Hello Martin, On Sunday 23 May 2010, 15:17, Martin Dobiasch wrote: > 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?
an Add-In (written in any language that can implement UNO components) provides new functions that can be used in OOo Calc cells just like any other built-in function. OOo Calc can also look for functions written in OOo Basic, placed in OOo Basic Standard libraries, but not in Basic libraries provided by extensions. So, if you want your extension to provide new functions to OOo Calc, you must implement an OOo Calc Add-In. If you also want to implement an Add-On, you can do both things in the same extension, even in the same JAR file: design a Java class for the component implementing the ProtocolHandler, and another one for the Calc Add-in component; that is 2 UNO components in one JAR file. This is possible and good practice (IMHO implementing both the Add-In and the ProtocolHandler in the same component is no good idea: both components need to have their own lifetime cycle, are instantiated by different implementations, etc.) > My Problem within the addin: I need access to the SpreadsheetDocument or > access to one specific sheet (specified by name). access to one spreadsheet is no good practice for an Add-In: it only provides a function that can take some parameters and return values. Why do you need access to one sheet? Please explain, there may be another solution for your use case. If you want the result to appear in a specific sheet, it is the user who has to put the result returned by your function on that specific sheet, just like s/he does with built-in functions. If you want to read data from a specific sheet, it is also up to the user to send the data as parameter to your function. > I've added as you suggested XPropertySet as Parameter. The documentation > Says its an interface to the SpreadsheetDocument. the XPropertySet is there just in case your Add-In function needs to query some specific settings (like the locale, or formatting settings), but IMHO is no good practice to modify the document. Your Add-In function is just a function that processes the data it receives and returns some values. Even modifying the css.table.XCellRange the function can receive may be questionable. > But how do I query for it? just like you do with any other object in OOo API Java language binding: use UnoRuntime.queryInterface and check if the returned object is not null. But my advice is not to modify the XSpreadsheetDocument from within the Add- In. Use XPropertySet just to query for settings. There may be some other solution that satisfies your needs. Regards -- Ariel Constenla-Haile La Plata, Argentina
signature.asc
Description: This is a digitally signed message part.
