diff options
author | Susobhan Ghosh <susobhang70@gmail.com> | 2016-03-05 01:48:55 +0530 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2016-03-14 13:48:26 +0000 |
commit | bf8f926acc8afd6a2dcd2b889d427c01e06dbf85 (patch) | |
tree | 693384f87178cbe142b7fe8df3bdfc72a162293d /dbaccess/source/ui/control | |
parent | 0ee0e8010f986b67d696111ff4ea269ccf904aba (diff) |
tdf#95845 Use CommandInfoProvider to receive UNO command labels
Added GetCommandPropertyFromModule to CommandInfoProvider.
Removed GetCommandText.
Change-Id: Ie987984b6465d540029196df371c0c0467999a59
Reviewed-on: https://gerrit.libreoffice.org/22918
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'dbaccess/source/ui/control')
-rw-r--r-- | dbaccess/source/ui/control/opendoccontrols.cxx | 52 |
1 files changed, 2 insertions, 50 deletions
diff --git a/dbaccess/source/ui/control/opendoccontrols.cxx b/dbaccess/source/ui/control/opendoccontrols.cxx index caa0e1c6049d..1e5db4be08e6 100644 --- a/dbaccess/source/ui/control/opendoccontrols.cxx +++ b/dbaccess/source/ui/control/opendoccontrols.cxx @@ -32,6 +32,7 @@ #include <comphelper/processfactory.hxx> #include <vcl/graph.hxx> #include <vcl/help.hxx> +#include <vcl/commandinfoprovider.hxx> #include <unotools/historyoptions.hxx> #include <comphelper/sequenceashashmap.hxx> #include <tools/urlobj.hxx> @@ -59,55 +60,6 @@ namespace dbaui using ::com::sun::star::frame::theUICommandDescription; using ::com::sun::star::graphic::XGraphic; - OUString GetCommandText( const sal_Char* _pCommandURL, const OUString& _rModuleName ) - { - OUString sLabel; - if ( !_pCommandURL || !*_pCommandURL ) - return sLabel; - - Reference< XNameAccess > xUICommandLabels; - OUString sCommandURL = OUString::createFromAscii( _pCommandURL ); - - try - { - do - { - // Retrieve popup menu labels - Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - if ( !xContext.is() ) - break; - - Reference< XNameAccess> xNameAccess( theUICommandDescription::get(xContext) ); - - xNameAccess->getByName( _rModuleName ) >>= xUICommandLabels; - if ( !xUICommandLabels.is() ) - break; - - Sequence< PropertyValue > aProperties; - if ( !( xUICommandLabels->getByName(sCommandURL) >>= aProperties ) ) - break; - - sal_Int32 nCount( aProperties.getLength() ); - for ( sal_Int32 i=0; i<nCount; ++i ) - { - OUString sPropertyName( aProperties[i].Name ); - if ( sPropertyName == "Label" ) - { - aProperties[i].Value >>= sLabel; - break; - } - } - } - while ( false ); - } - catch( Exception& rException ) - { - (void)rException; - } - - return sLabel; - } - Image GetCommandIcon( const sal_Char* _pCommandURL, const OUString& _rModuleName ) { Image aIcon; @@ -170,7 +122,7 @@ namespace dbaui m_sModule = OUString::createFromAscii( _pAsciiModuleName ); // our label should equal the UI text of the "Open" command - OUString sLabel(GetCommandText(".uno:Open", m_sModule)); + OUString sLabel(vcl::CommandInfoProvider::Instance().GetCommandPropertyFromModule(".uno:Open", m_sModule)); SetText(" " + sLabel.replaceAll("~", "")); // Place icon left of text and both centered in the button. |