https://bugs.documentfoundation.org/show_bug.cgi?id=160580

--- Comment #12 from [email protected] ---
(In reply to geoff183 from comment #10)
> The new behavior is aligned with other common UX designs. e.g these
> applications also wrap around: xfce4-terminal, firefox, GIMP, thunar... I'm
> sure there are plenty more. I also preferred the previous way This sort of
> change probably won't be reverted or given an option.
> 
> I found this code snippet which selects the 3rd sheet:
> 
>   dim document   as object
>   dim dispatcher as object
>   document   = ThisComponent.CurrentController.Frame
>   dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
>   dim args1(0) as new com.sun.star.beans.PropertyValue
>   args1(0).Name = "Nr"
>   args1(0).Value = 3
>   dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args1())
> 
> If you are motivated enough, you could make a macro triggered with two
> keyboard shortcuts to do something like this:
> 
>   alt-pgup
>   if current_sheet != 1
>     goto current_sheet-1
> 
>   alt-pgdn
>     get max_number_of_sheets
>     if current_sheet != max_number_of_sheets
>       goto current_sheet+1

Thanks - it turns out that yes I am motivated enough - it just hadn't occurred
to me to fix it that way!

In case it's of use to anybody else at all, here are four macros which can a/
Return the ToNextSheet/ToPreviousSheet to their 'classic' behaviour, and b/
Provide the GotoFirst/GotoLast behaviour that others asked for.
All can be bound to whatever keystrokes are preferred!

REM  *****  BASIC  *****
sub ToNextSheet_classic
        ' Select next worksheet but DON'T wrap (ie as prior to v24.2)
        dim document   as object
        dim dispatcher as object
        document   = ThisComponent.CurrentController.Frame
        dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

        dim iSmax as Integer
        dim iSindex as Integer
        iSmax=ThisComponent.Sheets.count - 1
        iSIndex=Thiscomponent.CurrentController.ActiveSheet.RangeAddress.Sheet
        if iSIndex < iSmax then
                dispatcher.executeDispatch(document, ".uno:JumpToNextTable",
"", 0, Array())
        end if
end sub
sub ToPreviousSheet_classic
        ' Select previous worksheet but DON'T wrap (ie as prior to v24.2)
        dim document   as object
        dim dispatcher as object
        document   = ThisComponent.CurrentController.Frame
        dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

        dim iSindex as Integer
        iSIndex=Thiscomponent.CurrentController.ActiveSheet.RangeAddress.Sheet
        if iSIndex > 0 then
                dispatcher.executeDispatch(document, ".uno:JumpToPrevTable",
"", 0, Array())
        end if
end sub
sub ToFirstSheet
        ' Select first worksheet
        dim document   as object
        dim dispatcher as object
        document   = ThisComponent.CurrentController.Frame
        dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

        dim args1(0) as new com.sun.star.beans.PropertyValue
        args1(0).Name = "Nr"
        args1(0).Value =1
        dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0,
args1())        
end sub
sub ToLastSheet
        ' Select last worksheet
        dim document   as object
        dim dispatcher as object
        document   = ThisComponent.CurrentController.Frame
        dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

        dim iSmax as Integer
        iSmax=ThisComponent.Sheets.count
        dim args1(0) as new com.sun.star.beans.PropertyValue
        args1(0).Name = "Nr"
        args1(0).Value = iSmax
        dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0,
args1())        
end sub

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to