Page 1 of 1

Read only mode

Posted: Mon Jul 28, 2008 8:33 am
by antonz
Good afternoon
There is a problem to block the document (to translate in a mode only reading) by means of macros (i.e. duplicate work of property of the menu service-parameters-security-set password). Somebody can faced a similar problem or even knows from what it is necessary to begin?

Re: Read only mode

Posted: Mon Aug 04, 2008 9:22 pm
by pdjota
Hello, I have the same problem, I'd like to catch the opening event of a Document and if it complies with certain constraints open iot in read-only mode.
Did you solve your problem?
TIA

Re: Read only mode

Posted: Mon Aug 04, 2008 10:11 pm
by pdjota
Hi again, I finded a post in the old forum which solves the problem with OOBasic, now I'm figuring out how to translate it into Java.

Code: Select all

Sub SetReadOnly
	dim url as string
	dim document as object
	dim dispatcher as object
	
	document=thisComponent
	url=document.getUrl
	
	GlobalScope.BasicLibraries.LoadLibrary("Tools")
	
	if getAttr(url)<>1 then	
		dispatcher=createUnoService("com.sun.star.frame.DispatchHelper")
		setattr(url,1) //readonly mode.
		dispatcher.executeDispatch(thisComponent.CurrentController.Frame,".uno:Reload","",0,array())
	end if 
End Sub
http://www.oooforum.org/forum/viewtopic.phtml?t=65973