From cc5ec80521546cddd0ce12fcd25becbcf2c7d2a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=BA=C5=A1=20Kukan?= Date: Fri, 7 Feb 2014 15:58:00 +0100 Subject: [PATCH] misc cleanup and unnecessary OUStrings Change-Id: Idef960995d7b13af049de5a5045b99df642dc3df --- .../layoutmanager/toolbarlayoutmanager.cxx | 29 +++++++------------ .../layoutmanager/toolbarlayoutmanager.hxx | 7 ----- .../source/uifactory/addonstoolbarfactory.cxx | 2 +- 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index 71a29b432422..333d3254731b 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -67,18 +67,11 @@ ToolbarLayoutManager::ToolbarLayoutManager( m_bDockingInProgress( false ), m_bVisible( true ), m_bLayoutInProgress( false ), - m_bToolbarCreation( false ), - m_aFullAddonTbxPrefix( "private:resource/toolbar/addon_" ), - m_aCustomTbxPrefix( "custom_" ), - m_aCustomizeCmd( "ConfigureDialog" ), - m_aToolbarTypeString( UIRESOURCETYPE_TOOLBAR ) + m_bToolbarCreation( false ) { // initialize rectangles to zero values setZeroRectangle( m_aDockingAreaOffsets ); setZeroRectangle( m_aDockingArea ); - - // create toolkit object - m_xToolkit = awt::Toolkit::create( m_xContext ); } ToolbarLayoutManager::~ToolbarLayoutManager() @@ -433,7 +426,7 @@ bool ToolbarLayoutManager::requestToolbar( const OUString& rResourceURL ) { bMustCallCreate = true; aRequestedToolbar.m_aName = rResourceURL; - aRequestedToolbar.m_aType = m_aToolbarTypeString; + aRequestedToolbar.m_aType = UIRESOURCETYPE_TOOLBAR; aRequestedToolbar.m_xUIElement = xUIElement; implts_readWindowStateData( rResourceURL, aRequestedToolbar ); } @@ -465,15 +458,13 @@ bool ToolbarLayoutManager::createToolbar( const OUString& rResourceURL ) bool ToolbarLayoutManager::destroyToolbar( const OUString& rResourceURL ) { - const OUString aAddonTbResourceName( "private:resource/toolbar/addon_" ); - UIElementVector::iterator pIter; uno::Reference< lang::XComponent > xComponent; bool bNotify( false ); bool bMustBeSorted( false ); bool bMustLayouted( false ); - bool bMustBeDestroyed( rResourceURL.indexOf( aAddonTbResourceName ) != 0 ); + bool bMustBeDestroyed( !rResourceURL.startsWith("private:resource/toolbar/addon_") ); WriteGuard aWriteLock( m_aLock ); for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter ) @@ -992,7 +983,6 @@ void ToolbarLayoutManager::implts_createAddonsToolBars() uno::Reference< ui::XUIElement > xUIElement; sal_uInt32 nCount = m_pAddonOptions->GetAddonsToolBarCount(); - OUString aAddonsToolBarStaticName( m_aFullAddonTbxPrefix ); OUString aElementType( "toolbar" ); uno::Sequence< beans::PropertyValue > aPropSeq( 2 ); @@ -1001,7 +991,8 @@ void ToolbarLayoutManager::implts_createAddonsToolBars() aPropSeq[1].Name = "ConfigurationData"; for ( sal_uInt32 i = 0; i < nCount; i++ ) { - OUString aAddonToolBarName( aAddonsToolBarStaticName + m_pAddonOptions->GetAddonsToolbarResourceName(i) ); + OUString aAddonToolBarName( "private:resource/toolbar/addon_" + + m_pAddonOptions->GetAddonsToolbarResourceName(i) ); aAddonToolBarData = m_pAddonOptions->GetAddonsToolBarPart( i ); aPropSeq[1].Value <<= aAddonToolBarData; @@ -1161,7 +1152,7 @@ void ToolbarLayoutManager::implts_createNonContextSensitiveToolBars() // - Toolbars (the statusbar is also member of the persistent window state) // - Not custom toolbars, there are created with their own method (implts_createCustomToolbars) if ( aElementType.equalsIgnoreAsciiCase("toolbar") && - aElementName.indexOf( m_aCustomTbxPrefix ) == -1 ) + aElementName.indexOf( "custom_" ) == -1 ) { UIElement aNewToolbar = implts_findToolbar( aName ); bool bFound = ( aNewToolbar.m_aName == aName ); @@ -1209,7 +1200,7 @@ void ToolbarLayoutManager::implts_createCustomToolBars( const uno::Sequence< uno } // Only create custom toolbars. Their name have to start with "custom_"! - if ( !aTbxResName.isEmpty() && ( aTbxResName.indexOf( m_aCustomTbxPrefix ) != -1 ) ) + if ( !aTbxResName.isEmpty() && ( aTbxResName.indexOf( "custom_" ) != -1 ) ) implts_createCustomToolBar( aTbxResName, aTbxTitle ); } } @@ -1359,7 +1350,7 @@ void ToolbarLayoutManager::implts_createToolBar( const OUString& aName, bool& bN else { // Create new UI element and try to read its state data - UIElement aNewToolbar( aName, m_aToolbarTypeString, xUIElement ); + UIElement aNewToolbar( aName, UIRESOURCETYPE_TOOLBAR, xUIElement ); implts_readWindowStateData( aName, aNewToolbar ); implts_setElementData( aNewToolbar, xDockWindow ); implts_insertToolbar( aNewToolbar ); @@ -1378,7 +1369,7 @@ void ToolbarLayoutManager::implts_createToolBar( const OUString& aName, bool& bN { ToolBox* pToolbar = (ToolBox *)pWindow; sal_uInt16 nMenuType = pToolbar->GetMenuType(); - if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, m_aCustomizeCmd )) + if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, "ConfigureDialog" )) pToolbar->SetMenuType( nMenuType & ~TOOLBOX_MENUTYPE_CUSTOMIZE ); else pToolbar->SetMenuType( nMenuType | TOOLBOX_MENUTYPE_CUSTOMIZE ); @@ -3872,7 +3863,7 @@ throw (uno::RuntimeException) OUString aElementType; OUString aElementName; parseResourceURL( rEvent.ResourceURL, aElementType, aElementName ); - if ( aElementName.indexOf( m_aCustomTbxPrefix ) != -1 ) + if ( aElementName.indexOf( "custom_" ) != -1 ) { // custom toolbar must be directly created, shown and layouted! createToolbar( rEvent.ResourceURL ); diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.hxx b/framework/source/layoutmanager/toolbarlayoutmanager.hxx index 4c2a64c15065..aa79775c1969 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.hxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.hxx @@ -294,7 +294,6 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper3< ::com::sun::star::a css::uno::Reference< ::com::sun::star::ui::XUIElementFactory > m_xUIElementFactoryManager; css::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xModuleCfgMgr; css::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xDocCfgMgr; - css::uno::Reference< ::com::sun::star::awt::XToolkit2 > m_xToolkit; css::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowState; ILayoutNotifications* m_pParentLayouter; @@ -317,12 +316,6 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper3< ::com::sun::star::a bool m_bVisible; bool m_bLayoutInProgress; bool m_bToolbarCreation; - - OUString m_aFullAddonTbxPrefix; - OUString m_aCustomTbxPrefix; - OUString m_aCustomizeCmd; - OUString m_aToolbarTypeString; - OUString m_aModuleIdentifier; }; } // namespace framework diff --git a/framework/source/uifactory/addonstoolbarfactory.cxx b/framework/source/uifactory/addonstoolbarfactory.cxx index 8f9fff8ab89d..2a89e5c86d39 100644 --- a/framework/source/uifactory/addonstoolbarfactory.cxx +++ b/framework/source/uifactory/addonstoolbarfactory.cxx @@ -196,7 +196,7 @@ throw ( ::com::sun::star::container::NoSuchElementException, Args[n].Value >>= aResourceURL; } - if ( aResourceURL.indexOf( "private:resource/toolbar/addon_" ) != 0 ) + if ( !aResourceURL.startsWith("private:resource/toolbar/addon_") ) throw IllegalArgumentException(); // Identify frame and determine module identifier to look for context based buttons