You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openoffice.apache.org by Ariel Constenla-Haile <ar...@apache.org> on 2015/04/01 14:24:06 UTC

Re: [Issue 54923] No obvious way to quickly increase/decrease font-size from the keyboard

Hello Patrick,

On Tue, Mar 31, 2015 at 09:39:23AM -0400, Patrick Lynn wrote:
> I had asked about this bug previously and got a response saying to look at
> this
> http://opengrok.adfinis-sygroup.org/source/xref/aoo-trunk/main/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
> .
> 
> The file was extremely long and didn't have a ton of comments so I wasn't
> sure exactly how it functioned. Many of the shortcuts were repeated with
> identical code several times so I assumed the shortcuts applied to
> different OO modules.

You can read the schema belonging to that configuration file:
https://svn.apache.org/viewvc/openoffice/trunk/main/officecfg/registry/schema/org/openoffice/Office/Accelerators.xcs?view=markup#l45
In order to understand it, it is better if you read the configuration
files, both the schema and the data, with an editor that lets you
collapse the nodes.

As the component defines, there are two main groups:

- "PrimaryKeys": contains the preferred keys
- "SecondaryKeys": contains the secondary keys

Each group has two sets:

- "Global": valid for all OpenOffice modules, its elements are of type
  "Key"
- "Modules": valid for an specific OpenOffice module, its elements are
  of type "Module"

So you have:

PrimaryKeys
     Global
     Modules
SecondaryKeys
     Global
     Modules

In the "Modules", each node has the name of an OpenOffice module, see
https://wiki.openoffice.org/wiki/Office_modules_since_OpenOffice.org_2.3

The type of the elements is defined in the templates:
https://svn.apache.org/viewvc/openoffice/trunk/main/officecfg/registry/schema/org/openoffice/Office/Accelerators.xcs?view=markup#l28

Both Global and Modules are a set of "Key".

Each Key is identified by its name in the oor:name.
The name is composed of the key name, followed by SHIFT and/or
modifiers, all in uppercase and separated by "_".
Keys are as defined in the API here
https://www.openoffice.org/api/docs/common/ref/com/sun/star/awt/Key.html
Modifiers here
https://www.openoffice.org/api/docs/common/ref/com/sun/star/awt/KeyModifier.html


Each Key has a property named Command, which contains a UNO command.
This property is localized but not translatable, this means that the
same key can be bound to a different UNO command, depending on the UI
language.

For example, among the PrimaryKeys for the module Writer,
"com.sun.star.text.TextDocument", you have Ctrl + B:

<node oor:name="B_MOD1" oor:op="replace">

The key is bound to different commands, depending on the UI language:

- in German, it is bound to .uno:JustifyPara, this means that Ctrl
  + B justifies a paragraph in Writer with German user interface

- in Spanish, Ctrl + B opens the search dialog: .uno:SearchDialog
  (Search is Buscar in Spanish, hence the "B")

- in English, Ctrl + B sets the text in Bold, .uno:Bold is the command


<value xml:lang="x-no-translate"> means that any of these values should
be translated, UNO commands are not meant to be translated!


> To try to narrow down which parts of the code apply to where I replaced all
> of the 4 N_SHIFT_MOD1 commands from NewDoc to Grow and after building the
> system the change did work and I could increase the font size in writer.
> 
> Is there some hidden structure to this file that i'm unaware of? I still
> don't know which one of the commands I replaced applies to writer, granted
> I can figure this out through trial and error, but i'm not sure where in
> the code I would add in the new shortcuts.
> 
> Then the big question is what should the shortcut keys be to increase and
> decrease font size in Writer?

See Regina's answer. Try to see what Microsoft Office does, as most
users come from a MSOffice background. According to this page
https://support.office.com/en-ca/article/Keyboard-shortcuts-for-Microsoft-Office-Word-628621ea-c0b7-4f01-bc3e-50640c0b46dc
http://support.microsoft.com/en-us/kb/290938

Decrease font size one value.   CTRL+SHIFT+<
Increase font size one value.   CTRL+SHIFT+>
Decrease font size 1 point.     CTRL+[
Increase font size 1 point.     CTRL+]

Side note, you don't need to build the whole source code in order to try
this out, you can make an extension.
See these files:
https://people.apache.org/~arielch/extensions/Accelerators.zip
that generate
https://people.apache.org/~arielch/extensions/AcceleratorsTest.oxt

If the shortcuts don't show up in the Tools - Customize - Keyboard,
that's a bug you'll have to fix ;)


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

Re: [Issue 54923] No obvious way to quickly increase/decrease font-size from the keyboard

Posted by Regina Henschel <rb...@t-online.de>.
Hi Patrick,

