User:Rvojta/Multiplatform shortcuts

From Apache OpenOffice Wiki
< User:Rvojta
Revision as of 21:20, 25 February 2009 by Rvojta (Talk | contribs)

Jump to: navigation, search

OpenOffice.org violates many shortcuts on Mac OS X platform. There was an effort (accelerators01 CWS) to define all shortcuts in one place, but there isn't possibility to easily define multiplatform shortcuts. Because of these reasons macshortcuts01 CWS was introduced to fix all these issues and provide fixes for small amount of Mac OS X shortcuts to show how it can be done.

Many thanks to Stephan Bergmann, Eric Bachard, Philipp Lohmann, Carsten Driesner and others. I can't remember all people who helped me and if I missed you, I'm sorry. Feel free to drop me a note and I'll fix it.

Current State

Shortcuts Configuration

For detailed information, please read framework's article Accelerators Configuration.

It's possible to sort shortcuts with install:module attribute. But it's not possible to use install:module with xml:lang for more than one <value> pair in <prop> entry. Shortcut definition example:

<node oor:name="F11" oor:op="replace">
  <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
    <value xml:lang="en-US">.uno:DesignerDialog</value>
  </prop>
</node>

Example above defines F11' key as a shortcut for .uno:DesignerDialog (stylist window).

Modifiers Support

KeyModifier constant group supports SHIFT, MOD1 and MOD2 only. These modifiers are assigned as:

SHIFT Shift on all platforms

MOD1 Ctrl on Windows, UNIX and Cmd on Mac OS X

MOD2 Alt on all platforms

As you can see, there's no support for Windows key (Windows, Linux) and Ctrl key (Mac OS X). Ctrl key is needed for some shortcuts on Mac OS X and needs to be introduced.

Enhancement

Shortcuts Definition

We propose to have possibility to use install:module with more than one <value> pair and xml:lang defined. It's possible now and you can define multiplatform shortcut in this way:

<node oor:name="F11" oor:op="replace">
 <prop oor:name="Command"><value xml:lang="x-no-translate" install:module="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
  <value xml:lang="en-US" install:module="unxwnt">.uno:DesignerDialog</value>
 </prop>
</node>

Example above defines F11 key as a shortcut for .uno:DesignerDialog on Unix and Windows platforms. Where and how is unxwnt install:module value defined / handled is described below.

As you can see, there's also special install:module value x-no-translate. You have to use it for <value> pair with xml:lang="x-no-translate" attribute if you use install:module because it's not possible to have <value> pairs with and without install:module attribute in one property (<prop>).

Example below shows how to define multiplatform shortcut actions for Ctrl-T (Cmd-T on Mac OS X). Cmd-T is used to display/hide stylist window on Mac OS X for all languages. Ctrl-T is used for subscript on Unix, Windows platform (DE language only). Ctrl-T is used for centering horizontal alignment on Unix, Windows platforms (ES language only).

<node oor:name="T_MOD1" oor:op="replace">
 <prop oor:name="Command"><value xml:lang="x-no-translate" install:module="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
   <value xml:lang="de" install:module="unxwnt">.uno:SubScript</value>
   <value xml:lang="es" install:module="unxwnt">.uno:AlignHorizontalCenter</value>
   <value xml:lang="en-US" install:module="macosx">.uno:DesignerDialog</value>
  </prop>
</node>

As you can see, you can define shortcuts for multiple platforms (modules) and for different languages. You can find more example in Accelerators.xcu file.

Now, we have defined multiplatform shortcuts and two modules: unxwnt, macosx. We have to edit makefile.mk and add our shortcuts and modules there.

Accelerators.xcu must be added to XCUFILES and LOCALIZEDFILES. Module files are generated automatically during build process and they have names Accelerators-unxwnt.xcu and Accelerators-macosx.xcu. Both files must be added to MODULEFILES. Example below:

XCUFILES = Accelerators \
  ...
 
MODULEFILES = Accelerators-macosx.xcu \
  Accelerators-unxwnt.xcu \
  ...
 
LOCALIZEDFILES = Accelerators.xcu \
  ...

We have define directory where we want to see our modules XCU files. This is defined in directory_ooo.scp file.

Directory gid_Dir_Share_Registry_Modules_Oo_Office_Accelerators
    ParentID = gid_Dir_Share_Registry_Modules_Oo_Office;
    HostName = "Accelerators";
End

We have defined shortcuts, build system, directory for our modules and the only thing we need to do is to select proper modules for platforms. It's done in file_ooo.scp file.

File gid_File_Registry_Spool_Oo_Accelerators_System_Xcu
    TXT_FILE_BODY;
    Styles = (PACKED);
    Dir = gid_Dir_Share_Registry_Modules_Oo_Office_Accelerators;
#ifdef QUARTZ
    Name = "/registry/spool/org/openoffice/Office/Accelerators-macosx.xcu";
#else
    Name = "/registry/spool/org/openoffice/Office/Accelerators-unxwnt.xcu";
#endif
End

Here's an example how to make selection based on your platform.

#ifdef WNT
    Platform = "Windows";
#elif defined QUARTZ
    Platform = "Mac OS X";
#else
    Platform = "Unix";
#endif

That's all. This is the way how to define multiplatform shortcuts. Most things mentioned here are done. It's enough to modify Accelerators.xcu file if you do want to provide shortcuts for Mac OS X (macosx) or for Windows/Linux (unxwnt) platforms.

Modifiers Support

This enhancement introduces MOD3 modifier in KeyModifier.idl. For now, OpenOffice.org supports SHIFT, MOD1, MOD2, MOD3. Platform specific usage:

Modifier Platform Key
SHIFT All Shift
MOD1 Unix, Windows Ctrl
Mac OS X Cmd
MOD2 All Alt (Option)
MOD3 Unix, Windows Windows (meta)
Mac OS X Ctrl

You can combine all these modifiers in Accelerators.xcu file. For example T_MOD2_MOD1 for Cmd-Option-T (Mac OS X), Ctrl-Alt-T (Unix, Windows), etc.

References

CWS

Name: macshortcuts01

Content:

  • Introduced MOD3 modifier (including changes in lot of modules to support it)
    • Modules: dbaccess, sfx2, vcl, sc, sd, toolkit, offapi, framework, accessibility, svx, forms, svtools
  • Possibility to have multiple <value> pairs with xml:lang and install:module attributes
    • Modules: officecfg, scp2 (for unxwnt and macosx modules)
  • Cmd-Y to Cmd-Shift-Z for Redo on Mac OS X
    • Modules: officecfg
  • Cmd-M to minimize current windows on Mac OS X
    • Modules: vcl
  • Cmd-Option-M to minimize all application windows on Mac OS X
    • Modules: vcl
  • Cmd-M to Ctrl-M for Default formatting on Mac OS X
    • Modules: officecfg
  • F11 to Cmd-T for Stylist window on Mac OS X
    • Modules: officecfg

What's missing to be marked ready for QA:

  • review Cmd-T shortcut for ES language
  • review Cmd-T shortcut for DE language (thanks to Andre Schnabel)

Issues

Credits

Eric Bachard for initial help. Stephan Bergmann, Carsten Driesner and Philipp Lohmann for helping me with remaining issues.

Personal tools