[api-dev] Typo in the Developer´s Guide?
In some places, the Developers guide, more specifically on section 7.3.5, named the service attached to a DataBaseTextField as com.sun.star.text.FieldMaster.Database. It does not correspond to the value returned when you get the FieldMaster, which returns com.sun.star.text.FieldMaster.DataBase, note the case of the letter b. Is this just a typo? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] Change the value of a DataBase TextField
Hi, I want to change the value of a collection of textfields. When the textfield is a User TextField, it works ok, but when it is a DataBase TextField I cannot obtain the field, even thought the field exists. How can I obtain a DataBase TextField of a document? Here is the code that I used: // get XTextFieldsSupplier XTextFieldsSupplier xTextFieldsSupplier = (XTextFieldsSupplier) UnoRuntime.queryInterface(XTextFieldsSupplier.class, component); // access the TextFieldMasters collections XNameAccess xNamedFieldMasters = xTextFieldsSupplier.getTextFieldMasters(); for (String fieldName : xNamedFieldMasters.getElementNames()) { logger.debug(Just to make sure the field exists: + fieldName); } //Iterate over the fields collection that are to be changed for (TextFieldContent textFieldContent : fieldsToChange) { String completeFieldName = textFieldContent.getCompleteName(); if (xNamedFieldMasters.hasByName(completeFieldName)) { Object fieldMaster = xNamedFieldMasters.getByName(completeFieldName); XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,fieldMaster); xPropertySet.setPropertyValue(Content, textFieldContent.getValue()); } else { logger.warn(completeFieldName + does not exists); } } In the log I have both lines: Just to make sure the field exists:com.sun.star.text.FieldMaster.DataBase.sicor74.sicor74.SicorDestinatario and com.sun.star.text.FieldMaster.Database.sicor74.sicor74.SicorDestinatario does not exists How is it possible? Thanks in advance, Fabrício Lemos - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Change the value of a DataBase TextField
I suppose it´s from the text-layer because when I iterate over the names in the FieldMaster I find the field: com.sun.star.text.FieldMaster.DataBase.sicor74.sicor74.SicorDestinatario It´s really strange because when I call hasByName() (from the interface XNameAccess) with the same name found, it returns false. On 12/4/06, Cor Nouws [EMAIL PROTECTED] wrote: Hi Fabricio, Fabricio Lemos wrote: I want to change the value of a collection of textfields. When the textfield is a User TextField, it works ok, but when it is a DataBase TextField I cannot obtain the field, even thought the field exists. How can I obtain a DataBase TextField of a document? Isn't the database textfield a part of the form-layer? See: http://api.openoffice.org/docs/common/ref/com/sun/star/form/component/DatabaseTextField.html Regards, Cor -- Cor Nouws Arnhem - Netherlands nl.OpenOffice.org - marketing contact - 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]
[api-dev] Not editable TextField
Is there anyway to prevent a textfield from being edited? Is there a property or a listener for this kind of thing? thanks in advance, Fabrício Lemos - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Macro: revert changes.
Maybe I don't understand how you integrate with OOo. My understanding is that you have a component that registers at a document and waits until it is closed, then you want to revert this document back to the last saved state, modify the edit time and send it to the server. How is the document sent to the server? Directly via http or is it an operation done by your component (e.g. by intercepting the saving process)? Here is the scenario for my application: 1. The user request a document to the server. 2. The server stores, via java applet, the document at the user disk. 3. The user may open and close the document as many times he wants. Some times he edit it, sometimes not. He can still move the document to another folder or another computer. 4. At any time (hours, days or months later), the user may decide to upload the document to the server. 5. The user tells the server where the file is and the server get the file via java applet. 6. On the server side, I need to know how long the document stayed open. All transfer operations, between server and user, is done via http. On 12/15/05, Mathias Bauer [EMAIL PROTECTED] wrote: Fabricio Lemos wrote: I see. The best idea I have is to keep a local copy of the file each time the document is sent to the server and when the document is closed load the copy of the document (in hidden mode), change the time and sent *this* document to the server. Unhappyly, the user should be able to travel with the document between folders and with this solution he would have to travel with the document copies each time he moves the original document. This would not be a clear solution :( Maybe I don't understand how you integrate with OOo. My understanding is that you have a component that registers at a document and waits until it is closed, then you want to revert this document back to the last saved state, modify the edit time and send it to the server. How is the document sent to the server? Directly via http or is it an operation done by your component (e.g. by intercepting the saving process)? In future versions of OOo we will be able to change the metadata of a document without loading the whole file, just with loading and storing only the metadata. So if you now store your document editing time as custom metadata (a new feature in OOo2) you can speed up your workflow a lot once the feature will be available. Any ideas on which version will have this feature? Not for sure. It might be 2.0.2 or 2.0.3. Best regards, Mathias -- Mathias Bauer - OpenOffice.org Application Framework Project Lead Please reply to the list only, [EMAIL PROTECTED] is a spam sink. - 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] Macro: revert changes.
So you could do the following: If you know where the local disk copy is you can wait until the document is closed, then load the file from disk in hidden mode, change the data about the editing time (preferable as extended metadata in the document) and send it to the server. Later on when we have the new feature that metadata can be stored independently from the content this will be much faster because reading and writing only metadata is quite fast. The user should be able do edit the document while he is offline (not connected to the server). That way, I don´t know how the application would notice that the document was closed and load it in hidden mode. If there were a macro that re-open a document after it was closed, would solve this :) On 12/15/05, Mathias Bauer [EMAIL PROTECTED] wrote: Fabricio Lemos wrote: Here is the scenario for my application: 1. The user request a document to the server. 2. The server stores, via java applet, the document at the user disk. 3. The user may open and close the document as many times he wants. Some times he edit it, sometimes not. He can still move the document to another folder or another computer. 4. At any time (hours, days or months later), the user may decide to upload the document to the server. 5. The user tells the server where the file is and the server get the file via java applet. 6. On the server side, I need to know how long the document stayed open. All transfer operations, between server and user, is done via http. So you could do the following: If you know where the local disk copy is you can wait until the document is closed, then load the file from disk in hidden mode, change the data about the editing time (preferable as extended metadata in the document) and send it to the server. Later on when we have the new feature that metadata can be stored independently from the content this will be much faster because reading and writing only metadata is quite fast. Best regards, Mathias -- Mathias Bauer - OpenOffice.org Application Framework Project Lead Please reply to the list only, [EMAIL PROTECTED] is a spam sink. - 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] Macro: revert changes.
All I need to do is, given a document file to the user, know how long it kept the document open before he returned it to the server. To prenvent the user from dealing all the time with 2 files, I was storing this information on a user-field in the document file. But before closing the document I need to revert unsaved changes, update the user-field with the editing time information and save the document. Is there anyway to do that (with or without reloading the document)? On 12/13/05, Mathias Bauer [EMAIL PROTECTED] wrote: Fabricio Lemos wrote: Hello all, Is there anyway, with macros, to revert all changes made in a document since last time it was saved, without reloading it? Such functionality does not exist at all, neither in the GUI nor in the API. You can call Undo until the undo stack is empty, in many cases that will do what you want. There are two cases where this is not what you want: (1) You have saved your document in the editing session. In this case calling Undo til the end will even go behind the last saved version. (2) OTOH if you have more undo steps than the configured depth of the undo stack (default in OOo2 is 100) you will not reach the last saved state. Best regards, Mathias -- Mathias Bauer - OpenOffice.org Application Framework Project Lead Please reply to the list only, [EMAIL PROTECTED] is a spam sink. - 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] Macro: revert changes.
Why don't you update the editing time when the document is stored by the user instead of waiting until he closes the document? In this case the correct time gets stored along with all the changes the user wants. Of course you will not keep track of the time that the user works on the document but then discards his work, but do you want to count this time? Yes, I need to count this time. By the way, I need to keep track of all the time the document stays open, whether the user edit (change) it or not. And are you really sure that the OOo internal editing time isn't good enough for you? If you can use the OOo internal counter it will be stored each time anyway and you don't need to do anything on your side. It doesn´t work for me because the internal editing time is updated only when, and if, the document is saved and doesn´t register the time the document was open without being edited. On 12/14/05, Mathias Bauer [EMAIL PROTECTED] wrote: Fabricio Lemos wrote: All I need to do is, given a document file to the user, know how long it kept the document open before he returned it to the server. To prenvent the user from dealing all the time with 2 files, I was storing this information on a user-field in the document file. But before closing the document I need to revert unsaved changes, update the user-field with the editing time information and save the document. Is there anyway to do that (with or without reloading the document)? I must confess that I'm not sure wether I understand what your goal is. A user gets a document from a server (right?). He makes some changes to the document and then saves it again to the server (right?). You keep track of the editing time in the document and update it when the document is closed. Now you want to store this updated time to the document on the server but of course without any changes that meanwhile have been applied to the document because obviously the user wants to discard them (right?). Why don't you update the editing time when the document is stored by the user instead of waiting until he closes the document? In this case the correct time gets stored along with all the changes the user wants. Of course you will not keep track of the time that the user works on the document but then discards his work, but do you want to count this time? And are you really sure that the OOo internal editing time isn't good enough for you? If you can use the OOo internal counter it will be stored each time anyway and you don't need to do anything on your side. Best regards, Mathias -- Mathias Bauer - OpenOffice.org Application Framework Project Lead Please reply to the list only, [EMAIL PROTECTED] is a spam sink. - 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] Macro: revert changes.
I see. The best idea I have is to keep a local copy of the file each time the document is sent to the server and when the document is closed load the copy of the document (in hidden mode), change the time and sent *this* document to the server. Unhappyly, the user should be able to travel with the document between folders and with this solution he would have to travel with the document copies each time he moves the original document. This would not be a clear solution :( In future versions of OOo we will be able to change the metadata of a document without loading the whole file, just with loading and storing only the metadata. So if you now store your document editing time as custom metadata (a new feature in OOo2) you can speed up your workflow a lot once the feature will be available. Any ideas on which version will have this feature? Thank you a lot for your answers... On 12/14/05, Mathias Bauer [EMAIL PROTECTED] wrote: Fabricio Lemos wrote: Why don't you update the editing time when the document is stored by the user instead of waiting until he closes the document? In this case the correct time gets stored along with all the changes the user wants. Of course you will not keep track of the time that the user works on the document but then discards his work, but do you want to count this time? Yes, I need to count this time. By the way, I need to keep track of all the time the document stays open, whether the user edit (change) it or not. And are you really sure that the OOo internal editing time isn't good enough for you? If you can use the OOo internal counter it will be stored each time anyway and you don't need to do anything on your side. It doesn´t work for me because the internal editing time is updated only when, and if, the document is saved and doesn´t register the time the document was open without being edited. I see. The best idea I have is to keep a local copy of the file each time the document is sent to the server and when the document is closed load the copy of the document (in hidden mode), change the time and sent *this* document to the server. In future versions of OOo we will be able to change the metadata of a document without loading the whole file, just with loading and storing only the metadata. So if you now store your document editing time as custom metadata (a new feature in OOo2) you can speed up your workflow a lot once the feature will be available. Best regards, Mathias -- Mathias Bauer - OpenOffice.org Application Framework Project Lead Please reply to the list only, [EMAIL PROTECTED] is a spam sink. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] Macro: revert changes.
Hello all, Is there anyway, with macros, to revert all changes made in a document since last time it was saved, without reloading it? thanks in advance, Fabrício Lemos - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] IsFieldDisplayed property
Is 2.0.1 version released? If so, where can I find it? thanks in advance... Fabrício Lemos On 11/1/05, Fabricio Lemos [EMAIL PROTECTED] wrote: Ok then. I just got lost because I saw the property at the api specification at [1], that doesn´t mention the 2.0.1 version; According to [2] , 2.0.1 will be released on November, 28th. I think I can wait :) Thank you a lot Stephan :) [1] http://development.openoffice.org/releases/OpenOffice_org_2_x.html [2] http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextField.html On 11/1/05, Stephan Wunderlich - Sun Germany - ham02 - Hamburg [EMAIL PROTECTED] wrote: Hi Fabricio, I´m using the 2.0 version. Don´t know if it´s 2.0.0 or 2.0.1. Here is the code I use to see the available properties: OOo 2.0 is an 2.0.0, so the property you search for isn't available in that version. Regards 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] Incomplete stack trace
Yes I was. Just changed to 2.0.0 and it´s ok now. Thank you, Stephan. On 11/8/05, Stephan Bergmann [EMAIL PROTECTED] wrote: Fabricio Lemos wrote: Why doesn´t the stack trace of exceptions thrown by the api indicate which line of code that called the api method that threw the exception? That has been fixed for OOo 2.0. I assume you are using an older version. -Stephan For example: I have a code that threw a exception and got the stack trace: com.sun.star.lang.ServiceNotRegisteredException: at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.sun.star.lib.uno.protocols.urp.Unmarshal.readThrowable(Unmarshal.java:315) at com.sun.star.lib.uno.protocols.urp.Unmarshal.readAny(Unmarshal.java:157) at com.sun.star.lib.uno.protocols.urp.Unmarshal.readObject(Unmarshal.java:404) at com.sun.star.lib.uno.protocols.urp.urp.readReply(urp.java:192) at com.sun.star.lib.uno.protocols.urp.urp.readMessage(urp.java:308) at com.sun.star.lib.uno.protocols.urp.urp.readMessage(urp.java:607) at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge$MessageDispatcher.invoke(java_remote_bridge.java:184) at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge$MessageDispatcher.run(java_remote_bridge.java:175) But from the stack trace I can´t know which line of my code threw the exception. thanks, Fabrício Lemos - 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] IsFieldDisplayed property
Ok then. I just got lost because I saw the property at the api specification at [1], that doesn´t mention the 2.0.1 version; According to [2] , 2.0.1 will be released on November, 28th. I think I can wait :) Thank you a lot Stephan :) [1] http://development.openoffice.org/releases/OpenOffice_org_2_x.html [2] http://api.openoffice.org/docs/common/ref/com/sun/star/text/TextField.html On 11/1/05, Stephan Wunderlich - Sun Germany - ham02 - Hamburg [EMAIL PROTECTED] wrote: Hi Fabricio, I´m using the 2.0 version. Don´t know if it´s 2.0.0 or 2.0.1. Here is the code I use to see the available properties: OOo 2.0 is an 2.0.0, so the property you search for isn't available in that version. Regards 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]
[api-dev] IsFieldDisplayed property
Hello! How can I access the value of the IsFieldDisplayed property of a com.sun.star.text.TextField? It would be very nice if the XTextField interface had the isFieldDisplayed method. thanks in advance, Fabrício Lemos - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] IsFieldDisplayed property
I tried that. The only properties that appeared were: AnchorType AnchorTypes IsFixedLanguage IsShowFormula IsVisible NumberFormat TextWrap On 10/31/05, Stephan Wunderlich - Sun Germany - ham02 - Hamburg [EMAIL PROTECTED] wrote: Hi Fabricio, How can I access the value of the IsFieldDisplayed property of a com.sun.star.text.TextField? It would be very nice if the XTextField interface had the isFieldDisplayed method. you could query the XTextField for an XPropertySet and see if you can gain and set the property with the methods get/setPropertyValue Hope that helps Regards 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] Hiding a textField throught the API
Thank you again Stephan. Now it´s doing what I want. Just for curiosity and future needs: is there any reference where IsVisible property is specified for textfields? Did not find anything in the Developer's Guide (v1.1 from December 2003) and in the api specification (sdk v1.1). In the Developer's Guide I found IsVisible propertie only for other components, like Spreadsheets and Layers. On 8/30/05, Stephan Wunderlich - Sun Germany - ham02 - Hamburg [EMAIL PROTECTED] wrote: Hi Fabricio, Worked just fine. Thank you, Stephan. But, in my application, I need to hide a textfield that has a given name. How would be the code for that? When you have a Enumeration of your TextFields you can query each of them for an XDependentTextField. UserFields are those and then you can call the method getTextFieldMaster() at this and get the property name from the returned PropertySet. If the TextFieldMaster has the name you search you can set the property IsVisible at the corresponding TexField. Hope that helps Regards 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] Hiding a textField throught the API
Worked just fine. Thank you, Stephan. But, in my application, I need to hide a textfield that has a given name. How would be the code for that? On 8/29/05, Stephan Wunderlich - Sun Germany - ham02 - Hamburg [EMAIL PROTECTED] wrote: Hi Fabricio, How can I hide a document text field using the API (without macros)? Here´s the code that I use for accessing the textfield: XTextFieldsSupplier xTextFieldsSupplier = (XTextFieldsSupplier) UnoRuntime.queryInterface( XTextFieldsSupplier.class, component); XNameAccess xNamedFieldMasters = xTextFieldsSupplier.getTextFieldMasters(); XEnumerationAccess xEnumeratedFields = xTextFieldsSupplier.getTextFields(); String completeName = com.sun.star.text.FieldMaster.User. + textFieldName; Object fieldMaster = xNamedFieldMasters.getByName(completeName); the TextFields has a property called IsVisible ... setting this to false will hide your User-TextFields. Somethings like XPropertySet FieldProperties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xEnumeratedFields.nextElement()) FieldProperties.setPropertyValue(IsVisible,Boolean.FALSE) should hide the first textfield in your enumeration ... that is if it is a User-Field ;-) Hope that helps Regards 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]