summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/inc/xml/acceleratorconfigurationreader.hxx10
-rw-r--r--framework/inc/xml/acceleratorconfigurationwriter.hxx11
-rw-r--r--framework/source/accelerators/acceleratorconfiguration.cxx14
-rw-r--r--framework/source/accelerators/keymapping.cxx11
-rw-r--r--framework/source/inc/accelerators/acceleratorconfiguration.hxx4
-rw-r--r--framework/source/inc/accelerators/keymapping.hxx3
-rw-r--r--framework/source/xml/acceleratorconfigurationreader.cxx5
-rw-r--r--framework/source/xml/acceleratorconfigurationwriter.cxx5
8 files changed, 26 insertions, 37 deletions
diff --git a/framework/inc/xml/acceleratorconfigurationreader.hxx b/framework/inc/xml/acceleratorconfigurationreader.hxx
index 6dc343d3662b..90365e5de9e6 100644
--- a/framework/inc/xml/acceleratorconfigurationreader.hxx
+++ b/framework/inc/xml/acceleratorconfigurationreader.hxx
@@ -23,7 +23,6 @@
#include <xml/saxnamespacefilter.hxx> // HACK: needed for MSVC 2013 ENABLE_LTO build: WeakImplHelper<XDocumentHandler>
#include <accelerators/acceleratorcache.hxx>
-#include <accelerators/keymapping.hxx>
#include <macros/xinterface.hxx>
#include <general.h>
@@ -31,7 +30,6 @@
#include <com/sun/star/xml/sax/XLocator.hpp>
-#include <salhelper/singletonref.hxx>
#include <cppuhelper/implbase.hxx>
#include <rtl/ustring.hxx>
@@ -85,14 +83,6 @@ class AcceleratorConfigurationReader : public ::cppu::WeakImplHelper< css::xml::
occurs recursive inside xml. */
bool m_bInsideAcceleratorItem;
- /** @short is used to map key codes to its
- string representation.
-
- @descr To perform this operation is
- created only one time and kept
- alive forever ...*/
- ::salhelper::SingletonRef< KeyMapping > m_rKeyMapping;
-
/** @short provide information about the parsing state.
@descr We use it to find out the line and column, where
diff --git a/framework/inc/xml/acceleratorconfigurationwriter.hxx b/framework/inc/xml/acceleratorconfigurationwriter.hxx
index d46b2e93ff6a..e71c8893acf9 100644
--- a/framework/inc/xml/acceleratorconfigurationwriter.hxx
+++ b/framework/inc/xml/acceleratorconfigurationwriter.hxx
@@ -21,12 +21,9 @@
#define INCLUDED_FRAMEWORK_INC_XML_ACCELERATORCONFIGURATIONWRITER_HXX
#include <accelerators/acceleratorcache.hxx>
-#include <accelerators/keymapping.hxx>
#include <general.h>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-
-#include <salhelper/singletonref.hxx>
#include <rtl/ustring.hxx>
namespace framework{
@@ -45,14 +42,6 @@ class AcceleratorConfigurationWriter
writer must work on. */
const AcceleratorCache& m_rContainer;
- /** @short is used to map key codes to its
- string representation.
-
- @descr To perform this operation is
- created only one times and holded
- alive forever ...*/
- ::salhelper::SingletonRef< KeyMapping > m_rKeyMapping;
-
// interface
public:
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index 3fb8331768ef..586011adc04b 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -18,7 +18,7 @@
*/
#include <accelerators/acceleratorconfiguration.hxx>
-
+#include <accelerators/keymapping.hxx>
#include <accelerators/presethandler.hxx>
#include <xml/saxnamespacefilter.hxx>
@@ -57,10 +57,10 @@ namespace framework
const char CFG_ENTRY_SECONDARY[] = "SecondaryKeys";
const char CFG_PROP_COMMAND[] = "Command";
- OUString lcl_getKeyString(salhelper::SingletonRef<framework::KeyMapping>& _rKeyMapping, const css::awt::KeyEvent& aKeyEvent)
+ OUString lcl_getKeyString(const css::awt::KeyEvent& aKeyEvent)
{
const sal_Int32 nBeginIndex = 4; // "KEY_" is the prefix of a identifier...
- OUStringBuffer sKeyBuffer((_rKeyMapping->mapCodeToIdentifier(aKeyEvent.KeyCode)).copy(nBeginIndex));
+ OUStringBuffer sKeyBuffer((KeyMapping::get().mapCodeToIdentifier(aKeyEvent.KeyCode)).copy(nBeginIndex));
if ( (aKeyEvent.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT )
sKeyBuffer.append("_SHIFT");
@@ -1135,7 +1135,7 @@ void XCUBasedAcceleratorConfiguration::impl_ts_load( bool bPreferred, const css:
sal_Int32 nIndex = 0;
OUString sKeyCommand = sKey.getToken(0, '_', nIndex);
OUString sPrefix("KEY_");
- aKeyEvent.KeyCode = m_rKeyMapping->mapIdentifierToCode(sPrefix + sKeyCommand);
+ aKeyEvent.KeyCode = KeyMapping::get().mapIdentifierToCode(sPrefix + sKeyCommand);
css::uno::Sequence< OUString > sToken(4);
const sal_Int32 nToken = 4;
@@ -1289,7 +1289,7 @@ void XCUBasedAcceleratorConfiguration::insertKeyToConfiguration( const css::awt:
xModules->getByName(m_sModuleCFG) >>= xContainer;
}
- const OUString sKey = lcl_getKeyString(m_rKeyMapping,aKeyEvent);
+ const OUString sKey = lcl_getKeyString(aKeyEvent);
css::uno::Reference< css::container::XNameAccess > xKey;
css::uno::Reference< css::container::XNameContainer > xCommand;
if ( !xContainer->hasByName(sKey) )
@@ -1329,7 +1329,7 @@ void XCUBasedAcceleratorConfiguration::removeKeyFromConfiguration( const css::aw
xModules->getByName(m_sModuleCFG) >>= xContainer;
}
- const OUString sKey = lcl_getKeyString(m_rKeyMapping,aKeyEvent);
+ const OUString sKey = lcl_getKeyString(aKeyEvent);
xContainer->removeByName(sKey);
}
@@ -1355,7 +1355,7 @@ void XCUBasedAcceleratorConfiguration::reloadChanged( const OUString& sPrimarySe
sal_Int32 nIndex = 0;
sKeyIdentifier = sKey.getToken(0, '_', nIndex);
- aKeyEvent.KeyCode = m_rKeyMapping->mapIdentifierToCode("KEY_"+sKeyIdentifier);
+ aKeyEvent.KeyCode = KeyMapping::get().mapIdentifierToCode("KEY_"+sKeyIdentifier);
css::uno::Sequence< OUString > sToken(3);
const sal_Int32 nToken = 3;
diff --git a/framework/source/accelerators/keymapping.cxx b/framework/source/accelerators/keymapping.cxx
index ec02c32e1a1b..02a0278b654f 100644
--- a/framework/source/accelerators/keymapping.cxx
+++ b/framework/source/accelerators/keymapping.cxx
@@ -20,6 +20,7 @@
#include <accelerators/keymapping.hxx>
#include <com/sun/star/awt/Key.hpp>
+#include <rtl/instance.hxx>
namespace framework
{
@@ -152,8 +153,14 @@ KeyMapping::KeyMapping()
}
}
-KeyMapping::~KeyMapping()
-{
+namespace {
+
+struct Instance: public rtl::Static<KeyMapping, Instance> {};
+
+}
+
+KeyMapping & KeyMapping::get() {
+ return Instance::get();
}
sal_uInt16 KeyMapping::mapIdentifierToCode(const OUString& sIdentifier)
diff --git a/framework/source/inc/accelerators/acceleratorconfiguration.hxx b/framework/source/inc/accelerators/acceleratorconfiguration.hxx
index be267721a675..e0d875590305 100644
--- a/framework/source/inc/accelerators/acceleratorconfiguration.hxx
+++ b/framework/source/inc/accelerators/acceleratorconfiguration.hxx
@@ -22,7 +22,6 @@
#include <accelerators/presethandler.hxx>
#include <accelerators/acceleratorcache.hxx>
-#include <accelerators/keymapping.hxx>
#include <macros/xinterface.hxx>
#include <macros/xtypeprovider.hxx>
#include <general.h>
@@ -46,7 +45,6 @@
#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/implbase.hxx>
-#include <salhelper/singletonref.hxx>
// definition
@@ -257,8 +255,6 @@ class XCUBasedAcceleratorConfiguration : public ::cppu::WeakImplHelper<
OUString m_sGlobalOrModules;
OUString m_sModuleCFG;
- ::salhelper::SingletonRef< KeyMapping > m_rKeyMapping;
-
// native interface!
public:
diff --git a/framework/source/inc/accelerators/keymapping.hxx b/framework/source/inc/accelerators/keymapping.hxx
index dfdd327caa91..3b6b7a25bebf 100644
--- a/framework/source/inc/accelerators/keymapping.hxx
+++ b/framework/source/inc/accelerators/keymapping.hxx
@@ -77,7 +77,8 @@ class KeyMapping
public:
KeyMapping();
- virtual ~KeyMapping();
+
+ static KeyMapping & get();
/** @short return a suitable key code
for the specified key identifier.
diff --git a/framework/source/xml/acceleratorconfigurationreader.cxx b/framework/source/xml/acceleratorconfigurationreader.cxx
index 000e831d6045..bb282d0059d5 100644
--- a/framework/source/xml/acceleratorconfigurationreader.cxx
+++ b/framework/source/xml/acceleratorconfigurationreader.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <accelerators/keymapping.hxx>
#include <xml/acceleratorconfigurationreader.hxx>
#include <acceleratorconst.h>
@@ -121,7 +124,7 @@ void SAL_CALL AcceleratorConfigurationReader::startElement(const OUString&
break;
case E_ATTRIBUTE_KEYCODE :
- aEvent.KeyCode = m_rKeyMapping->mapIdentifierToCode(sValue);
+ aEvent.KeyCode = KeyMapping::get().mapIdentifierToCode(sValue);
break;
case E_ATTRIBUTE_MOD_SHIFT :
diff --git a/framework/source/xml/acceleratorconfigurationwriter.cxx b/framework/source/xml/acceleratorconfigurationwriter.cxx
index 07c0a123bd26..181acec82b64 100644
--- a/framework/source/xml/acceleratorconfigurationwriter.cxx
+++ b/framework/source/xml/acceleratorconfigurationwriter.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <accelerators/keymapping.hxx>
#include <xml/acceleratorconfigurationwriter.hxx>
#include <acceleratorconst.h>
@@ -94,7 +97,7 @@ void AcceleratorConfigurationWriter::impl_ts_writeKeyCommandPair(const css::awt:
::comphelper::AttributeList* pAttribs = new ::comphelper::AttributeList;
css::uno::Reference< css::xml::sax::XAttributeList > xAttribs (static_cast< css::xml::sax::XAttributeList* >(pAttribs) , css::uno::UNO_QUERY_THROW);
- OUString sKey = m_rKeyMapping->mapCodeToIdentifier(aKey.KeyCode);
+ OUString sKey = KeyMapping::get().mapCodeToIdentifier(aKey.KeyCode);
// TODO check if key is empty!
pAttribs->AddAttribute(AL_ATTRIBUTE_KEYCODE, ATTRIBUTE_TYPE_CDATA, sKey );