diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2005-03-23 15:16:20 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2005-03-23 15:16:20 +0000 |
commit | 27b3a04c7875a2087a86b20d46e48190ca6fed82 (patch) | |
tree | 3b0377d5c946dad021adaac4c779a7c141cb919e /framework/source/uielement | |
parent | f0a72a58197d7df4cc7fba2c4434b407ad67ddd1 (diff) |
INTEGRATION: CWS fwkfinal2 (1.6.16); FILE MERGED
2005/03/14 13:46:57 cd 1.6.16.1: #i44997# Don't crash on a transient toolbar
Diffstat (limited to 'framework/source/uielement')
-rw-r--r-- | framework/source/uielement/toolbarwrapper.cxx | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/framework/source/uielement/toolbarwrapper.cxx b/framework/source/uielement/toolbarwrapper.cxx index 7cc3ee25da87..4aba8c3833b7 100644 --- a/framework/source/uielement/toolbarwrapper.cxx +++ b/framework/source/uielement/toolbarwrapper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: toolbarwrapper.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: obo $ $Date: 2005-03-15 09:35:18 $ + * last change: $Author: vg $ $Date: 2005-03-23 16:16:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -58,7 +58,6 @@ * * ************************************************************************/ - //_________________________________________________________________________________________________________________ // my own includes //_________________________________________________________________________________________________________________ @@ -266,6 +265,18 @@ void SAL_CALL ToolBarWrapper::initialize( const Sequence< Any >& aArguments ) th } catch ( NoSuchElementException& ) { + // No settings in our configuration manager. This means we are + // a transient toolbar which has no persistent settings. + m_bPersistent = sal_False; + if ( pToolBar && pToolBarManager ) + { + pToolBar->SetOutStyle( SvtMiscOptions().GetToolboxStyle() ); + pToolBar->EnableCustomize( TRUE ); + ::Size aActSize( pToolBar->GetSizePixel() ); + ::Size aSize( pToolBar->CalcWindowSizePixel() ); + aSize.Width() = aActSize.Width(); + pToolBar->SetOutputSizePixel( aSize ); + } } } } @@ -298,20 +309,25 @@ void SAL_CALL ToolBarWrapper::updateSettings() throw (::com::sun::star::uno::Run if ( m_bDisposed ) throw DisposedException(); - if ( m_bPersistent && - m_xConfigSource.is() && - m_xToolBarManager.is() ) + if ( m_xToolBarManager.is() ) { - try + if ( m_xConfigSource.is() && m_bPersistent ) { - ToolBarManager* pToolBarManager = static_cast< ToolBarManager *>( m_xToolBarManager.get() ); + try + { + ToolBarManager* pToolBarManager = static_cast< ToolBarManager *>( m_xToolBarManager.get() ); - m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL, sal_False ); - if ( m_xConfigData.is() ) - pToolBarManager->FillToolbar( m_xConfigData ); + m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL, sal_False ); + if ( m_xConfigData.is() ) + pToolBarManager->FillToolbar( m_xConfigData ); + } + catch ( NoSuchElementException& ) + { + } } - catch ( NoSuchElementException& ) + else if ( !m_bPersistent ) { + // Transient toolbar: do nothing } } } @@ -360,6 +376,13 @@ void SAL_CALL ToolBarWrapper::setSettings( const ::com::sun::star::uno::Referenc { } } + else if ( !m_bPersistent ) + { + // Transient toolbar => Fill toolbar with new data + ToolBarManager* pToolBarManager = static_cast< ToolBarManager *>( m_xToolBarManager.get() ); + if ( pToolBarManager ) + pToolBarManager->FillToolbar( m_xConfigData ); + } } } |