1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_cui.hxx" 30 31 //----------------------------------------------- 32 // include own files 33 34 #include "acccfg.hxx" 35 #include "cfgutil.hxx" 36 #include <dialmgr.hxx> 37 38 #include <sfx2/msg.hxx> 39 #include <sfx2/app.hxx> 40 #include <sfx2/filedlghelper.hxx> 41 #include <sfx2/minfitem.hxx> 42 #include <sfx2/sfxresid.hxx> 43 #include <svl/stritem.hxx> 44 45 #include "cuires.hrc" 46 #include "acccfg.hrc" 47 48 #include <svx/svxids.hrc> // SID_CHARMAP, SID_ATTR_SPECIALCHAR 49 50 //----------------------------------------------- 51 // include interface declarations 52 #include <com/sun/star/frame/XFramesSupplier.hpp> 53 #include <com/sun/star/frame/XFrame.hpp> 54 #include <com/sun/star/frame/XController.hpp> 55 #include <com/sun/star/frame/XModel.hpp> 56 #include <com/sun/star/form/XReset.hpp> 57 #include <com/sun/star/frame/XModuleManager.hpp> 58 #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> 59 #include <com/sun/star/frame/XModuleManager.hpp> 60 61 #ifndef _COM_SUN_STAR_UI_XUICONFIGURATIONMANAGERSUPLLIER_HPP_ 62 #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> 63 #endif 64 #include <com/sun/star/ui/XUIConfigurationManager.hpp> 65 #include <com/sun/star/awt/KeyModifier.hpp> 66 #include <com/sun/star/embed/XTransactedObject.hpp> 67 #include <com/sun/star/embed/ElementModes.hpp> 68 69 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> 70 71 //----------------------------------------------- 72 // include other projects 73 #include <unotools/processfactory.hxx> 74 #include <svtools/acceleratorexecute.hxx> 75 #include <comphelper/processfactory.hxx> 76 #include <svtools/svlbitm.hxx> 77 #include <vcl/svapp.hxx> 78 #include <vcl/help.hxx> 79 #include <rtl/ustrbuf.hxx> 80 #include <comphelper/sequenceashashmap.hxx> 81 82 //----------------------------------------------- 83 // namespaces 84 85 #ifdef css 86 #error "ambigous praeprozessor directive for css ..." 87 #else 88 namespace css = ::com::sun::star; 89 #endif 90 91 using namespace com::sun::star; 92 93 //----------------------------------------------- 94 // definitions 95 96 //----------------------------------------------- 97 static ::rtl::OUString SERVICE_STORAGEFACTORY = ::rtl::OUString::createFromAscii("com.sun.star.embed.StorageFactory" ); 98 static ::rtl::OUString SERVICE_UICONFIGMGR = ::rtl::OUString::createFromAscii("com.sun.star.ui.UIConfigurationManager" ); 99 static ::rtl::OUString SERVICE_DESKTOP = ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop" ); 100 static ::rtl::OUString SERVICE_MODULEMANAGER = ::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager" ); 101 static ::rtl::OUString SERVICE_GLOBALACCCFG = ::rtl::OUString::createFromAscii("com.sun.star.ui.GlobalAcceleratorConfiguration" ); 102 static ::rtl::OUString SERVICE_MODULEUICONFIGSUPPLIER = ::rtl::OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier"); 103 static ::rtl::OUString SERVICE_UICMDDESCRIPTION = ::rtl::OUString::createFromAscii("com.sun.star.frame.UICommandDescription" ); 104 105 static ::rtl::OUString MODULEPROP_SHORTNAME = ::rtl::OUString::createFromAscii("ooSetupFactoryShortName" ); 106 static ::rtl::OUString MODULEPROP_UINAME = ::rtl::OUString::createFromAscii("ooSetupFactoryUIName" ); 107 static ::rtl::OUString CMDPROP_UINAME = ::rtl::OUString::createFromAscii("Name" ); 108 109 static ::rtl::OUString FOLDERNAME_UICONFIG = ::rtl::OUString::createFromAscii("Configurations2" ); 110 111 static ::rtl::OUString MEDIATYPE_PROPNAME = ::rtl::OUString::createFromAscii("MediaType" ); 112 static ::rtl::OUString MEDIATYPE_UICONFIG = ::rtl::OUString::createFromAscii("application/vnd.sun.xml.ui.configuration" ); 113 114 //----------------------------------------------- 115 static sal_uInt16 __FAR_DATA KEYCODE_ARRAY[] = 116 { 117 KEY_F1 , 118 KEY_F2 , 119 KEY_F3 , 120 KEY_F4 , 121 KEY_F5 , 122 KEY_F6 , 123 KEY_F7 , 124 KEY_F8 , 125 KEY_F9 , 126 KEY_F10 , 127 KEY_F11 , 128 KEY_F12 , 129 130 KEY_DOWN , 131 KEY_UP , 132 KEY_LEFT , 133 KEY_RIGHT , 134 KEY_HOME , 135 KEY_END , 136 KEY_PAGEUP , 137 KEY_PAGEDOWN , 138 KEY_RETURN , 139 KEY_ESCAPE , 140 KEY_BACKSPACE, 141 KEY_INSERT , 142 KEY_DELETE , 143 144 KEY_OPEN , 145 KEY_CUT , 146 KEY_COPY , 147 KEY_PASTE , 148 KEY_UNDO , 149 KEY_REPEAT , 150 KEY_FIND , 151 KEY_PROPERTIES , 152 KEY_FRONT , 153 KEY_CONTEXTMENU , 154 KEY_MENU , 155 KEY_HELP , 156 157 KEY_F1 | KEY_SHIFT, 158 KEY_F2 | KEY_SHIFT, 159 KEY_F3 | KEY_SHIFT, 160 KEY_F4 | KEY_SHIFT, 161 KEY_F5 | KEY_SHIFT, 162 KEY_F6 | KEY_SHIFT, 163 KEY_F7 | KEY_SHIFT, 164 KEY_F8 | KEY_SHIFT, 165 KEY_F9 | KEY_SHIFT, 166 KEY_F10 | KEY_SHIFT, 167 KEY_F11 | KEY_SHIFT, 168 KEY_F12 | KEY_SHIFT, 169 170 KEY_DOWN | KEY_SHIFT, 171 KEY_UP | KEY_SHIFT, 172 KEY_LEFT | KEY_SHIFT, 173 KEY_RIGHT | KEY_SHIFT, 174 KEY_HOME | KEY_SHIFT, 175 KEY_END | KEY_SHIFT, 176 KEY_PAGEUP | KEY_SHIFT, 177 KEY_PAGEDOWN | KEY_SHIFT, 178 KEY_RETURN | KEY_SHIFT, 179 KEY_SPACE | KEY_SHIFT, 180 KEY_ESCAPE | KEY_SHIFT, 181 KEY_BACKSPACE | KEY_SHIFT, 182 KEY_INSERT | KEY_SHIFT, 183 KEY_DELETE | KEY_SHIFT, 184 185 KEY_0 | KEY_MOD1 , 186 KEY_1 | KEY_MOD1 , 187 KEY_2 | KEY_MOD1 , 188 KEY_3 | KEY_MOD1 , 189 KEY_4 | KEY_MOD1 , 190 KEY_5 | KEY_MOD1 , 191 KEY_6 | KEY_MOD1 , 192 KEY_7 | KEY_MOD1 , 193 KEY_8 | KEY_MOD1 , 194 KEY_9 | KEY_MOD1 , 195 KEY_A | KEY_MOD1 , 196 KEY_B | KEY_MOD1 , 197 KEY_C | KEY_MOD1 , 198 KEY_D | KEY_MOD1 , 199 KEY_E | KEY_MOD1 , 200 KEY_F | KEY_MOD1 , 201 KEY_G | KEY_MOD1 , 202 KEY_H | KEY_MOD1 , 203 KEY_I | KEY_MOD1 , 204 KEY_J | KEY_MOD1 , 205 KEY_K | KEY_MOD1 , 206 KEY_L | KEY_MOD1 , 207 KEY_M | KEY_MOD1 , 208 KEY_N | KEY_MOD1 , 209 KEY_O | KEY_MOD1 , 210 KEY_P | KEY_MOD1 , 211 KEY_Q | KEY_MOD1 , 212 KEY_R | KEY_MOD1 , 213 KEY_S | KEY_MOD1 , 214 KEY_T | KEY_MOD1 , 215 KEY_U | KEY_MOD1 , 216 KEY_V | KEY_MOD1 , 217 KEY_W | KEY_MOD1 , 218 KEY_X | KEY_MOD1 , 219 KEY_Y | KEY_MOD1 , 220 KEY_Z | KEY_MOD1 , 221 222 KEY_F1 | KEY_MOD1 , 223 KEY_F2 | KEY_MOD1 , 224 KEY_F3 | KEY_MOD1 , 225 KEY_F4 | KEY_MOD1 , 226 KEY_F5 | KEY_MOD1 , 227 KEY_F6 | KEY_MOD1 , 228 KEY_F7 | KEY_MOD1 , 229 KEY_F8 | KEY_MOD1 , 230 KEY_F9 | KEY_MOD1 , 231 KEY_F10 | KEY_MOD1 , 232 KEY_F11 | KEY_MOD1 , 233 KEY_F12 | KEY_MOD1 , 234 235 KEY_DOWN | KEY_MOD1 , 236 KEY_UP | KEY_MOD1 , 237 KEY_LEFT | KEY_MOD1 , 238 KEY_RIGHT | KEY_MOD1 , 239 KEY_HOME | KEY_MOD1 , 240 KEY_END | KEY_MOD1 , 241 KEY_PAGEUP | KEY_MOD1 , 242 KEY_PAGEDOWN | KEY_MOD1 , 243 KEY_RETURN | KEY_MOD1 , 244 KEY_SPACE | KEY_MOD1 , 245 KEY_BACKSPACE | KEY_MOD1 , 246 KEY_INSERT | KEY_MOD1 , 247 KEY_DELETE | KEY_MOD1 , 248 249 KEY_ADD | KEY_MOD1 , 250 KEY_SUBTRACT | KEY_MOD1 , 251 KEY_MULTIPLY | KEY_MOD1 , 252 KEY_DIVIDE | KEY_MOD1 , 253 254 KEY_0 | KEY_SHIFT | KEY_MOD1, 255 KEY_1 | KEY_SHIFT | KEY_MOD1, 256 KEY_2 | KEY_SHIFT | KEY_MOD1, 257 KEY_3 | KEY_SHIFT | KEY_MOD1, 258 KEY_4 | KEY_SHIFT | KEY_MOD1, 259 KEY_5 | KEY_SHIFT | KEY_MOD1, 260 KEY_6 | KEY_SHIFT | KEY_MOD1, 261 KEY_7 | KEY_SHIFT | KEY_MOD1, 262 KEY_8 | KEY_SHIFT | KEY_MOD1, 263 KEY_9 | KEY_SHIFT | KEY_MOD1, 264 KEY_A | KEY_SHIFT | KEY_MOD1, 265 KEY_B | KEY_SHIFT | KEY_MOD1, 266 KEY_C | KEY_SHIFT | KEY_MOD1, 267 KEY_D | KEY_SHIFT | KEY_MOD1, 268 KEY_E | KEY_SHIFT | KEY_MOD1, 269 KEY_F | KEY_SHIFT | KEY_MOD1, 270 KEY_G | KEY_SHIFT | KEY_MOD1, 271 KEY_H | KEY_SHIFT | KEY_MOD1, 272 KEY_I | KEY_SHIFT | KEY_MOD1, 273 KEY_J | KEY_SHIFT | KEY_MOD1, 274 KEY_K | KEY_SHIFT | KEY_MOD1, 275 KEY_L | KEY_SHIFT | KEY_MOD1, 276 KEY_M | KEY_SHIFT | KEY_MOD1, 277 KEY_N | KEY_SHIFT | KEY_MOD1, 278 KEY_O | KEY_SHIFT | KEY_MOD1, 279 KEY_P | KEY_SHIFT | KEY_MOD1, 280 KEY_Q | KEY_SHIFT | KEY_MOD1, 281 KEY_R | KEY_SHIFT | KEY_MOD1, 282 KEY_S | KEY_SHIFT | KEY_MOD1, 283 KEY_T | KEY_SHIFT | KEY_MOD1, 284 KEY_U | KEY_SHIFT | KEY_MOD1, 285 KEY_V | KEY_SHIFT | KEY_MOD1, 286 KEY_W | KEY_SHIFT | KEY_MOD1, 287 KEY_X | KEY_SHIFT | KEY_MOD1, 288 KEY_Y | KEY_SHIFT | KEY_MOD1, 289 KEY_Z | KEY_SHIFT | KEY_MOD1, 290 291 KEY_F1 | KEY_SHIFT | KEY_MOD1, 292 KEY_F2 | KEY_SHIFT | KEY_MOD1, 293 KEY_F3 | KEY_SHIFT | KEY_MOD1, 294 KEY_F4 | KEY_SHIFT | KEY_MOD1, 295 KEY_F5 | KEY_SHIFT | KEY_MOD1, 296 KEY_F6 | KEY_SHIFT | KEY_MOD1, 297 KEY_F7 | KEY_SHIFT | KEY_MOD1, 298 KEY_F8 | KEY_SHIFT | KEY_MOD1, 299 KEY_F9 | KEY_SHIFT | KEY_MOD1, 300 KEY_F10 | KEY_SHIFT | KEY_MOD1, 301 KEY_F11 | KEY_SHIFT | KEY_MOD1, 302 KEY_F12 | KEY_SHIFT | KEY_MOD1, 303 304 KEY_DOWN | KEY_SHIFT | KEY_MOD1, 305 KEY_UP | KEY_SHIFT | KEY_MOD1, 306 KEY_LEFT | KEY_SHIFT | KEY_MOD1, 307 KEY_RIGHT | KEY_SHIFT | KEY_MOD1, 308 KEY_HOME | KEY_SHIFT | KEY_MOD1, 309 KEY_END | KEY_SHIFT | KEY_MOD1, 310 KEY_PAGEUP | KEY_SHIFT | KEY_MOD1, 311 KEY_PAGEDOWN | KEY_SHIFT | KEY_MOD1, 312 KEY_RETURN | KEY_SHIFT | KEY_MOD1, 313 KEY_SPACE | KEY_SHIFT | KEY_MOD1, 314 KEY_BACKSPACE | KEY_SHIFT | KEY_MOD1, 315 KEY_INSERT | KEY_SHIFT | KEY_MOD1, 316 KEY_DELETE | KEY_SHIFT | KEY_MOD1, 317 318 KEY_0 | KEY_MOD2 , 319 KEY_1 | KEY_MOD2 , 320 KEY_2 | KEY_MOD2 , 321 KEY_3 | KEY_MOD2 , 322 KEY_4 | KEY_MOD2 , 323 KEY_5 | KEY_MOD2 , 324 KEY_6 | KEY_MOD2 , 325 KEY_7 | KEY_MOD2 , 326 KEY_8 | KEY_MOD2 , 327 KEY_9 | KEY_MOD2 , 328 KEY_A | KEY_MOD2 , 329 KEY_B | KEY_MOD2 , 330 KEY_C | KEY_MOD2 , 331 KEY_D | KEY_MOD2 , 332 KEY_E | KEY_MOD2 , 333 KEY_F | KEY_MOD2 , 334 KEY_G | KEY_MOD2 , 335 KEY_H | KEY_MOD2 , 336 KEY_I | KEY_MOD2 , 337 KEY_J | KEY_MOD2 , 338 KEY_K | KEY_MOD2 , 339 KEY_L | KEY_MOD2 , 340 KEY_M | KEY_MOD2 , 341 KEY_N | KEY_MOD2 , 342 KEY_O | KEY_MOD2 , 343 KEY_P | KEY_MOD2 , 344 KEY_Q | KEY_MOD2 , 345 KEY_R | KEY_MOD2 , 346 KEY_S | KEY_MOD2 , 347 KEY_T | KEY_MOD2 , 348 KEY_U | KEY_MOD2 , 349 KEY_V | KEY_MOD2 , 350 KEY_W | KEY_MOD2 , 351 KEY_X | KEY_MOD2 , 352 KEY_Y | KEY_MOD2 , 353 KEY_Z | KEY_MOD2 , 354 355 KEY_F1 | KEY_MOD2 , 356 KEY_F2 | KEY_MOD2 , 357 KEY_F3 | KEY_MOD2 , 358 KEY_F4 | KEY_MOD2 , 359 KEY_F5 | KEY_MOD2 , 360 KEY_F6 | KEY_MOD2 , 361 KEY_F7 | KEY_MOD2 , 362 KEY_F8 | KEY_MOD2 , 363 KEY_F9 | KEY_MOD2 , 364 KEY_F10 | KEY_MOD2 , 365 KEY_F11 | KEY_MOD2 , 366 KEY_F12 | KEY_MOD2 , 367 368 KEY_DOWN | KEY_MOD2 , 369 KEY_UP | KEY_MOD2 , 370 KEY_LEFT | KEY_MOD2 , 371 KEY_RIGHT | KEY_MOD2 , 372 KEY_HOME | KEY_MOD2 , 373 KEY_END | KEY_MOD2 , 374 KEY_PAGEUP | KEY_MOD2 , 375 KEY_PAGEDOWN | KEY_MOD2 , 376 KEY_RETURN | KEY_MOD2 , 377 KEY_SPACE | KEY_MOD2 , 378 KEY_BACKSPACE | KEY_MOD2 , 379 KEY_INSERT | KEY_MOD2 , 380 KEY_DELETE | KEY_MOD2 , 381 382 KEY_0 | KEY_SHIFT | KEY_MOD2, 383 KEY_1 | KEY_SHIFT | KEY_MOD2, 384 KEY_2 | KEY_SHIFT | KEY_MOD2, 385 KEY_3 | KEY_SHIFT | KEY_MOD2, 386 KEY_4 | KEY_SHIFT | KEY_MOD2, 387 KEY_5 | KEY_SHIFT | KEY_MOD2, 388 KEY_6 | KEY_SHIFT | KEY_MOD2, 389 KEY_7 | KEY_SHIFT | KEY_MOD2, 390 KEY_8 | KEY_SHIFT | KEY_MOD2, 391 KEY_9 | KEY_SHIFT | KEY_MOD2, 392 KEY_A | KEY_SHIFT | KEY_MOD2, 393 KEY_B | KEY_SHIFT | KEY_MOD2, 394 KEY_C | KEY_SHIFT | KEY_MOD2, 395 KEY_D | KEY_SHIFT | KEY_MOD2, 396 KEY_E | KEY_SHIFT | KEY_MOD2, 397 KEY_F | KEY_SHIFT | KEY_MOD2, 398 KEY_G | KEY_SHIFT | KEY_MOD2, 399 KEY_H | KEY_SHIFT | KEY_MOD2, 400 KEY_I | KEY_SHIFT | KEY_MOD2, 401 KEY_J | KEY_SHIFT | KEY_MOD2, 402 KEY_K | KEY_SHIFT | KEY_MOD2, 403 KEY_L | KEY_SHIFT | KEY_MOD2, 404 KEY_M | KEY_SHIFT | KEY_MOD2, 405 KEY_N | KEY_SHIFT | KEY_MOD2, 406 KEY_O | KEY_SHIFT | KEY_MOD2, 407 KEY_P | KEY_SHIFT | KEY_MOD2, 408 KEY_Q | KEY_SHIFT | KEY_MOD2, 409 KEY_R | KEY_SHIFT | KEY_MOD2, 410 KEY_S | KEY_SHIFT | KEY_MOD2, 411 KEY_T | KEY_SHIFT | KEY_MOD2, 412 KEY_U | KEY_SHIFT | KEY_MOD2, 413 KEY_V | KEY_SHIFT | KEY_MOD2, 414 KEY_W | KEY_SHIFT | KEY_MOD2, 415 KEY_X | KEY_SHIFT | KEY_MOD2, 416 KEY_Y | KEY_SHIFT | KEY_MOD2, 417 KEY_Z | KEY_SHIFT | KEY_MOD2, 418 419 KEY_F1 | KEY_SHIFT | KEY_MOD2, 420 KEY_F2 | KEY_SHIFT | KEY_MOD2, 421 KEY_F3 | KEY_SHIFT | KEY_MOD2, 422 KEY_F4 | KEY_SHIFT | KEY_MOD2, 423 KEY_F5 | KEY_SHIFT | KEY_MOD2, 424 KEY_F6 | KEY_SHIFT | KEY_MOD2, 425 KEY_F7 | KEY_SHIFT | KEY_MOD2, 426 KEY_F8 | KEY_SHIFT | KEY_MOD2, 427 KEY_F9 | KEY_SHIFT | KEY_MOD2, 428 KEY_F10 | KEY_SHIFT | KEY_MOD2, 429 KEY_F11 | KEY_SHIFT | KEY_MOD2, 430 KEY_F12 | KEY_SHIFT | KEY_MOD2, 431 432 KEY_DOWN | KEY_SHIFT | KEY_MOD2, 433 KEY_UP | KEY_SHIFT | KEY_MOD2, 434 KEY_LEFT | KEY_SHIFT | KEY_MOD2, 435 KEY_RIGHT | KEY_SHIFT | KEY_MOD2, 436 KEY_HOME | KEY_SHIFT | KEY_MOD2, 437 KEY_END | KEY_SHIFT | KEY_MOD2, 438 KEY_PAGEUP | KEY_SHIFT | KEY_MOD2, 439 KEY_PAGEDOWN | KEY_SHIFT | KEY_MOD2, 440 KEY_RETURN | KEY_SHIFT | KEY_MOD2, 441 KEY_SPACE | KEY_SHIFT | KEY_MOD2, 442 KEY_BACKSPACE | KEY_SHIFT | KEY_MOD2, 443 KEY_INSERT | KEY_SHIFT | KEY_MOD2, 444 KEY_DELETE | KEY_SHIFT | KEY_MOD2, 445 446 KEY_0 | KEY_MOD1 | KEY_MOD2 , 447 KEY_1 | KEY_MOD1 | KEY_MOD2 , 448 KEY_2 | KEY_MOD1 | KEY_MOD2 , 449 KEY_3 | KEY_MOD1 | KEY_MOD2 , 450 KEY_4 | KEY_MOD1 | KEY_MOD2 , 451 KEY_5 | KEY_MOD1 | KEY_MOD2 , 452 KEY_6 | KEY_MOD1 | KEY_MOD2 , 453 KEY_7 | KEY_MOD1 | KEY_MOD2 , 454 KEY_8 | KEY_MOD1 | KEY_MOD2 , 455 KEY_9 | KEY_MOD1 | KEY_MOD2 , 456 KEY_A | KEY_MOD1 | KEY_MOD2 , 457 KEY_B | KEY_MOD1 | KEY_MOD2 , 458 KEY_C | KEY_MOD1 | KEY_MOD2 , 459 KEY_D | KEY_MOD1 | KEY_MOD2 , 460 KEY_E | KEY_MOD1 | KEY_MOD2 , 461 KEY_F | KEY_MOD1 | KEY_MOD2 , 462 KEY_G | KEY_MOD1 | KEY_MOD2 , 463 KEY_H | KEY_MOD1 | KEY_MOD2 , 464 KEY_I | KEY_MOD1 | KEY_MOD2 , 465 KEY_J | KEY_MOD1 | KEY_MOD2 , 466 KEY_K | KEY_MOD1 | KEY_MOD2 , 467 KEY_L | KEY_MOD1 | KEY_MOD2 , 468 KEY_M | KEY_MOD1 | KEY_MOD2 , 469 KEY_N | KEY_MOD1 | KEY_MOD2 , 470 KEY_O | KEY_MOD1 | KEY_MOD2 , 471 KEY_P | KEY_MOD1 | KEY_MOD2 , 472 KEY_Q | KEY_MOD1 | KEY_MOD2 , 473 KEY_R | KEY_MOD1 | KEY_MOD2 , 474 KEY_S | KEY_MOD1 | KEY_MOD2 , 475 KEY_T | KEY_MOD1 | KEY_MOD2 , 476 KEY_U | KEY_MOD1 | KEY_MOD2 , 477 KEY_V | KEY_MOD1 | KEY_MOD2 , 478 KEY_W | KEY_MOD1 | KEY_MOD2 , 479 KEY_X | KEY_MOD1 | KEY_MOD2 , 480 KEY_Y | KEY_MOD1 | KEY_MOD2 , 481 KEY_Z | KEY_MOD1 | KEY_MOD2 , 482 483 KEY_F1 | KEY_MOD1 | KEY_MOD2 , 484 KEY_F2 | KEY_MOD1 | KEY_MOD2 , 485 KEY_F3 | KEY_MOD1 | KEY_MOD2 , 486 KEY_F4 | KEY_MOD1 | KEY_MOD2 , 487 KEY_F5 | KEY_MOD1 | KEY_MOD2 , 488 KEY_F6 | KEY_MOD1 | KEY_MOD2 , 489 KEY_F7 | KEY_MOD1 | KEY_MOD2 , 490 KEY_F8 | KEY_MOD1 | KEY_MOD2 , 491 KEY_F9 | KEY_MOD1 | KEY_MOD2 , 492 KEY_F10 | KEY_MOD1 | KEY_MOD2 , 493 KEY_F11 | KEY_MOD1 | KEY_MOD2 , 494 KEY_F12 | KEY_MOD1 | KEY_MOD2 , 495 496 KEY_DOWN | KEY_MOD1 | KEY_MOD2 , 497 KEY_UP | KEY_MOD1 | KEY_MOD2 , 498 KEY_LEFT | KEY_MOD1 | KEY_MOD2 , 499 KEY_RIGHT | KEY_MOD1 | KEY_MOD2 , 500 KEY_HOME | KEY_MOD1 | KEY_MOD2 , 501 KEY_END | KEY_MOD1 | KEY_MOD2 , 502 KEY_PAGEUP | KEY_MOD1 | KEY_MOD2 , 503 KEY_PAGEDOWN | KEY_MOD1 | KEY_MOD2 , 504 KEY_RETURN | KEY_MOD1 | KEY_MOD2 , 505 KEY_SPACE | KEY_MOD1 | KEY_MOD2 , 506 KEY_BACKSPACE | KEY_MOD1 | KEY_MOD2 , 507 KEY_INSERT | KEY_MOD1 | KEY_MOD2 , 508 KEY_DELETE | KEY_MOD1 | KEY_MOD2 , 509 510 KEY_0 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 511 KEY_1 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 512 KEY_2 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 513 KEY_3 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 514 KEY_4 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 515 KEY_5 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 516 KEY_6 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 517 KEY_7 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 518 KEY_8 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 519 KEY_9 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 520 KEY_A | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 521 KEY_B | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 522 KEY_C | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 523 KEY_D | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 524 KEY_E | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 525 KEY_F | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 526 KEY_G | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 527 KEY_H | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 528 KEY_I | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 529 KEY_J | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 530 KEY_K | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 531 KEY_L | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 532 KEY_M | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 533 KEY_N | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 534 KEY_O | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 535 KEY_P | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 536 KEY_Q | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 537 KEY_R | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 538 KEY_S | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 539 KEY_T | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 540 KEY_U | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 541 KEY_V | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 542 KEY_W | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 543 KEY_X | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 544 KEY_Y | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 545 KEY_Z | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 546 547 KEY_F1 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 548 KEY_F2 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 549 KEY_F3 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 550 KEY_F4 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 551 KEY_F5 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 552 KEY_F6 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 553 KEY_F7 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 554 KEY_F8 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 555 KEY_F9 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 556 KEY_F10 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 557 KEY_F11 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 558 KEY_F12 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 559 560 KEY_DOWN | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 561 KEY_UP | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 562 KEY_LEFT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 563 KEY_RIGHT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 564 KEY_HOME | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 565 KEY_END | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 566 KEY_PAGEUP | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 567 KEY_PAGEDOWN | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 568 KEY_RETURN | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 569 KEY_SPACE | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 570 KEY_BACKSPACE | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 571 KEY_INSERT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2, 572 KEY_DELETE | KEY_SHIFT | KEY_MOD1 | KEY_MOD2 573 }; 574 575 static sal_uInt16 KEYCODE_ARRAY_SIZE = (sizeof(KEYCODE_ARRAY) / sizeof(KEYCODE_ARRAY[0])); 576 577 //----------------------------------------------- 578 // seems to be needed to layout the list box, which shows all 579 // assignable shortcuts 580 static long AccCfgTabs[] = 581 { 582 2, // Number of Tabs 583 0, 584 120 // Function 585 }; 586 587 //----------------------------------------------- 588 class SfxAccCfgLBoxString_Impl : public SvLBoxString 589 { 590 public: 591 SfxAccCfgLBoxString_Impl( SvLBoxEntry* pEntry, 592 sal_uInt16 nFlags, 593 const String& sText ); 594 595 virtual ~SfxAccCfgLBoxString_Impl(); 596 597 virtual void Paint(const Point& aPos , 598 SvLBox& rDevice, 599 sal_uInt16 nFlags , 600 SvLBoxEntry* pEntry ); 601 }; 602 603 //----------------------------------------------- 604 SfxAccCfgLBoxString_Impl::SfxAccCfgLBoxString_Impl( SvLBoxEntry* pEntry, 605 sal_uInt16 nFlags, 606 const String& sText ) 607 : SvLBoxString(pEntry, nFlags, sText) 608 { 609 } 610 611 //----------------------------------------------- 612 SfxAccCfgLBoxString_Impl::~SfxAccCfgLBoxString_Impl() 613 { 614 } 615 616 //----------------------------------------------- 617 void SfxAccCfgLBoxString_Impl::Paint(const Point& aPos , 618 SvLBox& rDevice, 619 sal_uInt16 /*nFlags*/, 620 SvLBoxEntry* pEntry ) 621 { 622 /*/ ??? realy needed !!! 623 Font aOldFont(rDevice.GetFont()); 624 Font aNewFont(aOldFont ); 625 rDevice.SetFont( aFont ); 626 */ 627 628 if (!pEntry) 629 return; 630 631 TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); 632 if (!pUserData) 633 return; 634 635 if (pUserData->m_bIsConfigurable) 636 rDevice.DrawText(aPos, GetText()); 637 else 638 rDevice.DrawCtrlText(aPos, GetText(), 0, STRING_LEN, TEXT_DRAW_DISABLE); 639 640 //rDev.SetFont( aOldFont ); 641 } 642 643 //----------------------------------------------- 644 void SfxAccCfgTabListBox_Impl::InitEntry( SvLBoxEntry* pEntry , 645 const XubString& sText , 646 const Image& aImage1, 647 const Image& aImage2, 648 SvLBoxButtonKind eButtonKind) 649 { 650 SvTabListBox::InitEntry(pEntry, sText, aImage1, aImage2, eButtonKind); 651 } 652 653 //----------------------------------------------- 654 /** select the entry, which match the current key input ... excepting 655 keys, which are used for the dialog itself. 656 */ 657 void SfxAccCfgTabListBox_Impl::KeyInput(const KeyEvent& aKey) 658 { 659 KeyCode aCode1 = aKey.GetKeyCode(); 660 sal_uInt16 nCode1 = aCode1.GetCode(); 661 sal_uInt16 nMod1 = aCode1.GetModifier(); 662 663 // is it related to our list box ? 664 if ( 665 (nCode1 != KEY_DOWN ) && 666 (nCode1 != KEY_UP ) && 667 (nCode1 != KEY_LEFT ) && 668 (nCode1 != KEY_RIGHT ) && 669 (nCode1 != KEY_PAGEUP ) && 670 (nCode1 != KEY_PAGEDOWN) 671 ) 672 { 673 SvLBoxEntry* pEntry = First(); 674 while (pEntry) 675 { 676 TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); 677 if (pUserData) 678 { 679 sal_uInt16 nCode2 = pUserData->m_aKey.GetCode(); 680 sal_uInt16 nMod2 = pUserData->m_aKey.GetModifier(); 681 if ( 682 (nCode1 == nCode2) && 683 (nMod1 == nMod2 ) 684 ) 685 { 686 Select (pEntry); 687 MakeVisible(pEntry); 688 return; 689 } 690 } 691 pEntry = Next(pEntry); 692 } 693 } 694 695 // no - handle it as normal dialog input 696 SvTabListBox::KeyInput(aKey); 697 } 698 699 //----------------------------------------------- 700 SfxAcceleratorConfigPage::SfxAcceleratorConfigPage( Window* pParent, const SfxItemSet& aSet ) 701 : SfxTabPage (pParent, CUI_RES(RID_SVXPAGE_KEYBOARD), aSet) 702 , m_pMacroInfoItem () 703 , m_pStringItem () 704 , m_pFontItem () 705 , m_pFileDlg (NULL) 706 , aEntriesBox (this , this, CUI_RES(BOX_ACC_ENTRIES )) 707 , aKeyboardGroup (this , CUI_RES(GRP_ACC_KEYBOARD )) 708 , aOfficeButton (this , CUI_RES(RB_OFFICE )) 709 , aModuleButton (this , CUI_RES(RB_MODULE )) 710 , aChangeButton (this , CUI_RES(BTN_ACC_CHANGE )) 711 , aRemoveButton (this , CUI_RES(BTN_ACC_REMOVE )) 712 , aGroupText (this , CUI_RES(TXT_ACC_GROUP )) 713 , pGroupLBox(new SfxConfigGroupListBox_Impl( this, CUI_RES(BOX_ACC_GROUP), SFX_SLOT_ACCELCONFIG )) 714 , aFunctionText (this , CUI_RES(TXT_ACC_FUNCTION )) 715 , pFunctionBox(new SfxConfigFunctionListBox_Impl( this, CUI_RES( BOX_ACC_FUNCTION ))) 716 , aKeyText (this , CUI_RES(TXT_ACC_KEY )) 717 , aKeyBox (this , CUI_RES(BOX_ACC_KEY )) 718 , aFunctionsGroup (this , CUI_RES(GRP_ACC_FUNCTIONS )) 719 , aLoadButton (this , CUI_RES(BTN_LOAD )) 720 , aSaveButton (this , CUI_RES(BTN_SAVE )) 721 , aResetButton (this , CUI_RES(BTN_RESET )) 722 , aLoadAccelConfigStr ( CUI_RES( STR_LOADACCELCONFIG ) ) 723 , aSaveAccelConfigStr ( CUI_RES( STR_SAVEACCELCONFIG ) ) 724 , aFilterCfgStr ( CUI_RES( STR_FILTERNAME_CFG ) ) 725 , m_bStylesInfoInitialized(sal_False) 726 , m_xGlobal () 727 , m_xModule () 728 , m_xAct () 729 { 730 FreeResource(); 731 732 aFilterAllStr = String( SfxResId( STR_SFX_FILTERNAME_ALL ) ); 733 734 // install handler functions 735 aChangeButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, ChangeHdl )); 736 aRemoveButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RemoveHdl )); 737 aEntriesBox.SetSelectHdl ( LINK( this, SfxAcceleratorConfigPage, SelectHdl )); 738 pGroupLBox->SetSelectHdl ( LINK( this, SfxAcceleratorConfigPage, SelectHdl )); 739 pFunctionBox->SetSelectHdl( LINK( this, SfxAcceleratorConfigPage, SelectHdl )); 740 aKeyBox.SetSelectHdl ( LINK( this, SfxAcceleratorConfigPage, SelectHdl )); 741 aLoadButton.SetClickHdl ( LINK( this, SfxAcceleratorConfigPage, Load )); 742 aSaveButton.SetClickHdl ( LINK( this, SfxAcceleratorConfigPage, Save )); 743 aResetButton.SetClickHdl ( LINK( this, SfxAcceleratorConfigPage, Default )); 744 aOfficeButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RadioHdl )); 745 aModuleButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RadioHdl )); 746 747 // initialize Entriesbox 748 aEntriesBox.SetStyle(aEntriesBox.GetStyle()|WB_HSCROLL|WB_CLIPCHILDREN); 749 aEntriesBox.SetSelectionMode(SINGLE_SELECTION); 750 aEntriesBox.SetTabs(&AccCfgTabs[0], MAP_APPFONT); 751 aEntriesBox.Resize(); // OS: Hack for right selection 752 aEntriesBox.SetSpaceBetweenEntries(0); 753 aEntriesBox.SetDragDropMode(0); 754 755 // detect max keyname width 756 long nMaxWidth = 0; 757 for ( sal_uInt16 i = 0; i < KEYCODE_ARRAY_SIZE; ++i ) 758 { 759 long nTmp = GetTextWidth( KeyCode( KEYCODE_ARRAY[i] ).GetName() ); 760 if ( nTmp > nMaxWidth ) 761 nMaxWidth = nTmp; 762 } 763 // recalc second tab 764 long nNewTab = PixelToLogic( Size( nMaxWidth, 0 ), MAP_APPFONT ).Width(); 765 nNewTab = nNewTab + 5; // additional space 766 aEntriesBox.SetTab( 1, nNewTab ); 767 768 // initialize GroupBox 769 pGroupLBox->SetFunctionListBox(pFunctionBox); 770 771 // initialize KeyBox 772 aKeyBox.SetStyle(aKeyBox.GetStyle()|WB_CLIPCHILDREN|WB_HSCROLL|WB_SORT); 773 } 774 775 //----------------------------------------------- 776 SfxAcceleratorConfigPage::~SfxAcceleratorConfigPage() 777 { 778 // free memory - remove all dynamic user data 779 SvLBoxEntry* pEntry = aEntriesBox.First(); 780 while (pEntry) 781 { 782 TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); 783 if (pUserData) 784 delete pUserData; 785 pEntry = aEntriesBox.Next(pEntry); 786 } 787 788 pEntry = aKeyBox.First(); 789 while (pEntry) 790 { 791 TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); 792 if (pUserData) 793 delete pUserData; 794 pEntry = aKeyBox.Next(pEntry); 795 } 796 797 aEntriesBox.Clear(); 798 aKeyBox.Clear(); 799 800 delete m_pFileDlg; 801 delete pGroupLBox; 802 delete pFunctionBox; 803 } 804 805 //----------------------------------------------- 806 void SfxAcceleratorConfigPage::InitAccCfg() 807 { 808 // already initialized ? 809 if (m_xSMGR.is()) 810 return; // yes -> do nothing 811 812 try 813 { 814 // no - initialize this instance 815 m_xSMGR = ::utl::getProcessServiceFactory(); 816 817 m_xUICmdDescription = css::uno::Reference< css::container::XNameAccess >(m_xSMGR->createInstance(SERVICE_UICMDDESCRIPTION), css::uno::UNO_QUERY_THROW); 818 819 // get the current active frame, which should be our "parent" 820 // for this session 821 m_xFrame = GetFrame(); 822 if ( !m_xFrame.is() ) 823 { 824 css::uno::Reference< css::frame::XFramesSupplier > xDesktop(m_xSMGR->createInstance(SERVICE_DESKTOP), css::uno::UNO_QUERY_THROW); 825 m_xFrame = xDesktop->getActiveFrame(); 826 } 827 828 // identify module 829 css::uno::Reference< css::frame::XModuleManager > xModuleManager (m_xSMGR->createInstance(SERVICE_MODULEMANAGER), css::uno::UNO_QUERY_THROW); 830 css::uno::Reference< css::container::XNameAccess > xModuleManagerCont(xModuleManager , css::uno::UNO_QUERY_THROW); 831 m_sModuleLongName = xModuleManager->identify(m_xFrame); 832 ::comphelper::SequenceAsHashMap lModuleProps(xModuleManagerCont->getByName(m_sModuleLongName)); 833 m_sModuleShortName = lModuleProps.getUnpackedValueOrDefault(MODULEPROP_SHORTNAME, ::rtl::OUString()); 834 m_sModuleUIName = lModuleProps.getUnpackedValueOrDefault(MODULEPROP_UINAME , ::rtl::OUString()); 835 836 // get global accelerator configuration 837 m_xGlobal = css::uno::Reference< css::ui::XAcceleratorConfiguration >(m_xSMGR->createInstance(SERVICE_GLOBALACCCFG), css::uno::UNO_QUERY_THROW); 838 839 // get module accelerator configuration 840 css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier(m_xSMGR->createInstance(SERVICE_MODULEUICONFIGSUPPLIER), css::uno::UNO_QUERY_THROW); 841 css::uno::Reference< css::ui::XUIConfigurationManager > xUICfgManager = xModuleCfgSupplier->getUIConfigurationManager(m_sModuleLongName); 842 m_xModule = css::uno::Reference< css::ui::XAcceleratorConfiguration >(xUICfgManager->getShortCutManager(), css::uno::UNO_QUERY_THROW); 843 } 844 catch(const css::uno::RuntimeException& exRun) 845 { throw exRun; } 846 catch(const css::uno::Exception&) 847 { m_xSMGR.clear(); } 848 } 849 850 //----------------------------------------------- 851 /** Initialize text columns with own class to enable custom painting 852 This is needed as we have to paint disabled entries by ourself. No support for that in the 853 original SvTabListBox! 854 */ 855 void SfxAcceleratorConfigPage::CreateCustomItems( SvLBoxEntry* pEntry, 856 const String& sCol1 , 857 const String& sCol2 ) 858 { 859 SfxAccCfgLBoxString_Impl* pStringItem = new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol1); 860 pEntry->ReplaceItem(pStringItem, 1); 861 862 pStringItem = new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol2); 863 pEntry->ReplaceItem(pStringItem, 2); 864 } 865 866 //----------------------------------------------- 867 void SfxAcceleratorConfigPage::Init(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xAccMgr) 868 { 869 if (!xAccMgr.is()) 870 return; 871 872 if (!m_bStylesInfoInitialized) 873 { 874 css::uno::Reference< css::frame::XController > xController; 875 css::uno::Reference< css::frame::XModel > xModel; 876 if (m_xFrame.is()) 877 xController = m_xFrame->getController(); 878 if (xController.is()) 879 xModel = xController->getModel(); 880 881 m_aStylesInfo.setModel(xModel); 882 pFunctionBox->SetStylesInfo(&m_aStylesInfo); 883 pGroupLBox->SetStylesInfo(&m_aStylesInfo); 884 m_bStylesInfoInitialized = sal_True; 885 } 886 887 // Insert all editable accelerators into list box. It is possible 888 // that some accelerators are not mapped on the current system/keyboard 889 // but we don't want to lose these mappings. 890 sal_uInt16 c1 = KEYCODE_ARRAY_SIZE; 891 sal_uInt16 i1 = 0; 892 sal_uInt16 nListPos = 0; 893 for (i1=0; i1<c1; ++i1) 894 { 895 KeyCode aKey = KEYCODE_ARRAY[i1]; 896 String sKey = aKey.GetName(); 897 if (!sKey.Len()) 898 continue; 899 TAccInfo* pEntry = new TAccInfo(i1, nListPos, aKey); 900 SvLBoxEntry* pLBEntry = aEntriesBox.InsertEntryToColumn(sKey, 0L, LIST_APPEND, 0xFFFF); 901 pLBEntry->SetUserData(pEntry); 902 } 903 904 // Assign all commands to its shortcuts - reading the accelerator config. 905 css::uno::Sequence< css::awt::KeyEvent > lKeys = xAccMgr->getAllKeyEvents(); 906 sal_Int32 c2 = lKeys.getLength(); 907 sal_Int32 i2 = 0; 908 sal_uInt16 nCol = aEntriesBox.TabCount()-1; 909 910 for (i2=0; i2<c2; ++i2) 911 { 912 const css::awt::KeyEvent& aAWTKey = lKeys[i2]; 913 ::rtl::OUString sCommand = xAccMgr->getCommandByKeyEvent(aAWTKey); 914 String sLabel = GetLabel4Command(sCommand); 915 KeyCode aKeyCode = ::svt::AcceleratorExecute::st_AWTKey2VCLKey(aAWTKey); 916 sal_uInt16 nPos = MapKeyCodeToPos(aKeyCode); 917 918 if (nPos == LISTBOX_ENTRY_NOTFOUND) 919 continue; 920 921 aEntriesBox.SetEntryText(sLabel, nPos, nCol); 922 923 SvLBoxEntry* pLBEntry = aEntriesBox.GetEntry(0, nPos); 924 TAccInfo* pEntry = (TAccInfo*)pLBEntry->GetUserData(); 925 926 pEntry->m_bIsConfigurable = sal_True; 927 pEntry->m_sCommand = sCommand; 928 CreateCustomItems(pLBEntry, aEntriesBox.GetEntryText(pLBEntry, 0), sLabel); 929 } 930 931 // Map the VCL hardcoded key codes and mark them as not changeable 932 sal_uLong c3 = Application::GetReservedKeyCodeCount(); 933 sal_uLong i3 = 0; 934 for (i3=0; i3<c3; ++i3) 935 { 936 const KeyCode* pKeyCode = Application::GetReservedKeyCode(i3); 937 sal_uInt16 nPos = MapKeyCodeToPos(*pKeyCode); 938 939 if (nPos == LISTBOX_ENTRY_NOTFOUND) 940 continue; 941 942 // Hardcoded function mapped so no ID possible and mark entry as not changeable 943 SvLBoxEntry* pLBEntry = aEntriesBox.GetEntry(0, nPos); 944 TAccInfo* pEntry = (TAccInfo*)pLBEntry->GetUserData(); 945 946 pEntry->m_bIsConfigurable = sal_False; 947 CreateCustomItems(pLBEntry, aEntriesBox.GetEntryText(pLBEntry, 0), String()); 948 } 949 } 950 951 //----------------------------------------------- 952 void SfxAcceleratorConfigPage::Apply(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xAccMgr) 953 { 954 if (!xAccMgr.is()) 955 return; 956 957 // Go through the list from the bottom to the top ... 958 // because logical accelerator must be preferred instead of 959 // physical ones! 960 SvLBoxEntry* pEntry = aEntriesBox.First(); 961 while (pEntry) 962 { 963 TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); 964 ::rtl::OUString sCommand ; 965 css::awt::KeyEvent aAWTKey ; 966 967 if (pUserData) 968 { 969 sCommand = pUserData->m_sCommand; 970 aAWTKey = ::svt::AcceleratorExecute::st_VCLKey2AWTKey(pUserData->m_aKey); 971 } 972 973 try 974 { 975 if (sCommand.getLength()) 976 xAccMgr->setKeyEvent(aAWTKey, sCommand); 977 else 978 xAccMgr->removeKeyEvent(aAWTKey); 979 } 980 catch(const css::uno::RuntimeException& exRun) 981 { throw exRun; } 982 catch(const css::uno::Exception&) 983 {} 984 985 pEntry = aEntriesBox.Next(pEntry); 986 } 987 } 988 989 //----------------------------------------------- 990 void SfxAcceleratorConfigPage::ResetConfig() 991 { 992 aEntriesBox.Clear(); 993 } 994 995 //----------------------------------------------- 996 IMPL_LINK( SfxAcceleratorConfigPage, Load, Button*, EMPTYARG ) 997 { 998 // ask for filename, where we should load the new config data from 999 StartFileDialog( WB_OPEN | WB_STDMODAL | WB_3DLOOK, aLoadAccelConfigStr ); 1000 return 0; 1001 } 1002 1003 //----------------------------------------------- 1004 IMPL_LINK( SfxAcceleratorConfigPage, Save, Button*, EMPTYARG ) 1005 { 1006 StartFileDialog( WB_SAVEAS | WB_STDMODAL | WB_3DLOOK, aLoadAccelConfigStr ); 1007 return 0; 1008 } 1009 1010 //----------------------------------------------- 1011 IMPL_LINK(SfxAcceleratorConfigPage, Default, PushButton*, EMPTYARG) 1012 { 1013 css::uno::Reference< css::form::XReset > xReset(m_xAct, css::uno::UNO_QUERY); 1014 if (xReset.is()) 1015 xReset->reset(); 1016 1017 aEntriesBox.SetUpdateMode(sal_False); 1018 ResetConfig(); 1019 Init(m_xAct); 1020 aEntriesBox.SetUpdateMode(sal_True); 1021 aEntriesBox.Invalidate(); 1022 aEntriesBox.Select(aEntriesBox.GetEntry(0, 0)); 1023 1024 return 0; 1025 } 1026 1027 //----------------------------------------------- 1028 IMPL_LINK( SfxAcceleratorConfigPage, ChangeHdl, Button*, EMPTYARG ) 1029 { 1030 sal_uInt16 nPos = (sal_uInt16) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() ); 1031 TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData(); 1032 String sNewCommand = pFunctionBox->GetCurCommand(); 1033 String sLabel = pFunctionBox->GetCurLabel(); 1034 if (!sLabel.Len()) 1035 sLabel = GetLabel4Command(sNewCommand); 1036 1037 pEntry->m_sCommand = sNewCommand; 1038 sal_uInt16 nCol = aEntriesBox.TabCount() - 1; 1039 aEntriesBox.SetEntryText(sLabel, nPos, nCol); 1040 1041 ((Link &) pFunctionBox->GetSelectHdl()).Call( pFunctionBox ); 1042 return 0; 1043 } 1044 1045 //----------------------------------------------- 1046 IMPL_LINK( SfxAcceleratorConfigPage, RemoveHdl, Button *, EMPTYARG ) 1047 { 1048 // get selected entry 1049 sal_uInt16 nPos = (sal_uInt16) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() ); 1050 TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData(); 1051 1052 // remove function name from selected entry 1053 sal_uInt16 nCol = aEntriesBox.TabCount() - 1; 1054 aEntriesBox.SetEntryText( String(), nPos, nCol ); 1055 pEntry->m_sCommand = ::rtl::OUString(); 1056 1057 ((Link &) pFunctionBox->GetSelectHdl()).Call( pFunctionBox ); 1058 return 0; 1059 } 1060 1061 //----------------------------------------------- 1062 IMPL_LINK( SfxAcceleratorConfigPage, SelectHdl, Control*, pListBox ) 1063 { 1064 // disable help 1065 Help::ShowBalloon( this, Point(), String() ); 1066 if ( pListBox == &aEntriesBox ) 1067 { 1068 sal_uInt16 nPos = (sal_uInt16) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() ); 1069 TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData(); 1070 ::rtl::OUString sPossibleNewCommand = pFunctionBox->GetCurCommand(); 1071 1072 aRemoveButton.Enable( sal_False ); 1073 aChangeButton.Enable( sal_False ); 1074 1075 if (pEntry->m_bIsConfigurable) 1076 { 1077 if (pEntry->isConfigured()) 1078 aRemoveButton.Enable( sal_True ); 1079 aChangeButton.Enable( pEntry->m_sCommand != sPossibleNewCommand ); 1080 } 1081 } 1082 else if ( pListBox == pGroupLBox ) 1083 { 1084 pGroupLBox->GroupSelected(); 1085 if ( !pFunctionBox->FirstSelected() ) 1086 aChangeButton.Enable( sal_False ); 1087 } 1088 else if ( pListBox == pFunctionBox ) 1089 { 1090 aRemoveButton.Enable( sal_False ); 1091 aChangeButton.Enable( sal_False ); 1092 1093 // #i36994 First selected can return zero! 1094 SvLBoxEntry* pLBEntry = aEntriesBox.FirstSelected(); 1095 if ( pLBEntry != 0 ) 1096 { 1097 sal_uInt16 nPos = (sal_uInt16) aEntriesBox.GetModel()->GetRelPos( pLBEntry ); 1098 TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData(); 1099 ::rtl::OUString sPossibleNewCommand = pFunctionBox->GetCurCommand(); 1100 1101 if (pEntry->m_bIsConfigurable) 1102 { 1103 if (pEntry->isConfigured()) 1104 aRemoveButton.Enable( sal_True ); 1105 aChangeButton.Enable( pEntry->m_sCommand != sPossibleNewCommand ); 1106 } 1107 1108 // update key box 1109 aKeyBox.Clear(); 1110 SvLBoxEntry* pIt = aEntriesBox.First(); 1111 while ( pIt ) 1112 { 1113 TAccInfo* pUserData = (TAccInfo*)pIt->GetUserData(); 1114 if ( pUserData && pUserData->m_sCommand == sPossibleNewCommand ) 1115 { 1116 TAccInfo* pU1 = new TAccInfo(-1, -1, pUserData->m_aKey); 1117 SvLBoxEntry* pE1 = aKeyBox.InsertEntry( pUserData->m_aKey.GetName(), 0L, sal_True, LIST_APPEND ); 1118 pE1->SetUserData(pU1); 1119 pE1->EnableChildsOnDemand( sal_False ); 1120 } 1121 pIt = aEntriesBox.Next(pIt); 1122 } 1123 } 1124 } 1125 else 1126 { 1127 // goto selected "key" entry of the key box 1128 SvLBoxEntry* pE2 = 0; 1129 TAccInfo* pU2 = 0; 1130 sal_uInt16 nP2 = LISTBOX_ENTRY_NOTFOUND; 1131 SvLBoxEntry* pE3 = 0; 1132 1133 pE2 = aKeyBox.FirstSelected(); 1134 if (pE2) 1135 pU2 = (TAccInfo*)pE2->GetUserData(); 1136 if (pU2) 1137 nP2 = MapKeyCodeToPos(pU2->m_aKey); 1138 if (nP2 != LISTBOX_ENTRY_NOTFOUND) 1139 pE3 = aEntriesBox.GetEntry( 0, nP2 ); 1140 if (pE3) 1141 { 1142 aEntriesBox.Select( pE3 ); 1143 aEntriesBox.MakeVisible( pE3 ); 1144 } 1145 } 1146 1147 return 0; 1148 } 1149 1150 //----------------------------------------------- 1151 IMPL_LINK( SfxAcceleratorConfigPage, RadioHdl, RadioButton *, EMPTYARG ) 1152 { 1153 css::uno::Reference< css::ui::XAcceleratorConfiguration > xOld = m_xAct; 1154 1155 if (aOfficeButton.IsChecked()) 1156 m_xAct = m_xGlobal; 1157 else if (aModuleButton.IsChecked()) 1158 m_xAct = m_xModule; 1159 1160 // nothing changed? => do nothing! 1161 if ( m_xAct.is() && ( xOld == m_xAct ) ) 1162 return 0; 1163 1164 aEntriesBox.SetUpdateMode( sal_False ); 1165 ResetConfig(); 1166 Init(m_xAct); 1167 aEntriesBox.SetUpdateMode( sal_True ); 1168 aEntriesBox.Invalidate(); 1169 1170 pGroupLBox->Init(m_xSMGR, m_xFrame, m_sModuleLongName); 1171 1172 // pb: #133213# do not select NULL entries 1173 SvLBoxEntry* pEntry = aEntriesBox.GetEntry( 0, 0 ); 1174 if ( pEntry ) 1175 aEntriesBox.Select( pEntry ); 1176 pEntry = pGroupLBox->GetEntry( 0, 0 ); 1177 if ( pEntry ) 1178 pGroupLBox->Select( pEntry ); 1179 1180 ((Link &) pFunctionBox->GetSelectHdl()).Call( pFunctionBox ); 1181 return 1L; 1182 } 1183 1184 //----------------------------------------------- 1185 IMPL_LINK( SfxAcceleratorConfigPage, LoadHdl, sfx2::FileDialogHelper*, EMPTYARG ) 1186 { 1187 DBG_ASSERT( m_pFileDlg, "SfxInternetPage::DialogClosedHdl(): no file dialog" ); 1188 1189 ::rtl::OUString sCfgName; 1190 if ( ERRCODE_NONE == m_pFileDlg->GetError() ) 1191 sCfgName = m_pFileDlg->GetPath(); 1192 1193 if ( !sCfgName.getLength() ) 1194 return 0; 1195 1196 GetTabDialog()->EnterWait(); 1197 1198 css::uno::Reference< css::frame::XModel > xDoc ; 1199 css::uno::Reference< css::ui::XUIConfigurationManager > xCfgMgr ; 1200 css::uno::Reference< css::embed::XStorage > xRootStorage; // we must hold the root storage alive, if xCfgMgr is used! 1201 1202 try 1203 { 1204 // first check if URL points to a document already loaded 1205 xDoc = SearchForAlreadyLoadedDoc(sCfgName); 1206 if (xDoc.is()) 1207 { 1208 // Get ui config manager. There should always be one at the model. 1209 css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > xCfgSupplier(xDoc, css::uno::UNO_QUERY_THROW); 1210 xCfgMgr = xCfgSupplier->getUIConfigurationManager(); 1211 } 1212 else 1213 { 1214 // URL doesn't point to a loaded document, try to access it as a single storage 1215 // dont forget to release the storage afterwards! 1216 css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory(m_xSMGR->createInstance(SERVICE_STORAGEFACTORY), css::uno::UNO_QUERY_THROW); 1217 css::uno::Sequence< css::uno::Any > lArgs(2); 1218 lArgs[0] <<= sCfgName; 1219 lArgs[1] <<= css::embed::ElementModes::READ; 1220 1221 xRootStorage = css::uno::Reference< css::embed::XStorage >(xStorageFactory->createInstanceWithArguments(lArgs), css::uno::UNO_QUERY_THROW); 1222 css::uno::Reference< css::embed::XStorage > xUIConfig = xRootStorage->openStorageElement(FOLDERNAME_UICONFIG, css::embed::ElementModes::READ); 1223 if (xUIConfig.is()) 1224 { 1225 xCfgMgr = css::uno::Reference< css::ui::XUIConfigurationManager >(m_xSMGR->createInstance(SERVICE_UICONFIGMGR), css::uno::UNO_QUERY_THROW); 1226 css::uno::Reference< css::ui::XUIConfigurationStorage > xCfgMgrStore(xCfgMgr, css::uno::UNO_QUERY_THROW); 1227 xCfgMgrStore->setStorage(xUIConfig); 1228 } 1229 } 1230 1231 if (xCfgMgr.is()) 1232 { 1233 // open the configuration and update our UI 1234 css::uno::Reference< css::ui::XAcceleratorConfiguration > xTempAccMgr(xCfgMgr->getShortCutManager(), css::uno::UNO_QUERY_THROW); 1235 1236 aEntriesBox.SetUpdateMode(sal_False); 1237 ResetConfig(); 1238 Init(xTempAccMgr); 1239 aEntriesBox.SetUpdateMode(sal_True); 1240 aEntriesBox.Invalidate(); 1241 aEntriesBox.Select(aEntriesBox.GetEntry(0, 0)); 1242 1243 } 1244 1245 // dont forget to close the new opened storage! 1246 // We are the owner of it. 1247 if (xRootStorage.is()) 1248 { 1249 css::uno::Reference< css::lang::XComponent > xComponent; 1250 xComponent = css::uno::Reference< css::lang::XComponent >(xCfgMgr, css::uno::UNO_QUERY); 1251 if (xComponent.is()) 1252 xComponent->dispose(); 1253 xComponent = css::uno::Reference< css::lang::XComponent >(xRootStorage, css::uno::UNO_QUERY); 1254 if (xComponent.is()) 1255 xComponent->dispose(); 1256 } 1257 } 1258 catch(const css::uno::RuntimeException& exRun) 1259 { throw exRun; } 1260 catch(const css::uno::Exception&) 1261 {} 1262 1263 GetTabDialog()->LeaveWait(); 1264 1265 return 0; 1266 } 1267 1268 //----------------------------------------------- 1269 IMPL_LINK( SfxAcceleratorConfigPage, SaveHdl, sfx2::FileDialogHelper*, EMPTYARG ) 1270 { 1271 DBG_ASSERT( m_pFileDlg, "SfxInternetPage::DialogClosedHdl(): no file dialog" ); 1272 1273 ::rtl::OUString sCfgName; 1274 if ( ERRCODE_NONE == m_pFileDlg->GetError() ) 1275 sCfgName = m_pFileDlg->GetPath(); 1276 1277 if ( !sCfgName.getLength() ) 1278 return 0; 1279 1280 GetTabDialog()->EnterWait(); 1281 1282 css::uno::Reference< css::frame::XModel > xDoc ; 1283 css::uno::Reference< css::ui::XUIConfigurationManager > xCfgMgr ; 1284 css::uno::Reference< css::embed::XStorage > xRootStorage; 1285 1286 try 1287 { 1288 // first check if URL points to a document already loaded 1289 xDoc = SearchForAlreadyLoadedDoc(sCfgName); 1290 if (xDoc.is()) 1291 { 1292 // get config manager, force creation if there was none before 1293 css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > xCfgSupplier(xDoc, css::uno::UNO_QUERY_THROW); 1294 xCfgMgr = xCfgSupplier->getUIConfigurationManager(); 1295 } 1296 else 1297 { 1298 // URL doesn't point to a loaded document, try to access it as a single storage 1299 css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory(m_xSMGR->createInstance(SERVICE_STORAGEFACTORY), css::uno::UNO_QUERY_THROW); 1300 css::uno::Sequence< css::uno::Any > lArgs(2); 1301 lArgs[0] <<= sCfgName; 1302 lArgs[1] <<= css::embed::ElementModes::WRITE; 1303 1304 xRootStorage = css::uno::Reference< css::embed::XStorage >( 1305 xStorageFactory->createInstanceWithArguments(lArgs), 1306 css::uno::UNO_QUERY_THROW); 1307 1308 css::uno::Reference< css::embed::XStorage > xUIConfig( 1309 xRootStorage->openStorageElement(FOLDERNAME_UICONFIG, css::embed::ElementModes::WRITE), 1310 css::uno::UNO_QUERY_THROW); 1311 css::uno::Reference< css::beans::XPropertySet > xUIConfigProps( 1312 xUIConfig, 1313 css::uno::UNO_QUERY_THROW); 1314 1315 // set the correct media type if the storage was new created 1316 ::rtl::OUString sMediaType; 1317 xUIConfigProps->getPropertyValue(MEDIATYPE_PROPNAME) >>= sMediaType; 1318 if (!sMediaType.getLength()) 1319 xUIConfigProps->setPropertyValue(MEDIATYPE_PROPNAME, css::uno::makeAny(MEDIATYPE_UICONFIG)); 1320 1321 xCfgMgr = css::uno::Reference< css::ui::XUIConfigurationManager >(m_xSMGR->createInstance(SERVICE_UICONFIGMGR), css::uno::UNO_QUERY_THROW); 1322 css::uno::Reference< css::ui::XUIConfigurationStorage > xUICfgStore(xCfgMgr, css::uno::UNO_QUERY_THROW); 1323 xUICfgStore->setStorage(xUIConfig); 1324 } 1325 1326 if (xCfgMgr.is()) 1327 { 1328 // get the target configuration access and update with all shortcuts 1329 // which are set currently at the UI ! 1330 // Dont copy the m_xAct content to it ... because m_xAct will be updated 1331 // from the UI on pressing the button "OK" only. And inbetween it's not up to date ! 1332 css::uno::Reference< css::ui::XAcceleratorConfiguration > xTargetAccMgr(xCfgMgr->getShortCutManager(), css::uno::UNO_QUERY_THROW); 1333 Apply(xTargetAccMgr); 1334 1335 // commit (order is important!) 1336 css::uno::Reference< css::ui::XUIConfigurationPersistence > xCommit1(xTargetAccMgr, css::uno::UNO_QUERY_THROW); 1337 css::uno::Reference< css::ui::XUIConfigurationPersistence > xCommit2(xCfgMgr , css::uno::UNO_QUERY_THROW); 1338 xCommit1->store(); 1339 xCommit2->store(); 1340 1341 if (xRootStorage.is()) 1342 { 1343 // Commit root storage 1344 css::uno::Reference< css::embed::XTransactedObject > xCommit3(xRootStorage, css::uno::UNO_QUERY_THROW); 1345 xCommit3->commit(); 1346 } 1347 } 1348 1349 if (xRootStorage.is()) 1350 { 1351 css::uno::Reference< css::lang::XComponent > xComponent; 1352 xComponent = css::uno::Reference< css::lang::XComponent >(xCfgMgr, css::uno::UNO_QUERY); 1353 if (xComponent.is()) 1354 xComponent->dispose(); 1355 xComponent = css::uno::Reference< css::lang::XComponent >(xRootStorage, css::uno::UNO_QUERY); 1356 if (xComponent.is()) 1357 xComponent->dispose(); 1358 } 1359 } 1360 catch(const css::uno::RuntimeException& exRun) 1361 { throw exRun; } 1362 catch(const css::uno::Exception&) 1363 {} 1364 1365 GetTabDialog()->LeaveWait(); 1366 1367 return 0; 1368 } 1369 1370 //----------------------------------------------- 1371 void SfxAcceleratorConfigPage::StartFileDialog( WinBits nBits, const String& rTitle ) 1372 { 1373 bool bSave = ( ( nBits & WB_SAVEAS ) == WB_SAVEAS ); 1374 short nDialogType = bSave ? css::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE 1375 : css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE; 1376 if ( m_pFileDlg ) 1377 delete m_pFileDlg; 1378 m_pFileDlg = new sfx2::FileDialogHelper( nDialogType, 0 ); 1379 1380 m_pFileDlg->SetTitle( rTitle ); 1381 m_pFileDlg->AddFilter( aFilterAllStr, DEFINE_CONST_UNICODE( FILEDIALOG_FILTER_ALL ) ); 1382 m_pFileDlg->AddFilter( aFilterCfgStr, DEFINE_CONST_UNICODE( "*.cfg" ) ); 1383 1384 Link aDlgClosedLink = bSave ? LINK( this, SfxAcceleratorConfigPage, SaveHdl ) 1385 : LINK( this, SfxAcceleratorConfigPage, LoadHdl ); 1386 m_pFileDlg->StartExecuteModal( aDlgClosedLink ); 1387 } 1388 1389 //----------------------------------------------- 1390 sal_Bool SfxAcceleratorConfigPage::FillItemSet( SfxItemSet& ) 1391 { 1392 Apply(m_xAct); 1393 try 1394 { 1395 m_xAct->store(); 1396 } 1397 catch(const css::uno::RuntimeException& exRun) 1398 { throw exRun; } 1399 catch(const css::uno::Exception&) 1400 { return sal_False; } 1401 1402 return sal_True; 1403 } 1404 1405 //----------------------------------------------- 1406 void SfxAcceleratorConfigPage::Reset( const SfxItemSet& rSet ) 1407 { 1408 // open accelerator configs 1409 // Note: It initialize some other members too, which are needed here ... 1410 // e.g. m_sModuleUIName! 1411 InitAccCfg(); 1412 1413 // change te description of the radio button, which switch to the module 1414 // dependend accelerator configuration 1415 String sButtonText = aModuleButton.GetText(); 1416 sButtonText.SearchAndReplace(String::CreateFromAscii("$(MODULE)"), m_sModuleUIName); 1417 aModuleButton.SetText(sButtonText); 1418 1419 if (m_xModule.is()) 1420 aModuleButton.Check(); 1421 else 1422 { 1423 aModuleButton.Hide(); 1424 aOfficeButton.Check(); 1425 } 1426 1427 RadioHdl(0); 1428 1429 const SfxPoolItem* pMacroItem=0; 1430 if( SFX_ITEM_SET == rSet.GetItemState( SID_MACROINFO, sal_True, &pMacroItem ) ) 1431 { 1432 m_pMacroInfoItem = PTR_CAST( SfxMacroInfoItem, pMacroItem ); 1433 pGroupLBox->SelectMacro( m_pMacroInfoItem ); 1434 } 1435 else 1436 { 1437 const SfxPoolItem* pStringItem=0; 1438 if( SFX_ITEM_SET == rSet.GetItemState( SID_CHARMAP, sal_True, &pStringItem ) ) 1439 m_pStringItem = PTR_CAST( SfxStringItem, pStringItem ); 1440 1441 const SfxPoolItem* pFontItem=0; 1442 if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_SPECIALCHAR, sal_True, &pFontItem ) ) 1443 m_pFontItem = PTR_CAST( SfxStringItem, pFontItem ); 1444 } 1445 } 1446 1447 //----------------------------------------------- 1448 sal_uInt16 SfxAcceleratorConfigPage::MapKeyCodeToPos(const KeyCode& aKey) const 1449 { 1450 sal_uInt16 nCode1 = aKey.GetCode()+aKey.GetModifier(); 1451 SvLBoxEntry* pEntry = aEntriesBox.First(); 1452 sal_uInt16 i = 0; 1453 1454 while (pEntry) 1455 { 1456 TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData(); 1457 if (pUserData) 1458 { 1459 sal_uInt16 nCode2 = pUserData->m_aKey.GetCode()+pUserData->m_aKey.GetModifier(); 1460 if (nCode1 == nCode2) 1461 return i; 1462 } 1463 pEntry = aEntriesBox.Next(pEntry); 1464 ++i; 1465 } 1466 1467 return LISTBOX_ENTRY_NOTFOUND; 1468 } 1469 1470 //----------------------------------------------- 1471 String SfxAcceleratorConfigPage::GetLabel4Command(const String& sCommand) 1472 { 1473 try 1474 { 1475 // check global command configuration first 1476 css::uno::Reference< css::container::XNameAccess > xModuleConf; 1477 m_xUICmdDescription->getByName(m_sModuleLongName) >>= xModuleConf; 1478 if (xModuleConf.is()) 1479 { 1480 ::comphelper::SequenceAsHashMap lProps(xModuleConf->getByName(sCommand)); 1481 String sLabel = String(lProps.getUnpackedValueOrDefault(CMDPROP_UINAME, ::rtl::OUString())); 1482 if (sLabel.Len()) 1483 return sLabel; 1484 } 1485 } 1486 catch(const css::uno::RuntimeException& exRun) 1487 { throw exRun; } 1488 catch(const css::uno::Exception&) 1489 {} 1490 1491 // may be it's a style URL .. they must be handled special 1492 SfxStyleInfo_Impl aStyle; 1493 aStyle.sCommand = sCommand; 1494 if (m_aStylesInfo.parseStyleCommand(aStyle)) 1495 { 1496 m_aStylesInfo.getLabel4Style(aStyle); 1497 return aStyle.sLabel; 1498 } 1499 else 1500 { 1501 String aRet( String::CreateFromAscii("Symbols: ") ); 1502 xub_StrLen nPos = sCommand.SearchAscii(".uno:InsertSymbol?Symbols:string="); 1503 if ( nPos == 0 ) 1504 { 1505 aRet += String( sCommand, 34, sCommand.Len()-34 ); 1506 return aRet; 1507 } 1508 } 1509 1510 return sCommand; 1511 } 1512 1513 SfxTabPage* SfxAcceleratorConfigPage::Create( Window* pParent, const SfxItemSet& rAttrSet ) 1514 { 1515 return new SfxAcceleratorConfigPage( pParent, rAttrSet ); 1516 } 1517 1518 //----------------------------------------------- 1519 css::uno::Reference< css::frame::XModel > SfxAcceleratorConfigPage::SearchForAlreadyLoadedDoc(const String& /*sName*/) 1520 { 1521 return css::uno::Reference< css::frame::XModel >(); 1522 } 1523 1524 SvxShortcutAssignDlg::SvxShortcutAssignDlg( Window* pParent, const uno::Reference< frame::XFrame >& rxDocumentFrame, const SfxItemSet& rSet ) 1525 : SfxSingleTabDialog( pParent, rSet, 0 ) 1526 { 1527 SfxTabPage* pPage = SfxAcceleratorConfigPage::Create( this, rSet ); 1528 pPage->SetFrame( rxDocumentFrame ); 1529 SetTabPage( pPage ); 1530 1531 } 1532 1533 SvxShortcutAssignDlg::~SvxShortcutAssignDlg() 1534 { 1535 } 1536 1537 1538 // .uno:InsertSymbol?Symbols:string=bla 1539