|
|
| get the currently selected shaoe from
impress |

|
2007-01-04 13:43:50 |
Yes, get the current XController from the XModel and use the
XSelectionSupplier interface on it. This either returns a
single
XShape reference or a sequence of XShape for multi
selections.
Regards,
Christian
Madhan Ponnusamy wrote:
> Hi,
> i had inserted many shapes inside impress document
using XShapes and xShape
> interfaces....but now i need to get the currently
selected
> shape from the document..is that possible?
>
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
For additional commands, e-mail: dev-help api.openoffice.org
|
|
| get the currently selected shaoe from
impress |

|
2007-01-08 07:03:47 |
Thanks for your reply, i had created the code as u
told...but it is showing
null pointer exception..the code is
public void callPlayer(XScriptContext xSc) {
String name="";
XComponent xComponent = xSc.getDocument();
XModel xModel = (XModel)
UnoRuntime.queryInterface(XModel.class,
xComponent);
XController xController =
xModel.getCurrentController();
XSelectionSupplier xSelection = (XSelectionSupplier)
UnoRuntime.queryInterface(XSelectionSupplier.class,xControll
er);
Object temp = xSelection.getSelection();
XShape getShape = (XShape)
UnoRuntime.queryInterface(XShape.class,temp);
XPropertySet xShpProp = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class,
getShape);
try {
name =
xShpProp.getPropertyValue("Name").toString();
} catch (UnknownPropertyException ex) {
ex.printStackTrace();
} catch (WrappedTargetException ex) {
ex.printStackTrace();
}
}
i had inserted a image in impress and runned this macro it
is showing error
Type: NullPointer Exception..whats wrong?is the
selectionsupplier not
getting the shape
On 1/4/07, Christian Lippka <Christian.Lippka sun.com> wrote:
>
> Yes, get the current XController from the XModel and
use the
> XSelectionSupplier interface on it. This either returns
a single
> XShape reference or a sequence of XShape for multi
selections.
>
> Regards,
> Christian
>
> Madhan Ponnusamy wrote:
> > Hi,
> > i had inserted many shapes inside impress document
using XShapes and
> xShape
> > interfaces....but now i need to get the currently
selected
> > shape from the document..is that possible?
> >
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
> For additional commands, e-mail: dev-help api.openoffice.org
>
>
|
|
| get the currently selected shaoe from
impress |

|
2007-01-08 08:38:09 |
Hi there,
> Thanks for your reply, i had created the code as u
told...but it is
> showing
> null pointer exception..the code is
>
> public void callPlayer(XScriptContext xSc) {
> String name="";
> XComponent xComponent = xSc.getDocument();
>
> XModel xModel = (XModel)
UnoRuntime.queryInterface
> (XModel.class,
> xComponent);
> XController xController =
xModel.getCurrentController();
> XSelectionSupplier xSelection =
(XSelectionSupplier)
>
UnoRuntime.queryInterface(XSelectionSupplier.class,xControll
er);
> Object temp = xSelection.getSelection();
> XShape getShape = (XShape)
> UnoRuntime.queryInterface(XShape.class,temp);
>
> XPropertySet xShpProp = (XPropertySet)
>
UnoRuntime.queryInterface
> (XPropertySet.class,
> getShape);
> try {
> name =
xShpProp.getPropertyValue("Name").toString();
> } catch (UnknownPropertyException ex) {
> ex.printStackTrace();
> } catch (WrappedTargetException ex) {
> ex.printStackTrace();
> }
> }
> i had inserted a image in impress and runned this macro
it is
> showing error
> Type: NullPointer Exception..whats wrong?is the
selectionsupplier not
> getting the shape
the method getSelection returns a ShapesCollection.
Therefore you
could query this to css.container.XIndexAccess and then make
use of
the method getByIndex() to get your shape.
Hope that helps
Regards
Stephan
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
For additional commands, e-mail: dev-help api.openoffice.org
|
|
| get the currently selected shaoe from
impress |

