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

Changing properties of Window View in Calc

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


Joined: 04 Jun 2005
Posts: 24

PostPosted: Mon Jan 16, 2006 5:39 pm    Post subject: Changing properties of Window View in Calc Reply with quote

Hello

How can I turn on and turn off Horizontal and Vertical scroll bars and also Sheet Tabs ?

I'd like start my Calc document without its, but when I close it, I should restore previous properties of Window view.

Is there a way for check current view properties when I start my document and restore them when I close it ?

Thanks for any ideas.
Dezet
Back to top
View user's profile Send private message
noranthon
Super User
Super User


Joined: 07 Jul 2005
Posts: 3318

PostPosted: Mon Jan 16, 2006 9:08 pm    Post subject: Reply with quote

/Tools /Options /OpenOffice.org Calc /View : Window.
Back to top
View user's profile Send private message
dezet
General User
General User


Joined: 04 Jun 2005
Posts: 24

PostPosted: Tue Jan 17, 2006 8:00 am    Post subject: Reply with quote

Hello

Thanks noranthon, but I would like to do it with macro. Smile

First problem is turning on and turning off scroll bars.
I suppose, it is possible with Dispatcher, such like for Rows and Columns:
Code:
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ViewRowColumnHeaders"
args1(0).Value = true      ' or false for invisible

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

The Dispatcher has commands: HScrollbar and VScrollbar but I don't know what are arguments of them, because
Code:
args1(0).Name = "VScrollbar"
args1(0).Value = true
dispatcher.executeDispatch(document, ".uno:VScrollbar ", "", 0, args1())
doesn't work.
How can I use VScrollbar (HScrollbar) command ?
Maybe I should use another commands for turn on and turn off scroll bars ?

Have you any idea, how to do it ?

Dezet
Back to top
View user's profile Send private message
noranthon
Super User
Super User


Joined: 07 Jul 2005
Posts: 3318

PostPosted: Wed Jan 18, 2006 3:35 am    Post subject: Reply with quote

Sorry, got my forums mixed up.Embarassed
Code:
ThisComponent.CurrentController.HasHorizontalScrollBar = false
ThisComponent.CurrentController.HasSheetTabs = false
ThisComponent.CurrentController.HasVerticalScrollBar = false
Back to top
View user's profile Send private message
dezet
General User
General User


Joined: 04 Jun 2005
Posts: 24

PostPosted: Wed Jan 18, 2006 6:09 am    Post subject: Reply with quote

Hi

Thanks a lot, noranthon.
It works great.
In this way I may also check those properties, that's it. Very Happy

I can turn on and turn off Tool Bar with Dispatcher:
Code:
args(0).Name = "ToolBarVisible"
args(0).Value = true ' or false
dispatcher.executeDispatch(document, ".uno:ToolBarVisible", "", 0, args())


Is there a way for do it without Dispatcher, alike as in your example ?
I hope, this way also will allow me to check this property.

Dezet
Back to top
View user's profile Send private message
noranthon
Super User
Super User


Joined: 07 Jul 2005
Posts: 3318

PostPosted: Wed Jan 18, 2006 10:24 pm    Post subject: Reply with quote

The answer does not exactly spring out at you. The following does not work but was as close as I could get to the method that seems to be required:
Code:
ThisComponent.CurrentController.Frame.LayoutManager.isElementVisible( "private:resource/toolbar/standard" ) = false

From the SDK: A resource URL must meet the following syntax: "private:resource/$type/$name". It is only allowed to use ascii characters for type and name. Evil or Very Mad
Back to top
View user's profile Send private message
dezet
General User
General User


Joined: 04 Jun 2005
Posts: 24

PostPosted: Fri Jan 20, 2006 4:36 pm    Post subject: Reply with quote

Thank you noranthon. Your advices were really helpful.

Regards
Dezet Very Happy
Back to top
View user's profile Send private message
noranthon
Super User
Super User


Joined: 07 Jul 2005
Posts: 3318

PostPosted: Fri Jan 20, 2006 10:04 pm    Post subject: Reply with quote

I cannot work out how to make the toolbar visible or not but this tests visibility:
Code:
ThisComponent.CurrentController.Frame.LayoutManager.isElementVisible( "private:resource/toolbar/standardbar" )

You can test that code with:
Code:
Msgbox( ThisComponent.CurrentController.Frame.LayoutManager.isElementVisible( "private:resource/toolbar/standardbar" ) )

I happened to chance on the correct name in another thread and confirmed it with Xray. Adding ( false ) to the first line should make the toolbar disappear but Basic won't have it - it won't accept all those parentheses.
Back to top
View user's profile Send private message
noranthon
Super User
Super User


Joined: 07 Jul 2005
Posts: 3318

PostPosted: Fri Jan 20, 2006 10:29 pm    Post subject: Reply with quote

This is what happens when you speak too soon. The methods (don't know why I didn't see them) are hideElement and showElement. Thus:
Code:
ThisComponent.CurrentController.Frame.LayoutManager.hideElement( "private:resource/toolbar/standardbar" )
Twisted Evil
Back to top
View user's profile Send private message
dezet
General User
General User


Joined: 04 Jun 2005
Posts: 24

PostPosted: Sat Jan 21, 2006 8:18 am    Post subject: Reply with quote

It works great.
Thanks.

Where can I find names of toolbars (or all elements) to use in this macro ?
Back to top
View user's profile Send private message
noranthon
Super User
Super User


Joined: 07 Jul 2005
Posts: 3318

PostPosted: Mon Jan 23, 2006 2:42 am    Post subject: Reply with quote

I think the best way is with Xray. The SDK seems to list the types only. The elements you can read are the visible elements. The spreadsheet I have open lists 3: the standard toolbar, the menubar and the statusbar, in that order. If you want to read others, you'll need to make them visible first.

This line will get you the url of the first element:
Code:
Msgbox( ThisComponent.CurrentController.Frame.LayoutManager.Elements( 0 ).ResourceURL )

Of course, without Xray, you won't know how many elements. I believed there was a property .Count but it seems not.
The link for the latest SDK is http://download.openoffice.org/680/sdk.html
The link for Xray is http://www.ooomacros.org/dev.php#101416
Because of a flaw in OO2.0.1, you need to amend line 6 in module Mod4: http://www.oooforum.org/forum/viewtopic.phtml?t=30018 and http://www.oooforum.org/forum/viewtopic.phtml?t=30533 Shocked
Back to top
View user's profile Send private message
dezet
General User
General User


Joined: 04 Jun 2005
Posts: 24

PostPosted: Mon Jan 23, 2006 5:42 pm    Post subject: Reply with quote

Thanks. I will try to do it in this way.

Regards
Dezet
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