diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-02-29 11:42:51 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-02-29 13:56:13 +0100 |
commit | 46b85ee064a87dc4b5e438085f11d5d2efada2d6 (patch) | |
tree | e1a1d0a91f62590f2f4879a295fd7568ffaed3d3 /sfx2/source | |
parent | c00a0a4fd1f84594e9ead9cad10b96fd7f4beade (diff) |
sfx2 classification toolbar: dispatch uno command on selection change
Change-Id: Iad3cb44cd57ad9e50be6008146629cdca8455eb6
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/view/classificationcontroller.cxx | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/sfx2/source/view/classificationcontroller.cxx b/sfx2/source/view/classificationcontroller.cxx index 85ae6586bd98..0e861a10b21b 100644 --- a/sfx2/source/view/classificationcontroller.cxx +++ b/sfx2/source/view/classificationcontroller.cxx @@ -13,7 +13,6 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/frame/XFrame.hpp> -#include <cppuhelper/supportsservice.hxx> #include <vcl/vclptr.hxx> #include <vcl/lstbox.hxx> @@ -22,6 +21,9 @@ #include <vcl/toolbox.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/classificationhelper.hxx> +#include <cppuhelper/supportsservice.hxx> +#include <comphelper/propertysequence.hxx> +#include <comphelper/dispatchcommand.hxx> using namespace com::sun::star; @@ -35,6 +37,8 @@ class ClassificationCategoriesController : public ClassificationCategoriesContro { VclPtr<ListBox> m_pCategories; + DECL_LINK_TYPED(SelectHdl, ListBox&, void); + public: ClassificationCategoriesController(const uno::Reference<uno::XComponentContext>& rContext); virtual ~ClassificationCategoriesController(); @@ -96,11 +100,24 @@ uno::Reference<awt::XWindow> ClassificationCategoriesController::createItemWindo vcl::Window* pParent = VCLUnoHelper::GetWindow(rParent); ToolBox* pToolbar = dynamic_cast<ToolBox*>(pParent); if (pToolbar) + { m_pCategories = VclPtr<ListBox>::Create(pToolbar, WB_CLIPCHILDREN|WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_DROPDOWN|WB_SIMPLEMODE); + m_pCategories->SetSelectHdl(LINK(this, ClassificationCategoriesController, SelectHdl)); + } return uno::Reference<awt::XWindow>(VCLUnoHelper::GetInterface(m_pCategories)); } +IMPL_LINK_NOARG_TYPED(ClassificationCategoriesController, SelectHdl, ListBox&, void) +{ + OUString aEntry = m_pCategories->GetSelectEntry(); + uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence( + { + {"Name", uno::makeAny(aEntry)}, + })); + comphelper::dispatchCommand(".uno:ClassificationApply", aPropertyValues); +} + void ClassificationCategoriesController::statusChanged(const frame::FeatureStateEvent& /*rEvent*/) throw (uno::RuntimeException, std::exception) { if (!m_pCategories || m_pCategories->GetEntryCount() > 0) |