xref: /AOO41X/main/svx/inc/svx/tbcontrl.hxx (revision 3334a7e6acdae9820fa1a6f556bb10129a8de6b2)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SVX_TBCONTRL_HXX
24 #define _SVX_TBCONTRL_HXX
25 
26 /*--------------------------------------------------------------*\
27 
28     Beschreibung:
29     -------------
30     ToolBox-Controler fuer:
31         Font-Name, Font-Hoehe, Font-Farbe
32         Vorder-/Hintergrundfarbe /-Muster
33         Rahmen, Linien
34         (Absatz-)Vorlagen
35 
36     Bedienung:
37     ----------
38         SvxFontNameToolBoxControl
39         -------------------------
40         Item-Typ:       SvxFontItem
41         Execute-Id:     SID_ATTR_CHAR_FONT
42                         -> SvxFontItem
43         Zusatzdaten
44         aus DocShell:   SvxFontListItem (SID_ATTR_CHAR_FONTLIST)
45 
46         SvxFontHeightToolBoxControl
47         ---------------------------
48         Item-Typ:       SvxFontHeightItem
49         Execute-Id:     SID_ATTR_CHAR_FONTHEIGHT
50                         -> SvxFontHeightItem
51         Zusatzdaten
52         aus DocShell:   SvxFontListItem (SID_ATTR_CHAR_FONTLIST)
53 
54         SvxFontColorToolBoxControl
55         --------------------------
56         Item-Typ:       SvxFontColorItem
57         Execute-Id:     SID_ATTR_CHAR_COLOR
58                         -> SvxFontColorItem
59         Zusatzdaten
60         aus DocShell:   z.Zt. keine
61                         in Zukunft: Farbpalette
62 
63         class SvxFontColorExtToolBoxControl
64         -----------------------------------
65         fuer die Zeichenfarbe
66         Item-Typ        SvxColorItem
67                     und SfxBoolItem
68         Execute-Id      SID_ATTR_CHAR_COLOR
69                     und SID_ATTR_CHAR_COLOR_EXT
70 
71         fuer den Zeichenhintergrund
72         Item-Typ        SvxColorItem
73                     und SfxBoolItem
74         Execute-Id      SID_ATTR_CHAR_COLOR_BACKGROUND
75                     und SID_ATTR_CHAR_COLOR_BACKGROUND_EXT
76 
77         SvxColorToolBoxControl
78         --------------------------------
79         Item-Typ:       SvxBrushItem
80         Execute-Id:     SID_BACKGROUND_COLOR
81                         -> SvxColorItem
82         Zusatzdaten
83         aus DocShell:   z.Zt. keine
84                         in Zukunft: Farbpalette
85 
86         SvxPatternToolBoxControl
87         ------------------------
88         Item-Typ:       SvxBrushItem
89         Execute-Id:     SID_BACKGROUND_PATTERN
90                         -> SvxBrushItem
91         Zusatzdaten
92         aus DocShell:   z.Zt. keine
93                         in Zukunft: Farbpalette
94         Bemerkung:      Auswertung des BrushItems:
95                         Die Brush-FillColor() wird als Schalter
96                         missbraucht, um zu unterscheiden, ob ein
97                         neuer Style oder eine neue Farbe
98                         gesetzt wurde:
99 
100                         GetFillColor() == COL_BLACK -> GetStyle() auswerten,
101                         GetFillColor() == COL_WHITE -> GetColor() auswerten
102 
103         SvxFrameToolBoxControl
104         ----------------------
105         Item-Typ:       SvxBoxItem
106         Execute-Id:     SID_ATTR_BORDER
107                         -> SvxBoxItem & SvxBoxInfoItem
108         Zusatzdaten
109         aus DocShell:   keine
110         Bemerkung:      liefert je nach gewaehltem ValueSet-Item
111                         nur SvxBoxItem oder zusaetzlich SvxBoxInfoItem
112                         Wird dem Controller ein SfxUInt16Item mit einem
113                         Wert != 0 geschickt, so wird der Paragraph-Mode
114                         eingeschaltet, d.h. die letzte Zeile wird
115                         ausgeblendet. Ein Wert == 0 schaltet wieder in
116                         den Tabellenmodus.
117 
118         SvxFrameLineStyleToolBoxControl
119         -------------------------------
120         Item-Typ:       SvxLineItem
121         Execute-Id:     SID_FRAME_LINESTYLE
122                         -> SvxLineItem
123         Zusatzdaten
124         aus DocShell:   keine
125         Bemerkung:      liefert ein SvxLineItem, welches eine SvxBorderLine
126                         ohne Farbinformation liefert.
127 
128         SvxFrameLineColorToolBoxControl
129         -------------------------------
130         Item-Typ:       SvxColorItem
131         Execute-Id:     SID_FRAME_LINECOLOR
132                         -> SvxColorItem
133         Zusatzdaten
134         aus DocShell:   keine
135 
136         SvxStyleToolBoxControl
137         ----------------------
138         Item-Typ:       SfxTemplateItem
139         Execute-Id:     SID_TEMPLATE_APPLY
140                         -> StyleName (SfxStringItem)
141                         -> eStyleFamily (SfxUInt16Item)
142         Zusatzdaten
143         aus DocShell:   keine
144         Bemerkung:      Umschalten der Familie ueber Invalidate
145                         an den Bindings (->SfxStyleControllerItem)
146 
147 \*--------------------------------------------------------------*/
148 
149 // include ---------------------------------------------------------------
150 
151 // ITEMID_...-Defines im *.cxx
152 
153 #include <rsc/rscsfx.hxx>
154 #include <svl/lstner.hxx>
155 #include <sfx2/tbxctrl.hxx>
156 #include <svx/strarray.hxx>
157 #include "svx/svxdllapi.h"
158 
159 #include <com/sun/star/awt/FontDescriptor.hpp>
160 
161 // wichtig im mit HeDaBu erzeugtem tbxctrls.hxx!!!
162 class SvxLineItem;
163 class SvxBoxInfoItem;
164 class SvxFontItem;
165 class SvxFontHeightItem;
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 der ToolBox = Position - 1
213     sal_uInt16                              nActFilter; // FilterIdx
214     sal_uInt16                              nAppFilter; // Filter, den die App gesetzt hat
215     String                              aCurSel;
216     sal_Bool                                bListening;
217     Impl*                               pImpl;
218 
219     SVX_DLLPRIVATE void Update();
220     SVX_DLLPRIVATE void FillStyleBox();
221     SVX_DLLPRIVATE void     SelectStyle( const String& rStyleName );
222 
223 friend class SfxStyleControllerItem_Impl;
224 
225     SVX_DLLPRIVATE void         SetFamilyState  ( sal_uInt16 nIdx, const SfxTemplateItem* pItem );
226     SVX_DLLPRIVATE SfxStyleFamily   GetActFamily    ();
227 };
228 
229 //========================================================================
230 // class SvxFontNameToolBoxControl ---------------------------------------
231 //========================================================================
232 
233 
234 class SVX_DLLPUBLIC SvxFontNameToolBoxControl : public SfxToolBoxControl
235 {
236 public:
237     SFX_DECL_TOOLBOX_CONTROL();
238     SvxFontNameToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
239 
240     virtual void    StateChanged        ( sal_uInt16 nSID, SfxItemState eState,
241                                           const SfxPoolItem* pState );
242     virtual Window* CreateItemWindow    ( Window *pParent );
243 };
244 
245 
246 
247 //========================================================================
248 // class SvxFontHeightToolBoxControl -------------------------------------
249 //========================================================================
250 
251 /*
252 class SvxFontSizeItem;
253 class SvxFontItem;
254 class SvxFontSizeBox_Impl;
255 
256 class SVX_DLLPUBLIC SvxFontHeightToolBoxControl : public SfxToolBoxControl
257 {
258     SvxFontSizeBox_Impl* pBox;                          // ItemWindow f"ur quick-access
259     ::com::sun::star::awt::FontDescriptor aCurrentFont; // Kopie des aktuellen Fonts
260 
261 public:
262     SFX_DECL_TOOLBOX_CONTROL();
263     SvxFontHeightToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
264     ~SvxFontHeightToolBoxControl();
265 
266     // new controller API
267     // XStatusListener
268     virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event )
269         throw ( ::com::sun::star::uno::RuntimeException );
270 
271     virtual Window*     CreateItemWindow( Window *pParent );
272 };
273 */
274 
275 
276 //========================================================================
277 // class SvxFontColorToolBoxControl --------------------------------------
278 //========================================================================
279 
280 
281 
282 class SVX_DLLPUBLIC SvxFontColorToolBoxControl : public SfxToolBoxControl
283 {
284     ::svx::ToolboxButtonColorUpdater*   pBtnUpdater;
285 
286 public:
287     SFX_DECL_TOOLBOX_CONTROL();
288     SvxFontColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
289     ~SvxFontColorToolBoxControl();
290 
291     virtual void                StateChanged( sal_uInt16 nSID, SfxItemState eState,
292                                               const SfxPoolItem* pState );
293     virtual SfxPopupWindowType  GetPopupWindowType() const;
294     virtual SfxPopupWindow*     CreatePopupWindow();
295 };
296 
297 
298 
299 //========================================================================
300 // class SvxFontColorExtToolBoxControl --------------------------------------
301 //========================================================================
302 
303 
304 
305 class SVX_DLLPUBLIC SvxFontColorExtToolBoxControl : public SfxToolBoxControl
306 {
307     using SfxToolBoxControl::StateChanged;
308     using SfxToolBoxControl::Select;
309 
310     //  SfxStatusForwarder          aForward;
311     ::svx::ToolboxButtonColorUpdater*   pBtnUpdater;
312 
313 public:
314     SFX_DECL_TOOLBOX_CONTROL();
315     SvxFontColorExtToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
316     ~SvxFontColorExtToolBoxControl();
317 
318     virtual void                StateChanged( sal_uInt16 nSID, SfxItemState eState,
319                                               const SfxPoolItem* pState );
320     virtual SfxPopupWindowType  GetPopupWindowType() const;
321     virtual SfxPopupWindow*     CreatePopupWindow();
322     virtual void                Select( sal_Bool bMod1 = sal_False );
323 
324 };
325 
326 
327 
328 //========================================================================
329 // class SvxColorToolBoxControl ------------------------------------------
330 //========================================================================
331 
332 
333 class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl
334 {
335     ::svx::ToolboxButtonColorUpdater*   pBtnUpdater;
336 public:
337     SFX_DECL_TOOLBOX_CONTROL();
338     SvxColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
339     ~SvxColorToolBoxControl();
340 
341     virtual void                StateChanged( sal_uInt16 nSID, SfxItemState eState,
342                                               const SfxPoolItem* pState );
343     virtual SfxPopupWindowType  GetPopupWindowType() const;
344     virtual SfxPopupWindow*     CreatePopupWindow();
345 };
346 
347 
348 
349 //========================================================================
350 // class SvxFrameToolBoxControl ------------------------------------------
351 //========================================================================
352 
353 
354 class SVX_DLLPUBLIC SvxFrameToolBoxControl : public SfxToolBoxControl
355 {
356 public:
357     SFX_DECL_TOOLBOX_CONTROL();
358     SvxFrameToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
359 
360     virtual SfxPopupWindowType  GetPopupWindowType() const;
361     virtual SfxPopupWindow*     CreatePopupWindow();
362     virtual void                StateChanged( sal_uInt16 nSID, SfxItemState eState,
363                                               const SfxPoolItem* pState );
364 
365 };
366 
367 
368 
369 //========================================================================
370 // class SvxLineStyleToolBoxControl --------------------------------------
371 //========================================================================
372 
373 
374 class SVX_DLLPUBLIC SvxFrameLineStyleToolBoxControl : public SfxToolBoxControl
375 {
376 public:
377     SFX_DECL_TOOLBOX_CONTROL();
378     SvxFrameLineStyleToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
379 
380     virtual SfxPopupWindowType  GetPopupWindowType() const;
381     virtual SfxPopupWindow*     CreatePopupWindow();
382     virtual void                StateChanged( sal_uInt16 nSID, SfxItemState eState,
383                                               const SfxPoolItem* pState );
384 };
385 
386 
387 
388 //========================================================================
389 // class SvxFrameLineColorToolBoxControl ---------------------------------
390 //========================================================================
391 
392 
393 class SVX_DLLPUBLIC SvxFrameLineColorToolBoxControl : public SfxToolBoxControl
394 {
395     ::svx::ToolboxButtonColorUpdater*   pBtnUpdater;
396 public:
397     SFX_DECL_TOOLBOX_CONTROL();
398     SvxFrameLineColorToolBoxControl( sal_uInt16 nSlotId,
399                                      sal_uInt16 nId,
400                                      ToolBox& rTbx );
401     ~SvxFrameLineColorToolBoxControl();
402 
403     virtual void                StateChanged( sal_uInt16 nSID, SfxItemState eState,
404                                               const SfxPoolItem* pState );
405     virtual SfxPopupWindowType  GetPopupWindowType() const;
406     virtual SfxPopupWindow*     CreatePopupWindow();
407 };
408 
409 
410 
411 class SvxReloadControllerItem_Impl;
412 class SvxReloadControllerItem : public SfxToolBoxControl
413 {
414 private:
415     SvxReloadControllerItem_Impl* pImpl;
416 
417 public:
418     SFX_DECL_TOOLBOX_CONTROL();
419     SvxReloadControllerItem( sal_uInt16 nSlotId,
420                              sal_uInt16 nId,
421                              ToolBox& rTbx );
422     ~SvxReloadControllerItem();
423 
424 protected:
425     virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
426                                const SfxPoolItem* pState );
427 };
428 
429 class SVX_DLLPUBLIC SvxSimpleUndoRedoController : public SfxToolBoxControl
430 {
431 private:
432     ::rtl::OUString             aDefaultText;
433 
434 public:
435     SFX_DECL_TOOLBOX_CONTROL();
436     SvxSimpleUndoRedoController( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
437     ~SvxSimpleUndoRedoController();
438 
439     virtual void                StateChanged( sal_uInt16 nSID, SfxItemState eState,
440                                               const SfxPoolItem* pState );
441 };
442 
443 #endif // #ifndef _SVX_TBCONTRL_HXX
444