[Solved] Open Doc invisible and make it visible if prepared

The Application Programming Interface and the OASIS Open Document Format

[Solved] Open Doc invisible and make it visible if prepared

Postby Peter18 » Wed Oct 12, 2011 5:54 pm

A friendly hallo to anybody,

I would like to open a Doc invisible. ( Par[0].Name := 'Hidden'; Par[0].Value := True;) Then I want to prepare it and make it visible. If possible I want to bring the Window on top of the others.

Greetins and have a nice day

Peter
Last edited by Peter18 on Thu Oct 13, 2011 10:57 am, edited 1 time in total.
OpenOffice 3.3; OpenOffice 4.1.1
Peter18
 
Posts: 99
Joined: Thu May 12, 2011 1:01 pm

Re: Open a Doc invisible and make it visible if prepared

Postby JohnSUN-Pensioner » Wed Oct 12, 2011 9:52 pm

What do you want to do with hidden frame? Will be some operations with DispatchHelper? Forget! It's not working... I hope this is temporary.
About "set visible and bring to front" - see the Pitonyak's book chapters "5.41. Focus (bring to the front) a new document" and "5.45. Load hidden then setVisible"
I may not have a lot to give but what I got I'll give to you...
Apache OpenOffice 4.1.4, LibreOffice 5.4.2.2 (x64) on Windows 7
If you think that I did not answer your question, make allowances for my imperfect English
User avatar
JohnSUN-Pensioner
Volunteer
 
Posts: 761
Joined: Fri Jan 14, 2011 1:21 pm
Location: Kyiv, Ukraine

Re: Open a Doc invisible and make it visible if prepared

Postby Charlie Young » Wed Oct 12, 2011 10:23 pm

The subject of running a macro in a hidden component has come up before, and it is possible. I think the basic idea was presented by hanya.

I still have some of that code, in Basic, which runs a macro in the document, waits 5 seconds, then makes the document visible and brings it to the front.

Code: Select all   Expand viewCollapse view
Sub ManipulateHiddenDoc
   Dim oDoc
   Dim oVal(1) As New com.sun.star.beans.PropertyValue
   Dim oscriptProvider
   Dim oScript
      
   oVal(0).Name = "Hidden"
   oVal(0).Value = True
   oVal(1).Name = "MacroExecutionMode"
   oVal(1).Value = com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN
   
   oDoc = StarDesktop.loadComponentFromURL("file:///c:/tmp/a.odt", " blank", 0, oVal())
   oscriptProvider = oDoc.getScriptProvider()
   oScript = oscriptProvider.getScript("vnd.sun.star.script:Standard.Module1.MyMacro?language=Basic&location=document")
   oScript.invoke(array(), array(), array())
   Wait 5000
   oDoc.CurrentController.Frame.ContainerWindow.Visible = True
   oDoc.CurrentController.Frame.ContainerWindow.toFront()
End Sub

Apache OpenOffice 4.1.1
Windows XP
User avatar
Charlie Young
Volunteer
 
Posts: 1559
Joined: Fri May 14, 2010 1:07 am

Re: Open a Doc invisible and make it visible if prepared

Postby Peter18 » Thu Oct 13, 2011 10:57 am

Hello JohnSUN-Pensioner, hello Charlie Young,

thank you for your answers. It works :D . Why hidden frame? Well, my software is written with Delphi. So I like to prepare a doc, reading data from an other file and write it into the doc. If the doc is ready to work with, I make it visible. So you can't try to work with the doc while my prog is preparing it.

By the way, JohnSUN-Pensioner, are there more Documents with informations like this? An overview of the inteface components and its proertys and methods would be nice.

Greetings

Peter
OpenOffice 3.3; OpenOffice 4.1.1
Peter18
 
Posts: 99
Joined: Thu May 12, 2011 1:01 pm

Re: [Solved]Open a Doc invisible and make it visible if prep

Postby RoryOF » Thu Oct 13, 2011 11:39 am

Start with Andrew Pitonyak's site and documents downloadable from there; follow the references from them when you need to know more.
http://www.pitonyak.org/oo.php
Apache OpenOffice 4.1.7 on Xubuntu 18.04.3 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 29745
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland


Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 1 guest