shortcuts in Libreoffice plugin

First off, congratulations to the developers for the new version. It brings a number of improvements to my work.

One thing I can't figure out is how I can set keyboard shortcuts in libreoffice, for instance, to add or edit citations. My old shortcuts don't work anymore. In the LO-shortcut-menu I used to find the Zotero-functions in the macros-section, but they seem to have disappeared from there and I can't find it anywhere else. Can anyone point me in the right direction?
  • I have that same problem with Zotero 2.1 in OpenOffice 3.2. A solution would be highly appreciated!
  • edited March 19, 2011
    We're not using macros anymore as of OpenOffice.org Integration 3.5. For now, you could potentially create macros containing the code:

    createUnoService("org.zotero.integration.ooo.ZoteroOpenOfficeIntegration").trigger("addCitation")

    (where "addCitation" can also be "editCitation", "addBibliography", "editBibliography", "refresh", "setDocPrefs", or "removeCodes"). I'll investigate assigning shortcuts to the toolbar functions by default.
  • edited March 21, 2011
    Thanks! It would be nice to have an easy way for assigning shortcuts again. I'll see if I can figure out how to apply your suggested work-around. I suppose the cut-off code line ended with ...addCitation") and nothing else?

    edit: I figured it out. Thanks again.
  • edited May 10, 2011
    Hi Gitty K or anybody else!
    Can you enlighten me? My coding experience with OpenOffice is minimal. Where do I paste the createUnoService? What should be before and after the createUnoService line of code?
    Can anybody help?
    Thanks!
  • edited May 10, 2011
    I think, I did the following (I'm translating menu options from German into English, so they might be slightly different in an English installation of LO):

    * go to Extras (Tools??) > Macros > Manage Macros > Libreoffice Basic
    * single-click "Standard" in the left pane, then choose "Manage", then choose "New" in the newly opened window. Type in a name for the makro, e.g. InsertCitation
    * you should be back at the Manage Macros Window then. Have the newly created Macro highlighted and click "Change"
    * an editor should pop up with the following three lines:
    REM ***** BASIC *****

    Sub Main

    End Sub

    * paste Simon's command line between the last two lines. It's cut-off in the above post and should end with "...addCitation")"
    REM ***** BASIC *****

    Sub Main
    createUnoService("org.zotero.integration.ooo.ZoteroOpenOfficeIntegration").trigger("addCitation")
    End Sub

    * click the save-icon and close the window.
    * you can now assign short-cuts to the created macro

    I'm not sure if there are better or more elegant ways for this. I just played around without knowing what I'm doing and this did the trick for me.
  • edited May 10, 2011
    Thank you - blazing fast response!
    It works now (Mac 10.6.7 - Libreoffice 3.3.1 - Firefox 4 - Zotero 2.1.6 - Zotero OpenOffice Integration 3.5a1)...

    something to add to your instructions ... after changing the code ...
    I had to
    * click the compile-icon
    * click the save-icon (was greyed out without clicking the compile-icon)
  • This worked brilliantly for me. Thanks very much. Might be nice to make it a little easier for future releases though!
  • Worked for me -- thanks! This shouldn't be so hard, however, and I'd suggest that the word processing integration ship with a pre-built keyboard shortcut for every one of its functions.
  • The Word plugins have keyboard shortcuts, but I spent a couple days trying to figure out how to add a keyboard shortcut to a LibreOffice extension and came up empty-handed...
  • Ah, okay. The next best thing, then, would be an official tutorial that describes Gitty K's solution and provides the equivalent code for the other functions...
  • Can the macros be bundled with the extension? Then thee tutorial would just have to cover assigning shortcuts.
  • Are they not? They should be.
  • They are. Sorry for the false alarm; I misinterpreted anark and Gitty's remarks above. It's really easy to add a shortcut:
    1. Open Tools->Customize...
    2. Click on the key to you want to use, from the list of assignable keys in the top portion of the dialog.
    3. Find the appropriate Zotero macro in the bottom part of the dialog. The macros are in LibreOffice Macros -> user -> Zotero -> Zotero. Click on the desired action in the list (probably ZoteroAddCitation)
    4. Click the "Modify" button.
    5. Click "OK" and enjoy!
  • Here on my Win 7 computer the method outlined by ajlyon doesn't work. There seems to be no zotero macros at 'LibreOffice Macros -> user -> Zotero'. Or does this only work with older versions of Zotero as hinted above?
  • which version of Libre Office? This works with Zotero 3.0.3 and the 3.5.2 LO integration, i.e. the most recent versions.
    Are you using a non-English version of LO? It's possible that one of the folders would be named differently.
  • Ajlyon's instructions are now here:
    http://www.zotero.org/support/word_processor_plugin_shortcuts
    adding other word processors would be very welcome.
  • I understand that this is a six year-old question, but google brought me here seeking an answer to this very question, so I'll add an update on how I solved it.

    Using LibreOffice 5.3.3.2 on Windows 7x64 with Zotero 4.0.29.21 in Firefox 52 and Zotero LibreOffice Plugins 3,5,12...

    The LibreOffice macros that some of the prior answers say to create now exist already. See Menu -> Tools -> Macros -> Edit Macros, then expand My Macros -> Standard -> Zotero -> Zotero and you'll see macros for all of the functions that are available on the toolbar buttons.

    To assign them to keys, use Menu -> Tools -> Customise, click 'Keyboard' tab. Click in the top 'Shortcut Keys' frame, then press the key combination you wish to assign. Then in the bottom left half 'Functions, Category' of that dialogue, expand LibreOffice Macros -> user -> Zotero -> Zotero, select the macro you wish to assign from the middle 'Function' box, and with the key combination highlighted in the top window and the macro of choice highlighted in the middle/lower window, click the 'Modify' button at top-right in the dialogue box.

    Just like that, the key combo is assigned.

    To apply more, wash, rinse, repeat.

    I hope this helps someone! :-)

    Best,

    G
  • And I can confirm that the solution of geoffb works nicely in Aug 2019 in MacOS Mojave 10.14.6, and LibreOffice 6.2.5.2. Thanks!
  • I came in to say thank you to geoffb for their awesome tip that works like a charm in LibreOffice writer 7.2.7 on a macOS Monterey.
Sign In or Register to comment.