Bug 88947 - : Macros disabled by 4.403
Summary: : Macros disabled by 4.403
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.4.0.3 release
Hardware: Other All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-30 15:10 UTC by James A. Schulz
Modified: 2017-08-23 11:48 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James A. Schulz 2015-01-30 15:10:14 UTC
I have two macros which allow me to assign PgUp and PgDn to the page up and page down functions in the navigator window (which function is nowhere listed in the Customization dialog).  Below is the code for my PgUp macro:

REM  *****  BASIC  *****

Sub Main

End Sub


sub PgDn
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 = "Navigator"
args1(0).Value = true

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

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

dispatcher.executeDispatch(document, ".uno:ScrollNextPrev", "", 0, args2())

rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "Navigator"
args3(0).Value = false

dispatcher.executeDispatch(document, ".uno:Navigator", "", 0, args3())


end sub


sub PgUp
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 = "Navigator"
args1(0).Value = true

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

rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "ScrollNextPrev"
args2(0).Value = false

dispatcher.executeDispatch(document, ".uno:ScrollNextPrev", "", 0, args2())

rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "Navigator"
args3(0).Value = false

dispatcher.executeDispatch(document, ".uno:Navigator", "", 0, args3())


end sub


My problem could be easily fixed if you would simply add the action in question (which puts the top of the previous page at the top of the viewport for PgUp, and similarly puts the top of the next page at the top of the viewport for PgDn)
in the Function window of the Keyboard tab of the Customize dialog.  I've reported that this function is missing from that list several times over a period of years with no result.
Comment 1 Robinson Tryon (qubit) 2015-02-08 12:59:43 UTC
(In reply to James A. Schulz from comment #0)
> I have two macros which allow me to assign PgUp and PgDn to the page up and
> page down functions in the navigator window
> ...
> My problem could be easily fixed if you would simply add the action ...
> I've
> reported that this function is missing from that list several times over a
> period of years with no result.

So did this code work for you in the past with a previous version of LibreOffice, or are you just asking for an enhancement request?

Status -> NEEDINFO

(please change status back to UNCONFIRMED after you reply. Thanks!)
Comment 2 James A. Schulz 2015-02-08 14:27:43 UTC
Yes, I included the code from the macro that worked in 4.2.
>
> The problem is that the various actions under Navigator need to be
> regularized.
>
> I tried remaking the macro, given the Navigator in 4.4.  There are two sets
> actions that do what I want, i.e. put the top of the next (or previous) page
> at the top of the viewport, but only one of these sets works in a macro.
> The first set is visible in the Navigator in the sidebar.  Their hints are
> "Next page" and "Previous page"  I really don't know how to describe their
> icons, but they're located between the top (horizontal) row between the
> little navigator star and the increment/decrement textbox.  They do what I
> want when I click on them, but they do not work in a macro.  However, if
> instead of using these two buttons, I click on the little navigator icon
> (four pointed star) just to their left (not the larger one on the far right
> of the sidebar), that pops up a small dialog showing two rows of icons.
> Those on the far right of each row (an up arrow and a down arrow) have the
> same hints as previously, and they do the same actions (i.e. the ones I
> want) and they are recorded in a macro.  So that's good, but it was a
> needless nuisance to work out.
>
> That's why I have recommended in the past and I do so again that if you
> would simply add the kind of pgdn and pgup actions I prefer (again, those
> that put the top of the next or previous page at the top of the view port)
> in the list of Navigator functions in the Customize window so that I could
> assign them to the appropriate keys without using a macro.
>
> Thanks,
>
> JAS
Comment 3 Robinson Tryon (qubit) 2015-02-09 14:01:46 UTC
(In reply to James A. Schulz from comment #2)
> Yes, I included the code from the macro that worked in 4.2.
> >

Okay, so there's some regression/functionality change going on here.

> > The problem is that the various actions under Navigator need to be
> > regularized.
> >
> > I tried remaking the macro, given the Navigator in 4.4.  There are two sets
> > actions that do what I want, i.e. put the top of the next (or previous) page
> > at the top of the viewport, but only one of these sets works in a macro.
> > The first set is visible in the Navigator in the sidebar.  Their hints are
> > "Next page" and "Previous page"  I really don't know how to describe their
> > icons, but they're located between the top (horizontal) row between the
> > little navigator star and the increment/decrement textbox.  They do what I
> > want when I click on them, but they do not work in a macro.  However, if
> > instead of using these two buttons, I click on the little navigator icon
> > (four pointed star) just to their left (not the larger one on the far right
> > of the sidebar), that pops up a small dialog showing two rows of icons.
> > Those on the far right of each row (an up arrow and a down arrow) have the
> > same hints as previously, and they do the same actions (i.e. the ones I
> > want) and they are recorded in a macro.  So that's good, but it was a
> > needless nuisance to work out.

Okay, it sounds like
1) Functionality changed but wasn't clearly documented (?)
2) You did find a workaround, but it took a bit of digging