|
2007-01-08 10:07:59 |
yes, I queryed with xshapes and used getbyindex method its
working
fine...now the problem is on click of the shape iam calling
macro which
should find which shape is clicked..for this getting the
selected shape is
not working correctly...so is there any other(interfaces)
way to find which
shape is clicked?
On 1/8/07, Stephan Wunderlich <stephan.wunderlich googlemail.com> wrote:
>
> Hi there,
>
> > Thanks for your reply, i had created the code as u
told...but it is
> > showing
> > null pointer exception..the code is
> >
> > public void callPlayer(XScriptContext xSc) {
> > String name="";
> > XComponent xComponent = xSc.getDocument();
> >
> > XModel xModel = (XModel)
UnoRuntime.queryInterface
> > (XModel.class,
> > xComponent);
> > XController xController =
xModel.getCurrentController();
> > XSelectionSupplier xSelection =
(XSelectionSupplier)
> >
UnoRuntime.queryInterface(XSelectionSupplier.class,xControll
er);
> > Object temp = xSelection.getSelection();
> > XShape getShape = (XShape)
> > UnoRuntime.queryInterface(XShape.class,temp);
> >
> > XPropertySet xShpProp = (XPropertySet)
> >
UnoRuntime.queryInterface
> > (XPropertySet.class,
> > getShape);
> > try {
> > name =
xShpProp.getPropertyValue("Name").toString();
> > } catch (UnknownPropertyException ex) {
> > ex.printStackTrace();
> > } catch (WrappedTargetException ex) {
> > ex.printStackTrace();
> > }
> > }
> > i had inserted a image in impress and runned this
macro it is
> > showing error
> > Type: NullPointer Exception..whats wrong?is the
selectionsupplier not
> > getting the shape
>
> the method getSelection returns a ShapesCollection.
Therefore you
> could query this to css.container.XIndexAccess and then
make use of
> the method getByIndex() to get your shape.
>
> Hope that helps
>
> Regards
>
> Stephan
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
> For additional commands, e-mail: dev-help api.openoffice.org
>
>
|
|
| get the currently selected shaoe from
impress |

|
2007-01-08 09:25:12 |
Hi there,
> yes, I queryed with xshapes and used getbyindex method
its working
> fine...now the problem is on click of the shape iam
calling macro
> which
> should find which shape is clicked..for this getting
the selected
> shape is
> not working correctly...so is there any
other(interfaces) way to
> find which
> shape is clicked?
what do you mean with "not working correctly" ?
If only one shape is selected the "getSelection()"
method will be a
collection of shapes that consists of only one shape.
If you mean by "clicking on it" that you have a
cursor inside the
shape afterwards, than the selection is indeed the ShapeText
... is
that what you meant by not working ?
Regards
Stephan
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
For additional commands, e-mail: dev-help api.openoffice.org
|
|
| get the currently selected shaoe from
impress |

|
2007-01-08 10:39:18 |
Hi Stephan,
getSelection is working correctly...that is not the
problem..i am clearly
descriping the scenario here
i had inserted a shape inside impress document and made
interaction(Onclick)
of the shape to call a macro. this macro contains the code
to get the
currently selected shape.
So if i click the shape the macro is called before the shape
got
selected...so the macro code cannot find the selected
shape...what iam
asking now is is there any other way get the shape which is
clicked.
On 1/8/07, Stephan Wunderlich <stephan.wunderlich googlemail.com> wrote:
>
> Hi there,
>
> what do you mean with "not working correctly"
?
> If only one shape is selected the
"getSelection()" method will be a
> collection of shapes that consists of only one shape.
> If you mean by "clicking on it" that you have
a cursor inside the
> shape afterwards, than the selection is indeed the
ShapeText ... is
> that what you meant by not working ?
>
> Regards
>
> Stephan
>
>
|
|
| get the currently selected shaoe from
impress |

