I want to parser a document and trigger a XDispatchHelper at certain
points. I need the XModel object for doing it but when I get to this
line:
XModel xModel = (XModel)UnoRuntime.queryInterface(XModel.class,field);
xModel is null.... What am I doing wrong??
Joan
XEnumeration enumeration = xEnumeratedFields.createEnumeration();
while (enumeration.hasMoreElements())
{
Object field = enumeration.nextElement();
XDependentTextField dependentTextField =
(XDependentTextField)UnoRuntime.queryInterface(XDependentTextField.class
, field);
// This is null, why???
XModel xModel =
(XModel)UnoRuntime.queryInterface(XModel.class,field);
XController xController = xModel.getCurrentController();
// Getting the Dispatch Provider
XFrame xFrame = xController.getFrame();
XDispatchProvider xDispatchProvider =
(XDispatchProvider)UnoRuntime.queryInterface (XDispatchProvider.class,
xFrame);
// Getting the Dispatch Helper
XMultiServiceFactory xMultiServiceManager =
(XMultiServiceFactory)UnoRuntime.queryInterface(
XMultiServiceFactory.class,mxRemoteContext.getServiceManager());
Object oDispatchHelper = null;
try{
oDispatchHelper =
xMultiServiceManager.createInstance("com.sun.star.frame.DispatchHelper")
;
}
catch(com.sun.star.uno.Exception e)
{
System.out.println("Can't get the Dispatch Helper
Object...");
}
XDispatchHelper xDispatchHelper =
(XDispatchHelper)UnoRuntime.queryInterface(XDispatchHelper.class,
oDispatchHelper);
// Executing the commandURL
xDispatchHelper.executeDispatch(xDispatchProvider,".uno:InsertField","_s
elf",0,saveProperties);
This e-mail may contain confidential or privileged information. Any unauthorised
copying, use or distribution of this information is strictly prohibited.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]