Page 1 of 1

[Solved] Macro to turn on the document navigator

Posted: Sun Feb 19, 2017 5:05 am
by eminkovitch
Hi, has anyone tried to automate this? You can do it from the View Sidebar menu, then click on Navigator icon. Useless steps, but I can't find any way to automate this. It can't capture the macro for this task. I got as far as turning the sidebar on and off. Can anyone shed any light on how to go further, and turn on the document nav?

Thanks very much indeed.
Eliot

Re: Macro to turn on the document navigator

Posted: Sun Feb 19, 2017 5:27 am
by robleyd
You can use F5 to toggle a floating Navigator window, of course.

Is your problem that you want the Navigator to be visible when you open a document? You can do this with the floating window if you have it open when you close AOO - it should then be visible when next you open an AOO document.

Re: Macro to turn on the document navigator

Posted: Sun Feb 19, 2017 5:28 am
by FJCC
Sorry, I don't understand how a macro will help in this case. The Navigator can be accessed with the key F5, from the menu View -> Navigator, from an icon on the main tool bar, or from the side bar. Once it is opened with any of those methods, it can be docked at the left or right edge of the window just by dragging it to that location and then it will be permanently visible. If a macro were created to open it, I don't see how it would be more convenient than one of those options. What am I missing?

Re: Macro to turn on the document navigator

Posted: Sun Feb 19, 2017 5:32 am
by eminkovitch
Thanks for your reply. My use case is that some documents require a navigator and others do not, and I waste time looking for it and switching it on or off. Macro would be perfect for this - I have made one that opens the sidebar, or closes, depending on the document. Works nicely, but I can't find anything that would manipulate the navigator itself. Do you have any clues?

Cheers
Eliot

Re: Macro to turn on the document navigator

Posted: Sun Feb 19, 2017 5:36 am
by eminkovitch
FJCC wrote:Sorry, I don't understand how a macro will help in this case. The Navigator can be accessed with the key F5, from the menu View -> Navigator, from an icon on the main tool bar, or from the side bar. Once it is opened with any of those methods, it can be docked at the left or right edge of the window just by dragging it to that location and then it will be permanently visible. If a macro were created to open it, I don't see how it would be more convenient than one of those options. What am I missing?
Well, I wish it would be that simple. Unfortunately, the navigator does not stay in place. If a document is open with a navigator on, and you open another doc from it, it will also have an open nav (and vice-versa). What if you don't want a nav on that document? You have to go and close the sidebar. A macro helps automate this, it would run on document open event, and each document would have it's option to open or close the nav on opening.
cheers
Eliot

Re: Macro to turn on the document navigator

Posted: Sun Feb 19, 2017 10:00 am
by RoryOF
How is the second document to know that you do not want the sidebar? You have to tell it. It may be easier to map the sidebar switch to a key and use that key to turn the sidebar on/off than have some interaction with the macro to tell it that it is to run or not run.

Re: Macro to turn on the document navigator

Posted: Sun Feb 19, 2017 11:38 am
by F3K Total
Hello
eminkovitch wrote:It can't capture ...
I don't see a problem in doing that, just captured the F5 action:

Code: Select all

sub Navigator_on
    dim document   as object
    dim dispatcher as object
    dim args1(0) as new com.sun.star.beans.PropertyValue
    document   = ThisComponent.CurrentController.Frame
    dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
    args1(0).Name = "Navigator"
    args1(0).Value = true
    dispatcher.executeDispatch(document, ".uno:Navigator", "", 0, args1())
end sub

sub Navigator_off
    dim document   as object
    dim dispatcher as object
    dim args1(0) as new com.sun.star.beans.PropertyValue
    document   = ThisComponent.CurrentController.Frame
    dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
    args1(0).Name = "Navigator"
    args1(0).Value = false
    dispatcher.executeDispatch(document, ".uno:Navigator", "", 0, args1())
end sub

Re: Macro to turn on the document navigator

Posted: Sun Feb 19, 2017 5:53 pm
by eminkovitch
Thank you, that's exactly what I was looking for.