diff options
-rw-r--r-- | include/svx/sidebar/PanelLayout.hxx | 4 | ||||
-rw-r--r-- | include/vcl/builder.hxx | 5 | ||||
-rw-r--r-- | svx/source/sidebar/PanelLayout.cxx | 21 |
3 files changed, 29 insertions, 1 deletions
diff --git a/include/svx/sidebar/PanelLayout.hxx b/include/svx/sidebar/PanelLayout.hxx index 5275ced74092..fe55f11f8c5b 100644 --- a/include/svx/sidebar/PanelLayout.hxx +++ b/include/svx/sidebar/PanelLayout.hxx @@ -16,6 +16,7 @@ #include <vcl/ctrl.hxx> #include <vcl/timer.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/frame/XFrame.hpp> /// This class is the base for the Widget Layout-based sidebar panels. @@ -36,6 +37,9 @@ public: virtual Size GetOptimalSize() const; virtual void setPosSizePixel(long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags = WINDOW_POSSIZE_ALL); virtual void queue_resize(); + + void dispatch(const OUString& rCommand, const css::uno::Sequence<css::beans::PropertyValue>& rArgs = + css::uno::Sequence<css::beans::PropertyValue>()); }; #endif diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index 8cd25a0ce287..2719aba8e913 100644 --- a/include/vcl/builder.hxx +++ b/include/vcl/builder.hxx @@ -242,7 +242,7 @@ private: }; /// XFrame to be able to extract labels and other properties of the UNO commands (like of .uno:Bold). - com::sun::star::uno::Reference<com::sun::star::frame::XFrame> m_xFrame; + css::uno::Reference<css::frame::XFrame> m_xFrame; public: VclBuilder(::Window *pParent, OUString sUIRootDir, OUString sUIFile, @@ -308,6 +308,8 @@ public: //Helpers to retrofit all the existing code to the builder static void reorderWithinParent(std::vector< ::Window*>& rChilds, bool bIsButtonBox); static void reorderWithinParent(::Window &rWindow, sal_uInt16 nNewPosition); + + css::uno::Reference<css::frame::XFrame> getFrame() { return m_xFrame; } private: ::Window *insertObject(::Window *pParent, const OString &rClass, const OString &rID, @@ -390,6 +392,7 @@ public: virtual ~VclBuilderContainer(); static OUString getUIRootDir(); bool hasBuilder() const { return m_pUIBuilder != NULL; } + css::uno::Reference<css::frame::XFrame> getFrame() { return m_pUIBuilder->getFrame(); } template <typename T> T* get(T*& ret, OString sID) { return m_pUIBuilder->get<T>(ret, sID); diff --git a/svx/source/sidebar/PanelLayout.cxx b/svx/source/sidebar/PanelLayout.cxx index e31c75b2619b..72bdfc245413 100644 --- a/svx/source/sidebar/PanelLayout.cxx +++ b/svx/source/sidebar/PanelLayout.cxx @@ -7,6 +7,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/util/URLTransformer.hpp> +#include <comphelper/processfactory.hxx> #include <svx/sidebar/PanelLayout.hxx> #include <vcl/layout.hxx> @@ -87,4 +91,21 @@ void PanelLayout::setPosSizePixel(long nX, long nY, long nWidth, long nHeight, s VclContainer::setLayoutAllocation(*pChild, Point(0, 0), Size(nWidth, nHeight)); } +void PanelLayout::dispatch(const OUString& rCommand, const css::uno::Sequence<css::beans::PropertyValue>& rArgs) +{ + assert(getFrame().is()); + + css::util::URL aURL; + aURL.Complete = rCommand; + + css::uno::Reference<css::util::XURLTransformer > xURLTransformer( + css::util::URLTransformer::create(comphelper::getProcessComponentContext())); + + xURLTransformer->parseStrict(aURL); + + css::uno::Reference<css::frame::XDispatchProvider> xProvider(getFrame(), css::uno::UNO_QUERY_THROW); + css::uno::Reference<css::frame::XDispatch > xDispatch(xProvider->queryDispatch(aURL, OUString(), 0)); + xDispatch->dispatch(aURL, rArgs); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |