tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / include / svx / tbcontrl.hxx
blob6f6a15b7c33cc03f70da9ca8ad69726d4dd01d5f
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_BACK_COLOR
61 for paragraph background color (writer)
62 and cell background color (calc)
63 Execute-Id SID_BACKGROUND_COLOR
65 for table/cell border color (writer, calc)
66 Execute-Id SID_FRAME_LINECOLOR
68 for 3D extrusion
69 Execute-Id SID_EXTRUSION_3D_COLOR
71 for line color
72 Execute-Id SID_ATTR_LINE_COLOR
74 for area fill color
75 Execute-Id SID_ATTR_FILL_COLOR
77 SvxPatternToolBoxControl
78 ------------------------
79 Item type: SvxBrushItem
80 Execute-Id: SID_BACKGROUND_PATTERN
81 -> SvxBrushItem
82 Additional information
83 from DocShell: presently none
84 in future: color palette
85 Note: Analysis of BrushItem:
86 Brush-FillColor() is misused as switch,
87 to distinguish whether a new style
88 or a new color has been set
90 GetFillColor() == COL_BLACK -> GetStyle() ,
91 GetFillColor() == COL_WHITE -> GetColor()
93 SvxFrameToolBoxControl
94 ----------------------
95 Item type: SvxBoxItem
96 Execute-Id: SID_ATTR_BORDER
97 -> SvxBoxItem & SvxBoxInfoItem
98 Additional information
99 from DocShell: none
100 Note: provides, depending on chosen ValueSet-Item,
101 only SvxBoxItem or additionally SvxBoxInfoItem
102 If the Controller in SfxUInt16Item receives a
103 value != 0, paragraph mode will be switched on,
104 i.e. the last line will be hidden.
105 A value == 0 switches again to Table mode.
107 SvxFrameLineStyleToolBoxControl
108 -------------------------------
109 Item type: SvxLineItem
110 Execute-Id: SID_FRAME_LINESTYLE
111 -> SvxLineItem
112 Additional information
113 from DocShell: none
114 Note: provides a SvxLineItem, which provides a SvxBorderLine
115 without color information.
117 SvxStyleToolBoxControl
118 ----------------------
119 Item type: SfxTemplateItem
120 Execute-Id: SID_TEMPLATE_APPLY
121 -> StyleName (SfxStringItem)
122 -> eStyleFamily (SfxUInt16Item)
123 Additional information
124 from DocShell: none
125 Note: Switch family by Invalidate
126 at the Bindings (->SfxStyleControllerItem)
128 \*--------------------------------------------------------------*/
130 // ITEMID_... defines in the *.cxx
132 #include <config_options.h>
133 #include <svl/style.hxx>
134 #include <svx/svxdllapi.h>
135 #include <com/sun/star/frame/XSubToolbarController.hpp>
136 #include <svtools/popupwindowcontroller.hxx>
137 #include <svx/colorwindow.hxx>
138 #include <memory>
140 // important in the tbxctrls.hxx created with HeDaBu !!!
141 class SvxLineItem;
142 class SvxBoxInfoItem;
143 class SvxFontItem;
144 class SfxStyleControllerItem_Impl;
145 class SfxStyleSheetBasePool;
146 class SfxTemplateItem;
147 class PaletteManager;
149 namespace svx { class ToolboxButtonColorUpdaterBase; }
150 namespace sfx { struct CurrencyID; }
152 class SvxStyleToolBoxControl final : public cppu::ImplInheritanceHelper<svt::ToolboxController,
153 css::lang::XServiceInfo>
155 struct Impl;
156 std::unique_ptr<Impl> pImpl;
158 public:
159 SvxStyleToolBoxControl();
160 virtual ~SvxStyleToolBoxControl() override;
162 // XStatusListener
163 virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
165 // XToolbarController
166 virtual css::uno::Reference<css::awt::XWindow> SAL_CALL createItemWindow(const css::uno::Reference<css::awt::XWindow>& rParent) override;
168 // XInitialization
169 virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& aArguments) override;
171 // XUpdatable
172 virtual void SAL_CALL update() override;
174 // XComponent
175 virtual void SAL_CALL dispose() override;
177 // XServiceInfo
178 virtual OUString SAL_CALL getImplementationName() override;
179 virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
180 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
182 private:
183 #define MAX_FAMILIES 5
185 SfxStyleSheetBasePool* pStyleSheetPool;
186 rtl::Reference<SfxStyleControllerItem_Impl> m_xBoundItems[MAX_FAMILIES];
187 std::unique_ptr<SfxTemplateItem> pFamilyState[MAX_FAMILIES];
188 sal_uInt16 nActFamily; // Id in the ToolBox = Position - 1
190 void Update();
191 void FillStyleBox();
192 void SelectStyle(const OUString& rStyleName);
194 friend class SfxStyleControllerItem_Impl;
196 void SetFamilyState(sal_uInt16 nIdx, const SfxTemplateItem* pItem);
197 SfxStyleFamily GetActFamily() const;
200 typedef std::function<void(const OUString&, const NamedColor&)> ColorSelectFunction;
202 class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SvxColorToolBoxControl final : public cppu::ImplInheritanceHelper< svt::PopupWindowController,
203 css::frame::XSubToolbarController >
205 std::unique_ptr<svx::ToolboxButtonColorUpdaterBase> m_xBtnUpdater;
206 std::shared_ptr<PaletteManager> m_xPaletteManager;
207 ColorStatus m_aColorStatus;
208 bool m_bSplitButton;
209 sal_uInt16 m_nSlotId;
210 ColorSelectFunction m_aColorSelectFunction;
212 weld::Window* GetParentFrame() const;
214 public:
215 explicit SvxColorToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext );
216 virtual ~SvxColorToolBoxControl() override;
218 // XInitialization
219 virtual void SAL_CALL initialize( const css::uno::Sequence<css::uno::Any>& rArguments ) override;
221 // XUpdatable
222 virtual void SAL_CALL update() override;
224 // XStatusListener
225 virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
227 // XToolbarController
228 virtual void SAL_CALL execute( sal_Int16 nSelectModifier ) override;
230 virtual VclPtr<vcl::Window> createVclPopupWindow( vcl::Window* pParent ) override;
231 virtual std::unique_ptr<WeldToolbarPopup> weldPopupWindow() override;
233 // XSubToolbarController
234 virtual sal_Bool SAL_CALL opensSubToolbar() override;
235 virtual OUString SAL_CALL getSubToolbarName() override;
236 virtual void SAL_CALL functionSelected( const OUString& rCommand ) override;
237 virtual void SAL_CALL updateImage() override;
239 // XServiceInfo
240 virtual OUString SAL_CALL getImplementationName() override;
241 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
243 void setColorSelectFunction(const ColorSelectFunction& aColorSelectFunction);
244 void EnsurePaletteManager();
247 /** Popup controller for currency combo widget **/
248 class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SvxCurrencyToolBoxControl final : public svt::PopupWindowController
250 private:
251 OUString m_aFormatString;
252 LanguageType m_eLanguage;
253 sal_uInt32 m_nFormatKey;
255 public:
257 * Static method used by SvxNumberFormatShell::GetCurrencySymbols<p>
259 * @param rList output: labels in the combo box
260 * @param bFlag input: true means that we add the default currency in the combox
261 * @param rCurrencyList output: list of the currency positions in SvxCurrencyToolBoxControl::CurrencySymbols vector
262 * @see SvxNumberFormatShell::GetCurrencySymbols
264 static void GetCurrencySymbols( std::vector<OUString>& rList, bool bFlag,
265 std::vector<sal_uInt16>& rCurrencyList,
266 std::vector<sfx::CurrencyID> const& rCurrencyIDs);
268 explicit SvxCurrencyToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext );
269 virtual ~SvxCurrencyToolBoxControl() override;
271 /** XToolbarController **/
272 virtual void SAL_CALL execute( sal_Int16 nSelectModifier ) override;
274 virtual VclPtr<vcl::Window> createVclPopupWindow( vcl::Window* pParent ) override;
275 virtual std::unique_ptr<WeldToolbarPopup> weldPopupWindow() override;
277 /** XServiceInfo **/
278 virtual OUString SAL_CALL getImplementationName() override;
279 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
281 /** XInitialization **/
282 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rArguments ) override;
285 #endif // INCLUDED_SVX_TBCONTRL_HXX
287 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */