Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _SVX_TBCONTRL_HXX
29 : : #define _SVX_TBCONTRL_HXX
30 : :
31 : : /*--------------------------------------------------------------*\
32 : :
33 : : Description:
34 : : -------------
35 : : ToolBox-Controller for:
36 : : Font-Name, Font-Height, Font-Color
37 : : Fore-/Background color /-patterns
38 : : Frames, Lines
39 : : (indentation-)templates
40 : :
41 : : Use:
42 : : ----------
43 : : SvxFontNameToolBoxControl
44 : : -------------------------
45 : : Item type: SvxFontItem
46 : : Execute-Id: SID_ATTR_CHAR_FONT
47 : : -> SvxFontItem
48 : : Additional information
49 : : from DocShell: SvxFontListItem (SID_ATTR_CHAR_FONTLIST)
50 : :
51 : : SvxFontColorToolBoxControl
52 : : --------------------------
53 : : Item type: SvxFontColorItem
54 : : Execute-Id: SID_ATTR_CHAR_COLOR
55 : : -> SvxFontColorItem
56 : : Additional information
57 : : from DocShell: presently none
58 : : in future: color palette
59 : :
60 : : class SvxColorExtToolBoxControl
61 : : -----------------------------------
62 : : Item type: SvxColorItem
63 : : and SfxBoolItem
64 : :
65 : : for font color (writer, ...)
66 : : Execute-Id SID_ATTR_CHAR_COLOR2
67 : : and SID_ATTR_CHAR_COLOR_EXT
68 : :
69 : : for cell color (calc)
70 : : Execute-Id SID_ATTR_CHAR_COLOR
71 : :
72 : : for character background color (writer)
73 : : Execute-Id SID_ATTR_CHAR_COLOR_BACKGROUND
74 : : and SID_ATTR_CHAR_COLOR_BACKGROUND_EXT
75 : :
76 : : for paragraph background color (writer)
77 : : Execute-Id SID_BACKGROUND_COLOR
78 : :
79 : : for cell background color (calc)
80 : : Execute-Id SID_ATTR_CHAR_COLOR_BACKGROUND
81 : :
82 : : for table/cell border color (writer, calc)
83 : : Execute-Id SID_FRAME_LINECOLOR
84 : :
85 : : SvxColorToolBoxControl
86 : : --------------------------------
87 : : Item type: SvxBrushItem
88 : : Execute-Id: SID_BACKGROUND_COLOR
89 : : -> SvxColorItem
90 : :
91 : : SvxPatternToolBoxControl
92 : : ------------------------
93 : : Item type: SvxBrushItem
94 : : Execute-Id: SID_BACKGROUND_PATTERN
95 : : -> SvxBrushItem
96 : : Additional information
97 : : from DocShell: presently none
98 : : in future: color palette
99 : : Note: Analysis of BrushItem:
100 : : Brush-FillColor() is misused as switch,
101 : : to distinguish whether a new style
102 : : or a new color has been set
103 : :
104 : : GetFillColor() == COL_BLACK -> GetStyle() ,
105 : : GetFillColor() == COL_WHITE -> GetColor()
106 : :
107 : : SvxFrameToolBoxControl
108 : : ----------------------
109 : : Item type: SvxBoxItem
110 : : Execute-Id: SID_ATTR_BORDER
111 : : -> SvxBoxItem & SvxBoxInfoItem
112 : : Additional information
113 : : from DocShell: none
114 : : Bemerkung: provides dependant of chosen ValueSet-Item
115 : : only SvxBoxItem or additionally SvxBoxInfoItem
116 : : If the Controller ein SfxUInt16Item receives a
117 : : value != 0, paragraph mode will be switched on,
118 : : i.e. the last line will be hidden.
119 : : A value == 0 switches again to Tabel mode.
120 : :
121 : : SvxFrameLineStyleToolBoxControl
122 : : -------------------------------
123 : : Item type: SvxLineItem
124 : : Execute-Id: SID_FRAME_LINESTYLE
125 : : -> SvxLineItem
126 : : Additional information
127 : : from DocShell: none
128 : : Bemerkung: provides a SvxLineItem, which provides a SvxBorderLine
129 : : without color information.
130 : :
131 : : SvxFrameLineColorToolBoxControl
132 : : -------------------------------
133 : : Item type: SvxColorItem
134 : : Execute-Id: SID_FRAME_LINECOLOR
135 : : -> SvxColorItem
136 : : Additional information
137 : : from DocShell: none
138 : :
139 : : SvxStyleToolBoxControl
140 : : ----------------------
141 : : Item type: SfxTemplateItem
142 : : Execute-Id: SID_TEMPLATE_APPLY
143 : : -> StyleName (SfxStringItem)
144 : : -> eStyleFamily (SfxUInt16Item)
145 : : Additional information
146 : : from DocShell: none
147 : : Bemerkung: Switch family by Invalidate
148 : : at the Bindings (->SfxStyleControllerItem)
149 : :
150 : : \*--------------------------------------------------------------*/
151 : :
152 : : // ITEMID_...-Defines i *.cxx
153 : :
154 : : #include <rsc/rscsfx.hxx>
155 : : #include <svl/lstner.hxx>
156 : : #include <sfx2/tbxctrl.hxx>
157 : : #include <svx/strarray.hxx>
158 : : #include "svx/svxdllapi.h"
159 : :
160 : : #include <com/sun/star/awt/FontDescriptor.hpp>
161 : :
162 : : // important im tbxctrls.hxx created HeDaBu !!!
163 : : class SvxLineItem;
164 : : class SvxBoxInfoItem;
165 : : class SvxFontItem;
166 : : class SfxStyleControllerItem_Impl;
167 : : class SfxStyleSheetBasePool;
168 : : class SfxTemplateItem;
169 : :
170 : : namespace svx
171 : : {
172 : : class ToolboxButtonColorUpdater;
173 : : }
174 : : //########################################################################
175 : :
176 : : //========================================================================
177 : : // class SvxStyleToolBoxControl ------------------------------------------
178 : : //========================================================================
179 : : class SVX_DLLPUBLIC SvxStyleToolBoxControl : public SfxToolBoxControl
180 : : {
181 : : struct Impl;
182 : : public:
183 : : SFX_DECL_TOOLBOX_CONTROL();
184 : :
185 : : SvxStyleToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
186 : : ~SvxStyleToolBoxControl();
187 : :
188 : : virtual Window* CreateItemWindow( Window *pParent );
189 : :
190 : : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
191 : : const SfxPoolItem* pState );
192 : :
193 : : DECL_LINK( VisibilityNotification, void* );
194 : : protected:
195 : : // XInitialization
196 : : 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);
197 : :
198 : : // XUpdatable
199 : : virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException);
200 : :
201 : : // XComponent
202 : : virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
203 : :
204 : : private:
205 : :
206 : : #define MAX_FAMILIES 5
207 : :
208 : : SfxStyleSheetBasePool* pStyleSheetPool;
209 : : SfxStyleControllerItem_Impl* pBoundItems [MAX_FAMILIES];
210 : : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xBoundItems[MAX_FAMILIES];
211 : : SfxTemplateItem* pFamilyState[MAX_FAMILIES];
212 : : sal_uInt16 nActFamily; // Id in the ToolBox = Position - 1
213 : : String aCurSel;
214 : : Impl* pImpl;
215 : :
216 : : SVX_DLLPRIVATE void Update();
217 : : SVX_DLLPRIVATE void FillStyleBox();
218 : : SVX_DLLPRIVATE void SelectStyle( const String& rStyleName );
219 : :
220 : : friend class SfxStyleControllerItem_Impl;
221 : :
222 : : SVX_DLLPRIVATE void SetFamilyState ( sal_uInt16 nIdx, const SfxTemplateItem* pItem );
223 : : SVX_DLLPRIVATE SfxStyleFamily GetActFamily ();
224 : : };
225 : :
226 : : //========================================================================
227 : : // class SvxFontNameToolBoxControl ---------------------------------------
228 : : //========================================================================
229 : :
230 : :
231 [ - + ]: 1922 : class SVX_DLLPUBLIC SvxFontNameToolBoxControl : public SfxToolBoxControl
232 : : {
233 : : public:
234 : : SFX_DECL_TOOLBOX_CONTROL();
235 : : SvxFontNameToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
236 : :
237 : : virtual void StateChanged ( sal_uInt16 nSID, SfxItemState eState,
238 : : const SfxPoolItem* pState );
239 : : virtual Window* CreateItemWindow ( Window *pParent );
240 : : };
241 : :
242 : :
243 : :
244 : : //========================================================================
245 : : // class SvxFontColorToolBoxControl --------------------------------------
246 : : //========================================================================
247 : :
248 : :
249 : :
250 : : class SVX_DLLPUBLIC SvxFontColorToolBoxControl : public SfxToolBoxControl
251 : : {
252 : : ::svx::ToolboxButtonColorUpdater* pBtnUpdater;
253 : : Color mLastColor;
254 : :
255 : : public:
256 : : SFX_DECL_TOOLBOX_CONTROL();
257 : : SvxFontColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
258 : : ~SvxFontColorToolBoxControl();
259 : :
260 : : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
261 : : const SfxPoolItem* pState );
262 : : virtual SfxPopupWindowType GetPopupWindowType() const;
263 : : virtual SfxPopupWindow* CreatePopupWindow();
264 : : };
265 : :
266 : :
267 : :
268 : : //========================================================================
269 : : // class SvxColorExtToolBoxControl --------------------------------------
270 : : //========================================================================
271 : :
272 : :
273 : :
274 : : class SVX_DLLPUBLIC SvxColorExtToolBoxControl : public SfxToolBoxControl
275 : : {
276 : : using SfxToolBoxControl::StateChanged;
277 : : using SfxToolBoxControl::Select;
278 : :
279 : : // SfxStatusForwarder aForward;
280 : : ::svx::ToolboxButtonColorUpdater* pBtnUpdater;
281 : : Color mLastColor;
282 : : sal_Bool bChoiceFromPalette;
283 : :
284 : : public:
285 : : SFX_DECL_TOOLBOX_CONTROL();
286 : : SvxColorExtToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
287 : : ~SvxColorExtToolBoxControl();
288 : :
289 : : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
290 : : const SfxPoolItem* pState );
291 : : virtual SfxPopupWindowType GetPopupWindowType() const;
292 : : virtual SfxPopupWindow* CreatePopupWindow();
293 : : virtual void Select( sal_Bool bMod1 = sal_False );
294 : : };
295 : :
296 : :
297 : :
298 : : //========================================================================
299 : : // class SvxColorToolBoxControl ------------------------------------------
300 : : //========================================================================
301 : :
302 : :
303 : : class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl
304 : : {
305 : : ::svx::ToolboxButtonColorUpdater* pBtnUpdater;
306 : : Color mLastColor;
307 : :
308 : : public:
309 : : SvxColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
310 : : ~SvxColorToolBoxControl();
311 : :
312 : : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
313 : : const SfxPoolItem* pState );
314 : : virtual SfxPopupWindowType GetPopupWindowType() const;
315 : : virtual SfxPopupWindow* CreatePopupWindow();
316 : : };
317 : :
318 : :
319 : :
320 : : //========================================================================
321 : : // class SvxFrameToolBoxControl ------------------------------------------
322 : : //========================================================================
323 : :
324 : :
325 [ - + ]: 406 : class SVX_DLLPUBLIC SvxFrameToolBoxControl : public SfxToolBoxControl
326 : : {
327 : : public:
328 : : SFX_DECL_TOOLBOX_CONTROL();
329 : : SvxFrameToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
330 : :
331 : : virtual SfxPopupWindowType GetPopupWindowType() const;
332 : : virtual SfxPopupWindow* CreatePopupWindow();
333 : : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
334 : : const SfxPoolItem* pState );
335 : :
336 : : };
337 : :
338 : :
339 : :
340 : : //========================================================================
341 : : // class SvxLineStyleToolBoxControl --------------------------------------
342 : : //========================================================================
343 : :
344 : :
345 [ - + ]: 406 : class SVX_DLLPUBLIC SvxFrameLineStyleToolBoxControl : public SfxToolBoxControl
346 : : {
347 : : public:
348 : : SFX_DECL_TOOLBOX_CONTROL();
349 : : SvxFrameLineStyleToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
350 : :
351 : : virtual SfxPopupWindowType GetPopupWindowType() const;
352 : : virtual SfxPopupWindow* CreatePopupWindow();
353 : : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
354 : : const SfxPoolItem* pState );
355 : : };
356 : :
357 : :
358 : :
359 : : //========================================================================
360 : : // class SvxFrameLineColorToolBoxControl ---------------------------------
361 : : //========================================================================
362 : :
363 : :
364 : : class SVX_DLLPUBLIC SvxFrameLineColorToolBoxControl : public SfxToolBoxControl
365 : : {
366 : : ::svx::ToolboxButtonColorUpdater* pBtnUpdater;
367 : : Color mLastColor;
368 : :
369 : : public:
370 : : SFX_DECL_TOOLBOX_CONTROL();
371 : : SvxFrameLineColorToolBoxControl( sal_uInt16 nSlotId,
372 : : sal_uInt16 nId,
373 : : ToolBox& rTbx );
374 : : ~SvxFrameLineColorToolBoxControl();
375 : :
376 : : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
377 : : const SfxPoolItem* pState );
378 : : virtual SfxPopupWindowType GetPopupWindowType() const;
379 : : virtual SfxPopupWindow* CreatePopupWindow();
380 : : };
381 : :
382 : : class SVX_DLLPUBLIC SvxSimpleUndoRedoController : public SfxToolBoxControl
383 : : {
384 : : private:
385 : : ::rtl::OUString aDefaultText;
386 : :
387 : : public:
388 : : SFX_DECL_TOOLBOX_CONTROL();
389 : : SvxSimpleUndoRedoController( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
390 : : ~SvxSimpleUndoRedoController();
391 : :
392 : : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
393 : : const SfxPoolItem* pState );
394 : : };
395 : :
396 : : #endif // #ifndef _SVX_TBCONTRL_HXX
397 : :
398 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|