Re: [api-dev] [SOLVED] zip write access throug UCB
Ups, sorry. A small typo, of course it is flush command. Best regards, Mikhail. Mikhail Voitenko wrote: Hi Paolo, The provided by you link points to a solution using Package component. But the writing to a zip file works well using the UCB too. The provided by you UCB-based example looks good from the first view, except the missing flash command. It should be executed on the root content of the zip file vnd.sun.star.zip://encoded file URL to the zip file/. This command triggers the storing of all the changes made to the zip file. Hope that helps. Best regards, Mikhail. Paolo Mantovani wrote: Hi, I solved using the technique explained from Mikhail Voitenko in this old post: http://api.openoffice.org/servlets/ReadMsg?listName=devmsgNo=13383 Thank you Paolo Mantovani Alle 20:26, venerdì 24 novembre 2006, Paolo Mantovani ha scritto: Hi, me again, about zip packages... Thanks to help from Kai Sommerfeld I was able to read any contents into a zip file Now I'm trying to *write* contents, but again :-( without any luke Please see my test code below Notice that if I try with a regular file URL the code works perfectly and I can modify or delete the file. Any help will be appreciated Paolo M REM * BASIC * Sub WriteManifestTest oSM = GetProcessServiceManager() oUCB = oSM.createInstanceWithArguments( _ com.sun.star.ucb.UniversalContentBroker, Array(Local,Office)) sUrl = file:///home/paolo/Library1.uno.pkg sUrl = _ vnd.sun.star.zip:// Join(Split(sUrl, /), %2F) /META-INF/manifest.xml 'sUrl = file:///home/paolo/manifest.xml '---this works oID = oUCB.createContentIdentifier(sUrl) oProvider = oUCB.queryContentProvider(sUrl) oContent = oProvider.queryContent(oID) 'now write the manifest with empty data oMySinc = CreateUnoService(com.sun.star.io.Pipe) oWriter = CreateUnoService(com.sun.star.packages.manifest.ManifestWriter) oWriter.writeManifestSequence(oMySinc, array()) Dim aArg1 As New com.sun.star.ucb.InsertCommandArgument aArg1.ReplaceExisting = True aArg1.Data = oMySinc UcbExecuteCommand(oContent, insert, aArg1) 'UcbExecuteCommand(oContent, delete, True) End Sub Function UcbExecuteCommand(oContent As Object, _ sCommandName As String, aArgument As Variant) As Variant ' Assemble command to execute. Dim aCommand As New com.sun.star.ucb.Command aCommand.Name = sCommandName aCommand.Handle = -1 ' not available aCommand.Argument = aArgument ' Note: throws CommandAbortedException and Exception since ' we pass null for the XCommandEnvironment parameter UcbExecuteCommand = oContent.execute(aCommand, 0, Null) End Function - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] check visible state of a control
Hi Frank, Frank Schönheit - Sun Microsystems Germany wrote: That's not possible, AFAIK, except with the (potentially expensive) Accessibility workaround mentioned by Christoph. I'm aware of the greedy nature of the present solution, but in my tests it did work OK. I would like to encourage you to submit an issue for this missing API :) I thought about that. But I'm a little afraid that one issue is so isolated, only one fragment, since there probably will be quite some missing methods for various controls... Regards, Cor -- Cor Nouws Arnhem - Netherlands nl.OpenOffice.org - marketing contact - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] check visible state of a control
Hi Cor, I would like to encourage you to submit an issue for this missing API :) I thought about that. But I'm a little afraid that one issue is so isolated, only one fragment, since there probably will be quite some missing methods for various controls... Well, yes, might be. I just thought visibility in general is badly covered, for instance, models are missing a visibility property, so it could have justified a dedicated issue. Ciao Frank -- - Frank Schönheit, Software Engineer [EMAIL PROTECTED] - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Database http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] check visible state of a control
Bonjour Cor Nouws Message du 2006-11-27 21:27: I use the trick when generating documents from a dialog: For different document types, different txtFields are vissible. Contents of txtFields has to be put in userfields in the document. I use the same names for userfields and txtFields, so use a loop to fill all userfields ;-) Works great, but if for one reason or another, a txtField is hidden but not empty, the userfield may not be filled. So I needed a check on visibility of the txtField. Thanks for that. For problems like this, I would use the Tag property of the model of the control to memorize information. This property is a string, you can store various data in it. myControl.Visible = False myControl.Model.Tag = NotUsed . . . if myControl.Model.Tag = NotUsed then ... else ... Bernard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] soffice.bin still alive after closing the applet
Hi everybody, I managed to put openoffice.org into an applet, but sometimes when I close the applet there's this soffice.bin process still alive. Is it normal? Is there a way to clear the memory, kill it, etc. through the api? joan This e-mail may contain confidential or privileged information. Any unauthorised copying, use or distribution of this information is strictly prohibited. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Array - max elements number
Christoph Jopp ha scritto: Hi Bart, Hi Cristophe, don't know what you are exactly trying to do, but I assume that yoou would not need an array at all. The LoadDataFromFile function opens a file as input stream an reads line by line into an array. As you wrote that you want to iterate over the array and do something with each element, I guess you could do that also directly on the single line given back from 'oInputStream.ReadLine'. Interestig... I have tried... but I do not find the way... Can you suggest me several lines code or an example? So a possibility would be to rip off the parts related to assigning the lines to the array and fill in your content manipulation code. Sorry...I am not able in wich way I can make it... BTW, making a back step, my problem is: I have a quirky DB in txt format, one field in each line. In each line the firsts caracters are codes to identify the tipe field, and a precise code (@V) identify the lines where begin a new record. (They are 15 fields per Record) The first operation is to remove the Carriage Return in all the lines, except the lines that become with code @V (In this way the file (130'000 line) is reduced (rougly) at 8'000 lines.) At last to remove (partially) alls codes, in manner to obtaine fields separatar. i.e. The fields identifiers are: @A, @B, @C, ... @Y A possible separator for final file.csv may be only @ This is an (simplified) example: -- original file.txt @A field1 @B field2 @C field3 @... field... @V field15 - final File.csv @[EMAIL PROTECTED]@field3field15 The final File.csv will may easly imported (manually) in calc. thanks for the help Bart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] check visible state of a control
Cor Nouws wrote: Hi *, I know how to set the visible sate of a control: oControlModel = oDocDlg.GetControl(sName) oControlModel.setVisible (sYesNo) but cannot find a methode (with xRay / API IDL) to check if a control is visible ... Any hints welcome Thanks, Cor One problem I ran into regarding setVisible() is that the visibility of an UnoControl is not set persistently when you switch the steps of the dialog. In the following code oControl = oDialog.getControl(TextField1) oControl.setVisible(false) oDialog.Model.Step = 1 oDialog.Model.Step = 0 oDialog.execute() the control TextField1 will not be invisible, because the steps of the dialog have been set back and forth afterwards. As I found out the most convenient workaround for this problem is to reserve an invisible Step where you park all your invisible controls. I know that this might appear like a hack but the advantage is that you don't have to check which controls have to be set invisible each time when you change the Step property at the dialog. Public const INVISIBLESTEP = 99 ... oControl = oDialog.getControl(TextField1) ' Assign the value of the Step of your Control in the Tag ' ' property of the control initially oControl.Model.Tag = oControl.Model.Step setVisible(oControl.Model, false) Msgbox Control is visible:IsVisible(oControl.Model) oDialog.Model.Step = 2 oDialog.Model.Step = 1 oDialog.execute() ... public Sub setVisible(oControlModel, bIsVisible as Boolean) if bIsVisible Then oControlModel.Step = oControlModel.Tag Else oControlModel.Tag = oControlModel.Step oControlModel.Step = INVISIBLESTEP End If End Sub Public Function isVisible(oControlModel) as Boolean isVisible() = Not (oControlModel.Step = INVISIBLESTEP) End Function - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] check visible state of a control
Hi Berend, One problem I ran into regarding setVisible() is that the visibility of an UnoControl is not set persistently when you switch the steps of the dialog. In the following code oControl = oDialog.getControl(TextField1) oControl.setVisible(false) oDialog.Model.Step = 1 oDialog.Model.Step = 0 oDialog.execute() the control TextField1 will not be invisible, because the steps of the dialog have been set back and forth afterwards. which is one reason why I think the visibility problem deserves dedicated attention. Tampering with the visibility of the control is a hack, at best (which is fine, as long as there is no other solution). But the fact that this control-visibility is also used by other components - e.g. by a dialog, which implements its step-handling by adjusting visibilities - strongly supports that we need a better solution. Which would be a model-property Visible (as you have a model property Enabled, instead of calling setEnable at the control). Ciao Frank -- - Frank Schönheit, Software Engineer [EMAIL PROTECTED] - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Database http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Array - max elements number
Christoph Jopp ha scritto: Maybe the overflow comes from the rest of your code. I have not still write the rest of the code... :-) May will be a further problem in Overflow... Do you use Calc? Yes... There is a limit of 65536 lines - if you perhaps split your 13+ lines into two columns you would be quite near at this limit. Before to load the file in calc I must reduce the line number... as I have write in my previus message... May be that OOo and basic are not the better tools for manipulate a file.txt. thanks Bart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] [SOLVED] zip write access throug UCB
Hi Mikhail, Kai, Thank you very much for your replies. Sincerely I didn't notice the note about the flush command. My mistake of course, but perhaps the docu could be improved here: The examples on the dev guide are all generic (not about a specific content type), so the flush command is never shown. Furthermore, when I read the IDL spec of the PCPFolder I found this: XCommandProcessor Description This interface is implemented according to the specification of service Content . Aha!, OK! So I jumped on the css.ucb.Content page and read, but the flush command is never mentioned. Thanks again Paolo M Alle 09:15, martedì 28 novembre 2006, Kai Sommerfeld ha scritto: Hi all, Mikhail Voitenko wrote: Hi Paolo, The provided by you link points to a solution using Package component. But the writing to a zip file works well using the UCB too. The provided by you UCB-based example looks good from the first view, except the missing flash command. It should be executed on the root Actually, the name of the command is flush. content of the zip file vnd.sun.star.zip://encoded file URL to the zip file/. This command triggers the storing of all the changes made to the zip file. For your interest: The flush command has been introduced for performance reasons. As you can imagine zipping the whole file automatically upon every write operation can be quiete time consuming... Documentation of the flush command can be found here: http://api.openoffice.org/docs/common/ref/com/sun/star/ucb/PackageFolderCon tent.html - Kai. - 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] Array - max elements number
Hi May be that OOo and basic are not the better tools for manipulate a file.txt. it works i have no problem with the following coding did not test the tools - loadfromfile helper Laurent sub createFile open /home/lgodard/bigfile.txt for output as #1 for i = 1 to 13 print #1, line number cstr(i) string(100,-) next i print file created end sub this ends with a around 15 Mb file with lines like line number 1 line number 2 then reading it (i removed redim preserve for performances) sub readFile redim myArray(13) counter = 0 open /home/lgodard/bigfile.txt for input as #1 while not eof(1) line input #1, aLine counter = counter + 1 myArray(counter) = aLine wend close #1 print ok cstr(counter) end sub -- Laurent Godard [EMAIL PROTECTED] - Ingénierie OpenOffice.org - http://www.indesko.com Nuxeo Enterprise Content Management http://www.nuxeo.com - http://www.nuxeo.org Livre Programmation OpenOffice.org, Eyrolles 2004-2006 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Array - max elements number
Hi did not test the tools - loadfromfile helper i just test and encounter the problem it is due to the defintion of MaxIndex as integer (limited to 65535 then) Function LoadDataFromFile(FilePath as String, DataList()) as Boolean Dim i as Integer ... Dim MaxIndex as Integer changing to Dim i as Long Dim MaxIndex as Long is ok (the limit is then 2.147.483.647) Laurent -- Laurent Godard [EMAIL PROTECTED] - Ingénierie OpenOffice.org - http://www.indesko.com Nuxeo Enterprise Content Management http://www.nuxeo.com - http://www.nuxeo.org Livre Programmation OpenOffice.org, Eyrolles 2004-2006 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] XP Problem with OpenOffice.org eclipse plugin?
Bonjour Freddy, Freddy Marboeuf a écrit : I have the same problem than Alamo Vallejo, and I'm using the last version of the OOo SDK, which is 2.0.4. Error message is Invalid SDK path and Name field has value 680m3. I didn't found any solution for this problem and won't have time to create a new release only for it. However a new, really better release will come out in a few weeks. Stay tuned... Cedric - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]