Okay. Thanks for your help. What my code should be: AddOn and AddIn as the extension im working on needs both. One way to avoid this would be to have the addin replaced by some Basic-Code. Is this possible?
My Problem within the addin: I need access to the SpreadsheetDocument or access to one specific sheet (specified by name). I've added as you suggested XPropertySet as Parameter. The documentation Says its an interface to the SpreadsheetDocument. But how do I query for it? -----Ursprüngliche Nachricht----- Von: Ariel Constenla-Haile [mailto:[email protected]] Gesendet: Samstag, 22. Mai 2010 21:40 An: OpenOffice.org API Dev List Betreff: Re: AW: AW: [api-dev] java-macro: Not able to access CurrentComponent? On Saturday 22 May 2010, 16:30, Ariel Constenla-Haile wrote: > Hello Martin, > > On Saturday 22 May 2010, 15:28, Martin Dobiasch wrote: > > Okay. My Mistake. Its a Uno Component which provides add in for calc > > (I used the *M....oft* Word for this) > > So as it is java it seems that I don't have access to XScriptContext. > > now I am confused: is it an ADD-IN for Calc, or an ADD-ON? > It seems to implement a css.frame.ProtocolHandler, so I assume the last > one. > > Please notice that I'm not a lunatic asking you for technical correctness > in your expressions, it is just that both a Calc Add-In and an Add-On are > UNO components, that are implemented in a different way, so they have > access to underlying document in a very different way. > So in order to help, we must know what you're trying to achieve. > > In short, for your question "Not able to access CurrentComponent?", if it > is a ProtocolHandler ADD-ON, you access the document model from the > css.frame.Frame you're initialized with, via the css.frame.Controller: just in case that was too cryptic, your ProtocolHandler implementation implements com.sun.star.lang.XInitialization, its method can be implemented this way to get the information you need: // com.sun.star.lang.XInitialization: public void initialize(Object[] aArguments) throws com.sun.star.uno.Exception { if ( aArguments.length > 0 ) { m_xFrame = (com.sun.star.frame.XFrame)UnoRuntime.queryInterface( com.sun.star.frame.XFrame.class, aArguments[0]); if ( m_xFrame != null ){ m_xController = m_xFrame.getController(); m_xContainerWindow = m_xFrame.getContainerWindow(); m_xComponentWindow = m_xFrame.getComponentWindow(); if ( m_xController != null ){ m_xModel = m_xController.getModel(); if ( m_xModel != null ){ m_xCurrentComponent = (XComponent) UnoRuntime.queryInterface( XComponent.class, m_xModel); } } } } } where /** * m_xFrame points to the frame context in which this handler runs, * is set in initialize() */ private com.sun.star.frame.XFrame m_xFrame; private com.sun.star.frame.XModel m_xModel; private com.sun.star.lang.XComponent m_xCurrentComponent; private com.sun.star.frame.XController m_xController; private com.sun.star.frame.XModuleManager m_xModuleManager; private com.sun.star.awt.XWindow m_xContainerWindow; private com.sun.star.awt.XWindow m_xComponentWindow; it's all explained in http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Co mponent/Getting_Frames,_Controllers_and_Models_from_Each_Other Regards -- Ariel Constenla-Haile La Plata, Argentina --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
