Copy link to clipboard
Copied
Hi,
I was wondering whether anyone knew how to get the UID list of inline/anchored objects within a text box?
I have written a script to get me the page items in the text box, but I was wondering whether there was a way to get these in C++? This is because while I get the UID of a graphic frame that is inline in the text frame, when I try to see whether it is 'valid' (i.e., the UID is in the document database) I find that it is not.
Initially in C++ I tried using the IHierarchy interface on the text frame and while this did return a child of the text box, it's page item type was not that of a graphic box and it had a different UID from that found using the page item script that I had written.
I have also tried to use GetUIDListOfInlines() from IFrameUtils, but I have not managed to get either the IMultiColumnTextFrame or the ITextFrameColumn interface from the text frame, so I am unable to use this method. Does anyone know a way to get either of these interfaces on a text frame or do they only apply to graphic frames?
Any help would be greatly appreciated!
Thanks,
Dan Tate.
Copy link to clipboard
Copied
In C++ the IHierarchy has some more levels of nesting.
To find out details, DebugClassUtils or IObjectModel::GetIDName() give clear text class names.
The SDK provides a "DebugWindow" application as a sink for TRACE output.
Regards,
Dirk
Copy link to clipboard
Copied
That's interesting, thanks, I'll give that a try.
Copy link to clipboard
Copied
Hello,
Have a look in SnpInspectLayoutModel.cpp. Look for InspectStoryInlines.
P.
Copy link to clipboard
Copied
Hi,
Thanks for the help, I can now get the inline items from the text frame. In case anyone else needs this, here's the code that I'm using (pPageItem is a UIDRef):
InterfacePtr<IHierarchy> pageItemHierarchy(pPageItem, UseDefaultIID());
if(pageItemHierarchy)
{
int32 nChildren = pageItemHierarchy->GetChildCount();
for (int32 child = 0; child < nChildren; ++child)
{
IDataBase *db=pPageItem.GetDataBase();
UIDRef childUIDRef(pPageItem.GetDataBase(), pageItemHierarchy->GetChildUID(child));
if (db->GetClass( childUIDRef.GetUID()) == kMultiColumnItemBoss)
{
UIDList InlineList(db);
InterfacePtr<IMultiColumnTextFrame>mcf( childUIDRef, UseDefaultIID() );
if(mcf)
{
Utils<IFrameUtils>()->GetUIDListOfInlines(mcf, false, &InlineList);
int32 inlineLen = InlineList.Length();
for (int32 j=0; j < inlineLen; ++j)
{
UIDRef inlineRef (childUIDRef.GetDataBase(), InlineList
AddProperPageItems(inlineRef, pResultList, pDocName);
}
}
}
}
}
Hope that's helpful!
Dan