diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-01-16 20:33:54 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-01-16 20:37:54 +0000 |
commit | 36e590ee00affc89b26055c748b862cf79f56247 (patch) | |
tree | e9abf3da2ef50cb48bd8399b862391bfaa0baf07 /svx/source/sidebar/PanelLayout.cxx | |
parent | 75043c23c7d08fcc9b22a38fe08014d1381e2f90 (diff) |
make use that these VclBuilders have an XFrame to expose its dispatch
the sidebar widget-layout enabled panels could use frame::XDispatch::dispatch
to send their commands directly rather than mapping back to SIDS and Executing
those, which would allow removing piles of weird-ass stuff
Change-Id: Ibbff56d4fb96820d3bdbf4b1cb582d25337fe48b
Diffstat (limited to 'svx/source/sidebar/PanelLayout.cxx')
-rw-r--r-- | svx/source/sidebar/PanelLayout.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
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: */ |