11 Replies Latest reply: Mar 21, 2012 4:16 AM by suren_tringer RSS

    Issue with find out the pageItem type

    suren_tringer Community Member

      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? 

        • 1. Re: Issue with find out the pageItem type
          mfreitag Community Member

          Hi,

           

          did you try it with IPageItemTypeUtils instead of IPathUtils?

           

          Markus

          • 2. Re: Issue with find out the pageItem type
            suren_tringer Community Member

            Hi Markus , thanks for your reply ,

             

            i had tried with IPageItemTypeUtils also , still i get same issue .is there anything wrong that the way of getting pageitem's UIDRef

            • 3. Re: Issue with find out the pageItem type
              suren_tringer Community Member

              any help please

              • 4. Re: Issue with find out the pageItem type
                Norio Kawamura Community Member

                You need to check the class of UIDRef.

                Is the class kGroupItemBoss, kSplineItemBoss or others?

                • 5. Re: Issue with find out the pageItem type
                  suren_tringer Community Member

                  Hi

                   

                  thanks for your reply(Norio,Markus)

                   

                  as i follow your suggestion i am able to get all the page item and its type using its uidref .now i want to get the frame of that page item.

                   

                  can you tell me how do i get the frame of a pageitem(i have page item's uidref) ?

                   

                  thanks

                   

                  Message was edited by: suren_tringer

                  • 6. Re: Issue with find out the pageItem type
                    Pickory Community Member

                    This might help.

                     

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

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

                    PMMatrix inner2parent = ::InnerToPasteboardMatrix(frameGeom);

                    PMRect r = frameGeom->GetStrokeBoundingBox(inner2parent);

                    • 7. Re: Issue with find out the pageItem type
                      suren_tringer Community Member

                      Hi Pickory ,

                       

                      Thanks for your reply ,

                       

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

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

                      PMMatrix inner2parent = ::InnerToPasteboardMatrix(frameGeom);

                      PMRect r = frameGeom->GetStrokeBoundingBox(inner2parent);

                       

                       

                      Content = ? (is pageitem's uidref)

                      • 8. Re: Issue with find out the pageItem type
                        Pickory Community Member

                        Indeed.

                         

                                                                IDataBase* db = ::GetDataBase(doc);

                                                                UIDRef content( db, uid2Test);

                        • 9. Re: Issue with find out the pageItem type
                          suren_tringer Community Member

                          Hi Pickory

                           

                          i have tried the following code ,but it doesnt works

                           

                          UIDList pageItemList(database);

                                                                  spread->GetItemsOnPage

                                                                  (

                                                                   nPage,

                                                                   &pageItemList,

                                                                   kFalse,

                                                                   kFalse

                                                                   );

                           

                                            bool16 hasContent;

                                                                  int32 pageItemListLength = pageItemList.Length();

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

                                                                  {

                                                                            UIDRef content = pageItemList.GetRef(j);

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

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

                                                                  PMMatrix inner2parent = ::InnerToPasteboardMatrix(frameGeom);

                                              PMRect   r = frameGeom->GetStrokeBoundingBox(inner2parent);

                           

                                                                  }

                           

                          any thing need to be included?

                          • 10. Re: Issue with find out the pageItem type
                            Pickory Community Member

                            Have a look in  BscMEInvertFacade.cpp

                            • 11. Re: Issue with find out the pageItem type
                              suren_tringer Community Member

                              Hi all

                               

                              i am able to get page item's frame but it something un releated to original frame.(i am not sure whether i need to tranform it to get page item's frame corresponding to the page area)

                               

                              please help me !