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
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
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
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
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 ![]()
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??
North America
Europe, Middle East and Africa
Asia Pacific