summaryrefslogtreecommitdiffstats
path: root/framework
diff options
context:
space:
mode:
authorSusobhan Ghosh <susobhang70@gmail.com>2016-01-14 16:18:35 +0530
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2016-01-14 15:17:24 +0000
commit98887155c0fd209ed60e181f745bf00fb2d69ab7 (patch)
tree7964ec6130b63688f8e67548fc5d3dbf2530531a /framework
parent-Werror=maybe-uninitialized (GCC 6) (diff)
downloadcore-98887155c0fd209ed60e181f745bf00fb2d69ab7.tar.gz
core-98887155c0fd209ed60e181f745bf00fb2d69ab7.zip
tdf#95845 Use CommandInfoProvider to receive UNO command labels
Replaced getUINameFromCommand by GetMenuLabelForCommand Change-Id: Icd89fed4d9944653996a2218c6ed80af72cefe89 Reviewed-on: https://gerrit.libreoffice.org/21464 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/uielement/toolbarsmenucontroller.hxx3
-rw-r--r--framework/source/uielement/toolbarsmenucontroller.cxx50
2 files changed, 2 insertions, 51 deletions
diff --git a/framework/inc/uielement/toolbarsmenucontroller.hxx b/framework/inc/uielement/toolbarsmenucontroller.hxx
index f16a4e4032f7..f8240df92f29 100644
--- a/framework/inc/uielement/toolbarsmenucontroller.hxx
+++ b/framework/inc/uielement/toolbarsmenucontroller.hxx
@@ -85,20 +85,17 @@ namespace framework
private:
void fillPopupMenu( css::uno::Reference< css::awt::XPopupMenu >& rPopupMenu );
css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > getLayoutManagerToolbars( const css::uno::Reference< css::frame::XLayoutManager >& rLayoutManager );
- OUString getUINameFromCommand( const OUString& rCommandURL );
css::uno::Reference< css::frame::XDispatch > getDispatchFromCommandURL( const OUString& rCommandURL );
void addCommand( css::uno::Reference< css::awt::XPopupMenu >& rPopupMenu, const OUString& rCommandURL, const OUString& aLabel );
bool isContextSensitiveToolbarNonVisible() { return m_bResetActive;}
css::uno::Reference< css::uno::XComponentContext > m_xContext;
css::uno::Reference< css::container::XNameAccess > m_xPersistentWindowState;
- css::uno::Reference< css::container::XNameAccess > m_xUICommandDescription;
css::uno::Reference< css::ui::XUIConfigurationManager > m_xModuleCfgMgr;
css::uno::Reference< css::ui::XUIConfigurationManager > m_xDocCfgMgr;
OUString m_aModuleIdentifier;
OUString m_aPropUIName;
OUString m_aPropResourceURL;
- bool m_bModuleIdentified;
bool m_bResetActive;
std::vector< OUString > m_aCommandVector;
IntlWrapper m_aIntlWrapper;
diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx
index ec59424fd94e..0094ed63dcd9 100644
--- a/framework/source/uielement/toolbarsmenucontroller.cxx
+++ b/framework/source/uielement/toolbarsmenucontroller.cxx
@@ -51,6 +51,7 @@
#include <rtl/ustrbuf.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/window.hxx>
+#include <vcl/commandinfoprovider.hxx>
#include <svtools/menuoptions.hxx>
#include <unotools/cmdoptions.hxx>
#include <svtools/miscopt.hxx>
@@ -138,7 +139,6 @@ ToolbarsMenuController::ToolbarsMenuController( const css::uno::Reference< css::
m_xContext( xContext ),
m_aPropUIName( "UIName" ),
m_aPropResourceURL( "ResourceURL" ),
- m_bModuleIdentified( false ),
m_bResetActive( false ),
m_aIntlWrapper( xContext, Application::GetSettings().GetLanguageTag() )
{
@@ -155,7 +155,7 @@ void ToolbarsMenuController::addCommand(
OUString aLabel;
if ( rLabel.isEmpty() )
- aLabel = getUINameFromCommand( rCommandURL );
+ aLabel = vcl::CommandInfoProvider::Instance().GetMenuLabelForCommand( rCommandURL, m_xFrame );
else
aLabel = rLabel;
@@ -209,52 +209,6 @@ Reference< XDispatch > ToolbarsMenuController::getDispatchFromCommandURL( const
return Reference< XDispatch >();
}
-// private function
-OUString ToolbarsMenuController::getUINameFromCommand( const OUString& rCommandURL )
-{
- OUString aLabel;
-
- if ( !m_bModuleIdentified )
- {
- try
- {
- Reference< XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext );
- m_aModuleIdentifier = xModuleManager->identify( m_xFrame );
- Reference< XNameAccess > xNameAccess = frame::theUICommandDescription::get( m_xContext );
- xNameAccess->getByName( m_aModuleIdentifier ) >>= m_xUICommandDescription;
- }
- catch ( const Exception& )
- {
- }
- }
-
- if ( m_xUICommandDescription.is() )
- {
- try
- {
- Sequence< PropertyValue > aPropSeq;
- OUString aStr;
- if ( m_xUICommandDescription->getByName( rCommandURL ) >>= aPropSeq )
- {
- for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
- {
- if ( aPropSeq[i].Name == "Label" )
- {
- aPropSeq[i].Value >>= aStr;
- break;
- }
- }
- }
- aLabel = aStr;
- }
- catch ( const Exception& )
- {
- }
- }
-
- return aLabel;
-}
-
static void fillHashMap( const Sequence< Sequence< css::beans::PropertyValue > >& rSeqToolBars,
ToolbarHashMap& rHashMap )
{