[api-dev] Re: Get list of printers
Am Donnerstag, den 07.04.2011, 18:08 +0200 schrieb Niklas Nebel: On 07.04.2011 15:48, Andrew Douglas Pitonyak wrote: I had hoped it would be as easy as CreateUnoService(com.sun.star.awt.PrinterServer) Unfortunately, the returned object is not usable. Usable is a relative term. You can always do something like this: oServer = CreateUnoService(com.sun.star.awt.PrinterServer) oCore = CreateUnoService(com.sun.star.reflection.CoreReflection) oClass = oCore.forName(com.sun.star.awt.XPrinterServer) oMethod = oClass.getMethod(getPrinterNames) aNames = oMethod.invoke(oServer, Array()) Ah, I see. This does work. Can you explain why the intermediate step using Core Reflection is necessary, please? From those old times there is another macro that must have been working, and it doesn't (work or use CoreReflection): function PrinterNameListNew ps = CreateUnoService(com.sun.star.awt.PrinterServer) dbgM(ps) dbgP(ps) dim xps as object xps = ps.QueryInterface(com.sun.star.awt.XPrinterServer) if NOT IsNull(xps) then dbgM(xps) else msgbox NULL endif PrinterNameListNew = ps.getPrinterNames() end function TIA, Marc -- - To unsubscribe send email to dev-unsubscr...@api.openoffice.org For additional commands send email to sy...@api.openoffice.org with Subject: help
Re: [api-dev] Opening the file in MS Word, linked images wrong size
Am Dienstag, den 08.02.2011, 03:04 -0800 schrieb cdfleischmann: Thanks Marc unfortunately, I have already gone down that route, thus far, have tried the following: Inserting the picture (not linked but embedded) as the backgroundURL for the TextFrame. Inside the textFrame, I insert an image (any image), again embedded, and set the size. When I save it to MS Word, I hit bug http://www.openoffice.org/issues/show_bug.cgi?id=32638 That is, I get an error, There is not enough memory when opening the file in Word. A sample ODT file: http://openoffice.2283327.n4.nabble.com/file/n3275734/test.odt test.odt And the resultant MS Word doc file http://openoffice.2283327.n4.nabble.com/file/n3275734/test.doc test.doc However, when I link the images rather than embed, ie., I use file:/// to link to an absolute filename (with absolute). The document opens correctly and the scaling/sizing works as it should. However the file is then not portable, ie., refers to locations on my machine. If however, I try to host the images (on a server), and try to include images via URL hyperlinks (http://...) rather than to local files, (files:/ / /) The images don't seem to scale no matter what I try and remain 100% of the original file size... Is there a known workaround to insert images via hyperlinks and have the resultant image load, and correctly (re)size? If you're hit by an API bug the only workaround I can think of is to unpack the document zip file, fix the paths or what is wrong and not settable correctly by API using sed/awk/perl/java/whatever and pack things up again. Since you're building docs by using the sdk that would only be one - although ugly - additional step. And you caan omit it when the bug is fixed. Good luck, Marc -- Ihr Suchbegriff OO.o könnte fehlerhaft oder unbekannt sein: Ob Zoo besser ist? (Suchmaschine) - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Opening the file in MS Word, linked images wrong size
Am Montag, den 07.02.2011, 04:18 -0800 schrieb cdfleischmann: Hrm, hrm not sure how to do that. Thus far I tried: IsSyncWidthToHeight set to false, and at the same time also tried IsSyncHeightToWidth setting to false. Lastly, trying IsSyncWidthToHeight to TRUE also fails? In OOo I see: [The image is meant to be 7 cm's wide, and 0.41 cm's in height]. http://openoffice.2283327.n4.nabble.com/file/n3264004/ooimage.jpg and in MS Word I see the aspect also set, but not the same dimensions as it should be set to? http://openoffice.2283327.n4.nabble.com/file/n3264004/msword.jpg Any other ideas? I am really at a loss here? Maybe you can try this: - insert an image manually into a document - then export and see if it looks OK in the target program - read out how OO.o has set the properties and use them at the api From my experience it is sometimes important to use working combinations of multiple properties, not only one setting. HTH anyhow, Marc -- Ihr Suchbegriff OO.o könnte fehlerhaft oder unbekannt sein: Ob Zoo besser ist? (Suchmaschine) - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
[api-dev] forcing dos line endings on unix
Hi, is it possible to force the line endings of a text file written using BASICs simple file functions to be 0xOD 0xOA instead of 0x0A only? open sDateiname for output as #iNum s = CDate(oBereich.getCellByPosition(0, 0).getValue()) s = s + ; ... print #iNum, s I tried to add a chr(0x0d) at the end of the print line, but it is getting eaten up by OO.o not appearing in the file. Background: Those files are type .CSV written using OO.o running on FreeBSD. The consuming application is running on windows and is getting very confused by unix type line endings. TIA; Marc - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] forcing dos line endings on unix
Am Mittwoch, den 04.08.2010, 12:59 +0200 schrieb Thomas Krumbein: Hey Marc, Marc Santhoff schrieb: [..] I would rather change the macro using another technique, ucb or the like, for writing files than tell the users to install something else (because my macro program is not able to ...). I am writing my csv files using ucb. In this case I can even pass the encoding-type for output file. So, try this: oSFA = createUnoService(com.sun.star.ucb.SimpleFileAccess) oOutputStream = createUnoService(com.sun.star.io.TextOutputStream) oDatei = oSFA.OpenFileReadWrite(sURL) 'sURL should be the URL of your csv-file oOutputStream.SetOutputStream(oDatei.getOutPutStream) sString = this is your text(first line)... chr(13) chr(10) sString = sString and now line 2... oOutputStream.writeString(sString) 'Again add a windows line-feed: oOutputStream.writeString(chr(13) chr(10)) 'close the file oOutPutStream.closeOutput() Beautiful, you made my day. :) Many thanks, Marc - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
[api-dev] snippet database needs attention
Hi, can someone look at that snippet, please?: http://codesnippets.services.openoffice.org/Database/Database.EmptyDateField.snip Seems to be messed up, although the rest in the category is fine. Thanks, Marc -- Marc Santhoff m.santh...@web.de - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api - dev] How to change Macro Security Level in program?
Am Donnerstag, den 28.01.2010, 10:29 +0100 schrieb Fernand Vanrie: Lee , Security is part of the Document settings so i use in basic by openiong the document: Dim mFileProperties(0) As New com.sun.star.beans.PropertyValue mFileProperties(0).Name=MacroExecutionMode mFileProperties(0).Value=4 ' see documentations for more value's oDocument = StarDesktop.LoadComponentFromURL(ConvertToURL(filepath), _blank, 0, mFileProperties()) hope it helps I would name this a dangerous security hole. Is it possible to switch it off using a configuration setting? Marc - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api - dev] How to change Macro Security Level in program?
Am Freitag, den 29.01.2010, 12:02 +0100 schrieb Cor Nouws: Marc Santhoff wrote (29-01-10 00:35) I would name this a dangerous security hole. Is it possible to switch it off using a configuration setting? Well, to turn it off with a macro, the user has to accept to run that macro. So I do not understand which hole you mean. I was worried about something else: If the user allows a macro to run this macro could switch off macro security without getting noticed by the user. After this has been done any macro would run without warning. But generally it is better to think a little longer before writing mails. If the user chooses to trust a macro the potential damage is already done, so it makes no difference. To be sure a macro programm has to be read and checked line by line anyways (and signed afterwards). Sorry for the noise, it's just I didn't know yet macro security could be changed programmatically. Marc -- Warning: Do not look directly into laser with remaining eye. - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Using XDatabaseDocumentUI.loadComponent with BASIC
Am Freitag, den 09.01.2009, 09:33 +0100 schrieb Fernand Vanrie: Marc Santhoff wrote: Am Donnerstag, den 08.01.2009, 16:18 +0100 schrieb Fernand Vanrie: Frank, Is it also a reasonable RTF to asks that every SubComponent tables, Querys etc been protected by a password or a other protection sheme (from out the API) I think you can achieve user rights discrimination by doing so in the undelying database. It's a standard task for RDBMS. Marc, you are right but when using OO-docs as a frontend-docs then the rights are distributed on base of who has acces to the Frontend-doc . So here the maker of the frondend-doc must decide wath is accesable for the frontend-doc-user . Think at how spreadsheets are secured. Greetz Fernand I understand your intention, but since it isn't possible to do so it may be sufficient to let the underlying database reject the execution of queries and the change or even retrieval of tables (data). Another approach could be to hide the docs from the gui by removing from the lists shown, but really don't know if that's possible. HTH, Marc - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Using XDatabaseDocumentUI.loadComponent with BASIC
Am Donnerstag, den 08.01.2009, 16:18 +0100 schrieb Fernand Vanrie: Frank, Is it also a reasonable RTF to asks that every SubComponent tables, Querys etc been protected by a password or a other protection sheme (from out the API) I think you can achieve user rights discrimination by doing so in the undelying database. It's a standard task for RDBMS. Drew did and suggested some techniques, search the users and dev lists (at dba). HTH, Marc - To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org For additional commands, e-mail: dev-h...@api.openoffice.org
Re: [api-dev] Best way to know if SomeFileName is loadable ?
Am Montag, den 20.10.2008, 08:09 +0200 schrieb Alain Rist: Hi, I need to know if a user selected file can be loaded by OOo. My current (working) implementation tests if OOo can load the file (in hidden mode). It is costly, specially when the answer is yes, as the file will actually be loaded before return. Is there a lighter way to get the answer? inline bool CanLoad(LPCWSTR sPath) { ReferenceXComponent xDoc; using com::sun::star::frame::XComponentLoader; ReferenceXComponentLoader xLoader(InstanceXComponentLoader(Lcom.sun.star.frame.Desktop)); if (xLoader.is()) try { using com::sun::star::beans::PropertyValue; using com::sun::star::beans::PropertyState_DIRECT_VALUE; PropertyValue pvHidden(LHidden, 0, Any(true), PropertyState_DIRECT_VALUE); SequencePropertyValue sPV(pvHidden, 1); using com::sun::star::frame::FrameSearchFlag::CREATE; xDoc = xLoader-loadComponentFromURL(GetPathURL(sPath).Complete, L_blank, CREATE, sPV); _default This way the frame loader tries to find an already loaded document. I don't know if this works as expected in hidden mode though. } catch (Exception e) {} return xDoc.is() ? xDoc-dispose(), true : false; }Thanks, AR HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Unanswered API and OOo development related questions on the OOoForum
Hi Clayton, Am Samstag, den 18.10.2008, 19:33 +0200 schrieb Clayton: Some of the unanswered topics with links to the forum postings are: (Note: This is NOT a complete list.. it is only some of the API and OOo Development related questions that have gone unanswered.) [... list ...] At least a few of those questions could be answered by looking there: http://codesnippets.services.openoffice.org/ HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] automatic chapter numbering
Am Freitag, den 19.09.2008, 01:25 -0300 schrieb Ariel Constenla-Haile: [by the way, which is in German the shortcut for the Dummy Text - DT AutoText?] It is BT for Blindtext. Have fun, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] add more textfields to one shape
Am Freitag, den 05.09.2008, 10:14 +0200 schrieb Nicole Scholz: Hi! I would like to add some textfields to one shape. But always when I add them they are put directly on the right side next to the other textfield. I would like to have the textfield below the textfield before. Does someone have a hint how I can manage this? I think inserting a paragraph break should suffice. Try sth. like: oText.insertControlCharacter(oCursor, _ com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, FALSE) HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] add more textfields to one shape
Hello Nicole, Am Freitag, den 05.09.2008, 22:19 +0200 schrieb Nicole Scholz: Hi Marc! Thanks for your answer. I tried to insert a paragraph break and a line break but the textfield is inserted right to the other one and not below. Perhaps there is another possibility to change the position of the textfield. Here is my code: [ snip ] Regards Nicole Hm, I think I can't help any further. My expectation was this method would be working and I'm not a specialist regarding writer docs. Maybe if you start by creating the wanted result manually inside a writer doc and then investigate the structure of the internal data or the content of the XML in the un-zipped document you get some hints what is missing here. Or someone else can help ... Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] change font of the table of content
Am Donnerstag, den 28.08.2008, 22:15 +0200 schrieb Nicole Scholz: Hi! I created a table of content in Writer. But the font in the toc is different to the font I use in the rest of my document. Does someone know how to change the font that I have the same font for the whole document? Regards Nicole If you only want a different look you can change the style template manually or base your document on a template with adapted styles. There are paragraph styles for the different levels of the TOC. (german Standard-Verzeichnis-... and Überschrift-Inhaltsverzeichnis Überschrift in the hierarchical view of the navigator) These changes can certainly be changed by API, the Developers Guide shows how to. HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] embedding Java window in OO.o frame
Am Dienstag, den 01.07.2008, 08:35 +0200 schrieb Mathias Bauer: Marc Santhoff wrote: Hi, the devguide has information about embedding an OO.o window into a Java window as a client. I'd like to know if the opposite is possible: a Java window embedded into a OO.o window/frame. Can this be done? If yes, how to? (or where can I find information on the topic ;) In OOo2.x we had support for Java Applets in OOo and so we already have an example how to embed Java windows. The code doing that can be found in the sj2 module and in sfx2/source/doc/applet.cxx. Perhaps this can give you some hints how to do that. Thanks, I'll have a look and see what I can learn from the code. My bits of information to the ongoing discussion: I'm thinking about an extension that would insert it's own window into OO.o and steer it from the controls in the window. The idea is to use Java/Swing/... and whatever is necessary to get the task done without having to dig deep inside the sun.com.star.awt.* hierarchy and maybe find out there are some controls missing or something cannot be done in the way it should. This way I'd avoid the risk of finding out something isn't possible and OTOH I can use libraries and techniques for programmming I'm a ot more used to than OO.o's awt controls. Regards, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] embedding Java window in OO.o frame
Hi, the devguide has information about embedding an OO.o window into a Java window as a client. I'd like to know if the opposite is possible: a Java window embedded into a OO.o window/frame. Can this be done? If yes, how to? (or where can I find information on the topic ;) TIA, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Java in Windows and OOo uses different Paper Tray names
Am Montag, den 19.05.2008, 11:41 +0200 schrieb Tobias Krais: Hi Cor, I have a Basic extension for the same job, but provide admins with a unhandy tool to copy/paste papertray names to an ini-file. I thought about it. But it was mere a nightmare... What I do know: related issues are 87883 and 87495 Interesting. This would solve the issue. But in earlier mail discussions about this theme, these themes were rejected. Did you have a look at: $(user)/user/psprint/psprint.conf $(inst)/share/psprint/psprint.conf That's where I got the printer names from (by reading in the section names from the .ini file). Maybe the tray names are visible there (although I did not find anything looking quickly, but I have not defined any printers with trays, AFAIK)? HTH, Marc P.S.: the files are in OO.o 1.1.x, no idae if 2.x still supports them ... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] XRenderer.render
Am Samstag, den 26.04.2008, 10:41 +0200 schrieb Tim Parth: Hi all! Is it possible to use the interface XRender with it's method render to render a complete TextDocument (swriter) into an image for further use? The documentation is very short an I don't know exactly if it suits my needs and if yes, how to use it. Thank you all very much in advance! Hi, since noone seems to know the answer: I remember darkly having fiddled with such stuff and a way I found was using some PrintPreview-related properties and functions. IIRC these functions dealt with rendering the preview of templates. Maybe you'll find something looking for that keywords ... HTH, Marc P.S.: found somthing ... sub testLoadAsPreview oDT = createUnoService(com.sun.star.frame.Desktop) aURL = convertToUrl(/home/marc/Dokumente/Notizen.sdw) dim Args(1) as new com.sun.star.beans.PropertyValue Args(1).Name = ReadOnly Args(1).Value = TRUE Args(0).Name = Preview Args(0).Value = TRUE tmpDoc = oDT.loadComponentFromUrl(aURL, _blank, 0, Args()) end sub After that you would need to extract a bitmap out of the view. Have fun ... ;) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Getting tables in Bookmark (OOBasic)
Am Freitag, den 25.01.2008, 19:31 -0300 schrieb Ariel Constenla-Haile: Hi Marc, Marc Santhoff escribió: [...] Boris is trying to access a bookmark inserted inside a TextTable's cell (if I understood well) ' create a cursor at the bookmark csr = oDoc.Text.createTextCursor() csr.gotoRange(oBookmark.getAnchor(), FALSE) this won't work, ... It does, it's tested. As long as the bookmark spans over the complete table (which is how I did it), there is no problem. If the table is after or below the bookmark another, similar strategy will do. Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Getting tables in Bookmark (OOBasic)
Am Freitag, den 25.01.2008, 10:25 +0100 schrieb Boris Ratak: Hi, I'm searching for a way to interact with a table located in a bookmark in a Writer document (using an OOBasic macro). I know how to get the bookmark, but I can't see a getTextTable (or something similar) method in the bookmark ou anchor object. Does anyone know how to do it? It would be really helpful to me. The bookmark itself has an interface XContentEnumerationAccess. The example in the IDL reference looks like this: Example This example prints the names of all tables: xTextTableEnum = xTextDoc.createContentEnumeration( com::sun::star::text::TextTable ) while xTextTableEnum.hasMoreElements() do print xTextTableEnum.nextElement().Name wend So, by swapping the xTextDoc from the example with your bookmark that should be what you need. Hmm, but that doesn't work, at least not in OO.o 1.1.3 ... but look, this way it does: ' create a cursor at the bookmark csr = oDoc.Text.createTextCursor() csr.gotoRange(oBookmark.getAnchor(), FALSE) ' iterate over the content spanned by the bookmark xTextEnum = csr.createEnumeration() while xTextEnum.hasMoreElements() el = xTextTableEnum.nextElement() if el.SupportsService( com.sun.star.text.TextTable ) then print el.Name endif wend Have fun, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Re: [Spam] Re: [api-dev] How to unselect a current sleection
Am Dienstag, den 08.01.2008, 13:44 +0100 schrieb Fernand Vanrie: its in a writer doc where a picture is selected and i want to protect this picture from user alternation by placing a simple macro on it who says do not move and exits . But after exiting the sub the picture is still selected and can now been altered by the user ... So in my macro i must unselect the picture before exiting the sub As a workaround you could get the ViewCursor (I think you have it already, if your code does selection) and use one of it's moving methods back and forth, like VC.goNextWord() VC.goPrevious() or whatever fits your needs (e.g. SentenceCursor-IF). HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] MailMergeType.FILE vs MailMergeType.PRINT
Am Donnerstag, den 15.11.2007, 09:00 +0100 schrieb Willem Voogd: Hey Marc, Hi Willem, Yeah, well, that's exactly what I do. And the code passes, and runs fine, except that the resulting file doesn't have the fields merged. And then when I change MailMergeType.FILE to MailMergeType.PRINT I do get the merged document printed out... Did you by any chance run this code on a OOo2.3 version? No, it was lingering around in my archive since 1.x ... maybe I find the time to try next weekend. If anything fails I can pack up the complete bunch of files and send them to you in private. Well I think I have roughly the same code as you have, since I too picked it up somewhere in the archives (even the comments match), So you do create your print job(s) from a template? That should be it. but just to be sure it might be a good idea, so yes please :) I'll do and send to your private mail address. May take a little time, though. ;) Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] MailMergeType.FILE vs MailMergeType.PRINT
Am Donnerstag, den 15.11.2007, 15:46 +0100 schrieb Willem Voogd: I'll do and send to your private mail address. May take a little time, though. ;) My email agent is patient.. :) Thanks for your time and input! It's you I meant to be patient until I put my hands on it. ;) But it is on the way now. Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] MailMergeType.FILE vs MailMergeType.PRINT
Am Dienstag, den 13.11.2007, 17:37 +0100 schrieb Willem Voogd: Hi, Hi Willem, it's me again :) I'm still putting up a fight to get the mailmerge done programmatically. And again i find myself in the dark. When i set the OutputType property to MailMergeType.PRINT the file gets properly merged and printed, however when i set it to MailMergeType.FILE the file doesn't get merged before it gets saved. Is this a real bug or am i perhaps missing something that i have to do extra when choosing for OutputType MailMergeType.FILE? I don't know exactly what the problem may be at your side, but I got some code long ago on this list that was working flawlessly. The code was designed to do a mail merge to file(s) by creating a datasource, storing a doc with fields as template and merging the data to an instance of this template as new document. The merging sequence looks like this: snip public void doMerge() { Object mmservice = null; try { // Create an instance of the MailMerge service mmservice = mxMCF.createInstanceWithContext( com.sun.star.text.MailMerge, mxComponentContext); } catch (Exception e) { System.err.println(Error getting MailMerge service: + e); return; } // Get the XPropertySet interface of the mmservice object XPropertySet oObjProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, mmservice); try { // Set up the properties for the MailMerge command oObjProps.setPropertyValue(DataSourceName, mDataSourceName); oObjProps.setPropertyValue(Command, mTableName); oObjProps.setPropertyValue(CommandType, new Integer(com.sun.star.sdb.CommandType.TABLE)); oObjProps.setPropertyValue(OutputType, new Short(com.sun.star.text.MailMergeType.FILE)); oObjProps.setPropertyValue(DocumentURL, mFileURL); } catch /snip If anything fails I can pack up the complete bunch of files and send them to you in private. HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] instantiating InstanceLocker from BASIC
Hi Mikhail! Yes, you're right. It was a matter of brain usage ... ;) Am Dienstag, den 09.10.2007, 11:41 +0200 schrieb Mikhail Voitenko: Hi Marc, The approved action here is prevent closing. So if TRUE is returned, the closing of the current document model should be prevented. And it is. That exactly was the cause of a hanging office process after the office was closed by me. I only didn't identify it because I had done some other things leaving a process active sometimes. If don't do this dangerous actions in parallel the process holding the modell stays in memory. So holding a reference to a not closable model *does work*. But it looks like locking of the model does not prevent closing of the frame. Please try to register the InstanceLocker on the frame. Yes, if I do exchange the model for the frame I does work as expected, the frame stays open as it should. So this works, too. :) Many thanks for helping out and waking me up, Marc Regards, Mikhail. Marc Santhoff wrote: Hello Mikhail, Am Montag, den 08.10.2007, 14:53 +0200 schrieb Mikhail Voitenko: Hi Marc, This is a bug, I have just submitted an issue to myself. It is going to be fixed in OOo2.4 currently. Please use the following link to find the issue. http://www.openoffice.org/issues/show_bug.cgi?id=82393 Thanks for information and filing that one. :) I read the issues text as if all three parameters are available it should work. So I tried: BASIC global doc as object global lck as object sub testLocker doc = ThisComponent oCB = CreateUnoListener(my_, com.sun.star.embed.XActionsApproval) args() = Array( CreateUnoValue(any, doc), _ CreateUnoValue(any, 1), _ oCB _ ) psm = GetProcessServiceManager() lck = psm.createInstanceWithArguments(com.sun.star.embed.InstanceLocker, args()) end sub function my_approveAction(nAction as long) as boolean 'msgbox Ping! my_approveAction = FALSE end function sub ReleaseLock if NOT IsNull(lck) then lck.dispose() end sub /BASIC And indeed the Ping! appeared, but after clicking away this message the writer doc was closed. Is there another error or did I fail in handing over the approve listening function? (I did test returning TRUE in the listening callback to be sure, no change) TIA, Marc - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] instantiating InstanceLocker from BASIC
Hi again, this time a crash report was generated. As last time there was only one writer doc open in parallel to the IDE. The code is: sub testLocker doc = ThisComponent args() = Array(CreateUnoValue(any, doc), CreateUnoValue(any, 1)) psm = GetProcessServiceManager() lck = psm.createInstanceWithArguments(com.sun.star.embed.InstanceLocker, args()) msgbox your doc is locked while this message is shown lck.dispose() end sub But on the machine used there is no connection to the outside. Whre should I send it to, anyone interested? A few lines: officeinfo:officeinfo xmlns:officeinfo=http://openoffice.org/2002/officeinfo; build=680m5(Build:9221) platform=wntmsci10.pro language= procpath=D:\PROGRAMME\OPENOFFICE.ORG 2.3\PROGRAM\ exceptiontype=0xC005 product=OpenOffice.org 2.3/ systeminfo:systeminfo xmlns:systeminfo=http://openoffice.org/2002/systeminfo; systeminfo:System name=Windows version=4.10 build=67766446 locale=0x0407/ systeminfo:CPU type=x86/ /systeminfo:systeminfo errormail:Stack type=Win32 errormail:StackInfo pos=0 ip=0x66788034 rel=0x8034 ordinal=uno_Environment_enter+0x096E name=CPPU3.DLL path=/ errormail:StackInfo pos=1 ip=0x6678842B rel=0x842B ordinal=uno_type_any_construct+0x001D name=CPPU3.DLL path=/ errormail:StackInfo pos=2 ip=0x59B8113B rel=0x113B ordinal=GetVersionInfo+0x013B name=COMPHELP4MSC.DLL path=/ errormail:StackInfo pos=3 ip=0x59BC7E43 rel=0x00047E43 ordinal=component_getFactory+0x25CA name=COMPHELP4MSC.DLL path=/ errormail:StackInfo pos=4 ip=0x5C9AD050 rel=0x0001D050 ordinal=cppu::createSingleComponentFactory+0x0BBA name=CPPUHELPER3MSC.DLL path=/ errormail:StackInfo pos=5 ip=0x5C9AD185 rel=0x0001D185 ordinal=cppu::createSingleComponentFactory+0x0CEF name=CPPUHELPER3MSC.DLL path=/ errormail:StackInfo pos=6 ip=0x5C9ADEE3 rel=0x0001DEE3 ordinal=cppu::createSingleComponentFactory+0x1A4D name=CPPUHELPER3MSC.DLL path=/ errormail:StackInfo pos=7 ip=0x626063BD rel=0x63BD ordinal=component_getFactory+0x4B06 name=SERVICEMGR.UNO.DLL path=/ errormail:StackInfo pos=8 ip=0x6260304D rel=0x304D ordinal=component_getFactory+0x1796 name=SERVICEMGR.UNO.DLL path=/ errormail:StackInfo pos=9 ip=0x63D61BCA rel=0x1BCA name=MSCI_UNO.DLL path=/ errormail:StackInfo pos=10 ip=0x63D61EE4 rel=0x1EE4 name=MSCI_UNO.DLL path=/ errormail:StackInfo pos=11 ip=0x63D622E2 rel=0x22E2 name=MSCI_UNO.DLL path=/ errormail:StackInfo pos=12 ip=0x635F70FB rel=0x70FB ordinal=component_writeInfo+0x4E40 name=REFLECTION.UNO.DLL path=/ Maybe this will help making a guess how I get the locking to work ... TIA, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] instantiating InstanceLocker from BASIC
Hello Mikhail, Am Montag, den 08.10.2007, 14:53 +0200 schrieb Mikhail Voitenko: Hi Marc, This is a bug, I have just submitted an issue to myself. It is going to be fixed in OOo2.4 currently. Please use the following link to find the issue. http://www.openoffice.org/issues/show_bug.cgi?id=82393 Thanks for information and filing that one. :) I read the issues text as if all three parameters are available it should work. So I tried: BASIC global doc as object global lck as object sub testLocker doc = ThisComponent oCB = CreateUnoListener(my_, com.sun.star.embed.XActionsApproval) args() = Array( CreateUnoValue(any, doc), _ CreateUnoValue(any, 1), _ oCB _ ) psm = GetProcessServiceManager() lck = psm.createInstanceWithArguments(com.sun.star.embed.InstanceLocker, args()) end sub function my_approveAction(nAction as long) as boolean 'msgbox Ping! my_approveAction = FALSE end function sub ReleaseLock if NOT IsNull(lck) then lck.dispose() end sub /BASIC And indeed the Ping! appeared, but after clicking away this message the writer doc was closed. Is there another error or did I fail in handing over the approve listening function? (I did test returning TRUE in the listening callback to be sure, no change) TIA, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] instantiating InstanceLocker from BASIC
Hi Paolo, you're right, stupid error since the argument is sequence of any. I tried here and had the office hang repeatedly on win98, so there in deed must be something wrong. Am Samstag, den 06.10.2007, 23:45 +0200 schrieb Paolo Mantovani: Hello Marc, It seems that the problem is in the way in which you are passing arguments. I've tried in this way: sub LockerCheck doc = ThisComponent psm = GetProcessServiceManager() args() = Array(doc, 3) I changed this to Array(doc, 1) to have the correct value for closing prevention. lck = _ psm.createInstanceWithArguments(com.sun.star.embed.InstanceLocker, args()) end sub No error are raised in this case, and I'm quite sure that arguments are correctly processed .but I've got some crashes :-( It seems that there are further problems, please check. Funny enough, with the original version having an array of PropertyValues the InstanceLocker got created, I could inpect it after the exception ... BTW what are you trying to achieve with this code? (I'm curious :-) I want to make sort of an immutable document window. Noone should be able to close it except my code. Thanks, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] base snippets
Hi, I finally got the snippet creator working, so here are two snippets for the collection. Marc ?xml version=1.0? !-- $RCSfile: $ last change: $Revision: $ $Author: $ $Date: $ (c)2003 by the copyright holders listed with the author-tags. If no explicit copyright holder is mentioned with a certain author, the author him-/herself is the copyright holder. All rights reserved. Public Documentation License Notice: The contents of this Documentation are subject to the Public Documentation License Version 1.0 (the License); you may only use this Documentation if you comply with the terms of this License. A copy of the License is available at http://www.openoffice.org/licenses/PDL.html The Original Documentation can be found in the CVS archives of openoffice.org at the place specified by RCSfile: in this header. The Initial Writer(s) of the Original Documentation are listed with the author-tags below. The Contributor(s) are listed with the author-tags below without the marker for being an initial author. All Rights Reserved. -- snippet language=OOBasic application=Database keywords keywordlistbox/keyword keywordform/keyword keywordsql/keyword keywordlist source/keyword /keywords authors author id=ms2 initial=true email=[EMAIL PROTECTED]Marc Santhoff/author /authors question heading=change listbox sourceHow can I change the SQL list source of a ListBox? pA query (SQL) based listbox has a fixed SQL statement for itapos;s source./p pSometimes it is useful to change this statement by code, e.g. when using one form with different queries./p /question answer listingSub changeLBSource ' caution: if you change like this and then save the form ' the SQL statement filled in when designing the form is ' overwritten with the new one, your code should hold both of them! dim oDoc as object, oForm as object dim oListboxModel as object dim ssql(0) as string oDoc = ThisComponent oForm = oDoc.DrawPage.Forms(0) oListboxModel = oForm.getByName(quot;ListBoxquot;) ssql(0) = quot;select quot;quot;namequot;quot;, quot;quot;IDquot;quot; from quot;quot;colorquot;quot;quot; oListboxModel.ListSource() = ssql() oListboxModel.refresh() End Sub /listing /answer versions version number=1.1.x status=tested/ version number=2.2.0 status=tested/ /versions operating-systems operating-system name=All/ /operating-systems changelog change author-id=ms2 date=2007-09-24Initial version/change /changelog /snippet ?xml version=1.0? !-- $RCSfile: $ last change: $Revision: $ $Author: $ $Date: $ (c)2003 by the copyright holders listed with the author-tags. If no explicit copyright holder is mentioned with a certain author, the author him-/herself is the copyright holder. All rights reserved. Public Documentation License Notice: The contents of this Documentation are subject to the Public Documentation License Version 1.0 (the License); you may only use this Documentation if you comply with the terms of this License. A copy of the License is available at http://www.openoffice.org/licenses/PDL.html The Original Documentation can be found in the CVS archives of openoffice.org at the place specified by RCSfile: in this header. The Initial Writer(s) of the Original Documentation are listed with the author-tags below. The Contributor(s) are listed with the author-tags below without the marker for being an initial author. All Rights Reserved. -- snippet language=OOBasic application=Database keywords keywordrecord/keyword keywordtemplate/keyword keywordform/keyword keywordcopy/keyword /keywords authors author id=ms2 initial=true email=[EMAIL PROTECTED]Marc Santhoff/author /authors question heading=copy record to newHow can I copy an existing record to a new one as template? pWhen typing in data into a database form sometimes many records only differ in a small number of fields./p pIn this case it is desirable to copy one record to a new, empty one and only change the minor differences by hand./p /question answer listingapos; Copies the value currently shown in the form apos; as a template to a new record. This new record only apos; is displayed for editing, not stored yet. apos; Only some control types are checked here, please apos; add missing types needing special treatment. apos; The programmer or user has to take care of adding a apos; new primary key into the corresponding field control. apos; event binding sub sub copyToNewEvent(evt as object) copyRecordToNewRecord(thisComponent) end sub sub copyRecordToNewRecord(oDoc as object, optional sKeyfieldname as string) dim aVal as Variant dim ccount as integer dim i as integer if IsMissing(sKeyfieldname) then sKeyfieldname = quot;IDquot; oForm = oDoc.Drawpage.Forms(0) ccount = oForm.count redim aVal(ccount) apos; Step 1 --gt; get the current fields content (excluding key field for auto values) apos; loop over all controls for i=0 to ccount-1 aControl = oForm.getByIndex(i) apos; only get controls storing
Re: [api-dev] Moving CoceSnippets into the Wiki?
Am Dienstag, den 28.08.2007, 09:14 +0200 schrieb Juergen Schmidt: Marc Santhoff wrote: I do not like wikis. well it's your personal opinion. but can i ask you if you have already submitted a snippet until today? You're welcome. I haven't submitted snippets myself for technical reasons, not unwillingness. If moved to the wiki it'll be the other way round. ;) I like the snippets as they are now. Why invest so much time and work for making the wiki snippet-ready by extending syntax highlighting and whatever if anything is already running? As i mentioned before it is not so much time, it's quite easy. Why drop the very nice and matured work of Paolo and Tom and start anew? It is just the idea to renew the idea of a huge and useful snippet collection. This time with a wiki because i think a wiki has some advantages. Well i see that some people don't like the wiki idea, maybe we can improve the current snippet site to make contributions and maintenance easier. That was the reason for me to speak up. I think having other ways of submitting snippets could solve the bottleneck showing up when Tom is on vacation. Maybe a special mail address will do. I understand that moving to the wiki is an attempt to lower the barriers for submissions. Couldn't there be a cross-publishing-contents-synchronisation-engine for having both, wiki and website? Marc -- Hey you, go back to work! - my boss - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Moving CoceSnippets into the Wiki?
Am Montag, den 27.08.2007, 17:56 +0200 schrieb Juergen Schmidt: Frank Schönheit - Sun Microsystems Germany wrote: Hi Juergen, with our codesnippets.services.openoffice.org we have useful resource to find some useful snippets. But the contribution is from my point of view not easy enough. Although Tom Schindl did a tremendous job to set up the environment and infra structure and Paolo Mantovani who provides the excellent Snippet Creator i would like to suggest that we move the examples, snippets etc. into the wiki. Wikis are a cool thing, but I'm actually not sure they're the best solution for each and everything. Rony already mentioned some things the Wiki is lacking, there certainly are more. One example: Try to copy'n'paste a macro from e.g. [1] to your Basic it is the same with the current snippet page, isn't it? No, it isn't. You *can* copy and paste code from the snippets pages to the IDE or an Editor and you *will* get nicely formatted (indented) code ready to compile. If the wiki doesn't provide cp there has to be at least a download link for the source code as text or it will be unusable. I do not like wikis. I like the snippets as they are now. Why invest so much time and work for making the wiki snippet-ready by extending syntax highlighting and whatever if anything is already running? Why drop the very nice and matured work of Paolo and Tom and start anew? What really could be helpful is attracting more public attention to the snippets pages and the creator. Why don't the marketing people do? Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Problem with with NetBeans Plug-In
Am Montag, den 30.07.2007, 16:18 +0200 schrieb Max Giesbert: CRITICAL # org.openoffice.extensions.util.ProjectCreator,line 486: /usr/lib/openoffice/sdk/linux/bin/uno-skeletonmaker: 4: basename: not found /usr/lib/openoffice/sdk/linux/bin/uno-skeletonmaker: 4: /usr/lib/openoffice/sdk/linux/bin/.bin: not found ---this happened with the Ubuntu SDK ---then i changed /usr/lib/openoffice/sdk/linux/bin/uno-skeletonmaker from #!/bin/sh # wrapper script for OOos SDK programs LD_LIBRARY_PATH=/usr/lib/openoffice/program /usr/lib/openoffice/sdk/linux/bin/`basename $0`.bin $@ ---to #!/bin/sh # wrapper script for OOos SDK programs LD_LIBRARY_PATH=/usr/lib/openoffice/program /usr/lib/openoffice/sdk/linux/bin/uno-skeletonmaker.bin $@ Maybe you can enlighten me what exactly went wrong in the first place because I don't really get it. Your distribution or particular installation lacks the program basename. You could do a 'locate basename' or if locate isn't in use search brute force (find / -name basename). Maybe only the search path in the script is not correct for the distribution. I think basename is one of the most basic helper tools and has to be part of any Linux or Unix-ish OS ... Look there for example: http://www.freebsd.org/cgi/man.cgi?query=basename HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Some Calc Java Macro Issues:
Am Donnerstag, den 05.07.2007, 09:49 -0300 schrieb Denis Camargo: 2) I am having a terrible delay in writing the data on the spreadsheet. My macro has to write around (20-30k rows * 9 cols) of information (shading some blocks of rows with related info), and takes around 2 hours to do so. I can't put a sample of the code here right now, but basically i loop through the items, with a nested loop for each row of data for that item, finishing with the shading, like: for( Pack p : packages) { lastRow = rowCount; rowCount = 0; for( Row r : p) { xSpreadsheet.getCell(x, y).setFormula( r.getData1() ); ... xSpreadsheet.getCell(x, y).setFormula(r.getData9() ); rowCount++; } range = xSpreadsheet.getCellRange( rows from lastRow to rowCount, cols 1 to 9) range.shade( isShade() ); } The code above doesn't work I know that. The real program works, it just is taking too long to finish. Is there a way to speedwrite the data? All the data to write to the spreadsheet is available before I begin to write, so if there is a way to write to big chunks of cells at once, that is not a problem. Try getting the model interface (quuery for an XModel) of the SpreadSheet or SpreadsheetDocument service and use the methods lockControllers and unlockControllers at it. This will save a lot of screen updates and time costly formatting. 3 - On the same massive cell writing subject, how can I access the menu command Insert - Spreadsheet from file... via macro? Because I already created a standalone program that writes a tab-separated text file with the data, and then I manually load the file. I lose all the formatting the old macro did, but the whole 30k rows process goes from 2 hours to less than 1 minute. Maybe this is an alternative to problem 2. Two hours? Ouch ... You could try using a simple file format keeping what you need. In the past (approx. 10 years ago ;) I did something similar using .SLK (SYLK - Symbolic Link Format) or .DIF (Data Interchange Format), those are formats for transfering spreadsheet data with formatting. OO.o knows both, you've got to try yourself which is easier to write from java. HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] API Base Calc integration
Hi Frank, Ray, Am Donnerstag, den 21.06.2007, 14:40 +0200 schrieb Frank Schönheit - Sun Microsystems Germany: You loose the all-in-one-file then, of course, not sure how much this is a limitation in your scenario. Also, it still means you have two separate connections to the DB, while in your original sketch, you would have had one connection only. Again, not sure how much this is a limitation for you. That will most likely be the case. But it makes me think about two questions: - Would this be doable with Äxl? Some ODBC-voodoo or the like? - Could the internal HSQL data be dumped out (maybe in SQL like making a complete dump of common sql server data) and pumped into a central server? Dumping an internal database would make the scenario of having one file much more interesting. I'm using a similar approach for some very heterogenous data from technical tests and sort of laboratory data. These data items are stuck into a HDF5 file (Hierarchical Data Format - work like a file system with paths, files and metadata in one file) together with metadata and parameter files so that nothing get's lost - you pack your file and go. Doing this with OO.o sounds promising. Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] API Base Calc integration
Am Donnerstag, den 21.06.2007, 21:25 +0200 schrieb Frank Schönheit - Sun Microsystems Germany: Hi Marc, - Could the internal HSQL data be dumped out (maybe in SQL like making a complete dump of common sql server data) and pumped into a central server? SCRIPT 'path_to_file' will create a dump of the database, which can be used to re-create the complete DB. See the HSQLDB documentation. Pretty simple and scriptable, beautiful. Thank you! Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] API Base Calc integration
Am Donnerstag, den 21.06.2007, 22:20 +0200 schrieb Marc Santhoff: See the HSQLDB documentation. I did and found another interesting topic: brosing to: http://hsqldb.org/web/hsqlDocsFrame.html and selecting Documentation index i read: (direct link: http://hsqldb.org/doc/guide/ch01.html#N101B4 ) snip In-Process (Standalone) Mode [...] In 1.8.0, you can run a server instance in a thread from the same virtual machine as your application and provide external access to your in-process database. /snip So, besides having to get user, network and database access rights set up properly it *could* be possible to access the running internal hsqldb instance of an .odb document. Thinking about it this might not be very useful, there is no such thing as a database information service for publishing avaliability and the database is only active if OO.o is running ... leads to various bad designed structures. Viewn from the outside it would be better to have a foreign hsql server instance use the data zipped into the odb as its data files read on startup. I think that's what Ray meant in his last mail. Unzipping a temporary version and starting hsql with that sounds somewhat simple, only write access would be a real problem then (synchronization, locking). Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] API Base Calc integration
Am Mittwoch, den 20.06.2007, 23:59 +0200 schrieb Marc Santhoff: Many applications are designed and based solely on the OO Base *.odb files. The *.odb files are used either as the sole gateway to other JDBC data sources (MySQL, Oracle, etc.) or as a genuine data source (embedded HSQLDB). Therefore these applications would not encounter the need of conversion between sdbc.XConnection and java.sql.Connection. Unfortunately my business constraints make this approach impractical. So concluding you have some applications in .odb's being data containers of which some are lateron transferred to central server databases? I think reading the references threads would help me develop a deeper understanding ... the biggest problem in helping you is not knowing the existing structure and the contraints given. I did some digging in those mails. If you really need OO.o calc for collecting data (in internal HSQL databases) and do some data mining and reporting on various sources there is at least one possible solution: Use HSQL in server mode (as opposite to OO.o-embedded mode) and let OO.o and the custom java applications connect to them as needed. That way you have the full bandwidth of organizing the db engines (local, central, datacenter, ...) and the distribution boils down to a software distribution (HSQL and the data files) and configuration management problem. At least mid size companies have to deal with that anyways and are prepared to do so. Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Waiting for a document load and for a form load
Am Donnerstag, den 31.05.2007, 18:48 +0200 schrieb Mathias Röllig: The problem is, that in my opinion i don't need a listener - if i have already understood the sense of it. A listener should execute anything if a special event is initiated. And this should be every time the event is applied. By my macro should only wait once, if the form is not loaded. do anything If oForm.isLoaded do this Else waiting for oForm.isLoaded do this End If I can't see how i can implement the waiting with a listener. So i should add the listener, wait for the event, and after the event i must remove the listener. But ... #-| You can use a global boolean flag for remembering that the first load cycle has been done. In the following listener notifications your listener checks it and does nothing. if not(first_load_done) ... do what has to be done first_load_done = TRUE else exit sub endif But it has to be global for surviving the full time of the office session. Although I don't understand why it has to be done this way, doesn't saving and going to the next new record has to act, too? HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Veto dataset change
Am Mittwoch, den 02.05.2007, 10:32 +0200 schrieb Frank Schönheit - Sun Microsystems Germany: Hi Marc, I found a script from Frank Schönheit which doesn't work but I don't know what is wrong with it: ... This is a logical error made by Java programmers. ;) Calling me a Java programmer, who I barely know the basics of Java ... tsts. Sorry, didn't know being called a Java programmer would be interpreted as insulting you. It was of course an error induced by my C++-background :) Ah yes, that's better by far. ;) Marc -- It is practically impossible to teach good programming style to students that have had prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. - Dijkstra - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Veto dataset change
Am Mittwoch, den 02.05.2007, 17:28 +0200 schrieb Bernd Eilers: Code like this would do behave just like that in java. Are you really sure? If so, please verify ... see below. The assumptions about java programming shown here are just plain wrong. In fact I pretty much doubt that there is any programming language out there where setting a variable means to exit the function. If you view it that way, it is. But in Java the result of a function is set by using return (assigning a value to the function name is an error, as long as there is no variable with the same name), and return has the same task as a variable named like the function in BASIC: transporting the result to the caller. But in Java - and C++ as I learned now - the return statement *does* exit the function. Marc class FunctionDemo { boolean getBool(int v) { if (v == 1) { return true; } return false; } void run() { boolean b = getBool(0); System.out.println(b); b = getBool(1); System.out.println(b); } public static void main( String[] args ) { FunctionDemo me = new FunctionDemo(); me.run(); } } Gives the following output: $ javac FunctionDemo.java $ java FunctionDemo false true $ qed - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Setting page size when exporting as a pdf
Am Freitag, den 20.04.2007, 15:18 -0700 schrieb Ryan Grimm: I'm working on exporting spreadsheet documents to pdf using Java. I can get the documents exported as a pdf without any problem, but I'd like to change the paper size so the pagination is a bit nicer. Even when I set the size, the document still comes out as being 8.5x11. Anyone have any thoughts on how to do this? I've continued to try and work through things myself but haven't gotten anywhere. I've tried to boil down my code as much as I can: XStyleFamiliesSupplier xSupplier = (XStyleFamiliesSupplier) UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xSpreadsheetDocument); XNameAccess xNameAccess = xSupplier.getStyleFamilies(); XNameContainer xPageStyleCollection = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, xNameAccess.getByName(PageStyles)); XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xPageStyleCollection.getByName(Default)); Size large = new Size(5, 5); xPropertySet.setPropertyValue(Size, large); If this last step doesn't work, the easiest way to get around would be to predefine a new page style having the size set as needed. In your program you would only apply this page style temporarily and reset after it is done - no need to fiddle with actual sizes directly. If you have only one or a small amount of special size settings you only need to care about distributing the page style to every client ... HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Setting page size when exporting as a pdf
Am Freitag, den 20.04.2007, 17:28 -0700 schrieb Ryan Grimm: If this last step doesn't work, the easiest way to get around would be to predefine a new page style having the size set as needed. In your program you would only apply this page style temporarily and reset after it is done - no need to fiddle with actual sizes directly. If you have only one or a small amount of special size settings you only need to care about distributing the page style to every client ... Hi Marc, Unfortunately the page size is going to vary from spreadsheet to spreadsheet so I don't think I'll be able to predefine a page style. My end goal is to set the page width to be the same as the width of the spreadsheet itself. I see. It seems like this is something I should be able to do, am I correct in my thinking? I think so, too. But I'm only partly an expert in printing matters, knowing some facts from the users and macro programmers view. The behaviour you describe look like an error to me. It rings a bell somewhere too, but I don't know what it wants to tell me ... maybe an old issue not fixed yet. Last time dealing with calc and printing I went another way in my code: (- store all defined print areas to not disturb users) - define a print area containing the used range of cells - print the sheet - delete the self defined print area (- restore all user print areas) In BASIC the core part boils down to (working code I've made for a template): sub PrintSheetToPDF(aDoc as object, aSheet as object, aFileName) ' neuen Druckbereich einstellen, benutzter Bereich auf einer Seite dim oPrintAreas(0) as new com.sun.star.table.CellRangeAddress with oPrintAreas(0) .Sheet = IndexOfSheet(aDoc, aSheet) .StartRow = 0 .StartColumn = 0 .EndRow = maxRowI(aSheet) .EndColumn = maxColumnI(aSheet) end with aSheet.setPrintAreas(oPrintAreas()) ' neuen Drucker setzen dim oPrinterDescriptor(0) as new com.sun.star.beans.PropertyValue oPrinterDescriptor(0).Name = Name oPrinterDescriptor(0).Value = PDF-Konverter aDoc.setPrinter(oPrinterDescriptor()) ' Sheet drucken dim oPrintOpts(0) as new com.sun.star.beans.PropertyValue oPrintOpts(0).Name = FileName oPrintOpts(0).Value = ConvertToUrl(aFileName) aDoc.print(oPrintOpts()) end sub For a translation to Java you'll have to insert the queryInterface calls and get the var typing right ... HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] embedding extension into GUI and hierarchy
Am Dienstag, den 10.04.2007, 13:32 +0200 schrieb Juergen Schmidt: Marc Santhoff wrote: Am Sonntag, den 08.04.2007, 21:25 +0200 schrieb Mathias Bauer: Marc Santhoff schrieb: Hi, I ask myself if it is possible to do some special tasks with an extension. Imagine having written the core service for a new type of writer field as an external service using some scripting engine like python. This new field should be presented:- - to the user in the field insertion dialog (CTRL-F2) - to the programmer as part of the service structure he is used to, e.g. com.sun.star.text.FieldMaster.FancyUserField The core part would then be triggered at creation, update and refresh actions of the document holding an instance of this new field. Can this be done? Theoretically yes but it lacks some infrastructure. Writer must provide an extendable factory for text fields. We have something comparable (text fields assigned to meta data) on our agenda for the forseeable but probably not very near future. I expected an answer like this. Use cases for this scenario are too rare to expect something in the near future ... users and programmers will have to live with some additional docs then. ;) but it shows that you have thought about it and i like the idea. It should be taken as a pointer for future designs. We should think about extensions and should always ask if a generic approach can make sense. Can it be of interest to integrate in existing or extend functional areas with own implementations via extensions? If yes and if it won't be a performance killer we should prefer generic designs wherever it is possible. I'd like to have this feature for the future, too. Often macro programmers or extension makers ask questions about how to integrate their work with the existing gui, be it for reducing their own workload or, more important, to present it to the user in a uniform way. It's somewhat diffficult to explain somebody that a writer field comes from an extension and has to be inserted into a document another way than standard text fields but has the same meaning. We have already a lot of useful service provider interfaces (SPI) where it is possible to integrate in the office via extensions. This SPIs make it interesting to implement extensions (e.g. calc add-ins, add-ons, spellchecker, filter, ...). Very nice. Sounds like opening doors for second source solution providers - and lower the count of RFEs in the future. :) Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] embedding extension into GUI and hierarchy
Am Sonntag, den 08.04.2007, 21:25 +0200 schrieb Mathias Bauer: Marc Santhoff schrieb: Hi, I ask myself if it is possible to do some special tasks with an extension. Imagine having written the core service for a new type of writer field as an external service using some scripting engine like python. This new field should be presented:- - to the user in the field insertion dialog (CTRL-F2) - to the programmer as part of the service structure he is used to, e.g. com.sun.star.text.FieldMaster.FancyUserField The core part would then be triggered at creation, update and refresh actions of the document holding an instance of this new field. Can this be done? Theoretically yes but it lacks some infrastructure. Writer must provide an extendable factory for text fields. We have something comparable (text fields assigned to meta data) on our agenda for the forseeable but probably not very near future. I expected an answer like this. Use cases for this scenario are too rare to expect something in the near future ... users and programmers will have to live with some additional docs then. ;) Many thanks, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] embedding extension into GUI and hierarchy
Hi, I ask myself if it is possible to do some special tasks with an extension. Imagine having written the core service for a new type of writer field as an external service using some scripting engine like python. This new field should be presented:- - to the user in the field insertion dialog (CTRL-F2) - to the programmer as part of the service structure he is used to, e.g. com.sun.star.text.FieldMaster.FancyUserField The core part would then be triggered at creation, update and refresh actions of the document holding an instance of this new field. Can this be done? TIA, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Registering an XMailMergeListener - possible at all?
Am Mittwoch, den 07.03.2007, 14:59 +0100 schrieb Christian Lohmaier: http://api.openoffice.org/servlets/ReadMsg?listName=devmsgNo=11328 But at least it showshow this stuff is expected to work. Yes, the basic-macro already hinted to that... :-( I personally think this doesn't make too much sense then. If you have to set up all yourself, then you can do (have to basically if you want the user to be able to choose only parts of the dataset) the additional step to iterate through the database as well and the mailmergelistener is pretty useless/not much of a shortcut then. (and indeed the cited sample doesn't use the mailmergelistener at all) I guess I'll just file an issue to have something like you need to create your own mail-merge to use the listener to the docs. Please do that, it happens that some framework designs from the thinking lab are conceptually nice and orthogonal but not well suited for practically using them. From having a quick look at the code at least the setup of a database connection is shown, too. Yes, but this still would require me to write code to ask the user for the requested database and to duplicate all the stuff the current mail-merge wizard has builtin. (I personally don't like the wizard at all, but I don't want to write one myself either) Okay, thinking about it two ideas come to my mind: 1. Hacking up^w Improving the wizard Honestly, I like the OOo 1.x way much better. No fancy wizard. Just drag the fields into your document where you want them, optionally add some conditions (that's where help from a wizard would come handy), then select the set of rows you want to have included and fire off the mailmerge. If I'm honest too, I must admit that I'm only rarely using 2.x and never did use the wizard myself. Isn't it possible to switch that thing off? I'll try mail merge on 2.x later on ... For me 1.1.[3|5] is still working well in most situations. ;) Choose whether print/save and maybe offer a way to see a preview. That is my view of a useful wizard. Sounds good, the preview widget is already in the code somewhere. On the other hand: you might have choosen the wrong task for beginners level. Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Registering an XMailMergeListener - possible at all?
Moin Christian, Am Freitag, den 02.03.2007, 16:09 +0100 schrieb Christian Lohmaier: Hi Marc, *, On Mon, Feb 19, 2007 at 06:32:12PM +0100, Marc Santhoff wrote: Am Montag, den 19.02.2007, 15:43 +0100 schrieb Christian Lohmaier: [mailmerge-listener] If I cannot use the builtin wizard, but have to ask the user for the desired Database, etc myself and have to start the mailmerge from within my extension, then this would be far too much effort and thus pretty useless to me. You could search the archives of this list for: From [EMAIL PROTECTED] Mon Sep 27 14:43:34 2004 Subject: Re: [api-dev] mailmerge api usage Message-id: [EMAIL PROTECTED] There you can find a complete working example of doing MailMerge written in Java. If it is not on the list please tell me, I'll forward it to you. I think I found the mail you're refering to, but unforutnately it doesn't use the wizard-functionality, but instead requests the database/table to use in the merge as arguments. http://api.openoffice.org/servlets/ReadMsg?listName=devmsgNo=11328 But at least it showshow this stuff is expected to work. From having a quick look at the code at least the setup of a database connection is shown, too. Yes, but this still would require me to write code to ask the user for the requested database and to duplicate all the stuff the current mail-merge wizard has builtin. (I personally don't like the wizard at all, but I don't want to write one myself either) Okay, thinking about it two ideas come to my mind: 1. Hacking up^w Improving the wizard The sources should be somewhere near the database wizard. That is found here: http://installation.openoffice.org/source/browse/installation/wizards It could be a nice feature to have ... although I don't know if there is something similar in other countries or if this would be german only. 2. Trying to use one of the event hooks at the document in process There is an event Serienbriefe drucken, or maybe Dokument drucken will fit your needs. I think you could hook to one of them and trigger your macro there. The only question left then is, whether the hook is called only once at the start of mail merging or for each document with the actual data merged in already. HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Registering an XMailMergeListener - possible at all?
Am Montag, den 19.02.2007, 15:43 +0100 schrieb Christian Lohmaier: Hi Noëlson, Marc, *, N'Abend, On Fri, Feb 16, 2007 at 04:54:13PM -0300, Noelson Duarte wrote: Does anybody have the solution or even a working sample at hand? I'd really appreciate it. You'll find a sample (OOoBasic) here: http://www.oooforum.org/forum/viewtopic.phtml?t=8393 oProps must be Variant, not object here, but apart form that this macro shows that it is possible to use a mailmergelistener. Perhaps it helps you. That snippet, along with Marcs answer helped somewhat: I know that the mailmerge listener is not suitable for my case. If I cannot use the builtin wizard, but have to ask the user for the desired Database, etc myself and have to start the mailmerge from within my extension, then this would be far too much effort and thus pretty useless to me. You could search the archives of this list for: From [EMAIL PROTECTED] Mon Sep 27 14:43:34 2004 Subject: Re: [api-dev] mailmerge api usage Message-id: [EMAIL PROTECTED] There you can find a complete working example of doing MailMerge written in Java. If it is not on the list please tell me, I'll forward it to you. From having a quick look at the code at least the setup of a database connection is shown, too. The solution for the problem of touching each document is made by using fields in a doc template, I think you can adopt this for inserting barcode pics instead of text snippets. From the surrounding explanations: --- This command will: - Open up a new Writer document - Create a new Data Source with the name provided - Configure the data source to load tables from the Data Source directory - Configure the data source to use , as the value separator - Insert each of the headings in the first row of the table specified as fields in the Writer document - Save the Writer document as a OpenOffice.org Writer template with the name provided ... % java MailMerger -merge URL of template file Data Source name Table name This will perform a MailMerge using the template file, data source and table names provided. These should be the same names that you used in the -create command /--- So it shows much more than doing MailMerge ... If there would be a way to still use the wizard however, then this could work... Mut the mailmerge-object requires a documentURL and other properties before it can be executed. (and the documentURL would require the user to save the document first, etc...), so I doubt that this is possible :-( So thank you very much for the pointer answers. You're welcome- Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Registering an XMailMergeListener - possible at all?
Am Freitag, den 16.02.2007, 18:41 +0100 schrieb Christian Lohmaier: Hi Marc, *, Hi Christian, Does anybody have the solution or even a working sample at hand? I'd really appreciate it. I did post another message quickly after the first one, because I saw that your solution could not work imo the way it is. That message never reached the list, so I quote it here again: Von: Marc Santhoff [EMAIL PROTECTED] An: dev@api.openoffice.org Betreff: Re: [api-dev] Registering an XMailMergeListener - possible at all? Datum: Wed, 14 Feb 2007 23:45:55 +0100 Hi, me again, from reading your code I think you're on the Holzweg, this implmentation cannot work. You create a mailmerge object instance, register the listener and forget about the mailmerger. Since for each mail merge task a new individual MailMerge-object is created, the listener has to attached to that one in use currently. It seems you need to: - create a MailMerge-instance - create your PostNet-Service - hand over the MailMerge from the first step to the PostNetImpl from the second step for registration (some method like XPostnetjava.registerTo(MailMerge myMerger) or the like - start the mail merge I hope I got this right ... Marc I hope this explanation helps, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Registering an XMailMergeListener - possible at all?
Am Mittwoch, den 14.02.2007, 20:32 +0100 schrieb Christian Lohmaier: On Wed, Feb 14, 2007 at 07:14:37PM +0100, Steffen Grund wrote: thank you for having a look! perhaps I am getting this wrong, because you shortened your code to post it here, but: you add a listener to a MailMerge object and then throw the object away? Hmm - I don't mean to throw it away. I'm a novice, and I don't see where I throw it away. If you say it is thrown away, then this is very likely my problem, although with a terminate listener that way works. From your other mail: // org.openoffice.cloph.postnet.XPostnetjava: public void addMMEListener() { MailmergeEventListener MMListener = new MailmergeEventListener(); XMultiComponentFactory xMCF = m_xContext.getServiceManager(); Object mailMerge = null; ^ here you define an object only visible in this method try { mailMerge = xMCF.createInstanceWithContext( com.sun.star.text.MailMerge, m_xContext); } catch (Exception e) { e.printStackTrace(); } now the empty object reference has a value XMailMergeBroadcaster xMMB = null; xMMB = (XMailMergeBroadcaster) UnoRuntime.queryInterface( XMailMergeBroadcaster.class, mailMerge); here the value get's used xMMB.addMailMergeEventListener(MMListener); System.out.println(added listener); } ... and if this exit point is reached the object is lost because there is no further reference to it. I don't know if the object is really needed, but if you want to store it you have to hold a reference in a variable, otherwise the java garbage collector will dispose it at it's next run. You could simply do: public final class PostNetJavaImpl extends WeakBase implements com.sun.star.lang.XServiceInfo, org.openoffice.cloph.postnet.XPostnetjava { private final XComponentContext m_xContext; private static final String m_implementationName = PostNetJavaImpl.class.getName(); private static final String[] m_serviceNames = { org.openoffice.cloph.postnet.Postnetjava }; -- private static final(?) Object mailMerge = null; and only assign the retrieved object in the method addMMEListener() to it. This way the object stays alive until it's getting disposed manually or by disposing the surrounding PostNetJavaImpl object. That's the way java works. C++ is similar. It's one reason for inventing reference counting on object instances. HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] How to copy all Content of a document
Am Donnerstag, den 30.11.2006, 10:58 +0100 schrieb Tobias Krais: Hi Matthias, [...] stardesktop.loadcomponentfromurl(private:factory/swriter,_blank,0,noargs()) doc.currentController.insertTransferable(obj) This API is kind of an internal clipboard. Currently it only works in Writer. this is a very interesting solution. I wont use it, because I want to insert in a existing document. If you only want to insert the complete second doc at a given location (not mixing in), you can use ::com::sun::star::uno::XDocumentInsertable for this task. Get a text cursor at the target doc, position the cursor and call insertDocumentFromURL() on it. According to the dev guide you only need to pass an url and an empty prop set. HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] [SOLVED] How to copy all Content of a document
Am Donnerstag, den 30.11.2006, 17:31 +0100 schrieb Tobias Krais: Hi Marc, If you only want to insert the complete second doc at a given location (not mixing in), you can use ::com::sun::star::uno::XDocumentInsertable for this task. Get a text cursor at the target doc, position the cursor and call insertDocumentFromURL() on it. According to the dev guide you only need to pass an url and an empty prop set. This was a very good hint! Thank you. Here is a sample code: -%- /** * Inserts a document a the cursors point. * @param unoDocumentURL File name that is UNO URL conform * [EMAIL PROTECTED] de.twc.oocom.oo.OODocument#createUNOFileURL(String)} */ public void insertDocument(String unoDocumentURL) { XText xText = this.xTextDocument.getText(); // create a text cursor from the cells XText interface XTextCursor xTextCursor = xText.createTextCursor(); XDocumentInsertable xDocInsert = (XDocumentInsertable) UnoRuntime.queryInterface(XDocumentInsertable.class, xTextCursor); try { xDocInsert.insertDocumentFromURL(unoDocumentURL, null); } catch (Exception e) { } } -%- Thanks for 'snippetizing' it. I fear this interface is available on Writer docs only. Okay, for Calc or Draw there would be the need to split up in Sheets or Pages, but nonetheless it would be nice to have ... Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] XDispatchHelper / XModel in XEnumeration
Am Freitag, den 17.11.2006, 11:47 +0100 schrieb Stephan Wunderlich: Hi Joan, Thanks Stephan, that was really helpful! you are very welcome. The problem is that I don't really get (maybe because of my English) what is every class... What's a model, a controller, a component, a frame, etc it is not that easy to understand methinks :-) From http://api.openoffice.org/docs/DevelopersGuide/OfficeDev/ OfficeDev.xhtml ... The Frame-Controller-Model (FCM) paradigm in OpenOffice.org separates three application areas: document object (model), screen interaction with the model (controller) and controller-window linkage (frame). - The model holds the document data and has methods to change these data without using a controller object. Text, drawings, and spreadsheet cells are accessed directly at the model. - The controller has knowledge about the current view status of the document and manipulates the screen presentation of the document, but not the document data. It observes changes made to the model, and can be duplicated to have multiple controllers for the same model. - The frame contains the controller for a model and knows the windows that are used with it, but does not have window functionality. The purpose of FCM is to have three exchangeable parts that are used with an exchangeable window system. Hope that clarifies things a bit. FWIW: Wouldn't this explanation fit perfectly into some sort of UNO beginners documentation? It is short, clear and understandable. MAybe the intro chapter of the dev guide has some space to hold it? Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] printing current sheet
Am Dienstag, den 14.11.2006, 18:35 +0100 schrieb Oliver Brinzing: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Marc, You can't, OO.o does not allow to do so. This should be worth an RFE (if not already written). would be nice if someone will vote for my rfe ... :-) http://qa.openoffice.org/issues/show_bug.cgi?id=10658 Done, thanks for pointing out. There could be some more votes though ... Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] printing current sheet
Am Montag, den 13.11.2006, 17:48 +0100 schrieb Mathias Röllig: So the question is: how can i figure out, which print page number has the actual sheet? Or, how can i figure out, on which print page(s) will a special print area reside? You can't, OO.o does not allow to do so. This should be worth an RFE (if not already written). As a workaround you can: - try to use the print preview (not tested, would be an interesting solution) - use the PrintAreas of the calc doc: - store old print areas - Sheet.getPrintAreas() - set a new one for the used range of the sheet you want to print, maybe adapt scaling to 100% - print - restore old print areas Have fun, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] How to apply Paragraph Style to XTextDocument?
Am Mittwoch, den 08.11.2006, 11:23 -0800 schrieb aloizio: I need to change via OO API the following parameters LineSpacing ParaFirstLineIndent ParaVertAlignment Maybe you like to use the available documentation ressources: http://codesnippets.services.openoffice.org/Writer/ http://development.openoffice.org/ http://api.openoffice.org/docs/common/ref/com/sun/star/module-ix.html http://api.openoffice.org/DevelopersGuide/DevelopersGuide.html HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] how to copy textsection from a writer document to another ?
Am Dienstag, den 07.11.2006, 18:40 +0100 schrieb Oliver Brinzing: thanks for the code snippet, i can use it as a workaround: - - first copy paste the section - - second copy the properties of the paragraph styles but what i am really looking for is to store a textsection as url, or serialize it ... any hints ? As a dirty trick you can temporarily define the source snippet as autotext for inserting it into the target and delete the autotext immediately afterwards. This does work. In general I have missed services/interfaces for passing around arbitrary snippets consisting of more than one paragraph including all formatting, too. Tha basic implementation can be found in the autotext source codes, if an implementation of XClonable could hook them up, it should be nearly done. HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Re: installing ooSetupConnectionURL through UNO package
Am Mittwoch, den 01.11.2006, 14:29 +0100 schrieb Knut Olav Bøhmer: On 11/1/06, Tabish F. Mufti [EMAIL PROTECTED] wrote: Just few days back Tobias on the mailing list referred me to the following link for package installation. You might wanna look at it as well. It helped me like anything. http://kingyo.tutms.tut.ac.jp/~toshi/StarSuite/Chap4/http://kingyo.tutms.tut.ac.jp/%7Etoshi/StarSuite/Chap4/ I did not find anything that helped me there. Maybe there is something that I don't understand.. By the way what are you trying to do ? I'm trying to modify /share/registry/data/org/openoffice/Setup.xcu from a unopkg. If you don't mind translating some BASIC to the language of your choice (and fiddle the node path into shape ;), here is an example: sub testConfig Dim aNodePath(0) as new com.sun.star.beans.PropertyValue Globalscope.BasicLibraries.Loadlibrary(Tools) oConfigProvider = createUnoService(com.sun.star.configuration.ConfigurationProvider) aNodePath(0).Name = nodepath aNodePath(0).Value = org.openoffice.Office.Calc/Layout'/Line Cnf_zweig = oConfigProvider.createInstanceWithArguments(com.sun.star.configuration.ConfigurationUpdateAccess, aNodePath()) Wert = Cnf_zweig.getByName(Line) ShowPropertyValues(Wert) Wert.GridLine = FALSE Cnf_zweig.commitChanges end sub - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Re: Button on ooimpress slide
Am Mittwoch, den 01.11.2006, 19:48 +0500 schrieb Tabish F. Mufti: Can anyone mention to me the Object/Class name which I should look into for placing a button on ooimpress slide ? On 10/29/06, Tabish F. Mufti [EMAIL PROTECTED] wrote: Hi, I've a code which create my own customized slide in ooimpress. What I want is that a button be placed on every slide and I need to handle the click event of the button. On every click of the button I need to call my own function. I don't know much about Impress, but generally speaking you: - make a shape - place the button in it (see Developers Guide - Forms - Programmatic Creation of Controls for those two) - get the DrawPage of your Slide - put the Shape-and-Button on (or in viewn as container) the drawpage - connect a handler to the OnClick event of the button, this is an XActionListener-Interface to be implemented ont the actionPerfirmed event (should be shown in the Developers Guide, too) HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] controlling the anchor of a commandbutton in writer using script
Am Mittwoch, den 18.10.2006, 09:12 +0200 schrieb Christian Andersson: Marc Santhoff wrote: Am Freitag, den 13.10.2006, 15:58 +0200 schrieb Christian Andersson: Hi there, I'm dynamicly inserting commandbuttons into a writerdocument, this is all working fine, but I have a huge problem controlling where they are located. from what I can see I can set the x and y position of the button, but I want to insert the button depending on text that I have inserted using the same macro with the anchor as character my pseudocode should do the following 1: get a textcursor 2: goto bookmark 3: insert new section 4: fill section with text 5: at the end of the text in the section insert an button that calls a macro when pressing it. sofar 1-4 is working great, but I have a huge problem with 5. I can insert the button, but I have no knowledge on how to move it to the end of the section do anyone in here have any knowledge on how to do this? Have you tried getting a cursor from the text section (not the main cursor from the surrounding document) and inserting the button using that one (after moving to or getting the .end())? The cursor I already got (I used it to insert the text in the section byt my problem is that I have not found a way to use this cursor to insert the commandbutton. from what I have learned about adding buttons, etc I cannot add buttons to the document but need to add it to a drawpage and when I do that, I always get them at the top left corner, unless I move them with an x/y coordinate. Yes, you're right. My own code works that way ... I think you have to define the anchor of the button(s shape) form page to paragraph. smth. like: code theButton.setPropertyValue(AnchorType, _ com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH) /code If that does not do it: How about making an additional section directly after the new one for inserting the button there or maybe putting the button into a frame in the section? Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] controlling the anchor of a commandbutton in writer using script
Am Mittwoch, den 18.10.2006, 12:08 +0200 schrieb Christian Andersson: Marc Santhoff wrote: from what I have learned about adding buttons, etc I cannot add buttons to the document but need to add it to a drawpage and when I do that, I always get them at the top left corner, unless I move them with an x/y coordinate. Yes, you're right. My own code works that way ... I think you have to define the anchor of the button(s shape) form page to paragraph. smth. like: code theButton.setPropertyValue(AnchorType, _ com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH) /code yes, I have done that, but this just changes the anchortype, I have notr found a way to tell it which paragraph the anchor should connect to. :-( Wouldn't it be the paragraph where the cursor is you're working with? If not, can you try to use a ViewCursor instead of a TextCursor, does it make a difference? Some API programmer with writer knowledge could help here, I'm only an API user ... Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] controlling the anchor of a commandbutton in writer using script
Am Freitag, den 13.10.2006, 15:58 +0200 schrieb Christian Andersson: Hi there, I'm dynamicly inserting commandbuttons into a writerdocument, this is all working fine, but I have a huge problem controlling where they are located. from what I can see I can set the x and y position of the button, but I want to insert the button depending on text that I have inserted using the same macro with the anchor as character my pseudocode should do the following 1: get a textcursor 2: goto bookmark 3: insert new section 4: fill section with text 5: at the end of the text in the section insert an button that calls a macro when pressing it. sofar 1-4 is working great, but I have a huge problem with 5. I can insert the button, but I have no knowledge on how to move it to the end of the section do anyone in here have any knowledge on how to do this? Have you tried getting a cursor from the text section (not the main cursor from the surrounding document) and inserting the button using that one (after moving to or getting the .end())? HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] throw exception from OOo Basic
Am Freitag, den 29.09.2006, 13:10 +0200 schrieb Knut Olav Bøhmer: Hi, How can I throw an exception from openoffice.org Basic? You can't. I'm trying to prevent a mailmerge document from closing with a CloseVetoException. So far I have this code. But this should be possible. Have a look at http://api.openoffice.org/docs/common/ref/com/sun/star/embed/InstanceLocker.html and an old message on this list with the subject Re: [api-dev] switching components in one frame from Mathias Bauer with the message-id [EMAIL PROTECTED] There you'll find the necessary information. I don't know since when this service is built into OO.o, but 2.0.3 or .4 should have it. HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] [EMAIL PROTECTED] TOPIC: Contributing
Am Samstag, den 28.08.2004, 14:07 +1200 schrieb Ian Laurenson: On Fri, 2004-08-27 at 16:27, Michael Hoennig wrote: [snip] *** Reviewing the documentation and report issues if you find any [snip] And when you find anything to improve which you think should actually be improved, report an issue to IssueZilla. I am quite keen to start systematically creating examples of use for each OOo object in OOo BASIC. I know that I am not alone in this desire. See: http://www.oooforum.org/forum/viewtopic.php?t=9120 I don't think that posting these, either an example at a time, or posting several examples together, to IssueZilla would make for a good collaborative effort. I am bouncing the idea of using oooauthors: http://www.oooauthors.org What do other people think? FWIW, why don't you start filling up http://codesnippets.services.openoffice.org/ with sorted and grouped examples? If there is enough stuff listed it can be integrated into the DevGuide or the IDL reference later on. And it is usable from the first moment something new is added. I personally think the IDL reference is *the* spot for having examples regarding single objects (services, interfaces). But since it is generated automatically there must be some linking technique to bring external (in sense of not written into the source code) examples in by linking or the like. Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Error on closing eventlistner 'Cannot coerce argument type during corereflection'
Am Mittwoch, den 27.09.2006, 23:56 +0200 schrieb Cor Nouws: Sub AddListners Dim oCell Const sCellName as String = A1 oCell = ThisComponent.Sheets.getByIndex(0).getCellRangeByName(sCellName) oListner0 = CreateUnoListener( A10_, com.sun.star.chart.XChartDataChangeEventListener ) oCell.addChartDataChangeEventListener(oListner0) ' do the same for sheet(1) and (2) End Sub Sub RemoveListener Dim oCell ' removes the listener oCell = ThisComponent.Sheets.getByIndex(0).getCellByPosition(0, 0) oCell.removeModifyListener(oListner0) ** ' Gives Cannot coerce argument type during corereflection call From my experience this error message generally wants to tell you that typecasting is impossible in this situation. Since you added a ChartDataChangeEventListener I think removing must be done with exactly the same type: oCell.removeChartDataChangeEventListener(oListner0) should do. ' do the same for other listners End Sub HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Multiple cells in macros
Am Montag, den 05.06.2006, 10:36 +0200 schrieb Moisés Márquez Gil: Gerrit Jasper wrote: That's funny. When I record a macro and save it, and then run it, it does everything it was told to do. But I would describe my actions differently. What I do is: Tools-Macro-RecordMacro | Select cells | - | Do something | - | Stop Recording | - | Save macro These are the actions I did too. Exactly ... - Create a new sheet - Write date (3x3 matrix) - Tools-Macro-RecordMacro - Go to A1 - Press Ctrl - Select A1 - A3 - A5 - Press Supr - Stop Recording - Save macro - Execute macro This macro only supress the cell where I've the focus. It cannot supress the cells A1 - A3 - A5 like I want. Some actions are not tracked by the recorder. For your special task you may have more luck if you do it this way: - select the start of your range by mouse (A1) - hold the SHIFT key and navigate to the last cell of your range (A5) by keyboard How to select non consecutive cells by keyboard you have to investigate yourself, I simply don't know. ;) Have fun, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] switching components in one frame
Am Donnerstag, den 25.05.2006, 23:17 +0200 schrieb Mathias Bauer: Marc Santhoff wrote: Hi, I'm asking myself if it is possible to start implementing the following scenario: A doc is opened in a frame (and window). On a command of the user the component attached to the frame is stored elsewhere to keep the reference and a second document (component) is loaded into that frame. After a task is done by the user the second component get's saved and destroyed and the first component is attached to the frame again. The goal is to reuse the window presented to the user with variing contents. Will this work or am I asking for trouble regarding attached listeners, dispatch or whatelse? A component inside a frame comprises a controller and a model. You can not keep the controller without the frame, but you can keep the model and you can use this model later on to recreate a controller including a view from it without reloading the document. Yes, that's what I wanted to ask for (not fully tuned to thinking UNO atm ;). To preserve the model from being closed when its last controller gets destroyed you must register as a close listener at it and deny its request for becoming closed. Okay. The recreation of the view is a little bit tricky because the necessary API currently does not exist (it's in the making though). As far as it works, it's okay with me. :) Do you know an issue number for watching progress on this topic? We ourselves use the following replacement: use the loadComponentFromURL() method of the desired frame, but pass a parameter Model in the MediaDescriptor that contains a reference to the model. This will advise the frame loader to use the existing model and not creating and loading a new one. You must provide the valid URL of the document though (or the stream it was loaded from) to pass the type detection and to avoid confusion in the documents' internal media descriptor. I'll try that, I remeber seeing this solution in another thread recently. Thank you very much, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] switching components in one frame
Am Freitag, den 26.05.2006, 17:51 +0200 schrieb Mathias Bauer: Marc Santhoff wrote: The recreation of the view is a little bit tricky because the necessary API currently does not exist (it's in the making though). As far as it works, it's okay with me. :) Do you know an issue number for watching progress on this topic? No, but it will be announced in interface.announce once it's done. We wanted to introduce the new API together with adding the new UNO features to our models (multiple inheritance interfaces, new style service with constructors) but it turned out to be more work than expected. I'm looking forward to that. But the next question is already here: Is there any way to prevent closing from BASIC? The XCloseListener is expected to throw an exception which is not possible from BASIC, afaik. Regards, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] switching components in one frame
Hi, I'm asking myself if it is possible to start implementing the following scenario: A doc is opened in a frame (and window). On a command of the user the component attached to the frame is stored elsewhere to keep the reference and a second document (component) is loaded into that frame. After a task is done by the user the second component get's saved and destroyed and the first component is attached to the frame again. The goal is to reuse the window presented to the user with variing contents. Will this work or am I asking for trouble regarding attached listeners, dispatch or whatelse? TIA, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Determining the version number of installed OOo
Am Sonntag, den 23.04.2006, 11:52 -0400 schrieb Hal Vaughan: On Sunday 23 April 2006 06:34, Bernard Marcelly wrote: Bonjour Hal Vaughan I have recently filed an issue on this problem http://www.openoffice.org/issues/show_bug.cgi?id=64345 IMHO it is a defect that it is now impossible to know the exact version number, since there are new functionalities, corrections of bugs, and new bugs at each minor version. Bernard I noticed someone says this is intentional. Are they of the thought that as long as the version number specified stays the same, everything is supposed to be compatible? Has someone had a look at the Windows equivalent of Unix' ~/.sversionrc? I think it's in the registry or user file space ... (no installation of 2.x on *nix available here, for 1.x it has all nubers). Does that have the complete 2.x.x version number? HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Re: [dev] Integrating external program with OOo on Windows - request for assistance!
Hi Anders, since noone else does I'll try to help a little. Am Dienstag, den 18.04.2006, 09:36 +0200 schrieb Anders Johansen: I spent about two man-months trying to puzzle out how to interface with OOo from Delphi or BCB. Conclusion: If it works, the documentations is out of date, and nobody who is talking knows how. I'm not stupid, I'm not inexperienced, and I have figured this stuff out for several other products before, but OOo for some reason was just impenetrable. You can only use Delphi to control OO.o if there were a compiler bridge. See http://udk.openoffice.org for more info on what this thingy is (sort of abstraction layer and parameter mangling device). I only know it does take a hardcore programmer to write such a bridge. Until then ... COM/OLE support was at least back then obscure and/ or broken, and badly documented, and direct support for Delphi or BCB was the same, even more so. ... the only way to do so is using OLE automation (or what's is name this month ;). Have a look at the ressources pointed to from http://development.openoffice.org for Delphi, there are examples and AFAIR a complete wrapper or set of Delphi components written by a french guy. That one looked somewhat sophisticated to me, I assume it does work. HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Unpacked - MediaDescriptor - Not Working?!
Am Montag, den 10.04.2006, 19:10 -0700 schrieb Kent Gibson: thanks for the pointers. I tried the basic code, and no unpacked directory was created. Maybe, I cannot test with 2.x atm. But on 1.1.3 this works perfectly well (copied from the basic-IDE): sub saveUnpacked fname = /home/marc/tmp/test doc = ThisComponent dim Args(2) as new com.sun.star.beans.PropertyValue args(1).Name = Overwrite args(1).Value = TRUE args(0).Name = Unpacked args(0).Value = TRUE doc.storeAsUrl(ConvertToUrl(fname), args()) end sub When called from a document it leaves me with a folder /home/marc/tmp/content.test containing all the stuff put into the zip otherwise. I am starting to think this is a bug. hmm. odd. If this is a bug please file an issue. Maybe later the day I can get my hands on an installation of 2.x... regards, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Unpacked - MediaDescriptor - Not Working?!
Am Dienstag, den 11.04.2006, 15:21 +0200 schrieb Marc Santhoff: Maybe, I cannot test with 2.x atm. But on 1.1.3 this works perfectly well (copied from the basic-IDE): sub saveUnpacked fname = /home/marc/tmp/test doc = ThisComponent dim Args(2) as new com.sun.star.beans.PropertyValue args(1).Name = Overwrite args(1).Value = TRUE args(0).Name = Unpacked args(0).Value = TRUE doc.storeAsUrl(ConvertToUrl(fname), args()) end sub When called from a document it leaves me with a folder /home/marc/tmp/content.test containing all the stuff put into the zip otherwise. After testing a 2.0Beta1 (or beta 2, don't know exactly) with only the filename changed I can confirm the macro does *not* write out data. It does something but no error is occurs. Please file an issue, if this holds true for the current version of OO.o (2.0.2?). Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Finding the complete OOo version with API ?
Am Montag, den 10.04.2006, 13:31 +0200 schrieb Bernard Marcelly: Hi all, Successives minor versions of 2.0 are not only correcting bugs, they also introduce features. With API you can read ooSetupVersion from /share/registry/data/org/openoffice/Setup.xcu The problem is it returns 2.0 for any minor version, i.e. you cannot distinguish 2.0.0 from 2.0.1 or 2.0.2. My question is : can the API provide the exact version of OpenOffice ? or will it be available in ooSetupVersion with the next versions, e.g. 2.0.3 ? Seems to be a bug to me, with 1.x.x it did report the complete version number. HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Unpacked - MediaDescriptor - Not Working?!
Am Montag, den 10.04.2006, 05:12 -0700 schrieb Kent Gibson: oops I sent the wrong code, but I reckon you mean that I should be using a reference to a directory not a file no? Check chapter 14 of the developers guide about the Universal Content Broker, the target UCP has to support folders. A stream does not. The data from the document is sent out as multiple streams, as I had to learn, too. I think your goal of writing a document to a stream is reachable by creating your own export filter component, which has to take care of concatenating the streams or the like. You can check yourself: rename a OO.o-document to name.zip and open or list with your favourite packing tool. You'll see several files (=streams) located in several folders (not supported by streams). HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Unpacked - MediaDescriptor - Not Working?!
Am Montag, den 10.04.2006, 06:36 -0700 schrieb Kent Gibson: wow, so to write an unpacked format I will have to write an export and import filter, or use the UCP? Seems like overkill? You are already using UCB/P, storing a document makes use of a com.sun.star.ucb.FileContentProvider as I understand it. Did you do something similiar with UCP? I looked at the demo code and it seems to like file urls, and my document is in memory, so I wonder if the UCP will work for me. I wonder why the Unpacked parameters is there. Because it works with most precanned UCPs (file, WebDAV, ftp, hirarchy, zip/jar). ;) Thanks for the help. If you have some snippets doing something similiar to what I want that would be grand. No, I haven't. Sorry. The truth is that I am just trying to squeeze some performance, and this might not even work. I am rendering a document which takes a minute and then 2 minutes to presumably compress (loads of redundant data). If you can stand losing macros embedded in documents there's a chance that making a flat xsl filter work. Most common stuff is this: ?xml version=1.0 encoding=ISO-8859-1? xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform; version=1.0 xsl:output method=xml encoding=UTF-8/ xsl:template match=/ xsl:copy-of select=/ / /xsl:template /xsl:stylesheet You can register it for writing and reading (Menu: Tools - XML Filter Settings) and then use save as to select it in the type combo box. At least for testing the performance advantage it may be helpful. Have you tried saving uncompressed to an ordinary file system? This would be easy, somthing like (BASIC, written from memory): snip fname = /where/you/like/yourdoc dim Args(2) as new com.sun.star.beans.PropertyValue ' not sure atm if it's necessary for standard format ... ' args(2).Name = FilterName ' args(2).Value = OpenOffice.org 1.0 Text Document args(1).Name = Overwrite args(1).Value = TRUE args(0).Name = Unpacked args(0).Value = TRUE doc.storeAsUrl(ConvertToUrl(fname), args()) ' or storeToUrl for making a copy like when exporting This will create a folder hirarchy like the one in the zip but uncompressed an unarchived. The last name component (yourdoc) is the base folder. HTH, Marc -- A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Document is loaded in a background window
Am Donnerstag, den 19.01.2006, 13:05 +0100 schrieb Felix E. Klee: Try out the following code. It loads the file /tmp/bar.sxw and afterwards displays a message box. The problem is that the file is loaded in a background window, at least on my system. I.e. the current window obscures the window with the new document. Sub Test1 Dim NoArgs() As New com.sun.star.beans.PropertyValue Dim Service As Object Service = createUnoService(com.sun.star.frame.Desktop) Dim Document As Object Document = Service.loadComponentFromURL(file:///tmp/bar.sxw, _ _blank, 0, NoArgs()) MsgBox foo End Sub To get rid of the problem I found two solutions, but neither is satisfactory: * Don't display the message box * Close the window in front by using setVisible: StarDesktop.CurrentFrame().getContainerWindow().setVisible(False) So, what do you suggest? How do I make the window with the new document appear in the foreground? Or, alternatively, how do I lower the current window? I see two possibilities: you can modify the MediaDesrciptor used on loading a new doc or the target frame could be _default instead of _blank. Check chapter 6.1.5 Handling Documents of the Developers Guide for more in depth information. HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Accessing global constant in other library?
Am Donnerstag, den 19.01.2006, 19:21 +0100 schrieb Felix E. Klee: Am Donnerstag, 19. Januar 2006 16:23 schrieb Felix E. Klee: How can I access global constants in another library? If constants in another library are inaccessible, how do I access a function in another library? Have you tried typing public inthe IDE and then hitting the F1 key? And you can search the help for LibraryContainer for the other answer. Have fun, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] registering script events
Am Dienstag, den 03.01.2006, 09:27 +0100 schrieb Frank Schönheit - Sun Microsystems Germany: Hi Marc, Hello Frank, The IDL reference tells me about css.script.registerScriptEvent: ... registers one event for an object identified by its index. If any object is attached under this index, then this event is attached automatically. ... I do not understand what object is in this context. Is it the main form (Standard) or is it the control aka. my button? it's your button. More precise, it's the index of the button within its containing form. So, oForm.registerScriptEvent(0, oEvents(0)) registers events for the first child (because of the first 0) of oForm - which may or may not be your button. Ah, I see. That seems to be no problem, because in this case I'm building a document with some buttons in it programmatically. Since I can control the naming of the buttons I think it will be possible to get the index somehow. Normally, you'd expect some getIndexInParent (or so) method at your objects (buttons), but there is none (IIRC, there is some RFE requesting this). So, the algorithm would normally be (pidgin-Basic only) Function getIndexInParent( oContainer, oObject ) For ( i = 0 to oContainer.getCount() ) If ( oContainer.getByIndex( i ) = oObject ) Then getIndexInParent = i Exit Function End If Next i getIndexInParent = -1 End Function However, I am not sure how to test equality of UNO objects in Basic, I'd suppose that = might not really work here. Perhaps there's a dedicated function for this. Up to now I helped myself registering ActionListeners at each button, but my search should have a more generic way. That way it works but needs some more code. Thank for help and a happy new year! Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] GlobalEventBroadcaster and StarBasic - continued ( ....catch a Base document being opened )
Am Dienstag, den 03.01.2006, 17:53 -0500 schrieb Andrew Jensen: OK, This is getting closer, but a couple of issues remain. I have my sub procedure that is called by the OnDocumentOpen broadcast event. Using the suggested technique of reading the last frame's title from the ActiveDesktop frames container does indeed work. I'm curious, how did you register the connection? Did you use the dialog and assigned the macro or did you do it out of a program? If maually: there is a difference bewteen having the event connected on document or application level... However, as I put up before, the problem is that the procedure is called twice. I am trying to find some way to ignore the first call and act upon the second call. So far I have tried two things. Using a static variable in the procedure, and using a global variable in the library. 3 actually as just moving the variable out of the procedure did not work. Here is the procedure now. const cBaseTitle = - OpenOffice.org Base 'dim isInOnOpenAgain as boolean global isInOnOpenAgain as boolean sub onOpenDocumentMain dim df as variant dim DBName as string dim HideDBFrame as boolean 'static isInOnOpenAgain as boolean df = Stardesktop.Frames If RIGHT((df(df.count-1).title), LEN(cBaseTitle)) = cBaseTitle Then if isInOnOpenAgain then dbName = LEFT((df(df.count-1).title), LEN(df(df.count-1).title) - LEN(cBaseTitle)) isInOnOpenAgain = False HideDBFrame = OpenDefaultForm( dbName ) 'if HideDBFrame make it hidden somehow else isInOnOpenAgain = True endif End if end sub So - here is the problem and an oddity. If I have this library open in the Basic editor when a base form is opened it works as expected. The call to OpenDefaultForm happens just once. If it is not open in the editor it fails and calls the function twice. Any ideas on how to make the test variable isInOnOpenAgain act like a static variable? That looks like a bug in OO.o 1.0.x where macros called from the commandline when starting the office where invoked twice. Should be fixed somewhere in the step to 1.1, but using a global boolean outside any sub did fix it for me. global hasrun as boolean sub importCSVfromCommandline(file as string) dim typ as string typ = left(FileNameoutofPath(file),2) msgbox file + : + typ importCSV(file, typ) end sub sub importCSV(file as string, typ as string) if hasrun = FALSE then hasrun =TRUE else exit sub end if ... This way it *did* work. The oddity. While testing this libraries routines I happened to use drag and frop to move an embedded form from one Base file to another. Guess what happens. The onOpenDocumentMain procedure is called AND with the library NOT in the editor it is called only once??? For those that are interested, the dbName variable is set to the target frame's Base name. Are you sure the library your macro lives in is loaded already when the event fires? The whole story sounds like this is a global space library, but if you need to use macros from let's say Tools you've got to load it before calling. But to be honest I don't know how to seperate the chicken and the egg here - how can OO.o be told to load a library at the start? Hope this helps somehow, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] loadComponentFromURL Worked in 1.1.x and Not in 2.x.x
Am Samstag, den 31.12.2005, 18:12 -0500 schrieb Hal Vaughan: I have a section of code that worked fine in 1.1.x and does not work in 2.x.x. I keep getting the error: com.sun.star.lang.IllegalArgumentException: URL seems to be an unsupported one. (I'd paste in code here, but it seems clear that this is a URL problem, and not something else.) I've been looking through the documentation. While there are examples of using loadComponentFromURL, it is almost impossible to find an example of an actual working URL to use as a parameter or how that URL is constructed from a filename. I tried using a Java URL, creating it from a filename, and getting the URL as a string, but I had to include java.net.URL and that seemed to conflict with other imports (I'm still trying to figure that part out). With 1.x, when I had a filename, to convert it to a URL, I used this routine: public String makeURL(String sFile) { if (sFile.startsWith(private:factory/s)) {return sFile;} if (!sFile.startsWith(/)) {sFile = / + sFile;} if (sysConfig.getMode(osname).toLowerCase().indexOf(windows) = 0) { sFile = sFile.replace('\\', '/'); } sFile = file: + sFile; return sFile; } It worked without any problems before, but now it isn't working. I changed the 3rd line so it would put // at the start of the line instead of / so it would change from file:/ to file:// just in case, but no difference. Seeing a few sample URLs would be a great help here. You can transform arbitrary file locations and the like to valid URLs like this: sub make Url msgbox ConvertToUrl(your url-like string) end sub If you run this BASIC macro you can make your own examples. ;) Happy new year, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Re: New Document from Template
Am Montag, den 26.12.2005, 19:20 -0600 schrieb Tam: Marc Santhoff wrote: Am Dienstag, den 27.12.2005, 00:21 +0100 schrieb Mathias Bauer: Could some kind soul please tell me what's wrong? The message says it all: the URL is unsupported, mainly because it isn't a URL at all. Don't use system file names, you have to provide a valid URL: file:///d:/OOo_Templates/Letterhead.odt should work for you. In Basic this can be done by using: ConvertToUrl(D:\OOo_Templates\Letterhead.odt) Have Fun, Marc Hi, Marc -- thank you but what do I do with that statement? Where does it go? I've tried before, after and instead of and comingled with g the oDesk.loadComponentFromUrl statement and none of that works. oDesk.loadComponentFromUrl(ConvertToUrl(D:\OOo_Templates \Letterhead.odt) ,_blank, 0, mProps() It returns a value representing a coorect URL made from a system dependant path. Have fun, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] New Document from Template
Am Dienstag, den 27.12.2005, 00:21 +0100 schrieb Mathias Bauer: Could some kind soul please tell me what's wrong? The message says it all: the URL is unsupported, mainly because it isn't a URL at all. Don't use system file names, you have to provide a valid URL: file:///d:/OOo_Templates/Letterhead.odt should work for you. In Basic this can be done by using: ConvertToUrl(D:\OOo_Templates\Letterhead.odt) Have Fun, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] registering script events
Hi, I'm trying to connect script routines to two buttons in a writer doc. I found http://codesnippets.services.openoffice.org/Office/Office.SettingEventMethods.snip The code looks like this: oView = oDocument.CurrentController oDrawPage = oView.getActiveSheet.DrawPage ' get the first form oForm = oDrawPage.getForms.getByIndex(0) oEvents(0).ListenerType = XActionListener oEvents(0).EventMethod = actionPerformed oEvents(0).AddListenerParam = oEvents(0).ScriptType = StarBasic oEvents(0).ScriptCode = document:Standard.Module1.Test oForm.registerScriptEvent(0, oEvents(0)) and it works for the first button. But how can the second button be connected? The IDL reference tells me about css.script.registerScriptEvent: ... registers one event for an object identified by its index. If any object is attached under this index, then this event is attached automatically. ... I do not understand what object is in this context. Is it the main form (Standard) or is it the control aka. my button? TIA, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] encoding flaw in dictionary entries
Am Mittwoch, den 30.11.2005, 09:57 +0100 schrieb Stephan Bergmann: Two things I noticed when trying to reproduce this: 1 You must be using a non-UTF-8 locale (probably 8859-1), check the environment variable LANG. Yes: $ echo $LANG de_DE.ISO8859-1 If you set LANG to something like de_DE.UTF-8 the problem should go away. I cannot do that, because I know of some system tools still having problems with utf8. The only option for me here would be to reset $LANG in the OOo startup script (I'll try that). Which does not help, the appearance of the garbled chars chagnes but they're still not correct. 2 If you modify the Basic script by adding tEnd = tmpDoc.Text.getEnd() tEnd.String = äöü end sub to the end, you see that Basic is not the culprit, as the umlauts show up correctly in the writer doc, regardless of LANG setting. I see. I suspect that the OOo dictionary implementation erroneously uses osl_getThreadTextEncoding() (which depends on LANG) to translate the (obviously UTF-8 encoded) strings within the dictionary data base to Unicode. Please update the issue (did you already write one?) accordingly. I'll write down the issue when fact are complete (and I find the time ;) and post the number here. Thank you very much, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] encoding flaw in dictionary entries
Hi again, the issue is filed, a workaround for *nix like OSs is found, now I have to care for Windwos... Is there any conversion method somewhere in the API that can be hijacked from SBASIC for converting the Dictionary entries to the right encoding? Any service will do, as long as it has something like String Utf8ToCurrentLocale(String) and String CurrentLocaleToUtf8(String) to use wehn transferring. TIA, Marc Am Mittwoch, den 30.11.2005, 09:57 +0100 schrieb Stephan Bergmann: Marc Santhoff wrote: Am Dienstag, den 29.11.2005, 09:56 +0100 schrieb Stephan Bergmann: [...] Two things I noticed when trying to reproduce this: 1 You must be using a non-UTF-8 locale (probably 8859-1), check the environment variable LANG. If you set LANG to something like de_DE.UTF-8 the problem should go away. 2 If you modify the Basic script by adding tEnd = tmpDoc.Text.getEnd() tEnd.String = äöü end sub to the end, you see that Basic is not the culprit, as the umlauts show up correctly in the writer doc, regardless of LANG setting. I suspect that the OOo dictionary implementation erroneously uses osl_getThreadTextEncoding() (which depends on LANG) to translate the (obviously UTF-8 encoded) strings within the dictionary data base to Unicode. Please update the issue (did you already write one?) accordingly. -Stephan - 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: [api-dev] encoding flaw in dictionary entries
Am Dienstag, den 29.11.2005, 09:56 +0100 schrieb Stephan Bergmann: Marc Santhoff wrote: Am Montag, den 28.11.2005, 10:29 +0100 schrieb Stephan Bergmann: Marc Santhoff wrote: Hi, I'm using dictionaries from basic code and noticed a problem. When the search word from a dictionary entry is inserted into a writer doc the encoding is not shown correctly. Try this in a german localized version: sub encError dls = createUnoService(com.sun.star.linguistic2.DictionaryList) dic = dls.getDictionaryByName(soffice.dic) entries = dic.getEntries() msgbox entries(16).getDictionaryWord() end sub In a german language version of OO.o 1.1.x this should read Bemaßungslinien but the char ß is not converted correctly. This holds true for the german OO.o2.0-RC1/Windows, too. Is this worth filing an issue or is it a pilots error? It sure sounds like an error (so please file an issue): XDictionaryEntry.getDictionaryWord returns a UNO string, which is Unicode, so no excuse to garble an ß (and Basic's msgbox command should also be fully Unicode...). Thank for replying. I only thought I was missing some conversion function or the like because all umlauts are garbled too. They are shown as two chars in a writer doc. And from the GUI anything works as expected ... You mean, adding text to a writer doc via some Basic code (where the text to be added is represented as a literal Basic string) leads to garbled characters? That's strange. Maybe Andreas Bregas knows whether there is some part of Basic or the Basic IDE that works with locale-dependent text encodings instead of Unicode? Yes, that's what I wanted to say. Another Test fpor the german localized OO.o: sub encError2 BasicLibraries.LoadLibrary(Tools) dls = createUnoService(com.sun.star.linguistic2.DictionaryList) dic = dls.getDictionaryByName(soffice.dic) entries = dic.getEntries() tmpDoc = CreateNewDocument(swriter) csr = tmpDoc.Text.createTextCursor() tmpDoc.Text.string = entries(16).getDictionaryWord() ' ß tEnd = tmpDoc.Text.getEnd() tEnd.String = entries(46).getDictionaryWord() ' ö end sub This does garble the special chars, too. Regards, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] encoding flaw in dictionary entries
Am Montag, den 28.11.2005, 10:29 +0100 schrieb Stephan Bergmann: Marc Santhoff wrote: Hi, I'm using dictionaries from basic code and noticed a problem. When the search word from a dictionary entry is inserted into a writer doc the encoding is not shown correctly. Try this in a german localized version: sub encError dls = createUnoService(com.sun.star.linguistic2.DictionaryList) dic = dls.getDictionaryByName(soffice.dic) entries = dic.getEntries() msgbox entries(16).getDictionaryWord() end sub In a german language version of OO.o 1.1.x this should read Bemaßungslinien but the char ß is not converted correctly. This holds true for the german OO.o2.0-RC1/Windows, too. Is this worth filing an issue or is it a pilots error? It sure sounds like an error (so please file an issue): XDictionaryEntry.getDictionaryWord returns a UNO string, which is Unicode, so no excuse to garble an ß (and Basic's msgbox command should also be fully Unicode...). Thank for replying. I only thought I was missing some conversion function or the like because all umlauts are garbled too. They are shown as two chars in a writer doc. And from the GUI anything works as expected ... I will file an issue anyways. Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] dictionary entries limit
Hi, since the interface css.linguistic2.XDictionary(1) has a method IsFull() I'd like to know: When is a dictionary full? Is it a limit on number of items or on bytes total or what else? TIA, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] encoding flaw in dictionary entries
Hi, I'm using dictionaries from basic code and noticed a problem. When the search word from a dictionary entry is inserted into a writer doc the encoding is not shown correctly. Try this in a german localized version: sub encError dls = createUnoService(com.sun.star.linguistic2.DictionaryList) dic = dls.getDictionaryByName(soffice.dic) entries = dic.getEntries() msgbox entries(16).getDictionaryWord() end sub In a german language version of OO.o 1.1.x this should read Bemaßungslinien but the char ß is not converted correctly. This holds true for the german OO.o2.0-RC1/Windows, too. Is this worth filing an issue or is it a pilots error? TIA, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Info about Mail modules
Am Samstag, den 12.11.2005, 08:46 +0100 schrieb Mathias Bauer: Alexandro Colorado wrote: [...] XSmtpService(http://api.openoffice.org/docs/common/ref/com/sun/star/mail/XSmtpService.html) Represents a SMTP service abstraction. At least for the Send document as mail we don't use this API. I don't know about the emailmerging. Look for mail merging there: http://api.openoffice.org/docs/common/ref/com/sun/star/text/MailMerge.html There should be a snippet (at least in Java) there: http://codesnippets.services.openoffice.org/ Ah, yes, a massive one: http://codesnippets.services.openoffice.org/Writer/Writer.MailMerge.snip HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] window position of components container window
Am Montag, den 24.10.2005, 12:34 +0200 schrieb Mathias Bauer: Marc Santhoff wrote: Hi, Hello Mathias, I'm trying to retrieve the current position of a component by querying it's container windows position: snip cw = frms(i).ContainerWindow msgbox cw.PosSize.X cw.PosSize.Y /snip If this is done on Windows it returns the correct values. If the same runs on FreeBSD (should be the same for Linux?) the position is always 0,0. Can you test it on Linux? I'll for search someone to test, a doc with macro is prepared ... Anyway you can create an issue for the gsl team. This seems to be a bug only in the 1.x line, tested with 1.1.5de on Win98 1.1.0de on Win2000 1.1.3de on FreeBSD. 2.0.0RC1de on WIn98 gives thecorrect position values (Linux/FreeBSD outstanding). Would it make sense to file an issue for 1.1? Thank you, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] window position of components container window
Me again, some other testers confirm: OOo 2.0 / Linuxgives correct position values OOo 1.1.5 / linux give 0,0 at any window position Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] window position of components container window
Hi, I'm trying to retrieve the current position of a component by querying it's container windows position: snip cw = frms(i).ContainerWindow msgbox cw.PosSize.X cw.PosSize.Y /snip If this is done on Windows it returns the correct values. If the same runs on FreeBSD (should be the same for Linux?) the position is always 0,0. How can I get the correct values for any supported platform? If this is not possible, maybe there is a way to get the X-Id of the window for parsing the output of xwininfo? TIA, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] improving macro for merge mail
Am Freitag, den 07.10.2005, 12:24 +0200 schrieb Ippoliti Giuliano: My question is: is there a method like AppendToUrl (the name is just an example), to append a loaded document into another one, called for instance Fusion.sxw ? I would save a lot of processing time in this way. You could insert a page break at the end and then use insertDocumentFromURL() to push all generated documents in one collecting document. But the computer doing so should have enough memory, I think. HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] OOo C++ FAQ ?
Am Dienstag, den 20.09.2005, 14:07 +0200 schrieb Galmes Pierre-Andre: As a feedback from my experience, the documentation about OOo programming is quite difficult to find. Seems to be the case because ... For example, as a rookie in OOo Cpp programming, I would have enjoyed a page about all the cpp stuff I would have need to learn and a kind of schedule telling me : Ok, to start programming, firslty read this, then that, and finally this and then you should be ready. And then, a faq which would keep track of the common problems. Actually, at the moment, the documentation for cpp programming is spread in many different places, for example : http://udk.openoffice.org/ http://api.openoffice.org/ http://codesnippets.services.openoffice.org/ http://tools.openoffice.org/CodingGuidelines.sxw ... ... you did not find the best location: http://development.openoffice.org I think it would be much more easy if only one repository was holding all the interresting info ! I was hoping to find such a place, but it does not seems it exists at the moment. Would it be a good idea to try to gather all the developpers doc ? Isn't that what you're looking for? If so, it has to be made more visible. Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] UNO packages and events
Am Donnerstag, den 08.09.2005, 16:52 +1200 schrieb Ian Laurenson: I have two macros that it would be useful to assign to the application events: Open Document and Create Document. While it is possible to do this via Customize Events a lot of end users have difficulty in setting this up so I would like to be able to automate this process for them. Is it possible to modify: .openoffice.org2/user/registry/data/org/openoffice/Office/Events.xcu by the .xcu file in a uno package? If so some pointers would be useful. And is it possible by a BASIC macro? Again some pointers would be useful. If I can get this sorted out I would like to writeup the instructions in the wiki: http://ext.openoffice.org.nz and possibly update Bernard Marcelly's excellent Addons1_1en.sxw. Have you had a look at the code snippets? http://codesnippets.services.openoffice.org/ HTH, Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] UNO packages and events
Am Freitag, den 09.09.2005, 10:35 +1200 schrieb Ian Laurenson: On Thu, 2005-09-08 at 15:27 +0200, Marc Santhoff wrote: Am Donnerstag, den 08.09.2005, 16:52 +1200 schrieb Ian Laurenson: [...] And is it possible by a BASIC macro? Again some pointers would be useful. If I can get this sorted out I would like to writeup the instructions in the wiki: http://ext.openoffice.org.nz and possibly update Bernard Marcelly's excellent Addons1_1en.sxw. Have you had a look at the code snippets? http://codesnippets.services.openoffice.org/ Thanks for this but the closest code snippet is about setting dynamic events which is not what I want. Hm, I only knew there was something like that. Maybe you can apply a technique like this (working perfectly in OO.o 1.1.x, don't know about 2.x): sub testCOnfig Dim aNodePath(0) as new com.sun.star.beans.PropertyValue Globalscope.BasicLibraries.Loadlibrary(Tools) oConfigProvider = createUnoService(com.sun.star.configuration.ConfigurationProvider) aNodePath(0).Name = nodepath aNodePath(0).Value = org.openoffice.Office.Calc/Layout'/Line Cnf_zweig = oConfigProvider.createInstanceWithArguments(com.sun.star.configuration.ConfigurationUpdateAccess, aNodePath()) Wert = Cnf_zweig.getByName(Line) ShowPropertyValues(Wert) Wert.GridLine = FALSE Cnf_zweig.commitChanges end sub - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]