1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 _SVX_TBCONTRL_HXX
20 #define _SVX_TBCONTRL_HXX
22 /*--------------------------------------------------------------*\
26 ToolBox-Controller for:
27 Font-Name, Font-Height, Font-Color
28 Fore-/Background color /-patterns
30 (indentation-)templates
34 SvxFontNameToolBoxControl
35 -------------------------
36 Item type: SvxFontItem
37 Execute-Id: SID_ATTR_CHAR_FONT
39 Additional information
40 from DocShell: SvxFontListItem (SID_ATTR_CHAR_FONTLIST)
42 SvxFontColorToolBoxControl
43 --------------------------
44 Item type: SvxFontColorItem
45 Execute-Id: SID_ATTR_CHAR_COLOR
47 Additional information
48 from DocShell: presently none
49 in future: color palette
51 class SvxColorExtToolBoxControl
52 -----------------------------------
53 Item type: SvxColorItem
56 for font color (writer, ...)
57 Execute-Id SID_ATTR_CHAR_COLOR2
58 and SID_ATTR_CHAR_COLOR_EXT
61 Execute-Id SID_ATTR_CHAR_COLOR
63 for character background color (writer)
64 Execute-Id SID_ATTR_CHAR_COLOR_BACKGROUND
65 and SID_ATTR_CHAR_COLOR_BACKGROUND_EXT
67 for paragraph background color (writer)
68 Execute-Id SID_BACKGROUND_COLOR
70 for cell background color (calc)
71 Execute-Id SID_ATTR_CHAR_COLOR_BACKGROUND
73 for table/cell border color (writer, calc)
74 Execute-Id SID_FRAME_LINECOLOR
76 SvxColorToolBoxControl
77 --------------------------------
78 Item type: SvxBrushItem
79 Execute-Id: SID_BACKGROUND_COLOR
82 SvxPatternToolBoxControl
83 ------------------------
84 Item type: SvxBrushItem
85 Execute-Id: SID_BACKGROUND_PATTERN
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
95 GetFillColor() == COL_BLACK -> GetStyle() ,
96 GetFillColor() == COL_WHITE -> GetColor()
98 SvxFrameToolBoxControl
99 ----------------------
100 Item type: SvxBoxItem
101 Execute-Id: SID_ATTR_BORDER
102 -> SvxBoxItem & SvxBoxInfoItem
103 Additional information
105 Bemerkung: provides dependant 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.
112 SvxFrameLineStyleToolBoxControl
113 -------------------------------
114 Item type: SvxLineItem
115 Execute-Id: SID_FRAME_LINESTYLE
117 Additional information
119 Bemerkung: provides a SvxLineItem, which provides a SvxBorderLine
120 without color information.
122 SvxFrameLineColorToolBoxControl
123 -------------------------------
124 Item type: SvxColorItem
125 Execute-Id: SID_FRAME_LINECOLOR
127 Additional information
130 SvxStyleToolBoxControl
131 ----------------------
132 Item type: SfxTemplateItem
133 Execute-Id: SID_TEMPLATE_APPLY
134 -> StyleName (SfxStringItem)
135 -> eStyleFamily (SfxUInt16Item)
136 Additional information
138 Bemerkung: Switch family by Invalidate
139 at the Bindings (->SfxStyleControllerItem)
141 \*--------------------------------------------------------------*/
143 // ITEMID_...-Defines i *.cxx
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"
151 #include <com/sun/star/awt/FontDescriptor.hpp>
153 // important im tbxctrls.hxx created HeDaBu !!!
155 class SvxBoxInfoItem
;
157 class SfxStyleControllerItem_Impl
;
158 class SfxStyleSheetBasePool
;
159 class SfxTemplateItem
;
163 class ToolboxButtonColorUpdater
;
165 //########################################################################
167 //========================================================================
168 // class SvxStyleToolBoxControl ------------------------------------------
169 //========================================================================
170 class SVX_DLLPUBLIC SvxStyleToolBoxControl
: public SfxToolBoxControl
174 SFX_DECL_TOOLBOX_CONTROL();
176 SvxStyleToolBoxControl( sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rTbx
);
177 ~SvxStyleToolBoxControl();
179 virtual Window
* CreateItemWindow( Window
*pParent
);
181 virtual void StateChanged( sal_uInt16 nSID
, SfxItemState eState
,
182 const SfxPoolItem
* pState
);
184 DECL_LINK( VisibilityNotification
, void* );
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
);
190 virtual void SAL_CALL
update() throw (::com::sun::star::uno::RuntimeException
);
193 virtual void SAL_CALL
dispose() throw (::com::sun::star::uno::RuntimeException
);
197 #define MAX_FAMILIES 5
199 SfxStyleSheetBasePool
* pStyleSheetPool
;
200 SfxStyleControllerItem_Impl
* pBoundItems
[MAX_FAMILIES
];
201 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
> m_xBoundItems
[MAX_FAMILIES
];
202 SfxTemplateItem
* pFamilyState
[MAX_FAMILIES
];
203 sal_uInt16 nActFamily
; // Id in the ToolBox = Position - 1
207 SVX_DLLPRIVATE
void Update();
208 SVX_DLLPRIVATE
void FillStyleBox();
209 SVX_DLLPRIVATE
void SelectStyle( const String
& rStyleName
);
211 friend class SfxStyleControllerItem_Impl
;
213 SVX_DLLPRIVATE
void SetFamilyState ( sal_uInt16 nIdx
, const SfxTemplateItem
* pItem
);
214 SVX_DLLPRIVATE SfxStyleFamily
GetActFamily ();
217 //========================================================================
218 // class SvxFontNameToolBoxControl ---------------------------------------
219 //========================================================================
222 class SVX_DLLPUBLIC SvxFontNameToolBoxControl
: public SfxToolBoxControl
225 SFX_DECL_TOOLBOX_CONTROL();
226 SvxFontNameToolBoxControl( sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rTbx
);
228 virtual void StateChanged ( sal_uInt16 nSID
, SfxItemState eState
,
229 const SfxPoolItem
* pState
);
230 virtual Window
* CreateItemWindow ( Window
*pParent
);
235 //========================================================================
236 // class SvxFontColorToolBoxControl --------------------------------------
237 //========================================================================
241 class SVX_DLLPUBLIC SvxFontColorToolBoxControl
: public SfxToolBoxControl
243 ::svx::ToolboxButtonColorUpdater
* pBtnUpdater
;
247 SFX_DECL_TOOLBOX_CONTROL();
248 SvxFontColorToolBoxControl( sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rTbx
);
249 ~SvxFontColorToolBoxControl();
251 virtual void StateChanged( sal_uInt16 nSID
, SfxItemState eState
,
252 const SfxPoolItem
* pState
);
253 virtual SfxPopupWindowType
GetPopupWindowType() const;
254 virtual SfxPopupWindow
* CreatePopupWindow();
259 //========================================================================
260 // class SvxColorExtToolBoxControl --------------------------------------
261 //========================================================================
265 class SVX_DLLPUBLIC SvxColorExtToolBoxControl
: public SfxToolBoxControl
267 using SfxToolBoxControl::StateChanged
;
268 using SfxToolBoxControl::Select
;
270 // SfxStatusForwarder aForward;
271 ::svx::ToolboxButtonColorUpdater
* pBtnUpdater
;
273 sal_Bool bChoiceFromPalette
;
276 SFX_DECL_TOOLBOX_CONTROL();
277 SvxColorExtToolBoxControl( sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rTbx
);
278 ~SvxColorExtToolBoxControl();
280 virtual void StateChanged( sal_uInt16 nSID
, SfxItemState eState
,
281 const SfxPoolItem
* pState
);
282 virtual SfxPopupWindowType
GetPopupWindowType() const;
283 virtual SfxPopupWindow
* CreatePopupWindow();
284 virtual void Select( sal_Bool bMod1
= sal_False
);
289 //========================================================================
290 // class SvxColorToolBoxControl ------------------------------------------
291 //========================================================================
294 class SVX_DLLPUBLIC SvxColorToolBoxControl
: public SfxToolBoxControl
296 ::svx::ToolboxButtonColorUpdater
* pBtnUpdater
;
300 SvxColorToolBoxControl( sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rTbx
);
301 ~SvxColorToolBoxControl();
303 virtual void StateChanged( sal_uInt16 nSID
, SfxItemState eState
,
304 const SfxPoolItem
* pState
);
305 virtual SfxPopupWindowType
GetPopupWindowType() const;
306 virtual SfxPopupWindow
* CreatePopupWindow();
311 //========================================================================
312 // class SvxFrameToolBoxControl ------------------------------------------
313 //========================================================================
316 class SVX_DLLPUBLIC SvxFrameToolBoxControl
: public SfxToolBoxControl
319 SFX_DECL_TOOLBOX_CONTROL();
320 SvxFrameToolBoxControl( sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rTbx
);
322 virtual SfxPopupWindowType
GetPopupWindowType() const;
323 virtual SfxPopupWindow
* CreatePopupWindow();
324 virtual void StateChanged( sal_uInt16 nSID
, SfxItemState eState
,
325 const SfxPoolItem
* pState
);
331 //========================================================================
332 // class SvxLineStyleToolBoxControl --------------------------------------
333 //========================================================================
336 class SVX_DLLPUBLIC SvxFrameLineStyleToolBoxControl
: public SfxToolBoxControl
339 SFX_DECL_TOOLBOX_CONTROL();
340 SvxFrameLineStyleToolBoxControl( sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rTbx
);
342 virtual SfxPopupWindowType
GetPopupWindowType() const;
343 virtual SfxPopupWindow
* CreatePopupWindow();
344 virtual void StateChanged( sal_uInt16 nSID
, SfxItemState eState
,
345 const SfxPoolItem
* pState
);
350 //========================================================================
351 // class SvxFrameLineColorToolBoxControl ---------------------------------
352 //========================================================================
355 class SVX_DLLPUBLIC SvxFrameLineColorToolBoxControl
: public SfxToolBoxControl
357 ::svx::ToolboxButtonColorUpdater
* pBtnUpdater
;
361 SFX_DECL_TOOLBOX_CONTROL();
362 SvxFrameLineColorToolBoxControl( sal_uInt16 nSlotId
,
365 ~SvxFrameLineColorToolBoxControl();
367 virtual void StateChanged( sal_uInt16 nSID
, SfxItemState eState
,
368 const SfxPoolItem
* pState
);
369 virtual SfxPopupWindowType
GetPopupWindowType() const;
370 virtual SfxPopupWindow
* CreatePopupWindow();
373 class SVX_DLLPUBLIC SvxSimpleUndoRedoController
: public SfxToolBoxControl
376 OUString aDefaultText
;
379 SFX_DECL_TOOLBOX_CONTROL();
380 SvxSimpleUndoRedoController( sal_uInt16 nSlotId
, sal_uInt16 nId
, ToolBox
& rTbx
);
381 ~SvxSimpleUndoRedoController();
383 virtual void StateChanged( sal_uInt16 nSID
, SfxItemState eState
,
384 const SfxPoolItem
* pState
);
387 #endif // #ifndef _SVX_TBCONTRL_HXX
389 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */