Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to check selected content on page

Community Beginner ,
Jan 09, 2012 Jan 09, 2012

Hi all,

I would like to create plugin that works with selected content on document. Plugin should do following: user selects some frame, graphic content that is placed on document. Than he opens my plugin and click on button. After button click I must check if something is selected (it would be only graphic items, not table and text), then I would like to get information (on which page is placed, is in the frame picture, dimension of frame...) from selected item. So I would like to ask you what is the best approach for that.

Right now I have selection manager and from that I get ILayoutSelectionSuite and dont know what to do next, I have been looking thru adobe documents, but didnt find any article about it...

thx

TOPICS
SDK
2.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 09, 2012 Jan 09, 2012

You will have to create your own selection suite and then get the selected page items. Once you get the selected pageitems UIDRef you can check for all the properties like its type, page it lies on etc. You will have to look into the sdk for different methods to get this information.

Manan Joshi

 

- Efficient InDesign Solutions -

MetaDesign Solutions

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 09, 2012 Jan 09, 2012

Do you think, that following stucture do the magic? Screen Shot 2012-01-09 at 4.29.19 PM.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 09, 2012 Jan 09, 2012

Yes this looks right on track, you need to create ASB and CSB for your selection suites and also make their entries in the fr file.

In your case for layout selection you will place the ASB entry as an addin in the kIntegratorSuiteBoss and the CSB as addin in the kLayoutSuiteBoss class.

Manan Joshi

- Efficient InDesign Solutions -

MetaDesign Solutions

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 10, 2012 Jan 10, 2012

Hi,

thanks for all info.

all done, but now Iam searching thru documentation looking for functions, methods from that i can get desired information about selection, so far no luck...

Iam wondering, how to test if my selection work...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 10, 2012 Jan 10, 2012

Hi Ondrej

What kind of information do you need? For Layout Selection Boss you can get:

      - Item dimetions with IGeometry

     - type of item with IPageItemTypeUtils

      - item position in hierarchy with IPageItemTypeUtils

and much more.

Please specify what information do you need.

Regards

Bartek

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 10, 2012 Jan 10, 2012

Hi Cropas,

I need:

  • page on which is item placed
  • dimensions of item
  • content (image name that is placed into frame)

that is all for now, I hope

thx

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 10, 2012 Jan 10, 2012

For  pageitem dimension you can use the IGeometry interface of the pageitem, for the image name you will have to traverse the hierarchy of the pageitem to find whether it contains any child or not.

And to test whether your selection works or not query your selection interface from the active selection and call methods you have written inside it to see if you get the correct results.

Manan Joshi

- Efficient InDesign Solutions -

MetaDesign Solutions

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 10, 2012 Jan 10, 2012

Hi all,

I have a little problem with calling my selection suite. I have following hierarchy:

Screen Shot 2012-01-11 at 7.48.41 AM.png

In STButtonAction I handle button clicks, when user select button I would like to chech is is something selected and if yes, than I would like to get from that selection some information about it. I placed in ASB virtual method called MyTestMethod(ISelectionManager *myManager), in Layout CSB I wrote its implementation:

void STSuiteLayoutCSB::MyTestMethod(ISelectionManager *myManager)

{

  InterfacePtr<IGeometrySuite> itemGeometry(myManager, UseDefaultIID());

          PMRect bounds = itemGeometry->GetSelectionBounds() ;//what to use here??

  cout << "Something just happend...";

}

Now I have 2 problems, first: when I get Interface pointer to IGeometry suite, it dont know its method GetSelectionBounds (I have noticed, that this method is virtual, so It does nothnig and somewhere must be its body writen...) any tips, how to get this working??

And my second problem is, How to call my suite?? When I try something like this:

Utils<ISelectionUtils> iSelectionUtils;

          if (iSelectionUtils != nil) {

                         ISelectionManager* iSelectionManager = iSelectionUtils->GetActiveSelection();

                         if (iSelectionManager != nil)

                              {

                                             InterfacePtr<ISTSuite> iLayoutSuite(iSelectionManager, UseDefaultIID());

                                             if (iLayoutSuite !=nil)

                                                  {

                                                                 iLayoutSuite->myMethod(iSelectionManager);

                                                  }

                    }

It tells me that, ISTSuite was not declared in this scope... I think, that I am doing something wrong...

thx for any tips

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 12, 2012 Jan 12, 2012

Hi,

I read again in documentation about selections and found some errors, that I made. I have made some refractoring of my code. So right now I have following:

in STSuite.h file:

added definition of method, that I would like to use from IGeometrySuite - SelectionHasHeight ...

in STSuiteASB.cpp file:

added declaration and impl of that method, basicly it is only:

bool16 STSuiteASB::SelecitonHasWidth() const

{

          return (AnyCSBSupports(make_functor(&ISTSuite::SelecitonHasWidth), (this), IID_ISTSUITE));

}

and finally in STSLayoutCSB:

bool16 STSuiteLayoutCSB::SelecitonHasWidth() const

{

  bool16 result = kFalse;

  InterfacePtr<IGeometrySuite> mySuite(this, UseDefaultIID());

  result = mySuite->SelectionHasWidth();

 

  return result;

}

When I create new document in indesign, create selection, nothing happens...

So I would like to ask you all, how to make this code working??

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 16, 2012 Jan 16, 2012

Hello, still anybody to answer??

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 16, 2012 Jan 16, 2012

Hi,

Try to read the chapter called *Selection-Working with selection suites provided by the API-Calling a selection suite* in the Solutions.pdf.

//p

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 16, 2012 Jan 16, 2012
LATEST

Hi, I have already read that. I understand how to use and how to write that code, but my key problem is where should I write that code? Should it be in implementation of selection, or should it be on place where I would like to handle selections (my guess is the second one)...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines