Skip navigation
suren_tringer
Currently Being Moderated

Issue with find out the pageItem type

Mar 8, 2012 6:58 AM

Tags: #indesign #plugin #plug-in #indesign_cs5

Hi all,

i am trying to find out the all pageitem's type and its data on a document .i just use the following code to find out the pageitem's type .

 

InterfacePtr<ISpreadList> spreadList(document, UseDefaultIID());

        ASSERT(spreadList);

        if(!spreadList) {

            break;

        }

       

 

        UIDList frameList(database);

        int32 spreadCount = spreadList->GetSpreadCount();

        for (int32 spreadIndex = 0; spreadIndex < spreadCount; spreadIndex++ )

        {

            UIDRef spreadUIDRef(database, spreadList->GetNthSpreadUID(spreadIndex));

            InterfacePtr<ISpread> spread(spreadUIDRef, UseDefaultIID());

            ASSERT(spread);

            if(!spread) {

                break;

            }

           

 

            int32 numberOfPages = spread->GetNumPages();

            for (int32 nPage = 0; nPage < numberOfPages; nPage++ )

            {

                UIDList pageItemList(database);

                spread->GetItemsOnPage

                (

                 nPage,

                 &pageItemList,

                 kFalse,

                 kFalse 

                 );

               

 

                bool16 hasContent;

                int32 pageItemListLength = pageItemList.Length();

                for (int32 j = 0; j < pageItemListLength; j++ )

                {

                    UIDRef pageItemRef = pageItemList.GetRef(j);

                    InterfacePtr<IGraphicFrameData> graphicFrameData(pageItemRef, UseDefaultIID());

                    hasContent =graphicFrameData->HasContent();

                    InterfacePtr<IPathGeometry> pathGeometry(pageItemRef,UseDefaultIID());

                    if (pathGeometry != nil)

                    {

                       PMPageItemType pathType = Utils<IPathUtils>()->WhichKindOfPageItem(pathGeometry); //issue is this statement simply break up the execution

                        switch (pathType)

                        {

                            ......

                             .......

                        }

                    }

                   

 

                }

            }    

        }

     

 

please can any one help me? 

 
Replies
  • Currently Being Moderated
    Mar 8, 2012 7:27 AM   in reply to suren_tringer

    Hi,

     

    did you try it with IPageItemTypeUtils instead of IPathUtils?

     

    Markus

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 9, 2012 12:16 AM   in reply to suren_tringer

    You need to check the class of UIDRef.

    Is the class kGroupItemBoss, kSplineItemBoss or others?

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 15, 2012 1:13 AM   in reply to suren_tringer

    This might help.

     

      InterfacePtr<IGraphicFrameData> graphicFrameData(content, UseDefaultIID());

    InterfacePtr<IGeometry> frameGeom(graphicFrameData, UseDefaultIID());

    PMMatrix inner2parent = ::InnerToPasteboardMatrix(frameGeom);

    PMRect r = frameGeom->GetStrokeBoundingBox(inner2parent);

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 19, 2012 7:16 AM   in reply to suren_tringer

    Indeed.

     

                                            IDataBase* db = ::GetDataBase(doc);

                                            UIDRef content( db, uid2Test);

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 19, 2012 7:40 AM   in reply to suren_tringer

    Have a look in  BscMEInvertFacade.cpp

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points