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

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 close merge delete

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 :)

( 2016-10-31 17:00:00 +0200 )edit

Sort by » oldest newest most voted

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":

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 ...
more

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.

more

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

more

Does not work in Localc/Lowriter 4.2.8.2.

( 2015-09-02 22:00:45 +0200 )edit

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

( 2015-09-03 13:34:17 +0200 )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.

( 2015-11-24 17:48:34 +0200 )edit

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

more

This is still broken in 5.1.6.2.

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

more