OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Store setting for my extensiion

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
lx
General User
General User


Joined: 15 Apr 2012
Posts: 22

PostPosted: Thu Jun 07, 2012 1:37 am    Post subject: Store setting for my extensiion Reply with quote

How to do that? I want store setting(changes) for my extension between user session(after office will closed and open again)
Back to top
View user's profile Send private message
lx
General User
General User


Joined: 15 Apr 2012
Posts: 22

PostPosted: Thu Jun 07, 2012 4:16 am    Post subject: Reply with quote

solution:

store setting in file inside deployed extenssion

function pfi_settings_get_location
pfi_settings_get_location = pfi_extension_location+IDE_SETTINGS_FILE_NAME
end function

function pfi_settings_get_host
_path = pfi_settings_get_location

if not fileexists(_path) then
pfi_settings_get_host = PFD_DEFAULT_HOST
exit function
end if

_fileno = freefile
_line = ""

open _path for input as _fileno
line input #_fileno, _line
close #_fileno

pfi_settings_get_host = _line
end function

sub pfi_settings_set_host(_host)
_path = pfi_settings_get_location

if fileexists(_path) then
kill(_path)
end if

_fileno = freefile

open _path for output as #_fileno
print #_fileno, _host
close #_fileno
end sub

function pfi_extension_location
_provider = getdefaultcontext.getbyname("/singletons/com.sun.star.deployment.PackageInformationProvider")
pfi_extension_location = _provider.getpackagelocation("com.pack")
end function
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group