2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 #ifndef SVX_SIDEBAR_PARA_PROPERTY_PANEL_HXX
19 #define SVX_SIDEBAR_PARA_PROPERTY_PANEL_HXX
21 #include <vcl/ctrl.hxx>
22 #include <sfx2/sidebar/ControllerItem.hxx>
23 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
24 #include <editeng/lspcitem.hxx>
25 #include <svtools/ctrlbox.hxx>
26 #include <svx/tbxcolorupdate.hxx>
27 #include <svx/relfld.hxx>
28 #include <editeng/svxenum.hxx>
29 #include <editeng/fhgtitem.hxx>
31 #include <com/sun/star/frame/XFrame.hpp>
32 #include <com/sun/star/ui/XSidebar.hpp>
34 #include <boost/scoped_ptr.hpp>
36 #include <svx/sidebar/ColorPopup.hxx>
37 #include <vcl/vclenum.hxx>
38 #include <vcl/fixed.hxx>
39 #include <svl/poolitem.hxx>
40 #include <tools/fldunit.hxx>
42 #include "ParaBulletsPopup.hxx"
43 #include "ParaNumberingPopup.hxx"
44 #include "ParaLineSpacingPopup.hxx"
49 namespace css
= ::com::sun::star
;
50 namespace cssu
= ::com::sun::star::uno
;
53 namespace svx
{ namespace sidebar
{
58 class ParaPropertyPanel
60 public ::sfx2::sidebar::IContextChangeReceiver
,
61 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
64 static ParaPropertyPanel
* Create (
66 const cssu::Reference
<css::frame::XFrame
>& rxFrame
,
67 SfxBindings
* pBindings
,
68 const cssu::Reference
<css::ui::XSidebar
>& rxSidebar
);
70 virtual void DataChanged (const DataChangedEvent
& rEvent
);
71 SfxBindings
* GetBindings();
73 virtual void HandleContextChange (
74 const ::sfx2::sidebar::EnumContext aContext
);
76 virtual void NotifyItemUpdate(
77 const sal_uInt16 nSId
,
78 const SfxItemState eState
,
79 const SfxPoolItem
* pState
,
80 const bool bIsEnabled
);
83 sal_uInt16
GetBulletTypeIndex(){ return mnBulletTypeIndex
; }
84 sal_uInt16
GetNumTypeIndex(){ return mnNumTypeIndex
; }
85 FieldUnit
GetCurrentUnit( SfxItemState eState
, const SfxPoolItem
* pState
);
87 void EndSpacingPopupMode (void);
88 void EndBulletsPopupMode (void);
89 void EndNumberingPopupMode (void);
92 /**********************************************************
96 ***********************************************************/
98 ::boost::scoped_ptr
<Window
> mpAlignToolBoxBackground
;
99 ::boost::scoped_ptr
<ToolBox
> mpAlignToolBox
;
100 ::boost::scoped_ptr
<Window
> mpTBxVertAlignBackground
;
101 ::boost::scoped_ptr
<ToolBox
> mpTBxVertAlign
;
102 //NumBullet&Backcolor
103 ::boost::scoped_ptr
<Window
> mpTBxNumBulletBackground
;
104 ::boost::scoped_ptr
<ToolBox
> mpTBxNumBullet
;
105 ::boost::scoped_ptr
<Window
> mpTBxBackColorBackground
;
106 ::boost::scoped_ptr
<ToolBox
> mpTBxBackColor
;
108 ::boost::scoped_ptr
<FixedText
> mpFTUL
;
109 ::boost::scoped_ptr
<Window
> mpTbxUL_IncDecBackground
;
110 ::boost::scoped_ptr
<ToolBox
> mpTbxUL_IncDec
;
111 ::boost::scoped_ptr
<SvxRelativeField
> mpTopDist
;
112 ::boost::scoped_ptr
<SvxRelativeField
> mpBottomDist
;
113 ::boost::scoped_ptr
<Window
> mpLineSPTbxBackground
;
114 ::boost::scoped_ptr
<ToolBox
> mpLineSPTbx
;
115 ::boost::scoped_ptr
<FixedText
> mpFTIndent
;
116 ::boost::scoped_ptr
<Window
> mpTbxIndent_IncDecBackground
;
117 ::boost::scoped_ptr
<ToolBox
> mpTbxIndent_IncDec
;
118 ::boost::scoped_ptr
<Window
> mpTbxProDemoteBackground
;
119 ::boost::scoped_ptr
<ToolBox
> mpTbxProDemote
;
120 ::boost::scoped_ptr
<SvxRelativeField
> mpLeftIndent
;
121 ::boost::scoped_ptr
<SvxRelativeField
> mpRightIndent
;
122 ::boost::scoped_ptr
<SvxRelativeField
> mpFLineIndent
;
124 ::boost::scoped_ptr
< ::svx::ToolboxButtonColorUpdater
> mpColorUpdater
;
126 /**********************************************************
130 ***********************************************************/
131 FixedImage maFISpace1
;
132 FixedImage maFISpace2
;
133 FixedImage maFIndent1
;
134 FixedImage maFIndent2
;
135 FixedImage maFIndent3
;
146 ImageList maNumBImageList
;
147 ImageList maNumBImageListRTL
;
148 Image maImgBackColorHigh
;
149 Image maImgBackColor
;
151 /****************************************************************
155 *****************************************************************/
158 SvxLineSpacingItem
*mpLnSPItem
;
159 SfxItemState meLnSpState
;
165 sal_uInt16 mnBulletTypeIndex
;
166 sal_uInt16 mnNumTypeIndex
;
168 bool mbColorAvailable
;
169 FieldUnit m_eMetricUnit
;
170 FieldUnit m_last_eMetricUnit
;
171 SfxMapUnit m_eLRSpaceUnit
;
172 SfxMapUnit m_eULSpaceUnit
;
173 /****************************************************************
177 *****************************************************************/
179 ::sfx2::sidebar::ControllerItem maLeftAlignControl
;
180 ::sfx2::sidebar::ControllerItem maCenterAlignControl
;
181 ::sfx2::sidebar::ControllerItem maRightAlignControl
;
182 ::sfx2::sidebar::ControllerItem maJustifyAlignControl
;
183 ::sfx2::sidebar::ControllerItem maLRSpaceControl
;
184 ::sfx2::sidebar::ControllerItem maLNSpaceControl
;
185 ::sfx2::sidebar::ControllerItem maULSpaceControl
;
186 ::sfx2::sidebar::ControllerItem maOutLineLeftControl
;
187 ::sfx2::sidebar::ControllerItem maOutLineRightControl
;
188 ::sfx2::sidebar::ControllerItem maDecIndentControl
;
189 ::sfx2::sidebar::ControllerItem maIncIndentControl
;
190 ::sfx2::sidebar::ControllerItem maVertTop
;
191 ::sfx2::sidebar::ControllerItem maVertCenter
;
192 ::sfx2::sidebar::ControllerItem maVertBottom
;
193 ::sfx2::sidebar::ControllerItem maBulletOnOff
;
194 ::sfx2::sidebar::ControllerItem maNumberOnOff
;
195 ::sfx2::sidebar::ControllerItem maBackColorControl
;
196 ::sfx2::sidebar::ControllerItem m_aMetricCtl
;
197 ::sfx2::sidebar::ControllerItem maBulletNumRuleIndex
;
198 ::sfx2::sidebar::ControllerItem maNumNumRuleIndex
;
200 cssu::Reference
<css::frame::XFrame
> mxFrame
;
201 ::sfx2::sidebar::EnumContext maContext
;
202 SfxBindings
* mpBindings
;
203 ParaLineSpacingPopup maLineSpacePopup
;
204 ParaBulletsPopup maBulletsPopup
;
205 ParaNumberingPopup maNumberingPopup
;
206 ColorPopup maBGColorPopup
;
207 cssu::Reference
<css::ui::XSidebar
> mxSidebar
;
212 const cssu::Reference
<css::frame::XFrame
>& rxFrame
,
213 SfxBindings
* pBindings
,
214 const cssu::Reference
<css::ui::XSidebar
>& rxSidebar
);
215 virtual ~ParaPropertyPanel (void);
217 void InitImageList(::boost::scoped_ptr
<ToolBox
>& rTbx
, ImageList
& rImglst
, ImageList
& rImgHlst
);
219 DECL_LINK(AlignStyleModifyHdl_Impl
, ToolBox
*);
220 DECL_LINK(VertTbxSelectHandler
, ToolBox
*);
221 DECL_LINK(NumBTbxSelectHandler
, ToolBox
*);
222 DECL_LINK(ModifyIndentHdl_Impl
, void*);
223 DECL_LINK(ClickIndent_IncDec_Hdl_Impl
, ToolBox
*);
224 DECL_LINK(ClickProDemote_Hdl_Impl
, ToolBox
*);
225 DECL_LINK(ULSpaceHdl_Impl
, void*);
226 DECL_LINK(ClickUL_IncDec_Hdl_Impl
, ToolBox
*);
227 DECL_LINK(ImplPopupModeEndHdl
, FloatingWindow
* );
229 void VertStateChanged(sal_uInt16 nSID
, SfxItemState eState
, const SfxPoolItem
* pState
);
230 void ParaBKGStateChanged(sal_uInt16 nSID
, SfxItemState eState
, const SfxPoolItem
* pState
);
231 void StateChangedAlignmentImpl( sal_uInt16 nSID
, SfxItemState eState
, const SfxPoolItem
* pState
);
232 void StateChangedIndentImpl( sal_uInt16 nSID
, SfxItemState eState
, const SfxPoolItem
* pState
);
233 void StateChangedLnSPImpl( sal_uInt16 nSID
, SfxItemState eState
, const SfxPoolItem
* pState
);
234 void StateChangedULImpl( sal_uInt16 nSID
, SfxItemState eState
, const SfxPoolItem
* pState
);
235 void StateChangeOutLineImpl( sal_uInt16 nSID
, SfxItemState eState
, const SfxPoolItem
* pState
);
236 void StateChangeIncDecImpl( sal_uInt16 nSID
, SfxItemState eState
, const SfxPoolItem
* pState
);
237 // Add toggle state for numbering and bullet icons
238 void StateChangeBulletNumImpl( sal_uInt16 nSID
, SfxItemState eState
, const SfxPoolItem
* pState
);
239 //Modified for Numbering&Bullets Dialog UX Enh
240 //Handing the transferred the num rule index data of the current selection
241 void StateChangeBulletNumRuleImpl( sal_uInt16 nSID
, SfxItemState eState
, const SfxPoolItem
* pState
);
244 void ReSize(bool bSize
);
247 PopupControl
* CreateLineSpacingControl (PopupContainer
* pParent
);
248 PopupControl
* CreateBulletsPopupControl (PopupContainer
* pParent
);
249 PopupControl
* CreateNumberingPopupControl (PopupContainer
* pParent
);
250 PopupControl
* CreateBGColorPopupControl (PopupContainer
* pParent
);
251 DECL_LINK(ClickLineSPDropDownHdl_Impl
, ToolBox
*);
252 DECL_LINK(NumBTbxDDHandler
, ToolBox
*);
253 DECL_LINK(ToolBoxBackColorDDHandler
, ToolBox
*);
255 void InitToolBoxAlign();
256 void InitToolBoxVertAlign();
257 void InitToolBoxIndent();
258 void InitToolBoxBGColor();
259 void InitToolBoxBulletsNumbering();
260 void InitToolBoxSpacing();
261 void InitToolBoxLineSpacing();
263 void SetBGColor (const String
& rsColorName
, const Color aColor
);
266 } } // end of namespace ::svx::sidebar