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 <[EMAIL PROTECTED]> 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,xController);
>        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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to