Difference between revisions of "Tutorial Start"

From Apache OpenOffice Wiki
Jump to: navigation, search
(previous instructions dated back to Dec 2006 and were no longer relevant to the current system for accelerator keys.)
 
(2 intermediate revisions by 2 users not shown)
Line 10: Line 10:
 
Hack what ? We would have to start with what's available to hack first :-)
 
Hack what ? We would have to start with what's available to hack first :-)
  
So let's see, launching OOo with the newly installed 'soffice' launches the framework of the OpenOffice.org application. If it defaults to open with a default document, just close the application so that we have the blank framework window to start with.
+
In general, the functionality of the top-level projects is in-
  
Doesnt look very complicated, so we have a menubar at the top and one toolbar below it. The help option in the menubar has as the last menuitem "About OpenOffice.org" which is what we're going to target now:
+
sw - is the OpenOffice.org [[Writer]]<br />
 +
sc - is the OpenOffice.org [[Calc]]<br />
 +
sd - is the OpenOffice.org [[Impress]] and [[Draw]]
  
Most of the functionality we are interested in is concentrated in relatively few of the top-level projects -
+
And where functionality is common for all these applications, it is usually held in one of the desktop, framework, svtools, svx, and sfx2 projects.
  
sw - is the OpenOffice.org Writer<br />
+
The objective of this hack is to attach a keyboard accelerator to the About Dialog, so similar to how Ctrl+N launches a New Document, we'll add in a Ctrl+T to launch the About Dialog.
sc - is the OpenOffice.org Calc<br />
+
sd - is the OpenOffice.org Impress and Draw
+
  
And where functionality is common for all these applications, it is usually held in one of the desktop, framework, svtools, svx and sfx2 projects.
+
The accelerator keys are in:  \officecfg\registry\data\org\openoffice\Office\Accelerators.xcu
  
The objective of this hack is to attach a keyboard accelerator to the About Dialog, so similar to how Ctrl+N launches a New Document, we'll add in a Ctrl+T to launch the About Dialog.
+
We want to add a global accelerator, and these are in the top section of this file. This section is within the "Primary Keys" and "Global" nodes. Just to stick to the convention of the keys being in alphabetical order scroll down to the entry for the "S" key (this is the binding for CTRL + S):
 +
 
 +
  <node oor:name="S_MOD1" oor:op="replace">
 +
    <prop oor:name="Command">
 +
    <value xml:lang="en-US">.uno:Save</value>
 +
    </prop>
 +
  </node>
 +
 
 +
Now you will notice that below this is an entry such as:
  
We want this to be accessible across all the applications, which is held in the top-level svx project. svx/source/src/app.src lists the accelerators that are common across all the applications and is the location where we'll start our hack:
+
  <node oor:name="S_SHIFT_MOD1" oor:op="replace">
 +
    <prop oor:name="Command">
 +
    <value xml:lang="en-US">.uno:SaveAs</value>
 +
    </prop>
 +
  </node>
  
<pre>
+
This is the CTRL + SHIFT + S binding. So, below that add:
--- svx/source/src/app.src      2004-11-29 14:28:05.000000000 +0530
+
+++ svx/source/src/app.src      2004-12-20 21:54:16.895040960 +0530
+
@@ -178,6 +178,7 @@ ACC RID_DEFAULTACCEL
+
        ACC_CODE( SID_VIEW_DATA_SOURCE_BROWSER, KEY_F4, FALSE, FALSE, FALSE )
+
        ACC_CODE( SID_FM_GRABCONTROLFOCUS, KEY_F5, FALSE, TRUE, FALSE )
+
        ACC_CODE( SID_HANGUL_HANJA_CONVERSION, KEY_F7, TRUE, TRUE, FALSE )
+
+        ACC_CODE( SID_ABOUT, KEY_T, FALSE, TRUE, FALSE )
+
        };
+
};
+
</pre>
+
  
Add in that single line, rebuild svx, and launch soffice with the blank framework window. Hitting Ctrl+T should launch the About Dialog :-)
+
  <node oor:name="T_MOD1" oor:op="replace">
 +
    <prop oor:name="Command">
 +
    <value xml:lang="en-US">.uno:About</value>
 +
    </prop>
 +
  </node>
  
Now that's an interesting line which can be modified in a good number of ways, so maybe you'd like to try out the variations and see what happens :-)
+
You can copy your changed Accelerators.xcu file directly into the install directory (\OpenOffice.org 3\Basis\share\registry\data\org\openoffice\Office\Accelerators.xcu).
  
Go ahead!
+
Or, you can build the module and rebuild the installer (this assumed you have previously fully built it, if not then just do the usual build --all -P4 from the instsetoo module). From the $SRCROOT\officecfg directory call "build", then "deliver" to send the changed Accelerators.xcu file to the solenv module. Then change to the instsetoo module and call "build", then install.
  
 +
Run OOo, CRTL + T should now show the About dialog. Awesome!!!
 
<hr>
 
<hr>
  
Line 53: Line 60:
 
</table>
 
</table>
  
[[Category:Tutorials]]
+
[[Category:Tutorial]]

Latest revision as of 16:04, 28 December 2008

Hack! Tutorial_Help

Hack what ? We would have to start with what's available to hack first :-)

In general, the functionality of the top-level projects is in-

sw - is the OpenOffice.org Writer
sc - is the OpenOffice.org Calc
sd - is the OpenOffice.org Impress and Draw

And where functionality is common for all these applications, it is usually held in one of the desktop, framework, svtools, svx, and sfx2 projects.

The objective of this hack is to attach a keyboard accelerator to the About Dialog, so similar to how Ctrl+N launches a New Document, we'll add in a Ctrl+T to launch the About Dialog.

The accelerator keys are in: \officecfg\registry\data\org\openoffice\Office\Accelerators.xcu

We want to add a global accelerator, and these are in the top section of this file. This section is within the "Primary Keys" and "Global" nodes. Just to stick to the convention of the keys being in alphabetical order scroll down to the entry for the "S" key (this is the binding for CTRL + S):

  <node oor:name="S_MOD1" oor:op="replace">
   <prop oor:name="Command">
    <value xml:lang="en-US">.uno:Save</value>
   </prop>
  </node>

Now you will notice that below this is an entry such as:

  <node oor:name="S_SHIFT_MOD1" oor:op="replace">
   <prop oor:name="Command">
    <value xml:lang="en-US">.uno:SaveAs</value>
   </prop>
  </node>

This is the CTRL + SHIFT + S binding. So, below that add:

  <node oor:name="T_MOD1" oor:op="replace">
   <prop oor:name="Command">
    <value xml:lang="en-US">.uno:About</value>
   </prop>
  </node>

You can copy your changed Accelerators.xcu file directly into the install directory (\OpenOffice.org 3\Basis\share\registry\data\org\openoffice\Office\Accelerators.xcu).

Or, you can build the module and rebuild the installer (this assumed you have previously fully built it, if not then just do the usual build --all -P4 from the instsetoo module). From the $SRCROOT\officecfg directory call "build", then "deliver" to send the changed Accelerators.xcu file to the solenv module. Then change to the instsetoo module and call "build", then install.

Run OOo, CRTL + T should now show the About dialog. Awesome!!!


accelerator-about.diff Next: Tutorial_Toolbar
Personal tools