Page 1 of 1

[Solved] Java: mixing UNO proxies

Posted: Tue Mar 25, 2008 2:39 pm
by kavenchuk
Manual mixing (abstract example):

Code: Select all

public class com.sun.star.frame.Frame
                 extends com.sun.star.uno.Interface // nothing
                 implements com.sun.star.frame.XFrame,
                            com.sun.star.frame.XDispatchProvider,
                            com.sun.star.frame.XDispatchInformationProvider,
                            com.sun.star.frame.XDispatchProviderInterception,
                            com.sun.star.frame.XFramesSupplier
{
  private com.sun.star.frame.XFrame xFrame;
  private com.sun.star.frame.XDispatchProvider xDispatchProvider;
  private com.sun.star.frame.XDispatchInformationProvider xDispatchInformationProvider;
  private com.sun.star.frame.XDispatchProviderInterception xDispatchProviderInterception;
  private com.sun.star.frame.XFramesSupplier xFramesSupplier;

  public Frame()
  ...
  public Frame(com.sun.star.uno.XComponentContext context, com.sun.star.lang.XMultiComponentFactory xMCF)
  {
    xFrame = (com.sun.star.frame.XFrame)
       xMCF.createInstanceWithContext("com.sun.star.frame.XFrame", context);
  };

  // XFrame methods
  public com.sun.star.awt.XWindow getContainerWindow()
  {
    return xFrame.getContainerWindow();
  }
  ...
  // XDispatchProvider methods
  public com.sun.star.frame.XDispatch queryDispatch(com.sun.star.util.URL url, string targetFrameName, long searchFlags )
  {
    if (xDispatchProvider = null) {
        xDispatchProvider = com.sun.star.uno.UnoRuntime:queryInterface(com.sun.star.frame.XDispatchProvider.class, xFrame);
    }
    return xDispatchProvider.queryDispatch(url, targetFrameName, searchFlags);
  }
  ...
...
}
It is possible to do this automatically for all services?
Or anyone is made it already?

--
WBR, Yaroslav Kavenchuk.

Re: [SOLVED] Java: mixing UNO proxies

Posted: Wed Mar 26, 2008 4:37 pm
by kavenchuk
There is a error in the message.
The solution found - reflection&Kawa ;)