Skip to main content
Olivier Beltrami
Legend
October 16, 2024
Question

Equivalent of IsTextFrame() for "unassigned content" frames

  • October 16, 2024
  • 1 reply
  • 232 views

Hello,

In my plugin, I use the following to determine if an object is a text frame or a graphic frame.

Utils<IPageItemTypeUtils>()->IsTextFrame(pageItemUIDRef)
Utils<IPageItemTypeUtils>()->IsGraphicFrame(pageItemUIDRef)
Utils<IPageItemTypeUtils>()->IsEmptyGraphicFrame(pageItemUIDRef)

But I cannot find a corresponding function for frames with "unassigned content". The best I can do is to see if it is a spline object and, if so, what type, using the path geometry by calling the 2 functions below (error-handling code removed for the sake of clarity):

InterfacePtr<IPathGeometry> pathGeometry(itemUIDRef, UseDefaultIID();
pathType = Utils<IPathUtils>()->WhichKindOfPageItem(pathGeometry);

 Are frames with "unassigned content" actually splines ?

Very best regards,

Olivier

This topic has been closed for replies.

1 reply

Community Expert
December 8, 2024

Maybe try to evaluate if it's a type of frame and if it's not then it's unassigned?

 

I'm not a scripter but trying to learn and I get there sometimes and other times my 30 line code can be replaced by a single line 

 

So here I go with a lame attempt but maybe it will give you an idea

 

InterfacePtr<IPathGeometry> pathGeometry(pageItemUIDRef, UseDefaultIID());
if (pathGeometry) {
    if (!Utils<IPageItemTypeUtils>()->IsTextFrame(pageItemUIDRef) &&
        !Utils<IPageItemTypeUtils>()->IsGraphicFrame(pageItemUIDRef) &&
        !Utils<IPageItemTypeUtils>()->IsEmptyGraphicFrame(pageItemUIDRef)) {
        
        InterfacePtr<IFrameType> frameType(pageItemUIDRef, UseDefaultIID());
        if (frameType && frameType->GetFrameContentType() == IFrameType::kFrameTypeEmpty) {
            // This is an unassigned content frame
        }
    }
}

 

 

 

Olivier Beltrami
Legend
December 8, 2024

@Eugene Tyson Thank you very much for the suggestion.