Bug 60237 - : Bug in API call StoreAsURL (or in the OO Basic API description)
Summary: : Bug in API call StoreAsURL (or in the OO Basic API description)
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version: 3.5.7.2 release
Hardware: Other All
: medium normal
Assignee: Not Assigned
QA Contact:
URL:
Whiteboard: BSA
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-03 14:39 UTC by lo
Modified: 2013-02-17 00:23 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description lo 2013-02-03 14:39:52 UTC
Problem description: When saving a file using StoreAsURL with the MediaDescriptor property "Overwrite" not set (i.e. using the default, which the documentation describes as having the value FALSE), existing files are overwritten.

Steps to reproduce:

Edit the following macro to conform to your local directory structure and OS, put a Writer file called "Test1.odt" in the directory and run the macro.

Sub Main

dim FileString as String
dim TrueProp as  Object
TrueProp = New com.sun.star.beans.PropertyValue
dim FalseProp as Object
FalseProp = New com.sun.star.beans.PropertyValue

TrueProp.Name="Overwrite"
TrueProp.Value=TRUE
FalseProp.Name="Overwrite"
FalseProp.Value=FALSE

dim EmptyArray() as Object
dim TrueArray(0) as Object
dim FalseArray(0) as Object

TrueArray(0)=TrueProp
FalseArray(0)=FalseProp

InFileString=  "D:\Peter\PC\Open Office\Bughunt\Test1.odt"  ' This file already exists
OutFile2String="D:\Peter\PC\Open Office\Bughunt\Test2.odt" 
OutFile3String="D:\Peter\PC\Open Office\Bughunt\Test3.odt" 
OutFile4String="D:\Peter\PC\Open Office\Bughunt\Test4.odt" 

dim FileURL as String

InFileURL=ConverttoURL(InFileString)
OutFile2URL=ConverttoURL(OutFile2String)
OutFile3URL=ConverttoURL(OutFile3String)
OutFile4URL=ConverttoURL(OutFile4String)

Dim doc as Object

Doc=StarDesktop.LoadComponentfromURL(InFileURL, "_blank", 0, Array())
msgbox "Document loaded"
'xray doc

Doc.StoreToURL(OutFile2URL,TrueArray)
Doc.StoreToURL(OutFile3URL,TrueArray)
Doc.StoreToURL(OutFile4URL,TrueArray)
msgbox "Documents 2,3,4 stored OK"

Doc.StoreAsURL(OutFile2URL,TrueArray)
msgbox "Document 2 stored with Overwrite set to TRUE"

Doc.StoreAsURL(OutFile3URL,EmptyArray)
msgbox "Document 3 stored with default Overwrite"

Doc.StoreAsURL(OutFile4URL,FalseArray)
msgbox "Document 4 stored with Overwrite set to FALSE"

End sub

Current behavior:

Gives an error when storing Document Test4.

Expected behavior:

Should have given an error when storing document Test3.

This also occurs in OpenOffice and has been reported as bug no 121665 there.

              
Operating System: Windows 7
Version: 3.5.7.2 release
Comment 1 Julien Nabet 2013-02-17 00:23:47 UTC
On pc Debian x86-64 with master source updated today.

Noel: one for you?


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.