Skip navigation
Ondrej Vyhlidal
Currently Being Moderated

Questions about Selections

Jan 25, 2012 4:00 AM

Tags: #indesign #plugin #panel #selction

Hi all,

I have some unsolved questions about selections, I have panel, ASB, CSB, layoutSelectionBoss and so on:

  1. How is my selection called? What steps I need to do for that?
  2. How to get data from selection? There shlould be defined abstract methods in ASB, and its real implementation in CSB or eg. LayoutSelectionBoss?

Thank you in advice

 
Replies
  • Currently Being Moderated
    Jan 29, 2012 9:32 PM   in reply to Ondrej Vyhlidal

    In order to create your own selection suites you need to follow the following steps.

     

    1. Create an interface for the selection suite and place it as an AddIn in the IntegratorSuite and the suite boss that you need to extend. Like for layout you could use the kLayoutSuiteBoss.

     

    2. The implementation for the interface added in the IntegratorSuite will be the ASB implementation, the code for this is pretty much templated, refer SDK sample code to have an idea about it.

     

    3. The implementation for the interface added in the other suite boss will be the CSB implementation. Inside this class you can write the code specfic to your needs.

     

    Regading the call on this code and how do you get your code executed, first you will have to get the selection manager interface which is generally obtained from the activeselection but there are other ways too refer the SDK for it. From this selectionmanager interface query the interface of your suite and if your suite is available you can call it's method else you will get a nill pointer.

     

    I think this should make it pretty much clear, for more clarifications refer the SDK samples and the programming guide.

     

    Manan Joshi

     

    - Efficient InDesign Solutions -

    MetaDesign Solutions

    http://metadesignsolutions.com/services/indesign-development.php

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 13, 2012 1:55 AM   in reply to Ondrej Vyhlidal

    This might help.

     

              InterfacePtr<IGeometry> geometry(itemToModify, UseDefaultIID());

              ASSERT(geometry);

              if (!geometry) {

      return;

              }

              PMMatrix inner2parent = ::InnerToParentMatrix(geometry);

              PMRect boundsInParentCoords = geometry->GetStrokeBoundingBox(inner2parent);

     

    P.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 13, 2012 4:13 AM   in reply to Ondrej Vyhlidal

    Look in TransformUtils.h, the InnerToParentMatrix worked for my application but you might want InnerToPasteboardMatrix. Once you have got your PMRect in the right coordinates you can use the Height from the PMRect.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 13, 2012 11:06 PM   in reply to Ondrej Vyhlidal

    What exactly do you want, from what i see from Pickory's code is you are trying to get the height of the bounding box of the current selection in the layout. For ex if you have three image boxes selected you need the height of the bounding box that encloses all these image boxes. Kindly clarify so that we can provide better pointers for the solution.

     

    Manan Joshi

     

    - Efficient InDesign Solutions -

    MetaDesign Solutions

    http://metadesignsolutions.com/services/indesign-development.php

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 14, 2012 7:47 AM   in reply to Ondrej Vyhlidal

    if you wrote the code in accordance to what Pickory had hinted then the PMRect itself has the the top() method that will give you the X coordinate of the top left corner

     

    And for the 2nd question you will can use the method  "GetOwnerPageUID" in the "ILayoutUtils", but this method will return the UID of the spread if the pageitem does not lie on a page so make a check for that too.

     

     

    Manan Joshi

     

    - Efficient InDesign Solutions -

    MetaDesign Solutions

    http://metadesignsolutions.com/services/indesign-development.php

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 15, 2012 1:53 AM   in reply to Ondrej Vyhlidal

    i think you need to write ::InnerToParentMatrix instead of InnerToParentMatrix.

     

    Manan Joshi

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 15, 2012 2:11 AM   in reply to Ondrej Vyhlidal

    You should call it like

    iLayoutUtils->GetOwnerPageUID(IHierarchy, kFalse);

     

    Where IHierarchy is the interface of the pageitem, if you use querychild then you are moving into the pageitem like for ex in to the image in a pageitem.

     

    Manan Joshi

     

    - Efficient InDesign Solutions -

    MetaDesign Solutions

    http://metadesignsolutions.com/services/indesign-development.php


     
    |
    Mark as:
  • Currently Being Moderated
    Feb 15, 2012 4:43 AM   in reply to Ondrej Vyhlidal

    This works for me fine, maybe the interface that you are sending is not correct. UID 0 represents the document if i remember correctly. See the code that you are using to get the IHierarchy interface.

     

     

    Manan Joshi

     

    - Efficient InDesign Solutions -

    MetaDesign Solutions

    http://metadesignsolutions.com/services/indesign-development.php

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 15, 2012 5:33 AM   in reply to Ondrej Vyhlidal

    This would return a null interface as you did not query the interface from any boss class, you need to get this interface from the selected pageitem's boss class.

     

    Manan Joshi

     

    - Efficient InDesign Solutions -

    MetaDesign Solutions

    http://metadesignsolutions.com/services/indesign-development.php

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 15, 2012 10:16 PM   in reply to Ondrej Vyhlidal

    If you are writing this code inside the CSB method then you can query for "ILayoutTarget" interface that has "GetUIDList" method which will give you the UIDList of the selected page item. From this you can get the UIDRef of the selected pageitem, which can be quried to get the correct iHierarchy interface.

     

    If you are writing this code outside CSB method then write a method in the CSB to get the UIDRef of the selected page item and do as before.

    Hope this is not very confusing.

     

    Manan Joshi

     

    - Efficient InDesign Solutions -

    MetaDesign Solutions

    http://metadesignsolutions.com/services/indesign-development.php

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 16, 2012 12:08 AM   in reply to Ondrej Vyhlidal

    This works for me fine, don't you get the correct no of selected items? What is the result of GetPageUID. You could also check the boss class of the IHierarchy interface you are using to be sure that it is indeed of the pageitem.

     

    Manan Joshi

     
    |
    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