How to flow text from selected text frame?
Hi,
I have problem to flow a text from selected text frame to next.
The below code insert only on selected frame and not flow to nextframe
Please suggest any idea to go forward.
IDFile picFile;
picFile.SetPath(WideString(filepath.GrabCString()));
//parentUIDRef TextFrame UIDREF
InterfacePtr<IHierarchy> hierarchy(parentUIDRef, UseDefaultIID());
ASSERT(hierarchy);
if (!hierarchy) {
break;
}
InterfacePtr<ITransform> transform(parentUIDRef, UseDefaultIID());
ASSERT(transform);
if (transform == nil) {
break;
}
InterfacePtr<IGeometry> itemGeometry(parentUIDRef, IID_IGEOMETRY);
InterfacePtr<ITransform> pParentTransform(parentUIDRef, IID_ITRANSFORM); // get the Transform boss
PMRect pRC = itemGeometry->GetPathBoundingBox(InnerToPasteboardMatrix(pParentTransform));
PMPointList points(2);
PMPoint StartPoint = PMPoint(pRC.Left(), pRC.Top());
PMPoint EndPoint = PMPoint(pRC.Right(),pRC.Bottom());
points.push_back(StartPoint);
points.push_back(EndPoint);
// Create kImportAndPlaceCmdBoss.
InterfacePtr<ICommand> importAndPlaceCmd(CmdUtils::CreateCommand(kImportAndPlaceCmdBoss));
ASSERT(importAndPlaceCmd != nil);
if (importAndPlaceCmd == nil) {
break;
}
// Set up the command's data interfaces.
InterfacePtr<IPlacePIData> placePIData(importAndPlaceCmd, UseDefaultIID());
ASSERT(placePIData != nil);
if (placePIData == nil) {
break;
}
placePIData->Set(parentUIDRef, &points, kFalse);
URI tmpURI;
Utils<IURIUtils>()->IDFileToURI(picFile, tmpURI);
InterfacePtr<IImportResourceCmdData> importResourceCmdData(importAndPlaceCmd, IID_IIMPORTRESOURCECMDDATA); // no kDefaultIID
ASSERT(importResourceCmdData != nil);
if (importResourceCmdData == nil) {
break;
}
importResourceCmdData->Set(parentUIDRef.GetDataBase(), tmpURI, K2::kMinimalUI, kTrue, kTrue, kTrue, kFalse);
// Process the command.
if (CmdUtils::ProcessCommand(importAndPlaceCmd) != kSuccess) {
ASSERT_FAIL("kImportAndPlaceCmdBoss failed");
break;
}
// Get a reference to the created frame to the caller.
const UIDList& outItemList = importAndPlaceCmd->GetItemListReference();
ASSERT(outItemList.Length() > 0);
if (!(outItemList.Length() > 0)) {
break;
}
// Fit the frame to the text content we placed.
InterfacePtr<ICommand> fitFrameToContentCmd(CmdUtils::CreateCommand(kFitFrameToContentCmdBoss));
ASSERT(fitFrameToContentCmd != nil);
if (fitFrameToContentCmd == nil) {
break;
}
fitFrameToContentCmd->SetItemList(parentUIDRef);
if (CmdUtils::ProcessCommand(fitFrameToContentCmd) != kSuccess) {
ASSERT_FAIL("kFitFrameToContentCmdBoss failed");
break;
}