Kaydet (Commit) 46b85ee0 authored tarafından Miklos Vajna's avatar Miklos Vajna

sfx2 classification toolbar: dispatch uno command on selection change

Change-Id: Iad3cb44cd57ad9e50be6008146629cdca8455eb6
üst c00a0a4f
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment