Maximize Window in macro

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
User avatar
kapbepucm
Posts: 9
Joined: Fri Feb 13, 2009 12:41 pm
Location: Latvia

Maximize Window in macro

Post by kapbepucm »

How to maximize window, using a macro? Without using WindowsAPI
Last edited by kapbepucm on Fri Feb 13, 2009 1:28 pm, edited 3 times in total.
OOo 3.0.X on Ms Windows XP + Ubuntu 8.10
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Maximize Window in macro

Post by Villeroy »

The position and size of the WIndow is outside the scope of the office-API. OOo is platform independent. Under WIndows you can call the Windows-API from Basic, but that's not what you want.
A recorded macro dispatching menu:View>Full Screen

Code: Select all

sub FullScreen()
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "FullScreen"
args1(0).Value = true

dispatcher.executeDispatch(document, ".uno:FullScreen", "", 0, args1())


end sub
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
kapbepucm
Posts: 9
Joined: Fri Feb 13, 2009 12:41 pm
Location: Latvia

Re: Maximize Window in macro

Post by kapbepucm »

Villeroy wrote:The position and size of the WIndow is outside the scope of the office-API.

Code: Select all

thisComponent.CurrentController.Frame.ContainerWindow.setPosSize(0,0,750,550,15)
Is it "outside the scope of the office-API"?
OOo 3.0.X on Ms Windows XP + Ubuntu 8.10
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Maximize Window in macro

Post by Villeroy »

kapbepucm wrote:Is it "outside the scope of the office-API"?
OK, you are right. It can set it's position and size without knowing anything about the availlable size of the output device(s).
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
kapbepucm
Posts: 9
Joined: Fri Feb 13, 2009 12:41 pm
Location: Latvia

Re: Maximize Window in macro

Post by kapbepucm »

I know my availlable size of the output device. (800X600) But anyway [setPosSize] does not do so, as the WindowsAPI.
What should I do in Ubuntu? :?:
OOo 3.0.X on Ms Windows XP + Ubuntu 8.10
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Maximize Window in macro

Post by Villeroy »

Code: Select all

    thisComponent.CurrentController.Frame.ContainerWindow.setPosSize(0,0,750,550,15)
works if the window is not maximized.

That has been discussed frequently on oooforum.org.
http://www.oooforum.org/forum/search.phtml
Search for all keywords "maximize window" in the API-forum.
kapbepucm wrote:What should I do in Ubuntu? :?:
Let the user arrange his workspace :?:
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
kapbepucm
Posts: 9
Joined: Fri Feb 13, 2009 12:41 pm
Location: Latvia

Re: Maximize Window in macro

Post by kapbepucm »

That has been discussed frequently on oooforum.org.
http://www.oooforum.org/forum/search.phtml
Search for all keywords "maximize window" in the API-forum.
They say that this is not possible. :evil:
OOo 3.0.X on Ms Windows XP + Ubuntu 8.10
Post Reply