summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-08-23 18:06:05 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-03 15:55:03 +0200
commit7a464263cc5c2ca2b7128734ff4860e02d662818 (patch)
tree4614aa57736484cb46c8702f6afee1c2e663e8a0 /sfx2
parent10362695c2060f6aa48bd88f6b8dd6cfa556392a (diff)
fdo#46808, Adapt UICommandDescription UNO service to new style
Change-Id: Ibca112904f137ff981ae9be3e5bd56aa11aec352
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/recfloat.cxx7
-rw-r--r--sfx2/source/dialog/templdlg.cxx16
-rw-r--r--sfx2/source/view/viewsh.cxx5
3 files changed, 12 insertions, 16 deletions
diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx
index 49690dab556d..a43b9fba17db 100644
--- a/sfx2/source/dialog/recfloat.cxx
+++ b/sfx2/source/dialog/recfloat.cxx
@@ -21,10 +21,12 @@
#include <com/sun/star/frame/XModuleManager.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ui/UICommandDescription.hpp>
#include <svl/eitem.hxx>
#include <svtools/generictoolboxcontroller.hxx>
#include <vcl/msgbox.hxx>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/processfactory.hxx>
#include "recfloat.hxx"
@@ -63,10 +65,7 @@ static rtl::OUString GetLabelFromCommandURL( const rtl::OUString& rCommandURL, c
if ( !xUICommandDescription.is() )
{
xUICommandDescription = uno::Reference< container::XNameAccess >(
- xServiceManager->createInstance(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.frame.UICommandDescription" ))),
- uno::UNO_QUERY );
+ ui::UICommandDescription::create(comphelper::ComponentContext(xServiceManager).getUNOContext()) );
xTmpNameAccess = xUICommandDescription;
}
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 3982e2e3f24b..307bcb464071 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/ui/UICommandDescription.hpp>
#include "sfx2/sfxhelp.hxx"
#include <sfx2/app.hxx>
@@ -2542,18 +2543,13 @@ IMPL_LINK( SfxTemplateDialog_Impl, ToolBoxRClick, ToolBox *, pBox )
//create a popup menu in Writer
boost::scoped_ptr<PopupMenu> pMenu(new PopupMenu);
uno::Reference< container::XNameAccess > xNameAccess(
- ::comphelper::getProcessServiceFactory()->
- createInstance( ::rtl::OUString(
- "com.sun.star.frame.UICommandDescription") ), uno::UNO_QUERY );
+ ui::UICommandDescription::create(::comphelper::getProcessComponentContext()) );
uno::Reference< container::XNameAccess > xUICommands;
- if ( xNameAccess.is() )
+ rtl::OUString sTextDoc("com.sun.star.text.TextDocument");
+ if(xNameAccess->hasByName(sTextDoc))
{
- rtl::OUString sTextDoc("com.sun.star.text.TextDocument");
- if(xNameAccess->hasByName(sTextDoc))
- {
- uno::Any a = xNameAccess->getByName( sTextDoc );
- a >>= xUICommands;
- }
+ uno::Any a = xNameAccess->getByName( sTextDoc );
+ a >>= xUICommands;
}
if(!xUICommands.is())
return 0;
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index e1d0210c70e5..e33d59c168d4 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -33,6 +33,8 @@
#include <com/sun/star/container/XContainerQuery.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
+#include <com/sun/star/ui/UICommandDescription.hpp>
+#include <comphelper/componentcontext.hxx>
#include <cppuhelper/implbase1.hxx>
#include <osl/file.hxx>
@@ -247,8 +249,7 @@ static ::rtl::OUString RetrieveLabelFromCommand(
if ( !xNameAccess.is() )
{
xNameAccess = css::uno::Reference< css::container::XNameAccess >(
- xSMGR->createInstance(
- ::rtl::OUString( "com.sun.star.frame.UICommandDescription" )),
+ css::ui::UICommandDescription::create(comphelper::ComponentContext(xSMGR).getUNOContext()),
css::uno::UNO_QUERY_THROW );
s_xNameAccess = xNameAccess;
}