summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2016-10-06 23:44:37 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2016-10-06 23:54:22 +0300
commitff085ed8fd6438d855526a8a4d699960e4d3cc73 (patch)
tree243e99db2a0c8c298461ac4bd89bd70a017fed73 /sd
parent44ba8c2b986bb94b8809885bdf7dc97ae7db7398 (diff)
tdf#95845 Use CommandInfoProvider
Change-Id: Ief823dd19bc1c56a4acf380bfec8d35bdb20ad96
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/controller/slidelayoutcontroller.cxx7
-rw-r--r--sd/source/ui/inc/ViewShellBase.hxx3
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx41
3 files changed, 5 insertions, 46 deletions
diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx
index 6dd1079094b5..f034f43db690 100644
--- a/sd/source/ui/controller/slidelayoutcontroller.cxx
+++ b/sd/source/ui/controller/slidelayoutcontroller.cxx
@@ -26,6 +26,7 @@
#include <osl/mutex.hxx>
+#include <vcl/commandinfoprovider.hxx>
#include <vcl/svapp.hxx>
#include <vcl/toolbox.hxx>
@@ -39,8 +40,6 @@
#include <toolkit/helper/vclunohelper.hxx>
#include <comphelper/processfactory.hxx>
-#include <sfx2/imagemgr.hxx>
-
#include "app.hrc"
#include "facreg.hxx"
#include "glob.hrc"
@@ -240,11 +239,11 @@ LayoutToolbarMenu::LayoutToolbarMenu( SlideLayoutController& rController, vcl::W
sSlotStr = ".uno:DuplicatePage";
else
sSlotStr = ".uno:Undo";
- aSlotImage = ::GetImage( xFrame, sSlotStr, false );
+ aSlotImage = vcl::CommandInfoProvider::Instance().GetImageForCommand( sSlotStr, false, xFrame );
OUString sSlotTitle;
if( bInsertPage )
- sSlotTitle = ImplRetrieveLabelFromCommand( xFrame, sSlotStr );
+ sSlotTitle = vcl::CommandInfoProvider::Instance().GetLabelForCommand( sSlotStr, xFrame );
else
sSlotTitle = SD_RESSTR( STR_RESET_LAYOUT );
appendEntry( 2, sSlotTitle, aSlotImage);
diff --git a/sd/source/ui/inc/ViewShellBase.hxx b/sd/source/ui/inc/ViewShellBase.hxx
index dca78c06c58b..5cddc4244876 100644
--- a/sd/source/ui/inc/ViewShellBase.hxx
+++ b/sd/source/ui/inc/ViewShellBase.hxx
@@ -243,9 +243,6 @@ private:
OUString GetInitialViewShellType();
};
-OUString ImplRetrieveLabelFromCommand( const css::uno::Reference< css::frame::XFrame >& xFrame, const OUString& aCmdURL );
-
-
} // end of namespace sd
#endif
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 8aee92b7e04d..9c48fcc8cef3 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -79,6 +79,7 @@
#include <sfx2/objface.hxx>
#include <sfx2/viewfrm.hxx>
#include <svl/whiter.hxx>
+#include <vcl/commandinfoprovider.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/settings.hxx>
@@ -977,48 +978,10 @@ vcl::Window* ViewShellBase::GetViewWindow()
return mpImpl->mpViewWindow.get();
}
-OUString ImplRetrieveLabelFromCommand( const Reference< XFrame >& xFrame, const OUString& aCmdURL )
-{
- OUString aLabel;
-
- if ( !aCmdURL.isEmpty() ) try
- {
- Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext(), UNO_QUERY_THROW );
-
- Reference< XModuleManager2 > xModuleManager( ModuleManager::create(xContext) );
-
- OUString aModuleIdentifier( xModuleManager->identify( Reference<XInterface>( xFrame, UNO_QUERY_THROW ) ) );
-
- if( !aModuleIdentifier.isEmpty() )
- {
- Reference< XNameAccess > const xNameAccess(
- frame::theUICommandDescription::get(xContext) );
- Reference< css::container::XNameAccess > xUICommandLabels( xNameAccess->getByName( aModuleIdentifier ), UNO_QUERY_THROW );
- Sequence< PropertyValue > aPropSeq;
- if( xUICommandLabels->getByName( aCmdURL ) >>= aPropSeq )
- {
- for( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
- {
- if ( aPropSeq[i].Name == "Name" )
- {
- aPropSeq[i].Value >>= aLabel;
- break;
- }
- }
- }
- }
- }
- catch (const Exception&)
- {
- }
-
- return aLabel;
-}
-
OUString ViewShellBase::RetrieveLabelFromCommand( const OUString& aCmdURL ) const
{
Reference< XFrame > xFrame( GetMainViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(), UNO_QUERY );
- return ImplRetrieveLabelFromCommand( xFrame, aCmdURL );
+ return vcl::CommandInfoProvider::Instance().GetLabelForCommand( aCmdURL, xFrame );
}
int ViewShellBase::getPart() const