Patrick Lynn schrieb:
> Thanks for your in-depth explanation on how to go about solving this bug.
>
> I have made an attempt so far but couldn't get the font to decrease
> size. I originally added the shortcuts for increase font size to be
> CTRL+SHIFT+> and to decrease CTRL+SHIFT+< but both shortcuts ended up
> increasing the font size. So I then replaced the uno command Grow with
> Shrink so in theory both shortcuts should now decrease the font size but
> instead they both increase the font size.

What is your keyboard layout? I have got a German keyboard layout. To 
get the character > I have to press Shift+[key with < and > and | on 
it]. I cannot use GREATER_MOD1 to access the character >, but I have to 
use LESS_SHIFT_MOD1.

>
> This leads me to believe that there may be some sort of issue with the
> UNO Shrink command. There is some functionality that allows for
> decreased font size because you can still manually set your own shortcut
> under customize in writer and it works.

.uno:Shrink and .uno:Grow have icons in the sidebar. If they work there, 
the commands itself are OK.

>
> I have attached my patch code showing the differences between the
> original Accelerators.xcu and my current version. As you can see I've
> only added 10 lines of code and I intentionally have both shortcuts
> using the Shrink command so i'm not sure why this code is making the
> font size increase.

How do you test it? Do you have a new user folder?

If I test something after making a build, I do an administrative 
installation of the generated AOO from instsetoo_native, and then I 
tweak the file bootstap.ini in folder program to get a new user folder 
inside the installation.

Kind regards
Regina


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
For additional commands, e-mail: dev-help@openoffice.apache.org


Re: [Issue 54923] No obvious way to quickly increase/decrease font-size from the keyboard

Posted by Ariel Constenla-Haile <ar...@apache.org>.
On Tue, Apr 07, 2015 at 08:46:10AM -0400, Patrick Lynn wrote:
> --- oldAccelerators.xcu	2015-03-31 11:23:58.838929202 -0400
> +++ Accelerators.xcu	2015-04-06 17:53:01.142849021 -0400
> @@ -4480,6 +4480,11 @@
>        <value xml:lang="en-US">.uno:RepeatSearch</value>
>       </prop>
>      </node>
> +    <node oor:name="GREATER_SHIFT_MOD1" oor:op="replace">
> +     <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
> +      <value xml:lang="en-US">.uno:Shrink</value>
> +     </prop>
> +    </node>
>      <node oor:name="G_MOD1" oor:op="replace">
>       <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
>        <value xml:lang="de">.uno:RepeatSearch</value>
> @@ -4566,6 +4571,11 @@
>        <value xml:lang="en-US">.uno:WordLeftSel</value>
>       </prop>
>      </node>
> +    <node oor:name="LESS_SHIFT_MOD1" oor:op="replace">
> +     <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
> +      <value xml:lang="en-US">.uno:Shrink</value>
> +     </prop>
> +    </node>
>      <node oor:name="L_MOD1" oor:op="replace">
>       <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
>        <value xml:lang="en-US">.uno:LeftPara</value>

a) You are using the same command, .uno:Shrink. You should use two
different commands, ".uno:Shrink" and ".uno:Grow"

b) and these commands should be bound to different key strokes. In my
keyboard layout both GREATER_SHIFT_MOD1 and LESS_SHIFT_MOD1 are the
same, see Regina's answer.

In my keyboard, < is next to SHIFT, and > is on the same key as < but
has to be accessed with SHIFT. That's why in the demo extension I used
LESS_MOD1 and GREATER_SHIFT_MOD1.


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

Re: [Issue 54923] No obvious way to quickly increase/decrease font-size from the keyboard

Posted by Patrick Lynn <pl...@gmail.com>.
Thanks for your in-depth explanation on how to go about solving this bug.

I have made an attempt so far but couldn't get the font to decrease size. I
originally added the shortcuts for increase font size to be CTRL+SHIFT+>
and to decrease CTRL+SHIFT+< but both shortcuts ended up increasing the
font size. So I then replaced the uno command Grow with Shrink so in theory
both shortcuts should now decrease the font size but instead they both
increase the font size.

This leads me to believe that there may be some sort of issue with the UNO
Shrink command. There is some functionality that allows for decreased font
size because you can still manually set your own shortcut under customize
in writer and it works.

I have attached my patch code showing the differences between the original
Accelerators.xcu and my current version. As you can see I've only added 10
lines of code and I intentionally have both shortcuts using the Shrink
command so i'm not sure why this code is making the font size increase.

On Wed, Apr 1, 2015 at 8:24 AM, Ariel Constenla-Haile <ar...@apache.org>
wrote:

