bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / svx / tbcontrl.hxx
blobafa61b9b38b185267d0cf707a08a7d7c8e88f796
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SVX_TBCONTRL_HXX
20 #define INCLUDED_SVX_TBCONTRL_HXX
22 /*--------------------------------------------------------------*\
24 Description:
25 -------------
26 ToolBox-Controller for:
27 Font-Name, Font-Height, Font-Color
28 Fore-/Background color /-patterns
29 Frames, Lines
30 (indentation-)templates
32 Use:
33 ----------
34 SvxFontNameToolBoxControl
35 -------------------------
36 Item type: SvxFontItem
37 Execute-Id: SID_ATTR_CHAR_FONT
38 -> SvxFontItem
39 Additional information
40 from DocShell: SvxFontListItem (SID_ATTR_CHAR_FONTLIST)
42 SvxColorToolBoxControl
43 ----------------------
44 Item type: SvxColorItem
45 SvxLineItem
46 SfxBoolItem
47 XLineColorItem
48 and XFillColorItem
50 for font color (writer, ...)
51 Execute-Id SID_ATTR_CHAR_COLOR2
52 and SID_ATTR_CHAR_COLOR_EXT
54 for font color
55 (calc/impress/draw and writer drawing objects)
56 Execute-Id SID_ATTR_CHAR_COLOR
58 for character background color (writer)
59 Execute-Id SID_ATTR_CHAR_COLOR_BACKGROUND
60 and SID_ATTR_CHAR_COLOR_BACKGROUND_EXT
62 for paragraph background color (writer)
63 and cell background color (calc)
64 Execute-Id SID_BACKGROUND_COLOR
66 for table/cell border color (writer, calc)
67 Execute-Id SID_FRAME_LINECOLOR
69 for 3D extrusion
70 Execute-Id SID_EXTRUSION_3D_COLOR
72 for line color
73 Execute-Id SID_ATTR_LINE_COLOR
75 for area fill color
76 Execute-Id SID_ATTR_FILL_COLOR
78 SvxPatternToolBoxControl
79 ------------------------
80 Item type: SvxBrushItem
81 Execute-Id: SID_BACKGROUND_PATTERN
82 -> SvxBrushItem
83 Additional information
84 from DocShell: presently none
85 in future: color palette
86 Note: Analysis of BrushItem:
87 Brush-FillColor() is misused as switch,
88 to distinguish whether a new style
89 or a new color has been set
91 GetFillColor() == COL_BLACK -> GetStyle() ,
92 GetFillColor() == COL_WHITE -> GetColor()
94 SvxFrameToolBoxControl
95 ----------------------
96 Item type: SvxBoxItem
97 Execute-Id: SID_ATTR_BORDER
98 -> SvxBoxItem & SvxBoxInfoItem
99 Additional information
100 from DocShell: none
101 Note: provides, depending on chosen ValueSet-Item,
102 only SvxBoxItem or additionally SvxBoxInfoItem
103 If the Controller in SfxUInt16Item receives a
104 value != 0, paragraph mode will be switched on,
105 i.e. the last line will be hidden.
106 A value == 0 switches again to Table mode.
108 SvxFrameLineStyleToolBoxControl
109 -------------------------------
110 Item type: SvxLineItem
111 Execute-Id: SID_FRAME_LINESTYLE
112 -> SvxLineItem
113 Additional information
114 from DocShell: none
115 Note: provides a SvxLineItem, which provides a SvxBorderLine
116 without color information.
118 SvxStyleToolBoxControl
119 ----------------------
120 Item type: SfxTemplateItem
121 Execute-Id: SID_TEMPLATE_APPLY
122 -> StyleName (SfxStringItem)
123 -> eStyleFamily (SfxUInt16Item)
124 Additional information
125 from DocShell: none
126 Note: Switch family by Invalidate
127 at the Bindings (->SfxStyleControllerItem)
129 \*--------------------------------------------------------------*/
131 // ITEMID_... defines in the *.cxx
133 #include <svl/style.hxx>
134 #include <svl/lstner.hxx>
135 #include <sfx2/tbxctrl.hxx>
136 #include <svx/strarray.hxx>
137 #include <svx/svxdllapi.h>
138 #include <com/sun/star/awt/FontDescriptor.hpp>
139 #include <com/sun/star/frame/XSubToolbarController.hpp>
140 #include <svtools/popupwindowcontroller.hxx>
141 #include <svx/colorwindow.hxx>
142 #include <memory>
144 // important in the tbxctrls.hxx created with HeDaBu !!!
145 class SvxLineItem;
146 class SvxBoxInfoItem;
147 class SvxFontItem;
148 class SfxStyleControllerItem_Impl;
149 class SfxStyleSheetBasePool;
150 class SfxTemplateItem;
151 class SvxStyleBox_Impl;
152 class PaletteManager;
154 namespace svx
156 class ToolboxButtonColorUpdater;
159 class SVX_DLLPUBLIC SvxStyleToolBoxControl : public SfxToolBoxControl
161 struct Impl;
162 std::unique_ptr<Impl> pImpl;
164 public:
165 SFX_DECL_TOOLBOX_CONTROL();
167 SvxStyleToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox);
168 virtual ~SvxStyleToolBoxControl() override;
170 virtual VclPtr<vcl::Window> CreateItemWindow(vcl::Window* pParent) override;
172 virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
173 const SfxPoolItem* pState) override;
175 DECL_LINK( VisibilityNotification, SvxStyleBox_Impl&, void );
176 protected:
177 // XInitialization
178 virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& aArguments) override;
180 // XUpdatable
181 virtual void SAL_CALL update() override;
183 // XComponent
184 virtual void SAL_CALL dispose() override;
186 private:
188 #define MAX_FAMILIES 5
190 SfxStyleSheetBasePool* pStyleSheetPool;
191 SfxStyleControllerItem_Impl* pBoundItems[MAX_FAMILIES];
192 css::uno::Reference<css::lang::XComponent> m_xBoundItems[MAX_FAMILIES];
193 std::unique_ptr<SfxTemplateItem> pFamilyState[MAX_FAMILIES];
194 sal_uInt16 nActFamily; // Id in the ToolBox = Position - 1
196 SVX_DLLPRIVATE void Update();
197 SVX_DLLPRIVATE void FillStyleBox();
198 SVX_DLLPRIVATE void SelectStyle(const OUString& rStyleName);
200 friend class SfxStyleControllerItem_Impl;
202 SVX_DLLPRIVATE void SetFamilyState(sal_uInt16 nIdx, const SfxTemplateItem* pItem);
203 SVX_DLLPRIVATE SfxStyleFamily GetActFamily();
206 typedef std::function<void(const OUString&, const NamedColor&)> ColorSelectFunction;
208 class SVX_DLLPUBLIC SvxColorToolBoxControl : public cppu::ImplInheritanceHelper< svt::PopupWindowController,
209 css::frame::XSubToolbarController >
211 std::unique_ptr<svx::ToolboxButtonColorUpdater> m_xBtnUpdater;
212 std::shared_ptr<PaletteManager> m_xPaletteManager;
213 ColorStatus m_aColorStatus;
214 bool m_bSplitButton;
215 sal_uInt16 m_nSlotId;
216 ColorSelectFunction m_aColorSelectFunction;
217 DECL_LINK(SelectedHdl, const NamedColor&, void);
218 public:
219 explicit SvxColorToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext );
220 virtual ~SvxColorToolBoxControl() override;
222 // XInitialization
223 virtual void SAL_CALL initialize( const css::uno::Sequence<css::uno::Any>& rArguments ) override;
225 // XUpdatable
226 virtual void SAL_CALL update() override;
228 // XStatusListener
229 virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
231 // XToolbarController
232 virtual void SAL_CALL execute( sal_Int16 nSelectModifier ) override;
234 using svt::ToolboxController::createPopupWindow;
235 virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) override;
237 // XSubToolbarController
238 virtual sal_Bool SAL_CALL opensSubToolbar() override;
239 virtual OUString SAL_CALL getSubToolbarName() override;
240 virtual void SAL_CALL functionSelected( const OUString& rCommand ) override;
241 virtual void SAL_CALL updateImage() override;
243 // XServiceInfo
244 virtual OUString SAL_CALL getImplementationName() override;
245 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
247 void setColorSelectFunction(const ColorSelectFunction& aColorSelectFunction);
248 void EnsurePaletteManager();
251 class SVX_DLLPUBLIC SvxSimpleUndoRedoController : public SfxToolBoxControl
253 private:
254 OUString aDefaultText;
256 public:
257 SFX_DECL_TOOLBOX_CONTROL();
258 SvxSimpleUndoRedoController(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox);
259 virtual ~SvxSimpleUndoRedoController() override;
261 virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
262 const SfxPoolItem* pState) override;
265 class SVX_DLLPUBLIC SvxCurrencyToolBoxControl : public svt::PopupWindowController
267 private:
268 OUString m_aFormatString;
269 LanguageType m_eLanguage;
270 sal_uInt32 m_nFormatKey;
271 public:
272 static void GetCurrencySymbols( std::vector<OUString>& rList, bool bFlag,
273 std::vector<sal_uInt16>& rCurrencyList );
275 explicit SvxCurrencyToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext );
276 virtual ~SvxCurrencyToolBoxControl() override;
278 // XToolbarController
279 virtual void SAL_CALL execute( sal_Int16 nSelectModifier ) override;
281 using svt::ToolboxController::createPopupWindow;
282 virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) override;
284 // XServiceInfo
285 virtual OUString SAL_CALL getImplementationName() override;
286 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
288 // XInitialization
289 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rArguments ) override;
292 #endif // INCLUDED_SVX_TBCONTRL_HXX
294 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */