From 27415fd0dc397360ceb21aa678b808611d73fc94 Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Tue, 21 Oct 2014 14:45:16 +0200 Subject: Kill some static OUStrings. Change-Id: Ic06a3b4673446bbadd21f2380c04ec628a6f86a9 --- .../accelerators/acceleratorconfiguration.cxx | 15 ++++++----- .../documentacceleratorconfiguration.cxx | 4 ++- framework/source/accelerators/presethandler.cxx | 30 ---------------------- .../source/inc/accelerators/presethandler.hxx | 13 ---------- .../moduleuiconfigurationmanager.cxx | 10 +++++--- 5 files changed, 19 insertions(+), 53 deletions(-) (limited to 'framework') diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index 2284d1673898..be5799d18c6f 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -48,6 +48,9 @@ #include #include +#define PRESET_DEFAULT "default" +#define TARGET_CURRENT "current" + namespace framework { const char CFG_ENTRY_SECONDARY[] = "SecondaryKeys"; @@ -228,10 +231,10 @@ void SAL_CALL XMLBasedAcceleratorConfiguration::reload() css::uno::Reference< css::io::XStream > xStreamNoLang; { SolarMutexGuard g; - xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), true); // sal_True => open or create! + xStream = m_aPresetHandler.openTarget(TARGET_CURRENT, true); // sal_True => open or create! try { - xStreamNoLang = m_aPresetHandler.openPreset(PresetHandler::PRESET_DEFAULT(), true); + xStreamNoLang = m_aPresetHandler.openPreset(PRESET_DEFAULT, true); } catch(const css::io::IOException&) {} // does not have to exist } @@ -269,7 +272,7 @@ void SAL_CALL XMLBasedAcceleratorConfiguration::store() css::uno::Reference< css::io::XStream > xStream; { SolarMutexGuard g; - xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), true); // sal_True => open or create! + xStream = m_aPresetHandler.openTarget(TARGET_CURRENT, true); // sal_True => open or create! } css::uno::Reference< css::io::XOutputStream > xOut; @@ -295,7 +298,7 @@ void SAL_CALL XMLBasedAcceleratorConfiguration::storeToStorage(const css::uno::R { css::uno::Reference< css::io::XStream > xStream = StorageHolder::openSubStreamWithFallback( xStorage, - PresetHandler::TARGET_CURRENT(), + TARGET_CURRENT, css::embed::ElementModes::READWRITE, false); // False => no fallback from read/write to readonly! css::uno::Reference< css::io::XOutputStream > xOut; @@ -325,7 +328,7 @@ sal_Bool SAL_CALL XMLBasedAcceleratorConfiguration::isReadOnly() css::uno::Reference< css::io::XStream > xStream; { SolarMutexGuard g; - xStream = m_aPresetHandler.openTarget(PresetHandler::TARGET_CURRENT(), true); // sal_True => open or create! + xStream = m_aPresetHandler.openTarget(TARGET_CURRENT, true); // sal_True => open or create! } css::uno::Reference< css::io::XOutputStream > xOut; @@ -364,7 +367,7 @@ throw(css::uno::RuntimeException, std::exception) { { SolarMutexGuard g; - m_aPresetHandler.copyPresetToTarget(PresetHandler::PRESET_DEFAULT(), PresetHandler::TARGET_CURRENT()); + m_aPresetHandler.copyPresetToTarget(PRESET_DEFAULT, TARGET_CURRENT); } reload(); diff --git a/framework/source/accelerators/documentacceleratorconfiguration.cxx b/framework/source/accelerators/documentacceleratorconfiguration.cxx index d0564c5a625e..e99c20baa4ef 100644 --- a/framework/source/accelerators/documentacceleratorconfiguration.cxx +++ b/framework/source/accelerators/documentacceleratorconfiguration.cxx @@ -39,6 +39,8 @@ using namespace framework; +#define RESOURCETYPE_ACCELERATOR "accelerator" + namespace { /** @@ -189,7 +191,7 @@ void DocumentAcceleratorConfiguration::fillCache() // open the folder, where the configuration exists m_aPresetHandler.connectToResource( PresetHandler::E_DOCUMENT, - PresetHandler::RESOURCETYPE_ACCELERATOR(), + RESOURCETYPE_ACCELERATOR, OUString(), xDocumentRoot, aLanguageTag); diff --git a/framework/source/accelerators/presethandler.cxx b/framework/source/accelerators/presethandler.cxx index 0a200e3571aa..6396ecf3d671 100644 --- a/framework/source/accelerators/presethandler.cxx +++ b/framework/source/accelerators/presethandler.cxx @@ -46,36 +46,6 @@ static const ::sal_Int32 ID_CORRUPT_UICONFIG_GENERAL = 3; namespace framework { -OUString PresetHandler::PRESET_DEFAULT() -{ - return OUString("default"); -} - -OUString PresetHandler::TARGET_CURRENT() -{ - return OUString("current"); -} - -OUString PresetHandler::RESOURCETYPE_MENUBAR() -{ - return OUString("menubar"); -} - -OUString PresetHandler::RESOURCETYPE_TOOLBAR() -{ - return OUString("toolbar"); -} - -OUString PresetHandler::RESOURCETYPE_ACCELERATOR() -{ - return OUString("accelerator"); -} - -OUString PresetHandler::RESOURCETYPE_STATUSBAR() -{ - return OUString("statusbar"); -} - PresetHandler::PresetHandler(const css::uno::Reference< css::uno::XComponentContext >& xContext) : m_xContext(xContext) , m_eConfigType(E_GLOBAL) diff --git a/framework/source/inc/accelerators/presethandler.hxx b/framework/source/inc/accelerators/presethandler.hxx index f34be57f2569..a692f4d4241c 100644 --- a/framework/source/inc/accelerators/presethandler.hxx +++ b/framework/source/inc/accelerators/presethandler.hxx @@ -51,19 +51,6 @@ namespace framework */ class PresetHandler { - - public: - - static OUString PRESET_DEFAULT(); - static OUString TARGET_CURRENT(); - - static OUString RESOURCETYPE_MENUBAR(); - static OUString RESOURCETYPE_TOOLBAR(); - static OUString RESOURCETYPE_ACCELERATOR(); - static OUString RESOURCETYPE_STATUSBAR(); - - // types - public: /** @short this handler can provide different diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 30ace311deb3..fb7f85867133 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -61,6 +61,10 @@ using namespace com::sun::star::container; using namespace com::sun::star::beans; using namespace framework; +#define RESOURCETYPE_MENUBAR "menubar" +#define RESOURCETYPE_TOOLBAR "toolbar" +#define RESOURCETYPE_STATUSBAR "statusbar" + namespace { class ModuleUIConfigurationManager : public cppu::WeakImplHelper3< @@ -882,11 +886,11 @@ ModuleUIConfigurationManager::ModuleUIConfigurationManager( { OUString aResourceType; if ( i == ::com::sun::star::ui::UIElementType::MENUBAR ) - aResourceType = PresetHandler::RESOURCETYPE_MENUBAR(); + aResourceType = RESOURCETYPE_MENUBAR; else if ( i == ::com::sun::star::ui::UIElementType::TOOLBAR ) - aResourceType = PresetHandler::RESOURCETYPE_TOOLBAR(); + aResourceType = RESOURCETYPE_TOOLBAR; else if ( i == ::com::sun::star::ui::UIElementType::STATUSBAR ) - aResourceType = PresetHandler::RESOURCETYPE_STATUSBAR(); + aResourceType = RESOURCETYPE_STATUSBAR; if ( !aResourceType.isEmpty() ) { -- cgit