[dev] odf document looks different each time it is opened
Hi, I just would like to call your attention to issue http://www.openoffice.org/issues/show_bug.cgi?id=103137 which is a very critical Issue as I think. The binary identical odf-document looks different each time it is opened in OOo 3. Each time different parts of the text are hidden. What would you think about adobe reader hiding different parts of a pdf-file randomly? You would lose your trust in the software and you would lose the faith in the pdf-format itself. Please reconsider the current prioritisation. best regards, Christoph - To unsubscribe, e-mail: dev-unsubscr...@openoffice.org For additional commands, e-mail: dev-h...@openoffice.org
Re: [dev] why ist the size of user dictionaries limited to 2000 entries
Hi Cor, Hi Marcin, Hi André, thanks for your answers. I'm happy to see that the limit of entries in the user dictionary has been increased in OOo 3.0.1 to 3. I also agree with Marcin and André that the dictionary extensions supported since OOo 3.0.0 would be a better solution for my problem. Unfortunately we still have OOo 2.4.x installed on the most of our systems, so none of the two solutions could help in this case. As there are only a view people complaining about our current solution (the 3 user dictionary files), I think there is currently no pressing need to search for another workaround and it's worth to wait until OOo 3 has reached munich :-). 2009/1/22 André Schnabel andre.schna...@gmx.net: regular hunspell dictionaries are not limited to this. Can you dump the Word dictionaries to a simple ascii wordlist? If you like, you can send this to me and I'll wrap it in an extension. The structure should be easy to understand. thanks for this offer. May be I will ask you later on how to create a hunspell dictionary when I try to create such a dictionary extension (I guess that a hunspess dictionary is more performant than the plain text dict-Files !?). Or .. reading your macro code, it should be enough to place a test.aff file beside your test.dic. The test.aff file needs only to define the correct encodingforyour dictionary. Put this in a dicitonary extension and deploy this to all users. yes, this should work, too. I also noticed, that dict files in other dictionary extensions contain more than 2000 words and the structure of this file is very simple. So it could be a workaround to create a dict file with standard unix tools and drop down the idea of using the OOo-API. best regards, Christoph - To unsubscribe, e-mail: dev-unsubscr...@openoffice.org For additional commands, e-mail: dev-h...@openoffice.org
[dev] why ist the size of user dictionaries limited to 2000 entries
Hi, we want to import our word dictionaries into OOo. The test-macro below shows that user dictionaries in OOo seem to be limited to 2000 entries. This means we have to create 3 user dictionaries to cover all of the current 5000 entries in our word dictionary. And users have to import 3 OOo user dictionaries to use them. Some of our user complain about the need to have multiple user dictionary active simultanously and simply don't understand the restriction of 2000 words. What can I tell them? Are other types of dictionaries (e.g. system wide dictionaries) also restricted to 2000 entries? The following macro creates a new user dictionary and adds some values until the dictionary is full. In the end the number of possible elements (2000 on my system) is printed. dim locale as new com.sun.star.lang.Locale locale.Language = de dictList = createUnoService (com.sun.star.linguistic2.DictionaryList) dict = dictList.createDictionary(meinTest,locale, com.sun.star.linguistic2.DictionaryType.POSITIVE, file:///tmp/test.dic) count=0 while (NOT(dict.isFull())) dict.add(Hallo count, False, ) count=count+1 wend dictList.addDictionary(dict) print dict.Count best regards, Christoph - To unsubscribe, e-mail: dev-unsubscr...@openoffice.org For additional commands, e-mail: dev-h...@openoffice.org
Re: [dev] Is broadcasting global events possible?
Hi Matthias, On Nov 16, 2007 8:59 PM, Mathias Bauer [EMAIL PROTECTED] wrote: Did you consider to create your own broadcasting service? You are not restricted to the services provided by OOo, create your own ones! If your service provided the same API as the GlobalEventBroadcaster your listener just would hvave to register at two services instead of one but nothing else needed to be changed. yes, now that's also our preferred solution. We already have an own service implementation which we will extend by implementing the css.document.XEventBroadcaster-Interface. Is that what you mean by create your own 'broadcasting service'? thanks, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Is broadcasting global events possible?
Hi Andreas, I'm a colleague of Matthias and as he is not at office today, I will give you some details about the required global event: our component (let's call it A) processes TextDocuments. So it listens for OnNew-Events and starts the asynchron processing of the documents (in new Threads). This works fine, but now we need to synchronize our component with an other component (let's call it B) that does a similar job and requires the result of A. We are now searching for a mechanism to broadcast a kind of synchronization-event. This mechanism should of course be as most independent of our custom component and as most integrable into the generic OOo-Mechanisms. Using the globalEventBroadcaster is one approach we have in mind, but there might still be other other ways. We also considered implementing one of the XComponent- or XEventBroadcaster-Interfaces but this seems to be a very component-specific thing as the corresponding listener has to be registered on exactly one specific object (our component A). Broadcasting an event via GlobalEventBroadcaster seems to be a more generic way as there is one central point for registering the listener. To avoid the need of a complex naming-scheme for the event-names, I would prefer a generic event like OnCustomProcessingFinished (with an event-object containing information about the custom component and the processed document). regards, Christoph On Nov 16, 2007 9:03 AM, Andreas Schlüns [EMAIL PROTECTED] wrote: Hello Matthias, Is it possible for our custom Java component to broadcast events via the GlobalEventBroadcaster, so that listeners listening on it will receive them? Yes it's possible ... but till now an undocumented feature. The problem behind: who will be responsible to make sure that all event names will be non ambigous ? E.g. you shouldnt broadcast OnNew with a different meaning then now .-) Nobody wish to have a complex naming schema for such event names - do you ? I think it would be the best to let OOo core control such events. Can you please provide more details about the feature you wish to implement ... before I tell you something more about the tricky way for broadcasting own document events ? Matthias Regards Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] deploying jdbc-drivers (.jar) on multiple hosts/OOo-Installations
Hi Peter, In Issue #81899 there is a alternative described that works on system-level (editing the file ooo/program/jvmfwk3rc), not just on user-level. I think we will prefere this way. thanks and regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] deploying jdbc-drivers (.jar) on multiple hosts/OOo-Installations
Hi, for the connection to an oracle-db via OOo-Base, a jdbc-driver is required. This driver normally comes as a third-party jar-archive. Wich is the preferred way to deploy the jar-archive in a network with multiple hosts and multiple OOo-Installations? I already have got some possible ways for deploying the jar-archive in mind, but there is no way that convices me. There might be a better solution. 1) Manually add the jar-archive via Tools-Options-General Settings/Java/ ... add archive: This works but it is no alternative as user interaction is required on each single host and even for each single user. I need a deployment option that could be done by an admin. 2) Putting the third-party jar-archive into the jre/lib/ext directory: This is not a good option as the jar-archive might conflict with other drivers from other components than OOo base. The jar-file should only by visible for OOo/OOo-Base. 3) In former versions of OOo there was a java.ini-file that defined a systemClassPath. Regarding to the schema definition schema/org/openoffice/Office/Java.xcs this option is deprecated. So which is the preferred way? best regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] some questions about Addons.xcu - OfficeToolbar - Images
Hi Oliver, i have some questions about the Addons.xcu: - - Is it correct, that one can only define *one* OfficeToolBar inside an Addons.xcu ? So if one needs more OfficeToolbars, he has to deploy another extension ? OfficeToolBarMerging can not help in this case ? we define three ToolBars in one Addons.xcu. Is this what you are asking? Here is ours: ?xml version=1.0 encoding=UTF-8? oor:component-data xmlns:oor=http://openoffice.org/2001/registry; xmlns:xs=http://www.w3.org/2001/XMLSchema; oor:name=Addons oor:package=org.openoffice.Office node oor:name=AddonUI node oor:name=OfficeToolBar node oor:name=de.muenchen.allg.itd51.wollmux.SachleitendeVerfuegung oor:op=replace node oor:name=m1 oor:op=replace prop oor:name=URL oor:type=xs:string valuewollmux:ZifferEinfuegen/value /prop prop oor:name=Title oor:type=xs:string valueZiffer einfügen/value /prop prop oor:name=ImageIdentifier oor:type=xs:string value/ /prop prop oor:name=Target oor:type=xs:string value_self/value /prop prop oor:name=Context oor:type=xs:string valuecom.sun.star.text.TextDocument/value /prop /node [... definition of m2-m6 ...] node oor:name=m7 oor:op=replace prop oor:name=URL oor:type=xs:string valuewollmux:markBlock#draftOnly/value /prop prop oor:name=Title oor:type=xs:string valuenur im Entwurf/value /prop prop oor:name=ImageIdentifier oor:type=xs:string value/ /prop prop oor:name=Target oor:type=xs:string value_self/value /prop prop oor:name=Context oor:type=xs:string valuecom.sun.star.text.TextDocument/value /prop /node /node node oor:name=de.muenchen.allg.itd51.wollmux.Textbausteinsystem oor:op=replace node oor:name=m1 oor:op=replace prop oor:name=URL oor:type=xs:string valuewollmux:TextbausteinEinfuegen/value /prop prop oor:name=Title oor:type=xs:string valueTextbaustein einfügen/value /prop prop oor:name=ImageIdentifier oor:type=xs:string value/ /prop prop oor:name=Target oor:type=xs:string value_self/value /prop prop oor:name=Context oor:type=xs:string valuecom.sun.star.text.TextDocument/value /prop /node node oor:name=m2 oor:op=replace prop oor:name=URL oor:type=xs:string valuewollmux:PlatzhalterAnspringen/value /prop prop oor:name=Title oor:type=xs:string valuePlatzhalter anspringen/value /prop prop oor:name=ImageIdentifier oor:type=xs:string value/ /prop prop oor:name=Target oor:type=xs:string value_self/value /prop prop oor:name=Context oor:type=xs:string valuecom.sun.star.text.TextDocument/value /prop /node node oor:name=m3 oor:op=replace prop oor:name=URL oor:type=xs:string valuewollmux:FunctionDialog#Empfaengerauswahl/value /prop prop oor:name=Title oor:type=xs:string valueEmpfänger auswählen/value /prop prop oor:name=ImageIdentifier oor:type=xs:string value/ /prop prop oor:name=Target oor:type=xs:string value_self/value /prop prop oor:name=Context oor:type=xs:string valuecom.sun.star.text.TextDocument/value /prop /node /node node oor:name=de.muenchen.allg.itd51.wollmux.WerkzeugeFuerVorlagenersteller oor:op=replace node oor:name=m1 oor:op=replace prop oor:name=URL oor:type=xs:string valuewollmux:FormularMax4000/value /prop prop oor:name=Title oor:type=xs:string valueFormularMax 4000/value /prop prop oor:name=ImageIdentifier oor:type=xs:string value/ /prop prop oor:name=Target oor:type=xs:string value_self/value /prop prop oor:name=Context oor:type=xs:string valuecom.sun.star.text.TextDocument/value /prop /node [definition of m2-m4 ...] node oor:name=m5 oor:op=replace prop oor:name=URL oor:type=xs:string valuewollmux:dumpInfo/value /prop prop oor:name=Title oor:type=xs:string valueFehlerinfos erstellen/value /prop prop oor:name=ImageIdentifier oor:type=xs:string value/ /prop prop oor:name=Target oor:type=xs:string value_self/value /prop prop oor:name=Context
[dev] how to reset the text-property CharBackColor
Hi, I've got a textportion with a set property CharBackColor and I would like to reset this setting (the same as the button Defaultsettings/Standardformatierung of the context menu does), so that CharBackColor is used from the current paragraph-style, but other properties are not effected. I tried something like textPortion.setPropertyValue(CharBackColor, ) or textPortion.setPropertyValue(CharBackColor, null) but this didn't work. What could I do? a workaround could be settings CharBackColor to the color white textPortion.setPropertyValue(CharBackColor, new Integer(0xff)) but it's not the same as resetting the property completely... regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] how to reset the text-property CharBackColor
Hi Cor, Hi Oliver, thanks for your replies! I didn't knew of the method setPropertyToDefault(...), so I learned something new now :-) setting a fixed value of -1 works also, but resetting the option with setPropertyToDefault(...) is better as the fixed value overwrites the setting of the paragraph-style. So changing the bg-color of the paragraph style afterwards wouldn't effect my textportion. thanks, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] does .uno:PrinterSetup called via XNotifyingDispatch return whether Cancel was pressed?
Hi, I call the dispatch .uno:PrinterSetup via a XNotifyingDispatch and would like to react different if the dialog was finished successfull (by pressing the OK-button) and if the dialog was finished unsuccessfull by pressing the cancel-button. Is this possible? I have already debugged the DispatchResultEvent, the dispatch returns when finishing, but there seems to be no information about the button that finished the dialog... best regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] Tooltips in Addons.xcu possible?
Hi, I've got a addons.xcu that describes some customs menuitems. Is it possible to add a Tooltip for these menuitems, that is shown when I move the mousepointer over the menuitem? Here my example addons.xcu. ?xml version=1.0 encoding=UTF-8? oor:component-data xmlns:oor=http://openoffice.org/2001/registry; xmlns:xs=http://www.w3.org/2001/XMLSchema; oor:name=Addons oor:package=org.openoffice.Office node oor:name=AddonUI node oor:name=OfficeToolBar node oor:name=de.company.myaddon oor:op=replace node oor:name=m1 oor:op=replace prop oor:name=URL oor:type=xs:string valuede.company.myaddon:myFunction/value /prop prop oor:name=Title oor:type=xs:string valuemy Function/value /prop prop oor:name=ImageIdentifier oor:type=xs:string value/ /prop prop oor:name=Target oor:type=xs:string value_self/value /prop prop oor:name=Context oor:type=xs:string valuecom.sun.star.text.TextDocument/value /prop /node /node /node /oor:component-data - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] invoke a basic makro in a new (no-exclusive) thread
Hi, it seems that running a basic macro using XScript.invoke(...) always starts the macro in a kind of syncronized block, that provides exclusive access to ThisComponent for the basic macro. In our Lettherhead system that is written in java, we have got an own event-queue that synchronizes the access to internal data structures. Now we would like to access methods (that are synchronized by our event queue) of our letterhead system from a basic makro via a custom UNO-Interface, but the methods (that of course run in a different thread than the basic makro) are not allowed to access ThisComponent at the same time. Wheras the basic macro doesn't need access to ThisComponent since this should be done by the methods from our letterhead system. Any Ideas what I can do to get access to ThisComponent while a basic macro is running. Is it possible to invoke a basic macro in a no-exclusive way? regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Re: How to create OOo Basic scripts via API
Hi Matthias, On 11/17/06, Matthias B. [EMAIL PROTECTED] wrote: Thanks. I'm trying to do this from Java. I've checked the IDL docs and it seems that createLibrary() is provided by XStarBasicAccess, however the Use references of that interface are empty, so I have no idea what object/service provides XStarBasicAccess. There doesn't seem to be a property BasicLibraries nor a method getBasicLibraries(), at least not in the index of the IDL docs. Do you know how I can access this from Java? the XStarBasicAccess is provided by the document, so XStarBasicAccess xSBAccess = (XStarBasicAccess) UnoRuntime .queryInterface(XStarBasicAccess.class, doc); does it. (This is also what xray on ThisComponent says...) I don't know why the use reference is empty... maybe this interface is optional. Is it possible to adjust the idl documentation in this case? Ciao, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] is it possible to switch off auto-numbering via api for already opened documents
Hi, Writing the configuration directly has no effect on already opened documents. Which entry did you change? in the node /org.openoffice.Office.Writer/AutoFunction/Format/ByInput/ApplyNumbering I set the property Enable to the new value Boolean.FALSE (in java). Does this setting have any effect on documents opened later on? no, unfortunately not! -- I added it as another example to #71235 there seems to be no property set that allowes me to change the setting for already opened documents like ViewSettings is for all properties regarding the view. Ciao, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] is it possible to switch off auto-numbering via api for already opened documents
Hi, On 11/10/06, Mathias Bauer [EMAIL PROTECTED] wrote: Now I would like to know If I can switch off the autonumbering (Tools-AutoCorrect-Options/apply autonumbering) for an already opened document via api. Writing the configuration directly has no effect on already opened documents. Which entry did you change? in the node /org.openoffice.Office.Writer/AutoFunction/Format/ByInput/ApplyNumbering I set the property Enable to the new value Boolean.FALSE (in java). best regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] is it possible to switch off auto-numbering via api for already opened documents
Hi, I just recently asked in another thread whether it is possible to set the option ShowHiddenChar for already opened textdocuments. The result was that setting this property via api is not possible at the moment (therefore I submitted a bugreport). Now I would like to know If I can switch off the autonumbering (Tools-AutoCorrect-Options/apply autonumbering) for an already opened document via api. Writing the configuration directly has no effect on already opened documents. best regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] changing the OOo-Configuration via API has no effect during runtime
Hi Matthias, Are you sure that it doesn't affect even new documents you create later? Then it would be a bug (Writer having a cached value that doesn't react on changes of the configuration) and you should create an issue. I checked this and it is a bug -- #71235 If it only doesn't affect the current (or other already opened) documents the reason is that this is a document setting that is read from the configuration and set when the document is created. This happens with quite a lot of view settings in Writer. If you switch it on in the GUI it will be applied to both the configuration (that's what you did in your macro) *and* the view settings of the current document thanks for the explanation. This helpes to understand the behaviour! I don't know the API to change the corresponding setting at the document, sorry. Perhaps somebody else does. I will try to find how to change the view setting, but I still would be glad if somebody else could give me a hint. thangs and best regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] changing the OOo-Configuration via API has no effect during runtime
Hi, I don't know the API to change the corresponding setting at the document, sorry. Perhaps somebody else does. I will try to find how to change the view setting, but I still would be glad if somebody else could give me a hint. The Controller (ThisComponent.currentController) of the document has a property ViewSettings (a com.sun.star.text.ViewSettings service) which provides access to a lot of these show*-Options (e.g. ShowHiddenParagraphs). there is also one option called ShowHiddenText, but this option corresponds to Tools-Options/Writer/FormattingAids/(show)Textfields: HiddenText and not to (show) Hidden Characters. So I would expect an option like ShowHiddenCharacters, in the ViewSettings, but there is no such option. I can remember that the support of HiddenCharacters is a feature that is much younger than other features in ViewSettings. So could it be that the current implementation of a ShowHiddenCharacters option (somewhere else) is not conform the idea of ViewSettings? Any Ideas where else such an option could be found? Is it possible that the current implementation of the Controller doen't provide an API access to the searched option/property ShowHiddenCharacter? regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] changing the OOo-Configuration via API has no effect during runtime
Hi Frank, Hi Peter, thanks for your answers! I will try to find how to change the view setting, but I still would be glad if somebody else could give me a hint. viewsetting = thiscomponent.getCurrentController().getViewSettings() gives you the view settings. There is a ShowHiddenParagraphs (In UI: Fields: Hidden paragraphs) property and a ShowHiddenText property (In UI: Fields: Hidden text). But the hidden characters property seems to be missing. Please submit an issue for this. see http://qa.openoffice.org/issues/show_bug.cgi?id=71258 best regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] Re: how to show printerSetup-Dialog without Dispatches?
is it possible to show the printerSetup-Dialog (File-Printer Setup...) using the api (and not the dispatch-framework)? just to add: I would like to use the dialog inside my code, so that I do not have to write a new own printSetup-Dialog (with the features of File-Printer Setup). When the dialog returnes, I would like to perform some actions, so I need to know when the dialog returns. This is not possible using XDispatch. best regards Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] how to show printerSetup-Dialog without Dispatches?
Hi, is it possible to show the printerSetup-Dialog (File-Printer Setup...) using the api (and not the dispatch-framework)? best regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] how to reduce memory usage of unopkg
unopkg add ourUNOPackgage --shared So the failing unopkg add ourUNOPackgage --shared is for ourUNOPackgage == WollMux.uno.pkg, right? (Just asking because if the unopkg add consistently fails for that package, a unopkg list couldn't list it.) :) yes, the failing command is 'unopkg add WollMux.uno.pkg --shared', but the output of unopkg list is from a PC that has 1GB of memory which doesn't fail ;-) Do you have a stack trace of that Java OutOfMemoryError? unopkg does execute some code from the jar during registration, so this might shed some light on what is happening. Running in gdb: /opt/openoffice.org2.0/program/unopkg.bin add WollMux.uno.pkg ... . lots of undefined symbols follow (no debugging symbols found) ... /opt/openoffice.org2.0/program/uno.bin --quiet --singleaccept -u uno:pipe,name=284dada2fd8a4f5fcbb7897677e94c255 562e79b55472364126972d91b7e48;urp;uno.ComponentContext - -env:UNO_SERVICES=file:///opt/openoffice.org2.0/program/s ervices.rdb -env:INIFILENAME= ... . some more undef syms ... terminate called after throwing an instance of 'std::bad_alloc' what(): St9bad_alloc Program received signal SIGABRT, Aborted. [Switching to Thread -1542403152 (LWP 15636)] 0xa775a83b in raise () from /lib/tls/libc.so.6 (gdb) bt #0 0xa775a83b in raise () from /lib/tls/libc.so.6 #1 0xa775bfa2 in abort () from /lib/tls/libc.so.6 #2 0xa793bad1 in __gnu_cxx::__verbose_terminate_handler () from /opt/openoffice.org2.0/program/libstdc++.so.6 #3 0xa7939505 in __cxa_call_unexpected () from /opt/openoffice.org2.0/program/libstdc++.so.6 #4 0xa7939542 in std::terminate () from /opt/openoffice.org2.0/program/libstdc++.so.6 #5 0xa79396d2 in __cxa_throw () from /opt/openoffice.org2.0/program/libstdc++.so.6 #6 0x080595f0 in boost::detail::sp_counted_base_implrtl::Bootstrap*, boost::checked_deleterrtl::Bootstrap : :~sp_counted_base_impl () #7 0x08059620 in operator new () #8 0xa7d15ce2 in typelib_typedescriptionreference_getDescription () from /opt/openoffice.org2.0/program/libuno_cppu.so.3 #9 0xa413ef42 in component_canUnload () from /opt/openoffice.org2.0/program/liburp_uno.so #10 0xa413f07d in component_canUnload () from /opt/openoffice.org2.0/program/liburp_uno.so #11 0xa41318d5 in component_canUnload () from /opt/openoffice.org2.0/program/liburp_uno.so #12 0xa7d5a577 in osl_yieldThread () from /opt/openoffice.org2.0/program/libuno_sal.so.3 - ---Type return to continue, or q return to quit--- #13 0xa7a3ab63 in start_thread () from /lib/tls/libpthread.so.0 #14 0xa780a18a in clone () from /lib/tls/libc.so.6 ATB Christoph Lutz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] how to get TextField enclosed in a Bookmark in a cell of a TextTable
Hi, I have got a TextField in a cell of a TextTable and the TextField is enclosed by a bookmark that should be used to access the TextField. How do I get access to the model of the TextField using the bookmark? Please note, that using a bookmark to access the model of the TextField works fine when the TextField is put to a normal text area and NOT into a cell of a TextTable. For Example accessing such a TextFields via bookmark works fine with the followin lines of code: Sub getTextFieldInBookmark(bookmarkName as String) bookmark = ThisComponent.getBookmarks().getByName(bookmarkName) ' get Paragraph enu = bookmark.Anchor.createEnumeration() par = enu.nextElement() ' get TextPortion that has property TextField (second element) enu = par.createEnumeration() enu.nextElement() ' first element is the bookmark-portion itself portion = enu.nextElement() ' second element is the textField-range getTextFieldInBookmark = portion.TextField End Sub Why doesn't this work when a bookmark within a TextTable is used? regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] how to get TextField enclosed in a Bookmark in a cell of a TextTable
Hi Oliver, thanks! this helped a lot! best Regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] DocumentZoomType.PAGE_WIDTH_EXACT not accessible via UI
Hi, ist there a special reason that DocumentZoomType.PAGE_WIDTH_EXACT is not accessible via the View-Zoom Dialog, or is this feature just not jet implemented? I only need to know whether PAGE_WIDTH_EXACT works correct when setting the ZoomType-Property via the API or it is not recommended to be used. regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Set default posSize for new created Windows
Hi Carsten, On 7/14/06, Carsten Driesner [EMAIL PROTECTED] wrote: You can see that the configuration set Factories contains nodes for every appplication module, in the example com.sun.star.frame.StartModule and com.sun.star.text.TextDocument. The property called ooSetupFactoryWindowAttributes stores the left,top position and the width and height in pixel. You can use the configuration API to change these values programmatically. thanks. this works! if you are interested in the solution, just have a look at example code below. I am not sure if the current implementation reads the values for every new window or if it just uses internal values. So it's possible that the values are only read once from the configuration at startup time. Be aware that these values will be overwritten when a user changes the position or size of an application window. it seems that the current implementation reads the attribue for every new window and doesn't use internal values! here the example code: /** * Diese Hilfsmethode liest das Attribut ooSetupFactoryWindowAttributes aus * dem Konfigurationsknoten * /org.openoffice.Setup/Office/Factories/com.sun.star.text.TextDocument * der OOo-Konfiguration, welches die Standard-FensterAttribute enthält, mit * denen neue Fenster für TextDokumente erzeugt werden. * * @return */ private static String getDefaultWindowAttributes(XComponentContext ctx) { try { Object cp = ctx.getServiceManager().createInstanceWithContext( com.sun.star.configuration.ConfigurationProvider, ctx); // creation arguments: nodepath com.sun.star.beans.PropertyValue aPathArgument = new com.sun.star.beans.PropertyValue(); aPathArgument.Name = nodepath; aPathArgument.Value = /org.openoffice.Setup/Office/Factories/com.sun.star.text.TextDocument; Object[] aArguments = new Object[1]; aArguments[0] = aPathArgument; XMultiServiceFactory xmsf = (XMultiServiceFactory) UnoRuntime .queryInterface(XMultiServiceFactory.class, cp); Object ca = xmsf.createInstanceWithArguments( com.sun.star.configuration.ConfigurationUpdateAccess, aArguments); XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, ca); return prop .getPropertyValue(ooSetupFactoryWindowAttributes).toString(); } catch (java.lang.Exception e) { } return null; } /** * Diese Hilfsmethode setzt das Attribut ooSetupFactoryWindowAttributes aus * dem Konfigurationsknoten * /org.openoffice.Setup/Office/Factories/com.sun.star.text.TextDocument * der OOo-Konfiguration auf den neuen Wert value, der (am besten) über * einen vorhergehenden Aufruf von getDefaultWindowAttributes() gewonnen * wird. * * @param value */ private static void setDefaultWindowAttributes(XComponentContext ctx, String value) { try { Object cp = ctx.getServiceManager().createInstanceWithContext( com.sun.star.configuration.ConfigurationProvider, ctx); // creation arguments: nodepath com.sun.star.beans.PropertyValue aPathArgument = new com.sun.star.beans.PropertyValue(); aPathArgument.Name = nodepath; aPathArgument.Value = /org.openoffice.Setup/Office/Factories/com.sun.star.text.TextDocument; Object[] aArguments = new Object[1]; aArguments[0] = aPathArgument; XMultiServiceFactory xmsf = (XMultiServiceFactory) UnoRuntime .queryInterface(XMultiServiceFactory.class, cp); Object ca = xmsf.createInstanceWithArguments( com.sun.star.configuration.ConfigurationUpdateAccess, aArguments); XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, ca); prop.setPropertyValue(ooSetupFactoryWindowAttributes, value); XChangesBatch committer = (XChangesBatch) UnoRuntime .queryInterface(XChangesBatch.class, ca); committer.commitChanges(); } catch (java.lang.Exception e) { } } regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Set default posSize for new created Windows
Hi Carsten, thanks for the detailed explanation! I will have a try and give you feedback if this worked! You can see that the configuration set Factories contains nodes for every appplication module, in the example com.sun.star.frame.StartModule and com.sun.star.text.TextDocument. The property called ooSetupFactoryWindowAttributes stores the left,top position and the width and height in pixel. You can use the configuration API to change these values programmatically. regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] scrolling to a textRange without using the viewCursor possible?
Hi, I want my document-view to scroll to a specific TextRange in the same way the document-view does when the ViewCursor is moved to this TextRange. This means for example if my current view shows page one and my textRange is at the bottom of page two, after the scrolling, the view shows the bottom of the second page. Is it possible to archive such a scrolling in a programmatic way without using the ViewCursor? I can't use the viewCursor because our documents contain a lot of protected areas while our global configuration-option Tools-Options/OOo-Writer/Formatting Aids/Cursor in protected areas is disabled. So setting the viewCursor into a protected area is prohibited and has no effect. We need this option set to improve the user experience, but we also need the possibility to show (not to edit!) a content in a protected area. any ideas how the scrolling can be done? btw.: I already tried to temporarily enable the Cursors in protected areas-option, but after resetting the option, the cursor and the view jump back to an unwanted position. best regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] suppress popup of InputFields when opening a template
Hi Mathias, is there a way to suppress the popup of InputFields when I open a template that contains InputFields? No. If a document or a template is opened via UI all dialogs are allowed by default. Suppressing them needs dispatch interception but I don't see the point in doing it. Can you explain? As a migration-strategy we would like to do a soft-migration from MS-Office to OOo. This means we have users working parallel either with MSO or OOo and with document-templates in .dot AND .ott-Format. There are about (estimated) 3000 dot-templates which should be accessed from OOo and don't contain complex content, but Word's Text-FormFields. As you surely know, Word's simple Text-FormFields which are very common in all of our .dot-Templates are mapped to InputFields in OOo which behave different. The two main advantages of Word's TextFields are: 1) Direct editing is possible (without popup) which provides a much better overview of the document and the editing-result. 2) you can navigate through the Fields using the TAB-Key. 3) the user can decide by himself when it's time to fillout the Fields. OOo's popping-up InputFields are much more annoying in this point: 1) the automatic popup overlays the interesting field which harms the overview of the document. 2) navigation with TAB is not possible and pressing Enter in the dialog causes the cursor to jump to the next line, not to the next InputField. There is no easy way to navigate to the next InputField leafing the finges on the keyboard (you have to use the mouse to press OK - YES, 5 times pressing SHIFT+TAB works also, but this is not a real alternative) 3) You can not decide when you want to fill the fields as the popup comes automatically on load-time. Of course, InputFields work, but our users would not accept them in the direct competition between MSO and OOo! Since we don't expect OOo to provide the missing feature in the near future, we decided to provide a workaround for the unwanted behaviour of InputFields: We would like to collect all inputFields and join all the single dialog-windows into one large (selmade AWT) dialog-window that is diplayed beside(!) the office-document. Users can fill in the values und use the tab-key as used. There will be no window overlaying the document. The corresponding program listens on the ON_NEW-Event of the GlobalEventDispatcher, but this Event is only called AFTER the automatic popup of inputFields. I am asking the above question, because I want my code to run without the automatic popup. Hope this helped to understand my point best regards, Christoph Lutz
Re: [dev] suppress popup of InputFields when opening a template
Hi Mathias, On 5/25/06, Mathias Bauer [EMAIL PROTECTED] wrote: is there a way to suppress the popup of InputFields when I open a template that contains InputFields? I'm searching for a global configuration-option for OOo or even better for a way to place some kind of DONT POPUP-Flag into the respective documents. If this is not configurable, is there a programmatic way to suppress the popup? (eg. an eventhandler that I can register somewhere that runs before the popup task, an interactionHandler, a dispatchprovider, ...). Any Ideas? Usually all dialogs should be suppressed if you load a document via loadComponentFromURL() but appear when you load it via UI. Which way are you talking about? Yes, it's clear that loadComponentFromURL provides full control, but if a user creates a new document by opening an existing template via UI, filemanager or browser, the popups should (also) be suppressed - and this seems to be more difficult to control.
[dev] delete the next charakter on cursor-position - join paragraphs
Hi, I have got a simple collapsed TextCursor and I would like to delete the next charakter in a programmatic way without using the dispatch-framework(!). The function should behave exakt like pressing the DEL-Key in a writer-document. To do that, I tried the following basic code: REM the cursor is already present cursor.goRight(1, false) cursor.goLeft(1, true) cursor.setString() now assume the following text content: here is some textCURSOR_POSPAR_BREAK and this is the next text where CURSOR_POS is the position of my collapsed TextCursor and PAR_BREAK is a new-paragraph-charakter (shown with view-nonprinting Charakters). Now running the above code produces a joined version of both paragraphs here is some textand this is the next text, and this is what I want! But there is one special case in which the above code behaves different from pressing the DEL-key: assume the following content: here is some textCURSOR_POSPAR_BREAK TEXT_TABLE PAR_BREAK where TEXT_TABLE is a text-Table inserted directly after the first paragraph. Pressing the del-key at the CURSOR_POS would ignore the deletion as a texparagraph and a texttable cannot be joined. Wheras running the above code, deletes the table and thats what I don't want to get. Any Ideas how to avoid the removal of the texttable (without using the dispatch-framework!) are welcome best regards, Christoph
Re: [dev] Dynamic menus: with Java (Problem)
Hi Carsten, sorry for the late answer, I was very busy during the last weeks... 2005/11/17, Carsten Driesner [EMAIL PROTECTED]: Please look at the following example in Basic. It uses the function CreatePopupMenu to create a new popup menu. The line of interest uses the factory (the container) to create a sub container with createInstanceWithContext(). thank you for the example code. It works very well. I would like to mention a behaviour I just noticed: the new created popupmenu will not be restored after an restart of OOo, so there is no persistence like described in your code comment... But I asume it was your intention not to call the oModuleCfgMgr.store() method after the line oModuleCfgMgr.replaceSettings( sMenuBar, oMenuBarSettings )? For my tests, I added the respective line to your example-code. But now to my question: I translated your example to java (I tried to do an exaxt one-to-one-translation of your basic-example) and the java-code bahaves slightly differt from the basic code: In basic, the popupmenu and all elements are visible directly after calling the code. Using my java-code, the popupmenu is created, but the element(s) in the popupmenu are not visible. The strange thing is, that after the call of oModuleCfgMgr.store() and a restart of OOo, the popupmenu and all its previously unvisible item(s) get visible. Do you have got an idea, why the items are not visible directly after creation, while the same code in basic creates visible items? I think this might be a bug... If you would like to follow, here's my translated java-code: import com.sun.star.beans.PropertyValue; import com.sun.star.comp.helper.Bootstrap; import com.sun.star.container.XIndexAccess; import com.sun.star.container.XIndexContainer; import com.sun.star.lang.XSingleComponentFactory; import com.sun.star.ui.ItemType; import com.sun.star.ui.XModuleUIConfigurationManagerSupplier; import com.sun.star.ui.XUIConfigurationManager; import com.sun.star.ui.XUIConfigurationPersistence; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; public class MenubarTest { public static void main(String[] args) throws java.lang.Exception { addItemToMenubar(Bootstrap.bootstrap()); System.exit(0); } /** * Creates a top-level popup menu on the Writer menu bar persistently. It * checks if its popup menu has already been added to the menu bar and does * nothing. The popup menu contains one menu item which call the Basic macro * test. * * @throws Exception */ public static void addItemToMenubar(XComponentContext ctx) throws java.lang.Exception { // Initialize strings String sMenuBar = private:resource/menubar/menubar; String sMyPopupMenuCmdId = vnd.openoffice.org:MyMenu; // Retrieve the module configuration manager from central module // configuration manager supplier Object oModuleCfgMgrSupplier = ctx .getServiceManager().createInstanceWithContext( com.sun.star.ui.ModuleUIConfigurationManagerSupplier, ctx); XModuleUIConfigurationManagerSupplier xModuleUICfgMgrSupplier = (XModuleUIConfigurationManagerSupplier) UnoRuntime .queryInterface( XModuleUIConfigurationManagerSupplier.class, oModuleCfgMgrSupplier); // Retrieve the module configuration manager with module // identifier // See com.sun.star.frame.ModuleManager for more information XUIConfigurationManager xModuleUICfgMgr = xModuleUICfgMgrSupplier .getUIConfigurationManager(com.sun.star.text.TextDocument); XIndexAccess oMenuBarSettings = xModuleUICfgMgr.getSettings( sMenuBar, true); XIndexContainer settingsContainer = (XIndexContainer) UnoRuntime .queryInterface(XIndexContainer.class, oMenuBarSettings); XSingleComponentFactory factory = (XSingleComponentFactory) UnoRuntime .queryInterface(XSingleComponentFactory.class, oMenuBarSettings); // Look for our top-level popup menu. Can be identified by the // CommandURL property. boolean bHasAlreadyPopupMenu = false; int nCount = oMenuBarSettings.getCount(); for (int i = 0; i nCount; ++i) { PropertyValue[] oPopupMenu = (PropertyValue[]) oMenuBarSettings .getByIndex(i); for (int j = 0; j oPopupMenu.length; ++j) { if (oPopupMenu[j].Name.equals(CommandURL)) { if (oPopupMenu[j].Value.equals(sMyPopupMenuCmdId)) { bHasAlreadyPopupMenu = true; } } } } System.out.println(bHasAlreadyPopupMenu); if (!bHasAlreadyPopupMenu) { String sString = My Macro's; PropertyValue[] oPopupMenu = CreatePopupMenu( sMyPopupMenuCmdId,
Re: [dev] Dynamic menus: with Java (Problem)
Hi Carsten, thank you for answering the question of Andrej who is a colleague of mine. I am continuing the work with Andrej's code. I looked over your example and I am not sure what you want to do. Can you please explain what do you want to achieve? Create a new top-level menu or do you want to add a popup menu into an existing top-level menu, like File? For our own UNO-Component we would like to create a *new* top-level menu that is able to contain either simple-Elements (Type.BUTTON) AND nested Sub-Menus. One comment to your example. Please NEVER create a settings container using a ui configuration manager and insert it into another container. A container which is created by a ui configuration manager is always a root container! Every container itself is a factory to create its own sub containers. The referenced example in oooforum is wrong in that point! I think this hint points us to the root of our problems, as we currently always use the ModuleUIConfigurationManager to create new settings-instances even for sub containers. I am trying to change this, but I can't find the corresponding entry point. So which is the access point for us to create new sub containers? If my interpretation your statement above is correct, you say that each settings-instance provides a corresponding factory for sub containers. So I xray'ed an existing settings object, which I got using the following basic-lines, but the object doesn't export an Interface that seems to me the right one: sMenuBar = private:resource/menubar/menubar oModel = ThisComponent oLayoutManager = oModel.getCurrentController().getFrame().LayoutManager() oMenuBar = oLayoutManager.getElement( sMenuBar ) settings = oMenuBar.getSettings(true) settings supports the following Interfaces: com.sun.star.beans.XFastPropertySet com.sun.star.beans.XMultiPropertySet com.sun.star.beans.XPropertySet com.sun.star.container.XElementAccess com.sun.star.container.XIndexAccess com.sun.star.container.XIndexContainer com.sun.star.container.XIndexReplace com.sun.star.lang.XSingleComponentFactory com.sun.star.lang.XTypeProvider com.sun.star.lang.XUnoTunnel com.sun.star.uno.XInterface Is it the XSingleComponentFactory I have to use to create the sub containers? Just to write a quick test-example in basic: How can I create a instance using basic? settings.createInstance() didn't work and I don't know how to get the required XComponentContext in Basic to call the settings.createInstanceWithContext()-Method. best regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] selected text from the textdocument
Hi, 2005/11/4, S Sridhar [EMAIL PROTECTED]: How to get the selected text from the TextDocument. Is there any way to get the selected text from all the components of the TextDocuments like TextTables Drawings and others? also how to identify where the selected component is ? like is the selected text is in the texttable and drawing? you need a view-cursor see an example at http://codesnippets.services.openoffice.org/Writer/Writer.InsertUnicodeCharacter.snip regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] disable gui-interaction temporary for modal JFrame-dialog
Hi Mathias, I know that someone successfully used a trick to achieve modality: when her started his Java dialog he created a 1 pixel sized modal dialog with the OOo toolkit with the current OOo window as parent and moved it to the upper left corner of the screen. This will create the desired modal mode. yes, the modal-mode works using the following code, but I don't know how to return from the xInfoBox.execute() method in a programmatic way. I need to stop the execution of the infobox-dialog when my jframe-dialog returns. I already tried to use dispose() on the XComponent-Interface of xInfoBox from a different thread, but that caused OOo to crash. ... create Toolkit ... // describe the info box ini it's parameters com.sun.star.awt.WindowDescriptor aDescriptor = new com.sun.star.awt.WindowDescriptor(); aDescriptor.WindowServiceName = infobox; aDescriptor.Bounds = new com.sun.star.awt.Rectangle(0, 0, 300, 200); aDescriptor.WindowAttributes = com.sun.star.awt.WindowAttribute.BORDER | com.sun.star.awt.WindowAttribute.MOVEABLE | com.sun.star.awt.WindowAttribute.CLOSEABLE; aDescriptor.Type = com.sun.star.awt.WindowClass.MODALTOP; aDescriptor.ParentIndex = 1; aDescriptor.Parent = (com.sun.star.awt.XWindowPeer) UnoRuntime .queryInterface(com.sun.star.awt.XWindowPeer.class, frame .getContainerWindow()); // create the info box window com.sun.star.awt.XWindowPeer xPeer = xKit.createWindow(aDescriptor); com.sun.star.awt.XMessageBox xInfoBox = (com.sun.star.awt.XMessageBox) UnoRuntime .queryInterface(com.sun.star.awt.XMessageBox.class, xPeer); if (xInfoBox == null) return null; // fill it with all given informations and show it xInfoBox.setCaptionText(sTitle); xInfoBox.setMessageText(sMessage); xInfoBox.execute(); any ideas? A particular API for modality would be fine! best regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Buggy insertDocumentFromURL
Hi Mathias, I currently have no idea why you don't get the error message from Java. OTOH I think that the error message in an API call is a bug, so the behavior in Java is correct, why ever. A message box shouldn't be shown if no InteractionHandler set set. thats right, but OTOH a unresolved URL should not cause OOo to freeze... http://qa.openoffice.org/issues/show_bug.cgi?id=57049 Of course it still is an API bug that no suitable exception is thrown, but as I already wrote it can't be fixed in the method insertDocumentFromURL, it can be fixed only by providing a new method (and so a new interface). The idl-ref says: void insertDocumentFromURL( [in] string aURL, [in] sequence ::com::sun::star::beans::PropertyValue aOptions ) raises( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException ); I think that's all I need!? The problem is that the IOException is never thrown. I also tried to provide a different InteractionHandler in the MediaDescriptor props, but (that's the reason why I wrote the Bug 1-example) it seems that insertDocumentFromURL throws an IllegalArgumentException everytime the MediaDescriptor is not empty. This also sounds like a bug to me. http://qa.openoffice.org/issues/show_bug.cgi?id=57047 best regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Buggy insertDocumentFromURL
Hi Christian, 2005/10/27, Christian Junker [EMAIL PROTECTED]: I tested all the small examples on Mac OS X with OOo 2.0 using Starbasic and I can only reproduce Bug 1 (it's probably not a bug here). Bug 2: That's also my experience using Starbasic. In Starbasic the insertDocumentFromURL throws an corresponding exception *immediately* (a dialogbox with the error message pops up). It's the different behaviour in Java that makes me wonder. The way basic bahaves lets me come to the following guess: 1) the problem is NOT a problem of system timeouts. 2) is it possible that there is a kind of default behaviour that tries to create a message-box even with java? The message-box can't be shown because of a missing parent frame but is still there and modal so it blocks the rest of the application? I also tried to provide a different InteractionHandler in the MediaDescriptor props, but (that's the reason why I wrote the Bug 1-example) it seems that insertDocumentFromURL throws an IllegalArgumentException everytime the MediaDescriptor is not empty. best regards, Christoph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] disable gui-interaction temporary for modal JFrame-dialog
Hi, in my own uno-component I use a JFrame-based dialog which I want to be modal. Therefore I want to lock the user-interaction (all gui-events?) on all background UNO-Frames temporary. How can I do that? ...I know that I can create a modal dialog using the com.sun.star.awt.Toolkit, but I don't want to use it as I prefer swing for this special task. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] Buggy insertDocumentFromURL
Hi, in the following example-code I found some bugs in the XDocumentInsertable.insertDocumentFromURL() method. Can you confirm these bugs, so I can report an issue? Are there known workarounds? import com.sun.star.beans.PropertyValue; import com.sun.star.comp.helper.Bootstrap; import com.sun.star.document.XDocumentInsertable; import com.sun.star.frame.FrameSearchFlag; import com.sun.star.frame.XComponentLoader; import com.sun.star.lang.IllegalArgumentException; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiComponentFactory; import com.sun.star.text.XText; import com.sun.star.text.XTextCursor; import com.sun.star.text.XTextDocument; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; public class InsertDocumentFromURLTest { public static void main(String[] args) throws Exception { PropertyValue[] insertProps; // bootstrap and create Desktop XComponentContext xContext = Bootstrap.bootstrap(); XMultiComponentFactory xMCF = xContext.getServiceManager(); Object desktop = xMCF.createInstanceWithContext( com.sun.star.frame.Desktop, xContext); // create empty document XComponentLoader xLoader = (XComponentLoader) UnoRuntime .queryInterface(XComponentLoader.class, desktop); XComponent doc = xLoader.loadComponentFromURL( private:factory/swriter, _blank, FrameSearchFlag.CREATE, new PropertyValue[0]); // create insertion-textcursor XTextDocument xTextDoc = (XTextDocument) UnoRuntime.queryInterface( XTextDocument.class, doc); XText xText = xTextDoc.getText(); XTextCursor cursor = xText.createTextCursor(); XDocumentInsertable xInsert = (XDocumentInsertable) UnoRuntime .queryInterface(XDocumentInsertable.class, cursor); System.out.println(test 1); // Bug 1: // providing a non-empty MediaDescriptor throws an // IllegalArgumentException. try { insertProps = new PropertyValue[] { new PropertyValue() }; insertProps[0].Name = Author; insertProps[0].Value = itsMe; xInsert.insertDocumentFromURL( file:///W:/aFolder/thisFileDoesNotExist, insertProps); } catch (IllegalArgumentException e) { e.printStackTrace(); } System.out.println(test 2); // Bug ?: // trying to insert a document with a non-existing file-URL // does nothing (not even an exception) insertProps = new PropertyValue[] {}; xInsert.insertDocumentFromURL( file:///aFolder/thisFileDoesNotExist, insertProps); System.out.println(test 3); // Bug 2: // trying to insert a document with a non-existing file-URL // causes OOo to freeze IF the URL start with a drive letter c: insertProps = new PropertyValue[] {}; xInsert.insertDocumentFromURL( file:///c:/aFolder/aNonExistingFile, insertProps); System.out.println(test 4); // trying to insert a document with a non-existing file-URL // causes OOo to freeze IF the URL is an unresolved http-url. insertProps = new PropertyValue[] {}; xInsert.insertDocumentFromURL( http://www.michgibtswirklichnichtglaubichauchnicht.de/index.odt;, insertProps); System.out.println(finished!); System.exit(0); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] static classes in scripting framework / persistent data
Hi, I have got a Java-Macro that contains a static field which I would like use to count the number of its invocations. The output of the macro is appended to the actual writer-document. But the counting does not work. It seems that there is a new instance of the test class HelloWorld created each time I call the macro from the OOo-Gui. The static field is actually not static. Could you explain this behaviour? Is it a bug or a part of your concept? Here is my small java-makro: import com.sun.star.script.provider.XScriptContext; import com.sun.star.text.XText; import com.sun.star.text.XTextDocument; import com.sun.star.text.XTextRange; import com.sun.star.uno.UnoRuntime; public class HelloWorld { public static int count = 0; public static void printHW(XScriptContext sc) { XTextDocument xTextDoc = (XTextDocument) UnoRuntime.queryInterface( XTextDocument.class, sc.getDocument()); XText xText = xTextDoc.getText(); XTextRange xTextRange = xText.getEnd(); xTextRange.setString(Hello World (as Java-Macro) Count= + count + \n); count++; } } and this is the output (copy/pasted from the writer-document): Hello World (as Java-Macro) Count=0 Hello World (as Java-Macro) Count=0 Hello World (as Java-Macro) Count=0 If it is not possible to use static fields, How do I create and use persistant data? best regards, Christoph Lutz __ Mit WEB.DE FreePhone mit hoechster Qualitaet ab 0 Ct./Min. weltweit telefonieren! http://freephone.web.de/?mc=021201 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]