|
2007-01-08 10:42:38 |
Hi there,
> getSelection is working correctly...that is not the
problem..i am
> clearly
> descriping the scenario here
> i had inserted a shape inside impress document and made
interaction
> (Onclick)
> of the shape to call a macro. this macro contains the
code to get the
> currently selected shape.
>
> So if i click the shape the macro is called before the
shape got
> selected...so the macro code cannot find the selected
shape...what iam
> asking now is is there any other way get the shape
which is clicked.
now that is a bit inconvenient
What I'd do is add a SelectionChangeListener ... when your
"Shape" is
clicked and an "selectionChanged" event should be
fired and you can
work with that.
In Basic something like the following should work when
binding the
"OnClick" event to the method "OnClick"
global xListener
Sub OnClick
xListener = createUNOListener
("cb_","com.sun.star.view.XSelectionChangeLis
tener")
xView = ThisComponent.currentController
xView.addSelectionChangeListener(xListener)
End Sub
sub cb_selectionChanged()
xView = ThisComponent.currentController
xSelection = xView.getSelection
REM "remove Listener"
xView.removeSelectionChangeListener(xListener)
if not isEmpty(xSelection) then
msgbox xSelection.dbg_supportedInterfaces
endif
end sub
Hope that helps
Regards
Stephan
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
For additional commands, e-mail: dev-help api.openoffice.org
|
|
| get the currently selected shaoe from
impress |

|
2007-01-08 12:20:57 |
Hi Stephan,
whether the getselection works when the shape is clicked
during slide
show..i.e) when the shape is linked to macro and working
fine in normal
impress document..when the slideshow is started is that
possible to get
current documents and shape selected.
On 1/8/07, Stephan Wunderlich <stephan.wunderlich googlemail.com> wrote:
>
> Hi there,
>
> now that is a bit inconvenient
> What I'd do is add a SelectionChangeListener ... when
your "Shape" is
> clicked and an "selectionChanged" event
should be fired and you can
> work with that.
> In Basic something like the following should work when
binding the
> "OnClick" event to the method
"OnClick"
>
> global xListener
>
> Sub OnClick
> xListener = createUNOListener
>
("cb_","com.sun.star.view.XSelectionChangeLis
tener")
> xView = ThisComponent.currentController
> xView.addSelectionChangeListener(xListener)
> End Sub
>
> sub cb_selectionChanged()
> xView = ThisComponent.currentController
> xSelection = xView.getSelection
>
> REM "remove Listener"
> xView.removeSelectionChangeListener(xListener)
>
> if not isEmpty(xSelection) then
> msgbox xSelection.dbg_supportedInterfaces
> endif
> end sub
>
> Hope that helps
>
> Regards
>
> Stephan
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
> For additional commands, e-mail: dev-help api.openoffice.org
>
>
|
|
| get the currently selected shaoe from
impress |

|
2007-01-08 13:22:04 |
> whether the getselection works when the shape is
clicked during slide
> show..i.e) when the shape is linked to macro and
working fine in
> normal
> impress document..when the slideshow is started is that
possible to
> get
> current documents and shape selected.
in presentation view nothing is selected and so the
selection changed
event will most likely not be fired.
I suppose the easiest way to handle this would be to create
one
method for each shape where the shape's name is handed over
to a
method that does what has to be done with all shapes.
Somethings like
sub shape1_click
doShapeStuff("Shape1")
end sub
sub doShapeStuff(ShapeName as String)
xShape=ThisComponent.DrawPages(0).getByName(ShapeName)
'...
' do something brilliant
'...
end sub
Hope that helps
Regards
Stephan
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
For additional commands, e-mail: dev-help api.openoffice.org
|
|
| get the currently selected shaoe from
impress |

|
1969-12-31 18:00:00 |
> whether the getselection works when the shape is
clicked during slide
> show..i.e) when the shape is linked to macro and
working fine in
> normal
> impress document..when the slideshow is started is that
possible to
> get
> current documents and shape selected.
in presentation view nothing is selected and so the
selection changed
event will most likely not be fired.
I suppose the easiest way to handle this would be to create
one
method for each shape where the shape's name is handed over
to a
method that does what has to be done with all shapes.
Somethings like
sub shape1_click
doShapeStuff("Shape1")
end sub
sub doShapeStuff(ShapeName as String)
xShape=ThisComponent.DrawPages(0).getByName(ShapeName)
'...
' do something brilliant
'...
end sub
Hope that helps
Regards
Stephan
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
For additional commands, e-mail: dev-help api.openoffice.org
|
|