diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-23 16:03:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-25 17:19:22 +0200 |
commit | d116894b26f538793a0d5dc5847efd2fb53e7acb (patch) | |
tree | 5d99d51c14bccc6a08d646b32246814c8b1bd61d /framework | |
parent | 3361e28f944d9f752f0e0df91968559f1ae55f72 (diff) |
loplugin:oncevar in formula..framework
Change-Id: I96d6af49c1994ebd7d6dcc41469127e3151b4350
Reviewed-on: https://gerrit.libreoffice.org/39186
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework')
19 files changed, 31 insertions, 58 deletions
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx index 93c494bd1503..b09042600d45 100644 --- a/framework/source/accelerators/acceleratorconfiguration.cxx +++ b/framework/source/accelerators/acceleratorconfiguration.cxx @@ -1057,8 +1057,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 = KeyMapping::get().mapIdentifierToCode(sPrefix + sKeyCommand); + aKeyEvent.KeyCode = KeyMapping::get().mapIdentifierToCode("KEY_" + sKeyCommand); css::uno::Sequence< OUString > sToken(4); const sal_Int32 nToken = 4; diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx index 2df66d3c36b1..38cb7f3e53eb 100644 --- a/framework/source/dispatch/closedispatcher.cxx +++ b/framework/source/dispatch/closedispatcher.cxx @@ -252,7 +252,6 @@ IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback, LinkParamNone*, void) // Allow calling of XController->suspend() everytimes. // Dispatch is an UI functionality. We implement such dispatch object here. // And further XController->suspend() was designed to bring an UI ... - bool bAllowSuspend = true; bool bControllerSuspended = false; bool bCloseAllViewsToo; @@ -325,7 +324,7 @@ IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback, LinkParamNone*, void) // document inside our own frame and decide then again, what has to be done! else { - if (implts_prepareFrameForClosing(m_xCloseFrame, bAllowSuspend, bCloseAllViewsToo, bControllerSuspended)) + if (implts_prepareFrameForClosing(m_xCloseFrame, true/*bAllowSuspend*/, bCloseAllViewsToo, bControllerSuspended)) { // OK; this frame is empty now. // Check the environment again to decide, what is the next step. diff --git a/framework/source/dispatch/popupmenudispatcher.cxx b/framework/source/dispatch/popupmenudispatcher.cxx index 5a93197c8b99..bef0902c5fde 100644 --- a/framework/source/dispatch/popupmenudispatcher.cxx +++ b/framework/source/dispatch/popupmenudispatcher.cxx @@ -307,8 +307,7 @@ void PopupMenuDispatcher::impl_RetrievePopupControllerQuery() if ( xLayoutManager.is() ) { css::uno::Reference< css::ui::XUIElement > xMenuBar; - OUString aMenuBar( "private:resource/menubar/menubar" ); - xMenuBar = xLayoutManager->getElement( aMenuBar ); + xMenuBar = xLayoutManager->getElement( "private:resource/menubar/menubar" ); m_xPopupCtrlQuery.set( xMenuBar, css::uno::UNO_QUERY ); } diff --git a/framework/source/fwe/helper/titlehelper.cxx b/framework/source/fwe/helper/titlehelper.cxx index ddce708ab7fe..63fbd191299d 100644 --- a/framework/source/fwe/helper/titlehelper.cxx +++ b/framework/source/fwe/helper/titlehelper.cxx @@ -559,8 +559,7 @@ void TitleHelper::impl_appendDebugVersion (OUStringBuffer& sTitle) OUString version(utl::ConfigManager::getProductVersion()); sTitle.append(' '); sTitle.append(version); - OUString sDefault("development"); - OUString sVersion = ::utl::Bootstrap::getBuildIdData(sDefault); + OUString sVersion = ::utl::Bootstrap::getBuildIdData("development"); sTitle.append(" ["); sTitle.append(sVersion); if (OpenGLWrapper::isVCLOpenGLEnabled()) diff --git a/framework/source/fwe/xml/statusbardocumenthandler.cxx b/framework/source/fwe/xml/statusbardocumenthandler.cxx index 033103d25a80..d1edc94bb6d8 100644 --- a/framework/source/fwe/xml/statusbardocumenthandler.cxx +++ b/framework/source/fwe/xml/statusbardocumenthandler.cxx @@ -147,24 +147,20 @@ OReadStatusBarDocumentHandler::OReadStatusBarDocumentHandler( const Reference< XIndexContainer >& rStatusBarItems ) : m_aStatusBarItems( rStatusBarItems ) { - OUString aNamespaceStatusBar( XMLNS_STATUSBAR ); - OUString aNamespaceXLink( XMLNS_XLINK ); - OUString aSeparator( XMLNS_FILTER_SEPARATOR ); - // create hash map for ( int i = 0; i < (int)SB_XML_ENTRY_COUNT; i++ ) { if ( StatusBarEntries[i].nNamespace == SB_NS_STATUSBAR ) { - OUString temp( aNamespaceStatusBar ); - temp += aSeparator; + OUString temp( XMLNS_STATUSBAR ); + temp += XMLNS_FILTER_SEPARATOR; temp += OUString::createFromAscii( StatusBarEntries[i].aEntryName ); m_aStatusBarMap.insert( StatusBarHashMap::value_type( temp, (StatusBar_XML_Entry)i ) ); } else { - OUString temp( aNamespaceXLink ); - temp += aSeparator; + OUString temp( XMLNS_XLINK ); + temp += XMLNS_FILTER_SEPARATOR; temp += OUString::createFromAscii( StatusBarEntries[i].aEntryName ); m_aStatusBarMap.insert( StatusBarHashMap::value_type( temp, (StatusBar_XML_Entry)i ) ); } diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx index 4076a489d0a0..21f2d53ccc5d 100644 --- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx +++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx @@ -127,24 +127,20 @@ OReadToolBoxDocumentHandler::OReadToolBoxDocumentHandler( const Reference< XInde m_aIsVisible( ITEM_DESCRIPTOR_VISIBLE ), m_aCommandURL( ITEM_DESCRIPTOR_COMMANDURL ) { - OUString aNamespaceToolBar( XMLNS_TOOLBAR ); - OUString aNamespaceXLink( XMLNS_XLINK ); - OUString aSeparator( XMLNS_FILTER_SEPARATOR ); - // create hash map for ( int i = 0; i < (int)TB_XML_ENTRY_COUNT; i++ ) { if ( ToolBoxEntries[i].nNamespace == TB_NS_TOOLBAR ) { - OUString temp( aNamespaceToolBar ); - temp += aSeparator; + OUString temp( XMLNS_TOOLBAR ); + temp += XMLNS_FILTER_SEPARATOR; temp += OUString::createFromAscii( ToolBoxEntries[i].aEntryName ); m_aToolBoxMap.insert( ToolBoxHashMap::value_type( temp, (ToolBox_XML_Entry)i ) ); } else { - OUString temp( aNamespaceXLink ); - temp += aSeparator; + OUString temp( XMLNS_XLINK ); + temp += XMLNS_FILTER_SEPARATOR; temp += OUString::createFromAscii( ToolBoxEntries[i].aEntryName ); m_aToolBoxMap.insert( ToolBoxHashMap::value_type( temp, (ToolBox_XML_Entry)i ) ); } diff --git a/framework/source/fwe/xml/xmlnamespaces.cxx b/framework/source/fwe/xml/xmlnamespaces.cxx index 0562d56c2191..a658cf12961e 100644 --- a/framework/source/fwe/xml/xmlnamespaces.cxx +++ b/framework/source/fwe/xml/xmlnamespaces.cxx @@ -166,8 +166,7 @@ OUString XMLNamespaces::getNamespaceValue( const OUString& aNamespace ) const else { // namespace not defined => throw exception! - OUString aErrorMessage( "XML namespace used but not defined!" ); - throw SAXException( aErrorMessage, Reference< XInterface >(), Any() ); + throw SAXException( "XML namespace used but not defined!", Reference< XInterface >(), Any() ); } } } diff --git a/framework/source/helper/oframes.cxx b/framework/source/helper/oframes.cxx index 90f324c5240d..8a0ac74218d2 100644 --- a/framework/source/helper/oframes.cxx +++ b/framework/source/helper/oframes.cxx @@ -180,7 +180,7 @@ Sequence< css::uno::Reference< XFrame > > SAL_CALL OFrames::queryFrames( sal_Int { // Don't search for parents, siblings and self at children! // These things are supported by this instance himself. - sal_Int32 nChildSearchFlags = FrameSearchFlag::SELF | FrameSearchFlag::CHILDREN; + sal_Int32 const nChildSearchFlags = FrameSearchFlag::SELF | FrameSearchFlag::CHILDREN; // Step over all items of container and ask children for frames. sal_uInt32 nCount = m_pFrameContainer->getCount(); for ( sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex ) diff --git a/framework/source/helper/persistentwindowstate.cxx b/framework/source/helper/persistentwindowstate.cxx index 59ab70e5c5e9..30e3290cdbd2 100644 --- a/framework/source/helper/persistentwindowstate.cxx +++ b/framework/source/helper/persistentwindowstate.cxx @@ -216,7 +216,7 @@ OUString PersistentWindowState::implst_getWindowStateFromWindow(const css::uno:: (pWindow->IsSystemWindow()) ) { - WindowStateMask nMask = WindowStateMask::All & ~(WindowStateMask::Minimized); + WindowStateMask const nMask = WindowStateMask::All & ~(WindowStateMask::Minimized); sWindowState = OStringToOUString( static_cast<SystemWindow*>(pWindow.get())->GetWindowState(nMask), RTL_TEXTENCODING_UTF8); diff --git a/framework/source/jobs/shelljob.cxx b/framework/source/jobs/shelljob.cxx index fc4a16158c7e..469a6c55cc18 100644 --- a/framework/source/jobs/shelljob.cxx +++ b/framework/source/jobs/shelljob.cxx @@ -127,13 +127,12 @@ bool ShellJob::impl_execute(const OUString& sCommand { ::rtl_uString** pArgs = nullptr; const ::sal_Int32 nArgs = lArguments.getLength (); - oslProcessOption nOptions = osl_Process_WAIT; oslProcess hProcess(nullptr); if (nArgs > 0) pArgs = reinterpret_cast< ::rtl_uString** >(const_cast< OUString* >(lArguments.getConstArray())); - oslProcessError eError = osl_executeProcess(sCommand.pData, pArgs, nArgs, nOptions, nullptr, nullptr, nullptr, 0, &hProcess); + oslProcessError eError = osl_executeProcess(sCommand.pData, pArgs, nArgs, osl_Process_WAIT, nullptr, nullptr, nullptr, 0, &hProcess); // executable not found or couldnt be started if (eError != osl_Process_E_None) diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 55da5a72ea81..6533828a060c 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -2860,12 +2860,11 @@ void SAL_CALL LayoutManager::elementInserted( const ui::ConfigurationEvent& Even Reference< XUIElementSettings > xElementSettings( xUIElement, UNO_QUERY ); if ( xElementSettings.is() ) { - OUString aConfigSourcePropName( "ConfigurationSource" ); uno::Reference< XPropertySet > xPropSet( xElementSettings, uno::UNO_QUERY ); if ( xPropSet.is() ) { if ( Event.Source == uno::Reference< uno::XInterface >( m_xDocCfgMgr, uno::UNO_QUERY )) - xPropSet->setPropertyValue( aConfigSourcePropName, makeAny( m_xDocCfgMgr )); + xPropSet->setPropertyValue( "ConfigurationSource", makeAny( m_xDocCfgMgr )); } xElementSettings->updateSettings(); } @@ -2991,12 +2990,11 @@ void SAL_CALL LayoutManager::elementReplaced( const ui::ConfigurationEvent& Even Reference< XUIElementSettings > xElementSettings( xUIElement, UNO_QUERY ); if ( xElementSettings.is() ) { - OUString aConfigSourcePropName( "ConfigurationSource" ); Reference< XInterface > xElementCfgMgr; Reference< XPropertySet > xPropSet( xElementSettings, UNO_QUERY ); if ( xPropSet.is() ) - xPropSet->getPropertyValue( aConfigSourcePropName ) >>= xElementCfgMgr; + xPropSet->getPropertyValue( "ConfigurationSource" ) >>= xElementCfgMgr; if ( !xElementCfgMgr.is() ) return; diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index 37c86960a9b5..be24d67a0262 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -1092,7 +1092,6 @@ void ToolbarLayoutManager::implts_createAddonsToolBars() uno::Reference< ui::XUIElement > xUIElement; sal_uInt32 nCount = m_pAddonOptions->GetAddonsToolBarCount(); - OUString aElementType( "toolbar" ); uno::Sequence< beans::PropertyValue > aPropSeq( 2 ); aPropSeq[0].Name = "Frame"; @@ -1151,7 +1150,7 @@ void ToolbarLayoutManager::implts_createAddonsToolBars() else { // Create new UI element and try to read its state data - UIElement aNewToolbar( aAddonToolBarName, aElementType, xUIElement ); + UIElement aNewToolbar( aAddonToolBarName, "toolbar", xUIElement ); aNewToolbar.m_bFloating = true; implts_readWindowStateData( aAddonToolBarName, aNewToolbar ); implts_setElementData( aNewToolbar, xDockWindow ); @@ -3798,12 +3797,11 @@ void SAL_CALL ToolbarLayoutManager::elementInserted( const ui::ConfigurationEven uno::Reference< ui::XUIElementSettings > xElementSettings( aUIElement.m_xUIElement, uno::UNO_QUERY ); if ( xElementSettings.is() ) { - OUString aConfigSourcePropName( "ConfigurationSource" ); uno::Reference< beans::XPropertySet > xPropSet( xElementSettings, uno::UNO_QUERY ); if ( xPropSet.is() ) { if ( rEvent.Source == uno::Reference< uno::XInterface >( m_xDocCfgMgr, uno::UNO_QUERY )) - xPropSet->setPropertyValue( aConfigSourcePropName, makeAny( m_xDocCfgMgr )); + xPropSet->setPropertyValue( "ConfigurationSource", makeAny( m_xDocCfgMgr )); } xElementSettings->updateSettings(); } @@ -3908,12 +3906,11 @@ void SAL_CALL ToolbarLayoutManager::elementReplaced( const ui::ConfigurationEven uno::Reference< ui::XUIElementSettings > xElementSettings( aUIElement.m_xUIElement, uno::UNO_QUERY ); if ( xElementSettings.is() ) { - OUString aConfigSourcePropName( "ConfigurationSource" ); uno::Reference< uno::XInterface > xElementCfgMgr; uno::Reference< beans::XPropertySet > xPropSet( xElementSettings, uno::UNO_QUERY ); if ( xPropSet.is() ) - xPropSet->getPropertyValue( aConfigSourcePropName ) >>= xElementCfgMgr; + xPropSet->getPropertyValue( "ConfigurationSource" ) >>= xElementCfgMgr; if ( !xElementCfgMgr.is() ) return; diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 2a6ceb707af1..3a9fdfdb546a 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -2344,8 +2344,7 @@ IMPL_LINK_NOARG(AutoRecovery, implts_timerExpired, Timer *, void) // force save of all currently open documents // The called method returns an info, if and how this // timer must be restarted. - bool bAllowUserIdleLoop = true; - AutoRecovery::ETimerType eSuggestedTimer = implts_saveDocs(bAllowUserIdleLoop, false); + AutoRecovery::ETimerType eSuggestedTimer = implts_saveDocs(true/*bAllowUserIdleLoop*/, false); // If timer is not used for "short callbacks" (means polling // for special states) ... reset the handle state of all @@ -3700,7 +3699,7 @@ void AutoRecovery::implts_doEmergencySave(const DispatchParams& aParams) // Of course this method returns the right state - // because it knows, that we are running in EMERGENCY SAVE mode .-) - bool bAllowUserIdleLoop = false; // not allowed to change that .-) + bool const bAllowUserIdleLoop = false; // not allowed to change that .-) AutoRecovery::ETimerType eSuggestedTimer = AutoRecovery::E_DONT_START_TIMER; do { @@ -3768,7 +3767,7 @@ void AutoRecovery::implts_doSessionSave(const DispatchParams& aParams) // Of course this method returns the right state - // because it knows, that we are running in SESSION SAVE mode .-) - bool bAllowUserIdleLoop = false; // not allowed to change that .-) + bool const bAllowUserIdleLoop = false; // not allowed to change that .-) AutoRecovery::ETimerType eSuggestedTimer = AutoRecovery::E_DONT_START_TIMER; do { diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx index 7b1504ae69f4..a266af912c8f 100644 --- a/framework/source/services/substitutepathvars.cxx +++ b/framework/source/services/substitutepathvars.cxx @@ -488,8 +488,7 @@ OUString SubstitutePathVariables::impl_substituteVariable( const OUString& rText // variable in text but unknown! if ( bSubstRequired ) { - OUString aMsg( "Unknown variable found!" ); - throw NoSuchElementException( aMsg, static_cast<cppu::OWeakObject *>(this) ); + throw NoSuchElementException( "Unknown variable found!", static_cast<cppu::OWeakObject *>(this) ); } else aResult = aWorkText; @@ -600,8 +599,7 @@ OUString const & SubstitutePathVariables::impl_getSubstituteVariableValue( const } else { - OUString aExceptionText("Unknown variable!"); - throw NoSuchElementException(aExceptionText, static_cast<cppu::OWeakObject *>(this)); + throw NoSuchElementException("Unknown variable!", static_cast<cppu::OWeakObject *>(this)); } } diff --git a/framework/source/uielement/comboboxtoolbarcontroller.cxx b/framework/source/uielement/comboboxtoolbarcontroller.cxx index 1e80d29e661d..8f37f6d4f690 100644 --- a/framework/source/uielement/comboboxtoolbarcontroller.cxx +++ b/framework/source/uielement/comboboxtoolbarcontroller.cxx @@ -263,14 +263,13 @@ void ComboboxToolbarController::executeControlCommand( const css::frame::Control } else if ( rControlCommand.Command == "AddEntry" ) { - sal_Int32 nPos( COMBOBOX_APPEND ); OUString aText; for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) { if ( rControlCommand.Arguments[i].Name == "Text" ) { if ( rControlCommand.Arguments[i].Value >>= aText ) - m_pComboBox->InsertEntry( aText, nPos ); + m_pComboBox->InsertEntry( aText, COMBOBOX_APPEND ); break; } } diff --git a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx index ccac50e0a70c..7608d112b5d3 100644 --- a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx +++ b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx @@ -207,14 +207,13 @@ void DropdownToolbarController::executeControlCommand( const css::frame::Control } else if ( rControlCommand.Command == "AddEntry" ) { - sal_Int32 nPos( LISTBOX_APPEND ); OUString aText; for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) { if ( rControlCommand.Arguments[i].Name == "Text" ) { if ( rControlCommand.Arguments[i].Value >>= aText ) - m_pListBoxControl->InsertEntry( aText, nPos ); + m_pListBoxControl->InsertEntry( aText, LISTBOX_APPEND ); break; } } diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 2dcfd3a94920..76b8182dca29 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -597,12 +597,11 @@ void MenuBarManager::CheckAndAddMenuExtension( Menu* pMenu ) sal_uInt16 nNewItemId( 0 ); sal_uInt16 nInsertPos( MENU_APPEND ); sal_uInt16 nBeforePos( MENU_APPEND ); - OUString aCommandBefore( ".uno:About" ); for ( sal_uInt16 n = 0; n < pMenu->GetItemCount(); n++ ) { sal_uInt16 nItemId = pMenu->GetItemId( n ); nNewItemId = std::max( nItemId, nNewItemId ); - if ( pMenu->GetItemCommand( nItemId ) == aCommandBefore ) + if ( pMenu->GetItemCommand( nItemId ) == ".uno:About" ) nBeforePos = n; } ++nNewItemId; diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index ec0f925e7651..584aabdb7ec6 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -676,7 +676,6 @@ void ToolBarManager::CreateControllers() if ( nId == 0 ) continue; - OUString aLoadURL( ".uno:OpenUrl" ); bool bInit( true ); bool bCreate( true ); Reference< XStatusListener > xController; @@ -730,7 +729,7 @@ void ToolBarManager::CreateControllers() bInit = false; // Initialization is done through the factory service } - if (( aCommandURL == aLoadURL ) && ( !m_pToolBar->IsItemVisible(nId))) + if (( aCommandURL == ".uno:OpenUrl" ) && ( !m_pToolBar->IsItemVisible(nId))) bCreate = false; if ( !xController.is() && bCreate ) diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index b587b7e24cca..c5775e88d7b6 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -422,7 +422,6 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r bool bAddCommand( true ); SvtCommandOptions aCmdOptions; - OUString aConfigureToolbar( ".uno:ConfigureDialog" ); if ( aCmdOptions.HasEntries( SvtCommandOptions::CMDOPTION_DISABLED )) { @@ -440,7 +439,7 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r m_xPopupMenu->insertSeparator( nItemCount+1 ); } - addCommand( m_xPopupMenu, aConfigureToolbar, "" ); + addCommand( m_xPopupMenu, ".uno:ConfigureDialog", "" ); } // Add separator if no configure has been added |