> Hello Patrick,
>
> On Tue, Mar 31, 2015 at 09:39:23AM -0400, Patrick Lynn wrote:
> > I had asked about this bug previously and got a response saying to look
> at
> > this
> >
> http://opengrok.adfinis-sygroup.org/source/xref/aoo-trunk/main/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu
> > .
> >
> > The file was extremely long and didn't have a ton of comments so I wasn't
> > sure exactly how it functioned. Many of the shortcuts were repeated with
> > identical code several times so I assumed the shortcuts applied to
> > different OO modules.
>
> You can read the schema belonging to that configuration file:
>
> https://svn.apache.org/viewvc/openoffice/trunk/main/officecfg/registry/schema/org/openoffice/Office/Accelerators.xcs?view=markup#l45
> In order to understand it, it is better if you read the configuration
> files, both the schema and the data, with an editor that lets you
> collapse the nodes.
>
> As the component defines, there are two main groups:
>
> - "PrimaryKeys": contains the preferred keys
> - "SecondaryKeys": contains the secondary keys
>
> Each group has two sets:
>
> - "Global": valid for all OpenOffice modules, its elements are of type
>   "Key"
> - "Modules": valid for an specific OpenOffice module, its elements are
>   of type "Module"
>
> So you have:
>
> PrimaryKeys
>      Global
>      Modules
> SecondaryKeys
>      Global
>      Modules
>
> In the "Modules", each node has the name of an OpenOffice module, see
> https://wiki.openoffice.org/wiki/Office_modules_since_OpenOffice.org_2.3
>
> The type of the elements is defined in the templates:
>
> https://svn.apache.org/viewvc/openoffice/trunk/main/officecfg/registry/schema/org/openoffice/Office/Accelerators.xcs?view=markup#l28
>
> Both Global and Modules are a set of "Key".
>
> Each Key is identified by its name in the oor:name.
> The name is composed of the key name, followed by SHIFT and/or
> modifiers, all in uppercase and separated by "_".
> Keys are as defined in the API here
> https://www.openoffice.org/api/docs/common/ref/com/sun/star/awt/Key.html
> Modifiers here
>
> https://www.openoffice.org/api/docs/common/ref/com/sun/star/awt/KeyModifier.html
>
>
> Each Key has a property named Command, which contains a UNO command.
> This property is localized but not translatable, this means that the
> same key can be bound to a different UNO command, depending on the UI
> language.
>
> For example, among the PrimaryKeys for the module Writer,
> "com.sun.star.text.TextDocument", you have Ctrl + B:
>
> <node oor:name="B_MOD1" oor:op="replace">
>
> The key is bound to different commands, depending on the UI language:
>
> - in German, it is bound to .uno:JustifyPara, this means that Ctrl
>   + B justifies a paragraph in Writer with German user interface
>
> - in Spanish, Ctrl + B opens the search dialog: .uno:SearchDialog
>   (Search is Buscar in Spanish, hence the "B")
>
> - in English, Ctrl + B sets the text in Bold, .uno:Bold is the command
>
>
> <value xml:lang="x-no-translate"> means that any of these values should
> be translated, UNO commands are not meant to be translated!
>
>
> > To try to narrow down which parts of the code apply to where I replaced
> all
> > of the 4 N_SHIFT_MOD1 commands from NewDoc to Grow and after building the
> > system the change did work and I could increase the font size in writer.
> >
> > Is there some hidden structure to this file that i'm unaware of? I still
> > don't know which one of the commands I replaced applies to writer,
> granted
> > I can figure this out through trial and error, but i'm not sure where in
> > the code I would add in the new shortcuts.
> >
> > Then the big question is what should the shortcut keys be to increase and
> > decrease font size in Writer?
>
> See Regina's answer. Try to see what Microsoft Office does, as most
> users come from a MSOffice background. According to this page
>
> https://support.office.com/en-ca/article/Keyboard-shortcuts-for-Microsoft-Office-Word-628621ea-c0b7-4f01-bc3e-50640c0b46dc
> http://support.microsoft.com/en-us/kb/290938
>
> Decrease font size one value.   CTRL+SHIFT+<
> Increase font size one value.   CTRL+SHIFT+>
> Decrease font size 1 point.     CTRL+[
> Increase font size 1 point.     CTRL+]
>
> Side note, you don't need to build the whole source code in order to try
> this out, you can make an extension.
> See these files:
> https://people.apache.org/~arielch/extensions/Accelerators.zip
> that generate
> https://people.apache.org/~arielch/extensions/AcceleratorsTest.oxt
>
> If the shortcuts don't show up in the Tools - Customize - Keyboard,
> that's a bug you'll have to fix ;)
>
>
> Regards
> --
> Ariel Constenla-Haile
> La Plata, Argentina
>