Ask Your Question
0

Re-assign Ctrl-+ Ctrl-- as zoom-in/zoom-out shortcut globally

asked 2015-09-02 14:32:59 +0100

Ole Tange gravatar image

updated 2015-09-03 13:27:24 +0100

Alex Kemp gravatar image

I am so used to using CTRL-+ and CTRL-- as zoom-in/zoom-out that it really annoys me when an application does not use these shortcuts. LibreOffice is one that does not.

How can I globally re-assign CTRL-+ and CTRL-- as zoom-in/zoom-out?

edit retag flag offensive close merge delete

Comments

ctrl + mouse pad up/down is the default to do this. I know that this is not an answer to your question, but knowing this satisfied me when I had this same issue :)

lincolnfrias gravatar imagelincolnfrias ( 2016-10-31 17:00:00 +0100 )edit

5 Answers

Sort by » oldest newest most voted
1

answered 2019-01-17 13:57:44 +0100

tigger23 gravatar image

This is my first post. Feel free to provide feedback if need be.

TL/DR: Create macros. Assign key bindings.

Here's a work-around that accomplishes the goal of zooming in and out with the keyboard. The only catch is that not only are the built in "Zoom In" and "Zoom Out" commands broken, but it appears the "Ctrl + -" and "Ctrl + +" key bindings are broken as well (I couldn't assign any command to those key bindings successfully). I ended up choosing to use "Ctrl + 9" for zooming out and "Ctrl + 0" for zooming in as those key bindings felt as close to the key bindings I was going for as I could get. Here's what to do:

First, add the macros. Here are the two I created:

Sub ZoomIn

Dim doc As Object
Dim new_zoom_value As Integer
Dim dispatcher As Object

doc = ThisComponent.CurrentController.Frame
new_zoom_value = ThisComponent.CurrentController.viewSettings.ZoomValue + 5
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Zoom.Value"
args1(0).Value = new_zoom_value
args1(1).Name = "Zoom.ValueSet"
args1(1).Value = 28703
args1(2).Name = "Zoom.Type"
args1(2).Value = 0

dispatcher.executeDispatch(doc, ".uno:Zoom", "", 0, args1())

End Sub



Sub ZoomOut

Dim doc As Object
Dim new_zoom_value As Integer
Dim dispatcher As Object

doc = ThisComponent.CurrentController.Frame
new_zoom_value = ThisComponent.CurrentController.viewSettings.ZoomValue - 5
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Zoom.Value"
args1(0).Value = new_zoom_value
args1(1).Name = "Zoom.ValueSet"
args1(1).Value = 28703
args1(2).Name = "Zoom.Type"
args1(2).Value = 0

dispatcher.executeDispatch(doc, ".uno:Zoom", "", 0, args1())

End Sub

In short, the macros grab the current zoom value as a percentage, add or subtract 5 percentage points, then assign the new zoom value. You can alter the percentage that the macros zoom in or out by, by altering the number at the end of the "new_zoom_value" line.

To add the macros open the IDE (Tools -> Macros -> Edit Macros) and past the above code into "Module1": image description

Next, to assign the key bindings:

  1. Open the the "Customize" dialogue box (Tools -> Customize...)
  2. Make sure the "Keyboard" tab at the top of the dialogue box is selected
  3. Select the desired key binding from the "Shortcut Keys" menu. You may have to delete the existing key binding if you're replacing a key binding that already exist. The "Delete" key is on the right. Be aware of any key bindings that you are modifying but don't stress too much as any changes are completely reversible.
  4. Find the first macro you wish to assign a key binding to by selecting "Module1". It's near the bottom of the "Category" menu in the bottom-left quadrant of the dialogue box. You have to open up "LibreOffice Macros" and drill down to "Module1" (see pic below).
  5. Select the macro you want to assign to the chosen key binding and click "Modify ...
(mais)
edit flag offensive delete link more
0

answered 2017-08-15 21:31:56 +0100

This is bug 45705. This is not possible now for Calc or Writer (except for Print preview mode).

edit flag offensive delete link more
0

answered 2017-08-15 19:23:09 +0100

AnthonyC gravatar image

This is still broken in 5.1.6.2.

The shortcut can be modifed but they don't take effect (tried restart application).

edit flag offensive delete link more
0

answered 2018-09-16 19:59:25 +0100

BerenErchamion gravatar image

updated 2018-09-17 18:37:38 +0100

the aparent bug is still going in 6.0.5!. found some information about this. there is a bugzilla thread: https://bugs.documentfoundation.org/s... wich states that that the shortcuts you can assing in Tools-customize-keyboard dialog correspond to the preview mode. Browsing the options at Writer: Tools-Cusomize-keyboard-Category=view there are many possibly related Functions. 100%,150%,200%,50%,75%,Optimal,Zoom, Zoom In, Zoom Next, and others. One of the 'Zoom' options acutally opens a zoom dialog that makes it possible to select a zoom level pressing a second shortcut. a shortcut at PageWidth also works. Its not the solution, but this workaround makes the thing workable

EDIT , the day after. in Libreoffice Draw, the following works: https://defkey.com/libreoffice-draw-s... + zooms in - zooms out Num * zoom to fit entire page Num/ zooms to selected object.

to make this work in writer and calc would be of great help. maybe combining the keys with ctrl or super.

edit flag offensive delete link more
0

answered 2015-09-02 21:12:31 +0100

Alex Kemp gravatar image

updated 2015-09-03 13:30:55 +0100

In LO-4.4.4 + LO-5.0.0 you can assign those functions to those keys via the Customise dialog. One of the LO apps needs to be open before you take the steps below:

Step by Step:

  • (menu):ToolsCustomiseKeyboard tab

In Shortcut Keys:-

  • select Ctrl++ (by default assigned to 'Calculate')
  • press Delete button to remove default assignment

In Functions:-

  • select CategoryView
  • select FunctionZoom In
  • press LibreOffice option-button to apply to all of LO
    (else press Writer, or whichever App is open)
  • press Modify button to apply the Function to the Key
  • press OK to apply the shortcut
  • repeat whole sequence for Zoom Out

If this helps then please tick the answer (✔)

edit flag offensive delete link more

Comments

Does not work in Localc/Lowriter 4.2.8.2.

Ole Tange gravatar imageOle Tange ( 2015-09-02 22:00:45 +0100 )edit

Try giving a little more info; it encourage others to want to help you.

As you gave your LO version I added some extra info at the top of my reply.

Alex Kemp gravatar imageAlex Kemp ( 2015-09-03 13:34:17 +0100 )edit

I upgraded to 5.0.3.2. It still does not work. I can set the keys, but nothing happens after I press OK, and press CTRL-+ or CTRL--. I had expected the Zoom percentage in the lower right corner to change, just like it does if I do CTRL-scrollwheel.

Ole Tange gravatar imageOle Tange ( 2015-11-24 17:48:34 +0100 )edit
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2015-09-02 14:32:59 +0100

Seen: 2,967 times

Last updated: Jan 17