> Hello,
> I have a question about my Writer add-on
> is this code right?
>
> XComponentContext m_xCmpCtx;
> ...
>
>         XTextDocument xTextDocument = null;
>         xTextDocument = (XTextDocument) UnoRuntime.queryInterface (
>               XTextDocument.class,
>               m_xCmpCtx.getServiceManager().createInstanceWithContext
>               ("com.sun.star.text.TextDocument",  m_xCmpCtx));
>
>         XText xText = null;
>         xText = xTextDocument.getText();
>
>
> // The problem is that when I later call:
> xText.getString ();
>
> // I get:
> com.sun.star.uno.RuntimeException: this object is invalid
>             at com.sun.star.bridges.jni_uno.JNI_proxy.dispatch_call(Native
> Method)
>             at
> com.sun.star.bridges.jni_uno.JNI_proxy.invoke(JNI_proxy.java:204)
>             at $Proxy17.getString(Unknown Source)
>
> // when I try to call xText.setString(), the Writer coloses abnormally
> //
>
>
> Where could be the problem?
> (I am using OpenOffice 2.0 beta and the code is in an add-on)
>
> Thank you very much in advance
> George
>

OK I found in OfficeWriterBean :

    public XTextDocument getTextDocument ()
    {
      XTextDocument xTextDocument = null;
      XModel xModel = null;

      if (m_xFrame.getController() != null)
         xModel = m_xFrame.getController().getModel();

      if (xModel != null)
        xTextDocument =  (XTextDocument) UnoRuntime.queryInterface
(XTextDocument.class, xModel);
      return xTextDocument;
    }

and it works fine :)
Thank you
George


____________________________________________________________________
http://www.freemail.gr - δωρεάν υπηρεσία ηλεκτρονικού ταχυδρομείου.
http://www.freemail.gr - free email service for the Greek-speaking.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to