misc cleanup and unnecessary OUStrings

Change-Id: Idef960995d7b13af049de5a5045b99df642dc3df
This commit is contained in:
Matúš Kukan 2014-02-07 15:58:00 +01:00
parent e3e1bddb85
commit cc5ec80521
3 changed files with 11 additions and 27 deletions

View File

@ -67,18 +67,11 @@ ToolbarLayoutManager::ToolbarLayoutManager(
m_bDockingInProgress( false ), m_bDockingInProgress( false ),
m_bVisible( true ), m_bVisible( true ),
m_bLayoutInProgress( false ), m_bLayoutInProgress( false ),
m_bToolbarCreation( false ), m_bToolbarCreation( false )
m_aFullAddonTbxPrefix( "private:resource/toolbar/addon_" ),
m_aCustomTbxPrefix( "custom_" ),
m_aCustomizeCmd( "ConfigureDialog" ),
m_aToolbarTypeString( UIRESOURCETYPE_TOOLBAR )
{ {
// initialize rectangles to zero values // initialize rectangles to zero values
setZeroRectangle( m_aDockingAreaOffsets ); setZeroRectangle( m_aDockingAreaOffsets );
setZeroRectangle( m_aDockingArea ); setZeroRectangle( m_aDockingArea );
// create toolkit object
m_xToolkit = awt::Toolkit::create( m_xContext );
} }
ToolbarLayoutManager::~ToolbarLayoutManager() ToolbarLayoutManager::~ToolbarLayoutManager()
@ -433,7 +426,7 @@ bool ToolbarLayoutManager::requestToolbar( const OUString& rResourceURL )
{ {
bMustCallCreate = true; bMustCallCreate = true;
aRequestedToolbar.m_aName = rResourceURL; aRequestedToolbar.m_aName = rResourceURL;
aRequestedToolbar.m_aType = m_aToolbarTypeString; aRequestedToolbar.m_aType = UIRESOURCETYPE_TOOLBAR;
aRequestedToolbar.m_xUIElement = xUIElement; aRequestedToolbar.m_xUIElement = xUIElement;
implts_readWindowStateData( rResourceURL, aRequestedToolbar ); implts_readWindowStateData( rResourceURL, aRequestedToolbar );
} }
@ -465,15 +458,13 @@ bool ToolbarLayoutManager::createToolbar( const OUString& rResourceURL )
bool ToolbarLayoutManager::destroyToolbar( const OUString& rResourceURL ) bool ToolbarLayoutManager::destroyToolbar( const OUString& rResourceURL )
{ {
const OUString aAddonTbResourceName( "private:resource/toolbar/addon_" );
UIElementVector::iterator pIter; UIElementVector::iterator pIter;
uno::Reference< lang::XComponent > xComponent; uno::Reference< lang::XComponent > xComponent;
bool bNotify( false ); bool bNotify( false );
bool bMustBeSorted( false ); bool bMustBeSorted( false );
bool bMustLayouted( false ); bool bMustLayouted( false );
bool bMustBeDestroyed( rResourceURL.indexOf( aAddonTbResourceName ) != 0 ); bool bMustBeDestroyed( !rResourceURL.startsWith("private:resource/toolbar/addon_") );
WriteGuard aWriteLock( m_aLock ); WriteGuard aWriteLock( m_aLock );
for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter ) for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
@ -992,7 +983,6 @@ void ToolbarLayoutManager::implts_createAddonsToolBars()
uno::Reference< ui::XUIElement > xUIElement; uno::Reference< ui::XUIElement > xUIElement;
sal_uInt32 nCount = m_pAddonOptions->GetAddonsToolBarCount(); sal_uInt32 nCount = m_pAddonOptions->GetAddonsToolBarCount();
OUString aAddonsToolBarStaticName( m_aFullAddonTbxPrefix );
OUString aElementType( "toolbar" ); OUString aElementType( "toolbar" );
uno::Sequence< beans::PropertyValue > aPropSeq( 2 ); uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
@ -1001,7 +991,8 @@ void ToolbarLayoutManager::implts_createAddonsToolBars()
aPropSeq[1].Name = "ConfigurationData"; aPropSeq[1].Name = "ConfigurationData";
for ( sal_uInt32 i = 0; i < nCount; i++ ) 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 ); aAddonToolBarData = m_pAddonOptions->GetAddonsToolBarPart( i );
aPropSeq[1].Value <<= aAddonToolBarData; aPropSeq[1].Value <<= aAddonToolBarData;
@ -1161,7 +1152,7 @@ void ToolbarLayoutManager::implts_createNonContextSensitiveToolBars()
// - Toolbars (the statusbar is also member of the persistent window state) // - Toolbars (the statusbar is also member of the persistent window state)
// - Not custom toolbars, there are created with their own method (implts_createCustomToolbars) // - Not custom toolbars, there are created with their own method (implts_createCustomToolbars)
if ( aElementType.equalsIgnoreAsciiCase("toolbar") && if ( aElementType.equalsIgnoreAsciiCase("toolbar") &&
aElementName.indexOf( m_aCustomTbxPrefix ) == -1 ) aElementName.indexOf( "custom_" ) == -1 )
{ {
UIElement aNewToolbar = implts_findToolbar( aName ); UIElement aNewToolbar = implts_findToolbar( aName );
bool bFound = ( aNewToolbar.m_aName == 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_"! // 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 ); implts_createCustomToolBar( aTbxResName, aTbxTitle );
} }
} }
@ -1359,7 +1350,7 @@ void ToolbarLayoutManager::implts_createToolBar( const OUString& aName, bool& bN
else else
{ {
// Create new UI element and try to read its state data // 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_readWindowStateData( aName, aNewToolbar );
implts_setElementData( aNewToolbar, xDockWindow ); implts_setElementData( aNewToolbar, xDockWindow );
implts_insertToolbar( aNewToolbar ); implts_insertToolbar( aNewToolbar );
@ -1378,7 +1369,7 @@ void ToolbarLayoutManager::implts_createToolBar( const OUString& aName, bool& bN
{ {
ToolBox* pToolbar = (ToolBox *)pWindow; ToolBox* pToolbar = (ToolBox *)pWindow;
sal_uInt16 nMenuType = pToolbar->GetMenuType(); 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 ); pToolbar->SetMenuType( nMenuType & ~TOOLBOX_MENUTYPE_CUSTOMIZE );
else else
pToolbar->SetMenuType( nMenuType | TOOLBOX_MENUTYPE_CUSTOMIZE ); pToolbar->SetMenuType( nMenuType | TOOLBOX_MENUTYPE_CUSTOMIZE );
@ -3872,7 +3863,7 @@ throw (uno::RuntimeException)
OUString aElementType; OUString aElementType;
OUString aElementName; OUString aElementName;
parseResourceURL( rEvent.ResourceURL, aElementType, 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! // custom toolbar must be directly created, shown and layouted!
createToolbar( rEvent.ResourceURL ); createToolbar( rEvent.ResourceURL );

View File

@ -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::XUIElementFactory > m_xUIElementFactoryManager;
css::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xModuleCfgMgr; 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::ui::XUIConfigurationManager > m_xDocCfgMgr;
css::uno::Reference< ::com::sun::star::awt::XToolkit2 > m_xToolkit;
css::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowState; css::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowState;
ILayoutNotifications* m_pParentLayouter; ILayoutNotifications* m_pParentLayouter;
@ -317,12 +316,6 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper3< ::com::sun::star::a
bool m_bVisible; bool m_bVisible;
bool m_bLayoutInProgress; bool m_bLayoutInProgress;
bool m_bToolbarCreation; bool m_bToolbarCreation;
OUString m_aFullAddonTbxPrefix;
OUString m_aCustomTbxPrefix;
OUString m_aCustomizeCmd;
OUString m_aToolbarTypeString;
OUString m_aModuleIdentifier;
}; };
} // namespace framework } // namespace framework

View File

@ -196,7 +196,7 @@ throw ( ::com::sun::star::container::NoSuchElementException,
Args[n].Value >>= aResourceURL; Args[n].Value >>= aResourceURL;
} }
if ( aResourceURL.indexOf( "private:resource/toolbar/addon_" ) != 0 ) if ( !aResourceURL.startsWith("private:resource/toolbar/addon_") )
throw IllegalArgumentException(); throw IllegalArgumentException();
// Identify frame and determine module identifier to look for context based buttons // Identify frame and determine module identifier to look for context based buttons