office-gobmx/cui/source/customize/acccfg.cxx
Norbert Thiebaud cc5db648bc Merge commit 'ooo/DEV300_m101' into integration/dev300_m101
* commit 'ooo/DEV300_m101': (185 commits)
  masterfix DEV300: #i10000# usage of L10N build_type
  masterfix: #i10000# INT16 -> sal_Int16
  fixed compile errors after resync to m100, part2
  gridsort: post-rebase fixes
  CWS gnumake3: found another tools integer type
  removetooltypes01: Fix build problems after rebase to DEV300m99 in basctl, cui, reportdesign, sw
  native359: #i114398# changing mac langpack icon
  native359: #i115669# fixing package description for solaris packages
  gnumake3: remove comphelper version; fix including extract.hxx
  locales34: #i106785# add Haitian_Haiti [ht-HT] to language list and locale data; locale data contributed by <jcpoulard>
  sb138: #i116659# timely termination of OnLogRotateThread
  accfixes: removed include of obsolete header file
  accfixes: removed obsolete file
  removetooltypes01: #i112600# Fix build problems on non-pro
  accfixes: moved some shared strings to svx part2
  accfixes: moved some shared strings to svx
  accfixes: added more accessibility information and fixed tab orders in multiple dialogs (cui module)
  removetooltypes01: #i112600# Remove tools types for Mac specific parts
  fixed tab order in BasicIDE, Library dialog tab page
  added some accessible names in BasicIDE
  ...

Conflicts:
	UnoControls/source/base/registercontrols.cxx
	accessibility/inc/accessibility/standard/vclxaccessiblelistboxlist.hxx
	automation/inc/automation/communi.hxx
	automation/inc/automation/simplecm.hxx
	automation/source/communi/communi.cxx
	automation/source/inc/rcontrol.hxx
	automation/source/miniapp/servuid.hxx
	automation/source/server/XMLParser.cxx
	automation/source/server/cmdbasestream.cxx
	automation/source/server/profiler.hxx
	automation/source/server/recorder.cxx
	automation/source/server/retstrm.hxx
	automation/source/server/server.cxx
	automation/source/server/sta_list.cxx
	automation/source/server/statemnt.cxx
	automation/source/server/statemnt.hxx
	automation/source/simplecm/packethandler.cxx
	automation/source/simplecm/simplecm.cxx
	automation/source/simplecm/tcpio.cxx
	automation/source/simplecm/tcpio.hxx
	automation/source/testtool/comm_bas.hxx
	automation/source/testtool/cretstrm.hxx
	automation/source/testtool/httprequest.cxx
	automation/source/testtool/httprequest.hxx
	automation/source/testtool/objtest.cxx
	automation/source/testtool/objtest.hxx
	basctl/source/basicide/baside2.cxx
	basctl/source/basicide/baside2.hxx
	basctl/source/basicide/baside2b.cxx
	basctl/source/basicide/baside3.cxx
	basctl/source/basicide/basides1.cxx
	basctl/source/basicide/basides2.cxx
	basctl/source/basicide/basidesh.cxx
	basctl/source/basicide/basidesh.src
	basctl/source/basicide/basobj3.cxx
	basctl/source/basicide/bastype2.cxx
	basctl/source/basicide/bastype3.cxx
	basctl/source/basicide/bastypes.cxx
	basctl/source/basicide/brkdlg.cxx
	basctl/source/basicide/iderdll.cxx
	basctl/source/basicide/macrodlg.cxx
	basctl/source/basicide/moduldl2.cxx
	basctl/source/basicide/moduldlg.cxx
	basctl/source/basicide/objdlg.cxx
	basctl/source/basicide/scriptdocument.cxx
	basctl/source/basicide/tbxctl.cxx
	basctl/source/basicide/tbxctl.hxx
	basctl/source/basicide/tbxctl.src
	basctl/source/dlged/dlged.cxx
	basctl/source/dlged/dlgedfunc.cxx
	basctl/source/dlged/dlgedobj.cxx
	basctl/source/inc/basidesh.hxx
	basctl/source/inc/bastypes.hxx
	basctl/source/inc/dlgedmod.hxx
	basctl/source/inc/dlgedpage.hxx
	crashrep/prj/build.lst
	cui/inc/pch/precompiled_cui.hxx
	cui/source/customize/acccfg.cxx
	cui/source/customize/acccfg.hrc
	cui/source/customize/acccfg.src
	cui/source/customize/cfg.cxx
	cui/source/customize/cfgutil.cxx
	cui/source/customize/macropg.cxx
	cui/source/customize/macropg.src
	cui/source/customize/selector.cxx
	cui/source/dialogs/SpellDialog.cxx
	cui/source/dialogs/commonlingui.cxx
	cui/source/dialogs/cuicharmap.cxx
	cui/source/dialogs/cuifmsearch.cxx
	cui/source/dialogs/cuigaldlg.cxx
	cui/source/dialogs/cuigrfflt.cxx
	cui/source/dialogs/hldocntp.cxx
	cui/source/dialogs/hldoctp.cxx
	cui/source/dialogs/hlinettp.cxx
	cui/source/dialogs/hlmailtp.cxx
	cui/source/dialogs/hlmarkwn.cxx
	cui/source/dialogs/hlmarkwn.src
	cui/source/dialogs/hltpbase.cxx
	cui/source/dialogs/iconcdlg.cxx
	cui/source/dialogs/passwdomdlg.cxx
	cui/source/dialogs/pastedlg.cxx
	cui/source/dialogs/scriptdlg.cxx
	cui/source/dialogs/thesdlg.cxx
	cui/source/dialogs/zoom.cxx
	cui/source/factory/dlgfact.hxx
	cui/source/inc/SpellDialog.hxx
	cui/source/inc/autocdlg.hxx
	cui/source/inc/backgrnd.hxx
	cui/source/inc/bbdlg.hxx
	cui/source/inc/cfg.hxx
	cui/source/inc/cfgutil.hxx
	cui/source/inc/cuigaldlg.hxx
	cui/source/inc/cuigrfflt.hxx
	cui/source/inc/cuitabarea.hxx
	cui/source/inc/cuitabline.hxx
	cui/source/inc/hldocntp.hxx
	cui/source/inc/hltpbase.hxx
	cui/source/inc/iconcdlg.hxx
	cui/source/inc/numpages.hxx
	cui/source/inc/page.hxx
	cui/source/inc/postdlg.hxx
	cui/source/inc/scriptdlg.hxx
	cui/source/inc/transfrm.hxx
	cui/source/inc/zoom.hxx
	cui/source/options/cfgchart.cxx
	cui/source/options/cuisrchdlg.cxx
	cui/source/options/dbregister.cxx
	cui/source/options/dbregister.src
	cui/source/options/fontsubs.cxx
	cui/source/options/internationaloptions.cxx
	cui/source/options/optasian.cxx
	cui/source/options/optchart.cxx
	cui/source/options/optcolor.cxx
	cui/source/options/optcolor.src
	cui/source/options/optfltr.cxx
	cui/source/options/optfltr.src
	cui/source/options/optgdlg.cxx
	cui/source/options/optgdlg.src
	cui/source/options/optgenrl.cxx
	cui/source/options/opthtml.cxx
	cui/source/options/optimprove.cxx
	cui/source/options/optinet2.cxx
	cui/source/options/optinet2.hxx
	cui/source/options/optjava.cxx
	cui/source/options/optlingu.cxx
	cui/source/options/optsave.cxx
	cui/source/options/optsave.hxx
	cui/source/options/treeopt.cxx
	cui/source/options/webconninfo.cxx
	cui/source/tabpages/autocdlg.cxx
	cui/source/tabpages/backgrnd.cxx
	cui/source/tabpages/border.cxx
	cui/source/tabpages/chardlg.cxx
	cui/source/tabpages/dstribut.cxx
	cui/source/tabpages/grfpage.cxx
	cui/source/tabpages/macroass.cxx
	cui/source/tabpages/measure.cxx
	cui/source/tabpages/numfmt.cxx
	cui/source/tabpages/numpages.cxx
	cui/source/tabpages/page.cxx
	cui/source/tabpages/paragrph.cxx
	cui/source/tabpages/swpossizetabpage.cxx
	cui/source/tabpages/tabarea.src
	cui/source/tabpages/textanim.cxx
	cui/source/tabpages/textattr.cxx
	cui/source/tabpages/tparea.cxx
	cui/source/tabpages/tpbitmap.cxx
	cui/source/tabpages/tpcolor.cxx
	cui/source/tabpages/tpgradnt.cxx
	cui/source/tabpages/tphatch.cxx
	cui/source/tabpages/tpline.cxx
	cui/source/tabpages/tplnedef.cxx
	cui/source/tabpages/tplneend.cxx
	cui/source/tabpages/tpshadow.cxx
	cui/source/tabpages/transfrm.cxx
	embedserv/source/embed/register.cxx
	extensions/inc/pch/precompiled_extensions.hxx
	extensions/inc/propctrlr.hrc
	extensions/source/abpilot/abpservices.cxx
	extensions/source/bibliography/bibload.cxx
	extensions/source/bibliography/datman.cxx
	extensions/source/bibliography/general.cxx
	extensions/source/dbpilots/dbpservices.cxx
	extensions/source/inc/componentmodule.cxx
	extensions/source/nsplugin/source/so_env.cxx
	extensions/source/ole/oleobjw.cxx
	extensions/source/ole/oleobjw.hxx
	extensions/source/oooimprovement/invite_job.cxx
	extensions/source/oooimprovement/onlogrotate_job.cxx
	extensions/source/plugin/base/service.cxx
	extensions/source/plugin/inc/plugin/unx/mediator.hxx
	extensions/source/plugin/inc/plugin/unx/plugcon.hxx
	extensions/source/plugin/unx/mediator.cxx
	extensions/source/plugin/unx/nppapi.cxx
	extensions/source/plugin/unx/plugcon.cxx
	extensions/source/preload/services.cxx
	extensions/source/propctrlr/formmetadata.cxx
	extensions/source/propctrlr/pcrservices.cxx
	extensions/source/resource/resource.cxx
	extensions/source/scanner/sane.hxx
	extensions/source/scanner/sanedlg.cxx
	extensions/source/scanner/scanunx.cxx
	extensions/source/scanner/scanwin.cxx
	extensions/source/scanner/twain.cxx
	extensions/source/scanner/twain.hxx
	extensions/source/update/check/updatecheckconfig.cxx
	extensions/test/stm/datatest.cxx
	extensions/test/stm/marktest.cxx
	extensions/test/stm/pipetest.cxx
	extensions/test/stm/testfactreg.cxx
	extensions/workben/testpgp.cxx
	forms/qa/complex/forms/CheckOGroupBoxModel.java
	forms/qa/makefile.mk
	forms/source/component/Button.cxx
	forms/source/component/Button.hxx
	forms/source/component/ListBox.cxx
	forms/source/inc/forms_module_impl.hxx
	forms/source/misc/services.cxx
	forms/source/solar/control/navtoolbar.cxx
	javainstaller2/prj/build.lst
	javainstaller2/src/JavaSetup/org/openoffice/setup/Util/ModuleCtrl.java
	lingucomponent/prj/build.lst
	lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
	lingucomponent/source/spellcheck/spell/sreg.cxx
	lingucomponent/source/spellcheck/spell/sspellimp.cxx
	package/source/manifest/ManifestExport.cxx
	package/source/manifest/UnoRegister.cxx
	package/source/xstor/owriteablestream.cxx
	package/source/xstor/owriteablestream.hxx
	package/source/xstor/xstorage.hxx
	package/source/zippackage/ZipPackageFolder.cxx
	package/source/zippackage/ZipPackageStream.cxx
	setup_native/source/mac/ooo/DS_Store
	setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
	xmlsecurity/prj/build.lst
	xmlsecurity/source/component/registerservices.cxx
	xmlsecurity/source/dialogs/stbcontrl.cxx
	xmlsecurity/source/framework/xsec_framework.cxx
	xmlsecurity/source/xmlsec/xsec_xmlsec.cxx
	xmlsecurity/tools/demo/util.hxx
	xmlsecurity/workben/signaturetest.cxx
