[Libreoffice-commits] core.git: 10 commits - dbaccess/source forms/source framework/source include/vcl sd/source sfx2/source svx/source sw/source vcl/inc vcl/source
Maxim Monastirsky
momonasmon at gmail.com
Mon Feb 20 23:54:56 UTC 2017
dbaccess/source/ui/app/AppDetailPageHelper.cxx | 4
dbaccess/source/ui/control/opendoccontrols.cxx | 2
forms/source/solar/control/navtoolbar.cxx | 2
framework/source/accelerators/acceleratorconfiguration.cxx | 15
framework/source/accelerators/globalacceleratorconfiguration.cxx | 34
framework/source/accelerators/moduleacceleratorconfiguration.cxx | 19
framework/source/inc/accelerators/acceleratorconfiguration.hxx | 6
framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx | 3
framework/source/uielement/addonstoolbarmanager.cxx | 6
framework/source/uielement/macrosmenucontroller.cxx | 2
framework/source/uielement/menubarmanager.cxx | 21
framework/source/uielement/newmenucontroller.cxx | 2
framework/source/uielement/popuptoolbarcontroller.cxx | 14
framework/source/uielement/statusbarmanager.cxx | 2
framework/source/uielement/subtoolbarcontroller.cxx | 2
framework/source/uielement/thesaurusmenucontroller.cxx | 2
framework/source/uielement/toolbarmanager.cxx | 14
framework/source/uielement/toolbarsmenucontroller.cxx | 4
include/vcl/commandinfoprovider.hxx | 105 -
include/vcl/vclstatuslistener.hxx | 25
sd/source/ui/controller/slidelayoutcontroller.cxx | 4
sd/source/ui/view/ViewShellBase.cxx | 4
sfx2/source/appl/sfxhelp.cxx | 11
sfx2/source/sidebar/ControllerFactory.cxx | 2
sfx2/source/sidebar/SidebarToolBox.cxx | 2
sfx2/source/view/viewsh.cxx | 4
svx/source/mnuctrls/smarttagmenu.cxx | 2
svx/source/sidebar/shapes/DefaultShapesPanel.cxx | 2
svx/source/tbxctrls/tbcontrl.cxx | 6
sw/source/uibase/shells/frmsh.cxx | 7
vcl/inc/svdata.hxx | 2
vcl/source/app/svmain.cxx | 6
vcl/source/control/button.cxx | 1
vcl/source/control/tabctrl.cxx | 8
vcl/source/helper/commandinfoprovider.cxx | 546 +++-------
vcl/source/window/builder.cxx | 7
vcl/source/window/menu.cxx | 7
vcl/source/window/toolbox.cxx | 6
vcl/source/window/toolbox2.cxx | 8
39 files changed, 341 insertions(+), 578 deletions(-)
New commits:
commit 801422d70133986af45385307a10566af0bc56ee
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Mon Feb 20 22:31:28 2017 +0200
Fix memleak
Change-Id: Ia4bdc254e4967613aedde35cd24ecc4ae6298ae5
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 3540ab1..989da8f 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -2211,13 +2211,7 @@ NotebookbarTabControl::NotebookbarTabControl(vcl::Window* pParent)
, bLastContextWasSupported(true)
, eLastContext(vcl::EnumContext::Context::Any)
{
- LanguageTag aLocale( Application::GetSettings().GetUILanguageTag());
- ResMgr* pResMgr = ResMgr::SearchCreateResMgr( "vcl", aLocale );
-
- Bitmap aBitmap;
- if( pResMgr )
- aBitmap = Bitmap( ResId( SV_RESID_BITMAP_NOTEBOOKBAR, *pResMgr ) );
-
+ Bitmap aBitmap(VclResId(SV_RESID_BITMAP_NOTEBOOKBAR));
InsertPage(1, "");
SetPageImage(1, Image(aBitmap));
}
commit c8dc5650836bd837b5839e2654ec185eb243ff3a
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Mon Feb 20 14:05:09 2017 +0200
Formatting and remove unneeded declaration
Change-Id: Icefd6b869bdbfb3d03f24aea5b94fcf83961d388
diff --git a/include/vcl/commandinfoprovider.hxx b/include/vcl/commandinfoprovider.hxx
index 996d9e5..ce695ce 100644
--- a/include/vcl/commandinfoprovider.hxx
+++ b/include/vcl/commandinfoprovider.hxx
@@ -61,16 +61,11 @@ namespace vcl { namespace CommandInfoProvider {
/** Returns the shortcut for a command in human-readable form */
VCL_DLLPUBLIC OUString GetCommandShortcut (const OUString& rCommandName,
- const css::uno::Reference<css::frame::XFrame>& rxFrame);
+ const css::uno::Reference<css::frame::XFrame>& rxFrame);
VCL_DLLPUBLIC OUString GetRealCommandForCommand( const OUString& rCommandName,
const OUString& rsModuleName );
- VCL_DLLPUBLIC BitmapEx GetBitmapForCommand(
- const OUString& rsCommandName,
- const css::uno::Reference<css::frame::XFrame>& rxFrame,
- vcl::ImageType eImageType = vcl::ImageType::Small);
-
VCL_DLLPUBLIC Image GetImageForCommand(
const OUString& rsCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
diff --git a/vcl/source/helper/commandinfoprovider.cxx b/vcl/source/helper/commandinfoprovider.cxx
index d95ea55..755d41f 100644
--- a/vcl/source/helper/commandinfoprovider.cxx
+++ b/vcl/source/helper/commandinfoprovider.cxx
@@ -271,7 +271,7 @@ OUString GetTooltipForCommand (
}
OUString GetCommandShortcut (const OUString& rsCommandName,
- const Reference<frame::XFrame>& rxFrame)
+ const Reference<frame::XFrame>& rxFrame)
{
OUString sShortcut;
@@ -298,8 +298,8 @@ OUString GetRealCommandForCommand(const OUString& rCommandName,
}
BitmapEx GetBitmapForCommand(const OUString& rsCommandName,
- const Reference<frame::XFrame>& rxFrame,
- vcl::ImageType eImageType)
+ const Reference<frame::XFrame>& rxFrame,
+ vcl::ImageType eImageType)
{
if (rsCommandName.isEmpty())
@@ -364,8 +364,8 @@ BitmapEx GetBitmapForCommand(const OUString& rsCommandName,
}
Image GetImageForCommand(const OUString& rsCommandName,
- const Reference<frame::XFrame>& rxFrame,
- vcl::ImageType eImageType)
+ const Reference<frame::XFrame>& rxFrame,
+ vcl::ImageType eImageType)
{
return Image(GetBitmapForCommand(rsCommandName, rxFrame, eImageType));
}
@@ -398,8 +398,7 @@ bool IsMirrored(const OUString& rsCommandName, const OUString& rsModuleName)
return ResourceHasKey("private:resource/image/commandmirrorimagelist", rsCommandName, rsModuleName);
}
-bool IsExperimental(const OUString& rsCommandName,
- const OUString& rModuleName)
+bool IsExperimental(const OUString& rsCommandName, const OUString& rModuleName)
{
Sequence<beans::PropertyValue> aProperties;
try
commit 8f381b47f5493151f06d77453ff5153cd075a68b
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Mon Feb 20 13:01:46 2017 +0200
Try to cut some costs
Change-Id: I0f541a020232960541bccdf970c042cf3303671e
diff --git a/vcl/source/helper/commandinfoprovider.cxx b/vcl/source/helper/commandinfoprovider.cxx
index dad5b58..d95ea55 100644
--- a/vcl/source/helper/commandinfoprovider.cxx
+++ b/vcl/source/helper/commandinfoprovider.cxx
@@ -22,6 +22,7 @@
#include <vcl/mnemonic.hxx>
#include <comphelper/string.hxx>
#include <comphelper/processfactory.hxx>
+#include <cppuhelper/weakref.hxx>
#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/theUICommandDescription.hpp>
@@ -37,6 +38,48 @@ using namespace css::uno;
namespace vcl { namespace CommandInfoProvider {
+Reference<container::XNameAccess> const GetCommandDescription()
+{
+ static WeakReference<container::XNameAccess> xWeakRef;
+ css::uno::Reference<container::XNameAccess> xRef(xWeakRef);
+
+ if (!xRef.is())
+ {
+ xRef = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
+ xWeakRef = xRef;
+ }
+
+ return xRef;
+}
+
+Reference<ui::XModuleUIConfigurationManagerSupplier> const GetModuleConfigurationSupplier()
+{
+ static WeakReference<ui::XModuleUIConfigurationManagerSupplier> xWeakRef;
+ css::uno::Reference<ui::XModuleUIConfigurationManagerSupplier> xRef(xWeakRef);
+
+ if (!xRef.is())
+ {
+ xRef = ui::theModuleUIConfigurationManagerSupplier::get(comphelper::getProcessComponentContext());
+ xWeakRef = xRef;
+ }
+
+ return xRef;
+}
+
+Reference<ui::XAcceleratorConfiguration> const GetGlobalAcceleratorConfiguration()
+{
+ static WeakReference<ui::XAcceleratorConfiguration> xWeakRef;
+ css::uno::Reference<ui::XAcceleratorConfiguration> xRef(xWeakRef);
+
+ if (!xRef.is())
+ {
+ xRef = ui::GlobalAcceleratorConfiguration::create(comphelper::getProcessComponentContext());
+ xWeakRef = xRef;
+ }
+
+ return xRef;
+}
+
Reference<ui::XAcceleratorConfiguration> const GetDocumentAcceleratorConfiguration(const Reference<frame::XFrame>& rxFrame)
{
Reference<frame::XController> xController = rxFrame->getController();
@@ -49,8 +92,7 @@ Reference<ui::XAcceleratorConfiguration> const GetDocumentAcceleratorConfigurati
if (xSupplier.is())
{
Reference<ui::XUIConfigurationManager> xConfigurationManager(
- xSupplier->getUIConfigurationManager(),
- UNO_QUERY);
+ xSupplier->getUIConfigurationManager());
if (xConfigurationManager.is())
{
return xConfigurationManager->getShortCutManager();
@@ -66,7 +108,7 @@ Reference<ui::XAcceleratorConfiguration> const GetModuleAcceleratorConfiguration
css::uno::Reference<css::ui::XAcceleratorConfiguration> curModuleAcceleratorConfiguration;
try
{
- Reference<ui::XModuleUIConfigurationManagerSupplier> xSupplier = ui::theModuleUIConfigurationManagerSupplier::get(comphelper::getProcessComponentContext());
+ Reference<ui::XModuleUIConfigurationManagerSupplier> xSupplier(GetModuleConfigurationSupplier());
Reference<ui::XUIConfigurationManager> xManager (
xSupplier->getUIConfigurationManager(GetModuleIdentifier(rxFrame)));
if (xManager.is())
@@ -80,13 +122,6 @@ Reference<ui::XAcceleratorConfiguration> const GetModuleAcceleratorConfiguration
return curModuleAcceleratorConfiguration;
}
-Reference<ui::XAcceleratorConfiguration> const GetGlobalAcceleratorConfiguration()
-{
- // Get the global accelerator configuration.
- return ui::GlobalAcceleratorConfiguration::create(comphelper::getProcessComponentContext());
-
-}
-
vcl::KeyCode AWTKey2VCLKey(const awt::KeyEvent& aAWTKey)
{
bool bShift = ((aAWTKey.Modifiers & awt::KeyModifier::SHIFT) == awt::KeyModifier::SHIFT );
@@ -132,7 +167,7 @@ bool ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandNam
{
if (!rsModuleName.isEmpty())
{
- Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
+ Reference<container::XNameAccess> xNameAccess(GetCommandDescription());
Reference<container::XNameAccess> xUICommandLabels;
if (xNameAccess->getByName(rsModuleName) >>= xUICommandLabels)
{
@@ -159,7 +194,7 @@ Sequence<beans::PropertyValue> GetCommandProperties(const OUString& rsCommandNam
{
if (!rsModuleName.isEmpty())
{
- Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
+ Reference<container::XNameAccess> xNameAccess(GetCommandDescription());
Reference<container::XNameAccess> xUICommandLabels;
if (xNameAccess->getByName(rsModuleName) >>= xUICommandLabels)
xUICommandLabels->getByName(rsCommandName) >>= aProperties;
@@ -285,7 +320,7 @@ BitmapEx GetBitmapForCommand(const OUString& rsCommandName,
Reference<ui::XUIConfigurationManagerSupplier> xSupplier(xModel, UNO_QUERY);
if (xSupplier.is())
{
- Reference<ui::XUIConfigurationManager> xDocUICfgMgr(xSupplier->getUIConfigurationManager(), UNO_QUERY);
+ Reference<ui::XUIConfigurationManager> xDocUICfgMgr(xSupplier->getUIConfigurationManager());
Reference<ui::XImageManager> xDocImgMgr(xDocUICfgMgr->getImageManager(), UNO_QUERY);
Sequence< Reference<graphic::XGraphic> > aGraphicSeq;
@@ -305,7 +340,7 @@ BitmapEx GetBitmapForCommand(const OUString& rsCommandName,
}
try {
- Reference<ui::XModuleUIConfigurationManagerSupplier> xModuleCfgMgrSupplier(ui::theModuleUIConfigurationManagerSupplier::get(comphelper::getProcessComponentContext()));
+ Reference<ui::XModuleUIConfigurationManagerSupplier> xModuleCfgMgrSupplier(GetModuleConfigurationSupplier());
Reference<ui::XUIConfigurationManager> xUICfgMgr(xModuleCfgMgrSupplier->getUIConfigurationManager(GetModuleIdentifier(rxFrame)));
Sequence< Reference<graphic::XGraphic> > aGraphicSeq;
@@ -371,7 +406,7 @@ bool IsExperimental(const OUString& rsCommandName,
{
if( rModuleName.getLength() > 0)
{
- Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
+ Reference<container::XNameAccess> xNameAccess(GetCommandDescription());
Reference<container::XNameAccess> xUICommandLabels;
if (xNameAccess->getByName( rModuleName ) >>= xUICommandLabels )
xUICommandLabels->getByName(rsCommandName) >>= aProperties;
@@ -394,11 +429,18 @@ bool IsExperimental(const OUString& rsCommandName,
OUString const GetModuleIdentifier(const Reference<frame::XFrame>& rxFrame)
{
- Reference<frame::XModuleManager2> xModuleManager = frame::ModuleManager::create(comphelper::getProcessComponentContext());
+ static WeakReference<frame::XModuleManager2> xWeakRef;
+ css::uno::Reference<frame::XModuleManager2> xRef(xWeakRef);
+
+ if (!xRef.is())
+ {
+ xRef = frame::ModuleManager::create(comphelper::getProcessComponentContext());
+ xWeakRef = xRef;
+ }
try
{
- return xModuleManager->identify(rxFrame);
+ return xRef->identify(rxFrame);
}
catch (const Exception&)
{}
commit eed06b010ce0c4723a0594df31f08c21fe6faf8d
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Mon Feb 20 12:31:17 2017 +0200
Ignore exceptions in identify
Change-Id: Iccee29668f5d619c4726d09baa4503c6ae38e84b
diff --git a/vcl/source/helper/commandinfoprovider.cxx b/vcl/source/helper/commandinfoprovider.cxx
index 3b22ebb..dad5b58 100644
--- a/vcl/source/helper/commandinfoprovider.cxx
+++ b/vcl/source/helper/commandinfoprovider.cxx
@@ -395,7 +395,15 @@ bool IsExperimental(const OUString& rsCommandName,
OUString const GetModuleIdentifier(const Reference<frame::XFrame>& rxFrame)
{
Reference<frame::XModuleManager2> xModuleManager = frame::ModuleManager::create(comphelper::getProcessComponentContext());
- return xModuleManager->identify(rxFrame);
+
+ try
+ {
+ return xModuleManager->identify(rxFrame);
+ }
+ catch (const Exception&)
+ {}
+
+ return OUString();
}
} }
commit 5ccea065247dffe1c29923619b39d63b2e1c5911
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Sun Feb 19 15:15:54 2017 +0200
VclStatusListener: Listener needs to be acquire'd first
because as soon as we're wrapped somewhere with a temp.
uno/rtl::Reference, its destruction will lead to our own
destruction while we're still in ctor. Typical situation
is when the broadcaster rejects our listening request.
Change-Id: I7fd282e53095ab9939f803df9564c9767263b1f8
diff --git a/include/vcl/vclstatuslistener.hxx b/include/vcl/vclstatuslistener.hxx
index c18d2ac..42894dd 100644
--- a/include/vcl/vclstatuslistener.hxx
+++ b/include/vcl/vclstatuslistener.hxx
@@ -41,6 +41,8 @@ public:
const css::uno::Reference<css::frame::XFrame>& getFrame() { return mxFrame; }
+ void startListening();
+
void dispose();
};
@@ -57,19 +59,24 @@ VclStatusListener<T>::VclStatusListener(T* widget, const rtl::OUString& aCommand
mxFrame = xFrame;
- css::uno::Reference<css::frame::XDispatchProvider> xDispatchProvider(xFrame, css::uno::UNO_QUERY);
- if (!xDispatchProvider.is())
- return;
-
maCommandURL.Complete = aCommand;
css::uno::Reference<css::util::XURLTransformer> xParser = css::util::URLTransformer::create(xContext);
xParser->parseStrict(maCommandURL);
+}
- mxDispatch = xDispatchProvider->queryDispatch(maCommandURL, "", 0);
- if (!mxDispatch.is())
+template<class T>
+void VclStatusListener<T>::startListening()
+{
+ if (mxDispatch.is())
+ mxDispatch->removeStatusListener(this, maCommandURL);
+
+ css::uno::Reference<css::frame::XDispatchProvider> xDispatchProvider(mxFrame, css::uno::UNO_QUERY);
+ if (!xDispatchProvider.is())
return;
- mxDispatch->addStatusListener(this, maCommandURL);
+ mxDispatch = xDispatchProvider->queryDispatch(maCommandURL, "", 0);
+ if (mxDispatch.is())
+ mxDispatch->addStatusListener(this, maCommandURL);
}
template<class T>
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index e565639..e94df63 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -115,6 +115,7 @@ void Button::SetCommandHandler(const OUString& aCommand)
SetClickHdl( LINK( this, Button, dispatchCommandHandler) );
mpButtonData->mpStatusListener = new VclStatusListener<Button>(this, aCommand);
+ mpButtonData->mpStatusListener->startListening();
}
void Button::Click()
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index dfee6f2..5490748 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -1401,6 +1401,7 @@ void ToolBox::ImplInitToolBoxData()
mnActivateCount = 0;
mnImagesRotationAngle = 0;
mpStatusListener = new VclStatusListener<ToolBox>(this, ".uno:ImageOrientation");
+ mpStatusListener->startListening();
mpIdle = new Idle("vcl::ToolBox maIdle update");
mpIdle->SetPriority( TaskPriority::RESIZE );
commit b6994cb75fb7e34574d933dff58fcec3bb1ab922
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Sun Feb 19 14:38:32 2017 +0200
Use module name when getting labels
Change-Id: I1d5196e1ca888dfb11d5bd6ef4676937dce49fdc
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 1e9ca06..240b9fa 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::GetCommandPropertyFromModule(".uno:DBDisablePreview", "com.sun.star.sdb.OfficeDatabaseDocument"),
+ vcl::CommandInfoProvider::GetLabelForCommand(".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::GetCommandPropertyFromModule(aCommand, "com.sun.star.sdb.OfficeDatabaseDocument");
+ OUString aCommandLabel = vcl::CommandInfoProvider::GetLabelForCommand(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 dff3368..207e017 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::GetCommandPropertyFromModule(".uno:Open", m_sModule));
+ OUString sLabel(vcl::CommandInfoProvider::GetLabelForCommand(".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 0a66584..f2be671 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::GetCommandPropertyFromModule(sCommandURL, m_sModuleId) );
+ vcl::CommandInfoProvider::GetLabelForCommand(sCommandURL, m_sModuleId) );
}
if ( pSupportedFeatures->bItemWindow )
diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx
index dcff602..c67c7c5 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::GetMenuLabelForCommand(aCommand, m_xFrame);
+ OUString aDisplayName = vcl::CommandInfoProvider::GetMenuLabelForCommand(aCommand, m_aModuleName);
pPopupMenu->InsertItem( 2, aDisplayName );
pPopupMenu->SetItemCommand( 2, aCommand );
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 6e3cc8d..989943e 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -1082,9 +1082,9 @@ OUString MenuBarManager::RetrieveLabelFromCommand(const OUString& rCmdURL)
if ( !m_bHasMenuBar )
{
// This is a context menu, prefer "PopupLabel" over "Label".
- return vcl::CommandInfoProvider::GetPopupLabelForCommand(rCmdURL, m_xFrame);
+ return vcl::CommandInfoProvider::GetPopupLabelForCommand(rCmdURL, m_aModuleIdentifier);
}
- return vcl::CommandInfoProvider::GetMenuLabelForCommand(rCmdURL, m_xFrame);
+ return vcl::CommandInfoProvider::GetMenuLabelForCommand(rCmdURL, m_aModuleIdentifier);
}
bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHandler )
@@ -1180,7 +1180,7 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
}
// Command can be just an alias to another command.
- OUString aRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( aItemCommand, m_xFrame );
+ OUString aRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( aItemCommand, m_aModuleIdentifier );
if ( !aRealCommand.isEmpty() )
aItemCommand = aRealCommand;
diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx
index 4a13605..3fa27a8 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::GetRealCommandForCommand( rCommand, m_xFrame ) );
+ OUString aRealCommand( vcl::CommandInfoProvider::GetRealCommandForCommand( rCommand, m_sModuleName ) );
m_aCommandURL = aRealCommand.isEmpty() ? rCommand : aRealCommand;
addStatusListener( m_aCommandURL );
@@ -380,7 +380,7 @@ 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::GetLabelForCommand( rCommand, m_xFrame ) );
+ pToolBox->SetItemText( nId, vcl::CommandInfoProvider::GetLabelForCommand( rCommand, m_sModuleName ) );
pToolBox->SetQuickHelpText( nId, vcl::CommandInfoProvider::GetTooltipForCommand( rCommand, m_xFrame ) );
vcl::ImageType eImageType = getImageType(pToolBox->GetToolboxButtonSize());
diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx
index 06baee2..53fc6dd 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::GetLabelForCommand(aCommandURL, m_xFrame));
+ OUString aString( vcl::CommandInfoProvider::GetLabelForCommand(aCommandURL, m_aModuleIdentifier));
StatusBarItemBits nItemBits( impl_convertItemStyleToItemBits( nStyle ));
m_pStatusBar->InsertItem( nId, nWidth, nItemBits, nOffset );
diff --git a/framework/source/uielement/thesaurusmenucontroller.cxx b/framework/source/uielement/thesaurusmenucontroller.cxx
index cfbe7e8..d5eeca2 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::GetPopupLabelForCommand( aThesaurusDialogCmd, m_xFrame ) );
+ pVCLMenu->InsertItem( nId, vcl::CommandInfoProvider::GetPopupLabelForCommand( aThesaurusDialogCmd, m_aModuleName ) );
pVCLMenu->SetItemCommand( nId, aThesaurusDialogCmd );
}
}
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index c3fa5ea..518ef1a 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -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::GetRealCommandForCommand( aCommandURL, m_xFrame ) );
+ OUString aRealCommandURL( vcl::CommandInfoProvider::GetRealCommandForCommand( aCommandURL, m_aModuleIdentifier ) );
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::GetPropertiesForCommand(aCommandURL, m_xFrame);
+ sal_Int32 nProps = vcl::CommandInfoProvider::GetPropertiesForCommand(aCommandURL, m_aModuleIdentifier);
if ( nProps & UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON )
m_pToolBar->SetItemBits( nId, m_pToolBar->GetItemBits( nId ) | ToolBoxItemBits::CHECKABLE );
}
@@ -1021,7 +1021,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine
if (( nType == css::ui::ItemType::DEFAULT ) && !aCommandURL.isEmpty() )
{
- OUString aString(vcl::CommandInfoProvider::GetLabelForCommand(aCommandURL, m_xFrame));
+ OUString aString(vcl::CommandInfoProvider::GetLabelForCommand(aCommandURL, m_aModuleIdentifier));
ToolBoxItemBits nItemBits = ConvertStyleToToolboxItemBits( nStyle );
m_pToolBar->InsertItem( nId, aString, nItemBits );
diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx
index 9b6bc5e..8633c1c 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::GetMenuLabelForCommand( rCommandURL, m_xFrame );
+ aLabel = vcl::CommandInfoProvider::GetMenuLabelForCommand( rCommandURL, m_aModuleName );
else
aLabel = rLabel;
diff --git a/include/vcl/commandinfoprovider.hxx b/include/vcl/commandinfoprovider.hxx
index d254ee3..996d9e5 100644
--- a/include/vcl/commandinfoprovider.hxx
+++ b/include/vcl/commandinfoprovider.hxx
@@ -29,22 +29,22 @@ namespace vcl { namespace CommandInfoProvider {
/** Return a label for the given command.
@param rsCommandName
The command name is expected to start with .uno:
- @param rxFrame
- The frame is used to identify the module and document.
+ @param rsModuleName
+ The current application module.
@return
The command label.
*/
VCL_DLLPUBLIC OUString GetLabelForCommand (
const OUString& rsCommandName,
- const css::uno::Reference<css::frame::XFrame>& rxFrame);
+ const OUString& rsModuleName);
VCL_DLLPUBLIC OUString GetMenuLabelForCommand (
const OUString& rsCommandName,
- const css::uno::Reference<css::frame::XFrame>& rxFrame);
+ const OUString& rsModuleName);
VCL_DLLPUBLIC OUString GetPopupLabelForCommand (
const OUString& rsCommandName,
- const css::uno::Reference<css::frame::XFrame>& rxFrame);
+ const OUString& rsModuleName);
/** Return a tooltip for the given command. Falls back to label if command has no tooltip.
@param rsCommandName
@@ -64,9 +64,7 @@ namespace vcl { namespace CommandInfoProvider {
const css::uno::Reference<css::frame::XFrame>& rxFrame);
VCL_DLLPUBLIC OUString GetRealCommandForCommand( const OUString& rCommandName,
- const css::uno::Reference<css::frame::XFrame>& rxFrame );
-
- VCL_DLLPUBLIC OUString GetCommandPropertyFromModule( const OUString& rCommandName, const OUString& rModuleName );
+ const OUString& rsModuleName );
VCL_DLLPUBLIC BitmapEx GetBitmapForCommand(
const OUString& rsCommandName,
@@ -80,10 +78,10 @@ namespace vcl { namespace CommandInfoProvider {
VCL_DLLPUBLIC sal_Int32 GetPropertiesForCommand(
const OUString& rsCommandName,
- const css::uno::Reference<css::frame::XFrame>& rxFrame);
+ const OUString& rsModuleName);
- VCL_DLLPUBLIC bool IsRotated(const OUString& rsCommandName,const css::uno::Reference<css::frame::XFrame>& rxFrame);
- VCL_DLLPUBLIC bool IsMirrored(const OUString& rsCommandName, const css::uno::Reference<css::frame::XFrame>& rxFrame);
+ VCL_DLLPUBLIC bool IsRotated(const OUString& rsCommandName, const OUString& rsModuleName);
+ VCL_DLLPUBLIC bool IsMirrored(const OUString& rsCommandName, const OUString& rsModuleName);
/** Returns whether the command is experimental. */
VCL_DLLPUBLIC bool IsExperimental(
diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx
index e2f2cfa..95b3420 100644
--- a/sd/source/ui/controller/slidelayoutcontroller.cxx
+++ b/sd/source/ui/controller/slidelayoutcontroller.cxx
@@ -245,7 +245,7 @@ LayoutToolbarMenu::LayoutToolbarMenu( SlideLayoutController& rController, vcl::W
OUString sSlotTitle;
if( bInsertPage )
- sSlotTitle = vcl::CommandInfoProvider::GetLabelForCommand( sSlotStr, xFrame );
+ sSlotTitle = vcl::CommandInfoProvider::GetLabelForCommand( sSlotStr, rController.getModuleName() );
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 378747e..5e20423 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -975,8 +975,8 @@ vcl::Window* ViewShellBase::GetViewWindow()
OUString ViewShellBase::RetrieveLabelFromCommand( const OUString& aCmdURL ) const
{
- Reference< XFrame > xFrame( GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(), UNO_QUERY );
- return vcl::CommandInfoProvider::GetLabelForCommand( aCmdURL, xFrame );
+ OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface()));
+ return vcl::CommandInfoProvider::GetLabelForCommand( aCmdURL, aModuleName );
}
int ViewShellBase::getPart() const
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index a8dce9d..2fa709a 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -259,13 +259,6 @@ OUString getDefaultModule_Impl()
return sDefaultModule;
}
-Reference< XFrame > getCurrentFrame()
-{
- Reference < XComponentContext > xContext = ::comphelper::getProcessComponentContext();
- Reference < XDesktop2 > xDesktop = Desktop::create(xContext);
- return xDesktop->getCurrentFrame();
-}
-
OUString getCurrentModuleIdentifier_Impl()
{
OUString sIdentifier;
@@ -446,7 +439,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::GetRealCommandForCommand( aCommandURL, getCurrentFrame() );
+ OUString sRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( aCommandURL, getCurrentModuleIdentifier_Impl() );
OUString sHelpText = SfxHelp_Impl::GetHelpText( sRealCommand.isEmpty() ? aCommandURL : sRealCommand, sModuleName );
OString aNewHelpId;
@@ -564,7 +557,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::GetRealCommandForCommand( rURL, getCurrentFrame() );
+ aRealCommand = vcl::CommandInfoProvider::GetRealCommandForCommand( rURL, getCurrentModuleIdentifier_Impl() );
// 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/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 7e84a76..071d6e1 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -720,7 +720,7 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet )
OUStringBuffer aBuffer( 60 );
aBuffer.append( vcl::CommandInfoProvider::GetLabelForCommand(
".uno:PrintDefault",
- xFrame ));
+ vcl::CommandInfoProvider::GetModuleIdentifier( xFrame ) ) );
aBuffer.append( " (" );
aBuffer.append( aPrinterName );
aBuffer.append(')');
diff --git a/svx/source/mnuctrls/smarttagmenu.cxx b/svx/source/mnuctrls/smarttagmenu.cxx
index 5d0eb6e..af73107 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::GetPopupLabelForCommand( aCommand, m_xFrame ) );
+ pVCLMenu->InsertItem( nMenuId, vcl::CommandInfoProvider::GetPopupLabelForCommand( aCommand, m_aModuleName ) );
pVCLMenu->SetItemCommand( nMenuId, aCommand );
}
}
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index c1f2a3a..28bc427 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1312,9 +1312,7 @@ SvxColorWindow::SvxColorWindow(const OUString& rCommand,
}
}
- OUString aWindowTitle = vcl::CommandInfoProvider::GetLabelForCommand( rCommand, rFrame );
- SetText( aWindowTitle );
- mpColorSet->SetAccessibleName( aWindowTitle );
+ mpColorSet->SetAccessibleName( GetText() );
mpPaletteListBox->SetStyle( mpPaletteListBox->GetStyle() | WB_BORDER | WB_AUTOSIZE );
mpPaletteListBox->SetSelectHdl( LINK( this, SvxColorWindow, SelectPaletteHdl ) );
@@ -2831,6 +2829,8 @@ VclPtr<SfxPopupWindow> SvxColorToolBoxControl::CreatePopupWindow()
&GetToolBox(),
m_aColorSelectFunction);
+ OUString aWindowTitle = vcl::CommandInfoProvider::GetLabelForCommand( m_aCommandURL, m_sModuleName );
+ pColorWin->SetText( aWindowTitle );
pColorWin->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus);
pColorWin->StartSelection();
SetPopupWindow(pColorWin);
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index 811282d..b2b6a19 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -806,19 +806,20 @@ void SwFrameShell::GetState(SfxItemSet& rSet)
}
}
}
+ OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(GetFrame()->GetFrame().GetFrameInterface()));
switch (nWhich)
{
case SID_OBJECT_ALIGN_UP :
case FN_FRAME_ALIGN_VERT_TOP:
- sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignTop", GetFrame()->GetFrame().GetFrameInterface());
+ sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignTop", aModuleName);
break;
case SID_OBJECT_ALIGN_MIDDLE:
case FN_FRAME_ALIGN_VERT_CENTER:
- sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignVerticalCenter", GetFrame()->GetFrame().GetFrameInterface());
+ sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignVerticalCenter", aModuleName);
break;
case SID_OBJECT_ALIGN_DOWN:
case FN_FRAME_ALIGN_VERT_BOTTOM:
- sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignBottom", GetFrame()->GetFrame().GetFrameInterface());
+ sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(".uno:AlignBottom", aModuleName);
break;
}
}
diff --git a/vcl/source/helper/commandinfoprovider.cxx b/vcl/source/helper/commandinfoprovider.cxx
index 4b5b2b4..3b22ebb 100644
--- a/vcl/source/helper/commandinfoprovider.cxx
+++ b/vcl/source/helper/commandinfoprovider.cxx
@@ -125,17 +125,17 @@ OUString RetrieveShortcutsFromConfiguration(
return OUString();
}
-bool ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
+bool ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName, const OUString& rsModuleName)
{
Sequence< OUString > aSequence;
try
{
- const OUString sModuleIdentifier (GetModuleIdentifier(rxFrame));
- if (!sModuleIdentifier.isEmpty())
+ if (!rsModuleName.isEmpty())
{
Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
Reference<container::XNameAccess> xUICommandLabels;
- if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels) {
+ if (xNameAccess->getByName(rsModuleName) >>= xUICommandLabels)
+ {
xUICommandLabels->getByName(rsResourceName) >>= aSequence;
for ( sal_Int32 i = 0; i < aSequence.getLength(); i++ )
{
@@ -151,18 +151,17 @@ bool ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandNam
return false;
}
-Sequence<beans::PropertyValue> GetCommandProperties(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
+Sequence<beans::PropertyValue> GetCommandProperties(const OUString& rsCommandName, const OUString& rsModuleName)
{
Sequence<beans::PropertyValue> aProperties;
try
{
- const OUString sModuleIdentifier (GetModuleIdentifier(rxFrame));
- if (sModuleIdentifier.getLength() > 0)
+ if (!rsModuleName.isEmpty())
{
Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
Reference<container::XNameAccess> xUICommandLabels;
- if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels)
+ if (xNameAccess->getByName(rsModuleName) >>= xUICommandLabels)
xUICommandLabels->getByName(rsCommandName) >>= aProperties;
}
}
@@ -173,9 +172,9 @@ Sequence<beans::PropertyValue> GetCommandProperties(const OUString& rsCommandNam
return aProperties;
}
-OUString GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
+OUString GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName, const OUString& rsModuleName)
{
- const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName, rxFrame));
+ const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName, rsModuleName));
for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
{
if (aProperties[nIndex].Name == rsProperty)
@@ -190,41 +189,38 @@ OUString GetCommandProperty(const OUString& rsProperty, const OUString& rsComman
OUString GetLabelForCommand (
const OUString& rsCommandName,
- const Reference<frame::XFrame>& rxFrame)
+ const OUString& rsModuleName)
{
-
- return GetCommandProperty("Name", rsCommandName, rxFrame);
+ return GetCommandProperty("Name", rsCommandName, rsModuleName);
}
OUString GetMenuLabelForCommand (
const OUString& rsCommandName,
- const Reference<frame::XFrame>& rxFrame)
+ const OUString& rsModuleName)
{
-
// 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, rxFrame);
+ return GetCommandProperty("Label", rsCommandName, rsModuleName);
}
OUString GetPopupLabelForCommand (
const OUString& rsCommandName,
- const css::uno::Reference<css::frame::XFrame>& rxFrame)
+ const OUString& rsModuleName)
{
-
- OUString sPopupLabel(GetCommandProperty("PopupLabel", rsCommandName, rxFrame));
+ OUString sPopupLabel(GetCommandProperty("PopupLabel", rsCommandName, rsModuleName));
if (!sPopupLabel.isEmpty())
return sPopupLabel;
- return GetCommandProperty("Label", rsCommandName, rxFrame);
+ return GetCommandProperty("Label", rsCommandName, rsModuleName);
}
OUString GetTooltipForCommand (
const OUString& rsCommandName,
const Reference<frame::XFrame>& rxFrame)
{
-
- OUString sLabel (GetCommandProperty("TooltipLabel", rsCommandName, rxFrame));
+ OUString sModuleName(GetModuleIdentifier(rxFrame));
+ OUString sLabel (GetCommandProperty("TooltipLabel", rsCommandName, sModuleName));
if (sLabel.isEmpty()) {
- sLabel = GetPopupLabelForCommand(rsCommandName, rxFrame);
+ sLabel = GetPopupLabelForCommand(rsCommandName, sModuleName);
// Remove '...' at the end and mnemonics (we don't want those in tooltips)
sLabel = comphelper::string::stripEnd(sLabel, '.');
sLabel = MnemonicGenerator::EraseAllMnemonicChars(sLabel);
@@ -232,7 +228,7 @@ OUString GetTooltipForCommand (
// Command can be just an alias to another command,
// so need to get the shortcut of the "real" command.
- const OUString sRealCommand(GetRealCommandForCommand(rsCommandName, rxFrame));
+ const OUString sRealCommand(GetRealCommandForCommand(rsCommandName, sModuleName));
const OUString sShortCut(GetCommandShortcut(!sRealCommand.isEmpty() ? sRealCommand : rsCommandName, rxFrame));
if (!sShortCut.isEmpty())
return sLabel + " (" + sShortCut + ")";
@@ -261,10 +257,9 @@ OUString GetCommandShortcut (const OUString& rsCommandName,
}
OUString GetRealCommandForCommand(const OUString& rCommandName,
- const css::uno::Reference<frame::XFrame>& rxFrame)
+ const OUString& rsModuleName)
{
-
- return GetCommandProperty("TargetURL", rCommandName, rxFrame);
+ return GetCommandProperty("TargetURL", rCommandName, rsModuleName);
}
BitmapEx GetBitmapForCommand(const OUString& rsCommandName,
@@ -342,11 +337,11 @@ Image GetImageForCommand(const OUString& rsCommandName,
sal_Int32 GetPropertiesForCommand (
const OUString& rsCommandName,
- const Reference<frame::XFrame>& rxFrame)
+ const OUString& rsModuleName)
{
sal_Int32 nValue = 0;
- const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName, rxFrame));
+ const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName, rsModuleName));
for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
{
if (aProperties[nIndex].Name == "Properties")
@@ -358,14 +353,14 @@ sal_Int32 GetPropertiesForCommand (
return nValue;
}
-bool IsRotated(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
+bool IsRotated(const OUString& rsCommandName, const OUString& rsModuleName)
{
- return ResourceHasKey("private:resource/image/commandrotateimagelist", rsCommandName, rxFrame);
+ return ResourceHasKey("private:resource/image/commandrotateimagelist", rsCommandName, rsModuleName);
}
-bool IsMirrored(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
+bool IsMirrored(const OUString& rsCommandName, const OUString& rsModuleName)
{
- return ResourceHasKey("private:resource/image/commandmirrorimagelist", rsCommandName, rxFrame);
+ return ResourceHasKey("private:resource/image/commandmirrorimagelist", rsCommandName, rsModuleName);
}
bool IsExperimental(const OUString& rsCommandName,
@@ -403,38 +398,6 @@ OUString const GetModuleIdentifier(const Reference<frame::XFrame>& rxFrame)
return xModuleManager->identify(rxFrame);
}
-OUString GetCommandPropertyFromModule( const OUString& rCommandName, const OUString& rModuleName )
-{
- OUString sLabel;
- if ( rCommandName.isEmpty() )
- return sLabel;
-
- Sequence<beans::PropertyValue> aProperties;
- try
- {
- if( rModuleName.getLength() > 0)
- {
- Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
- Reference<container::XNameAccess> xUICommandLabels;
- if (xNameAccess->getByName( rModuleName ) >>= xUICommandLabels )
- xUICommandLabels->getByName(rCommandName) >>= aProperties;
-
- for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
- {
- if(aProperties[nIndex].Name == "Label")
- {
- aProperties[nIndex].Value >>= sLabel;
- return sLabel;
- }
- }
- }
- }
- catch (Exception&)
- {
- }
- return OUString();
-}
-
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 93494da..f24029d 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -879,7 +879,8 @@ namespace
if (aCommand.isEmpty())
return;
- OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(aCommand, rFrame));
+ OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(rFrame));
+ OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(aCommand, aModuleName));
if (!aLabel.isEmpty())
pButton->SetText(aLabel);
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index da4f00d..1e961b8 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -510,7 +510,8 @@ void Menu::InsertItem(const OUString& rCommand, const css::uno::Reference<css::f
if (rFrame.is())
{
- OUString aLabel(CommandInfoProvider::GetPopupLabelForCommand(rCommand, rFrame));
+ OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(rFrame));
+ OUString aLabel(CommandInfoProvider::GetPopupLabelForCommand(rCommand, aModuleName));
OUString aTooltip(CommandInfoProvider::GetTooltipForCommand(rCommand, rFrame));
Image aImage(CommandInfoProvider::GetImageForCommand(rCommand, rFrame));
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 6c75ab8..dfee6f2 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -4538,11 +4538,12 @@ void ToolBox::statusChanged( const css::frame::FeatureStateEvent& Event )
mnImagesRotationAngle = aItem.GetRotation();
// update image orientation
+ OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(mpStatusListener->getFrame()));
for (std::vector<ImplToolItem>::const_iterator it = mpData->m_aItems.begin(); it != mpData->m_aItems.end(); ++it)
{
- if (vcl::CommandInfoProvider::IsMirrored(it->maCommandStr, mpStatusListener->getFrame()))
+ if (vcl::CommandInfoProvider::IsMirrored(it->maCommandStr, aModuleName))
SetItemImageMirrorMode(it->mnId, mbImagesMirrored);
- if (vcl::CommandInfoProvider::IsRotated(it->maCommandStr, mpStatusListener->getFrame()))
+ if (vcl::CommandInfoProvider::IsRotated(it->maCommandStr, aModuleName))
SetItemImageAngle(it->mnId, mnImagesRotationAngle);
}
}
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 4fc6c9c..b95e1a8 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -432,7 +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::GetLabelForCommand(rCommand, rFrame));
+ OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(rFrame));
+ OUString aLabel(vcl::CommandInfoProvider::GetLabelForCommand(rCommand, aModuleName));
OUString aTooltip(vcl::CommandInfoProvider::GetTooltipForCommand(rCommand, rFrame));
vcl::ImageType eImageType = vcl::ImageType::Size16;
commit 8c5a3b448a50981b41b2860c64a3039265398cf9
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Sun Feb 19 11:56:37 2017 +0200
Single GlobalAcceleratorConfiguration should be enough
avoid reading the configuration again and again.
Change-Id: I4179da53114990e5ee68b47125ccef356ca00d53
diff --git a/framework/source/accelerators/globalacceleratorconfiguration.cxx b/framework/source/accelerators/globalacceleratorconfiguration.cxx
index ba5a2e4..d8d1f85 100644
--- a/framework/source/accelerators/globalacceleratorconfiguration.cxx
+++ b/framework/source/accelerators/globalacceleratorconfiguration.cxx
@@ -111,6 +111,22 @@ void GlobalAcceleratorConfiguration::fillCache()
{}
}
+struct Instance
+{
+ explicit Instance(css::uno::Reference<css::uno::XComponentContext> const & context)
+ : instance(new GlobalAcceleratorConfiguration(context))
+ {
+ instance->fillCache();
+ }
+
+ rtl::Reference<GlobalAcceleratorConfiguration> instance;
+};
+
+struct Singleton:
+ public rtl::StaticWithArg<
+ Instance, css::uno::Reference<css::uno::XComponentContext>, Singleton>
+{};
+
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
@@ -118,12 +134,7 @@ com_sun_star_comp_framework_GlobalAcceleratorConfiguration_get_implementation(
css::uno::XComponentContext *context,
css::uno::Sequence<css::uno::Any> const &)
{
- GlobalAcceleratorConfiguration *inst = new GlobalAcceleratorConfiguration(context);
- css::uno::XInterface *acquired_inst = cppu::acquire(inst);
-
- inst->fillCache();
-
- return acquired_inst;
+ return cppu::acquire(static_cast<cppu::OWeakObject*>(Singleton::get(context).instance.get()));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 7e559e549528686d431056bd1bbbc9c0a0bfb304
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Sun Feb 19 09:48:33 2017 +0200
Revert "Resolves: #i120029# Unregister on dispose."
This reverts commit 11f8e53d6c9942185702552445a751c6f542942d.
At the time this commit was imported from AOO, we had the
original problem fixed already with
dd8fa7c25af9614dbee5a7795b95d8583093f65b ("fix more lifecycle
problems").
Change-Id: Id8288d30c1cb908b68e5b9ef0279237412aae357
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index c348f92..93c494bd 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -994,21 +994,6 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::disposing(const css::lang::Event
{
}
-void SAL_CALL XCUBasedAcceleratorConfiguration::dispose()
-{
- // nop
-}
-
-void SAL_CALL XCUBasedAcceleratorConfiguration::addEventListener( const css::uno::Reference< css::lang::XEventListener >& /*xListener*/ )
-{
- // nop
-}
-
-void SAL_CALL XCUBasedAcceleratorConfiguration::removeEventListener( const css::uno::Reference< css::lang::XEventListener >& /*xListener*/ )
-{
- // nop
-}
-
void XCUBasedAcceleratorConfiguration::impl_ts_load( bool bPreferred, const css::uno::Reference< css::container::XNameAccess >& xCfg )
{
AcceleratorCache aReadCache = AcceleratorCache();
diff --git a/framework/source/accelerators/globalacceleratorconfiguration.cxx b/framework/source/accelerators/globalacceleratorconfiguration.cxx
index 5648c91..ba5a2e4 100644
--- a/framework/source/accelerators/globalacceleratorconfiguration.cxx
+++ b/framework/source/accelerators/globalacceleratorconfiguration.cxx
@@ -69,9 +69,6 @@ public:
return {"com.sun.star.ui.GlobalAcceleratorConfiguration"};
}
- // XComponent
- virtual void SAL_CALL dispose() override;
-
/// This has to be called after when the instance is acquire()'d.
void fillCache();
@@ -114,22 +111,6 @@ void GlobalAcceleratorConfiguration::fillCache()
{}
}
-// XComponent.dispose(), #i120029#, to release the cyclic reference
-
-void SAL_CALL GlobalAcceleratorConfiguration::dispose()
-{
- try
- {
- css::uno::Reference< css::util::XChangesNotifier > xBroadcaster(m_xCfg, css::uno::UNO_QUERY_THROW);
- if ( xBroadcaster.is() )
- xBroadcaster->removeChangesListener(static_cast< css::util::XChangesListener* >(this));
- }
- catch(const css::uno::RuntimeException&)
- { throw; }
- catch(const css::uno::Exception&)
- {}
-}
-
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
diff --git a/framework/source/accelerators/moduleacceleratorconfiguration.cxx b/framework/source/accelerators/moduleacceleratorconfiguration.cxx
index f6cfa4d..ea4c5f3 100644
--- a/framework/source/accelerators/moduleacceleratorconfiguration.cxx
+++ b/framework/source/accelerators/moduleacceleratorconfiguration.cxx
@@ -83,9 +83,6 @@ public:
return {"com.sun.star.ui.ModuleAcceleratorConfiguration"};
}
- // XComponent
- virtual void SAL_CALL dispose() override;
-
/// This has to be called after when the instance is acquire()'d.
void SAL_CALL fillCache();
@@ -150,22 +147,6 @@ void ModuleAcceleratorConfiguration::fillCache()
{}
}
-// XComponent.dispose(), #i120029#, to release the cyclic reference
-
-void SAL_CALL ModuleAcceleratorConfiguration::dispose()
-{
- try
- {
- css::uno::Reference< css::util::XChangesNotifier > xBroadcaster(m_xCfg, css::uno::UNO_QUERY_THROW);
- if ( xBroadcaster.is() )
- xBroadcaster->removeChangesListener(static_cast< css::util::XChangesListener* >(this));
- }
- catch(const css::uno::RuntimeException&)
- { throw; }
- catch(const css::uno::Exception&)
- {}
-}
-
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
diff --git a/framework/source/inc/accelerators/acceleratorconfiguration.hxx b/framework/source/inc/accelerators/acceleratorconfiguration.hxx
index bf14189..7d7cd6c 100644
--- a/framework/source/inc/accelerators/acceleratorconfiguration.hxx
+++ b/framework/source/inc/accelerators/acceleratorconfiguration.hxx
@@ -201,7 +201,6 @@ class XMLBasedAcceleratorConfiguration : public ::cppu::WeakImplHelper<
class XCUBasedAcceleratorConfiguration : public ::cppu::WeakImplHelper<
css::util::XChangesListener,
- css::lang::XComponent,
css::form::XReset, // TODO use XPresetHandler instead if available
css::ui::XAcceleratorConfiguration > // => css::ui::XUIConfigurationPersistence
// css::ui::XUIConfigurationStorage
@@ -287,11 +286,6 @@ class XCUBasedAcceleratorConfiguration : public ::cppu::WeakImplHelper<
// css.lang.XEventListener
virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) override;
- // XComponent
- virtual void SAL_CALL dispose() override;
- virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
- virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
-
// helper for derived classes
protected:
diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index 3543f2e..9950342 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -940,9 +940,6 @@ void SAL_CALL ModuleUIConfigurationManager::dispose()
SolarMutexClearableGuard aGuard;
Reference< XComponent > xModuleImageManager( m_xModuleImageManager );
m_xModuleImageManager.clear();
- Reference< XComponent > xCompMAM( m_xModuleAcceleratorManager, UNO_QUERY );
- if ( xCompMAM.is() )
- xCompMAM->dispose();
m_xModuleAcceleratorManager.clear();
m_aUIElements[LAYER_USERDEFINED].clear();
m_aUIElements[LAYER_DEFAULT].clear();
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 1f9c968..6e3cc8d 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -296,9 +296,6 @@ void SAL_CALL MenuBarManager::dispose()
}
m_xDocImageManager.clear();
m_xModuleImageManager.clear();
- Reference< XComponent > xCompGAM( m_xGlobalAcceleratorManager, UNO_QUERY );
- if ( xCompGAM.is() )
- xCompGAM->dispose();
m_xGlobalAcceleratorManager.clear();
m_xModuleAcceleratorManager.clear();
m_xDocAcceleratorManager.clear();
commit 096637c9570654437e9f5e12a614fdcefc23ae3a
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Fri Feb 17 11:11:44 2017 +0200
CommandInfoProvider can be a namespace
Change-Id: I8b56423724360f49e1f361cb95056b391a9a3a42
diff --git a/include/vcl/commandinfoprovider.hxx b/include/vcl/commandinfoprovider.hxx
index 2a3eaea..d254ee3 100644
--- a/include/vcl/commandinfoprovider.hxx
+++ b/include/vcl/commandinfoprovider.hxx
@@ -20,27 +20,11 @@
#define INCLUDED_VCL_COMMANDINFOPROVIDER_HXX
#include <vcl/dllapi.h>
-#include <vcl/keycod.hxx>
#include <vcl/image.hxx>
#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
-using namespace css;
-using namespace css::uno;
-
-
-namespace vcl {
-
-/** Provides information about UNO commands like tooltip text with
- keyboard accelerator.
-*/
-class VCL_DLLPUBLIC CommandInfoProvider
-{
-public:
- CommandInfoProvider();
- ~CommandInfoProvider();
+namespace vcl { namespace CommandInfoProvider {
/** Return a label for the given command.
@param rsCommandName
@@ -48,17 +32,17 @@ public:
@param rxFrame
The frame is used to identify the module and document.
@return
- The command labe.
+ The command label.
*/
- static OUString GetLabelForCommand (
+ VCL_DLLPUBLIC OUString GetLabelForCommand (
const OUString& rsCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
- static OUString GetMenuLabelForCommand (
+ VCL_DLLPUBLIC OUString GetMenuLabelForCommand (
const OUString& rsCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
- static OUString GetPopupLabelForCommand (
+ VCL_DLLPUBLIC OUString GetPopupLabelForCommand (
const OUString& rsCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
@@ -71,61 +55,43 @@ public:
The returned label contains the keyboard accelerator, if
one is defined and bIncludeShortcut is true.
*/
- static OUString GetTooltipForCommand (
+ VCL_DLLPUBLIC OUString GetTooltipForCommand (
const OUString& rsCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
/** Returns the shortcut for a command in human-readable form */
- static OUString GetCommandShortcut (const OUString& rCommandName,
+ VCL_DLLPUBLIC OUString GetCommandShortcut (const OUString& rCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
- static OUString GetRealCommandForCommand( const OUString& rCommandName,
+ VCL_DLLPUBLIC OUString GetRealCommandForCommand( const OUString& rCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame );
- static OUString GetCommandPropertyFromModule( const OUString& rCommandName, const OUString& rModuleName );
+ VCL_DLLPUBLIC OUString GetCommandPropertyFromModule( const OUString& rCommandName, const OUString& rModuleName );
- static BitmapEx GetBitmapForCommand(
+ VCL_DLLPUBLIC BitmapEx GetBitmapForCommand(
const OUString& rsCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
vcl::ImageType eImageType = vcl::ImageType::Small);
- static Image GetImageForCommand(
+ VCL_DLLPUBLIC Image GetImageForCommand(
const OUString& rsCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
vcl::ImageType eImageType = vcl::ImageType::Small);
- static sal_Int32 GetPropertiesForCommand(
+ VCL_DLLPUBLIC sal_Int32 GetPropertiesForCommand(
const OUString& rsCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame);
- static bool IsRotated(const OUString& rsCommandName,const Reference<frame::XFrame>& rxFrame);
- static bool IsMirrored(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame);
+ VCL_DLLPUBLIC bool IsRotated(const OUString& rsCommandName,const css::uno::Reference<css::frame::XFrame>& rxFrame);
+ VCL_DLLPUBLIC bool IsMirrored(const OUString& rsCommandName, const css::uno::Reference<css::frame::XFrame>& rxFrame);
/** Returns whether the command is experimental. */
- static bool IsExperimental(
+ VCL_DLLPUBLIC bool IsExperimental(
const OUString& rsCommandName,
const OUString& rModuleName);
- /** Do not call. Should be part of a local and hidden interface.
- */
- static void SetFrame (const css::uno::Reference<css::frame::XFrame>& rxFrame);
-
- private:
- 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);
- static vcl::KeyCode AWTKey2VCLKey(const css::awt::KeyEvent& aAWTKey);
-};
-
-} // end of namespace vcl
+ VCL_DLLPUBLIC OUString const GetModuleIdentifier(const css::uno::Reference<css::frame::XFrame>& rxFrame);
+} }
#endif // INCLUDED_VCL_COMMANDINFOPROVIDER_HXX
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 1a03164..d1b8a6c6 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -67,7 +67,6 @@ class Application;
class OutputDevice;
namespace vcl
{
- class CommandInfoProvider;
class Window;
}
class SystemWindow;
@@ -330,7 +329,6 @@ struct ImplSVData
VclPtr<vcl::Window> mpIntroWindow; // the splash screen
DockingManager* mpDockingManager = nullptr;
BlendFrameCache* mpBlendFrameCache = nullptr;
- vcl::CommandInfoProvider* mpCommandInfoProvider = nullptr;
oslThreadIdentifier mnMainThreadId = 0;
rtl::Reference< vcl::DisplayConnectionDispatch > mxDisplayConnection;
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 4ae2205..7d60132 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -524,11 +524,6 @@ void DeInitVCL()
pSVData->mpBlendFrameCache = nullptr;
}
- if (pSVData->mpCommandInfoProvider)
- {
- pSVData->mpCommandInfoProvider = nullptr;
- }
-
ImplDeletePrnQueueList();
delete pSVData->maGDIData.mpScreenFontList;
pSVData->maGDIData.mpScreenFontList = nullptr;
diff --git a/vcl/source/helper/commandinfoprovider.cxx b/vcl/source/helper/commandinfoprovider.cxx
index 7ba8690..4b5b2b4 100644
--- a/vcl/source/helper/commandinfoprovider.cxx
+++ b/vcl/source/helper/commandinfoprovider.cxx
@@ -18,11 +18,10 @@
*/
#include <vcl/commandinfoprovider.hxx>
+#include <vcl/keycod.hxx>
#include <vcl/mnemonic.hxx>
#include <comphelper/string.hxx>
#include <comphelper/processfactory.hxx>
-#include <cppuhelper/compbase.hxx>
-#include <cppuhelper/basemutex.hxx>
#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/theUICommandDescription.hpp>
@@ -33,21 +32,163 @@
#include <com/sun/star/ui/XImageManager.hpp>
#include <com/sun/star/awt/KeyModifier.hpp>
-#include "svdata.hxx"
-
using namespace css;
using namespace css::uno;
+namespace vcl { namespace CommandInfoProvider {
+
+Reference<ui::XAcceleratorConfiguration> const GetDocumentAcceleratorConfiguration(const Reference<frame::XFrame>& rxFrame)
+{
+ Reference<frame::XController> xController = rxFrame->getController();
+ if (xController.is())
+ {
+ Reference<frame::XModel> xModel (xController->getModel());
+ if (xModel.is())
+ {
+ Reference<ui::XUIConfigurationManagerSupplier> xSupplier (xModel, UNO_QUERY);
+ if (xSupplier.is())
+ {
+ Reference<ui::XUIConfigurationManager> xConfigurationManager(
+ xSupplier->getUIConfigurationManager(),
+ UNO_QUERY);
+ if (xConfigurationManager.is())
+ {
+ return xConfigurationManager->getShortCutManager();
+ }
+ }
+ }
+ }
+ return nullptr;
+}
+
+Reference<ui::XAcceleratorConfiguration> const GetModuleAcceleratorConfiguration(const Reference<frame::XFrame>& rxFrame)
+{
+ css::uno::Reference<css::ui::XAcceleratorConfiguration> curModuleAcceleratorConfiguration;
+ try
+ {
+ Reference<ui::XModuleUIConfigurationManagerSupplier> xSupplier = ui::theModuleUIConfigurationManagerSupplier::get(comphelper::getProcessComponentContext());
+ Reference<ui::XUIConfigurationManager> xManager (
+ xSupplier->getUIConfigurationManager(GetModuleIdentifier(rxFrame)));
+ if (xManager.is())
+ {
+ curModuleAcceleratorConfiguration = xManager->getShortCutManager();
+ }
+ }
+ catch (Exception&)
+ {
+ }
+ return curModuleAcceleratorConfiguration;
+}
+
+Reference<ui::XAcceleratorConfiguration> const GetGlobalAcceleratorConfiguration()
+{
+ // Get the global accelerator configuration.
+ return ui::GlobalAcceleratorConfiguration::create(comphelper::getProcessComponentContext());
+
+}
+
+vcl::KeyCode AWTKey2VCLKey(const awt::KeyEvent& aAWTKey)
+{
+ bool bShift = ((aAWTKey.Modifiers & awt::KeyModifier::SHIFT) == awt::KeyModifier::SHIFT );
+ bool bMod1 = ((aAWTKey.Modifiers & awt::KeyModifier::MOD1 ) == awt::KeyModifier::MOD1 );
+ bool bMod2 = ((aAWTKey.Modifiers & awt::KeyModifier::MOD2 ) == awt::KeyModifier::MOD2 );
+ bool bMod3 = ((aAWTKey.Modifiers & awt::KeyModifier::MOD3 ) == awt::KeyModifier::MOD3 );
+ sal_uInt16 nKey = (sal_uInt16)aAWTKey.KeyCode;
+
+ return vcl::KeyCode(nKey, bShift, bMod1, bMod2, bMod3);
+}
+
+OUString RetrieveShortcutsFromConfiguration(
+ const Reference<ui::XAcceleratorConfiguration>& rxConfiguration,
+ const OUString& rsCommandName)
+{
+ if (rxConfiguration.is())
+ {
+ try
+ {
+ Sequence<OUString> aCommands { rsCommandName };
+
+ Sequence<Any> aKeyCodes (rxConfiguration->getPreferredKeyEventsForCommandList(aCommands));
+ if (aCommands.getLength() == 1)
+ {
+ awt::KeyEvent aKeyEvent;
+ if (aKeyCodes[0] >>= aKeyEvent)
+ {
+ return AWTKey2VCLKey(aKeyEvent).GetName();
+ }
+ }
+ }
+ catch (css::lang::IllegalArgumentException&)
+ {
+ }
+ }
+ return OUString();
+}
+
+bool ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
+{
+ Sequence< OUString > aSequence;
+ try
+ {
+ const OUString sModuleIdentifier (GetModuleIdentifier(rxFrame));
+ if (!sModuleIdentifier.isEmpty())
+ {
+ Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
+ Reference<container::XNameAccess> xUICommandLabels;
+ if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels) {
+ xUICommandLabels->getByName(rsResourceName) >>= aSequence;
+ for ( sal_Int32 i = 0; i < aSequence.getLength(); i++ )
+ {
+ if (aSequence[i] == rsCommandName)
+ return true;
+ }
+ }
+ }
+ }
+ catch (Exception&)
+ {
+ }
+ return false;
+}
-namespace vcl {
+Sequence<beans::PropertyValue> GetCommandProperties(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
+{
+ Sequence<beans::PropertyValue> aProperties;
-CommandInfoProvider::CommandInfoProvider() { }
+ try
+ {
+ const OUString sModuleIdentifier (GetModuleIdentifier(rxFrame));
+ if (sModuleIdentifier.getLength() > 0)
+ {
+ Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
+ Reference<container::XNameAccess> xUICommandLabels;
+ if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels)
+ xUICommandLabels->getByName(rsCommandName) >>= aProperties;
+ }
+ }
+ catch (Exception&)
+ {
+ }
-CommandInfoProvider::~CommandInfoProvider()
+ return aProperties;
+}
+
+OUString GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
{
+ const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName, rxFrame));
+ for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
+ {
+ if (aProperties[nIndex].Name == rsProperty)
+ {
+ OUString sLabel;
+ aProperties[nIndex].Value >>= sLabel;
+ return sLabel;
+ }
+ }
+ return OUString();
}
-OUString CommandInfoProvider::GetLabelForCommand (
+OUString GetLabelForCommand (
const OUString& rsCommandName,
const Reference<frame::XFrame>& rxFrame)
{
@@ -55,7 +196,7 @@ OUString CommandInfoProvider::GetLabelForCommand (
return GetCommandProperty("Name", rsCommandName, rxFrame);
}
-OUString CommandInfoProvider::GetMenuLabelForCommand (
+OUString GetMenuLabelForCommand (
const OUString& rsCommandName,
const Reference<frame::XFrame>& rxFrame)
{
@@ -65,7 +206,7 @@ OUString CommandInfoProvider::GetMenuLabelForCommand (
return GetCommandProperty("Label", rsCommandName, rxFrame);
}
-OUString CommandInfoProvider::GetPopupLabelForCommand (
+OUString GetPopupLabelForCommand (
const OUString& rsCommandName,
const css::uno::Reference<css::frame::XFrame>& rxFrame)
{
@@ -76,7 +217,7 @@ OUString CommandInfoProvider::GetPopupLabelForCommand (
return GetCommandProperty("Label", rsCommandName, rxFrame);
}
-OUString CommandInfoProvider::GetTooltipForCommand (
+OUString GetTooltipForCommand (
const OUString& rsCommandName,
const Reference<frame::XFrame>& rxFrame)
{
@@ -98,7 +239,7 @@ OUString CommandInfoProvider::GetTooltipForCommand (
return sLabel;
}
-OUString CommandInfoProvider::GetCommandShortcut (const OUString& rsCommandName,
+OUString GetCommandShortcut (const OUString& rsCommandName,
const Reference<frame::XFrame>& rxFrame)
{
@@ -119,14 +260,14 @@ OUString CommandInfoProvider::GetCommandShortcut (const OUString& rsCommandName,
return OUString();
}
-OUString CommandInfoProvider::GetRealCommandForCommand(const OUString& rCommandName,
+OUString GetRealCommandForCommand(const OUString& rCommandName,
const css::uno::Reference<frame::XFrame>& rxFrame)
{
return GetCommandProperty("TargetURL", rCommandName, rxFrame);
}
-BitmapEx CommandInfoProvider::GetBitmapForCommand(const OUString& rsCommandName,
+BitmapEx GetBitmapForCommand(const OUString& rsCommandName,
const Reference<frame::XFrame>& rxFrame,
vcl::ImageType eImageType)
{
@@ -192,14 +333,14 @@ BitmapEx CommandInfoProvider::GetBitmapForCommand(const OUString& rsCommandName,
return BitmapEx();
}
-Image CommandInfoProvider::GetImageForCommand(const OUString& rsCommandName,
+Image GetImageForCommand(const OUString& rsCommandName,
const Reference<frame::XFrame>& rxFrame,
vcl::ImageType eImageType)
{
return Image(GetBitmapForCommand(rsCommandName, rxFrame, eImageType));
}
-sal_Int32 CommandInfoProvider::GetPropertiesForCommand (
+sal_Int32 GetPropertiesForCommand (
const OUString& rsCommandName,
const Reference<frame::XFrame>& rxFrame)
{
@@ -217,17 +358,17 @@ sal_Int32 CommandInfoProvider::GetPropertiesForCommand (
return nValue;
}
-bool CommandInfoProvider::IsRotated(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
+bool IsRotated(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
{
return ResourceHasKey("private:resource/image/commandrotateimagelist", rsCommandName, rxFrame);
}
-bool CommandInfoProvider::IsMirrored(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
+bool IsMirrored(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
{
return ResourceHasKey("private:resource/image/commandmirrorimagelist", rsCommandName, rxFrame);
}
-bool CommandInfoProvider::IsExperimental(const OUString& rsCommandName,
+bool IsExperimental(const OUString& rsCommandName,
const OUString& rModuleName)
{
Sequence<beans::PropertyValue> aProperties;
@@ -256,153 +397,13 @@ bool CommandInfoProvider::IsExperimental(const OUString& rsCommandName,
return false;
}
-Reference<ui::XAcceleratorConfiguration> const CommandInfoProvider::GetDocumentAcceleratorConfiguration(const Reference<frame::XFrame>& rxFrame)
-{
- Reference<frame::XController> xController = rxFrame->getController();
- if (xController.is())
- {
- Reference<frame::XModel> xModel (xController->getModel());
- if (xModel.is())
- {
- Reference<ui::XUIConfigurationManagerSupplier> xSupplier (xModel, UNO_QUERY);
- if (xSupplier.is())
- {
- Reference<ui::XUIConfigurationManager> xConfigurationManager(
- xSupplier->getUIConfigurationManager(),
- UNO_QUERY);
- if (xConfigurationManager.is())
- {
- return xConfigurationManager->getShortCutManager();
- }
- }
- }
- }
- return nullptr;
-}
-
-Reference<ui::XAcceleratorConfiguration> const CommandInfoProvider::GetModuleAcceleratorConfiguration(const Reference<frame::XFrame>& rxFrame)
-{
- css::uno::Reference<css::ui::XAcceleratorConfiguration> curModuleAcceleratorConfiguration;
- try
- {
- Reference<ui::XModuleUIConfigurationManagerSupplier> xSupplier = ui::theModuleUIConfigurationManagerSupplier::get(comphelper::getProcessComponentContext());
- Reference<ui::XUIConfigurationManager> xManager (
- xSupplier->getUIConfigurationManager(GetModuleIdentifier(rxFrame)));
- if (xManager.is())
- {
- curModuleAcceleratorConfiguration = xManager->getShortCutManager();
- }
- }
- catch (Exception&)
- {
- }
- return curModuleAcceleratorConfiguration;
-}
-
-Reference<ui::XAcceleratorConfiguration> const CommandInfoProvider::GetGlobalAcceleratorConfiguration()
-{
- // Get the global accelerator configuration.
- return ui::GlobalAcceleratorConfiguration::create(comphelper::getProcessComponentContext());
-
-}
-
-OUString const CommandInfoProvider::GetModuleIdentifier(const Reference<frame::XFrame>& rxFrame)
+OUString const GetModuleIdentifier(const Reference<frame::XFrame>& rxFrame)
{
Reference<frame::XModuleManager2> xModuleManager = frame::ModuleManager::create(comphelper::getProcessComponentContext());
return xModuleManager->identify(rxFrame);
}
-OUString CommandInfoProvider::RetrieveShortcutsFromConfiguration(
- const Reference<ui::XAcceleratorConfiguration>& rxConfiguration,
- const OUString& rsCommandName)
-{
- if (rxConfiguration.is())
- {
- try
- {
- Sequence<OUString> aCommands { rsCommandName };
-
- Sequence<Any> aKeyCodes (rxConfiguration->getPreferredKeyEventsForCommandList(aCommands));
- if (aCommands.getLength() == 1)
- {
- awt::KeyEvent aKeyEvent;
- if (aKeyCodes[0] >>= aKeyEvent)
- {
- return AWTKey2VCLKey(aKeyEvent).GetName();
- }
- }
- }
- catch (css::lang::IllegalArgumentException&)
- {
- }
- }
- return OUString();
-}
-
-bool CommandInfoProvider::ResourceHasKey(const OUString& rsResourceName, const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
-{
- Sequence< OUString > aSequence;
- try
- {
- const OUString sModuleIdentifier (GetModuleIdentifier(rxFrame));
- if (!sModuleIdentifier.isEmpty())
- {
- Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
- Reference<container::XNameAccess> xUICommandLabels;
- if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels) {
- xUICommandLabels->getByName(rsResourceName) >>= aSequence;
- for ( sal_Int32 i = 0; i < aSequence.getLength(); i++ )
- {
- if (aSequence[i] == rsCommandName)
- return true;
- }
- }
- }
- }
- catch (Exception&)
- {
- }
- return false;
-}
-
-Sequence<beans::PropertyValue> CommandInfoProvider::GetCommandProperties(const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
-{
- Sequence<beans::PropertyValue> aProperties;
-
- try
- {
- const OUString sModuleIdentifier (GetModuleIdentifier(rxFrame));
- if (sModuleIdentifier.getLength() > 0)
- {
- Reference<container::XNameAccess> xNameAccess = frame::theUICommandDescription::get(comphelper::getProcessComponentContext());
- Reference<container::XNameAccess> xUICommandLabels;
- if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels)
- xUICommandLabels->getByName(rsCommandName) >>= aProperties;
- }
- }
- catch (Exception&)
- {
- }
-
- return aProperties;
-}
-
-OUString CommandInfoProvider::GetCommandProperty(const OUString& rsProperty, const OUString& rsCommandName, const Reference<frame::XFrame>& rxFrame)
-{
- const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName, rxFrame));
- for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
- {
- if (aProperties[nIndex].Name == rsProperty)
- {
- OUString sLabel;
- aProperties[nIndex].Value >>= sLabel;
- return sLabel;
- }
- }
- return OUString();
-}
-
-OUString CommandInfoProvider::GetCommandPropertyFromModule( const OUString& rCommandName, const OUString& rModuleName )
+OUString GetCommandPropertyFromModule( const OUString& rCommandName, const OUString& rModuleName )
{
OUString sLabel;
if ( rCommandName.isEmpty() )
@@ -434,18 +435,6 @@ OUString CommandInfoProvider::GetCommandPropertyFromModule( const OUString& rCom
return OUString();
}
-vcl::KeyCode CommandInfoProvider::AWTKey2VCLKey(const awt::KeyEvent& aAWTKey)
-{
- bool bShift = ((aAWTKey.Modifiers & awt::KeyModifier::SHIFT) == awt::KeyModifier::SHIFT );
- bool bMod1 = ((aAWTKey.Modifiers & awt::KeyModifier::MOD1 ) == awt::KeyModifier::MOD1 );
- bool bMod2 = ((aAWTKey.Modifiers & awt::KeyModifier::MOD2 ) == awt::KeyModifier::MOD2 );
- bool bMod3 = ((aAWTKey.Modifiers & awt::KeyModifier::MOD3 ) == awt::KeyModifier::MOD3 );
- sal_uInt16 nKey = (sal_uInt16)aAWTKey.KeyCode;
-
- return vcl::KeyCode(nKey, bShift, bMod1, bMod2, bMod3);
-}
-
-
-} // end of namespace vcl
+} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 33c51e8002f58847ba43bc111dabc49278e36daf
Author: Rohan Kumar <rohankanojia420 at gmail.com>
Date: Tue Jan 24 21:18:00 2017 +0530
tdf#95844 Refactor CommandInfoProvider
Instead of a singleton, CommandInfoProvider should just be a set of static methods.
Change-Id: I16d4406e361a72f013d78f18d6bd0ae20c0cc5e9
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index ac36ea1..1e9ca06 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 daac412..dff3368 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 66b9109..0a66584 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 0043c25..f156dfa 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 b8880b8..dcff602 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 e1a1653..1f9c968 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 7ee1e56..51c6cc1 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 34b3a39..4a13605 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 27e5be3..06baee2 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 146051d..2f37263 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;
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list