1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  *   Licensed to the Apache Software Foundation (ASF) under one or more
12  *   contributor license agreements. See the NOTICE file distributed
13  *   with this work for additional information regarding copyright
14  *   ownership. The ASF licenses this file to you under the Apache
15  *   License, Version 2.0 (the "License"); you may not use this file
16  *   except in compliance with the License. You may obtain a copy of
17  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 #ifndef INCLUDED_SVX_SOURCE_SIDEBAR_PARAGRAPH_PARASPACINGCONTROL_HXX
20 #define INCLUDED_SVX_SOURCE_SIDEBAR_PARAGRAPH_PARASPACINGCONTROL_HXX
21 
22 #include <sfx2/tbxctrl.hxx>
23 #include <svx/svxdllapi.h>
24 #include <com/sun/star/ui/XContextChangeEventListener.hpp>
25 
26 namespace com::sun::star::ui { class XContextChangeEventMultiplexer; }
27 namespace com::sun::star::ui { struct ContextChangeEventObject; }
28 namespace vcl { class Window; }
29 
30 namespace svx {
31 
32 class SVX_DLLPUBLIC ParaULSpacingControl : public SfxToolBoxControl
33 {
34 public:
35     SFX_DECL_TOOLBOX_CONTROL();
36 
37     ParaULSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
38     virtual ~ParaULSpacingControl() override;
39 
40     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
41                               const SfxPoolItem* pState) override;
42     virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) override = 0;
43 };
44 
45 class SVX_DLLPUBLIC ParaAboveSpacingControl final : public ParaULSpacingControl
46 {
47 public:
48     SFX_DECL_TOOLBOX_CONTROL();
49 
50     ParaAboveSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
51     virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) override;
52 };
53 
54 class SVX_DLLPUBLIC ParaBelowSpacingControl final : public ParaULSpacingControl
55 {
56 public:
57     SFX_DECL_TOOLBOX_CONTROL();
58 
59     ParaBelowSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
60     virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) override;
61 };
62 
63 class SVX_DLLPUBLIC ParaLRSpacingControl : public SfxToolBoxControl,
64                                     public css::ui::XContextChangeEventListener
65 {
66 public:
67     SFX_DECL_TOOLBOX_CONTROL();
68 
69     ParaLRSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
70     virtual ~ParaLRSpacingControl() override;
71 
72     virtual void SAL_CALL dispose() override;
73 
74     virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
75                               const SfxPoolItem* pState) override;
76     virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) override = 0;
77 
78     // XContextChangeEventListener
79     virtual void SAL_CALL notifyContextChangeEvent(const css::ui::ContextChangeEventObject& rEvent) override;
80 
81     virtual ::css::uno::Any SAL_CALL queryInterface(const ::css::uno::Type& aType) override;
82 
83     virtual void SAL_CALL acquire() throw () override;
84 
85     virtual void SAL_CALL disposing(const ::css::lang::EventObject&) override;
86 
87     virtual void SAL_CALL release() throw () override;
88 
89 private:
90     css::uno::Reference<css::ui::XContextChangeEventMultiplexer> m_xMultiplexer;
91 };
92 
93 class SVX_DLLPUBLIC ParaLeftSpacingControl final : public ParaLRSpacingControl
94 {
95 public:
96     SFX_DECL_TOOLBOX_CONTROL();
97 
98     ParaLeftSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
99     virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) override;
100 };
101 
102 class SVX_DLLPUBLIC ParaRightSpacingControl final : public ParaLRSpacingControl
103 {
104 public:
105     SFX_DECL_TOOLBOX_CONTROL();
106 
107     ParaRightSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
108     virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) override;
109 };
110 
111 class SVX_DLLPUBLIC ParaFirstLineSpacingControl final : public ParaLRSpacingControl
112 {
113 public:
114     SFX_DECL_TOOLBOX_CONTROL();
115 
116     ParaFirstLineSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
117     virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) override;
118 };
119 
120 }
121 
122 #endif
123 
124 
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
126