2011-03-09 16:20:50 -06:00

1578 lines
58 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
//-----------------------------------------------
// include own files
#include "acccfg.hxx"
#include "cfgutil.hxx"
#include <dialmgr.hxx>
#include <sfx2/msg.hxx>
#include <sfx2/app.hxx>
#include <sfx2/filedlghelper.hxx>
#include <sfx2/minfitem.hxx>
#include <sfx2/sfxresid.hxx>
#include <svl/stritem.hxx>
#include <sal/macros.h>
#include "cuires.hrc"
#include "acccfg.hrc"
#include <svx/svxids.hrc> // SID_CHARMAP, SID_ATTR_SPECIALCHAR
//-----------------------------------------------
// include interface declarations
#include <com/sun/star/frame/XFramesSupplier.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/form/XReset.hpp>
#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/frame/XModuleManager.hpp>
#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/XUIConfigurationManager.hpp>
#include <com/sun/star/awt/KeyModifier.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
//-----------------------------------------------
// include other projects
#include <unotools/processfactory.hxx>
#include <svtools/acceleratorexecute.hxx>
#include <comphelper/processfactory.hxx>
#include <svtools/svlbitm.hxx>
#include <vcl/svapp.hxx>
#include <vcl/help.hxx>
#include <rtl/ustrbuf.hxx>
#include <comphelper/sequenceashashmap.hxx>
//-----------------------------------------------
// namespaces
#ifdef css
#error "ambigous praeprozessor directive for css ..."
#else
namespace css = ::com::sun::star;
#endif
using namespace com::sun::star;
//-----------------------------------------------
// definitions
//-----------------------------------------------
static ::rtl::OUString SERVICE_STORAGEFACTORY (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.StorageFactory" ));
static ::rtl::OUString SERVICE_UICONFIGMGR (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.UIConfigurationManager" ));
static ::rtl::OUString SERVICE_DESKTOP (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop" ));
static ::rtl::OUString SERVICE_MODULEMANAGER (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager" ));
static ::rtl::OUString SERVICE_GLOBALACCCFG (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.GlobalAcceleratorConfiguration" ));
static ::rtl::OUString SERVICE_MODULEUICONFIGSUPPLIER (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.ModuleUIConfigurationManagerSupplier"));
static ::rtl::OUString SERVICE_UICMDDESCRIPTION (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.UICommandDescription" ));
static ::rtl::OUString MODULEPROP_SHORTNAME (RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryShortName" ));
static ::rtl::OUString MODULEPROP_UINAME (RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryUIName" ));
static ::rtl::OUString CMDPROP_UINAME (RTL_CONSTASCII_USTRINGPARAM("Name" ));
static ::rtl::OUString FOLDERNAME_UICONFIG (RTL_CONSTASCII_USTRINGPARAM("Configurations2" ));
static ::rtl::OUString MEDIATYPE_PROPNAME (RTL_CONSTASCII_USTRINGPARAM("MediaType" ));
static ::rtl::OUString MEDIATYPE_UICONFIG (RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.xml.ui.configuration" ));
//-----------------------------------------------
static sal_uInt16 KEYCODE_ARRAY[] =
{
KEY_F1 ,
KEY_F2 ,
KEY_F3 ,
KEY_F4 ,
KEY_F5 ,
KEY_F6 ,
KEY_F7 ,
KEY_F8 ,
KEY_F9 ,
KEY_F10 ,
KEY_F11 ,
KEY_F12 ,
KEY_F13 ,
KEY_F14 ,
KEY_F15 ,
KEY_F16 ,
KEY_DOWN ,
KEY_UP ,
KEY_LEFT ,
KEY_RIGHT ,
KEY_HOME ,
KEY_END ,
KEY_PAGEUP ,
KEY_PAGEDOWN ,
KEY_RETURN ,
KEY_ESCAPE ,
KEY_BACKSPACE,
KEY_INSERT ,
KEY_DELETE ,
KEY_OPEN ,
KEY_CUT ,
KEY_COPY ,
KEY_PASTE ,
KEY_UNDO ,
KEY_REPEAT ,
KEY_FIND ,
KEY_PROPERTIES ,
KEY_FRONT ,
KEY_CONTEXTMENU ,
KEY_MENU ,
KEY_HELP ,
KEY_F1 | KEY_SHIFT,
KEY_F2 | KEY_SHIFT,
KEY_F3 | KEY_SHIFT,
KEY_F4 | KEY_SHIFT,
KEY_F5 | KEY_SHIFT,
KEY_F6 | KEY_SHIFT,
KEY_F7 | KEY_SHIFT,
KEY_F8 | KEY_SHIFT,
KEY_F9 | KEY_SHIFT,
KEY_F10 | KEY_SHIFT,
KEY_F11 | KEY_SHIFT,
KEY_F12 | KEY_SHIFT,
KEY_F13 | KEY_SHIFT,
KEY_F14 | KEY_SHIFT,
KEY_F15 | KEY_SHIFT,
KEY_F16 | KEY_SHIFT,
KEY_DOWN | KEY_SHIFT,
KEY_UP | KEY_SHIFT,
KEY_LEFT | KEY_SHIFT,
KEY_RIGHT | KEY_SHIFT,
KEY_HOME | KEY_SHIFT,
KEY_END | KEY_SHIFT,
KEY_PAGEUP | KEY_SHIFT,
KEY_PAGEDOWN | KEY_SHIFT,
KEY_RETURN | K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OD1 ,
KEY_F10 | KEY_MOD1 ,
KEY_F11 | KEY_MOD1 ,
KEY_F12 | KEY_MOD1 ,
KEY_F13 | KEY_MOD1 ,
KEY_F14 | KEY_MOD1 ,
KEY_F15 | KEY_MOD1 ,
KEY_F16 | KEY_MOD1 ,
KEY_DOWN | KEY_MOD1 ,
KEY_UP | KEY_MOD1 ,
KEY_LEFT | KEY_MOD1 ,
KEY_RIGHT | KEY_MOD1 ,
KEY_HOME | KEY_MOD1 ,
KEY_END | KEY_MOD1 ,
KEY_PAGEUP | KEY_MOD1 ,
KEY_PAGEDOWN | KEY_MOD1 ,
KEY_RETURN | KEY_MOD1 ,
KEY_SPACE | KEY_MOD1 ,
KEY_BACKSPACE | KEY_MOD1 ,
KEY_INSERT | KEY_MOD1 ,
KEY_DELETE | KEY_MOD1 ,
KEY_ADD | KEY_MOD1 ,
KEY_SUBTRACT | KEY_MOD1 ,
KEY_MULTIPLY | KEY_MOD1 ,
KEY_DIVIDE | KEY_MOD1 ,
KEY_0 | KEY_SHIFT | KEY_MOD1,
KEY_1 | KEY_SHIFT | KEY_MOD1,
KEY_2 | KEY_SHIFT | KEY_MOD1,
KEY_3 | KEY_SHIFT | KEY_MOD1,
KEY_4 | KEY_SHIFT | KEY_MOD1,
KEY_5 | KEY_SHIFT | KEY_MOD1,
KEY_6 | KEY_SHIFT | KEY_MOD1,
KEY_7 | KEY_SHIFT | KEY_MOD1,
KEY_8 | KEY_SHIFT | KEY_MOD1,
KEY_9 | KEY_SHIFT | KEY_MOD1,
KEY_A | KEY_SHIFT | KEY_MOD1,
KEY_B | KEY_SHIFT | KEY_MOD1,
KEY_C | KEY_SHIFT | KEY_MOD1,
KEY_D | KEY_SHIFT | KEY_MOD1,
KEY_E | KEY_SHIFT | KEY_MOD1,
KEY_F | KEY_SHIFT | KEY_MOD1,
KEY_G | KEY_SHIFT | KEY_MOD1,
KEY_H | KEY_SHIFT | KEY_MOD1,
KEY_I | KEY_SHIFT | KEY_MOD1,
KEY_J | KEY_SHIFT | KEY_MOD1,
KEY_K | KEY_SHIFT | KEY_MOD1,
KEY_L | KEY_SHIFT | KEY_MOD1,
KEY_M | KEY_SHIFT | KEY_MOD1,
KEY_N | KEY_SHIFT | KEY_MOD1,
KEY_O | KEY_SHIFT | KEY_MOD1,
KEY_P | KEY_SHIFT | KEY_MOD1,
KEY_Q | KEY_SHIFT | KEY_MOD1,
KEY_R | KEY_SHIFT | KEY_MOD1,
KEY_S | KEY_SHIFT | KEY_MOD1,
KEY_T | KEY_SHIFT | KEY_MOD1,
KEY_U | KEY_SHIFT | KEY_MOD1,
KEY_V | KEY_SHIFT | KEY_MOD1,
KEY_W | KEY_SHIFT | KEY_MOD1,
KEY_X | KEY_SHIFT | KEY_MOD1,
KEY_Y | KEY_SHIFT | KEY_MOD1,
KEY_Z | KEY_SHIFT | KEY_MOD1,
KEY_SEMICOLON | KEY_SHIFT | KEY_MOD1 ,
KEY_BRACKETLEFT | KEY_SHIFT | KEY_MOD1 ,
KEY_BRACKETRIGHT | KEY_SHIFT | KEY_MOD1,
KEY_F1 | KEY_SHIFT | KEY_MOD1,
KEY_F2 | KEY_SHIFT | KEY_MOD1,
KEY_F3 | KEY_SHIFT | KEY_MOD1,
KEY_F4 | KEY_SHIFT | KEY_MOD1,
KEY_F5 | KEY_SHIFT | KEY_MOD1,
KEY_F6 | KEY_SHIFT | KEY_MOD1,
KEY_F7 | KEY_SHIFT | KEY_MOD1,
KEY_F8 | KEY_SHIFT | KEY_MOD1,
KEY_F9 | KEY_SHIFT | KEY_MOD1,
KEY_F10 | KEY_SHIFT | KEY_MOD1,
KEY_F11 | KEY_SHIFT | KEY_MOD1,
KEY_F12 | KEY_SHIFT | KEY_MOD1,
KEY_F13 | KEY_SHIFT | KEY_MOD1,
KEY_F14 | KEY_SHIFT | KEY_MOD1,
KEY_F15 | KEY_SHIFT | KEY_MOD1,
KEY_F16 | KEY_SHIFT | KEY_MOD1,
KEY_DOWN | KEY_SHIFT | KEY_MOD1,
KE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EY_MOD2,
KEY_E | KEY_SHIFT | KEY_MOD2,
KEY_F | KEY_SHIFT | KEY_MOD2,
KEY_G | KEY_SHIFT | KEY_MOD2,
KEY_H | KEY_SHIFT | KEY_MOD2,
KEY_I | KEY_SHIFT | KEY_MOD2,
KEY_J | KEY_SHIFT | KEY_MOD2,
KEY_K | KEY_SHIFT | KEY_MOD2,
KEY_L | KEY_SHIFT | KEY_MOD2,
KEY_M | KEY_SHIFT | KEY_MOD2,
KEY_N | KEY_SHIFT | KEY_MOD2,
KEY_O | KEY_SHIFT | KEY_MOD2,
KEY_P | KEY_SHIFT | KEY_MOD2,
KEY_Q | KEY_SHIFT | KEY_MOD2,
KEY_R | KEY_SHIFT | KEY_MOD2,
KEY_S | KEY_SHIFT | KEY_MOD2,
KEY_T | KEY_SHIFT | KEY_MOD2,
KEY_U | KEY_SHIFT | KEY_MOD2,
KEY_V | KEY_SHIFT | KEY_MOD2,
KEY_W | KEY_SHIFT | KEY_MOD2,
KEY_X | KEY_SHIFT | KEY_MOD2,
KEY_Y | KEY_SHIFT | KEY_MOD2,
KEY_Z | KEY_SHIFT | KEY_MOD2,
KEY_SEMICOLON | KEY_SHIFT | KEY_MOD2 ,
KEY_BRACKETLEFT | KEY_SHIFT | KEY_MOD2 ,
KEY_BRACKETRIGHT | KEY_SHIFT | KEY_MOD2,
KEY_F1 | KEY_SHIFT | KEY_MOD2,
KEY_F2 | KEY_SHIFT | KEY_MOD2,
KEY_F3 | KEY_SHIFT | KEY_MOD2,
KEY_F4 | KEY_SHIFT | KEY_MOD2,
KEY_F5 | KEY_SHIFT | KEY_MOD2,
KEY_F6 | KEY_SHIFT | KEY_MOD2,
KEY_F7 | KEY_SHIFT | KEY_MOD2,
KEY_F8 | KEY_SHIFT | KEY_MOD2,
KEY_F9 | KEY_SHIFT | KEY_MOD2,
KEY_F10 | KEY_SHIFT | KEY_MOD2,
KEY_F11 | KEY_SHIFT | KEY_MOD2,
KEY_F12 | KEY_SHIFT | KEY_MOD2,
KEY_F13 | KEY_SHIFT | KEY_MOD2,
KEY_F14 | KEY_SHIFT | KEY_MOD2,
KEY_F15 | KEY_SHIFT | KEY_MOD2,
KEY_F16 | KEY_SHIFT | KEY_MOD2,
KEY_DOWN | KEY_SHIFT | KEY_MOD2,
KEY_UP | KEY_SHIFT | KEY_MOD2,
KEY_LEFT | KEY_SHIFT | KEY_MOD2,
KEY_RIGHT | KEY_SHIFT | KEY_MOD2,
KEY_HOME | KEY_SHIFT | KEY_MOD2,
KEY_END | KEY_SHIFT | KEY_MOD2,
KEY_PAGEUP | KEY_SHIFT | KEY_MOD2,
KEY_PAGEDOWN | KEY_SHIFT | KEY_MOD2,
KEY_RETURN | KEY_SHIFT | KEY_MOD2,
KEY_SPACE | KEY_SHIFT | KEY_MOD2,
KEY_BACKSPACE | KEY_SHIFT | KEY_MOD2,
KEY_INSERT | KEY_SHIFT | KEY_MOD2,
KEY_DELETE | KEY_SHIFT | KEY_MOD2,
KEY_0 | KEY_MOD1 | KEY_MOD2 ,
KEY_1 | KEY_MOD1 | KEY_MOD2 ,
KEY_2 | KEY_MOD1 | KEY_MOD2 ,
KEY_3 | KEY_MOD1 | KEY_MOD2 ,
KEY_4 | KEY_MOD1 | KEY_MOD2 ,
KEY_5 | KEY_MOD1 | KEY_MOD2 ,
KEY_6 | KEY_MOD1 | KEY_MOD2 ,
KEY_7 | KEY_MOD1 | KEY_MOD2 ,
KEY_8 | KEY_MOD1 | KEY_MOD2 ,
KEY_9 | KEY_MOD1 | KEY_MOD2 ,
KEY_A | KEY_MOD1 | KEY_MOD2 ,
KEY_B | KEY_MOD1 | KEY_MOD2 ,
KEY_C | KEY_MOD1 | KEY_MOD2 ,
KEY_D | KEY_MOD1 | KEY_MOD2 ,
KEY_E | KEY_MOD1 | KEY_MOD2 ,
KEY_F | KEY_MOD1 | KEY_MOD2 ,
KEY_G | KEY_MOD1 | KEY_MOD2 ,
KEY_H | KEY_MOD1 | KEY_MOD2 ,
KEY_I | KEY_MOD1 |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OD2 ,
KEY_LEFT | KEY_MOD1 | KEY_MOD2 ,
KEY_RIGHT | KEY_MOD1 | KEY_MOD2 ,
KEY_HOME | KEY_MOD1 | KEY_MOD2 ,
KEY_END | KEY_MOD1 | KEY_MOD2 ,
KEY_PAGEUP | KEY_MOD1 | KEY_MOD2 ,
KEY_PAGEDOWN | KEY_MOD1 | KEY_MOD2 ,
KEY_RETURN | KEY_MOD1 | KEY_MOD2 ,
KEY_SPACE | KEY_MOD1 | KEY_MOD2 ,
KEY_BACKSPACE | KEY_MOD1 | KEY_MOD2 ,
KEY_INSERT | KEY_MOD1 | KEY_MOD2 ,
KEY_DELETE | KEY_MOD1 | KEY_MOD2 ,
KEY_0 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_1 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_2 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_3 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_4 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_5 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_6 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_7 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_8 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_9 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_A | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_B | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_C | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_D | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_E | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_F | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_G | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_H | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_I | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_J | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_K | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_L | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_M | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_N | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_O | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_P | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_Q | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_R | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_S | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_T | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_U | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_V | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_W | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_X | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_Y | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_Z | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_SEMICOLON | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_BRACKETLEFT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_BRACKETRIGHT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_F1 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_F2 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_F3 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_F4 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_F5 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_F6 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_F7 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_F8 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_F9 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_F10 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_F11 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_F12 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_F13 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_F14 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_F15 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_F16 | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_DOWN | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_UP | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_LEFT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_RIGHT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_HOME | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_END | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_PAGEUP | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_PAGEDOWN | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_RETURN | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_SPACE | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_BACKSPACE | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_INSERT | KEY_SHIFT | KEY_MOD1 | KEY_MOD2,
KEY_DELETE | KEY_SHIFT | KEY_MOD1 | KEY_MOD2
};
static sal_uInt16 KEYCODE_ARRAY_SIZE = SAL_N_ELEMENTS(KEYCODE_ARRAY);
//-----------------------------------------------
// seems to be needed to layout the list box, which shows all
// assignable shortcuts
static long AccCfgTabs[] =
{
2, // Number of Tabs
0,
120 // Function
};
//-----------------------------------------------
class SfxAccCfgLBoxString_Impl : public SvLBoxString
{
public:
SfxAccCfgLBoxString_Impl( SvLBoxEntry* pEntry,
sal_uInt16 nFlags,
const String& sText );
virtual ~SfxAccCfgLBoxString_Impl();
virtual void Paint(const Point& aPos ,
SvLBox& rDevice,
sal_uInt16 nFlags ,
SvLBoxEntry* pEntry );
};
//-----------------------------------------------
SfxAccCfgLBoxString_Impl::SfxAccCfgLBoxString_Impl( SvLBoxEntry* pEntry,
sal_uInt16 nFlags,
const String& sText )
: SvLBoxString(pEntry, nFlags, sText)
{
}
//-----------------------------------------------
SfxAccCfgLBoxString_Impl::~SfxAccCfgLBoxString_Impl()
{
}
//-----------------------------------------------
void SfxAccCfgLBoxString_Impl::Paint(const Point& aPos ,
SvLBox& rDevice,
sal_uInt16 /*nFlags*/,
SvLBoxEntry* pEntry )
{
if (!pEntry)
return;
TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData();
if (!pUserData)
return;
if (pUserData->m_bIsConfigurable)
rDevice.DrawText(aPos, GetText());
else
rDevice.DrawCtrlText(aPos, GetText(), 0, STRING_LEN, TEXT_DRAW_DISABLE);
}
//-----------------------------------------------
void SfxAccCfgTabListBox_Impl::InitEntry( SvLBoxEntry* pEntry ,
const XubString& sText ,
const Image& aImage1,
const Image& aImage2,
SvLBoxButtonKind eButtonKind)
{
SvTabListBox::InitEntry(pEntry, sText, aImage1, aImage2, eButtonKind);
}
//-----------------------------------------------
/** select the entry, which match the current key input ... excepting
keys, which are used for the dialog itself.
*/
void SfxAccCfgTabListBox_Impl::KeyInput(const KeyEvent& aKey)
{
KeyCode aCode1 = aKey.GetKeyCode();
sal_uInt16 nCode1 = aCode1.GetCode();
sal_uInt16 nMod1 = aCode1.GetModifier();
// is it related to our list box ?
if (
(nCode1 != KEY_DOWN ) &&
(nCode1 != KEY_UP ) &&
(nCode1 != KEY_LEFT ) &&
(nCode1 != KEY_RIGHT ) &&
(nCode1 != KEY_PAGEUP ) &&
(nCode1 != KEY_PAGEDOWN)
)
{
SvLBoxEntry* pEntry = First();
while (pEntry)
{
TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData();
if (pUserData)
{
sal_uInt16 nCode2 = pUserData->m_aKey.GetCode();
sal_uInt16 nMod2 = pUserData->m_aKey.GetModifier();
if (
(nCode1 == nCode2) &&
(nMod1 == nMod2 )
)
{
Select (pEntry);
MakeVisible(pEntry);
return;
}
}
pEntry = Next(pEntry);
}
}
// no - handle it as normal dialog input
SvTabListBox::KeyInput(aKey);
}
//-----------------------------------------------
SfxAcceleratorConfigPage::SfxAcceleratorConfigPage( Window* pParent, const SfxItemSet& aSet )
: SfxTabPage (pParent, CUI_RES(RID_SVXPAGE_KEYBOARD), aSet)
, m_pMacroInfoItem ()
, m_pStringItem ()
, m_pFontItem ()
, m_pFileDlg (NULL)
, aEntriesBox (this , this, CUI_RES(BOX_ACC_ENTRIES ))
, aKeyboardGroup (this , CUI_RES(GRP_ACC_KEYBOARD ))
, aOfficeButton (this , CUI_RES(RB_OFFICE ))
, aModuleButton (this , CUI_RES(RB_MODULE ))
, aChangeButton (this , CUI_RES(BTN_ACC_CHANGE ))
, aRemoveButton (this , CUI_RES(BTN_ACC_REMOVE ))
, aGroupText (this , CUI_RES(TXT_ACC_GROUP ))
, pGroupLBox(new SfxConfigGroupListBox_Impl( this, CUI_RES(BOX_ACC_GROUP), SFX_SLOT_ACCELCONFIG ))
, aFunctionText (this , CUI_RES(TXT_ACC_FUNCTION ))
, pFunctionBox(new SfxConfigFunctionListBox_Impl( this, CUI_RES( BOX_ACC_FUNCTION )))
, aKeyText (this , CUI_RES(TXT_ACC_KEY ))
, aKeyBox (this , CUI_RES(BOX_ACC_KEY ))
, aFunctionsGroup (this , CUI_RES(GRP_ACC_FUNCTIONS ))
, aLoadButton (this , CUI_RES(BTN_LOAD ))
, aSaveButton (this , CUI_RES(BTN_SAVE ))
, aResetButton (this , CUI_RES(BTN_RESET ))
, aLoadAccelConfigStr ( CUI_RES( STR_LOADACCELCONFIG ) )
, aSaveAccelConfigStr ( CUI_RES( STR_SAVEACCELCONFIG ) )
, aFilterCfgStr ( CUI_RES( STR_FILTERNAME_CFG ) )
, m_bStylesInfoInitialized(sal_False)
, m_xGlobal ()
, m_xModule ()
, m_xAct ()
{
FreeResource();
aFilterAllStr = String( SfxResId( STR_SFX_FILTERNAME_ALL ) );
// install handler functions
aChangeButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, ChangeHdl ));
aRemoveButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RemoveHdl ));
aEntriesBox.SetSelectHdl ( LINK( this, SfxAcceleratorConfigPage, SelectHdl ));
pGroupLBox->SetSelectHdl ( LINK( this, SfxAcceleratorConfigPage, SelectHdl ));
pFunctionBox->SetSelectHdl( LINK( this, SfxAcceleratorConfigPage, SelectHdl ));
aKeyBox.SetSelectHdl ( LINK( this, SfxAcceleratorConfigPage, SelectHdl ));
aLoadButton.SetClickHdl ( LINK( this, SfxAcceleratorConfigPage, Load ));
aSaveButton.SetClickHdl ( LINK( this, SfxAcceleratorConfigPage, Save ));
aResetButton.SetClickHdl ( LINK( this, SfxAcceleratorConfigPage, Default ));
aOfficeButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RadioHdl ));
aModuleButton.SetClickHdl( LINK( this, SfxAcceleratorConfigPage, RadioHdl ));
// initialize Entriesbox
aEntriesBox.SetStyle(aEntriesBox.GetStyle()|WB_HSCROLL|WB_CLIPCHILDREN);
aEntriesBox.SetSelectionMode(SINGLE_SELECTION);
aEntriesBox.SetTabs(&AccCfgTabs[0], MAP_APPFONT);
aEntriesBox.Resize(); // OS: Hack for right selection
aEntriesBox.SetSpaceBetweenEntries(0);
aEntriesBox.SetDragDropMode(0);
// detect max keyname width
long nMaxWidth = 0;
for ( sal_uInt16 i = 0; i < KEYCODE_ARRAY_SIZE; ++i )
{
long nTmp = GetTextWidth( KeyCode( KEYCODE_ARRAY[i] ).GetName() );
if ( nTmp > nMaxWidth )
nMaxWidth = nTmp;
}
// recalc second tab
long nNewTab = PixelToLogic( Size( nMaxWidth, 0 ), MAP_APPFONT ).Width();
nNewTab = nNewTab + 5; // additional space
aEntriesBox.SetTab( 1, nNewTab );
// initialize GroupBox
pGroupLBox->SetFunctionListBox(pFunctionBox);
// initialize KeyBox
aKeyBox.SetStyle(aKeyBox.GetStyle()|WB_CLIPCHILDREN|WB_HSCROLL|WB_SORT);
}
//-----------------------------------------------
SfxAcceleratorConfigPage::~SfxAcceleratorConfigPage()
{
// free memory - remove all dynamic user data
SvLBoxEntry* pEntry = aEntriesBox.First();
while (pEntry)
{
TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData();
if (pUserData)
delete pUserData;
pEntry = aEntriesBox.Next(pEntry);
}
pEntry = aKeyBox.First();
while (pEntry)
{
TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData();
if (pUserData)
delete pUserData;
pEntry = aKeyBox.Next(pEntry);
}
aEntriesBox.Clear();
aKeyBox.Clear();
delete m_pFileDlg;
delete pGroupLBox;
delete pFunctionBox;
}
//-----------------------------------------------
void SfxAcceleratorConfigPage::InitAccCfg()
{
// already initialized ?
if (m_xSMGR.is())
return; // yes -> do nothing
try
{
// no - initialize this instance
m_xSMGR = ::utl::getProcessServiceFactory();
m_xUICmdDescription = css::uno::Reference< css::container::XNameAccess >(m_xSMGR->createInstance(SERVICE_UICMDDESCRIPTION), css::uno::UNO_QUERY_THROW);
// get the current active frame, which should be our "parent"
// for this session
m_xFrame = GetFrame();
if ( !m_xFrame.is() )
{
css::uno::Reference< css::frame::XFramesSupplier > xDesktop(m_xSMGR->createInstance(SERVICE_DESKTOP), css::uno::UNO_QUERY_THROW);
m_xFrame = xDesktop->getActiveFrame();
}
// identify module
css::uno::Reference< css::frame::XModuleManager > xModuleManager (m_xSMGR->createInstance(SERVICE_MODULEMANAGER), css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::container::XNameAccess > xModuleManagerCont(xModuleManager , css::uno::UNO_QUERY_THROW);
m_sModuleLongName = xModuleManager->identify(m_xFrame);
::comphelper::SequenceAsHashMap lModuleProps(xModuleManagerCont->getByName(m_sModuleLongName));
m_sModuleShortName = lModuleProps.getUnpackedValueOrDefault(MODULEPROP_SHORTNAME, ::rtl::OUString());
m_sModuleUIName = lModuleProps.getUnpackedValueOrDefault(MODULEPROP_UINAME , ::rtl::OUString());
// get global accelerator configuration
m_xGlobal = css::uno::Reference< css::ui::XAcceleratorConfiguration >(m_xSMGR->createInstance(SERVICE_GLOBALACCCFG), css::uno::UNO_QUERY_THROW);
// get module accelerator configuration
css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier(m_xSMGR->createInstance(SERVICE_MODULEUICONFIGSUPPLIER), css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::ui::XUIConfigurationManager > xUICfgManager = xModuleCfgSupplier->getUIConfigurationManager(m_sModuleLongName);
m_xModule = css::uno::Reference< css::ui::XAcceleratorConfiguration >(xUICfgManager->getShortCutManager(), css::uno::UNO_QUERY_THROW);
}
catch(const css::uno::RuntimeException& exRun)
{ throw exRun; }
catch(const css::uno::Exception&)
{ m_xSMGR.clear(); }
}
//-----------------------------------------------
/** Initialize text columns with own class to enable custom painting
This is needed as we have to paint disabled entries by ourself. No support for that in the
original SvTabListBox!
*/
void SfxAcceleratorConfigPage::CreateCustomItems( SvLBoxEntry* pEntry,
const String& sCol1 ,
const String& sCol2 )
{
SfxAccCfgLBoxString_Impl* pStringItem = new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol1);
pEntry->ReplaceItem(pStringItem, 1);
pStringItem = new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol2);
pEntry->ReplaceItem(pStringItem, 2);
}
//-----------------------------------------------
void SfxAcceleratorConfigPage::Init(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xAccMgr)
{
if (!xAccMgr.is())
return;
if (!m_bStylesInfoInitialized)
{
css::uno::Reference< css::frame::XController > xController;
css::uno::Reference< css::frame::XModel > xModel;
if (m_xFrame.is())
xController = m_xFrame->getController();
if (xController.is())
xModel = xController->getModel();
m_aStylesInfo.setModel(xModel);
pFunctionBox->SetStylesInfo(&m_aStylesInfo);
pGroupLBox->SetStylesInfo(&m_aStylesInfo);
m_bStylesInfoInitialized = sal_True;
}
// Insert all editable accelerators into list box. It is possible
// that some accelerators are not mapped on the current system/keyboard
// but we don't want to lose these mappings.
sal_uInt16 c1 = KEYCODE_ARRAY_SIZE;
sal_uInt16 i1 = 0;
sal_uInt16 nListPos = 0;
for (i1=0; i1<c1; ++i1)
{
KeyCode aKey = KEYCODE_ARRAY[i1];
String sKey = aKey.GetName();
if (!sKey.Len())
continue;
TAccInfo* pEntry = new TAccInfo(i1, nListPos, aKey);
SvLBoxEntry* pLBEntry = aEntriesBox.InsertEntryToColumn(sKey, 0L, LIST_APPEND, 0xFFFF);
pLBEntry->SetUserData(pEntry);
}
// Assign all commands to its shortcuts - reading the accelerator config.
css::uno::Sequence< css::awt::KeyEvent > lKeys = xAccMgr->getAllKeyEvents();
sal_Int32 c2 = lKeys.getLength();
sal_Int32 i2 = 0;
sal_uInt16 nCol = aEntriesBox.TabCount()-1;
for (i2=0; i2<c2; ++i2)
{
const css::awt::KeyEvent& aAWTKey = lKeys[i2];
::rtl::OUString sCommand = xAccMgr->getCommandByKeyEvent(aAWTKey);
String sLabel = GetLabel4Command(sCommand);
KeyCode aKeyCode = ::svt::AcceleratorExecute::st_AWTKey2VCLKey(aAWTKey);
sal_uInt16 nPos = MapKeyCodeToPos(aKeyCode);
if (nPos == LISTBOX_ENTRY_NOTFOUND)
continue;
aEntriesBox.SetEntryText(sLabel, nPos, nCol);
SvLBoxEntry* pLBEntry = aEntriesBox.GetEntry(0, nPos);
TAccInfo* pEntry = (TAccInfo*)pLBEntry->GetUserData();
pEntry->m_bIsConfigurable = sal_True;
pEntry->m_sCommand = sCommand;
CreateCustomItems(pLBEntry, aEntriesBox.GetEntryText(pLBEntry, 0), sLabel);
}
// Map the VCL hardcoded key codes and mark them as not changeable
sal_uLong c3 = Application::GetReservedKeyCodeCount();
sal_uLong i3 = 0;
for (i3=0; i3<c3; ++i3)
{
const KeyCode* pKeyCode = Application::GetReservedKeyCode(i3);
sal_uInt16 nPos = MapKeyCodeToPos(*pKeyCode);
if (nPos == LISTBOX_ENTRY_NOTFOUND)
continue;
// Hardcoded function mapped so no ID possible and mark entry as not changeable
SvLBoxEntry* pLBEntry = aEntriesBox.GetEntry(0, nPos);
TAccInfo* pEntry = (TAccInfo*)pLBEntry->GetUserData();
pEntry->m_bIsConfigurable = sal_False;
CreateCustomItems(pLBEntry, aEntriesBox.GetEntryText(pLBEntry, 0), String());
}
}
//-----------------------------------------------
void SfxAcceleratorConfigPage::Apply(const css::uno::Reference< css::ui::XAcceleratorConfiguration >& xAccMgr)
{
if (!xAccMgr.is())
return;
// Go through the list from the bottom to the top ...
// because logical accelerator must be preferred instead of
// physical ones!
SvLBoxEntry* pEntry = aEntriesBox.First();
while (pEntry)
{
TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData();
::rtl::OUString sCommand ;
css::awt::KeyEvent aAWTKey ;
if (pUserData)
{
sCommand = pUserData->m_sCommand;
aAWTKey = ::svt::AcceleratorExecute::st_VCLKey2AWTKey(pUserData->m_aKey);
}
try
{
if (sCommand.getLength())
xAccMgr->setKeyEvent(aAWTKey, sCommand);
else
xAccMgr->removeKeyEvent(aAWTKey);
}
catch(const css::uno::RuntimeException& exRun)
{ throw exRun; }
catch(const css::uno::Exception&)
{}
pEntry = aEntriesBox.Next(pEntry);
}
}
//-----------------------------------------------
void SfxAcceleratorConfigPage::ResetConfig()
{
aEntriesBox.Clear();
}
//-----------------------------------------------
IMPL_LINK( SfxAcceleratorConfigPage, Load, Button*, EMPTYARG )
{
// ask for filename, where we should load the new config data from
StartFileDialog( WB_OPEN | WB_STDMODAL | WB_3DLOOK, aLoadAccelConfigStr );
return 0;
}
//-----------------------------------------------
IMPL_LINK( SfxAcceleratorConfigPage, Save, Button*, EMPTYARG )
{
StartFileDialog( WB_SAVEAS | WB_STDMODAL | WB_3DLOOK, aLoadAccelConfigStr );
return 0;
}
//-----------------------------------------------
IMPL_LINK(SfxAcceleratorConfigPage, Default, PushButton*, EMPTYARG)
{
css::uno::Reference< css::form::XReset > xReset(m_xAct, css::uno::UNO_QUERY);
if (xReset.is())
xReset->reset();
aEntriesBox.SetUpdateMode(sal_False);
ResetConfig();
Init(m_xAct);
aEntriesBox.SetUpdateMode(sal_True);
aEntriesBox.Invalidate();
aEntriesBox.Select(aEntriesBox.GetEntry(0, 0));
return 0;
}
//-----------------------------------------------
IMPL_LINK( SfxAcceleratorConfigPage, ChangeHdl, Button*, EMPTYARG )
{
sal_uInt16 nPos = (sal_uInt16) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() );
TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData();
String sNewCommand = pFunctionBox->GetCurCommand();
String sLabel = pFunctionBox->GetCurLabel();
if (!sLabel.Len())
sLabel = GetLabel4Command(sNewCommand);
pEntry->m_sCommand = sNewCommand;
sal_uInt16 nCol = aEntriesBox.TabCount() - 1;
aEntriesBox.SetEntryText(sLabel, nPos, nCol);
((Link &) pFunctionBox->GetSelectHdl()).Call( pFunctionBox );
return 0;
}
//-----------------------------------------------
IMPL_LINK( SfxAcceleratorConfigPage, RemoveHdl, Button *, EMPTYARG )
{
// get selected entry
sal_uInt16 nPos = (sal_uInt16) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() );
TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData();
// remove function name from selected entry
sal_uInt16 nCol = aEntriesBox.TabCount() - 1;
aEntriesBox.SetEntryText( String(), nPos, nCol );
pEntry->m_sCommand = ::rtl::OUString();
((Link &) pFunctionBox->GetSelectHdl()).Call( pFunctionBox );
return 0;
}
//-----------------------------------------------
IMPL_LINK( SfxAcceleratorConfigPage, SelectHdl, Control*, pListBox )
{
// disable help
Help::ShowBalloon( this, Point(), String() );
if ( pListBox == &aEntriesBox )
{
sal_uInt16 nPos = (sal_uInt16) aEntriesBox.GetModel()->GetRelPos( aEntriesBox.FirstSelected() );
TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData();
::rtl::OUString sPossibleNewCommand = pFunctionBox->GetCurCommand();
aRemoveButton.Enable( sal_False );
aChangeButton.Enable( sal_False );
if (pEntry->m_bIsConfigurable)
{
if (pEntry->isConfigured())
aRemoveButton.Enable( sal_True );
aChangeButton.Enable( pEntry->m_sCommand != sPossibleNewCommand );
}
}
else if ( pListBox == pGroupLBox )
{
pGroupLBox->GroupSelected();
if ( !pFunctionBox->FirstSelected() )
aChangeButton.Enable( sal_False );
}
else if ( pListBox == pFunctionBox )
{
aRemoveButton.Enable( sal_False );
aChangeButton.Enable( sal_False );
// #i36994 First selected can return zero!
SvLBoxEntry* pLBEntry = aEntriesBox.FirstSelected();
if ( pLBEntry != 0 )
{
sal_uInt16 nPos = (sal_uInt16) aEntriesBox.GetModel()->GetRelPos( pLBEntry );
TAccInfo* pEntry = (TAccInfo*)aEntriesBox.GetEntry(0, nPos)->GetUserData();
::rtl::OUString sPossibleNewCommand = pFunctionBox->GetCurCommand();
if (pEntry->m_bIsConfigurable)
{
if (pEntry->isConfigured())
aRemoveButton.Enable( sal_True );
aChangeButton.Enable( pEntry->m_sCommand != sPossibleNewCommand );
}
// update key box
aKeyBox.Clear();
SvLBoxEntry* pIt = aEntriesBox.First();
while ( pIt )
{
TAccInfo* pUserData = (TAccInfo*)pIt->GetUserData();
if ( pUserData && pUserData->m_sCommand == sPossibleNewCommand )
{
TAccInfo* pU1 = new TAccInfo(-1, -1, pUserData->m_aKey);
SvLBoxEntry* pE1 = aKeyBox.InsertEntry( pUserData->m_aKey.GetName(), 0L, sal_True, LIST_APPEND );
pE1->SetUserData(pU1);
pE1->EnableChildsOnDemand( sal_False );
}
pIt = aEntriesBox.Next(pIt);
}
}
}
else
{
// goto selected "key" entry of the key box
SvLBoxEntry* pE2 = 0;
TAccInfo* pU2 = 0;
sal_uInt16 nP2 = LISTBOX_ENTRY_NOTFOUND;
SvLBoxEntry* pE3 = 0;
pE2 = aKeyBox.FirstSelected();
if (pE2)
pU2 = (TAccInfo*)pE2->GetUserData();
if (pU2)
nP2 = MapKeyCodeToPos(pU2->m_aKey);
if (nP2 != LISTBOX_ENTRY_NOTFOUND)
pE3 = aEntriesBox.GetEntry( 0, nP2 );
if (pE3)
{
aEntriesBox.Select( pE3 );
aEntriesBox.MakeVisible( pE3 );
}
}
return 0;
}
//-----------------------------------------------
IMPL_LINK( SfxAcceleratorConfigPage, RadioHdl, RadioButton *, EMPTYARG )
{
css::uno::Reference< css::ui::XAcceleratorConfiguration > xOld = m_xAct;
if (aOfficeButton.IsChecked())
m_xAct = m_xGlobal;
else if (aModuleButton.IsChecked())
m_xAct = m_xModule;
// nothing changed? => do nothing!
if ( m_xAct.is() && ( xOld == m_xAct ) )
return 0;
aEntriesBox.SetUpdateMode( sal_False );
ResetConfig();
Init(m_xAct);
aEntriesBox.SetUpdateMode( sal_True );
aEntriesBox.Invalidate();
pGroupLBox->Init(m_xSMGR, m_xFrame, m_sModuleLongName);
// pb: #133213# do not select NULL entries
SvLBoxEntry* pEntry = aEntriesBox.GetEntry( 0, 0 );
if ( pEntry )
aEntriesBox.Select( pEntry );
pEntry = pGroupLBox->GetEntry( 0, 0 );
if ( pEntry )
pGroupLBox->Select( pEntry );
((Link &) pFunctionBox->GetSelectHdl()).Call( pFunctionBox );
return 1L;
}
//-----------------------------------------------
IMPL_LINK( SfxAcceleratorConfigPage, LoadHdl, sfx2::FileDialogHelper*, EMPTYARG )
{
DBG_ASSERT( m_pFileDlg, "SfxInternetPage::DialogClosedHdl(): no file dialog" );
::rtl::OUString sCfgName;
if ( ERRCODE_NONE == m_pFileDlg->GetError() )
sCfgName = m_pFileDlg->GetPath();
if ( !sCfgName.getLength() )
return 0;
GetTabDialog()->EnterWait();
css::uno::Reference< css::frame::XModel > xDoc ;
css::uno::Reference< css::ui::XUIConfigurationManager > xCfgMgr ;
css::uno::Reference< css::embed::XStorage > xRootStorage; // we must hold the root storage alive, if xCfgMgr is used!
try
{
// first check if URL points to a document already loaded
xDoc = SearchForAlreadyLoadedDoc(sCfgName);
if (xDoc.is())
{
// Get ui config manager. There should always be one at the model.
css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > xCfgSupplier(xDoc, css::uno::UNO_QUERY_THROW);
xCfgMgr = xCfgSupplier->getUIConfigurationManager();
}
else
{
// URL doesn't point to a loaded document, try to access it as a single storage
// dont forget to release the storage afterwards!
css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory(m_xSMGR->createInstance(SERVICE_STORAGEFACTORY), css::uno::UNO_QUERY_THROW);
css::uno::Sequence< css::uno::Any > lArgs(2);
lArgs[0] <<= sCfgName;
lArgs[1] <<= css::embed::ElementModes::READ;
xRootStorage = css::uno::Reference< css::embed::XStorage >(xStorageFactory->createInstanceWithArguments(lArgs), css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::embed::XStorage > xUIConfig = xRootStorage->openStorageElement(FOLDERNAME_UICONFIG, css::embed::ElementModes::READ);
if (xUIConfig.is())
{
xCfgMgr = css::uno::Reference< css::ui::XUIConfigurationManager >(m_xSMGR->createInstance(SERVICE_UICONFIGMGR), css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::ui::XUIConfigurationStorage > xCfgMgrStore(xCfgMgr, css::uno::UNO_QUERY_THROW);
xCfgMgrStore->setStorage(xUIConfig);
}
}
if (xCfgMgr.is())
{
// open the configuration and update our UI
css::uno::Reference< css::ui::XAcceleratorConfiguration > xTempAccMgr(xCfgMgr->getShortCutManager(), css::uno::UNO_QUERY_THROW);
aEntriesBox.SetUpdateMode(sal_False);
ResetConfig();
Init(xTempAccMgr);
aEntriesBox.SetUpdateMode(sal_True);
aEntriesBox.Invalidate();
aEntriesBox.Select(aEntriesBox.GetEntry(0, 0));
}
// dont forget to close the new opened storage!
// We are the owner of it.
if (xRootStorage.is())
{
css::uno::Reference< css::lang::XComponent > xComponent;
xComponent = css::uno::Reference< css::lang::XComponent >(xCfgMgr, css::uno::UNO_QUERY);
if (xComponent.is())
xComponent->dispose();
xComponent = css::uno::Reference< css::lang::XComponent >(xRootStorage, css::uno::UNO_QUERY);
if (xComponent.is())
xComponent->dispose();
}
}
catch(const css::uno::RuntimeException& exRun)
{ throw exRun; }
catch(const css::uno::Exception&)
{}
GetTabDialog()->LeaveWait();
return 0;
}
//-----------------------------------------------
IMPL_LINK( SfxAcceleratorConfigPage, SaveHdl, sfx2::FileDialogHelper*, EMPTYARG )
{
DBG_ASSERT( m_pFileDlg, "SfxInternetPage::DialogClosedHdl(): no file dialog" );
::rtl::OUString sCfgName;
if ( ERRCODE_NONE == m_pFileDlg->GetError() )
sCfgName = m_pFileDlg->GetPath();
if ( !sCfgName.getLength() )
return 0;
GetTabDialog()->EnterWait();
css::uno::Reference< css::frame::XModel > xDoc ;
css::uno::Reference< css::ui::XUIConfigurationManager > xCfgMgr ;
css::uno::Reference< css::embed::XStorage > xRootStorage;
try
{
// first check if URL points to a document already loaded
xDoc = SearchForAlreadyLoadedDoc(sCfgName);
if (xDoc.is())
{
// get config manager, force creation if there was none before
css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > xCfgSupplier(xDoc, css::uno::UNO_QUERY_THROW);
xCfgMgr = xCfgSupplier->getUIConfigurationManager();
}
else
{
// URL doesn't point to a loaded document, try to access it as a single storage
css::uno::Reference< css::lang::XSingleServiceFactory > xStorageFactory(m_xSMGR->createInstance(SERVICE_STORAGEFACTORY), css::uno::UNO_QUERY_THROW);
css::uno::Sequence< css::uno::Any > lArgs(2);
lArgs[0] <<= sCfgName;
lArgs[1] <<= css::embed::ElementModes::WRITE;
xRootStorage = css::uno::Reference< css::embed::XStorage >(
xStorageFactory->createInstanceWithArguments(lArgs),
css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::embed::XStorage > xUIConfig(
xRootStorage->openStorageElement(FOLDERNAME_UICONFIG, css::embed::ElementModes::WRITE),
css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::beans::XPropertySet > xUIConfigProps(
xUIConfig,
css::uno::UNO_QUERY_THROW);
// set the correct media type if the storage was new created
::rtl::OUString sMediaType;
xUIConfigProps->getPropertyValue(MEDIATYPE_PROPNAME) >>= sMediaType;
if (!sMediaType.getLength())
xUIConfigProps->setPropertyValue(MEDIATYPE_PROPNAME, css::uno::makeAny(MEDIATYPE_UICONFIG));
xCfgMgr = css::uno::Reference< css::ui::XUIConfigurationManager >(m_xSMGR->createInstance(SERVICE_UICONFIGMGR), css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::ui::XUIConfigurationStorage > xUICfgStore(xCfgMgr, css::uno::UNO_QUERY_THROW);
xUICfgStore->setStorage(xUIConfig);
}
if (xCfgMgr.is())
{
// get the target configuration access and update with all shortcuts
// which are set currently at the UI !
// Dont copy the m_xAct content to it ... because m_xAct will be updated
// from the UI on pressing the button "OK" only. And inbetween it's not up to date !
css::uno::Reference< css::ui::XAcceleratorConfiguration > xTargetAccMgr(xCfgMgr->getShortCutManager(), css::uno::UNO_QUERY_THROW);
Apply(xTargetAccMgr);
// commit (order is important!)
css::uno::Reference< css::ui::XUIConfigurationPersistence > xCommit1(xTargetAccMgr, css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::ui::XUIConfigurationPersistence > xCommit2(xCfgMgr , css::uno::UNO_QUERY_THROW);
xCommit1->store();
xCommit2->store();
if (xRootStorage.is())
{
// Commit root storage
css::uno::Reference< css::embed::XTransactedObject > xCommit3(xRootStorage, css::uno::UNO_QUERY_THROW);
xCommit3->commit();
}
}
if (xRootStorage.is())
{
css::uno::Reference< css::lang::XComponent > xComponent;
xComponent = css::uno::Reference< css::lang::XComponent >(xCfgMgr, css::uno::UNO_QUERY);
if (xComponent.is())
xComponent->dispose();
xComponent = css::uno::Reference< css::lang::XComponent >(xRootStorage, css::uno::UNO_QUERY);
if (xComponent.is())
xComponent->dispose();
}
}
catch(const css::uno::RuntimeException& exRun)
{ throw exRun; }
catch(const css::uno::Exception&)
{}
GetTabDialog()->LeaveWait();
return 0;
}
//-----------------------------------------------
void SfxAcceleratorConfigPage::StartFileDialog( WinBits nBits, const String& rTitle )
{
bool bSave = ( ( nBits & WB_SAVEAS ) == WB_SAVEAS );
short nDialogType = bSave ? css::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE
: css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE;
if ( m_pFileDlg )
delete m_pFileDlg;
m_pFileDlg = new sfx2::FileDialogHelper( nDialogType, 0 );
m_pFileDlg->SetTitle( rTitle );
m_pFileDlg->AddFilter( aFilterAllStr, DEFINE_CONST_UNICODE( FILEDIALOG_FILTER_ALL ) );
m_pFileDlg->AddFilter( aFilterCfgStr, DEFINE_CONST_UNICODE( "*.cfg" ) );
Link aDlgClosedLink = bSave ? LINK( this, SfxAcceleratorConfigPage, SaveHdl )
: LINK( this, SfxAcceleratorConfigPage, LoadHdl );
m_pFileDlg->StartExecuteModal( aDlgClosedLink );
}
//-----------------------------------------------
sal_Bool SfxAcceleratorConfigPage::FillItemSet( SfxItemSet& )
{
Apply(m_xAct);
try
{
m_xAct->store();
}
catch(const css::uno::RuntimeException& exRun)
{ throw exRun; }
catch(const css::uno::Exception&)
{ return sal_False; }
return sal_True;
}
//-----------------------------------------------
void SfxAcceleratorConfigPage::Reset( const SfxItemSet& rSet )
{
// open accelerator configs
// Note: It initialize some other members too, which are needed here ...
// e.g. m_sModuleUIName!
InitAccCfg();
// change te description of the radio button, which switch to the module
// dependend accelerator configuration
String sButtonText = aModuleButton.GetText();
sButtonText.SearchAndReplace(String::CreateFromAscii("$(MODULE)"), m_sModuleUIName);
aModuleButton.SetText(sButtonText);
if (m_xModule.is())
aModuleButton.Check();
else
{
aModuleButton.Hide();
aOfficeButton.Check();
}
RadioHdl(0);
const SfxPoolItem* pMacroItem=0;
if( SFX_ITEM_SET == rSet.GetItemState( SID_MACROINFO, sal_True, &pMacroItem ) )
{
m_pMacroInfoItem = PTR_CAST( SfxMacroInfoItem, pMacroItem );
pGroupLBox->SelectMacro( m_pMacroInfoItem );
}
else
{
const SfxPoolItem* pStringItem=0;
if( SFX_ITEM_SET == rSet.GetItemState( SID_CHARMAP, sal_True, &pStringItem ) )
m_pStringItem = PTR_CAST( SfxStringItem, pStringItem );
const SfxPoolItem* pFontItem=0;
if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_SPECIALCHAR, sal_True, &pFontItem ) )
m_pFontItem = PTR_CAST( SfxStringItem, pFontItem );
}
}
//-----------------------------------------------
sal_uInt16 SfxAcceleratorConfigPage::MapKeyCodeToPos(const KeyCode& aKey) const
{
sal_uInt16 nCode1 = aKey.GetCode()+aKey.GetModifier();
SvLBoxEntry* pEntry = aEntriesBox.First();
sal_uInt16 i = 0;
while (pEntry)
{
TAccInfo* pUserData = (TAccInfo*)pEntry->GetUserData();
if (pUserData)
{
sal_uInt16 nCode2 = pUserData->m_aKey.GetCode()+pUserData->m_aKey.GetModifier();
if (nCode1 == nCode2)
return i;
}
pEntry = aEntriesBox.Next(pEntry);
++i;
}
return LISTBOX_ENTRY_NOTFOUND;
}
//-----------------------------------------------
String SfxAcceleratorConfigPage::GetLabel4Command(const String& sCommand)
{
try
{
// check global command configuration first
css::uno::Reference< css::container::XNameAccess > xModuleConf;
m_xUICmdDescription->getByName(m_sModuleLongName) >>= xModuleConf;
if (xModuleConf.is())
{
::comphelper::SequenceAsHashMap lProps(xModuleConf->getByName(sCommand));
String sLabel = String(lProps.getUnpackedValueOrDefault(CMDPROP_UINAME, ::rtl::OUString()));
if (sLabel.Len())
return sLabel;
}
}
catch(const css::uno::RuntimeException& exRun)
{ throw exRun; }
catch(const css::uno::Exception&)
{}
// may be it's a style URL .. they must be handled special
SfxStyleInfo_Impl aStyle;
aStyle.sCommand = sCommand;
if (m_aStylesInfo.parseStyleCommand(aStyle))
{
m_aStylesInfo.getLabel4Style(aStyle);
return aStyle.sLabel;
}
else
{
String aRet( String::CreateFromAscii("Symbols: ") );
xub_StrLen nPos = sCommand.SearchAscii(".uno:InsertSymbol?Symbols:string=");
if ( nPos == 0 )
{
aRet += String( sCommand, 34, sCommand.Len()-34 );
return aRet;
}
}
return sCommand;
}
SfxTabPage* SfxAcceleratorConfigPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
{
return new SfxAcceleratorConfigPage( pParent, rAttrSet );
}
//-----------------------------------------------
css::uno::Reference< css::frame::XModel > SfxAcceleratorConfigPage::SearchForAlreadyLoadedDoc(const String& /*sName*/)
{
return css::uno::Reference< css::frame::XModel >();
}
SvxShortcutAssignDlg::SvxShortcutAssignDlg( Window* pParent, const uno::Reference< frame::XFrame >& rxDocumentFrame, const SfxItemSet& rSet )
: SfxSingleTabDialog( pParent, rSet, 0 )
{
SfxTabPage* pPage = SfxAcceleratorConfigPage::Create( this, rSet );
pPage->SetFrame( rxDocumentFrame );
SetTabPage( pPage );
}
SvxShortcutAssignDlg::~SvxShortcutAssignDlg()
{
}
// .uno:InsertSymbol?Symbols:string=bla
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */