summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-07 20:32:26 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-08 11:01:31 +0200
commitff25a4a6f4b9763b09abbbd6a711fa4d18f40ade (patch)
treeded29238e8fb782c20b429f6d5df6c40a3bb2604 /framework
parent32343bcbb786168df62f85a57e30c620c3d3bdb4 (diff)
loplugin:flatten in framework
Change-Id: I2a74a7543b5edd853396efa31a3e2568e6607778 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91848 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework')
-rw-r--r--framework/source/dispatch/popupmenudispatcher.cxx76
-rw-r--r--framework/source/fwe/classes/addonmenu.cxx138
-rw-r--r--framework/source/fwe/helper/actiontriggerhelper.cxx214
-rw-r--r--framework/source/fwe/xml/menudocumenthandler.cxx98
-rw-r--r--framework/source/fwe/xml/statusbardocumenthandler.cxx357
-rw-r--r--framework/source/fwe/xml/toolboxdocumenthandler.cxx513
-rw-r--r--framework/source/fwi/helper/mischelper.cxx22
-rw-r--r--framework/source/fwi/jobs/configaccess.cxx71
-rw-r--r--framework/source/fwi/uielement/constitemcontainer.cxx62
-rw-r--r--framework/source/fwi/uielement/itemcontainer.cxx44
-rw-r--r--framework/source/fwi/uielement/rootitemcontainer.cxx44
-rw-r--r--framework/source/helper/dockingareadefaultacceptor.cxx46
-rw-r--r--framework/source/helper/ocomponentaccess.cxx28
-rw-r--r--framework/source/helper/statusindicatorfactory.cxx68
-rw-r--r--framework/source/helper/uiconfigelementwrapperbase.cxx90
-rw-r--r--framework/source/helper/uielementwrapperbase.cxx28
-rw-r--r--framework/source/jobs/job.cxx50
-rw-r--r--framework/source/jobs/jobdata.cxx52
-rw-r--r--framework/source/jobs/jobexecutor.cxx34
-rw-r--r--framework/source/jobs/joburl.cxx82
-rw-r--r--framework/source/layoutmanager/helpers.cxx58
-rw-r--r--framework/source/layoutmanager/layoutmanager.cxx546
-rw-r--r--framework/source/layoutmanager/toolbarlayoutmanager.cxx907
-rw-r--r--framework/source/loadenv/loadenv.cxx26
-rw-r--r--framework/source/services/ContextChangeEventMultiplexer.cxx59
-rw-r--r--framework/source/services/autorecovery.cxx48
-rw-r--r--framework/source/services/frame.cxx380
-rw-r--r--framework/source/uiconfiguration/imagemanagerimpl.cxx514
-rw-r--r--framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx392
-rw-r--r--framework/source/uiconfiguration/uiconfigurationmanager.cxx276
-rw-r--r--framework/source/uiconfiguration/windowstateconfiguration.cxx104
-rw-r--r--framework/source/uielement/FixedImageToolbarController.cxx42
-rw-r--r--framework/source/uielement/FixedTextToolbarController.cxx24
-rw-r--r--framework/source/uielement/addonstoolbarwrapper.cxx90
-rw-r--r--framework/source/uielement/buttontoolbarcontroller.cxx56
-rw-r--r--framework/source/uielement/complextoolbarcontroller.cxx162
-rw-r--r--framework/source/uielement/controlmenucontroller.cxx114
-rw-r--r--framework/source/uielement/edittoolbarcontroller.cxx24
-rw-r--r--framework/source/uielement/fontmenucontroller.cxx91
-rw-r--r--framework/source/uielement/fontsizemenucontroller.cxx152
-rw-r--r--framework/source/uielement/generictoolbarcontroller.cxx212
-rw-r--r--framework/source/uielement/headermenucontroller.cxx156
-rw-r--r--framework/source/uielement/imagebuttontoolbarcontroller.cxx46
-rw-r--r--framework/source/uielement/langselectionstatusbarcontroller.cxx182
-rw-r--r--framework/source/uielement/menubarmanager.cxx214
-rw-r--r--framework/source/uielement/menubarwrapper.cxx176
-rw-r--r--framework/source/uielement/newmenucontroller.cxx396
-rw-r--r--framework/source/uielement/objectmenucontroller.cxx24
-rw-r--r--framework/source/uielement/popuptoolbarcontroller.cxx40
-rw-r--r--framework/source/uielement/progressbarwrapper.cxx70
-rw-r--r--framework/source/uielement/recentfilesmenucontroller.cxx282
-rw-r--r--framework/source/uielement/statusbarmanager.cxx82
-rw-r--r--framework/source/uielement/statusbarwrapper.cxx90
-rw-r--r--framework/source/uielement/subtoolbarcontroller.cxx136
-rw-r--r--framework/source/uielement/thesaurusmenucontroller.cxx82
-rw-r--r--framework/source/uielement/toolbarmanager.cxx148
-rw-r--r--framework/source/uielement/toolbarmodemenucontroller.cxx150
-rw-r--r--framework/source/uielement/toolbarsmenucontroller.cxx580
-rw-r--r--framework/source/uielement/toolbarwrapper.cxx198
-rw-r--r--framework/source/uielement/uicommanddescription.cxx128
-rw-r--r--framework/source/uifactory/factoryconfiguration.cxx72
-rw-r--r--framework/source/uifactory/uielementfactorymanager.cxx44
-rw-r--r--framework/source/xml/imagesdocumenthandler.cxx146
63 files changed, 4915 insertions, 4921 deletions
diff --git a/framework/source/dispatch/popupmenudispatcher.cxx b/framework/source/dispatch/popupmenudispatcher.cxx
index caa3170c53bd..24ce67dc70d2 100644
--- a/framework/source/dispatch/popupmenudispatcher.cxx
+++ b/framework/source/dispatch/popupmenudispatcher.cxx
@@ -250,58 +250,58 @@ void SAL_CALL PopupMenuDispatcher::disposing( const EventObject& )
// Safe impossible cases
SAL_WARN_IF( m_bAlreadyDisposed, "fwk", "MenuDispatcher::disposing(): Object already disposed .. don't call it again!" );
- if( !m_bAlreadyDisposed )
- {
- m_bAlreadyDisposed = true;
+ if( m_bAlreadyDisposed )
+ return;
+
+ m_bAlreadyDisposed = true;
- if ( m_bActivateListener )
+ if ( m_bActivateListener )
+ {
+ uno::Reference< XFrame > xFrame( m_xWeakFrame.get(), UNO_QUERY );
+ if ( xFrame.is() )
{
- uno::Reference< XFrame > xFrame( m_xWeakFrame.get(), UNO_QUERY );
- if ( xFrame.is() )
- {
- xFrame->removeFrameActionListener( uno::Reference< XFrameActionListener >( static_cast<OWeakObject *>(this), UNO_QUERY ));
- m_bActivateListener = false;
- }
+ xFrame->removeFrameActionListener( uno::Reference< XFrameActionListener >( static_cast<OWeakObject *>(this), UNO_QUERY ));
+ m_bActivateListener = false;
}
-
- // Forget our factory.
- m_xContext.clear();
}
+
+ // Forget our factory.
+ m_xContext.clear();
}
void PopupMenuDispatcher::impl_RetrievePopupControllerQuery()
{
- if ( !m_xPopupCtrlQuery.is() )
+ if ( m_xPopupCtrlQuery.is() )
+ return;
+
+ css::uno::Reference< css::frame::XLayoutManager2 > xLayoutManager;
+ css::uno::Reference< css::frame::XFrame > xFrame( m_xWeakFrame );
+
+ if ( !xFrame.is() )
+ return;
+
+ css::uno::Reference< css::beans::XPropertySet > xPropSet( xFrame, css::uno::UNO_QUERY );
+ if ( !xPropSet.is() )
+ return;
+
+ try
{
- css::uno::Reference< css::frame::XLayoutManager2 > xLayoutManager;
- css::uno::Reference< css::frame::XFrame > xFrame( m_xWeakFrame );
+ xPropSet->getPropertyValue( FRAME_PROPNAME_ASCII_LAYOUTMANAGER ) >>= xLayoutManager;
- if ( xFrame.is() )
+ if ( xLayoutManager.is() )
{
- css::uno::Reference< css::beans::XPropertySet > xPropSet( xFrame, css::uno::UNO_QUERY );
- if ( xPropSet.is() )
- {
- try
- {
- xPropSet->getPropertyValue( FRAME_PROPNAME_ASCII_LAYOUTMANAGER ) >>= xLayoutManager;
+ css::uno::Reference< css::ui::XUIElement > xMenuBar = xLayoutManager->getElement( "private:resource/menubar/menubar" );
- if ( xLayoutManager.is() )
- {
- css::uno::Reference< css::ui::XUIElement > xMenuBar = xLayoutManager->getElement( "private:resource/menubar/menubar" );
-
- m_xPopupCtrlQuery.set( xMenuBar, css::uno::UNO_QUERY );
- }
- }
- catch ( const css::uno::RuntimeException& )
- {
- throw;
- }
- catch ( const css::uno::Exception& )
- {
- }
- }
+ m_xPopupCtrlQuery.set( xMenuBar, css::uno::UNO_QUERY );
}
}
+ catch ( const css::uno::RuntimeException& )
+ {
+ throw;
+ }
+ catch ( const css::uno::Exception& )
+ {
+ }
}
} // namespace framework
diff --git a/framework/source/fwe/classes/addonmenu.cxx b/framework/source/fwe/classes/addonmenu.cxx
index 5a7ab9f5c544..0ce25ceca88f 100644
--- a/framework/source/fwe/classes/addonmenu.cxx
+++ b/framework/source/fwe/classes/addonmenu.cxx
@@ -89,44 +89,44 @@ static sal_uInt16 FindMenuId( Menu const * pMenu, const OUString& aCommand )
void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame,
MenuBar const * pMergeMenuBar )
{
- if ( pMergeMenuBar )
- {
- PopupMenu* pHelpMenu(nullptr);
- sal_uInt16 nId = FindMenuId(pMergeMenuBar, ".uno:HelpMenu");
- if ( nId != USHRT_MAX )
- pHelpMenu = pMergeMenuBar->GetPopupMenu( nId );
+ if ( !pMergeMenuBar )
+ return;
- if ( pHelpMenu )
- {
- // Add-Ons help menu items should be inserted after the "registration" menu item
- sal_uInt16 nItemCount = pHelpMenu->GetItemCount();
- sal_uInt16 nInsSepAfterPos = MENU_APPEND;
- sal_uInt16 nUniqueMenuId = ADDONMENU_ITEMID_START;
- AddonsOptions aOptions;
+ PopupMenu* pHelpMenu(nullptr);
+ sal_uInt16 nId = FindMenuId(pMergeMenuBar, ".uno:HelpMenu");
+ if ( nId != USHRT_MAX )
+ pHelpMenu = pMergeMenuBar->GetPopupMenu( nId );
- // try to detect the about menu item with the command URL
- nId = FindMenuId(pHelpMenu, ".uno:About");
- sal_uInt16 nInsPos = pHelpMenu->GetItemPos( nId );
+ if ( !pHelpMenu )
+ return;
- const Sequence< Sequence< PropertyValue > >& rAddonHelpMenuEntries = aOptions.GetAddonsHelpMenu();
+ // Add-Ons help menu items should be inserted after the "registration" menu item
+ sal_uInt16 nItemCount = pHelpMenu->GetItemCount();
+ sal_uInt16 nInsSepAfterPos = MENU_APPEND;
+ sal_uInt16 nUniqueMenuId = ADDONMENU_ITEMID_START;
+ AddonsOptions aOptions;
- if ( nInsPos < nItemCount && pHelpMenu->GetItemType( nInsPos ) != MenuItemType::SEPARATOR )
- nInsSepAfterPos = nInsPos;
+ // try to detect the about menu item with the command URL
+ nId = FindMenuId(pHelpMenu, ".uno:About");
+ sal_uInt16 nInsPos = pHelpMenu->GetItemPos( nId );
- OUString aModuleIdentifier = vcl::CommandInfoProvider::GetModuleIdentifier(rFrame);
- AddonMenuManager::BuildMenu( pHelpMenu, nInsPos, nUniqueMenuId, rAddonHelpMenuEntries, rFrame, aModuleIdentifier );
+ const Sequence< Sequence< PropertyValue > >& rAddonHelpMenuEntries = aOptions.GetAddonsHelpMenu();
- if ( pHelpMenu->GetItemCount() > nItemCount )
- {
- if ( nInsSepAfterPos < MENU_APPEND )
- {
- nInsSepAfterPos += ( pHelpMenu->GetItemCount() - nItemCount );
- if ( pHelpMenu->GetItemType( nInsSepAfterPos ) != MenuItemType::SEPARATOR )
- pHelpMenu->InsertSeparator(OString(), nInsSepAfterPos);
- }
- pHelpMenu->InsertSeparator(OString(), nItemCount);
- }
+ if ( nInsPos < nItemCount && pHelpMenu->GetItemType( nInsPos ) != MenuItemType::SEPARATOR )
+ nInsSepAfterPos = nInsPos;
+
+ OUString aModuleIdentifier = vcl::CommandInfoProvider::GetModuleIdentifier(rFrame);
+ AddonMenuManager::BuildMenu( pHelpMenu, nInsPos, nUniqueMenuId, rAddonHelpMenuEntries, rFrame, aModuleIdentifier );
+
+ if ( pHelpMenu->GetItemCount() > nItemCount )
+ {
+ if ( nInsSepAfterPos < MENU_APPEND )
+ {
+ nInsSepAfterPos += ( pHelpMenu->GetItemCount() - nItemCount );
+ if ( pHelpMenu->GetItemType( nInsSepAfterPos ) != MenuItemType::SEPARATOR )
+ pHelpMenu->InsertSeparator(OString(), nInsSepAfterPos);
}
+ pHelpMenu->InsertSeparator(OString(), nItemCount);
}
}
@@ -135,52 +135,52 @@ void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame,
sal_uInt16 nMergeAtPos,
MenuBar* pMergeMenuBar )
{
- if ( pMergeMenuBar )
- {
- AddonsOptions aAddonsOptions;
- sal_uInt16 nInsertPos = nMergeAtPos;
+ if ( !pMergeMenuBar )
+ return;
- OUString aTitle;
- OUString aURL;
- OUString aTarget;
- OUString aImageId;
- OUString aContext;
- Sequence< Sequence< PropertyValue > > aAddonSubMenu;
- sal_uInt16 nUniqueMenuId = ADDONMENU_ITEMID_START;
+ AddonsOptions aAddonsOptions;
+ sal_uInt16 nInsertPos = nMergeAtPos;
- OUString aModuleIdentifier = vcl::CommandInfoProvider::GetModuleIdentifier(rFrame);
+ OUString aTitle;
+ OUString aURL;
+ OUString aTarget;
+ OUString aImageId;
+ OUString aContext;
+ Sequence< Sequence< PropertyValue > > aAddonSubMenu;
+ sal_uInt16 nUniqueMenuId = ADDONMENU_ITEMID_START;
- const Sequence< Sequence< PropertyValue > >& rAddonMenuEntries = aAddonsOptions.GetAddonsMenuBarPart();
- for ( sal_Int32 i = 0; i < rAddonMenuEntries.getLength(); i++ )
+ OUString aModuleIdentifier = vcl::CommandInfoProvider::GetModuleIdentifier(rFrame);
+
+ const Sequence< Sequence< PropertyValue > >& rAddonMenuEntries = aAddonsOptions.GetAddonsMenuBarPart();
+ for ( sal_Int32 i = 0; i < rAddonMenuEntries.getLength(); i++ )
+ {
+ AddonMenuManager::GetMenuEntry( rAddonMenuEntries[i],
+ aTitle,
+ aURL,
+ aTarget,
+ aImageId,
+ aContext,
+ aAddonSubMenu );
+ if ( !aTitle.isEmpty() &&
+ !aURL.isEmpty() &&
+ aAddonSubMenu.hasElements() &&
+ AddonMenuManager::IsCorrectContext( aModuleIdentifier, aContext ))
{
- AddonMenuManager::GetMenuEntry( rAddonMenuEntries[i],
- aTitle,
- aURL,
- aTarget,
- aImageId,
- aContext,
- aAddonSubMenu );
- if ( !aTitle.isEmpty() &&
- !aURL.isEmpty() &&
- aAddonSubMenu.hasElements() &&
- AddonMenuManager::IsCorrectContext( aModuleIdentifier, aContext ))
- {
- sal_uInt16 nId = nUniqueMenuId++;
- VclPtrInstance<PopupMenu> pAddonPopupMenu;
+ sal_uInt16 nId = nUniqueMenuId++;
+ VclPtrInstance<PopupMenu> pAddonPopupMenu;
- AddonMenuManager::BuildMenu( pAddonPopupMenu, MENU_APPEND, nUniqueMenuId, aAddonSubMenu, rFrame, aModuleIdentifier );
+ AddonMenuManager::BuildMenu( pAddonPopupMenu, MENU_APPEND, nUniqueMenuId, aAddonSubMenu, rFrame, aModuleIdentifier );
- if ( pAddonPopupMenu->GetItemCount() > 0 )
- {
- pMergeMenuBar->InsertItem( nId, aTitle, MenuItemBits::NONE, OString(), nInsertPos++ );
- pMergeMenuBar->SetPopupMenu( nId, pAddonPopupMenu );
+ if ( pAddonPopupMenu->GetItemCount() > 0 )
+ {
+ pMergeMenuBar->InsertItem( nId, aTitle, MenuItemBits::NONE, OString(), nInsertPos++ );
+ pMergeMenuBar->SetPopupMenu( nId, pAddonPopupMenu );
- // Store the command URL into the VCL menu bar for later identification
- pMergeMenuBar->SetItemCommand( nId, aURL );
- }
- else
- pAddonPopupMenu.disposeAndClear();
+ // Store the command URL into the VCL menu bar for later identification
+ pMergeMenuBar->SetItemCommand( nId, aURL );
}
+ else
+ pAddonPopupMenu.disposeAndClear();
}
}
}
diff --git a/framework/source/fwe/helper/actiontriggerhelper.cxx b/framework/source/fwe/helper/actiontriggerhelper.cxx
index ed700fdced20..deb14f0e1e2e 100644
--- a/framework/source/fwe/helper/actiontriggerhelper.cxx
+++ b/framework/source/fwe/helper/actiontriggerhelper.cxx
@@ -96,139 +96,139 @@ static void GetMenuItemAttributes( const Reference< XPropertySet >& xActionTrigg
static void InsertSubMenuItems( Menu* pSubMenu, sal_uInt16& nItemId, const Reference< XIndexContainer >& xActionTriggerContainer )
{
- if ( xActionTriggerContainer.is() )
- {
- AddonsOptions aAddonOptions;
- OUString aSlotURL( "slot:" );
+ if ( !xActionTriggerContainer.is() )
+ return;
+
+ AddonsOptions aAddonOptions;
+ OUString aSlotURL( "slot:" );
- for ( sal_Int32 i = 0; i < xActionTriggerContainer->getCount(); i++ )
+ for ( sal_Int32 i = 0; i < xActionTriggerContainer->getCount(); i++ )
+ {
+ try
{
- try
+ Reference< XPropertySet > xPropSet;
+ if (( xActionTriggerContainer->getByIndex( i ) >>= xPropSet ) && ( xPropSet.is() ))
{
- Reference< XPropertySet > xPropSet;
- if (( xActionTriggerContainer->getByIndex( i ) >>= xPropSet ) && ( xPropSet.is() ))
+ if ( IsSeparator( xPropSet ))
{
- if ( IsSeparator( xPropSet ))
- {
- // Separator
- SolarMutexGuard aGuard;
- pSubMenu->InsertSeparator();
- }
- else
- {
- // Menu item
- OUString aLabel;
- OUString aCommandURL;
- OUString aHelpURL;
- Reference< XBitmap > xBitmap;
- Reference< XIndexContainer > xSubContainer;
+ // Separator
+ SolarMutexGuard aGuard;
+ pSubMenu->InsertSeparator();
+ }
+ else
+ {
+ // Menu item
+ OUString aLabel;
+ OUString aCommandURL;
+ OUString aHelpURL;
+ Reference< XBitmap > xBitmap;
+ Reference< XIndexContainer > xSubContainer;
+
+ sal_uInt16 nNewItemId = nItemId++;
+ GetMenuItemAttributes( xPropSet, aLabel, aCommandURL, aHelpURL, xBitmap, xSubContainer );
- sal_uInt16 nNewItemId = nItemId++;
- GetMenuItemAttributes( xPropSet, aLabel, aCommandURL, aHelpURL, xBitmap, xSubContainer );
+ SolarMutexGuard aGuard;
+ {
+ // insert new menu item
+ sal_Int32 nIndex = aCommandURL.indexOf( aSlotURL );
+ if ( nIndex >= 0 )
+ {
+ // Special code for our menu implementation: some menu items don't have a
+ // command url but uses the item id as a unique identifier. These entries
+ // got a special url during conversion from menu=>actiontriggercontainer.
+ // Now we have to extract this special url and set the correct item id!!!
+ nNewItemId = static_cast<sal_uInt16>(aCommandURL.copy( nIndex+aSlotURL.getLength() ).toInt32());
+ pSubMenu->InsertItem( nNewItemId, aLabel );
+ }
+ else
+ {
+ pSubMenu->InsertItem( nNewItemId, aLabel );
+ pSubMenu->SetItemCommand( nNewItemId, aCommandURL );
+ }
- SolarMutexGuard aGuard;
+ // handle bitmap
+ if ( xBitmap.is() )
{
- // insert new menu item
- sal_Int32 nIndex = aCommandURL.indexOf( aSlotURL );
- if ( nIndex >= 0 )
- {
- // Special code for our menu implementation: some menu items don't have a
- // command url but uses the item id as a unique identifier. These entries
- // got a special url during conversion from menu=>actiontriggercontainer.
- // Now we have to extract this special url and set the correct item id!!!
- nNewItemId = static_cast<sal_uInt16>(aCommandURL.copy( nIndex+aSlotURL.getLength() ).toInt32());
- pSubMenu->InsertItem( nNewItemId, aLabel );
- }
- else
+ bool bImageSet = false;
+
+ Reference< XUnoTunnel > xUnoTunnel( xBitmap, UNO_QUERY );
+ if ( xUnoTunnel.is() )
{
- pSubMenu->InsertItem( nNewItemId, aLabel );
- pSubMenu->SetItemCommand( nNewItemId, aCommandURL );
+ // Try to get implementation pointer through XUnoTunnel
+ sal_Int64 nPointer = xUnoTunnel->getSomething( ImageWrapper::GetUnoTunnelId() );
+ if ( nPointer )
+ {
+ // This is our own optimized implementation of menu images!
+ ImageWrapper* pImageWrapper = reinterpret_cast< ImageWrapper * >( nPointer );
+ const Image& aMenuImage = pImageWrapper->GetImage();
+
+ if ( !!aMenuImage )
+ pSubMenu->SetItemImage( nNewItemId, aMenuImage );
+
+ bImageSet = true;
+ }
}
- // handle bitmap
- if ( xBitmap.is() )
+ if ( !bImageSet )
{
- bool bImageSet = false;
+ // This is an unknown implementation of a XBitmap interface. We have to
+ // use a more time consuming way to build an Image!
+ Image aImage;
+ BitmapEx aBitmap;
- Reference< XUnoTunnel > xUnoTunnel( xBitmap, UNO_QUERY );
- if ( xUnoTunnel.is() )
+ Sequence< sal_Int8 > aDIBSeq;
{
- // Try to get implementation pointer through XUnoTunnel
- sal_Int64 nPointer = xUnoTunnel->getSomething( ImageWrapper::GetUnoTunnelId() );
- if ( nPointer )
- {
- // This is our own optimized implementation of menu images!
- ImageWrapper* pImageWrapper = reinterpret_cast< ImageWrapper * >( nPointer );
- const Image& aMenuImage = pImageWrapper->GetImage();
-
- if ( !!aMenuImage )
- pSubMenu->SetItemImage( nNewItemId, aMenuImage );
-
- bImageSet = true;
- }
+ aDIBSeq = xBitmap->getDIB();
+ SvMemoryStream aMem( const_cast<sal_Int8 *>(aDIBSeq.getConstArray()), aDIBSeq.getLength(), StreamMode::READ );
+ ReadDIBBitmapEx(aBitmap, aMem);
}
- if ( !bImageSet )
+ aDIBSeq = xBitmap->getMaskDIB();
+ if ( aDIBSeq.hasElements() )
{
- // This is an unknown implementation of a XBitmap interface. We have to
- // use a more time consuming way to build an Image!
- Image aImage;
- BitmapEx aBitmap;
-
- Sequence< sal_Int8 > aDIBSeq;
- {
- aDIBSeq = xBitmap->getDIB();
- SvMemoryStream aMem( const_cast<sal_Int8 *>(aDIBSeq.getConstArray()), aDIBSeq.getLength(), StreamMode::READ );
- ReadDIBBitmapEx(aBitmap, aMem);
- }
-
- aDIBSeq = xBitmap->getMaskDIB();
- if ( aDIBSeq.hasElements() )
- {
- Bitmap aMaskBitmap;
- SvMemoryStream aMem( const_cast<sal_Int8 *>(aDIBSeq.getConstArray()), aDIBSeq.getLength(), StreamMode::READ );
- ReadDIB(aMaskBitmap, aMem, true);
- aImage = Image(BitmapEx(aBitmap.GetBitmap(), aMaskBitmap));
- }
- else
- aImage = Image( aBitmap );
-
- if ( !!aImage )
- pSubMenu->SetItemImage( nNewItemId, aImage );
+ Bitmap aMaskBitmap;
+ SvMemoryStream aMem( const_cast<sal_Int8 *>(aDIBSeq.getConstArray()), aDIBSeq.getLength(), StreamMode::READ );
+ ReadDIB(aMaskBitmap, aMem, true);
+ aImage = Image(BitmapEx(aBitmap.GetBitmap(), aMaskBitmap));
}
- }
- else
- {
- // Support add-on images for context menu interceptors
- Image aImage = aAddonOptions.GetImageFromURL( aCommandURL, false, true );
+ else
+ aImage = Image( aBitmap );
+
if ( !!aImage )
pSubMenu->SetItemImage( nNewItemId, aImage );
}
+ }
+ else
+ {
+ // Support add-on images for context menu interceptors
+ Image aImage = aAddonOptions.GetImageFromURL( aCommandURL, false, true );
+ if ( !!aImage )
+ pSubMenu->SetItemImage( nNewItemId, aImage );
+ }
- if ( xSubContainer.is() )
- {
- VclPtr<PopupMenu> pNewSubMenu = VclPtr<PopupMenu>::Create();
+ if ( xSubContainer.is() )
+ {
+ VclPtr<PopupMenu> pNewSubMenu = VclPtr<PopupMenu>::Create();
- // Sub menu (recursive call CreateSubMenu )
- InsertSubMenuItems( pNewSubMenu, nItemId, xSubContainer );
- pSubMenu->SetPopupMenu( nNewItemId, pNewSubMenu );
- }
+ // Sub menu (recursive call CreateSubMenu )
+ InsertSubMenuItems( pNewSubMenu, nItemId, xSubContainer );
+ pSubMenu->SetPopupMenu( nNewItemId, pNewSubMenu );
}
}
}
}
- catch (const IndexOutOfBoundsException&)
- {
- return;
- }
- catch (const WrappedTargetException&)
- {
- return;
- }
- catch (const RuntimeException&)
- {
- return;
- }
+ }
+ catch (const IndexOutOfBoundsException&)
+ {
+ return;
+ }
+ catch (const WrappedTargetException&)
+ {
+ return;
+ }
+ catch (const RuntimeException&)
+ {
+ return;
}
}
}
diff --git a/framework/source/fwe/xml/menudocumenthandler.cxx b/framework/source/fwe/xml/menudocumenthandler.cxx
index 144c6c600d22..a9bc60525af1 100644
--- a/framework/source/fwe/xml/menudocumenthandler.cxx
+++ b/framework/source/fwe/xml/menudocumenthandler.cxx
@@ -270,29 +270,29 @@ void SAL_CALL OReadMenuDocumentHandler::characters(const OUString&)
void SAL_CALL OReadMenuDocumentHandler::endElement( const OUString& aName )
{
- if ( m_eReaderMode != ReaderMode::None )
+ if ( m_eReaderMode == ReaderMode::None )
+ return;
+
+ --m_nElementDepth;
+ m_xReader->endElement( aName );
+ if ( 0 != m_nElementDepth )
+ return;
+
+ m_xReader->endDocument();
+ m_xReader.clear();
+ if ( m_eReaderMode == ReaderMode::MenuBar && aName != ELEMENT_MENUBAR )
{
- --m_nElementDepth;
- m_xReader->endElement( aName );
- if ( 0 == m_nElementDepth )
- {
- m_xReader->endDocument();
- m_xReader.clear();
- if ( m_eReaderMode == ReaderMode::MenuBar && aName != ELEMENT_MENUBAR )
- {
- OUString aErrorMessage = getErrorLineString() +
- "closing element menubar expected!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
- else if ( m_eReaderMode == ReaderMode::MenuPopup && aName != ELEMENT_MENUPOPUP )
- {
- OUString aErrorMessage = getErrorLineString() +
- "closing element menupopup expected!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
- m_eReaderMode = ReaderMode::None;
- }
+ OUString aErrorMessage = getErrorLineString() +
+ "closing element menubar expected!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
+ else if ( m_eReaderMode == ReaderMode::MenuPopup && aName != ELEMENT_MENUPOPUP )
+ {
+ OUString aErrorMessage = getErrorLineString() +
+ "closing element menupopup expected!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
+ }
+ m_eReaderMode = ReaderMode::None;
}
OReadMenuBarHandler::OReadMenuBarHandler(
@@ -410,24 +410,24 @@ void SAL_CALL OReadMenuBarHandler::characters(const OUString&)
void OReadMenuBarHandler::endElement( const OUString& aName )
{
- if ( m_bMenuMode )
+ if ( !m_bMenuMode )
+ return;
+
+ --m_nElementDepth;
+ if ( 0 == m_nElementDepth )
{
- --m_nElementDepth;
- if ( 0 == m_nElementDepth )
+ m_xReader->endDocument();
+ m_xReader.clear();
+ m_bMenuMode = false;
+ if ( aName != ELEMENT_MENU )
{
- m_xReader->endDocument();
- m_xReader.clear();
- m_bMenuMode = false;
- if ( aName != ELEMENT_MENU )
- {
- OUString aErrorMessage = getErrorLineString() +
- "closing element menu expected!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ OUString aErrorMessage = getErrorLineString() +
+ "closing element menu expected!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- else
- m_xReader->endElement( aName );
}
+ else
+ m_xReader->endElement( aName );
}
OReadMenuHandler::OReadMenuHandler(
@@ -481,24 +481,24 @@ void SAL_CALL OReadMenuHandler::characters(const OUString&)
void SAL_CALL OReadMenuHandler::endElement( const OUString& aName )
{
- if ( m_bMenuPopupMode )
+ if ( !m_bMenuPopupMode )
+ return;
+
+ --m_nElementDepth;
+ if ( 0 == m_nElementDepth )
{
- --m_nElementDepth;
- if ( 0 == m_nElementDepth )
+ m_xReader->endDocument();
+ m_xReader.clear();
+ m_bMenuPopupMode = false;
+ if ( aName != ELEMENT_MENUPOPUP )
{
- m_xReader->endDocument();
- m_xReader.clear();
- m_bMenuPopupMode = false;
- if ( aName != ELEMENT_MENUPOPUP )
- {
- OUString aErrorMessage = getErrorLineString() +
- "closing element menupopup expected!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ OUString aErrorMessage = getErrorLineString() +
+ "closing element menupopup expected!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- else
- m_xReader->endElement( aName );
}
+ else
+ m_xReader->endElement( aName );
}
OReadMenuPopupHandler::OReadMenuPopupHandler(
diff --git a/framework/source/fwe/xml/statusbardocumenthandler.cxx b/framework/source/fwe/xml/statusbardocumenthandler.cxx
index 43d6cc12e811..e9e6d0038ea1 100644
--- a/framework/source/fwe/xml/statusbardocumenthandler.cxx
+++ b/framework/source/fwe/xml/statusbardocumenthandler.cxx
@@ -202,202 +202,202 @@ void SAL_CALL OReadStatusBarDocumentHandler::startElement(
SolarMutexGuard g;
StatusBarHashMap::const_iterator pStatusBarEntry = m_aStatusBarMap.find( aName );
- if ( pStatusBarEntry != m_aStatusBarMap.end() )
+ if ( pStatusBarEntry == m_aStatusBarMap.end() )
+ return;
+
+ switch ( pStatusBarEntry->second )
{
- switch ( pStatusBarEntry->second )
+ case SB_ELEMENT_STATUSBAR:
{
- case SB_ELEMENT_STATUSBAR:
+ if ( m_bStatusBarStartFound )
{
- if ( m_bStatusBarStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "Element 'statusbar:statusbar' cannot be embedded into 'statusbar:statusbar'!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
-
- m_bStatusBarStartFound = true;
+ OUString aErrorMessage = getErrorLineString() + "Element 'statusbar:statusbar' cannot be embedded into 'statusbar:statusbar'!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
- case SB_ELEMENT_STATUSBARITEM:
+ m_bStatusBarStartFound = true;
+ }
+ break;
+
+ case SB_ELEMENT_STATUSBARITEM:
+ {
+ if ( !m_bStatusBarStartFound )
{
- if ( !m_bStatusBarStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "Element 'statusbar:statusbaritem' must be embedded into element 'statusbar:statusbar'!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ OUString aErrorMessage = getErrorLineString() + "Element 'statusbar:statusbaritem' must be embedded into element 'statusbar:statusbar'!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
+ }
- if ( m_bStatusBarItemStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "Element statusbar:statusbaritem is not a container!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ if ( m_bStatusBarItemStartFound )
+ {
+ OUString aErrorMessage = getErrorLineString() + "Element statusbar:statusbaritem is not a container!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
+ }
- OUString aCommandURL;
- OUString aHelpURL;
- sal_Int16 nItemBits( ItemStyle::ALIGN_CENTER|ItemStyle::DRAW_IN3D|ItemStyle::MANDATORY );
- sal_Int16 nWidth( 0 );
- sal_Int16 nOffset( STATUSBAR_OFFSET );
- bool bCommandURL( false );
+ OUString aCommandURL;
+ OUString aHelpURL;
+ sal_Int16 nItemBits( ItemStyle::ALIGN_CENTER|ItemStyle::DRAW_IN3D|ItemStyle::MANDATORY );
+ sal_Int16 nWidth( 0 );
+ sal_Int16 nOffset( STATUSBAR_OFFSET );
+ bool bCommandURL( false );
- m_bStatusBarItemStartFound = true;
- for ( sal_Int16 n = 0; n < xAttribs->getLength(); n++ )
+ m_bStatusBarItemStartFound = true;
+ for ( sal_Int16 n = 0; n < xAttribs->getLength(); n++ )
+ {
+ pStatusBarEntry = m_aStatusBarMap.find( xAttribs->getNameByIndex( n ) );
+ if ( pStatusBarEntry != m_aStatusBarMap.end() )
{
- pStatusBarEntry = m_aStatusBarMap.find( xAttribs->getNameByIndex( n ) );
- if ( pStatusBarEntry != m_aStatusBarMap.end() )
+ switch ( pStatusBarEntry->second )
{
- switch ( pStatusBarEntry->second )
+ case SB_ATTRIBUTE_URL:
{
- case SB_ATTRIBUTE_URL:
+ bCommandURL = true;
+ aCommandURL = xAttribs->getValueByIndex( n );
+ }
+ break;
+
+ case SB_ATTRIBUTE_ALIGN:
+ {
+ if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_ALIGN_LEFT )
{
- bCommandURL = true;
- aCommandURL = xAttribs->getValueByIndex( n );
+ nItemBits |= ItemStyle::ALIGN_LEFT;
+ nItemBits &= ~ItemStyle::ALIGN_CENTER;
}
- break;
-
- case SB_ATTRIBUTE_ALIGN:
+ else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_ALIGN_CENTER )
{
- if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_ALIGN_LEFT )
- {
- nItemBits |= ItemStyle::ALIGN_LEFT;
- nItemBits &= ~ItemStyle::ALIGN_CENTER;
- }
- else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_ALIGN_CENTER )
- {
- nItemBits |= ItemStyle::ALIGN_CENTER;
- nItemBits &= ~ItemStyle::ALIGN_LEFT;
- }
- else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_ALIGN_RIGHT )
- {
- nItemBits |= ItemStyle::ALIGN_RIGHT;
- }
- else
- {
- OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:align must have one value of 'left','right' or 'center'!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ nItemBits |= ItemStyle::ALIGN_CENTER;
+ nItemBits &= ~ItemStyle::ALIGN_LEFT;
}
- break;
-
- case SB_ATTRIBUTE_STYLE:
+ else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_ALIGN_RIGHT )
{
- if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_STYLE_IN )
- {
- nItemBits |= ItemStyle::DRAW_IN3D;
- nItemBits &= ~ItemStyle::DRAW_OUT3D;
- }
- else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_STYLE_OUT )
- {
- nItemBits |= ItemStyle::DRAW_OUT3D;
- nItemBits &= ~ItemStyle::DRAW_IN3D;
- }
- else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_STYLE_FLAT )
- {
- nItemBits |= ItemStyle::DRAW_FLAT;
- }
- else
- {
- OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:autosize must have value 'true' or 'false'!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ nItemBits |= ItemStyle::ALIGN_RIGHT;
}
- break;
-
- case SB_ATTRIBUTE_AUTOSIZE:
+ else
{
- if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_TRUE )
- nItemBits |= ItemStyle::AUTO_SIZE;
- else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_FALSE )
- nItemBits &= ~ItemStyle::AUTO_SIZE;
- else
- {
- OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:autosize must have value 'true' or 'false'!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:align must have one value of 'left','right' or 'center'!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
+ }
+ break;
- case SB_ATTRIBUTE_OWNERDRAW:
+ case SB_ATTRIBUTE_STYLE:
+ {
+ if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_STYLE_IN )
{
- if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_TRUE )
- nItemBits |= ItemStyle::OWNER_DRAW;
- else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_FALSE )
- nItemBits &= ~ItemStyle::OWNER_DRAW;
- else
- {
- OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:ownerdraw must have value 'true' or 'false'!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ nItemBits |= ItemStyle::DRAW_IN3D;
+ nItemBits &= ~ItemStyle::DRAW_OUT3D;
}
- break;
-
- case SB_ATTRIBUTE_WIDTH:
+ else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_STYLE_OUT )
{
- nWidth = static_cast<sal_Int16>(xAttribs->getValueByIndex( n ).toInt32());
+ nItemBits |= ItemStyle::DRAW_OUT3D;
+ nItemBits &= ~ItemStyle::DRAW_IN3D;
}
- break;
-
- case SB_ATTRIBUTE_OFFSET:
+ else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_STYLE_FLAT )
{
- nOffset = static_cast<sal_Int16>(xAttribs->getValueByIndex( n ).toInt32());
+ nItemBits |= ItemStyle::DRAW_FLAT;
}
- break;
+ else
+ {
+ OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:autosize must have value 'true' or 'false'!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
+ }
+ }
+ break;
- case SB_ATTRIBUTE_HELPURL:
+ case SB_ATTRIBUTE_AUTOSIZE:
+ {
+ if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_TRUE )
+ nItemBits |= ItemStyle::AUTO_SIZE;
+ else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_FALSE )
+ nItemBits &= ~ItemStyle::AUTO_SIZE;
+ else
{
- aHelpURL = xAttribs->getValueByIndex( n );
+ OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:autosize must have value 'true' or 'false'!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
+ }
+ break;
- case SB_ATTRIBUTE_MANDATORY:
+ case SB_ATTRIBUTE_OWNERDRAW:
+ {
+ if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_TRUE )
+ nItemBits |= ItemStyle::OWNER_DRAW;
+ else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_FALSE )
+ nItemBits &= ~ItemStyle::OWNER_DRAW;
+ else
{
- if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_TRUE )
- nItemBits |= ItemStyle::MANDATORY;
- else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_FALSE )
- nItemBits &= ~ItemStyle::MANDATORY;
- else
- {
- OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:mandatory must have value 'true' or 'false'!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:ownerdraw must have value 'true' or 'false'!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
+ }
+ break;
- default:
- break;
+ case SB_ATTRIBUTE_WIDTH:
+ {
+ nWidth = static_cast<sal_Int16>(xAttribs->getValueByIndex( n ).toInt32());
}
- }
- } // for
+ break;
- if ( !bCommandURL )
- {
- OUString aErrorMessage = getErrorLineString() + "Required attribute statusbar:url must have a value!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
+ case SB_ATTRIBUTE_OFFSET:
+ {
+ nOffset = static_cast<sal_Int16>(xAttribs->getValueByIndex( n ).toInt32());
+ }
+ break;
+
+ case SB_ATTRIBUTE_HELPURL:
+ {
+ aHelpURL = xAttribs->getValueByIndex( n );
+ }
+ break;
+
+ case SB_ATTRIBUTE_MANDATORY:
+ {
+ if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_TRUE )
+ nItemBits |= ItemStyle::MANDATORY;
+ else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_FALSE )
+ nItemBits &= ~ItemStyle::MANDATORY;
+ else
+ {
+ OUString aErrorMessage = getErrorLineString() + "Attribute statusbar:mandatory must have value 'true' or 'false'!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
}
- else
- {
- Sequence< PropertyValue > aStatusbarItemProp( 6 );
- aStatusbarItemProp[0].Name = ITEM_DESCRIPTOR_COMMANDURL;
- aStatusbarItemProp[1].Name = ITEM_DESCRIPTOR_HELPURL;
- aStatusbarItemProp[2].Name = ITEM_DESCRIPTOR_OFFSET;
- aStatusbarItemProp[3].Name = ITEM_DESCRIPTOR_STYLE;
- aStatusbarItemProp[4].Name = ITEM_DESCRIPTOR_WIDTH;
- aStatusbarItemProp[5].Name = ITEM_DESCRIPTOR_TYPE;
-
- aStatusbarItemProp[0].Value <<= aCommandURL;
- aStatusbarItemProp[1].Value <<= aHelpURL;
- aStatusbarItemProp[2].Value <<= nOffset;
- aStatusbarItemProp[3].Value <<= nItemBits;
- aStatusbarItemProp[4].Value <<= nWidth;
- aStatusbarItemProp[5].Value <<= css::ui::ItemType::DEFAULT;
-
- m_aStatusBarItems->insertByIndex( m_aStatusBarItems->getCount(), makeAny( aStatusbarItemProp ) );
- }
- }
- break;
+ } // for
- default:
- break;
+ if ( !bCommandURL )
+ {
+ OUString aErrorMessage = getErrorLineString() + "Required attribute statusbar:url must have a value!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
+ }
+ else
+ {
+ Sequence< PropertyValue > aStatusbarItemProp( 6 );
+ aStatusbarItemProp[0].Name = ITEM_DESCRIPTOR_COMMANDURL;
+ aStatusbarItemProp[1].Name = ITEM_DESCRIPTOR_HELPURL;
+ aStatusbarItemProp[2].Name = ITEM_DESCRIPTOR_OFFSET;
+ aStatusbarItemProp[3].Name = ITEM_DESCRIPTOR_STYLE;
+ aStatusbarItemProp[4].Name = ITEM_DESCRIPTOR_WIDTH;
+ aStatusbarItemProp[5].Name = ITEM_DESCRIPTOR_TYPE;
+
+ aStatusbarItemProp[0].Value <<= aCommandURL;
+ aStatusbarItemProp[1].Value <<= aHelpURL;
+ aStatusbarItemProp[2].Value <<= nOffset;
+ aStatusbarItemProp[3].Value <<= nItemBits;
+ aStatusbarItemProp[4].Value <<= nWidth;
+ aStatusbarItemProp[5].Value <<= css::ui::ItemType::DEFAULT;
+
+ m_aStatusBarItems->insertByIndex( m_aStatusBarItems->getCount(), makeAny( aStatusbarItemProp ) );
+ }
}
+ break;
+
+ default:
+ break;
}
}
@@ -406,37 +406,36 @@ void SAL_CALL OReadStatusBarDocumentHandler::endElement(const OUString& aName)
SolarMutexGuard g;
StatusBarHashMap::const_iterator pStatusBarEntry = m_aStatusBarMap.find( aName );
- if ( pStatusBarEntry != m_aStatusBarMap.end() )
+ if ( pStatusBarEntry == m_aStatusBarMap.end() )
+ return;
+
+ switch ( pStatusBarEntry->second )
{
- switch ( pStatusBarEntry->second )
+ case SB_ELEMENT_STATUSBAR:
{
- case SB_ELEMENT_STATUSBAR:
+ if ( !m_bStatusBarStartFound )
{
- if ( !m_bStatusBarStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "End element 'statusbar' found, but no start element 'statusbar'";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
-
- m_bStatusBarStartFound = false;
+ OUString aErrorMessage = getErrorLineString() + "End element 'statusbar' found, but no start element 'statusbar'";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
- case SB_ELEMENT_STATUSBARITEM:
- {
- if ( !m_bStatusBarItemStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "End element 'statusbar:statusbaritem' found, but no start element 'statusbar:statusbaritem'";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ m_bStatusBarStartFound = false;
+ }
+ break;
- m_bStatusBarItemStartFound = false;
+ case SB_ELEMENT_STATUSBARITEM:
+ {
+ if ( !m_bStatusBarItemStartFound )
+ {
+ OUString aErrorMessage = getErrorLineString() + "End element 'statusbar:statusbaritem' found, but no start element 'statusbar:statusbaritem'";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
- default:
- break;
+ m_bStatusBarItemStartFound = false;
}
+ break;
+
+ default: break;
}
}
diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx
index a01e0fc649cf..1027d18af4b8 100644
--- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx
+++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx
@@ -196,273 +196,273 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement(
SolarMutexGuard g;
ToolBoxHashMap::const_iterator pToolBoxEntry = m_aToolBoxMap.find( aName );
- if ( pToolBoxEntry != m_aToolBoxMap.end() )
+ if ( pToolBoxEntry == m_aToolBoxMap.end() )
+ return;
+
+ switch ( pToolBoxEntry->second )
{
- switch ( pToolBoxEntry->second )
+ case TB_ELEMENT_TOOLBAR:
{
- case TB_ELEMENT_TOOLBAR:
+ if ( m_bToolBarStartFound )
{
- if ( m_bToolBarStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "Element 'toolbar:toolbar' cannot be embedded into 'toolbar:toolbar'!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
- else
+ OUString aErrorMessage = getErrorLineString() + "Element 'toolbar:toolbar' cannot be embedded into 'toolbar:toolbar'!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
+ }
+ else
+ {
+ // Check if we have a UI name set in our XML file
+ OUString aUIName;
+ for ( sal_Int16 n = 0; n < xAttribs->getLength(); n++ )
{
- // Check if we have a UI name set in our XML file
- OUString aUIName;
- for ( sal_Int16 n = 0; n < xAttribs->getLength(); n++ )
+ pToolBoxEntry = m_aToolBoxMap.find( xAttribs->getNameByIndex( n ) );
+ if ( pToolBoxEntry != m_aToolBoxMap.end() )
{
- pToolBoxEntry = m_aToolBoxMap.find( xAttribs->getNameByIndex( n ) );
- if ( pToolBoxEntry != m_aToolBoxMap.end() )
+ switch ( pToolBoxEntry->second )
{
- switch ( pToolBoxEntry->second )
- {
- case TB_ATTRIBUTE_UINAME:
- aUIName = xAttribs->getValueByIndex( n );
- break;
- default:
- break;
- }
+ case TB_ATTRIBUTE_UINAME:
+ aUIName = xAttribs->getValueByIndex( n );
+ break;
+ default:
+ break;
}
}
- if ( !aUIName.isEmpty() )
+ }
+ if ( !aUIName.isEmpty() )
+ {
+ // Try to set UI name as a container property
+ Reference< XPropertySet > xPropSet( m_rItemContainer, UNO_QUERY );
+ if ( xPropSet.is() )
{
- // Try to set UI name as a container property
- Reference< XPropertySet > xPropSet( m_rItemContainer, UNO_QUERY );
- if ( xPropSet.is() )
+ try
+ {
+ xPropSet->setPropertyValue("UIName", makeAny( aUIName ) );
+ }
+ catch ( const UnknownPropertyException& )
{
- try
- {
- xPropSet->setPropertyValue("UIName", makeAny( aUIName ) );
- }
- catch ( const UnknownPropertyException& )
- {
- }
}
-
}
+
}
- m_bToolBarStartFound = true;
}
- break;
+ m_bToolBarStartFound = true;
+ }
+ break;
- case TB_ELEMENT_TOOLBARITEM:
+ case TB_ELEMENT_TOOLBARITEM:
+ {
+ if ( !m_bToolBarStartFound )
{
- if ( !m_bToolBarStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "Element 'toolbar:toolbaritem' must be embedded into element 'toolbar:toolbar'!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ OUString aErrorMessage = getErrorLineString() + "Element 'toolbar:toolbaritem' must be embedded into element 'toolbar:toolbar'!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
+ }
- if ( m_bToolBarSeparatorStartFound ||
- m_bToolBarBreakStartFound ||
- m_bToolBarSpaceStartFound ||
- m_bToolBarItemStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "Element toolbar:toolbaritem is not a container!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ if ( m_bToolBarSeparatorStartFound ||
+ m_bToolBarBreakStartFound ||
+ m_bToolBarSpaceStartFound ||
+ m_bToolBarItemStartFound )
+ {
+ OUString aErrorMessage = getErrorLineString() + "Element toolbar:toolbaritem is not a container!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
+ }
- bool bAttributeURL = false;
+ bool bAttributeURL = false;
- m_bToolBarItemStartFound = true;
- OUString aLabel;
- OUString aCommandURL;
- sal_uInt16 nItemBits( 0 );
- bool bVisible( true );
+ m_bToolBarItemStartFound = true;
+ OUString aLabel;
+ OUString aCommandURL;
+ sal_uInt16 nItemBits( 0 );
+ bool bVisible( true );
- for ( sal_Int16 n = 0; n < xAttribs->getLength(); n++ )
+ for ( sal_Int16 n = 0; n < xAttribs->getLength(); n++ )
+ {
+ pToolBoxEntry = m_aToolBoxMap.find( xAttribs->getNameByIndex( n ) );
+ if ( pToolBoxEntry != m_aToolBoxMap.end() )
{
- pToolBoxEntry = m_aToolBoxMap.find( xAttribs->getNameByIndex( n ) );
- if ( pToolBoxEntry != m_aToolBoxMap.end() )
+ switch ( pToolBoxEntry->second )
{
- switch ( pToolBoxEntry->second )
+ case TB_ATTRIBUTE_TEXT:
{
- case TB_ATTRIBUTE_TEXT:
- {
- aLabel = xAttribs->getValueByIndex( n );
- }
- break;
+ aLabel = xAttribs->getValueByIndex( n );
+ }
+ break;
- case TB_ATTRIBUTE_URL:
- {
- bAttributeURL = true;
- aCommandURL = xAttribs->getValueByIndex( n ).intern();
- }
- break;
+ case TB_ATTRIBUTE_URL:
+ {
+ bAttributeURL = true;
+ aCommandURL = xAttribs->getValueByIndex( n ).intern();
+ }
+ break;
- case TB_ATTRIBUTE_VISIBLE:
+ case TB_ATTRIBUTE_VISIBLE:
+ {
+ if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_TRUE )
+ bVisible = true;
+ else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_FALSE )
+ bVisible = false;
+ else
{
- if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_TRUE )
- bVisible = true;
- else if ( xAttribs->getValueByIndex( n ) == ATTRIBUTE_BOOLEAN_FALSE )
- bVisible = false;
- else
- {
- OUString aErrorMessage = getErrorLineString() + "Attribute toolbar:visible must have value 'true' or 'false'!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ OUString aErrorMessage = getErrorLineString() + "Attribute toolbar:visible must have value 'true' or 'false'!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
+ }
+ break;
- case TB_ATTRIBUTE_STYLE:
- {
- // read space separated item style list
- OUString aTemp = xAttribs->getValueByIndex( n );
- sal_Int32 nIndex = 0;
+ case TB_ATTRIBUTE_STYLE:
+ {
+ // read space separated item style list
+ OUString aTemp = xAttribs->getValueByIndex( n );
+ sal_Int32 nIndex = 0;
- do
+ do
+ {
+ OUString aToken = aTemp.getToken( 0, ' ', nIndex );
+ if ( !aToken.isEmpty() )
{
- OUString aToken = aTemp.getToken( 0, ' ', nIndex );
- if ( !aToken.isEmpty() )
- {
- sal_Int32 nHashCode = aToken.hashCode();
- if ( nHashCode == m_nHashCode_Style_Radio )
- nItemBits |= css::ui::ItemStyle::RADIO_CHECK;
- else if ( nHashCode == m_nHashCode_Style_Left )
- nItemBits |= css::ui::ItemStyle::ALIGN_LEFT;
- else if ( nHashCode == m_nHashCode_Style_AutoSize )
- nItemBits |= css::ui::ItemStyle::AUTO_SIZE;
- else if ( nHashCode == m_nHashCode_Style_Repeat )
- nItemBits |= css::ui::ItemStyle::REPEAT;
- else if ( nHashCode == m_nHashCode_Style_DropDownOnly )
- nItemBits |= css::ui::ItemStyle::DROPDOWN_ONLY;
- else if ( nHashCode == m_nHashCode_Style_DropDown )
- nItemBits |= css::ui::ItemStyle::DROP_DOWN;
- else if ( nHashCode == m_nHashCode_Style_Text )
- nItemBits |= css::ui::ItemStyle::TEXT;
- else if ( nHashCode == m_nHashCode_Style_Image )
- nItemBits |= css::ui::ItemStyle::ICON;
- }
+ sal_Int32 nHashCode = aToken.hashCode();
+ if ( nHashCode == m_nHashCode_Style_Radio )
+ nItemBits |= css::ui::ItemStyle::RADIO_CHECK;
+ else if ( nHashCode == m_nHashCode_Style_Left )
+ nItemBits |= css::ui::ItemStyle::ALIGN_LEFT;
+ else if ( nHashCode == m_nHashCode_Style_AutoSize )
+ nItemBits |= css::ui::ItemStyle::AUTO_SIZE;
+ else if ( nHashCode == m_nHashCode_Style_Repeat )
+ nItemBits |= css::ui::ItemStyle::REPEAT;
+ else if ( nHashCode == m_nHashCode_Style_DropDownOnly )
+ nItemBits |= css::ui::ItemStyle::DROPDOWN_ONLY;
+ else if ( nHashCode == m_nHashCode_Style_DropDown )
+ nItemBits |= css::ui::ItemStyle::DROP_DOWN;
+ else if ( nHashCode == m_nHashCode_Style_Text )
+ nItemBits |= css::ui::ItemStyle::TEXT;
+ else if ( nHashCode == m_nHashCode_Style_Image )
+ nItemBits |= css::ui::ItemStyle::ICON;
}
- while ( nIndex >= 0 );
}
- break;
-
- default:
- break;
+ while ( nIndex >= 0 );
}
- }
- } // for
+ break;
- if ( !bAttributeURL )
- {
- OUString aErrorMessage = getErrorLineString() + "Required attribute toolbar:url must have a value!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
-
- if ( !aCommandURL.isEmpty() )
- {
- //fix for fdo#39370
- /// check whether RTL interface or not
- if(AllSettings::GetLayoutRTL()){
- if (aCommandURL == ".uno:ParaLeftToRight")
- aCommandURL = ".uno:ParaRightToLeft";
- else if (aCommandURL == ".uno:ParaRightToLeft")
- aCommandURL = ".uno:ParaLeftToRight";
- else if (aCommandURL == ".uno:LeftPara")
- aCommandURL = ".uno:RightPara";
- else if (aCommandURL == ".uno:RightPara")
- aCommandURL = ".uno:LeftPara";
- else if (aCommandURL == ".uno:AlignLeft")
- aCommandURL = ".uno:AlignRight";
- else if (aCommandURL == ".uno:AlignRight")
- aCommandURL = ".uno:AlignLeft";
- else if (aCommandURL == ".uno:WrapLeft")
- aCommandURL = ".uno:WrapRight";
- else if (aCommandURL == ".uno:WrapRight")
- aCommandURL = ".uno:WrapLeft";
+ default:
+ break;
}
-
- auto aToolbarItemProp( comphelper::InitPropertySequence( {
- { m_aCommandURL, css::uno::makeAny( aCommandURL ) },
- { m_aLabel, css::uno::makeAny( aLabel ) },
- { m_aType, css::uno::makeAny( css::ui::ItemType::DEFAULT ) },
- { m_aStyle, css::uno::makeAny( nItemBits ) },
- { m_aIsVisible, css::uno::makeAny( bVisible ) },
- } ) );
-
- m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), makeAny( aToolbarItemProp ) );
}
+ } // for
+
+ if ( !bAttributeURL )
+ {
+ OUString aErrorMessage = getErrorLineString() + "Required attribute toolbar:url must have a value!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
- case TB_ELEMENT_TOOLBARSPACE:
+ if ( !aCommandURL.isEmpty() )
{
- if ( m_bToolBarSeparatorStartFound ||
- m_bToolBarBreakStartFound ||
- m_bToolBarSpaceStartFound ||
- m_bToolBarItemStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "Element toolbar:toolbarspace is not a container!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
+ //fix for fdo#39370
+ /// check whether RTL interface or not
+ if(AllSettings::GetLayoutRTL()){
+ if (aCommandURL == ".uno:ParaLeftToRight")
+ aCommandURL = ".uno:ParaRightToLeft";
+ else if (aCommandURL == ".uno:ParaRightToLeft")
+ aCommandURL = ".uno:ParaLeftToRight";
+ else if (aCommandURL == ".uno:LeftPara")
+ aCommandURL = ".uno:RightPara";
+ else if (aCommandURL == ".uno:RightPara")
+ aCommandURL = ".uno:LeftPara";
+ else if (aCommandURL == ".uno:AlignLeft")
+ aCommandURL = ".uno:AlignRight";
+ else if (aCommandURL == ".uno:AlignRight")
+ aCommandURL = ".uno:AlignLeft";
+ else if (aCommandURL == ".uno:WrapLeft")
+ aCommandURL = ".uno:WrapRight";
+ else if (aCommandURL == ".uno:WrapRight")
+ aCommandURL = ".uno:WrapLeft";
}
- m_bToolBarSpaceStartFound = true;
-
- Sequence< PropertyValue > aToolbarItemProp( 2 );
- aToolbarItemProp[0].Name = m_aCommandURL;
- aToolbarItemProp[1].Name = m_aType;
-
- aToolbarItemProp[0].Value <<= OUString();
- aToolbarItemProp[1].Value <<= css::ui::ItemType::SEPARATOR_SPACE;
+ auto aToolbarItemProp( comphelper::InitPropertySequence( {
+ { m_aCommandURL, css::uno::makeAny( aCommandURL ) },
+ { m_aLabel, css::uno::makeAny( aLabel ) },
+ { m_aType, css::uno::makeAny( css::ui::ItemType::DEFAULT ) },
+ { m_aStyle, css::uno::makeAny( nItemBits ) },
+ { m_aIsVisible, css::uno::makeAny( bVisible ) },
+ } ) );
m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), makeAny( aToolbarItemProp ) );
}
- break;
+ }
+ break;
- case TB_ELEMENT_TOOLBARBREAK:
+ case TB_ELEMENT_TOOLBARSPACE:
+ {
+ if ( m_bToolBarSeparatorStartFound ||
+ m_bToolBarBreakStartFound ||
+ m_bToolBarSpaceStartFound ||
+ m_bToolBarItemStartFound )
{
- if ( m_bToolBarSeparatorStartFound ||
- m_bToolBarBreakStartFound ||
- m_bToolBarSpaceStartFound ||
- m_bToolBarItemStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "Element toolbar:toolbarbreak is not a container!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ OUString aErrorMessage = getErrorLineString() + "Element toolbar:toolbarspace is not a container!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
+ }
- m_bToolBarBreakStartFound = true;
+ m_bToolBarSpaceStartFound = true;
- Sequence< PropertyValue > aToolbarItemProp( 2 );
- aToolbarItemProp[0].Name = m_aCommandURL;
- aToolbarItemProp[1].Name = m_aType;
+ Sequence< PropertyValue > aToolbarItemProp( 2 );
+ aToolbarItemProp[0].Name = m_aCommandURL;
+ aToolbarItemProp[1].Name = m_aType;
- aToolbarItemProp[0].Value <<= OUString();
- aToolbarItemProp[1].Value <<= css::ui::ItemType::SEPARATOR_LINEBREAK;
+ aToolbarItemProp[0].Value <<= OUString();
+ aToolbarItemProp[1].Value <<= css::ui::ItemType::SEPARATOR_SPACE;
- m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), makeAny( aToolbarItemProp ) );
- }
- break;
+ m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), makeAny( aToolbarItemProp ) );
+ }
+ break;
- case TB_ELEMENT_TOOLBARSEPARATOR:
+ case TB_ELEMENT_TOOLBARBREAK:
+ {
+ if ( m_bToolBarSeparatorStartFound ||
+ m_bToolBarBreakStartFound ||
+ m_bToolBarSpaceStartFound ||
+ m_bToolBarItemStartFound )
{
- if ( m_bToolBarSeparatorStartFound ||
- m_bToolBarBreakStartFound ||
- m_bToolBarSpaceStartFound ||
- m_bToolBarItemStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "Element toolbar:toolbarseparator is not a container!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ OUString aErrorMessage = getErrorLineString() + "Element toolbar:toolbarbreak is not a container!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
+ }
- m_bToolBarSeparatorStartFound = true;
+ m_bToolBarBreakStartFound = true;
- Sequence< PropertyValue > aToolbarItemProp( 2 );
- aToolbarItemProp[0].Name = m_aCommandURL;
- aToolbarItemProp[1].Name = m_aType;
+ Sequence< PropertyValue > aToolbarItemProp( 2 );
+ aToolbarItemProp[0].Name = m_aCommandURL;
+ aToolbarItemProp[1].Name = m_aType;
- aToolbarItemProp[0].Value <<= OUString();
- aToolbarItemProp[1].Value <<= css::ui::ItemType::SEPARATOR_LINE;
+ aToolbarItemProp[0].Value <<= OUString();
+ aToolbarItemProp[1].Value <<= css::ui::ItemType::SEPARATOR_LINEBREAK;
- m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), makeAny( aToolbarItemProp ) );
+ m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), makeAny( aToolbarItemProp ) );
+ }
+ break;
+
+ case TB_ELEMENT_TOOLBARSEPARATOR:
+ {
+ if ( m_bToolBarSeparatorStartFound ||
+ m_bToolBarBreakStartFound ||
+ m_bToolBarSpaceStartFound ||
+ m_bToolBarItemStartFound )
+ {
+ OUString aErrorMessage = getErrorLineString() + "Element toolbar:toolbarseparator is not a container!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
- default:
- break;
+ m_bToolBarSeparatorStartFound = true;
+
+ Sequence< PropertyValue > aToolbarItemProp( 2 );
+ aToolbarItemProp[0].Name = m_aCommandURL;
+ aToolbarItemProp[1].Name = m_aType;
+
+ aToolbarItemProp[0].Value <<= OUString();
+ aToolbarItemProp[1].Value <<= css::ui::ItemType::SEPARATOR_LINE;
+
+ m_rItemContainer->insertByIndex( m_rItemContainer->getCount(), makeAny( aToolbarItemProp ) );
}
+ break;
+
+ default:
+ break;
}
}
@@ -471,73 +471,72 @@ void SAL_CALL OReadToolBoxDocumentHandler::endElement(const OUString& aName)
SolarMutexGuard g;
ToolBoxHashMap::const_iterator pToolBoxEntry = m_aToolBoxMap.find( aName );
- if ( pToolBoxEntry != m_aToolBoxMap.end() )
+ if ( pToolBoxEntry == m_aToolBoxMap.end() )
+ return;
+
+ switch ( pToolBoxEntry->second )
{
- switch ( pToolBoxEntry->second )
+ case TB_ELEMENT_TOOLBAR:
{
- case TB_ELEMENT_TOOLBAR:
+ if ( !m_bToolBarStartFound )
{
- if ( !m_bToolBarStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "End element 'toolbar' found, but no start element 'toolbar'";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
-
- m_bToolBarStartFound = false;
+ OUString aErrorMessage = getErrorLineString() + "End element 'toolbar' found, but no start element 'toolbar'";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
- case TB_ELEMENT_TOOLBARITEM:
- {
- if ( !m_bToolBarItemStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "End element 'toolbar:toolbaritem' found, but no start element 'toolbar:toolbaritem'";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ m_bToolBarStartFound = false;
+ }
+ break;
- m_bToolBarItemStartFound = false;
+ case TB_ELEMENT_TOOLBARITEM:
+ {
+ if ( !m_bToolBarItemStartFound )
+ {
+ OUString aErrorMessage = getErrorLineString() + "End element 'toolbar:toolbaritem' found, but no start element 'toolbar:toolbaritem'";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
- case TB_ELEMENT_TOOLBARBREAK:
- {
- if ( !m_bToolBarBreakStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "End element 'toolbar:toolbarbreak' found, but no start element 'toolbar:toolbarbreak'";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ m_bToolBarItemStartFound = false;
+ }
+ break;
- m_bToolBarBreakStartFound = false;
+ case TB_ELEMENT_TOOLBARBREAK:
+ {
+ if ( !m_bToolBarBreakStartFound )
+ {
+ OUString aErrorMessage = getErrorLineString() + "End element 'toolbar:toolbarbreak' found, but no start element 'toolbar:toolbarbreak'";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
- case TB_ELEMENT_TOOLBARSPACE:
- {
- if ( !m_bToolBarSpaceStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "End element 'toolbar:toolbarspace' found, but no start element 'toolbar:toolbarspace'";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ m_bToolBarBreakStartFound = false;
+ }
+ break;
- m_bToolBarSpaceStartFound = false;
+ case TB_ELEMENT_TOOLBARSPACE:
+ {
+ if ( !m_bToolBarSpaceStartFound )
+ {
+ OUString aErrorMessage = getErrorLineString() + "End element 'toolbar:toolbarspace' found, but no start element 'toolbar:toolbarspace'";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
- case TB_ELEMENT_TOOLBARSEPARATOR:
- {
- if ( !m_bToolBarSeparatorStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "End element 'toolbar:toolbarseparator' found, but no start element 'toolbar:toolbarseparator'";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ m_bToolBarSpaceStartFound = false;
+ }
+ break;
- m_bToolBarSeparatorStartFound = false;
+ case TB_ELEMENT_TOOLBARSEPARATOR:
+ {
+ if ( !m_bToolBarSeparatorStartFound )
+ {
+ OUString aErrorMessage = getErrorLineString() + "End element 'toolbar:toolbarseparator' found, but no start element 'toolbar:toolbarseparator'";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
- default:
- break;
+ m_bToolBarSeparatorStartFound = false;
}
+ break;
+
+ default: break;
}
}
diff --git a/framework/source/fwi/helper/mischelper.cxx b/framework/source/fwi/helper/mischelper.cxx
index a8a841295767..75e560e7a975 100644
--- a/framework/source/fwi/helper/mischelper.cxx
+++ b/framework/source/fwi/helper/mischelper.cxx
@@ -119,19 +119,19 @@ void FillLangItems( std::set< OUString > &rLangItems,
COMPLEX: 0x004
*/
const sal_Int16 nMaxCount = 7;
- if ( xDocumentLanguages.is() )
+ if ( !xDocumentLanguages.is() )
+ return;
+
+ Sequence< Locale > rLocales( xDocumentLanguages->getDocumentLanguages( static_cast<sal_Int16>(nScriptType), nMaxCount ));
+ if ( rLocales.hasElements() )
{
- Sequence< Locale > rLocales( xDocumentLanguages->getDocumentLanguages( static_cast<sal_Int16>(nScriptType), nMaxCount ));
- if ( rLocales.hasElements() )
+ for ( sal_Int32 i = 0; i < rLocales.getLength(); ++i )
{
- for ( sal_Int32 i = 0; i < rLocales.getLength(); ++i )
- {
- if ( rLangItems.size() == static_cast< size_t >(nMaxCount) )
- break;
- const Locale& rLocale=rLocales[i];
- if( IsScriptTypeMatchingToLanguage( nScriptType, SvtLanguageTable::GetLanguageType( rLocale.Language )))
- rLangItems.insert( rLocale.Language );
- }
+ if ( rLangItems.size() == static_cast< size_t >(nMaxCount) )
+ break;
+ const Locale& rLocale=rLocales[i];
+ if( IsScriptTypeMatchingToLanguage( nScriptType, SvtLanguageTable::GetLanguageType( rLocale.Language )))
+ rLangItems.insert( rLocale.Language );
}
}
}
diff --git a/framework/source/fwi/jobs/configaccess.cxx b/framework/source/fwi/jobs/configaccess.cxx
index 2cb736d4bb65..bcb739c09cdb 100644
--- a/framework/source/fwi/jobs/configaccess.cxx
+++ b/framework/source/fwi/jobs/configaccess.cxx
@@ -91,45 +91,42 @@ void ConfigAccess::open( /*IN*/ EOpenMode eMode )
// check if configuration is already open in the right mode.
// By the way: Don't allow closing by using this method!
- if (
- (eMode !=E_CLOSED) &&
- (m_eMode!=eMode )
- )
+ if ( eMode == E_CLOSED || m_eMode == eMode )
+ return;
+
+ // We have to close the old access point without any question here.
+ // It will be open again using the new mode.
+ // can be called without checks! It does the checks by itself ...
+ // e.g. for already closed or not opened configuration.
+ // Flushing of all made changes will be done here too.
+ close();
+
+ // create the configuration provider, which provides sub access points
+ css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider = css::configuration::theDefaultProvider::get(m_xContext);
+ css::beans::PropertyValue aParam;
+ aParam.Name = "nodepath";
+ aParam.Value <<= m_sRoot;
+
+ css::uno::Sequence< css::uno::Any > lParams(1);
+ lParams[0] <<= aParam;
+
+ // open it
+ try
{
- // We have to close the old access point without any question here.
- // It will be open again using the new mode.
- // can be called without checks! It does the checks by itself ...
- // e.g. for already closed or not opened configuration.
- // Flushing of all made changes will be done here too.
- close();
-
- // create the configuration provider, which provides sub access points
- css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider = css::configuration::theDefaultProvider::get(m_xContext);
- css::beans::PropertyValue aParam;
- aParam.Name = "nodepath";
- aParam.Value <<= m_sRoot;
-
- css::uno::Sequence< css::uno::Any > lParams(1);
- lParams[0] <<= aParam;
-
- // open it
- try
- {
- if (eMode==E_READONLY)
- m_xConfig = xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGREADACCESS , lParams);
- else
- if (eMode==E_READWRITE)
- m_xConfig = xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGUPDATEACCESS, lParams);
- }
- catch(const css::uno::Exception&)
- {
- TOOLS_INFO_EXCEPTION("fwk", "open config");
- }
-
- m_eMode = E_CLOSED;
- if (m_xConfig.is())
- m_eMode = eMode;
+ if (eMode==E_READONLY)
+ m_xConfig = xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGREADACCESS , lParams);
+ else
+ if (eMode==E_READWRITE)
+ m_xConfig = xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGUPDATEACCESS, lParams);
}
+ catch(const css::uno::Exception&)
+ {
+ TOOLS_INFO_EXCEPTION("fwk", "open config");
+ }
+
+ m_eMode = E_CLOSED;
+ if (m_xConfig.is())
+ m_eMode = eMode;
}
/**
diff --git a/framework/source/fwi/uielement/constitemcontainer.cxx b/framework/source/fwi/uielement/constitemcontainer.cxx
index bb901da9226b..d0a621babcd5 100644
--- a/framework/source/fwi/uielement/constitemcontainer.cxx
+++ b/framework/source/fwi/uielement/constitemcontainer.cxx
@@ -63,51 +63,51 @@ ConstItemContainer::ConstItemContainer( const Reference< XIndexAccess >& rSource
{
}
- if ( rSourceContainer.is() )
+ if ( !rSourceContainer.is() )
+ return;
+
+ try
{
- try
+ sal_Int32 nCount = rSourceContainer->getCount();
+ m_aItemVector.reserve(nCount);
+ if ( bFastCopy )
{
- sal_Int32 nCount = rSourceContainer->getCount();
- m_aItemVector.reserve(nCount);
- if ( bFastCopy )
+ for ( sal_Int32 i = 0; i < nCount; i++ )
{
- for ( sal_Int32 i = 0; i < nCount; i++ )
- {
- Sequence< PropertyValue > aPropSeq;
- if ( rSourceContainer->getByIndex( i ) >>= aPropSeq )
- m_aItemVector.push_back( aPropSeq );
- }
+ Sequence< PropertyValue > aPropSeq;
+ if ( rSourceContainer->getByIndex( i ) >>= aPropSeq )
+ m_aItemVector.push_back( aPropSeq );
}
- else
+ }
+ else
+ {
+ for ( sal_Int32 i = 0; i < nCount; i++ )
{
- for ( sal_Int32 i = 0; i < nCount; i++ )
+ Sequence< PropertyValue > aPropSeq;
+ if ( rSourceContainer->getByIndex( i ) >>= aPropSeq )
{
- Sequence< PropertyValue > aPropSeq;
- if ( rSourceContainer->getByIndex( i ) >>= aPropSeq )
+ sal_Int32 nContainerIndex = -1;
+ Reference< XIndexAccess > xIndexAccess;
+ for ( sal_Int32 j = 0; j < aPropSeq.getLength(); j++ )
{
- sal_Int32 nContainerIndex = -1;
- Reference< XIndexAccess > xIndexAccess;
- for ( sal_Int32 j = 0; j < aPropSeq.getLength(); j++ )
+ if ( aPropSeq[j].Name == "ItemDescriptorContainer" )
{
- if ( aPropSeq[j].Name == "ItemDescriptorContainer" )
- {
- aPropSeq[j].Value >>= xIndexAccess;
- nContainerIndex = j;
- break;
- }
+ aPropSeq[j].Value >>= xIndexAccess;
+ nContainerIndex = j;
+ break;
}
+ }
- if ( xIndexAccess.is() && nContainerIndex >= 0 )
- aPropSeq[nContainerIndex].Value <<= deepCopyContainer( xIndexAccess );
+ if ( xIndexAccess.is() && nContainerIndex >= 0 )
+ aPropSeq[nContainerIndex].Value <<= deepCopyContainer( xIndexAccess );
- m_aItemVector.push_back( aPropSeq );
- }
+ m_aItemVector.push_back( aPropSeq );
}
}
}
- catch ( const IndexOutOfBoundsException& )
- {
- }
+ }
+ catch ( const IndexOutOfBoundsException& )
+ {
}
}
diff --git a/framework/source/fwi/uielement/itemcontainer.cxx b/framework/source/fwi/uielement/itemcontainer.cxx
index 8401274534af..79e5104e933f 100644
--- a/framework/source/fwi/uielement/itemcontainer.cxx
+++ b/framework/source/fwi/uielement/itemcontainer.cxx
@@ -50,38 +50,38 @@ ItemContainer::ItemContainer( const ConstItemContainer& rConstItemContainer, con
ItemContainer::ItemContainer( const Reference< XIndexAccess >& rSourceContainer, const ShareableMutex& rMutex ) :
m_aShareMutex( rMutex )
{
- if ( rSourceContainer.is() )
+ if ( !rSourceContainer.is() )
+ return;
+
+ sal_Int32 nCount = rSourceContainer->getCount();
+ try
{
- sal_Int32 nCount = rSourceContainer->getCount();
- try
+ for ( sal_Int32 i = 0; i < nCount; i++ )
{
- for ( sal_Int32 i = 0; i < nCount; i++ )
+ Sequence< PropertyValue > aPropSeq;
+ if ( rSourceContainer->getByIndex( i ) >>= aPropSeq )
{
- Sequence< PropertyValue > aPropSeq;
- if ( rSourceContainer->getByIndex( i ) >>= aPropSeq )
+ sal_Int32 nContainerIndex = -1;
+ Reference< XIndexAccess > xIndexAccess;
+ for ( sal_Int32 j = 0; j < aPropSeq.getLength(); j++ )
{
- sal_Int32 nContainerIndex = -1;
- Reference< XIndexAccess > xIndexAccess;
- for ( sal_Int32 j = 0; j < aPropSeq.getLength(); j++ )
+ if ( aPropSeq[j].Name == "ItemDescriptorContainer" )
{
- if ( aPropSeq[j].Name == "ItemDescriptorContainer" )
- {
- aPropSeq[j].Value >>= xIndexAccess;
- nContainerIndex = j;
- break;
- }
+ aPropSeq[j].Value >>= xIndexAccess;
+ nContainerIndex = j;
+ break;
}
+ }
- if ( xIndexAccess.is() && nContainerIndex >= 0 )
- aPropSeq[nContainerIndex].Value <<= deepCopyContainer( xIndexAccess, rMutex );
+ if ( xIndexAccess.is() && nContainerIndex >= 0 )
+ aPropSeq[nContainerIndex].Value <<= deepCopyContainer( xIndexAccess, rMutex );
- m_aItemVector.push_back( aPropSeq );
- }
+ m_aItemVector.push_back( aPropSeq );
}
}
- catch ( const IndexOutOfBoundsException& )
- {
- }
+ }
+ catch ( const IndexOutOfBoundsException& )
+ {
}
}
diff --git a/framework/source/fwi/uielement/rootitemcontainer.cxx b/framework/source/fwi/uielement/rootitemcontainer.cxx
index 14a199891313..edf695135d1d 100644
--- a/framework/source/fwi/uielement/rootitemcontainer.cxx
+++ b/framework/source/fwi/uielement/rootitemcontainer.cxx
@@ -64,38 +64,38 @@ RootItemContainer::RootItemContainer( const Reference< XIndexAccess >& rSourceCo
{
}
- if ( rSourceContainer.is() )
+ if ( !rSourceContainer.is() )
+ return;
+
+ sal_Int32 nCount = rSourceContainer->getCount();
+ try
{
- sal_Int32 nCount = rSourceContainer->getCount();
- try
+ for ( sal_Int32 i = 0; i < nCount; i++ )
{
- for ( sal_Int32 i = 0; i < nCount; i++ )
+ Sequence< PropertyValue > aPropSeq;
+ if ( rSourceContainer->getByIndex( i ) >>= aPropSeq )
{
- Sequence< PropertyValue > aPropSeq;
- if ( rSourceContainer->getByIndex( i ) >>= aPropSeq )
+ sal_Int32 nContainerIndex = -1;
+ Reference< XIndexAccess > xIndexAccess;
+ for ( sal_Int32 j = 0; j < aPropSeq.getLength(); j++ )
{
- sal_Int32 nContainerIndex = -1;
- Reference< XIndexAccess > xIndexAccess;
- for ( sal_Int32 j = 0; j < aPropSeq.getLength(); j++ )
+ if ( aPropSeq[j].Name == "ItemDescriptorContainer" )
{
- if ( aPropSeq[j].Name == "ItemDescriptorContainer" )
- {
- aPropSeq[j].Value >>= xIndexAccess;
- nContainerIndex = j;
- break;
- }
+ aPropSeq[j].Value >>= xIndexAccess;
+ nContainerIndex = j;
+ break;
}
+ }
- if ( xIndexAccess.is() && nContainerIndex >= 0 )
- aPropSeq[nContainerIndex].Value <<= deepCopyContainer( xIndexAccess );
+ if ( xIndexAccess.is() && nContainerIndex >= 0 )
+ aPropSeq[nContainerIndex].Value <<= deepCopyContainer( xIndexAccess );
- m_aItemVector.push_back( aPropSeq );
- }
+ m_aItemVector.push_back( aPropSeq );
}
}
- catch ( const IndexOutOfBoundsException& )
- {
- }
+ }
+ catch ( const IndexOutOfBoundsException& )
+ {
}
}
diff --git a/framework/source/helper/dockingareadefaultacceptor.cxx b/framework/source/helper/dockingareadefaultacceptor.cxx
index 27d75723012a..9d51d2052516 100644
--- a/framework/source/helper/dockingareadefaultacceptor.cxx
+++ b/framework/source/helper/dockingareadefaultacceptor.cxx
@@ -98,31 +98,31 @@ void SAL_CALL DockingAreaDefaultAcceptor::setDockingAreaSpace( const css::awt::R
// Try to "lock" the frame for access to taskscontainer.
css::uno::Reference< XFrame > xFrame( m_xOwner );
- if ( xFrame.is() )
- {
- css::uno::Reference< css::awt::XWindow > xContainerWindow( xFrame->getContainerWindow() );
- css::uno::Reference< css::awt::XWindow > xComponentWindow( xFrame->getComponentWindow() );
+ if ( !xFrame.is() )
+ return;
- if ( xContainerWindow.is() && xComponentWindow.is() )
- {
- css::uno::Reference< css::awt::XDevice > xDevice( xContainerWindow, css::uno::UNO_QUERY );
- // Convert relative size to output size.
- css::awt::Rectangle aRectangle = xContainerWindow->getPosSize();
- css::awt::DeviceInfo aInfo = xDevice->getInfo();
- css::awt::Size aSize ( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset ,
- aRectangle.Height - aInfo.TopInset - aInfo.BottomInset );
- css::awt::Size aMinSize( 0, 0 );// = xLayoutContrains->getMinimumSize();
+ css::uno::Reference< css::awt::XWindow > xContainerWindow( xFrame->getContainerWindow() );
+ css::uno::Reference< css::awt::XWindow > xComponentWindow( xFrame->getComponentWindow() );
- // Check if request border space would decrease component window size below minimum size
- sal_Int32 nWidth = aSize.Width - BorderSpace.X - BorderSpace.Width;
- sal_Int32 nHeight = aSize.Height - BorderSpace.Y - BorderSpace.Height;
-
- if (( nWidth > aMinSize.Width ) && ( nHeight > aMinSize.Height ))
- {
- // Resize our component window.
- xComponentWindow->setPosSize( BorderSpace.X, BorderSpace.Y, nWidth, nHeight, css::awt::PosSize::POSSIZE );
- }
- }
+ if ( !(xContainerWindow.is() && xComponentWindow.is()) )
+ return;
+
+ css::uno::Reference< css::awt::XDevice > xDevice( xContainerWindow, css::uno::UNO_QUERY );
+ // Convert relative size to output size.
+ css::awt::Rectangle aRectangle = xContainerWindow->getPosSize();
+ css::awt::DeviceInfo aInfo = xDevice->getInfo();
+ css::awt::Size aSize ( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset ,
+ aRectangle.Height - aInfo.TopInset - aInfo.BottomInset );
+ css::awt::Size aMinSize( 0, 0 );// = xLayoutContrains->getMinimumSize();
+
+ // Check if request border space would decrease component window size below minimum size
+ sal_Int32 nWidth = aSize.Width - BorderSpace.X - BorderSpace.Width;
+ sal_Int32 nHeight = aSize.Height - BorderSpace.Y - BorderSpace.Height;
+
+ if (( nWidth > aMinSize.Width ) && ( nHeight > aMinSize.Height ))
+ {
+ // Resize our component window.
+ xComponentWindow->setPosSize( BorderSpace.X, BorderSpace.Y, nWidth, nHeight, css::awt::PosSize::POSSIZE );
}
}
diff --git a/framework/source/helper/ocomponentaccess.cxx b/framework/source/helper/ocomponentaccess.cxx
index b170ae5258a0..b814fc49b83a 100644
--- a/framework/source/helper/ocomponentaccess.cxx
+++ b/framework/source/helper/ocomponentaccess.cxx
@@ -109,24 +109,24 @@ void OComponentAccess::impl_collectAllChildComponents( const css::uno::Referenc
std::vector< css::uno::Reference< XComponent > >& seqComponents )
{
// If valid node was given ...
- if( xNode.is() )
- {
- // ... continue collection at these.
+ if( !xNode.is() )
+ return;
+
+ // ... continue collection at these.
- // Get the container of current node, collect the components of existing child frames
- // and go down to next level in tree (recursive!).
+ // Get the container of current node, collect the components of existing child frames
+ // and go down to next level in tree (recursive!).
- const css::uno::Reference< XFrames > xContainer = xNode->getFrames();
- const Sequence< css::uno::Reference< XFrame > > seqFrames = xContainer->queryFrames( FrameSearchFlag::CHILDREN );
+ const css::uno::Reference< XFrames > xContainer = xNode->getFrames();
+ const Sequence< css::uno::Reference< XFrame > > seqFrames = xContainer->queryFrames( FrameSearchFlag::CHILDREN );
- const sal_Int32 nFrameCount = seqFrames.getLength();
- for( sal_Int32 nFrame=0; nFrame<nFrameCount; ++nFrame )
+ const sal_Int32 nFrameCount = seqFrames.getLength();
+ for( sal_Int32 nFrame=0; nFrame<nFrameCount; ++nFrame )
+ {
+ css::uno::Reference< XComponent > xComponent = impl_getFrameComponent( seqFrames[nFrame] );
+ if( xComponent.is() )
{
- css::uno::Reference< XComponent > xComponent = impl_getFrameComponent( seqFrames[nFrame] );
- if( xComponent.is() )
- {
- seqComponents.push_back( xComponent );
- }
+ seqComponents.push_back( xComponent );
}
}
// ... otherwise break a recursive path and go back at current stack!
diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx
index f00ce08eb043..f525a1d2c1dd 100644
--- a/framework/source/helper/statusindicatorfactory.cxx
+++ b/framework/source/helper/statusindicatorfactory.cxx
@@ -433,32 +433,32 @@ void StatusIndicatorFactory::impl_showProgress()
css::uno::Reference< css::task::XStatusIndicator > xProgress;
- if (xFrame.is())
+ if (!xFrame.is())
+ return;
+
+ // use frame layouted progress implementation
+ css::uno::Reference< css::beans::XPropertySet > xPropSet(xFrame, css::uno::UNO_QUERY);
+ if (xPropSet.is())
{
- // use frame layouted progress implementation
- css::uno::Reference< css::beans::XPropertySet > xPropSet(xFrame, css::uno::UNO_QUERY);
- if (xPropSet.is())
+ css::uno::Reference< css::frame::XLayoutManager2 > xLayoutManager;
+ xPropSet->getPropertyValue(FRAME_PROPNAME_ASCII_LAYOUTMANAGER) >>= xLayoutManager;
+ if (xLayoutManager.is())
{
- css::uno::Reference< css::frame::XLayoutManager2 > xLayoutManager;
- xPropSet->getPropertyValue(FRAME_PROPNAME_ASCII_LAYOUTMANAGER) >>= xLayoutManager;
- if (xLayoutManager.is())
- {
- // Be sure that we have always a progress. It can be that our frame
- // was recycled and therefore the progress was destroyed!
- // CreateElement does nothing if there is already a valid progress.
- OUString sPROGRESS_RESOURCE(PROGRESS_RESOURCE);
- xLayoutManager->createElement( sPROGRESS_RESOURCE );
- xLayoutManager->showElement( sPROGRESS_RESOURCE );
-
- css::uno::Reference< css::ui::XUIElement > xProgressBar = xLayoutManager->getElement(sPROGRESS_RESOURCE);
- if (xProgressBar.is())
- xProgress.set(xProgressBar->getRealInterface(), css::uno::UNO_QUERY);
- }
+ // Be sure that we have always a progress. It can be that our frame
+ // was recycled and therefore the progress was destroyed!
+ // CreateElement does nothing if there is already a valid progress.
+ OUString sPROGRESS_RESOURCE(PROGRESS_RESOURCE);
+ xLayoutManager->createElement( sPROGRESS_RESOURCE );
+ xLayoutManager->showElement( sPROGRESS_RESOURCE );
+
+ css::uno::Reference< css::ui::XUIElement > xProgressBar = xLayoutManager->getElement(sPROGRESS_RESOURCE);
+ if (xProgressBar.is())
+ xProgress.set(xProgressBar->getRealInterface(), css::uno::UNO_QUERY);
}
-
- osl::MutexGuard g(m_mutex);
- m_xProgress = xProgress;
}
+
+ osl::MutexGuard g(m_mutex);
+ m_xProgress = xProgress;
}
void StatusIndicatorFactory::impl_hideProgress()
@@ -509,21 +509,21 @@ void StatusIndicatorFactory::impl_reschedule(bool bForce)
// SAFE ->
osl::ResettableMutexGuard aRescheduleGuard(RescheduleLock::get());
- if (m_nInReschedule == 0)
- {
- ++m_nInReschedule;
- aRescheduleGuard.clear();
- // <- SAFE
+ if (m_nInReschedule != 0)
+ return;
- {
- SolarMutexGuard g;
- Application::Reschedule(true);
- }
+ ++m_nInReschedule;
+ aRescheduleGuard.clear();
+ // <- SAFE
- // SAFE ->
- aRescheduleGuard.reset();
- --m_nInReschedule;
+ {
+ SolarMutexGuard g;
+ Application::Reschedule(true);
}
+
+ // SAFE ->
+ aRescheduleGuard.reset();
+ --m_nInReschedule;
}
void StatusIndicatorFactory::impl_startWakeUpThread()
diff --git a/framework/source/helper/uiconfigelementwrapperbase.cxx b/framework/source/helper/uiconfigelementwrapperbase.cxx
index 9ddbb355211e..0ba8470628c3 100644
--- a/framework/source/helper/uiconfigelementwrapperbase.cxx
+++ b/framework/source/helper/uiconfigelementwrapperbase.cxx
@@ -111,32 +111,32 @@ void SAL_CALL UIConfigElementWrapperBase::initialize( const Sequence< Any >& aAr
{
SolarMutexGuard g;
- if ( !m_bInitialized )
+ if ( m_bInitialized )
+ return;
+
+ for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ )
{
- for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ )
+ PropertyValue aPropValue;
+ if ( aArguments[n] >>= aPropValue )
{
- PropertyValue aPropValue;
- if ( aArguments[n] >>= aPropValue )
- {
- if ( aPropValue.Name == UIELEMENT_PROPNAME_CONFIGSOURCE )
- setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_CONFIGSOURCE, aPropValue.Value );
- else if ( aPropValue.Name == UIELEMENT_PROPNAME_FRAME )
- setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_FRAME, aPropValue.Value );
- else if ( aPropValue.Name == UIELEMENT_PROPNAME_PERSISTENT )
- setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_PERSISTENT, aPropValue.Value );
- else if ( aPropValue.Name == UIELEMENT_PROPNAME_RESOURCEURL )
- setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_RESOURCEURL, aPropValue.Value );
- else if ( aPropValue.Name == UIELEMENT_PROPNAME_TYPE )
- setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_TYPE, aPropValue.Value );
- else if ( aPropValue.Name == UIELEMENT_PROPNAME_CONFIGLISTENER )
- setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_CONFIGLISTENER, aPropValue.Value );
- else if ( aPropValue.Name == UIELEMENT_PROPNAME_NOCLOSE )
- setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_NOCLOSE, aPropValue.Value );
- }
+ if ( aPropValue.Name == UIELEMENT_PROPNAME_CONFIGSOURCE )
+ setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_CONFIGSOURCE, aPropValue.Value );
+ else if ( aPropValue.Name == UIELEMENT_PROPNAME_FRAME )
+ setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_FRAME, aPropValue.Value );
+ else if ( aPropValue.Name == UIELEMENT_PROPNAME_PERSISTENT )
+ setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_PERSISTENT, aPropValue.Value );
+ else if ( aPropValue.Name == UIELEMENT_PROPNAME_RESOURCEURL )
+ setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_RESOURCEURL, aPropValue.Value );
+ else if ( aPropValue.Name == UIELEMENT_PROPNAME_TYPE )
+ setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_TYPE, aPropValue.Value );
+ else if ( aPropValue.Name == UIELEMENT_PROPNAME_CONFIGLISTENER )
+ setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_CONFIGLISTENER, aPropValue.Value );
+ else if ( aPropValue.Name == UIELEMENT_PROPNAME_NOCLOSE )
+ setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_NOCLOSE, aPropValue.Value );
}
-
- m_bInitialized = true;
}
+
+ m_bInitialized = true;
}
// XUpdatable
@@ -413,36 +413,36 @@ void SAL_CALL UIConfigElementWrapperBase::setSettings( const Reference< XIndexAc
{
SolarMutexClearableGuard aLock;
- if ( xSettings.is() )
+ if ( !xSettings.is() )
+ return;
+
+ // Create a copy of the data if the container is not const
+ Reference< XIndexReplace > xReplace( xSettings, UNO_QUERY );
+ if ( xReplace.is() )
+ m_xConfigData.set( static_cast< OWeakObject * >( new ConstItemContainer( xSettings ) ), UNO_QUERY );
+ else
+ m_xConfigData = xSettings;
+
+ if ( m_xConfigSource.is() && m_bPersistent )
{
- // Create a copy of the data if the container is not const
- Reference< XIndexReplace > xReplace( xSettings, UNO_QUERY );
- if ( xReplace.is() )
- m_xConfigData.set( static_cast< OWeakObject * >( new ConstItemContainer( xSettings ) ), UNO_QUERY );
- else
- m_xConfigData = xSettings;
-
- if ( m_xConfigSource.is() && m_bPersistent )
- {
- OUString aResourceURL( m_aResourceURL );
- Reference< XUIConfigurationManager > xUICfgMgr( m_xConfigSource );
+ OUString aResourceURL( m_aResourceURL );
+ Reference< XUIConfigurationManager > xUICfgMgr( m_xConfigSource );
- aLock.clear();
+ aLock.clear();
- try
- {
- xUICfgMgr->replaceSettings( aResourceURL, m_xConfigData );
- }
- catch( const NoSuchElementException& )
- {
- }
+ try
+ {
+ xUICfgMgr->replaceSettings( aResourceURL, m_xConfigData );
}
- else if ( !m_bPersistent )
+ catch( const NoSuchElementException& )
{
- // Transient menubar => Fill menubar with new data
- impl_fillNewData();
}
}
+ else if ( !m_bPersistent )
+ {
+ // Transient menubar => Fill menubar with new data
+ impl_fillNewData();
+ }
}
void UIConfigElementWrapperBase::impl_fillNewData()
{
diff --git a/framework/source/helper/uielementwrapperbase.cxx b/framework/source/helper/uielementwrapperbase.cxx
index 656e09dafb68..d02e8954c2cf 100644
--- a/framework/source/helper/uielementwrapperbase.cxx
+++ b/framework/source/helper/uielementwrapperbase.cxx
@@ -83,26 +83,26 @@ void SAL_CALL UIElementWrapperBase::initialize( const Sequence< Any >& aArgument
{
SolarMutexGuard g;
- if ( !m_bInitialized )
+ if ( m_bInitialized )
+ return;
+
+ for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ )
{
- for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ )
+ PropertyValue aPropValue;
+ if ( aArguments[n] >>= aPropValue )
{
- PropertyValue aPropValue;
- if ( aArguments[n] >>= aPropValue )
+ if ( aPropValue.Name == "ResourceURL" )
+ aPropValue.Value >>= m_aResourceURL;
+ else if ( aPropValue.Name == "Frame" )
{
- if ( aPropValue.Name == "ResourceURL" )
- aPropValue.Value >>= m_aResourceURL;
- else if ( aPropValue.Name == "Frame" )
- {
- Reference< XFrame > xFrame;
- aPropValue.Value >>= xFrame;
- m_xWeakFrame = xFrame;
- }
+ Reference< XFrame > xFrame;
+ aPropValue.Value >>= xFrame;
+ m_xWeakFrame = xFrame;
}
}
-
- m_bInitialized = true;
}
+
+ m_bInitialized = true;
}
// XUIElement
diff --git a/framework/source/jobs/job.cxx b/framework/source/jobs/job.cxx
index 3b74cf01a2f4..9f85f8452d3f 100644
--- a/framework/source/jobs/job.cxx
+++ b/framework/source/jobs/job.cxx
@@ -525,23 +525,23 @@ void Job::impl_startListening()
}
// listening for model closing
- if (m_xModel.is() && !m_bListenOnModel)
+ if (!(m_xModel.is() && !m_bListenOnModel))
+ return;
+
+ try
{
- try
- {
- css::uno::Reference< css::util::XCloseBroadcaster > xCloseable(m_xModel , css::uno::UNO_QUERY);
- css::uno::Reference< css::util::XCloseListener > xThis (static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
- if (xCloseable.is())
- {
- xCloseable->addCloseListener(xThis);
- m_bListenOnModel = true;
- }
- }
- catch(const css::uno::Exception&)
+ css::uno::Reference< css::util::XCloseBroadcaster > xCloseable(m_xModel , css::uno::UNO_QUERY);
+ css::uno::Reference< css::util::XCloseListener > xThis (static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
+ if (xCloseable.is())
{
- m_bListenOnModel = false;
+ xCloseable->addCloseListener(xThis);
+ m_bListenOnModel = true;
}
}
+ catch(const css::uno::Exception&)
+ {
+ m_bListenOnModel = false;
+ }
}
/**
@@ -586,22 +586,22 @@ void Job::impl_stopListening()
}
// stop listening for model closing
- if (m_xModel.is() && m_bListenOnModel)
+ if (!(m_xModel.is() && m_bListenOnModel))
+ return;
+
+ try
{
- try
- {
- css::uno::Reference< css::util::XCloseBroadcaster > xCloseable(m_xModel , css::uno::UNO_QUERY);
- css::uno::Reference< css::util::XCloseListener > xThis (static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
- if (xCloseable.is())
- {
- xCloseable->removeCloseListener(xThis);
- m_bListenOnModel = false;
- }
- }
- catch(const css::uno::Exception&)
+ css::uno::Reference< css::util::XCloseBroadcaster > xCloseable(m_xModel , css::uno::UNO_QUERY);
+ css::uno::Reference< css::util::XCloseListener > xThis (static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
+ if (xCloseable.is())
{
+ xCloseable->removeCloseListener(xThis);
+ m_bListenOnModel = false;
}
}
+ catch(const css::uno::Exception&)
+ {
+ }
}
/**
diff --git a/framework/source/jobs/jobdata.cxx b/framework/source/jobs/jobdata.cxx
index 1825aeae04d0..3f7a96674d3d 100644
--- a/framework/source/jobs/jobdata.cxx
+++ b/framework/source/jobs/jobdata.cxx
@@ -229,36 +229,36 @@ void JobData::setJobConfig( const std::vector< css::beans::NamedValue >& lArgume
m_lArguments = lArguments;
// update the configuration ... if possible!
- if (m_eMode==E_ALIAS)
- {
- // It doesn't matter if this config object was already opened before.
- // It doesn nothing here then ... or it change the mode automatically, if
- // it was opened using another one before.
- ConfigAccess aConfig(
- m_xContext,
- ("/org.openoffice.Office.Jobs/Jobs/"
- + utl::wrapConfigurationElementName(m_sAlias)));
- aConfig.open(ConfigAccess::E_READWRITE);
- if (aConfig.getMode()==ConfigAccess::E_CLOSED)
- return;
-
- css::uno::Reference< css::beans::XMultiHierarchicalPropertySet > xArgumentList(aConfig.cfg(), css::uno::UNO_QUERY);
- if (xArgumentList.is())
- {
- sal_Int32 nCount = m_lArguments.size();
- css::uno::Sequence< OUString > lNames (nCount);
- css::uno::Sequence< css::uno::Any > lValues(nCount);
+ if (m_eMode!=E_ALIAS)
+ return;
- for (sal_Int32 i=0; i<nCount; ++i)
- {
- lNames [i] = m_lArguments[i].Name;
- lValues[i] = m_lArguments[i].Value;
- }
+ // It doesn't matter if this config object was already opened before.
+ // It doesn nothing here then ... or it change the mode automatically, if
+ // it was opened using another one before.
+ ConfigAccess aConfig(
+ m_xContext,
+ ("/org.openoffice.Office.Jobs/Jobs/"
+ + utl::wrapConfigurationElementName(m_sAlias)));
+ aConfig.open(ConfigAccess::E_READWRITE);
+ if (aConfig.getMode()==ConfigAccess::E_CLOSED)
+ return;
- xArgumentList->setHierarchicalPropertyValues(lNames, lValues);
+ css::uno::Reference< css::beans::XMultiHierarchicalPropertySet > xArgumentList(aConfig.cfg(), css::uno::UNO_QUERY);
+ if (xArgumentList.is())
+ {
+ sal_Int32 nCount = m_lArguments.size();
+ css::uno::Sequence< OUString > lNames (nCount);
+ css::uno::Sequence< css::uno::Any > lValues(nCount);
+
+ for (sal_Int32 i=0; i<nCount; ++i)
+ {
+ lNames [i] = m_lArguments[i].Name;
+ lValues[i] = m_lArguments[i].Value;
}
- aConfig.close();
+
+ xArgumentList->setHierarchicalPropertyValues(lNames, lValues);
}
+ aConfig.close();
}
/**
diff --git a/framework/source/jobs/jobexecutor.cxx b/framework/source/jobs/jobexecutor.cxx
index 4e8a93fa93c7..7dd5f67d7de2 100644
--- a/framework/source/jobs/jobexecutor.cxx
+++ b/framework/source/jobs/jobexecutor.cxx
@@ -139,25 +139,25 @@ void JobExecutor::initListeners()
// list too ... Be listener at the configuration.
m_aConfig.open(ConfigAccess::E_READONLY);
- if (m_aConfig.getMode() == ConfigAccess::E_READONLY)
- {
- css::uno::Reference< css::container::XNameAccess > xRegistry(
- m_aConfig.cfg(), css::uno::UNO_QUERY);
- if (xRegistry.is())
- m_lEvents = Converter::convert_seqOUString2OUStringList(
- xRegistry->getElementNames());
-
- css::uno::Reference< css::container::XContainer > xNotifier(
- m_aConfig.cfg(), css::uno::UNO_QUERY);
- if (xNotifier.is())
- {
- m_xConfigListener = new WeakContainerListener(this);
- xNotifier->addContainerListener(m_xConfigListener);
- }
+ if (m_aConfig.getMode() != ConfigAccess::E_READONLY)
+ return;
- // don't close cfg here!
- // It will be done inside disposing ...
+ css::uno::Reference< css::container::XNameAccess > xRegistry(
+ m_aConfig.cfg(), css::uno::UNO_QUERY);
+ if (xRegistry.is())
+ m_lEvents = Converter::convert_seqOUString2OUStringList(
+ xRegistry->getElementNames());
+
+ css::uno::Reference< css::container::XContainer > xNotifier(
+ m_aConfig.cfg(), css::uno::UNO_QUERY);
+ if (xNotifier.is())
+ {
+ m_xConfigListener = new WeakContainerListener(this);
+ xNotifier->addContainerListener(m_xConfigListener);
}
+
+ // don't close cfg here!
+ // It will be done inside disposing ...
}
JobExecutor::~JobExecutor()
diff --git a/framework/source/jobs/joburl.cxx b/framework/source/jobs/joburl.cxx
index 76fb1a6dd5b9..efff201a8401 100644
--- a/framework/source/jobs/joburl.cxx
+++ b/framework/source/jobs/joburl.cxx
@@ -45,51 +45,51 @@ JobURL::JobURL( /*IN*/ const OUString& sURL )
// syntax: vnd.sun.star.job:{[event=<name>],[alias=<name>],[service=<name>]}
// check for "vnd.sun.star.job:"
- if (sURL.startsWithIgnoreAsciiCase("vnd.sun.star.job:"))
+ if (!sURL.startsWithIgnoreAsciiCase("vnd.sun.star.job:"))
+ return;
+
+ sal_Int32 t = std::strlen("vnd.sun.star.job:");
+ do
{
- sal_Int32 t = std::strlen("vnd.sun.star.job:");
- do
+ // separate all token of "{[event=<name>],[alias=<name>],[service=<name>]}"
+ OUString sToken = sURL.getToken(0, JOBURL_PART_SEPARATOR, t);
+ OUString sPartValue;
+ OUString sPartArguments;
+
+ // check for "event="
+ if (
+ (JobURL::implst_split(sToken,JOBURL_EVENT_STR,JOBURL_EVENT_LEN,sPartValue,sPartArguments)) &&
+ (!sPartValue.isEmpty())
+ )
+ {
+ // set the part value
+ m_sEvent = sPartValue;
+ m_eRequest |= E_EVENT;
+ }
+ else
+ // check for "alias="
+ if (
+ (JobURL::implst_split(sToken,JOBURL_ALIAS_STR,JOBURL_ALIAS_LEN,sPartValue,sPartArguments)) &&
+ (!sPartValue.isEmpty())
+ )
+ {
+ // set the part value
+ m_sAlias = sPartValue;
+ m_eRequest |= E_ALIAS;
+ }
+ else
+ // check for "service="
+ if (
+ (JobURL::implst_split(sToken,JOBURL_SERVICE_STR,JOBURL_SERVICE_LEN,sPartValue,sPartArguments)) &&
+ (!sPartValue.isEmpty())
+ )
{
- // separate all token of "{[event=<name>],[alias=<name>],[service=<name>]}"
- OUString sToken = sURL.getToken(0, JOBURL_PART_SEPARATOR, t);
- OUString sPartValue;
- OUString sPartArguments;
-
- // check for "event="
- if (
- (JobURL::implst_split(sToken,JOBURL_EVENT_STR,JOBURL_EVENT_LEN,sPartValue,sPartArguments)) &&
- (!sPartValue.isEmpty())
- )
- {
- // set the part value
- m_sEvent = sPartValue;
- m_eRequest |= E_EVENT;
- }
- else
- // check for "alias="
- if (
- (JobURL::implst_split(sToken,JOBURL_ALIAS_STR,JOBURL_ALIAS_LEN,sPartValue,sPartArguments)) &&
- (!sPartValue.isEmpty())
- )
- {
- // set the part value
- m_sAlias = sPartValue;
- m_eRequest |= E_ALIAS;
- }
- else
- // check for "service="
- if (
- (JobURL::implst_split(sToken,JOBURL_SERVICE_STR,JOBURL_SERVICE_LEN,sPartValue,sPartArguments)) &&
- (!sPartValue.isEmpty())
- )
- {
- // set the part value
- m_sService = sPartValue;
- m_eRequest |= E_SERVICE;
- }
+ // set the part value
+ m_sService = sPartValue;
+ m_eRequest |= E_SERVICE;
}
- while(t!=-1);
}
+ while(t!=-1);
}
/**
diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx
index 4dc621245b4c..22fc257a4eec 100644
--- a/framework/source/layoutmanager/helpers.cxx
+++ b/framework/source/layoutmanager/helpers.cxx
@@ -294,24 +294,24 @@ void impl_setDockingWindowVisibility( const css::uno::Reference< css::uno::XComp
sal_Int32 nIndex = nID - DOCKWIN_ID_BASE;
css::uno::Reference< css::frame::XDispatchProvider > xProvider(rFrame, css::uno::UNO_QUERY);
- if ( nIndex >= 0 && xProvider.is() )
- {
- OUString aDockWinArgName = "DockingWindow" + OUString::number( nIndex );
+ if ( !(nIndex >= 0 && xProvider.is()) )
+ return;
- css::uno::Sequence< css::beans::PropertyValue > aArgs(1);
- aArgs[0].Name = aDockWinArgName;
- aArgs[0].Value <<= bVisible;
+ OUString aDockWinArgName = "DockingWindow" + OUString::number( nIndex );
- css::uno::Reference< css::frame::XDispatchHelper > xDispatcher = css::frame::DispatchHelper::create( rxContext );
+ css::uno::Sequence< css::beans::PropertyValue > aArgs(1);
+ aArgs[0].Name = aDockWinArgName;
+ aArgs[0].Value <<= bVisible;
- OUString aDockWinCommand = ".uno:" + aDockWinArgName;
- xDispatcher->executeDispatch(
- xProvider,
- aDockWinCommand,
- "_self",
- 0,
- aArgs);
- }
+ css::uno::Reference< css::frame::XDispatchHelper > xDispatcher = css::frame::DispatchHelper::create( rxContext );
+
+ OUString aDockWinCommand = ".uno:" + aDockWinArgName;
+ xDispatcher->executeDispatch(
+ xProvider,
+ aDockWinCommand,
+ "_self",
+ 0,
+ aArgs);
}
void impl_addWindowListeners(
@@ -320,21 +320,21 @@ void impl_addWindowListeners(
{
css::uno::Reference< css::awt::XWindow > xWindow( xUIElement->getRealInterface(), css::uno::UNO_QUERY );
css::uno::Reference< css::awt::XDockableWindow > xDockWindow( xUIElement->getRealInterface(), css::uno::UNO_QUERY );
- if ( xDockWindow.is() && xWindow.is() )
+ if ( !(xDockWindow.is() && xWindow.is()) )
+ return;
+
+ try
+ {
+ xDockWindow->addDockableWindowListener(
+ css::uno::Reference< css::awt::XDockableWindowListener >(
+ xThis, css::uno::UNO_QUERY ));
+ xWindow->addWindowListener(
+ css::uno::Reference< css::awt::XWindowListener >(
+ xThis, css::uno::UNO_QUERY ));
+ xDockWindow->enableDocking( true );
+ }
+ catch ( const css::uno::Exception& )
{
- try
- {
- xDockWindow->addDockableWindowListener(
- css::uno::Reference< css::awt::XDockableWindowListener >(
- xThis, css::uno::UNO_QUERY ));
- xWindow->addWindowListener(
- css::uno::Reference< css::awt::XWindowListener >(
- xThis, css::uno::UNO_QUERY ));
- xDockWindow->enableDocking( true );
- }
- catch ( const css::uno::Exception& )
- {
- }
}
}
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index f9bbf677fc97..924e21c2b3c4 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -150,46 +150,46 @@ void LayoutManager::implts_createMenuBar(const OUString& rMenuBarName)
}
// Create the default menubar otherwise
- if (!m_bInplaceMenuSet && !m_xMenuBar.is())
+ if (m_bInplaceMenuSet || m_xMenuBar.is())
+ return;
+
+ m_xMenuBar = implts_createElement( rMenuBarName );
+ if ( !m_xMenuBar.is() )
+ return;
+
+ SystemWindow* pSysWindow = getTopSystemWindow( m_xContainerWindow );
+ if ( !pSysWindow )
+ return;
+
+ Reference< awt::XMenuBar > xMenuBar;
+
+ Reference< XPropertySet > xPropSet( m_xMenuBar, UNO_QUERY );
+ if ( xPropSet.is() )
{
- m_xMenuBar = implts_createElement( rMenuBarName );
- if ( m_xMenuBar.is() )
+ try
{
- SystemWindow* pSysWindow = getTopSystemWindow( m_xContainerWindow );
- if ( pSysWindow )
- {
- Reference< awt::XMenuBar > xMenuBar;
+ xPropSet->getPropertyValue("XMenuBar") >>= xMenuBar;
+ }
+ catch (const beans::UnknownPropertyException&)
+ {
+ }
+ catch (const lang::WrappedTargetException&)
+ {
+ }
+ }
- Reference< XPropertySet > xPropSet( m_xMenuBar, UNO_QUERY );
- if ( xPropSet.is() )
- {
- try
- {
- xPropSet->getPropertyValue("XMenuBar") >>= xMenuBar;
- }
- catch (const beans::UnknownPropertyException&)
- {
- }
- catch (const lang::WrappedTargetException&)
- {
- }
- }
+ if ( !xMenuBar.is() )
+ return;
- if ( xMenuBar.is() )
- {
- VCLXMenu* pAwtMenuBar = comphelper::getUnoTunnelImplementation<VCLXMenu>( xMenuBar );
- if ( pAwtMenuBar )
- {
- MenuBar* pMenuBar = static_cast<MenuBar*>(pAwtMenuBar->GetMenu());
- if ( pMenuBar )
- {
- pSysWindow->SetMenuBar(pMenuBar);
- pMenuBar->SetDisplayable( m_bMenuVisible );
- implts_updateMenuBarClose();
- }
- }
- }
- }
+ VCLXMenu* pAwtMenuBar = comphelper::getUnoTunnelImplementation<VCLXMenu>( xMenuBar );
+ if ( pAwtMenuBar )
+ {
+ MenuBar* pMenuBar = static_cast<MenuBar*>(pAwtMenuBar->GetMenu());
+ if ( pMenuBar )
+ {
+ pSysWindow->SetMenuBar(pMenuBar);
+ pMenuBar->SetDisplayable( m_bMenuVisible );
+ implts_updateMenuBarClose();
}
}
}
@@ -669,48 +669,48 @@ void LayoutManager::implts_writeWindowStateData( const OUString& aName, const UI
}
}
- if ( bPersistent && xPersistentWindowState.is() )
+ if ( !(bPersistent && xPersistentWindowState.is()) )
+ return;
+
+ try
{
- try
- {
- Sequence< PropertyValue > aWindowState( 8 );
+ Sequence< PropertyValue > aWindowState( 8 );
- aWindowState[0].Name = WINDOWSTATE_PROPERTY_DOCKED;
- aWindowState[0].Value <<= !rElementData.m_bFloating;
- aWindowState[1].Name = WINDOWSTATE_PROPERTY_VISIBLE;
- aWindowState[1].Value <<= rElementData.m_bVisible;
+ aWindowState[0].Name = WINDOWSTATE_PROPERTY_DOCKED;
+ aWindowState[0].Value <<= !rElementData.m_bFloating;
+ aWindowState[1].Name = WINDOWSTATE_PROPERTY_VISIBLE;
+ aWindowState[1].Value <<= rElementData.m_bVisible;
- aWindowState[2].Name = WINDOWSTATE_PROPERTY_DOCKINGAREA;
- aWindowState[2].Value <<= rElementData.m_aDockedData.m_nDockedArea;
+ aWindowState[2].Name = WINDOWSTATE_PROPERTY_DOCKINGAREA;
+ aWindowState[2].Value <<= rElementData.m_aDockedData.m_nDockedArea;
- aWindowState[3].Name = WINDOWSTATE_PROPERTY_DOCKPOS;
- aWindowState[3].Value <<= rElementData.m_aDockedData.m_aPos;
+ aWindowState[3].Name = WINDOWSTATE_PROPERTY_DOCKPOS;
+ aWindowState[3].Value <<= rElementData.m_aDockedData.m_aPos;
- aWindowState[4].Name = WINDOWSTATE_PROPERTY_POS;
- aWindowState[4].Value <<= rElementData.m_aFloatingData.m_aPos;
+ aWindowState[4].Name = WINDOWSTATE_PROPERTY_POS;
+ aWindowState[4].Value <<= rElementData.m_aFloatingData.m_aPos;
- aWindowState[5].Name = WINDOWSTATE_PROPERTY_SIZE;
- aWindowState[5].Value <<= rElementData.m_aFloatingData.m_aSize;
- aWindowState[6].Name = WINDOWSTATE_PROPERTY_UINAME;
- aWindowState[6].Value <<= rElementData.m_aUIName;
- aWindowState[7].Name = WINDOWSTATE_PROPERTY_LOCKED;
- aWindowState[7].Value <<= rElementData.m_aDockedData.m_bLocked;
+ aWindowState[5].Name = WINDOWSTATE_PROPERTY_SIZE;
+ aWindowState[5].Value <<= rElementData.m_aFloatingData.m_aSize;
+ aWindowState[6].Name = WINDOWSTATE_PROPERTY_UINAME;
+ aWindowState[6].Value <<= rElementData.m_aUIName;
+ aWindowState[7].Name = WINDOWSTATE_PROPERTY_LOCKED;
+ aWindowState[7].Value <<= rElementData.m_aDockedData.m_bLocked;
- if ( xPersistentWindowState->hasByName( aName ))
- {
- Reference< XNameReplace > xReplace( xPersistentWindowState, uno::UNO_QUERY );
- xReplace->replaceByName( aName, makeAny( aWindowState ));
- }
- else
- {
- Reference< XNameContainer > xInsert( xPersistentWindowState, uno::UNO_QUERY );
- xInsert->insertByName( aName, makeAny( aWindowState ));
- }
+ if ( xPersistentWindowState->hasByName( aName ))
+ {
+ Reference< XNameReplace > xReplace( xPersistentWindowState, uno::UNO_QUERY );
+ xReplace->replaceByName( aName, makeAny( aWindowState ));
}
- catch (const Exception&)
+ else
{
+ Reference< XNameContainer > xInsert( xPersistentWindowState, uno::UNO_QUERY );
+ xInsert->insertByName( aName, makeAny( aWindowState ));
}
}
+ catch (const Exception&)
+ {
+ }
}
::Size LayoutManager::implts_getContainerWindowOutputSize()
@@ -994,18 +994,18 @@ void LayoutManager::implts_setStatusBarPosSize( const ::Point& rPos, const ::Siz
aReadLock.clear();
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( xWindow.is() )
+ if ( !xWindow.is() )
+ return;
+
+ SolarMutexGuard aGuard;
+ VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow( xContainerWindow );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
+ if ( pParentWindow && ( pWindow && pWindow->GetType() == WindowType::STATUSBAR ))
{
- SolarMutexGuard aGuard;
- VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow( xContainerWindow );
- VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
- if ( pParentWindow && ( pWindow && pWindow->GetType() == WindowType::STATUSBAR ))
- {
- vcl::Window* pOldParentWindow = pWindow->GetParent();
- if ( pParentWindow != pOldParentWindow )
- pWindow->SetParent( pParentWindow );
- static_cast<StatusBar *>(pWindow.get())->SetPosSizePixel( rPos, rSize );
- }
+ vcl::Window* pOldParentWindow = pWindow->GetParent();
+ if ( pParentWindow != pOldParentWindow )
+ pWindow->SetParent( pParentWindow );
+ static_cast<StatusBar *>(pWindow.get())->SetPosSizePixel( rPos, rSize );
}
}
@@ -1155,42 +1155,42 @@ void LayoutManager::implts_setInplaceMenuBar( const Reference< XIndexAccess >& x
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
SolarMutexClearableGuard aWriteLock;
- if ( !m_bInplaceMenuSet )
- {
- SolarMutexGuard aGuard;
-
- // Reset old inplace menubar!
- VclPtr<Menu> pOldMenuBar;
- if (m_xInplaceMenuBar.is())
- {
- pOldMenuBar = m_xInplaceMenuBar->GetMenuBar();
- m_xInplaceMenuBar->dispose();
- m_xInplaceMenuBar.clear();
- }
- pOldMenuBar.disposeAndClear();
+ if ( m_bInplaceMenuSet )
+ return;
- m_bInplaceMenuSet = false;
+ SolarMutexGuard aGuard;
- if ( m_xFrame.is() && m_xContainerWindow.is() )
- {
- Reference< XDispatchProvider > xDispatchProvider;
+ // Reset old inplace menubar!
+ VclPtr<Menu> pOldMenuBar;
+ if (m_xInplaceMenuBar.is())
+ {
+ pOldMenuBar = m_xInplaceMenuBar->GetMenuBar();
+ m_xInplaceMenuBar->dispose();
+ m_xInplaceMenuBar.clear();
+ }
+ pOldMenuBar.disposeAndClear();
- VclPtr<MenuBar> pMenuBar = VclPtr<MenuBar>::Create();
- m_xInplaceMenuBar = new MenuBarManager( m_xContext, m_xFrame, m_xURLTransformer, xDispatchProvider, OUString(), pMenuBar, true );
- m_xInplaceMenuBar->SetItemContainer( xMergedMenuBar );
+ m_bInplaceMenuSet = false;
- SystemWindow* pSysWindow = getTopSystemWindow( m_xContainerWindow );
- if ( pSysWindow )
- pSysWindow->SetMenuBar(pMenuBar);
+ if ( m_xFrame.is() && m_xContainerWindow.is() )
+ {
+ Reference< XDispatchProvider > xDispatchProvider;
- m_bInplaceMenuSet = true;
- }
+ VclPtr<MenuBar> pMenuBar = VclPtr<MenuBar>::Create();
+ m_xInplaceMenuBar = new MenuBarManager( m_xContext, m_xFrame, m_xURLTransformer, xDispatchProvider, OUString(), pMenuBar, true );
+ m_xInplaceMenuBar->SetItemContainer( xMergedMenuBar );
- aWriteLock.clear();
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ SystemWindow* pSysWindow = getTopSystemWindow( m_xContainerWindow );
+ if ( pSysWindow )
+ pSysWindow->SetMenuBar(pMenuBar);
- implts_updateMenuBarClose();
+ m_bInplaceMenuSet = true;
}
+
+ aWriteLock.clear();
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+
+ implts_updateMenuBarClose();
}
void LayoutManager::implts_resetInplaceMenuBar()
@@ -1954,52 +1954,52 @@ sal_Bool SAL_CALL LayoutManager::unlockWindow( const OUString& aName )
void SAL_CALL LayoutManager::setElementSize( const OUString& aName, const awt::Size& aSize )
{
- if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
- {
- SolarMutexClearableGuard aReadLock;
- ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
- aReadLock.clear();
+ if ( !getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
+ return;
- if ( pToolbarManager )
- {
- pToolbarManager->setToolbarSize( aName, aSize );
- if ( pToolbarManager->isLayoutDirty() )
- doLayout();
- }
+ SolarMutexClearableGuard aReadLock;
+ ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
+ aReadLock.clear();
+
+ if ( pToolbarManager )
+ {
+ pToolbarManager->setToolbarSize( aName, aSize );
+ if ( pToolbarManager->isLayoutDirty() )
+ doLayout();
}
}
void SAL_CALL LayoutManager::setElementPos( const OUString& aName, const awt::Point& aPos )
{
- if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
- {
- SolarMutexClearableGuard aReadLock;
- ToolbarLayoutManager* pToolbarManager( m_xToolbarManager.get() );
- aReadLock.clear();
+ if ( !getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
+ return;
- if ( pToolbarManager )
- {
- pToolbarManager->setToolbarPos( aName, aPos );
- if ( pToolbarManager->isLayoutDirty() )
- doLayout();
- }
+ SolarMutexClearableGuard aReadLock;
+ ToolbarLayoutManager* pToolbarManager( m_xToolbarManager.get() );
+ aReadLock.clear();
+
+ if ( pToolbarManager )
+ {
+ pToolbarManager->setToolbarPos( aName, aPos );
+ if ( pToolbarManager->isLayoutDirty() )
+ doLayout();
}
}
void SAL_CALL LayoutManager::setElementPosSize( const OUString& aName, const awt::Point& aPos, const awt::Size& aSize )
{
- if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
- {
- SolarMutexClearableGuard aReadLock;
- ToolbarLayoutManager* pToolbarManager( m_xToolbarManager.get() );
- aReadLock.clear();
+ if ( !getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
+ return;
- if ( pToolbarManager )
- {
- pToolbarManager->setToolbarPosSize( aName, aPos, aSize );
- if ( pToolbarManager->isLayoutDirty() )
- doLayout();
- }
+ SolarMutexClearableGuard aReadLock;
+ ToolbarLayoutManager* pToolbarManager( m_xToolbarManager.get() );
+ aReadLock.clear();
+
+ if ( pToolbarManager )
+ {
+ pToolbarManager->setToolbarPosSize( aName, aPos, aSize );
+ if ( pToolbarManager->isLayoutDirty() )
+ doLayout();
}
}
@@ -2458,20 +2458,20 @@ void LayoutManager::implts_updateMenuBarClose()
Reference< awt::XWindow > xContainerWindow( m_xContainerWindow );
aWriteLock.clear();
- if ( xContainerWindow.is() )
- {
- SolarMutexGuard aGuard;
+ if ( !xContainerWindow.is() )
+ return;
- SystemWindow* pSysWindow = getTopSystemWindow( xContainerWindow );
- if ( pSysWindow )
+ SolarMutexGuard aGuard;
+
+ SystemWindow* pSysWindow = getTopSystemWindow( xContainerWindow );
+ if ( pSysWindow )
+ {
+ MenuBar* pMenuBar = pSysWindow->GetMenuBar();
+ if ( pMenuBar )
{
- MenuBar* pMenuBar = pSysWindow->GetMenuBar();
- if ( pMenuBar )
- {
- // TODO remove link on sal_False ?!
- pMenuBar->ShowCloseButton(bShowCloseButton);
- pMenuBar->SetCloseButtonClickHdl(LINK(this, LayoutManager, MenuBarClose));
- }
+ // TODO remove link on sal_False ?!
+ pMenuBar->ShowCloseButton(bShowCloseButton);
+ pMenuBar->SetCloseButtonClickHdl(LINK(this, LayoutManager, MenuBarClose));
}
}
}
@@ -2592,19 +2592,19 @@ void LayoutManager::implts_notifyListeners(short nEvent, const uno::Any& rInfoPa
{
lang::EventObject aSource( static_cast< ::cppu::OWeakObject*>(this) );
::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<frame::XLayoutManagerListener>::get());
- if (pContainer!=nullptr)
+ if (pContainer==nullptr)
+ return;
+
+ ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
+ while (pIterator.hasMoreElements())
{
- ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
- while (pIterator.hasMoreElements())
+ try
{
- try
- {
- static_cast<frame::XLayoutManagerListener*>(pIterator.next())->layoutEvent(aSource, nEvent, rInfoParam);
- }
- catch( const uno::RuntimeException& )
- {
- pIterator.remove();
- }
+ static_cast<frame::XLayoutManagerListener*>(pIterator.next())->layoutEvent(aSource, nEvent, rInfoParam);
+ }
+ catch( const uno::RuntimeException& )
+ {
+ pIterator.remove();
}
}
}
@@ -2851,40 +2851,40 @@ void SAL_CALL LayoutManager::elementInserted( const ui::ConfigurationEvent& Even
rtl::Reference< ToolbarLayoutManager > xToolbarManager( m_xToolbarManager );
aReadLock.clear();
- if ( xFrame.is() )
- {
- OUString aElementType;
- OUString aElementName;
- bool bRefreshLayout(false);
+ if ( !xFrame.is() )
+ return;
+
+ OUString aElementType;
+ OUString aElementName;
+ bool bRefreshLayout(false);
- parseResourceURL( Event.ResourceURL, aElementType, aElementName );
- if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
+ parseResourceURL( Event.ResourceURL, aElementType, aElementName );
+ if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
+ {
+ if ( xToolbarManager.is() )
{
- if ( xToolbarManager.is() )
- {
- xToolbarManager->elementInserted( Event );
- bRefreshLayout = xToolbarManager->isLayoutDirty();
- }
+ xToolbarManager->elementInserted( Event );
+ bRefreshLayout = xToolbarManager->isLayoutDirty();
}
- else if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_MENUBAR ))
+ }
+ else if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_MENUBAR ))
+ {
+ Reference< XUIElement > xUIElement = implts_findElement( Event.ResourceURL );
+ Reference< XUIElementSettings > xElementSettings( xUIElement, UNO_QUERY );
+ if ( xElementSettings.is() )
{
- Reference< XUIElement > xUIElement = implts_findElement( Event.ResourceURL );
- Reference< XUIElementSettings > xElementSettings( xUIElement, UNO_QUERY );
- if ( xElementSettings.is() )
+ uno::Reference< XPropertySet > xPropSet( xElementSettings, uno::UNO_QUERY );
+ if ( xPropSet.is() )
{
- 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( "ConfigurationSource", makeAny( m_xDocCfgMgr ));
- }
- xElementSettings->updateSettings();
+ if ( Event.Source == uno::Reference< uno::XInterface >( m_xDocCfgMgr, uno::UNO_QUERY ))
+ xPropSet->setPropertyValue( "ConfigurationSource", makeAny( m_xDocCfgMgr ));
}
+ xElementSettings->updateSettings();
}
-
- if ( bRefreshLayout )
- doLayout();
}
+
+ if ( bRefreshLayout )
+ doLayout();
}
void SAL_CALL LayoutManager::elementRemoved( const ui::ConfigurationEvent& Event )
@@ -2898,80 +2898,80 @@ void SAL_CALL LayoutManager::elementRemoved( const ui::ConfigurationEvent& Event
Reference< ui::XUIConfigurationManager > xDocCfgMgr( m_xDocCfgMgr );
aReadLock.clear();
- if ( xFrame.is() )
- {
- OUString aElementType;
- OUString aElementName;
- bool bRefreshLayout(false);
+ if ( !xFrame.is() )
+ return;
+
+ OUString aElementType;
+ OUString aElementName;
+ bool bRefreshLayout(false);
- parseResourceURL( Event.ResourceURL, aElementType, aElementName );
- if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
+ parseResourceURL( Event.ResourceURL, aElementType, aElementName );
+ if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
+ {
+ if ( xToolbarManager.is() )
{
- if ( xToolbarManager.is() )
- {
- xToolbarManager->elementRemoved( Event );
- bRefreshLayout = xToolbarManager->isLayoutDirty();
- }
+ xToolbarManager->elementRemoved( Event );
+ bRefreshLayout = xToolbarManager->isLayoutDirty();
}
- else
+ }
+ else
+ {
+ Reference< XUIElement > xUIElement = implts_findElement( Event.ResourceURL );
+ Reference< XUIElementSettings > xElementSettings( xUIElement, UNO_QUERY );
+ if ( xElementSettings.is() )
{
- Reference< XUIElement > xUIElement = implts_findElement( Event.ResourceURL );
- Reference< XUIElementSettings > xElementSettings( xUIElement, UNO_QUERY );
- if ( xElementSettings.is() )
- {
- bool bNoSettings( false );
- OUString aConfigSourcePropName( "ConfigurationSource" );
- Reference< XInterface > xElementCfgMgr;
- Reference< XPropertySet > xPropSet( xElementSettings, UNO_QUERY );
+ bool bNoSettings( false );
+ OUString aConfigSourcePropName( "ConfigurationSource" );
+ Reference< XInterface > xElementCfgMgr;
+ Reference< XPropertySet > xPropSet( xElementSettings, UNO_QUERY );
- if ( xPropSet.is() )
- xPropSet->getPropertyValue( aConfigSourcePropName ) >>= xElementCfgMgr;
+ if ( xPropSet.is() )
+ xPropSet->getPropertyValue( aConfigSourcePropName ) >>= xElementCfgMgr;
- if ( !xElementCfgMgr.is() )
- return;
+ if ( !xElementCfgMgr.is() )
+ return;
- // Check if the same UI configuration manager has changed => check further
- if ( Event.Source == xElementCfgMgr )
+ // Check if the same UI configuration manager has changed => check further
+ if ( Event.Source == xElementCfgMgr )
+ {
+ // Same UI configuration manager where our element has its settings
+ if ( Event.Source == Reference< XInterface >( xDocCfgMgr, UNO_QUERY ))
{
- // Same UI configuration manager where our element has its settings
- if ( Event.Source == Reference< XInterface >( xDocCfgMgr, UNO_QUERY ))
+ // document settings removed
+ if ( xModuleCfgMgr->hasSettings( Event.ResourceURL ))
{
- // document settings removed
- if ( xModuleCfgMgr->hasSettings( Event.ResourceURL ))
- {
- xPropSet->setPropertyValue( aConfigSourcePropName, makeAny( m_xModuleCfgMgr ));
- xElementSettings->updateSettings();
- return;
- }
+ xPropSet->setPropertyValue( aConfigSourcePropName, makeAny( m_xModuleCfgMgr ));
+ xElementSettings->updateSettings();
+ return;
}
-
- bNoSettings = true;
}
- // No settings anymore, element must be destroyed
- if ( xContainerWindow.is() && bNoSettings )
+ bNoSettings = true;
+ }
+
+ // No settings anymore, element must be destroyed
+ if ( xContainerWindow.is() && bNoSettings )
+ {
+ if ( aElementType.equalsIgnoreAsciiCase("menubar") &&
+ aElementName.equalsIgnoreAsciiCase("menubar") )
{
- if ( aElementType.equalsIgnoreAsciiCase("menubar") &&
- aElementName.equalsIgnoreAsciiCase("menubar") )
- {
- SystemWindow* pSysWindow = getTopSystemWindow( xContainerWindow );
- if ( pSysWindow && !m_bInplaceMenuSet )
- pSysWindow->SetMenuBar( nullptr );
+ SystemWindow* pSysWindow = getTopSystemWindow( xContainerWindow );
+ if ( pSysWindow && !m_bInplaceMenuSet )
+ pSysWindow->SetMenuBar( nullptr );
- Reference< XComponent > xComp( xMenuBar, UNO_QUERY );
- if ( xComp.is() )
- xComp->dispose();
+ Reference< XComponent > xComp( xMenuBar, UNO_QUERY );
+ if ( xComp.is() )
+ xComp->dispose();
- SolarMutexGuard g;
- m_xMenuBar.clear();
- }
+ SolarMutexGuard g;
+ m_xMenuBar.clear();
}
}
}
-
- if ( bRefreshLayout )
- doLayout();
}
+
+ if ( bRefreshLayout )
+ doLayout();
}
void SAL_CALL LayoutManager::elementReplaced( const ui::ConfigurationEvent& Event )
@@ -2981,45 +2981,45 @@ void SAL_CALL LayoutManager::elementReplaced( const ui::ConfigurationEvent& Even
rtl::Reference< ToolbarLayoutManager > xToolbarManager( m_xToolbarManager );
aReadLock.clear();
- if ( xFrame.is() )
- {
- OUString aElementType;
- OUString aElementName;
- bool bRefreshLayout(false);
+ if ( !xFrame.is() )
+ return;
- parseResourceURL( Event.ResourceURL, aElementType, aElementName );
- if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
+ OUString aElementType;
+ OUString aElementName;
+ bool bRefreshLayout(false);
+
+ parseResourceURL( Event.ResourceURL, aElementType, aElementName );
+ if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
+ {
+ if ( xToolbarManager.is() )
{
- if ( xToolbarManager.is() )
- {
- xToolbarManager->elementReplaced( Event );
- bRefreshLayout = xToolbarManager->isLayoutDirty();
- }
+ xToolbarManager->elementReplaced( Event );
+ bRefreshLayout = xToolbarManager->isLayoutDirty();
}
- else
+ }
+ else
+ {
+ Reference< XUIElement > xUIElement = implts_findElement( Event.ResourceURL );
+ Reference< XUIElementSettings > xElementSettings( xUIElement, UNO_QUERY );
+ if ( xElementSettings.is() )
{
- Reference< XUIElement > xUIElement = implts_findElement( Event.ResourceURL );
- Reference< XUIElementSettings > xElementSettings( xUIElement, UNO_QUERY );
- if ( xElementSettings.is() )
- {
- Reference< XInterface > xElementCfgMgr;
- Reference< XPropertySet > xPropSet( xElementSettings, UNO_QUERY );
+ Reference< XInterface > xElementCfgMgr;
+ Reference< XPropertySet > xPropSet( xElementSettings, UNO_QUERY );
- if ( xPropSet.is() )
- xPropSet->getPropertyValue( "ConfigurationSource" ) >>= xElementCfgMgr;
+ if ( xPropSet.is() )
+ xPropSet->getPropertyValue( "ConfigurationSource" ) >>= xElementCfgMgr;
- if ( !xElementCfgMgr.is() )
- return;
+ if ( !xElementCfgMgr.is() )
+ return;
- // Check if the same UI configuration manager has changed => update settings
- if ( Event.Source == xElementCfgMgr )
- xElementSettings->updateSettings();
- }
+ // Check if the same UI configuration manager has changed => update settings
+ if ( Event.Source == xElementCfgMgr )
+ xElementSettings->updateSettings();
}
-
- if ( bRefreshLayout )
- doLayout();
}
+
+ if ( bRefreshLayout )
+ doLayout();
}
void SAL_CALL LayoutManager::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle,
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index 1bc783916b60..9bb4c8e2a102 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -910,73 +910,74 @@ void ToolbarLayoutManager::childWindowEvent( VclSimpleEvent const * pEvent )
// To enable toolbar controllers to change their image when a sub-toolbar function
// is activated, we need this mechanism. We have NO connection between these toolbars
// anymore!
- if ( auto pWindowEvent = dynamic_cast< const VclWindowEvent* >(pEvent) )
+ auto pWindowEvent = dynamic_cast< const VclWindowEvent* >(pEvent);
+ if (!pWindowEvent)
+ return;
+
+ if ( pEvent->GetId() == VclEventId::ToolboxSelect )
{
- if ( pEvent->GetId() == VclEventId::ToolboxSelect )
+ OUString aToolbarName;
+ OUString aCommand;
+ ToolBox* pToolBox = getToolboxPtr( pWindowEvent->GetWindow() );
+
+ if ( pToolBox )
+ {
+ aToolbarName = retrieveToolbarNameFromHelpURL( pToolBox );
+ sal_uInt16 nId = pToolBox->GetCurItemId();
+ if ( nId > 0 )
+ aCommand = pToolBox->GetItemCommand( nId );
+ }
+
+ if ( !aToolbarName.isEmpty() && !aCommand.isEmpty() )
{
- OUString aToolbarName;
- OUString aCommand;
- ToolBox* pToolBox = getToolboxPtr( pWindowEvent->GetWindow() );
+ SolarMutexClearableGuard aReadLock;
+ ::std::vector< uno::Reference< ui::XUIFunctionListener > > aListenerArray;
- if ( pToolBox )
+ for (auto const& elem : m_aUIElements)
{
- aToolbarName = retrieveToolbarNameFromHelpURL( pToolBox );
- sal_uInt16 nId = pToolBox->GetCurItemId();
- if ( nId > 0 )
- aCommand = pToolBox->GetItemCommand( nId );
+ if ( elem.m_xUIElement.is() )
+ {
+ uno::Reference< ui::XUIFunctionListener > xListener( elem.m_xUIElement, uno::UNO_QUERY );
+ if ( xListener.is() )
+ aListenerArray.push_back( xListener );
+ }
}
+ aReadLock.clear();
- if ( !aToolbarName.isEmpty() && !aCommand.isEmpty() )
+ const sal_uInt32 nCount = aListenerArray.size();
+ for ( sal_uInt32 i = 0; i < nCount; ++i )
{
- SolarMutexClearableGuard aReadLock;
- ::std::vector< uno::Reference< ui::XUIFunctionListener > > aListenerArray;
-
- for (auto const& elem : m_aUIElements)
+ try
{
- if ( elem.m_xUIElement.is() )
- {
- uno::Reference< ui::XUIFunctionListener > xListener( elem.m_xUIElement, uno::UNO_QUERY );
- if ( xListener.is() )
- aListenerArray.push_back( xListener );
- }
+ aListenerArray[i]->functionExecute( aToolbarName, aCommand );
}
- aReadLock.clear();
-
- const sal_uInt32 nCount = aListenerArray.size();
- for ( sal_uInt32 i = 0; i < nCount; ++i )
+ catch (const uno::RuntimeException&)
+ {
+ throw;
+ }
+ catch (const uno::Exception&)
{
- try
- {
- aListenerArray[i]->functionExecute( aToolbarName, aCommand );
- }
- catch (const uno::RuntimeException&)
- {
- throw;
- }
- catch (const uno::Exception&)
- {
- }
}
}
}
- else if ( pEvent->GetId() == VclEventId::ToolboxFormatChanged )
+ }
+ else if ( pEvent->GetId() == VclEventId::ToolboxFormatChanged )
+ {
+ if ( !implts_isToolbarCreationActive() )
{
- if ( !implts_isToolbarCreationActive() )
+ ToolBox* pToolBox = getToolboxPtr( static_cast<VclWindowEvent const *>(pEvent)->GetWindow() );
+ if ( pToolBox )
{
- ToolBox* pToolBox = getToolboxPtr( static_cast<VclWindowEvent const *>(pEvent)->GetWindow() );
- if ( pToolBox )
+ OUString aToolbarName = retrieveToolbarNameFromHelpURL( pToolBox );
+ if ( !aToolbarName.isEmpty() )
{
- OUString aToolbarName = retrieveToolbarNameFromHelpURL( pToolBox );
- if ( !aToolbarName.isEmpty() )
- {
- OUString aToolbarUrl = "private:resource/toolbar/" + aToolbarName;
+ OUString aToolbarUrl = "private:resource/toolbar/" + aToolbarName;
- UIElement aToolbar = implts_findToolbar( aToolbarUrl );
- if ( aToolbar.m_xUIElement.is() && !aToolbar.m_bFloating )
- {
- implts_setLayoutDirty();
- m_pParentLayouter->requestLayout();
- }
+ UIElement aToolbar = implts_findToolbar( aToolbarUrl );
+ if ( aToolbar.m_xUIElement.is() && !aToolbar.m_bFloating )
+ {
+ implts_setLayoutDirty();
+ m_pParentLayouter->requestLayout();
}
}
}
@@ -1187,22 +1188,22 @@ void ToolbarLayoutManager::implts_createCustomToolBars()
uno::Reference< ui::XUIConfigurationManager > xDocCfgMgr = m_xDocCfgMgr;
aReadLock.clear();
- if ( xFrame.is() )
- {
- if (isPreviewFrame())
- return; // no custom toolbars for preview frame!
+ if ( !xFrame.is() )
+ return;
- uno::Sequence< uno::Sequence< beans::PropertyValue > > aTbxSeq;
- if ( xDocCfgMgr.is() )
- {
- aTbxSeq = xDocCfgMgr->getUIElementsInfo( ui::UIElementType::TOOLBAR );
- implts_createCustomToolBars( aTbxSeq ); // first create all document based toolbars
- }
- if ( xModuleCfgMgr.is() )
- {
- aTbxSeq = xModuleCfgMgr->getUIElementsInfo( ui::UIElementType::TOOLBAR );
- implts_createCustomToolBars( aTbxSeq ); // second create module based toolbars
- }
+ if (isPreviewFrame())
+ return; // no custom toolbars for preview frame!
+
+ uno::Sequence< uno::Sequence< beans::PropertyValue > > aTbxSeq;
+ if ( xDocCfgMgr.is() )
+ {
+ aTbxSeq = xDocCfgMgr->getUIElementsInfo( ui::UIElementType::TOOLBAR );
+ implts_createCustomToolBars( aTbxSeq ); // first create all document based toolbars
+ }
+ if ( xModuleCfgMgr.is() )
+ {
+ aTbxSeq = xModuleCfgMgr->getUIElementsInfo( ui::UIElementType::TOOLBAR );
+ implts_createCustomToolBars( aTbxSeq ); // second create module based toolbars
}
}
@@ -1300,21 +1301,21 @@ void ToolbarLayoutManager::implts_createCustomToolBars( const uno::Sequence< uno
void ToolbarLayoutManager::implts_createCustomToolBar( const OUString& aTbxResName, const OUString& aTitle )
{
- if ( !aTbxResName.isEmpty() )
- {
- if ( !createToolbar( aTbxResName ) )
- SAL_WARN("fwk.uielement", "ToolbarLayoutManager cannot create custom toolbar");
+ if ( aTbxResName.isEmpty() )
+ return;
- uno::Reference< ui::XUIElement > xUIElement = getToolbar( aTbxResName );
+ if ( !createToolbar( aTbxResName ) )
+ SAL_WARN("fwk.uielement", "ToolbarLayoutManager cannot create custom toolbar");
- if ( !aTitle.isEmpty() && xUIElement.is() )
- {
- SolarMutexGuard aGuard;
+ uno::Reference< ui::XUIElement > xUIElement = getToolbar( aTbxResName );
- vcl::Window* pWindow = getWindowFromXUIElement( xUIElement );
- if ( pWindow )
- pWindow->SetText( aTitle );
- }
+ if ( !aTitle.isEmpty() && xUIElement.is() )
+ {
+ SolarMutexGuard aGuard;
+
+ vcl::Window* pWindow = getWindowFromXUIElement( xUIElement );
+ if ( pWindow )
+ pWindow->SetText( aTitle );
}
}
@@ -1330,45 +1331,45 @@ void ToolbarLayoutManager::implts_reparentToolbars()
aWriteLock.clear();
SolarMutexGuard aGuard;
- if ( pContainerWindow )
+ if ( !pContainerWindow )
+ return;
+
+ for (auto const& elem : aUIElementVector)
{
- for (auto const& elem : aUIElementVector)
+ uno::Reference< ui::XUIElement > xUIElement( elem.m_xUIElement );
+ if ( xUIElement.is() )
{
- uno::Reference< ui::XUIElement > xUIElement( elem.m_xUIElement );
- if ( xUIElement.is() )
+ uno::Reference< awt::XWindow > xWindow;
+ try
{
- uno::Reference< awt::XWindow > xWindow;
- try
- {
- // We have to retrieve the window reference with try/catch as it is
- // possible that all elements have been disposed!
- xWindow.set( xUIElement->getRealInterface(), uno::UNO_QUERY );
- }
- catch (const uno::RuntimeException&)
- {
- throw;
- }
- catch (const uno::Exception&)
- {
- }
+ // We have to retrieve the window reference with try/catch as it is
+ // possible that all elements have been disposed!
+ xWindow.set( xUIElement->getRealInterface(), uno::UNO_QUERY );
+ }
+ catch (const uno::RuntimeException&)
+ {
+ throw;
+ }
+ catch (const uno::Exception&)
+ {
+ }
- VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
- if ( pWindow )
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
+ if ( pWindow )
+ {
+ // Reparent our child windows according to their current state.
+ if ( elem.m_bFloating )
+ pWindow->SetParent( pContainerWindow );
+ else
{
- // Reparent our child windows according to their current state.
- if ( elem.m_bFloating )
- pWindow->SetParent( pContainerWindow );
+ if ( elem.m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_TOP )
+ pWindow->SetParent( pTopDockWindow );
+ else if ( elem.m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM )
+ pWindow->SetParent( pBottomDockWindow );
+ else if ( elem.m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_LEFT )
+ pWindow->SetParent( pLeftDockWindow );
else
- {
- if ( elem.m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_TOP )
- pWindow->SetParent( pTopDockWindow );
- else if ( elem.m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM )
- pWindow->SetParent( pBottomDockWindow );
- else if ( elem.m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_LEFT )
- pWindow->SetParent( pLeftDockWindow );
- else
- pWindow->SetParent( pRightDockWindow );
- }
+ pWindow->SetParent( pRightDockWindow );
}
}
}
@@ -1398,118 +1399,118 @@ void ToolbarLayoutManager::implts_setElementData( UIElement& rElement, const uno
vcl::Window* pWindow( nullptr );
ToolBox* pToolBox( nullptr );
- if ( rDockWindow.is() && xWindow.is() )
+ if ( !(rDockWindow.is() && xWindow.is()) )
+ return;
+
{
+ SolarMutexGuard aGuard;
+ pWindow = VCLUnoHelper::GetWindow( xWindow ).get();
+ if ( pWindow )
{
- SolarMutexGuard aGuard;
- pWindow = VCLUnoHelper::GetWindow( xWindow ).get();
- if ( pWindow )
- {
- OUString aText = pWindow->GetText();
- if ( aText.isEmpty() )
- pWindow->SetText( rElement.m_aUIName );
- if ( rElement.m_bNoClose )
- pWindow->SetStyle( pWindow->GetStyle() & ~WB_CLOSEABLE );
- if ( pWindow->GetType() == WindowType::TOOLBOX )
- pToolBox = static_cast<ToolBox *>(pWindow);
- }
- if ( pToolBox )
- {
- pToolBox->SetButtonType( rElement.m_nStyle );
- if ( rElement.m_bNoClose )
- pToolBox->SetFloatStyle( pToolBox->GetFloatStyle() & ~WB_CLOSEABLE );
- }
+ OUString aText = pWindow->GetText();
+ if ( aText.isEmpty() )
+ pWindow->SetText( rElement.m_aUIName );
+ if ( rElement.m_bNoClose )
+ pWindow->SetStyle( pWindow->GetStyle() & ~WB_CLOSEABLE );
+ if ( pWindow->GetType() == WindowType::TOOLBOX )
+ pToolBox = static_cast<ToolBox *>(pWindow);
}
-
- if ( rElement.m_bFloating )
+ if ( pToolBox )
{
- if ( pWindow )
- {
- SolarMutexGuard aGuard;
- OUString aText = pWindow->GetText();
- if ( aText.isEmpty() )
- pWindow->SetText( rElement.m_aUIName );
- }
+ pToolBox->SetButtonType( rElement.m_nStyle );
+ if ( rElement.m_bNoClose )
+ pToolBox->SetFloatStyle( pToolBox->GetFloatStyle() & ~WB_CLOSEABLE );
+ }
+ }
- awt::Point aPos(rElement.m_aFloatingData.m_aPos);
- bool bWriteData( false );
- bool bUndefPos = hasDefaultPosValue( rElement.m_aFloatingData.m_aPos );
- bool bSetSize = ( rElement.m_aFloatingData.m_aSize.Width != 0 &&
- rElement.m_aFloatingData.m_aSize.Height != 0 );
- rDockWindow->setFloatingMode( true );
- if ( bUndefPos )
- {
- aPos = implts_findNextCascadeFloatingPos();
- rElement.m_aFloatingData.m_aPos = aPos; // set new cascaded position
- bWriteData = true;
- }
+ if ( rElement.m_bFloating )
+ {
+ if ( pWindow )
+ {
+ SolarMutexGuard aGuard;
+ OUString aText = pWindow->GetText();
+ if ( aText.isEmpty() )
+ pWindow->SetText( rElement.m_aUIName );
+ }
- if( bSetSize )
- xWindow->setOutputSize(rElement.m_aFloatingData.m_aSize);
- else
- {
- if( pToolBox )
- {
- // set an optimal initial floating size
- SolarMutexGuard aGuard;
- ::Size aSize( pToolBox->CalcFloatingWindowSizePixel() );
- pToolBox->SetOutputSizePixel( aSize );
- }
- }
+ awt::Point aPos(rElement.m_aFloatingData.m_aPos);
+ bool bWriteData( false );
+ bool bUndefPos = hasDefaultPosValue( rElement.m_aFloatingData.m_aPos );
+ bool bSetSize = ( rElement.m_aFloatingData.m_aSize.Width != 0 &&
+ rElement.m_aFloatingData.m_aSize.Height != 0 );
+ rDockWindow->setFloatingMode( true );
+ if ( bUndefPos )
+ {
+ aPos = implts_findNextCascadeFloatingPos();
+ rElement.m_aFloatingData.m_aPos = aPos; // set new cascaded position
+ bWriteData = true;
+ }
- // #i60882# IMPORTANT: Set position after size as it is
- // possible that we position some part of the toolbar
- // outside of the desktop. A default constructed toolbar
- // always has one line. Now VCL automatically
- // position the toolbar back into the desktop. Therefore
- // we resize the toolbar with the new (wrong) position.
- // To fix this problem we have to set the size BEFORE the
- // position.
- xWindow->setPosSize( aPos.X, aPos.Y, 0, 0, awt::PosSize::POS );
-
- if ( bWriteData )
- implts_writeWindowStateData( rElement );
- if ( bShowElement && pWindow )
+ if( bSetSize )
+ xWindow->setOutputSize(rElement.m_aFloatingData.m_aSize);
+ else
+ {
+ if( pToolBox )
{
+ // set an optimal initial floating size
SolarMutexGuard aGuard;
- pWindow->Show( true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
+ ::Size aSize( pToolBox->CalcFloatingWindowSizePixel() );
+ pToolBox->SetOutputSizePixel( aSize );
}
}
- else
+
+ // #i60882# IMPORTANT: Set position after size as it is
+ // possible that we position some part of the toolbar
+ // outside of the desktop. A default constructed toolbar
+ // always has one line. Now VCL automatically
+ // position the toolbar back into the desktop. Therefore
+ // we resize the toolbar with the new (wrong) position.
+ // To fix this problem we have to set the size BEFORE the
+ // position.
+ xWindow->setPosSize( aPos.X, aPos.Y, 0, 0, awt::PosSize::POS );
+
+ if ( bWriteData )
+ implts_writeWindowStateData( rElement );
+ if ( bShowElement && pWindow )
{
- bool bSetSize( false );
- awt::Point aDockPos;
- ::Point aPixelPos;
- ::Size aSize;
+ SolarMutexGuard aGuard;
+ pWindow->Show( true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
+ }
+ }
+ else
+ {
+ bool bSetSize( false );
+ awt::Point aDockPos;
+ ::Point aPixelPos;
+ ::Size aSize;
- if ( pToolBox )
+ if ( pToolBox )
+ {
+ SolarMutexGuard aGuard;
+ pToolBox->SetAlign( ImplConvertAlignment(rElement.m_aDockedData.m_nDockedArea ) );
+ pToolBox->SetLineCount( 1 );
+ rDockWindow->setFloatingMode( false );
+ if ( rElement.m_aDockedData.m_bLocked )
+ rDockWindow->lock();
+ aSize = pToolBox->CalcWindowSizePixel();
+ bSetSize = true;
+
+ if ( isDefaultPos( rElement.m_aDockedData.m_aPos ))
{
- SolarMutexGuard aGuard;
- pToolBox->SetAlign( ImplConvertAlignment(rElement.m_aDockedData.m_nDockedArea ) );
- pToolBox->SetLineCount( 1 );
- rDockWindow->setFloatingMode( false );
- if ( rElement.m_aDockedData.m_bLocked )
- rDockWindow->lock();
- aSize = pToolBox->CalcWindowSizePixel();
- bSetSize = true;
-
- if ( isDefaultPos( rElement.m_aDockedData.m_aPos ))
- {
- implts_findNextDockingPos( rElement.m_aDockedData.m_nDockedArea, aSize, aDockPos, aPixelPos );
- rElement.m_aDockedData.m_aPos = aDockPos;
- }
+ implts_findNextDockingPos( rElement.m_aDockedData.m_nDockedArea, aSize, aDockPos, aPixelPos );
+ rElement.m_aDockedData.m_aPos = aDockPos;
}
+ }
- xWindow->setPosSize( aPixelPos.X(), aPixelPos.Y(), 0, 0, awt::PosSize::POS );
- if( bSetSize )
- xWindow->setOutputSize( AWTSize( aSize) );
+ xWindow->setPosSize( aPixelPos.X(), aPixelPos.Y(), 0, 0, awt::PosSize::POS );
+ if( bSetSize )
+ xWindow->setOutputSize( AWTSize( aSize) );
- if ( pWindow )
- {
- SolarMutexGuard aGuard;
- if ( !bShowElement )
- pWindow->Hide();
- }
+ if ( pWindow )
+ {
+ SolarMutexGuard aGuard;
+ if ( !bShowElement )
+ pWindow->Hide();
}
}
}
@@ -1566,52 +1567,52 @@ void ToolbarLayoutManager::implts_writeWindowStateData( const UIElement& rElemen
}
}
- if ( bPersistent && xPersistentWindowState.is() )
+ if ( !(bPersistent && xPersistentWindowState.is()) )
+ return;
+
+ try
{
- try
+ uno::Sequence< beans::PropertyValue > aWindowState( 9 );
+
+ aWindowState[0].Name = WINDOWSTATE_PROPERTY_DOCKED;
+ aWindowState[0].Value <<= !rElementData.m_bFloating;
+ aWindowState[1].Name = WINDOWSTATE_PROPERTY_VISIBLE;
+ aWindowState[1].Value <<= rElementData.m_bVisible;
+ aWindowState[2].Name = WINDOWSTATE_PROPERTY_DOCKINGAREA;
+ aWindowState[2].Value <<= rElementData.m_aDockedData.m_nDockedArea;
+
+ awt::Point aPos = rElementData.m_aDockedData.m_aPos;
+ aWindowState[3].Name = WINDOWSTATE_PROPERTY_DOCKPOS;
+ aWindowState[3].Value <<= aPos;
+
+ aPos = rElementData.m_aFloatingData.m_aPos;
+ aWindowState[4].Name = WINDOWSTATE_PROPERTY_POS;
+ aWindowState[4].Value <<= aPos;
+
+ aWindowState[5].Name = WINDOWSTATE_PROPERTY_SIZE;
+ aWindowState[5].Value <<= rElementData.m_aFloatingData.m_aSize;
+ aWindowState[6].Name = WINDOWSTATE_PROPERTY_UINAME;
+ aWindowState[6].Value <<= rElementData.m_aUIName;
+ aWindowState[7].Name = WINDOWSTATE_PROPERTY_LOCKED;
+ aWindowState[7].Value <<= rElementData.m_aDockedData.m_bLocked;
+ aWindowState[8].Name = WINDOWSTATE_PROPERTY_STYLE;
+ aWindowState[8].Value <<= static_cast<sal_uInt16>(rElementData.m_nStyle);
+
+ OUString aName = rElementData.m_aName;
+ if ( xPersistentWindowState->hasByName( aName ))
{
- uno::Sequence< beans::PropertyValue > aWindowState( 9 );
-
- aWindowState[0].Name = WINDOWSTATE_PROPERTY_DOCKED;
- aWindowState[0].Value <<= !rElementData.m_bFloating;
- aWindowState[1].Name = WINDOWSTATE_PROPERTY_VISIBLE;
- aWindowState[1].Value <<= rElementData.m_bVisible;
- aWindowState[2].Name = WINDOWSTATE_PROPERTY_DOCKINGAREA;
- aWindowState[2].Value <<= rElementData.m_aDockedData.m_nDockedArea;
-
- awt::Point aPos = rElementData.m_aDockedData.m_aPos;
- aWindowState[3].Name = WINDOWSTATE_PROPERTY_DOCKPOS;
- aWindowState[3].Value <<= aPos;
-
- aPos = rElementData.m_aFloatingData.m_aPos;
- aWindowState[4].Name = WINDOWSTATE_PROPERTY_POS;
- aWindowState[4].Value <<= aPos;
-
- aWindowState[5].Name = WINDOWSTATE_PROPERTY_SIZE;
- aWindowState[5].Value <<= rElementData.m_aFloatingData.m_aSize;
- aWindowState[6].Name = WINDOWSTATE_PROPERTY_UINAME;
- aWindowState[6].Value <<= rElementData.m_aUIName;
- aWindowState[7].Name = WINDOWSTATE_PROPERTY_LOCKED;
- aWindowState[7].Value <<= rElementData.m_aDockedData.m_bLocked;
- aWindowState[8].Name = WINDOWSTATE_PROPERTY_STYLE;
- aWindowState[8].Value <<= static_cast<sal_uInt16>(rElementData.m_nStyle);
-
- OUString aName = rElementData.m_aName;
- if ( xPersistentWindowState->hasByName( aName ))
- {
- uno::Reference< container::XNameReplace > xReplace( xPersistentWindowState, uno::UNO_QUERY );
- xReplace->replaceByName( aName, uno::makeAny( aWindowState ));
- }
- else
- {
- uno::Reference< container::XNameContainer > xInsert( xPersistentWindowState, uno::UNO_QUERY );
- xInsert->insertByName( aName, uno::makeAny( aWindowState ));
- }
+ uno::Reference< container::XNameReplace > xReplace( xPersistentWindowState, uno::UNO_QUERY );
+ xReplace->replaceByName( aName, uno::makeAny( aWindowState ));
}
- catch (const uno::Exception&)
+ else
{
+ uno::Reference< container::XNameContainer > xInsert( xPersistentWindowState, uno::UNO_QUERY );
+ xInsert->insertByName( aName, uno::makeAny( aWindowState ));
}
}
+ catch (const uno::Exception&)
+ {
+ }
}
/******************************************************************************
@@ -2865,103 +2866,103 @@ void ToolbarLayoutManager::implts_calcDockingPosSize(
// Docking outside of our docking window area =>
// Users want to dock before/after first/last docked element or to an empty docking area
- if ( bOpOutsideOfDockingArea )
+ if ( !bOpOutsideOfDockingArea )
+ return;
+
+ // set correct size for docking
+ implts_setTrackingRect( eDockedArea, rMousePos, aTrackingRect );
+ rTrackingRect = aTrackingRect;
+
+ if ( bHorizontalDockArea )
{
- // set correct size for docking
- implts_setTrackingRect( eDockedArea, rMousePos, aTrackingRect );
- rTrackingRect = aTrackingRect;
+ sal_Int32 nPosX( std::max( sal_Int32( rTrackingRect.Left()), sal_Int32( 0 )));
+ if (( nPosX + rTrackingRect.getWidth()) > aContainerWinSize.Width() )
+ nPosX = std::min( nPosX,
+ std::max( sal_Int32( aContainerWinSize.Width() - rTrackingRect.getWidth() ),
+ sal_Int32( 0 )));
- if ( bHorizontalDockArea )
+ sal_Int32 nSize = std::min( aContainerWinSize.Width(), rTrackingRect.getWidth() );
+ sal_Int32 nDockHeight = std::max( static_cast<sal_Int32>(aDockingAreaRect.getHeight()), sal_Int32( 0 ));
+ if ( nDockHeight == 0 )
{
- sal_Int32 nPosX( std::max( sal_Int32( rTrackingRect.Left()), sal_Int32( 0 )));
- if (( nPosX + rTrackingRect.getWidth()) > aContainerWinSize.Width() )
- nPosX = std::min( nPosX,
- std::max( sal_Int32( aContainerWinSize.Width() - rTrackingRect.getWidth() ),
- sal_Int32( 0 )));
-
- sal_Int32 nSize = std::min( aContainerWinSize.Width(), rTrackingRect.getWidth() );
- sal_Int32 nDockHeight = std::max( static_cast<sal_Int32>(aDockingAreaRect.getHeight()), sal_Int32( 0 ));
- if ( nDockHeight == 0 )
- {
- sal_Int32 nPosY( std::max( aDockingAreaRect.Top(), aDockingAreaRect.Bottom() ));
- if ( eDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM )
- nPosY -= rTrackingRect.getHeight();
- rTrackingRect.SetPos( Point( nPosX, nPosY ));
+ sal_Int32 nPosY( std::max( aDockingAreaRect.Top(), aDockingAreaRect.Bottom() ));
+ if ( eDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM )
+ nPosY -= rTrackingRect.getHeight();
+ rTrackingRect.SetPos( Point( nPosX, nPosY ));
+ rUIElement.m_aDockedData.m_aPos.Y = 0;
+ }
+ else if ( rMousePos.Y() < ( aDockingAreaRect.Top() + ( nDockHeight / 2 )))
+ {
+ rTrackingRect.SetPos( Point( nPosX, aDockingAreaRect.Top() - rTrackingRect.getHeight() ));
+ if ( eDockedArea == ui::DockingArea_DOCKINGAREA_TOP )
rUIElement.m_aDockedData.m_aPos.Y = 0;
- }
- else if ( rMousePos.Y() < ( aDockingAreaRect.Top() + ( nDockHeight / 2 )))
- {
- rTrackingRect.SetPos( Point( nPosX, aDockingAreaRect.Top() - rTrackingRect.getHeight() ));
- if ( eDockedArea == ui::DockingArea_DOCKINGAREA_TOP )
- rUIElement.m_aDockedData.m_aPos.Y = 0;
- else
- rUIElement.m_aDockedData.m_aPos.Y = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0;
- rDockingOperation = DOCKOP_BEFORE_COLROW;
- }
else
- {
- rTrackingRect.SetPos( Point( nPosX, aDockingAreaRect.Bottom() ));
- if ( eDockedArea == ui::DockingArea_DOCKINGAREA_TOP )
- rUIElement.m_aDockedData.m_aPos.Y = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0;
- else
- rUIElement.m_aDockedData.m_aPos.Y = 0;
- rDockingOperation = DOCKOP_AFTER_COLROW;
- }
- rTrackingRect.setWidth( nSize );
-
- {
- SolarMutexGuard aGuard;
- nPosX = pDockingAreaWindow->ScreenToOutputPixel(
- pContainerWindow->OutputToScreenPixel( rTrackingRect.TopLeft() )).X();
- }
- rUIElement.m_aDockedData.m_aPos.X = nPosX;
+ rUIElement.m_aDockedData.m_aPos.Y = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0;
+ rDockingOperation = DOCKOP_BEFORE_COLROW;
}
else
{
- sal_Int32 nMaxDockingAreaHeight = std::max<sal_Int32>( 0, nMaxLeftRightDockAreaSize );
- sal_Int32 nPosY( std::max<sal_Int32>( aTrackingRect.Top(), nTopDockingAreaSize ));
- if (( nPosY + aTrackingRect.getHeight()) > ( nTopDockingAreaSize + nMaxDockingAreaHeight ))
- nPosY = std::min( nPosY,
- std::max<sal_Int32>( nTopDockingAreaSize + ( nMaxDockingAreaHeight - aTrackingRect.getHeight() ),
- nTopDockingAreaSize ));
+ rTrackingRect.SetPos( Point( nPosX, aDockingAreaRect.Bottom() ));
+ if ( eDockedArea == ui::DockingArea_DOCKINGAREA_TOP )
+ rUIElement.m_aDockedData.m_aPos.Y = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0;
+ else
+ rUIElement.m_aDockedData.m_aPos.Y = 0;
+ rDockingOperation = DOCKOP_AFTER_COLROW;
+ }
+ rTrackingRect.setWidth( nSize );
- sal_Int32 nSize = std::min( nMaxDockingAreaHeight, static_cast<sal_Int32>(aTrackingRect.getHeight()) );
- sal_Int32 nDockWidth = std::max( static_cast<sal_Int32>(aDockingAreaRect.getWidth()), sal_Int32( 0 ));
- if ( nDockWidth == 0 )
- {
- sal_Int32 nPosX( std::max( aDockingAreaRect.Left(), aDockingAreaRect.Right() ));
- if ( eDockedArea == ui::DockingArea_DOCKINGAREA_RIGHT )
- nPosX -= rTrackingRect.getWidth();
- rTrackingRect.SetPos( Point( nPosX, nPosY ));
+ {
+ SolarMutexGuard aGuard;
+ nPosX = pDockingAreaWindow->ScreenToOutputPixel(
+ pContainerWindow->OutputToScreenPixel( rTrackingRect.TopLeft() )).X();
+ }
+ rUIElement.m_aDockedData.m_aPos.X = nPosX;
+ }
+ else
+ {
+ sal_Int32 nMaxDockingAreaHeight = std::max<sal_Int32>( 0, nMaxLeftRightDockAreaSize );
+ sal_Int32 nPosY( std::max<sal_Int32>( aTrackingRect.Top(), nTopDockingAreaSize ));
+ if (( nPosY + aTrackingRect.getHeight()) > ( nTopDockingAreaSize + nMaxDockingAreaHeight ))
+ nPosY = std::min( nPosY,
+ std::max<sal_Int32>( nTopDockingAreaSize + ( nMaxDockingAreaHeight - aTrackingRect.getHeight() ),
+ nTopDockingAreaSize ));
+
+ sal_Int32 nSize = std::min( nMaxDockingAreaHeight, static_cast<sal_Int32>(aTrackingRect.getHeight()) );
+ sal_Int32 nDockWidth = std::max( static_cast<sal_Int32>(aDockingAreaRect.getWidth()), sal_Int32( 0 ));
+ if ( nDockWidth == 0 )
+ {
+ sal_Int32 nPosX( std::max( aDockingAreaRect.Left(), aDockingAreaRect.Right() ));
+ if ( eDockedArea == ui::DockingArea_DOCKINGAREA_RIGHT )
+ nPosX -= rTrackingRect.getWidth();
+ rTrackingRect.SetPos( Point( nPosX, nPosY ));
+ rUIElement.m_aDockedData.m_aPos.X = 0;
+ }
+ else if ( rMousePos.X() < ( aDockingAreaRect.Left() + ( nDockWidth / 2 )))
+ {
+ rTrackingRect.SetPos( Point( aDockingAreaRect.Left() - rTrackingRect.getWidth(), nPosY ));
+ if ( eDockedArea == ui::DockingArea_DOCKINGAREA_LEFT )
rUIElement.m_aDockedData.m_aPos.X = 0;
- }
- else if ( rMousePos.X() < ( aDockingAreaRect.Left() + ( nDockWidth / 2 )))
- {
- rTrackingRect.SetPos( Point( aDockingAreaRect.Left() - rTrackingRect.getWidth(), nPosY ));
- if ( eDockedArea == ui::DockingArea_DOCKINGAREA_LEFT )
- rUIElement.m_aDockedData.m_aPos.X = 0;
- else
- rUIElement.m_aDockedData.m_aPos.X = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0;
- rDockingOperation = DOCKOP_BEFORE_COLROW;
- }
else
- {
- rTrackingRect.SetPos( Point( aDockingAreaRect.Right(), nPosY ));
- if ( eDockedArea == ui::DockingArea_DOCKINGAREA_LEFT )
- rUIElement.m_aDockedData.m_aPos.X = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0;
- else
- rUIElement.m_aDockedData.m_aPos.X = 0;
- rDockingOperation = DOCKOP_AFTER_COLROW;
- }
- rTrackingRect.setHeight( nSize );
+ rUIElement.m_aDockedData.m_aPos.X = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0;
+ rDockingOperation = DOCKOP_BEFORE_COLROW;
+ }
+ else
+ {
+ rTrackingRect.SetPos( Point( aDockingAreaRect.Right(), nPosY ));
+ if ( eDockedArea == ui::DockingArea_DOCKINGAREA_LEFT )
+ rUIElement.m_aDockedData.m_aPos.X = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0;
+ else
+ rUIElement.m_aDockedData.m_aPos.X = 0;
+ rDockingOperation = DOCKOP_AFTER_COLROW;
+ }
+ rTrackingRect.setHeight( nSize );
- {
- SolarMutexGuard aGuard;
- nPosY = pDockingAreaWindow->ScreenToOutputPixel(
- pContainerWindow->OutputToScreenPixel( rTrackingRect.TopLeft() )).Y();
- }
- rUIElement.m_aDockedData.m_aPos.Y = nPosY;
+ {
+ SolarMutexGuard aGuard;
+ nPosY = pDockingAreaWindow->ScreenToOutputPixel(
+ pContainerWindow->OutputToScreenPixel( rTrackingRect.TopLeft() )).Y();
}
+ rUIElement.m_aDockedData.m_aPos.Y = nPosY;
}
}
@@ -3132,55 +3133,55 @@ void ToolbarLayoutManager::implts_renumberRowColumnData(
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
// We have to change the persistent window state part
- if ( xPersistentWindowState.is() )
+ if ( !xPersistentWindowState.is() )
+ return;
+
+ try
{
- try
+ uno::Sequence< OUString > aWindowElements = xPersistentWindowState->getElementNames();
+ for ( sal_Int32 i = 0; i < aWindowElements.getLength(); i++ )
{
- uno::Sequence< OUString > aWindowElements = xPersistentWindowState->getElementNames();
- for ( sal_Int32 i = 0; i < aWindowElements.getLength(); i++ )
+ if ( rUIElement.m_aName != aWindowElements[i] )
{
- if ( rUIElement.m_aName != aWindowElements[i] )
+ try
{
- try
- {
- uno::Sequence< beans::PropertyValue > aPropValueSeq;
- awt::Point aDockedPos;
- ui::DockingArea nDockedArea( ui::DockingArea_DOCKINGAREA_DEFAULT );
+ uno::Sequence< beans::PropertyValue > aPropValueSeq;
+ awt::Point aDockedPos;
+ ui::DockingArea nDockedArea( ui::DockingArea_DOCKINGAREA_DEFAULT );
- xPersistentWindowState->getByName( aWindowElements[i] ) >>= aPropValueSeq;
- for ( sal_Int32 j = 0; j < aPropValueSeq.getLength(); j++ )
- {
- if ( aPropValueSeq[j].Name == WINDOWSTATE_PROPERTY_DOCKINGAREA )
- aPropValueSeq[j].Value >>= nDockedArea;
- else if ( aPropValueSeq[j].Name == WINDOWSTATE_PROPERTY_DOCKPOS )
- aPropValueSeq[j].Value >>= aDockedPos;
- }
-
- // Don't change toolbars without a valid docking position!
- if ( isDefaultPos( aDockedPos ))
- continue;
+ xPersistentWindowState->getByName( aWindowElements[i] ) >>= aPropValueSeq;
+ for ( sal_Int32 j = 0; j < aPropValueSeq.getLength(); j++ )
+ {
+ if ( aPropValueSeq[j].Name == WINDOWSTATE_PROPERTY_DOCKINGAREA )
+ aPropValueSeq[j].Value >>= nDockedArea;
+ else if ( aPropValueSeq[j].Name == WINDOWSTATE_PROPERTY_DOCKPOS )
+ aPropValueSeq[j].Value >>= aDockedPos;
+ }
- sal_Int32 nWindowRowCol = bHorzDockingArea ? aDockedPos.Y : aDockedPos.X;
- if (( nDockedArea == eDockingArea ) && ( nWindowRowCol >= nRowCol ))
- {
- if ( bHorzDockingArea )
- aDockedPos.Y += 1;
- else
- aDockedPos.X += 1;
+ // Don't change toolbars without a valid docking position!
+ if ( isDefaultPos( aDockedPos ))
+ continue;
- uno::Reference< container::XNameReplace > xReplace( xPersistentWindowState, uno::UNO_QUERY );
- xReplace->replaceByName( aWindowElements[i], makeAny( aPropValueSeq ));
- }
- }
- catch (const uno::Exception&)
+ sal_Int32 nWindowRowCol = bHorzDockingArea ? aDockedPos.Y : aDockedPos.X;
+ if (( nDockedArea == eDockingArea ) && ( nWindowRowCol >= nRowCol ))
{
+ if ( bHorzDockingArea )
+ aDockedPos.Y += 1;
+ else
+ aDockedPos.X += 1;
+
+ uno::Reference< container::XNameReplace > xReplace( xPersistentWindowState, uno::UNO_QUERY );
+ xReplace->replaceByName( aWindowElements[i], makeAny( aPropValueSeq ));
}
}
+ catch (const uno::Exception&)
+ {
+ }
}
}
- catch (const uno::Exception&)
- {
- }
+ }
+ catch (const uno::Exception&)
+ {
}
}
@@ -3197,42 +3198,42 @@ void SAL_CALL ToolbarLayoutManager::windowResized( const awt::WindowEvent& aEven
// operations. We will store the new position and size in the docking handlers.
// Do not do anything if we are in the middle of our layouting process. We will adapt the position
// and size of the user interface elements.
- if ( !bLocked && !bLayoutInProgress )
- {
- bool bNotify( false );
- uno::Reference< awt::XWindow > xWindow( aEvent.Source, uno::UNO_QUERY );
+ if ( bLocked || bLayoutInProgress )
+ return;
- UIElement aUIElement = implts_findToolbar( aEvent.Source );
- if ( aUIElement.m_xUIElement.is() )
- {
- if ( aUIElement.m_bFloating )
- {
- uno::Reference< awt::XWindow2 > xWindow2( xWindow, uno::UNO_QUERY );
+ bool bNotify( false );
+ uno::Reference< awt::XWindow > xWindow( aEvent.Source, uno::UNO_QUERY );
- if( xWindow2.is() )
- {
- awt::Rectangle aPos = xWindow2->getPosSize();
- awt::Size aSize = xWindow2->getOutputSize(); // always use output size for consistency
- bool bVisible = xWindow2->isVisible();
-
- // update element data
- aUIElement.m_aFloatingData.m_aPos = awt::Point(aPos.X, aPos.Y);
- aUIElement.m_aFloatingData.m_aSize = aSize;
- aUIElement.m_bVisible = bVisible;
- }
+ UIElement aUIElement = implts_findToolbar( aEvent.Source );
+ if ( aUIElement.m_xUIElement.is() )
+ {
+ if ( aUIElement.m_bFloating )
+ {
+ uno::Reference< awt::XWindow2 > xWindow2( xWindow, uno::UNO_QUERY );
- implts_writeWindowStateData( aUIElement );
- }
- else
+ if( xWindow2.is() )
{
- implts_setLayoutDirty();
- bNotify = true;
+ awt::Rectangle aPos = xWindow2->getPosSize();
+ awt::Size aSize = xWindow2->getOutputSize(); // always use output size for consistency
+ bool bVisible = xWindow2->isVisible();
+
+ // update element data
+ aUIElement.m_aFloatingData.m_aPos = awt::Point(aPos.X, aPos.Y);
+ aUIElement.m_aFloatingData.m_aSize = aSize;
+ aUIElement.m_bVisible = bVisible;
}
- }
- if ( bNotify )
- m_pParentLayouter->requestLayout();
+ implts_writeWindowStateData( aUIElement );
+ }
+ else
+ {
+ implts_setLayoutDirty();
+ bNotify = true;
+ }
}
+
+ if ( bNotify )
+ m_pParentLayouter->requestLayout();
}
void SAL_CALL ToolbarLayoutManager::windowMoved( const awt::WindowEvent& /*aEvent*/ )
@@ -3771,19 +3772,19 @@ void SAL_CALL ToolbarLayoutManager::closed( const lang::EventObject& e )
}
// destroy element
- if ( !aName.isEmpty() )
- {
- implts_writeWindowStateData( aUIElement );
- destroyToolbar( aName );
+ if ( aName.isEmpty() )
+ return;
- SolarMutexClearableGuard aReadLock;
- bool bLayoutDirty = m_bLayoutDirty;
- LayoutManager* pParentLayouter( m_pParentLayouter );
- aReadLock.clear();
+ implts_writeWindowStateData( aUIElement );
+ destroyToolbar( aName );
- if ( bLayoutDirty && pParentLayouter )
- pParentLayouter->requestLayout();
- }
+ SolarMutexClearableGuard aReadLock;
+ bool bLayoutDirty = m_bLayoutDirty;
+ LayoutManager* pParentLayouter( m_pParentLayouter );
+ aReadLock.clear();
+
+ if ( bLayoutDirty && pParentLayouter )
+ pParentLayouter->requestLayout();
}
void SAL_CALL ToolbarLayoutManager::endPopupMode( const awt::EndPopupModeEvent& /*e*/ )
@@ -3864,41 +3865,41 @@ void SAL_CALL ToolbarLayoutManager::elementRemoved( const ui::ConfigurationEvent
UIElement aUIElement = implts_findToolbar( rEvent.ResourceURL );
uno::Reference< ui::XUIElementSettings > xElementSettings( aUIElement.m_xUIElement, uno::UNO_QUERY );
- if ( xElementSettings.is() )
- {
- bool bNoSettings( false );
- OUString aConfigSourcePropName( "ConfigurationSource" );
- uno::Reference< uno::XInterface > xElementCfgMgr;
- uno::Reference< beans::XPropertySet > xPropSet( xElementSettings, uno::UNO_QUERY );
+ if ( !xElementSettings.is() )
+ return;
- if ( xPropSet.is() )
- xPropSet->getPropertyValue( aConfigSourcePropName ) >>= xElementCfgMgr;
+ bool bNoSettings( false );
+ OUString aConfigSourcePropName( "ConfigurationSource" );
+ uno::Reference< uno::XInterface > xElementCfgMgr;
+ uno::Reference< beans::XPropertySet > xPropSet( xElementSettings, uno::UNO_QUERY );
+
+ if ( xPropSet.is() )
+ xPropSet->getPropertyValue( aConfigSourcePropName ) >>= xElementCfgMgr;
- if ( !xElementCfgMgr.is() )
- return;
+ if ( !xElementCfgMgr.is() )
+ return;
- // Check if the same UI configuration manager has changed => check further
- if ( rEvent.Source == xElementCfgMgr )
+ // Check if the same UI configuration manager has changed => check further
+ if ( rEvent.Source == xElementCfgMgr )
+ {
+ // Same UI configuration manager where our element has its settings
+ if ( rEvent.Source == uno::Reference< uno::XInterface >( xDocCfgMgr, uno::UNO_QUERY ))
{
- // Same UI configuration manager where our element has its settings
- if ( rEvent.Source == uno::Reference< uno::XInterface >( xDocCfgMgr, uno::UNO_QUERY ))
+ // document settings removed
+ if ( xModuleCfgMgr->hasSettings( rEvent.ResourceURL ))
{
- // document settings removed
- if ( xModuleCfgMgr->hasSettings( rEvent.ResourceURL ))
- {
- xPropSet->setPropertyValue( aConfigSourcePropName, makeAny( xModuleCfgMgr ));
- xElementSettings->updateSettings();
- return;
- }
+ xPropSet->setPropertyValue( aConfigSourcePropName, makeAny( xModuleCfgMgr ));
+ xElementSettings->updateSettings();
+ return;
}
-
- bNoSettings = true;
}
- // No settings anymore, element must be destroyed
- if ( xContainerWindow.is() && bNoSettings )
- destroyToolbar( rEvent.ResourceURL );
+ bNoSettings = true;
}
+
+ // No settings anymore, element must be destroyed
+ if ( xContainerWindow.is() && bNoSettings )
+ destroyToolbar( rEvent.ResourceURL );
}
void SAL_CALL ToolbarLayoutManager::elementReplaced( const ui::ConfigurationEvent& rEvent )
@@ -3906,32 +3907,32 @@ void SAL_CALL ToolbarLayoutManager::elementReplaced( const ui::ConfigurationEven
UIElement aUIElement = implts_findToolbar( rEvent.ResourceURL );
uno::Reference< ui::XUIElementSettings > xElementSettings( aUIElement.m_xUIElement, uno::UNO_QUERY );
- if ( xElementSettings.is() )
- {
- uno::Reference< uno::XInterface > xElementCfgMgr;
- uno::Reference< beans::XPropertySet > xPropSet( xElementSettings, uno::UNO_QUERY );
+ if ( !xElementSettings.is() )
+ return;
- if ( xPropSet.is() )
- xPropSet->getPropertyValue( "ConfigurationSource" ) >>= xElementCfgMgr;
+ uno::Reference< uno::XInterface > xElementCfgMgr;
+ uno::Reference< beans::XPropertySet > xPropSet( xElementSettings, uno::UNO_QUERY );
- if ( !xElementCfgMgr.is() )
- return;
+ if ( xPropSet.is() )
+ xPropSet->getPropertyValue( "ConfigurationSource" ) >>= xElementCfgMgr;
- // Check if the same UI configuration manager has changed => update settings
- if ( rEvent.Source == xElementCfgMgr )
- {
- xElementSettings->updateSettings();
+ if ( !xElementCfgMgr.is() )
+ return;
- SolarMutexClearableGuard aWriteLock;
- bool bNotify = !aUIElement.m_bFloating;
- m_bLayoutDirty = bNotify;
- LayoutManager* pParentLayouter( m_pParentLayouter );
- aWriteLock.clear();
+ // Check if the same UI configuration manager has changed => update settings
+ if ( rEvent.Source != xElementCfgMgr )
+ return;
- if ( bNotify && pParentLayouter )
- pParentLayouter->requestLayout();
- }
- }
+ xElementSettings->updateSettings();
+
+ SolarMutexClearableGuard aWriteLock;
+ bool bNotify = !aUIElement.m_bFloating;
+ m_bLayoutDirty = bNotify;
+ LayoutManager* pParentLayouter( m_pParentLayouter );
+ aWriteLock.clear();
+
+ if ( bNotify && pParentLayouter )
+ pParentLayouter->requestLayout();
}
uno::Reference< ui::XUIElement > ToolbarLayoutManager::getToolbar( const OUString& aName )
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index 12368afce638..b25b0fea8f3a 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -1674,22 +1674,22 @@ void LoadEnv::impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::X
SolarMutexGuard aSolarGuard;
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow);
- if ( pWindow )
- {
- bool const preview( m_lMediaDescriptor.getUnpackedValueOrDefault(
- utl::MediaDescriptor::PROP_PREVIEW(), false) );
+ if ( !pWindow )
+ return;
- bool bForceFrontAndFocus(false);
- if ( !preview )
- {
- bForceFrontAndFocus = officecfg::Office::Common::View::NewDocumentHandling::ForceFocusAndToFront::get(xContext);
- }
+ bool const preview( m_lMediaDescriptor.getUnpackedValueOrDefault(
+ utl::MediaDescriptor::PROP_PREVIEW(), false) );
- if( pWindow->IsVisible() && (bForceFrontAndFocus || bForceToFront) )
- pWindow->ToTop( ToTopFlags::RestoreWhenMin | ToTopFlags::ForegroundTask );
- else
- pWindow->Show(true, (bForceFrontAndFocus || bForceToFront) ? ShowFlags::ForegroundTask : ShowFlags::NONE );
+ bool bForceFrontAndFocus(false);
+ if ( !preview )
+ {
+ bForceFrontAndFocus = officecfg::Office::Common::View::NewDocumentHandling::ForceFocusAndToFront::get(xContext);
}
+
+ if( pWindow->IsVisible() && (bForceFrontAndFocus || bForceToFront) )
+ pWindow->ToTop( ToTopFlags::RestoreWhenMin | ToTopFlags::ForegroundTask );
+ else
+ pWindow->Show(true, (bForceFrontAndFocus || bForceToFront) ? ShowFlags::ForegroundTask : ShowFlags::NONE );
}
void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::awt::XWindow >& xWindow)
diff --git a/framework/source/services/ContextChangeEventMultiplexer.cxx b/framework/source/services/ContextChangeEventMultiplexer.cxx
index 4dbc182ceaa5..d7e59bda0b87 100644
--- a/framework/source/services/ContextChangeEventMultiplexer.cxx
+++ b/framework/source/services/ContextChangeEventMultiplexer.cxx
@@ -161,32 +161,31 @@ void SAL_CALL ContextChangeEventMultiplexer::addContextChangeEventListener (
// Send out an initial event that informs the new listener about
// the current context.
- if (rxEventFocus.is() && pFocusDescriptor!=nullptr)
+ if (!(rxEventFocus.is() && pFocusDescriptor!=nullptr))
+ return;
+
+ if (pFocusDescriptor->msCurrentApplicationName.isEmpty() && pFocusDescriptor->msCurrentContextName.isEmpty()
+ && rxEventFocus.is())
{
- if (pFocusDescriptor->msCurrentApplicationName.isEmpty() && pFocusDescriptor->msCurrentContextName.isEmpty()
- && rxEventFocus.is())
+ Reference< lang::XServiceInfo > xServInfo( rxEventFocus, uno::UNO_QUERY );
+ if( xServInfo.is() && xServInfo->getImplementationName() == "com.sun.star.comp.chart2.ChartController")
{
- Reference< lang::XServiceInfo > xServInfo( rxEventFocus, uno::UNO_QUERY );
- if( xServInfo.is() && xServInfo->getImplementationName() == "com.sun.star.comp.chart2.ChartController")
- {
- css::ui::ContextChangeEventObject aEvent (
- rxEventFocus,
- "com.sun.star.chart2.ChartDocument",
- "Chart");
- rxListener->notifyContextChangeEvent(aEvent);
-
- return;
- }
+ css::ui::ContextChangeEventObject aEvent (
+ rxEventFocus,
+ "com.sun.star.chart2.ChartDocument",
+ "Chart");
+ rxListener->notifyContextChangeEvent(aEvent);
+ return;
}
- css::ui::ContextChangeEventObject aEvent (
- nullptr,
- pFocusDescriptor->msCurrentApplicationName,
- pFocusDescriptor->msCurrentContextName);
- rxListener->notifyContextChangeEvent(aEvent);
-
}
+
+ css::ui::ContextChangeEventObject aEvent (
+ nullptr,
+ pFocusDescriptor->msCurrentApplicationName,
+ pFocusDescriptor->msCurrentContextName);
+ rxListener->notifyContextChangeEvent(aEvent);
}
void SAL_CALL ContextChangeEventMultiplexer::removeContextChangeEventListener (
@@ -199,18 +198,18 @@ void SAL_CALL ContextChangeEventMultiplexer::removeContextChangeEventListener (
static_cast<XWeak*>(this), 0);
FocusDescriptor* pFocusDescriptor = GetFocusDescriptor(rxEventFocus, false);
- if (pFocusDescriptor != nullptr)
+ if (pFocusDescriptor == nullptr)
+ return;
+
+ ListenerContainer& rContainer (pFocusDescriptor->maListeners);
+ const ListenerContainer::iterator iListener (
+ ::std::find(rContainer.begin(), rContainer.end(), rxListener));
+ if (iListener != rContainer.end())
{
- ListenerContainer& rContainer (pFocusDescriptor->maListeners);
- const ListenerContainer::iterator iListener (
- ::std::find(rContainer.begin(), rContainer.end(), rxListener));
- if (iListener != rContainer.end())
- {
- rContainer.erase(iListener);
+ rContainer.erase(iListener);
- // We hold on to the focus descriptor even when the last listener has been removed.
- // This allows us to keep track of the current context and send it to new listeners.
- }
+ // We hold on to the focus descriptor even when the last listener has been removed.
+ // This allows us to keep track of the current context and send it to new listeners.
}
}
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index da4055e07937..bf08a705aa66 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -2708,22 +2708,22 @@ void lc_removeLockFile(AutoRecovery::TDocumentInfo const & rInfo)
#if !HAVE_FEATURE_MULTIUSER_ENVIRONMENT || HAVE_FEATURE_MACOSX_SANDBOX
(void) rInfo;
#else
- if ( rInfo.Document.is() )
+ if ( !rInfo.Document.is() )
+ return;
+
+ try
{
- try
- {
- css::uno::Reference< css::frame::XStorable > xStore(rInfo.Document, css::uno::UNO_QUERY_THROW);
- OUString aURL = xStore->getLocation();
- if ( !aURL.isEmpty() )
- {
- ::svt::DocumentLockFile aLockFile( aURL );
- aLockFile.RemoveFile();
- }
- }
- catch( const css::uno::Exception& )
+ css::uno::Reference< css::frame::XStorable > xStore(rInfo.Document, css::uno::UNO_QUERY_THROW);
+ OUString aURL = xStore->getLocation();
+ if ( !aURL.isEmpty() )
{
+ ::svt::DocumentLockFile aLockFile( aURL );
+ aLockFile.RemoveFile();
}
}
+ catch( const css::uno::Exception& )
+ {
+ }
#endif
}
@@ -3496,20 +3496,20 @@ void AutoRecovery::implts_informListener( Job eJob ,
// inform listener, which are registered for any URLs(!)
pListenerForURL = m_lListener.getContainer(sJob);
- if(pListenerForURL != nullptr)
+ if(pListenerForURL == nullptr)
+ return;
+
+ ::cppu::OInterfaceIteratorHelper pIt(*pListenerForURL);
+ while(pIt.hasMoreElements())
{
- ::cppu::OInterfaceIteratorHelper pIt(*pListenerForURL);
- while(pIt.hasMoreElements())
+ try
{
- try
- {
- css::uno::Reference< css::frame::XStatusListener > xListener(static_cast<css::frame::XStatusListener*>(pIt.next()), css::uno::UNO_QUERY);
- xListener->statusChanged(aEvent);
- }
- catch(const css::uno::RuntimeException&)
- {
- pIt.remove();
- }
+ css::uno::Reference< css::frame::XStatusListener > xListener(static_cast<css::frame::XStatusListener*>(pIt.next()), css::uno::UNO_QUERY);
+ xListener->statusChanged(aEvent);
+ }
+ catch(const css::uno::RuntimeException&)
+ {
+ pIt.remove();
}
}
}
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index aebeb9fa2503..11881c3ebefb 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -1319,49 +1319,49 @@ void SAL_CALL XFrameImpl::deactivate()
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Work only, if there something to do!
- if( eState != E_INACTIVE )
- {
+ if( eState == E_INACTIVE )
+ return;
- // 1) Deactivate all active children.
- if ( xActiveChild.is() && xActiveChild->isActive() )
- {
- xActiveChild->deactivate();
- }
- // 2) If I have the focus - I will lost it now.
- if( eState == E_FOCUS )
- {
- // Set new state INACTIVE(!) and send message to all listener.
- // Don't set ACTIVE as new state. This frame is deactivated for next time - due to activate().
- aWriteLock.reset();
- eState = E_ACTIVE;
- m_eActiveState = eState;
- aWriteLock.clear();
- implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_UI_DEACTIVATING );
- }
+ // 1) Deactivate all active children.
+ if ( xActiveChild.is() && xActiveChild->isActive() )
+ {
+ xActiveChild->deactivate();
+ }
- // 3) If I am active - I will be deactivated now.
- if( eState == E_ACTIVE )
- {
- // Set new state and send message to all listener.
- aWriteLock.reset();
- eState = E_INACTIVE;
- m_eActiveState = eState;
- aWriteLock.clear();
- implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_DEACTIVATING );
- }
+ // 2) If I have the focus - I will lost it now.
+ if( eState == E_FOCUS )
+ {
+ // Set new state INACTIVE(!) and send message to all listener.
+ // Don't set ACTIVE as new state. This frame is deactivated for next time - due to activate().
+ aWriteLock.reset();
+ eState = E_ACTIVE;
+ m_eActiveState = eState;
+ aWriteLock.clear();
+ implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_UI_DEACTIVATING );
+ }
- // 4) If there is a path from here to my parent...
- // ... I am on the top or in the middle of deactivated subtree and action was started here.
- // I must deactivate all frames from here to top, which are members of current path.
- // Stop, if THESE frame not the active frame of our parent!
- if ( xParent.is() && xParent->getActiveFrame() == xThis )
- {
- // We MUST break the path - otherwise we will get the focus - not our parent! ...
- // Attention: Our parent don't call us again - WE ARE NOT ACTIVE YET!
- // [ see step 3 and condition "if ( m_eActiveState!=INACTIVE ) ..." in this method! ]
- xParent->deactivate();
- }
+ // 3) If I am active - I will be deactivated now.
+ if( eState == E_ACTIVE )
+ {
+ // Set new state and send message to all listener.
+ aWriteLock.reset();
+ eState = E_INACTIVE;
+ m_eActiveState = eState;
+ aWriteLock.clear();
+ implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_DEACTIVATING );
+ }
+
+ // 4) If there is a path from here to my parent...
+ // ... I am on the top or in the middle of deactivated subtree and action was started here.
+ // I must deactivate all frames from here to top, which are members of current path.
+ // Stop, if THESE frame not the active frame of our parent!
+ if ( xParent.is() && xParent->getActiveFrame() == xThis )
+ {
+ // We MUST break the path - otherwise we will get the focus - not our parent! ...
+ // Attention: Our parent don't call us again - WE ARE NOT ACTIVE YET!
+ // [ see step 3 and condition "if ( m_eActiveState!=INACTIVE ) ..." in this method! ]
+ xParent->deactivate();
}
}
@@ -2493,33 +2493,33 @@ void SAL_CALL XFrameImpl::windowDeactivated( const css::lang::EventObject& )
aReadLock.clear();
- if( eActiveState != E_INACTIVE )
- {
- // Deactivation is always done implicitly by activation of another frame.
- // Only if no activation is done, deactivations have to be processed if the activated window
- // is a parent window of the last active Window!
- SolarMutexClearableGuard aSolarGuard;
- vcl::Window* pFocusWindow = Application::GetFocusWindow();
- if ( xContainerWindow.is() && xParent.is() &&
- !css::uno::Reference< css::frame::XDesktop >( xParent, css::uno::UNO_QUERY ).is()
- )
+ if( eActiveState == E_INACTIVE )
+ return;
+
+ // Deactivation is always done implicitly by activation of another frame.
+ // Only if no activation is done, deactivations have to be processed if the activated window
+ // is a parent window of the last active Window!
+ SolarMutexClearableGuard aSolarGuard;
+ vcl::Window* pFocusWindow = Application::GetFocusWindow();
+ if ( !(xContainerWindow.is() && xParent.is() &&
+ !css::uno::Reference< css::frame::XDesktop >( xParent, css::uno::UNO_QUERY ).is())
+ )
+ return;
+
+ css::uno::Reference< css::awt::XWindow > xParentWindow = xParent->getContainerWindow();
+ VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
+ //#i70261#: dialogs opened from an OLE object will cause a deactivate on the frame of the OLE object
+ // on Solaris/Linux at that time pFocusWindow is still NULL because the focus handling is different; right after
+ // the deactivation the focus will be set into the dialog!
+ // currently I see no case where a sub frame could get a deactivate with pFocusWindow being NULL permanently
+ // so for now this case is omitted from handled deactivations
+ if( pFocusWindow && pParentWindow->IsChild( pFocusWindow ) )
+ {
+ css::uno::Reference< css::frame::XFramesSupplier > xSupplier( xParent, css::uno::UNO_QUERY );
+ if( xSupplier.is() )
{
- css::uno::Reference< css::awt::XWindow > xParentWindow = xParent->getContainerWindow();
- VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
- //#i70261#: dialogs opened from an OLE object will cause a deactivate on the frame of the OLE object
- // on Solaris/Linux at that time pFocusWindow is still NULL because the focus handling is different; right after
- // the deactivation the focus will be set into the dialog!
- // currently I see no case where a sub frame could get a deactivate with pFocusWindow being NULL permanently
- // so for now this case is omitted from handled deactivations
- if( pFocusWindow && pParentWindow->IsChild( pFocusWindow ) )
- {
- css::uno::Reference< css::frame::XFramesSupplier > xSupplier( xParent, css::uno::UNO_QUERY );
- if( xSupplier.is() )
- {
- aSolarGuard.clear();
- xSupplier->setActiveFrame( css::uno::Reference< css::frame::XFrame >() );
- }
- }
+ aSolarGuard.clear();
+ xSupplier->setActiveFrame( css::uno::Reference< css::frame::XFrame >() );
}
}
}
@@ -2590,20 +2590,20 @@ void SAL_CALL XFrameImpl::windowShown( const css::lang::EventObject& )
impl_checkMenuCloser();
- if (xDesktopCheck.is())
- {
- static bool bFirstVisibleTask = true;
- osl::ClearableMutexGuard aGuard(aFirstVisibleLock);
- bool bMustBeTriggered = bFirstVisibleTask;
- bFirstVisibleTask = false;
- aGuard.clear();
+ if (!xDesktopCheck.is())
+ return;
- if (bMustBeTriggered)
- {
- css::uno::Reference< css::task::XJobExecutor > xExecutor
- = css::task::theJobExecutor::get( m_xContext );
- xExecutor->trigger( "onFirstVisibleTask" );
- }
+ static bool bFirstVisibleTask = true;
+ osl::ClearableMutexGuard aGuard(aFirstVisibleLock);
+ bool bMustBeTriggered = bFirstVisibleTask;
+ bFirstVisibleTask = false;
+ aGuard.clear();
+
+ if (bMustBeTriggered)
+ {
+ css::uno::Reference< css::task::XJobExecutor > xExecutor
+ = css::task::theJobExecutor::get( m_xContext );
+ xExecutor->trigger( "onFirstVisibleTask" );
}
}
@@ -2928,24 +2928,24 @@ void XFrameImpl::implts_sendFrameActionEvent( const css::frame::FrameAction& aAc
::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer(
cppu::UnoType<css::frame::XFrameActionListener>::get());
- if( pContainer != nullptr )
- {
- // Build action event.
- css::frame::FrameActionEvent aFrameActionEvent( static_cast< ::cppu::OWeakObject* >(this), this, aAction );
+ if( pContainer == nullptr )
+ return;
- // Get iterator for access to listener.
- ::cppu::OInterfaceIteratorHelper aIterator( *pContainer );
- // Send message to all listener.
- while( aIterator.hasMoreElements() )
+ // Build action event.
+ css::frame::FrameActionEvent aFrameActionEvent( static_cast< ::cppu::OWeakObject* >(this), this, aAction );
+
+ // Get iterator for access to listener.
+ ::cppu::OInterfaceIteratorHelper aIterator( *pContainer );
+ // Send message to all listener.
+ while( aIterator.hasMoreElements() )
+ {
+ try
{
- try
- {
- static_cast<css::frame::XFrameActionListener*>(aIterator.next())->frameAction( aFrameActionEvent );
- }
- catch( const css::uno::RuntimeException& )
- {
- aIterator.remove();
- }
+ static_cast<css::frame::XFrameActionListener*>(aIterator.next())->frameAction( aFrameActionEvent );
+ }
+ catch( const css::uno::RuntimeException& )
+ {
+ aIterator.remove();
}
}
}
@@ -2960,23 +2960,23 @@ void XFrameImpl::implts_resizeComponentWindow()
{
// usually the LayoutManager does the resizing
// in case there is no LayoutManager resizing has to be done here
- if ( !m_xLayoutManager.is() )
- {
- css::uno::Reference< css::awt::XWindow > xComponentWindow( getComponentWindow() );
- if( xComponentWindow.is() )
- {
- css::uno::Reference< css::awt::XDevice > xDevice( getContainerWindow(), css::uno::UNO_QUERY );
+ if ( m_xLayoutManager.is() )
+ return;
- // Convert relative size to output size.
- css::awt::Rectangle aRectangle = getContainerWindow()->getPosSize();
- css::awt::DeviceInfo aInfo = xDevice->getInfo();
- css::awt::Size aSize( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset,
- aRectangle.Height - aInfo.TopInset - aInfo.BottomInset );
+ css::uno::Reference< css::awt::XWindow > xComponentWindow( getComponentWindow() );
+ if( !xComponentWindow.is() )
+ return;
- // Resize our component window.
- xComponentWindow->setPosSize( 0, 0, aSize.Width, aSize.Height, css::awt::PosSize::POSSIZE );
- }
- }
+ css::uno::Reference< css::awt::XDevice > xDevice( getContainerWindow(), css::uno::UNO_QUERY );
+
+ // Convert relative size to output size.
+ css::awt::Rectangle aRectangle = getContainerWindow()->getPosSize();
+ css::awt::DeviceInfo aInfo = xDevice->getInfo();
+ css::awt::Size aSize( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset,
+ aRectangle.Height - aInfo.TopInset - aInfo.BottomInset );
+
+ // Resize our component window.
+ xComponentWindow->setPosSize( 0, 0, aSize.Width, aSize.Height, css::awt::PosSize::POSSIZE );
}
/*-****************************************************************************************************
@@ -3000,69 +3000,69 @@ void XFrameImpl::implts_setIconOnWindow()
aReadLock.clear();
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- if( xContainerWindow.is() && xController.is() )
- {
+ if( !(xContainerWindow.is() && xController.is()) )
+ return;
+
- // a) set default value to an invalid one. So we can start further searches for right icon id, if
- // first steps failed!
- // We must reset it to any fallback value - if no search step returns a valid result.
- sal_Int32 nIcon = -1;
+ // a) set default value to an invalid one. So we can start further searches for right icon id, if
+ // first steps failed!
+ // We must reset it to any fallback value - if no search step returns a valid result.
+ sal_Int32 nIcon = -1;
- // b) try to find information on controller propertyset directly
- // Don't forget to catch possible exceptions - because these property is an optional one!
- css::uno::Reference< css::beans::XPropertySet > xSet( xController, css::uno::UNO_QUERY );
- if( xSet.is() )
+ // b) try to find information on controller propertyset directly
+ // Don't forget to catch possible exceptions - because these property is an optional one!
+ css::uno::Reference< css::beans::XPropertySet > xSet( xController, css::uno::UNO_QUERY );
+ if( xSet.is() )
+ {
+ try
{
- try
- {
- css::uno::Reference< css::beans::XPropertySetInfo > const xPSI( xSet->getPropertySetInfo(),
- css::uno::UNO_SET_THROW );
- if ( xPSI->hasPropertyByName( "IconId" ) )
- xSet->getPropertyValue( "IconId" ) >>= nIcon;
- }
- catch( css::uno::Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("fwk");
- }
+ css::uno::Reference< css::beans::XPropertySetInfo > const xPSI( xSet->getPropertySetInfo(),
+ css::uno::UNO_SET_THROW );
+ if ( xPSI->hasPropertyByName( "IconId" ) )
+ xSet->getPropertyValue( "IconId" ) >>= nIcon;
}
-
- // c) if b) failed... analyze argument list of currently loaded document inside the frame to find the filter.
- // He can be used to detect right factory - and these can be used to match factory to icon...
- if( nIcon == -1 )
+ catch( css::uno::Exception& )
{
- css::uno::Reference< css::frame::XModel > xModel = xController->getModel();
- if( xModel.is() )
- {
- SvtModuleOptions::EFactory eFactory = SvtModuleOptions::ClassifyFactoryByModel(xModel);
- if (eFactory != SvtModuleOptions::EFactory::UNKNOWN_FACTORY)
- nIcon = SvtModuleOptions().GetFactoryIcon( eFactory );
- }
+ DBG_UNHANDLED_EXCEPTION("fwk");
}
+ }
- // d) if all steps failed - use fallback!
- if( nIcon == -1 )
+ // c) if b) failed... analyze argument list of currently loaded document inside the frame to find the filter.
+ // He can be used to detect right factory - and these can be used to match factory to icon...
+ if( nIcon == -1 )
+ {
+ css::uno::Reference< css::frame::XModel > xModel = xController->getModel();
+ if( xModel.is() )
{
- nIcon = 0;
+ SvtModuleOptions::EFactory eFactory = SvtModuleOptions::ClassifyFactoryByModel(xModel);
+ if (eFactory != SvtModuleOptions::EFactory::UNKNOWN_FACTORY)
+ nIcon = SvtModuleOptions().GetFactoryIcon( eFactory );
}
+ }
- // e) set icon on container window now
- // Don't forget SolarMutex! We use vcl directly :-(
- // Check window pointer for right WorkWindow class too!!!
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ // d) if all steps failed - use fallback!
+ if( nIcon == -1 )
+ {
+ nIcon = 0;
+ }
+
+ // e) set icon on container window now
+ // Don't forget SolarMutex! We use vcl directly :-(
+ // Check window pointer for right WorkWindow class too!!!
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ {
+ SolarMutexGuard aSolarGuard;
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xContainerWindow );
+ if(
+ ( pWindow != nullptr ) &&
+ ( pWindow->GetType() == WindowType::WORKWINDOW )
+ )
{
- SolarMutexGuard aSolarGuard;
- VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xContainerWindow );
- if(
- ( pWindow != nullptr ) &&
- ( pWindow->GetType() == WindowType::WORKWINDOW )
- )
- {
- WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow.get());
- pWorkWindow->SetIcon( static_cast<sal_uInt16>(nIcon) );
- }
+ WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow.get());
+ pWorkWindow->SetIcon( static_cast<sal_uInt16>(nIcon) );
}
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
}
+ /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
}
/*-************************************************************************************************************
@@ -3095,23 +3095,23 @@ void XFrameImpl::implts_startWindowListening()
aReadLock.clear();
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- if( xContainerWindow.is() )
+ if( !xContainerWindow.is() )
+ return;
+
+ xContainerWindow->addWindowListener( xWindowListener);
+ xContainerWindow->addFocusListener ( xFocusListener );
+
+ css::uno::Reference< css::awt::XTopWindow > xTopWindow( xContainerWindow, css::uno::UNO_QUERY );
+ if( xTopWindow.is() )
{
- xContainerWindow->addWindowListener( xWindowListener);
- xContainerWindow->addFocusListener ( xFocusListener );
+ xTopWindow->addTopWindowListener( xTopWindowListener );
- css::uno::Reference< css::awt::XTopWindow > xTopWindow( xContainerWindow, css::uno::UNO_QUERY );
- if( xTopWindow.is() )
+ css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( m_xContext );
+ css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xToolkit->getDropTarget( xContainerWindow );
+ if( xDropTarget.is() )
{
- xTopWindow->addTopWindowListener( xTopWindowListener );
-
- css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( m_xContext );
- css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xToolkit->getDropTarget( xContainerWindow );
- if( xDropTarget.is() )
- {
- xDropTarget->addDropTargetListener( xDragDropListener );
- xDropTarget->setActive( true );
- }
+ xDropTarget->addDropTargetListener( xDragDropListener );
+ xDropTarget->setActive( true );
}
}
}
@@ -3134,25 +3134,25 @@ void XFrameImpl::implts_stopWindowListening()
aReadLock.clear();
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- if( xContainerWindow.is() )
- {
- xContainerWindow->removeWindowListener( xWindowListener);
- xContainerWindow->removeFocusListener ( xFocusListener );
+ if( !xContainerWindow.is() )
+ return;
- css::uno::Reference< css::awt::XTopWindow > xTopWindow( xContainerWindow, css::uno::UNO_QUERY );
- if( xTopWindow.is() )
- {
- xTopWindow->removeTopWindowListener( xTopWindowListener );
+ xContainerWindow->removeWindowListener( xWindowListener);
+ xContainerWindow->removeFocusListener ( xFocusListener );
- css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( m_xContext );
- css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget =
- xToolkit->getDropTarget( xContainerWindow );
- if( xDropTarget.is() )
- {
- xDropTarget->removeDropTargetListener( xDragDropListener );
- xDropTarget->setActive( false );
- }
- }
+ css::uno::Reference< css::awt::XTopWindow > xTopWindow( xContainerWindow, css::uno::UNO_QUERY );
+ if( !xTopWindow.is() )
+ return;
+
+ xTopWindow->removeTopWindowListener( xTopWindowListener );
+
+ css::uno::Reference< css::awt::XToolkit2 > xToolkit = css::awt::Toolkit::create( m_xContext );
+ css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget =
+ xToolkit->getDropTarget( xContainerWindow );
+ if( xDropTarget.is() )
+ {
+ xDropTarget->removeDropTargetListener( xDragDropListener );
+ xDropTarget->setActive( false );
}
}
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index 55372351c33a..67c38860164b 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -120,48 +120,48 @@ CmdImageList::~CmdImageList()
void CmdImageList::initialize()
{
- if (!m_bInitialized)
- {
- const OUString aCommandImageList(UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDIMAGELIST);
+ if (m_bInitialized)
+ return;
+
+ const OUString aCommandImageList(UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDIMAGELIST);
- Sequence<OUString> aCommandImageSeq;
- uno::Reference<XNameAccess> xCommandDesc = frame::theUICommandDescription::get(m_xContext);
+ Sequence<OUString> aCommandImageSeq;
+ uno::Reference<XNameAccess> xCommandDesc = frame::theUICommandDescription::get(m_xContext);
- if (!m_aModuleIdentifier.isEmpty())
+ if (!m_aModuleIdentifier.isEmpty())
+ {
+ // If we have a module identifier - use to retrieve the command image name list from it.
+ // Otherwise we will use the global command image list
+ try
{
- // If we have a module identifier - use to retrieve the command image name list from it.
- // Otherwise we will use the global command image list
- try
- {
- xCommandDesc->getByName(m_aModuleIdentifier) >>= xCommandDesc;
- if (xCommandDesc.is())
- xCommandDesc->getByName(aCommandImageList) >>= aCommandImageSeq;
- }
- catch (const NoSuchElementException&)
- {
- // Module unknown we will work with an empty command image list!
- return;
- }
+ xCommandDesc->getByName(m_aModuleIdentifier) >>= xCommandDesc;
+ if (xCommandDesc.is())
+ xCommandDesc->getByName(aCommandImageList) >>= aCommandImageSeq;
}
+ catch (const NoSuchElementException&)
+ {
+ // Module unknown we will work with an empty command image list!
+ return;
+ }
+ }
- if (xCommandDesc.is())
+ if (xCommandDesc.is())
+ {
+ try
+ {
+ xCommandDesc->getByName(aCommandImageList) >>= aCommandImageSeq;
+ }
+ catch (const NoSuchElementException&)
{
- try
- {
- xCommandDesc->getByName(aCommandImageList) >>= aCommandImageSeq;
- }
- catch (const NoSuchElementException&)
- {
- }
- catch (const WrappedTargetException&)
- {
- }
}
+ catch (const WrappedTargetException&)
+ {
+ }
+ }
- m_aResolver.registerCommands(aCommandImageSeq);
+ m_aResolver.registerCommands(aCommandImageSeq);
- m_bInitialized = true;
- }
+ m_bInitialized = true;
}
@@ -271,36 +271,36 @@ ImageList* ImageManagerImpl::implts_getUserImageList( vcl::ImageType nImageType
void ImageManagerImpl::implts_initialize()
{
// Initialize the top-level structures with the storage data
- if ( m_xUserConfigStorage.is() )
- {
- long nModes = m_bReadOnly ? ElementModes::READ : ElementModes::READWRITE;
+ if ( !m_xUserConfigStorage.is() )
+ return;
- try
- {
- m_xUserImageStorage = m_xUserConfigStorage->openStorageElement( IMAGE_FOLDER,
- nModes );
- if ( m_xUserImageStorage.is() )
- {
- m_xUserBitmapsStorage = m_xUserImageStorage->openStorageElement( BITMAPS_FOLDER,
- nModes );
- }
- }
- catch ( const css::container::NoSuchElementException& )
- {
- }
- catch ( const css::embed::InvalidStorageException& )
- {
- }
- catch ( const css::lang::IllegalArgumentException& )
- {
- }
- catch ( const css::io::IOException& )
- {
- }
- catch ( const css::embed::StorageWrappedTargetException& )
+ long nModes = m_bReadOnly ? ElementModes::READ : ElementModes::READWRITE;
+
+ try
+ {
+ m_xUserImageStorage = m_xUserConfigStorage->openStorageElement( IMAGE_FOLDER,
+ nModes );
+ if ( m_xUserImageStorage.is() )
{
+ m_xUserBitmapsStorage = m_xUserImageStorage->openStorageElement( BITMAPS_FOLDER,
+ nModes );
}
}
+ catch ( const css::container::NoSuchElementException& )
+ {
+ }
+ catch ( const css::embed::InvalidStorageException& )
+ {
+ }
+ catch ( const css::lang::IllegalArgumentException& )
+ {
+ }
+ catch ( const css::io::IOException& )
+ {
+ }
+ catch ( const css::embed::StorageWrappedTargetException& )
+ {
+ }
}
void ImageManagerImpl::implts_loadUserImages(
@@ -559,43 +559,43 @@ void ImageManagerImpl::initialize( const Sequence< Any >& aArguments )
{
SolarMutexGuard g;
- if ( !m_bInitialized )
+ if ( m_bInitialized )
+ return;
+
+ for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ )
{
- for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ )
+ PropertyValue aPropValue;
+ if ( aArguments[n] >>= aPropValue )
{
- PropertyValue aPropValue;
- if ( aArguments[n] >>= aPropValue )
+ if ( aPropValue.Name == "UserConfigStorage" )
{
- if ( aPropValue.Name == "UserConfigStorage" )
- {
- aPropValue.Value >>= m_xUserConfigStorage;
- }
- else if ( aPropValue.Name == "ModuleIdentifier" )
- {
- aPropValue.Value >>= m_aModuleIdentifier;
- }
- else if ( aPropValue.Name == "UserRootCommit" )
- {
- aPropValue.Value >>= m_xUserRootCommit;
- }
+ aPropValue.Value >>= m_xUserConfigStorage;
+ }
+ else if ( aPropValue.Name == "ModuleIdentifier" )
+ {
+ aPropValue.Value >>= m_aModuleIdentifier;
+ }
+ else if ( aPropValue.Name == "UserRootCommit" )
+ {
+ aPropValue.Value >>= m_xUserRootCommit;
}
}
+ }
- if ( m_xUserConfigStorage.is() )
+ if ( m_xUserConfigStorage.is() )
+ {
+ uno::Reference< XPropertySet > xPropSet( m_xUserConfigStorage, UNO_QUERY );
+ if ( xPropSet.is() )
{
- uno::Reference< XPropertySet > xPropSet( m_xUserConfigStorage, UNO_QUERY );
- if ( xPropSet.is() )
- {
- long nOpenMode = 0;
- if ( xPropSet->getPropertyValue("OpenMode") >>= nOpenMode )
- m_bReadOnly = !( nOpenMode & ElementModes::WRITE );
- }
+ long nOpenMode = 0;
+ if ( xPropSet->getPropertyValue("OpenMode") >>= nOpenMode )
+ m_bReadOnly = !( nOpenMode & ElementModes::WRITE );
}
+ }
- implts_initialize();
+ implts_initialize();
- m_bInitialized = true;
- }
+ m_bInitialized = true;
}
// XImageManagerImpl
@@ -947,138 +947,138 @@ void ImageManagerImpl::reload()
CommandMap aOldUserCmdImageSet;
std::vector< OUString > aNewUserCmdImageSet;
- if ( m_bModified )
+ if ( !m_bModified )
+ return;
+
+ for ( vcl::ImageType i : o3tl::enumrange<vcl::ImageType>() )
{
- for ( vcl::ImageType i : o3tl::enumrange<vcl::ImageType>() )
+ if ( !m_bDisposed && m_bUserImageListModified[i] )
{
- if ( !m_bDisposed && m_bUserImageListModified[i] )
+ std::vector< OUString > aOldUserCmdImageVector;
+ ImageList* pImageList = implts_getUserImageList(i);
+ pImageList->GetImageNames( aOldUserCmdImageVector );
+
+ // Fill hash map to speed up search afterwards
+ sal_uInt32 j( 0 );
+ const sal_uInt32 nOldCount = aOldUserCmdImageVector.size();
+ for ( j = 0; j < nOldCount; j++ )
+ aOldUserCmdImageSet.emplace( aOldUserCmdImageVector[j], false );
+
+ // Attention: This can make the old image list pointer invalid!
+ implts_loadUserImages( i, m_xUserImageStorage, m_xUserBitmapsStorage );
+ pImageList = implts_getUserImageList(i);
+ pImageList->GetImageNames( aNewUserCmdImageSet );
+
+ GraphicNameAccess* pInsertedImages( nullptr );
+ GraphicNameAccess* pReplacedImages( nullptr );
+ GraphicNameAccess* pRemovedImages( nullptr );
+
+ for (auto const& newUserCmdImage : aNewUserCmdImageSet)
{
- std::vector< OUString > aOldUserCmdImageVector;
- ImageList* pImageList = implts_getUserImageList(i);
- pImageList->GetImageNames( aOldUserCmdImageVector );
-
- // Fill hash map to speed up search afterwards
- sal_uInt32 j( 0 );
- const sal_uInt32 nOldCount = aOldUserCmdImageVector.size();
- for ( j = 0; j < nOldCount; j++ )
- aOldUserCmdImageSet.emplace( aOldUserCmdImageVector[j], false );
-
- // Attention: This can make the old image list pointer invalid!
- implts_loadUserImages( i, m_xUserImageStorage, m_xUserBitmapsStorage );
- pImageList = implts_getUserImageList(i);
- pImageList->GetImageNames( aNewUserCmdImageSet );
-
- GraphicNameAccess* pInsertedImages( nullptr );
- GraphicNameAccess* pReplacedImages( nullptr );
- GraphicNameAccess* pRemovedImages( nullptr );
-
- for (auto const& newUserCmdImage : aNewUserCmdImageSet)
+ CommandMap::iterator pIter = aOldUserCmdImageSet.find(newUserCmdImage);
+ if ( pIter != aOldUserCmdImageSet.end() )
{
- CommandMap::iterator pIter = aOldUserCmdImageSet.find(newUserCmdImage);
- if ( pIter != aOldUserCmdImageSet.end() )
- {
- pIter->second = true; // mark entry as replaced
- if ( !pReplacedImages )
- pReplacedImages = new GraphicNameAccess();
- pReplacedImages->addElement( newUserCmdImage,
- GetXGraphic(pImageList->GetImage(newUserCmdImage)) );
- }
- else
- {
- if ( !pInsertedImages )
- pInsertedImages = new GraphicNameAccess();
- pInsertedImages->addElement( newUserCmdImage,
- GetXGraphic(pImageList->GetImage(newUserCmdImage)) );
- }
+ pIter->second = true; // mark entry as replaced
+ if ( !pReplacedImages )
+ pReplacedImages = new GraphicNameAccess();
+ pReplacedImages->addElement( newUserCmdImage,
+ GetXGraphic(pImageList->GetImage(newUserCmdImage)) );
}
-
- // Search map for unmarked entries => they have been removed from the user list
- // through this reload operation.
- // We have to search the module and global image list!
- rtl::Reference< GlobalImageList > rGlobalImageList;
- CmdImageList* pDefaultImageList = nullptr;
- if ( m_bUseGlobal )
+ else
{
- rGlobalImageList = implts_getGlobalImageList();
- pDefaultImageList = implts_getDefaultImageList();
+ if ( !pInsertedImages )
+ pInsertedImages = new GraphicNameAccess();
+ pInsertedImages->addElement( newUserCmdImage,
+ GetXGraphic(pImageList->GetImage(newUserCmdImage)) );
}
- uno::Reference<XGraphic> xEmptyGraphic;
- for (auto const& oldUserCmdImage : aOldUserCmdImageSet)
+ }
+
+ // Search map for unmarked entries => they have been removed from the user list
+ // through this reload operation.
+ // We have to search the module and global image list!
+ rtl::Reference< GlobalImageList > rGlobalImageList;
+ CmdImageList* pDefaultImageList = nullptr;
+ if ( m_bUseGlobal )
+ {
+ rGlobalImageList = implts_getGlobalImageList();
+ pDefaultImageList = implts_getDefaultImageList();
+ }
+ uno::Reference<XGraphic> xEmptyGraphic;
+ for (auto const& oldUserCmdImage : aOldUserCmdImageSet)
+ {
+ if ( !oldUserCmdImage.second )
{
- if ( !oldUserCmdImage.second )
+ if ( m_bUseGlobal )
{
- if ( m_bUseGlobal )
- {
- Image aImage = pDefaultImageList->getImageFromCommandURL( i, oldUserCmdImage.first );
- if ( !aImage )
- aImage = rGlobalImageList->getImageFromCommandURL( i, oldUserCmdImage.first );
-
- if ( !aImage )
- {
- // No image in the module/global image list => remove user image
- if ( !pRemovedImages )
- pRemovedImages = new GraphicNameAccess();
- pRemovedImages->addElement( oldUserCmdImage.first, xEmptyGraphic );
- }
- else
- {
- // Image has been found in the module/global image list => replace user image
- if ( !pReplacedImages )
- pReplacedImages = new GraphicNameAccess();
- pReplacedImages->addElement(oldUserCmdImage.first, GetXGraphic(aImage));
- }
- } // if ( m_bUseGlobal )
- else
+ Image aImage = pDefaultImageList->getImageFromCommandURL( i, oldUserCmdImage.first );
+ if ( !aImage )
+ aImage = rGlobalImageList->getImageFromCommandURL( i, oldUserCmdImage.first );
+
+ if ( !aImage )
{
- // No image in the user image list => remove user image
+ // No image in the module/global image list => remove user image
if ( !pRemovedImages )
pRemovedImages = new GraphicNameAccess();
pRemovedImages->addElement( oldUserCmdImage.first, xEmptyGraphic );
}
+ else
+ {
+ // Image has been found in the module/global image list => replace user image
+ if ( !pReplacedImages )
+ pReplacedImages = new GraphicNameAccess();
+ pReplacedImages->addElement(oldUserCmdImage.first, GetXGraphic(aImage));
+ }
+ } // if ( m_bUseGlobal )
+ else
+ {
+ // No image in the user image list => remove user image
+ if ( !pRemovedImages )
+ pRemovedImages = new GraphicNameAccess();
+ pRemovedImages->addElement( oldUserCmdImage.first, xEmptyGraphic );
}
}
+ }
- aGuard.clear();
-
- // Now notify our listeners. Unlock mutex to prevent deadlocks
- uno::Reference< uno::XInterface > xOwner(m_pOwner);
- if ( pInsertedImages != nullptr )
- {
- ConfigurationEvent aInsertEvent;
- aInsertEvent.aInfo <<=static_cast<sal_uInt16>(i);
- aInsertEvent.Accessor <<= xOwner;
- aInsertEvent.Source = xOwner;
- aInsertEvent.ResourceURL = m_aResourceString;
- aInsertEvent.Element <<= uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pInsertedImages ), UNO_QUERY );
- implts_notifyContainerListener( aInsertEvent, NotifyOp_Insert );
- }
- if ( pReplacedImages != nullptr )
- {
- ConfigurationEvent aReplaceEvent;
- aReplaceEvent.aInfo <<= static_cast<sal_uInt16>(i);
- aReplaceEvent.Accessor <<= xOwner;
- aReplaceEvent.Source = xOwner;
- aReplaceEvent.ResourceURL = m_aResourceString;
- aReplaceEvent.ReplacedElement = Any();
- aReplaceEvent.Element <<= uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pReplacedImages ), UNO_QUERY );
- implts_notifyContainerListener( aReplaceEvent, NotifyOp_Replace );
- }
- if ( pRemovedImages != nullptr )
- {
- ConfigurationEvent aRemoveEvent;
- aRemoveEvent.aInfo <<= static_cast<sal_uInt16>(i);
- aRemoveEvent.Accessor <<= xOwner;
- aRemoveEvent.Source = xOwner;
- aRemoveEvent.ResourceURL = m_aResourceString;
- aRemoveEvent.Element <<= uno::Reference< XNameAccess >(
- static_cast< OWeakObject *>( pRemovedImages ), UNO_QUERY );
- implts_notifyContainerListener( aRemoveEvent, NotifyOp_Remove );
- }
+ aGuard.clear();
- aGuard.clear();
+ // Now notify our listeners. Unlock mutex to prevent deadlocks
+ uno::Reference< uno::XInterface > xOwner(m_pOwner);
+ if ( pInsertedImages != nullptr )
+ {
+ ConfigurationEvent aInsertEvent;
+ aInsertEvent.aInfo <<=static_cast<sal_uInt16>(i);
+ aInsertEvent.Accessor <<= xOwner;
+ aInsertEvent.Source = xOwner;
+ aInsertEvent.ResourceURL = m_aResourceString;
+ aInsertEvent.Element <<= uno::Reference< XNameAccess >(
+ static_cast< OWeakObject *>( pInsertedImages ), UNO_QUERY );
+ implts_notifyContainerListener( aInsertEvent, NotifyOp_Insert );
+ }
+ if ( pReplacedImages != nullptr )
+ {
+ ConfigurationEvent aReplaceEvent;
+ aReplaceEvent.aInfo <<= static_cast<sal_uInt16>(i);
+ aReplaceEvent.Accessor <<= xOwner;
+ aReplaceEvent.Source = xOwner;
+ aReplaceEvent.ResourceURL = m_aResourceString;
+ aReplaceEvent.ReplacedElement = Any();
+ aReplaceEvent.Element <<= uno::Reference< XNameAccess >(
+ static_cast< OWeakObject *>( pReplacedImages ), UNO_QUERY );
+ implts_notifyContainerListener( aReplaceEvent, NotifyOp_Replace );
+ }
+ if ( pRemovedImages != nullptr )
+ {
+ ConfigurationEvent aRemoveEvent;
+ aRemoveEvent.aInfo <<= static_cast<sal_uInt16>(i);
+ aRemoveEvent.Accessor <<= xOwner;
+ aRemoveEvent.Source = xOwner;
+ aRemoveEvent.ResourceURL = m_aResourceString;
+ aRemoveEvent.Element <<= uno::Reference< XNameAccess >(
+ static_cast< OWeakObject *>( pRemovedImages ), UNO_QUERY );
+ implts_notifyContainerListener( aRemoveEvent, NotifyOp_Remove );
}
+
+ aGuard.clear();
}
}
}
@@ -1090,29 +1090,29 @@ void ImageManagerImpl::store()
if ( m_bDisposed )
throw DisposedException();
- if ( m_bModified )
- {
- bool bWritten( false );
- for ( vcl::ImageType i : o3tl::enumrange<vcl::ImageType>() )
- {
- bool bSuccess = implts_storeUserImages(i, m_xUserImageStorage, m_xUserBitmapsStorage );
- if ( bSuccess )
- bWritten = true;
- m_bUserImageListModified[i] = false;
- }
+ if ( !m_bModified )
+ return;
- if ( bWritten &&
- m_xUserConfigStorage.is() )
- {
- uno::Reference< XTransactedObject > xUserConfigStorageCommit( m_xUserConfigStorage, UNO_QUERY );
- if ( xUserConfigStorageCommit.is() )
- xUserConfigStorageCommit->commit();
- if ( m_xUserRootCommit.is() )
- m_xUserRootCommit->commit();
- }
+ bool bWritten( false );
+ for ( vcl::ImageType i : o3tl::enumrange<vcl::ImageType>() )
+ {
+ bool bSuccess = implts_storeUserImages(i, m_xUserImageStorage, m_xUserBitmapsStorage );
+ if ( bSuccess )
+ bWritten = true;
+ m_bUserImageListModified[i] = false;
+ }
- m_bModified = false;
+ if ( bWritten &&
+ m_xUserConfigStorage.is() )
+ {
+ uno::Reference< XTransactedObject > xUserConfigStorageCommit( m_xUserConfigStorage, UNO_QUERY );
+ if ( xUserConfigStorageCommit.is() )
+ xUserConfigStorageCommit->commit();
+ if ( m_xUserRootCommit.is() )
+ m_xUserRootCommit->commit();
}
+
+ m_bModified = false;
}
void ImageManagerImpl::storeToStorage( const uno::Reference< XStorage >& Storage )
@@ -1122,27 +1122,27 @@ void ImageManagerImpl::storeToStorage( const uno::Reference< XStorage >& Storage
if ( m_bDisposed )
throw DisposedException();
- if ( m_bModified && Storage.is() )
- {
- long nModes = ElementModes::READWRITE;
+ if ( !(m_bModified && Storage.is()) )
+ return;
- uno::Reference< XStorage > xUserImageStorage = Storage->openStorageElement( IMAGE_FOLDER,
- nModes );
- if ( xUserImageStorage.is() )
- {
- uno::Reference< XStorage > xUserBitmapsStorage = xUserImageStorage->openStorageElement( BITMAPS_FOLDER,
- nModes );
- for ( vcl::ImageType i : o3tl::enumrange<vcl::ImageType>() )
- {
- implts_getUserImageList(i);
- implts_storeUserImages( i, xUserImageStorage, xUserBitmapsStorage );
- }
+ long nModes = ElementModes::READWRITE;
- uno::Reference< XTransactedObject > xTransaction( Storage, UNO_QUERY );
- if ( xTransaction.is() )
- xTransaction->commit();
- }
+ uno::Reference< XStorage > xUserImageStorage = Storage->openStorageElement( IMAGE_FOLDER,
+ nModes );
+ if ( !xUserImageStorage.is() )
+ return;
+
+ uno::Reference< XStorage > xUserBitmapsStorage = xUserImageStorage->openStorageElement( BITMAPS_FOLDER,
+ nModes );
+ for ( vcl::ImageType i : o3tl::enumrange<vcl::ImageType>() )
+ {
+ implts_getUserImageList(i);
+ implts_storeUserImages( i, xUserImageStorage, xUserBitmapsStorage );
}
+
+ uno::Reference< XTransactedObject > xTransaction( Storage, UNO_QUERY );
+ if ( xTransaction.is() )
+ xTransaction->commit();
}
bool ImageManagerImpl::isModified() const
@@ -1180,31 +1180,31 @@ void ImageManagerImpl::implts_notifyContainerListener( const ConfigurationEvent&
{
::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer(
cppu::UnoType<css::ui::XUIConfigurationListener>::get());
- if ( pContainer != nullptr )
+ if ( pContainer == nullptr )
+ return;
+
+ ::cppu::OInterfaceIteratorHelper pIterator( *pContainer );
+ while ( pIterator.hasMoreElements() )
{
- ::cppu::OInterfaceIteratorHelper pIterator( *pContainer );
- while ( pIterator.hasMoreElements() )
+ try
{
- try
+ switch ( eOp )
{
- switch ( eOp )
- {
- case NotifyOp_Replace:
- static_cast< css::ui::XUIConfigurationListener*>(pIterator.next())->elementReplaced( aEvent );
- break;
- case NotifyOp_Insert:
- static_cast< css::ui::XUIConfigurationListener*>(pIterator.next())->elementInserted( aEvent );
- break;
- case NotifyOp_Remove:
- static_cast< css::ui::XUIConfigurationListener*>(pIterator.next())->elementRemoved( aEvent );
- break;
- }
- }
- catch( const css::uno::RuntimeException& )
- {
- pIterator.remove();
+ case NotifyOp_Replace:
+ static_cast< css::ui::XUIConfigurationListener*>(pIterator.next())->elementReplaced( aEvent );
+ break;
+ case NotifyOp_Insert:
+ static_cast< css::ui::XUIConfigurationListener*>(pIterator.next())->elementInserted( aEvent );
+ break;
+ case NotifyOp_Remove:
+ static_cast< css::ui::XUIConfigurationListener*>(pIterator.next())->elementRemoved( aEvent );
+ break;
}
}
+ catch( const css::uno::RuntimeException& )
+ {
+ pIterator.remove();
+ }
}
}
void ImageManagerImpl::clear()
diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index b166fc79a47e..1b9926d7f7eb 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -348,50 +348,50 @@ void ModuleUIConfigurationManager::impl_preloadUIElementTypeList( Layer eLayer,
{
UIElementType& rElementTypeData = m_aUIElements[eLayer][nElementType];
- if ( !rElementTypeData.bLoaded )
+ if ( rElementTypeData.bLoaded )
+ return;
+
+ Reference< XStorage > xElementTypeStorage = rElementTypeData.xStorage;
+ if ( !xElementTypeStorage.is() )
+ return;
+
+ OUString aResURLPrefix =
+ RESOURCEURL_PREFIX +
+ UIELEMENTTYPENAMES[ nElementType ] +
+ "/";
+
+ UIElementDataHashMap& rHashMap = rElementTypeData.aElementsHashMap;
+ Sequence< OUString > aUIElementNames = xElementTypeStorage->getElementNames();
+ for ( sal_Int32 n = 0; n < aUIElementNames.getLength(); n++ )
{
- Reference< XStorage > xElementTypeStorage = rElementTypeData.xStorage;
- if ( xElementTypeStorage.is() )
+ UIElementData aUIElementData;
+
+ // Resource name must be without ".xml"
+ sal_Int32 nIndex = aUIElementNames[n].lastIndexOf( '.' );
+ if (( nIndex > 0 ) && ( nIndex < aUIElementNames[n].getLength() ))
{
- OUString aResURLPrefix =
- RESOURCEURL_PREFIX +
- UIELEMENTTYPENAMES[ nElementType ] +
- "/";
-
- UIElementDataHashMap& rHashMap = rElementTypeData.aElementsHashMap;
- Sequence< OUString > aUIElementNames = xElementTypeStorage->getElementNames();
- for ( sal_Int32 n = 0; n < aUIElementNames.getLength(); n++ )
+ OUString aExtension( aUIElementNames[n].copy( nIndex+1 ));
+ OUString aUIElementName( aUIElementNames[n].copy( 0, nIndex ));
+
+ if (!aUIElementName.isEmpty() &&
+ ( aExtension.equalsIgnoreAsciiCase("xml")))
{
- UIElementData aUIElementData;
+ aUIElementData.aResourceURL = aResURLPrefix + aUIElementName;
+ aUIElementData.aName = aUIElementNames[n];
- // Resource name must be without ".xml"
- sal_Int32 nIndex = aUIElementNames[n].lastIndexOf( '.' );
- if (( nIndex > 0 ) && ( nIndex < aUIElementNames[n].getLength() ))
+ if ( eLayer == LAYER_USERDEFINED )
{
- OUString aExtension( aUIElementNames[n].copy( nIndex+1 ));
- OUString aUIElementName( aUIElementNames[n].copy( 0, nIndex ));
-
- if (!aUIElementName.isEmpty() &&
- ( aExtension.equalsIgnoreAsciiCase("xml")))
- {
- aUIElementData.aResourceURL = aResURLPrefix + aUIElementName;
- aUIElementData.aName = aUIElementNames[n];
-
- if ( eLayer == LAYER_USERDEFINED )
- {
- aUIElementData.bModified = false;
- aUIElementData.bDefault = false;
- aUIElementData.bDefaultNode = false;
- }
-
- // Create std::unordered_map entries for all user interface elements inside the storage. We don't load the
- // settings to speed up the process.
- rHashMap.emplace( aUIElementData.aResourceURL, aUIElementData );
- }
+ aUIElementData.bModified = false;
+ aUIElementData.bDefault = false;
+ aUIElementData.bDefaultNode = false;
}
- rElementTypeData.bLoaded = true;
+
+ // Create std::unordered_map entries for all user interface elements inside the storage. We don't load the
+ // settings to speed up the process.
+ rHashMap.emplace( aUIElementData.aResourceURL, aUIElementData );
}
}
+ rElementTypeData.bLoaded = true;
}
}
@@ -791,29 +791,29 @@ void ModuleUIConfigurationManager::impl_Initialize()
}
}
- if ( m_xDefaultConfigStorage.is() )
- {
- Reference< XNameAccess > xNameAccess( m_xDefaultConfigStorage, UNO_QUERY_THROW );
+ if ( !m_xDefaultConfigStorage.is() )
+ return;
- // Try to access our module sub folder
- for ( sal_Int16 i = 1; i < css::ui::UIElementType::COUNT;
- i++ )
- {
- Reference< XStorage > xElementTypeStorage;
- try
- {
- const OUString sName( UIELEMENTTYPENAMES[i] );
- if( xNameAccess->hasByName( sName ) )
- xNameAccess->getByName( sName ) >>= xElementTypeStorage;
- }
- catch ( const css::container::NoSuchElementException& )
- {
- }
+ Reference< XNameAccess > xNameAccess( m_xDefaultConfigStorage, UNO_QUERY_THROW );
- m_aUIElements[LAYER_DEFAULT][i].nElementType = i;
- m_aUIElements[LAYER_DEFAULT][i].bModified = false;
- m_aUIElements[LAYER_DEFAULT][i].xStorage = xElementTypeStorage;
+ // Try to access our module sub folder
+ for ( sal_Int16 i = 1; i < css::ui::UIElementType::COUNT;
+ i++ )
+ {
+ Reference< XStorage > xElementTypeStorage;
+ try
+ {
+ const OUString sName( UIELEMENTTYPENAMES[i] );
+ if( xNameAccess->hasByName( sName ) )
+ xNameAccess->getByName( sName ) >>= xElementTypeStorage;
}
+ catch ( const css::container::NoSuchElementException& )
+ {
+ }
+
+ m_aUIElements[LAYER_DEFAULT][i].nElementType = i;
+ m_aUIElements[LAYER_DEFAULT][i].bModified = false;
+ m_aUIElements[LAYER_DEFAULT][i].xStorage = xElementTypeStorage;
}
}
@@ -969,80 +969,80 @@ void SAL_CALL ModuleUIConfigurationManager::reset()
if ( m_bDisposed )
throw DisposedException();
- if ( !isReadOnly() )
+ if ( isReadOnly() )
+ return;
+
+ // Remove all elements from our user-defined storage!
+ try
{
- // Remove all elements from our user-defined storage!
- try
+ for ( int i = 1; i < css::ui::UIElementType::COUNT; i++ )
{
- for ( int i = 1; i < css::ui::UIElementType::COUNT; i++ )
- {
- UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][i];
+ UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][i];
- if ( rElementType.xStorage.is() )
+ if ( rElementType.xStorage.is() )
+ {
+ bool bCommitSubStorage( false );
+ Sequence< OUString > aUIElementStreamNames = rElementType.xStorage->getElementNames();
+ for ( sal_Int32 j = 0; j < aUIElementStreamNames.getLength(); j++ )
{
- bool bCommitSubStorage( false );
- Sequence< OUString > aUIElementStreamNames = rElementType.xStorage->getElementNames();
- for ( sal_Int32 j = 0; j < aUIElementStreamNames.getLength(); j++ )
- {
- rElementType.xStorage->removeElement( aUIElementStreamNames[j] );
- bCommitSubStorage = true;
- }
+ rElementType.xStorage->removeElement( aUIElementStreamNames[j] );
+ bCommitSubStorage = true;
+ }
- if ( bCommitSubStorage )
- {
- Reference< XTransactedObject > xTransactedObject( rElementType.xStorage, UNO_QUERY );
- if ( xTransactedObject.is() )
- xTransactedObject->commit();
- m_pStorageHandler[i]->commitUserChanges();
- }
+ if ( bCommitSubStorage )
+ {
+ Reference< XTransactedObject > xTransactedObject( rElementType.xStorage, UNO_QUERY );
+ if ( xTransactedObject.is() )
+ xTransactedObject->commit();
+ m_pStorageHandler[i]->commitUserChanges();
}
}
+ }
- // remove settings from user defined layer and notify listener about removed settings data!
- ConfigEventNotifyContainer aRemoveEventNotifyContainer;
- ConfigEventNotifyContainer aReplaceEventNotifyContainer;
- for ( sal_Int16 j = 1; j < css::ui::UIElementType::COUNT; j++ )
+ // remove settings from user defined layer and notify listener about removed settings data!
+ ConfigEventNotifyContainer aRemoveEventNotifyContainer;
+ ConfigEventNotifyContainer aReplaceEventNotifyContainer;
+ for ( sal_Int16 j = 1; j < css::ui::UIElementType::COUNT; j++ )
+ {
+ try
{
- try
- {
- UIElementType& rUserElementType = m_aUIElements[LAYER_USERDEFINED][j];
- UIElementType& rDefaultElementType = m_aUIElements[LAYER_DEFAULT][j];
+ UIElementType& rUserElementType = m_aUIElements[LAYER_USERDEFINED][j];
+ UIElementType& rDefaultElementType = m_aUIElements[LAYER_DEFAULT][j];
- impl_resetElementTypeData( rUserElementType, rDefaultElementType, aRemoveEventNotifyContainer, aReplaceEventNotifyContainer );
- rUserElementType.bModified = false;
- }
- catch (const Exception&)
- {
- css::uno::Any anyEx = cppu::getCaughtException();
- throw css::lang::WrappedTargetRuntimeException(
- "ModuleUIConfigurationManager::reset exception",
- css::uno::Reference<css::uno::XInterface>(*this), anyEx);
- }
+ impl_resetElementTypeData( rUserElementType, rDefaultElementType, aRemoveEventNotifyContainer, aReplaceEventNotifyContainer );
+ rUserElementType.bModified = false;
+ }
+ catch (const Exception&)
+ {
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "ModuleUIConfigurationManager::reset exception",
+ css::uno::Reference<css::uno::XInterface>(*this), anyEx);
}
+ }
- m_bModified = false;
+ m_bModified = false;
- // Unlock mutex before notify our listeners
- aGuard.clear();
+ // Unlock mutex before notify our listeners
+ aGuard.clear();
- // Notify our listeners
- for ( auto const & k: aRemoveEventNotifyContainer )
- implts_notifyContainerListener( k, NotifyOp_Remove );
- for ( auto const & k: aReplaceEventNotifyContainer )
- implts_notifyContainerListener( k, NotifyOp_Replace );
- }
- catch ( const css::lang::IllegalArgumentException& )
- {
- }
- catch ( const css::container::NoSuchElementException& )
- {
- }
- catch ( const css::embed::InvalidStorageException& )
- {
- }
- catch ( const css::embed::StorageWrappedTargetException& )
- {
- }
+ // Notify our listeners
+ for ( auto const & k: aRemoveEventNotifyContainer )
+ implts_notifyContainerListener( k, NotifyOp_Remove );
+ for ( auto const & k: aReplaceEventNotifyContainer )
+ implts_notifyContainerListener( k, NotifyOp_Replace );
+ }
+ catch ( const css::lang::IllegalArgumentException& )
+ {
+ }
+ catch ( const css::container::NoSuchElementException& )
+ {
+ }
+ catch ( const css::embed::InvalidStorageException& )
+ {
+ }
+ catch ( const css::embed::StorageWrappedTargetException& )
+ {
}
}
@@ -1494,40 +1494,40 @@ void SAL_CALL ModuleUIConfigurationManager::reload()
if ( m_bDisposed )
throw DisposedException();
- if ( m_xUserConfigStorage.is() && m_bModified && !m_bReadOnly )
+ if ( !(m_xUserConfigStorage.is() && m_bModified && !m_bReadOnly) )
+ return;
+
+ // Try to access our module sub folder
+ ConfigEventNotifyContainer aRemoveNotifyContainer;
+ ConfigEventNotifyContainer aReplaceNotifyContainer;
+ for ( sal_Int16 i = 1; i < css::ui::UIElementType::COUNT; i++ )
{
- // Try to access our module sub folder
- ConfigEventNotifyContainer aRemoveNotifyContainer;
- ConfigEventNotifyContainer aReplaceNotifyContainer;
- for ( sal_Int16 i = 1; i < css::ui::UIElementType::COUNT; i++ )
+ try
{
- try
- {
- UIElementType& rUserElementType = m_aUIElements[LAYER_USERDEFINED][i];
+ UIElementType& rUserElementType = m_aUIElements[LAYER_USERDEFINED][i];
- if ( rUserElementType.bModified )
- {
- UIElementType& rDefaultElementType = m_aUIElements[LAYER_DEFAULT][i];
- impl_reloadElementTypeData( rUserElementType, rDefaultElementType, aRemoveNotifyContainer, aReplaceNotifyContainer );
- }
- }
- catch ( const Exception& )
+ if ( rUserElementType.bModified )
{
- throw IOException();
+ UIElementType& rDefaultElementType = m_aUIElements[LAYER_DEFAULT][i];
+ impl_reloadElementTypeData( rUserElementType, rDefaultElementType, aRemoveNotifyContainer, aReplaceNotifyContainer );
}
}
+ catch ( const Exception& )
+ {
+ throw IOException();
+ }
+ }
- m_bModified = false;
+ m_bModified = false;
- // Unlock mutex before notify our listeners
- aGuard.clear();
+ // Unlock mutex before notify our listeners
+ aGuard.clear();
- // Notify our listeners
- for (const ui::ConfigurationEvent & j : aRemoveNotifyContainer)
- implts_notifyContainerListener( j, NotifyOp_Remove );
- for (const ui::ConfigurationEvent & k : aReplaceNotifyContainer)
- implts_notifyContainerListener( k, NotifyOp_Replace );
- }
+ // Notify our listeners
+ for (const ui::ConfigurationEvent & j : aRemoveNotifyContainer)
+ implts_notifyContainerListener( j, NotifyOp_Remove );
+ for (const ui::ConfigurationEvent & k : aReplaceNotifyContainer)
+ implts_notifyContainerListener( k, NotifyOp_Replace );
}
void SAL_CALL ModuleUIConfigurationManager::store()
@@ -1537,29 +1537,29 @@ void SAL_CALL ModuleUIConfigurationManager::store()
if ( m_bDisposed )
throw DisposedException();
- if ( m_xUserConfigStorage.is() && m_bModified && !m_bReadOnly )
+ if ( !(m_xUserConfigStorage.is() && m_bModified && !m_bReadOnly) )
+ return;
+
+ // Try to access our module sub folder
+ for ( int i = 1; i < css::ui::UIElementType::COUNT; i++ )
{
- // Try to access our module sub folder
- for ( int i = 1; i < css::ui::UIElementType::COUNT; i++ )
+ try
{
- try
- {
- UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][i];
+ UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][i];
- if ( rElementType.bModified && rElementType.xStorage.is() )
- {
- impl_storeElementTypeData( rElementType.xStorage, rElementType );
- m_pStorageHandler[i]->commitUserChanges();
- }
- }
- catch ( const Exception& )
+ if ( rElementType.bModified && rElementType.xStorage.is() )
{
- throw IOException();
+ impl_storeElementTypeData( rElementType.xStorage, rElementType );
+ m_pStorageHandler[i]->commitUserChanges();
}
}
-
- m_bModified = false;
+ catch ( const Exception& )
+ {
+ throw IOException();
+ }
}
+
+ m_bModified = false;
}
void SAL_CALL ModuleUIConfigurationManager::storeToStorage( const Reference< XStorage >& Storage )
@@ -1569,30 +1569,30 @@ void SAL_CALL ModuleUIConfigurationManager::storeToStorage( const Reference< XSt
if ( m_bDisposed )
throw DisposedException();
- if ( m_xUserConfigStorage.is() && m_bModified && !m_bReadOnly )
+ if ( !(m_xUserConfigStorage.is() && m_bModified && !m_bReadOnly) )
+ return;
+
+ // Try to access our module sub folder
+ for ( int i = 1; i < css::ui::UIElementType::COUNT; i++ )
{
- // Try to access our module sub folder
- for ( int i = 1; i < css::ui::UIElementType::COUNT; i++ )
+ try
{
- try
- {
- Reference< XStorage > xElementTypeStorage( Storage->openStorageElement(
- UIELEMENTTYPENAMES[i], ElementModes::READWRITE ));
- UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][i];
+ Reference< XStorage > xElementTypeStorage( Storage->openStorageElement(
+ UIELEMENTTYPENAMES[i], ElementModes::READWRITE ));
+ UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][i];
- if ( rElementType.bModified && xElementTypeStorage.is() )
- impl_storeElementTypeData( xElementTypeStorage, rElementType, false ); // store data to storage, but don't reset modify flag!
- }
- catch ( const Exception& )
- {
- throw IOException();
- }
+ if ( rElementType.bModified && xElementTypeStorage.is() )
+ impl_storeElementTypeData( xElementTypeStorage, rElementType, false ); // store data to storage, but don't reset modify flag!
+ }
+ catch ( const Exception& )
+ {
+ throw IOException();
}
-
- Reference< XTransactedObject > xTransactedObject( Storage, UNO_QUERY );
- if ( xTransactedObject.is() )
- xTransactedObject->commit();
}
+
+ Reference< XTransactedObject > xTransactedObject( Storage, UNO_QUERY );
+ if ( xTransactedObject.is() )
+ xTransactedObject->commit();
}
sal_Bool SAL_CALL ModuleUIConfigurationManager::isModified()
@@ -1612,31 +1612,31 @@ sal_Bool SAL_CALL ModuleUIConfigurationManager::isReadOnly()
void ModuleUIConfigurationManager::implts_notifyContainerListener( const ui::ConfigurationEvent& aEvent, NotifyOp eOp )
{
::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::ui::XUIConfigurationListener>::get());
- if ( pContainer != nullptr )
+ if ( pContainer == nullptr )
+ return;
+
+ ::cppu::OInterfaceIteratorHelper pIterator( *pContainer );
+ while ( pIterator.hasMoreElements() )
{
- ::cppu::OInterfaceIteratorHelper pIterator( *pContainer );
- while ( pIterator.hasMoreElements() )
+ try
{
- try
- {
- switch ( eOp )
- {
- case NotifyOp_Replace:
- static_cast< css::ui::XUIConfigurationListener*>(pIterator.next())->elementReplaced( aEvent );
- break;
- case NotifyOp_Insert:
- static_cast< css::ui::XUIConfigurationListener*>(pIterator.next())->elementInserted( aEvent );
- break;
- case NotifyOp_Remove:
- static_cast< css::ui::XUIConfigurationListener*>(pIterator.next())->elementRemoved( aEvent );
- break;
- }
- }
- catch( const css::uno::RuntimeException& )
+ switch ( eOp )
{
- pIterator.remove();
+ case NotifyOp_Replace:
+ static_cast< css::ui::XUIConfigurationListener*>(pIterator.next())->elementReplaced( aEvent );
+ break;
+ case NotifyOp_Insert:
+ static_cast< css::ui::XUIConfigurationListener*>(pIterator.next())->elementInserted( aEvent );
+ break;
+ case NotifyOp_Remove:
+ static_cast< css::ui::XUIConfigurationListener*>(pIterator.next())->elementRemoved( aEvent );
+ break;
}
}
+ catch( const css::uno::RuntimeException& )
+ {
+ pIterator.remove();
+ }
}
}
diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
index cf5def97aa4a..5ec6a167131e 100644
--- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
@@ -755,76 +755,76 @@ void SAL_CALL UIConfigurationManager::reset()
if ( isReadOnly() )
return;
- if ( m_xDocConfigStorage.is() )
+ if ( !m_xDocConfigStorage.is() )
+ return;
+
+ try
{
- try
+ // Remove all elements from our user-defined storage!
+ bool bCommit( false );
+ for ( int i = 1; i < css::ui::UIElementType::COUNT; i++ )
{
- // Remove all elements from our user-defined storage!
- bool bCommit( false );
- for ( int i = 1; i < css::ui::UIElementType::COUNT; i++ )
- {
- UIElementType& rElementType = m_aUIElements[i];
+ UIElementType& rElementType = m_aUIElements[i];
- if ( rElementType.xStorage.is() )
+ if ( rElementType.xStorage.is() )
+ {
+ bool bCommitSubStorage( false );
+ Sequence< OUString > aUIElementStreamNames = rElementType.xStorage->getElementNames();
+ for ( sal_Int32 j = 0; j < aUIElementStreamNames.getLength(); j++ )
{
- bool bCommitSubStorage( false );
- Sequence< OUString > aUIElementStreamNames = rElementType.xStorage->getElementNames();
- for ( sal_Int32 j = 0; j < aUIElementStreamNames.getLength(); j++ )
- {
- rElementType.xStorage->removeElement( aUIElementStreamNames[j] );
- bCommitSubStorage = true;
- bCommit = true;
- }
+ rElementType.xStorage->removeElement( aUIElementStreamNames[j] );
+ bCommitSubStorage = true;
+ bCommit = true;
+ }
- if ( bCommitSubStorage )
- {
- Reference< XTransactedObject > xTransactedObject( rElementType.xStorage, UNO_QUERY );
- if ( xTransactedObject.is() )
- xTransactedObject->commit();
- }
+ if ( bCommitSubStorage )
+ {
+ Reference< XTransactedObject > xTransactedObject( rElementType.xStorage, UNO_QUERY );
+ if ( xTransactedObject.is() )
+ xTransactedObject->commit();
}
}
+ }
- // Commit changes
- if ( bCommit )
- {
- Reference< XTransactedObject > xTransactedObject( m_xDocConfigStorage, UNO_QUERY );
- if ( xTransactedObject.is() )
- xTransactedObject->commit();
- }
+ // Commit changes
+ if ( bCommit )
+ {
+ Reference< XTransactedObject > xTransactedObject( m_xDocConfigStorage, UNO_QUERY );
+ if ( xTransactedObject.is() )
+ xTransactedObject->commit();
+ }
- // remove settings from user defined layer and notify listener about removed settings data!
- // Try to access our module sub folder
- ConfigEventNotifyContainer aRemoveEventNotifyContainer;
- for ( sal_Int16 j = 1; j < css::ui::UIElementType::COUNT; j++ )
- {
- UIElementType& rDocElementType = m_aUIElements[j];
+ // remove settings from user defined layer and notify listener about removed settings data!
+ // Try to access our module sub folder
+ ConfigEventNotifyContainer aRemoveEventNotifyContainer;
+ for ( sal_Int16 j = 1; j < css::ui::UIElementType::COUNT; j++ )
+ {
+ UIElementType& rDocElementType = m_aUIElements[j];
- impl_resetElementTypeData( rDocElementType, aRemoveEventNotifyContainer );
- rDocElementType.bModified = false;
- }
+ impl_resetElementTypeData( rDocElementType, aRemoveEventNotifyContainer );
+ rDocElementType.bModified = false;
+ }
- m_bModified = false;
+ m_bModified = false;
- // Unlock mutex before notify our listeners
- aGuard.clear();
+ // Unlock mutex before notify our listeners
+ aGuard.clear();
- // Notify our listeners
- for (const ConfigurationEvent & k : aRemoveEventNotifyContainer)
- implts_notifyContainerListener( k, NotifyOp_Remove );
- }
- catch ( const css::lang::IllegalArgumentException& )
- {
- }
- catch ( const css::container::NoSuchElementException& )
- {
- }
- catch ( const css::embed::InvalidStorageException& )
- {
- }
- catch ( const css::embed::StorageWrappedTargetException& )
- {
- }
+ // Notify our listeners
+ for (const ConfigurationEvent & k : aRemoveEventNotifyContainer)
+ implts_notifyContainerListener( k, NotifyOp_Remove );
+ }
+ catch ( const css::lang::IllegalArgumentException& )
+ {
+ }
+ catch ( const css::container::NoSuchElementException& )
+ {
+ }
+ catch ( const css::embed::InvalidStorageException& )
+ {
+ }
+ catch ( const css::embed::StorageWrappedTargetException& )
+ {
}
}
@@ -1226,36 +1226,36 @@ void SAL_CALL UIConfigurationManager::reload()
if ( m_bDisposed )
throw DisposedException();
- if ( m_xDocConfigStorage.is() && m_bModified && !m_bReadOnly )
+ if ( !(m_xDocConfigStorage.is() && m_bModified && !m_bReadOnly) )
+ return;
+
+ // Try to access our module sub folder
+ ConfigEventNotifyContainer aRemoveNotifyContainer;
+ ConfigEventNotifyContainer aReplaceNotifyContainer;
+ for ( sal_Int16 i = 1; i < css::ui::UIElementType::COUNT; i++ )
{
- // Try to access our module sub folder
- ConfigEventNotifyContainer aRemoveNotifyContainer;
- ConfigEventNotifyContainer aReplaceNotifyContainer;
- for ( sal_Int16 i = 1; i < css::ui::UIElementType::COUNT; i++ )
+ try
{
- try
- {
- UIElementType& rDocElementType = m_aUIElements[i];
- if ( rDocElementType.bModified )
- impl_reloadElementTypeData( rDocElementType, aRemoveNotifyContainer, aReplaceNotifyContainer );
- }
- catch ( const Exception& )
- {
- throw IOException();
- }
+ UIElementType& rDocElementType = m_aUIElements[i];
+ if ( rDocElementType.bModified )
+ impl_reloadElementTypeData( rDocElementType, aRemoveNotifyContainer, aReplaceNotifyContainer );
}
+ catch ( const Exception& )
+ {
+ throw IOException();
+ }
+ }
- m_bModified = false;
+ m_bModified = false;
- // Unlock mutex before notify our listeners
- aGuard.clear();
+ // Unlock mutex before notify our listeners
+ aGuard.clear();
- // Notify our listeners
- for (const ConfigurationEvent & j : aRemoveNotifyContainer)
- implts_notifyContainerListener( j, NotifyOp_Remove );
- for (const ConfigurationEvent & k : aReplaceNotifyContainer)
- implts_notifyContainerListener( k, NotifyOp_Replace );
- }
+ // Notify our listeners
+ for (const ConfigurationEvent & j : aRemoveNotifyContainer)
+ implts_notifyContainerListener( j, NotifyOp_Remove );
+ for (const ConfigurationEvent & k : aReplaceNotifyContainer)
+ implts_notifyContainerListener( k, NotifyOp_Replace );
}
void SAL_CALL UIConfigurationManager::store()
@@ -1265,29 +1265,29 @@ void SAL_CALL UIConfigurationManager::store()
if ( m_bDisposed )
throw DisposedException();
- if ( m_xDocConfigStorage.is() && m_bModified && !m_bReadOnly )
+ if ( !(m_xDocConfigStorage.is() && m_bModified && !m_bReadOnly) )
+ return;
+
+ // Try to access our module sub folder
+ for ( int i = 1; i < css::ui::UIElementType::COUNT; i++ )
{
- // Try to access our module sub folder
- for ( int i = 1; i < css::ui::UIElementType::COUNT; i++ )
+ try
{
- try
- {
- UIElementType& rElementType = m_aUIElements[i];
+ UIElementType& rElementType = m_aUIElements[i];
- if ( rElementType.bModified && rElementType.xStorage.is() )
- impl_storeElementTypeData( rElementType.xStorage, rElementType );
- }
- catch ( const Exception& )
- {
- throw IOException();
- }
+ if ( rElementType.bModified && rElementType.xStorage.is() )
+ impl_storeElementTypeData( rElementType.xStorage, rElementType );
+ }
+ catch ( const Exception& )
+ {
+ throw IOException();
}
-
- m_bModified = false;
- Reference< XTransactedObject > xTransactedObject( m_xDocConfigStorage, UNO_QUERY );
- if ( xTransactedObject.is() )
- xTransactedObject->commit();
}
+
+ m_bModified = false;
+ Reference< XTransactedObject > xTransactedObject( m_xDocConfigStorage, UNO_QUERY );
+ if ( xTransactedObject.is() )
+ xTransactedObject->commit();
}
void SAL_CALL UIConfigurationManager::storeToStorage( const Reference< XStorage >& Storage )
@@ -1297,30 +1297,30 @@ void SAL_CALL UIConfigurationManager::storeToStorage( const Reference< XStorage
if ( m_bDisposed )
throw DisposedException();
- if ( m_xDocConfigStorage.is() && m_bModified && !m_bReadOnly )
+ if ( !(m_xDocConfigStorage.is() && m_bModified && !m_bReadOnly) )
+ return;
+
+ // Try to access our module sub folder
+ for ( int i = 1; i < css::ui::UIElementType::COUNT; i++ )
{
- // Try to access our module sub folder
- for ( int i = 1; i < css::ui::UIElementType::COUNT; i++ )
+ try
{
- try
- {
- Reference< XStorage > xElementTypeStorage( Storage->openStorageElement(
- UIELEMENTTYPENAMES[i], ElementModes::READWRITE ));
- UIElementType& rElementType = m_aUIElements[i];
+ Reference< XStorage > xElementTypeStorage( Storage->openStorageElement(
+ UIELEMENTTYPENAMES[i], ElementModes::READWRITE ));
+ UIElementType& rElementType = m_aUIElements[i];
- if ( rElementType.bModified && xElementTypeStorage.is() )
- impl_storeElementTypeData( xElementTypeStorage, rElementType, false ); // store data to storage, but don't reset modify flag!
- }
- catch ( const Exception& )
- {
- throw IOException();
- }
+ if ( rElementType.bModified && xElementTypeStorage.is() )
+ impl_storeElementTypeData( xElementTypeStorage, rElementType, false ); // store data to storage, but don't reset modify flag!
+ }
+ catch ( const Exception& )
+ {
+ throw IOException();
}
-
- Reference< XTransactedObject > xTransactedObject( Storage, UNO_QUERY );
- if ( xTransactedObject.is() )
- xTransactedObject->commit();
}
+
+ Reference< XTransactedObject > xTransactedObject( Storage, UNO_QUERY );
+ if ( xTransactedObject.is() )
+ xTransactedObject->commit();
}
sal_Bool SAL_CALL UIConfigurationManager::isModified()
@@ -1340,31 +1340,31 @@ sal_Bool SAL_CALL UIConfigurationManager::isReadOnly()
void UIConfigurationManager::implts_notifyContainerListener( const ConfigurationEvent& aEvent, NotifyOp eOp )
{
::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( cppu::UnoType<css::ui::XUIConfigurationListener>::get());
- if ( pContainer != nullptr )
+ if ( pContainer == nullptr )
+ return;
+
+ ::cppu::OInterfaceIteratorHelper pIterator( *pContainer );
+ while ( pIterator.hasMoreElements() )
{
- ::cppu::OInterfaceIteratorHelper pIterator( *pContainer );
- while ( pIterator.hasMoreElements() )
+ try
{
- try
- {
- switch ( eOp )
- {
- case NotifyOp_Replace:
- static_cast< css::ui::XUIConfigurationListener*>(pIterator.next())->elementReplaced( aEvent );
- break;
- case NotifyOp_Insert:
- static_cast< css::ui::XUIConfigurationListener*>(pIterator.next())->elementInserted( aEvent );
- break;
- case NotifyOp_Remove:
- static_cast< css::ui::XUIConfigurationListener*>(pIterator.next())->elementRemoved( aEvent );
- break;
- }
- }
- catch( const css::uno::RuntimeException& )
+ switch ( eOp )
{
- pIterator.remove();
+ case NotifyOp_Replace:
+ static_cast< css::ui::XUIConfigurationListener*>(pIterator.next())->elementReplaced( aEvent );
+ break;
+ case NotifyOp_Insert:
+ static_cast< css::ui::XUIConfigurationListener*>(pIterator.next())->elementInserted( aEvent );
+ break;
+ case NotifyOp_Remove:
+ static_cast< css::ui::XUIConfigurationListener*>(pIterator.next())->elementRemoved( aEvent );
+ break;
}
}
+ catch( const css::uno::RuntimeException& )
+ {
+ pIterator.remove();
+ }
}
}
diff --git a/framework/source/uiconfiguration/windowstateconfiguration.cxx b/framework/source/uiconfiguration/windowstateconfiguration.cxx
index eb9b3bcfeee4..536f4b2d048f 100644
--- a/framework/source/uiconfiguration/windowstateconfiguration.cxx
+++ b/framework/source/uiconfiguration/windowstateconfiguration.cxx
@@ -369,41 +369,41 @@ void SAL_CALL ConfigurationAccess_WindowState::insertByName( const OUString& rRe
}
// Try to ask our configuration access
- if ( m_xConfigAccess.is() )
- {
- if ( m_xConfigAccess->hasByName( rResourceURL ) )
- throw ElementExistException();
+ if ( !m_xConfigAccess.is() )
+ return;
- WindowStateInfo aWinStateInfo;
- impl_fillStructFromSequence( aWinStateInfo, aPropSet );
- m_aResourceURLToInfoCache.emplace( rResourceURL, aWinStateInfo );
+ if ( m_xConfigAccess->hasByName( rResourceURL ) )
+ throw ElementExistException();
- // insert must be write-through => insert element into configuration
- Reference< XNameContainer > xNameContainer( m_xConfigAccess, UNO_QUERY );
- if ( xNameContainer.is() )
- {
- Reference< XSingleServiceFactory > xFactory( m_xConfigAccess, UNO_QUERY );
- g.clear();
+ WindowStateInfo aWinStateInfo;
+ impl_fillStructFromSequence( aWinStateInfo, aPropSet );
+ m_aResourceURLToInfoCache.emplace( rResourceURL, aWinStateInfo );
- try
- {
- Reference< XPropertySet > xPropSet( xFactory->createInstance(), UNO_QUERY );
- if ( xPropSet.is() )
- {
- Any a;
- impl_putPropertiesFromStruct( aWinStateInfo, xPropSet );
- a <<= xPropSet;
- xNameContainer->insertByName( rResourceURL, a );
- Reference< XChangesBatch > xFlush( xFactory, UNO_QUERY );
- if ( xFlush.is() )
- xFlush->commitChanges();
- }
- }
- catch ( const Exception& )
- {
- }
+ // insert must be write-through => insert element into configuration
+ Reference< XNameContainer > xNameContainer( m_xConfigAccess, UNO_QUERY );
+ if ( !xNameContainer.is() )
+ return;
+
+ Reference< XSingleServiceFactory > xFactory( m_xConfigAccess, UNO_QUERY );
+ g.clear();
+
+ try
+ {
+ Reference< XPropertySet > xPropSet( xFactory->createInstance(), UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ Any a;
+ impl_putPropertiesFromStruct( aWinStateInfo, xPropSet );
+ a <<= xPropSet;
+ xNameContainer->insertByName( rResourceURL, a );
+ Reference< XChangesBatch > xFlush( xFactory, UNO_QUERY );
+ if ( xFlush.is() )
+ xFlush->commitChanges();
}
}
+ catch ( const Exception& )
+ {
+ }
}
// XNameReplace
@@ -445,33 +445,33 @@ void SAL_CALL ConfigurationAccess_WindowState::replaceByName( const OUString& rR
}
- if ( m_bModified && pIter != m_aResourceURLToInfoCache.end() )
+ if ( !(m_bModified && pIter != m_aResourceURLToInfoCache.end()) )
+ return;
+
+ Reference< XNameContainer > xNameContainer( m_xConfigAccess, UNO_QUERY );
+ if ( !xNameContainer.is() )
+ return;
+
+ WindowStateInfo aWinStateInfo( pIter->second );
+ OUString aResourceURL( pIter->first );
+ m_bModified = false;
+ g.clear();
+
+ try
{
- Reference< XNameContainer > xNameContainer( m_xConfigAccess, UNO_QUERY );
- if ( xNameContainer.is() )
+ Reference< XPropertySet > xPropSet;
+ if ( xNameContainer->getByName( aResourceURL ) >>= xPropSet )
{
- WindowStateInfo aWinStateInfo( pIter->second );
- OUString aResourceURL( pIter->first );
- m_bModified = false;
- g.clear();
-
- try
- {
- Reference< XPropertySet > xPropSet;
- if ( xNameContainer->getByName( aResourceURL ) >>= xPropSet )
- {
- impl_putPropertiesFromStruct( aWinStateInfo, xPropSet );
+ impl_putPropertiesFromStruct( aWinStateInfo, xPropSet );
- Reference< XChangesBatch > xFlush( m_xConfigAccess, UNO_QUERY );
- if ( xFlush.is() )
- xFlush->commitChanges();
- }
- }
- catch ( const Exception& )
- {
- }
+ Reference< XChangesBatch > xFlush( m_xConfigAccess, UNO_QUERY );
+ if ( xFlush.is() )
+ xFlush->commitChanges();
}
}
+ catch ( const Exception& )
+ {
+ }
}
diff --git a/framework/source/uielement/FixedImageToolbarController.cxx b/framework/source/uielement/FixedImageToolbarController.cxx
index 19e05f081d0d..c42bb518a8e7 100644
--- a/framework/source/uielement/FixedImageToolbarController.cxx
+++ b/framework/source/uielement/FixedImageToolbarController.cxx
@@ -73,29 +73,29 @@ void FixedImageToolbarController::CheckAndUpdateImages()
SvtMiscOptions aMiscOptions;
const sal_Int16 eNewSymbolSize = aMiscOptions.GetCurrentSymbolsSize();
- if (m_eSymbolSize != eNewSymbolSize)
+ if (m_eSymbolSize == eNewSymbolSize)
+ return;
+
+ m_eSymbolSize = eNewSymbolSize;
+
+ // Refresh images if requested
+ auto aSize(m_pFixedImageControl->GetOptimalSize());
+ if (m_eSymbolSize == SFX_SYMBOLS_SIZE_LARGE)
+ {
+ aSize.setWidth(26);
+ aSize.setHeight(26);
+ }
+ else if (m_eSymbolSize == SFX_SYMBOLS_SIZE_32)
+ {
+ aSize.setWidth(32);
+ aSize.setHeight(32);
+ }
+ else
{
- m_eSymbolSize = eNewSymbolSize;
-
- // Refresh images if requested
- auto aSize(m_pFixedImageControl->GetOptimalSize());
- if (m_eSymbolSize == SFX_SYMBOLS_SIZE_LARGE)
- {
- aSize.setWidth(26);
- aSize.setHeight(26);
- }
- else if (m_eSymbolSize == SFX_SYMBOLS_SIZE_32)
- {
- aSize.setWidth(32);
- aSize.setHeight(32);
- }
- else
- {
- aSize.setWidth(16);
- aSize.setHeight(16);
- }
- m_pFixedImageControl->SetSizePixel(aSize);
+ aSize.setWidth(16);
+ aSize.setHeight(16);
}
+ m_pFixedImageControl->SetSizePixel(aSize);
}
IMPL_LINK_NOARG(FixedImageToolbarController, MiscOptionsChanged, LinkParamNone*, void)
diff --git a/framework/source/uielement/FixedTextToolbarController.cxx b/framework/source/uielement/FixedTextToolbarController.cxx
index 26208cc68bb1..374ad33798aa 100644
--- a/framework/source/uielement/FixedTextToolbarController.cxx
+++ b/framework/source/uielement/FixedTextToolbarController.cxx
@@ -70,21 +70,21 @@ void FixedTextToolbarController::executeControlCommand(
{
SolarMutexGuard aSolarMutexGuard;
- if (rControlCommand.Command == "SetText")
+ if (rControlCommand.Command != "SetText")
+ return;
+
+ for (sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++)
{
- for (sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++)
+ if (rControlCommand.Arguments[i].Name == "Text")
{
- if (rControlCommand.Arguments[i].Name == "Text")
- {
- OUString aText;
- rControlCommand.Arguments[i].Value >>= aText;
- m_pFixedTextControl->SetText(aText);
- m_pFixedTextControl->SetSizePixel(m_pFixedTextControl->GetOptimalSize());
+ OUString aText;
+ rControlCommand.Arguments[i].Value >>= aText;
+ m_pFixedTextControl->SetText(aText);
+ m_pFixedTextControl->SetSizePixel(m_pFixedTextControl->GetOptimalSize());
- // send notification
- notifyTextChanged(aText);
- break;
- }
+ // send notification
+ notifyTextChanged(aText);
+ break;
}
}
}
diff --git a/framework/source/uielement/addonstoolbarwrapper.cxx b/framework/source/uielement/addonstoolbarwrapper.cxx
index 8c62997a27a2..025b57904ff1 100644
--- a/framework/source/uielement/addonstoolbarwrapper.cxx
+++ b/framework/source/uielement/addonstoolbarwrapper.cxx
@@ -76,59 +76,59 @@ void SAL_CALL AddonsToolBarWrapper::initialize( const Sequence< Any >& aArgument
if ( m_bDisposed )
throw DisposedException();
- if ( !m_bInitialized )
+ if ( m_bInitialized )
+ return;
+
+ UIElementWrapperBase::initialize( aArguments );
+
+ for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ )
{
- UIElementWrapperBase::initialize( aArguments );
+ PropertyValue aPropValue;
+ if ( aArguments[n] >>= aPropValue )
+ {
+ if ( aPropValue.Name == "ConfigurationData" )
+ aPropValue.Value >>= m_aConfigData;
+ }
+ }
+
+ Reference< XFrame > xFrame( m_xWeakFrame );
+ if ( !(xFrame.is() && m_aConfigData.hasElements()) )
+ return;
- for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ )
+ // Create VCL based toolbar which will be filled with settings data
+ VclPtr<ToolBox> pToolBar;
+ AddonsToolBarManager* pToolBarManager = nullptr;
+ {
+ SolarMutexGuard aSolarMutexGuard;
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
+ if ( pWindow )
{
- PropertyValue aPropValue;
- if ( aArguments[n] >>= aPropValue )
- {
- if ( aPropValue.Name == "ConfigurationData" )
- aPropValue.Value >>= m_aConfigData;
- }
+ sal_uLong nStyles = WB_BORDER | WB_SCROLL | WB_MOVEABLE | WB_3DLOOK | WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE;
+
+ pToolBar = VclPtr<ToolBox>::Create( pWindow, nStyles );
+ pToolBar->SetLineSpacing(true);
+ pToolBarManager = new AddonsToolBarManager( m_xContext, xFrame, m_aResourceURL, pToolBar );
+ m_xToolBarManager.set( static_cast< OWeakObject *>( pToolBarManager ), UNO_QUERY );
}
+ }
- Reference< XFrame > xFrame( m_xWeakFrame );
- if ( xFrame.is() && m_aConfigData.hasElements() )
+ try
+ {
+ if ( m_aConfigData.hasElements() && pToolBar && pToolBarManager )
{
- // Create VCL based toolbar which will be filled with settings data
- VclPtr<ToolBox> pToolBar;
- AddonsToolBarManager* pToolBarManager = nullptr;
- {
- SolarMutexGuard aSolarMutexGuard;
- VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
- if ( pWindow )
- {
- sal_uLong nStyles = WB_BORDER | WB_SCROLL | WB_MOVEABLE | WB_3DLOOK | WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE;
-
- pToolBar = VclPtr<ToolBox>::Create( pWindow, nStyles );
- pToolBar->SetLineSpacing(true);
- pToolBarManager = new AddonsToolBarManager( m_xContext, xFrame, m_aResourceURL, pToolBar );
- m_xToolBarManager.set( static_cast< OWeakObject *>( pToolBarManager ), UNO_QUERY );
- }
- }
-
- try
- {
- if ( m_aConfigData.hasElements() && pToolBar && pToolBarManager )
- {
- // Fill toolbar with container contents
- pToolBarManager->FillToolbar( m_aConfigData );
- pToolBar->SetOutStyle( SvtMiscOptions().GetToolboxStyle() );
- pToolBar->EnableCustomize();
- ::Size aActSize( pToolBar->GetSizePixel() );
- ::Size aSize( pToolBar->CalcWindowSizePixel() );
- aSize.setWidth( aActSize.Width() );
- pToolBar->SetSizePixel( aSize );
- }
- }
- catch ( const NoSuchElementException& )
- {
- }
+ // Fill toolbar with container contents
+ pToolBarManager->FillToolbar( m_aConfigData );
+ pToolBar->SetOutStyle( SvtMiscOptions().GetToolboxStyle() );
+ pToolBar->EnableCustomize();
+ ::Size aActSize( pToolBar->GetSizePixel() );
+ ::Size aSize( pToolBar->CalcWindowSizePixel() );
+ aSize.setWidth( aActSize.Width() );
+ pToolBar->SetSizePixel( aSize );
}
}
+ catch ( const NoSuchElementException& )
+ {
+ }
}
// XUIElement interface
diff --git a/framework/source/uielement/buttontoolbarcontroller.cxx b/framework/source/uielement/buttontoolbarcontroller.cxx
index 175fad04bbb2..c13d645f57f0 100644
--- a/framework/source/uielement/buttontoolbarcontroller.cxx
+++ b/framework/source/uielement/buttontoolbarcontroller.cxx
@@ -100,25 +100,25 @@ void SAL_CALL ButtonToolbarController::initialize(
bInitialized = m_bInitialized;
}
- if ( !bInitialized )
- {
- SolarMutexGuard aSolarMutexGuard;
- m_bInitialized = true;
+ if ( bInitialized )
+ return;
- PropertyValue aPropValue;
- for ( int i = 0; i < aArguments.getLength(); i++ )
+ SolarMutexGuard aSolarMutexGuard;
+ m_bInitialized = true;
+
+ PropertyValue aPropValue;
+ for ( int i = 0; i < aArguments.getLength(); i++ )
+ {
+ if ( aArguments[i] >>= aPropValue )
{
- if ( aArguments[i] >>= aPropValue )
+ if ( aPropValue.Name == "Frame" )
+ m_xFrame.set(aPropValue.Value,UNO_QUERY);
+ else if ( aPropValue.Name == "CommandURL" )
+ aPropValue.Value >>= m_aCommandURL;
+ else if ( aPropValue.Name == "ServiceManager" )
{
- if ( aPropValue.Name == "Frame" )
- m_xFrame.set(aPropValue.Value,UNO_QUERY);
- else if ( aPropValue.Name == "CommandURL" )
- aPropValue.Value >>= m_aCommandURL;
- else if ( aPropValue.Name == "ServiceManager" )
- {
- Reference<XMultiServiceFactory> xServiceManager(aPropValue.Value,UNO_QUERY);
- m_xContext = comphelper::getComponentContext(xServiceManager);
- }
+ Reference<XMultiServiceFactory> xServiceManager(aPropValue.Value,UNO_QUERY);
+ m_xContext = comphelper::getComponentContext(xServiceManager);
}
}
}
@@ -224,21 +224,21 @@ void SAL_CALL ButtonToolbarController::execute( sal_Int16 KeyModifier )
xDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 );
}
- if ( xDispatch.is() )
+ if ( !xDispatch.is() )
+ return;
+
+ try
{
- try
- {
- Sequence<PropertyValue> aArgs( 1 );
+ Sequence<PropertyValue> aArgs( 1 );
- // Provide key modifier information to dispatch function
- aArgs[0].Name = "KeyModifier";
- aArgs[0].Value <<= KeyModifier;
+ // Provide key modifier information to dispatch function
+ aArgs[0].Name = "KeyModifier";
+ aArgs[0].Value <<= KeyModifier;
- xDispatch->dispatch( aTargetURL, aArgs );
- }
- catch ( const DisposedException& )
- {
- }
+ xDispatch->dispatch( aTargetURL, aArgs );
+ }
+ catch ( const DisposedException& )
+ {
}
}
diff --git a/framework/source/uielement/complextoolbarcontroller.cxx b/framework/source/uielement/complextoolbarcontroller.cxx
index eb4a59f38a0a..9b985a039e78 100644
--- a/framework/source/uielement/complextoolbarcontroller.cxx
+++ b/framework/source/uielement/complextoolbarcontroller.cxx
@@ -128,80 +128,80 @@ void ComplexToolbarController::statusChanged( const FeatureStateEvent& Event )
if ( m_bDisposed )
return;
- if ( m_xToolbar )
- {
- m_xToolbar->EnableItem( m_nID, Event.IsEnabled );
+ if ( !m_xToolbar )
+ return;
- ToolBoxItemBits nItemBits = m_xToolbar->GetItemBits( m_nID );
- nItemBits &= ~ToolBoxItemBits::CHECKABLE;
- TriState eTri = TRISTATE_FALSE;
+ m_xToolbar->EnableItem( m_nID, Event.IsEnabled );
- bool bValue;
- OUString aStrValue;
- ItemStatus aItemState;
- Visibility aItemVisibility;
- ControlCommand aControlCommand;
+ ToolBoxItemBits nItemBits = m_xToolbar->GetItemBits( m_nID );
+ nItemBits &= ~ToolBoxItemBits::CHECKABLE;
+ TriState eTri = TRISTATE_FALSE;
- if ( Event.State >>= bValue )
- {
- // Boolean, treat it as checked/unchecked
- if ( m_bMadeInvisible )
- m_xToolbar->ShowItem( m_nID );
- m_xToolbar->CheckItem( m_nID, bValue );
- if ( bValue )
- eTri = TRISTATE_TRUE;
- nItemBits |= ToolBoxItemBits::CHECKABLE;
- }
- else if ( Event.State >>= aStrValue )
- {
- OUString aText( MnemonicGenerator::EraseAllMnemonicChars( aStrValue ) );
- m_xToolbar->SetItemText( m_nID, aText );
- m_xToolbar->SetQuickHelpText( m_nID, aText );
+ bool bValue;
+ OUString aStrValue;
+ ItemStatus aItemState;
+ Visibility aItemVisibility;
+ ControlCommand aControlCommand;
- if ( m_bMadeInvisible )
- m_xToolbar->ShowItem( m_nID );
- }
- else if ( Event.State >>= aItemState )
- {
- eTri = TRISTATE_INDET;
- nItemBits |= ToolBoxItemBits::CHECKABLE;
- if ( m_bMadeInvisible )
- m_xToolbar->ShowItem( m_nID );
- }
- else if ( Event.State >>= aItemVisibility )
- {
- m_xToolbar->ShowItem( m_nID, aItemVisibility.bVisible );
- m_bMadeInvisible = !aItemVisibility.bVisible;
- }
- else if ( Event.State >>= aControlCommand )
+ if ( Event.State >>= bValue )
+ {
+ // Boolean, treat it as checked/unchecked
+ if ( m_bMadeInvisible )
+ m_xToolbar->ShowItem( m_nID );
+ m_xToolbar->CheckItem( m_nID, bValue );
+ if ( bValue )
+ eTri = TRISTATE_TRUE;
+ nItemBits |= ToolBoxItemBits::CHECKABLE;
+ }
+ else if ( Event.State >>= aStrValue )
+ {
+ OUString aText( MnemonicGenerator::EraseAllMnemonicChars( aStrValue ) );
+ m_xToolbar->SetItemText( m_nID, aText );
+ m_xToolbar->SetQuickHelpText( m_nID, aText );
+
+ if ( m_bMadeInvisible )
+ m_xToolbar->ShowItem( m_nID );
+ }
+ else if ( Event.State >>= aItemState )
+ {
+ eTri = TRISTATE_INDET;
+ nItemBits |= ToolBoxItemBits::CHECKABLE;
+ if ( m_bMadeInvisible )
+ m_xToolbar->ShowItem( m_nID );
+ }
+ else if ( Event.State >>= aItemVisibility )
+ {
+ m_xToolbar->ShowItem( m_nID, aItemVisibility.bVisible );
+ m_bMadeInvisible = !aItemVisibility.bVisible;
+ }
+ else if ( Event.State >>= aControlCommand )
+ {
+ if (aControlCommand.Command == "SetQuickHelpText")
{
- if (aControlCommand.Command == "SetQuickHelpText")
+ for (sal_Int32 i = 0; i < aControlCommand.Arguments.getLength(); i++)
{
- for (sal_Int32 i = 0; i < aControlCommand.Arguments.getLength(); i++)
+ if (aControlCommand.Arguments[i].Name == "HelpText")
{
- if (aControlCommand.Arguments[i].Name == "HelpText")
- {
- OUString aHelpText;
- aControlCommand.Arguments[i].Value >>= aHelpText;
- m_xToolbar->SetQuickHelpText(m_nID, aHelpText);
- break;
- }
+ OUString aHelpText;
+ aControlCommand.Arguments[i].Value >>= aHelpText;
+ m_xToolbar->SetQuickHelpText(m_nID, aHelpText);
+ break;
}
}
- else
- {
- executeControlCommand( aControlCommand );
- }
- if ( m_bMadeInvisible )
- m_xToolbar->ShowItem( m_nID );
}
-
- else if ( m_bMadeInvisible )
+ else
+ {
+ executeControlCommand( aControlCommand );
+ }
+ if ( m_bMadeInvisible )
m_xToolbar->ShowItem( m_nID );
-
- m_xToolbar->SetItemState( m_nID, eTri );
- m_xToolbar->SetItemBits( m_nID, nItemBits );
}
+
+ else if ( m_bMadeInvisible )
+ m_xToolbar->ShowItem( m_nID );
+
+ m_xToolbar->SetItemState( m_nID, eTri );
+ m_xToolbar->SetItemBits( m_nID, nItemBits );
}
IMPL_STATIC_LINK( ComplexToolbarController, ExecuteHdl_Impl, void*, p, void )
@@ -251,25 +251,25 @@ void ComplexToolbarController::addNotifyInfo(
{
uno::Reference< frame::XControlNotificationListener > xControlNotify( xDispatch, uno::UNO_QUERY );
- if ( xControlNotify.is() )
- {
- // Execute notification asynchronously
- NotifyInfo* pNotifyInfo = new NotifyInfo;
-
- pNotifyInfo->aEventName = aEventName;
- pNotifyInfo->xNotifyListener = xControlNotify;
- pNotifyInfo->aSourceURL = getInitializedURL();
-
- // Add frame as source to the information sequence
- sal_Int32 nCount = rInfo.getLength();
- uno::Sequence< beans::NamedValue > aInfoSeq( rInfo );
- aInfoSeq.realloc( nCount+1 );
- aInfoSeq[nCount].Name = "Source";
- aInfoSeq[nCount].Value <<= getFrameInterface();
- pNotifyInfo->aInfoSeq = aInfoSeq;
-
- Application::PostUserEvent( LINK(nullptr, ComplexToolbarController, Notify_Impl), pNotifyInfo );
- }
+ if ( !xControlNotify.is() )
+ return;
+
+ // Execute notification asynchronously
+ NotifyInfo* pNotifyInfo = new NotifyInfo;
+
+ pNotifyInfo->aEventName = aEventName;
+ pNotifyInfo->xNotifyListener = xControlNotify;
+ pNotifyInfo->aSourceURL = getInitializedURL();
+
+ // Add frame as source to the information sequence
+ sal_Int32 nCount = rInfo.getLength();
+ uno::Sequence< beans::NamedValue > aInfoSeq( rInfo );
+ aInfoSeq.realloc( nCount+1 );
+ aInfoSeq[nCount].Name = "Source";
+ aInfoSeq[nCount].Value <<= getFrameInterface();
+ pNotifyInfo->aInfoSeq = aInfoSeq;
+
+ Application::PostUserEvent( LINK(nullptr, ComplexToolbarController, Notify_Impl), pNotifyInfo );
}
sal_Int32 ComplexToolbarController::getFontSizePixel( const vcl::Window* pWindow )
diff --git a/framework/source/uielement/controlmenucontroller.cxx b/framework/source/uielement/controlmenucontroller.cxx
index 3ed5bc11aee2..9e6d490d3e33 100644
--- a/framework/source/uielement/controlmenucontroller.cxx
+++ b/framework/source/uielement/controlmenucontroller.cxx
@@ -237,37 +237,37 @@ void SAL_CALL ControlMenuController::statusChanged( const FeatureStateEvent& Eve
nMenuId = m_xResPopupMenu->GetItemId(sIdent);
}
- if (pPopupMenu)
- {
- SolarMutexGuard aSolarMutexGuard;
+ if (!pPopupMenu)
+ return;
+
+ SolarMutexGuard aSolarMutexGuard;
- PopupMenu* pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
+ PopupMenu* pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
- if ( !Event.IsEnabled && pVCLPopupMenu->GetItemPos( nMenuId ) != MENU_ITEM_NOTFOUND )
- pVCLPopupMenu->RemoveItem( pVCLPopupMenu->GetItemPos( nMenuId ));
- else if ( Event.IsEnabled && pVCLPopupMenu->GetItemPos( nMenuId ) == MENU_ITEM_NOTFOUND )
+ if ( !Event.IsEnabled && pVCLPopupMenu->GetItemPos( nMenuId ) != MENU_ITEM_NOTFOUND )
+ pVCLPopupMenu->RemoveItem( pVCLPopupMenu->GetItemPos( nMenuId ));
+ else if ( Event.IsEnabled && pVCLPopupMenu->GetItemPos( nMenuId ) == MENU_ITEM_NOTFOUND )
+ {
+ sal_Int16 nSourcePos = m_xResPopupMenu->GetItemPos(nMenuId);
+ sal_Int16 nPrevInSource = nSourcePos;
+ sal_uInt16 nPrevInConversion = MENU_ITEM_NOTFOUND;
+ while (nPrevInSource>0)
{
- sal_Int16 nSourcePos = m_xResPopupMenu->GetItemPos(nMenuId);
- sal_Int16 nPrevInSource = nSourcePos;
- sal_uInt16 nPrevInConversion = MENU_ITEM_NOTFOUND;
- while (nPrevInSource>0)
- {
- sal_Int16 nPrevId = m_xResPopupMenu->GetItemId(--nPrevInSource);
+ sal_Int16 nPrevId = m_xResPopupMenu->GetItemId(--nPrevInSource);
- // do we have the source's predecessor in our conversion menu, too ?
- nPrevInConversion = pVCLPopupMenu->GetItemPos( nPrevId );
- if ( nPrevInConversion != MENU_ITEM_NOTFOUND )
- break;
- }
+ // do we have the source's predecessor in our conversion menu, too ?
+ nPrevInConversion = pVCLPopupMenu->GetItemPos( nPrevId );
+ if ( nPrevInConversion != MENU_ITEM_NOTFOUND )
+ break;
+ }
- if ( MENU_ITEM_NOTFOUND == nPrevInConversion )
- // none of the items which precede the nSID-slot in the source menu are present in our conversion menu
- nPrevInConversion = sal::static_int_cast< sal_uInt16 >(-1); // put the item at the first position
+ if ( MENU_ITEM_NOTFOUND == nPrevInConversion )
+ // none of the items which precede the nSID-slot in the source menu are present in our conversion menu
+ nPrevInConversion = sal::static_int_cast< sal_uInt16 >(-1); // put the item at the first position
- pVCLPopupMenu->InsertItem(nMenuId, m_xResPopupMenu->GetItemText(nMenuId), m_xResPopupMenu->GetItemBits(nMenuId), OString(), ++nPrevInConversion);
- pVCLPopupMenu->SetItemImage(nMenuId, m_xResPopupMenu->GetItemImage(nMenuId));
- pVCLPopupMenu->SetHelpId(nMenuId, m_xResPopupMenu->GetHelpId(nMenuId));
- }
+ pVCLPopupMenu->InsertItem(nMenuId, m_xResPopupMenu->GetItemText(nMenuId), m_xResPopupMenu->GetItemBits(nMenuId), OString(), ++nPrevInConversion);
+ pVCLPopupMenu->SetItemImage(nMenuId, m_xResPopupMenu->GetItemImage(nMenuId));
+ pVCLPopupMenu->SetHelpId(nMenuId, m_xResPopupMenu->GetHelpId(nMenuId));
}
}
@@ -276,25 +276,25 @@ void SAL_CALL ControlMenuController::itemActivated( const css::awt::MenuEvent& )
{
osl::MutexGuard aLock( m_aMutex );
- if ( m_xPopupMenu.is() )
- {
- SolarMutexGuard aSolarMutexGuard;
+ if ( !m_xPopupMenu.is() )
+ return;
- // Check if some modes have changed so we have to update our menu images
- const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
- bool bShowMenuImages = rSettings.GetUseImagesInMenus();
+ SolarMutexGuard aSolarMutexGuard;
- if (bShowMenuImages != m_bShowMenuImages)
- {
- m_bShowMenuImages = bShowMenuImages;
+ // Check if some modes have changed so we have to update our menu images
+ const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
+ bool bShowMenuImages = rSettings.GetUseImagesInMenus();
- VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( m_xPopupMenu ));
- if ( pPopupMenu )
- {
- PopupMenu* pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
- if (pVCLPopupMenu)
- updateImagesPopupMenu( pVCLPopupMenu );
- }
+ if (bShowMenuImages != m_bShowMenuImages)
+ {
+ m_bShowMenuImages = bShowMenuImages;
+
+ VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( m_xPopupMenu ));
+ if ( pPopupMenu )
+ {
+ PopupMenu* pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
+ if (pVCLPopupMenu)
+ updateImagesPopupMenu( pVCLPopupMenu );
}
}
}
@@ -316,25 +316,25 @@ void SAL_CALL ControlMenuController::updatePopupMenu()
throwIfDisposed();
- if ( m_xFrame.is() && m_xPopupMenu.is() )
+ if ( !(m_xFrame.is() && m_xPopupMenu.is()) )
+ return;
+
+ css::util::URL aTargetURL;
+ Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
+ fillPopupMenu( m_xPopupMenu );
+ m_aURLToDispatchMap.free();
+
+ for (const char* aCommand : aCommands)
{
- css::util::URL aTargetURL;
- Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
- fillPopupMenu( m_xPopupMenu );
- m_aURLToDispatchMap.free();
+ aTargetURL.Complete = OUString::createFromAscii( aCommand );
+ m_xURLTransformer->parseStrict( aTargetURL );
- for (const char* aCommand : aCommands)
+ Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 );
+ if ( xDispatch.is() )
{
- aTargetURL.Complete = OUString::createFromAscii( aCommand );
- m_xURLTransformer->parseStrict( aTargetURL );
-
- Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 );
- if ( xDispatch.is() )
- {
- xDispatch->addStatusListener( static_cast< XStatusListener* >(this), aTargetURL );
- xDispatch->removeStatusListener( static_cast< XStatusListener* >(this), aTargetURL );
- m_aURLToDispatchMap.emplace( aTargetURL.Complete, xDispatch );
- }
+ xDispatch->addStatusListener( static_cast< XStatusListener* >(this), aTargetURL );
+ xDispatch->removeStatusListener( static_cast< XStatusListener* >(this), aTargetURL );
+ m_aURLToDispatchMap.emplace( aTargetURL.Complete, xDispatch );
}
}
}
diff --git a/framework/source/uielement/edittoolbarcontroller.cxx b/framework/source/uielement/edittoolbarcontroller.cxx
index 2e6164181072..5b6cd39cd45d 100644
--- a/framework/source/uielement/edittoolbarcontroller.cxx
+++ b/framework/source/uielement/edittoolbarcontroller.cxx
@@ -189,20 +189,20 @@ bool EditToolbarController::PreNotify( NotifyEvent const & rNEvt )
void EditToolbarController::executeControlCommand( const css::frame::ControlCommand& rControlCommand )
{
- if ( rControlCommand.Command.startsWith( "SetText" ))
+ if ( !rControlCommand.Command.startsWith( "SetText" ))
+ return;
+
+ for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
{
- for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+ if ( rControlCommand.Arguments[i].Name.startsWith( "Text" ))
{
- if ( rControlCommand.Arguments[i].Name.startsWith( "Text" ))
- {
- OUString aText;
- rControlCommand.Arguments[i].Value >>= aText;
- m_pEditControl->SetText( aText );
-
- // send notification
- notifyTextChanged( aText );
- break;
- }
+ OUString aText;
+ rControlCommand.Arguments[i].Value >>= aText;
+ m_pEditControl->SetText( aText );
+
+ // send notification
+ notifyTextChanged( aText );
+ break;
}
}
}
diff --git a/framework/source/uielement/fontmenucontroller.cxx b/framework/source/uielement/fontmenucontroller.cxx
index 184626b2b1cb..50cc9d344534 100644
--- a/framework/source/uielement/fontmenucontroller.cxx
+++ b/framework/source/uielement/fontmenucontroller.cxx
@@ -84,31 +84,30 @@ void FontMenuController::fillPopupMenu( const Sequence< OUString >& rFontNameSeq
if ( pPopupMenu )
pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
- if ( pVCLPopupMenu )
- {
- vector<OUString> aVector;
- aVector.reserve(rFontNameSeq.getLength());
- for ( sal_Int32 i = 0; i < rFontNameSeq.getLength(); i++ )
- {
- aVector.push_back(MnemonicGenerator::EraseAllMnemonicChars(pFontNameArray[i]));
- }
- sort(aVector.begin(), aVector.end(), lcl_I18nCompareString );
+ if ( !pVCLPopupMenu )
+ return;
- const OUString aFontNameCommandPrefix( ".uno:CharFontName?CharFontName.FamilyName:string=" );
- const sal_Int16 nCount = static_cast<sal_Int16>(aVector.size());
- for ( sal_Int16 i = 0; i < nCount; i++ )
- {
- const OUString& rName = aVector[i];
- m_xPopupMenu->insertItem( i+1, rName, css::awt::MenuItemStyle::RADIOCHECK | css::awt::MenuItemStyle::AUTOCHECK, i );
- if ( rName == m_aFontFamilyName )
- m_xPopupMenu->checkItem( i+1, true );
- // use VCL popup menu pointer to set vital information that are not part of the awt implementation
- OUStringBuffer aCommandBuffer( aFontNameCommandPrefix );
- aCommandBuffer.append( INetURLObject::encode( rName, INetURLObject::PART_HTTP_QUERY, INetURLObject::EncodeMechanism::All ));
- OUString aFontNameCommand = aCommandBuffer.makeStringAndClear();
- pVCLPopupMenu->SetItemCommand( i+1, aFontNameCommand ); // Store font name into item command.
- }
+ vector<OUString> aVector;
+ aVector.reserve(rFontNameSeq.getLength());
+ for ( sal_Int32 i = 0; i < rFontNameSeq.getLength(); i++ )
+ {
+ aVector.push_back(MnemonicGenerator::EraseAllMnemonicChars(pFontNameArray[i]));
+ }
+ sort(aVector.begin(), aVector.end(), lcl_I18nCompareString );
+ const OUString aFontNameCommandPrefix( ".uno:CharFontName?CharFontName.FamilyName:string=" );
+ const sal_Int16 nCount = static_cast<sal_Int16>(aVector.size());
+ for ( sal_Int16 i = 0; i < nCount; i++ )
+ {
+ const OUString& rName = aVector[i];
+ m_xPopupMenu->insertItem( i+1, rName, css::awt::MenuItemStyle::RADIOCHECK | css::awt::MenuItemStyle::AUTOCHECK, i );
+ if ( rName == m_aFontFamilyName )
+ m_xPopupMenu->checkItem( i+1, true );
+ // use VCL popup menu pointer to set vital information that are not part of the awt implementation
+ OUStringBuffer aCommandBuffer( aFontNameCommandPrefix );
+ aCommandBuffer.append( INetURLObject::encode( rName, INetURLObject::PART_HTTP_QUERY, INetURLObject::EncodeMechanism::All ));
+ OUString aFontNameCommand = aCommandBuffer.makeStringAndClear();
+ pVCLPopupMenu->SetItemCommand( i+1, aFontNameCommand ); // Store font name into item command.
}
}
@@ -151,36 +150,36 @@ void SAL_CALL FontMenuController::itemActivated( const css::awt::MenuEvent& )
{
osl::MutexGuard aLock( m_aMutex );
- if ( m_xPopupMenu.is() )
+ if ( !m_xPopupMenu.is() )
+ return;
+
+ // find new font name and set check mark!
+ sal_uInt16 nChecked = 0;
+ sal_uInt16 nItemCount = m_xPopupMenu->getItemCount();
+ for( sal_uInt16 i = 0; i < nItemCount; i++ )
{
- // find new font name and set check mark!
- sal_uInt16 nChecked = 0;
- sal_uInt16 nItemCount = m_xPopupMenu->getItemCount();
- for( sal_uInt16 i = 0; i < nItemCount; i++ )
- {
- sal_uInt16 nItemId = m_xPopupMenu->getItemId( i );
+ sal_uInt16 nItemId = m_xPopupMenu->getItemId( i );
- if ( m_xPopupMenu->isItemChecked( nItemId ) )
- nChecked = nItemId;
+ if ( m_xPopupMenu->isItemChecked( nItemId ) )
+ nChecked = nItemId;
- OUString aText = m_xPopupMenu->getItemText( nItemId );
+ OUString aText = m_xPopupMenu->getItemText( nItemId );
- // TODO: must be replaced by implementation of VCL, when available
- sal_Int32 nIndex = aText.indexOf( '~' );
- if ( nIndex >= 0 )
- aText = aText.replaceAt( nIndex, 1, "" );
- // TODO: must be replaced by implementation of VCL, when available
+ // TODO: must be replaced by implementation of VCL, when available
+ sal_Int32 nIndex = aText.indexOf( '~' );
+ if ( nIndex >= 0 )
+ aText = aText.replaceAt( nIndex, 1, "" );
+ // TODO: must be replaced by implementation of VCL, when available
- if ( aText == m_aFontFamilyName )
- {
- m_xPopupMenu->checkItem( nItemId, true );
- return;
- }
+ if ( aText == m_aFontFamilyName )
+ {
+ m_xPopupMenu->checkItem( nItemId, true );
+ return;
}
-
- if ( nChecked )
- m_xPopupMenu->checkItem( nChecked, false );
}
+
+ if ( nChecked )
+ m_xPopupMenu->checkItem( nChecked, false );
}
// XPopupMenuController
diff --git a/framework/source/uielement/fontsizemenucontroller.cxx b/framework/source/uielement/fontsizemenucontroller.cxx
index 8bdcf5f6b038..5fa645d68a1a 100644
--- a/framework/source/uielement/fontsizemenucontroller.cxx
+++ b/framework/source/uielement/fontsizemenucontroller.cxx
@@ -128,57 +128,77 @@ void FontSizeMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > co
if ( pPopupMenu )
pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
- if ( pVCLPopupMenu )
- {
- std::unique_ptr<FontList> pFontList;
- ScopedVclPtr<Printer> pInfoPrinter;
- OUString aPrinterName;
+ if ( !pVCLPopupMenu )
+ return;
- SolarMutexGuard aSolarMutexGuard;
+ std::unique_ptr<FontList> pFontList;
+ ScopedVclPtr<Printer> pInfoPrinter;
+ OUString aPrinterName;
- // try to retrieve printer name of document
- aPrinterName = retrievePrinterName( m_xFrame );
- if ( !aPrinterName.isEmpty() )
- {
- pInfoPrinter.disposeAndReset(VclPtr<Printer>::Create( aPrinterName ));
- if ( pInfoPrinter && pInfoPrinter->GetDevFontCount() > 0 )
- pFontList.reset(new FontList( pInfoPrinter.get() ));
- }
+ SolarMutexGuard aSolarMutexGuard;
+
+ // try to retrieve printer name of document
+ aPrinterName = retrievePrinterName( m_xFrame );
+ if ( !aPrinterName.isEmpty() )
+ {
+ pInfoPrinter.disposeAndReset(VclPtr<Printer>::Create( aPrinterName ));
+ if ( pInfoPrinter && pInfoPrinter->GetDevFontCount() > 0 )
+ pFontList.reset(new FontList( pInfoPrinter.get() ));
+ }
- if ( !pFontList )
- pFontList.reset(new FontList( Application::GetDefaultDevice() ));
+ if ( !pFontList )
+ pFontList.reset(new FontList( Application::GetDefaultDevice() ));
- FontMetric aFontMetric = pFontList->Get( m_aFontDescriptor.Name, m_aFontDescriptor.StyleName );
+ FontMetric aFontMetric = pFontList->Get( m_aFontDescriptor.Name, m_aFontDescriptor.StyleName );
- // setup font size array
- m_pHeightArray.reset();
+ // setup font size array
+ m_pHeightArray.reset();
- const sal_IntPtr* pTempAry;
- const sal_IntPtr* pAry = pFontList->GetSizeAry( aFontMetric );
- sal_uInt16 nSizeCount = 0;
- while ( pAry[nSizeCount] )
- nSizeCount++;
+ const sal_IntPtr* pTempAry;
+ const sal_IntPtr* pAry = pFontList->GetSizeAry( aFontMetric );
+ sal_uInt16 nSizeCount = 0;
+ while ( pAry[nSizeCount] )
+ nSizeCount++;
- sal_uInt16 nPos = 0;
- const OUString aFontHeightCommand( ".uno:FontHeight?FontHeight.Height:float=" );
+ sal_uInt16 nPos = 0;
+ const OUString aFontHeightCommand( ".uno:FontHeight?FontHeight.Height:float=" );
- // first insert font size names (for simplified/traditional chinese)
- float fPoint;
- FontSizeNames aFontSizeNames( Application::GetSettings().GetUILanguageTag().getLanguageType() );
- m_pHeightArray.reset( new long[nSizeCount+aFontSizeNames.Count()] );
- OUString aCommand;
+ // first insert font size names (for simplified/traditional chinese)
+ float fPoint;
+ FontSizeNames aFontSizeNames( Application::GetSettings().GetUILanguageTag().getLanguageType() );
+ m_pHeightArray.reset( new long[nSizeCount+aFontSizeNames.Count()] );
+ OUString aCommand;
- if ( !aFontSizeNames.IsEmpty() )
+ if ( !aFontSizeNames.IsEmpty() )
+ {
+ if ( pAry == FontList::GetStdSizeAry() )
+ {
+ // for scalable fonts all font size names
+ sal_Int32 nCount = aFontSizeNames.Count();
+ for( sal_Int32 i = 0; i < nCount; i++ )
+ {
+ OUString aSizeName = aFontSizeNames.GetIndexName( i );
+ sal_Int32 nSize = aFontSizeNames.GetIndexSize( i );
+ m_pHeightArray[nPos] = nSize;
+ nPos++; // Id is nPos+1
+ pVCLPopupMenu->InsertItem( nPos, aSizeName, MenuItemBits::RADIOCHECK | MenuItemBits::AUTOCHECK );
+ fPoint = float( m_pHeightArray[nPos-1] ) / 10;
+
+ // Create dispatchable .uno command and set it
+ aCommand = aFontHeightCommand + OUString::number( fPoint );
+ pVCLPopupMenu->SetItemCommand( nPos, aCommand );
+ }
+ }
+ else
{
- if ( pAry == FontList::GetStdSizeAry() )
+ // for fixed size fonts only selectable font size names
+ pTempAry = pAry;
+ while ( *pTempAry )
{
- // for scalable fonts all font size names
- sal_Int32 nCount = aFontSizeNames.Count();
- for( sal_Int32 i = 0; i < nCount; i++ )
+ OUString aSizeName = aFontSizeNames.Size2Name( *pTempAry );
+ if ( !aSizeName.isEmpty() )
{
- OUString aSizeName = aFontSizeNames.GetIndexName( i );
- sal_Int32 nSize = aFontSizeNames.GetIndexSize( i );
- m_pHeightArray[nPos] = nSize;
+ m_pHeightArray[nPos] = *pTempAry;
nPos++; // Id is nPos+1
pVCLPopupMenu->InsertItem( nPos, aSizeName, MenuItemBits::RADIOCHECK | MenuItemBits::AUTOCHECK );
fPoint = float( m_pHeightArray[nPos-1] ) / 10;
@@ -187,49 +207,29 @@ void FontSizeMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > co
aCommand = aFontHeightCommand + OUString::number( fPoint );
pVCLPopupMenu->SetItemCommand( nPos, aCommand );
}
- }
- else
- {
- // for fixed size fonts only selectable font size names
- pTempAry = pAry;
- while ( *pTempAry )
- {
- OUString aSizeName = aFontSizeNames.Size2Name( *pTempAry );
- if ( !aSizeName.isEmpty() )
- {
- m_pHeightArray[nPos] = *pTempAry;
- nPos++; // Id is nPos+1
- pVCLPopupMenu->InsertItem( nPos, aSizeName, MenuItemBits::RADIOCHECK | MenuItemBits::AUTOCHECK );
- fPoint = float( m_pHeightArray[nPos-1] ) / 10;
-
- // Create dispatchable .uno command and set it
- aCommand = aFontHeightCommand + OUString::number( fPoint );
- pVCLPopupMenu->SetItemCommand( nPos, aCommand );
- }
- pTempAry++;
- }
+ pTempAry++;
}
}
+ }
- // then insert numerical font size values
- const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper();
- pTempAry = pAry;
- while ( *pTempAry )
- {
- m_pHeightArray[nPos] = *pTempAry;
- nPos++; // Id is nPos+1
- pVCLPopupMenu->InsertItem( nPos, rI18nHelper.GetNum( *pTempAry, 1, true, false ), MenuItemBits::RADIOCHECK | MenuItemBits::AUTOCHECK );
- fPoint = float( m_pHeightArray[nPos-1] ) / 10;
-
- // Create dispatchable .uno command and set it
- aCommand = aFontHeightCommand + OUString::number( fPoint );
- pVCLPopupMenu->SetItemCommand( nPos, aCommand );
+ // then insert numerical font size values
+ const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper();
+ pTempAry = pAry;
+ while ( *pTempAry )
+ {
+ m_pHeightArray[nPos] = *pTempAry;
+ nPos++; // Id is nPos+1
+ pVCLPopupMenu->InsertItem( nPos, rI18nHelper.GetNum( *pTempAry, 1, true, false ), MenuItemBits::RADIOCHECK | MenuItemBits::AUTOCHECK );
+ fPoint = float( m_pHeightArray[nPos-1] ) / 10;
- pTempAry++;
- }
+ // Create dispatchable .uno command and set it
+ aCommand = aFontHeightCommand + OUString::number( fPoint );
+ pVCLPopupMenu->SetItemCommand( nPos, aCommand );
- setCurHeight( long( m_aFontHeight.Height * 10), rPopupMenu );
+ pTempAry++;
}
+
+ setCurHeight( long( m_aFontHeight.Height * 10), rPopupMenu );
}
// XEventListener
diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx
index 770f5860fbef..ec0f64c146f1 100644
--- a/framework/source/uielement/generictoolbarcontroller.cxx
+++ b/framework/source/uielement/generictoolbarcontroller.cxx
@@ -138,26 +138,26 @@ void SAL_CALL GenericToolbarController::execute( sal_Int16 KeyModifier )
}
}
- if ( xDispatch.is() )
- {
- css::util::URL aTargetURL;
- Sequence<PropertyValue> aArgs( 1 );
-
- // Add key modifier to argument list
- aArgs[0].Name = "KeyModifier";
- aArgs[0].Value <<= KeyModifier;
-
- aTargetURL.Complete = aCommandURL;
- if ( m_xUrlTransformer.is() )
- m_xUrlTransformer->parseStrict( aTargetURL );
-
- // Execute dispatch asynchronously
- ExecuteInfo* pExecuteInfo = new ExecuteInfo;
- pExecuteInfo->xDispatch = xDispatch;
- pExecuteInfo->aTargetURL = aTargetURL;
- pExecuteInfo->aArgs = aArgs;
- Application::PostUserEvent( LINK(nullptr, GenericToolbarController , ExecuteHdl_Impl), pExecuteInfo );
- }
+ if ( !xDispatch.is() )
+ return;
+
+ css::util::URL aTargetURL;
+ Sequence<PropertyValue> aArgs( 1 );
+
+ // Add key modifier to argument list
+ aArgs[0].Name = "KeyModifier";
+ aArgs[0].Value <<= KeyModifier;
+
+ aTargetURL.Complete = aCommandURL;
+ if ( m_xUrlTransformer.is() )
+ m_xUrlTransformer->parseStrict( aTargetURL );
+
+ // Execute dispatch asynchronously
+ ExecuteInfo* pExecuteInfo = new ExecuteInfo;
+ pExecuteInfo->xDispatch = xDispatch;
+ pExecuteInfo->aTargetURL = aTargetURL;
+ pExecuteInfo->aArgs = aArgs;
+ Application::PostUserEvent( LINK(nullptr, GenericToolbarController , ExecuteHdl_Impl), pExecuteInfo );
}
void GenericToolbarController::statusChanged( const FeatureStateEvent& Event )
@@ -167,100 +167,100 @@ void GenericToolbarController::statusChanged( const FeatureStateEvent& Event )
if ( m_bDisposed )
return;
- if ( m_xToolbar )
- {
- m_xToolbar->EnableItem( m_nID, Event.IsEnabled );
+ if ( !m_xToolbar )
+ return;
+
+ m_xToolbar->EnableItem( m_nID, Event.IsEnabled );
- ToolBoxItemBits nItemBits = m_xToolbar->GetItemBits( m_nID );
- nItemBits &= ~ToolBoxItemBits::CHECKABLE;
- TriState eTri = TRISTATE_FALSE;
+ ToolBoxItemBits nItemBits = m_xToolbar->GetItemBits( m_nID );
+ nItemBits &= ~ToolBoxItemBits::CHECKABLE;
+ TriState eTri = TRISTATE_FALSE;
- bool bValue;
- OUString aStrValue;
- ItemStatus aItemState;
- Visibility aItemVisibility;
- ControlCommand aControlCommand;
+ bool bValue;
+ OUString aStrValue;
+ ItemStatus aItemState;
+ Visibility aItemVisibility;
+ ControlCommand aControlCommand;
- if (( Event.State >>= bValue ) && !m_bEnumCommand )
+ if (( Event.State >>= bValue ) && !m_bEnumCommand )
+ {
+ // Boolean, treat it as checked/unchecked
+ if ( m_bMadeInvisible )
+ m_xToolbar->ShowItem( m_nID );
+ m_xToolbar->CheckItem( m_nID, bValue );
+ if ( bValue )
+ eTri = TRISTATE_TRUE;
+ nItemBits |= ToolBoxItemBits::CHECKABLE;
+ }
+ else if ( Event.State >>= aStrValue )
+ {
+ if ( m_bEnumCommand )
{
- // Boolean, treat it as checked/unchecked
- if ( m_bMadeInvisible )
- m_xToolbar->ShowItem( m_nID );
+ bValue = aStrValue == m_aEnumCommand;
+
m_xToolbar->CheckItem( m_nID, bValue );
if ( bValue )
eTri = TRISTATE_TRUE;
nItemBits |= ToolBoxItemBits::CHECKABLE;
}
- else if ( Event.State >>= aStrValue )
+ else
{
- if ( m_bEnumCommand )
+ // Replacement for place holders
+ if ( aStrValue.startsWith("($1)") )
{
- bValue = aStrValue == m_aEnumCommand;
-
- m_xToolbar->CheckItem( m_nID, bValue );
- if ( bValue )
- eTri = TRISTATE_TRUE;
- nItemBits |= ToolBoxItemBits::CHECKABLE;
+ aStrValue = FwkResId(STR_UPDATEDOC) + " " + aStrValue.copy( 4 );
}
- else
+ else if ( aStrValue.startsWith("($2)") )
{
- // Replacement for place holders
- if ( aStrValue.startsWith("($1)") )
- {
- aStrValue = FwkResId(STR_UPDATEDOC) + " " + aStrValue.copy( 4 );
- }
- else if ( aStrValue.startsWith("($2)") )
- {
- aStrValue = FwkResId(STR_CLOSEDOC_ANDRETURN) + aStrValue.copy( 4 );
- }
- else if ( aStrValue.startsWith("($3)") )
- {
- aStrValue = FwkResId(STR_SAVECOPYDOC) + aStrValue.copy( 4 );
- }
- m_xToolbar->SetItemText( m_nID, aStrValue );
- // tdf#124267 strip mnemonic from tooltip
- m_xToolbar->SetQuickHelpText(m_nID, aStrValue.replaceFirst("~", ""));
+ aStrValue = FwkResId(STR_CLOSEDOC_ANDRETURN) + aStrValue.copy( 4 );
}
-
- if ( m_bMadeInvisible )
- m_xToolbar->ShowItem( m_nID );
- }
- else if (( Event.State >>= aItemState ) && !m_bEnumCommand )
- {
- eTri = TRISTATE_INDET;
- nItemBits |= ToolBoxItemBits::CHECKABLE;
- if ( m_bMadeInvisible )
- m_xToolbar->ShowItem( m_nID );
- }
- else if ( Event.State >>= aItemVisibility )
- {
- m_xToolbar->ShowItem( m_nID, aItemVisibility.bVisible );
- m_bMadeInvisible = !aItemVisibility.bVisible;
+ else if ( aStrValue.startsWith("($3)") )
+ {
+ aStrValue = FwkResId(STR_SAVECOPYDOC) + aStrValue.copy( 4 );
+ }
+ m_xToolbar->SetItemText( m_nID, aStrValue );
+ // tdf#124267 strip mnemonic from tooltip
+ m_xToolbar->SetQuickHelpText(m_nID, aStrValue.replaceFirst("~", ""));
}
- else if ( Event.State >>= aControlCommand )
+
+ if ( m_bMadeInvisible )
+ m_xToolbar->ShowItem( m_nID );
+ }
+ else if (( Event.State >>= aItemState ) && !m_bEnumCommand )
+ {
+ eTri = TRISTATE_INDET;
+ nItemBits |= ToolBoxItemBits::CHECKABLE;
+ if ( m_bMadeInvisible )
+ m_xToolbar->ShowItem( m_nID );
+ }
+ else if ( Event.State >>= aItemVisibility )
+ {
+ m_xToolbar->ShowItem( m_nID, aItemVisibility.bVisible );
+ m_bMadeInvisible = !aItemVisibility.bVisible;
+ }
+ else if ( Event.State >>= aControlCommand )
+ {
+ if (aControlCommand.Command == "SetQuickHelpText")
{
- if (aControlCommand.Command == "SetQuickHelpText")
+ for (sal_Int32 i = 0; i < aControlCommand.Arguments.getLength(); i++)
{
- for (sal_Int32 i = 0; i < aControlCommand.Arguments.getLength(); i++)
+ if (aControlCommand.Arguments[i].Name == "HelpText")
{
- if (aControlCommand.Arguments[i].Name == "HelpText")
- {
- OUString aHelpText;
- aControlCommand.Arguments[i].Value >>= aHelpText;
- m_xToolbar->SetQuickHelpText(m_nID, aHelpText);
- break;
- }
+ OUString aHelpText;
+ aControlCommand.Arguments[i].Value >>= aHelpText;
+ m_xToolbar->SetQuickHelpText(m_nID, aHelpText);
+ break;
}
}
- if ( m_bMadeInvisible )
- m_xToolbar->ShowItem( m_nID );
}
- else if ( m_bMadeInvisible )
+ if ( m_bMadeInvisible )
m_xToolbar->ShowItem( m_nID );
-
- m_xToolbar->SetItemState( m_nID, eTri );
- m_xToolbar->SetItemBits( m_nID, nItemBits );
}
+ else if ( m_bMadeInvisible )
+ m_xToolbar->ShowItem( m_nID );
+
+ m_xToolbar->SetItemState( m_nID, eTri );
+ m_xToolbar->SetItemBits( m_nID, nItemBits );
}
IMPL_STATIC_LINK( GenericToolbarController, ExecuteHdl_Impl, void*, p, void )
@@ -324,25 +324,25 @@ void MenuToolbarController::initialize( const css::uno::Sequence< css::uno::Any
{}
}
- if ( xMenuContainer.is() && xMenuContainer->getCount() )
+ if ( !(xMenuContainer.is() && xMenuContainer->getCount()) )
+ return;
+
+ Sequence< PropertyValue > aProps;
+ // drop down menu info is currently the first ( and only ) menu in the menusettings container
+ xMenuContainer->getByIndex(0) >>= aProps;
+ for ( const auto& aProp : std::as_const(aProps) )
{
- Sequence< PropertyValue > aProps;
- // drop down menu info is currently the first ( and only ) menu in the menusettings container
- xMenuContainer->getByIndex(0) >>= aProps;
- for ( const auto& aProp : std::as_const(aProps) )
+ if ( aProp.Name == "ItemDescriptorContainer" )
{
- if ( aProp.Name == "ItemDescriptorContainer" )
- {
- aProp.Value >>= m_xMenuDesc;
- break;
- }
+ aProp.Value >>= m_xMenuDesc;
+ break;
}
-
- ToolBox* pToolBox = nullptr;
- sal_uInt16 nId = 0;
- if ( getToolboxId( nId, &pToolBox ) )
- pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY );
}
+
+ ToolBox* pToolBox = nullptr;
+ sal_uInt16 nId = 0;
+ if ( getToolboxId( nId, &pToolBox ) )
+ pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY );
}
Reference< XWindow > SAL_CALL
diff --git a/framework/source/uielement/headermenucontroller.cxx b/framework/source/uielement/headermenucontroller.cxx
index d45014becdc0..7e74ef99f506 100644
--- a/framework/source/uielement/headermenucontroller.cxx
+++ b/framework/source/uielement/headermenucontroller.cxx
@@ -80,100 +80,100 @@ void HeaderMenuController::fillPopupMenu( const Reference< css::frame::XModel >&
pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
Reference< XStyleFamiliesSupplier > xStyleFamiliesSupplier( rModel, UNO_QUERY );
- if ( pVCLPopupMenu && xStyleFamiliesSupplier.is())
- {
- Reference< XNameAccess > xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies();
+ if ( !(pVCLPopupMenu && xStyleFamiliesSupplier.is()))
+ return;
- OUString aCmd( ".uno:InsertPageHeader" );
- OUString aHeaderFooterIsOnStr( "HeaderIsOn" );
- if ( m_bFooter )
- {
- aCmd = ".uno:InsertPageFooter";
- aHeaderFooterIsOnStr = "FooterIsOn";
- }
- const OUString aIsPhysicalStr( "IsPhysical" );
- const OUString aDisplayNameStr( "DisplayName" );
+ Reference< XNameAccess > xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies();
- try
+ OUString aCmd( ".uno:InsertPageHeader" );
+ OUString aHeaderFooterIsOnStr( "HeaderIsOn" );
+ if ( m_bFooter )
+ {
+ aCmd = ".uno:InsertPageFooter";
+ aHeaderFooterIsOnStr = "FooterIsOn";
+ }
+ const OUString aIsPhysicalStr( "IsPhysical" );
+ const OUString aDisplayNameStr( "DisplayName" );
+
+ try
+ {
+ Reference< XNameContainer > xNameContainer;
+ if ( xStyleFamilies->getByName("PageStyles") >>= xNameContainer )
{
- Reference< XNameContainer > xNameContainer;
- if ( xStyleFamilies->getByName("PageStyles") >>= xNameContainer )
+ Sequence< OUString > aSeqNames = xNameContainer->getElementNames();
+
+ sal_uInt16 nId = 2;
+ sal_uInt16 nCount = 0;
+ bool bAllOneState( true );
+ bool bLastCheck( true );
+ bool bFirstChecked( false );
+ bool bFirstItemInserted( false );
+ for ( sal_Int32 n = 0; n < aSeqNames.getLength(); n++ )
{
- Sequence< OUString > aSeqNames = xNameContainer->getElementNames();
-
- sal_uInt16 nId = 2;
- sal_uInt16 nCount = 0;
- bool bAllOneState( true );
- bool bLastCheck( true );
- bool bFirstChecked( false );
- bool bFirstItemInserted( false );
- for ( sal_Int32 n = 0; n < aSeqNames.getLength(); n++ )
+ OUString aName = aSeqNames[n];
+ Reference< XPropertySet > xPropSet( xNameContainer->getByName( aName ), UNO_QUERY );
+ if ( xPropSet.is() )
{
- OUString aName = aSeqNames[n];
- Reference< XPropertySet > xPropSet( xNameContainer->getByName( aName ), UNO_QUERY );
- if ( xPropSet.is() )
+ bool bIsPhysical( false );
+ if (( xPropSet->getPropertyValue( aIsPhysicalStr ) >>= bIsPhysical ) && bIsPhysical )
{
- bool bIsPhysical( false );
- if (( xPropSet->getPropertyValue( aIsPhysicalStr ) >>= bIsPhysical ) && bIsPhysical )
+ OUString aDisplayName;
+ bool bHeaderIsOn( false );
+ xPropSet->getPropertyValue( aDisplayNameStr ) >>= aDisplayName;
+ xPropSet->getPropertyValue( aHeaderFooterIsOnStr ) >>= bHeaderIsOn;
+
+ OUStringBuffer aStrBuf( aCmd );
+ aStrBuf.append( "?PageStyle:string=");
+ aStrBuf.append( aDisplayName );
+ aStrBuf.append( "&On:bool=" );
+ if ( !bHeaderIsOn )
+ aStrBuf.append( "true" );
+ else
+ aStrBuf.append( "false" );
+ OUString aCommand( aStrBuf.makeStringAndClear() );
+ pVCLPopupMenu->InsertItem( nId, aDisplayName, MenuItemBits::CHECKABLE );
+ if ( !bFirstItemInserted )
{
- OUString aDisplayName;
- bool bHeaderIsOn( false );
- xPropSet->getPropertyValue( aDisplayNameStr ) >>= aDisplayName;
- xPropSet->getPropertyValue( aHeaderFooterIsOnStr ) >>= bHeaderIsOn;
-
- OUStringBuffer aStrBuf( aCmd );
- aStrBuf.append( "?PageStyle:string=");
- aStrBuf.append( aDisplayName );
- aStrBuf.append( "&On:bool=" );
- if ( !bHeaderIsOn )
- aStrBuf.append( "true" );
- else
- aStrBuf.append( "false" );
- OUString aCommand( aStrBuf.makeStringAndClear() );
- pVCLPopupMenu->InsertItem( nId, aDisplayName, MenuItemBits::CHECKABLE );
- if ( !bFirstItemInserted )
- {
- bFirstItemInserted = true;
- bFirstChecked = bHeaderIsOn;
- }
-
- pVCLPopupMenu->SetItemCommand( nId, aCommand );
-
- if ( bHeaderIsOn )
- pVCLPopupMenu->CheckItem( nId );
- ++nId;
-
- // Check if all entries have the same state
- if( bAllOneState && n && bHeaderIsOn != bLastCheck )
- bAllOneState = false;
- bLastCheck = bHeaderIsOn;
- ++nCount;
+ bFirstItemInserted = true;
+ bFirstChecked = bHeaderIsOn;
}
+
+ pVCLPopupMenu->SetItemCommand( nId, aCommand );
+
+ if ( bHeaderIsOn )
+ pVCLPopupMenu->CheckItem( nId );
+ ++nId;
+
+ // Check if all entries have the same state
+ if( bAllOneState && n && bHeaderIsOn != bLastCheck )
+ bAllOneState = false;
+ bLastCheck = bHeaderIsOn;
+ ++nCount;
}
}
+ }
- if ( bAllOneState && ( nCount > 1 ))
- {
- // Insert special item for all command
- pVCLPopupMenu->InsertItem( ALL_MENUITEM_ID, FwkResId(STR_MENU_HEADFOOTALL), MenuItemBits::NONE, OString(), 0 );
+ if ( bAllOneState && ( nCount > 1 ))
+ {
+ // Insert special item for all command
+ pVCLPopupMenu->InsertItem( ALL_MENUITEM_ID, FwkResId(STR_MENU_HEADFOOTALL), MenuItemBits::NONE, OString(), 0 );
- OUStringBuffer aStrBuf( aCmd );
- aStrBuf.append( "?On:bool=" );
+ OUStringBuffer aStrBuf( aCmd );
+ aStrBuf.append( "?On:bool=" );
- // Command depends on check state of first menu item entry
- if ( !bFirstChecked )
- aStrBuf.append( "true" );
- else
- aStrBuf.append( "false" );
+ // Command depends on check state of first menu item entry
+ if ( !bFirstChecked )
+ aStrBuf.append( "true" );
+ else
+ aStrBuf.append( "false" );
- pVCLPopupMenu->SetItemCommand( 1, aStrBuf.makeStringAndClear() );
- pVCLPopupMenu->InsertSeparator(OString(), 1);
- }
+ pVCLPopupMenu->SetItemCommand( 1, aStrBuf.makeStringAndClear() );
+ pVCLPopupMenu->InsertSeparator(OString(), 1);
}
}
- catch ( const css::container::NoSuchElementException& )
- {
- }
+ }
+ catch ( const css::container::NoSuchElementException& )
+ {
}
}
diff --git a/framework/source/uielement/imagebuttontoolbarcontroller.cxx b/framework/source/uielement/imagebuttontoolbarcontroller.cxx
index 9ad5cc47885e..3d9997aaaa57 100644
--- a/framework/source/uielement/imagebuttontoolbarcontroller.cxx
+++ b/framework/source/uielement/imagebuttontoolbarcontroller.cxx
@@ -83,32 +83,32 @@ void ImageButtonToolbarController::executeControlCommand( const css::frame::Cont
{
SolarMutexGuard aSolarMutexGuard;
// i73486 to be downward compatible use old and "wrong" also!
- if( rControlCommand.Command == "SetImag" ||
- rControlCommand.Command == "SetImage" )
+ if( !(rControlCommand.Command == "SetImag" ||
+ rControlCommand.Command == "SetImage") )
+ return;
+
+ for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
{
- for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ )
+ if ( rControlCommand.Arguments[i].Name == "URL" )
{
- if ( rControlCommand.Arguments[i].Name == "URL" )
+ OUString aURL;
+ rControlCommand.Arguments[i].Value >>= aURL;
+
+ SubstituteVariables( aURL );
+
+ Image aImage;
+ if ( ReadImageFromURL( SvtMiscOptions().AreCurrentSymbolsLarge(),
+ aURL,
+ aImage ))
{
- OUString aURL;
- rControlCommand.Arguments[i].Value >>= aURL;
-
- SubstituteVariables( aURL );
-
- Image aImage;
- if ( ReadImageFromURL( SvtMiscOptions().AreCurrentSymbolsLarge(),
- aURL,
- aImage ))
- {
- m_xToolbar->SetItemImage( m_nID, aImage );
-
- // send notification
- uno::Sequence< beans::NamedValue > aInfo { { "URL", css::uno::makeAny(aURL) } };
- addNotifyInfo( "ImageChanged",
- getDispatchFromCommand( m_aCommandURL ),
- aInfo );
- break;
- }
+ m_xToolbar->SetItemImage( m_nID, aImage );
+
+ // send notification
+ uno::Sequence< beans::NamedValue > aInfo { { "URL", css::uno::makeAny(aURL) } };
+ addNotifyInfo( "ImageChanged",
+ getDispatchFromCommand( m_aCommandURL ),
+ aInfo );
+ break;
}
}
}
diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx b/framework/source/uielement/langselectionstatusbarcontroller.cxx
index cc4ac14a2843..2e12c12fee26 100644
--- a/framework/source/uielement/langselectionstatusbarcontroller.cxx
+++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx
@@ -202,72 +202,72 @@ void LangSelectionStatusbarController::LangMenu(
css::awt::Rectangle aRect( aPos.X, aPos.Y, 0, 0 );
sal_Int16 nId = xPopupMenu->execute( xParent, aRect, css::awt::PopupMenuDirection::EXECUTE_UP+16 );
//click "More..."
- if ( nId && m_xFrame.is() )
- {
- OUStringBuffer aBuff;
- //set selected language as current language for selection
- const OUString aSelectedLang = aLangMap[nId];
+ if ( !(nId && m_xFrame.is()) )
+ return;
- if (MID_LANG_SEL_1 <= nId && nId <= MID_LANG_SEL_9)
- {
- if (bWriter)
- aBuff.append( ".uno:LanguageStatus?Language:string=Current_" );
- else
- aBuff.append( ".uno:LanguageStatus?Language:string=Default_" );
+ OUStringBuffer aBuff;
+ //set selected language as current language for selection
+ const OUString aSelectedLang = aLangMap[nId];
- aBuff.append( aSelectedLang );
- }
- else if (nId == MID_LANG_SEL_NONE)
- {
- //set None as current language for selection
- aBuff.append( ".uno:LanguageStatus?Language:string=Current_LANGUAGE_NONE" );
- }
- else if (nId == MID_LANG_SEL_RESET)
- {
- // reset language attributes for selection
- aBuff.append( ".uno:LanguageStatus?Language:string=Current_RESET_LANGUAGES" );
- }
- else if (nId == MID_LANG_SEL_MORE)
- {
- //open the dialog "format/character" for current selection
- aBuff.append( ".uno:FontDialog?Page:string=font" );
- }
- else if (nId == MID_LANG_DEF_NONE)
- {
- aBuff.append( ".uno:LanguageStatus?Language:string=Default_LANGUAGE_NONE" );
- }
- else if (nId == MID_LANG_DEF_RESET)
- {
- aBuff.append( ".uno:LanguageStatus?Language:string=Default_RESET_LANGUAGES" );
- }
- else if (nId == MID_LANG_DEF_MORE)
- {
- aBuff.append( ".uno:LanguageStatus?Language:string=*" );
- }
- else if (MID_LANG_PARA_1 <= nId && nId <= MID_LANG_PARA_9)
- {
- aBuff.append( ".uno:LanguageStatus?Language:string=Paragraph_" );
- aBuff.append( aSelectedLang );
- }
- else if (nId == MID_LANG_PARA_NONE)
- {
- //set None as language for current paragraph
- aBuff.append( ".uno:LanguageStatus?Language:string=Paragraph_LANGUAGE_NONE" );
- }
- else if (nId == MID_LANG_PARA_RESET)
- {
- // reset language attributes for paragraph
- aBuff.append( ".uno:LanguageStatus?Language:string=Paragraph_RESET_LANGUAGES" );
- }
- else if (nId == MID_LANG_PARA_MORE)
- {
- //open the dialog "format/character" for current paragraph
- aBuff.append( ".uno:FontDialogForParagraph" );
- }
+ if (MID_LANG_SEL_1 <= nId && nId <= MID_LANG_SEL_9)
+ {
+ if (bWriter)
+ aBuff.append( ".uno:LanguageStatus?Language:string=Current_" );
+ else
+ aBuff.append( ".uno:LanguageStatus?Language:string=Default_" );
- const Sequence< beans::PropertyValue > aDummyArgs;
- execute( aBuff.makeStringAndClear(), aDummyArgs );
+ aBuff.append( aSelectedLang );
+ }
+ else if (nId == MID_LANG_SEL_NONE)
+ {
+ //set None as current language for selection
+ aBuff.append( ".uno:LanguageStatus?Language:string=Current_LANGUAGE_NONE" );
}
+ else if (nId == MID_LANG_SEL_RESET)
+ {
+ // reset language attributes for selection
+ aBuff.append( ".uno:LanguageStatus?Language:string=Current_RESET_LANGUAGES" );
+ }
+ else if (nId == MID_LANG_SEL_MORE)
+ {
+ //open the dialog "format/character" for current selection
+ aBuff.append( ".uno:FontDialog?Page:string=font" );
+ }
+ else if (nId == MID_LANG_DEF_NONE)
+ {
+ aBuff.append( ".uno:LanguageStatus?Language:string=Default_LANGUAGE_NONE" );
+ }
+ else if (nId == MID_LANG_DEF_RESET)
+ {
+ aBuff.append( ".uno:LanguageStatus?Language:string=Default_RESET_LANGUAGES" );
+ }
+ else if (nId == MID_LANG_DEF_MORE)
+ {
+ aBuff.append( ".uno:LanguageStatus?Language:string=*" );
+ }
+ else if (MID_LANG_PARA_1 <= nId && nId <= MID_LANG_PARA_9)
+ {
+ aBuff.append( ".uno:LanguageStatus?Language:string=Paragraph_" );
+ aBuff.append( aSelectedLang );
+ }
+ else if (nId == MID_LANG_PARA_NONE)
+ {
+ //set None as language for current paragraph
+ aBuff.append( ".uno:LanguageStatus?Language:string=Paragraph_LANGUAGE_NONE" );
+ }
+ else if (nId == MID_LANG_PARA_RESET)
+ {
+ // reset language attributes for paragraph
+ aBuff.append( ".uno:LanguageStatus?Language:string=Paragraph_RESET_LANGUAGES" );
+ }
+ else if (nId == MID_LANG_PARA_MORE)
+ {
+ //open the dialog "format/character" for current paragraph
+ aBuff.append( ".uno:FontDialogForParagraph" );
+ }
+
+ const Sequence< beans::PropertyValue > aDummyArgs;
+ execute( aBuff.makeStringAndClear(), aDummyArgs );
}
void SAL_CALL LangSelectionStatusbarController::command(
@@ -306,40 +306,40 @@ void SAL_CALL LangSelectionStatusbarController::statusChanged( const FeatureStat
m_bShowMenu = true;
m_nScriptType = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX; //set the default value
- if ( m_xStatusbarItem.is() )
- {
- OUString aStrValue;
- Sequence< OUString > aSeq;
+ if ( !m_xStatusbarItem.is() )
+ return;
- if ( Event.State >>= aStrValue )
- {
- m_xStatusbarItem->setText( aStrValue );
- m_aCurLang = aStrValue;
- }
- else if ( Event.State >>= aSeq )
+ OUString aStrValue;
+ Sequence< OUString > aSeq;
+
+ if ( Event.State >>= aStrValue )
+ {
+ m_xStatusbarItem->setText( aStrValue );
+ m_aCurLang = aStrValue;
+ }
+ else if ( Event.State >>= aSeq )
+ {
+ if ( aSeq.getLength() == 4 )
{
- if ( aSeq.getLength() == 4 )
+ OUString aStatusText = aSeq[0];
+ if (aStatusText == "*")
{
- OUString aStatusText = aSeq[0];
- if (aStatusText == "*")
- {
- aStatusText = FwkResId(STR_LANGSTATUS_MULTIPLE_LANGUAGES);
- }
- m_xStatusbarItem->setText( aStatusText );
-
- // Retrieve all other values from the sequence and
- // store it members!
- m_aCurLang = aSeq[0];
- m_nScriptType = static_cast< SvtScriptType >( aSeq[1].toInt32() );
- m_aKeyboardLang = aSeq[2];
- m_aGuessedTextLang = aSeq[3];
+ aStatusText = FwkResId(STR_LANGSTATUS_MULTIPLE_LANGUAGES);
}
+ m_xStatusbarItem->setText( aStatusText );
+
+ // Retrieve all other values from the sequence and
+ // store it members!
+ m_aCurLang = aSeq[0];
+ m_nScriptType = static_cast< SvtScriptType >( aSeq[1].toInt32() );
+ m_aKeyboardLang = aSeq[2];
+ m_aGuessedTextLang = aSeq[3];
}
- else if ( !Event.State.hasValue() )
- {
- m_xStatusbarItem->setText( OUString() );
- m_bShowMenu = false; // no language -> no menu
- }
+ }
+ else if ( !Event.State.hasValue() )
+ {
+ m_xStatusbarItem->setText( OUString() );
+ m_bShowMenu = false; // no language -> no menu
}
}
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index e0fbfe16c4e3..8be9c718e5ad 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -165,20 +165,20 @@ void MenuBarManager::Destroy()
{
SolarMutexGuard aGuard;
- if ( !rBHelper.bDisposed )
- {
- // stop asynchronous settings timer and
- // release deferred item container reference
- m_aAsyncSettingsTimer.Stop();
- m_xDeferedItemContainer.clear();
- RemoveListener();
+ if ( rBHelper.bDisposed )
+ return;
- m_aMenuItemHandlerVector.clear();
+ // stop asynchronous settings timer and
+ // release deferred item container reference
+ m_aAsyncSettingsTimer.Stop();
+ m_xDeferedItemContainer.clear();
+ RemoveListener();
- if ( m_bDeleteMenu )
- {
- m_pVCLMenu.disposeAndClear();
- }
+ m_aMenuItemHandlerVector.clear();
+
+ if ( m_bDeleteMenu )
+ {
+ m_pVCLMenu.disposeAndClear();
}
}
@@ -255,21 +255,21 @@ void SAL_CALL MenuBarManager::frameAction( const FrameActionEvent& Action )
if ( rBHelper.bDisposed || rBHelper.bInDispose )
throw css::lang::DisposedException();
- if ( Action.Action == FrameAction_CONTEXT_CHANGED )
+ if ( Action.Action != FrameAction_CONTEXT_CHANGED )
+ return;
+
+ for (auto const& menuItemHandler : m_aMenuItemHandlerVector)
{
- for (auto const& menuItemHandler : m_aMenuItemHandlerVector)
+ // Clear dispatch reference as we will requery it later
+ if ( menuItemHandler->xMenuItemDispatch.is() )
{
- // Clear dispatch reference as we will requery it later
- if ( menuItemHandler->xMenuItemDispatch.is() )
- {
- URL aTargetURL;
- aTargetURL.Complete = menuItemHandler->aMenuItemURL;
- m_xURLTransformer->parseStrict( aTargetURL );
+ URL aTargetURL;
+ aTargetURL.Complete = menuItemHandler->aMenuItemURL;
+ m_xURLTransformer->parseStrict( aTargetURL );
- menuItemHandler->xMenuItemDispatch->removeStatusListener( this, aTargetURL );
- }
- menuItemHandler->xMenuItemDispatch.clear();
+ menuItemHandler->xMenuItemDispatch->removeStatusListener( this, aTargetURL );
}
+ menuItemHandler->xMenuItemDispatch.clear();
}
}
@@ -1185,22 +1185,22 @@ void MenuBarManager::impl_RetrieveShortcutsFromConfiguration(
const Sequence< OUString >& rCommands,
std::vector< std::unique_ptr<MenuItemHandler> >& aMenuShortCuts )
{
- if ( rAccelCfg.is() )
+ if ( !rAccelCfg.is() )
+ return;
+
+ try
{
- try
- {
- css::awt::KeyEvent aKeyEvent;
- Sequence< Any > aSeqKeyCode = rAccelCfg->getPreferredKeyEventsForCommandList( rCommands );
- for ( sal_Int32 i = 0; i < aSeqKeyCode.getLength(); i++ )
- {
- if ( aSeqKeyCode[i] >>= aKeyEvent )
- aMenuShortCuts[i]->aKeyCode = svt::AcceleratorExecute::st_AWTKey2VCLKey( aKeyEvent );
- }
- }
- catch ( const IllegalArgumentException& )
+ css::awt::KeyEvent aKeyEvent;
+ Sequence< Any > aSeqKeyCode = rAccelCfg->getPreferredKeyEventsForCommandList( rCommands );
+ for ( sal_Int32 i = 0; i < aSeqKeyCode.getLength(); i++ )
{
+ if ( aSeqKeyCode[i] >>= aKeyEvent )
+ aMenuShortCuts[i]->aKeyCode = svt::AcceleratorExecute::st_AWTKey2VCLKey( aKeyEvent );
}
}
+ catch ( const IllegalArgumentException& )
+ {
+ }
}
void MenuBarManager::RetrieveShortcuts( std::vector< std::unique_ptr<MenuItemHandler> >& aMenuShortCuts )
@@ -1219,92 +1219,92 @@ void MenuBarManager::RetrieveShortcuts( std::vector< std::unique_ptr<MenuItemHan
}
}
- if ( m_bModuleIdentified )
- {
- Reference< XAcceleratorConfiguration > xDocAccelCfg( m_xDocAcceleratorManager );
- Reference< XAcceleratorConfiguration > xModuleAccelCfg( m_xModuleAcceleratorManager );
- Reference< XAcceleratorConfiguration > xGlobalAccelCfg( m_xGlobalAcceleratorManager );
+ if ( !m_bModuleIdentified )
+ return;
+
+ Reference< XAcceleratorConfiguration > xDocAccelCfg( m_xDocAcceleratorManager );
+ Reference< XAcceleratorConfiguration > xModuleAccelCfg( m_xModuleAcceleratorManager );
+ Reference< XAcceleratorConfiguration > xGlobalAccelCfg( m_xGlobalAcceleratorManager );
- if ( !m_bAcceleratorCfg )
+ if ( !m_bAcceleratorCfg )
+ {
+ // Retrieve references on demand
+ m_bAcceleratorCfg = true;
+ if ( !xDocAccelCfg.is() )
{
- // Retrieve references on demand
- m_bAcceleratorCfg = true;
- if ( !xDocAccelCfg.is() )
+ Reference< XController > xController = m_xFrame->getController();
+ Reference< XModel > xModel;
+ if ( xController.is() )
{
- Reference< XController > xController = m_xFrame->getController();
- Reference< XModel > xModel;
- if ( xController.is() )
+ xModel = xController->getModel();
+ if ( xModel.is() )
{
- xModel = xController->getModel();
- if ( xModel.is() )
+ Reference< XUIConfigurationManagerSupplier > xSupplier( xModel, UNO_QUERY );
+ if ( xSupplier.is() )
{
- Reference< XUIConfigurationManagerSupplier > xSupplier( xModel, UNO_QUERY );
- if ( xSupplier.is() )
+ Reference< XUIConfigurationManager > xDocUICfgMgr = xSupplier->getUIConfigurationManager();
+ if ( xDocUICfgMgr.is() )
{
- Reference< XUIConfigurationManager > xDocUICfgMgr = xSupplier->getUIConfigurationManager();
- if ( xDocUICfgMgr.is() )
- {
- xDocAccelCfg = xDocUICfgMgr->getShortCutManager();
- m_xDocAcceleratorManager = xDocAccelCfg;
- }
+ xDocAccelCfg = xDocUICfgMgr->getShortCutManager();
+ m_xDocAcceleratorManager = xDocAccelCfg;
}
}
}
}
+ }
- if ( !xModuleAccelCfg.is() )
+ if ( !xModuleAccelCfg.is() )
+ {
+ Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier =
+ theModuleUIConfigurationManagerSupplier::get( m_xContext );
+ try
{
- Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier =
- theModuleUIConfigurationManagerSupplier::get( m_xContext );
- try
- {
- Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier );
- if ( xUICfgMgr.is() )
- {
- xModuleAccelCfg = xUICfgMgr->getShortCutManager();
- m_xModuleAcceleratorManager = xModuleAccelCfg;
- }
- }
- catch ( const RuntimeException& )
- {
- throw;
- }
- catch ( const Exception& )
+ Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier );
+ if ( xUICfgMgr.is() )
{
+ xModuleAccelCfg = xUICfgMgr->getShortCutManager();
+ m_xModuleAcceleratorManager = xModuleAccelCfg;
}
}
-
- if ( !xGlobalAccelCfg.is() ) try
+ catch ( const RuntimeException& )
{
- xGlobalAccelCfg = GlobalAcceleratorConfiguration::create( m_xContext );
- m_xGlobalAcceleratorManager = xGlobalAccelCfg;
+ throw;
}
- catch ( const css::uno::DeploymentException& )
+ catch ( const Exception& )
{
- SAL_WARN("fwk.uielement", "GlobalAcceleratorConfiguration"
- " not available. This should happen only on mobile platforms.");
}
}
- vcl::KeyCode aEmptyKeyCode;
- Sequence< OUString > aSeq( aMenuShortCuts.size() );
- const sal_uInt32 nCount = aMenuShortCuts.size();
- for ( sal_uInt32 i = 0; i < nCount; ++i )
+ if ( !xGlobalAccelCfg.is() ) try
{
- OUString aItemURL = aMenuShortCuts[i]->aMenuItemURL;
- if( aItemURL.isEmpty() && aMenuShortCuts[i]->xSubMenuManager.is())
- aItemURL = "-"; // tdf#99527 prevent throw in case of empty commands
- aSeq[i] = aItemURL;
- aMenuShortCuts[i]->aKeyCode = aEmptyKeyCode;
+ xGlobalAccelCfg = GlobalAcceleratorConfiguration::create( m_xContext );
+ m_xGlobalAcceleratorManager = xGlobalAccelCfg;
}
+ catch ( const css::uno::DeploymentException& )
+ {
+ SAL_WARN("fwk.uielement", "GlobalAcceleratorConfiguration"
+ " not available. This should happen only on mobile platforms.");
+ }
+ }
- if ( m_xGlobalAcceleratorManager.is() )
- impl_RetrieveShortcutsFromConfiguration( xGlobalAccelCfg, aSeq, aMenuShortCuts );
- if ( m_xModuleAcceleratorManager.is() )
- impl_RetrieveShortcutsFromConfiguration( xModuleAccelCfg, aSeq, aMenuShortCuts );
- if ( m_xDocAcceleratorManager.is() )
- impl_RetrieveShortcutsFromConfiguration( xDocAccelCfg, aSeq, aMenuShortCuts );
+ vcl::KeyCode aEmptyKeyCode;
+ Sequence< OUString > aSeq( aMenuShortCuts.size() );
+ const sal_uInt32 nCount = aMenuShortCuts.size();
+ for ( sal_uInt32 i = 0; i < nCount; ++i )
+ {
+ OUString aItemURL = aMenuShortCuts[i]->aMenuItemURL;
+ if( aItemURL.isEmpty() && aMenuShortCuts[i]->xSubMenuManager.is())
+ aItemURL = "-"; // tdf#99527 prevent throw in case of empty commands
+ aSeq[i] = aItemURL;
+ aMenuShortCuts[i]->aKeyCode = aEmptyKeyCode;
}
+
+ if ( m_xGlobalAcceleratorManager.is() )
+ impl_RetrieveShortcutsFromConfiguration( xGlobalAccelCfg, aSeq, aMenuShortCuts );
+ if ( m_xModuleAcceleratorManager.is() )
+ impl_RetrieveShortcutsFromConfiguration( xModuleAccelCfg, aSeq, aMenuShortCuts );
+ if ( m_xDocAcceleratorManager.is() )
+ impl_RetrieveShortcutsFromConfiguration( xDocAccelCfg, aSeq, aMenuShortCuts );
}
void MenuBarManager::RetrieveImageManagers()
@@ -1371,20 +1371,20 @@ void MenuBarManager::FillMenuWithConfiguration(
rModuleIdentifier );
bool bHasDisabledEntries = SvtCommandOptions().HasEntries( SvtCommandOptions::CMDOPTION_DISABLED );
- if ( bHasDisabledEntries )
+ if ( !bHasDisabledEntries )
+ return;
+
+ sal_uInt16 nCount = pMenu->GetItemCount();
+ for ( sal_uInt16 i = 0; i < nCount; i++ )
{
- sal_uInt16 nCount = pMenu->GetItemCount();
- for ( sal_uInt16 i = 0; i < nCount; i++ )
+ sal_uInt16 nID = pMenu->GetItemId( i );
+ if ( nID > 0 )
{
- sal_uInt16 nID = pMenu->GetItemId( i );
- if ( nID > 0 )
+ PopupMenu* pPopupMenu = pMenu->GetPopupMenu( nID );
+ if ( pPopupMenu )
{
- PopupMenu* pPopupMenu = pMenu->GetPopupMenu( nID );
- if ( pPopupMenu )
- {
- if ( MustBeHidden( pPopupMenu, rTransformer ))
- pMenu->HideItem( nId );
- }
+ if ( MustBeHidden( pPopupMenu, rTransformer ))
+ pMenu->HideItem( nId );
}
}
}
diff --git a/framework/source/uielement/menubarwrapper.cxx b/framework/source/uielement/menubarwrapper.cxx
index 4c0d243c0753..716bc77094e2 100644
--- a/framework/source/uielement/menubarwrapper.cxx
+++ b/framework/source/uielement/menubarwrapper.cxx
@@ -111,84 +111,84 @@ void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments )
if ( m_bDisposed )
throw DisposedException();
- if ( !m_bInitialized )
+ if ( m_bInitialized )
+ return;
+
+ OUString aModuleIdentifier;
+ UIConfigElementWrapperBase::initialize( aArguments );
+
+ Reference< XFrame > xFrame( m_xWeakFrame );
+ if ( !(xFrame.is() && m_xConfigSource.is()) )
+ return;
+
+ // Create VCL menubar which will be filled with settings data
+ VclPtr<MenuBar> pVCLMenuBar;
+ VCLXMenuBar* pAwtMenuBar = nullptr;
+ {
+ SolarMutexGuard aSolarMutexGuard;
+ pVCLMenuBar = VclPtr<MenuBar>::Create();
+ }
+
+ Reference< XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext );
+
+ try
+ {
+ aModuleIdentifier = xModuleManager->identify( xFrame );
+ }
+ catch( const Exception& )
+ {
+ }
+
+ Reference< XURLTransformer > xTrans;
+ try
+ {
+ xTrans.set( URLTransformer::create(m_xContext) );
+ m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL, false );
+ if ( m_xConfigData.is() )
+ {
+ // Fill menubar with container contents
+ sal_uInt16 nId = 1;
+ MenuBarManager::FillMenuWithConfiguration( nId, pVCLMenuBar, aModuleIdentifier, m_xConfigData, xTrans );
+ }
+ }
+ catch ( const NoSuchElementException& )
{
- OUString aModuleIdentifier;
- UIConfigElementWrapperBase::initialize( aArguments );
+ }
- Reference< XFrame > xFrame( m_xWeakFrame );
- if ( xFrame.is() && m_xConfigSource.is() )
+ bool bMenuOnly( false );
+ for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ )
+ {
+ PropertyValue aPropValue;
+ if ( aArguments[n] >>= aPropValue )
{
- // Create VCL menubar which will be filled with settings data
- VclPtr<MenuBar> pVCLMenuBar;
- VCLXMenuBar* pAwtMenuBar = nullptr;
- {
- SolarMutexGuard aSolarMutexGuard;
- pVCLMenuBar = VclPtr<MenuBar>::Create();
- }
-
- Reference< XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext );
-
- try
- {
- aModuleIdentifier = xModuleManager->identify( xFrame );
- }
- catch( const Exception& )
- {
- }
-
- Reference< XURLTransformer > xTrans;
- try
- {
- xTrans.set( URLTransformer::create(m_xContext) );
- m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL, false );
- if ( m_xConfigData.is() )
- {
- // Fill menubar with container contents
- sal_uInt16 nId = 1;
- MenuBarManager::FillMenuWithConfiguration( nId, pVCLMenuBar, aModuleIdentifier, m_xConfigData, xTrans );
- }
- }
- catch ( const NoSuchElementException& )
- {
- }
-
- bool bMenuOnly( false );
- for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ )
- {
- PropertyValue aPropValue;
- if ( aArguments[n] >>= aPropValue )
- {
- if ( aPropValue.Name == "MenuOnly" )
- aPropValue.Value >>= bMenuOnly;
- }
- }
-
- if ( !bMenuOnly )
- {
- // Initialize menubar manager with our vcl menu bar. There are some situations where we only want to get the menu without any
- // interaction which is done by the menu bar manager. This must be requested by a special property called "MenuOnly". Be careful
- // a menu bar created with this property is not fully supported. It must be attached to a real menu bar manager to have full
- // support. This feature is currently used for "Inplace editing"!
- Reference< XDispatchProvider > xDispatchProvider;
-
- MenuBarManager* pMenuBarManager = new MenuBarManager( m_xContext,
- xFrame,
- xTrans,
- xDispatchProvider,
- aModuleIdentifier,
- pVCLMenuBar,
- false );
-
- m_xMenuBarManager.set( static_cast< OWeakObject *>( pMenuBarManager ), UNO_QUERY );
- }
-
- // Initialize toolkit menu bar implementation to have awt::XMenuBar for data exchange.
- // Don't use this toolkit menu bar or one of its functions. It is only used as a data container!
- pAwtMenuBar = new VCLXMenuBar( pVCLMenuBar );
- m_xMenuBar = pAwtMenuBar;
+ if ( aPropValue.Name == "MenuOnly" )
+ aPropValue.Value >>= bMenuOnly;
}
}
+
+ if ( !bMenuOnly )
+ {
+ // Initialize menubar manager with our vcl menu bar. There are some situations where we only want to get the menu without any
+ // interaction which is done by the menu bar manager. This must be requested by a special property called "MenuOnly". Be careful
+ // a menu bar created with this property is not fully supported. It must be attached to a real menu bar manager to have full
+ // support. This feature is currently used for "Inplace editing"!
+ Reference< XDispatchProvider > xDispatchProvider;
+
+ MenuBarManager* pMenuBarManager = new MenuBarManager( m_xContext,
+ xFrame,
+ xTrans,
+ xDispatchProvider,
+ aModuleIdentifier,
+ pVCLMenuBar,
+ false );
+
+ m_xMenuBarManager.set( static_cast< OWeakObject *>( pMenuBarManager ), UNO_QUERY );
+ }
+
+ // Initialize toolkit menu bar implementation to have awt::XMenuBar for data exchange.
+ // Don't use this toolkit menu bar or one of its functions. It is only used as a data container!
+ pAwtMenuBar = new VCLXMenuBar( pVCLMenuBar );
+ m_xMenuBar = pAwtMenuBar;
}
// XUIElementSettings
@@ -199,27 +199,27 @@ void SAL_CALL MenuBarWrapper::updateSettings()
if ( m_bDisposed )
throw DisposedException();
- if ( m_xMenuBarManager.is() )
+ if ( !m_xMenuBarManager.is() )
+ return;
+
+ if ( m_xConfigSource.is() && m_bPersistent )
{
- if ( m_xConfigSource.is() && m_bPersistent )
+ try
{
- try
- {
- MenuBarManager* pMenuBarManager = static_cast< MenuBarManager *>( m_xMenuBarManager.get() );
-
- m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL, false );
- if ( m_xConfigData.is() )
- pMenuBarManager->SetItemContainer( m_xConfigData );
- }
- catch ( const NoSuchElementException& )
- {
- }
+ MenuBarManager* pMenuBarManager = static_cast< MenuBarManager *>( m_xMenuBarManager.get() );
+
+ m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL, false );
+ if ( m_xConfigData.is() )
+ pMenuBarManager->SetItemContainer( m_xConfigData );
}
- else if ( !m_bPersistent )
+ catch ( const NoSuchElementException& )
{
- // Transient menubar: do nothing
}
}
+ else if ( !m_bPersistent )
+ {
+ // Transient menubar: do nothing
+ }
}
void MenuBarWrapper::impl_fillNewData()
{
diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx
index 5bb88b23842b..0bcd24982c47 100644
--- a/framework/source/uielement/newmenucontroller.cxx
+++ b/framework/source/uielement/newmenucontroller.cxx
@@ -124,24 +124,24 @@ void NewMenuController::determineAndSetNewDocAccel( PopupMenu* pPopupMenu, const
}
}
- if ( !bFound )
+ if ( bFound )
+ return;
+
+ // Search for the default module name
+ OUString aDefaultModuleName( SvtModuleOptions().GetDefaultModuleName() );
+ if ( aDefaultModuleName.isEmpty() )
+ return;
+
+ for ( sal_uInt16 i = 0; i < nCount; i++ )
{
- // Search for the default module name
- OUString aDefaultModuleName( SvtModuleOptions().GetDefaultModuleName() );
- if ( !aDefaultModuleName.isEmpty() )
+ if ( pPopupMenu->GetItemType( i ) != MenuItemType::SEPARATOR )
{
- for ( sal_uInt16 i = 0; i < nCount; i++ )
+ nId = pPopupMenu->GetItemId( i );
+ aCommand = pPopupMenu->GetItemCommand( nId );
+ if ( aCommand.indexOf( aDefaultModuleName ) >= 0 )
{
- if ( pPopupMenu->GetItemType( i ) != MenuItemType::SEPARATOR )
- {
- nId = pPopupMenu->GetItemId( i );
- aCommand = pPopupMenu->GetItemCommand( nId );
- if ( aCommand.indexOf( aDefaultModuleName ) >= 0 )
- {
- pPopupMenu->SetAccelKey( nId, rKeyCode );
- break;
- }
- }
+ pPopupMenu->SetAccelKey( nId, rKeyCode );
+ break;
}
}
}
@@ -149,110 +149,110 @@ void NewMenuController::determineAndSetNewDocAccel( PopupMenu* pPopupMenu, const
void NewMenuController::setAccelerators( PopupMenu* pPopupMenu )
{
- if ( m_bModuleIdentified )
- {
- Reference< XAcceleratorConfiguration > xDocAccelCfg( m_xDocAcceleratorManager );
- Reference< XAcceleratorConfiguration > xModuleAccelCfg( m_xModuleAcceleratorManager );
- Reference< XAcceleratorConfiguration > xGlobalAccelCfg( m_xGlobalAcceleratorManager );
+ if ( !m_bModuleIdentified )
+ return;
- if ( !m_bAcceleratorCfg )
+ Reference< XAcceleratorConfiguration > xDocAccelCfg( m_xDocAcceleratorManager );
+ Reference< XAcceleratorConfiguration > xModuleAccelCfg( m_xModuleAcceleratorManager );
+ Reference< XAcceleratorConfiguration > xGlobalAccelCfg( m_xGlobalAcceleratorManager );
+
+ if ( !m_bAcceleratorCfg )
+ {
+ // Retrieve references on demand
+ m_bAcceleratorCfg = true;
+ if ( !xDocAccelCfg.is() )
{
- // Retrieve references on demand
- m_bAcceleratorCfg = true;
- if ( !xDocAccelCfg.is() )
+ Reference< XController > xController = m_xFrame->getController();
+ Reference< XModel > xModel;
+ if ( xController.is() )
{
- Reference< XController > xController = m_xFrame->getController();
- Reference< XModel > xModel;
- if ( xController.is() )
+ xModel = xController->getModel();
+ if ( xModel.is() )
{
- xModel = xController->getModel();
- if ( xModel.is() )
+ Reference< XUIConfigurationManagerSupplier > xSupplier( xModel, UNO_QUERY );
+ if ( xSupplier.is() )
{
- Reference< XUIConfigurationManagerSupplier > xSupplier( xModel, UNO_QUERY );
- if ( xSupplier.is() )
+ Reference< XUIConfigurationManager > xDocUICfgMgr = xSupplier->getUIConfigurationManager();
+ if ( xDocUICfgMgr.is() )
{
- Reference< XUIConfigurationManager > xDocUICfgMgr = xSupplier->getUIConfigurationManager();
- if ( xDocUICfgMgr.is() )
- {
- xDocAccelCfg = xDocUICfgMgr->getShortCutManager();
- m_xDocAcceleratorManager = xDocAccelCfg;
- }
+ xDocAccelCfg = xDocUICfgMgr->getShortCutManager();
+ m_xDocAcceleratorManager = xDocAccelCfg;
}
}
}
}
+ }
- if ( !xModuleAccelCfg.is() )
+ if ( !xModuleAccelCfg.is() )
+ {
+ Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier =
+ theModuleUIConfigurationManagerSupplier::get( m_xContext );
+ Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier );
+ if ( xUICfgMgr.is() )
{
- Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier =
- theModuleUIConfigurationManagerSupplier::get( m_xContext );
- Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier );
- if ( xUICfgMgr.is() )
- {
- xModuleAccelCfg = xUICfgMgr->getShortCutManager();
- m_xModuleAcceleratorManager = xModuleAccelCfg;
- }
+ xModuleAccelCfg = xUICfgMgr->getShortCutManager();
+ m_xModuleAcceleratorManager = xModuleAccelCfg;
}
+ }
- if ( !xGlobalAccelCfg.is() )
- {
- xGlobalAccelCfg = GlobalAcceleratorConfiguration::create( m_xContext );
- m_xGlobalAcceleratorManager = xGlobalAccelCfg;
- }
+ if ( !xGlobalAccelCfg.is() )
+ {
+ xGlobalAccelCfg = GlobalAcceleratorConfiguration::create( m_xContext );
+ m_xGlobalAcceleratorManager = xGlobalAccelCfg;
}
+ }
- vcl::KeyCode aEmptyKeyCode;
- sal_uInt16 nItemCount( pPopupMenu->GetItemCount() );
- std::vector< vcl::KeyCode > aMenuShortCuts;
- std::vector< OUString > aCmds;
- std::vector< sal_uInt16 > aIds;
- for ( sal_uInt16 i = 0; i < nItemCount; i++ )
+ vcl::KeyCode aEmptyKeyCode;
+ sal_uInt16 nItemCount( pPopupMenu->GetItemCount() );
+ std::vector< vcl::KeyCode > aMenuShortCuts;
+ std::vector< OUString > aCmds;
+ std::vector< sal_uInt16 > aIds;
+ for ( sal_uInt16 i = 0; i < nItemCount; i++ )
+ {
+ if ( pPopupMenu->GetItemType( i ) != MenuItemType::SEPARATOR )
{
- if ( pPopupMenu->GetItemType( i ) != MenuItemType::SEPARATOR )
- {
- sal_uInt16 nId( pPopupMenu->GetItemId( i ));
- aIds.push_back( nId );
- aMenuShortCuts.push_back( aEmptyKeyCode );
- aCmds.push_back( pPopupMenu->GetItemCommand( nId ));
- }
+ sal_uInt16 nId( pPopupMenu->GetItemId( i ));
+ aIds.push_back( nId );
+ aMenuShortCuts.push_back( aEmptyKeyCode );
+ aCmds.push_back( pPopupMenu->GetItemCommand( nId ));
}
+ }
- sal_uInt32 nSeqCount( aIds.size() );
+ sal_uInt32 nSeqCount( aIds.size() );
- if ( m_bNewMenu )
- nSeqCount+=1;
+ if ( m_bNewMenu )
+ nSeqCount+=1;
- Sequence< OUString > aSeq( nSeqCount );
+ Sequence< OUString > aSeq( nSeqCount );
- // Add a special command for our "New" menu.
- if ( m_bNewMenu )
- {
- aSeq[nSeqCount-1] = m_aCommandURL;
- aMenuShortCuts.push_back( aEmptyKeyCode );
- }
+ // Add a special command for our "New" menu.
+ if ( m_bNewMenu )
+ {
+ aSeq[nSeqCount-1] = m_aCommandURL;
+ aMenuShortCuts.push_back( aEmptyKeyCode );
+ }
- const sal_uInt32 nCount = aCmds.size();
- for ( sal_uInt32 i = 0; i < nCount; i++ )
- aSeq[i] = aCmds[i];
+ const sal_uInt32 nCount = aCmds.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
+ aSeq[i] = aCmds[i];
- if ( m_xGlobalAcceleratorManager.is() )
- retrieveShortcutsFromConfiguration( xGlobalAccelCfg, aSeq, aMenuShortCuts );
- if ( m_xModuleAcceleratorManager.is() )
- retrieveShortcutsFromConfiguration( xModuleAccelCfg, aSeq, aMenuShortCuts );
- if ( m_xDocAcceleratorManager.is() )
- retrieveShortcutsFromConfiguration( xDocAccelCfg, aSeq, aMenuShortCuts );
+ if ( m_xGlobalAcceleratorManager.is() )
+ retrieveShortcutsFromConfiguration( xGlobalAccelCfg, aSeq, aMenuShortCuts );
+ if ( m_xModuleAcceleratorManager.is() )
+ retrieveShortcutsFromConfiguration( xModuleAccelCfg, aSeq, aMenuShortCuts );
+ if ( m_xDocAcceleratorManager.is() )
+ retrieveShortcutsFromConfiguration( xDocAccelCfg, aSeq, aMenuShortCuts );
- const sal_uInt32 nCount2 = aIds.size();
- for ( sal_uInt32 i = 0; i < nCount2; i++ )
- pPopupMenu->SetAccelKey( aIds[i], aMenuShortCuts[i] );
+ const sal_uInt32 nCount2 = aIds.size();
+ for ( sal_uInt32 i = 0; i < nCount2; i++ )
+ pPopupMenu->SetAccelKey( aIds[i], aMenuShortCuts[i] );
- // Special handling for "New" menu short-cut should be set at the
- // document which will be opened using it.
- if ( m_bNewMenu )
- {
- if ( aMenuShortCuts[nSeqCount-1] != aEmptyKeyCode )
- determineAndSetNewDocAccel( pPopupMenu, aMenuShortCuts[nSeqCount-1] );
- }
+ // Special handling for "New" menu short-cut should be set at the
+ // document which will be opened using it.
+ if ( m_bNewMenu )
+ {
+ if ( aMenuShortCuts[nSeqCount-1] != aEmptyKeyCode )
+ determineAndSetNewDocAccel( pPopupMenu, aMenuShortCuts[nSeqCount-1] );
}
}
@@ -261,22 +261,22 @@ void NewMenuController::retrieveShortcutsFromConfiguration(
const Sequence< OUString >& rCommands,
std::vector< vcl::KeyCode >& aMenuShortCuts )
{
- if ( rAccelCfg.is() )
+ if ( !rAccelCfg.is() )
+ return;
+
+ try
{
- try
- {
- css::awt::KeyEvent aKeyEvent;
- Sequence< Any > aSeqKeyCode = rAccelCfg->getPreferredKeyEventsForCommandList( rCommands );
- for ( sal_Int32 i = 0; i < aSeqKeyCode.getLength(); i++ )
- {
- if ( aSeqKeyCode[i] >>= aKeyEvent )
- aMenuShortCuts[i] = svt::AcceleratorExecute::st_AWTKey2VCLKey( aKeyEvent );
- }
- }
- catch ( const IllegalArgumentException& )
+ css::awt::KeyEvent aKeyEvent;
+ Sequence< Any > aSeqKeyCode = rAccelCfg->getPreferredKeyEventsForCommandList( rCommands );
+ for ( sal_Int32 i = 0; i < aSeqKeyCode.getLength(); i++ )
{
+ if ( aSeqKeyCode[i] >>= aKeyEvent )
+ aMenuShortCuts[i] = svt::AcceleratorExecute::st_AWTKey2VCLKey( aKeyEvent );
}
}
+ catch ( const IllegalArgumentException& )
+ {
+ }
}
NewMenuController::NewMenuController( const css::uno::Reference< css::uno::XComponentContext >& xContext ) :
@@ -306,59 +306,59 @@ void NewMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > const &
if ( pPopupMenu )
pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
- if ( pVCLPopupMenu )
+ if ( !pVCLPopupMenu )
+ return;
+
+ Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
+ URL aTargetURL;
+ aTargetURL.Complete = OUString::createFromAscii(m_bNewMenu ? aSlotNewDocDirect : aSlotAutoPilot);
+ m_xURLTransformer->parseStrict( aTargetURL );
+ Reference< XDispatch > xMenuItemDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 );
+ if(xMenuItemDispatch == nullptr)
+ return;
+
+ const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aDynamicMenuEntries =
+ SvtDynamicMenuOptions().GetMenu( m_bNewMenu ? EDynamicMenuType::NewMenu : EDynamicMenuType::WizardMenu );
+
+ OUString aTitle;
+ OUString aURL;
+ OUString aTargetFrame;
+ OUString aImageId;
+ sal_uInt16 nItemId = 1;
+
+ for ( const auto& aDynamicMenuEntry : aDynamicMenuEntries )
{
- Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
- URL aTargetURL;
- aTargetURL.Complete = OUString::createFromAscii(m_bNewMenu ? aSlotNewDocDirect : aSlotAutoPilot);
- m_xURLTransformer->parseStrict( aTargetURL );
- Reference< XDispatch > xMenuItemDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 );
- if(xMenuItemDispatch == nullptr)
- return;
-
- const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aDynamicMenuEntries =
- SvtDynamicMenuOptions().GetMenu( m_bNewMenu ? EDynamicMenuType::NewMenu : EDynamicMenuType::WizardMenu );
-
- OUString aTitle;
- OUString aURL;
- OUString aTargetFrame;
- OUString aImageId;
- sal_uInt16 nItemId = 1;
-
- for ( const auto& aDynamicMenuEntry : aDynamicMenuEntries )
+ for ( const auto& aProperty : aDynamicMenuEntry )
{
- for ( const auto& aProperty : aDynamicMenuEntry )
- {
- if ( aProperty.Name == DYNAMICMENU_PROPERTYNAME_URL )
- aProperty.Value >>= aURL;
- else if ( aProperty.Name == DYNAMICMENU_PROPERTYNAME_TITLE )
- aProperty.Value >>= aTitle;
- else if ( aProperty.Name == DYNAMICMENU_PROPERTYNAME_IMAGEIDENTIFIER )
- aProperty.Value >>= aImageId;
- else if ( aProperty.Name == DYNAMICMENU_PROPERTYNAME_TARGETNAME )
- aProperty.Value >>= aTargetFrame;
- }
+ if ( aProperty.Name == DYNAMICMENU_PROPERTYNAME_URL )
+ aProperty.Value >>= aURL;
+ else if ( aProperty.Name == DYNAMICMENU_PROPERTYNAME_TITLE )
+ aProperty.Value >>= aTitle;
+ else if ( aProperty.Name == DYNAMICMENU_PROPERTYNAME_IMAGEIDENTIFIER )
+ aProperty.Value >>= aImageId;
+ else if ( aProperty.Name == DYNAMICMENU_PROPERTYNAME_TARGETNAME )
+ aProperty.Value >>= aTargetFrame;
+ }
- if ( aTitle.isEmpty() && aURL.isEmpty() )
- continue;
+ if ( aTitle.isEmpty() && aURL.isEmpty() )
+ continue;
- if ( aURL == "private:separator" )
- pVCLPopupMenu->InsertSeparator();
- else
- {
- pVCLPopupMenu->InsertItem( nItemId, aTitle );
- pVCLPopupMenu->SetItemCommand( nItemId, aURL );
+ if ( aURL == "private:separator" )
+ pVCLPopupMenu->InsertSeparator();
+ else
+ {
+ pVCLPopupMenu->InsertItem( nItemId, aTitle );
+ pVCLPopupMenu->SetItemCommand( nItemId, aURL );
- void* nAttributePtr = MenuAttributes::CreateAttribute( aTargetFrame, aImageId );
- pVCLPopupMenu->SetUserValue( nItemId, nAttributePtr, MenuAttributes::ReleaseAttribute );
+ void* nAttributePtr = MenuAttributes::CreateAttribute( aTargetFrame, aImageId );
+ pVCLPopupMenu->SetUserValue( nItemId, nAttributePtr, MenuAttributes::ReleaseAttribute );
- nItemId++;
- }
+ nItemId++;
}
-
- if ( m_bShowImages )
- setMenuImages( pVCLPopupMenu, m_bShowImages );
}
+
+ if ( m_bShowImages )
+ setMenuImages( pVCLPopupMenu, m_bShowImages );
}
// XEventListener
@@ -393,57 +393,57 @@ void SAL_CALL NewMenuController::itemSelected( const css::awt::MenuEvent& rEvent
xContext = m_xContext;
}
- if ( xPopupMenu.is() )
- {
- VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( xPopupMenu ));
- if ( pPopupMenu )
- {
- OUString aURL;
- OUString aTargetFrame( m_aTargetFrame );
+ if ( !xPopupMenu.is() )
+ return;
- {
- SolarMutexGuard aSolarMutexGuard;
- PopupMenu* pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
- aURL = pVCLPopupMenu->GetItemCommand(rEvent.MenuId);
- void* nAttributePtr = pVCLPopupMenu->GetUserValue(rEvent.MenuId);
- MenuAttributes* pAttributes = static_cast<MenuAttributes *>(nAttributePtr);
- if (pAttributes)
- aTargetFrame = pAttributes->aTargetFrame;
- }
+ VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( xPopupMenu ));
+ if ( !pPopupMenu )
+ return;
- Sequence< PropertyValue > aArgsList( 1 );
- aArgsList[0].Name = "Referer";
- aArgsList[0].Value <<= OUString( "private:user" );
+ OUString aURL;
+ OUString aTargetFrame( m_aTargetFrame );
- dispatchCommand( aURL, aArgsList, aTargetFrame );
- }
+ {
+ SolarMutexGuard aSolarMutexGuard;
+ PopupMenu* pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
+ aURL = pVCLPopupMenu->GetItemCommand(rEvent.MenuId);
+ void* nAttributePtr = pVCLPopupMenu->GetUserValue(rEvent.MenuId);
+ MenuAttributes* pAttributes = static_cast<MenuAttributes *>(nAttributePtr);
+ if (pAttributes)
+ aTargetFrame = pAttributes->aTargetFrame;
}
+
+ Sequence< PropertyValue > aArgsList( 1 );
+ aArgsList[0].Name = "Referer";
+ aArgsList[0].Value <<= OUString( "private:user" );
+
+ dispatchCommand( aURL, aArgsList, aTargetFrame );
}
void SAL_CALL NewMenuController::itemActivated( const css::awt::MenuEvent& )
{
SolarMutexGuard aSolarMutexGuard;
- if ( m_xFrame.is() && m_xPopupMenu.is() )
- {
- VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( m_xPopupMenu ));
- if ( pPopupMenu )
- {
- const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
- bool bShowImages( rSettings.GetUseImagesInMenus() );
- OUString aIconTheme( rSettings.DetermineIconTheme() );
+ if ( !(m_xFrame.is() && m_xPopupMenu.is()) )
+ return;
- PopupMenu* pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
+ VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( m_xPopupMenu ));
+ if ( !pPopupMenu )
+ return;
- if ( m_bShowImages != bShowImages || m_aIconTheme != aIconTheme )
- {
- m_bShowImages = bShowImages;
- m_aIconTheme = aIconTheme;
- setMenuImages( pVCLPopupMenu, m_bShowImages );
- }
+ const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
+ bool bShowImages( rSettings.GetUseImagesInMenus() );
+ OUString aIconTheme( rSettings.DetermineIconTheme() );
- setAccelerators( pVCLPopupMenu );
- }
+ PopupMenu* pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
+
+ if ( m_bShowImages != bShowImages || m_aIconTheme != aIconTheme )
+ {
+ m_bShowImages = bShowImages;
+ m_aIconTheme = aIconTheme;
+ setMenuImages( pVCLPopupMenu, m_bShowImages );
}
+
+ setAccelerators( pVCLPopupMenu );
}
// XPopupMenuController
@@ -492,18 +492,18 @@ void SAL_CALL NewMenuController::initialize( const Sequence< Any >& aArguments )
osl::MutexGuard aLock( m_aMutex );
bool bInitalized( m_bInitialized );
- if ( !bInitalized )
- {
- svt::PopupMenuControllerBase::initialize( aArguments );
+ if ( bInitalized )
+ return;
- if ( m_bInitialized )
- {
- const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
+ svt::PopupMenuControllerBase::initialize( aArguments );
- m_bShowImages = rSettings.GetUseImagesInMenus();
- m_aIconTheme = rSettings.DetermineIconTheme();
- m_bNewMenu = m_aCommandURL == aSlotNewDocDirect;
- }
+ if ( m_bInitialized )
+ {
+ const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
+
+ m_bShowImages = rSettings.GetUseImagesInMenus();
+ m_aIconTheme = rSettings.DetermineIconTheme();
+ m_bNewMenu = m_aCommandURL == aSlotNewDocDirect;
}
}
diff --git a/framework/source/uielement/objectmenucontroller.cxx b/framework/source/uielement/objectmenucontroller.cxx
index 05d217b7a06b..80215acb8d06 100644
--- a/framework/source/uielement/objectmenucontroller.cxx
+++ b/framework/source/uielement/objectmenucontroller.cxx
@@ -90,20 +90,20 @@ void ObjectMenuController::fillPopupMenu( const Sequence< css::embed::VerbDescri
if ( pPopupMenu )
pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
- if ( pVCLPopupMenu )
+ if ( !pVCLPopupMenu )
+ return;
+
+ const OUString aVerbCommand( ".uno:ObjectMenue?VerbID:short=" );
+ for ( sal_Int32 i = 0; i < rVerbCommandSeq.getLength(); i++ )
{
- const OUString aVerbCommand( ".uno:ObjectMenue?VerbID:short=" );
- for ( sal_Int32 i = 0; i < rVerbCommandSeq.getLength(); i++ )
+ const css::embed::VerbDescriptor& rVerb = pVerbCommandArray[i];
+ if ( rVerb.VerbAttributes & css::embed::VerbAttributes::MS_VERBATTR_ONCONTAINERMENU )
{
- const css::embed::VerbDescriptor& rVerb = pVerbCommandArray[i];
- if ( rVerb.VerbAttributes & css::embed::VerbAttributes::MS_VERBATTR_ONCONTAINERMENU )
- {
- m_xPopupMenu->insertItem( i+1, rVerb.VerbName, 0, i );
- // use VCL popup menu pointer to set vital information that are not part of the awt implementation
-
- OUString aCommand = aVerbCommand + OUString::number( rVerb.VerbID );
- pVCLPopupMenu->SetItemCommand( i+1, aCommand ); // Store verb command
- }
+ m_xPopupMenu->insertItem( i+1, rVerb.VerbName, 0, i );
+ // use VCL popup menu pointer to set vital information that are not part of the awt implementation
+
+ OUString aCommand = aVerbCommand + OUString::number( rVerb.VerbID );
+ pVCLPopupMenu->SetItemCommand( i+1, aCommand ); // Store verb command
}
}
}
diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx
index 9520ae8fc5d7..5c11600c31b9 100644
--- a/framework/source/uielement/popuptoolbarcontroller.cxx
+++ b/framework/source/uielement/popuptoolbarcontroller.cxx
@@ -355,28 +355,28 @@ void GenericPopupToolbarController::statusChanged( const css::frame::FeatureStat
void GenericPopupToolbarController::functionExecuted( const OUString& rCommand )
{
- if ( m_bReplaceWithLast )
- {
- removeStatusListener( m_aCommandURL );
+ if ( !m_bReplaceWithLast )
+ return;
- auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(rCommand, m_sModuleName);
- OUString aRealCommand( vcl::CommandInfoProvider::GetRealCommandForCommand(aProperties) );
- m_aCommandURL = aRealCommand.isEmpty() ? rCommand : aRealCommand;
- addStatusListener( m_aCommandURL );
+ removeStatusListener( m_aCommandURL );
- ToolBox* pToolBox = nullptr;
- sal_uInt16 nId = 0;
- if ( getToolboxId( nId, &pToolBox ) )
- {
- pToolBox->SetItemCommand( nId, rCommand );
- pToolBox->SetHelpText( nId, OUString() ); // Will retrieve the new one from help.
- pToolBox->SetItemText(nId, vcl::CommandInfoProvider::GetLabelForCommand(aProperties));
- pToolBox->SetQuickHelpText(nId, vcl::CommandInfoProvider::GetTooltipForCommand(rCommand, aProperties, m_xFrame));
-
- Image aImage = vcl::CommandInfoProvider::GetImageForCommand(rCommand, m_xFrame, pToolBox->GetImageSize());
- if ( !!aImage )
- pToolBox->SetItemImage( nId, aImage );
- }
+ auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(rCommand, m_sModuleName);
+ OUString aRealCommand( vcl::CommandInfoProvider::GetRealCommandForCommand(aProperties) );
+ m_aCommandURL = aRealCommand.isEmpty() ? rCommand : aRealCommand;
+ addStatusListener( m_aCommandURL );
+
+ ToolBox* pToolBox = nullptr;
+ sal_uInt16 nId = 0;
+ if ( getToolboxId( nId, &pToolBox ) )
+ {
+ pToolBox->SetItemCommand( nId, rCommand );
+ pToolBox->SetHelpText( nId, OUString() ); // Will retrieve the new one from help.
+ pToolBox->SetItemText(nId, vcl::CommandInfoProvider::GetLabelForCommand(aProperties));
+ pToolBox->SetQuickHelpText(nId, vcl::CommandInfoProvider::GetTooltipForCommand(rCommand, aProperties, m_xFrame));
+
+ Image aImage = vcl::CommandInfoProvider::GetImageForCommand(rCommand, m_xFrame, pToolBox->GetImageSize());
+ if ( !!aImage )
+ pToolBox->SetItemImage( nId, aImage );
}
}
diff --git a/framework/source/uielement/progressbarwrapper.cxx b/framework/source/uielement/progressbarwrapper.cxx
index 3a0c04a262bd..537129b9632b 100644
--- a/framework/source/uielement/progressbarwrapper.cxx
+++ b/framework/source/uielement/progressbarwrapper.cxx
@@ -98,26 +98,26 @@ void ProgressBarWrapper::start( const OUString& Text, ::sal_Int32 Range )
nValue = m_nValue;
}
- if ( xWindow.is() )
+ if ( !xWindow.is() )
+ return;
+
+ SolarMutexGuard aSolarMutexGuard;
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
+ if ( !(pWindow && pWindow->GetType() == WindowType::STATUSBAR) )
+ return;
+
+ StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow.get());
+ if ( !pStatusBar->IsProgressMode() )
+ pStatusBar->StartProgressMode( Text );
+ else
{
- SolarMutexGuard aSolarMutexGuard;
- VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
- if ( pWindow && pWindow->GetType() == WindowType::STATUSBAR )
- {
- StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow.get());
- if ( !pStatusBar->IsProgressMode() )
- pStatusBar->StartProgressMode( Text );
- else
- {
- pStatusBar->SetUpdateMode( false );
- pStatusBar->EndProgressMode();
- pStatusBar->StartProgressMode( Text );
- pStatusBar->SetProgressValue( sal_uInt16( nValue ));
- pStatusBar->SetUpdateMode( true );
- }
- pStatusBar->Show( true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
- }
+ pStatusBar->SetUpdateMode( false );
+ pStatusBar->EndProgressMode();
+ pStatusBar->StartProgressMode( Text );
+ pStatusBar->SetProgressValue( sal_uInt16( nValue ));
+ pStatusBar->SetUpdateMode( true );
}
+ pStatusBar->Show( true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
}
void ProgressBarWrapper::end()
@@ -164,25 +164,25 @@ void ProgressBarWrapper::setText( const OUString& Text )
nValue = m_nValue;
}
- if ( xWindow.is() )
+ if ( !xWindow.is() )
+ return;
+
+ SolarMutexGuard aSolarMutexGuard;
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
+ if ( !(pWindow && pWindow->GetType() == WindowType::STATUSBAR) )
+ return;
+
+ StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow.get());
+ if( pStatusBar->IsProgressMode() )
{
- SolarMutexGuard aSolarMutexGuard;
- VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
- if ( pWindow && pWindow->GetType() == WindowType::STATUSBAR )
- {
- StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow.get());
- if( pStatusBar->IsProgressMode() )
- {
- pStatusBar->SetUpdateMode( false );
- pStatusBar->EndProgressMode();
- pStatusBar->StartProgressMode( Text );
- pStatusBar->SetProgressValue( sal_uInt16( nValue ));
- pStatusBar->SetUpdateMode( true );
- }
- else
- pStatusBar->SetText( Text );
- }
+ pStatusBar->SetUpdateMode( false );
+ pStatusBar->EndProgressMode();
+ pStatusBar->StartProgressMode( Text );
+ pStatusBar->SetProgressValue( sal_uInt16( nValue ));
+ pStatusBar->SetUpdateMode( true );
}
+ else
+ pStatusBar->SetText( Text );
}
void ProgressBarWrapper::setValue( ::sal_Int32 nValue )
diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx
index 395a72352ba0..24ceeb1cb506 100644
--- a/framework/source/uielement/recentfilesmenucontroller.cxx
+++ b/framework/source/uielement/recentfilesmenucontroller.cxx
@@ -124,135 +124,135 @@ void RecentFilesMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >
if ( pPopupMenu )
pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
- if ( pVCLPopupMenu )
- {
- Sequence< Sequence< PropertyValue > > aHistoryList = SvtHistoryOptions().GetList( ePICKLIST );
+ if ( !pVCLPopupMenu )
+ return;
+
+ Sequence< Sequence< PropertyValue > > aHistoryList = SvtHistoryOptions().GetList( ePICKLIST );
- int nPickListMenuItems = std::min<sal_Int32>( aHistoryList.getLength(), MAX_MENU_ITEMS );
- m_aRecentFilesItems.clear();
- if (( nPickListMenuItems > 0 ) && !m_bDisabled )
+ int nPickListMenuItems = std::min<sal_Int32>( aHistoryList.getLength(), MAX_MENU_ITEMS );
+ m_aRecentFilesItems.clear();
+ if (( nPickListMenuItems > 0 ) && !m_bDisabled )
+ {
+ for ( int i = 0; i < nPickListMenuItems; i++ )
{
- for ( int i = 0; i < nPickListMenuItems; i++ )
- {
- Sequence< PropertyValue >& rPickListEntry = aHistoryList[i];
- OUString aURL;
+ Sequence< PropertyValue >& rPickListEntry = aHistoryList[i];
+ OUString aURL;
- for ( int j = 0; j < rPickListEntry.getLength(); j++ )
+ for ( int j = 0; j < rPickListEntry.getLength(); j++ )
+ {
+ if ( rPickListEntry[j].Name == HISTORY_PROPERTYNAME_URL )
{
- if ( rPickListEntry[j].Name == HISTORY_PROPERTYNAME_URL )
- {
- rPickListEntry[j].Value >>= aURL;
- break;
- }
+ rPickListEntry[j].Value >>= aURL;
+ break;
}
-
- m_aRecentFilesItems.push_back( aURL );
}
+
+ m_aRecentFilesItems.push_back( aURL );
}
+ }
- if ( !m_aRecentFilesItems.empty() )
+ if ( !m_aRecentFilesItems.empty() )
+ {
+ const sal_uInt32 nCount = m_aRecentFilesItems.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
{
- const sal_uInt32 nCount = m_aRecentFilesItems.size();
- for ( sal_uInt32 i = 0; i < nCount; i++ )
- {
- OUStringBuffer aMenuShortCut;
- if ( i <= 9 )
- {
- if ( i == 9 )
- aMenuShortCut.append( "1~0. " );
- else
- {
- aMenuShortCut.append( "~N. " );
- aMenuShortCut[ 1 ] = sal_Unicode( i + '1' );
- }
- }
+ OUStringBuffer aMenuShortCut;
+ if ( i <= 9 )
+ {
+ if ( i == 9 )
+ aMenuShortCut.append( "1~0. " );
else
{
- aMenuShortCut.append( sal_Int32( i + 1 ) );
- aMenuShortCut.append( ". " );
+ aMenuShortCut.append( "~N. " );
+ aMenuShortCut[ 1 ] = sal_Unicode( i + '1' );
}
+ }
+ else
+ {
+ aMenuShortCut.append( sal_Int32( i + 1 ) );
+ aMenuShortCut.append( ". " );
+ }
- OUString aURLString = "vnd.sun.star.popup:RecentFileList?entry=" + OUString::number(i);
+ OUString aURLString = "vnd.sun.star.popup:RecentFileList?entry=" + OUString::number(i);
- // Abbreviate URL
- OUString aMenuTitle;
- INetURLObject aURL( m_aRecentFilesItems[i] );
- OUString aTipHelpText( aURL.getFSysPath( FSysStyle::Detect ) );
+ // Abbreviate URL
+ OUString aMenuTitle;
+ INetURLObject aURL( m_aRecentFilesItems[i] );
+ OUString aTipHelpText( aURL.getFSysPath( FSysStyle::Detect ) );
- if ( aURL.GetProtocol() == INetProtocol::File )
- {
- // Do handle file URL differently: don't show the protocol, just the file name
- aMenuTitle = aURL.GetLastName(INetURLObject::DecodeMechanism::WithCharset);
- }
- else
- {
- // In all other URLs show the protocol name before the file name
- aMenuTitle = INetURLObject::GetSchemeName(aURL.GetProtocol()) + ": " + aURL.getName();
- }
+ if ( aURL.GetProtocol() == INetProtocol::File )
+ {
+ // Do handle file URL differently: don't show the protocol, just the file name
+ aMenuTitle = aURL.GetLastName(INetURLObject::DecodeMechanism::WithCharset);
+ }
+ else
+ {
+ // In all other URLs show the protocol name before the file name
+ aMenuTitle = INetURLObject::GetSchemeName(aURL.GetProtocol()) + ": " + aURL.getName();
+ }
- aMenuShortCut.append( aMenuTitle );
+ aMenuShortCut.append( aMenuTitle );
- pVCLPopupMenu->InsertItem( sal_uInt16( i+1 ), aMenuShortCut.makeStringAndClear() );
- pVCLPopupMenu->SetTipHelpText( sal_uInt16( i+1 ), aTipHelpText );
- pVCLPopupMenu->SetItemCommand( sal_uInt16( i+1 ), aURLString );
- }
+ pVCLPopupMenu->InsertItem( sal_uInt16( i+1 ), aMenuShortCut.makeStringAndClear() );
+ pVCLPopupMenu->SetTipHelpText( sal_uInt16( i+1 ), aTipHelpText );
+ pVCLPopupMenu->SetItemCommand( sal_uInt16( i+1 ), aURLString );
+ }
+ pVCLPopupMenu->InsertSeparator();
+ // Clear List menu entry
+ pVCLPopupMenu->InsertItem( sal_uInt16( nCount + 1 ),
+ FwkResId(STR_CLEAR_RECENT_FILES) );
+ pVCLPopupMenu->SetItemCommand( sal_uInt16( nCount + 1 ),
+ CMD_CLEAR_LIST );
+ pVCLPopupMenu->SetHelpText( sal_uInt16( nCount + 1 ),
+ FwkResId(STR_CLEAR_RECENT_FILES_HELP) );
+
+ // Open remote menu entry
+ if ( m_bShowToolbarEntries )
+ {
pVCLPopupMenu->InsertSeparator();
- // Clear List menu entry
- pVCLPopupMenu->InsertItem( sal_uInt16( nCount + 1 ),
- FwkResId(STR_CLEAR_RECENT_FILES) );
- pVCLPopupMenu->SetItemCommand( sal_uInt16( nCount + 1 ),
- CMD_CLEAR_LIST );
- pVCLPopupMenu->SetHelpText( sal_uInt16( nCount + 1 ),
- FwkResId(STR_CLEAR_RECENT_FILES_HELP) );
-
- // Open remote menu entry
- if ( m_bShowToolbarEntries )
- {
- pVCLPopupMenu->InsertSeparator();
- pVCLPopupMenu->InsertItem( CMD_OPEN_AS_TEMPLATE, m_xFrame );
- pVCLPopupMenu->InsertItem( CMD_OPEN_REMOTE, m_xFrame );
- }
+ pVCLPopupMenu->InsertItem( CMD_OPEN_AS_TEMPLATE, m_xFrame );
+ pVCLPopupMenu->InsertItem( CMD_OPEN_REMOTE, m_xFrame );
+ }
+ }
+ else
+ {
+ if ( m_bShowToolbarEntries )
+ {
+ pVCLPopupMenu->InsertItem( CMD_OPEN_AS_TEMPLATE, m_xFrame );
+ pVCLPopupMenu->InsertItem( CMD_OPEN_REMOTE, m_xFrame );
}
else
{
- if ( m_bShowToolbarEntries )
- {
- pVCLPopupMenu->InsertItem( CMD_OPEN_AS_TEMPLATE, m_xFrame );
- pVCLPopupMenu->InsertItem( CMD_OPEN_REMOTE, m_xFrame );
- }
- else
- {
- // No recent documents => insert "no document" string
- pVCLPopupMenu->InsertItem( 1, FwkResId(STR_NODOCUMENT) );
- // Do not disable it, otherwise the Toolbar controller and MenuButton
- // will display SV_RESID_STRING_NOSELECTIONPOSSIBLE instead of STR_NODOCUMENT
- pVCLPopupMenu->SetItemBits( 1, pVCLPopupMenu->GetItemBits( 1 ) | MenuItemBits::NOSELECT );
- }
+ // No recent documents => insert "no document" string
+ pVCLPopupMenu->InsertItem( 1, FwkResId(STR_NODOCUMENT) );
+ // Do not disable it, otherwise the Toolbar controller and MenuButton
+ // will display SV_RESID_STRING_NOSELECTIONPOSSIBLE instead of STR_NODOCUMENT
+ pVCLPopupMenu->SetItemBits( 1, pVCLPopupMenu->GetItemBits( 1 ) | MenuItemBits::NOSELECT );
}
}
}
void RecentFilesMenuController::executeEntry( sal_Int32 nIndex )
{
- if (( nIndex >= 0 ) &&
- ( nIndex < sal::static_int_cast<sal_Int32>( m_aRecentFilesItems.size() )))
- {
- Sequence< PropertyValue > aArgsList(3);
- aArgsList[0].Name = "Referer";
- aArgsList[0].Value <<= OUString( "private:user" );
+ if (!(( nIndex >= 0 ) &&
+ ( nIndex < sal::static_int_cast<sal_Int32>( m_aRecentFilesItems.size() ))))
+ return;
- // documents in the picklist will never be opened as templates
- aArgsList[1].Name = "AsTemplate";
- aArgsList[1].Value <<= false;
+ Sequence< PropertyValue > aArgsList(3);
+ aArgsList[0].Name = "Referer";
+ aArgsList[0].Value <<= OUString( "private:user" );
- // Type detection needs to know which app we are opening it from.
- aArgsList[2].Name = "DocumentService";
- aArgsList[2].Value <<= m_aModuleName;
+ // documents in the picklist will never be opened as templates
+ aArgsList[1].Name = "AsTemplate";
+ aArgsList[1].Value <<= false;
- dispatchCommand( m_aRecentFilesItems[ nIndex ], aArgsList, "_default" );
- }
+ // Type detection needs to know which app we are opening it from.
+ aArgsList[2].Name = "DocumentService";
+ aArgsList[2].Value <<= m_aModuleName;
+
+ dispatchCommand( m_aRecentFilesItems[ nIndex ], aArgsList, "_default" );
}
// XEventListener
@@ -285,30 +285,30 @@ void SAL_CALL RecentFilesMenuController::itemSelected( const css::awt::MenuEvent
xPopupMenu = m_xPopupMenu;
}
- if ( xPopupMenu.is() )
- {
- const OUString aCommand( xPopupMenu->getCommand( rEvent.MenuId ) );
+ if ( !xPopupMenu.is() )
+ return;
- if ( aCommand == CMD_CLEAR_LIST )
- {
- SvtHistoryOptions().Clear( ePICKLIST );
- dispatchCommand(
- "vnd.org.libreoffice.recentdocs:ClearRecentFileList",
- css::uno::Sequence< css::beans::PropertyValue >() );
- }
- else if ( aCommand == CMD_OPEN_REMOTE )
- {
- Sequence< PropertyValue > aArgsList( 0 );
- dispatchCommand( CMD_OPEN_REMOTE, aArgsList );
- }
- else if ( aCommand == CMD_OPEN_AS_TEMPLATE )
- {
- Sequence< PropertyValue > aArgsList( 0 );
- dispatchCommand( CMD_OPEN_AS_TEMPLATE, aArgsList );
- }
- else
- executeEntry( rEvent.MenuId-1 );
+ const OUString aCommand( xPopupMenu->getCommand( rEvent.MenuId ) );
+
+ if ( aCommand == CMD_CLEAR_LIST )
+ {
+ SvtHistoryOptions().Clear( ePICKLIST );
+ dispatchCommand(
+ "vnd.org.libreoffice.recentdocs:ClearRecentFileList",
+ css::uno::Sequence< css::beans::PropertyValue >() );
+ }
+ else if ( aCommand == CMD_OPEN_REMOTE )
+ {
+ Sequence< PropertyValue > aArgsList( 0 );
+ dispatchCommand( CMD_OPEN_REMOTE, aArgsList );
+ }
+ else if ( aCommand == CMD_OPEN_AS_TEMPLATE )
+ {
+ Sequence< PropertyValue > aArgsList( 0 );
+ dispatchCommand( CMD_OPEN_AS_TEMPLATE, aArgsList );
}
+ else
+ executeEntry( rEvent.MenuId-1 );
}
void SAL_CALL RecentFilesMenuController::itemActivated( const css::awt::MenuEvent& )
@@ -349,30 +349,30 @@ void SAL_CALL RecentFilesMenuController::dispatch(
throwIfDisposed();
- if ( aURL.Complete.startsWith( m_aBaseURL ) )
- {
- // Parse URL to retrieve entry argument and its value
- sal_Int32 nQueryPart = aURL.Complete.indexOf( '?', m_aBaseURL.getLength() );
- if ( nQueryPart > 0 )
- {
- const OUString aEntryArgStr( "entry=" );
- sal_Int32 nEntryArg = aURL.Complete.indexOf( aEntryArgStr, nQueryPart );
- sal_Int32 nEntryPos = nEntryArg + aEntryArgStr.getLength();
- if (( nEntryArg > 0 ) && ( nEntryPos < aURL.Complete.getLength() ))
- {
- sal_Int32 nAddArgs = aURL.Complete.indexOf( '&', nEntryPos );
- OUString aEntryArg;
+ if ( !aURL.Complete.startsWith( m_aBaseURL ) )
+ return;
- if ( nAddArgs < 0 )
- aEntryArg = aURL.Complete.copy( nEntryPos );
- else
- aEntryArg = aURL.Complete.copy( nEntryPos, nAddArgs-nEntryPos );
+ // Parse URL to retrieve entry argument and its value
+ sal_Int32 nQueryPart = aURL.Complete.indexOf( '?', m_aBaseURL.getLength() );
+ if ( nQueryPart <= 0 )
+ return;
- sal_Int32 nEntry = aEntryArg.toInt32();
- executeEntry( nEntry );
- }
- }
- }
+ const OUString aEntryArgStr( "entry=" );
+ sal_Int32 nEntryArg = aURL.Complete.indexOf( aEntryArgStr, nQueryPart );
+ sal_Int32 nEntryPos = nEntryArg + aEntryArgStr.getLength();
+ if (!(( nEntryArg > 0 ) && ( nEntryPos < aURL.Complete.getLength() )))
+ return;
+
+ sal_Int32 nAddArgs = aURL.Complete.indexOf( '&', nEntryPos );
+ OUString aEntryArg;
+
+ if ( nAddArgs < 0 )
+ aEntryArg = aURL.Complete.copy( nEntryPos );
+ else
+ aEntryArg = aURL.Complete.copy( nEntryPos, nAddArgs-nEntryPos );
+
+ sal_Int32 nEntry = aEntryArg.toInt32();
+ executeEntry( nEntry );
}
}
diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx
index b20abfd2ed99..9827e2e60bab 100644
--- a/framework/source/uielement/statusbarmanager.cxx
+++ b/framework/source/uielement/statusbarmanager.cxx
@@ -532,20 +532,20 @@ void StatusBarManager::UserDraw( const UserDrawEvent& rUDEvt )
sal_uInt16 nId( rUDEvt.GetItemId() );
StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId );
- if (( nId > 0 ) && ( it != m_aControllerMap.end() ))
- {
- uno::Reference< frame::XStatusbarController > xController( it->second );
- if (xController.is() && rUDEvt.GetRenderContext())
- {
- uno::Reference< awt::XGraphics > xGraphics = rUDEvt.GetRenderContext()->CreateUnoGraphics();
+ if (!(( nId > 0 ) && ( it != m_aControllerMap.end() )))
+ return;
- awt::Rectangle aRect( rUDEvt.GetRect().Left(),
- rUDEvt.GetRect().Top(),
- rUDEvt.GetRect().GetWidth(),
- rUDEvt.GetRect().GetHeight() );
- aGuard.clear();
- xController->paint( xGraphics, aRect, rUDEvt.GetStyle() );
- }
+ uno::Reference< frame::XStatusbarController > xController( it->second );
+ if (xController.is() && rUDEvt.GetRenderContext())
+ {
+ uno::Reference< awt::XGraphics > xGraphics = rUDEvt.GetRenderContext()->CreateUnoGraphics();
+
+ awt::Rectangle aRect( rUDEvt.GetRect().Left(),
+ rUDEvt.GetRect().Top(),
+ rUDEvt.GetRect().GetWidth(),
+ rUDEvt.GetRect().GetHeight() );
+ aGuard.clear();
+ xController->paint( xGraphics, aRect, rUDEvt.GetStyle() );
}
}
@@ -556,20 +556,20 @@ void StatusBarManager::Command( const CommandEvent& rEvt )
if ( m_bDisposed )
return;
- if ( rEvt.GetCommand() == CommandEventId::ContextMenu )
+ if ( rEvt.GetCommand() != CommandEventId::ContextMenu )
+ return;
+
+ sal_uInt16 nId = m_pStatusBar->GetItemId( rEvt.GetMousePosPixel() );
+ StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId );
+ if (( nId > 0 ) && ( it != m_aControllerMap.end() ))
{
- sal_uInt16 nId = m_pStatusBar->GetItemId( rEvt.GetMousePosPixel() );
- StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId );
- if (( nId > 0 ) && ( it != m_aControllerMap.end() ))
+ uno::Reference< frame::XStatusbarController > xController( it->second );
+ if ( xController.is() )
{
- uno::Reference< frame::XStatusbarController > xController( it->second );
- if ( xController.is() )
- {
- awt::Point aPos;
- aPos.X = rEvt.GetMousePosPixel().X();
- aPos.Y = rEvt.GetMousePosPixel().Y();
- xController->command( aPos, awt::Command::CONTEXTMENU, true, uno::Any() );
- }
+ awt::Point aPos;
+ aPos.X = rEvt.GetMousePosPixel().X();
+ aPos.Y = rEvt.GetMousePosPixel().Y();
+ xController->command( aPos, awt::Command::CONTEXTMENU, true, uno::Any() );
}
}
}
@@ -583,23 +583,23 @@ void StatusBarManager::MouseButton( const MouseEvent& rMEvt ,sal_Bool ( SAL_CALL
{
SolarMutexGuard g;
- if ( !m_bDisposed )
+ if ( m_bDisposed )
+ return;
+
+ sal_uInt16 nId = m_pStatusBar->GetItemId( rMEvt.GetPosPixel() );
+ StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId );
+ if (!(( nId > 0 ) && ( it != m_aControllerMap.end() )))
+ return;
+
+ uno::Reference< frame::XStatusbarController > xController( it->second );
+ if ( xController.is() )
{
- sal_uInt16 nId = m_pStatusBar->GetItemId( rMEvt.GetPosPixel() );
- StatusBarControllerMap::const_iterator it = m_aControllerMap.find( nId );
- if (( nId > 0 ) && ( it != m_aControllerMap.end() ))
- {
- uno::Reference< frame::XStatusbarController > xController( it->second );
- if ( xController.is() )
- {
- css::awt::MouseEvent aMouseEvent;
- aMouseEvent.Buttons = rMEvt.GetButtons();
- aMouseEvent.X = rMEvt.GetPosPixel().X();
- aMouseEvent.Y = rMEvt.GetPosPixel().Y();
- aMouseEvent.ClickCount = rMEvt.GetClicks();
- (xController.get()->*_pMethod)( aMouseEvent);
- }
- }
+ css::awt::MouseEvent aMouseEvent;
+ aMouseEvent.Buttons = rMEvt.GetButtons();
+ aMouseEvent.X = rMEvt.GetPosPixel().X();
+ aMouseEvent.Y = rMEvt.GetPosPixel().Y();
+ aMouseEvent.ClickCount = rMEvt.GetClicks();
+ (xController.get()->*_pMethod)( aMouseEvent);
}
}
diff --git a/framework/source/uielement/statusbarwrapper.cxx b/framework/source/uielement/statusbarwrapper.cxx
index 02c3b458821b..f22736f796a4 100644
--- a/framework/source/uielement/statusbarwrapper.cxx
+++ b/framework/source/uielement/statusbarwrapper.cxx
@@ -81,44 +81,44 @@ void SAL_CALL StatusBarWrapper::initialize( const Sequence< Any >& aArguments )
if ( m_bDisposed )
throw DisposedException();
- if ( !m_bInitialized )
+ if ( m_bInitialized )
+ return;
+
+ UIConfigElementWrapperBase::initialize( aArguments );
+
+ Reference< XFrame > xFrame( m_xWeakFrame );
+ if ( !(xFrame.is() && m_xConfigSource.is()) )
+ return;
+
+ // Create VCL based toolbar which will be filled with settings data
+ StatusBar* pStatusBar( nullptr );
+ StatusBarManager* pStatusBarManager( nullptr );
{
- UIConfigElementWrapperBase::initialize( aArguments );
+ SolarMutexGuard aSolarMutexGuard;
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
+ if ( pWindow )
+ {
+ sal_uLong nStyles = WinBits( WB_LEFT | WB_3DLOOK );
- Reference< XFrame > xFrame( m_xWeakFrame );
- if ( xFrame.is() && m_xConfigSource.is() )
+ pStatusBar = VclPtr<FrameworkStatusBar>::Create( pWindow, nStyles );
+ pStatusBarManager = new StatusBarManager( m_xContext, xFrame, pStatusBar );
+ static_cast<FrameworkStatusBar*>(pStatusBar)->SetStatusBarManager( pStatusBarManager );
+ m_xStatusBarManager.set( static_cast< OWeakObject *>( pStatusBarManager ), UNO_QUERY );
+ }
+ }
+
+ try
+ {
+ m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL, false );
+ if ( m_xConfigData.is() && pStatusBar && pStatusBarManager )
{
- // Create VCL based toolbar which will be filled with settings data
- StatusBar* pStatusBar( nullptr );
- StatusBarManager* pStatusBarManager( nullptr );
- {
- SolarMutexGuard aSolarMutexGuard;
- VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
- if ( pWindow )
- {
- sal_uLong nStyles = WinBits( WB_LEFT | WB_3DLOOK );
-
- pStatusBar = VclPtr<FrameworkStatusBar>::Create( pWindow, nStyles );
- pStatusBarManager = new StatusBarManager( m_xContext, xFrame, pStatusBar );
- static_cast<FrameworkStatusBar*>(pStatusBar)->SetStatusBarManager( pStatusBarManager );
- m_xStatusBarManager.set( static_cast< OWeakObject *>( pStatusBarManager ), UNO_QUERY );
- }
- }
-
- try
- {
- m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL, false );
- if ( m_xConfigData.is() && pStatusBar && pStatusBarManager )
- {
- // Fill statusbar with container contents
- pStatusBarManager->FillStatusBar( m_xConfigData );
- }
- }
- catch ( const NoSuchElementException& )
- {
- }
+ // Fill statusbar with container contents
+ pStatusBarManager->FillStatusBar( m_xConfigData );
}
}
+ catch ( const NoSuchElementException& )
+ {
+ }
}
// XUIElementSettings
@@ -129,21 +129,21 @@ void SAL_CALL StatusBarWrapper::updateSettings()
if ( m_bDisposed )
throw DisposedException();
- if ( m_bPersistent &&
+ if ( !(m_bPersistent &&
m_xConfigSource.is() &&
- m_xStatusBarManager.is() )
+ m_xStatusBarManager.is()) )
+ return;
+
+ try
{
- try
- {
- StatusBarManager* pStatusBarManager = static_cast< StatusBarManager *>( m_xStatusBarManager.get() );
+ StatusBarManager* pStatusBarManager = static_cast< StatusBarManager *>( m_xStatusBarManager.get() );
- m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL, false );
- if ( m_xConfigData.is() )
- pStatusBarManager->FillStatusBar( m_xConfigData );
- }
- catch ( const NoSuchElementException& )
- {
- }
+ m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL, false );
+ if ( m_xConfigData.is() )
+ pStatusBarManager->FillStatusBar( m_xConfigData );
+ }
+ catch ( const NoSuchElementException& )
+ {
}
}
diff --git a/framework/source/uielement/subtoolbarcontroller.cxx b/framework/source/uielement/subtoolbarcontroller.cxx
index e36ec92ea4aa..635ebfb90770 100644
--- a/framework/source/uielement/subtoolbarcontroller.cxx
+++ b/framework/source/uielement/subtoolbarcontroller.cxx
@@ -136,48 +136,48 @@ void SubToolBarController::statusChanged( const css::frame::FeatureStateEvent& E
ToolBox* pToolBox = nullptr;
sal_uInt16 nId = 0;
- if ( getToolboxId( nId, &pToolBox ) )
+ if ( !getToolboxId( nId, &pToolBox ) )
+ return;
+
+ ToolBoxItemBits nItemBits = pToolBox->GetItemBits( nId );
+ nItemBits &= ~ToolBoxItemBits::CHECKABLE;
+ TriState eTri = TRISTATE_FALSE;
+
+ if ( Event.FeatureURL.Complete == m_aCommandURL )
{
- ToolBoxItemBits nItemBits = pToolBox->GetItemBits( nId );
- nItemBits &= ~ToolBoxItemBits::CHECKABLE;
- TriState eTri = TRISTATE_FALSE;
+ pToolBox->EnableItem( nId, Event.IsEnabled );
- if ( Event.FeatureURL.Complete == m_aCommandURL )
+ OUString aStrValue;
+ css::frame::status::Visibility aItemVisibility;
+ if ( Event.State >>= aStrValue )
{
- pToolBox->EnableItem( nId, Event.IsEnabled );
-
- OUString aStrValue;
- css::frame::status::Visibility aItemVisibility;
- if ( Event.State >>= aStrValue )
+ // Enum command, such as the current custom shape,
+ // toggle checked state.
+ if ( m_aLastCommand == ( m_aCommandURL + "." + aStrValue ) )
{
- // Enum command, such as the current custom shape,
- // toggle checked state.
- if ( m_aLastCommand == ( m_aCommandURL + "." + aStrValue ) )
- {
- eTri = TRISTATE_TRUE;
- nItemBits |= ToolBoxItemBits::CHECKABLE;
- }
- }
- else if ( Event.State >>= aItemVisibility )
- {
- pToolBox->ShowItem( nId, aItemVisibility.bVisible );
+ eTri = TRISTATE_TRUE;
+ nItemBits |= ToolBoxItemBits::CHECKABLE;
}
}
- else
+ else if ( Event.State >>= aItemVisibility )
{
- bool bValue;
- if ( Event.State >>= bValue )
- {
- // Boolean, treat it as checked/unchecked
- if ( bValue )
- eTri = TRISTATE_TRUE;
- nItemBits |= ToolBoxItemBits::CHECKABLE;
- }
+ pToolBox->ShowItem( nId, aItemVisibility.bVisible );
}
-
- pToolBox->SetItemState( nId, eTri );
- pToolBox->SetItemBits( nId, nItemBits );
}
+ else
+ {
+ bool bValue;
+ if ( Event.State >>= bValue )
+ {
+ // Boolean, treat it as checked/unchecked
+ if ( bValue )
+ eTri = TRISTATE_TRUE;
+ nItemBits |= ToolBoxItemBits::CHECKABLE;
+ }
+ }
+
+ pToolBox->SetItemState( nId, eTri );
+ pToolBox->SetItemBits( nId, nItemBits );
}
void SubToolBarController::execute( sal_Int16 nKeyModifier )
@@ -345,49 +345,49 @@ void SubToolBarController::endPopupMode( const css::awt::EndPopupModeEvent& e )
m_xUIElement = nullptr;
// if the toolbar was teared-off recreate it and place it at the given position
- if( e.bTearoff )
- {
- css::uno::Reference< css::ui::XUIElement > xUIElement;
- css::uno::Reference< css::frame::XLayoutManager > xLayoutManager = getLayoutManager();
+ if( !e.bTearoff )
+ return;
- if ( !xLayoutManager.is() )
- return;
+ css::uno::Reference< css::ui::XUIElement > xUIElement;
+ css::uno::Reference< css::frame::XLayoutManager > xLayoutManager = getLayoutManager();
- xLayoutManager->createElement( aSubToolBarResName );
- xUIElement = xLayoutManager->getElement( aSubToolBarResName );
- if ( xUIElement.is() )
+ if ( !xLayoutManager.is() )
+ return;
+
+ xLayoutManager->createElement( aSubToolBarResName );
+ xUIElement = xLayoutManager->getElement( aSubToolBarResName );
+ if ( !xUIElement.is() )
+ return;
+
+ css::uno::Reference< css::awt::XWindow > xSubToolBar( xUIElement->getRealInterface(), css::uno::UNO_QUERY );
+ css::uno::Reference< css::beans::XPropertySet > xProp( xUIElement, css::uno::UNO_QUERY );
+ if ( !(xSubToolBar.is() && xProp.is()) )
+ return;
+
+ OUString aPersistentString( "Persistent" );
+ try
+ {
+ VclPtr<vcl::Window> pTbxWindow = VCLUnoHelper::GetWindow( xSubToolBar );
+ if ( pTbxWindow && pTbxWindow->GetType() == WindowType::TOOLBOX )
{
- css::uno::Reference< css::awt::XWindow > xSubToolBar( xUIElement->getRealInterface(), css::uno::UNO_QUERY );
- css::uno::Reference< css::beans::XPropertySet > xProp( xUIElement, css::uno::UNO_QUERY );
- if ( xSubToolBar.is() && xProp.is() )
- {
- OUString aPersistentString( "Persistent" );
- try
- {
- VclPtr<vcl::Window> pTbxWindow = VCLUnoHelper::GetWindow( xSubToolBar );
- if ( pTbxWindow && pTbxWindow->GetType() == WindowType::TOOLBOX )
- {
- css::uno::Any a = xProp->getPropertyValue( aPersistentString );
- xProp->setPropertyValue( aPersistentString, css::uno::makeAny( false ) );
+ css::uno::Any a = xProp->getPropertyValue( aPersistentString );
+ xProp->setPropertyValue( aPersistentString, css::uno::makeAny( false ) );
- xLayoutManager->hideElement( aSubToolBarResName );
- xLayoutManager->floatWindow( aSubToolBarResName );
+ xLayoutManager->hideElement( aSubToolBarResName );
+ xLayoutManager->floatWindow( aSubToolBarResName );
- xLayoutManager->setElementPos( aSubToolBarResName, e.FloatingPosition );
- xLayoutManager->showElement( aSubToolBarResName );
+ xLayoutManager->setElementPos( aSubToolBarResName, e.FloatingPosition );
+ xLayoutManager->showElement( aSubToolBarResName );
- xProp->setPropertyValue("Persistent", a );
- }
- }
- catch ( css::uno::RuntimeException& )
- {
- throw;
- }
- catch ( css::uno::Exception& )
- {}
- }
+ xProp->setPropertyValue("Persistent", a );
}
}
+ catch ( css::uno::RuntimeException& )
+ {
+ throw;
+ }
+ catch ( css::uno::Exception& )
+ {}
}
void SubToolBarController::disposing( const css::lang::EventObject& e )
diff --git a/framework/source/uielement/thesaurusmenucontroller.cxx b/framework/source/uielement/thesaurusmenucontroller.cxx
index 8cc84c1bdf3b..492da8593ac2 100644
--- a/framework/source/uielement/thesaurusmenucontroller.cxx
+++ b/framework/source/uielement/thesaurusmenucontroller.cxx
@@ -84,61 +84,61 @@ void ThesaurusMenuController::fillPopupMenu()
VCLXMenu* pAwtMenu = comphelper::getUnoTunnelImplementation<VCLXMenu>( m_xPopupMenu );
Menu* pVCLMenu = pAwtMenu->GetMenu();
pVCLMenu->SetMenuFlags( MenuFlags::NoAutoMnemonics );
- if ( !aSynonyms.empty() )
- {
- SvtLinguConfig aCfg;
- Image aImage;
- OUString aThesImplName( getThesImplName( aLocale ) );
- OUString aSynonymsImageUrl( aCfg.GetSynonymsContextImage( aThesImplName ) );
- if ( !aThesImplName.isEmpty() && !aSynonymsImageUrl.isEmpty() )
- aImage = Image( aSynonymsImageUrl );
-
- sal_uInt16 nId = 1;
- for ( const auto& aSynonym : aSynonyms )
- {
- OUString aItemText( linguistic::GetThesaurusReplaceText( aSynonym ) );
- pVCLMenu->InsertItem( nId, aItemText );
- pVCLMenu->SetItemCommand( nId, ".uno:ThesaurusFromContext?WordReplace:string=" + aItemText );
+ if ( aSynonyms.empty() )
+ return;
- if ( !aSynonymsImageUrl.isEmpty() )
- pVCLMenu->SetItemImage( nId, aImage );
- nId++;
- }
+ SvtLinguConfig aCfg;
+ Image aImage;
+ OUString aThesImplName( getThesImplName( aLocale ) );
+ OUString aSynonymsImageUrl( aCfg.GetSynonymsContextImage( aThesImplName ) );
+ if ( !aThesImplName.isEmpty() && !aSynonymsImageUrl.isEmpty() )
+ aImage = Image( aSynonymsImageUrl );
- pVCLMenu->InsertSeparator();
- OUString aThesaurusDialogCmd( ".uno:ThesaurusDialog" );
- auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aThesaurusDialogCmd, m_aModuleName);
- pVCLMenu->InsertItem( nId, vcl::CommandInfoProvider::GetPopupLabelForCommand(aProperties) );
- pVCLMenu->SetItemCommand( nId, aThesaurusDialogCmd );
+ sal_uInt16 nId = 1;
+ for ( const auto& aSynonym : aSynonyms )
+ {
+ OUString aItemText( linguistic::GetThesaurusReplaceText( aSynonym ) );
+ pVCLMenu->InsertItem( nId, aItemText );
+ pVCLMenu->SetItemCommand( nId, ".uno:ThesaurusFromContext?WordReplace:string=" + aItemText );
+
+ if ( !aSynonymsImageUrl.isEmpty() )
+ pVCLMenu->SetItemImage( nId, aImage );
+ nId++;
}
+
+ pVCLMenu->InsertSeparator();
+ OUString aThesaurusDialogCmd( ".uno:ThesaurusDialog" );
+ auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(aThesaurusDialogCmd, m_aModuleName);
+ pVCLMenu->InsertItem( nId, vcl::CommandInfoProvider::GetPopupLabelForCommand(aProperties) );
+ pVCLMenu->SetItemCommand( nId, aThesaurusDialogCmd );
}
void ThesaurusMenuController::getMeanings( std::vector< OUString >& rSynonyms, const OUString& rWord,
const css::lang::Locale& rLocale, size_t nMaxSynonms )
{
rSynonyms.clear();
- if ( m_xThesaurus.is() && m_xThesaurus->hasLocale( rLocale ) && !rWord.isEmpty() && nMaxSynonms > 0 )
+ if ( !(m_xThesaurus.is() && m_xThesaurus->hasLocale( rLocale ) && !rWord.isEmpty() && nMaxSynonms > 0) )
+ return;
+
+ try
{
- try
- {
- const css::uno::Sequence< css::uno::Reference< css::linguistic2::XMeaning > > aMeaningSeq(
- m_xThesaurus->queryMeanings( rWord, rLocale, css::uno::Sequence< css::beans::PropertyValue >() ) );
+ const css::uno::Sequence< css::uno::Reference< css::linguistic2::XMeaning > > aMeaningSeq(
+ m_xThesaurus->queryMeanings( rWord, rLocale, css::uno::Sequence< css::beans::PropertyValue >() ) );
- for ( const auto& xMeaning : aMeaningSeq )
+ for ( const auto& xMeaning : aMeaningSeq )
+ {
+ const css::uno::Sequence< OUString > aSynonymSeq( xMeaning->querySynonyms() );
+ for ( const auto& aSynonym : aSynonymSeq )
{
- const css::uno::Sequence< OUString > aSynonymSeq( xMeaning->querySynonyms() );
- for ( const auto& aSynonym : aSynonymSeq )
- {
- rSynonyms.push_back( aSynonym );
- if ( rSynonyms.size() == nMaxSynonms )
- return;
- }
+ rSynonyms.push_back( aSynonym );
+ if ( rSynonyms.size() == nMaxSynonms )
+ return;
}
}
- catch ( const css::uno::Exception& )
- {
- SAL_WARN( "fwk.uielement", "Failed to get synonyms" );
- }
+ }
+ catch ( const css::uno::Exception& )
+ {
+ SAL_WARN( "fwk.uielement", "Failed to get synonyms" );
}
}
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index d224cfc2a955..9aa20b7933e5 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -563,48 +563,48 @@ void ToolBarManager::impl_elementChanged(bool const isRemove,
sal_Int16 nImageType = sal_Int16();
sal_Int16 nCurrentImageType = getCurrentImageType();
- if (( Event.aInfo >>= nImageType ) &&
+ if (!(( Event.aInfo >>= nImageType ) &&
( nImageType == nCurrentImageType ) &&
- ( Event.Element >>= xNameAccess ))
- {
- sal_Int16 nImageInfo( 1 );
- Reference< XInterface > xIfacDocImgMgr( m_xDocImageManager, UNO_QUERY );
- if ( xIfacDocImgMgr == Event.Source )
- nImageInfo = 0;
+ ( Event.Element >>= xNameAccess )))
+ return;
- Sequence< OUString > aSeq = xNameAccess->getElementNames();
- for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
+ sal_Int16 nImageInfo( 1 );
+ Reference< XInterface > xIfacDocImgMgr( m_xDocImageManager, UNO_QUERY );
+ if ( xIfacDocImgMgr == Event.Source )
+ nImageInfo = 0;
+
+ Sequence< OUString > aSeq = xNameAccess->getElementNames();
+ for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
+ {
+ CommandToInfoMap::iterator pIter = m_aCommandMap.find( aSeq[i] );
+ if ( pIter != m_aCommandMap.end() && ( pIter->second.nImageInfo >= nImageInfo ))
{
- CommandToInfoMap::iterator pIter = m_aCommandMap.find( aSeq[i] );
- if ( pIter != m_aCommandMap.end() && ( pIter->second.nImageInfo >= nImageInfo ))
+ if (isRemove)
{
- if (isRemove)
+ Image aImage;
+ if (( pIter->second.nImageInfo == 0 ) && ( pIter->second.nImageInfo == nImageInfo ))
{
- Image aImage;
- if (( pIter->second.nImageInfo == 0 ) && ( pIter->second.nImageInfo == nImageInfo ))
- {
- // Special case: An image from the document image manager has been removed.
- // It is possible that we have an image at our module image manager. Before
- // we can remove our image we have to ask our module image manager.
- Sequence< OUString > aCmdURLSeq( 1 );
- Sequence< Reference< XGraphic > > aGraphicSeq;
- aCmdURLSeq[0] = pIter->first;
- aGraphicSeq = m_xModuleImageManager->getImages( nImageType, aCmdURLSeq );
- aImage = Image( aGraphicSeq[0] );
- }
+ // Special case: An image from the document image manager has been removed.
+ // It is possible that we have an image at our module image manager. Before
+ // we can remove our image we have to ask our module image manager.
+ Sequence< OUString > aCmdURLSeq( 1 );
+ Sequence< Reference< XGraphic > > aGraphicSeq;
+ aCmdURLSeq[0] = pIter->first;
+ aGraphicSeq = m_xModuleImageManager->getImages( nImageType, aCmdURLSeq );
+ aImage = Image( aGraphicSeq[0] );
+ }
- setToolBarImage(aImage,pIter);
- } // if (isRemove)
- else
+ setToolBarImage(aImage,pIter);
+ } // if (isRemove)
+ else
+ {
+ Reference< XGraphic > xGraphic;
+ if ( xNameAccess->getByName( aSeq[i] ) >>= xGraphic )
{
- Reference< XGraphic > xGraphic;
- if ( xNameAccess->getByName( aSeq[i] ) >>= xGraphic )
- {
- Image aImage( xGraphic );
- setToolBarImage(aImage,pIter);
- }
- pIter->second.nImageInfo = nImageInfo;
+ Image aImage( xGraphic );
+ setToolBarImage(aImage,pIter);
}
+ pIter->second.nImageInfo = nImageInfo;
}
}
}
@@ -1155,18 +1155,18 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
// Try to retrieve UIName from the container property set and set it as the title
// if it is not empty.
Reference< XPropertySet > xPropSet( rItemContainer, UNO_QUERY );
- if ( xPropSet.is() )
+ if ( !xPropSet.is() )
+ return;
+
+ try
+ {
+ OUString aUIName;
+ xPropSet->getPropertyValue("UIName") >>= aUIName;
+ if ( !aUIName.isEmpty() )
+ m_pToolBar->SetText( aUIName );
+ }
+ catch (const Exception&)
{
- try
- {
- OUString aUIName;
- xPropSet->getPropertyValue("UIName") >>= aUIName;
- if ( !aUIName.isEmpty() )
- m_pToolBar->SetText( aUIName );
- }
- catch (const Exception&)
- {
- }
}
}
@@ -1280,37 +1280,37 @@ void ToolBarManager::RequestImages()
void ToolBarManager::notifyRegisteredControllers( const OUString& aUIElementName, const OUString& aCommand )
{
SolarMutexClearableGuard aGuard;
- if ( !m_aSubToolBarControllerMap.empty() )
- {
- SubToolBarToSubToolBarControllerMap::const_iterator pIter =
- m_aSubToolBarControllerMap.find( aUIElementName );
+ if ( m_aSubToolBarControllerMap.empty() )
+ return;
- if ( pIter != m_aSubToolBarControllerMap.end() )
- {
- const SubToolBarControllerVector& rSubToolBarVector = pIter->second;
- if ( !rSubToolBarVector.empty() )
- {
- SubToolBarControllerVector aNotifyVector = rSubToolBarVector;
- aGuard.clear();
+ SubToolBarToSubToolBarControllerMap::const_iterator pIter =
+ m_aSubToolBarControllerMap.find( aUIElementName );
- const sal_uInt32 nCount = aNotifyVector.size();
- for ( sal_uInt32 i=0; i < nCount; i++ )
- {
- try
- {
- Reference< XSubToolbarController > xController = aNotifyVector[i];
- if ( xController.is() )
- xController->functionSelected( aCommand );
- }
- catch (const RuntimeException&)
- {
- throw;
- }
- catch (const Exception&)
- {
- }
- }
- }
+ if ( pIter == m_aSubToolBarControllerMap.end() )
+ return;
+
+ const SubToolBarControllerVector& rSubToolBarVector = pIter->second;
+ if ( rSubToolBarVector.empty() )
+ return;
+
+ SubToolBarControllerVector aNotifyVector = rSubToolBarVector;
+ aGuard.clear();
+
+ const sal_uInt32 nCount = aNotifyVector.size();
+ for ( sal_uInt32 i=0; i < nCount; i++ )
+ {
+ try
+ {
+ Reference< XSubToolbarController > xController = aNotifyVector[i];
+ if ( xController.is() )
+ xController->functionSelected( aCommand );
+ }
+ catch (const RuntimeException&)
+ {
+ throw;
+ }
+ catch (const Exception&)
+ {
}
}
}
diff --git a/framework/source/uielement/toolbarmodemenucontroller.cxx b/framework/source/uielement/toolbarmodemenucontroller.cxx
index 15596a091335..2cc438ebb9e9 100644
--- a/framework/source/uielement/toolbarmodemenucontroller.cxx
+++ b/framework/source/uielement/toolbarmodemenucontroller.cxx
@@ -168,43 +168,43 @@ void SAL_CALL ToolbarModeMenuController::statusChanged( const FeatureStateEvent&
Reference< css::awt::XPopupMenu > xPopupMenu( m_xPopupMenu );
aLock.clear();
- if ( xPopupMenu.is() )
- {
- SolarMutexGuard aGuard;
- VCLXPopupMenu* pXPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( xPopupMenu ));
- PopupMenu* pVCLPopupMenu = pXPopupMenu ? static_cast<PopupMenu *>(pXPopupMenu->GetMenu()) : nullptr;
+ if ( !xPopupMenu.is() )
+ return;
- SAL_WARN_IF(!pVCLPopupMenu, "fwk.uielement", "worrying lack of popup menu");
- if (!pVCLPopupMenu)
- return;
+ SolarMutexGuard aGuard;
+ VCLXPopupMenu* pXPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( xPopupMenu ));
+ PopupMenu* pVCLPopupMenu = pXPopupMenu ? static_cast<PopupMenu *>(pXPopupMenu->GetMenu()) : nullptr;
+
+ SAL_WARN_IF(!pVCLPopupMenu, "fwk.uielement", "worrying lack of popup menu");
+ if (!pVCLPopupMenu)
+ return;
+
+ bool bSetCheckmark = false;
+ bool bCheckmark = false;
+ for ( sal_uInt16 i = 0; i < pVCLPopupMenu->GetItemCount(); i++ )
+ {
+ sal_uInt16 nId = pVCLPopupMenu->GetItemId( i );
+ if ( nId == 0 )
+ continue;
- bool bSetCheckmark = false;
- bool bCheckmark = false;
- for ( sal_uInt16 i = 0; i < pVCLPopupMenu->GetItemCount(); i++ )
+ OUString aCmd = pVCLPopupMenu->GetItemCommand( nId );
+ if ( aCmd == aFeatureURL )
{
- sal_uInt16 nId = pVCLPopupMenu->GetItemId( i );
- if ( nId == 0 )
- continue;
+ // Enable/disable item
+ pVCLPopupMenu->EnableItem( nId, Event.IsEnabled );
- OUString aCmd = pVCLPopupMenu->GetItemCommand( nId );
- if ( aCmd == aFeatureURL )
+ // Checkmark
+ if ( Event.State >>= bCheckmark )
+ bSetCheckmark = true;
+
+ if ( bSetCheckmark )
+ pVCLPopupMenu->CheckItem( nId, bCheckmark );
+ else
{
- // Enable/disable item
- pVCLPopupMenu->EnableItem( nId, Event.IsEnabled );
-
- // Checkmark
- if ( Event.State >>= bCheckmark )
- bSetCheckmark = true;
-
- if ( bSetCheckmark )
- pVCLPopupMenu->CheckItem( nId, bCheckmark );
- else
- {
- OUString aItemText;
-
- if ( Event.State >>= aItemText )
- pVCLPopupMenu->SetItemText( nId, aItemText );
- }
+ OUString aItemText;
+
+ if ( Event.State >>= aItemText )
+ pVCLPopupMenu->SetItemText( nId, aItemText );
}
}
}
@@ -224,54 +224,54 @@ void SAL_CALL ToolbarModeMenuController::itemSelected( const css::awt::MenuEvent
xFrame = m_xFrame;
}
- if ( xPopupMenu.is() )
- {
- VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( xPopupMenu ));
- if ( pPopupMenu )
- {
- SolarMutexGuard aSolarMutexGuard;
- PopupMenu* pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
- OUString aCmd( pVCLPopupMenu->GetItemCommand( rEvent.MenuId ));
+ if ( !xPopupMenu.is() )
+ return;
- {
- URL aTargetURL;
- Sequence<PropertyValue> aArgs;
-
- aTargetURL.Complete = ".uno:Notebookbar?File:string=" + aCmd;
- xURLTransformer->parseStrict( aTargetURL );
- Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
- if ( xDispatchProvider.is() )
- {
- Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch(
- aTargetURL, OUString(), 0 );
-
- ExecuteInfo* pExecuteInfo = new ExecuteInfo;
- pExecuteInfo->xDispatch = xDispatch;
- pExecuteInfo->aTargetURL = aTargetURL;
- pExecuteInfo->aArgs = aArgs;
- Application::PostUserEvent( LINK(nullptr,ToolbarModeMenuController, ExecuteHdl_Impl), pExecuteInfo );
- }
- }
+ VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( xPopupMenu ));
+ if ( !pPopupMenu )
+ return;
- URL aTargetURL;
- Sequence<PropertyValue> aArgs;
+ SolarMutexGuard aSolarMutexGuard;
+ PopupMenu* pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
+ OUString aCmd( pVCLPopupMenu->GetItemCommand( rEvent.MenuId ));
- aTargetURL.Complete = ".uno:ToolbarMode?Mode:string=" + aCmd;
- xURLTransformer->parseStrict( aTargetURL );
- Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
- if ( xDispatchProvider.is() )
- {
- Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch(
- aTargetURL, OUString(), 0 );
-
- ExecuteInfo* pExecuteInfo = new ExecuteInfo;
- pExecuteInfo->xDispatch = xDispatch;
- pExecuteInfo->aTargetURL = aTargetURL;
- pExecuteInfo->aArgs = aArgs;
- Application::PostUserEvent( LINK(nullptr, ToolbarModeMenuController, ExecuteHdl_Impl), pExecuteInfo );
- }
+ {
+ URL aTargetURL;
+ Sequence<PropertyValue> aArgs;
+
+ aTargetURL.Complete = ".uno:Notebookbar?File:string=" + aCmd;
+ xURLTransformer->parseStrict( aTargetURL );
+ Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
+ if ( xDispatchProvider.is() )
+ {
+ Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch(
+ aTargetURL, OUString(), 0 );
+
+ ExecuteInfo* pExecuteInfo = new ExecuteInfo;
+ pExecuteInfo->xDispatch = xDispatch;
+ pExecuteInfo->aTargetURL = aTargetURL;
+ pExecuteInfo->aArgs = aArgs;
+ Application::PostUserEvent( LINK(nullptr,ToolbarModeMenuController, ExecuteHdl_Impl), pExecuteInfo );
}
}
+
+ URL aTargetURL;
+ Sequence<PropertyValue> aArgs;
+
+ aTargetURL.Complete = ".uno:ToolbarMode?Mode:string=" + aCmd;
+ xURLTransformer->parseStrict( aTargetURL );
+ Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
+ if ( xDispatchProvider.is() )
+ {
+ Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch(
+ aTargetURL, OUString(), 0 );
+
+ ExecuteInfo* pExecuteInfo = new ExecuteInfo;
+ pExecuteInfo->xDispatch = xDispatch;
+ pExecuteInfo->aTargetURL = aTargetURL;
+ pExecuteInfo->aArgs = aArgs;
+ Application::PostUserEvent( LINK(nullptr, ToolbarModeMenuController, ExecuteHdl_Impl), pExecuteInfo );
+ }
}
void SAL_CALL ToolbarModeMenuController::itemActivated( const css::awt::MenuEvent& )
diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx
index 3640f11f8e7e..d8febf95b4bf 100644
--- a/framework/source/uielement/toolbarsmenucontroller.cxx
+++ b/framework/source/uielement/toolbarsmenucontroller.cxx
@@ -303,157 +303,157 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > co
Reference< XLayoutManager > xLayoutManager( getLayoutManagerFromFrame( m_xFrame ));
m_bResetActive = false;
- if ( xLayoutManager.is() )
- {
- ToolbarHashMap aToolbarHashMap;
+ if ( !xLayoutManager.is() )
+ return;
- if ( m_xDocCfgMgr.is() )
- {
- Sequence< Sequence< css::beans::PropertyValue > > aSeqDocToolBars =
- m_xDocCfgMgr->getUIElementsInfo( UIElementType::TOOLBAR );
- fillHashMap( aSeqDocToolBars, aToolbarHashMap );
- }
+ ToolbarHashMap aToolbarHashMap;
- if ( m_xModuleCfgMgr.is() )
- {
- Sequence< Sequence< css::beans::PropertyValue > > aSeqToolBars =
- m_xModuleCfgMgr->getUIElementsInfo( UIElementType::TOOLBAR );
- fillHashMap( aSeqToolBars, aToolbarHashMap );
- }
+ if ( m_xDocCfgMgr.is() )
+ {
+ Sequence< Sequence< css::beans::PropertyValue > > aSeqDocToolBars =
+ m_xDocCfgMgr->getUIElementsInfo( UIElementType::TOOLBAR );
+ fillHashMap( aSeqDocToolBars, aToolbarHashMap );
+ }
+
+ if ( m_xModuleCfgMgr.is() )
+ {
+ Sequence< Sequence< css::beans::PropertyValue > > aSeqToolBars =
+ m_xModuleCfgMgr->getUIElementsInfo( UIElementType::TOOLBAR );
+ fillHashMap( aSeqToolBars, aToolbarHashMap );
+ }
- std::vector< ToolBarEntry > aSortedTbs;
- OUString aStaticCmdPart( STATIC_CMD_PART );
+ std::vector< ToolBarEntry > aSortedTbs;
+ OUString aStaticCmdPart( STATIC_CMD_PART );
- Sequence< Sequence< css::beans::PropertyValue > > aSeqFrameToolBars = getLayoutManagerToolbars( xLayoutManager );
- fillHashMap( aSeqFrameToolBars, aToolbarHashMap );
+ Sequence< Sequence< css::beans::PropertyValue > > aSeqFrameToolBars = getLayoutManagerToolbars( xLayoutManager );
+ fillHashMap( aSeqFrameToolBars, aToolbarHashMap );
- for (auto const& toolbar : aToolbarHashMap)
+ for (auto const& toolbar : aToolbarHashMap)
+ {
+ OUString aUIName = toolbar.second;
+ bool bHideFromMenu( false );
+ bool bContextSensitive( false );
+ if ( aUIName.isEmpty() &&
+ m_xPersistentWindowState.is() )
{
- OUString aUIName = toolbar.second;
- bool bHideFromMenu( false );
- bool bContextSensitive( false );
- if ( aUIName.isEmpty() &&
- m_xPersistentWindowState.is() )
+ bool bVisible( false );
+
+ try
{
- bool bVisible( false );
+ Sequence< PropertyValue > aWindowState;
+ Any a( m_xPersistentWindowState->getByName( toolbar.first ));
- try
+ if ( a >>= aWindowState )
{
- Sequence< PropertyValue > aWindowState;
- Any a( m_xPersistentWindowState->getByName( toolbar.first ));
-
- if ( a >>= aWindowState )
+ for ( sal_Int32 i = 0; i < aWindowState.getLength(); i++ )
{
- for ( sal_Int32 i = 0; i < aWindowState.getLength(); i++ )
- {
- if ( aWindowState[i].Name == WINDOWSTATE_PROPERTY_UINAME )
- aWindowState[i].Value >>= aUIName;
- else if ( aWindowState[i].Name == WINDOWSTATE_PROPERTY_HIDEFROMENU )
- aWindowState[i].Value >>= bHideFromMenu;
- else if ( aWindowState[i].Name == WINDOWSTATE_PROPERTY_CONTEXT )
- aWindowState[i].Value >>= bContextSensitive;
- else if ( aWindowState[i].Name == WINDOWSTATE_PROPERTY_VISIBLE )
- aWindowState[i].Value >>= bVisible;
- }
+ if ( aWindowState[i].Name == WINDOWSTATE_PROPERTY_UINAME )
+ aWindowState[i].Value >>= aUIName;
+ else if ( aWindowState[i].Name == WINDOWSTATE_PROPERTY_HIDEFROMENU )
+ aWindowState[i].Value >>= bHideFromMenu;
+ else if ( aWindowState[i].Name == WINDOWSTATE_PROPERTY_CONTEXT )
+ aWindowState[i].Value >>= bContextSensitive;
+ else if ( aWindowState[i].Name == WINDOWSTATE_PROPERTY_VISIBLE )
+ aWindowState[i].Value >>= bVisible;
}
}
- catch ( const Exception& )
- {
- }
-
- // Check if we have to enable/disable "Reset" menu item
- if ( bContextSensitive && !bVisible )
- m_bResetActive = true;
-
}
-
- if ( !aUIName.isEmpty() && !bHideFromMenu )
+ catch ( const Exception& )
{
- ToolBarEntry aTbEntry;
- aTbEntry.aUIName = aUIName;
- aTbEntry.aCommand = toolbar.first;
- aTbEntry.bVisible = xLayoutManager->isElementVisible( toolbar.first );
- aTbEntry.bContextSensitive = bContextSensitive;
- aTbEntry.pCollatorWrapper = m_aIntlWrapper.getCaseCollator();
- aSortedTbs.push_back( aTbEntry );
}
+
+ // Check if we have to enable/disable "Reset" menu item
+ if ( bContextSensitive && !bVisible )
+ m_bResetActive = true;
+
}
- // sort toolbars
- std::sort( aSortedTbs.begin(), aSortedTbs.end(), CompareToolBarEntry );
+ if ( !aUIName.isEmpty() && !bHideFromMenu )
+ {
+ ToolBarEntry aTbEntry;
+ aTbEntry.aUIName = aUIName;
+ aTbEntry.aCommand = toolbar.first;
+ aTbEntry.bVisible = xLayoutManager->isElementVisible( toolbar.first );
+ aTbEntry.bContextSensitive = bContextSensitive;
+ aTbEntry.pCollatorWrapper = m_aIntlWrapper.getCaseCollator();
+ aSortedTbs.push_back( aTbEntry );
+ }
+ }
+
+ // sort toolbars
+ std::sort( aSortedTbs.begin(), aSortedTbs.end(), CompareToolBarEntry );
+
+ sal_Int16 nIndex( 1 );
+ const sal_uInt32 nCount = aSortedTbs.size();
+ for ( sal_uInt32 i = 0; i < nCount; i++ )
+ {
+ sal_uInt16 nItemCount = m_xPopupMenu->getItemCount();
+ m_xPopupMenu->insertItem( nIndex, aSortedTbs[i].aUIName, css::awt::MenuItemStyle::CHECKABLE, nItemCount );
+ if ( aSortedTbs[i].bVisible )
+ m_xPopupMenu->checkItem( nIndex, true );
- sal_Int16 nIndex( 1 );
- const sal_uInt32 nCount = aSortedTbs.size();
- for ( sal_uInt32 i = 0; i < nCount; i++ )
{
- sal_uInt16 nItemCount = m_xPopupMenu->getItemCount();
- m_xPopupMenu->insertItem( nIndex, aSortedTbs[i].aUIName, css::awt::MenuItemStyle::CHECKABLE, nItemCount );
- if ( aSortedTbs[i].bVisible )
- m_xPopupMenu->checkItem( nIndex, true );
+ SolarMutexGuard aGuard;
+ VCLXPopupMenu* pXPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( m_xPopupMenu ));
+ PopupMenu* pVCLPopupMenu = pXPopupMenu ? static_cast<PopupMenu *>(pXPopupMenu->GetMenu()) : nullptr;
+ assert(pVCLPopupMenu);
+ if (pVCLPopupMenu)
+ pVCLPopupMenu->SetUserValue( nIndex, reinterpret_cast<void*>( aSortedTbs[i].bContextSensitive ? 1 : 0 ));
+ }
- {
- SolarMutexGuard aGuard;
- VCLXPopupMenu* pXPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( m_xPopupMenu ));
- PopupMenu* pVCLPopupMenu = pXPopupMenu ? static_cast<PopupMenu *>(pXPopupMenu->GetMenu()) : nullptr;
- assert(pVCLPopupMenu);
- if (pVCLPopupMenu)
- pVCLPopupMenu->SetUserValue( nIndex, reinterpret_cast<void*>( aSortedTbs[i].bContextSensitive ? 1 : 0 ));
- }
+ // use VCL popup menu pointer to set vital information that are not part of the awt implementation
+ OUStringBuffer aStrBuf( aStaticCmdPart );
- // use VCL popup menu pointer to set vital information that are not part of the awt implementation
- OUStringBuffer aStrBuf( aStaticCmdPart );
+ sal_Int32 n = aSortedTbs[i].aCommand.lastIndexOf( '/' );
+ if (( n > 0 ) && (( n+1 ) < aSortedTbs[i].aCommand.getLength() ))
+ aStrBuf.append( std::u16string_view(aSortedTbs[i].aCommand).substr(n+1) );
- sal_Int32 n = aSortedTbs[i].aCommand.lastIndexOf( '/' );
- if (( n > 0 ) && (( n+1 ) < aSortedTbs[i].aCommand.getLength() ))
- aStrBuf.append( std::u16string_view(aSortedTbs[i].aCommand).substr(n+1) );
+ OUString aCmd( aStrBuf.makeStringAndClear() );
- OUString aCmd( aStrBuf.makeStringAndClear() );
+ // Store complete uno-command so it can also be dispatched. This is necessary to support
+ // the test tool!
+ rPopupMenu->setCommand( nIndex, aCmd );
+ ++nIndex;
+ }
- // Store complete uno-command so it can also be dispatched. This is necessary to support
- // the test tool!
- rPopupMenu->setCommand( nIndex, aCmd );
- ++nIndex;
- }
+ // Create commands for non-toolbars
- // Create commands for non-toolbars
-
- bool bAddCommand( true );
- SvtCommandOptions aCmdOptions;
+ bool bAddCommand( true );
+ SvtCommandOptions aCmdOptions;
- if ( aCmdOptions.HasEntries( SvtCommandOptions::CMDOPTION_DISABLED ))
- {
- if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED,
- "ConfigureDialog"))
- bAddCommand = false;
- }
+ if ( aCmdOptions.HasEntries( SvtCommandOptions::CMDOPTION_DISABLED ))
+ {
+ if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED,
+ "ConfigureDialog"))
+ bAddCommand = false;
+ }
- if ( bAddCommand )
+ if ( bAddCommand )
+ {
+ // Create command for configure
+ if ( m_xPopupMenu->getItemCount() > 0 )
{
- // Create command for configure
- if ( m_xPopupMenu->getItemCount() > 0 )
- {
- sal_uInt16 nItemCount = m_xPopupMenu->getItemCount();
- m_xPopupMenu->insertSeparator( nItemCount+1 );
- }
-
- addCommand( m_xPopupMenu, ".uno:ConfigureDialog", "" );
+ sal_uInt16 nItemCount = m_xPopupMenu->getItemCount();
+ m_xPopupMenu->insertSeparator( nItemCount+1 );
}
- // Add separator if no configure has been added
- if ( !bAddCommand )
+ addCommand( m_xPopupMenu, ".uno:ConfigureDialog", "" );
+ }
+
+ // Add separator if no configure has been added
+ if ( !bAddCommand )
+ {
+ // Create command for configure
+ if ( m_xPopupMenu->getItemCount() > 0 )
{
- // Create command for configure
- if ( m_xPopupMenu->getItemCount() > 0 )
- {
- sal_uInt16 nItemCount = m_xPopupMenu->getItemCount();
- m_xPopupMenu->insertSeparator( nItemCount+1 );
- }
+ sal_uInt16 nItemCount = m_xPopupMenu->getItemCount();
+ m_xPopupMenu->insertSeparator( nItemCount+1 );
}
-
- OUString aLabelStr(FwkResId(STR_RESTORE_TOOLBARS));
- OUString aRestoreCmd( CMD_RESTOREVISIBILITY );
- addCommand( m_xPopupMenu, aRestoreCmd, aLabelStr );
}
+
+ OUString aLabelStr(FwkResId(STR_RESTORE_TOOLBARS));
+ OUString aRestoreCmd( CMD_RESTOREVISIBILITY );
+ addCommand( m_xPopupMenu, aRestoreCmd, aLabelStr );
}
// XEventListener
@@ -483,43 +483,43 @@ void SAL_CALL ToolbarsMenuController::statusChanged( const FeatureStateEvent& Ev
Reference< css::awt::XPopupMenu > xPopupMenu( m_xPopupMenu );
aLock.clear();
- if ( xPopupMenu.is() )
- {
- SolarMutexGuard aGuard;
- VCLXPopupMenu* pXPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( xPopupMenu ));
- PopupMenu* pVCLPopupMenu = pXPopupMenu ? static_cast<PopupMenu *>(pXPopupMenu->GetMenu()) : nullptr;
+ if ( !xPopupMenu.is() )
+ return;
- SAL_WARN_IF(!pVCLPopupMenu, "fwk.uielement", "worrying lack of popup menu");
- if (!pVCLPopupMenu)
- return;
+ SolarMutexGuard aGuard;
+ VCLXPopupMenu* pXPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( xPopupMenu ));
+ PopupMenu* pVCLPopupMenu = pXPopupMenu ? static_cast<PopupMenu *>(pXPopupMenu->GetMenu()) : nullptr;
- bool bSetCheckmark = false;
- bool bCheckmark = false;
- for ( sal_uInt16 i = 0; i < pVCLPopupMenu->GetItemCount(); i++ )
- {
- sal_uInt16 nId = pVCLPopupMenu->GetItemId( i );
- if ( nId == 0 )
- continue;
+ SAL_WARN_IF(!pVCLPopupMenu, "fwk.uielement", "worrying lack of popup menu");
+ if (!pVCLPopupMenu)
+ return;
- OUString aCmd = pVCLPopupMenu->GetItemCommand( nId );
- if ( aCmd == aFeatureURL )
- {
- // Enable/disable item
- pVCLPopupMenu->EnableItem( nId, Event.IsEnabled );
+ bool bSetCheckmark = false;
+ bool bCheckmark = false;
+ for ( sal_uInt16 i = 0; i < pVCLPopupMenu->GetItemCount(); i++ )
+ {
+ sal_uInt16 nId = pVCLPopupMenu->GetItemId( i );
+ if ( nId == 0 )
+ continue;
- // Checkmark
- if ( Event.State >>= bCheckmark )
- bSetCheckmark = true;
+ OUString aCmd = pVCLPopupMenu->GetItemCommand( nId );
+ if ( aCmd == aFeatureURL )
+ {
+ // Enable/disable item
+ pVCLPopupMenu->EnableItem( nId, Event.IsEnabled );
- if ( bSetCheckmark )
- pVCLPopupMenu->CheckItem( nId, bCheckmark );
- else
- {
- OUString aItemText;
+ // Checkmark
+ if ( Event.State >>= bCheckmark )
+ bSetCheckmark = true;
- if ( Event.State >>= aItemText )
- pVCLPopupMenu->SetItemText( nId, aItemText );
- }
+ if ( bSetCheckmark )
+ pVCLPopupMenu->CheckItem( nId, bCheckmark );
+ else
+ {
+ OUString aItemText;
+
+ if ( Event.State >>= aItemText )
+ pVCLPopupMenu->SetItemText( nId, aItemText );
}
}
}
@@ -543,143 +543,143 @@ void SAL_CALL ToolbarsMenuController::itemSelected( const css::awt::MenuEvent& r
xPersistentWindowState = m_xPersistentWindowState;
}
- if ( xPopupMenu.is() )
+ if ( !xPopupMenu.is() )
+ return;
+
+ VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( xPopupMenu ));
+ if ( !pPopupMenu )
+ return;
+
+ SolarMutexGuard aSolarMutexGuard;
+ PopupMenu* pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
+
+ OUString aCmd( pVCLPopupMenu->GetItemCommand( rEvent.MenuId ));
+ if ( aCmd.startsWith( STATIC_INTERNAL_CMD_PART ) )
{
- VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( xPopupMenu ));
- if ( pPopupMenu )
+ // Command to restore the visibility of all context sensitive toolbars
+ Reference< XNameReplace > xNameReplace( xPersistentWindowState, UNO_QUERY );
+ if ( xPersistentWindowState.is() && xNameReplace.is() )
{
- SolarMutexGuard aSolarMutexGuard;
- PopupMenu* pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu());
-
- OUString aCmd( pVCLPopupMenu->GetItemCommand( rEvent.MenuId ));
- if ( aCmd.startsWith( STATIC_INTERNAL_CMD_PART ) )
+ try
{
- // Command to restore the visibility of all context sensitive toolbars
- Reference< XNameReplace > xNameReplace( xPersistentWindowState, UNO_QUERY );
- if ( xPersistentWindowState.is() && xNameReplace.is() )
+ Sequence< OUString > aElementNames = xPersistentWindowState->getElementNames();
+ sal_Int32 nCount = aElementNames.getLength();
+ bool bRefreshToolbars( false );
+
+ for ( sal_Int32 i = 0; i < nCount; i++ )
{
try
{
- Sequence< OUString > aElementNames = xPersistentWindowState->getElementNames();
- sal_Int32 nCount = aElementNames.getLength();
- bool bRefreshToolbars( false );
+ OUString aElementName = aElementNames[i];
+ Sequence< PropertyValue > aWindowState;
- for ( sal_Int32 i = 0; i < nCount; i++ )
+ if ( xPersistentWindowState->getByName( aElementName ) >>= aWindowState )
{
- try
+ bool bVisible( false );
+ bool bContextSensitive( false );
+ sal_Int32 nVisibleIndex( -1 );
+ for ( sal_Int32 j = 0; j < aWindowState.getLength(); j++ )
{
- OUString aElementName = aElementNames[i];
- Sequence< PropertyValue > aWindowState;
-
- if ( xPersistentWindowState->getByName( aElementName ) >>= aWindowState )
+ if ( aWindowState[j].Name == WINDOWSTATE_PROPERTY_VISIBLE )
{
- bool bVisible( false );
- bool bContextSensitive( false );
- sal_Int32 nVisibleIndex( -1 );
- for ( sal_Int32 j = 0; j < aWindowState.getLength(); j++ )
- {
- if ( aWindowState[j].Name == WINDOWSTATE_PROPERTY_VISIBLE )
- {
- aWindowState[j].Value >>= bVisible;
- nVisibleIndex = j;
- }
- else if ( aWindowState[j].Name == WINDOWSTATE_PROPERTY_CONTEXT )
- aWindowState[j].Value >>= bContextSensitive;
- }
-
- if ( !bVisible && bContextSensitive && nVisibleIndex >= 0 )
- {
- // Default is: Every context sensitive toolbar is visible
- aWindowState[nVisibleIndex].Value <<= true;
- xNameReplace->replaceByName( aElementName, makeAny( aWindowState ));
- bRefreshToolbars = true;
- }
+ aWindowState[j].Value >>= bVisible;
+ nVisibleIndex = j;
}
+ else if ( aWindowState[j].Name == WINDOWSTATE_PROPERTY_CONTEXT )
+ aWindowState[j].Value >>= bContextSensitive;
}
- catch ( const NoSuchElementException& )
- {
- }
- }
- if ( bRefreshToolbars )
- {
- Reference< XLayoutManager > xLayoutManager( getLayoutManagerFromFrame( xFrame ));
- if ( xLayoutManager.is() )
+ if ( !bVisible && bContextSensitive && nVisibleIndex >= 0 )
{
- Reference< XPropertySet > xPropSet( xLayoutManager, UNO_QUERY );
- if ( xPropSet.is() )
- {
- try
- {
- xPropSet->setPropertyValue("RefreshContextToolbarVisibility", makeAny( true ));
- }
- catch ( const RuntimeException& )
- {
- }
- catch ( const Exception& )
- {
- }
- }
+ // Default is: Every context sensitive toolbar is visible
+ aWindowState[nVisibleIndex].Value <<= true;
+ xNameReplace->replaceByName( aElementName, makeAny( aWindowState ));
+ bRefreshToolbars = true;
}
- RefreshToolbars( xFrame );
}
}
- catch ( const RuntimeException& )
+ catch ( const NoSuchElementException& )
{
- throw;
}
- catch ( const Exception& )
+ }
+
+ if ( bRefreshToolbars )
+ {
+ Reference< XLayoutManager > xLayoutManager( getLayoutManagerFromFrame( xFrame ));
+ if ( xLayoutManager.is() )
{
+ Reference< XPropertySet > xPropSet( xLayoutManager, UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ try
+ {
+ xPropSet->setPropertyValue("RefreshContextToolbarVisibility", makeAny( true ));
+ }
+ catch ( const RuntimeException& )
+ {
+ }
+ catch ( const Exception& )
+ {
+ }
+ }
}
+ RefreshToolbars( xFrame );
}
}
- else if ( aCmd.indexOf( STATIC_CMD_PART ) < 0 )
+ catch ( const RuntimeException& )
+ {
+ throw;
+ }
+ catch ( const Exception& )
+ {
+ }
+ }
+ }
+ else if ( aCmd.indexOf( STATIC_CMD_PART ) < 0 )
+ {
+ URL aTargetURL;
+ Sequence<PropertyValue> aArgs;
+
+ aTargetURL.Complete = aCmd;
+ xURLTransformer->parseStrict( aTargetURL );
+ Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
+ if ( xDispatchProvider.is() )
+ {
+ Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch(
+ aTargetURL, OUString(), 0 );
+
+ ExecuteInfo* pExecuteInfo = new ExecuteInfo;
+ pExecuteInfo->xDispatch = xDispatch;
+ pExecuteInfo->aTargetURL = aTargetURL;
+ pExecuteInfo->aArgs = aArgs;
+ Application::PostUserEvent( LINK(nullptr, ToolbarsMenuController, ExecuteHdl_Impl), pExecuteInfo );
+ }
+ }
+ else
+ {
+ Reference< XLayoutManager > xLayoutManager( getLayoutManagerFromFrame( xFrame ));
+ if ( xLayoutManager.is() )
+ {
+ // Extract toolbar name from the combined uno-command.
+ sal_Int32 nIndex = aCmd.indexOf( '=' );
+ if (( nIndex > 0 ) && (( nIndex+1 ) < aCmd.getLength() ))
{
- URL aTargetURL;
- Sequence<PropertyValue> aArgs;
+ OUStringBuffer aBuf( "private:resource/toolbar/" );
+ aBuf.append( std::u16string_view(aCmd).substr(nIndex+1) );
- aTargetURL.Complete = aCmd;
- xURLTransformer->parseStrict( aTargetURL );
- Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY );
- if ( xDispatchProvider.is() )
+ bool bShow( !pVCLPopupMenu->IsItemChecked( rEvent.MenuId ));
+ OUString aToolBarResName( aBuf.makeStringAndClear() );
+ if ( bShow )
{
- Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch(
- aTargetURL, OUString(), 0 );
-
- ExecuteInfo* pExecuteInfo = new ExecuteInfo;
- pExecuteInfo->xDispatch = xDispatch;
- pExecuteInfo->aTargetURL = aTargetURL;
- pExecuteInfo->aArgs = aArgs;
- Application::PostUserEvent( LINK(nullptr, ToolbarsMenuController, ExecuteHdl_Impl), pExecuteInfo );
+ xLayoutManager->createElement( aToolBarResName );
+ xLayoutManager->showElement( aToolBarResName );
}
- }
- else
- {
- Reference< XLayoutManager > xLayoutManager( getLayoutManagerFromFrame( xFrame ));
- if ( xLayoutManager.is() )
+ else
{
- // Extract toolbar name from the combined uno-command.
- sal_Int32 nIndex = aCmd.indexOf( '=' );
- if (( nIndex > 0 ) && (( nIndex+1 ) < aCmd.getLength() ))
- {
- OUStringBuffer aBuf( "private:resource/toolbar/" );
- aBuf.append( std::u16string_view(aCmd).substr(nIndex+1) );
-
- bool bShow( !pVCLPopupMenu->IsItemChecked( rEvent.MenuId ));
- OUString aToolBarResName( aBuf.makeStringAndClear() );
- if ( bShow )
- {
- xLayoutManager->createElement( aToolBarResName );
- xLayoutManager->showElement( aToolBarResName );
- }
- else
- {
- // closing means:
- // hide and destroy element
- xLayoutManager->hideElement( aToolBarResName );
- xLayoutManager->destroyElement( aToolBarResName );
- }
- }
+ // closing means:
+ // hide and destroy element
+ xLayoutManager->hideElement( aToolBarResName );
+ xLayoutManager->destroyElement( aToolBarResName );
}
}
}
@@ -749,42 +749,42 @@ void SAL_CALL ToolbarsMenuController::initialize( const Sequence< Any >& aArgume
{
osl::MutexGuard aLock( m_aMutex );
bool bInitalized( m_bInitialized );
- if ( !bInitalized )
- {
- svt::PopupMenuControllerBase::initialize(aArguments);
+ if ( bInitalized )
+ return;
- if ( m_bInitialized )
- {
- Reference< XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext );
- Reference< XNameAccess > xPersistentWindowStateSupplier = css::ui::theWindowStateConfiguration::get( m_xContext );
+ svt::PopupMenuControllerBase::initialize(aArguments);
- // Retrieve persistent window state reference for our module
- OUString aModuleIdentifier;
- try
- {
- aModuleIdentifier = xModuleManager->identify( m_xFrame );
- xPersistentWindowStateSupplier->getByName( aModuleIdentifier ) >>= m_xPersistentWindowState;
-
- Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier =
- theModuleUIConfigurationManagerSupplier::get( m_xContext );
- m_xModuleCfgMgr = xModuleCfgSupplier->getUIConfigurationManager( aModuleIdentifier );
-
- Reference< XController > xController = m_xFrame->getController();
- Reference< XModel > xModel;
- if ( xController.is() )
- xModel = xController->getModel();
- if ( xModel.is() )
- {
- Reference< XUIConfigurationManagerSupplier > xUIConfigurationManagerSupplier( xModel, UNO_QUERY );
- if ( xUIConfigurationManagerSupplier.is() )
- m_xDocCfgMgr = xUIConfigurationManagerSupplier->getUIConfigurationManager();
- }
- }
- catch ( const Exception& )
- {
- }
+ if ( !m_bInitialized )
+ return;
+
+ Reference< XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext );
+ Reference< XNameAccess > xPersistentWindowStateSupplier = css::ui::theWindowStateConfiguration::get( m_xContext );
+
+ // Retrieve persistent window state reference for our module
+ OUString aModuleIdentifier;
+ try
+ {
+ aModuleIdentifier = xModuleManager->identify( m_xFrame );
+ xPersistentWindowStateSupplier->getByName( aModuleIdentifier ) >>= m_xPersistentWindowState;
+
+ Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier =
+ theModuleUIConfigurationManagerSupplier::get( m_xContext );
+ m_xModuleCfgMgr = xModuleCfgSupplier->getUIConfigurationManager( aModuleIdentifier );
+
+ Reference< XController > xController = m_xFrame->getController();
+ Reference< XModel > xModel;
+ if ( xController.is() )
+ xModel = xController->getModel();
+ if ( xModel.is() )
+ {
+ Reference< XUIConfigurationManagerSupplier > xUIConfigurationManagerSupplier( xModel, UNO_QUERY );
+ if ( xUIConfigurationManagerSupplier.is() )
+ m_xDocCfgMgr = xUIConfigurationManagerSupplier->getUIConfigurationManager();
}
}
+ catch ( const Exception& )
+ {
+ }
}
IMPL_STATIC_LINK( ToolbarsMenuController, ExecuteHdl_Impl, void*, p, void )
diff --git a/framework/source/uielement/toolbarwrapper.cxx b/framework/source/uielement/toolbarwrapper.cxx
index fec3138dc78e..3e1706ed0b17 100644
--- a/framework/source/uielement/toolbarwrapper.cxx
+++ b/framework/source/uielement/toolbarwrapper.cxx
@@ -108,77 +108,77 @@ void SAL_CALL ToolBarWrapper::initialize( const Sequence< Any >& aArguments )
if ( m_bDisposed )
throw DisposedException();
- if ( !m_bInitialized )
+ if ( m_bInitialized )
+ return;
+
+ UIConfigElementWrapperBase::initialize( aArguments );
+
+ bool bPopupMode( false );
+ Reference< XWindow > xParentWindow;
+ for ( sal_Int32 i = 0; i < aArguments.getLength(); i++ )
{
- UIConfigElementWrapperBase::initialize( aArguments );
+ PropertyValue aPropValue;
+ if ( aArguments[i] >>= aPropValue )
+ {
+ if ( aPropValue.Name == "PopupMode" )
+ aPropValue.Value >>= bPopupMode;
+ else if ( aPropValue.Name == "ParentWindow" )
+ xParentWindow.set( aPropValue.Value, UNO_QUERY );
+ }
+ }
+
+ Reference< XFrame > xFrame( m_xWeakFrame );
+ if ( !(xFrame.is() && m_xConfigSource.is()) )
+ return;
- bool bPopupMode( false );
- Reference< XWindow > xParentWindow;
- for ( sal_Int32 i = 0; i < aArguments.getLength(); i++ )
+ // Create VCL based toolbar which will be filled with settings data
+ VclPtr<ToolBox> pToolBar;
+ ToolBarManager* pToolBarManager = nullptr;
+ {
+ SolarMutexGuard aSolarMutexGuard;
+ if ( !xParentWindow.is() )
+ xParentWindow.set( xFrame->getContainerWindow() );
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xParentWindow );
+ if ( pWindow )
{
- PropertyValue aPropValue;
- if ( aArguments[i] >>= aPropValue )
- {
- if ( aPropValue.Name == "PopupMode" )
- aPropValue.Value >>= bPopupMode;
- else if ( aPropValue.Name == "ParentWindow" )
- xParentWindow.set( aPropValue.Value, UNO_QUERY );
- }
+ sal_uLong nStyles = WB_BORDER | WB_SCROLL | WB_MOVEABLE | WB_3DLOOK | WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE;
+
+ pToolBar = VclPtr<ToolBox>::Create( pWindow, nStyles );
+ pToolBar->SetLineSpacing(true);
+ pToolBarManager = new ToolBarManager( m_xContext, xFrame, m_aResourceURL, pToolBar );
+ m_xToolBarManager.set( static_cast< OWeakObject *>( pToolBarManager ), UNO_QUERY );
+ pToolBar->WillUsePopupMode( bPopupMode );
}
+ }
- Reference< XFrame > xFrame( m_xWeakFrame );
- if ( xFrame.is() && m_xConfigSource.is() )
+ try
+ {
+ m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL, false );
+ if ( m_xConfigData.is() && pToolBar && pToolBarManager )
{
- // Create VCL based toolbar which will be filled with settings data
- VclPtr<ToolBox> pToolBar;
- ToolBarManager* pToolBarManager = nullptr;
- {
- SolarMutexGuard aSolarMutexGuard;
- if ( !xParentWindow.is() )
- xParentWindow.set( xFrame->getContainerWindow() );
- VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xParentWindow );
- if ( pWindow )
- {
- sal_uLong nStyles = WB_BORDER | WB_SCROLL | WB_MOVEABLE | WB_3DLOOK | WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE;
-
- pToolBar = VclPtr<ToolBox>::Create( pWindow, nStyles );
- pToolBar->SetLineSpacing(true);
- pToolBarManager = new ToolBarManager( m_xContext, xFrame, m_aResourceURL, pToolBar );
- m_xToolBarManager.set( static_cast< OWeakObject *>( pToolBarManager ), UNO_QUERY );
- pToolBar->WillUsePopupMode( bPopupMode );
- }
- }
-
- try
- {
- m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL, false );
- if ( m_xConfigData.is() && pToolBar && pToolBarManager )
- {
- // Fill toolbar with container contents
- pToolBarManager->FillToolbar( m_xConfigData );
- pToolBar->SetOutStyle( SvtMiscOptions().GetToolboxStyle() );
- pToolBar->EnableCustomize();
- ::Size aActSize( pToolBar->GetSizePixel() );
- ::Size aSize( pToolBar->CalcWindowSizePixel() );
- aSize.setWidth( aActSize.Width() );
- pToolBar->SetOutputSizePixel( aSize );
- }
- }
- catch ( const NoSuchElementException& )
- {
- // No settings in our configuration manager. This means we are
- // a transient toolbar which has no persistent settings.
- m_bPersistent = false;
- if ( pToolBar && pToolBarManager )
- {
- pToolBar->SetOutStyle( SvtMiscOptions().GetToolboxStyle() );
- pToolBar->EnableCustomize();
- ::Size aActSize( pToolBar->GetSizePixel() );
- ::Size aSize( pToolBar->CalcWindowSizePixel() );
- aSize.setWidth( aActSize.Width() );
- pToolBar->SetOutputSizePixel( aSize );
- }
- }
+ // Fill toolbar with container contents
+ pToolBarManager->FillToolbar( m_xConfigData );
+ pToolBar->SetOutStyle( SvtMiscOptions().GetToolboxStyle() );
+ pToolBar->EnableCustomize();
+ ::Size aActSize( pToolBar->GetSizePixel() );
+ ::Size aSize( pToolBar->CalcWindowSizePixel() );
+ aSize.setWidth( aActSize.Width() );
+ pToolBar->SetOutputSizePixel( aSize );
+ }
+ }
+ catch ( const NoSuchElementException& )
+ {
+ // No settings in our configuration manager. This means we are
+ // a transient toolbar which has no persistent settings.
+ m_bPersistent = false;
+ if ( pToolBar && pToolBarManager )
+ {
+ pToolBar->SetOutStyle( SvtMiscOptions().GetToolboxStyle() );
+ pToolBar->EnableCustomize();
+ ::Size aActSize( pToolBar->GetSizePixel() );
+ ::Size aSize( pToolBar->CalcWindowSizePixel() );
+ aSize.setWidth( aActSize.Width() );
+ pToolBar->SetOutputSizePixel( aSize );
}
}
}
@@ -210,27 +210,27 @@ void SAL_CALL ToolBarWrapper::updateSettings()
if ( m_bDisposed )
throw DisposedException();
- if ( m_xToolBarManager.is() )
+ if ( !m_xToolBarManager.is() )
+ return;
+
+ if ( m_xConfigSource.is() && m_bPersistent )
{
- if ( m_xConfigSource.is() && m_bPersistent )
+ try
{
- try
- {
- ToolBarManager* pToolBarManager = static_cast< ToolBarManager *>( m_xToolBarManager.get() );
-
- m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL, false );
- if ( m_xConfigData.is() )
- pToolBarManager->FillToolbar( m_xConfigData );
- }
- catch ( const NoSuchElementException& )
- {
- }
+ ToolBarManager* pToolBarManager = static_cast< ToolBarManager *>( m_xToolBarManager.get() );
+
+ m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL, false );
+ if ( m_xConfigData.is() )
+ pToolBarManager->FillToolbar( m_xConfigData );
}
- else if ( !m_bPersistent )
+ catch ( const NoSuchElementException& )
{
- // Transient toolbar: do nothing
}
}
+ else if ( !m_bPersistent )
+ {
+ // Transient toolbar: do nothing
+ }
}
void ToolBarWrapper::impl_fillNewData()
@@ -285,26 +285,26 @@ void SAL_CALL ToolBarWrapper::setFastPropertyValue_NoBroadcast( sal_Int32 nHandl
aLock.reset();
bool bNewNoClose( m_bNoClose );
- if ( m_xToolBarManager.is() && !m_bDisposed && ( bNewNoClose != bNoClose ))
+ if ( !(m_xToolBarManager.is() && !m_bDisposed && ( bNewNoClose != bNoClose )))
+ return;
+
+ ToolBarManager* pToolBarManager = static_cast< ToolBarManager *>( m_xToolBarManager.get() );
+ if ( !pToolBarManager )
+ return;
+
+ ToolBox* pToolBox = pToolBarManager->GetToolBar();
+ if ( !pToolBox )
+ return;
+
+ if ( bNewNoClose )
{
- ToolBarManager* pToolBarManager = static_cast< ToolBarManager *>( m_xToolBarManager.get() );
- if ( pToolBarManager )
- {
- ToolBox* pToolBox = pToolBarManager->GetToolBar();
- if ( pToolBox )
- {
- if ( bNewNoClose )
- {
- pToolBox->SetStyle( pToolBox->GetStyle() & ~WB_CLOSEABLE );
- pToolBox->SetFloatStyle( pToolBox->GetFloatStyle() & ~WB_CLOSEABLE );
- }
- else
- {
- pToolBox->SetStyle( pToolBox->GetStyle() | WB_CLOSEABLE );
- pToolBox->SetFloatStyle( pToolBox->GetFloatStyle() | WB_CLOSEABLE );
- }
- }
- }
+ pToolBox->SetStyle( pToolBox->GetStyle() & ~WB_CLOSEABLE );
+ pToolBox->SetFloatStyle( pToolBox->GetFloatStyle() & ~WB_CLOSEABLE );
+ }
+ else
+ {
+ pToolBox->SetStyle( pToolBox->GetStyle() | WB_CLOSEABLE );
+ pToolBox->SetFloatStyle( pToolBox->GetFloatStyle() | WB_CLOSEABLE );
}
}
diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx
index 77b8e13193f0..d81591ac3876 100644
--- a/framework/source/uielement/uicommanddescription.cxx
+++ b/framework/source/uielement/uicommanddescription.cxx
@@ -286,45 +286,45 @@ void ConfigurationAccess_UICommand::impl_fill(const Reference< XNameAccess >& _x
std::vector< OUString >& aImageRotateVector,
std::vector< OUString >& aImageMirrorVector)
{
- if ( _xConfigAccess.is() )
+ if ( !_xConfigAccess.is() )
+ return;
+
+ Sequence< OUString> aNameSeq = _xConfigAccess->getElementNames();
+ const sal_Int32 nCount = aNameSeq.getLength();
+ for ( sal_Int32 i = 0; i < nCount; i++ )
{
- Sequence< OUString> aNameSeq = _xConfigAccess->getElementNames();
- const sal_Int32 nCount = aNameSeq.getLength();
- for ( sal_Int32 i = 0; i < nCount; i++ )
+ try
{
- try
- {
- Reference< XNameAccess > xNameAccess(_xConfigAccess->getByName( aNameSeq[i] ),UNO_QUERY);
- if ( xNameAccess.is() )
- {
- CmdToInfoMap aCmdToInfo;
-
- aCmdToInfo.bPopup = _bPopup;
- xNameAccess->getByName( "Label" ) >>= aCmdToInfo.aLabel;
- xNameAccess->getByName( "ContextLabel" ) >>= aCmdToInfo.aContextLabel;
- xNameAccess->getByName( "PopupLabel" ) >>= aCmdToInfo.aPopupLabel;
- xNameAccess->getByName( "TooltipLabel" ) >>= aCmdToInfo.aTooltipLabel;
- xNameAccess->getByName( "TargetURL" ) >>= aCmdToInfo.aTargetURL;
- xNameAccess->getByName( "IsExperimental" ) >>= aCmdToInfo.bIsExperimental;
- xNameAccess->getByName( m_aPropProperties ) >>= aCmdToInfo.nProperties;
-
- m_aCmdInfoCache.emplace( aNameSeq[i], aCmdToInfo );
-
- if ( aCmdToInfo.nProperties & COMMAND_PROPERTY_IMAGE )
- aImageCommandVector.push_back( aNameSeq[i] );
- if ( aCmdToInfo.nProperties & COMMAND_PROPERTY_ROTATE )
- aImageRotateVector.push_back( aNameSeq[i] );
- if ( aCmdToInfo.nProperties & COMMAND_PROPERTY_MIRROR )
- aImageMirrorVector.push_back( aNameSeq[i] );
- }
- }
- catch (const css::lang::WrappedTargetException&)
- {
- }
- catch (const css::container::NoSuchElementException&)
+ Reference< XNameAccess > xNameAccess(_xConfigAccess->getByName( aNameSeq[i] ),UNO_QUERY);
+ if ( xNameAccess.is() )
{
+ CmdToInfoMap aCmdToInfo;
+
+ aCmdToInfo.bPopup = _bPopup;
+ xNameAccess->getByName( "Label" ) >>= aCmdToInfo.aLabel;
+ xNameAccess->getByName( "ContextLabel" ) >>= aCmdToInfo.aContextLabel;
+ xNameAccess->getByName( "PopupLabel" ) >>= aCmdToInfo.aPopupLabel;
+ xNameAccess->getByName( "TooltipLabel" ) >>= aCmdToInfo.aTooltipLabel;
+ xNameAccess->getByName( "TargetURL" ) >>= aCmdToInfo.aTargetURL;
+ xNameAccess->getByName( "IsExperimental" ) >>= aCmdToInfo.bIsExperimental;
+ xNameAccess->getByName( m_aPropProperties ) >>= aCmdToInfo.nProperties;
+
+ m_aCmdInfoCache.emplace( aNameSeq[i], aCmdToInfo );
+
+ if ( aCmdToInfo.nProperties & COMMAND_PROPERTY_IMAGE )
+ aImageCommandVector.push_back( aNameSeq[i] );
+ if ( aCmdToInfo.nProperties & COMMAND_PROPERTY_ROTATE )
+ aImageRotateVector.push_back( aNameSeq[i] );
+ if ( aCmdToInfo.nProperties & COMMAND_PROPERTY_MIRROR )
+ aImageMirrorVector.push_back( aNameSeq[i] );
}
}
+ catch (const css::lang::WrappedTargetException&)
+ {
+ }
+ catch (const css::container::NoSuchElementException&)
+ {
+ }
}
}
void ConfigurationAccess_UICommand::fillCache()
@@ -349,39 +349,39 @@ void ConfigurationAccess_UICommand::fillCache()
void ConfigurationAccess_UICommand::addGenericInfoToCache()
{
- if ( m_xGenericUICommands.is() && !m_bGenericDataRetrieved )
- {
- Sequence< OUString > aCommandNameSeq;
- try
- {
- if ( m_xGenericUICommands->getByName(
- UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDROTATEIMAGELIST ) >>= aCommandNameSeq )
- m_aCommandRotateImageList = comphelper::concatSequences< OUString >( m_aCommandRotateImageList, aCommandNameSeq );
- }
- catch (const RuntimeException&)
- {
- throw;
- }
- catch (const Exception&)
- {
- }
+ if ( !(m_xGenericUICommands.is() && !m_bGenericDataRetrieved) )
+ return;
- try
- {
- if ( m_xGenericUICommands->getByName(
- UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDMIRRORIMAGELIST ) >>= aCommandNameSeq )
- m_aCommandMirrorImageList = comphelper::concatSequences< OUString >( m_aCommandMirrorImageList, aCommandNameSeq );
- }
- catch (const RuntimeException&)
- {
- throw;
- }
- catch (const Exception&)
- {
- }
+ Sequence< OUString > aCommandNameSeq;
+ try
+ {
+ if ( m_xGenericUICommands->getByName(
+ UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDROTATEIMAGELIST ) >>= aCommandNameSeq )
+ m_aCommandRotateImageList = comphelper::concatSequences< OUString >( m_aCommandRotateImageList, aCommandNameSeq );
+ }
+ catch (const RuntimeException&)
+ {
+ throw;
+ }
+ catch (const Exception&)
+ {
+ }
- m_bGenericDataRetrieved = true;
+ try
+ {
+ if ( m_xGenericUICommands->getByName(
+ UICOMMANDDESCRIPTION_NAMEACCESS_COMMANDMIRRORIMAGELIST ) >>= aCommandNameSeq )
+ m_aCommandMirrorImageList = comphelper::concatSequences< OUString >( m_aCommandMirrorImageList, aCommandNameSeq );
}
+ catch (const RuntimeException&)
+ {
+ throw;
+ }
+ catch (const Exception&)
+ {
+ }
+
+ m_bGenericDataRetrieved = true;
}
Any ConfigurationAccess_UICommand::getInfoFromCommand( const OUString& rCommandURL )
diff --git a/framework/source/uifactory/factoryconfiguration.cxx b/framework/source/uifactory/factoryconfiguration.cxx
index 421ae5034e75..f67cea50d3db 100644
--- a/framework/source/uifactory/factoryconfiguration.cxx
+++ b/framework/source/uifactory/factoryconfiguration.cxx
@@ -201,56 +201,56 @@ void ConfigurationAccess_ControllerFactory::readConfigurationData()
m_bConfigAccessInitialized = true;
}
- if ( m_xConfigAccess.is() )
- {
- // Read and update configuration data
- updateConfigurationData();
+ if ( !m_xConfigAccess.is() )
+ return;
- uno::Reference< container::XContainer > xContainer( m_xConfigAccess, uno::UNO_QUERY );
- // UNSAFE
- aLock.clear();
+ // Read and update configuration data
+ updateConfigurationData();
- if ( xContainer.is() )
- {
- m_xConfigAccessListener = new WeakContainerListener(this);
- xContainer->addContainerListener(m_xConfigAccessListener);
- }
+ uno::Reference< container::XContainer > xContainer( m_xConfigAccess, uno::UNO_QUERY );
+ // UNSAFE
+ aLock.clear();
+
+ if ( xContainer.is() )
+ {
+ m_xConfigAccessListener = new WeakContainerListener(this);
+ xContainer->addContainerListener(m_xConfigAccessListener);
}
}
void ConfigurationAccess_ControllerFactory::updateConfigurationData()
{
osl::MutexGuard g(m_mutex);
- if ( m_xConfigAccess.is() )
- {
- Sequence< OUString > aPopupMenuControllers = m_xConfigAccess->getElementNames();
+ if ( !m_xConfigAccess.is() )
+ return;
+
+ Sequence< OUString > aPopupMenuControllers = m_xConfigAccess->getElementNames();
- OUString aCommand;
- OUString aModule;
- OUString aService;
- OUString aHashKey;
- OUString aValue;
+ OUString aCommand;
+ OUString aModule;
+ OUString aService;
+ OUString aHashKey;
+ OUString aValue;
- m_aMenuControllerMap.clear();
- for ( sal_Int32 i = 0; i < aPopupMenuControllers.getLength(); i++ )
+ m_aMenuControllerMap.clear();
+ for ( sal_Int32 i = 0; i < aPopupMenuControllers.getLength(); i++ )
+ {
+ try
{
- try
- {
- if ( impl_getElementProps( m_xConfigAccess->getByName( aPopupMenuControllers[i] ), aCommand, aModule, aService,aValue ))
- {
- // Create hash key from command and module as they are together a primary key to
- // the UNO service that implements the popup menu controller.
- aHashKey = getHashKeyFromStrings( aCommand, aModule );
- m_aMenuControllerMap.emplace( aHashKey, ControllerInfo(aService,aValue) );
- }
- }
- catch ( const NoSuchElementException& )
- {
- }
- catch ( const WrappedTargetException& )
+ if ( impl_getElementProps( m_xConfigAccess->getByName( aPopupMenuControllers[i] ), aCommand, aModule, aService,aValue ))
{
+ // Create hash key from command and module as they are together a primary key to
+ // the UNO service that implements the popup menu controller.
+ aHashKey = getHashKeyFromStrings( aCommand, aModule );
+ m_aMenuControllerMap.emplace( aHashKey, ControllerInfo(aService,aValue) );
}
}
+ catch ( const NoSuchElementException& )
+ {
+ }
+ catch ( const WrappedTargetException& )
+ {
+ }
}
}
diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx
index 5794fb044b0f..e58493e8f7e3 100644
--- a/framework/source/uifactory/uielementfactorymanager.cxx
+++ b/framework/source/uifactory/uielementfactorymanager.cxx
@@ -276,32 +276,32 @@ void ConfigurationAccess_FactoryManager::readConfigurationData()
m_bConfigAccessInitialized = true;
}
- if ( m_xConfigAccess.is() )
+ if ( !m_xConfigAccess.is() )
+ return;
+
+ Sequence< OUString > aUIElementFactories = m_xConfigAccess->getElementNames();
+
+ OUString aType;
+ OUString aName;
+ OUString aModule;
+ OUString aService;
+ OUString aHashKey;
+ for ( sal_Int32 i = 0; i < aUIElementFactories.getLength(); i++ )
{
- Sequence< OUString > aUIElementFactories = m_xConfigAccess->getElementNames();
-
- OUString aType;
- OUString aName;
- OUString aModule;
- OUString aService;
- OUString aHashKey;
- for ( sal_Int32 i = 0; i < aUIElementFactories.getLength(); i++ )
+ if ( impl_getElementProps( m_xConfigAccess->getByName( aUIElementFactories[i] ), aType, aName, aModule, aService ))
{
- if ( impl_getElementProps( m_xConfigAccess->getByName( aUIElementFactories[i] ), aType, aName, aModule, aService ))
- {
- // Create hash key from type, name and module as they are together a primary key to
- // the UNO service that implements the user interface element factory.
- aHashKey = getHashKeyFromStrings( aType, aName, aModule );
- m_aFactoryManagerMap.emplace( aHashKey, aService );
- }
+ // Create hash key from type, name and module as they are together a primary key to
+ // the UNO service that implements the user interface element factory.
+ aHashKey = getHashKeyFromStrings( aType, aName, aModule );
+ m_aFactoryManagerMap.emplace( aHashKey, aService );
}
+ }
- Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY );
- if ( xContainer.is() )
- {
- m_xConfigListener = new WeakContainerListener(this);
- xContainer->addContainerListener(m_xConfigListener);
- }
+ Reference< XContainer > xContainer( m_xConfigAccess, UNO_QUERY );
+ if ( xContainer.is() )
+ {
+ m_xConfigListener = new WeakContainerListener(this);
+ xContainer->addContainerListener(m_xConfigListener);
}
}
diff --git a/framework/source/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx
index 45a5387186b9..51352b0296d4 100644
--- a/framework/source/xml/imagesdocumenthandler.cxx
+++ b/framework/source/xml/imagesdocumenthandler.cxx
@@ -144,87 +144,87 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
SolarMutexGuard g;
ImageHashMap::const_iterator pImageEntry = m_aImageMap.find( aName );
- if ( pImageEntry != m_aImageMap.end() )
+ if ( pImageEntry == m_aImageMap.end() )
+ return;
+
+ switch ( pImageEntry->second )
{
- switch ( pImageEntry->second )
+ case IMG_ELEMENT_IMAGECONTAINER:
{
- case IMG_ELEMENT_IMAGECONTAINER:
+ // image:imagecontainer element (container element for all further image elements)
+ if ( m_bImageContainerStartFound )
{
- // image:imagecontainer element (container element for all further image elements)
- if ( m_bImageContainerStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "Element 'image:imagecontainer' cannot be embedded into 'image:imagecontainer'!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
-
- m_bImageContainerStartFound = true;
+ OUString aErrorMessage = getErrorLineString() + "Element 'image:imagecontainer' cannot be embedded into 'image:imagecontainer'!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
- case IMG_ELEMENT_IMAGES:
- {
- if ( !m_bImageContainerStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "Element 'image:images' must be embedded into element 'image:imagecontainer'!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ m_bImageContainerStartFound = true;
+ }
+ break;
- if ( m_bImagesStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "Element 'image:images' cannot be embedded into 'image:images'!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ case IMG_ELEMENT_IMAGES:
+ {
+ if ( !m_bImageContainerStartFound )
+ {
+ OUString aErrorMessage = getErrorLineString() + "Element 'image:images' must be embedded into element 'image:imagecontainer'!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
+ }
- m_bImagesStartFound = true;
+ if ( m_bImagesStartFound )
+ {
+ OUString aErrorMessage = getErrorLineString() + "Element 'image:images' cannot be embedded into 'image:images'!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
- case IMG_ELEMENT_ENTRY:
+ m_bImagesStartFound = true;
+ }
+ break;
+
+ case IMG_ELEMENT_ENTRY:
+ {
+ // Check that image:entry is embedded into image:images!
+ if ( !m_bImagesStartFound )
{
- // Check that image:entry is embedded into image:images!
- if ( !m_bImagesStartFound )
- {
- OUString aErrorMessage = getErrorLineString() + "Element 'image:entry' must be embedded into element 'image:images'!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
+ OUString aErrorMessage = getErrorLineString() + "Element 'image:entry' must be embedded into element 'image:images'!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
+ }
- // Create new image item descriptor
- ImageItemDescriptor aItem;
+ // Create new image item descriptor
+ ImageItemDescriptor aItem;
- // Read attributes for this image definition
- for ( sal_Int16 n = 0; n < xAttribs->getLength(); n++ )
+ // Read attributes for this image definition
+ for ( sal_Int16 n = 0; n < xAttribs->getLength(); n++ )
+ {
+ pImageEntry = m_aImageMap.find( xAttribs->getNameByIndex( n ) );
+ if ( pImageEntry != m_aImageMap.end() )
{
- pImageEntry = m_aImageMap.find( xAttribs->getNameByIndex( n ) );
- if ( pImageEntry != m_aImageMap.end() )
+ switch ( pImageEntry->second )
{
- switch ( pImageEntry->second )
+ case IMG_ATTRIBUTE_COMMAND:
{
- case IMG_ATTRIBUTE_COMMAND:
- {
- aItem.aCommandURL = xAttribs->getValueByIndex( n );
- }
- break;
-
- default:
- break;
+ aItem.aCommandURL = xAttribs->getValueByIndex( n );
}
- }
- }
+ break;
- // Check required attribute "command"
- if ( aItem.aCommandURL.isEmpty() )
- {
- OUString aErrorMessage = getErrorLineString() + "Required attribute 'image:command' must have a value!";
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
+ default:
+ break;
+ }
}
+ }
- m_rImageList.push_back( aItem );
+ // Check required attribute "command"
+ if ( aItem.aCommandURL.isEmpty() )
+ {
+ OUString aErrorMessage = getErrorLineString() + "Required attribute 'image:command' must have a value!";
+ throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- break;
- default:
- break;
+ m_rImageList.push_back( aItem );
}
+ break;
+
+ default:
+ break;
}
}
@@ -233,24 +233,24 @@ void SAL_CALL OReadImagesDocumentHandler::endElement(const OUString& aName)
SolarMutexGuard g;
ImageHashMap::const_iterator pImageEntry = m_aImageMap.find( aName );
- if ( pImageEntry != m_aImageMap.end() )
+ if ( pImageEntry == m_aImageMap.end() )
+ return;
+
+ switch ( pImageEntry->second )
{
- switch ( pImageEntry->second )
+ case IMG_ELEMENT_IMAGECONTAINER:
{
- case IMG_ELEMENT_IMAGECONTAINER:
- {
- m_bImageContainerEndFound = true;
- }
- break;
-
- case IMG_ELEMENT_IMAGES:
- {
- m_bImagesStartFound = false;
- }
- break;
+ m_bImageContainerEndFound = true;
+ }
+ break;
- default: break;
+ case IMG_ELEMENT_IMAGES:
+ {
+ m_bImagesStartFound = false;
}
+ break;
+
+ default: break;
}
}