summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu11
-rw-r--r--sfx2/Library_sfx.mk1
-rw-r--r--sfx2/source/view/classificationcontroller.cxx119
-rw-r--r--sfx2/util/sfx.component4
-rw-r--r--sw/uiconfig/swriter/toolbar/classificationbar.xml2
5 files changed, 136 insertions, 1 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index d0366d815646..21fde6e16c17 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -985,6 +985,17 @@
<value>com.sun.star.svx.FindAllToolboxController</value>
</prop>
</node>
+ <node oor:name="com.sun.star.comp.sfx2.ClassificationCategoriesController" oor:op="replace">
+ <prop oor:name="Command">
+ <value>.uno:ClassificationApply</value>
+ </prop>
+ <prop oor:name="Module">
+ <value/>
+ </prop>
+ <prop oor:name="Controller">
+ <value>com.sun.star.comp.sfx2.ClassificationCategoriesController</value>
+ </prop>
+ </node>
<node oor:name="c4" oor:op="replace" install:module="reportbuilder">
<prop oor:name="Command">
<value>.uno:FontColor</value>
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 418a836b5465..0e4b51cef105 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -290,6 +290,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/styles/StyleManager \
sfx2/source/toolbox/imgmgr \
sfx2/source/toolbox/tbxitem \
+ sfx2/source/view/classificationcontroller \
sfx2/source/view/classificationhelper \
sfx2/source/view/frame \
sfx2/source/view/frame2 \
diff --git a/sfx2/source/view/classificationcontroller.cxx b/sfx2/source/view/classificationcontroller.cxx
new file mode 100644
index 000000000000..acdc9bf5073e
--- /dev/null
+++ b/sfx2/source/view/classificationcontroller.cxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <cppuhelper/implbase.hxx>
+#include <svtools/toolboxcontroller.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#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>
+#include <vcl/svapp.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/toolbox.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/classificationhelper.hxx>
+
+using namespace com::sun::star;
+
+namespace sfx2
+{
+
+using ClassificationCategoriesControllerBase = cppu::ImplInheritanceHelper<svt::ToolboxController, lang::XServiceInfo>;
+
+/// Controller for .uno:ClassificationApply.
+class ClassificationCategoriesController : public ClassificationCategoriesControllerBase
+{
+ VclPtr<ListBox> m_pCategories;
+
+public:
+ ClassificationCategoriesController(const uno::Reference<uno::XComponentContext>& rContext);
+ virtual ~ClassificationCategoriesController();
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw (uno::RuntimeException, std::exception) override;
+ virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) throw (uno::RuntimeException, std::exception) override;
+ virtual uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() throw (uno::RuntimeException, std::exception) override;
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw (uno::RuntimeException, std::exception) override;
+
+ // XToolbarController
+ virtual uno::Reference<awt::XWindow> SAL_CALL createItemWindow(const uno::Reference<awt::XWindow>& rParent) throw (uno::RuntimeException, std::exception) override;
+
+ // XStatusListener
+ virtual void SAL_CALL statusChanged(const frame::FeatureStateEvent& rEvent) throw (uno::RuntimeException, std::exception) override;
+};
+
+ClassificationCategoriesController::ClassificationCategoriesController(const uno::Reference<uno::XComponentContext>& rContext)
+ : ClassificationCategoriesControllerBase(rContext, uno::Reference<frame::XFrame>(), OUString(".uno:ClassificationApply"))
+ , m_pCategories(nullptr)
+{
+}
+
+ClassificationCategoriesController::~ClassificationCategoriesController()
+{
+}
+
+OUString ClassificationCategoriesController::getImplementationName() throw (uno::RuntimeException, std::exception)
+{
+ return OUString("com.sun.star.comp.sfx2.ClassificationCategoriesController");
+}
+
+sal_Bool ClassificationCategoriesController::supportsService(const OUString& rServiceName) throw (uno::RuntimeException, std::exception)
+{
+ return cppu::supportsService(this, rServiceName);
+}
+
+uno::Sequence<OUString> ClassificationCategoriesController::getSupportedServiceNames() throw (uno::RuntimeException, std::exception)
+{
+ uno::Sequence<OUString> aServices
+ {
+ "com.sun.star.frame.ToolbarController"
+ };
+ return aServices;
+}
+
+void ClassificationCategoriesController::dispose() throw (uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aSolarMutexGuard;
+
+ svt::ToolboxController::dispose();
+ m_pCategories.disposeAndClear();
+}
+
+uno::Reference<awt::XWindow> ClassificationCategoriesController::createItemWindow(const uno::Reference<awt::XWindow>& rParent) throw (uno::RuntimeException, std::exception)
+{
+ 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->SetSizePixel(m_pCategories->GetOptimalSize());
+ }
+
+ return uno::Reference<awt::XWindow>(VCLUnoHelper::GetInterface(m_pCategories));
+}
+
+void ClassificationCategoriesController::statusChanged(const frame::FeatureStateEvent& /*rEvent*/) throw (uno::RuntimeException, std::exception)
+{
+ return;
+}
+
+} // namespace sfx2
+
+extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* SAL_CALL com_sun_star_sfx2_ClassificationCategoriesController_get_implementation(uno::XComponentContext* pContext, const uno::Sequence<uno::Any>&)
+{
+ return cppu::acquire(new sfx2::ClassificationCategoriesController(pContext));
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/util/sfx.component b/sfx2/util/sfx.component
index dde8aa0815f0..ed9a449baca1 100644
--- a/sfx2/util/sfx.component
+++ b/sfx2/util/sfx.component
@@ -82,4 +82,8 @@
constructor="com_sun_star_comp_sfx2_SfxMacroLoader_get_implementation">
<service name="com.sun.star.frame.ProtocolHandler"/>
</implementation>
+ <implementation name="com.sun.star.comp.sfx2.ClassificationCategoriesController"
+ constructor="com_sun_star_sfx2_ClassificationCategoriesController_get_implementation">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
</component>
diff --git a/sw/uiconfig/swriter/toolbar/classificationbar.xml b/sw/uiconfig/swriter/toolbar/classificationbar.xml
index a30c24429452..3ee34071e040 100644
--- a/sw/uiconfig/swriter/toolbar/classificationbar.xml
+++ b/sw/uiconfig/swriter/toolbar/classificationbar.xml
@@ -8,5 +8,5 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
- <toolbar:toolbaritem xlink:href=".uno:FontHeight"/>
+ <toolbar:toolbaritem xlink:href=".uno:ClassificationApply"/>
</toolbar:toolbar>