Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Do you think, that following stucture do the magic?
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hi Cropas,
I need:
that is all for now, I hope
thx
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hi all,
I have a little problem with calling my selection suite. I have following hierarchy:
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
Copy link to clipboard
Copied
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??
Copy link to clipboard
Copied
Hello, still anybody to answer??
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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)...
Find more inspiration, events, and resources on the new Adobe Community
Explore Now