xref: /AOO41X/main/svx/inc/svx/tbcontrl.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _SVX_TBCONTRL_HXX
28 #define _SVX_TBCONTRL_HXX
29 
30 /*--------------------------------------------------------------*\
31 
32 	Beschreibung:
33 	-------------
34 	ToolBox-Controler fuer:
35 		Font-Name, Font-Hoehe, Font-Farbe
36 		Vorder-/Hintergrundfarbe /-Muster
37 		Rahmen, Linien
38 		(Absatz-)Vorlagen
39 
40 	Bedienung:
41 	----------
42 		SvxFontNameToolBoxControl
43 		-------------------------
44 		Item-Typ:		SvxFontItem
45 		Execute-Id:		SID_ATTR_CHAR_FONT
46 						-> SvxFontItem
47 		Zusatzdaten
48 		aus DocShell:	SvxFontListItem (SID_ATTR_CHAR_FONTLIST)
49 
50 		SvxFontHeightToolBoxControl
51 		---------------------------
52 		Item-Typ:		SvxFontHeightItem
53 		Execute-Id:		SID_ATTR_CHAR_FONTHEIGHT
54 						-> SvxFontHeightItem
55 		Zusatzdaten
56 		aus DocShell:	SvxFontListItem (SID_ATTR_CHAR_FONTLIST)
57 
58 		SvxFontColorToolBoxControl
59 		--------------------------
60 		Item-Typ:		SvxFontColorItem
61 		Execute-Id:		SID_ATTR_CHAR_COLOR
62 						-> SvxFontColorItem
63 		Zusatzdaten
64 		aus DocShell:	z.Zt. keine
65 						in Zukunft: Farbpalette
66 
67 		class SvxFontColorExtToolBoxControl
68 		-----------------------------------
69 		fuer die Zeichenfarbe
70 		Item-Typ		SvxColorItem
71 					und SfxBoolItem
72 		Execute-Id		SID_ATTR_CHAR_COLOR
73 					und SID_ATTR_CHAR_COLOR_EXT
74 
75 		fuer den Zeichenhintergrund
76 		Item-Typ		SvxColorItem
77 					und SfxBoolItem
78 		Execute-Id		SID_ATTR_CHAR_COLOR_BACKGROUND
79 					und SID_ATTR_CHAR_COLOR_BACKGROUND_EXT
80 
81 		SvxColorToolBoxControl
82 		--------------------------------
83 		Item-Typ:		SvxBrushItem
84 		Execute-Id:		SID_BACKGROUND_COLOR
85 						-> SvxColorItem
86 		Zusatzdaten
87 		aus DocShell:	z.Zt. keine
88 						in Zukunft: Farbpalette
89 
90 		SvxPatternToolBoxControl
91 		------------------------
92 		Item-Typ:		SvxBrushItem
93 		Execute-Id:		SID_BACKGROUND_PATTERN
94 						-> SvxBrushItem
95 		Zusatzdaten
96 		aus DocShell:	z.Zt. keine
97 						in Zukunft: Farbpalette
98 		Bemerkung:		Auswertung des BrushItems:
99 						Die Brush-FillColor() wird als Schalter
100 						missbraucht, um zu unterscheiden, ob ein
101 						neuer Style oder eine neue Farbe
102 						gesetzt wurde:
103 
104 						GetFillColor() == COL_BLACK -> GetStyle() auswerten,
105 						GetFillColor() == COL_WHITE -> GetColor() auswerten
106 
107 		SvxFrameToolBoxControl
108 		----------------------
109 		Item-Typ:		SvxBoxItem
110 		Execute-Id:		SID_ATTR_BORDER
111 						-> SvxBoxItem & SvxBoxInfoItem
112 		Zusatzdaten
113 		aus DocShell:	keine
114 		Bemerkung:		liefert je nach gewaehltem ValueSet-Item
115 						nur SvxBoxItem oder zusaetzlich SvxBoxInfoItem
116 						Wird dem Controller ein SfxUInt16Item mit einem
117 						Wert != 0 geschickt, so wird der Paragraph-Mode
118 						eingeschaltet, d.h. die letzte Zeile wird
119 						ausgeblendet. Ein Wert == 0 schaltet wieder in
120 						den Tabellenmodus.
121 
122 		SvxFrameLineStyleToolBoxControl
123 		-------------------------------
124 		Item-Typ:		SvxLineItem
125 		Execute-Id:		SID_FRAME_LINESTYLE
126 						-> SvxLineItem
127 		Zusatzdaten
128 		aus DocShell:	keine
129 		Bemerkung:		liefert ein SvxLineItem, welches eine SvxBorderLine
130 						ohne Farbinformation liefert.
131 
132 		SvxFrameLineColorToolBoxControl
133 		-------------------------------
134 		Item-Typ:		SvxColorItem
135 		Execute-Id:		SID_FRAME_LINECOLOR
136 						-> SvxColorItem
137 		Zusatzdaten
138 		aus DocShell:	keine
139 
140 		SvxStyleToolBoxControl
141 		----------------------
142 		Item-Typ:		SfxTemplateItem
143 		Execute-Id:		SID_TEMPLATE_APPLY
144 						-> StyleName (SfxStringItem)
145 						-> eStyleFamily (SfxUInt16Item)
146 		Zusatzdaten
147 		aus DocShell:	keine
148 		Bemerkung:		Umschalten der Familie ueber Invalidate
149 						an den Bindings (->SfxStyleControllerItem)
150 
151 \*--------------------------------------------------------------*/
152 
153 // include ---------------------------------------------------------------
154 
155 // ITEMID_...-Defines im *.cxx
156 
157 #include <rsc/rscsfx.hxx>
158 #include <svl/lstner.hxx>
159 #include <sfx2/tbxctrl.hxx>
160 #include <svx/strarray.hxx>
161 #include "svx/svxdllapi.h"
162 
163 #include <com/sun/star/awt/FontDescriptor.hpp>
164 
165 // wichtig im mit HeDaBu erzeugtem tbxctrls.hxx!!!
166 class SvxLineItem;
167 class SvxBoxInfoItem;
168 class SvxFontItem;
169 class SvxFontHeightItem;
170 class SfxStyleControllerItem_Impl;
171 class SfxStyleSheetBasePool;
172 class SfxTemplateItem;
173 
174 namespace svx
175 {
176     class ToolboxButtonColorUpdater;
177 }
178 //########################################################################
179 
180 //========================================================================
181 // class SvxStyleToolBoxControl ------------------------------------------
182 //========================================================================
183 class SVX_DLLPUBLIC SvxStyleToolBoxControl : public SfxToolBoxControl
184 {
185 	struct Impl;
186 public:
187 	SFX_DECL_TOOLBOX_CONTROL();
188 
189 	SvxStyleToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
190 	~SvxStyleToolBoxControl();
191 
192 	virtual Window*	CreateItemWindow( Window *pParent );
193 
194 	virtual void	StateChanged( sal_uInt16 nSID, SfxItemState eState,
195 								  const SfxPoolItem* pState );
196 
197     DECL_LINK( VisibilityNotification, void* );
198 protected:
199     // XInitialization
200     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);
201 
202     // XUpdatable
203     virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException);
204 
205     // XComponent
206     virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
207 
208 private:
209 
210 #define MAX_FAMILIES 5
211 
212 	SfxStyleSheetBasePool*              pStyleSheetPool;
213     SfxStyleControllerItem_Impl*        pBoundItems [MAX_FAMILIES];
214     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xBoundItems[MAX_FAMILIES];
215 	SfxTemplateItem*			        pFamilyState[MAX_FAMILIES];
216 	sal_uInt16					 	        nActFamily;	// Id in der ToolBox = Position - 1
217 	sal_uInt16						        nActFilter;	// FilterIdx
218 	sal_uInt16						        nAppFilter;	// Filter, den die App gesetzt hat
219 	String						        aCurSel;
220 	sal_Bool						        bListening;
221 	Impl*								pImpl;
222 
223 	SVX_DLLPRIVATE void	Update();
224 	SVX_DLLPRIVATE void	FillStyleBox();
225 	SVX_DLLPRIVATE void 	SelectStyle( const String& rStyleName );
226 
227 friend class SfxStyleControllerItem_Impl;
228 
229 	SVX_DLLPRIVATE void			SetFamilyState	( sal_uInt16 nIdx, const SfxTemplateItem* pItem );
230 	SVX_DLLPRIVATE SfxStyleFamily	GetActFamily	();
231 };
232 
233 //========================================================================
234 // class SvxFontNameToolBoxControl ---------------------------------------
235 //========================================================================
236 
237 
238 class SVX_DLLPUBLIC SvxFontNameToolBoxControl : public SfxToolBoxControl
239 {
240 public:
241 	SFX_DECL_TOOLBOX_CONTROL();
242 	SvxFontNameToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
243 
244 	virtual void	StateChanged		( sal_uInt16 nSID, SfxItemState eState,
245 										  const SfxPoolItem* pState );
246 	virtual Window*	CreateItemWindow	( Window *pParent );
247 };
248 
249 
250 
251 //========================================================================
252 // class SvxFontHeightToolBoxControl -------------------------------------
253 //========================================================================
254 
255 /*
256 class SvxFontSizeItem;
257 class SvxFontItem;
258 class SvxFontSizeBox_Impl;
259 
260 class SVX_DLLPUBLIC SvxFontHeightToolBoxControl : public SfxToolBoxControl
261 {
262     SvxFontSizeBox_Impl* pBox;                          // ItemWindow f"ur quick-access
263 	::com::sun::star::awt::FontDescriptor aCurrentFont;	// Kopie des aktuellen Fonts
264 
265 public:
266 	SFX_DECL_TOOLBOX_CONTROL();
267 	SvxFontHeightToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
268 	~SvxFontHeightToolBoxControl();
269 
270     // new controller API
271     // XStatusListener
272 	virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event )
273         throw ( ::com::sun::star::uno::RuntimeException );
274 
275 	virtual Window*		CreateItemWindow( Window *pParent );
276 };
277 */
278 
279 
280 //========================================================================
281 // class SvxFontColorToolBoxControl --------------------------------------
282 //========================================================================
283 
284 
285 
286 class SVX_DLLPUBLIC SvxFontColorToolBoxControl : public SfxToolBoxControl
287 {
288     ::svx::ToolboxButtonColorUpdater*   pBtnUpdater;
289 
290 public:
291 	SFX_DECL_TOOLBOX_CONTROL();
292 	SvxFontColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
293 	~SvxFontColorToolBoxControl();
294 
295 	virtual void				StateChanged( sal_uInt16 nSID, SfxItemState eState,
296 											  const SfxPoolItem* pState );
297 	virtual SfxPopupWindowType	GetPopupWindowType() const;
298 	virtual SfxPopupWindow*		CreatePopupWindow();
299 };
300 
301 
302 
303 //========================================================================
304 // class SvxFontColorExtToolBoxControl --------------------------------------
305 //========================================================================
306 
307 
308 
309 class SVX_DLLPUBLIC SvxFontColorExtToolBoxControl : public SfxToolBoxControl
310 {
311 	using SfxToolBoxControl::StateChanged;
312 	using SfxToolBoxControl::Select;
313 
314 	//	SfxStatusForwarder 			aForward;
315     ::svx::ToolboxButtonColorUpdater*   pBtnUpdater;
316 
317 public:
318 	SFX_DECL_TOOLBOX_CONTROL();
319 	SvxFontColorExtToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
320 	~SvxFontColorExtToolBoxControl();
321 
322 	virtual void				StateChanged( sal_uInt16 nSID, SfxItemState eState,
323 											  const SfxPoolItem* pState );
324 	virtual SfxPopupWindowType	GetPopupWindowType() const;
325 	virtual SfxPopupWindow*		CreatePopupWindow();
326 	virtual void				Select( sal_Bool bMod1 = sal_False );
327 
328 };
329 
330 
331 
332 //========================================================================
333 // class SvxColorToolBoxControl ------------------------------------------
334 //========================================================================
335 
336 
337 class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl
338 {
339     ::svx::ToolboxButtonColorUpdater*   pBtnUpdater;
340 public:
341 	SFX_DECL_TOOLBOX_CONTROL();
342 	SvxColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
343 	~SvxColorToolBoxControl();
344 
345 	virtual void				StateChanged( sal_uInt16 nSID, SfxItemState eState,
346 											  const SfxPoolItem* pState );
347 	virtual SfxPopupWindowType	GetPopupWindowType() const;
348 	virtual SfxPopupWindow*		CreatePopupWindow();
349 };
350 
351 
352 
353 //========================================================================
354 // class SvxFrameToolBoxControl ------------------------------------------
355 //========================================================================
356 
357 
358 class SVX_DLLPUBLIC SvxFrameToolBoxControl : public SfxToolBoxControl
359 {
360 public:
361 	SFX_DECL_TOOLBOX_CONTROL();
362 	SvxFrameToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
363 
364 	virtual SfxPopupWindowType	GetPopupWindowType() const;
365 	virtual SfxPopupWindow*		CreatePopupWindow();
366 	virtual void				StateChanged( sal_uInt16 nSID, SfxItemState eState,
367 											  const SfxPoolItem* pState );
368 
369 };
370 
371 
372 
373 //========================================================================
374 // class SvxLineStyleToolBoxControl --------------------------------------
375 //========================================================================
376 
377 
378 class SVX_DLLPUBLIC SvxFrameLineStyleToolBoxControl : public SfxToolBoxControl
379 {
380 public:
381 	SFX_DECL_TOOLBOX_CONTROL();
382 	SvxFrameLineStyleToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
383 
384 	virtual SfxPopupWindowType	GetPopupWindowType() const;
385 	virtual SfxPopupWindow*		CreatePopupWindow();
386 	virtual void				StateChanged( sal_uInt16 nSID, SfxItemState eState,
387 											  const SfxPoolItem* pState );
388 };
389 
390 
391 
392 //========================================================================
393 // class SvxFrameLineColorToolBoxControl ---------------------------------
394 //========================================================================
395 
396 
397 class SVX_DLLPUBLIC SvxFrameLineColorToolBoxControl : public SfxToolBoxControl
398 {
399     ::svx::ToolboxButtonColorUpdater*   pBtnUpdater;
400 public:
401 	SFX_DECL_TOOLBOX_CONTROL();
402 	SvxFrameLineColorToolBoxControl( sal_uInt16 nSlotId,
403                                      sal_uInt16 nId,
404 									 ToolBox& rTbx );
405 	~SvxFrameLineColorToolBoxControl();
406 
407 	virtual void				StateChanged( sal_uInt16 nSID, SfxItemState eState,
408 											  const SfxPoolItem* pState );
409 	virtual SfxPopupWindowType	GetPopupWindowType() const;
410 	virtual SfxPopupWindow*		CreatePopupWindow();
411 };
412 
413 
414 
415 class SvxReloadControllerItem_Impl;
416 class SvxReloadControllerItem : public SfxToolBoxControl
417 {
418 private:
419 	SvxReloadControllerItem_Impl* pImpl;
420 
421 public:
422 	SFX_DECL_TOOLBOX_CONTROL();
423 	SvxReloadControllerItem( sal_uInt16 nSlotId,
424                              sal_uInt16 nId,
425 						     ToolBox& rTbx );
426 	~SvxReloadControllerItem();
427 
428 protected:
429 	virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
430 							   const SfxPoolItem* pState );
431 };
432 
433 class SVX_DLLPUBLIC SvxSimpleUndoRedoController : public SfxToolBoxControl
434 {
435 private:
436     ::rtl::OUString             aDefaultText;
437 
438 public:
439     SFX_DECL_TOOLBOX_CONTROL();
440     SvxSimpleUndoRedoController( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
441     ~SvxSimpleUndoRedoController();
442 
443     virtual void                StateChanged( sal_uInt16 nSID, SfxItemState eState,
444 											  const SfxPoolItem* pState );
445 };
446 
447 #endif // #ifndef _SVX_TBCONTRL_HXX
448