[api-dev] Re: Open Ended Arrays or Similar Data Structures
Hello Hal, On Saturday 18 June 2011, 23:35, Hal Vaughan wrote: Is there any way, in OOo BASIC, to create something like a vector or linked list or anything that gives me something like an array that I can keep adding elements to? (Everything I found with an array indicated it has to be declared with a set number of members.) search in the OOo help ReDim Sub Test_Array Dim arr(0) as Integer arr(0) = 0 Dim i% For i = 1 To 10 ReDim Preserve arr(i) arr(i) = i Next End Sub Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
[api-dev] Re: Adding Items to a Sub-Menu
Hello Hal, On Wednesday 15 June 2011, 02:05, Hal Vaughan wrote: I haven't been using the API for a while and I'm working on a macros in OO Basic. From what I remember, to add things to a sub menu, I have to do that by hand. Am I wrong? Is there a way, using OO Basic to add items to a sub menu? I'm creating a sticky-note program that will let me make notes that are attached to a document. They're stored in the document text fields. I'd like to be able to, when a note is created, add a menu item with the note title to a sub-menu I'm creating. Also, of course, if the note is deleted, I'd like to remove that item from the menu. The hard part is I only want those sub-menu items available when that document window is selected. Is that do-able without going through a nightmare? you need to develop a UNO component implementing a PopupMenuController, impossible in OOo Basic, you must code in Java, C++ or Python. Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
[api-dev] Re: Invoking macros via toolbar items: where does the argument come from ?
Hello Rony, On Wednesday 25 May 2011, 07:25, Rony G. Flatscher wrote: Hi there, if executing a macro via Tools - Macro - Run there is no argument supplied to the script. However, if running the same macro via a toolbar item, an argument is supplied, which seems to have always a value of 0 (false?). Where does this argument come from and what is its purpose, where can one find the documentation for this? there is an explanation in http://openoffice.org/bugzilla/show_bug.cgi?id=85298#c3 Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
[api-dev] Re: MailMerge settings
Hello Paolo, On Wednesday 11 May 2011, 13:33, Paolo Mantovani wrote: Hallo, I need to change (via API) the database bound to a given document. In practice I need to perform via API the same operation that you normally do via the menu Modify-Change Database. In Writer I see Edit - Exchange Database I tried with: oSet = oDoc.createInstance(com.sun.star.text.DocumentSettings) oSet.CurrentDatabaseDataSource = newsource oSet.CurrentDatabaseCommandType = com.sun.star.sdb.CommandType.TABLE oSet.CurrentDatabaseCommand = newtable In fact, this *does* exchange the database, just see the dialog in the Edit - Exchange Database menu, at the bottom you'll see that settings are changed and stored; for example, I had Database1.Contacts and after executing your code I see in this dialog Database applied to document: newsource.newtable Changing the document settings does not even test if there is actually a DB and a table with the given names. It is the client code responsibility to check this and register the new data source in case the test fails. But this does not affect the database fieldmasters in the document, that are still pointing to the old datasource. Updating/refreshing the fields as Fernand suggested does not work; as far as I could understand reading the implementation, you have to instantiate new field masters for your new data source (because Writer does not seem to create them until they are in use, that is, until the user really inserts a field), and then update all the fields in the documents iterating on the text field collection (not via XRefreshable.refresh()). I haven't test any of these, but it seems to be what happens internally when .uno:ChangeDatabaseField is dispatched: * the slot id FN_CHANGE_DBFIELD is executed by the SwBaseShell, void SwBaseShell::ExecField http://svn.services.openoffice.org/opengrok/xref/DEV300_m106/sw/source/ui/shells/basesh.cxx#2914 * the dialog impl. is SwChangeDBDlg http://svn.services.openoffice.org/opengrok/xref/DEV300_m106/sw/source/ui/inc/changedb.hxx http://svn.services.openoffice.org/opengrok/xref/DEV300_m106/sw/source/ui/fldui/changedb.cxx You can see how two different things happen there: a) changing the data source, will lead to void SwDoc::ChgDBData(const SwDBData rNewData) http://svn.services.openoffice.org/opengrok/xref/DEV300_m106/sw/source/core/doc/doc.cxx#682 b) updating the document's field will lead to void SwDoc::ChangeDBFields( const SvStringsDtor rOldNames, const String rNewName ) http://svn.services.openoffice.org/opengrok/xref/DEV300_m106/sw/source/core/doc/docfld.cxx#1908 Using the API to change the com.sun.star.text.DocumentSettings does the same as (a), it calls SwDoc::ChgDBData http://svn.services.openoffice.org/opengrok/xref/DEV300_m106/sw/source/ui/uno/SwXDocumentSettings.cxx#465 It seems that I'm missing something. the above shows you are missing (b), it is not enough to change the com.sun.star.text.DocumentSettings, you have to instantiate the field masters, and modify the existing fields. Note that SwDoc::ChangeDBFields does a few things more: it updates the text section's condition (a text section may bi hidden according to a db related condition like Datasource.Table.Field EQ Something so you have to change Dataource.Table to newdatasource.newtable in your example) http://svn.services.openoffice.org/opengrok/xref/DEV300_m106/sw/source/core/doc/docfld.cxx#1918 it updates *not only* database fields, but also other text fields, see the switch in http://svn.services.openoffice.org/opengrok/xref/DEV300_m106/sw/source/core/doc/docfld.cxx#1947 Hope this helps. Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] Are there changes to the resourceURL 's ?
Hello Fernand, On Tuesday 21 December 2010, 14:42, Fernand Vanrie wrote: I trie to remove some buttons on the standard Toolbar I found some BASIC code made by Andrew Pitonyack, but i run in a error, saying that private:resource/toolbar/standardbar is no valid element for settings in the UIConfigurationManager your code below checks for private:resource/menubar/menubar Obviously, if you ask for info about com.sun.star.ui.UIElementType.TOOLBAR, there won't be MenuBar info! Please try this simple code from in a writerdoc oDoc = ThisComponent iToolType = com.sun.star.ui.UIElementType.TOOLBAR oFrame = oDoc.getCurrentController().getFrame() oCfgManager = oDoc.getUIConfigurationManager() oToolInfo = oCfgManager.getUIElementsInfo( iToolType ) For Each x in oFrame.LayoutManager.getElements() print x.ResourceURL REM private:resource/toolbar/standardbar is prentent stoolbar = private:resource/menubar/menubar this is the resource URL for the MenuBar! May be a copy paste mistake. Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] use of css.container.EnumerableMap
(xEnumeration.hasMoreElements()) { Object elem = xEnumeration.nextElement(); Pair pair = (Pair) ( (Any)elem ).getObject(); System.out.printf(%d - %s\n, pair.First, pair.Second); } } } catch (java.lang.Exception e){ e.printStackTrace(); } finally { System.exit( 0 ); } } Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] use of css.container.EnumerableMap
On Saturday 18 December 2010, 21:34:00, Ariel Constenla-Haile wrote: IMHO the wrong choice was to use the UNO type instead of com.sun.star.uno.TypeClass. With TypeClass and the support for new-style service constructor, it could have been as simple as: Dim aMap aMap = com.sun.star.container.EnumerableMap.create(_ com.sun.star.uno.TypeClass.SHORT,_ com.sun.star.uno.TypeClass.STRING) looking at http://api.openoffice.org/docs/common/ref/com/sun/star/container/EnumerableMap.html I see this won't work, because the EnumerableMap also takes other types than simple ones, like ENUM and INTERFACE; sure in this cases the UNO type is need and the uno.TypeClass is not enough. Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] list of supported Dispatch commands
Hello Andrew, On Wednesday 08 December 2010, 20:59, Andrew Douglas Pitonyak wrote: I last documented the dispatch commands (meaning I enumerated them) based off of these very outdated links: http://framework.openoffice.org/servlets/ProjectDocumentList http://api.openoffice.org/servlets/ProjectDownloadList http://api.openoffice.org/servlets/ProjectDownloadList?action=downloaddlID =12 there is http://wiki.services.openoffice.org/wiki/Framework/Article/OpenOffice.org_3.x_Commands I'm not sure how complete this list is (it does not contain some common commands I needed, like .uno:ObjectTitleDescription). If there is some means to document the currently supported dispatches, I will likely do that there is some API like the interface css.frame.XDispatchInformationProvider (supported by some controller implementations) and the service css.frame.UICommandDescription (by an issue documented under the ui module, not the frame one). You can see some sample code inside the following document http://arielch.fedorapeople.org/devel/ooo/UICommands.ods Here, I'm not sure how accurate the list here: if you take a look at the Bibliographic commands, the UICommandDescription gives you among others the .uno:ArrowShapes command, which has no sense in this context. (even if it means writing a script to troll the code). It would be even better if I had some way to document the accepted parameters, but, I doubt that I can easily do that. For the SFX2 based modules is possible, even the parameters can be extracted, and it's not that hard to do this: you have to parse SDI files inside every sfx2 based module (look at the folder module/sdi/); or even parse the header files generated in the build environment (*). This last approach is the one I took to get what I needed, you can see the results on http://arielch.fedorapeople.org/devel/ooo/uicommands.tar.gz For the new modules it may be easier, though some browsing through the source code is needed. For example, in chart2: http://svn.services.openoffice.org/opengrok/xref/DEV300_m94/chart2/source/controller/main/ChartController.cxx#1533 http://svn.services.openoffice.org/opengrok/xref/DEV300_m94/chart2/source/controller/main/DrawCommandDispatch.cxx#428 http://svn.services.openoffice.org/opengrok/xref/DEV300_m94/chart2/source/controller/main/ShapeController.cxx#229 Regards (*) for example: sfx2sfx2/unxlngx6/inc/sfxslots.hxx svx svx/unxlngx6/inc/svxslots.hxx sc sc/unxlngx6/inc/scslots.hxx sd sd/unxlngx6/inc/sdslots.hxx sw sw/unxlngx6/inc/swslots.hxx basctl basctl/unxlngx6/inc/basslots.hxx starmathstarmath/unxlngx6/inc/smslots.hxx -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] Copy textstring to Clipboard SOLVED
Hello steb, On Thursday 02 December 2010, 09:44, steb wrote: Hi Fernand, i wonder which method to copy contents is recommended. I achieve the same but I use a different approach with XSelectionSupplier in combination with XDispatchHelper and the XTextViewCursor. Code is similar to: public void copyContent(XCellRange cellRange, XTextRange textRange) this is Java! so why are you using the dispatch API? Look at the Developer's Guide http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Common_Application_Features and the example in the OOo SDK /opt/openoffice.org/basis3.4/sdk/examples/DevelopersGuide/OfficeDev/Clipboard/ Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] Re: Examining a directory with OpenOffice.org Basic
Hello Johnny, On Wednesday 01 December 2010, 10:38, Johnny Rosenberg wrote: 2010/12/1 Johnny Rosenberg gurus.knu...@gmail.com: If I know the name of a directory, let's say ~/MyImages, how can I easily read the names of all the files in that directory? Let's say that we will fill an array with all the file names. I have searched a bit online, but so far I didn't find anything that I understand… I'll continue searching, though. He he he… I tried again to search for the answer and this time I found it almost immediately… At least I think I did: http://wiki.services.openoffice.org/wiki/Documentation/BASIC_Guide/Files_an d_Directories_(Runtime_Library) Seems to be what I am looking for. Other thoughts about this are still welcome, though. I'd prefer using OOo API (not simply OOo Basic). This way you can then port your code to any supported language. Try the following: REM * BASIC * Option Explicit Sub Main Dim oSFA as Object oSFA = CreateUnoService( com.sun.star.ucb.SimpleFileAccess ) Dim sURL$ sURL = getHomeDir() If NOT oSFA.exists( sURL) OR NOT oSFA.isFolder( sURL ) Then 'some message Exit Sub End If Dim sHomeDirFileContents$() Dim sHomeDirFolderContents$() sHomeDirFileContents = oSFA.getFolderContents( sURL, false ) sHomeDirFolderContents = oSFA.getFolderContents( sURL, true ) Dim oDoc as Object oDoc = StarDesktop.loadComponentFromURL(_ private:factory/swriter, _ _default, _ com.sun.star.frame.FrameSearchFlag.ALL, _ Array()) Dim oCursor as Object oCursor = oDoc.getText().createTextCursorByRange(oDoc.getText().getStart()) InsertContents( oCursor, sHomeDirFileContents, Only files ) InsertContents( oCursor, sHomeDirFolderContents, Files and folders ) End Sub Sub InsertContents( oCursor as Object, sContents(), sHeading$ ) oCursor.ParaStyleName = Heading 1 oCursor.getText().insertString( oCursor, sHeading, false ) oCursor.getText().insertControlCharacter( oCursor, _ com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false ) oCursor.ParaStyleName = Default Dim n% For n = 0 To UBound(sContents) oCursor.getText().insertString( oCursor, sContents(n), false ) oCursor.getText().insertControlCharacter( oCursor, _ com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false ) Next End Sub Function getHomeDir() as String Dim oPaths oPaths = CreateUnoService(com.sun.star.util.PathSubstitution) getHomeDir() = oPaths.getSubstituteVariableValue($(home)) End Function Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] simpress: printing handouts programmatically, howto ?
Hello Rony, On Tuesday 13 July 2010, 13:35, Rony G. Flatscher wrote: Having an impress document, I would like to programmatically print out a presentation in form of handouts, with e.g. 2 slides per page. Tried the English print-dialog names as print options, but to no avail. How can one achieve that programmatically, what steps are needed, what PropertyValue can be supplied to control that ? not sure if this helps, but http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Drawings/Printing_Drawing_Documents#Special_Print_Settings says The printed drawing view (drawings, notes, handout pages, outline), the print quality (color, grayscale), the page options (tile, fit to page, brochure, paper tray) and additional options (page name, date, time, hidden pages) can all be controlled. Settings describes how these settings are used. where Settings is http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Drawings/Settings it looks like printing handouts is a property of the document's settings. Look at the second table on that wiki page, which resumes http://api.openoffice.org/docs/common/ref/com/sun/star/presentation/DocumentSettings.html Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] simpress: printing handouts programmatically, howto?
Hello Rony, On Tuesday 13 July 2010, 14:52, Rony G. Flatscher wrote: The script that I have been trying to tidy up already opened (loadComponentFromurl) the impress component with a PropertyValue of (IsPrintHandout, true), which had no visual effect on the displayed document. you were in the wrong way: these settings are not in the document's main settings (querying css.beans.XPropertySet on the document's model), not in the printer settings, not in the MediaDescriptor when loading the document. As explained in http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Drawings/Settings you must instantiate the com.sun.star.document.Settings at the document's factory. When printing that impress component I supplied PropertyValues to XPrintable.print() like * (IsPrintHandout, true) and Dim oDoc as Object oDoc = ThisComponent Dim oDocSettings as Object oDocSettings = oDoc.createInstance(com.sun.star.document.Settings) oDocSettings.setPropertyValue(IsPrintHandout, True) * (SlidesPerPage | SlidesPerHandout, 2), where 2 was supplied oDocSettings.setPropertyValue(SlidesPerHandout, 6) has no effect, at least I could not see any. If what you are trying to achieve is that the handout page has X number of slides, you will have to play with the Layout property of the HandoutMasterPage, which is implementation specific (AFAIK): ' http://svn.services.openoffice.org/opengrok/xref/DEV300_m84/sd/inc/pres.hxx#97 PRIVATE CONST AUTOLAYOUT_HANDOUT1 = 22 PRIVATE CONST AUTOLAYOUT_HANDOUT2 = 23 PRIVATE CONST AUTOLAYOUT_HANDOUT3 = 24 PRIVATE CONST AUTOLAYOUT_HANDOUT4 = 25 PRIVATE CONST AUTOLAYOUT_HANDOUT6 = 26 PRIVATE CONST AUTOLAYOUT_HANDOUT9 = 31 Sub Main Dim oDoc as Object oDoc = ThisComponent If NOT oDoc.supportsService(com.sun.star.presentation.PresentationDocument) Then MsgBox This macro works only on presentations, 16, ERROR Exit Sub End If Dim oDocSettings as Object oDocSettings = oDoc.createInstance(com.sun.star.document.Settings) oDocSettings.setPropertyValue(IsPrintHandout, True) oDocSettings.setPropertyValue(SlidesPerHandout, 6) Dim oHandout as object oHandout = oDoc.getHandoutMasterPage() 'MsgBox Join(oDoc.getSupportedServiceNames(), Chr(9)), 64, Supported Services oHandout.setPropertyValue(Layout, AUTOLAYOUT_HANDOUT6 ) End Sub Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] How to configure my program to build for using OOo
Hello Scott, On Wednesday 23 June 2010, 18:18, Scott Thompson wrote: Greetings! My program fires up OOo Calc via cppu::bootstrap(), inserts at least 2 columns of data into a new OOo Calc document, along with some describing text, and creates a new chart using that data. My current task is to update the configure process so our program will compile with the correct compiler flags. Is there an OOo equivalent of pkg-config that will return these flags for my system (or a target system)? not exactly. You can use the OOo SDK build environment. I would like to build on 32- and 64-bit Fedora Linux, and deploy to multiple flavors of Linux, including Red Hat and OpenSUSE. I build on Fedora (2.6.33.5-124.fc13.x86_64) 64 and 32 bits, and deploy on Ubuntu and OpenSuSe without any problem (even with OOo provided by the distros)... assuming you don't start linking against external libraries, it should work out of the box. Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] Generating the platform string for an extension
Hello Patrick, On Tuesday 25 May 2010, 05:09, Patrick Bernard wrote: I'm developing an extension in C++ on Ubuntu with the OOo sdk, make and g++ as build environment. so you are using the OOo SDK build environment, aren't you? The extension will be available for several platforms (Windows, Mac OS X, Ubuntu), but not at the same time. There will be a version of the extension for each platform. As you can see in DevGuide/Extensions/Extension_Identifiers, the identifier used for the extension must be unique, even among extensions that are logically the same but support different platforms. Besides, the file description.xml must contain a platform element with the platform token. this is true if you take the approach of creating one OXT file for each platform/architecture, so you must have a) MyExtension_Linux_x86.oxt b) MyExtension_Linux_x86_64.oxt c) ... all with the same extension identifier in description.xml but a) platform value=linux_x86/ b) platform value=linux_x86_64/ c) ... or you can take the approach of having only one OXT file, without specifying the platform in description.xml; placing inside the extension's root dir. a directory for every plat./arch. with the respective library OXT_ROOT_DIR/Windows/mylib.uno.dll OXT_ROOT_DIR/Linux_x86/libmylib.uno.so OXT_ROOT_DIR/Linux_x86_64/libmylib.uno.so and leave platform/arch. handling in the manifest only: OXT_ROOT_DIR//META-INF/manifest.xml manifest:file-entry manifest:media-type=application/vnd.sun.star.uno- component;type=native;platform=Linux_x86 manifest:full-path=Linux_x86/libmylib.uno.so/ manifest:file-entry manifest:media-type=application/vnd.sun.star.uno- component;type=native;platform=Linux_x86_64 manifest:full-path=Linux_x86_64/libmylib.uno.so/ manifest:file-entry manifest:media-type=application/vnd.sun.star.uno- component;type=native;platform=Windows manifest:full-path=Windows/mylib.uno.dll/ I guess this approach will have the drawback that if you do not provide a component library for the respective platform/arch. where the extension is installed, the user gets the extension installed anyway without any warning. I thought that this token could be obtained automatically from the sdk, to avoid setting it manually. AFAIK it is not possible. Both $(PLATFORM) and $(PROCTYPE) are there to help set, in some cases, $(UNOPKG_PLATFORM), which is used for the name of the folder containing the UNO component library, and for setting the platform in the manifest' media- type; see for example http://svn.services.openoffice.org/opengrok/xref/DEV300_m78/odk/examples/cpp/complextoolbarcontrols/Makefile#121 If it is not possible, I would like to know why. I guess Jürgen never had in mind someone will actually use the OOo SDK build environment to build a C++ extension with all the latest features provided now by OOo Extension framework. You can submit an issue asking for this enhancement. In the meantime, using the OOo SDK build environ. you can find a solution adding some custom include to your makefile (it easier to maintain than adding it to your main makefile) right after including OOo SDK's ones, something like: include set_env/project_platform_settings.mk where project_platform_settings.mk has some conditional definition (using the variables already set by the SDK) of a variable, let's say, DESCRIPTION_PLATFORM, that you use to generate the correct platform in the description.xml: @echo $(SQM)$(SQM)$(OSEP)platform value=$(QM)$(DESCRIPTION_PLATFORM)$(QM)/$(CSEP) $@ (this assumes you are using the approach of echoing the description.xml, as the SDK makefiles do with the manifest.xml). Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] Generating the platform string for an extension
Hello Joachim, On Tuesday 25 May 2010, 11:03, Joachim Lingner wrote: this is true if you take the approach of creating one OXT file for each platform/architecture, so you must have a) MyExtension_Linux_x86.oxt b) MyExtension_Linux_x86_64.oxt c) ... all with the same extension identifier in description.xml but The identifier must be different! Otherwise, using the online update you could download and install an extension, which is not supported on your platform. The extension manager uses only the identifier and version to determine if there is an update available. ups yes, you're right (it seems I take always the other all-in-one-approach): http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Extensions/Extension_Identifiers the identifier MUST be unique. This is also the case when two extensions are logically the same but support different platforms. In this case one can achieve this uniqueness by adding a platform string to identifier. Nice we caught your attention. According to http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Extensions/Target_Platform Do not confuse these tokens with those used to specify a native library in the manifest.xml. We will unify the use of the tokens in one of the future releases. I couldn't find any issue about this in the issue tracker. Do you have any idea if this is already planned? (This will be the real solution for the OP) Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] api: example for working with impress?
Hello Andreas, On Monday 24 May 2010, 14:32, Andreas Mantke wrote: Hello, I'm looking for an example how to access an impress document. I read through the dev guide (First Steps). There are examples how to work with spreadsheet, writer and draw documents. Is there also a description how to work with impress documents. I'm not able to find such an example in the OOo-Wiki. I hope someone can give a hint. you have the SDK example [/opt/openoffice.org/basis3.3]/sdk/examples/DevelopersGuide/Drawing/PresentationDemo.java http://svn.services.openoffice.org/opengrok/xref/DEV300_m78/odk/examples/DevelopersGuide/Drawing/PresentationDemo.java it's rather old, so it does not cover new features, like the very useful SlideShowController. Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] Generating the platform string for an extension
Hello Patrick, On Monday 24 May 2010, 13:54, Patrick Bernard wrote: Hi The page DevGuide/Extensions/Target_Platform I guess you're referring to http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Extensions/Target_Platform states that the information about the operating system and the architecture, that is necessary to generate the platform string for an extension, can be found in rtlbootstrap.mk. However, I couldn't find this file in my OpenOffice.org installation (version 3.2.0 on Ubuntu). http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Extensions/Target_Platform#Generating_the_Platform_String_in_the_Build_Environment that explanation is for Generating the Platform String in the Build Environment where OOo is built, that is: if you build OOo yourself and develop an extension in the OOo build environment. You won't find this file in the OOo installation, it's just generated in sal/unxlngx6/inc/rtlbootstrap.mk and delivered to solver/300/unxlngx6/inc/rtlbootstrap.mk for use inside the build environment. as you are writing to dev@api.openoffice.org I assume you are not dealing with OOo source nor build environment. Instead, the file sdk/settings/settings.mk contains two variables : PLATFORM and PROCTYPE. Do I have to use these variables to generate the platform string ? in some cases this is valid, in others not; look at the UNOPKG_PLATFORM variable, it is NOT simply made out of $(PLATFORM)_$(PROCTYPE) for every case. cf. the table at http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Extensions/Target_Platform#Platform_Tokens may be some more info may help: what kind of extension are you developing? what build environment do you use? can't you simply take the value from the Platform_Tokens table and hard code it, or you need something more portable? Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] java-macro: Not able to access CurrentComponent?
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.
Re: [api-dev] options for the pdf export
Hello Bernard, On Sunday 23 May 2010, 09:45, Bernard Marcelly wrote: Message de Ariel Constenla-Haile date 2010-05-21 04:34 : Hello Andreas, On Thursday 20 May 2010, 15:01, Andreas Mantke wrote: I have a look on the wiki site (http://wiki.services.openoffice.org/wiki/API/Tutorials/PDF_export) and missed the option FitWindow. AFAIK there is no option (in the PDF configuration) with that name (though I may have missed that). Or may be you mixed the PDF config. property named ResizeWindowToInitialPage with its representation in the source code http://svn.services.openoffice.org/opengrok/xref/DEV300_m77/filter/source /pdf/pdfexport.cxx#450 Hi, I think Andreas request corresponds to property Magnification, described in the table Initial view. yes, Magnification is in http://wiki.services.openoffice.org/wiki/API/Tutorials/PDF_export#Magnification Today (we have a 4 days long weekend here) I added span HTML tags with IDs to all the properties, so they can be referenced as link targets, for example: http://wiki.services.openoffice.org/wiki/API/Tutorials/PDF_export#FirstPageOnLeft http://wiki.services.openoffice.org/wiki/API/Tutorials/PDF_export#MaxImageResolution according to the documentation http://meta.wikimedia.org/wiki/Help:HTML_in_wikitext#Using_.3Cspan.3E_as_a_link_target it may not work with every browser (it does with Firefox). I profit from this occasion to thank Ariel for this splendid Wiki page. It is distressing that developers have not yet documented this interface in the API, and then we do not have API constants for all these parameter values. thanks :-) Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: AW: [api-dev] java-macro: Not able to access CurrentComponent?
Hello Martin, On Sunday 23 May 2010, 16:46, Martin Dobiasch wrote: The addin should find the area in which the sheet is filled. This thing will be used for educational use. So it should help People who don't have much experience with calc. The specify the Starting cell and use the function to access the area. So the can Add data to the range without caring about the address. I'm doing this for a teacher ... He has written this for Excel. Where it looks like this (Basic-Code): Public Function CSDRightFrom(startcell As Range) As Range Set CSDRightFrom = Range(startcell, startcell.End(xlToRight)) End Function Public Function CSDRangeAddress(arg As Range) As String CSDRangeAddress = arg.Address End Function To use it he calls CSDRangeAddress(CSDRightFrom(A1)) In that AddOn there are some functions which are reading cell ranges. this looks as if you wanted to get a cell range as parameter, and in this cell range write your result. This is possible, but IMHO is a NO-NO. As you've been told on Tuesday, you can get a cell range as parameter to your function, but it isn't the area in which the sheet is filled by your function's result. IMHO an Add-In should not modify the document (a sheet, a range, etc). OOo Calc Developers read this mailing list, so sure they will give on Monday a more accurate opinion. Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] java-macro: Not able to access CurrentComponent?
Hello Martin, On Saturday 22 May 2010, 06:24, Martin Dobiasch wrote: Hi! I'm running into trubles when my macro-code is invoked at calc-startup. Running the samecode after calc-startup (document opened+loaded) same Code works without anyproblems. Is there a way to get Currentcomponent which should be a XSpreadsheetDocument? The macro should gain access to one sheet. So if there is another way to get access to the sheets ... code: can you please post (or upload somewhere the complete code as a Java source file (*.java)? The way posted here is hard to follow, though... try { Object desktop=null; desktop = x_xMCF.createInstanceWithContext(com.sun.star.frame.Desktop, m_xContext); where does m_xContext come from? xd= (XDesktop) UnoRuntime.queryInterface(com.sun.star.frame.XDesktop.class, desktop); } catch (Exception e1) { Debug.showMessage(Exception); e1.printStackTrace(); return error; } XComponent document = xd.getCurrentComponent(); Debug.showMessage(document != null?: + (document != null) ); XModel xmodel = (XModel) UnoRuntime.queryInterface(XModel.class, document); xSpreadsheetDocument= (XSpreadsheetDocument) UnoRuntime.queryInterface( XSpreadsheetDocument.class, xmodel); XSpreadsheets xss = xSpreadsheetDocument.getSheets(); try { Object o= xss.getByName( sheetname ); xs= (XSpreadsheet) UnoRuntime.queryInterface(XSpreadsheet.class, o); } catch (NoSuchElementException e) { Debug.showMessage( NoSuchElement + e.getMessage() ); e.printStackTrace(); } catch (WrappedTargetException e) { Debug.showMessage( WrappedTarget: + e.getMessage() ); e.printStackTrace(); } Running this code at startup I geht the message document != null?: false But if I invoke the macro later its true Thanks for any Help, Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: AW: [api-dev] java-macro: Not able to access CurrentComponent?
Hello Martin, On Saturday 22 May 2010, 14:03, Martin Dobiasch wrote: Hello Ariel, Sorry. Attached there are some parts of my class. I removed a lot of functions which have nothing to do with the problem. The troublemaker is CSDRightFrom (at the bottom of the source code) Hope the source-code is now easier to understand. Thanks for your and any other help! A short answer (not sure it helps): a Java *macro* consist of a public static method, that takes as parameter a com.sun.star.script.provider.XScriptContext http://api.openoffice.org/docs/common/ref/com/sun/star/script/provider/XScriptContext.html use its methods to access what you need (copy paste from the API reference): * getDocument Obtain the document reference on which the script can operate * getInvocationContext provides access to the context where the script was invoked * getDesktop Obtain the desktop reference on which the script can operate * getComponentContext Obtain the component context which the script can use to create other uno components but your code is NO Java-macro; it is a UNO component. What are you developing? a Java macro or a UNO component? Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: AW: AW: [api-dev] java-macro: Not able to access CurrentComponent?
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 *Moft* 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: http://api.openoffice.org/docs/common/ref/com/sun/star/frame/Frame.html http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Component/Getting_Frames,_Controllers_and_Models_from_Each_Other http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Implementation So your attempt in private void ResetStreamTime() and public String CSDRightFrom(XCellRange startcell) to get the component from the Desktop is a bad idea and conceptually wrong: the current component depends on the focus, not on the component inside the frame your ProtocolHandler was initialized with. If it is an ADD-IN, the ADD-IN function can take a parameter of type ::com::sun::star::beans::XPropertySet interface to the SpreadsheetDocument making the function call: http://api.openoffice.org/docs/common/ref/com/sun/star/sheet/AddIn.html Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
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 *Moft* 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/Component/Getting_Frames,_Controllers_and_Models_from_Each_Other Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] options for the pdf export
Hello Andreas, On Thursday 20 May 2010, 15:01, Andreas Mantke wrote: I have a look on the wiki site (http://wiki.services.openoffice.org/wiki/API/Tutorials/PDF_export) and missed the option FitWindow. AFAIK there is no option (in the PDF configuration) with that name (though I may have missed that). Or may be you mixed the PDF config. property named ResizeWindowToInitialPage with its representation in the source code http://svn.services.openoffice.org/opengrok/xref/DEV300_m77/filter/source/pdf/pdfexport.cxx#450 Should I add this option to the wiki you - and everyone is free (and very welcome) to improve that page (just like any other OOo Wiki page: the content is open) or is this option not valid anymore? I never knew such an option existed (though I might be wrong - I missed the Watermark* property) * cf. http://arielch.fedorapeople.org/docs/Export_PDF_Watermark.bas Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] Using transformation matrices
Hello Thibault, On Sunday 16 May 2010, 13:43, Thibault Vataire wrote: Hi, I encounter some difficulties to use matrices for apply a transformation on a drawing shape. I need to rotate a com.sun.star.drawing.GraphicObjectShape object. I've found how to compute values for the first and the second column of the matrix from existing values and angle, but not those of the third column. These values seems to be the new position of the initial upper left corner of the shape. Is somebody know how to compute these values ? you can read http://graphics.openoffice.org/servlets/ReadMsg?list=devmsgNo=1691 and browse that mail's thread. Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] Using transformation matrices
Hello Thibault, On Sunday 16 May 2010, 19:01, Thibault Vataire wrote: Hello Ariel, I have already take a look on this thread but I set it aside hoping to find a simpler solution than to analyze OOo source code. oh I didn't send you to read OOo source code, I'm not *that* mad... but this thread is quite informative, so I thought you could get something out of it. I'll try to do with that, but if someone has an example or something else, I'm interested. you have the Developer's Guide example: SDK inst dir/examples/DevelopersGuide/Drawing/ObjectTransformationDemo.java Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] info/CWS slidecopy : +css.ui.UIElementType.TOOLPANEL / css.ui.XToolPanel
Hello Frank, On Thursday 29 April 2010, 05:38, frank.schoenh...@sun.com wrote: *Summary* + css.ui.UIElementType.TOOLPANEL + css.ui.XToolPanel *Description* - css.ui now supports so-called tool panels (which is what you already know from Impress' task pane). They're not yet fully integrated into the UI framework implementation, that is, you cannot yet use the Layout Manager to control them (this is up to a next step, where the existing implementation is to be merged with some layout manager refactoring). However, you can already write extensions providing tool panels: http://wiki.services.openoffice.org/wiki/Framework/Article/Tool_Panels I couldn't picture what this feature actually was until I saw the actual picture at the end of that wiki page. http://wiki.services.openoffice.org/wiki/File:Task_pane_tool_panel.png Let me see if I get this right: now every OOo application will be able to display a Task panel (now only available in OOo Impress); and extension developers can add a custom task to the panel. Am I right? Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] info/CWS slidecopy : +css.ui.UIElementType.TOOLPANEL / css.ui.XToolPanel
Hello Frank, On Thursday 29 April 2010, 09:36, Frank Schoenheit, Sun Microsystems Germany wrote: Hi Ariel, Let me see if I get this right: now every OOo application will be able to display a Task panel (now only available in OOo Impress); and extension developers can add a custom task to the panel. Am I right? Yes. quite impressing then :-) This is a nice solution for many extension developers that wanted docking window functionality (though they can't yet have a docking window of their own, they can share the task panel - I find this even more end-user friendly, instead of many extensions providing lots of docking windows by themselves). Looking forward to try this out (I hope I can resist to check out and build this cws). Regards -- Ariel Constenla-Haile La Plata, Argentina signature.asc Description: This is a digitally signed message part.
Re: [api-dev] Questions about the service com.sun.star.frame.GlobalEventBroadcaster
Hello Patrick, On Sunday 18 April 2010, 05:49, Patrick Bernard wrote: If unpublished interfaces can be changed at any time in any release, is it advisable to use an unpublished interface in released code ? Besides, is it possible, when compiling the code, to be warned that unpublished interfaces are used ? this kind of questions have been discussed several times on this (and, if IRRC, others OOo) mailing lists, you can search the archives. This is the kind of topic where the thread ends up open, with no clear answer, because different OOo developers have different opinions about what should be understood under unpublished (may be from this is unstable API I plan to change it any time to I just plan to enhance it by adding further functionality, so I leave this unpublished). So a warning when using unpublished API does not sound very realistic. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Call Python script in OOo Basic
Hello Jan, Thomas On Tuesday 06 April 2010, 05:48, Jan Holst Jensen wrote: On 2010-04-06 10:22, Thomas Krumbein wrote: Hey, in one of my basic-macros I have to call a python script and work afterwards with the results - i.e. the content of a created textfile. At the moment I do this using the shell service. But there are two things, which I do not like: - when calling the shellservice a console-window will pop in front for a very short moment. - the Python script create a text-file, then I read the text file. Because the Basic-script do not stop on the shellservice call, I have to use a wait() statemet to be sure, the file is created. Is there - maybe - another way to call a python script in basic? I have to call the python script with parameters and - if possible - to get a flag or something back, so that I now, python script is done. Hi Thomas. Try this. Create a python file called test.py containing def testMacro(): return Testing from Python and save it in your user configuration under .../scripts/python/. On my Windows XP machine I have saved test.py in C:\Documents and Settings\user name\Application Data\OpenOffice.org\3\user\Scripts\python\ - I had to create the \python\ directory myself; \Scripts\ was already there. Check that the Python macro is seen by OOo: Open Tools - Macros - Organize Macros - Python... and check that you now have a library called test with a macro in it called testMacro. From a StarBasic macro you can now call the macro by-URL with Sub Main Dim MasterScriptProviderFactory as Object Dim MasterScriptProvider as Object Dim Script as Object Dim Url as String Dim PythonResult as String Url = vnd.sun.star.script:test.py$testMacro?language=Pythonlocation=user MasterScriptProviderFactory = createUnoService(com.sun.star.script.provider.MasterScriptProviderFactory ) MasterScriptProvider = MasterScriptProviderFactory.createScriptProvider() Script = MasterScriptProvider.getScript(url) PythonResult = Script.invoke(Array(),Array(),Array()) MsgBox PythonResult End Sub There might be a way to load the Python library directly instead of by-URL so you could call the macro in a more natural way, but I didn't figure out how to do it. Perhaps others can help. other than using the scripting framework as you suggested, I can only imagine a Python UNO component. This way you simply use CreateUnoService() and start using your component's functionality . Of course, this may be too much for his current purpose (though it's rather easy to design a PyUNO component...). Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] options for the pdf export
On Friday 02 April 2010, 19:44, Ariel Constenla-Haile wrote: EmbedStandardFonts on the other hand is missing. There is a cws that will add this option for all PDF formats while it is already available for PDF/A-1, see http://svn.services.openoffice.org/opengrok/xref/DEV300_m75/filter/source/pdf/pdfexport.cxx#93 I've found the link, but the service is down https://tools.services.openoffice.org/EIS2/changesmails.EditFeature?ReadOnly=trueId=4636 seems an OOo 3.3 task. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Windows and Linux portability queries
Hello Madhur, On Saturday 27 March 2010, 10:20, Madhur Kashyap wrote: That's completely unnecessary if you use URLs instead of path names. As most API calls in OOo use URLs anyway you also save your don't need to convert your file names when you want to use them in API calls. The biggest problem still is sRootDir. You have to know this and so your idea to write OS agnostic code is only possible with using a root dir that is accessible through one of OOo's path variable, like e.g. the HOME folder. If you are not able to identify the operating system you are working on, how can you guess sRootDir in the correct notation? OTOH, if you know sRootDir, you also know at least if your OS has a Windows type or a Unix type file name notation. Actually in my description I gave, I did not tell that I also need to execute some shell commands with path description. So, does shell or execute commands accept URLs ? I haven't tried that but my gut feel is it would not. So, would the conversion command take care of path separator? you can work always with URLs and then use OOo Basic convertFromURL when a sys path is needed. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Embedding data files in Calc and extracting on need
Hello Madhur, On Friday 19 March 2010, 08:32, Madhur Kashyap wrote: I can't seem to find a way to embed arbitrary file(s) into calc spreadsheet. you need to use the embed API, cf. http://api.openoffice.org/docs/common/ref/com/sun/star/embed/module-ix.ht I did notice this module earlier but it is complicated for me to grasp. basically, you get the document root storage: http://api.openoffice.org/docs/common/ref/com/sun/star/document/XStorageBasedDocument.html#getDocumentStorage and then you have a storage to work with Do you know some examples which I can refer to? Thanks for the help. I thought it is important from my part to describe the word content. I have few text and binary executable files which I would like to keep embedded in the document. a simple text file is also a binary file, so you use the same procedure - the same media type in the example (this would be different if you want to embed an xml file for example) Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Embedding data files in Calc and extracting on need
Hello Madhur, sorry, forgot the link On Friday 19 March 2010, 08:32, Madhur Kashyap wrote: I can't seem to find a way to embed arbitrary file(s) into calc spreadsheet. you need to use the embed API, cf. http://api.openoffice.org/docs/common/ref/com/sun/star/embed/module-ix.ht I did notice this module earlier but it is complicated for me to grasp. basically, you get the document root storage: http://api.openoffice.org/docs/common/ref/com/sun/star/document/XStorageBasedDocument.html#getDocumentStorage and then you have a storage to work with Do you know some examples which I can refer to? http://arielch.fedorapeople.org/docs/embed_content.zip unzip the folder. It has a text document and a C source file with 2 binaries. These 3 files will be embedded inside a new Writer document, stored in folder in $HOME, and then extracted in the same folder. Thanks for the help. I thought it is important from my part to describe the word content. I have few text and binary executable files which I would like to keep embedded in the document. a simple text file is also a binary file, so you use the same procedure - the same media type in the example (this would be different if you want to embed an xml file for example) Notice that I don't see a way to execute the extracted binary executable files if you don't change the file modes once extracted (when the file is embedded, that attribute is lost). Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Example, snippet for creating and using an XCommandEnvironment, even better, deploying/removing packages via UNO ?
Hello Rony, On Saturday 20 March 2010, 13:04, Rony G. Flatscher wrote: Hi there, it may be me, but I have not found an example/explanation of how to create and use a XCommandEnvironment. Purpose: for an installation script, which is supposed to install/remove a package from OOo, I would like to use /singletons/com.sun.star.deployment.thePackageManagerFactory (which I was able to successfully exploit back in the pre 2.2 days; with OOo 2.2; my notes tell me that then an XCommandEnvironment object was mandatory to be passed to one of the methods, such that I switched to using the unopkg executable instead). Thankful for any hints, pointers ! you have to pass to XPackageManager::add/removePackage a UNO object implementing XCommandEnvironment (== you must write this in a language supporting UNO objects implementation... well, sometimes OOo Basic listeners do the trick, but never tried this) This can be a class implementing XCommandEnvironment, or invoking the CommandEnvironment service constructor's: http://api.openoffice.org/docs/common/ref/com/sun/star/ucb/CommandEnvironment.html First example I find is the unopkg implementation itself. See for example http://svn.services.openoffice.org/opengrok/xref/DEV300_m75/desktop/source/pkgchk/unopkg/unopkg_app.cxx#366 366 xPackageManager-removePackage( 367 cmdPackage, cmdPackage, 368 Referencetask::XAbortChannel(), xCmdEnv ); here xCmdEnv is 343 Reference ::com::sun::star::ucb::XCommandEnvironment xCmdEnv( 344 createCmdEnv( xComponentContext, logFile, 345 option_force, option_verbose, option_bundled) ); where createCmdEnv instantiates a class implementing XCommandEnvironment (together with task::XInteractionHandler and XProgressHandler) http://svn.services.openoffice.org/opengrok/xref/DEV300_m75/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx#430 http://svn.services.openoffice.org/opengrok/xref/DEV300_m75/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx#80 As you see, this class implements all 3 required interfaces, so when XCommandEnvironment::getInteractionHandler() and XCommandEnvironment::getProgressHandler() are invoked, it returns itself. http://svn.services.openoffice.org/opengrok/xref/DEV300_m75/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx#212 The implementation there is quite complex http://svn.services.openoffice.org/opengrok/xref/DEV300_m75/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx#227 but, well, it's the OOo unopkg! Depending on your purpose, you could try something more modest, like in http://svn.services.openoffice.org/opengrok/xref/DEV300_m75/javaunohelper/com/sun/star/comp/juhtest/SmoketestCommandEnvironment.java Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Embedding data files in Calc and extracting on need
Hello Madhur, On Friday 19 March 2010, 07:17, Madhur Kashyap wrote: I can't seem to find a way to embed arbitrary file(s) into calc spreadsheet. you need to use the embed API, cf. http://api.openoffice.org/docs/common/ref/com/sun/star/embed/module-ix.html Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Embedding data files in Calc and extracting on need
Hello Madhur, On Friday 19 March 2010, 08:02, Madhur Kashyap wrote: On Fri, Mar 19, 2010 at 4:10 PM, Ariel Constenla-Haile ariel.constenla.ha...@googlemail.com wrote: Hello Madhur, On Friday 19 March 2010, 07:17, Madhur Kashyap wrote: I can't seem to find a way to embed arbitrary file(s) into calc spreadsheet. you need to use the embed API, cf. http://api.openoffice.org/docs/common/ref/com/sun/star/embed/module-ix.ht ml I did notice this module earlier but it is complicated for me to grasp. Do you know some examples which I can refer to? mmm not that I'm aware of (what Konstantin said is an example on how to implement an embedded object, you simply want to embed and then extract some content, so believe me you wouldn't like to mess with such a complicated thing). I'll try to write some OOo Basic example this weekend, I'll let you know, stay tuned. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] How to get document's windows (position, size, moving) via UNO ?
Hello Rony, in the meantime I've found http://svn.services.openoffice.org/opengrok/xref/DEV300_m75/vcl/inc/vcl/window.hxx#858 // window extents including border and decoratrion Rectangle GetWindowExtentsRelative( Window *pRelativeWindow ); // window extents of the client window, coordinates to be used in SetPosPixel Rectangle GetClientWindowExtentsRelative( Window *pRelativeWindow ); On Monday 15 March 2010, 16:21, Rony G. Flatscher wrote: just a pointer, having gone through the Javadocs over the weekend: if creating an instance of javax.swing.JFrame and pack it, one can use the getInsets() method to retrieve an Inset object which has the members/fields left, top, right, bottom, giving the respecitve insets. Now if you want to adjust the OOo document's XFrame's containerWindow posSize to include the Window decoration (borders and title bar), you would have to do something like: posSize~x -= insets~left posSize~Y -= insets~top posSize~width += insets~left + insets~right posSize~height += insets~top + insets~bottom much like http://svn.services.openoffice.org/opengrok/xref/DEV300_m75/vcl/source/window/window.cxx#7468 I'll try to wrap this in a css::awt::XWindow3 [my god, what awfulness!] API and test how it works (indeed quite easy task, no rocket science). It's interesting to see that some developer needed such a thing (and other missing features in OOo API), but instead of improving the API he designed something ad hoc; that in fact does not work for your use case, because it checks you pass a valid parent window, and top windows have no parent: http://svn.services.openoffice.org/opengrok/xref/DEV300_m75/sd/source/ui/presenter/PresenterHelper.cxx#325 Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] [OO API] Where does the reference points to?
Hello Mikhail, On Sunday 07 March 2010, 15:50, Mikhail Kulinich wrote: Hello, I have an issue with searching the place where the reference points to. I dont understand how to do that. I use the following code to iterate through the text: *XEnumeration range = ; . while (range.hasMoreElements()) { XTextRange xTextPortion = (XTextRange) UnoRuntime.queryInterface( XTextRange.class, range.nextElement()); ** * At some moment xTextPortion will contain a text which is in fact a reference to some other part of the document (for example, chapter). And I want to determine where the reference points to (maybe in future i will need to go to this place...). Example of document structure: -- Chapter 1. SubChapter 1.1 SubChapter 1.2 Chapter 2 A *reference to the SubChapter 1.1* -- *reference to the SubChapter 1.1* can be replaced by any text and I need to find SubChapter 1.1 (the place where reference points to) using only OpenOffice.org API. As I know the reference can point only to exact place. Also, I have the following property on XTextRange object: Property[ReferenceMark] = Any[Type[com.sun.star.text.XTextContent], null] Can somebody give me an example of code which is suitable for this task? http://arielch.fedorapeople.org/docs/Iterating_over_Text.odt I search for an example on Java. well, it's in Ooo Basic, so do your homework: http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Text/Iterating_over_Text http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Text/Text_Fields http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Text/Reference_Marks http://api.openoffice.org/docs/common/ref/com/sun/star/text/textfield/GetReference.html Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] How to get document's windows (position, size, moving) via UNO ?
Hello Rony, On Wednesday 03 March 2010, 10:24, Rony G. Flatscher wrote: maybe ContainerWindow.Toolkit can do the job thank you! Tried that already to no avail yesterday; here is what I did: * create an emnpty swriter document (named: oDoc, o get oDoc's XModel - getCurrentController() - getFrame() + get its getContainerWindow() - getPosSize(): this contains everything, but the enclosing window/frame (the top-level window in Windows having the frame and the title bar etc.), + get the XWindowPeer interface from the container window, then its toolkit and from it the work area, o get xFrame's parent (assuming that then one could get to the encompassing frame (window), which works, but the position information (a Dimension object) has all its members set to 0. Tried to research the OOo docs, the DevGuide and search facilities to get further, but have not been successful. Maybe the route I am taking is false, or I do not see the forest for the trees, or the information is not available via UNO. thank you! Unfortunately, this does not help solve the problem. --- The problem rephrased would be: using UNO, how can one get a hold of the e.g. Windows window in which OOo creates its components, such that one can get the exact window position, width and height? let me see if I get you... You want to get the window dimensions including the window decorations (that is: the window border and the window title bar). You are in the right way searching through the container window: *this* is the system window the frame (where the document is loaded) is initialized with. The problem is that OOo API does not take into account the window manager hints (window decorations, window border and the window title bar). The closest I could get was working with the com.sun.star.awt.DeviceInfo.TopInset (in Linux [well, on Fedora with KDE 4.4] this gives me an approximate idea of the window title bar height). Nevertheless this gives no idea about the window borders. Play with this awful example: http://arielch.fedorapeople.org/devel/ooo/SystemWindow.tar.gz As OOo API can't handle to bring the window to the front, you will have to do it manually (read the comments main method). May be the underlying implementation (the vcl WorkWindow/SystemWindow/Window) knows how to get this data, sure Carsten joins the discussion and gives us some light. You could file a RFE to enhance the com.sun.star.awt.XTopWindow (haha now I see someone [fs in dba33a?] added a com.sun.star.awt.XTopWindow2). Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] How to get document's windows (position, size, moving) via UNO ?
Hello Rony, On Wednesday 03 March 2010, 14:16, Rony G. Flatscher wrote: You could file a RFE to enhance the com.sun.star.awt.XTopWindow (haha now I see someone [fs in dba33a?] added a com.sun.star.awt.XTopWindow2). But that one seems not to be available (it cannot be interrogated via reflection). I founded it in a Dev. snapshot cf. http://svn.services.openoffice.org/opengrok/xref/DEV300_m73/offapi/com/sun/star/awt/XTopWindow2.idl you can get the Dev. version of OOo and its respective SDK from any mirror, for example ftp://mirror.switch.ch/mirror/OpenOffice/extended/developer/DEV300_m73 Anyway this new interface does not help you with this current problem. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] css.sdb.application.XDatabaseDocumentUI: new methods
Hello Frank, On Thursday 18 February 2010, 10:24, Frank Schoenheit, Sun Microsystems Germany wrote: Nothing changed there, sorry: A connection still is subordinate to the database document - there can be connections without an associated database document, but a database document has (or can obtain) a connection. Forms then are also subordinate to a database document. So, the entry point for all form/report/etc. work is still the DB doc. What the mail tried :-\ to express you were perfectly clear :-) is that formerly, you could only load existing forms (XDatabaseDocumentUI.loadComponent( DatabaseObject.FORM, ...)), where now you can also easily create new ones via the createComponent method. ... Tampering with the document definitions (and other low level objects) directly is possible, but gives you who you're doing this the responsibility for life time etc. this new abstraction layer is very welcome, life time issues were always a pain when dealing with DocumentDefinition/s; and as extension developers are likely to work with/from the Controller, this is a nice enhancement. Thanks for bringing this info/discussion to *this* mailing list. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] options for the pdf export
Hello Andreas, On Friday 29 January 2010, 09:20, Andreas Mantke wrote: Hi all, I'll try to create a java application that exports an editable office file format to pdf and I searching for the spec / listing of the pdf options of the current OOo (3.2.0). Is there such a document in the wiki or in OOo-cvs? http://wiki.services.openoffice.org/wiki/API/Tutorials/PDF_export#PDF_Export_filter_data though I didn't check if everything still works with OOo 3.2 (I'll do this when updating the tutorial, now that in 3.2 the PDF dialog is accessible to scripting languages too). Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Working with awt windows
Hello Per, On Saturday 09 January 2010, 08:14, Per Eriksson wrote: I am trying to display an awt window, using the best possible ways, and would like to get some options. IIRC you wanted to work with awt dialogs... I've tried using the awt.Toolkit to display an awt window of my own, but received a tips from Ariel Constenla-Haile at framework that there are better ways. if you want to show a dialog when a menu item is selected, there are better ways than creating an AWT window on your own. An example code which I am trying to run is attached below, but this mailing list does not allow attachments (well, sometimes I attach plain source code text files, and pass to the list) crashes probably because of handle a related problem. What alterantives are there for displaying awt dialogs, for example when pressing a menu item. [I repeat what I wrote to you privately] basically you have two options: * create a dialog at runtime * create a dialog designed in the OOo Dialog Editor Thank you for your help. The tutorial shows how actions are handled, and seem to involve some Basic code (because of the script vnd.sun.star.UNO:doit1). no, that's not the case. If you re-read the Dev's Guide, it's clear that in the Dialog Editor, when you assign an action to an event, instead of choosing Macro... you should select Component..., and then in Component method name you must enter the name of the method that will be used when the event takes place (doit1 in this case). There is no OOo Basic code involved at all, vnd.sun.star.UNO:doit1 is just how the command URL is represented internally Your class implementing com.sun.star.awt.XDialogEventHandler will then be invoked with that method's name passed to callHandlerMethod() Of course, first you have the create the dialog telling which class implements com.sun.star.awt.XDialogEventHandler . You do this when creating the dialog, invoking com.sun.star.awt.XDialogProvider2.createDialogWithHandler() See http://api.openoffice.org/docs/common/ref/com/sun/star/awt/XDialogProvider2.html#createDialogWithHandler http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Using_Dialogs_in_Components#Instantiate_and_display_a_dialog I would have thought the SDK example was self-explaining, but it seems it wasn't (yes... every example should have a little documentation, guiding the user/developer...). Try then http://arielch.fedorapeople.org/devel/ooo/DialogProviderDemo.zip it's basically the same SDK example but presented - I hope - in a more useful way (the dialog is created when a menu item under File - Wizards is pressed). Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] How to handle XInterface objects in Basic
On Wednesday 06 January 2010, 13:17, Juergen Schmidt wrote: A parser implementation is available using CreateUnoService(com.sun.star.xml.sax.Parser). A complete example is at http://wiki.services.openoffice.org/wiki/XML_and_Filter. So the service com.sun.star.xml.sax.Parser is not documented? See http://api.openoffice.org/docs/common/ref/com/sun/star/xml/sax/module-ix. html you can help to improve the docu over time by submitting issues for not yet documented services issues exist already since Apr 3 2008: http://www.openoffice.org/issues/show_bug.cgi?id=87781 IDL: undocumented service com.sun.star.xml.sax.Parser http://www.openoffice.org/issues/show_bug.cgi?id=87783 IDL: undocumented service com.sun.star.xml.sax.Writer you can help to improve the docu over time by telling your colleagues to work on submitted issues ;-) Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Working with awt windows
Hello Per, On Wednesday 06 January 2010, 17:16, Per Eriksson wrote: Hello, I am trying to display an awt window, using the best possible ways, and would like to get some options. IIRC you wanted to work with awt dialogs... I've tried using the awt.Toolkit to display an awt window of my own, but received a tips from Ariel Constenla-Haile at framework that there are better ways. if you want to show a dialog when a menu item is selected, there are better ways than creating an AWT window on your own. An example code which I am trying to run is attached below, but this mailing list does not allow attachments (well, sometimes I attach plain source code text files, and pass to the list) crashes probably because of handle a related problem. What alterantives are there for displaying awt dialogs, for example when pressing a menu item. [I repeat what I wrote to you privately] basically you have two options: * create a dialog at runtime * create a dialog designed in the OOo Dialog Editor in any case you do NOT need to create an AWT window (you will have life-time issues with this one). AFAIK the documentation is http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Basic/Creating_Dialogs_at_Runtime http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/GUI/Graphical_User_Interfaces http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Accessing_Dialogs There is also an example /opt/openoffice.org/basis3.2/sdk/examples/DevelopersGuide/Components/dialogcomponent/ but not a very realistic one (I mean, it would have been more useful an example that shows a dialog when a menu/toolbar item is selected). Side note: as you seem not to be subscribed to the list, I CC'ed you. But you may miss some answers from people answering directly to the mailing list. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
[api-dev] How to avoid Python bridge conversion of SequencePropertyValue to Sequence:Any
Hi there, In Python, I need to transport a css::uno::Sequencecss::beans::PropertyValue inside the css.document.MediaDescriptor's FilterData for the PDF export filter. I guess (my PyUNO knowledge is rather limited... as I don't like Python that much...) the Python code may look like this: aFilterData = ( PropertyValue( DisplayPDFDocumentTitle, 0, False, DIRECT_VALUE ), PropertyValue( OpenInFullScreenMode, 0, True, DIRECT_VALUE ), PropertyValue( ResizeWindowToInitialPage, 0, True, DIRECT_VALUE ), PropertyValue( HideViewerMenubar, 0, True, DIRECT_VALUE ), PropertyValue( HideViewerToolbar, 0, True, DIRECT_VALUE ), PropertyValue( Selection, 0, oSel, DIRECT_VALUE ) ) aMediaDescriptor = ( PropertyValue( FilterName, 0, writer_pdf_Export, DIRECT_VALUE ), PropertyValue( FilterData, 0, aFilterData, DIRECT_VALUE ) ) xTextDoc.storeToURL( sURL, aMediaDescriptor ) (complete code attached) what in Java looks like this: PropertyValue[] aMediaDescriptor = new PropertyValue[2]; aMediaDescriptor[0] = new PropertyValue(); aMediaDescriptor[0].Name = FilterName; aMediaDescriptor[0].Value = writer_pdf_Export; PropertyValue[] aFilterData = new PropertyValue[6]; aFilterData[0] = new PropertyValue(); aFilterData[0].Name = Selection; aFilterData[0].Value = oSelection; aFilterData[1] = new PropertyValue(); aFilterData[1].Name = DisplayPDFDocumentTitle; aFilterData[1].Value = Boolean.FALSE; aFilterData[2] = new PropertyValue(); aFilterData[2].Name = OpenInFullScreenMode; aFilterData[2].Value = Boolean.TRUE; aFilterData[3] = new PropertyValue(); aFilterData[3].Name = ResizeWindowToInitialPage; aFilterData[3].Value = Boolean.TRUE; aFilterData[4] = new PropertyValue(); aFilterData[4].Name = HideViewerMenubar; aFilterData[4].Value = Boolean.TRUE; aFilterData[5] = new PropertyValue(); aFilterData[5].Name = HideViewerToolbar; aFilterData[5].Value = Boolean.TRUE; aMediaDescriptor[1] = new PropertyValue(); aMediaDescriptor[1].Name = FilterData; aMediaDescriptor[1].Value = aFilterData; XStorable xStorable = (XStorable) UnoRuntime.queryInterface( XStorable.class, xTextDocument); xStorable.storeToURL(sURL, aMediaDescriptor); and in OOo Basic looks like the code in http://arielch.fedorapeople.org/docs/PDF_export_FilterData_demo.odt The problem is that with the above code, the PyUNO bridge transports the FilterData as a css::uno::Sequencecss::uno::Any instead of a css::uno::Sequencecss::beans::PropertyValue and the convertion fails in the filter code http://svn.services.openoffice.org/opengrok/xref/DEV300_m68/filter/source/pdf/pdffilter.cxx#71 so that the filter ends up reading the configuration instead of the FilterData passed. The problem is the same as in http://www.openoffice.org/issues/show_bug.cgi?id=12504 The problem is, that the writer code expects a sequencePropertyValue as the any argument of replaceByIndex, but python delivers a sequenceany, where each member is of type PropertyValue. but the workaround in FAQ Nr. 15 didn't work for me cf. http://udk.openoffice.org/python/python-bridge.html#faq and http://www.openoffice.org/issues/show_bug.cgi?id=12504#desc12 Any hints on how to tell the PyUNO bridge to do things as really wanted are very welcome. Regards -- Ariel Constenla-Haile La Plata, Argentina # -*- coding: utf-8 -*- # sample client application # # Start OOo with the following command: #/opt/openoffice.org3/program/soffice -accept=socket,host=localhost,port=8100;urp;StarOffice.ComponentContext /dev/null 21 import uno import unohelper from com.sun.star.beans import NamedValue from com.sun.star.beans import PropertyValue from com.sun.star.beans.PropertyState import DIRECT_VALUE from com.sun.star.text.ControlCharacter import PARAGRAPH_BREAK def load_new_writer_doc( xContext ): xComponentLoader = xContext.ServiceManager.createInstanceWithContext( com.sun.star.frame.Desktop, xContext ) xComponent = xComponentLoader.loadComponentFromURL( private:factory/swriter, _default, 0, () ) return xComponent def get_home_dir( xContext ): xPathSubst = xContext.ServiceManager.createInstanceWithContext( com.sun.star.util.PathSubstitution, xContext ) sHomeDir = xPathSubst.getSubstituteVariableValue( $(home) ) return sHomeDir def create_unique_file_name( xContext, sBaseURL, sFileName, sExtension ): xSFA = xContext.ServiceManager.createInstanceWithContext( com.sun.star.ucb.SimpleFileAccess, xContext ) n = 0 sRet = sBaseURL + / + sFileName + . + sExtension while
Re: [api-dev] Sharing macros with people…
Hello Johnny, On Sunday 20 December 2009, 14:19, Johnny Rosenberg wrote: Anyone who can point me to somewhere where I can learn to create an add-on or extension? My thought is that the person to whom I send it should easily install it by the extension manager, so I guess I need to create an OXT somehow. How is all that done properly? if you just want to share macros with people, I'd recommend Paolo's BasicAddonBuilder http://extensions.services.openoffice.org/project/BasicAddonBuilder Anyway, if you want to study how extensions are packages, read the Dev's Guide http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Extensions/Extensions and http://wiki.services.openoffice.org/wiki/Non-code_extensions Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Extension - Addon.xcu
Hello Jörg, On Wednesday 09 December 2009, 12:05, Jörg Schmidt wrote: How can i create a addon.xcu in a extension for a new independent toolbar which i can dock (which is visible) in the area of the DataSource-browser? ... but thats work not correctly, i dont see a new toolbar after installation the extension. (I try restart OOo after installation, but i get the same result.) What i need is a solution to create/install a new toolbar which is visible in the DataSource-browser-Window after install the extension (which 'contains' the toolbar). Its no matter whether the new toolbar (in DataSource-browser) is docked but it must be visible. ... notices on the side: I don't know whether it is a general problem, but when i create a new toolbar in the DataSource-browser-Window manually (by using the normal GUI) the toolbar is first visible, but when i close the DataSource-browser-Window and reopen, then the new toolbar is suddenly invisible. (OOo 3.1.0) yes, this seems to be an issue. I'm not sure which one is the issue: * a custom toolbar you have configured is first visible in the DSB, but the next time you open it, the toolbar is not visible anymore (though still present in the user ui-config. layer, and so in the Customize Toolbar... tab page) * if the DSB toolbar settings are not configurable in the sense of adding new toolbars, then you should not be allowed to configure a new one; instead be warned about this fact. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Extension - Addon.xcu
Hello Jörg, Steffen, On Tuesday 08 December 2009, 07:43, Steffen Grund wrote: Hello Jörg, when I change browserobjectbar to standardbar, your Addons.xcu works. It seems that browserobjectbar is not valid anymore, but I am not familiar with it, so I am at a loss there. no, you're right. MergeToolBar specifies the target toolbar. You have to use the name part of the toolbar resource URL. E.g. private:resource/toolbar/standardbar quoting http://wiki.services.openoffice.org/wiki/Framework/Article/Addon_Menu_Toolbar_Merging the name part is also the name of the xml file without extension, file which should be located, on Linux, in /opt/openoffice.org/basis3.2/share/config/soffice.cfg/modules/module/toolbar/name_part.xml and there is no browserobjectbar.xml in any folder. in an extension (*.oxt) i use the following Addon.xcu to create an button in the browserobject-toolbar - works correct in OOo 2.4.0 but not in OOo 3.1. (in OOo 3.1 i dont get a button in the browserobject-toolbar after installation of the extension) What can i do? there is o such toolbar in OOo 3.1. Browse /opt/openoffice.org/basis3.2/share/config/soffice.cfg/modules/module/toolbar to find out if it was renamed or merged. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Extension - Addon.xcu
Hello Jörg, On Tuesday 08 December 2009, 15:33, Jörg Schmidt wrote: in my opinion, there is a problem. In OOo 2.4.0 is the xml-file (in Windows): C:\Programme\OpenOffice.org 2.4\share\config\soffice.cfg\modules\dbbrowser\toolbar\browserobjectbar. xml but in OOo 3.1.0 the file for the functional same toolbar is: C:\Programme\OpenOffice.org 3\Basis\share\config\soffice.cfg\modules\dbbrowser\toolbar\toolbar.xml and i think the file-name toolbar.xml is not a clear (unambiguous) name. For example i find the same name in: C:\Programme\OpenOffice.org 3\Basis\share\config\soffice.cfg\modules\scalc\toolbar\toolbar.xml C:\Programme\OpenOffice.org 3\Basis\share\config\soffice.cfg\modules\swriter\toolbar\toolbar.xml ... And now? What can i do? What must i write for: '... prop oor:name=MergeToolBar valuebrowserobjectbar/value /prop '... when i will merge in this toolbar: C:\Programme\OpenOffice.org 3\Basis\share\config\soffice.cfg\modules\dbbrowser\toolbar\toolbar.xml you must specify the module the toolbar belongs to: MergeContext Defines in which application module context the merge instruction should be active. Contexts must be separated by a comma. An empty context means that the instruction is always active. The context string is identical with the module identifier accessible from the com.sun.star.frame.ModuleManager service. The following module identifiers are defined (for a complete list refer to Office modules since OpenOffice.org 2.3) http://wiki.services.openoffice.org/wiki/Office_modules_since_OpenOffice.org_2.3 (should be updated, in OOo 3.2 the macro in that page counts 22 modules) /opt/openoffice.org/basis3.2/share/config/soffice.cfg/modules/module/toolbar/name_part.xml In your case module is dbbrowser, so use com.sun.star.sdb.DataSourceBrowser for the DataSourceBrowser. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Missing interfaces in OOo 3.2: Why not a blocker?
Hello Jürgen, * On Thursday 26 November 2009, 12:36, Juergen Schmidt wrote: mmh, it seems that we have a classical problem where you have implemented a macro based on a not documented implementation detail. But the implementation gets cleaned up for 3.2. The problem is that the correct way is also not well documented :-( In this case it would be correct to check the TextPortionType and in case of a text field ask for the property TextField. It should be possible to ask for the property always and do the necessary checks... I am not sure if we can or should mark this as a show stopper because it was an implementation detail. And the clean up of the code makes sense and we don't really want to change it back. Maybe the responsible developer can shed some light on this and give us some more reasons for the change. We have definitely to fix the documentation to reflect the correct way. To avoid such problems in the future it is probably a good idea to ask here on this list first before you use an API that is not documented. Often enough the documentation is simply missing or incomplete. We should be careful with the available introspection tools. They provide great help and are necessary but the user of these tools should at least check the documentation too. This way we can improve the documentation as well. this issue has the same background as the one with the TextCursor properties http://www.openoffice.org/issues/show_bug.cgi?id=100798 For the TextPortion issue, on a DEV300_m65 the documentation seems corrected (though I didn't check every property) http://svn.services.openoffice.org/opengrok/xref/DEV300_m65/offapi/com/sun/star/text/TextPortion.idl#130 IMHO common properties should be moved to the TextRange service (both a TextCursor and a TextPortion are TextRanges). Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Where can I find the SDK for OO 2.4.x?
On Tuesday 24 November 2009, 04:58, Cor Nouws wrote: Ariel Constenla-Haile wrote (24-11-2009 0:58) On Monday 23 November 2009, 18:26, Marco Castillo wrote: I'm looking for the SDK for version 2.4.x of OpenOffice. Can someone show me a link where I can download it? it seems to be disappeared. I can only found the 3.1.1 SDK. search in ftp://ftp.tu-chemnitz.de/pub/openoffice-archive/stable/ or here http://download.openoffice.org/2.4.0/sdk.html (linked via via from download page nowadays) this links to http://archive.services.openoffice.org/pub/openoffice-archive/stable/2.4.0/ but in the last of the 2.4.* series, there is also an SDK http://archive.services.openoffice.org/pub/openoffice-archive/stable/2.4.3/ May be there is a difference between them? besides that it makes sense that, if Marco downloaded OOo 2.4.3, he should also use the 2.4.3 SDK. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Where can I find the SDK for OO 2.4.x?
Hello Marco, On Monday 23 November 2009, 18:26, Marco Castillo wrote: Dear List: I'm looking for the SDK for version 2.4.x of OpenOffice. Can someone show me a link where I can download it? it seems to be disappeared. I can only found the 3.1.1 SDK. search in ftp://ftp.tu-chemnitz.de/pub/openoffice-archive/stable/ Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] loadcomponentfromurl
Hello Wei, On Thursday 05 November 2009, 22:51, Wei Min Teo wrote: I'm not going to use any filters or perhaps it automatically uses a default filter. Anyway, to clarify, I think my problem occurs with opening *.doc or *.ppt files. When I open it prompts me on which character encoding i want to use. This would hang an automation program. this sounds like the Writer encoding text dialog, that shows up for example when you try to open with OOo an unkown file format (by default is treated as text, and you are prompted to select the encoding, etc.) Aren't you passing a filter name? Thus, I thought I could pass in the character encoding set for it to open by using ChracterSet UTF8 in the media descriptor. However, this didn't work even with UTF8. Do I have to use this with some filter implementation? If so, how can i do that? Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] HowTo Customize Number Formats
Hello Irné, On Thursday 22 October 2009, 11:44, Irné Barnard wrote: I'm trying to create some custom number formats for calc. In particular to fix issue 5930. I've already created some add-on functions to format numbers by converting them to strings and back. I'd like to create an extra format type (instead of conversion functions) in the properties dialog so the user could select this, instead of modifying the formula. Unfortunately this would be my first attempt at this level of extension to OOo. Going through the API documentation I'm a bit confused by the *Number Format services, interfaces constant. the API specification is that, an specification, and so abstract. But it you go to the specification for example http://api.openoffice.org/docs/common/ref/com/sun/star/util/NumberFormats.html you'll find links to the Developer's Guide http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Number_Formats where things are explained in detail (at least on this case) It appears to be impossible to add another number format type. yes, it is possible (but at document level, as stated in the Dev's Guide). Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] OO API during slide show
Hello Konstantin, On Thursday 22 October 2009, 07:38, Konstantin Tokarev wrote: Could you explain in detail, what is 'external plugin'? Christian was telling about the feature found when inserting a video from the menu Insert - Object - Video... But this isn't something you can achieve as an OOo extension developer (OOo is just a client of the mozilla plug-ins) Can you explain a little more what you're trying to do? may be someone comes with an alternative idea, something possible for an extension developer. I mean: I'm trying to develop OOo extension with embedded object, which can be controlled with mouse during slide show do you want the user to interact with your object will the slide show is running? (note that - AFAIK - this is also impossible in the user interface, only shapes with links can be clicked, but for the rest, you can not modify/interact/etc shapes while the presentation is running) Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] HowTo Customize Number Formats
Hello Irné, On Thursday 22 October 2009, 13:00, Irné Barnard wrote: The API specification is that, an specification, and so abstract. But it you go to the specification for example http://api.openoffice.org/docs/common/ref/com/sun/star/util/NumberFormats .html you'll find links to the Developer's Guide http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev /Number_Formats where things are explained in detail (at least on this case) It appears to be impossible to add another number format type. yes, it is possible (but at document level, as stated in the Dev's Guide). Thanks for the extra info. So you're saying I'm just saying go study the Developer's Guide!... no, just kidding (though hope you study it) the only way would be to create a custom format in the ODS file itself? custom number formats are stored inside the document (that's all I know from the Dev's Guide, and AFAIK that hasn't changed) In which case, does the extended format also need to be an embedded macro? no, no marco needed; but you need a way to store the format in every OOo document you want to use that format. One way could be to develop a css.task.Job that will be invoked onDocumentOpened (== OnNew + OnLoad), check if the document already has the num. format, and if not then add it. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Bad page numbers when updating table of contents
Hello Stéphane, On Friday 16 October 2009, 08:23, Stéphane Bonhomme wrote: Hello Ariel, Thanks for your solution it works fine. Now I'm trying to set pdf export parameters, but I don't know how to access the configuration service using pyuno, may be someone could give me the path attached is a Python version of http://wiki.services.openoffice.org/wiki/API/Tutorials/PDF_export#Accessing_the_configuration Regards -- Ariel Constenla-Haile La Plata, Argentina # -*- coding: utf-8 -*- # sample client application import uno import unohelper from com.sun.star.beans import NamedValue def get_pdf_config_access( xContext ): Access the PDF configuration. xConfigurationProvider = xContext.ServiceManager.createInstanceWithContext( com.sun.star.configuration.ConfigurationProvider, xContext ) aNamedValue = NamedValue() aNamedValue.Name = nodepath aNamedValue.Value = /org.openoffice.Office.Common/Filter/PDF/Export/ xConfigurationUpdateAccess = xConfigurationProvider.createInstanceWithArguments( com.sun.star.configuration.ConfigurationUpdateAccess, (aNamedValue,) ) return xConfigurationUpdateAccess sConnectionStr = uno:socket,host=localhost,port=8100;urp;StarOffice.ComponentContext localContext = uno.getComponentContext() localServiceManager = localContext.getServiceManager() xURLResolver = localServiceManager.createInstanceWithContext(com.sun.star.bridge.UnoUrlResolver, localContext) remoteContext = xURLResolver.resolve( sConnectionStr ) remoteServiceManager = remoteContext.getServiceManager() xPDFConfig = get_pdf_config_access( remoteContext ) xPDFConfig.setPropertyValue(ReduceImageResolution, True) xPDFConfig.setPropertyValue(MaxImageResolution, 600) # When exporting a document to PDF, the default is PDF 1.4 # Since OOo 2.4 the PDF/A-1a is also supported. # PDF/A-1a is an ISO 19005-1:2005 International Standard. # # NOTE that some other options WILL NOT be available if this format # is selected (UseTaggedPDF, ExportFormFileds, FormsType, # all security options) xPDFConfig.setPropertyValue(SelectPdfVersion, 1) # Magnification specifies the action to be performed # when the PDF document is opened. # A value of 4 opens with the zoom level specified in the # Zoom property. xPDFConfig.setPropertyValue(Magnification, 4) xPDFConfig.setPropertyValue(Zoom, 60) # When using XMultiPropertySet:setPropertyValues(), # properties must be alphabetically sorted! xPDFConfig.setPropertyValues( ( CenterWindow, DisplayPDFDocumentTitle, InitialView, PageLayout ), ( True, False, 2, 1 ) ) # commit the changes, otherwise they will be lost! xPDFConfig.commitChanges() - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Bad page numbers when updating table of contents
Hello Stéphane, On Thursday 15 October 2009, 10:26, Stéphane Bonhomme wrote: Hi, This is my first post here, I'm not experimented with uno but trying to use it for generating pdf from odt documents on a server. It works quite well, my server is running debian and a python server application, so i use pyUno, with openoffice.org 3.1.1 running in headless mode. I managed to open a document and save it to pdf, It was quite easy. The problem I have now appears when updating the table of contents, the page numbers are not correctly set : they are all changed to the first table of contents page number (2) (so the index is updated, in the odt they were set to 1). There might be several reasons to that : - as oo.o runs headless, does it automatically updates the page numbers ? - I call the update() method on the index just after having called loadComponentFromURL, do I need to attach my update to an kind of event (I was wondering if the document were finished to be loaded when I do my update) AFAIK updating the TOC does not force a re-pagination. The easiest is to dispatch a .uno:Repaginate before, or even an .uno:UpdateAll. Nevertheless, I've no idea if this works headless. Try it and tell. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] java MailMerger for open office 3.1.1
Hello René, On Monday 12 October 2009, 10:47, René van Oevelen wrote: Dear Ted, I wonder why nobody is responding to your issue. This is an issue I also raised just before the summer holiday, but it was hard to get any help. It seems the real OOo-specialists worry more about minor issues like removing toolbar items this is no minor issue, at least not for the one that had the problem and tried to solved it, looking for help here. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] java MailMerger for open office 3.1.1
Hello Ted, On Thursday 08 October 2009, 08:30, Ted Zhou wrote: Dear All: I am trying to play with the MailMerger java possibly written more than 5 years ago. as you didn't quote your source, I didn't know what you where talking about, but a little searching makes me think you're talking about http://codesnippets.services.openoffice.org/Writer/Writer.MailMerge.snip Anyone has the latest java MailMerger for Open Office 3.1.1? well, not sure if this is the latest, but I've just finished it (== not very tested, so use it at your risk, only as a tool for further research) http://arielch.fedorapeople.org/devel/OOoMailMerge.zip Many thanks for all your efforts and time. You're welcome; yo should also thank Cor, who pushed me into this ;-) @Jürgen: that snippet should be removed, because is rather misleading. I didn't look much at the source, but does not work anymore (not sure it ever did on something = OOo 2.0). Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] How to remove toolbars items
Hello Alexander, On Monday 12 October 2009, 01:50, Alexander Anisimov wrote: Hello Ariel, I have one more question. I think it last question. Now I know how to operate with toolbar items. But I need to know how to hide or show some toolbar and then save it in document storage. do you want to save the visibility state inside the document? AFAIK this isn't possible. I'm just an API client, so the following is just guessing (Carsten Diesner usually reads this mailing list, sure the mail subject catches his attention; he could give you a better advice, as he developed the code). * as far as I could see, the window state configuration is stored globally; even if the doc has its own UI elements, as long as they are persistent, their window state is stored globally, per module Sub Hide_Standard_Toolbar() Dim oDoc As Object Dim oFrame Dim element Dim layoutmanager oDoc = ThisComponent Dim oUIConfigurationManager as Object oUIConfigurationManager = oDoc.getUIConfigurationManager() oFrame = oDoc.getCurrentController().getFrame() layoutmanager = oFrame.LayoutManager element = layoutmanager.getElement(private:resource/toolbar/standardbar) element.ConfigurationSource = oUIConfigurationManager * does this switch the storage? I mean, if the toolbar wasn't stored in the document, changing the configuration source copies the module toolbar into the document storage? I didn't try if this works. element.Persistent = true * you should do the opposite: setting this to true stores the window state at the module level cf. http://svn.services.openoffice.org/opengrok/xref/DEV300_m61/framework/source/layoutmanager/layoutmanager.cxx#1545 spec. 1573 I'd try the following: * do not access the toolbar by the LayoutManager and then change the ConfigurationSource. Use the way you already learn by getting it from the configuration manager (first try to see if the document already has a customized version in its storage; if not, get it from the module ui config. manager, and copy it in the document ui config. manager). You can make a helper method getToolbar(sResourceURL) for this. This way you make sure that you're always working with the toolbar at document level, not module. * now fool the LayoutManager to set it not visible without storing the window state information: Dim oLayoutManager as Object oLayoutManager = oDoc.getCurrentController().getFrame().getPropertyValue(LayoutManager) Dim oUIElement as Object oUIElement = oLayoutManager.getElement(OOO_WRITER_STANDARD_TOOLBAR) 'Fool the LayoutManager oUIElement.Persistent = False oLayoutManager.hideElement(OOO_WRITER_STANDARD_TOOLBAR) 'Set it Persistent again oUIElement.Persistent = True I've updated the doc with a new sub http://arielch.fedorapeople.org/docs/com.sun.star.ui.XUIConfigirationManager.odt I didn't test much, but that trick seems to work. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
[api-dev] css.document.XDocumentEventBroadcaster supported since when and by who?
Hi there, I used the css.document.XDocumentEventBroadcaster that is supposed to replace the XEventBroadcaster interface, which should not be used anymore , but http://svn.services.openoffice.org/opengrok/xref/DEV300_m61/offapi/com/sun/star/document/XDocumentEventBroadcaster.idl has no since tag and a Job that added a listener did nothing, so I changed the code to work both with the old and the new interfaces: // only listen for documents that can be printed uno::Reference view::XPrintable xPrintable( xModel, uno::UNO_QUERY ); if ( xPrintable.is() ) { uno::Reference document::XDocumentEventBroadcaster xBroadcaster( xModel, uno::UNO_QUERY ); if ( xBroadcaster.is() ) { uno::Reference document::XDocumentEventListener xDocListener( static_cast document::XDocumentEventListener* ( new MyUpdateOnPrintListener() ), uno::UNO_QUERY); xBroadcaster-addDocumentEventListener( xDocListener ); } else { uno::Reference document::XEventBroadcaster xOldBroadcaster( xModel, uno::UNO_QUERY ); if ( xOldBroadcaster.is() ) { uno::Reference document::XEventListener xDocListener( static_cast document::XEventListener* ( new MyUpdateOnPrintListener() ), uno::UNO_QUERY); xOldBroadcaster-addEventListener( xDocListener ); } } } to my surprise, xBroadcaster.is() evaluates to false for every office document (where xPrintable.is() evaluates to true - that, I guess, is every document but OOo Base's ones). The should not be used anymore is rather misleading: or there is a new way to get this broadcaster interface from a document, or no office document is supporting this right now, so you must stay with the old one. Is XDocumentEventBroadcaster supported? By which services? since when? Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
[api-dev] oochemistry plugin
Hello Reinis, @Reinis: I CCed you, but send the answer to d...@api.openoffice.org. It would be better to ask directly there, because you can get feedback from other people and ask directly OOo core developers. If you are not subscribed yet, please send a mail to dev-subscr...@api.openoffice.org and follow the instructions on the mail you'll get back. @people on d...@api: this comes from http://www.openoffice.org/servlets/BrowseList?list=devby=threadfrom=2263410 On Friday 09 October 2009, 10:41, My Th wrote: Hi! I'm working on JChemPaint plug-in for OO.o (oochemistry) I guess you're talking about http://sourceforge.net/projects/oochemistry/ using Jmol plug-in example as reference. @people on d...@api: he's referring to http://arielch.fedorapeople.org/devel/JmolEmbeddedObject.oxt sources: http://arielch.fedorapeople.org/devel/JmolEmbeddedObject.tar.gz I have managed to make a NetBeans project to compile and install into OpenOffice, but it still doesn't do anything. by anything you mean...? could you at least instantiate the factory? I created a menu command, but when I click on it I get error: This operation is not supported on this operating system. If I understood you clearly, you can not insert your embedded object in an OOo document, so you can not test if it works (so your it does not do anything above). The simplest way of inserting an embedded object is from the menu Insert Object OLE Object This will open a dialog like the one you can see here: http://arielch.fedorapeople.org/images/jmol_ole.png For your embedded object to appear on the list, you need a configuration file, in the sample on JmolEmbeddedObject/registry/org/openoffice/Office/Embedding.xcu You have to set the ObjectUIName , which can be localized (on the sample Jmol 3-D chemical structure) [and it may be needed that your factory works; don't know how this is implemented internally, but in other cases I've seen OOo instantiating the factories before filling a list with available features] You may have noticed that you need a UUID as CLSID for your embedded object (you need it both in the Embedding.xcu and the sources). On Linux it's easy to create them ~]$ uuid -v4 -m -n 6 -1 will give you six different UUIDs. You can also try to insert your embedded object using OOo API. See the code on the OOo Basic library inside the Jmol sample (EmbedObjectFactory/EmbedObjectFactoryTest.xba), you can find it among the office libraries if you install the sample OXT. If you want your own menu entry under Insert Object, (like OOo Math has its own under Insert Object Formula), you'll need a ProtocolHandler; and you'll need a little more work (as you have to insert the object, you need to take care of the document type [OLE objects are inserted in a different way on the different OOo applications], the current selection, etc.; and once inserted you have to call a doVerb() on the object to open the UI). I have built Jmol plug-in from the code you provided in mailing list, so my build setup should be ok. take care of the settings in Embedding.xcu, they must match the ones you use in the source code, otherwise your factory can not be instantiated. I'm using NetBeans 6.5 with OpenOffice.org API plug-in 2.0.4 and OpenOffice 3.1.1. I actually have several questions: - How does Jmol example plug-in creates embedded object? I see it is provided in example document, but is it created manually? this may be clear from the answers above. - It looks that my menu command doesn't get to the plug-in code at all, which part is the entrance point into the plug-ins logic? the class implementing com.sun.star.embed.XEmbedObjectFactory. You will have to study this by debugging. Take the Jmol sample NB project, and set breakpoints in every method (specially JmolEmbeddedObjectFactory.createInstanceUserInit() ) Select the NB menu to debug the extension in the target office [this is IMHO the best practice, because it creates a new user directory inside the NB project, that is deleted when you clean the project], then insert a new embedded object via Insert Object OLE Object Jmol 3-D chemical structure, and start debugging. - Which files usually are put under revision control? Should I include NetBeans project files? this is up to you. The best may be to arrange everything so that the sources are independent from the IDE you choose. This way you can create a NB project, a Maven project, an Eclipse project, etc. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] How to remove toolbars items
Hello Alexander, On Friday 02 October 2009, 00:19, Alexander Anisimov wrote: Hi, I am trying to remove toolbars items. I understand how to remove it using LayoutManager. But LayoutManager doesn't save changes to the document storage. you need the com.sun.star.ui.UIConfigurationManager I have read http://specs.openoffice.org/ui_in_general/api/ProgrammaticControlOfMenuAndT oolbarItems.sxw, where said: [quote] User interface configuration manager retrieved from the document model - Make changes to menu and/or toolbars and store them persistently to the document storage. [/quote] I think it is what I need. I know how to open document. After opening the document, I have XComponent Object. And now, how could I take user interface configuration manager? the document implements the com.sun.star.ui.XUIConfigurationManagerSupplier Invoke XUIConfigurationManagerSupplier.getUIConfigurationManager() to access the document's UIConfigurationManager how could I, using user interface configuration manager, remove toolbars items? I understood you are talking here about a document UI, not a module level. If so, then there are two main scenarios: * if the document has already a modified toolbar, you can access it by its resource URL * if the document does not have a customized version of the toolbar you want to modify, then you have to access the toolbar configuration at the module level, and insert the modified version on the document. I do this by getting a writable copy of the module toolbar, so that I con modify it, and then I don't store this changes at the module level but at the document level (I guess that a cleaner approach would be to ask for a read-only copy of the module config. and make an own copy item by item...) Look for sample code at http://arielch.fedorapeople.org/docs/com.sun.star.ui.XUIConfigirationManager.odt Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] How to remove toolbars items
Hello Alexander, On Saturday 10 October 2009, 21:30, Alexander Anisimov wrote: I understood you are talking here about a document UI, not a module level. Yes, you are quite right. I have looked this sample. Its very useful for me. But there is problem: When you getting document configuration manager, it looks like Dim oDoc as Object oDoc = ThisComponent Dim oUIConfigurationManager as Object oUIConfigurationManager = oDoc.getUIConfigurationManager() but I am writing application in Java. And I can not understand how to get this configuration manager. sorry, I was too lazy to write something new in Java, I just copied and pasted some OOo Basic code I have. First lesson in OOo API must be: learn how to use the API reference. So, you don't know how to get access to this method getUIConfigurationManager()? then search for it in the global index: http://api.openoffice.org/docs/common/ref/index-files/index-7.html there you find two methods: getUIConfigurationManager() - function in interface ::com::sun::star::ui:: .XUIConfigurationManagerSupplier getUIConfigurationManager() - function in interface ::com::sun::star::ui:: .XModuleUIConfigurationManagerSupplier the names of the interfaces tell you everything: the one with xxxModulexxx is for accessing the global UI configuration. ::com::sun::star::ui:: XUIConfigurationManagerSupplier is implemented by the documents. So query this last interface on the object you get with loadComponentFromURL(), check the reference is not null, and then invoke getUIConfigurationManager() XComponentContext xContext = Bootstrap.bootstrap(); XMultiComponentFactory xMCF = xContext.getServiceManager(); Object oDesktop = xMCF.createInstanceWithContext(com.sun.star.frame.Desktop, xContext); XComponentLoader xCLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, oDesktop); PropertyValue[] szEmptyArgs = new PropertyValue[0]; XComponent Doc = xCLoader.loadComponentFromURL(private:factory/swriter, _blank, 0, szEmptyArgs); And now, how to get configuration manager. There is no getUIConfiguratinManager method in Doc. you get by loadComponentFromURL() an object that implements XComponent. On that object you have to query all the interfaces it is supposed to implement (or all interfaces you intend to use, if the object does not implement it, you'll get a null reference). In your case, query XUIConfigurationManagerSupplier As it may be quite difficult to remember all interfaces an object implements, for learning the OOo API you may find useful a tool called Xray that can introspect every object in OOo API. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Progress on exporting the Dev Guide to ODT and PDF
Hello Andrew, On Sunday 06 September 2009, 14:40, Andrew Douglas Pitonyak wrote: Exporting the existing syntax highlighting from the Wiki is beyond the current capabilities of the Book (Collection) extension. If anyone has any ideas on how this might be done... I'm definitely open to them :-) I have macros that do something similar in OOo. I apply character styles to different portions of the text to colorize them. The primary macro works based on a cursor selection. I have code that wades through an entire document and color codes what it finds based on paragraph styles. Because I am not aware of your process, I do not know how adaptable this is for your export process. I maintain the latest copy here: http://extensions.services.openoffice.org/project/CodeFormatter applying the code formatter to a huge document like the Developer's Guide seems impossible due to issue http://qa.openoffice.org/issues/show_bug.cgi?id=84159 Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Re: Calc - Column/Row Headers from macro
Hello Bart, On Monday 07 September 2009, 09:18, Bart Aimar wrote: Is possible from macro to control the Column/Row Headers visibility? (Like: Tools Options OpenOffice.org Calc View Window Column/Row Headers ) http://api.openoffice.org/docs/common/ref/com/sun/star/sheet/SpreadsheetViewSettings.html#HasColumnRowHeaders Supposing ThisComponent is a Calc doc., and it has a controller, you can do ThisComponent.getCurrentController().setPropertyValue(_ HasColumnRowHeaders, True) Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] empty string in PropertyValue in dispatch method
On Thursday 03 September 2009, 12:23, Ariel Constenla-Haile wrote: Hello Carsten, On Thursday 03 September 2009, 10:35, Carsten Driesner wrote: Krzysztof Rączkiewicz wrote: Hi, first I was directed to d...@openoffice group but I think that this one is more proper for my problem. I'm developing Java addon for OO3.1. (OOO310m11 Build: 9399) I'm having toggledropdown control and when user select something from that control I get to: - public void dispatch(URL aURL, PropertyValue[] aArguments) then I iterate on the aArguments to find the property with Text name. PropertyValue propertyValue = aArguments[i]; if (propertyValue.Name.equals(Text)) and here I get the text that user selected on the toggledropdown. This one works fine, but I have problem with Dropdownbox. I used same code with dropdownbox and when user select something from dropdown I always get empty string in Text. There's also one other property KeyModifier which Value is always 0. Is it a bug or I'm doing something wrong? I appreciate any help. Hi Krzysztof, Could you please tell me more about your use case? I don't know if you use the complex toolbar controls feature or a dropdownbox within a UNO AWT dialog. I would guess the first case but you can definitely tell me. Do you have a link where I can download the add-on to reproduce your problem? you can reproduce it with your C++ SDK example (see the diff I attached here, the example must be compiled with make DEBUG=yes). Whenever a color from the listbox is selected, it prints Thread: 1 :BaseDispatch::dispatch - Command7 Thread: 1 :[0] KeyModifier = 0 Thread: 1 :[1] Text = Debugging this ... gives me Breakpoint 2, framework::DropdownToolbarController::execute (this=0x7f9a086f6a08, KeyModifier=0) at /mnt/build/openoffice/DEV300_m52/framework/source/uielement/dropdownboxtoolbarcontroller.cxx:204 204 Reference XDispatchxDispatch; (gdb) n 205 Reference XURLTransformer xURLTransformer; (gdb) n 206 ::rtl::OUString aCommandURL; (gdb) n 207 ::rtl::OUString aSelectedText; (gdb) n 208 ::com::sun::star::util::URL aTargetURL; (gdb) n 211 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); (gdb) n 213 if ( m_bDisposed ) (gdb) n 216 if ( m_bInitialized (gdb) n 221 xURLTransformer = m_xURLTransformer; (gdb) n 222 xDispatch = getDispatchFromCommand( m_aCommandURL ); (gdb) n 223 aCommandURL = m_aCommandURL; (gdb) n 224 aTargetURL = getInitializedURL(); (gdb) n 225 aSelectedText = m_pListBoxControl-GetText(); aSelectedText is zero length... Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] empty string in PropertyValue in dispatch method
On Thursday 03 September 2009, 12:28, Ariel Constenla-Haile wrote: On Thursday 03 September 2009, 12:23, Ariel Constenla-Haile wrote: Hello Carsten, On Thursday 03 September 2009, 10:35, Carsten Driesner wrote: Krzysztof Rączkiewicz wrote: Hi, first I was directed to d...@openoffice group but I think that this one is more proper for my problem. I'm developing Java addon for OO3.1. (OOO310m11 Build: 9399) I'm having toggledropdown control and when user select something from that control I get to: - public void dispatch(URL aURL, PropertyValue[] aArguments) then I iterate on the aArguments to find the property with Text name. PropertyValue propertyValue = aArguments[i]; if (propertyValue.Name.equals(Text)) and here I get the text that user selected on the toggledropdown. This one works fine, but I have problem with Dropdownbox. I used same code with dropdownbox and when user select something from dropdown I always get empty string in Text. There's also one other property KeyModifier which Value is always 0. Is it a bug or I'm doing something wrong? I appreciate any help. Hi Krzysztof, Could you please tell me more about your use case? I don't know if you use the complex toolbar controls feature or a dropdownbox within a UNO AWT dialog. I would guess the first case but you can definitely tell me. Do you have a link where I can download the add-on to reproduce your problem? you can reproduce it with your C++ SDK example (see the diff I attached here, the example must be compiled with make DEBUG=yes). Whenever a color from the listbox is selected, it prints Thread: 1 :BaseDispatch::dispatch - Command7 Thread: 1 :[0] KeyModifier = 0 Thread: 1 :[1] Text = Debugging this ... gives me Breakpoint 2, framework::DropdownToolbarController::execute (this=0x7f9a086f6a08, KeyModifier=0) at /mnt/build/openoffice/DEV300_m52/framework/source/uielement/dropdownboxtool barcontroller.cxx:204 204 Reference XDispatchxDispatch; (gdb) n 205 Reference XURLTransformer xURLTransformer; (gdb) n 206 ::rtl::OUString aCommandURL; (gdb) n 207 ::rtl::OUString aSelectedText; (gdb) n 208 ::com::sun::star::util::URL aTargetURL; (gdb) n 211 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); (gdb) n 213 if ( m_bDisposed ) (gdb) n 216 if ( m_bInitialized (gdb) n 221 xURLTransformer = m_xURLTransformer; (gdb) n 222 xDispatch = getDispatchFromCommand( m_aCommandURL ); (gdb) n 223 aCommandURL = m_aCommandURL; (gdb) n 224 aTargetURL = getInitializedURL(); (gdb) n 225 aSelectedText = m_pListBoxControl-GetText(); aSelectedText is zero length... seems this should be aSelectedText = m_pListBoxControl-GetSelectEntry(); instead of aSelectedText = m_pListBoxControl-GetText(); Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] empty string in PropertyValue in dispatch method
On Thursday 03 September 2009, 13:23, Ariel Constenla-Haile wrote: you can reproduce it with your C++ SDK example (see the diff I attached here, the example must be compiled with make DEBUG=yes). Whenever a color from the listbox is selected, it prints Thread: 1 :BaseDispatch::dispatch - Command7 Thread: 1 :[0] KeyModifier = 0 Thread: 1 :[1] Text = Debugging this ... gives me Breakpoint 2, framework::DropdownToolbarController::execute (this=0x7f9a086f6a08, KeyModifier=0) at /mnt/build/openoffice/DEV300_m52/framework/source/uielement/dropdownboxto ol barcontroller.cxx:204 204 Reference XDispatch xDispatch; (gdb) n 205 Reference XURLTransformer xURLTransformer; (gdb) n 206 ::rtl::OUString aCommandURL; (gdb) n 207 ::rtl::OUString aSelectedText; (gdb) n 208 ::com::sun::star::util::URL aTargetURL; (gdb) n 211 vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); (gdb) n 213 if ( m_bDisposed ) (gdb) n 216 if ( m_bInitialized (gdb) n 221 xURLTransformer = m_xURLTransformer; (gdb) n 222 xDispatch = getDispatchFromCommand( m_aCommandURL ); (gdb) n 223 aCommandURL = m_aCommandURL; (gdb) n 224 aTargetURL = getInitializedURL(); (gdb) n 225 aSelectedText = m_pListBoxControl-GetText(); aSelectedText is zero length... seems this should be aSelectedText = m_pListBoxControl-GetSelectEntry(); instead of aSelectedText = m_pListBoxControl-GetText(); yes, now with m_pListBoxControl-GetSelectEntry() works fine [cf. how css.awt.XListBox.getSelectedItem() ends up in http://svn.services.openoffice.org/opengrok/xref/DEV300_m56/toolkit/source/awt/vclxwindows.cxx#1713] Thread: 1 :BaseDispatch::dispatch - Command7 Thread: 1 :[0] KeyModifier = 0 Thread: 1 :[1] Text = Blue Thread: 1 :BaseDispatch::dispatch - Command7 Thread: 1 :[0] KeyModifier = 0 Thread: 1 :[1] Text = Blue Thread: 1 :BaseDispatch::dispatch - Command7 Thread: 1 :[0] KeyModifier = 16384 Thread: 1 :[1] Text = Yellow Thread: 1 :BaseDispatch::dispatch - Command7 Thread: 1 :[0] KeyModifier = 0 Thread: 1 :[1] Text = Black Thread: 1 :BaseDispatch::dispatch - Command7 Thread: 1 :[0] KeyModifier = 8192 Thread: 1 :[1] Text = Blue selected inputmethod style = PreeditNothing StatusNothing Thread: 1 :BaseDispatch::dispatch - Command7 Thread: 1 :[0] KeyModifier = 0 Thread: 1 :[1] Text = Yellow Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] empty string in PropertyValue in dispatch method
Hello Krzysztof, On Thursday 03 September 2009, 14:29, Krzysztof Rączkiewicz wrote: seems this should be aSelectedText = m_pListBoxControl-GetSelectEntry(); instead of aSelectedText = m_pListBoxControl-GetText(); yes, now with m_pListBoxControl-GetSelectEntry() works fine ok, thanks for checking that. I suppose I will need to use toggledropdown for that control. Does this fix will be avaliable in next OO release (3.1.1)? no, 3.1.1 is closed ( http://wiki.services.openoffice.org/wiki/OOoRelease311 ) chances are you'll get this fixed for 3.2.0 ( http://wiki.services.openoffice.org/wiki/OOoRelease32 ), released by end of November. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Detecting which button was pressed with a Basic Macro
Hello Johnny, On Sunday 30 August 2009, 12:57, Johnny Rosenberg wrote: I have a dialogue with some buttons and boxes. Eight of the buttons does basically the same thing, but to different objects, so I need to write 8 macros for these, one for each button, since I can not call a subroutine with parameters from a command button. but you get an event object, see bellow... My solution right now is to let the buttons call each own subroutine, for example the first button calls: Sub MySub1 MySub(1) End Sub So all the subroutines call MySub, but with different parameters, and of course MySub looks something like this: Sub MySub(X As Integer) Dim CtlName As String Dim Ctl As Object Ctl=Dlg.getControl(ComboBox + LTrim(Str(X))) ' Well, then it's doing stuff with Ctl and so on… End Sub Of the easiest way would to assign the first button to MySub(1) and so on, making 8 subroutines unnecessary, but no matter what I try it doesn't seem like this is possible. Another solution would be to let all the 8 buttons call this one and only subroutine: Sub MySub Dim X As String X=Blahblah ' The name of the last button that was pressed… Select Case X Case CommandButton1 'Do something 'And so on End Select End Sub Hm… when thinking about it, this solution is maybe not that much convenient after all… Suggestions? assign all the buttons to the same macro: Sub BtnPressed(oEvent as Object) Dim oControl as Object Dim oModel as Object oControl = oEvent.Source oModel = oControl.getModel() End Sub In this way, you can access the control and its model, and check what button was pressed (by checking the control's model name, which is unique; or by setting an action command to each button; etc. etc. use your imagination) Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Detecting which button was pressed with a Basic Macro
Hello Drew, On Sunday 30 August 2009, 13:49, Drew Jensen wrote: Ariel Constenla-Haile wrote: Sub BtnPressed(oEvent as Object) Dim oControl as Object Dim oModel as Object oControl = oEvent.Source oModel = oControl.getModel() End Sub In this way, you can access the control and its model, and check what button was pressed (by checking the control's model name, which is unique; or by setting an action command to each button; etc. etc. use your imagination) Just one caveat. The button names will be unique when you add them to a document via the controls toolbar or a wizard - but there is no requirement that they be so. Copy controls from one document to another and most likely they will not be. So you (the macro programmer) must take care not break uniqueness as you modify your controls if you intend to use the names in this fashion. I guess you're talking about forms. But Johnny asked about dialogues, and here the control's model name is unique: the css.awt.UnoControlDialogModel is a container for control models and supports the css.container.XNameContainer interface, which throws a css.container.ElementExistException if the name is not unique. Sub Main Dim oDlg oDlg = CreateUnoDialog(DialogLibraries.Standard.Dialog1) Dim oControlModel oControlModel = oDlg.getModel().createInstance(com.sun.star.awt.UnoControlFixedTextModel) oControlModel.Label = Label 1 oControlModel.Width = 100 oControlModel.Height = 8 oDlg.getModel().insertByName(Demo1, oControlModel) oControlModel = oDlg.getModel().createInstance(com.sun.star.awt.UnoControlFixedTextModel) oControlModel.Label = Label 2 oControlModel.Width = 100 oControlModel.Height = 8 oControlModel.PositionY = 9 oDlg.getModel().insertByName(Demo2, oControlModel) oDlg.execute() End Sub Change Demo2 by Demo1 and you'll see it. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] An export macro in OpenImpress
Hello Stefano, On Wednesday 26 August 2009, 04:18, Advice Communication wrote: Hi Expert, I would to know If is it possible to create a macro that : Save in odp format (ex: 1.opd) And Export in jpg format (ex: 1.jpg) In the same time. You can export page by page to image format, something like: Option Explicit Sub ExportODP2PNG Dim FOLDER_NAME$ FOLDER_NAME = impress_export_demo GlobalScope.BasicLibraries.loadLibrary(Tools) Dim oDoc as Object oDoc = ThisComponent If HasUnoInterfaces(oDoc, com.sun.star.lang.XServiceInfo) Then If NOT oDoc.supportsService(_ com.sun.star.presentation.PresentationDocument) Then Exit Sub End If Else Exit Sub End If Dim sBaseURL$ If oDoc.hasLocation() Then sBaseURL = DirectoryNameoutofPath(oDoc.getURL(), /) Else sBaseURL = getTempDir() + / + FOLDER_NAME End If Dim oExporter oExporter = CreateUnoService(com.sun.star.drawing.GraphicExportFilter) Dim oDrawPages as Object oDrawPages = oDoc.getDrawPages() Dim oDrawPage as Object Dim aProps(1) as New com.sun.star.beans.PropertyValue aProps(0).Name = MediaType aProps(0).Value = image/png aProps(1).Name = URL Dim n For n = 0 To oDrawPages.getCount()-1 oDrawPage = oDrawPages.getByIndex(n) aProps(1).Value = sBaseURL + /images/ + CStr(n) + .png oExporter.setSourceDocument(oDrawPage) oExporter.filter(aProps) Next If oDoc.hasLocation() and NOT oDoc.isReadonly() Then oDoc.store() Else oDoc.storeAsURL(sBaseURL + / + FOLDER_NAME + .odp, Array()) End If End Sub Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] How do I close the QuickStarter via command-line or Window messages?
Hello Jürgen, On Monday 24 August 2009, 03:34, Juergen Schmidt wrote: mmh, an undocumented service ... with a not really known API. I can image that such a service can be really helpful and we should maybe think about a well designed and documented one. So please don't expect that this code will work in the future as well. You're right, I was going to add at the end of the mail the warning: all these stuff is internal , that is: not published nor unpublished API. This means it has no contract to its API clients, and may change or even not work at all; if you find its behavior changes, you'll have to look at the implementation http://svn.services.openoffice.org/opengrok/xref/DEV300_m55/sfx2/source/appl/shutdownicon.hxx http://svn.services.openoffice.org/opengrok/xref/DEV300_m55/sfx2/source/appl/shutdownicon.cxx and for win relative stuff: http://svn.services.openoffice.org/opengrok/xref/DEV300_m55/sfx2/source/appl/shutdowniconw32.cxx Jan can keep an eye on them while submitting an issue (I guess sfx2 belongs to the framework team) and wait for it to be fixed. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] How do I close the QuickStarter via command-line or Window messages?
Hello Jan, On Monday 24 August 2009, 17:28, Jan Holst Jensen wrote: Ariel Constenla-Haile wrote: the quickstarter listens for desktop termination. AFAIK you have to options 1) You can tell it not to throw a veto, this way: Sub Quickstater Dim oQS as Object oQS = CreateUnoService(com.sun.star.office.Quickstart) oQS.setFastPropertyValue(0, FALSE) End Sub Hi Ariel. Thanks. Tried it out and it works as you describe. However, if I don't have any documents open and I only want to close the Quickstarter itself, it seems that I first need to open a document and then ask that to close to get the Quickstarter to go away (?). That might work, but seems a little cumbersome. 2) fully disabling it, closing it if opened: Sub Quickstater Dim oQS as Object oQS = CreateUnoService(com.sun.star.office.Quickstart) Dim aAny(1) aAny(0) = False aAny(1) = False oQS.initialize(aAny) End Sub It does disable the Quickstarter in the sense that it won't be started next time I log on, but the Quickstarter does not exit on my machine (running the released OOo 3.1). So - doesn't really work for me, and I don't want the Quickstarter disabled, just all of OpenOffice closed before I install an extension. ups I also forgot to mention that only used this on Linux, and as you could see in the source, the implementation is system-dependent (there is a quickstarter for Win, another for Mac, and another for Linux-Gnome), and it seems they behave different. However, your later post that included links to the source gave me a solution. I will respond to that later post with what I found. yes, please post what you find on Windows (it may help others looking for a way to control the quickstarter ... as Jürgen said, an API for this would be the optimal solution). Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] How do I close the QuickStarter via command-line or Window messages?
Hello Jan, On Sunday 23 August 2009, 20:32, Jan Holst Jensen wrote: Hi all. A month or two ago someone asked this same question but I don't recall seeing an answer. How can you close the OpenOffice Quickstarter tray icon on Windows ? The only way I know is to manually right-click the tray icon and choose Exit Quickstarter but I would really like to do this programatically. the quickstarter listens for desktop termination. AFAIK you have to options 1) You can tell it not to throw a veto, this way: Sub Quickstater Dim oQS as Object oQS = CreateUnoService(com.sun.star.office.Quickstart) oQS.setFastPropertyValue(0, FALSE) End Sub You will still see the systray icon, but when you close the last application window, the quickstarter closes itself and the office process will finish. 2) fully disabling it, closing it if opened: Sub Quickstater Dim oQS as Object oQS = CreateUnoService(com.sun.star.office.Quickstart) Dim aAny(1) aAny(0) = False aAny(1) = False oQS.initialize(aAny) End Sub Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] DockingWindows Java
Hello Christina, Carsten, On Friday 21 August 2009, 03:52, Carsten Driesner wrote: I tried to give up on docking support and I've chosen the solution with UNO dialogs. My dialog with the tree control should be non-modal. If the current document window is the parent of my window , my window is not modal . (the user cannot change the focus window- document). There is something I don't understand in your last two sentences. For me it looks like a conflict. If a window is not in modal mode a user CAN change the focus. E.g. the file dialog always starts in modal mode and you cannot change focus to the dependent document window. Sorry, my bad , I intended to write modal. If I set the parent to be the desktop , the two windows are totally independent. In this case I have to handle manually every event like closing the window, resizing it etc ( when the user closes the document window I need my small dialog to be closed too). Is there any other alternative that allows the two windows to be dependent, but also the focus to be changed? How do you start the dialog? Please don't use execute() which starts the dialog in modal mode. You have to use show() otherwise you could see the described behavior. I start the dialog with execute() method from XDialog interface. The XDialog interface doesn't seem to offer a show() method. Is there any other place where I find it? For now , I create a non-modal dialog , creating a different window which is invisible and setting this window as Peer for my dialog. Of course this is a temporary solution because I would need to handle all the events from the document window. Sorry for the late answer but I have tried to look for a solution. Unfortunately I wasn't able to find anything what can help you here. The object you get via the DialogProvider service just implements XDialog and XTopWindow neither implements anything that you need. I fear that your workaround is currently the best available solution. Please write a request for enhancement and the owner to c...@openoffice.org. I hope that we can extend the implementation to support your use case. I think that one of the issues here is that - according to the API specification - a top window is not a window ... Anyway, the css.awt.XDialog is an css.awt.XTopWindow, so it implements also css.awt.XWindow. Query for this last interface and invoke setVisible(false). You will have to take care of three (or more) things: * setting the window not visible does not close it; there is no close() method for awt windows, you have to dispose them by invoking dispose() * but you have to dispose them when listening at two things: ** when the parent window is being closed: if the window you set at its parent is closed, you may surely want to also close your window ** if you set the frame's container window as parent, it may happen that the document gets closed but not the container window (for example, when this is the last appl. window opened and the user presses the X on the menu bar to close the document but not terminate the office; or when the frame is reused to load another component in it). In case you want your modal-less window to be closed when the document it was opened for gets closed, you have to listen for the document closing event. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] ODT to Windows Help file format - help needed in more than one sense.
Hello Jan, On Wednesday 12 August 2009, 10:11, Jan Holst Jensen wrote: Hi list. I have developed a Calc extension which I am about to release. The documentation for the extension is provided as PDF which Writer produces easily and with a nice result. However, in case the end-user doesn't have a PDF reader I would like to provide the documentation as a Windows Help file too. and what if the user does not have a PDF reader NOR a CHM reader (on a Linux installation you won't find one by default)? Didn't you try OOo Help? this will be cross-platform and of course integrated into OOo. http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Extensions/Help_Content I have tried saving my document as HTML and also exporting it as XHTML with terrible .CHM files as a result (using the Microsoft Help compilers to produce HtmlHelp .CHM format). Saving as .RTF and using MS's WinHelp compiler also produces a next-to-unreadable result. What do you guys do if you need to produce Windows Help files ? isn't this a question for a CHM-help mailing list? All Writer does is HTML export (you already tried Writer HTML CHM compiler, so I can't think of another way). Does a PDF-to-Help-file converter exist (as a last resort) ? I've seen html to chm, chm to html, chm to pdf, but pdf to chm not. You should Google PDF to CHM and see if there is something useful. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Need to download the OOo 2.1 Source
Hello Scott, On Wednesday 12 August 2009, 12:28, Herter, S. wrote: We had a crash that wiped out part of our CVS repository. We still ship a product that has OpenOffice 2.1 embedded in it and I can't find the OpenOffice 2.1 source to download from anywhere. All of the links are dead, either a 404 error or nothing there. Does anyone know of someplace I can download the 2.1 source from? go to http://distribution.openoffice.org/mirrors/#mirrors and look in the archive column Not sure if you will find a 2.1 src anyway (for what I've seen the Technische Universität Chemnitz for example has no 2.1 src, but 2.2.0 http://ftp.tu-chemnitz.de/pub/openoffice-archive/stable/2.1.0/ http://ftp.tu-chemnitz.de/pub/openoffice-archive/stable/2.2.0/ And I guess you can still checkout the 2.1 src via CVS with something like: ]$ export CVSROOT=:pserver:anon...@anoncvs.services.openoffice.org:2401/cvs ]$ cvs login Logging in to :pserver:anon...@anoncvs.services.openoffice.org:2401/cvs CVS password: type anoncvs ]$ cvs co OpenOffice2/OpenOffice_2_1_0 Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
[api-dev] NetBeans OOo API plug-in for NB 6.7
Hi all, as NB 6.7 is out there, the question will come: is there a release date for the OOo API plug-in for NB 6.7? Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
[api-dev] Re: [interface-discuss] adding a method to a published interface
Hello Frank, On Monday 29 June 2009, 07:43, Frank Schönheit - Sun Microsystems Germany wrote: Hi, would adding a method to an existing published interface be considered too incompatible for a 3.2 release? In particular, css.awt.XView has a method setZoom, but not a getZoom, which I'd like to add. I could create a crutch called XView2, deriving from XView, having only this one said method. However, it would lead to a better API (IMO), if we would simply add the method to XView. Now XView is published, but did't we say that there's a certain type of incompatible API changes which we should consider to allow for non-major OOo releases? was there an agreement on that? I didn't have time to understand the reasons given for adding a FilterOperator2, carrying with it a TableFilterField2 and a XSheetFilterDescriptor2; but the names just tell me there was no agreement. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
[api-dev] Re: I have five text frames on the one page, can I move each frame to a new page?
Hello Chris, On Wednesday 24 June 2009, 03:06, chris.fleischm...@sun.com wrote: Hello Hrm, I have read through your example... Thank you very much... I am still stuck... Just a newbie... I'm sure its a simple solution.. Just cant find it :-( the problem with your code is that the document with the text frames has only *one* paragraph, so there is no change to have page breaks == different pages (a page break is a paragraph property, you only have one paragraph == then, all text frames are anchored to the very same paragraph; then, when you get the anchor and insert a page break, you only have one page because it is the very same and only paragraph you are modifying). The solution is to insert a new paragraph right after you insert a text frame, like in my code: private void insertTextFrames(XTextDocument xTextDocument){ try { XMultiServiceFactory xDocFactory = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, xTextDocument); XText xText = xTextDocument.getText(); XTextCursor xTextCursor = xText.createTextCursorByRange(xText.getStart()); // first insert the text frames for (int i = 0; i FRAMES_COUNT; i++) { insertTextFrame(xDocFactory, xTextCursor); insertParaBreak(xTextCursor); } } catch (Exception e) { e.printStackTrace(); } } Please see my code here below: see the change I've made to your code (look at the /*===*/ in line 241). The change only answers the subject of this thread (Re: I have five text frames on the one page, can I move each frame to a new page?): now every frame is in its own page. You will have to fix other things to achieve what you're looking for. Regards -- Ariel Constenla-Haile La Plata, Argentina package org.openoffice.sdk; import com.sun.star.awt.Size; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; import com.sun.star.comp.helper.Bootstrap; import com.sun.star.container.XIndexAccess; import com.sun.star.container.XNameAccess; import com.sun.star.container.XNameContainer; import com.sun.star.datatransfer.XTransferable; import com.sun.star.datatransfer.XTransferableSupplier; import com.sun.star.drawing.XShape; import com.sun.star.frame.XComponentLoader; import com.sun.star.frame.XController; import com.sun.star.frame.XStorable; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiComponentFactory; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.style.XStyleFamiliesSupplier; import com.sun.star.text.ControlCharacter; import com.sun.star.text.HoriOrientation; import com.sun.star.text.TextContentAnchorType; import com.sun.star.text.VertOrientation; import com.sun.star.text.XPageCursor; import com.sun.star.text.XText; import com.sun.star.text.XTextContent; import com.sun.star.text.XTextCursor; import com.sun.star.text.XTextDocument; import com.sun.star.text.XTextFrame; import com.sun.star.text.XTextFramesSupplier; import com.sun.star.text.XTextRange; import com.sun.star.text.XTextViewCursor; import com.sun.star.text.XTextViewCursorSupplier; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; public class TextDocumentStructure { private XTextDocument xTextDocument_src; private XTextDocument xTextDocument_dest; private XMultiServiceFactory xWriterFactory; private XComponent xWriterComponent_src; private XComponent xWriterComponent_dest; private Size page_size; private Size frame_size; public static void main(String args[]) { TextDocumentStructure tds = new TextDocumentStructure(); tds.copyContents(); tds.moveTextFrames(); // tds.saveFile(); System.exit(1); } public TextDocumentStructure() { try { // get the remote office component context XComponentContext xRemoteContext = Bootstrap.bootstrap(); if (xRemoteContext == null) { System.err.println(ERROR: Could not bootstrap default Office.); } XMultiComponentFactory xRemoteServiceManager = xRemoteContext.getServiceManager(); Object desktop = xRemoteServiceManager.createInstanceWithContext( com.sun.star.frame.Desktop, xRemoteContext); XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktop); PropertyValue[] loadProps = new PropertyValue[0]; xWriterComponent_src = xComponentLoader.loadComponentFromURL(private:factory/swriter, _blank, 0, loadProps); xWriterComponent_dest
Re: [api-dev] RV: Embedded Image
Hello Emilio, On Tuesday 23 June 2009, 11:09, Emilio Cano - Tecnotur 3000 wrote: Hello!! I have not received a response on this issue. you got answered the very same day http://api.openoffice.org/servlets/BrowseList?list=devby=threadfrom=2243227 Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Problems with handling a xTextEmbeddedObject
Hello Benjamin, On Sunday 21 June 2009, 08:20, bvoll...@informatik.uni-bremen.de wrote: Hi everybody, my teammate is trying to insert an OLE object in a writer document like in the OOo menu structure create from file with a given ODS file. That's what he got for now. But the inserted object shows always only an extract of the table which is just ca. nine cm in width and ca. three cm in height. But he wants to see the entire table, if the table is bigger than the size of 9x3. ... How can he manipulate the size of the embedded object? see the Java source code attached. @Mikhail Voytenko: I took the freedom to CCed you (IIRC you master the subject). Here are some doubts I had when looking at the code that used to work fine in OOo 2.x: * if you see the C++ code attached, in previous versions I had to change first the size of the BaseFrame object's shape (that is, change the size of the visual representation), and then change the embedded object's visual area size. Now changing the embedded object's visual area updates automatically the shape's size, am I right? Changing first the shape's size makes the spreadsheet document rows higher. * May be an issue (or my code is bad...): I'm changing the embedded object's visual area size, so that it's width is no wider than the width of (the text document page - left/right margins). But the resulting width is indeed wider. See the example output: Embedded object Info: getAspect()= 1 getMapUnit() = 0 getVisualAreaSize().Width = 9,03 cm getVisualAreaSize().Height = 2,13 cm BaseFrame object Info: Width = 9,03 cm Height = 2,13 cm Spreadsheet Used Area size: Width = 22,67 cm Height = 6,41 cm TextDocument page text area size: Width = 17,00 cm Height = 25,70 cm New size for the embedded object: Width = 17,00 cm Height = 6,41 cm Press ENTER to change the size of embedded object's visual area BaseFrame object new size: Width = 18,07 cm Height = 6,38 cm Regards -- Ariel Constenla-Haile La Plata, Argentina /* * EmbeddedCalcResizer.java * */ package org.openoffice.sdk; import com.sun.star.awt.Size; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; import com.sun.star.comp.helper.Bootstrap; import com.sun.star.container.XIndexAccess; import com.sun.star.container.XNameAccess; import com.sun.star.document.XEmbeddedObjectSupplier2; import com.sun.star.embed.XEmbeddedObject; import com.sun.star.frame.FrameSearchFlag; import com.sun.star.frame.XComponentLoader; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.sheet.XCellRangeAddressable; import com.sun.star.sheet.XSheetCellCursor; import com.sun.star.sheet.XSpreadsheet; import com.sun.star.sheet.XSpreadsheetDocument; import com.sun.star.sheet.XSpreadsheets; import com.sun.star.sheet.XUsedAreaCursor; import com.sun.star.style.XStyleFamiliesSupplier; import com.sun.star.table.CellRangeAddress; import com.sun.star.table.XCell; import com.sun.star.table.XColumnRowRange; import com.sun.star.table.XTableColumns; import com.sun.star.table.XTableRows; import com.sun.star.text.ControlCharacter; import com.sun.star.text.XText; import com.sun.star.text.XTextContent; import com.sun.star.text.XTextCursor; import com.sun.star.text.XTextDocument; import com.sun.star.text.XTextRange; import com.sun.star.uno.XComponentContext; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.UnoRuntime; import java.io.BufferedReader; import java.io.InputStreamReader; /** * * @author ariel */ public class EmbeddedCalcResizer { private XComponentContext m_xContext; /** Creates a new instance of EmbeddedCalcResizer */ public EmbeddedCalcResizer(XComponentContext xContext) { this.m_xContext = xContext; } /** * @param args the command line arguments */ public static void main(String[] args) { int nRet = 0; try { // get the remote office component context XComponentContext xContext = Bootstrap.bootstrap(); if (xContext == null) { System.err.println(ERROR: Could not bootstrap default Office.); nRet = -1; } EmbeddedCalcResizer demo = new EmbeddedCalcResizer(xContext); demo.runDemo(); waitForInput(\nPress ENTER to finish the example\n); } catch (java.lang.Exception e) { e.printStackTrace(); } finally { System.exit(nRet); } } protected void runDemo() { try { // load a new empty OOo Writer document XTextDocument xTextDocument = createWriterDoc(m_xContext); // get the document's factory XMultiServiceFactory xDocFactory = (XMultiServiceFactory) UnoRuntime.queryInterface
Re: [api-dev] Embedded Image
Hello Fernand, On Tuesday 16 June 2009, 09:48, Fernand Vanrie wrote: Emilio , you need first a shape who has a internal URL and then use these internal URL for your embedded Graphic us code like: GraphicURL := ConvertirAURL(archivo); oOriginalGraph = getGraphFromUrl(sGraphicURL) oShape = oDocument.createInstance(com.sun.star.drawing.GraphicObjectShape) oGraphic1 = oDocument.createInstance(com.sun.star.text.GraphicObject) oDocument.getDrawPage().add(oShape) oShape.Graphic = oOriginalGraph oGraphic1.GraphicUrl = oShape.GraphicUrl ' Insert at the current cursor location oText.insertTextContent(oDocument.getCurrentController().getViewCursor(), oGraphic1, false) 'We no longer require the shape object. oDocument.getDrawPage().reMove(oShape) this is what I'd call the the old work-around/bad way http://api.openoffice.org/servlets/ReadMsg?list=devmsgNo=20941 Now just use the Graphic property, instead of the GraphicURL. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Embedded Image
Hello Fernand, On Tuesday 16 June 2009, 10:13, Fernand Vanrie wrote: Hallo Ariel , the opengrok link is not working, change DEV300_m** by the most recent, like DEV300_m50 http://svn.services.openoffice.org/opengrok/xref/DEV300_m50/odk/examples/java/Text/GraphicsInserter.java#155 maybe you can write it down in basic? :-) here you have it :-) REM * BASIC * Option Explicit Sub Writer_Demo Dim oDoc as Object oDoc = CreateNewDoc(writer) Dim sImage$ sImage = getGalleryPath() /www-back/aqua.jpg Dim oImage as Object oImage = CreateEmbeddedGraphicObject(oDoc, sImage) oImage.Width = 5000 oImage.Height = 5000 Dim oText as Object, oCursor as Object oText = oDoc.getText() oCursor = oText.createTextCursorByRange(oText.getStart()) oText.insertTextContent(oCursor, oImage, False) End Sub Sub Draw_Demo Dim oDoc as Object oDoc = CreateNewDoc(draw) Dim oDrawPage as Object oDrawPage = oDoc.getDrawPages().getByIndex(0) Dim sImage$ sImage = getGalleryPath() /www-back/aqua.jpg Dim oImage as Object oImage = CreateEmbeddedGraphicObject(oDoc, sImage) Dim aSize as New com.sun.star.awt.Size aSize.Width = 5000 aSize.Height = 5000 Dim aPos as New com.sun.star.awt.Point aPos.X = CInt(oDrawPage.Width/2 - aSize.Width/2) aPos.Y = CInt(oDrawPage.Height/2 - aSize.Height/2) oImage.setSize(aSize) oImage.setPosition(aPos) oDrawPage.add(oImage) End Sub Function CreateNewDoc( sDocType as String, _ Optional MediaDescriptor(), _ Optional sFrame as String ) as Object On Error Resume Next If IsMissing(MediaDescriptor()) then MediaDescriptor() = Array() If IsMissing(sFrame) then sFrame = _default CreateNewDoc = StarDesktop.loadComponentFromURL(_ private:factory/s sDocType , _ sFrame, 0, MediaDescriptor()) End Function Function CreateEmbeddedGraphicObject( oDoc as Object, sURL as String ) as Object On Error Resume Next Dim sService as String If oDoc.supportsService(com.sun.star.text.TextDocument) Then sService = com.sun.star.text.TextGraphicObject Else sService = com.sun.star.drawing.GraphicObjectShape End If Dim oGraphicObject as Object oGraphicObject = oDoc.createInstance(sService) oGraphicObject.setPropertyValue(Graphic, getGraphicFromURL(sURL)) CreateEmbeddedGraphicObject = oGraphicObject End Function Function getGraphicFromURL( sURL as String) as com.sun.star.graphic.XGraphic On Error Resume Next Dim oGraphicProvider as Object oGraphicProvider = createUnoservice(com.sun.star.graphic.GraphicProvider) Dim aMediaProperties(0) as New com.sun.star.beans.PropertyValue aMediaProperties(0).Name = URL aMediaProperties(0).Value = sURL getGraphicFromURL = oGraphicProvider.queryGraphic(aMediaProperties) End Function Function getGalleryPath() as String On Error Resume Next Dim oPathSettings as Object oPathSettings = createUNOService(com.sun.star.util.PathSettings) Dim sPath$ sPath = oPathSettings.getPropertyValue(Gallery) If InStr(sPath, ;) Then Dim sPaths() sPaths = Split(sPath, ;) sPath = sPaths(0) End If getGalleryPath = sPath End Function Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] NB plug-in: Debug Extension in Target OOo fails on OOO310_m11
Hello Stephan, Steffen, * On Monday 18 May 2009, 05:45, Stephan Bergmann wrote: Sounds like a consequence of http://qa.openoffice.org/issues/show_bug.cgi?id=101457 javaldx searches for Java on every startup. yes indeed, and your patch has fixed it on my DEV300_m48 :-) Log attached here this happens for me (on Solaris x86) even without NetBeans etc. I simply add e.g. -Xdebug -Xrunjdwp:transport=dt_socket,address=8701 as parameters to the JavaVM in OpenOffice.org. The next time I start OpenOffice.org, I get the message box stating the JRE is defect. I cannot reproduce this on Windows. this means no debugging at all (even attaching) on Linux and Solaris. I guess API developers on these plataforms will need you to upload somewhere a patched build of jvmfwk (or wait untill 3.1.1?) Regards -- Ariel Constenla-Haile La Plata, Argentina setting up UNO environment ... build UNO idl files finished uno-idl-compile: init: deps-jar: compile: Building jar: /media/pendrive2/OOo_SDK_EXAMPLES/Java_examples/UNO_Component/EmbeddedObject/dist/EmbeddedObject.uno.jar Updating property file: /media/pendrive2/OOo_SDK_EXAMPLES/Java_examples/UNO_Component/EmbeddedObject/build/regclass.properties Updating property file: /media/pendrive2/OOo_SDK_EXAMPLES/Java_examples/UNO_Component/EmbeddedObject/build/regclass.properties jar: Building jar: /media/pendrive2/OOo_SDK_EXAMPLES/Java_examples/UNO_Component/EmbeddedObject/dist/EmbeddedObject.uno.jar images: registry: creating UNO extension package ... Building zip: /media/pendrive2/OOo_SDK_EXAMPLES/Java_examples/UNO_Component/EmbeddedObject/dist/EmbeddedObject.oxt uno-package: debugging UNO extension package ... /home/ariel/OOo_DEV300_m48_dbgutil/openoffice.org3/program/unopkg gui -f /media/pendrive2/OOo_SDK_EXAMPLES/Java_examples/UNO_Component/EmbeddedObject/dist/EmbeddedObject.oxt [Java framework] Using configuration file file:///home/ariel/OOo_DEV300_m48_dbgutil/openoffice.org/ure/lib/jvmfwk3rc [Java framework] Using bootstrap parameter UNO_JAVA_JFW_USER_DATA = file:///media/pendrive2/OOo_SDK_EXAMPLES/Java_examples/UNO_Component/EmbeddedObject/build/soffice_debug/user/config/javasettings_Linux_x86.xml file:///home/ariel/.ure/javasettings_Linux_x86.xml. [Java framework] Using bootstrap parameter UNO_JAVA_JFW_USER_DATA = file:///media/pendrive2/OOo_SDK_EXAMPLES/Java_examples/UNO_Component/EmbeddedObject/build/soffice_debug/user/config/javasettings_Linux_x86.xml file:///home/ariel/.ure/javasettings_Linux_x86.xml. [Java framework] Using bootstrap parameter UNO_JAVA_JFW_USER_DATA = file:///media/pendrive2/OOo_SDK_EXAMPLES/Java_examples/UNO_Component/EmbeddedObject/build/soffice_debug/user/config/javasettings_Linux_x86.xml file:///home/ariel/.ure/javasettings_Linux_x86.xml. [Java framework] Using bootstrap parameter UNO_JAVA_JFW_USER_DATA = file:///media/pendrive2/OOo_SDK_EXAMPLES/Java_examples/UNO_Component/EmbeddedObject/build/soffice_debug/user/config/javasettings_Linux_x86.xml file:///home/ariel/.ure/javasettings_Linux_x86.xml. [Java framework] Using bootstrap parameter UNO_JAVA_JFW_USER_DATA = file:///media/pendrive2/OOo_SDK_EXAMPLES/Java_examples/UNO_Component/EmbeddedObject/build/soffice_debug/user/config/javasettings_Linux_x86.xml file:///home/ariel/.ure/javasettings_Linux_x86.xml. [Java framework] Using bootstrap parameter UNO_JAVA_JFW_SHARED_DATA = file:///home/ariel/OOo_DEV300_m48_dbgutil/openoffice.org3/program/../share/config/javasettings_Linux_x86.xml file:///etc/opt/ure/javasettings_Linux_x86.xml. [Java framework] Using bootstrap parameter UNO_JAVA_JFW_USER_DATA = file:///media/pendrive2/OOo_SDK_EXAMPLES/Java_examples/UNO_Component/EmbeddedObject/build/soffice_debug/user/config/javasettings_Linux_x86.xml file:///home/ariel/.ure/javasettings_Linux_x86.xml. [Java framework] Using bootstrap parameter UNO_JAVA_JFW_USER_DATA = file:///media/pendrive2/OOo_SDK_EXAMPLES/Java_examples/UNO_Component/EmbeddedObject/build/soffice_debug/user/config/javasettings_Linux_x86.xml file:///home/ariel/.ure/javasettings_Linux_x86.xml. [Java framework] Using bootstrap parameter UNO_JAVA_JFW_USER_DATA = file:///media/pendrive2/OOo_SDK_EXAMPLES/Java_examples/UNO_Component/EmbeddedObject/build/soffice_debug/user/config/javasettings_Linux_x86.xml file:///home/ariel/.ure/javasettings_Linux_x86.xml. [Java framework] Using bootstrap parameter UNO_JAVA_JFW_USER_DATA = file:///media/pendrive2/OOo_SDK_EXAMPLES/Java_examples/UNO_Component/EmbeddedObject/build/soffice_debug/user/config/javasettings_Linux_x86.xml file:///home/ariel/.ure/javasettings_Linux_x86.xml. [Java framework] Using bootstrap parameter UNO_JAVA_JFW_SHARED_DATA = file:///home/ariel/OOo_DEV300_m48_dbgutil/openoffice.org3/program/../share/config/javasettings_Linux_x86.xml file:///etc/opt/ure/javasettings_Linux_x86.xml. [Java framework] Using bootstrap parameter UNO_JAVA_JFW_VENDOR_SETTINGS = file:///home/ariel/OOo_DEV300_m48_dbgutil/openoffice.org/ure/lib/../share/misc/javavendors.xml. [Java
Re: [api-dev] Unfortunate document event name - how to fix it?
Hello Robert, On Sunday 17 May 2009, 16:02, Robert Vojta wrote: In general, that's not true. For writing serious documentation you need some information about its implementation; but API user only know the specification and how to use the API. I disagree here. Sometimes I develop OO.o internals and sometimes I develop extension. From the extension developer point of view (API client), it is much better if documentation is written by someone who uses this API. may be we don't disagree: not only an API client, but with the knowledge to dive in the source code meant that the documentation writer must have a *deep* knowledge of the API (which you get not simply by reading its specification, but working the API) and *some* knowledge about its specification (because he may need to know the internals in order to understand how something works). Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Proposal: first convention to discuss API changes in the future
On Saturday 16 May 2009, 10:19, Mathias Bauer wrote: Is cleaning up Ariel's menu interface mess in awt incompatible? I don't know what he did, but cleaning up a mess sounds incompatible by default. :-) Carsten blogged about that http://blogs.sun.com/GullFOSS/entry/framework_team_and_community_contributions [ the issue he reffers to is wrong, it should be http://www.openoffice.org/issues/show_bug.cgi?id=96390 ] now I'm not sure if Carsten's idea was to show how easy it can be to contribute code to OOo, or how easy it is to mess OOo source code... anyway I'll clean up my own mess (once we're granted with the perfect situation I've talked about in http://wiki.services.openoffice.org/wiki/User:Arielch/Menu_API_Enhancement#New_Menu_API_.28and_its_design_problems.29) We now live with some bad APIs for a lot of years. It didn't kill us and the problems in our code base are not primarily caused by bad UNO APIs. IMHO you developers do not have the prespective of an API client, an extensions developer. If the bad API didn't kill OOo, it did and does hinder the interest of external developers willing to extend OOo functionality via add-ons. Just compare OOo's extensions with Firefox's or Kde's. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
[api-dev] NB plug-in: Debug Extension in Target OOo fails on OOO310_m11
Hi there, trying OOo 3.1 (Sun's build, OOO310_m11), I find it's impossible (at least on Linux) to make Debug Extension in Target OOo. If fails poping up the dialog with a deffective JRE, asking to choose a new one in the Options dialog. In NB output window: ERROR: transport error 202: connect failed: Conexión rehusada ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690] FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197) JavaVM: JNI_CreateJavaVM called _exit, caught by abort_handler in javavm.cxx [Java framework] sunjavaplugin.soCan not create JavaVirtualMachine, abort handler was called. [Java framework] sunjavaplugin.soCan not create Java Virtual Machine [Java framework] sunjavaplugin.soCan not create Java Virtual Machine Of course, with this Debug Extension in Target OOo option, a new user dir. is created on the build dir., which has no Java settings (as it's a brand new user dir.). In OOo 3.0.1 everything works. Any hints? Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Proposal: first convention to discuss API changes in the future
Hello Juergen, On Thursday 14 May 2009, 06:44, Juergen Schmidt wrote: Hi, i would like to suggest that we start new threads to discuss proposals for API changes with a subject API.CHANGE-ver: e.g. API.CHANGE-4.0: is this ver the current version where the to-be-changed API appears, or the version where it will be integreted? in the later case, quite impossible to guess. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Proposal: first convention to discuss API changes in the future
Hello Juergen, On Thursday 14 May 2009, 10:34, Juergen Schmidt wrote: i would like to suggest that we start new threads to discuss proposals for API changes with a subject API.CHANGE-ver: e.g. API.CHANGE-4.0: is this ver the current version where the to-be-changed API appears, or the version where it will be integreted? in the later case, quite impossible to guess. sorry for being unclear, it should be the version for which the change is proposed. Well you are correct that it is not easy to say 100%. But i think if somebody will change an API he/she has of course a specific release in mind, probably the next possible major release. is there already a general agreement about when API changes will be allowed? only major (for example only OOo 4.0, OOo 5.0), or also minor (OOo 3.3, OOo 3.4), or even micro (OOo 3.2.1)? It should be just for the discussion. A complete list with all changes for a major release is necessary anyway and will be available in the wiki. may be http://development.openoffice.org/releases/3.1_sdk.html can also be moved to the wiki, so that one can keep track of them, something like http://wiki.services.openoffice.org/wiki/API/SDK/Features/3.1 Interpret it more as PROPOSED.API.CHANGE-4.0 but i wanted keep it shorter. Maybe you have a better idea? mmm... no, sorry for the lack of imagination. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Unfortunate document event name - how to fix it?
Hello Matthias, On Tuesday 12 May 2009, 06:06, Matthias B. wrote: That you even consider removing this event is exactly the lack of commitment to compatibility I have critized in the long thread about OOo quality recently. I'm not sure what you're meaning with lack of commitment to compatibility, but this cannot refer to OOo API incompatible changes: OOo's API is so mummyfied, that I find it a very unique case compared to other FOSS project's API. (may be lack of commitment to compatibility means that changes in the implementation break exisitn API?) Anyway, if by lack of commitment to compatibility you mean that you don't want any API change at all, it seems then that you missed the discussion at http://api.openoffice.org/servlets/BrowseList?list=devby=threadfrom=377 For what I understood, there is a general agreement to allow incompatible API changes. Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Unfortunate document event name - how to fix it?
Hello Mathias, On Wednesday 13 May 2009, 14:14, Mathias Bauer wrote: The best documentation is an API that doesn't need one. This deals with the fact that people don't like to read documentation. Having speaking names for events is a good thing per se, not just some language aesthetics. +1 Besides, it's true that people don't like reading documentation (and also that developers in general don't like writing documentation). We often see people asking questions without even reading first the API ref. nor the Dev's Guide (and not even searching on the mailing list if the theme has already been discussed), but this is a general problem I see also on other mailing list (people have become simply more lazy). It would be more useful to spend time on improving the API documentation (IDL and Developer's Guide) and correcting known API issues. Sure. But I think documentation can be done by anybody knowing about the API, developers as well as users. In general, that's not true. For writing serious documentation you need some information about its implementation; but API user only know the specification and how to use the API. For example, the Calc Add-in documentation is from the stone age (http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Spreadsheet_Add‑Ins), I have developed several add-in, but I don't feel qualified to update the documentation. And there are sure several examples where you need to know the implementation in order to explain how something works; now I recall css.awt.XToolkit.createWindow/s http://api.openoffice.org/docs/common/ref/com/sun/star/awt/XToolkit.html#createWindow I only understood what was expected under the css.awt.WindowDescriptor after I studied some sources in the toolkit module. May be Clayton and/or Jürgen have some statistics about contributions in the Dev's Guide since it's been moved to the Wiki; but in general, the most I've seen is adding source tags for syntax highlighting, but no big contributions from community members. IMHO a Dev's Guide documentation writer has also to be a developer (I mean: not only an API client, but with the knowledge to dive in the source code), so an idea for improving this situation may be calling for documentation contributors who would then be mentored by a developer in the know of the implementation. Regards - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Proposal: first convention to discuss API changes in the future
Hello Juergen, On Thursday 14 May 2009, 11:35, Juergen Schmidt wrote: is there already a general agreement about when API changes will be allowed? only major (for example only OOo 4.0, OOo 5.0), or also minor (OOo 3.3, OOo 3.4), or even micro (OOo 3.2.1)? mmh, i think yes, we should take it serious and should allow this changes not frequently and only for major changes. We still have the published keyword that allows us to improve new APIs over minor releases as well. But published only applies to the whole type. Are the changes going to be allowed so that you can add a new member to an exisitng and already published type? For example, I also thought about the @since tag: autodoc only handles this pertype, but not per member. I think there will be cases, where instead of designing a new XSomething2 you add a new member to an existing XSomething type (well, and I vote for removing all existing XSomething2 around there!). It makes sense that if someone adds a new member, the @since tag is also added, and autodoc respects it; not the case nowadays: cf. http://svn.services.openoffice.org/opengrok/xref/DEV300_m47/offapi/com/sun/star/accessibility/AccessibleRelationType.idl#117 vs. http://api.openoffice.org/docs/common/ref/com/sun/star/accessibility/AccessibleRelationType.html#NODE_CHILD_OF Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Proposal: first convention to discuss API changes in the future
Hello Frank, On Thursday 14 May 2009, 15:12, Frank Schönheit - Sun Microsystems Germany wrote: Hi Ariel, is there already a general agreement about when API changes will be allowed? In my understanding, there was no definitive answer to this question in the thread which discussed it. The general consensus seemed to be towards change anything you like (as long as it's reasonable) in a major release. In my opinion, this /perhaps/ is somewhat too generous for a major release, and /definitely/ too restrictive for all intermediate releases. well, I couldn't find info about the OOo 2.0 release, but just comparing OOo 2.0.1 = Dec. 2005 http://wiki.services.openoffice.org/wiki/OOoRelease201 OOo 3.0 = Oct 2008 http://wiki.services.openoffice.org/wiki/OOoRelease30 If major releases happen every 3 years, then allowing API changes only on a mayor release does not make much sense to me. Well, I think I'll challenge that rule sooner or later, I have a lot of small changes to start with :). For instance, I'd like to take all those awt/form services which effectively describe *implementations* in OOo, and make all the optional properties added over the years non-optional, to match reality. I have several changes in mind for the awt module (including my enhanced menu API); this module has several non-senses (like a top window not being a window, and the like). I volunteer myself for fixing the ones in my list (once API changes are allowed). Regards -- Ariel Constenla-Haile La Plata, Argentina - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org