<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Martin,<br>
<br>
I supose it is already cross platform and environment independent,
neve tested it but interesting to know.<br>
<br>
<br>
<blockquote
cite="mid:CAOEXP8jascxTciXr4nCm+37=Nws1V6jFrBTNzGB=XBCN86=+uQ@mail.gmail.com"
type="cite">Hi Fernand,<br>
<br>
Thank you for your response, it may help indeed.<br>
<br>
It seems that you create your own xcs file from scratch and store
it in a custom location. I think that in my case, I will need to
find a way to make it cross platform and environment independent.
<br>
<br>
Cheers<br>
<br>
<div class="gmail_quote">2012/1/24 Fernand Vanrie <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:sos@pmgroup.be">sos@pmgroup.be</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div>
<div class="h5"> Martin ,<br>
<br>
i use folowed BASIC code to make a "path" consitent ,
maybe it helps ?<br>
<br>
public sElementnaam , sfotopath as string<br>
public oParameter as object<br>
<br>
sub addFotoPath()<br>
sRegisterPath =
"/org.openoffice.OpmaakMacro.FotoPath/Parameters/" <br>
CreateRegistrySchemaPathIfNotPresent(sRegisterPath)<br>
aSettings = GetConfigSettings(sRegisterPath)<br>
sElementNaam = "FOTO"<br>
sParaNaam = "FotoPath"<br>
sParameter = "c:\test"<br>
<br>
call addParameter(aSettings, sParaNaam, sParaMeter) <br>
<br>
end sub<br>
sub getFotoPath<br>
sRegisterPath =
"/org.openoffice.OpmaakMacro.FotoPath/Parameters/" <br>
aSettings = GetConfigSettings(sRegisterPath)<br>
asElNames = aSettings.ElementNames <br>
if aSettings.hasByName("FOTO") then<br>
oParameter = aSettings.getByName("FOTO") <br>
<br>
sFOTOpath = oParameter.getByName("ParameterString")<br>
else<br>
sFOTOpath = ""<br>
endif <br>
end sub<br>
<br>
<br>
function GetConfigSettings(sRegisterPath as String) as
Object 'Taken from DannyB <br>
Dim args(1) As new com.sun.star.beans.PropertyValue <br>
aConfProv =
createUnoService("com.sun.star.configuration.ConfigurationProvider")
<br>
args(1).Name = "nodepath" <br>
args(1).Value = sRegisterPath <br>
args(0).Name = "EnableAsync" <br>
args(0).Value = false <br>
GetConfigSettings =
aConfProv.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess",
args()) <br>
end function <br>
<br>
sub CreateRegistrySchemaPathIfNotPresent(sRegisterPath
as String) <br>
oPathSettings = CreateUnoService(
"com.sun.star.util.PathSettings" )<br>
xray oPathSettings <br>
sPathConfig = oPathSettings.Work 'Config <br>
<br>
asPath1 = split(sRegisterPath, "/") <br>
sFullDotPath = asPath1(1) <br>
asPath2 = Split(sFullDotPath,".") <br>
sFolder = join(asPath2,"/") <br>
<br>
<br>
sRegistrySchemaPath = <a moz-do-not-send="true">"file:///H:/"</a>
& sFolder & ".xcs" <br>
<br>
sFileName = asPath2(UBound(asPath2)) <br>
sPackage = left(sFullDotPath,
len(sFullDotPath)-len(sFileName)-1) <br>
<br>
oSFA = createUNOService
("com.sun.star.ucb.SimpleFileAccess") <br>
if not oSFA.exists(sRegistrySchemaPath) then 'See the
chapter 15 of the dev guide for some explanation <br>
print sRegistrySchemaPath<br>
oOutStream = oSFA.openFileWrite(sRegistrySchemaPath) <br>
oOutText = createUNOService
("com.sun.star.io.TextOutputStream") <br>
oOutText.setOutputStream(oOutStream) <br>
<br>
oOutText.WriteString("<?xml version='1.0'
encoding='UTF-8'?>" & Chr(10)) <br>
<br>
oOutText.WriteString("<oor:component-schema
oor:name=""" & sFileName & """ oor:package="""
& sPackage & """ " ) <br>
oOutText.WriteString("xml:lang=""en-US"" xmlns:oor="<a
moz-do-not-send="true"
href="http://openoffice.org/2001/registry"
target="_blank">"http://openoffice.org/2001/registry"</a>"
" ) <br>
oOutText.WriteString("xmlns:xs="<a
moz-do-not-send="true"
href="http://www.w3.org/2001/XMLSchema"
target="_blank">"http://www.w3.org/2001/XMLSchema"</a>"
" ) <br>
oOutText.WriteString("xmlns:xsi="<a
moz-do-not-send="true"
href="http://www.w3.org/2001/XMLSchema-instance"
target="_blank">"http://www.w3.org/2001/XMLSchema-instance"</a>">"
& Chr(10)) <br>
<br>
oOutText.WriteString("<templates>" &
Chr(10)) <br>
oOutText.WriteString(" <group
oor:name=""Parameter"">" & Chr(10)) <br>
oOutText.WriteString(" <prop
oor:name=""ParameterName"" oor:type=""xs:string""/>"
& Chr(10)) <br>
oOutText.WriteString(" <prop
oor:name=""ParameterString""
oor:type=""xs:string""/>" & Chr(10)) <br>
oOutText.WriteString(" </group>" & Chr(10))
<br>
oOutText.WriteString("</templates>" &
Chr(10)) <br>
<br>
oOutText.WriteString("<component>" &
Chr(10)) <br>
oOutText.WriteString(" <set
oor:name=""Parameters""
oor:node-type=""Parameter""/>" & Chr(10)) <br>
oOutText.WriteString("</component>" &
Chr(10)) <br>
<br>
oOutText.WriteString("</oor:component-schema>"
& Chr(10)) <br>
<br>
oOutText.closeOutput() <br>
oOutStream.closeOutput <br>
endif <br>
<br>
end sub <br>
<br>
sub addParameter(aSettings as Object, ParameterName as
String, ParameterString as String) <br>
<br>
Dim arParameters1(0) As new
com.sun.star.beans.PropertyValue <br>
arParameters1(0).Name = ParameterName <br>
arParameters1(0).Value = ParameterString <br>
call setParameters(aSettings, arParameters1(0)) <br>
<br>
end sub <br>
<br>
function getParameterCount(aSettings as Object) as long
<br>
getParameterCount = UBound(aSettings.ElementNames)+1 <br>
end function <br>
<br>
<br>
<br>
sub setParameters(aSettings as Object, aNewValue as
Object) <br>
if aSettings.hasbyName(sElementnaam) then<br>
'print aNewvalue.name<br>
oParameter = aSettings.createInstance() <br>
oParameter.ParameterName = aNewValue.Name <br>
oParameter.ParameterString = aNewValue.Value <br>
<br>
aSettings.ReplaceByName(sElementNaam , oParameter) <br>
<br>
aSettings.commitChanges() <br>
else<br>
oParameter = aSettings.createInstance() <br>
oParameter.ParameterName = aNewValue.Name <br>
oParameter.ParameterString = aNewValue.Value <br>
<br>
aSettings.insertByName(sElementNaam , oParameter) <br>
aSettings.commitChanges() <br>
endif<br>
<br>
end sub <br>
</div>
</div>
<blockquote type="cite">Hi everybody,
<div>
<div class="h5"><br>
<br>
I'm hacking the cross-platform filepicker (in
fpicker/source/office). I added a "Places" (bookmarks)
list on the left and I would like to save the entries
that the user bookmarked .<br>
<br>
Cedric Bosdonnat told me to look at xcu and xcs files,
but I'm a bit lost. I'm looking for a code sample
where user's persistent configuration is manipulated
(read and written) and/or anything that can be
usefull, like search keywords, links to old threads in
the mailing list, which would help me to identify some
good practices (naming conventions, for instance).<br>
<br>
Cheers,<br>
Martin Richard<br>
<br>
<fieldset></fieldset>
<br>
</div>
</div>
<div class="im">
<pre>_______________________________________________
LibreOffice mailing list
<a moz-do-not-send="true" href="mailto:LibreOffice@lists.freedesktop.org" target="_blank">LibreOffice@lists.freedesktop.org</a>
<a moz-do-not-send="true" href="http://lists.freedesktop.org/mailman/listinfo/libreoffice" target="_blank">http://lists.freedesktop.org/mailman/listinfo/libreoffice</a>
</pre>
</div>
</blockquote>
<br>
<br>
</div>
<br>
_______________________________________________<br>
LibreOffice mailing list<br>
<a moz-do-not-send="true"
href="mailto:LibreOffice@lists.freedesktop.org">LibreOffice@lists.freedesktop.org</a><br>
<a moz-do-not-send="true"
href="http://lists.freedesktop.org/mailman/listinfo/libreoffice"
target="_blank">http://lists.freedesktop.org/mailman/listinfo/libreoffice</a><br>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
Martin Richard<br>
<a moz-do-not-send="true" href="http://www.martiuweb.net"
target="_blank">www.martiusweb.net</a><br>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LibreOffice mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LibreOffice@lists.freedesktop.org">LibreOffice@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freedesktop.org/mailman/listinfo/libreoffice">http://lists.freedesktop.org/mailman/listinfo/libreoffice</a>
</pre>
</blockquote>
<br>
</body>
</html>