bump product version to 5.0.4.1
[LibreOffice.git] / cui / source / customize / acccfg.cxx
blobb3511e977198cee9e84476508dc9f864d763b9cb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 // include own files
23 #include "acccfg.hxx"
24 #include "cfgutil.hxx"
25 #include <dialmgr.hxx>
27 #include <sfx2/msg.hxx>
28 #include <sfx2/app.hxx>
29 #include <sfx2/filedlghelper.hxx>
30 #include <sfx2/minfitem.hxx>
31 #include <sfx2/sfxresid.hxx>
32 #include <svl/stritem.hxx>
33 #include "svtools/treelistentry.hxx"
35 #include <sal/macros.h>
36 #include <vcl/builderfactory.hxx>
38 #include "cuires.hrc"
39 #include "acccfg.hrc"
41 #include <svx/svxids.hrc>
44 // include interface declarations
45 #include <com/sun/star/awt/KeyModifier.hpp>
46 #include <com/sun/star/embed/StorageFactory.hpp>
47 #include <com/sun/star/embed/XTransactedObject.hpp>
48 #include <com/sun/star/embed/ElementModes.hpp>
49 #include <com/sun/star/form/XReset.hpp>
50 #include <com/sun/star/frame/Desktop.hpp>
51 #include <com/sun/star/frame/XFramesSupplier.hpp>
52 #include <com/sun/star/frame/XFrame.hpp>
53 #include <com/sun/star/frame/XController.hpp>
54 #include <com/sun/star/frame/XModel.hpp>
55 #include <com/sun/star/frame/ModuleManager.hpp>
56 #include <com/sun/star/frame/theUICommandDescription.hpp>
57 #include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp>
58 #include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
59 #include <com/sun/star/ui/UIConfigurationManager.hpp>
60 #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
61 #include <com/sun/star/ui/XUIConfigurationManager.hpp>
62 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
64 // include other projects
65 #include <comphelper/processfactory.hxx>
66 #include <svtools/acceleratorexecute.hxx>
67 #include <svtools/svlbitm.hxx>
68 #include <vcl/svapp.hxx>
69 #include <vcl/help.hxx>
70 #include <rtl/ustrbuf.hxx>
71 #include <comphelper/sequenceashashmap.hxx>
73 // namespaces
75 using namespace css;
77 static const char MODULEPROP_SHORTNAME [] = "ooSetupFactoryShortName";
78 static const char MODULEPROP_UINAME [] = "ooSetupFactoryUIName";
79 static const char CMDPROP_UINAME [] = "Name";
81 static const char FOLDERNAME_UICONFIG [] = "Configurations2";
83 static const char MEDIATYPE_PROPNAME [] = "MediaType";
84 static const char MEDIATYPE_UICONFIG [] = "application/vnd.sun.xml.ui.configuration";
86 static const sal_uInt16 KEYCODE_ARRAY[] =
88 KEY_F1,
89 KEY_F2,
90 KEY_F3,
91 KEY_F4,
92 KEY_F5,
93 KEY_F6,
94 KEY_F7,
95 KEY_F8,
96 KEY_F9,
97 KEY_F10,
98 KEY_F11,
99 KEY_F12,
100 KEY_F13,
101 KEY_F14,
102 KEY_F15,
103 KEY_F16,
105 KEY_DOWN,
106 KEY_UP,
107 KEY_LEFT,
108 KEY_RIGHT,
109 KEY_HOME,
110 KEY_END,
111 KEY_PAGEUP,
112 KEY_PAGEDOWN,
113 KEY_RETURN,
114 KEY_ESCAPE,
115 KEY_BACKSPACE,
116 KEY_INSERT,
117 KEY_DELETE,
119 KEY_OPEN,
120 KEY_CUT,
121 KEY_COPY,
122 KEY_PASTE,
123 KEY_UNDO,
124 KEY_REPEAT,
125 KEY_FIND,
126 KEY_PROPERTIES,
127 KEY_FRONT,
128 KEY_CONTEXTMENU,
129 KEY_MENU,
130 KEY_HELP,
132 KEY_SHIFT | KEY_F1,
133 KEY_SHIFT | KEY_F2,
134 KEY_SHIFT | KEY_F3,
135 KEY_SHIFT | KEY_F4,
136 KEY_SHIFT | KEY_F5,
137 KEY_SHIFT | KEY_F6,
138 KEY_SHIFT | KEY_F7,
139 KEY_SHIFT | KEY_F8,
140 KEY_SHIFT | KEY_F9,
141 KEY_SHIFT | KEY_F10,
142 KEY_SHIFT | KEY_F11,
143 KEY_SHIFT | KEY_F12,
144 KEY_SHIFT | KEY_F13,
145 KEY_SHIFT | KEY_F14,
146 KEY_SHIFT | KEY_F15,
147 KEY_SHIFT | KEY_F16,
149 KEY_SHIFT | KEY_DOWN,
150 KEY_SHIFT | KEY_UP,
151 KEY_SHIFT | KEY_LEFT,
152 KEY_SHIFT | KEY_RIGHT,
153 KEY_SHIFT | KEY_HOME,
154 KEY_SHIFT | KEY_END,
155 KEY_SHIFT | KEY_PAGEUP,
156 KEY_SHIFT | KEY_PAGEDOWN,
157 KEY_SHIFT | KEY_RETURN,
158 KEY_SHIFT | KEY_SPACE,
159 KEY_SHIFT | KEY_ESCAPE,
160 KEY_SHIFT | KEY_BACKSPACE,
161 KEY_SHIFT | KEY_INSERT,
162 KEY_SHIFT | KEY_DELETE,
164 KEY_MOD1 | KEY_0,
165 KEY_MOD1 | KEY_1,
166 KEY_MOD1 | KEY_2,
167 KEY_MOD1 | KEY_3,
168 KEY_MOD1 | KEY_4,
169 KEY_MOD1 | KEY_5,
170 KEY_MOD1 | KEY_6,
171 KEY_MOD1 | KEY_7,
172 KEY_MOD1 | KEY_8,
173 KEY_MOD1 | KEY_9,
174 KEY_MOD1 | KEY_A,
175 KEY_MOD1 | KEY_B,
176 KEY_MOD1 | KEY_C,
177 KEY_MOD1 | KEY_D,
178 KEY_MOD1 | KEY_E,
179 KEY_MOD1 | KEY_F,
180 KEY_MOD1 | KEY_G,
181 KEY_MOD1 | KEY_H,
182 KEY_MOD1 | KEY_I,
183 KEY_MOD1 | KEY_J,
184 KEY_MOD1 | KEY_K,
185 KEY_MOD1 | KEY_L,
186 KEY_MOD1 | KEY_M,
187 KEY_MOD1 | KEY_N,
188 KEY_MOD1 | KEY_O,
189 KEY_MOD1 | KEY_P,
190 KEY_MOD1 | KEY_Q,
191 KEY_MOD1 | KEY_R,
192 KEY_MOD1 | KEY_S,
193 KEY_MOD1 | KEY_T,
194 KEY_MOD1 | KEY_U,
195 KEY_MOD1 | KEY_V,
196 KEY_MOD1 | KEY_W,
197 KEY_MOD1 | KEY_X,
198 KEY_MOD1 | KEY_Y,
199 KEY_MOD1 | KEY_Z,
200 KEY_MOD1 | KEY_SEMICOLON,
201 KEY_MOD1 | KEY_QUOTERIGHT,
202 KEY_MOD1 | KEY_BRACKETLEFT,
203 KEY_MOD1 | KEY_BRACKETRIGHT,
204 KEY_MOD1 | KEY_POINT,
206 KEY_MOD1 | KEY_F1,
207 KEY_MOD1 | KEY_F2,
208 KEY_MOD1 | KEY_F3,
209 KEY_MOD1 | KEY_F4,
210 KEY_MOD1 | KEY_F5,
211 KEY_MOD1 | KEY_F6,
212 KEY_MOD1 | KEY_F7,
213 KEY_MOD1 | KEY_F8,
214 KEY_MOD1 | KEY_F9,
215 KEY_MOD1 | KEY_F10,
216 KEY_MOD1 | KEY_F11,
217 KEY_MOD1 | KEY_F12,
218 KEY_MOD1 | KEY_F13,
219 KEY_MOD1 | KEY_F14,
220 KEY_MOD1 | KEY_F15,
221 KEY_MOD1 | KEY_F16,
223 KEY_MOD1 | KEY_DOWN,
224 KEY_MOD1 | KEY_UP,
225 KEY_MOD1 | KEY_LEFT,
226 KEY_MOD1 | KEY_RIGHT,
227 KEY_MOD1 | KEY_HOME,
228 KEY_MOD1 | KEY_END,
229 KEY_MOD1 | KEY_PAGEUP,
230 KEY_MOD1 | KEY_PAGEDOWN,
231 KEY_MOD1 | KEY_RETURN,
232 KEY_MOD1 | KEY_SPACE,
233 KEY_MOD1 | KEY_BACKSPACE,
234 KEY_MOD1 | KEY_INSERT,
235 KEY_MOD1 | KEY_DELETE,
237 KEY_MOD1 | KEY_ADD,
238 KEY_MOD1 | KEY_SUBTRACT,
239 KEY_MOD1 | KEY_MULTIPLY,
240 KEY_MOD1 | KEY_DIVIDE,
242 KEY_SHIFT | KEY_MOD1 | KEY_0,
243 KEY_SHIFT | KEY_MOD1 | KEY_1,
244 KEY_SHIFT | KEY_MOD1 | KEY_2,
245 KEY_SHIFT | KEY_MOD1 | KEY_3,
246 KEY_SHIFT | KEY_MOD1 | KEY_4,
247 KEY_SHIFT | KEY_MOD1 | KEY_5,
248 KEY_SHIFT | KEY_MOD1 | KEY_6,
249 KEY_SHIFT | KEY_MOD1 | KEY_7,
250 KEY_SHIFT | KEY_MOD1 | KEY_8,
251 KEY_SHIFT | KEY_MOD1 | KEY_9,
252 KEY_SHIFT | KEY_MOD1 | KEY_A,
253 KEY_SHIFT | KEY_MOD1 | KEY_B,
254 KEY_SHIFT | KEY_MOD1 | KEY_C,
255 KEY_SHIFT | KEY_MOD1 | KEY_D,
256 KEY_SHIFT | KEY_MOD1 | KEY_E,
257 KEY_SHIFT | KEY_MOD1 | KEY_F,
258 KEY_SHIFT | KEY_MOD1 | KEY_G,
259 KEY_SHIFT | KEY_MOD1 | KEY_H,
260 KEY_SHIFT | KEY_MOD1 | KEY_I,
261 KEY_SHIFT | KEY_MOD1 | KEY_J,
262 KEY_SHIFT | KEY_MOD1 | KEY_K,
263 KEY_SHIFT | KEY_MOD1 | KEY_L,
264 KEY_SHIFT | KEY_MOD1 | KEY_M,
265 KEY_SHIFT | KEY_MOD1 | KEY_N,
266 KEY_SHIFT | KEY_MOD1 | KEY_O,
267 KEY_SHIFT | KEY_MOD1 | KEY_P,
268 KEY_SHIFT | KEY_MOD1 | KEY_Q,
269 KEY_SHIFT | KEY_MOD1 | KEY_R,
270 KEY_SHIFT | KEY_MOD1 | KEY_S,
271 KEY_SHIFT | KEY_MOD1 | KEY_T,
272 KEY_SHIFT | KEY_MOD1 | KEY_U,
273 KEY_SHIFT | KEY_MOD1 | KEY_V,
274 KEY_SHIFT | KEY_MOD1 | KEY_W,
275 KEY_SHIFT | KEY_MOD1 | KEY_X,
276 KEY_SHIFT | KEY_MOD1 | KEY_Y,
277 KEY_SHIFT | KEY_MOD1 | KEY_Z,
278 KEY_SHIFT | KEY_MOD1 | KEY_SEMICOLON,
279 KEY_SHIFT | KEY_MOD1 | KEY_QUOTERIGHT,
280 KEY_SHIFT | KEY_MOD1 | KEY_BRACKETLEFT,
281 KEY_SHIFT | KEY_MOD1 | KEY_BRACKETRIGHT,
282 KEY_SHIFT | KEY_MOD1 | KEY_POINT,
284 KEY_SHIFT | KEY_MOD1 | KEY_F1,
285 KEY_SHIFT | KEY_MOD1 | KEY_F2,
286 KEY_SHIFT | KEY_MOD1 | KEY_F3,
287 KEY_SHIFT | KEY_MOD1 | KEY_F4,
288 KEY_SHIFT | KEY_MOD1 | KEY_F5,
289 KEY_SHIFT | KEY_MOD1 | KEY_F6,
290 KEY_SHIFT | KEY_MOD1 | KEY_F7,
291 KEY_SHIFT | KEY_MOD1 | KEY_F8,
292 KEY_SHIFT | KEY_MOD1 | KEY_F9,
293 KEY_SHIFT | KEY_MOD1 | KEY_F10,
294 KEY_SHIFT | KEY_MOD1 | KEY_F11,
295 KEY_SHIFT | KEY_MOD1 | KEY_F12,
296 KEY_SHIFT | KEY_MOD1 | KEY_F13,
297 KEY_SHIFT | KEY_MOD1 | KEY_F14,
298 KEY_SHIFT | KEY_MOD1 | KEY_F15,
299 KEY_SHIFT | KEY_MOD1 | KEY_F16,
301 KEY_SHIFT | KEY_MOD1 | KEY_DOWN,
302 KEY_SHIFT | KEY_MOD1 | KEY_UP,
303 KEY_SHIFT | KEY_MOD1 | KEY_LEFT,
304 KEY_SHIFT | KEY_MOD1 | KEY_RIGHT,
305 KEY_SHIFT | KEY_MOD1 | KEY_HOME,
306 KEY_SHIFT | KEY_MOD1 | KEY_END,
307 KEY_SHIFT | KEY_MOD1 | KEY_PAGEUP,
308 KEY_SHIFT | KEY_MOD1 | KEY_PAGEDOWN,
309 KEY_SHIFT | KEY_MOD1 | KEY_RETURN,
310 KEY_SHIFT | KEY_MOD1 | KEY_ESCAPE,
311 KEY_SHIFT | KEY_MOD1 | KEY_BACKSPACE,
312 KEY_SHIFT | KEY_MOD1 | KEY_INSERT,
313 KEY_SHIFT | KEY_MOD1 | KEY_DELETE,
315 KEY_MOD2 | KEY_0,
316 KEY_MOD2 | KEY_1,
317 KEY_MOD2 | KEY_2,
318 KEY_MOD2 | KEY_3,
319 KEY_MOD2 | KEY_4,
320 KEY_MOD2 | KEY_5,
321 KEY_MOD2 | KEY_6,
322 KEY_MOD2 | KEY_7,
323 KEY_MOD2 | KEY_8,
324 KEY_MOD2 | KEY_9,
325 KEY_MOD2 | KEY_A,
326 KEY_MOD2 | KEY_B,
327 KEY_MOD2 | KEY_C,
328 KEY_MOD2 | KEY_D,
329 KEY_MOD2 | KEY_E,
330 KEY_MOD2 | KEY_F,
331 KEY_MOD2 | KEY_G,
332 KEY_MOD2 | KEY_H,
333 KEY_MOD2 | KEY_I,
334 KEY_MOD2 | KEY_J,
335 KEY_MOD2 | KEY_K,
336 KEY_MOD2 | KEY_L,
337 KEY_MOD2 | KEY_M,
338 KEY_MOD2 | KEY_N,
339 KEY_MOD2 | KEY_O,
340 KEY_MOD2 | KEY_P,
341 KEY_MOD2 | KEY_Q,
342 KEY_MOD2 | KEY_R,
343 KEY_MOD2 | KEY_S,
344 KEY_MOD2 | KEY_T,
345 KEY_MOD2 | KEY_U,
346 KEY_MOD2 | KEY_V,
347 KEY_MOD2 | KEY_W,
348 KEY_MOD2 | KEY_X,
349 KEY_MOD2 | KEY_Y,
350 KEY_MOD2 | KEY_Z,
351 KEY_MOD2 | KEY_SEMICOLON,
352 KEY_MOD2 | KEY_QUOTERIGHT,
353 KEY_MOD2 | KEY_BRACKETLEFT,
354 KEY_MOD2 | KEY_BRACKETRIGHT,
355 KEY_MOD2 | KEY_POINT,
357 KEY_MOD2 | KEY_F1,
358 KEY_MOD2 | KEY_F2,
359 KEY_MOD2 | KEY_F3,
360 KEY_MOD2 | KEY_F4,
361 KEY_MOD2 | KEY_F5,
362 KEY_MOD2 | KEY_F6,
363 KEY_MOD2 | KEY_F7,
364 KEY_MOD2 | KEY_F8,
365 KEY_MOD2 | KEY_F9,
366 KEY_MOD2 | KEY_F10,
367 KEY_MOD2 | KEY_F11,
368 KEY_MOD2 | KEY_F12,
369 KEY_MOD2 | KEY_F13,
370 KEY_MOD2 | KEY_F14,
371 KEY_MOD2 | KEY_F15,
372 KEY_MOD2 | KEY_F16,
374 KEY_MOD2 | KEY_DOWN,
375 KEY_MOD2 | KEY_UP,
376 KEY_MOD2 | KEY_LEFT,
377 KEY_MOD2 | KEY_RIGHT,
378 KEY_MOD2 | KEY_HOME,
379 KEY_MOD2 | KEY_END,
380 KEY_MOD2 | KEY_PAGEUP,
381 KEY_MOD2 | KEY_PAGEDOWN,
382 KEY_MOD2 | KEY_RETURN,
383 KEY_MOD2 | KEY_SPACE,
384 KEY_MOD2 | KEY_BACKSPACE,
385 KEY_MOD2 | KEY_INSERT,
386 KEY_MOD2 | KEY_DELETE,
388 KEY_SHIFT | KEY_MOD2 | KEY_0,
389 KEY_SHIFT | KEY_MOD2 | KEY_1,
390 KEY_SHIFT | KEY_MOD2 | KEY_2,
391 KEY_SHIFT | KEY_MOD2 | KEY_3,
392 KEY_SHIFT | KEY_MOD2 | KEY_4,
393 KEY_SHIFT | KEY_MOD2 | KEY_5,
394 KEY_SHIFT | KEY_MOD2 | KEY_6,
395 KEY_SHIFT | KEY_MOD2 | KEY_7,
396 KEY_SHIFT | KEY_MOD2 | KEY_8,
397 KEY_SHIFT | KEY_MOD2 | KEY_9,
398 KEY_SHIFT | KEY_MOD2 | KEY_A,
399 KEY_SHIFT | KEY_MOD2 | KEY_B,
400 KEY_SHIFT | KEY_MOD2 | KEY_C,
401 KEY_SHIFT | KEY_MOD2 | KEY_D,
402 KEY_SHIFT | KEY_MOD2 | KEY_E,
403 KEY_SHIFT | KEY_MOD2 | KEY_F,
404 KEY_SHIFT | KEY_MOD2 | KEY_G,
405 KEY_SHIFT | KEY_MOD2 | KEY_H,
406 KEY_SHIFT | KEY_MOD2 | KEY_I,
407 KEY_SHIFT | KEY_MOD2 | KEY_J,
408 KEY_SHIFT | KEY_MOD2 | KEY_K,
409 KEY_SHIFT | KEY_MOD2 | KEY_L,
410 KEY_SHIFT | KEY_MOD2 | KEY_M,
411 KEY_SHIFT | KEY_MOD2 | KEY_N,
412 KEY_SHIFT | KEY_MOD2 | KEY_O,
413 KEY_SHIFT | KEY_MOD2 | KEY_P,
414 KEY_SHIFT | KEY_MOD2 | KEY_Q,
415 KEY_SHIFT | KEY_MOD2 | KEY_R,
416 KEY_SHIFT | KEY_MOD2 | KEY_S,
417 KEY_SHIFT | KEY_MOD2 | KEY_T,
418 KEY_SHIFT | KEY_MOD2 | KEY_U,
419 KEY_SHIFT | KEY_MOD2 | KEY_V,
420 KEY_SHIFT | KEY_MOD2 | KEY_W,
421 KEY_SHIFT | KEY_MOD2 | KEY_X,
422 KEY_SHIFT | KEY_MOD2 | KEY_Y,
423 KEY_SHIFT | KEY_MOD2 | KEY_Z,
424 KEY_SHIFT | KEY_MOD2 | KEY_SEMICOLON,
425 KEY_SHIFT | KEY_MOD2 | KEY_QUOTERIGHT,
426 KEY_SHIFT | KEY_MOD2 | KEY_BRACKETLEFT,
427 KEY_SHIFT | KEY_MOD2 | KEY_BRACKETRIGHT,
428 KEY_SHIFT | KEY_MOD2 | KEY_POINT,
430 KEY_SHIFT | KEY_MOD2 | KEY_F1,
431 KEY_SHIFT | KEY_MOD2 | KEY_F2,
432 KEY_SHIFT | KEY_MOD2 | KEY_F3,
433 KEY_SHIFT | KEY_MOD2 | KEY_F4,
434 KEY_SHIFT | KEY_MOD2 | KEY_F5,
435 KEY_SHIFT | KEY_MOD2 | KEY_F6,
436 KEY_SHIFT | KEY_MOD2 | KEY_F7,
437 KEY_SHIFT | KEY_MOD2 | KEY_F8,
438 KEY_SHIFT | KEY_MOD2 | KEY_F9,
439 KEY_SHIFT | KEY_MOD2 | KEY_F10,
440 KEY_SHIFT | KEY_MOD2 | KEY_F11,
441 KEY_SHIFT | KEY_MOD2 | KEY_F12,
442 KEY_SHIFT | KEY_MOD2 | KEY_F13,
443 KEY_SHIFT | KEY_MOD2 | KEY_F14,
444 KEY_SHIFT | KEY_MOD2 | KEY_F15,
445 KEY_SHIFT | KEY_MOD2 | KEY_F16,
447 KEY_SHIFT | KEY_MOD2 | KEY_DOWN,
448 KEY_SHIFT | KEY_MOD2 | KEY_UP,
449 KEY_SHIFT | KEY_MOD2 | KEY_LEFT,
450 KEY_SHIFT | KEY_MOD2 | KEY_RIGHT,
451 KEY_SHIFT | KEY_MOD2 | KEY_HOME,
452 KEY_SHIFT | KEY_MOD2 | KEY_END,
453 KEY_SHIFT | KEY_MOD2 | KEY_PAGEUP,
454 KEY_SHIFT | KEY_MOD2 | KEY_PAGEDOWN,
455 KEY_SHIFT | KEY_MOD2 | KEY_RETURN,
456 KEY_SHIFT | KEY_MOD2 | KEY_ESCAPE,
457 KEY_SHIFT | KEY_MOD2 | KEY_BACKSPACE,
458 KEY_SHIFT | KEY_MOD2 | KEY_INSERT,
459 KEY_SHIFT | KEY_MOD2 | KEY_DELETE,
461 KEY_MOD1 | KEY_MOD2 | KEY_0,
462 KEY_MOD1 | KEY_MOD2 | KEY_1,
463 KEY_MOD1 | KEY_MOD2 | KEY_2,
464 KEY_MOD1 | KEY_MOD2 | KEY_3,
465 KEY_MOD1 | KEY_MOD2 | KEY_4,
466 KEY_MOD1 | KEY_MOD2 | KEY_5,
467 KEY_MOD1 | KEY_MOD2 | KEY_6,
468 KEY_MOD1 | KEY_MOD2 | KEY_7,
469 KEY_MOD1 | KEY_MOD2 | KEY_8,
470 KEY_MOD1 | KEY_MOD2 | KEY_9,
471 KEY_MOD1 | KEY_MOD2 | KEY_A,
472 KEY_MOD1 | KEY_MOD2 | KEY_B,
473 KEY_MOD1 | KEY_MOD2 | KEY_C,
474 KEY_MOD1 | KEY_MOD2 | KEY_D,
475 KEY_MOD1 | KEY_MOD2 | KEY_E,
476 KEY_MOD1 | KEY_MOD2 | KEY_F,
477 KEY_MOD1 | KEY_MOD2 | KEY_G,
478 KEY_MOD1 | KEY_MOD2 | KEY_H,
479 KEY_MOD1 | KEY_MOD2 | KEY_I,
480 KEY_MOD1 | KEY_MOD2 | KEY_J,
481 KEY_MOD1 | KEY_MOD2 | KEY_K,
482 KEY_MOD1 | KEY_MOD2 | KEY_L,
483 KEY_MOD1 | KEY_MOD2 | KEY_M,
484 KEY_MOD1 | KEY_MOD2 | KEY_N,
485 KEY_MOD1 | KEY_MOD2 | KEY_O,
486 KEY_MOD1 | KEY_MOD2 | KEY_P,
487 KEY_MOD1 | KEY_MOD2 | KEY_Q,
488 KEY_MOD1 | KEY_MOD2 | KEY_R,
489 KEY_MOD1 | KEY_MOD2 | KEY_S,
490 KEY_MOD1 | KEY_MOD2 | KEY_T,
491 KEY_MOD1 | KEY_MOD2 | KEY_U,
492 KEY_MOD1 | KEY_MOD2 | KEY_V,
493 KEY_MOD1 | KEY_MOD2 | KEY_W,
494 KEY_MOD1 | KEY_MOD2 | KEY_X,
495 KEY_MOD1 | KEY_MOD2 | KEY_Y,
496 KEY_MOD1 | KEY_MOD2 | KEY_Z,
497 KEY_MOD1 | KEY_MOD2 | KEY_SEMICOLON,
498 KEY_MOD1 | KEY_MOD2 | KEY_QUOTERIGHT,
499 KEY_MOD1 | KEY_MOD2 | KEY_BRACKETLEFT,
500 KEY_MOD1 | KEY_MOD2 | KEY_BRACKETRIGHT,
501 KEY_MOD1 | KEY_MOD2 | KEY_POINT,
503 KEY_MOD1 | KEY_MOD2 | KEY_F1,
504 KEY_MOD1 | KEY_MOD2 | KEY_F2,
505 KEY_MOD1 | KEY_MOD2 | KEY_F3,
506 KEY_MOD1 | KEY_MOD2 | KEY_F4,
507 KEY_MOD1 | KEY_MOD2 | KEY_F5,
508 KEY_MOD1 | KEY_MOD2 | KEY_F6,
509 KEY_MOD1 | KEY_MOD2 | KEY_F7,
510 KEY_MOD1 | KEY_MOD2 | KEY_F8,
511 KEY_MOD1 | KEY_MOD2 | KEY_F9,
512 KEY_MOD1 | KEY_MOD2 | KEY_F10,
513 KEY_MOD1 | KEY_MOD2 | KEY_F11,
514 KEY_MOD1 | KEY_MOD2 | KEY_F12,
515 KEY_MOD1 | KEY_MOD2 | KEY_F13,
516 KEY_MOD1 | KEY_MOD2 | KEY_F14,
517 KEY_MOD1 | KEY_MOD2 | KEY_F15,
518 KEY_MOD1 | KEY_MOD2 | KEY_F16,
520 KEY_MOD1 | KEY_MOD2 | KEY_DOWN,
521 KEY_MOD1 | KEY_MOD2 | KEY_UP,
522 KEY_MOD1 | KEY_MOD2 | KEY_LEFT,
523 KEY_MOD1 | KEY_MOD2 | KEY_RIGHT,
524 KEY_MOD1 | KEY_MOD2 | KEY_HOME,
525 KEY_MOD1 | KEY_MOD2 | KEY_END,
526 KEY_MOD1 | KEY_MOD2 | KEY_PAGEUP,
527 KEY_MOD1 | KEY_MOD2 | KEY_PAGEDOWN,
528 KEY_MOD1 | KEY_MOD2 | KEY_RETURN,
529 KEY_MOD1 | KEY_MOD2 | KEY_SPACE,
530 KEY_MOD1 | KEY_MOD2 | KEY_BACKSPACE,
531 KEY_MOD1 | KEY_MOD2 | KEY_INSERT,
532 KEY_MOD1 | KEY_MOD2 | KEY_DELETE,
534 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_0,
535 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_1,
536 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_2,
537 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_3,
538 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_4,
539 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_5,
540 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_6,
541 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_7,
542 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_8,
543 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_9,
544 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_A,
545 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_B,
546 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_C,
547 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_D,
548 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_E,
549 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_F,
550 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_G,
551 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_H,
552 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_I,
553 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_J,
554 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_K,
555 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_L,
556 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_M,
557 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_N,
558 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_O,
559 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_P,
560 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_Q,
561 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_R,
562 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_S,
563 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_T,
564 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_U,
565 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_V,
566 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_W,
567 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_X,
568 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_Y,
569 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_Z,
570 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_SEMICOLON,
571 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_QUOTERIGHT,
572 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_BRACKETLEFT,
573 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_BRACKETRIGHT,
574 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_POINT,
576 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_F1,
577 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_F2,
578 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_F3,
579 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_F4,
580 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_F5,
581 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_F6,
582 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_F7,
583 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_F8,
584 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_F9,
585 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_F10,
586 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_F11,
587 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_F12,
588 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_F13,
589 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_F14,
590 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_F15,
591 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_F16,
593 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_DOWN,
594 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_UP,
595 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_LEFT,
596 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_RIGHT,
597 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_HOME,
598 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_END,
599 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_PAGEUP,
600 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_PAGEDOWN,
601 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_RETURN,
602 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_SPACE,
603 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_BACKSPACE,
604 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_INSERT,
605 KEY_SHIFT | KEY_MOD1 | KEY_MOD2 | KEY_DELETE
608 static const sal_uInt16 KEYCODE_ARRAY_SIZE = SAL_N_ELEMENTS(KEYCODE_ARRAY);
610 // seems to be needed to layout the list box, which shows all
611 // assignable shortcuts
612 static long AccCfgTabs[] =
614 2, // Number of Tabs
616 120 // Function
620 class SfxAccCfgLBoxString_Impl : public SvLBoxString
622 public:
623 SfxAccCfgLBoxString_Impl(SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& sText);
625 virtual ~SfxAccCfgLBoxString_Impl();
627 virtual void Paint(const Point& aPos, SvTreeListBox& rDevice, vcl::RenderContext& rRenderContext,
628 const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE;
632 SfxAccCfgLBoxString_Impl::SfxAccCfgLBoxString_Impl(SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& sText)
633 : SvLBoxString(pEntry, nFlags, sText)
636 SfxAccCfgLBoxString_Impl::~SfxAccCfgLBoxString_Impl()
639 void SfxAccCfgLBoxString_Impl::Paint(const Point& aPos, SvTreeListBox& /*rDevice*/, vcl::RenderContext& rRenderContext,
640 const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry)
642 if (!pEntry)
643 return;
645 TAccInfo* pUserData = static_cast<TAccInfo*>(pEntry->GetUserData());
646 if (!pUserData)
647 return;
649 if (pUserData->m_bIsConfigurable)
650 rRenderContext.DrawText(aPos, GetText());
651 else
652 rRenderContext.DrawCtrlText(aPos, GetText(), 0, -1, DrawTextFlags::Disable);
656 VCL_BUILDER_DECL_FACTORY(SfxAccCfgTabListBox)
658 WinBits nWinBits = WB_TABSTOP;
660 OString sBorder = VclBuilder::extractCustomProperty(rMap);
661 if (!sBorder.isEmpty())
662 nWinBits |= WB_BORDER;
664 rRet = VclPtr<SfxAccCfgTabListBox_Impl>::Create(pParent, nWinBits);
667 void SfxAccCfgTabListBox_Impl::InitEntry(SvTreeListEntry* pEntry,
668 const OUString& rText,
669 const Image& rImage1,
670 const Image& rImage2,
671 SvLBoxButtonKind eButtonKind)
673 SvTabListBox::InitEntry(pEntry, rText, rImage1, rImage2, eButtonKind);
676 SfxAccCfgTabListBox_Impl::~SfxAccCfgTabListBox_Impl()
678 disposeOnce();
681 void SfxAccCfgTabListBox_Impl::dispose()
683 m_pAccelConfigPage.clear();
684 SvTabListBox::dispose();
687 /** select the entry, which match the current key input ... excepting
688 keys, which are used for the dialog itself.
690 void SfxAccCfgTabListBox_Impl::KeyInput(const KeyEvent& aKey)
692 vcl::KeyCode aCode1 = aKey.GetKeyCode();
693 sal_uInt16 nCode1 = aCode1.GetCode();
694 sal_uInt16 nMod1 = aCode1.GetModifier();
696 // is it related to our list box ?
697 if (
698 (nCode1 != KEY_DOWN ) &&
699 (nCode1 != KEY_UP ) &&
700 (nCode1 != KEY_LEFT ) &&
701 (nCode1 != KEY_RIGHT ) &&
702 (nCode1 != KEY_PAGEUP ) &&
703 (nCode1 != KEY_PAGEDOWN)
706 SvTreeListEntry* pEntry = First();
707 while (pEntry)
709 TAccInfo* pUserData = static_cast<TAccInfo*>(pEntry->GetUserData());
710 if (pUserData)
712 sal_uInt16 nCode2 = pUserData->m_aKey.GetCode();
713 sal_uInt16 nMod2 = pUserData->m_aKey.GetModifier();
715 if ((nCode1 == nCode2) &&
716 (nMod1 == nMod2 ))
718 Select(pEntry);
719 MakeVisible(pEntry);
720 return;
723 pEntry = Next(pEntry);
727 // no - handle it as normal dialog input
728 SvTabListBox::KeyInput(aKey);
731 SfxAcceleratorConfigPage::SfxAcceleratorConfigPage( vcl::Window* pParent, const SfxItemSet& aSet )
732 : SfxTabPage(pParent, "AccelConfigPage", "cui/ui/accelconfigpage.ui", &aSet)
733 , m_pMacroInfoItem()
734 , m_pStringItem()
735 , m_pFontItem()
736 , m_pFileDlg(NULL)
737 , aLoadAccelConfigStr(CUI_RES(RID_SVXSTR_LOADACCELCONFIG))
738 , aSaveAccelConfigStr(CUI_RES(RID_SVXSTR_SAVEACCELCONFIG))
739 , aFilterCfgStr(CUI_RES(RID_SVXSTR_FILTERNAME_CFG))
740 , m_bStylesInfoInitialized(false)
741 , m_xGlobal()
742 , m_xModule()
743 , m_xAct()
745 get(m_pOfficeButton, "office");
746 get(m_pModuleButton, "module");
747 get(m_pChangeButton, "change");
748 get(m_pRemoveButton, "delete");
749 get(m_pLoadButton, "load");
750 get(m_pSaveButton, "save");
751 get(m_pResetButton, "reset");
752 get(m_pEntriesBox, "shortcuts");
753 Size aSize(LogicToPixel(Size(174, 100), MAP_APPFONT));
754 m_pEntriesBox->set_width_request(aSize.Width());
755 m_pEntriesBox->set_height_request(aSize.Height());
756 m_pEntriesBox->SetAccelConfigPage(this);
757 get(m_pGroupLBox, "category");
758 aSize = LogicToPixel(Size(78 , 91), MAP_APPFONT);
759 m_pGroupLBox->set_width_request(aSize.Width());
760 m_pGroupLBox->set_height_request(aSize.Height());
761 get(m_pFunctionBox, "function");
762 aSize = LogicToPixel(Size(88, 91), MAP_APPFONT);
763 m_pFunctionBox->set_width_request(aSize.Width());
764 m_pFunctionBox->set_height_request(aSize.Height());
765 get(m_pKeyBox, "keys");
766 aSize = LogicToPixel(Size(80, 91), MAP_APPFONT);
767 m_pKeyBox->set_width_request(aSize.Width());
768 m_pKeyBox->set_height_request(aSize.Height());
770 aFilterAllStr = SfxResId( STR_SFX_FILTERNAME_ALL );
772 // install handler functions
773 m_pChangeButton->SetClickHdl( LINK( this, SfxAcceleratorConfigPage, ChangeHdl ));
774 m_pRemoveButton->SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RemoveHdl ));
775 m_pEntriesBox->SetSelectHdl ( LINK( this, SfxAcceleratorConfigPage, SelectHdl ));
776 m_pGroupLBox->SetSelectHdl ( LINK( this, SfxAcceleratorConfigPage, SelectHdl ));
777 m_pFunctionBox->SetSelectHdl( LINK( this, SfxAcceleratorConfigPage, SelectHdl ));
778 m_pKeyBox->SetSelectHdl ( LINK( this, SfxAcceleratorConfigPage, SelectHdl ));
779 m_pLoadButton->SetClickHdl ( LINK( this, SfxAcceleratorConfigPage, Load ));
780 m_pSaveButton->SetClickHdl ( LINK( this, SfxAcceleratorConfigPage, Save ));
781 m_pResetButton->SetClickHdl ( LINK( this, SfxAcceleratorConfigPage, Default ));
782 m_pOfficeButton->SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RadioHdl ));
783 m_pModuleButton->SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RadioHdl ));
785 // initialize Entriesbox
786 m_pEntriesBox->SetStyle(m_pEntriesBox->GetStyle()|WB_HSCROLL|WB_CLIPCHILDREN);
787 m_pEntriesBox->SetSelectionMode(SINGLE_SELECTION);
788 m_pEntriesBox->SetTabs(&AccCfgTabs[0], MAP_APPFONT);
789 m_pEntriesBox->Resize(); // OS: Hack for right selection
790 m_pEntriesBox->SetSpaceBetweenEntries(0);
791 m_pEntriesBox->SetDragDropMode(DragDropMode::NONE);
793 // detect max keyname width
794 long nMaxWidth = 0;
795 for ( sal_uInt16 i = 0; i < KEYCODE_ARRAY_SIZE; ++i )
797 long nTmp = GetTextWidth( vcl::KeyCode( KEYCODE_ARRAY[i] ).GetName() );
798 if ( nTmp > nMaxWidth )
799 nMaxWidth = nTmp;
801 // recalc second tab
802 long nNewTab = PixelToLogic( Size( nMaxWidth, 0 ), MAP_APPFONT ).Width();
803 nNewTab = nNewTab + 5; // additional space
804 m_pEntriesBox->SetTab( 1, nNewTab );
806 // initialize GroupBox
807 m_pGroupLBox->SetFunctionListBox(m_pFunctionBox);
809 // initialize KeyBox
810 m_pKeyBox->SetStyle(m_pKeyBox->GetStyle()|WB_CLIPCHILDREN|WB_HSCROLL|WB_SORT);
813 SfxAcceleratorConfigPage::~SfxAcceleratorConfigPage()
815 disposeOnce();
818 void SfxAcceleratorConfigPage::dispose()
820 // free memory - remove all dynamic user data
821 SvTreeListEntry* pEntry = m_pEntriesBox->First();
822 while (pEntry)
824 TAccInfo* pUserData = static_cast<TAccInfo*>(pEntry->GetUserData());
825 if (pUserData)
826 delete pUserData;
827 pEntry = m_pEntriesBox->Next(pEntry);
830 pEntry = m_pKeyBox->First();
831 while (pEntry)
833 TAccInfo* pUserData = static_cast<TAccInfo*>(pEntry->GetUserData());
834 if (pUserData)
835 delete pUserData;
836 pEntry = m_pKeyBox->Next(pEntry);
839 m_pEntriesBox->Clear();
840 m_pKeyBox->Clear();
842 delete m_pFileDlg;
843 m_pFileDlg = NULL;
845 m_pEntriesBox.clear();
846 m_pOfficeButton.clear();
847 m_pModuleButton.clear();
848 m_pChangeButton.clear();
849 m_pRemoveButton.clear();
850 m_pGroupLBox.clear();
851 m_pFunctionBox.clear();
852 m_pKeyBox.clear();
853 m_pLoadButton.clear();
854 m_pSaveButton.clear();
855 m_pResetButton.clear();
857 SfxTabPage::dispose();
860 void SfxAcceleratorConfigPage::InitAccCfg()
862 // already initialized ?
863 if (m_xContext.is())
864 return; // yes -> do nothing
868 // no - initialize this instance
869 m_xContext = comphelper::getProcessComponentContext();
871 m_xUICmdDescription = frame::theUICommandDescription::get(m_xContext);
873 // get the current active frame, which should be our "parent"
874 // for this session
875 m_xFrame = GetFrame();
876 if ( !m_xFrame.is() )
878 uno::Reference<frame::XDesktop2> xDesktop = frame::Desktop::create( m_xContext );
879 m_xFrame = xDesktop->getActiveFrame();
882 // identify module
883 uno::Reference<frame::XModuleManager2> xModuleManager =
884 frame::ModuleManager::create(m_xContext);
885 m_sModuleLongName = xModuleManager->identify(m_xFrame);
886 comphelper::SequenceAsHashMap lModuleProps(xModuleManager->getByName(m_sModuleLongName));
887 m_sModuleShortName = lModuleProps.getUnpackedValueOrDefault(MODULEPROP_SHORTNAME, OUString());
888 m_sModuleUIName = lModuleProps.getUnpackedValueOrDefault(MODULEPROP_UINAME , OUString());
890 // get global accelerator configuration
891 m_xGlobal = css::ui::GlobalAcceleratorConfiguration::create(m_xContext);
893 // get module accelerator configuration
895 uno::Reference<ui::XModuleUIConfigurationManagerSupplier> xModuleCfgSupplier(
896 ui::theModuleUIConfigurationManagerSupplier::get(m_xContext));
897 uno::Reference<ui::XUIConfigurationManager> xUICfgManager =
898 xModuleCfgSupplier->getUIConfigurationManager(m_sModuleLongName);
899 m_xModule = xUICfgManager->getShortCutManager();
901 catch(const uno::RuntimeException&)
903 throw;
905 catch(const uno::Exception&)
907 m_xContext.clear();
911 /** Initialize text columns with own class to enable custom painting
912 This is needed as we have to paint disabled entries by ourself. No support for that in the
913 original SvTabListBox!
915 void SfxAcceleratorConfigPage::CreateCustomItems(SvTreeListEntry* pEntry,
916 const OUString& sCol1 ,
917 const OUString& sCol2)
919 SfxAccCfgLBoxString_Impl* pStringItem = new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol1);
920 pEntry->ReplaceItem(pStringItem, 1);
922 pStringItem = new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol2);
923 pEntry->ReplaceItem(pStringItem, 2);
927 void SfxAcceleratorConfigPage::Init(const uno::Reference<ui::XAcceleratorConfiguration>& xAccMgr)
929 if (!xAccMgr.is())
930 return;
932 if (!m_bStylesInfoInitialized)
934 uno::Reference<frame::XController> xController;
935 uno::Reference<frame::XModel> xModel;
936 if (m_xFrame.is())
937 xController = m_xFrame->getController();
938 if (xController.is())
939 xModel = xController->getModel();
941 m_aStylesInfo.setModel(xModel);
942 m_pFunctionBox->SetStylesInfo(&m_aStylesInfo);
943 m_pGroupLBox->SetStylesInfo(&m_aStylesInfo);
944 m_bStylesInfoInitialized = true;
947 // Insert all editable accelerators into list box. It is possible
948 // that some accelerators are not mapped on the current system/keyboard
949 // but we don't want to lose these mappings.
950 sal_Int32 c1 = KEYCODE_ARRAY_SIZE;
951 sal_Int32 i1 = 0;
952 sal_Int32 nListPos = 0;
953 for (i1 = 0; i1 < c1; ++i1)
955 vcl::KeyCode aKey = KEYCODE_ARRAY[i1];
956 OUString sKey = aKey.GetName();
957 if (sKey.isEmpty())
958 continue;
959 TAccInfo* pEntry = new TAccInfo(i1, nListPos, aKey);
960 SvTreeListEntry* pLBEntry = m_pEntriesBox->InsertEntryToColumn(sKey, 0L, TREELIST_APPEND, 0xFFFF);
961 pLBEntry->SetUserData(pEntry);
964 // Assign all commands to its shortcuts - reading the accelerator config.
965 uno::Sequence<awt::KeyEvent> lKeys = xAccMgr->getAllKeyEvents();
966 sal_Int32 c2 = lKeys.getLength();
967 sal_Int32 i2 = 0;
968 sal_uInt16 nCol = m_pEntriesBox->TabCount()-1;
970 for (i2=0; i2<c2; ++i2)
972 const awt::KeyEvent& aAWTKey = lKeys[i2];
973 OUString sCommand = xAccMgr->getCommandByKeyEvent(aAWTKey);
974 OUString sLabel = GetLabel4Command(sCommand);
975 vcl::KeyCode aKeyCode = svt::AcceleratorExecute::st_AWTKey2VCLKey(aAWTKey);
976 sal_uLong nPos = MapKeyCodeToPos(aKeyCode);
978 if (nPos == TREELIST_ENTRY_NOTFOUND)
979 continue;
981 m_pEntriesBox->SetEntryText(sLabel, nPos, nCol);
983 SvTreeListEntry* pLBEntry = m_pEntriesBox->GetEntry(0, nPos);
984 TAccInfo* pEntry = static_cast<TAccInfo*>(pLBEntry->GetUserData());
986 pEntry->m_bIsConfigurable = true;
987 pEntry->m_sCommand = sCommand;
988 CreateCustomItems(pLBEntry, SvTabListBox::GetEntryText(pLBEntry, 0), sLabel);
991 // Map the VCL hardcoded key codes and mark them as not changeable
992 sal_uLong c3 = Application::GetReservedKeyCodeCount();
993 sal_uLong i3 = 0;
994 for (i3 = 0; i3 < c3; ++i3)
996 const vcl::KeyCode* pKeyCode = Application::GetReservedKeyCode(i3);
997 sal_uLong nPos = MapKeyCodeToPos(*pKeyCode);
999 if (nPos == TREELIST_ENTRY_NOTFOUND)
1000 continue;
1002 // Hardcoded function mapped so no ID possible and mark entry as not changeable
1003 SvTreeListEntry* pLBEntry = m_pEntriesBox->GetEntry(0, nPos);
1004 TAccInfo* pEntry = static_cast<TAccInfo*>(pLBEntry->GetUserData());
1006 pEntry->m_bIsConfigurable = false;
1007 CreateCustomItems(pLBEntry, SvTabListBox::GetEntryText(pLBEntry, 0), OUString());
1011 void SfxAcceleratorConfigPage::Apply(const uno::Reference<ui::XAcceleratorConfiguration>& xAccMgr)
1013 if (!xAccMgr.is())
1014 return;
1016 // Go through the list from the bottom to the top ...
1017 // because logical accelerator must be preferred instead of
1018 // physical ones!
1019 SvTreeListEntry* pEntry = m_pEntriesBox->First();
1020 while (pEntry)
1022 TAccInfo* pUserData = static_cast<TAccInfo*>(pEntry->GetUserData());
1023 OUString sCommand;
1024 awt::KeyEvent aAWTKey;
1026 if (pUserData)
1028 sCommand = pUserData->m_sCommand;
1029 aAWTKey = svt::AcceleratorExecute::st_VCLKey2AWTKey(pUserData->m_aKey);
1034 if (!sCommand.isEmpty())
1035 xAccMgr->setKeyEvent(aAWTKey, sCommand);
1036 else
1037 xAccMgr->removeKeyEvent(aAWTKey);
1039 catch(const uno::RuntimeException&)
1041 throw;
1043 catch(const uno::Exception&)
1047 pEntry = m_pEntriesBox->Next(pEntry);
1051 void SfxAcceleratorConfigPage::ResetConfig()
1053 m_pEntriesBox->Clear();
1056 IMPL_LINK_NOARG(SfxAcceleratorConfigPage, Load)
1058 // ask for filename, where we should load the new config data from
1059 StartFileDialog( 0, aLoadAccelConfigStr );
1060 return 0;
1063 IMPL_LINK_NOARG(SfxAcceleratorConfigPage, Save)
1065 StartFileDialog( WB_SAVEAS, aSaveAccelConfigStr );
1066 return 0;
1069 IMPL_LINK_NOARG(SfxAcceleratorConfigPage, Default)
1071 uno::Reference<form::XReset> xReset(m_xAct, uno::UNO_QUERY);
1072 if (xReset.is())
1073 xReset->reset();
1075 m_pEntriesBox->SetUpdateMode(false);
1076 ResetConfig();
1077 Init(m_xAct);
1078 m_pEntriesBox->SetUpdateMode(true);
1079 m_pEntriesBox->Invalidate();
1080 m_pEntriesBox->Select(m_pEntriesBox->GetEntry(0, 0));
1082 return 0;
1085 IMPL_LINK_NOARG(SfxAcceleratorConfigPage, ChangeHdl)
1087 sal_uLong nPos = SvTreeList::GetRelPos( m_pEntriesBox->FirstSelected() );
1088 TAccInfo* pEntry = static_cast<TAccInfo*>(m_pEntriesBox->GetEntry(0, nPos)->GetUserData());
1089 OUString sNewCommand = m_pFunctionBox->GetCurCommand();
1090 OUString sLabel = m_pFunctionBox->GetCurLabel();
1091 if (sLabel.isEmpty())
1092 sLabel = GetLabel4Command(sNewCommand);
1094 pEntry->m_sCommand = sNewCommand;
1095 sal_uInt16 nCol = m_pEntriesBox->TabCount() - 1;
1096 m_pEntriesBox->SetEntryText(sLabel, nPos, nCol);
1098 ((Link<> &) m_pFunctionBox->GetSelectHdl()).Call( m_pFunctionBox );
1099 return 0;
1102 IMPL_LINK_NOARG(SfxAcceleratorConfigPage, RemoveHdl)
1104 // get selected entry
1105 sal_uLong nPos = SvTreeList::GetRelPos( m_pEntriesBox->FirstSelected() );
1106 TAccInfo* pEntry = static_cast<TAccInfo*>(m_pEntriesBox->GetEntry(0, nPos)->GetUserData());
1108 // remove function name from selected entry
1109 sal_uInt16 nCol = m_pEntriesBox->TabCount() - 1;
1110 m_pEntriesBox->SetEntryText( OUString(), nPos, nCol );
1111 (pEntry->m_sCommand).clear();
1113 ((Link<> &) m_pFunctionBox->GetSelectHdl()).Call( m_pFunctionBox );
1114 return 0;
1117 IMPL_LINK( SfxAcceleratorConfigPage, SelectHdl, Control*, pListBox )
1119 // disable help
1120 Help::ShowBalloon( this, Point(), OUString() );
1121 if (pListBox == m_pEntriesBox)
1123 sal_uLong nPos = SvTreeList::GetRelPos( m_pEntriesBox->FirstSelected() );
1124 TAccInfo* pEntry = static_cast<TAccInfo*>(m_pEntriesBox->GetEntry(0, nPos)->GetUserData());
1125 OUString sPossibleNewCommand = m_pFunctionBox->GetCurCommand();
1127 m_pRemoveButton->Enable( false );
1128 m_pChangeButton->Enable( false );
1130 if (pEntry->m_bIsConfigurable)
1132 if (pEntry->isConfigured())
1133 m_pRemoveButton->Enable( true );
1134 m_pChangeButton->Enable( pEntry->m_sCommand != sPossibleNewCommand );
1137 else if ( pListBox == m_pGroupLBox )
1139 m_pGroupLBox->GroupSelected();
1140 if ( !m_pFunctionBox->FirstSelected() )
1141 m_pChangeButton->Enable( false );
1143 else if ( pListBox == m_pFunctionBox )
1145 m_pRemoveButton->Enable( false );
1146 m_pChangeButton->Enable( false );
1148 // #i36994 First selected can return zero!
1149 SvTreeListEntry* pLBEntry = m_pEntriesBox->FirstSelected();
1150 if ( pLBEntry != 0 )
1152 sal_uLong nPos = SvTreeList::GetRelPos( pLBEntry );
1153 TAccInfo* pEntry = static_cast<TAccInfo*>(m_pEntriesBox->GetEntry(0, nPos)->GetUserData());
1154 OUString sPossibleNewCommand = m_pFunctionBox->GetCurCommand();
1156 if (pEntry->m_bIsConfigurable)
1158 if (pEntry->isConfigured())
1159 m_pRemoveButton->Enable( true );
1160 m_pChangeButton->Enable( pEntry->m_sCommand != sPossibleNewCommand );
1163 // update key box
1164 m_pKeyBox->Clear();
1165 SvTreeListEntry* pIt = m_pEntriesBox->First();
1166 while ( pIt )
1168 TAccInfo* pUserData = static_cast<TAccInfo*>(pIt->GetUserData());
1169 if ( pUserData && pUserData->m_sCommand == sPossibleNewCommand )
1171 TAccInfo* pU1 = new TAccInfo(-1, -1, pUserData->m_aKey);
1172 SvTreeListEntry* pE1 = m_pKeyBox->InsertEntry( pUserData->m_aKey.GetName(), 0L, true, TREELIST_APPEND );
1173 pE1->SetUserData(pU1);
1174 pE1->EnableChildrenOnDemand( false );
1176 pIt = m_pEntriesBox->Next(pIt);
1180 else
1182 // goto selected "key" entry of the key box
1183 SvTreeListEntry* pE2 = 0;
1184 TAccInfo* pU2 = 0;
1185 sal_uLong nP2 = TREELIST_ENTRY_NOTFOUND;
1186 SvTreeListEntry* pE3 = 0;
1188 pE2 = m_pKeyBox->FirstSelected();
1189 if (pE2)
1190 pU2 = static_cast<TAccInfo*>(pE2->GetUserData());
1191 if (pU2)
1192 nP2 = MapKeyCodeToPos(pU2->m_aKey);
1193 if (nP2 != TREELIST_ENTRY_NOTFOUND)
1194 pE3 = m_pEntriesBox->GetEntry( 0, nP2 );
1195 if (pE3)
1197 m_pEntriesBox->Select( pE3 );
1198 m_pEntriesBox->MakeVisible( pE3 );
1202 return 0;
1205 IMPL_LINK_NOARG(SfxAcceleratorConfigPage, RadioHdl)
1207 uno::Reference<ui::XAcceleratorConfiguration> xOld = m_xAct;
1209 if (m_pOfficeButton->IsChecked())
1210 m_xAct = m_xGlobal;
1211 else if (m_pModuleButton->IsChecked())
1212 m_xAct = m_xModule;
1214 // nothing changed? => do nothing!
1215 if ( m_xAct.is() && ( xOld == m_xAct ) )
1216 return 0;
1218 m_pEntriesBox->SetUpdateMode( false );
1219 ResetConfig();
1220 Init(m_xAct);
1221 m_pEntriesBox->SetUpdateMode( true );
1222 m_pEntriesBox->Invalidate();
1224 m_pGroupLBox->Init(m_xContext, m_xFrame, m_sModuleLongName, true);
1226 // pb: #133213# do not select NULL entries
1227 SvTreeListEntry* pEntry = m_pEntriesBox->GetEntry( 0, 0 );
1228 if ( pEntry )
1229 m_pEntriesBox->Select( pEntry );
1230 pEntry = m_pGroupLBox->GetEntry( 0, 0 );
1231 if ( pEntry )
1232 m_pGroupLBox->Select( pEntry );
1234 ((Link<> &) m_pFunctionBox->GetSelectHdl()).Call( m_pFunctionBox );
1235 return 1L;
1239 IMPL_LINK_NOARG(SfxAcceleratorConfigPage, LoadHdl)
1241 assert(m_pFileDlg);
1243 OUString sCfgName;
1244 if ( ERRCODE_NONE == m_pFileDlg->GetError() )
1245 sCfgName = m_pFileDlg->GetPath();
1247 if ( sCfgName.isEmpty() )
1248 return 0;
1250 GetTabDialog()->EnterWait();
1252 uno::Reference<frame::XModel> xDoc;
1253 uno::Reference<ui::XUIConfigurationManager> xCfgMgr;
1254 uno::Reference<embed::XStorage> xRootStorage; // we must hold the root storage alive, if xCfgMgr is used!
1258 // first check if URL points to a document already loaded
1259 xDoc = SearchForAlreadyLoadedDoc(sCfgName);
1260 if (xDoc.is())
1262 // Get ui config manager. There should always be one at the model.
1263 uno::Reference<ui::XUIConfigurationManagerSupplier> xCfgSupplier(xDoc, uno::UNO_QUERY_THROW);
1264 xCfgMgr = xCfgSupplier->getUIConfigurationManager();
1266 else
1268 // URL doesn't point to a loaded document, try to access it as a single storage
1269 // dont forget to release the storage afterwards!
1270 uno::Reference<lang::XSingleServiceFactory> xStorageFactory(embed::StorageFactory::create(m_xContext));
1271 uno::Sequence<uno::Any> lArgs(2);
1272 lArgs[0] <<= sCfgName;
1273 lArgs[1] <<= css::embed::ElementModes::READ;
1275 xRootStorage = uno::Reference<embed::XStorage>(xStorageFactory->createInstanceWithArguments(lArgs), uno::UNO_QUERY_THROW);
1276 uno::Reference<embed::XStorage> xUIConfig = xRootStorage->openStorageElement(FOLDERNAME_UICONFIG, embed::ElementModes::READ);
1277 if (xUIConfig.is())
1279 uno::Reference<ui::XUIConfigurationManager2> xCfgMgr2 = ui::UIConfigurationManager::create(m_xContext);
1280 xCfgMgr2->setStorage(xUIConfig);
1281 xCfgMgr.set(xCfgMgr2, uno::UNO_QUERY_THROW);
1285 if (xCfgMgr.is())
1287 // open the configuration and update our UI
1288 uno::Reference<ui::XAcceleratorConfiguration> xTempAccMgr(xCfgMgr->getShortCutManager(), uno::UNO_QUERY_THROW);
1290 m_pEntriesBox->SetUpdateMode(false);
1291 ResetConfig();
1292 Init(xTempAccMgr);
1293 m_pEntriesBox->SetUpdateMode(true);
1294 m_pEntriesBox->Invalidate();
1295 m_pEntriesBox->Select(m_pEntriesBox->GetEntry(0, 0));
1299 // dont forget to close the new opened storage!
1300 // We are the owner of it.
1301 if (xRootStorage.is())
1303 uno::Reference<lang::XComponent> xComponent;
1304 xComponent = uno::Reference<css::lang::XComponent>(xCfgMgr, uno::UNO_QUERY);
1305 if (xComponent.is())
1306 xComponent->dispose();
1307 xComponent = uno::Reference<css::lang::XComponent>(xRootStorage, uno::UNO_QUERY);
1308 if (xComponent.is())
1309 xComponent->dispose();
1312 catch(const uno::RuntimeException&)
1314 throw;
1316 catch(const uno::Exception&)
1319 GetTabDialog()->LeaveWait();
1321 return 0;
1325 IMPL_LINK_NOARG(SfxAcceleratorConfigPage, SaveHdl)
1327 assert(m_pFileDlg);
1329 OUString sCfgName;
1330 if ( ERRCODE_NONE == m_pFileDlg->GetError() )
1331 sCfgName = m_pFileDlg->GetPath();
1333 if ( sCfgName.isEmpty() )
1334 return 0;
1336 GetTabDialog()->EnterWait();
1338 uno::Reference<frame::XModel> xDoc;
1339 uno::Reference<ui::XUIConfigurationManager> xCfgMgr;
1340 uno::Reference<embed::XStorage> xRootStorage;
1344 // first check if URL points to a document already loaded
1345 xDoc = SearchForAlreadyLoadedDoc(sCfgName);
1346 if (xDoc.is())
1348 // get config manager, force creation if there was none before
1349 uno::Reference<ui::XUIConfigurationManagerSupplier> xCfgSupplier(xDoc, uno::UNO_QUERY_THROW);
1350 xCfgMgr = xCfgSupplier->getUIConfigurationManager();
1352 else
1354 // URL doesn't point to a loaded document, try to access it as a single storage
1355 uno::Reference<lang::XSingleServiceFactory> xStorageFactory(embed::StorageFactory::create(m_xContext));
1356 uno::Sequence<uno::Any> lArgs(2);
1357 lArgs[0] <<= sCfgName;
1358 lArgs[1] <<= embed::ElementModes::WRITE;
1360 xRootStorage = uno::Reference<embed::XStorage>(
1361 xStorageFactory->createInstanceWithArguments(lArgs),
1362 uno::UNO_QUERY_THROW);
1364 uno::Reference<embed::XStorage> xUIConfig(
1365 xRootStorage->openStorageElement(FOLDERNAME_UICONFIG, embed::ElementModes::WRITE),
1366 uno::UNO_QUERY_THROW);
1367 uno::Reference<beans::XPropertySet> xUIConfigProps(
1368 xUIConfig,
1369 uno::UNO_QUERY_THROW);
1371 // set the correct media type if the storage was new created
1372 OUString sMediaType;
1373 xUIConfigProps->getPropertyValue(MEDIATYPE_PROPNAME) >>= sMediaType;
1374 if (sMediaType.isEmpty())
1375 xUIConfigProps->setPropertyValue(MEDIATYPE_PROPNAME, uno::makeAny(OUString(MEDIATYPE_UICONFIG)));
1377 uno::Reference<ui::XUIConfigurationManager2> xCfgMgr2 = ui::UIConfigurationManager::create(m_xContext);
1378 xCfgMgr2->setStorage(xUIConfig);
1379 xCfgMgr.set( xCfgMgr2, uno::UNO_QUERY_THROW );
1382 if (xCfgMgr.is())
1384 // get the target configuration access and update with all shortcuts
1385 // which are set currently at the UI !
1386 // Dont copy the m_xAct content to it ... because m_xAct will be updated
1387 // from the UI on pressing the button "OK" only. And inbetween it's not up to date !
1388 uno::Reference<ui::XAcceleratorConfiguration> xTargetAccMgr(xCfgMgr->getShortCutManager(), uno::UNO_QUERY_THROW);
1389 Apply(xTargetAccMgr);
1391 // commit (order is important!)
1392 uno::Reference<ui::XUIConfigurationPersistence> xCommit1(xTargetAccMgr, uno::UNO_QUERY_THROW);
1393 uno::Reference<ui::XUIConfigurationPersistence> xCommit2(xCfgMgr , uno::UNO_QUERY_THROW);
1394 xCommit1->store();
1395 xCommit2->store();
1397 if (xRootStorage.is())
1399 // Commit root storage
1400 uno::Reference<embed::XTransactedObject> xCommit3(xRootStorage, uno::UNO_QUERY_THROW);
1401 xCommit3->commit();
1405 if (xRootStorage.is())
1407 uno::Reference<lang::XComponent> xComponent(xCfgMgr, uno::UNO_QUERY);
1408 if (xComponent.is())
1409 xComponent->dispose();
1410 xComponent.set(xRootStorage, uno::UNO_QUERY);
1411 if (xComponent.is())
1412 xComponent->dispose();
1415 catch(const uno::RuntimeException&)
1417 throw;
1419 catch(const uno::Exception&)
1422 GetTabDialog()->LeaveWait();
1424 return 0;
1428 void SfxAcceleratorConfigPage::StartFileDialog( WinBits nBits, const OUString& rTitle )
1430 bool bSave = ( ( nBits & WB_SAVEAS ) == WB_SAVEAS );
1431 short nDialogType = bSave ? ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION
1432 : ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE;
1433 if ( m_pFileDlg )
1434 delete m_pFileDlg;
1435 m_pFileDlg = new sfx2::FileDialogHelper( nDialogType, 0 );
1437 m_pFileDlg->SetTitle( rTitle );
1438 m_pFileDlg->AddFilter( aFilterAllStr, OUString(FILEDIALOG_FILTER_ALL) );
1439 m_pFileDlg->AddFilter( aFilterCfgStr, OUString("*.cfg") );
1440 m_pFileDlg->SetCurrentFilter( aFilterCfgStr );
1442 Link<> aDlgClosedLink = bSave ? LINK( this, SfxAcceleratorConfigPage, SaveHdl )
1443 : LINK( this, SfxAcceleratorConfigPage, LoadHdl );
1444 m_pFileDlg->StartExecuteModal( aDlgClosedLink );
1448 bool SfxAcceleratorConfigPage::FillItemSet( SfxItemSet* )
1450 Apply(m_xAct);
1453 m_xAct->store();
1455 catch(const uno::RuntimeException&)
1457 throw;
1459 catch(const uno::Exception&)
1461 return false;
1464 return true;
1468 void SfxAcceleratorConfigPage::Reset( const SfxItemSet* rSet )
1470 // open accelerator configs
1471 // Note: It initialize some other members too, which are needed here ...
1472 // e.g. m_sModuleUIName!
1473 InitAccCfg();
1475 // change the description of the radio button, which switch to the module
1476 // dependent accelerator configuration
1477 OUString sButtonText = m_pModuleButton->GetText();
1478 sButtonText = sButtonText.replaceFirst("$(MODULE)", m_sModuleUIName);
1479 m_pModuleButton->SetText(sButtonText);
1481 if (m_xModule.is())
1482 m_pModuleButton->Check();
1483 else
1485 m_pModuleButton->Hide();
1486 m_pOfficeButton->Check();
1489 RadioHdl(0);
1491 const SfxPoolItem* pMacroItem=0;
1492 if( SfxItemState::SET == rSet->GetItemState( SID_MACROINFO, true, &pMacroItem ) )
1494 m_pMacroInfoItem = PTR_CAST( SfxMacroInfoItem, pMacroItem );
1495 m_pGroupLBox->SelectMacro( m_pMacroInfoItem );
1497 else
1499 const SfxPoolItem* pStringItem=0;
1500 if( SfxItemState::SET == rSet->GetItemState( SID_CHARMAP, true, &pStringItem ) )
1501 m_pStringItem = PTR_CAST( SfxStringItem, pStringItem );
1503 const SfxPoolItem* pFontItem=0;
1504 if( SfxItemState::SET == rSet->GetItemState( SID_ATTR_SPECIALCHAR, true, &pFontItem ) )
1505 m_pFontItem = PTR_CAST( SfxStringItem, pFontItem );
1510 sal_uLong SfxAcceleratorConfigPage::MapKeyCodeToPos(const vcl::KeyCode& aKey) const
1512 sal_uInt16 nCode1 = aKey.GetCode() + aKey.GetModifier();
1513 SvTreeListEntry* pEntry = m_pEntriesBox->First();
1514 sal_uLong i = 0;
1516 while (pEntry)
1518 TAccInfo* pUserData = static_cast<TAccInfo*>(pEntry->GetUserData());
1519 if (pUserData)
1521 sal_uInt16 nCode2 = pUserData->m_aKey.GetCode()+pUserData->m_aKey.GetModifier();
1522 if (nCode1 == nCode2)
1523 return i;
1525 pEntry = m_pEntriesBox->Next(pEntry);
1526 ++i;
1529 return TREELIST_ENTRY_NOTFOUND;
1533 OUString SfxAcceleratorConfigPage::GetLabel4Command(const OUString& sCommand)
1537 // check global command configuration first
1538 uno::Reference<container::XNameAccess> xModuleConf;
1539 m_xUICmdDescription->getByName(m_sModuleLongName) >>= xModuleConf;
1540 if (xModuleConf.is())
1542 ::comphelper::SequenceAsHashMap lProps(xModuleConf->getByName(sCommand));
1543 OUString sLabel = lProps.getUnpackedValueOrDefault(CMDPROP_UINAME, OUString());
1544 if (!sLabel.isEmpty())
1545 return sLabel;
1548 catch(const uno::RuntimeException&)
1550 throw;
1552 catch(const uno::Exception&)
1555 // may be it's a style URL .. they must be handled special
1556 SfxStyleInfo_Impl aStyle;
1557 aStyle.sCommand = sCommand;
1558 if (SfxStylesInfo_Impl::parseStyleCommand(aStyle))
1560 m_aStylesInfo.getLabel4Style(aStyle);
1561 return aStyle.sLabel;
1564 return sCommand;
1567 uno::Reference<frame::XModel> SfxAcceleratorConfigPage::SearchForAlreadyLoadedDoc(const OUString& /*sName*/)
1569 return uno::Reference<frame::XModel>();
1572 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */