summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.cxx4
-rw-r--r--dbaccess/source/ui/control/opendoccontrols.cxx2
-rw-r--r--forms/source/solar/control/navtoolbar.cxx2
-rw-r--r--framework/source/uielement/addonstoolbarmanager.cxx6
-rw-r--r--framework/source/uielement/macrosmenucontroller.cxx2
-rw-r--r--framework/source/uielement/menubarmanager.cxx18
-rw-r--r--framework/source/uielement/newmenucontroller.cxx2
-rw-r--r--framework/source/uielement/popuptoolbarcontroller.cxx14
-rw-r--r--framework/source/uielement/statusbarmanager.cxx2
-rw-r--r--framework/source/uielement/subtoolbarcontroller.cxx2
-rw-r--r--framework/source/uielement/thesaurusmenucontroller.cxx2
-rw-r--r--framework/source/uielement/toolbarmanager.cxx14
-rw-r--r--framework/source/uielement/toolbarsmenucontroller.cxx4
-rw-r--r--include/vcl/commandinfoprovider.hxx72
-rw-r--r--include/vcl/vclstatuslistener.hxx6
-rw-r--r--sd/source/ui/controller/slidelayoutcontroller.cxx4
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx2
-rw-r--r--sfx2/source/appl/sfxhelp.cxx4
-rw-r--r--sfx2/source/sidebar/ControllerFactory.cxx2
-rw-r--r--sfx2/source/sidebar/SidebarToolBox.cxx2
-rw-r--r--sfx2/source/view/viewsh.cxx2
-rw-r--r--svx/source/mnuctrls/smarttagmenu.cxx2
-rw-r--r--svx/source/sidebar/shapes/DefaultShapesPanel.cxx2
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx2
-rw-r--r--sw/source/uibase/shells/frmsh.cxx6
-rw-r--r--vcl/source/app/svmain.cxx1
-rw-r--r--vcl/source/helper/commandinfoprovider.cxx235
-rw-r--r--vcl/source/window/builder.cxx6
-rw-r--r--vcl/source/window/menu.cxx6
-rw-r--r--vcl/source/window/toolbox.cxx4
-rw-r--r--vcl/source/window/toolbox2.cxx7
31 files changed, 151 insertions, 288 deletions
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index ac36ea17bc1d..1e9ca0663138 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -197,7 +197,7 @@ OAppDetailPageHelper::OAppDetailPageHelper(vcl::Window* _pParent,OAppBorderWindo
m_aTBPreview->SetOutStyle(TOOLBOX_STYLE_FLAT);
m_aTBPreview->InsertItem(SID_DB_APP_DISABLE_PREVIEW,
- vcl::CommandInfoProvider::Instance().GetCommandPropertyFromModule(".uno:DBDisablePreview", "com.sun.star.sdb.OfficeDatabaseDocument"),
+ vcl::CommandInfoProvider::GetCommandPropertyFromModule(".uno:DBDisablePreview", "com.sun.star.sdb.OfficeDatabaseDocument"),
ToolBoxItemBits::LEFT|ToolBoxItemBits::DROPDOWN|ToolBoxItemBits::AUTOSIZE|ToolBoxItemBits::RADIOCHECK);
m_aTBPreview->SetHelpId(HID_APP_VIEW_PREVIEW_CB);
m_aTBPreview->SetDropdownClickHdl( LINK( this, OAppDetailPageHelper, OnDropdownClickHdl ) );
@@ -995,7 +995,7 @@ void OAppDetailPageHelper::switchPreview(PreviewMode _eMode,bool _bForce)
break;
}
- OUString aCommandLabel = vcl::CommandInfoProvider::Instance().GetCommandPropertyFromModule(aCommand, "com.sun.star.sdb.OfficeDatabaseDocument");
+ OUString aCommandLabel = vcl::CommandInfoProvider::GetCommandPropertyFromModule(aCommand, "com.sun.star.sdb.OfficeDatabaseDocument");
m_aTBPreview->SetItemText(SID_DB_APP_DISABLE_PREVIEW, stripTrailingDots(aCommandLabel));
Resize();
diff --git a/dbaccess/source/ui/control/opendoccontrols.cxx b/dbaccess/source/ui/control/opendoccontrols.cxx
index daac412787e3..dff3368f5528 100644
--- a/dbaccess/source/ui/control/opendoccontrols.cxx
+++ b/dbaccess/source/ui/control/opendoccontrols.cxx
@@ -118,7 +118,7 @@ namespace dbaui
m_sModule = OUString::createFromAscii( _pAsciiModuleName );
// our label should equal the UI text of the "Open" command
- OUString sLabel(vcl::CommandInfoProvider::Instance().GetCommandPropertyFromModule(".uno:Open", m_sModule));
+ OUString sLabel(vcl::CommandInfoProvider::GetCommandPropertyFromModule(".uno:Open", m_sModule));
SetText(" " + sLabel.replaceAll("~", ""));
// Place icon left of text and both centered in the button.
diff --git a/forms/source/solar/control/navtoolbar.cxx b/forms/source/solar/control/navtoolbar.cxx
index 66b910962c26..0a665844e060 100644
--- a/forms/source/solar/control/navtoolbar.cxx
+++ b/forms/source/solar/control/navtoolbar.cxx
@@ -287,7 +287,7 @@ namespace frm
OUString sCommandURL( lcl_getCommandURL( pSupportedFeatures->nId ) );
m_pToolbar->SetItemCommand( pSupportedFeatures->nId, sCommandURL );
m_pToolbar->SetQuickHelpText( pSupportedFeatures->nId,
- vcl::CommandInfoProvider::Instance().GetCommandPropertyFromModule(sCommandURL, m_sModuleId) );
+ vcl::CommandInfoProvider::GetCommandPropertyFromModule(sCommandURL, m_sModuleId) );
}
if ( pSupportedFeatures->bItemWindow )
diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxx
index 0043c25a45c2..f156dfa7cceb 100644
--- a/framework/source/uielement/addonstoolbarmanager.cxx
+++ b/framework/source/uielement/addonstoolbarmanager.cxx
@@ -122,14 +122,14 @@ static Image RetrieveImage( Reference< css::frame::XFrame >& rFrame,
if ( !!aImage )
return aImage;
else
- aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, rFrame, eImageType);
+ aImage = vcl::CommandInfoProvider::GetImageForCommand(aImageId, rFrame, eImageType);
if ( !!aImage )
return aImage;
}
aImage = framework::AddonsOptions().GetImageFromURL( aURL, bBigImage );
if ( !aImage )
- aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, rFrame, eImageType);
+ aImage = vcl::CommandInfoProvider::GetImageForCommand(aImageId, rFrame, eImageType);
return aImage;
}
@@ -259,7 +259,7 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue
m_pToolBar->InsertItem( nId, aTitle );
- OUString aShortcut(vcl::CommandInfoProvider::Instance().GetCommandShortcut(aURL, m_xFrame));
+ OUString aShortcut(vcl::CommandInfoProvider::GetCommandShortcut(aURL, m_xFrame));
if (!aShortcut.isEmpty())
m_pToolBar->SetQuickHelpText(nId, aTitle + " (" + aShortcut + ")");
diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx
index b8880b8e7321..dcff602fe58d 100644
--- a/framework/source/uielement/macrosmenucontroller.cxx
+++ b/framework/source/uielement/macrosmenucontroller.cxx
@@ -83,7 +83,7 @@ void MacrosMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPo
// insert basic
OUString aCommand(".uno:MacroDialog");
- OUString aDisplayName = vcl::CommandInfoProvider::Instance().GetMenuLabelForCommand(aCommand, m_xFrame);
+ OUString aDisplayName = vcl::CommandInfoProvider::GetMenuLabelForCommand(aCommand, m_xFrame);
pPopupMenu->InsertItem( 2, aDisplayName );
pPopupMenu->SetItemCommand( 2, aCommand );
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index e1a1653647e8..1f9c9687f05e 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -1085,9 +1085,9 @@ OUString MenuBarManager::RetrieveLabelFromCommand(const OUString& rCmdURL)
if ( !m_bHasMenuBar )
{
// This is a context menu, prefer "PopupLabel" over "Label".
- return vcl::CommandInfoProvider::Instance().GetPopupLabelForCommand(rCmdURL, m_xFrame);
+ return vcl::CommandInfoProvider::GetPopupLabelForCommand(rCmdURL, m_xFrame);
}
- return vcl::CommandInfoProvider::Instance().GetMenuLabelForCommand(rCmdURL, m_xFrame);
+ return vcl::CommandInfoProvider::GetMenuLabelForCommand(rCmdURL, m_xFrame);
}
bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHandler )
@@ -1183,7 +1183,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
}
// Command can be just an alias to another command.
- OUString aRealCommand = vcl::CommandInfoProvider::Instance().GetRealCommandForCommand( aItemCommand, m_xFrame );
+ OUString aRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( aItemCommand, m_xFrame );
if ( !aRealCommand.isEmpty() )
aItemCommand = aRealCommand;
@@ -1289,7 +1289,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
// Set image for the addon popup menu item
if ( bItemShowMenuImages && !pPopup->GetItemImage( ITEMID_ADDONLIST ))
{
- Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aItemCommand, rFrame);
+ Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aItemCommand, rFrame);
if ( !!aImage )
pPopup->SetItemImage( ITEMID_ADDONLIST, aImage );
}
@@ -1320,12 +1320,12 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
if ( pMenuAttributes && !pMenuAttributes->aImageId.isEmpty() )
{
// Retrieve image id from menu attributes
- aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, m_xFrame);
+ aImage = vcl::CommandInfoProvider::GetImageForCommand(aImageId, m_xFrame);
}
if ( !aImage )
{
- aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aItemCommand, m_xFrame);
+ aImage = vcl::CommandInfoProvider::GetImageForCommand(aItemCommand, m_xFrame);
if ( !aImage )
aImage = AddonsOptions().GetImageFromURL( aItemCommand, false );
}
@@ -1648,7 +1648,7 @@ void MenuBarManager::FillMenu(
aProp[i].Value >>= bEnabled;
}
- if (vcl::CommandInfoProvider::Instance().IsExperimental(aCommandURL, rModuleIdentifier) &&
+ if (vcl::CommandInfoProvider::IsExperimental(aCommandURL, rModuleIdentifier) &&
!SvtMiscOptions().IsExperimentalMode())
{
continue;
@@ -2086,7 +2086,7 @@ void MenuBarManager::FillMenuImages(Reference< XFrame >& _xFrame, Menu* _pMenu,b
if ( !aImageId.isEmpty() )
{
- Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aImageId, _xFrame);
+ Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aImageId, _xFrame);
if ( !!aImage )
{
bImageSet = true;
@@ -2097,7 +2097,7 @@ void MenuBarManager::FillMenuImages(Reference< XFrame >& _xFrame, Menu* _pMenu,b
if ( !bImageSet )
{
OUString aMenuItemCommand = _pMenu->GetItemCommand( nId );
- Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aMenuItemCommand, _xFrame);
+ Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aMenuItemCommand, _xFrame);
if ( !aImage )
aImage = aAddonOptions.GetImageFromURL( aMenuItemCommand, false );
diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx
index 7ee1e564da7d..51c6cc1e2067 100644
--- a/framework/source/uielement/newmenucontroller.cxx
+++ b/framework/source/uielement/newmenucontroller.cxx
@@ -91,7 +91,7 @@ void NewMenuController::setMenuImages( PopupMenu* pPopupMenu, bool bSetImages )
INetURLObject aURLObj( aImageId.isEmpty() ? aCmd : aImageId );
Image aImage = SvFileInformationManager::GetImageNoDefault( aURLObj );
if ( !aImage )
- aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aCmd, xFrame);
+ aImage = vcl::CommandInfoProvider::GetImageForCommand(aCmd, xFrame);
if ( !!aImage )
pPopupMenu->SetItemImage( nItemId, aImage );
diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx
index 34b3a39cf528..4a13605270ae 100644
--- a/framework/source/uielement/popuptoolbarcontroller.cxx
+++ b/framework/source/uielement/popuptoolbarcontroller.cxx
@@ -370,7 +370,7 @@ void GenericPopupToolbarController::functionExecuted( const OUString& rCommand )
{
removeStatusListener( m_aCommandURL );
- OUString aRealCommand( vcl::CommandInfoProvider::Instance().GetRealCommandForCommand( rCommand, m_xFrame ) );
+ OUString aRealCommand( vcl::CommandInfoProvider::GetRealCommandForCommand( rCommand, m_xFrame ) );
m_aCommandURL = aRealCommand.isEmpty() ? rCommand : aRealCommand;
addStatusListener( m_aCommandURL );
@@ -380,12 +380,12 @@ void GenericPopupToolbarController::functionExecuted( const OUString& rCommand )
{
pToolBox->SetItemCommand( nId, rCommand );
pToolBox->SetHelpText( nId, OUString() ); // Will retrieve the new one from help.
- pToolBox->SetItemText( nId, vcl::CommandInfoProvider::Instance().GetLabelForCommand( rCommand, m_xFrame ) );
- pToolBox->SetQuickHelpText( nId, vcl::CommandInfoProvider::Instance().GetTooltipForCommand( rCommand, m_xFrame ) );
+ pToolBox->SetItemText( nId, vcl::CommandInfoProvider::GetLabelForCommand( rCommand, m_xFrame ) );
+ pToolBox->SetQuickHelpText( nId, vcl::CommandInfoProvider::GetTooltipForCommand( rCommand, m_xFrame ) );
vcl::ImageType eImageType = getImageType(pToolBox->GetToolboxButtonSize());
- Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(rCommand, m_xFrame, eImageType);
+ Image aImage = vcl::CommandInfoProvider::GetImageForCommand(rCommand, m_xFrame, eImageType);
if ( !!aImage )
pToolBox->SetItemImage( nId, aImage );
}
@@ -503,7 +503,7 @@ void SaveToolbarController::updateImage()
if ( m_bReadOnly )
{
- aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(".uno:SaveAs", m_xFrame, eImageType);
+ aImage = vcl::CommandInfoProvider::GetImageForCommand(".uno:SaveAs", m_xFrame, eImageType);
}
else if ( m_bModified )
{
@@ -512,7 +512,7 @@ void SaveToolbarController::updateImage()
}
if ( !aImage )
- aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(m_aCommandURL, m_xFrame, eImageType);
+ aImage = vcl::CommandInfoProvider::GetImageForCommand(m_aCommandURL, m_xFrame, eImageType);
if ( !!aImage )
pToolBox->SetItemImage( nId, aImage );
@@ -530,7 +530,7 @@ void SaveToolbarController::statusChanged( const css::frame::FeatureStateEvent&
if ( bLastReadOnly != m_bReadOnly )
{
pToolBox->SetQuickHelpText( nId,
- vcl::CommandInfoProvider::Instance().GetTooltipForCommand( m_bReadOnly ? OUString( ".uno:SaveAs" ) : m_aCommandURL, m_xFrame ) );
+ vcl::CommandInfoProvider::GetTooltipForCommand( m_bReadOnly ? OUString( ".uno:SaveAs" ) : m_aCommandURL, m_xFrame ) );
pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) & ~( m_bReadOnly ? ToolBoxItemBits::DROPDOWN : ToolBoxItemBits::DROPDOWNONLY ) );
pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ( m_bReadOnly ? ToolBoxItemBits::DROPDOWNONLY : ToolBoxItemBits::DROPDOWN ) );
updateImage();
diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx
index 27e5be35ef04..06baee2af7f8 100644
--- a/framework/source/uielement/statusbarmanager.cxx
+++ b/framework/source/uielement/statusbarmanager.cxx
@@ -450,7 +450,7 @@ void StatusBarManager::FillStatusBar( const uno::Reference< container::XIndexAcc
if (( nType == css::ui::ItemType::DEFAULT ) && !aCommandURL.isEmpty() )
{
- OUString aString( vcl::CommandInfoProvider::Instance().GetLabelForCommand(aCommandURL, m_xFrame));
+ OUString aString( vcl::CommandInfoProvider::GetLabelForCommand(aCommandURL, m_xFrame));
StatusBarItemBits nItemBits( impl_convertItemStyleToItemBits( nStyle ));
m_pStatusBar->InsertItem( nId, nWidth, nItemBits, nOffset );
diff --git a/framework/source/uielement/subtoolbarcontroller.cxx b/framework/source/uielement/subtoolbarcontroller.cxx
index 146051d1958f..2f372633a315 100644
--- a/framework/source/uielement/subtoolbarcontroller.cxx
+++ b/framework/source/uielement/subtoolbarcontroller.cxx
@@ -291,7 +291,7 @@ void SubToolBarController::updateImage()
else if (pToolBox->GetToolboxButtonSize() == ToolBoxButtonSize::Size32)
eImageType = vcl::ImageType::Size32;
- Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(m_aLastCommand, getFrameInterface(), eImageType);
+ Image aImage = vcl::CommandInfoProvider::GetImageForCommand(m_aLastCommand, getFrameInterface(), eImageType);
if ( !!aImage )
pToolBox->SetItemImage( nId, aImage );
}
diff --git a/framework/source/uielement/thesaurusmenucontroller.cxx b/framework/source/uielement/thesaurusmenucontroller.cxx
index c6832fa714c1..cfbe7e80a0df 100644
--- a/framework/source/uielement/thesaurusmenucontroller.cxx
+++ b/framework/source/uielement/thesaurusmenucontroller.cxx
@@ -99,7 +99,7 @@ void ThesaurusMenuController::fillPopupMenu()
pVCLMenu->InsertSeparator();
OUString aThesaurusDialogCmd( ".uno:ThesaurusDialog" );
- pVCLMenu->InsertItem( nId, vcl::CommandInfoProvider::Instance().GetPopupLabelForCommand( aThesaurusDialogCmd, m_xFrame ) );
+ pVCLMenu->InsertItem( nId, vcl::CommandInfoProvider::GetPopupLabelForCommand( aThesaurusDialogCmd, m_xFrame ) );
pVCLMenu->SetItemCommand( nId, aThesaurusDialogCmd );
}
}
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index a42fe2d2ecf2..c3fa5ea4c568 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -315,7 +315,7 @@ void ToolBarManager::RefreshImages()
else
{
OUString aCommandURL = m_pToolBar->GetItemCommand( it.first );
- Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommandURL, m_xFrame, eImageType);
+ Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aCommandURL, m_xFrame, eImageType);
// Try also to query for add-on images before giving up and use an
// empty image.
bool bBigImages = eImageType != vcl::ImageType::Size16;
@@ -684,7 +684,7 @@ void ToolBarManager::CreateControllers()
OUString aCommandURL( m_pToolBar->GetItemCommand( nId ) );
// Command can be just an alias to another command.
- OUString aRealCommandURL( vcl::CommandInfoProvider::Instance().GetRealCommandForCommand( aCommandURL, m_xFrame ) );
+ OUString aRealCommandURL( vcl::CommandInfoProvider::GetRealCommandForCommand( aCommandURL, m_xFrame ) );
if ( !aRealCommandURL.isEmpty() )
aCommandURL = aRealCommandURL;
@@ -764,7 +764,7 @@ void ToolBarManager::CreateControllers()
new GenericToolbarController( m_xContext, m_xFrame, m_pToolBar, nId, aCommandURL ));
// Accessibility support: Set toggle button role for specific commands
- sal_Int32 nProps = vcl::CommandInfoProvider::Instance().GetPropertiesForCommand(aCommandURL, m_xFrame);
+ sal_Int32 nProps = vcl::CommandInfoProvider::GetPropertiesForCommand(aCommandURL, m_xFrame);
if ( nProps & UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON )
m_pToolBar->SetItemBits( nId, m_pToolBar->GetItemBits( nId ) | ToolBoxItemBits::CHECKABLE );
}
@@ -1013,7 +1013,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
aProp[i].Value >>= nStyle;
}
- if (vcl::CommandInfoProvider::Instance().IsExperimental(aCommandURL, m_aModuleIdentifier) &&
+ if (vcl::CommandInfoProvider::IsExperimental(aCommandURL, m_aModuleIdentifier) &&
!SvtMiscOptions().IsExperimentalMode())
{
continue;
@@ -1021,7 +1021,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
if (( nType == css::ui::ItemType::DEFAULT ) && !aCommandURL.isEmpty() )
{
- OUString aString(vcl::CommandInfoProvider::Instance().GetLabelForCommand(aCommandURL, m_xFrame));
+ OUString aString(vcl::CommandInfoProvider::GetLabelForCommand(aCommandURL, m_xFrame));
ToolBoxItemBits nItemBits = ConvertStyleToToolboxItemBits( nStyle );
m_pToolBar->InsertItem( nId, aString, nItemBits );
@@ -1029,7 +1029,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
if ( !aTooltip.isEmpty() )
m_pToolBar->SetQuickHelpText( nId, aTooltip );
else
- m_pToolBar->SetQuickHelpText( nId, vcl::CommandInfoProvider::Instance().GetTooltipForCommand(aCommandURL, m_xFrame) );
+ m_pToolBar->SetQuickHelpText( nId, vcl::CommandInfoProvider::GetTooltipForCommand(aCommandURL, m_xFrame) );
if ( !aLabel.isEmpty() )
{
@@ -1468,7 +1468,7 @@ void ToolBarManager::AddCustomizeMenuItems(ToolBox* pToolBar)
pVisibleItemsPopupMenu->InsertItem( STARTID_CUSTOMIZE_POPUPMENU+nPos, m_pToolBar->GetItemText( nId ), MenuItemBits::CHECKABLE );
pVisibleItemsPopupMenu->CheckItem( STARTID_CUSTOMIZE_POPUPMENU+nPos, m_pToolBar->IsItemVisible( nId ) );
pVisibleItemsPopupMenu->SetItemCommand( STARTID_CUSTOMIZE_POPUPMENU+nPos, aCommandURL );
- Image aImage(vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommandURL, m_xFrame));
+ Image aImage(vcl::CommandInfoProvider::GetImageForCommand(aCommandURL, m_xFrame));
commandToImage[aCommandURL] = aImage;
pVisibleItemsPopupMenu->SetItemImage( STARTID_CUSTOMIZE_POPUPMENU+nPos, aImage );
}
diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx
index d10ec62091f9..9b6bc5e575b6 100644
--- a/framework/source/uielement/toolbarsmenucontroller.cxx
+++ b/framework/source/uielement/toolbarsmenucontroller.cxx
@@ -147,7 +147,7 @@ void ToolbarsMenuController::addCommand(
OUString aLabel;
if ( rLabel.isEmpty() )
- aLabel = vcl::CommandInfoProvider::Instance().GetMenuLabelForCommand( rCommandURL, m_xFrame );
+ aLabel = vcl::CommandInfoProvider::GetMenuLabelForCommand( rCommandURL, m_xFrame );
else
aLabel = rLabel;
@@ -167,7 +167,7 @@ void ToolbarsMenuController::addCommand(
const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
if ( rSettings.GetUseImagesInMenus() )
- aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(rCommandURL, m_xFrame);
+ aImage = vcl::CommandInfoProvider::GetImageForCommand(rCommandURL, m_xFrame);
VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(VCLXPopupMenu::GetImplementation( rPopupMenu ));
if ( pPopupMenu )
diff --git a/include/vcl/commandinfoprovider.hxx b/include/vcl/commandinfoprovider.hxx
index 0a8e53e5ef7b..2a3eaea347ad 100644
--- a/include/vcl/commandinfoprovider.hxx
+++ b/include/vcl/commandinfoprovider.hxx
@@ -27,6 +27,9 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
+using namespace css;
+using namespace css::uno;
+
namespace vcl {
@@ -36,16 +39,8 @@ namespace vcl {
class VCL_DLLPUBLIC CommandInfoProvider
{
public:
- /** Return the singleton instance.
-
- It caches some objects for the last XFrame object given to
- GetLabelForCommand. These objects are release and created new
- when that method is called with a different XFrame from the
- last call.
-
- Lifetime control should work but could be more elegant.
- */
- static CommandInfoProvider& Instance();
+ CommandInfoProvider();
+ ~CommandInfoProvider();
/** Return a label for the given command.
@param rsCommandName
@@ -55,15 +50,15 @@ public:
@return
The command labe.
*/
- OUString GetLabelForCommand (
+ static OUString GetLabelForCommand (
const OUString& rsCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
- OUString GetMenuLabelForCommand (
+ static OUString GetMenuLabelForCommand (
const OUString& rsCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
- OUString GetPopupLabelForCommand (
+ static OUString GetPopupLabelForCommand (
const OUString& rsCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
@@ -76,67 +71,54 @@ public:
The returned label contains the keyboard accelerator, if
one is defined and bIncludeShortcut is true.
*/
- OUString GetTooltipForCommand (
+ static OUString GetTooltipForCommand (
const OUString& rsCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
/** Returns the shortcut for a command in human-readable form */
- OUString GetCommandShortcut (const OUString& rCommandName,
+ static OUString GetCommandShortcut (const OUString& rCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
- OUString GetRealCommandForCommand( const OUString& rCommandName,
+ static OUString GetRealCommandForCommand( const OUString& rCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame );
- OUString GetCommandPropertyFromModule( const OUString& rCommandName, const OUString& rModuleName );
+ static OUString GetCommandPropertyFromModule( const OUString& rCommandName, const OUString& rModuleName );
- BitmapEx GetBitmapForCommand(
+ static BitmapEx GetBitmapForCommand(
const OUString& rsCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
vcl::ImageType eImageType = vcl::ImageType::Small);
- Image GetImageForCommand(
+ static Image GetImageForCommand(
const OUString& rsCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
vcl::ImageType eImageType = vcl::ImageType::Small);
- sal_Int32 GetPropertiesForCommand(
+ static sal_Int32 GetPropertiesForCommand(
const OUString& rsCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
- bool IsRotated(const OUString& rsCommandName);
- bool IsMirrored(const OUString& rsCommandName);
+ static bool IsRotated(const OUString& rsCommandName,const Reference<frame::XFrame>& rxFrame);
+ static bool IsMirrored(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame);
/** Returns whether the command is experimental. */
- bool IsExperimental(
+ static bool IsExperimental(
const OUString& rsCommandName,
const OUString& rModuleName);
/** Do not call. Should be part of a local and hidden interface.
*/
- void SetFrame (const css::uno::Reference<css::frame::XFrame>& rxFrame);
-
- void dispose();
+ static void SetFrame (const css::uno::Reference<css::frame::XFrame>& rxFrame);
private:
- css::uno::Reference<css::uno::XComponentContext> mxContext;
- css::uno::Reference<css::frame::XFrame> mxCachedDataFrame;
- css::uno::Reference<css::ui::XAcceleratorConfiguration> mxCachedDocumentAcceleratorConfiguration;
- css::uno::Reference<css::ui::XAcceleratorConfiguration> mxCachedModuleAcceleratorConfiguration;
- css::uno::Reference<css::ui::XAcceleratorConfiguration> mxCachedGlobalAcceleratorConfiguration;
- OUString msCachedModuleIdentifier;
- css::uno::Reference<css::lang::XComponent> mxFrameListener;
-
- CommandInfoProvider();
- ~CommandInfoProvider();
-
- css::uno::Reference<css::ui::XAcceleratorConfiguration> const & GetDocumentAcceleratorConfiguration();
- css::uno::Reference<css::ui::XAcceleratorConfiguration> const & GetModuleAcceleratorConfiguration();
- css::uno::Reference<css::ui::XAcceleratorConfiguration> const & GetGlobalAcceleratorConfiguration();
- OUString const & GetModuleIdentifier();
- css::uno::Sequence<css::beans::PropertyValue> GetCommandProperties (
- const OUString& rsCommandName);
- OUString GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName);
- bool ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName);
+ static css::uno::Reference<css::ui::XAcceleratorConfiguration> const GetDocumentAcceleratorConfiguration(const Reference<frame::XFrame>& rxFrame);
+ static css::uno::Reference<css::ui::XAcceleratorConfiguration> const GetModuleAcceleratorConfiguration(const Reference<frame::XFrame>& rxFrame);
+ static css::uno::Reference<css::ui::XAcceleratorConfiguration> const GetGlobalAcceleratorConfiguration();
+ static OUString const GetModuleIdentifier(const Reference<frame::XFrame>& rxFrame);
+ static css::uno::Sequence<css::beans::PropertyValue> GetCommandProperties (
+ const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame);
+ static OUString GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName,const Reference<frame::XFrame>& rxFrame);
+ static bool ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame);
static OUString RetrieveShortcutsFromConfiguration(
const css::uno::Reference<css::ui::XAcceleratorConfiguration>& rxConfiguration,
const OUString& rsCommandName);
diff --git a/include/vcl/vclstatuslistener.hxx b/include/vcl/vclstatuslistener.hxx
index ae461f8d9cb3..c18d2acbed14 100644
--- a/include/vcl/vclstatuslistener.hxx
+++ b/include/vcl/vclstatuslistener.hxx
@@ -32,12 +32,15 @@ private:
/** Dispatcher. Need to keep a reference to it as long as this StatusListener exists. */
css::uno::Reference<css::frame::XDispatch> mxDispatch;
css::util::URL maCommandURL;
+ css::uno::Reference<css::frame::XFrame> mxFrame;
public:
void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& rEvent) override;
void SAL_CALL disposing(const css::lang::EventObject& /*Source*/) override;
+ const css::uno::Reference<css::frame::XFrame>& getFrame() { return mxFrame; }
+
void dispose();
};
@@ -52,6 +55,8 @@ VclStatusListener<T>::VclStatusListener(T* widget, const rtl::OUString& aCommand
if (!xFrame.is())
xFrame = css::uno::Reference<css::frame::XFrame>(xDesktop, css::uno::UNO_QUERY);
+ mxFrame = xFrame;
+
css::uno::Reference<css::frame::XDispatchProvider> xDispatchProvider(xFrame, css::uno::UNO_QUERY);
if (!xDispatchProvider.is())
return;
@@ -86,6 +91,7 @@ void VclStatusListener<T>::dispose()
mxDispatch->removeStatusListener(this, maCommandURL);
mxDispatch.clear();
}
+ mxFrame.clear();
mWidget.clear();
}
diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx
index db34b253d426..e2f2cfa8eff4 100644
--- a/sd/source/ui/controller/slidelayoutcontroller.cxx
+++ b/sd/source/ui/controller/slidelayoutcontroller.cxx
@@ -241,11 +241,11 @@ LayoutToolbarMenu::LayoutToolbarMenu( SlideLayoutController& rController, vcl::W
sSlotStr = ".uno:DuplicatePage";
else
sSlotStr = ".uno:Undo";
- aSlotImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(sSlotStr, xFrame);
+ aSlotImage = vcl::CommandInfoProvider::GetImageForCommand(sSlotStr, xFrame);
OUString sSlotTitle;
if( bInsertPage )
- sSlotTitle = vcl::CommandInfoProvider::Instance().GetLabelForCommand( sSlotStr, xFrame );
+ sSlotTitle = vcl::CommandInfoProvider::GetLabelForCommand( sSlotStr, xFrame );
else
sSlotTitle = SD_RESSTR( STR_RESET_LAYOUT );
appendEntry( 2, sSlotTitle, aSlotImage);
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 8a3665bda16a..378747e6474a 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -976,7 +976,7 @@ vcl::Window* ViewShellBase::GetViewWindow()
OUString ViewShellBase::RetrieveLabelFromCommand( const OUString& aCmdURL ) const
{
Reference< XFrame > xFrame( GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(), UNO_QUERY );
- return vcl::CommandInfoProvider::Instance().GetLabelForCommand( aCmdURL, xFrame );
+ return vcl::CommandInfoProvider::GetLabelForCommand( aCmdURL, xFrame );
}
int ViewShellBase::getPart() const
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index f3ac5fb6d786..a8dce9d2f0a8 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -446,7 +446,7 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame2 >& rHelpTask ,
OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const vcl::Window* pWindow )
{
OUString sModuleName = GetHelpModuleName_Impl();
- OUString sRealCommand = vcl::CommandInfoProvider::Instance().GetRealCommandForCommand( aCommandURL, getCurrentFrame() );
+ OUString sRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( aCommandURL, getCurrentFrame() );
OUString sHelpText = SfxHelp_Impl::GetHelpText( sRealCommand.isEmpty() ? aCommandURL : sRealCommand, sModuleName );
OString aNewHelpId;
@@ -564,7 +564,7 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const
if ( nProtocol == INetProtocol::Uno )
// Command can be just an alias to another command.
- aRealCommand = vcl::CommandInfoProvider::Instance().GetRealCommandForCommand( rURL, getCurrentFrame() );
+ aRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( rURL, getCurrentFrame() );
// no URL, just a HelpID (maybe empty in case of keyword search)
aHelpURL = CreateHelpURL_Impl( aRealCommand.isEmpty() ? rURL : aRealCommand, aHelpModuleName );
diff --git a/sfx2/source/sidebar/ControllerFactory.cxx b/sfx2/source/sidebar/ControllerFactory.cxx
index 00484980174b..ce1910784fd7 100644
--- a/sfx2/source/sidebar/ControllerFactory.cxx
+++ b/sfx2/source/sidebar/ControllerFactory.cxx
@@ -125,7 +125,7 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController(
// Add tooltip.
if (xController.is())
{
- const OUString sTooltip (vcl::CommandInfoProvider::Instance().GetTooltipForCommand(
+ const OUString sTooltip (vcl::CommandInfoProvider::GetTooltipForCommand(
rsCommandName,
rxFrame));
pToolBox->SetQuickHelpText(nItemId, sTooltip);
diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx
index ae1855ffd4b4..5a52fe8b6643 100644
--- a/sfx2/source/sidebar/SidebarToolBox.cxx
+++ b/sfx2/source/sidebar/SidebarToolBox.cxx
@@ -275,7 +275,7 @@ IMPL_LINK_NOARG(SidebarToolBox, ChangedIconSizeHandler, LinkParamNone*, void)
{
OUString aCommandURL = GetItemCommand(it.first);
css::uno::Reference<frame::XFrame> xFrame = SfxViewFrame::Current()->GetFrame().GetFrameInterface();
- Image aImage = vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommandURL, xFrame, eImageType);
+ Image aImage = vcl::CommandInfoProvider::GetImageForCommand(aCommandURL, xFrame, eImageType);
SetItemImage(it.first, aImage);
}
}
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 958348fba113..7e84a768bb01 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -718,7 +718,7 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet )
uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() );
OUStringBuffer aBuffer( 60 );
- aBuffer.append( vcl::CommandInfoProvider::Instance().GetLabelForCommand(
+ aBuffer.append( vcl::CommandInfoProvider::GetLabelForCommand(
".uno:PrintDefault",
xFrame ));
aBuffer.append( " (" );
diff --git a/svx/source/mnuctrls/smarttagmenu.cxx b/svx/source/mnuctrls/smarttagmenu.cxx
index c684fed7abb6..5d0eb6e03bde 100644
--- a/svx/source/mnuctrls/smarttagmenu.cxx
+++ b/svx/source/mnuctrls/smarttagmenu.cxx
@@ -180,7 +180,7 @@ void SmartTagMenuController::FillMenu()
{
const OUString aCommand = ".uno:AutoCorrectDlg?OpenSmartTag:bool=true";
pVCLMenu->InsertSeparator();
- pVCLMenu->InsertItem( nMenuId, vcl::CommandInfoProvider::Instance().GetPopupLabelForCommand( aCommand, m_xFrame ) );
+ pVCLMenu->InsertItem( nMenuId, vcl::CommandInfoProvider::GetPopupLabelForCommand( aCommand, m_xFrame ) );
pVCLMenu->SetItemCommand( nMenuId, aCommand );
}
}
diff --git a/svx/source/sidebar/shapes/DefaultShapesPanel.cxx b/svx/source/sidebar/shapes/DefaultShapesPanel.cxx
index 8f30ac1ff5af..a56e004fa670 100644
--- a/svx/source/sidebar/shapes/DefaultShapesPanel.cxx
+++ b/svx/source/sidebar/shapes/DefaultShapesPanel.cxx
@@ -132,7 +132,7 @@ void DefaultShapesPanel::populateShapes()
{
sSlotStr = aSet.second[i];
aSlotImage = ::GetImage(mxFrame, sSlotStr, false);
- sLabel = vcl::CommandInfoProvider::Instance().GetTooltipForCommand(sSlotStr, mxFrame);
+ sLabel = vcl::CommandInfoProvider::GetTooltipForCommand(sSlotStr, mxFrame);
aSet.first->InsertItem(i, aSlotImage, sLabel);
}
}
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 78540607b35c..c1f2a3a0d1f4 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1312,7 +1312,7 @@ SvxColorWindow::SvxColorWindow(const OUString& rCommand,
}
}
- OUString aWindowTitle = vcl::CommandInfoProvider::Instance().GetLabelForCommand( rCommand, rFrame );
+ OUString aWindowTitle = vcl::CommandInfoProvider::GetLabelForCommand( rCommand, rFrame );
SetText( aWindowTitle );
mpColorSet->SetAccessibleName( aWindowTitle );
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index 68c1e15a4fb7..811282d8c1f0 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -810,15 +810,15 @@ void SwFrameShell::GetState(SfxItemSet& rSet)
{
case SID_OBJECT_ALIGN_UP :
case FN_FRAME_ALIGN_VERT_TOP:
- sNewLabel = vcl::CommandInfoProvider::Instance().GetLabelForCommand(".uno:AlignTop", GetFrame()->GetFrame().GetFrameInterface());
+ sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignTop", GetFrame()->GetFrame().GetFrameInterface());
break;
case SID_OBJECT_ALIGN_MIDDLE:
case FN_FRAME_ALIGN_VERT_CENTER:
- sNewLabel = vcl::CommandInfoProvider::Instance().GetLabelForCommand(".uno:AlignVerticalCenter", GetFrame()->GetFrame().GetFrameInterface());
+ sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignVerticalCenter", GetFrame()->GetFrame().GetFrameInterface());
break;
case SID_OBJECT_ALIGN_DOWN:
case FN_FRAME_ALIGN_VERT_BOTTOM:
- sNewLabel = vcl::CommandInfoProvider::Instance().GetLabelForCommand(".uno:AlignBottom", GetFrame()->GetFrame().GetFrameInterface());
+ sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignBottom", GetFrame()->GetFrame().GetFrameInterface());
break;
}
}
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 294847ef45a3..4ae2205ec512 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -526,7 +526,6 @@ void DeInitVCL()
if (pSVData->mpCommandInfoProvider)
{
- pSVData->mpCommandInfoProvider->dispose();
pSVData->mpCommandInfoProvider = nullptr;
}
diff --git a/vcl/source/helper/commandinfoprovider.cxx b/vcl/source/helper/commandinfoprovider.cxx
index f1578151fb56..7ba86900caf4 100644
--- a/vcl/source/helper/commandinfoprovider.cxx
+++ b/vcl/source/helper/commandinfoprovider.cxx
@@ -39,128 +39,49 @@ using namespace css;
using namespace css::uno;
-namespace
-{
- typedef ::cppu::WeakComponentImplHelper <
- css::frame::XFrameActionListener
- > FrameListenerInterfaceBase;
- class FrameListener
- : public ::cppu::BaseMutex,
- public FrameListenerInterfaceBase
- {
- public:
- FrameListener (vcl::CommandInfoProvider& rInfoProvider, const Reference<frame::XFrame>& rxFrame)
- : FrameListenerInterfaceBase(m_aMutex),
- mrInfoProvider(rInfoProvider),
- mxFrame(rxFrame)
- {
- if (mxFrame.is())
- mxFrame->addFrameActionListener(this);
- }
-
- virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent) override
- {
- // The same frame can be reused for a different component, e.g.
- // starting component from the start center, so need to re-init the cached data.
- if (aEvent.Action == css::frame::FrameAction_COMPONENT_DETACHING)
- mrInfoProvider.SetFrame(nullptr);
- }
- virtual void SAL_CALL disposing() override
- {
- if (mxFrame.is())
- mxFrame->removeFrameActionListener(this);
- }
- virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) override
- {
- (void)rEvent;
- mrInfoProvider.SetFrame(nullptr);
- mxFrame = nullptr;
- }
-
- private:
- vcl::CommandInfoProvider& mrInfoProvider;
- Reference<frame::XFrame> mxFrame;
- };
-}
-
namespace vcl {
-CommandInfoProvider& CommandInfoProvider::Instance()
-{
- static CommandInfoProvider aProvider;
- return aProvider;
-}
-
-CommandInfoProvider::CommandInfoProvider()
- : mxContext(comphelper::getProcessComponentContext()),
- mxCachedDataFrame(),
- mxCachedDocumentAcceleratorConfiguration(),
- mxCachedModuleAcceleratorConfiguration(),
- mxCachedGlobalAcceleratorConfiguration(),
- msCachedModuleIdentifier(),
- mxFrameListener()
-{
- ImplGetSVData()->mpCommandInfoProvider = this;
-}
-
-void CommandInfoProvider::dispose()
-{
- if (mxFrameListener.is())
- {
- mxFrameListener->dispose();
- mxFrameListener.clear();
- }
- mxCachedGlobalAcceleratorConfiguration.clear();
- mxCachedModuleAcceleratorConfiguration.clear();
- mxCachedDocumentAcceleratorConfiguration.clear();
- mxCachedDataFrame.clear();
- mxContext.clear();
-}
+CommandInfoProvider::CommandInfoProvider() { }
CommandInfoProvider::~CommandInfoProvider()
{
- dispose();
}
OUString CommandInfoProvider::GetLabelForCommand (
const OUString& rsCommandName,
const Reference<frame::XFrame>& rxFrame)
{
- SetFrame(rxFrame);
- return GetCommandProperty("Name", rsCommandName);
+ return GetCommandProperty("Name", rsCommandName, rxFrame);
}
OUString CommandInfoProvider::GetMenuLabelForCommand (
const OUString& rsCommandName,
const Reference<frame::XFrame>& rxFrame)
{
- SetFrame(rxFrame);
// Here we want to use "Label", not "Name". "Name" is a stripped-down version of "Label" without accelerators
// and ellipsis. In the menu, we want to have those accelerators and ellipsis.
- return GetCommandProperty("Label", rsCommandName);
+ return GetCommandProperty("Label", rsCommandName, rxFrame);
}
OUString CommandInfoProvider::GetPopupLabelForCommand (
const OUString& rsCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame)
{
- SetFrame(rxFrame);
- OUString sPopupLabel(GetCommandProperty("PopupLabel", rsCommandName));
+ OUString sPopupLabel(GetCommandProperty("PopupLabel", rsCommandName, rxFrame));
if (!sPopupLabel.isEmpty())
return sPopupLabel;
- return GetCommandProperty("Label", rsCommandName);
+ return GetCommandProperty("Label", rsCommandName, rxFrame);
}
OUString CommandInfoProvider::GetTooltipForCommand (
const OUString& rsCommandName,
const Reference<frame::XFrame>& rxFrame)
{
- SetFrame(rxFrame);
- OUString sLabel (GetCommandProperty("TooltipLabel", rsCommandName));
+ OUString sLabel (GetCommandProperty("TooltipLabel", rsCommandName, rxFrame));
if (sLabel.isEmpty()) {
sLabel = GetPopupLabelForCommand(rsCommandName, rxFrame);
// Remove '...' at the end and mnemonics (we don't want those in tooltips)
@@ -180,15 +101,14 @@ OUString CommandInfoProvider::GetTooltipForCommand (
OUString CommandInfoProvider::GetCommandShortcut (const OUString& rsCommandName,
const Reference<frame::XFrame>& rxFrame)
{
- SetFrame(rxFrame);
OUString sShortcut;
- sShortcut = RetrieveShortcutsFromConfiguration(GetDocumentAcceleratorConfiguration(), rsCommandName);
+ sShortcut = RetrieveShortcutsFromConfiguration(GetDocumentAcceleratorConfiguration(rxFrame), rsCommandName);
if (sShortcut.getLength() > 0)
return sShortcut;
- sShortcut = RetrieveShortcutsFromConfiguration(GetModuleAcceleratorConfiguration(), rsCommandName);
+ sShortcut = RetrieveShortcutsFromConfiguration(GetModuleAcceleratorConfiguration(rxFrame), rsCommandName);
if (sShortcut.getLength() > 0)
return sShortcut;
@@ -202,16 +122,14 @@ OUString CommandInfoProvider::GetCommandShortcut (const OUString& rsCommandName,
OUString CommandInfoProvider::GetRealCommandForCommand(const OUString& rCommandName,
const css::uno::Reference<frame::XFrame>& rxFrame)
{
- SetFrame(rxFrame);
- return GetCommandProperty("TargetURL", rCommandName);
+ return GetCommandProperty("TargetURL", rCommandName, rxFrame);
}
BitmapEx CommandInfoProvider::GetBitmapForCommand(const OUString& rsCommandName,
const Reference<frame::XFrame>& rxFrame,
vcl::ImageType eImageType)
{
- SetFrame(rxFrame);
if (rsCommandName.isEmpty())
return BitmapEx();
@@ -251,8 +169,8 @@ BitmapEx CommandInfoProvider::GetBitmapForCommand(const OUString& rsCommandName,
}
try {
- Reference<ui::XModuleUIConfigurationManagerSupplier> xModuleCfgMgrSupplier(ui::theModuleUIConfigurationManagerSupplier::get(mxContext));
- Reference<ui::XUIConfigurationManager> xUICfgMgr(xModuleCfgMgrSupplier->getUIConfigurationManager(GetModuleIdentifier()));
+ Reference<ui::XModuleUIConfigurationManagerSupplier> xModuleCfgMgrSupplier(ui::theModuleUIConfigurationManagerSupplier::get(comphelper::getProcessComponentContext()));
+ Reference<ui::XUIConfigurationManager> xUICfgMgr(xModuleCfgMgrSupplier->getUIConfigurationManager(GetModuleIdentifier(rxFrame)));
Sequence< Reference<graphic::XGraphic> > aGraphicSeq;
Reference<ui::XImageManager> xModuleImageManager(xUICfgMgr->getImageManager(), UNO_QUERY);
@@ -285,10 +203,9 @@ sal_Int32 CommandInfoProvider::GetPropertiesForCommand (
const OUString& rsCommandName,
const Reference<frame::XFrame>& rxFrame)
{
- SetFrame(rxFrame);
sal_Int32 nValue = 0;
- const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName));
+ const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName, rxFrame));
for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
{
if (aProperties[nIndex].Name == "Properties")
@@ -300,14 +217,14 @@ sal_Int32 CommandInfoProvider::GetPropertiesForCommand (
return nValue;
}
-bool CommandInfoProvider::IsRotated(const OUString& rsCommandName)
+bool CommandInfoProvider::IsRotated(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
{
- return ResourceHasKey("private:resource/image/commandrotateimagelist", rsCommandName);
+ return ResourceHasKey("private:resource/image/commandrotateimagelist", rsCommandName, rxFrame);
}
-bool CommandInfoProvider::IsMirrored(const OUString& rsCommandName)
+bool CommandInfoProvider::IsMirrored(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
{
- return ResourceHasKey("private:resource/image/commandmirrorimagelist", rsCommandName);
+ return ResourceHasKey("private:resource/image/commandmirrorimagelist", rsCommandName, rxFrame);
}
bool CommandInfoProvider::IsExperimental(const OUString& rsCommandName,
@@ -318,7 +235,7 @@ bool CommandInfoProvider::IsExperimental(const OUString& rsCommandName,
{
if( rModuleName.getLength() > 0)
{
- Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(mxContext);
+ Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
Reference<container::XNameAccess> xUICommandLabels;
if (xNameAccess->getByName( rModuleName ) >>= xUICommandLabels )
xUICommandLabels->getByName(rsCommandName) >>= aProperties;
@@ -339,100 +256,60 @@ bool CommandInfoProvider::IsExperimental(const OUString& rsCommandName,
return false;
}
-void CommandInfoProvider::SetFrame (const Reference<frame::XFrame>& rxFrame)
-{
- if (rxFrame != mxCachedDataFrame)
- {
- // Detach from the old frame.
- if (mxFrameListener.is())
- {
- mxFrameListener->dispose();
- mxFrameListener = nullptr;
- }
-
- // Release objects that are tied to the old frame.
- mxCachedDocumentAcceleratorConfiguration = nullptr;
- mxCachedModuleAcceleratorConfiguration = nullptr;
- msCachedModuleIdentifier.clear();
- mxCachedDataFrame = rxFrame;
-
- // Connect to the new frame.
- if (rxFrame.is())
- mxFrameListener = new FrameListener(*this, rxFrame);
- }
-}
-
-Reference<ui::XAcceleratorConfiguration> const & CommandInfoProvider::GetDocumentAcceleratorConfiguration()
+Reference<ui::XAcceleratorConfiguration> const CommandInfoProvider::GetDocumentAcceleratorConfiguration(const Reference<frame::XFrame>& rxFrame)
{
- if ( ! mxCachedDocumentAcceleratorConfiguration.is())
+ Reference<frame::XController> xController = rxFrame->getController();
+ if (xController.is())
{
- // Get the accelerator configuration for the document.
- if (mxCachedDataFrame.is())
+ Reference<frame::XModel> xModel (xController->getModel());
+ if (xModel.is())
{
- Reference<frame::XController> xController = mxCachedDataFrame->getController();
- if (xController.is())
+ Reference<ui::XUIConfigurationManagerSupplier> xSupplier (xModel, UNO_QUERY);
+ if (xSupplier.is())
{
- Reference<frame::XModel> xModel (xController->getModel());
- if (xModel.is())
+ Reference<ui::XUIConfigurationManager> xConfigurationManager(
+ xSupplier->getUIConfigurationManager(),
+ UNO_QUERY);
+ if (xConfigurationManager.is())
{
- Reference<ui::XUIConfigurationManagerSupplier> xSupplier (xModel, UNO_QUERY);
- if (xSupplier.is())
- {
- Reference<ui::XUIConfigurationManager> xConfigurationManager(
- xSupplier->getUIConfigurationManager(),
- UNO_QUERY);
- if (xConfigurationManager.is())
- {
- mxCachedDocumentAcceleratorConfiguration = xConfigurationManager->getShortCutManager();
- }
- }
+ return xConfigurationManager->getShortCutManager();
}
}
}
}
- return mxCachedDocumentAcceleratorConfiguration;
+ return nullptr;
}
-Reference<ui::XAcceleratorConfiguration> const & CommandInfoProvider::GetModuleAcceleratorConfiguration()
+Reference<ui::XAcceleratorConfiguration> const CommandInfoProvider::GetModuleAcceleratorConfiguration(const Reference<frame::XFrame>& rxFrame)
{
- if ( ! mxCachedModuleAcceleratorConfiguration.is())
+ css::uno::Reference<css::ui::XAcceleratorConfiguration> curModuleAcceleratorConfiguration;
+ try
{
- try
- {
- Reference<ui::XModuleUIConfigurationManagerSupplier> xSupplier = ui::theModuleUIConfigurationManagerSupplier::get(mxContext);
- Reference<ui::XUIConfigurationManager> xManager (
- xSupplier->getUIConfigurationManager(GetModuleIdentifier()));
- if (xManager.is())
- {
- mxCachedModuleAcceleratorConfiguration = xManager->getShortCutManager();
- }
- }
- catch (Exception&)
+ Reference<ui::XModuleUIConfigurationManagerSupplier> xSupplier = ui::theModuleUIConfigurationManagerSupplier::get(comphelper::getProcessComponentContext());
+ Reference<ui::XUIConfigurationManager> xManager (
+ xSupplier->getUIConfigurationManager(GetModuleIdentifier(rxFrame)));
+ if (xManager.is())
{
+ curModuleAcceleratorConfiguration = xManager->getShortCutManager();
}
}
- return mxCachedModuleAcceleratorConfiguration;
+ catch (Exception&)
+ {
+ }
+ return curModuleAcceleratorConfiguration;
}
-Reference<ui::XAcceleratorConfiguration> const & CommandInfoProvider::GetGlobalAcceleratorConfiguration()
+Reference<ui::XAcceleratorConfiguration> const CommandInfoProvider::GetGlobalAcceleratorConfiguration()
{
// Get the global accelerator configuration.
- if ( ! mxCachedGlobalAcceleratorConfiguration.is())
- {
- mxCachedGlobalAcceleratorConfiguration = ui::GlobalAcceleratorConfiguration::create(mxContext);
- }
+ return ui::GlobalAcceleratorConfiguration::create(comphelper::getProcessComponentContext());
- return mxCachedGlobalAcceleratorConfiguration;
}
-OUString const & CommandInfoProvider::GetModuleIdentifier()
+OUString const CommandInfoProvider::GetModuleIdentifier(const Reference<frame::XFrame>& rxFrame)
{
- if (msCachedModuleIdentifier.getLength() == 0)
- {
- Reference<frame::XModuleManager2> xModuleManager = frame::ModuleManager::create(mxContext);
- msCachedModuleIdentifier = xModuleManager->identify(mxCachedDataFrame);
- }
- return msCachedModuleIdentifier;
+ Reference<frame::XModuleManager2> xModuleManager = frame::ModuleManager::create(comphelper::getProcessComponentContext());
+ return xModuleManager->identify(rxFrame);
}
OUString CommandInfoProvider::RetrieveShortcutsFromConfiguration(
@@ -462,15 +339,15 @@ OUString CommandInfoProvider::RetrieveShortcutsFromConfiguration(
return OUString();
}
-bool CommandInfoProvider::ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName)
+bool CommandInfoProvider::ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
{
Sequence< OUString > aSequence;
try
{
- const OUString sModuleIdentifier (GetModuleIdentifier());
+ const OUString sModuleIdentifier (GetModuleIdentifier(rxFrame));
if (!sModuleIdentifier.isEmpty())
{
- Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(mxContext);
+ Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
Reference<container::XNameAccess> xUICommandLabels;
if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels) {
xUICommandLabels->getByName(rsResourceName) >>= aSequence;
@@ -488,16 +365,16 @@ bool CommandInfoProvider::ResourceHasKey(const OUString& rsResourceName, const O
return false;
}
-Sequence<beans::PropertyValue> CommandInfoProvider::GetCommandProperties(const OUString& rsCommandName)
+Sequence<beans::PropertyValue> CommandInfoProvider::GetCommandProperties(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
{
Sequence<beans::PropertyValue> aProperties;
try
{
- const OUString sModuleIdentifier (GetModuleIdentifier());
+ const OUString sModuleIdentifier (GetModuleIdentifier(rxFrame));
if (sModuleIdentifier.getLength() > 0)
{
- Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(mxContext);
+ Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
Reference<container::XNameAccess> xUICommandLabels;
if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels)
xUICommandLabels->getByName(rsCommandName) >>= aProperties;
@@ -510,9 +387,9 @@ Sequence<beans::PropertyValue> CommandInfoProvider::GetCommandProperties(const O
return aProperties;
}
-OUString CommandInfoProvider::GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName)
+OUString CommandInfoProvider::GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
{
- const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName));
+ const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName, rxFrame));
for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
{
if (aProperties[nIndex].Name == rsProperty)
@@ -536,7 +413,7 @@ OUString CommandInfoProvider::GetCommandPropertyFromModule( const OUString& rCom
{
if( rModuleName.getLength() > 0)
{
- Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(mxContext);
+ Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
Reference<container::XNameAccess> xUICommandLabels;
if (xNameAccess->getByName( rModuleName ) >>= xUICommandLabels )
xUICommandLabels->getByName(rCommandName) >>= aProperties;
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 709c51e9093b..93494dab537f 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -879,15 +879,15 @@ namespace
if (aCommand.isEmpty())
return;
- OUString aLabel(vcl::CommandInfoProvider::Instance().GetLabelForCommand(aCommand, rFrame));
+ OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(aCommand, rFrame));
if (!aLabel.isEmpty())
pButton->SetText(aLabel);
- OUString aTooltip(vcl::CommandInfoProvider::Instance().GetTooltipForCommand(aCommand, rFrame));
+ OUString aTooltip(vcl::CommandInfoProvider::GetTooltipForCommand(aCommand, rFrame));
if (!aTooltip.isEmpty())
pButton->SetQuickHelpText(aTooltip);
- Image aImage(vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommand, rFrame));
+ Image aImage(vcl::CommandInfoProvider::GetImageForCommand(aCommand, rFrame));
pButton->SetModeImage(aImage);
pButton->SetCommandHandler(aCommand);
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 52b868886ef2..da4f00da89a1 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -510,9 +510,9 @@ void Menu::InsertItem(const OUString& rCommand, const css::uno::Reference<css::f
if (rFrame.is())
{
- OUString aLabel(CommandInfoProvider::Instance().GetPopupLabelForCommand(rCommand, rFrame));
- OUString aTooltip(CommandInfoProvider::Instance().GetTooltipForCommand(rCommand, rFrame));
- Image aImage(CommandInfoProvider::Instance().GetImageForCommand(rCommand, rFrame));
+ OUString aLabel(CommandInfoProvider::GetPopupLabelForCommand(rCommand, rFrame));
+ OUString aTooltip(CommandInfoProvider::GetTooltipForCommand(rCommand, rFrame));
+ Image aImage(CommandInfoProvider::GetImageForCommand(rCommand, rFrame));
InsertItem(nItemId, aLabel, aImage);
SetHelpText(nItemId, aTooltip);
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 9d8a1ba7cccd..6c75ab8ad6cf 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -4540,9 +4540,9 @@ void ToolBox::statusChanged( const css::frame::FeatureStateEvent& Event )
// update image orientation
for (std::vector<ImplToolItem>::const_iterator it = mpData->m_aItems.begin(); it != mpData->m_aItems.end(); ++it)
{
- if (vcl::CommandInfoProvider::Instance().IsMirrored(it->maCommandStr))
+ if (vcl::CommandInfoProvider::IsMirrored(it->maCommandStr, mpStatusListener->getFrame()))
SetItemImageMirrorMode(it->mnId, mbImagesMirrored);
- if (vcl::CommandInfoProvider::Instance().IsRotated(it->maCommandStr))
+ if (vcl::CommandInfoProvider::IsRotated(it->maCommandStr, mpStatusListener->getFrame()))
SetItemImageAngle(it->mnId, mnImagesRotationAngle);
}
}
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 4be71d608377..4fc6c9cba0c4 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -432,8 +432,8 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const OUString& rText, ToolBoxItem
void ToolBox::InsertItem(const OUString& rCommand, const css::uno::Reference<css::frame::XFrame>& rFrame, ToolBoxItemBits nBits,
const Size& rRequestedSize, sal_uInt16 nPos)
{
- OUString aLabel(vcl::CommandInfoProvider::Instance().GetLabelForCommand(rCommand, rFrame));
- OUString aTooltip(vcl::CommandInfoProvider::Instance().GetTooltipForCommand(rCommand, rFrame));
+ OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(rCommand, rFrame));
+ OUString aTooltip(vcl::CommandInfoProvider::GetTooltipForCommand(rCommand, rFrame));
vcl::ImageType eImageType = vcl::ImageType::Size16;
@@ -442,8 +442,7 @@ void ToolBox::InsertItem(const OUString& rCommand, const css::uno::Reference<css
else if (GetToolboxButtonSize() == ToolBoxButtonSize::Size32)
eImageType = vcl::ImageType::Size32;
- CommandInfoProvider& rInfoProvider = vcl::CommandInfoProvider::Instance();
- Image aImage(rInfoProvider.GetImageForCommand(rCommand, rFrame, eImageType));
+ Image aImage(CommandInfoProvider::GetImageForCommand(rCommand, rFrame, eImageType));
sal_uInt16 nItemId = GetItemCount() + 1;
InsertItem(nItemId, aImage, aLabel, nBits, nPos);