> > That's why I have recommended in the past and I do so again that if you
> > would simply add the kind of pgdn and pgup actions I prefer (again, those
> > that put the top of the next or previous page at the top of the view port)
> > in the list of Navigator functions in the Customize window so that I could
> > assign them to the appropriate keys without using a macro.

Hmmm, so this part sounds like an enhancement request. As the other part sounds like you've mostly resolved it, I'm going to hand this bug over to ux-advise and see if they have thoughts re: adding this capability.

Component -> ux-advise
Status -> NEW
severity -> enhancement
Comment 4 Niklas Johansson 2015-02-09 15:43:00 UTC
Hi James

Thanks for the report. If I understand you correctly, let me know if I don't. 
It seems to me that the commands you've been asking about is present in LibreOffice 4.4. I do not know when the were added but suspect that it was at the same time as you macro stopped working. ;)

Go to Tools -> Customize...
Select the Keyboard tab
You'll find the commands in the category Navigate
The functions are called
- To Begin of Next Page
- To Begin of Previous Page

Isn't that what you actually ask for at the end of your first comment?
Comment 5 James A. Schulz 2015-02-09 17:34:28 UTC
Niklas,

No, neither of those functions (To Begin of Next/Previous Page) puts the top of the page in question at the top of the viewport.  They just move the insertion point.

The thing that is frustrating (to me) about this is that the code for the functions I want to use already exists (else the buttons I describe wouldn't do what they do).  All that is need is to give those functions a name and add them to the Navigator Functions list in the Customize dialog.
Comment 6 Niklas Johansson 2015-02-10 11:35:15 UTC
Sorry for not paying attention to the details. Personally I'd prefer to see that the commands I mentioned in Comment 4 would act the way that you prefer. I mean if I want to go to the start of the next/previous page I want it to be shown at the top of the viewport and not at the center as the case is now.

About your code snippet, you should get the same results using the following.

Sub PgDn
	doDispatch ".uno:ScrollToNext", Array()
End Sub

Sub PgUp
	doDispatch ".uno:ScrollToPrevious", Array()
End Sub

Function doDispatch(sUnoCmd As String, Args As Variant)
Dim oFrame As Object
Dim oDispatcher As Object
	oFrame = ThisComponent.CurrentController.Frame
	oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
	oDispatcher.executeDispatch(oFrame, sUnoCmd, "", 0, Args)
End Function

Note however that the function you are using is depending on what type of navigation object that is selected in the navigator so, you cannot be 100% sure that the next object is the next page, it could just as well be the next table. I'm sorry to say that I do not know how to select the object to navigate by through basic.
Comment 7 Robinson Tryon (qubit) 2016-08-25 04:44:52 UTC Comment hidden (obsolete)
Comment 8 Heiko Tietze 2017-08-23 11:48:10 UTC
Would say the question has been answered, and it's rather not a UX question too. Where next page should land at is in discussion at bug 101211.