From 7f509501e9b042aeae0cdcc8e267550a45ab43c2 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 3 Nov 2016 14:15:50 +0200 Subject: loplugin:oncevar in framework Change-Id: I7528a4afd59a19b069bcad2106ca80f429ef12e0 Reviewed-on: https://gerrit.libreoffice.org/30525 Tested-by: Jenkins Reviewed-by: Noel Grandin --- framework/inc/helper/mischelper.hxx | 4 +- framework/source/fwe/helper/configimporter.cxx | 8 +--- framework/source/fwe/xml/menudocumenthandler.cxx | 9 ++-- framework/source/jobs/jobdata.cxx | 3 +- framework/source/jobs/jobexecutor.cxx | 12 ++--- framework/source/jobs/shelljob.cxx | 25 +++-------- framework/source/layoutmanager/layoutmanager.cxx | 3 +- framework/source/loadenv/loadenv.cxx | 10 ++--- .../source/uiconfiguration/globalsettings.cxx | 17 +++---- .../source/uiconfiguration/imagemanagerimpl.cxx | 4 +- .../moduleuiconfigurationmanager.cxx | 5 +-- .../uiconfiguration/uicategorydescription.cxx | 14 ++---- .../source/uielement/addonstoolbarmanager.cxx | 4 +- .../source/uielement/recentfilesmenucontroller.cxx | 9 +--- framework/source/uielement/statusbarmanager.cxx | 20 +++------ framework/source/uielement/statusbarmerger.cxx | 39 +++++----------- framework/source/uielement/toolbarmanager.cxx | 23 +++------- .../source/uielement/toolbarsmenucontroller.cxx | 24 ++++------ .../source/uielement/uicommanddescription.cxx | 52 +++++++--------------- 19 files changed, 85 insertions(+), 200 deletions(-) (limited to 'framework') diff --git a/framework/inc/helper/mischelper.hxx b/framework/inc/helper/mischelper.hxx index 49fd219ba55d..de7044350b50 100644 --- a/framework/inc/helper/mischelper.hxx +++ b/framework/inc/helper/mischelper.hxx @@ -83,8 +83,8 @@ inline bool IsScriptTypeMatchingToLanguage( SvtScriptType nScriptType, LanguageT inline void RetrieveTypeNameFromResourceURL( const OUString& aResourceURL, OUString& aType, OUString& aName ) { - const sal_Int32 RESOURCEURL_PREFIX_SIZE = 17; - const char RESOURCEURL_PREFIX[] = "private:resource/"; + static const char RESOURCEURL_PREFIX[] = "private:resource/"; + static const sal_Int32 RESOURCEURL_PREFIX_SIZE = strlen(RESOURCEURL_PREFIX); if (( aResourceURL.startsWith( RESOURCEURL_PREFIX ) ) && ( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE )) diff --git a/framework/source/fwe/helper/configimporter.cxx b/framework/source/fwe/helper/configimporter.cxx index 27c98497550a..48eee08384c2 100644 --- a/framework/source/fwe/helper/configimporter.cxx +++ b/framework/source/fwe/helper/configimporter.cxx @@ -34,8 +34,6 @@ bool UIConfigurationImporterOOo1x::ImportCustomToolbars( const uno::Reference< uno::XComponentContext >& rxContext, const uno::Reference< embed::XStorage >& rToolbarStorage ) { - const char USERDEFTOOLBOX[] = "userdeftoolbox0.xml"; - bool bResult ( false ); if ( rToolbarStorage.is() && rContainerFactory.is() ) { @@ -43,11 +41,7 @@ bool UIConfigurationImporterOOo1x::ImportCustomToolbars( { for ( sal_uInt16 i = 1; i <= 4; i++ ) { - OUStringBuffer aCustomTbxName( 20 ); - aCustomTbxName.append( USERDEFTOOLBOX ); - aCustomTbxName[14] = aCustomTbxName[14] + i; - - OUString aTbxStreamName( aCustomTbxName.makeStringAndClear() ); + OUString aTbxStreamName = "userdeftoolbox" + OUString::number(i) + ".xml"; uno::Reference< io::XStream > xStream = rToolbarStorage->openStreamElement( aTbxStreamName, embed::ElementModes::READ ); if ( xStream.is() ) { diff --git a/framework/source/fwe/xml/menudocumenthandler.cxx b/framework/source/fwe/xml/menudocumenthandler.cxx index 8055034ad041..27333374ffb9 100644 --- a/framework/source/fwe/xml/menudocumenthandler.cxx +++ b/framework/source/fwe/xml/menudocumenthandler.cxx @@ -79,10 +79,6 @@ static const char ITEM_DESCRIPTOR_LABEL[] = "Label"; static const char ITEM_DESCRIPTOR_TYPE[] = "Type"; static const char ITEM_DESCRIPTOR_STYLE[] = "Style"; -// special popup menus (filled during runtime) must be saved as an empty popup menu or menuitem!!! -static const char ADDDIRECT_CMD[] = ".uno:AddDirect"; -static const char AUTOPILOTMENU_CMD[] = ".uno:AutoPilotMenu"; - // using namespaces using namespace ::com::sun::star::uno; @@ -819,8 +815,9 @@ throw ( SAXException, RuntimeException ) ExtractMenuParameters( aProps, aCommandURL, aLabel, aHelpURL, xSubMenu, nType, nItemBits ); if ( xSubMenu.is() ) { - if ( aCommandURL == ADDDIRECT_CMD || - aCommandURL == AUTOPILOTMENU_CMD ) + // special popup menus (filled during runtime) must be saved as an empty popup menu or menuitem!!! + if ( aCommandURL == ".uno:AddDirect" || + aCommandURL == ".uno:AutoPilotMenu" ) { WriteMenuItem( aCommandURL, aLabel, aHelpURL, nItemBits ); bSeparator = false; diff --git a/framework/source/jobs/jobdata.cxx b/framework/source/jobs/jobdata.cxx index c1807a4ea47c..662afb01812c 100644 --- a/framework/source/jobs/jobdata.cxx +++ b/framework/source/jobs/jobdata.cxx @@ -451,8 +451,7 @@ bool isEnabled( const OUString& sAdminTime , we have to encode all '?' signs. Otherwhise e.g. "??-" will be translated to "~" ... */ - static const char PATTERN_ISO8601[] = "\?\?\?\?-\?\?-\?\?*"; - WildCard aISOPattern(PATTERN_ISO8601); + WildCard aISOPattern("\?\?\?\?-\?\?-\?\?*"); bool bValidAdmin = aISOPattern.Matches(sAdminTime); bool bValidUser = aISOPattern.Matches(sUserTime ); diff --git a/framework/source/jobs/jobexecutor.cxx b/framework/source/jobs/jobexecutor.cxx index d4394078721f..462f47ca8973 100644 --- a/framework/source/jobs/jobexecutor.cxx +++ b/framework/source/jobs/jobexecutor.cxx @@ -249,10 +249,6 @@ void SAL_CALL JobExecutor::trigger( const OUString& sEvent ) throw(css::uno::Run void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent ) throw(css::uno::RuntimeException, std::exception) { - const char EVENT_ON_NEW[] = "OnNew"; // Doc UI event - const char EVENT_ON_LOAD[] = "OnLoad"; // Doc UI event - const char EVENT_ON_CREATE[] = "OnCreate"; // Doc API event - const char EVENT_ON_LOAD_FINISHED[] = "OnLoadFinished"; // Doc API event OUString EVENT_ON_DOCUMENT_OPENED("onDocumentOpened"); // Job UI event : OnNew or OnLoad OUString EVENT_ON_DOCUMENT_ADDED("onDocumentAdded"); // Job API event : OnCreate or OnLoadFinished @@ -277,8 +273,8 @@ void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent // Special feature: If the events "OnNew" or "OnLoad" occurs - we generate our own event "onDocumentOpened". if ( - (aEvent.EventName == EVENT_ON_NEW) || - (aEvent.EventName == EVENT_ON_LOAD) + (aEvent.EventName == "OnNew") || + (aEvent.EventName == "OnLoad") ) { if (std::find(m_lEvents.begin(), m_lEvents.end(), EVENT_ON_DOCUMENT_OPENED) != m_lEvents.end()) @@ -287,8 +283,8 @@ void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent // Special feature: If the events "OnCreate" or "OnLoadFinished" occurs - we generate our own event "onDocumentAdded". if ( - (aEvent.EventName == EVENT_ON_CREATE) || - (aEvent.EventName == EVENT_ON_LOAD_FINISHED) + (aEvent.EventName == "OnCreate") || + (aEvent.EventName == "OnLoadFinished") ) { if (std::find(m_lEvents.begin(), m_lEvents.end(), EVENT_ON_DOCUMENT_ADDED) != m_lEvents.end()) diff --git a/framework/source/jobs/shelljob.cxx b/framework/source/jobs/shelljob.cxx index a3394e0ce1c9..ebad3a570667 100644 --- a/framework/source/jobs/shelljob.cxx +++ b/framework/source/jobs/shelljob.cxx @@ -39,20 +39,6 @@ namespace framework{ -/** address job configuration inside argument set provided on method execute(). */ -static const char PROP_JOBCONFIG[] = "JobConfig"; - -/** address job configuration property "Command". */ -static const char PROP_COMMAND[] = "Command"; - -/** address job configuration property "Arguments". */ -static const char PROP_ARGUMENTS[] = "Arguments"; - -/** address job configuration property "DeactivateJobIfDone". */ -static const char PROP_DEACTIVATEJOBIFDONE[] = "DeactivateJobIfDone"; - -/** address job configuration property "CheckExitCode". */ -static const char PROP_CHECKEXITCODE[] = "CheckExitCode"; DEFINE_XSERVICEINFO_MULTISERVICE_2(ShellJob , ::cppu::OWeakObject , @@ -84,12 +70,13 @@ css::uno::Any SAL_CALL ShellJob::execute(const css::uno::Sequence< css::beans::N css::uno::RuntimeException, std::exception ) { ::comphelper::SequenceAsHashMap lArgs (lJobArguments); - ::comphelper::SequenceAsHashMap lOwnCfg(lArgs.getUnpackedValueOrDefault(PROP_JOBCONFIG, css::uno::Sequence< css::beans::NamedValue >())); + /** address job configuration inside argument set provided on method execute(). */ + ::comphelper::SequenceAsHashMap lOwnCfg(lArgs.getUnpackedValueOrDefault("JobConfig", css::uno::Sequence< css::beans::NamedValue >())); - const OUString sCommand = lOwnCfg.getUnpackedValueOrDefault(PROP_COMMAND , OUString()); - const css::uno::Sequence< OUString > lCommandArguments = lOwnCfg.getUnpackedValueOrDefault(PROP_ARGUMENTS , css::uno::Sequence< OUString >()); - const bool bDeactivateJobIfDone = lOwnCfg.getUnpackedValueOrDefault(PROP_DEACTIVATEJOBIFDONE , true ); - const bool bCheckExitCode = lOwnCfg.getUnpackedValueOrDefault(PROP_CHECKEXITCODE , true ); + const OUString sCommand = lOwnCfg.getUnpackedValueOrDefault("Command" , OUString()); + const css::uno::Sequence< OUString > lCommandArguments = lOwnCfg.getUnpackedValueOrDefault("Arguments" , css::uno::Sequence< OUString >()); + const bool bDeactivateJobIfDone = lOwnCfg.getUnpackedValueOrDefault("DeactivateJobIfDone" , true ); + const bool bCheckExitCode = lOwnCfg.getUnpackedValueOrDefault("CheckExitCode" , true ); // replace all might existing place holder. OUString sRealCommand = impl_substituteCommandVariables(sCommand); diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 2b011bc6cc41..c43ba899a659 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -92,7 +92,6 @@ using namespace ::com::sun::star::ui; using namespace ::com::sun::star::frame; static const char STATUS_BAR_ALIAS[] = "private:resource/statusbar/statusbar"; -static const char PROGRESS_BAR_ALIAS[] = "private:resource/progressbar/progressbar"; namespace framework { @@ -2493,7 +2492,7 @@ throw (uno::RuntimeException, std::exception) { SolarMutexClearableGuard aReadLock; bool bStatusBarVisible( isElementVisible( STATUS_BAR_ALIAS )); - bool bProgressBarVisible( isElementVisible( PROGRESS_BAR_ALIAS )); + bool bProgressBarVisible( isElementVisible( "private:resource/progressbar/progressbar" )); bool bVisible( m_bVisible ); Reference< XUIElement > xStatusBar( m_aStatusBarElement.m_xUIElement ); Reference< XUIElement > xProgressBar( m_aProgressBarElement.m_xUIElement ); diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 7610c5f54ae3..c225542be62f 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -726,8 +726,6 @@ bool queryOrcusTypeAndFilter(const uno::Sequence&, OUStrin void LoadEnv::impl_detectTypeAndFilter() throw(LoadEnvException, css::uno::RuntimeException, std::exception) { - static const char TYPEPROP_PREFERREDFILTER[] = "PreferredFilter"; - static const char FILTERPROP_FLAGS [] = "Flags"; static sal_Int32 FILTERFLAG_TEMPLATEPATH = 16; // SAFE -> @@ -799,7 +797,7 @@ void LoadEnv::impl_detectTypeAndFilter() try { ::comphelper::SequenceAsHashMap lTypeProps(xTypeCont->getByName(sType)); - sFilter = lTypeProps.getUnpackedValueOrDefault(TYPEPROP_PREFERREDFILTER, OUString()); + sFilter = lTypeProps.getUnpackedValueOrDefault("PreferredFilter", OUString()); if (!sFilter.isEmpty()) { // SAFE -> @@ -828,7 +826,7 @@ void LoadEnv::impl_detectTypeAndFilter() try { ::comphelper::SequenceAsHashMap lFilterProps(xFilterCont->getByName(sFilter)); - sal_Int32 nFlags = lFilterProps.getUnpackedValueOrDefault(FILTERPROP_FLAGS, (sal_Int32)0); + sal_Int32 nFlags = lFilterProps.getUnpackedValueOrDefault("Flags", (sal_Int32)0); bIsOwnTemplate = ((nFlags & FILTERFLAG_TEMPLATEPATH) == FILTERFLAG_TEMPLATEPATH); } catch(const css::container::NoSuchElementException&) @@ -1657,8 +1655,6 @@ void LoadEnv::impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::X void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::awt::XWindow >& xWindow) { - static const char PACKAGE_SETUP_MODULES[] = "/org.openoffice.Setup/Office/Factories"; - // no window -> action not possible if (!xWindow.is()) return; @@ -1720,7 +1716,7 @@ void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::aw // get access to the configuration of this office module css::uno::Reference< css::container::XNameAccess > xModuleCfg(::comphelper::ConfigurationHelper::openConfig( xContext, - PACKAGE_SETUP_MODULES, + "/org.openoffice.Setup/Office/Factories", ::comphelper::EConfigurationModes::ReadOnly), css::uno::UNO_QUERY_THROW); diff --git a/framework/source/uiconfiguration/globalsettings.cxx b/framework/source/uiconfiguration/globalsettings.cxx index aa8a15af8a09..8701c83c8a02 100644 --- a/framework/source/uiconfiguration/globalsettings.cxx +++ b/framework/source/uiconfiguration/globalsettings.cxx @@ -39,13 +39,6 @@ using namespace ::com::sun::star; // Namespace -static const char GLOBALSETTINGS_ROOT_ACCESS[] = "/org.openoffice.Office.UI.GlobalSettings/Toolbars"; - -static const char GLOBALSETTINGS_NODEREF_STATES[] = "States"; -static const char GLOBALSETTINGS_PROPERTY_LOCKED[] = "Locked"; -static const char GLOBALSETTINGS_PROPERTY_DOCKED[] = "Docked"; -static const char GLOBALSETTINGS_PROPERTY_STATESENABLED[] = "StatesEnabled"; - namespace framework { @@ -88,10 +81,10 @@ class GlobalSettings_Access : public ::cppu::WeakImplHelper< GlobalSettings_Access::GlobalSettings_Access( const css::uno::Reference< css::uno::XComponentContext >& rxContext ) : m_bDisposed( false ), m_bConfigRead( false ), - m_aNodeRefStates( GLOBALSETTINGS_NODEREF_STATES ), - m_aPropStatesEnabled( GLOBALSETTINGS_PROPERTY_STATESENABLED ), - m_aPropLocked( GLOBALSETTINGS_PROPERTY_LOCKED ), - m_aPropDocked( GLOBALSETTINGS_PROPERTY_DOCKED ), + m_aNodeRefStates( "States" ), + m_aPropStatesEnabled( "StatesEnabled" ), + m_aPropLocked( "Locked" ), + m_aPropDocked( "Docked" ), m_xContext( rxContext ) { } @@ -225,7 +218,7 @@ void GlobalSettings_Access::impl_initConfigAccess() css::configuration::theDefaultProvider::get( m_xContext ); aPropValue.Name = "nodepath"; - aPropValue.Value = css::uno::makeAny( OUString( GLOBALSETTINGS_ROOT_ACCESS )); + aPropValue.Value = css::uno::makeAny(OUString("/org.openoffice.Office.UI.GlobalSettings/Toolbars")); aArgs[0] = css::uno::makeAny( aPropValue ); aPropValue.Name = "lazywrite"; aPropValue.Value = css::uno::makeAny( true ); diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx index bde487dfea39..b2bae3fad4ae 100644 --- a/framework/source/uiconfiguration/imagemanagerimpl.cxx +++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx @@ -69,8 +69,6 @@ const sal_Int16 MAX_IMAGETYPE_VALUE = css::ui::ImageType::SIZE_32; static const char IMAGE_FOLDER[] = "images"; static const char BITMAPS_FOLDER[] = "Bitmaps"; -static const char ModuleImageList[] = "private:resource/images/moduleimages"; - static const o3tl::enumarray IMAGELIST_XML_FILE = { "sc_imagelist.xml", @@ -513,7 +511,7 @@ ImageManagerImpl::ImageManagerImpl( const uno::Reference< uno::XComponentContext m_xContext( rxContext ) , m_pOwner(pOwner) , m_pDefaultImageList( nullptr ) - , m_aResourceString( ModuleImageList ) + , m_aResourceString( "private:resource/images/moduleimages" ) , m_aListenerContainer( m_mutex ) , m_bUseGlobal(_bUseGlobal) , m_bReadOnly( true ) diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 610eed6be2a1..5b57820985e4 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -233,8 +233,7 @@ static const char* UIELEMENTTYPENAMES[] = }; static const char RESOURCEURL_PREFIX[] = "private:resource/"; -static const sal_Int32 RESOURCEURL_PREFIX_SIZE = 17; -static const char RESOURCEURL_CUSTOM_ELEMENT[] = "custom_"; +static const sal_Int32 RESOURCEURL_PREFIX_SIZE = strlen(RESOURCEURL_PREFIX); sal_Int16 RetrieveTypeFromResourceURL( const OUString& aResourceURL ) { @@ -280,7 +279,7 @@ void ModuleUIConfigurationManager::impl_fillSequenceWithElementTypeInfo( UIEleme UIElementDataHashMap& rUserElements = m_aUIElements[LAYER_USERDEFINED][nElementType].aElementsHashMap; UIElementDataHashMap::const_iterator pUserIter = rUserElements.begin(); - OUString aCustomUrlPrefix( RESOURCEURL_CUSTOM_ELEMENT ); + OUString aCustomUrlPrefix( "custom_" ); while ( pUserIter != rUserElements.end() ) { sal_Int32 nIndex = pUserIter->second.aResourceURL.indexOf( aCustomUrlPrefix, RESOURCEURL_PREFIX_SIZE ); diff --git a/framework/source/uiconfiguration/uicategorydescription.cxx b/framework/source/uiconfiguration/uicategorydescription.cxx index 3d9476bfc724..7b6109a4d566 100644 --- a/framework/source/uiconfiguration/uicategorydescription.cxx +++ b/framework/source/uiconfiguration/uicategorydescription.cxx @@ -51,11 +51,6 @@ using namespace framework; namespace { -static const char GENERIC_MODULE_NAME[] = "generic"; -static const char CONFIGURATION_ROOT_ACCESS[] = "/org.openoffice.Office.UI."; -static const char CONFIGURATION_CATEGORY_ELEMENT_ACCESS[] = "/Commands/Categories"; -static const char CONFIGURATION_PROPERTY_NAME[] = "Name"; - class ConfigurationAccess_UICategory : public ::cppu::WeakImplHelper { osl::Mutex aMutex; @@ -115,15 +110,14 @@ class ConfigurationAccess_UICategory : public ::cppu::WeakImplHelper& rGenericUICategories, const Reference< XComponentContext >& rxContext ) : - m_aConfigCategoryAccess( CONFIGURATION_ROOT_ACCESS ), - m_aPropUIName( CONFIGURATION_PROPERTY_NAME ), + m_aConfigCategoryAccess( "/org.openoffice.Office.UI." ), + m_aPropUIName( "Name" ), m_xGenericUICategories( rGenericUICategories ), m_bConfigAccessInitialized( false ), m_bCacheFilled( false ) { // Create configuration hierarchical access name - m_aConfigCategoryAccess += aModuleName - + CONFIGURATION_CATEGORY_ELEMENT_ACCESS; + m_aConfigCategoryAccess += aModuleName + "/Commands/Categories"; m_xConfigProvider = theDefaultProvider::get( rxContext ); } @@ -404,7 +398,7 @@ UICategoryDescription::UICategoryDescription( const Reference< XComponentContext // insert generic categories mappings m_aModuleToCommandFileMap.insert( ModuleToCommandFileMap::value_type( - OUString(GENERIC_MODULE_NAME ), aGenericCategories )); + OUString("generic"), aGenericCategories )); UICommandsHashMap::iterator pCatIter = m_aUICommandsHashMap.find( aGenericCategories ); if ( pCatIter != m_aUICommandsHashMap.end() ) diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxx index cdca410d7406..5e9a5368bf4d 100644 --- a/framework/source/uielement/addonstoolbarmanager.cxx +++ b/framework/source/uielement/addonstoolbarmanager.cxx @@ -72,8 +72,6 @@ using namespace ::com::sun::star::ui; namespace framework { -static const char TOOLBOXITEM_SEPARATOR_STR[] = "private:separator"; - AddonsToolBarManager::AddonsToolBarManager( const Reference< XComponentContext >& rxContext, const Reference< XFrame >& rFrame, const OUString& rResourceName, @@ -240,7 +238,7 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue if ( IsCorrectContext( aModuleIdentifier, aContext )) { - if ( aURL == TOOLBOXITEM_SEPARATOR_STR ) + if ( aURL == "private:separator" ) // toolbox item separator { sal_uInt16 nCount = m_pToolBar->GetItemCount(); if ( nCount > 0 && ( m_pToolBar->GetItemType( nCount-1 ) != ToolBoxItemType::SEPARATOR ) && nElements > 0 ) diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx index 5873b4a0164f..2786f3c3ac88 100644 --- a/framework/source/uielement/recentfilesmenucontroller.cxx +++ b/framework/source/uielement/recentfilesmenucontroller.cxx @@ -46,8 +46,6 @@ namespace { static const char CMD_CLEAR_LIST[] = ".uno:ClearRecentFileList"; static const char CMD_OPEN_AS_TEMPLATE[] = ".uno:OpenTemplate"; static const char CMD_OPEN_REMOTE[] = ".uno:OpenRemote"; -static const char CMD_PREFIX[] = "vnd.sun.star.popup:RecentFileList?entry="; -static const char MENU_SHORTCUT[] = "~N. "; struct LoadRecentFile { @@ -192,7 +190,7 @@ void RecentFilesMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > aMenuShortCut.append( "1~0. " ); else { - aMenuShortCut.append( MENU_SHORTCUT ); + aMenuShortCut.append( "~N. " ); aMenuShortCut[ 1 ] = sal_Unicode( i + '1' ); } } @@ -202,10 +200,7 @@ void RecentFilesMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > aMenuShortCut.append( ". " ); } - OUStringBuffer aStrBuffer; - aStrBuffer.append( CMD_PREFIX ); - aStrBuffer.append( sal_Int32( i ) ); - OUString aURLString( aStrBuffer.makeStringAndClear() ); + OUString aURLString = "vnd.sun.star.popup:RecentFileList?entry=" + OUString::number(i); // Abbreviate URL OUString aMenuTitle; diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx index fce91ae24c93..eb4096c18d2e 100644 --- a/framework/source/uielement/statusbarmanager.cxx +++ b/framework/source/uielement/statusbarmanager.cxx @@ -54,14 +54,6 @@ using namespace ::com::sun::star; -// Property names of a menu/menu item ItemDescriptor -static const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL"; -static const char ITEM_DESCRIPTOR_HELPURL[] = "HelpURL"; -static const char ITEM_DESCRIPTOR_OFFSET[] = "Offset"; -static const char ITEM_DESCRIPTOR_STYLE[] = "Style"; -static const char ITEM_DESCRIPTOR_WIDTH[] = "Width"; -static const char ITEM_DESCRIPTOR_TYPE[] = "Type"; - namespace framework { @@ -440,27 +432,27 @@ void StatusBarManager::FillStatusBar( const uno::Reference< container::XIndexAcc { for ( int i = 0; i < aProp.getLength(); i++ ) { - if ( aProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL ) + if ( aProp[i].Name == "CommandURL" ) { aProp[i].Value >>= aCommandURL; } - else if ( aProp[i].Name == ITEM_DESCRIPTOR_HELPURL ) + else if ( aProp[i].Name == "HelpURL" ) { aProp[i].Value >>= aHelpURL; } - else if ( aProp[i].Name == ITEM_DESCRIPTOR_STYLE ) + else if ( aProp[i].Name == "Style" ) { aProp[i].Value >>= nStyle; } - else if ( aProp[i].Name == ITEM_DESCRIPTOR_TYPE ) + else if ( aProp[i].Name == "Type" ) { aProp[i].Value >>= nType; } - else if ( aProp[i].Name == ITEM_DESCRIPTOR_WIDTH ) + else if ( aProp[i].Name == "Width" ) { aProp[i].Value >>= nWidth; } - else if ( aProp[i].Name == ITEM_DESCRIPTOR_OFFSET ) + else if ( aProp[i].Name == "Offset" ) { aProp[i].Value >>= nOffset; } diff --git a/framework/source/uielement/statusbarmerger.cxx b/framework/source/uielement/statusbarmerger.cxx index 9459acc8e61b..6ec97abef7a9 100644 --- a/framework/source/uielement/statusbarmerger.cxx +++ b/framework/source/uielement/statusbarmerger.cxx @@ -26,26 +26,11 @@ namespace framework { namespace { -static const char MERGE_STATUSBAR_URL[] = "URL"; -static const char MERGE_STATUSBAR_TITLE[] = "Title"; -static const char MERGE_STATUSBAR_CONTEXT[] = "Context"; -static const char MERGE_STATUSBAR_ALIGN[] = "Alignment"; -static const char MERGE_STATUSBAR_AUTOSIZE[] = "AutoSize"; -static const char MERGE_STATUSBAR_OWNERDRAW[] = "OwnerDraw"; -static const char MERGE_STATUSBAR_WIDTH[] = "Width"; - -static const char STATUSBAR_ALIGN_CENTER[] = "center"; -static const char STATUSBAR_ALIGN_RIGHT[] = "right"; - static const char MERGECOMMAND_ADDAFTER[] = "AddAfter"; static const char MERGECOMMAND_ADDBEFORE[] = "AddBefore"; static const char MERGECOMMAND_REPLACE[] = "Replace"; static const char MERGECOMMAND_REMOVE[] = "Remove"; -static const char MERGEFALLBACK_ADDLAST[] = "AddLast"; -static const char MERGEFALLBACK_ADDFIRST[] = "AddFirst"; -static const char MERGEFALLBACK_IGNORE[] = "Ignore"; - void lcl_ConvertSequenceToValues( const Sequence< PropertyValue > &rSequence, AddonStatusbarItem &rItem ) @@ -58,19 +43,19 @@ void lcl_ConvertSequenceToValues( for ( sal_Int32 i = 0; i < rSequence.getLength(); i++ ) { aPropVal = rSequence[i]; - if ( aPropVal.Name == MERGE_STATUSBAR_URL ) + if ( aPropVal.Name == "URL" ) aPropVal.Value >>= rItem.aCommandURL; - else if ( aPropVal.Name == MERGE_STATUSBAR_TITLE ) + else if ( aPropVal.Name == "Title" ) aPropVal.Value >>= rItem.aLabel; - else if ( aPropVal.Name == MERGE_STATUSBAR_CONTEXT ) + else if ( aPropVal.Name == "Context" ) aPropVal.Value >>= rItem.aContext; - else if ( aPropVal.Name == MERGE_STATUSBAR_ALIGN ) + else if ( aPropVal.Name == "Alignment" ) aPropVal.Value >>= sAlignment; - else if ( aPropVal.Name == MERGE_STATUSBAR_AUTOSIZE ) + else if ( aPropVal.Name == "AutoSize" ) aPropVal.Value >>= bAutoSize; - else if ( aPropVal.Name == MERGE_STATUSBAR_OWNERDRAW ) + else if ( aPropVal.Name == "OwnerDraw" ) aPropVal.Value >>= bOwnerDraw; - else if ( aPropVal.Name == MERGE_STATUSBAR_WIDTH ) + else if ( aPropVal.Name == "Width" ) { sal_Int32 aWidth = 0; aPropVal.Value >>= aWidth; @@ -83,9 +68,9 @@ void lcl_ConvertSequenceToValues( nItemBits |= StatusBarItemBits::AutoSize; if ( bOwnerDraw ) nItemBits |= StatusBarItemBits::UserDraw; - if ( sAlignment == STATUSBAR_ALIGN_CENTER ) + if ( sAlignment == "center" ) nItemBits |= StatusBarItemBits::Center; - else if ( sAlignment == STATUSBAR_ALIGN_RIGHT ) + else if ( sAlignment == "right" ) nItemBits |= StatusBarItemBits::Right; else // if unset, defaults to left alignment @@ -233,7 +218,7 @@ bool StatusbarMerger::ProcessMergeFallback( const AddonStatusbarItemContainer& rItems ) { // fallback IGNORE or REPLACE/REMOVE item not found - if (( rMergeFallback == MERGEFALLBACK_IGNORE ) || + if (( rMergeFallback == "Ignore" ) || ( rMergeCommand == MERGECOMMAND_REPLACE ) || ( rMergeCommand == MERGECOMMAND_REMOVE ) ) { @@ -242,9 +227,9 @@ bool StatusbarMerger::ProcessMergeFallback( else if (( rMergeCommand == MERGECOMMAND_ADDBEFORE ) || ( rMergeCommand == MERGECOMMAND_ADDAFTER ) ) { - if ( rMergeFallback == MERGEFALLBACK_ADDFIRST ) + if ( rMergeFallback == "AddFirst" ) return lcl_MergeItems( pStatusbar, 0, 0, rItemId, rModuleIdentifier, rItems ); - else if ( rMergeFallback == MERGEFALLBACK_ADDLAST ) + else if ( rMergeFallback == "AddLast" ) return lcl_MergeItems( pStatusbar, STATUSBAR_APPEND, 0, rItemId, rModuleIdentifier, rItems ); } diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index ec0e374ad07a..cc00fc9bd5fc 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -82,16 +82,7 @@ namespace framework { static const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL"; -static const char ITEM_DESCRIPTOR_HELPURL[] = "HelpURL"; -static const char ITEM_DESCRIPTOR_CONTAINER[] = "ItemDescriptorContainer"; -static const char ITEM_DESCRIPTOR_LABEL[] = "Label"; -static const char ITEM_DESCRIPTOR_TYPE[] = "Type"; static const char ITEM_DESCRIPTOR_VISIBLE[] = "IsVisible"; -static const char ITEM_DESCRIPTOR_STYLE[] = "Style"; - -static const char MENUPREFIX[] = "private:resource/menubar/"; - -static const char HELPID_PREFIX_TESTTOOL[] = ".HelpId:"; static const sal_uInt16 STARTID_CUSTOMIZE_POPUPMENU = 1000; @@ -191,7 +182,7 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext, // set name for testtool, the useful part is after the last '/' sal_Int32 idx = rResourceName.lastIndexOf('/'); idx++; // will become 0 if '/' not found: use full string - OString aHelpIdAsString( HELPID_PREFIX_TESTTOOL ); + OString aHelpIdAsString( ".HelpId:" ); OUString aToolbarName = rResourceName.copy( idx ); aHelpIdAsString += OUStringToOString( aToolbarName, RTL_TEXTENCODING_UTF8 ); m_pToolBar->SetHelpId( aHelpIdAsString ); @@ -1005,7 +996,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine if ( aProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL ) { aProp[i].Value >>= aCommandURL; - if ( aCommandURL.startsWith(MENUPREFIX) ) + if ( aCommandURL.startsWith("private:resource/menubar/") ) { try { @@ -1026,7 +1017,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine xMenuContainer->getByIndex(0) >>= aProps; for ( sal_Int32 index=0; index>= aMenuDesc; @@ -1040,15 +1031,15 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine } } } - else if ( aProp[i].Name == ITEM_DESCRIPTOR_HELPURL ) + else if ( aProp[i].Name == "HelpURL" ) aProp[i].Value >>= aHelpURL; - else if ( aProp[i].Name == ITEM_DESCRIPTOR_LABEL ) + else if ( aProp[i].Name == "Label" ) aProp[i].Value >>= aLabel; - else if ( aProp[i].Name == ITEM_DESCRIPTOR_TYPE ) + else if ( aProp[i].Name == "Type" ) aProp[i].Value >>= nType; else if ( aProp[i].Name == ITEM_DESCRIPTOR_VISIBLE ) aProp[i].Value >>= bIsVisible; - else if ( aProp[i].Name == ITEM_DESCRIPTOR_STYLE ) + else if ( aProp[i].Name == "Style" ) aProp[i].Value >>= nStyle; } diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index 2980d3ebb647..caeaec5bebae 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -67,15 +67,7 @@ using namespace ::com::sun::star::util; using namespace ::com::sun::star::container; using namespace ::com::sun::star::ui; -static const char CONFIGURE_TOOLBARS_CMD[] = "ConfigureDialog"; -static const char CONFIGURE_TOOLBARS[] = ".uno:ConfigureDialog"; -static const char CMD_COLORBAR[] = ".uno:ColorControl"; -static const char CMD_FORMULABAR[] = ".uno:InsertFormula"; -static const char CMD_INPUTLINEBAR[] = ".uno:InputLineVisible"; static const char CMD_RESTOREVISIBILITY[] = ".cmd:RestoreVisibility"; -static const char ITEM_DESCRIPTOR_RESOURCEURL[] = "ResourceURL"; -static const char ITEM_DESCRIPTOR_UINAME[] = "UIName"; -static const char STATIC_PRIVATE_TB_RESOURCE[] = "private:resource/toolbar/"; static const char STATIC_CMD_PART[] = ".uno:AvailableToolbars?Toolbar:string="; static const char STATIC_INTERNAL_CMD_PART[] = ".cmd:"; @@ -219,9 +211,9 @@ static void fillHashMap( const Sequence< Sequence< css::beans::PropertyValue > > const PropertyValue* pProperties = rSeqToolBars[i].getConstArray(); for ( sal_Int32 j = 0; j < rSeqToolBars[i].getLength(); j++ ) { - if ( pProperties[j].Name == ITEM_DESCRIPTOR_RESOURCEURL ) + if ( pProperties[j].Name == "ResourceURL" ) pProperties[j].Value >>= aResourceURL; - else if ( pProperties[j].Name == ITEM_DESCRIPTOR_UINAME ) + else if ( pProperties[j].Name == "UIName" ) pProperties[j].Value >>= aUIName; } @@ -427,21 +419,21 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r { if ( m_aModuleIdentifier == "com.sun.star.drawing.DrawingDocument" || m_aModuleIdentifier == "com.sun.star.presentation.PresentationDocument" ) - addCommand( m_xPopupMenu, CMD_COLORBAR, aEmptyString ); + addCommand( m_xPopupMenu, ".uno:ColorControl", aEmptyString ); else if ( m_aModuleIdentifier == "com.sun.star.sheet.SpreadsheetDocument" ) - addCommand( m_xPopupMenu, CMD_INPUTLINEBAR, aEmptyString ); + addCommand( m_xPopupMenu, ".uno:InputLineVisible", aEmptyString ); else - addCommand( m_xPopupMenu, CMD_FORMULABAR, aEmptyString ); + addCommand( m_xPopupMenu, ".uno:InsertFormula", aEmptyString ); } bool bAddCommand( true ); SvtCommandOptions aCmdOptions; - OUString aConfigureToolbar( CONFIGURE_TOOLBARS ); + OUString aConfigureToolbar( ".uno:ConfigureDialog" ); if ( aCmdOptions.HasEntries( SvtCommandOptions::CMDOPTION_DISABLED )) { if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, - CONFIGURE_TOOLBARS_CMD)) + "ConfigureDialog")) bAddCommand = false; } @@ -679,7 +671,7 @@ void SAL_CALL ToolbarsMenuController::itemSelected( const css::awt::MenuEvent& r sal_Int32 nIndex = aCmd.indexOf( '=' ); if (( nIndex > 0 ) && (( nIndex+1 ) < aCmd.getLength() )) { - OUStringBuffer aBuf( STATIC_PRIVATE_TB_RESOURCE ); + OUStringBuffer aBuf( "private:resource/toolbar/" ); aBuf.append( aCmd.copy( nIndex+1 )); bool bShow( !pVCLPopupMenu->IsItemChecked( rEvent.MenuId )); diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx index 41b50d202ac1..4d80ec0ceb02 100644 --- a/framework/source/uielement/uicommanddescription.cxx +++ b/framework/source/uielement/uicommanddescription.cxx @@ -49,24 +49,6 @@ using namespace ::com::sun::star::frame; // Namespace static const char CONFIGURATION_ROOT_ACCESS[] = "/org.openoffice.Office.UI."; -static const char CONFIGURATION_CMD_ELEMENT_ACCESS[] = "/UserInterface/Commands"; -static const char CONFIGURATION_POP_ELEMENT_ACCESS[] = "/UserInterface/Popups"; -static const char CONFIGURATION_PROPERTY_LABEL[] = "Label"; -static const char CONFIGURATION_PROPERTY_CONTEXT_LABEL[] = "ContextLabel"; -static const char CONFIGURATION_PROPERTY_POPUP_LABEL[] = "PopupLabel"; -static const char CONFIGURATION_PROPERTY_TOOLTIP_LABEL[] = "TooltipLabel"; -static const char CONFIGURATION_PROPERTY_TARGET_URL[] = "TargetURL"; -static const char CONFIGURATION_PROPERTY_IS_EXPERIMENTAL[] = "IsExperimental"; - -// Property names of the resulting Property Set -static const char PROPSET_LABEL[] = "Label"; -static const char PROPSET_NAME[] = "Name"; -static const char PROPSET_POPUP[] = "Popup"; -static const char PROPSET_POPUPLABEL[] = "PopupLabel"; -static const char PROPSET_TOOLTIPLABEL[] = "TooltipLabel"; -static const char PROPSET_TARGETURL[] = "TargetURL"; -static const char PROPSET_IS_EXPERIMENTAL[] = "IsExperimental"; -static const char PROPSET_PROPERTIES[] = "Properties"; // Special resource URLs to retrieve additional information static const char PRIVATE_RESOURCE_URL[] = "private:"; @@ -190,20 +172,20 @@ class ConfigurationAccess_UICommand : // Order is necessary for right initializa ConfigurationAccess_UICommand::ConfigurationAccess_UICommand( const OUString& aModuleName, const Reference< XNameAccess >& rGenericUICommands, const Reference< XComponentContext>& rxContext ) : m_aConfigCmdAccess( CONFIGURATION_ROOT_ACCESS ), m_aConfigPopupAccess( CONFIGURATION_ROOT_ACCESS ), - m_aPropUILabel( CONFIGURATION_PROPERTY_LABEL ), - m_aPropUIContextLabel( CONFIGURATION_PROPERTY_CONTEXT_LABEL ), - m_aPropUIPopupLabel( CONFIGURATION_PROPERTY_POPUP_LABEL ), - m_aPropUITooltipLabel( CONFIGURATION_PROPERTY_TOOLTIP_LABEL ), - m_aPropUITargetURL( CONFIGURATION_PROPERTY_TARGET_URL ), - m_aPropUIIsExperimental( CONFIGURATION_PROPERTY_IS_EXPERIMENTAL ), - m_aPropLabel( PROPSET_LABEL ), - m_aPropName( PROPSET_NAME ), - m_aPropPopup( PROPSET_POPUP ), - m_aPropPopupLabel( PROPSET_POPUPLABEL ), - m_aPropTooltipLabel( PROPSET_TOOLTIPLABEL ), - m_aPropTargetURL( PROPSET_TARGETURL ), - m_aPropIsExperimental( PROPSET_IS_EXPERIMENTAL ), - m_aPropProperties( PROPSET_PROPERTIES ), + m_aPropUILabel( "Label" ), + m_aPropUIContextLabel( "ContextLabel" ), + m_aPropUIPopupLabel( "PopupLabel" ), + m_aPropUITooltipLabel( "TooltipLabel" ), + m_aPropUITargetURL( "TargetURL" ), + m_aPropUIIsExperimental( "IsExperimental" ), + m_aPropLabel( "Label" ), + m_aPropName( "Name" ), + m_aPropPopup( "Popup" ), + m_aPropPopupLabel( "PopupLabel" ), + m_aPropTooltipLabel( "TooltipLabel" ), + m_aPropTargetURL( "TargetURL" ), + m_aPropIsExperimental( "IsExperimental" ), + m_aPropProperties( "Properties" ), m_aPrivateResourceURL( PRIVATE_RESOURCE_URL ), m_xGenericUICommands( rGenericUICommands ), m_bConfigAccessInitialized( false ), @@ -211,13 +193,11 @@ ConfigurationAccess_UICommand::ConfigurationAccess_UICommand( const OUString& aM m_bGenericDataRetrieved( false ) { // Create configuration hierarchical access name - m_aConfigCmdAccess += aModuleName - + CONFIGURATION_CMD_ELEMENT_ACCESS; + m_aConfigCmdAccess += aModuleName + "/UserInterface/Commands"; m_xConfigProvider = theDefaultProvider::get( rxContext ); - m_aConfigPopupAccess += aModuleName - + CONFIGURATION_POP_ELEMENT_ACCESS; + m_aConfigPopupAccess += aModuleName + "/UserInterface/Popups"; } ConfigurationAccess_UICommand::~ConfigurationAccess_UICommand() -- cgit