diff options
author | Andre Fischer <af@apache.org> | 2013-05-16 11:43:55 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-21 16:36:07 +0100 |
commit | edaca7c6e1d1ade6bf6cdae753028ee62297f0b1 (patch) | |
tree | 7d753b4337f8b993c3585fd4597a65e7672c2d49 /sfx2/source/sidebar/Tools.cxx | |
parent | aad035bd70b29253e9206de48259a9f0943bbc41 (diff) |
Resolves: #i121960# Improve creation of toolbox/toolbar controllers
(cherry picked from commit 3608a33d8362cbc44a2eb7203b7d1bffe481c7ab)
Conflicts:
sfx2/inc/sfx2/sidebar/ControlFactory.hxx
sfx2/inc/sfx2/sidebar/ControllerFactory.hxx
sfx2/inc/sfx2/sidebar/SidebarToolBox.hxx
sfx2/inc/sfx2/sidebar/Tools.hxx
sfx2/source/sidebar/ToolBoxBackground.cxx
Change-Id: I833a33bbc58ebe46bd28c6d97a4d76329f1f0186
Diffstat (limited to 'sfx2/source/sidebar/Tools.cxx')
-rw-r--r-- | sfx2/source/sidebar/Tools.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sfx2/source/sidebar/Tools.cxx b/sfx2/source/sidebar/Tools.cxx index 881545864ae9..62c244cd6045 100644 --- a/sfx2/source/sidebar/Tools.cxx +++ b/sfx2/source/sidebar/Tools.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> #include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> #include <cstring> @@ -179,4 +180,28 @@ Reference<frame::XDispatch> Tools::GetDispatch ( } + + +::rtl::OUString Tools::GetModuleName ( + const cssu::Reference<css::frame::XFrame>& rxFrame) +{ + if ( ! rxFrame.is() || ! rxFrame->getController().is()) + return ::rtl::OUString(); + + try + { + const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory()); + const Reference<frame::XModuleManager> xModuleManager ( + aContext.createComponent("com.sun.star.frame.ModuleManager"), + UNO_QUERY_THROW); + return xModuleManager->identify(rxFrame); + } + catch (const Exception&) + { + // Ignored. + } + return ::rtl::OUString(); +} + + } } // end of namespace sfx2::sidebar |