Re: [api-dev] Ubuntu OpenOffice.org eclipse plugin
Mikael De Bie a écrit : Thank you very much for your help ! I've followed the steps and manage to create a UNO package. :) But it still remains a problem : I've made the really simple macro : Sub TestHelloworld helloworld = createUnoService(org.openoffice.helloworld.Helloworld) print helloworld.sayHello() End Sub And I get this error when calling the sayHello() method : BASIC runtime error. Property or method not found. Tough I don't think that I've missed something in the tutorial... My files are the same as the ones described at http://wiki.services.openoffice.org/wiki/JavaEclipseTuto Any idea ? No idea if you have the same files as the tutorial... Could you try to inspect the helloworld object with xray ? Cedric - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] Bug?!: xPrintable.print(printOpts) is too slow for itself
Hi together, I wrote a little program and wonder about its behaviour. This java programm first sets the printer, then the printer tray and prints afterwards the pages I want. Printing is started with: xPrintable.print(printOpts) Then my programm continues to set another printer tray, the same printer and prints some other pages with: xPrintable.print(printOpts) Now something interesting happens: the second print request is just ignored! I can solve this problem by telling my programm to sleep for about 2 seconds after the first print is started and then continue with the second print. Is this a bug or a feature? Greetings, Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] How to copy all Content of a document
Hi Oliver, sorry for my late answer. I was sick :-( oSrcDoc.CurrentController.Select(oSrcSection.Anchor) oDispatcher.executeDispatch(oSrcDispFrame, .uno:Copy, , 0, arr()) oDstDoc.CurrentController.Select(oDstSection.Anchor) oDispatcher.executeDispatch(oDstDispFrame, .uno:Paste, , 0, arr()) this is a very good idea. I'll test it in Java. But this seems to solve my problem. Thanks for the idea! Or you create a tmp autotext: [...] This is also a good idea. But I think I'll first try your first idea. Greetings, Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] How to copy all Content of a document
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. Thanks for telling me this useful feature. Greetings, Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Idea for a feature: adding a PageStyle / PageStyleName for Presentation and Draw documents
Hi Tobias, impress uses a different concept as each slide has a master page assigned which for one is a complete page with shapes that is rendered on the background of that slide but also contains a unique set of presentation styles for shapes used in layouts. So I don't think we need page styles for impress as master pages have far more features than just simple styles and fit the slide oriented document model of impress better. Same holds for draw except draw has no presentation styles of course. Best regards, Christian Tobias Krais wrote: Hi together again, I worte a little program that sets the printer tray and prints OO documents. I use following code to set the printer tray for XTextdocuments: %- XText xText = myXTextDocument.getText(); // create a text cursor from the cells XText interface XTextCursor xTextCursor = xText.createTextCursor(); // Get the property set of the cell's TextCursor XPropertySet xPropSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextCursor); String pageStyleName = xPropSet .getPropertyValue(PageStyleName).toString(); -% For Spreadsheets I use a similar way to get the PageStyleName using: -%- // Selecting each SpreadSheet by itself Object sheet = xSpreadsheets.getByName(sheetName); XSpreadsheet xSpreadsheet = (XSpreadsheet) AnyConverter.toObject(XSpreadsheet.class, sheet); // Get all properties of the sheet XPropertySet xSheetProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xSpreadsheet); // Get page style property String pageStyleName = xSheetProps .getPropertyValue(PageStyle).toString(); -%- Now I want to do the same for a presentation document -%- // Getting the page style name XPresentation xPresentation = xPresSupplier.getPresentation(); XPropertySet xPropSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xPresentation); // TODO: There is no such property name... String pageStyleName = xPropSet.getPropertyValue(PageStyleName).toString(); -%- Same for drawing documents: -%- XDrawPage xDrawPage = (XDrawPage) AnyConverter.toObject(XDrawPage.class, xDrawPages.getByIndex(i)); XPropertySet xPropSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xDrawPage); // TODO: There is no such property name... String pageStyle = xPropSet.getPropertyValue(PageStyleName).toString(); -%- Do you think it is worth to add an ENHANCEMENT issue? Please disagree or tell me your ideas. Greetings, Tobias - 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] Idea for a feature: adding a PageStyle / PageStyleName for Presentation and Draw documents
Hi Christian, So I don't think we need page styles for impress as master pages have far more features than just simple styles and fit the slide oriented document model of impress better. If there are far more features than just simple styles, how can I set the printer tray? Can you give me an idea? Greetings, Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Ubuntu OpenOffice.org eclipse plugin
I've inspected the helloworld object by using this macro : Sub TestHelloworld helloworld = createUnoService(org.openoffice.helloworld.Helloworld) oInspector = createUnoService(org.openoffice.InstanceInspector) oInspector.inspect(helloworld, helloworldInspect) helloworld.sayHello() End Sub I can see the method string sayHello() = in the list of methods. When I generate the source code, here's what I get : import org.openoffice.helloworld.XHelloworld; public void codesnippet(Object UNOENTRYOBJECT){ XHelloworld xHelloworld = (XHelloworld) UnoRuntime.queryInterface(XHelloworld.class, UNOENTRYOBJECT); String sVariableName = xHelloworld.sayHello(); } It seems that the method exists... However, I stell get the same error. cheers, Mikaël On Thu, 2006-11-30 at 09:40 +0100, Cedric Bosdonnat wrote: Mikael De Bie a écrit : Thank you very much for your help ! I've followed the steps and manage to create a UNO package. :) But it still remains a problem : I've made the really simple macro : Sub TestHelloworld helloworld = createUnoService(org.openoffice.helloworld.Helloworld) print helloworld.sayHello() End Sub And I get this error when calling the sayHello() method : BASIC runtime error. Property or method not found. Tough I don't think that I've missed something in the tutorial... My files are the same as the ones described at http://wiki.services.openoffice.org/wiki/JavaEclipseTuto Any idea ? No idea if you have the same files as the tutorial... Could you try to inspect the helloworld object with xray ? Cedric - 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] [SOLVED] How to copy all Content of a document
Hi Oliver, oSrcDoc.CurrentController.Select(oSrcSection.Anchor) oDispatcher.executeDispatch(oSrcDispFrame, .uno:Copy, , 0, arr()) oDstDoc.CurrentController.Select(oDstSection.Anchor) oDispatcher.executeDispatch(oDstDispFrame, .uno:Paste, , 0, arr()) now I implemented it and it works. Even the styles are copied - wonderful! Here is my java code: -%- public void dispatchCommandURL(String myCommandURL, PropertyValue[] myProperties) { // Getting the frame the loaded document resides in XModel xModel = (XModel)UnoRuntime.queryInterface(XModel.class, this.xComponent); XController xController = xModel.getCurrentController(); // Getting the Dispatch Provider XDispatchProvider xDispatchProvider = (XDispatchProvider) UnoRuntime.queryInterface (XDispatchProvider.class, xController.getFrame()); // Getting the Dispatch Helper XMultiServiceFactory xMultiServiceManager = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, OOWorkbench.getXComponentContext().getServiceManager()); XDispatchHelper xDispatchHelper = null; try{ Object oDispatchHelper = xMultiServiceManager.createInstance( com.sun.star.frame.DispatchHelper); xDispatchHelper = (XDispatchHelper) AnyConverter.toObject(XDispatchHelper.class, oDispatchHelper); } catch(com.sun.star.uno.Exception e) { } // Executing the commandURL xDispatchHelper.executeDispatch(xDispatchProvider, myCommandURL, _self, 0, myProperties); } -%- Thanks again. Greetings, Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] how to copy textframes ?
Hi Oliver, i try to copy textframes (including content) from a source doc to a destination doc ... is this possible via api ? it a long time ago, you wrote this mail. I cannot answer your question fully, but I was working on a part of the problem last week. Here is the java code I used for getting the textframe: -%- // Get the text frame interface from document XTextFramesSupplier xTextFramesSupplier = (XTextFramesSupplier) UnoRuntime.queryInterface(XTextFramesSupplier.class, xComponent); XNameAccess xNamedFrames = xTextFramesSupplier.getTextFrames(); String[] textframes = xNamedFrames.getElementNames(); for (int i = 0; i textframes.length; i++) { Object textframe = null; try { textframe = xNamedFrames.getByName(textframes[i]); XTextContent xFrameContent = (XTextContent) AnyConverter.toObject(XTextContent.class, textframe); } catch (Exception e) { } } -%- I think now you should be able to insert the XTextContent on an other... Greetings, Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] Dispatching a CommandURL from a hidden document
Hi together, one more question today. I wrote a little program, copying text from one document to an other using the CommandURLs .uno:SelectAll, .uno:Copy and .uno:Paste. This works quite well. But if I open my document in hidden mode, nothing is copied. How can I copy the whole content from one document to an other in hidden mode? Greetings, Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Array - max elements number
Laurent Godard ha scritto: HI bart Hi Laurent, ..and sounds fine in more little help well, early morning and not tested 'be carefull, will erase myFile open myFile for output as #1 for i= 1 to 13 print #1, myArray(i) next i close #1 Thank you kindly, problems about end mounth deadline... :-) But I will work on this... Bart - 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
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) { } } -%- Greetings, Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] function usage in a calc addin
Hi, Maybe you've read that I'm trying to use the java eclipse plugin to create UNO component, but beside this, I'm also creating a calc addin in c++. And I need some help : I'm trying to integrate a way to create and solve contraints satisfaction problems in a calc sheet. But I'm a beginner yet and need some help to know if what I plan to do is possible. I've actually three questions about calc addin : 1. Is there a way to get the reference to a cell rather than its content? The purpose is to be able to change a cell content using the cell in question as a parameter of the function. 2. Is there a way to get the formula of a function in a cell or only the value returned can be used? Here's an exemple : If i use =testaddin(H1:H4) in cell A1, I would like that either: a. my testaddin implementation is called with H1:H4 as a parameter (or an object abstracting a cell range). b. A macro is able to get the content of cell A1 as a formula string ( =testaddin(H1:H4) ) or (better) as a parsing tree or any abstraction which let me identify the functions used as well as their arguments. 3. Is there a way to hide the returned value of a function? So that the value can be use by another function but isn't visible on the sheet. Thanks in advance, Mikaël - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] [snippet] How to insert a document in an other one
Hi Tom, please add this snippet to the snippet database. Greetings, Tobias ?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=Java application=Writer keywords keywordinsert/keyword keyworddocument/keyword /keywords authors author id=tobiaskrais initial=true email=[EMAIL PROTECTED] copyright=GNU Public liscenseTobias Krais/author /authors question heading=Inserting a Document in an otherHow to insert a document in an other one? /question answer listingimport com.sun.star.document.XDocumentInsertable; import com.sun.star.lang.XComponent; import com.sun.star.text.XText; import com.sun.star.text.XTextCursor; import com.sun.star.text.XTextDocument; import com.sun.star.uno.UnoRuntime; /** * Inserts a document a the cursors point. * @param unoDocumentURL File name that is UNO URL conform. * How to create this, see [EMAIL PROTECTED] ../Office/Office.CreateUNOCompatibleURL.snip} */ public void insertDocument(String unoDocumentURL) { // How to get the XComponent, see [EMAIL PROTECTED] ../Office/Office.OpenDocumentFromURL.snip} XTextDocumen xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent); XText xText = 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) { if (debug gt; 1) e.printStackTrace(); } }/listing /answer versions version number=2.0.x status=tested/ /versions operating-systems operating-system name=All/ /operating-systems changelog change author-id=tobiaskrais date=2006-11-30Initial version/change /changelog /snippet - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] [snippet] How to insert a document in an other one
Hi, Thanks for your contribution your snippet has been added here:http://codesnippets.services.openoffice.org/Writer/Writer.InsertingADocumentInAnOther.snip Tom signature.asc Description: OpenPGP digital signature
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] Dispatching a CommandURL from a hidden document
Tobias Krais wrote: Hi together, one more question today. I wrote a little program, copying text from one document to an other using the CommandURLs .uno:SelectAll, .uno:Copy and .uno:Paste. This works quite well. But if I open my document in hidden mode, nothing is copied. How can I copy the whole content from one document to an other in hidden mode? It is very probable that dispatches don't work in hidden mode. I think I already gave you a macro to accomplish the same what you can do with the clipboard, at least for Writer. Ciao, Mathias -- Mathias Bauer (mba) - Project Lead OpenOffice.org Writer OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS Please don't reply to [EMAIL PROTECTED]. I use it for the OOo lists and only rarely read other mails sent to it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Bug?!: xPrintable.print(printOpts) is too slow for itself
Hi Mathias, I assume that you can call it a feature; to my knowledge we are not able to queue printer requests. Instead of waiting for a fixed time you could register a print listener to get notified when printing is done. I did do before. But if the user wanted to print a non-existing page, the printer listener was hanging at the state of job started, but never exited. I did not find a workaround for this bug, so I decided to throw away the printer listener and to solve it this way. Greetings, Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]