Line data Source code
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_TBCONTRL_HXX
20 : #define INCLUDED_SVX_TBCONTRL_HXX
21 :
22 : /*--------------------------------------------------------------*\
23 :
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
31 :
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)
41 :
42 : SvxFontColorToolBoxControl
43 : --------------------------
44 : Item type: SvxFontColorItem
45 : Execute-Id: SID_ATTR_CHAR_COLOR
46 : -> SvxFontColorItem
47 : Additional information
48 : from DocShell: presently none
49 : in future: color palette
50 :
51 : class SvxColorExtToolBoxControl
52 : -----------------------------------
53 : Item type: SvxColorItem
54 : and SfxBoolItem
55 :
56 : for font color (writer, ...)
57 : Execute-Id SID_ATTR_CHAR_COLOR2
58 : and SID_ATTR_CHAR_COLOR_EXT
59 :
60 : for cell color (calc)
61 : Execute-Id SID_ATTR_CHAR_COLOR
62 :
63 : for character background color (writer)
64 : Execute-Id SID_ATTR_CHAR_COLOR_BACKGROUND
65 : and SID_ATTR_CHAR_COLOR_BACKGROUND_EXT
66 :
67 : for paragraph background color (writer)
68 : Execute-Id SID_BACKGROUND_COLOR
69 :
70 : for cell background color (calc)
71 : Execute-Id SID_ATTR_CHAR_COLOR_BACKGROUND
72 :
73 : for table/cell border color (writer, calc)
74 : Execute-Id SID_FRAME_LINECOLOR
75 :
76 : SvxColorToolBoxControl
77 : --------------------------------
78 : Item type: SvxBrushItem
79 : Execute-Id: SID_BACKGROUND_COLOR
80 : -> SvxColorItem
81 :
82 : SvxPatternToolBoxControl
83 : ------------------------
84 : Item type: SvxBrushItem
85 : Execute-Id: SID_BACKGROUND_PATTERN
86 : -> SvxBrushItem
87 : Additional information
88 : from DocShell: presently none
89 : in future: color palette
90 : Note: Analysis of BrushItem:
91 : Brush-FillColor() is misused as switch,
92 : to distinguish whether a new style
93 : or a new color has been set
94 :
95 : GetFillColor() == COL_BLACK -> GetStyle() ,
96 : GetFillColor() == COL_WHITE -> GetColor()
97 :
98 : SvxFrameToolBoxControl
99 : ----------------------
100 : Item type: SvxBoxItem
101 : Execute-Id: SID_ATTR_BORDER
102 : -> SvxBoxItem & SvxBoxInfoItem
103 : Additional information
104 : from DocShell: none
105 : Bemerkung: provides dependent of chosen ValueSet-Item
106 : only SvxBoxItem or additionally SvxBoxInfoItem
107 : If the Controller ein SfxUInt16Item receives a
108 : value != 0, paragraph mode will be switched on,
109 : i.e. the last line will be hidden.
110 : A value == 0 switches again to Tabel mode.
111 :
112 : SvxFrameLineStyleToolBoxControl
113 : -------------------------------
114 : Item type: SvxLineItem
115 : Execute-Id: SID_FRAME_LINESTYLE
116 : -> SvxLineItem
117 : Additional information
118 : from DocShell: none
119 : Bemerkung: provides a SvxLineItem, which provides a SvxBorderLine
120 : without color information.
121 :
122 : SvxFrameLineColorToolBoxControl
123 : -------------------------------
124 : Item type: SvxColorItem
125 : Execute-Id: SID_FRAME_LINECOLOR
126 : -> SvxColorItem
127 : Additional information
128 : from DocShell: none
129 :
130 : SvxStyleToolBoxControl
131 : ----------------------
132 : Item type: SfxTemplateItem
133 : Execute-Id: SID_TEMPLATE_APPLY
134 : -> StyleName (SfxStringItem)
135 : -> eStyleFamily (SfxUInt16Item)
136 : Additional information
137 : from DocShell: none
138 : Bemerkung: Switch family by Invalidate
139 : at the Bindings (->SfxStyleControllerItem)
140 :
141 : \*--------------------------------------------------------------*/
142 :
143 : // ITEMID_...-Defines i *.cxx
144 :
145 : #include <rsc/rscsfx.hxx>
146 : #include <svl/lstner.hxx>
147 : #include <sfx2/tbxctrl.hxx>
148 : #include <svx/strarray.hxx>
149 : #include <svx/svxdllapi.h>
150 :
151 : #include <com/sun/star/awt/FontDescriptor.hpp>
152 :
153 : // important im tbxctrls.hxx created HeDaBu !!!
154 : class SvxLineItem;
155 : class SvxBoxInfoItem;
156 : class SvxFontItem;
157 : class SfxStyleControllerItem_Impl;
158 : class SfxStyleSheetBasePool;
159 : class SfxTemplateItem;
160 :
161 : namespace svx
162 : {
163 : class ToolboxButtonColorUpdater;
164 : }
165 :
166 :
167 :
168 : // class SvxStyleToolBoxControl ------------------------------------------
169 :
170 : class SVX_DLLPUBLIC SvxStyleToolBoxControl : public SfxToolBoxControl
171 : {
172 : struct Impl;
173 : public:
174 : SFX_DECL_TOOLBOX_CONTROL();
175 :
176 : SvxStyleToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
177 : virtual ~SvxStyleToolBoxControl();
178 :
179 : virtual Window* CreateItemWindow( Window *pParent ) SAL_OVERRIDE;
180 :
181 : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
182 : const SfxPoolItem* pState ) SAL_OVERRIDE;
183 :
184 : DECL_LINK( VisibilityNotification, void* );
185 : protected:
186 : // XInitialization
187 : virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
188 :
189 : // XUpdatable
190 : virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
191 :
192 : // XComponent
193 : virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
194 :
195 : private:
196 :
197 : #define MAX_FAMILIES 5
198 :
199 : SfxStyleSheetBasePool* pStyleSheetPool;
200 : SfxStyleControllerItem_Impl* pBoundItems [MAX_FAMILIES];
201 : css::uno::Reference< css::lang::XComponent >
202 : m_xBoundItems[MAX_FAMILIES];
203 : SfxTemplateItem* pFamilyState[MAX_FAMILIES];
204 : sal_uInt16 nActFamily; // Id in the ToolBox = Position - 1
205 : OUString aCurSel;
206 : Impl* pImpl;
207 :
208 : SVX_DLLPRIVATE void Update();
209 : SVX_DLLPRIVATE void FillStyleBox();
210 : SVX_DLLPRIVATE void SelectStyle( const OUString& rStyleName );
211 :
212 : friend class SfxStyleControllerItem_Impl;
213 :
214 : SVX_DLLPRIVATE void SetFamilyState ( sal_uInt16 nIdx, const SfxTemplateItem* pItem );
215 : SVX_DLLPRIVATE SfxStyleFamily GetActFamily ();
216 : };
217 :
218 :
219 : // class SvxFontNameToolBoxControl ---------------------------------------
220 :
221 :
222 :
223 0 : class SVX_DLLPUBLIC SvxFontNameToolBoxControl : public SfxToolBoxControl
224 : {
225 : public:
226 : SFX_DECL_TOOLBOX_CONTROL();
227 : SvxFontNameToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
228 :
229 : virtual void StateChanged ( sal_uInt16 nSID, SfxItemState eState,
230 : const SfxPoolItem* pState ) SAL_OVERRIDE;
231 : virtual Window* CreateItemWindow ( Window *pParent ) SAL_OVERRIDE;
232 : };
233 :
234 :
235 :
236 :
237 : // class SvxFontColorToolBoxControl --------------------------------------
238 :
239 :
240 :
241 :
242 : class SVX_DLLPUBLIC SvxFontColorToolBoxControl : public SfxToolBoxControl
243 : {
244 : ::svx::ToolboxButtonColorUpdater* pBtnUpdater;
245 : Color mLastColor;
246 :
247 : public:
248 : SFX_DECL_TOOLBOX_CONTROL();
249 : SvxFontColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
250 : virtual ~SvxFontColorToolBoxControl();
251 :
252 : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
253 : const SfxPoolItem* pState ) SAL_OVERRIDE;
254 : virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
255 : virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
256 : };
257 :
258 :
259 :
260 :
261 : // class SvxColorExtToolBoxControl --------------------------------------
262 :
263 :
264 :
265 :
266 : class SVX_DLLPUBLIC SvxColorExtToolBoxControl : public SfxToolBoxControl
267 : {
268 : using SfxToolBoxControl::StateChanged;
269 :
270 : ::svx::ToolboxButtonColorUpdater* pBtnUpdater;
271 : Color mLastColor;
272 : bool bChoiceFromPalette;
273 :
274 : public:
275 : SFX_DECL_TOOLBOX_CONTROL();
276 : SvxColorExtToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
277 : virtual ~SvxColorExtToolBoxControl();
278 :
279 : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
280 : const SfxPoolItem* pState ) SAL_OVERRIDE;
281 : virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
282 : virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
283 : virtual void Select(sal_uInt16 nSelectModifier) SAL_OVERRIDE;
284 : };
285 :
286 :
287 :
288 :
289 : // class SvxColorToolBoxControl ------------------------------------------
290 :
291 :
292 :
293 : class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl
294 : {
295 : ::svx::ToolboxButtonColorUpdater* pBtnUpdater;
296 : Color mLastColor;
297 :
298 : public:
299 : SvxColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
300 : virtual ~SvxColorToolBoxControl();
301 :
302 : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
303 : const SfxPoolItem* pState ) SAL_OVERRIDE;
304 : virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
305 : virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
306 : };
307 :
308 :
309 :
310 :
311 : // class SvxFrameToolBoxControl ------------------------------------------
312 :
313 :
314 :
315 0 : class SVX_DLLPUBLIC SvxFrameToolBoxControl : public SfxToolBoxControl
316 : {
317 : public:
318 : SFX_DECL_TOOLBOX_CONTROL();
319 : SvxFrameToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
320 :
321 : virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
322 : virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
323 : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
324 : const SfxPoolItem* pState ) SAL_OVERRIDE;
325 :
326 : };
327 :
328 :
329 :
330 :
331 : // class SvxLineStyleToolBoxControl --------------------------------------
332 :
333 :
334 :
335 0 : class SVX_DLLPUBLIC SvxFrameLineStyleToolBoxControl : public SfxToolBoxControl
336 : {
337 : public:
338 : SFX_DECL_TOOLBOX_CONTROL();
339 : SvxFrameLineStyleToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
340 :
341 : virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
342 : virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
343 : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
344 : const SfxPoolItem* pState ) SAL_OVERRIDE;
345 : };
346 :
347 :
348 :
349 :
350 : // class SvxFrameLineColorToolBoxControl ---------------------------------
351 :
352 :
353 :
354 : class SVX_DLLPUBLIC SvxFrameLineColorToolBoxControl : public SfxToolBoxControl
355 : {
356 : ::svx::ToolboxButtonColorUpdater* pBtnUpdater;
357 : Color mLastColor;
358 :
359 : public:
360 : SFX_DECL_TOOLBOX_CONTROL();
361 : SvxFrameLineColorToolBoxControl( sal_uInt16 nSlotId,
362 : sal_uInt16 nId,
363 : ToolBox& rTbx );
364 : virtual ~SvxFrameLineColorToolBoxControl();
365 :
366 : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
367 : const SfxPoolItem* pState ) SAL_OVERRIDE;
368 : virtual SfxPopupWindowType GetPopupWindowType() const SAL_OVERRIDE;
369 : virtual SfxPopupWindow* CreatePopupWindow() SAL_OVERRIDE;
370 : };
371 :
372 : class SVX_DLLPUBLIC SvxSimpleUndoRedoController : public SfxToolBoxControl
373 : {
374 : private:
375 : OUString aDefaultText;
376 :
377 : public:
378 : SFX_DECL_TOOLBOX_CONTROL();
379 : SvxSimpleUndoRedoController( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
380 : virtual ~SvxSimpleUndoRedoController();
381 :
382 : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
383 : const SfxPoolItem* pState ) SAL_OVERRIDE;
384 : };
385 :
386 : #endif // INCLUDED_SVX_TBCONTRL_HXX
387 :
388 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|