xref: /trunk/main/svx/source/sidebar/paragraph/ParaPropertyPanel.hxx (revision 4e8031e0a9bc16df402a00dc593d120d34289fa7)
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 #ifndef SVX_SIDEBAR_PARA_PROPERTY_PAGE_HXX
23 #define SVX_SIDEBAR_PARA_PROPERTY_PAGE_HXX
24 
25 #include <vcl/ctrl.hxx>
26 #include <sfx2/sidebar/SidebarPanelBase.hxx>
27 #include <sfx2/sidebar/ControllerItem.hxx>
28 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
29 #include <editeng/lspcitem.hxx>
30 #include <svtools/ctrlbox.hxx>
31 #include <svx/tbxcolorupdate.hxx>
32 #include <svx/relfld.hxx>
33 #include <editeng/svxenum.hxx>
34 #include <editeng/fhgtitem.hxx>
35 
36 #include <com/sun/star/ui/XUIElement.hpp>
37 
38 #include <boost/scoped_ptr.hpp>
39 
40 #include <svx/sidebar/ColorPopup.hxx>
41 #include <vcl/vclenum.hxx>
42 #include <vcl/fixed.hxx>
43 #include <svl/poolitem.hxx>
44 #include <tools/fldunit.hxx>
45 
46 #include "ParaBulletsPopup.hxx"
47 #include "ParanumberingPopup.hxx"
48 #include "ParaLineSpacingPopup.hxx"
49 
50 class FloatingWindow;
51 class ToolBox;
52 
53 namespace svx { namespace sidebar {
54 
55 class PopupControl;
56 class PopupContainer;
57 
58 class ParaPropertyPanel
59     : public Control,
60       public ::sfx2::sidebar::IContextChangeReceiver,
61       public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
62 {
63 public:
64     static ParaPropertyPanel* Create (
65         Window* pParent,
66         const cssu::Reference<css::frame::XFrame>& rxFrame,
67         SfxBindings* pBindings);
68 
69     virtual void DataChanged (const DataChangedEvent& rEvent);
70     SfxBindings* GetBindings();
71 
72     virtual void HandleContextChange (
73         const ::sfx2::sidebar::EnumContext aContext);
74 
75     virtual void NotifyItemUpdate(
76         const sal_uInt16 nSId,
77         const SfxItemState eState,
78         const SfxPoolItem* pState);
79 
80     void ShowMenu (void);
81     sal_uInt16 GetBulletTypeIndex(){ return nBulletTypeIndex; }
82     void SetBulletTypeIndex(sal_uInt16 nInd){ nBulletTypeIndex = nInd; }
83     sal_uInt16 GetNumTypeIndex(){ return nNumTypeIndex; }
84     void SetNumTypeIndex(sal_uInt16 nInd){ nNumTypeIndex = nInd; }
85     //End
86     FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState );
87 
88     void EndSpacingPopupMode (void);
89     void EndBulletsPopupMode (void);
90     void EndNumberingPopupMode (void);
91 
92 private:
93     /**********************************************************
94      **
95      ** UI controls
96      **
97     ***********************************************************/
98     //Alignment
99     ::boost::scoped_ptr<Window>             maAlignToolBoxBackground;
100     ::boost::scoped_ptr<ToolBox>            maAlignToolBox;
101     ::boost::scoped_ptr<Window>             maTBxVertAlignBackground;
102     ::boost::scoped_ptr<ToolBox>            maTBxVertAlign;
103     //NumBullet&Backcolor
104     ::boost::scoped_ptr<Window>             maTBxNumBulletBackground;
105     ::boost::scoped_ptr<ToolBox>            maTBxNumBullet;
106     ::boost::scoped_ptr<Window>             maTBxBackColorBackground;
107     ::boost::scoped_ptr<ToolBox>            maTBxBackColor;
108     //Paragraph spacing
109     ::boost::scoped_ptr<FixedText>          maFTUL;
110     ::boost::scoped_ptr<Window>             maTbxUL_IncDecBackground;
111     ::boost::scoped_ptr<ToolBox>            maTbxUL_IncDec;
112     ::boost::scoped_ptr<SvxRelativeField>   maTopDist;
113     ::boost::scoped_ptr<SvxRelativeField>   maBottomDist;
114     //Line spacing
115     ::boost::scoped_ptr<Window>             maLineSPTbxBackground;
116     ::boost::scoped_ptr<ToolBox>            maLineSPTbx;
117     //Indent
118     ::boost::scoped_ptr<FixedText>          maFTIndent;
119     ::boost::scoped_ptr<Window>             maTbxIndent_IncDecBackground;
120     ::boost::scoped_ptr<ToolBox>            maTbxIndent_IncDec;
121     ::boost::scoped_ptr<Window>             maTbxProDemoteBackground;
122     ::boost::scoped_ptr<ToolBox>            maTbxProDemote;
123     ::boost::scoped_ptr<SvxRelativeField>   maLeftIndent;
124     ::boost::scoped_ptr<SvxRelativeField>   maRightIndent;
125     ::boost::scoped_ptr<SvxRelativeField>   maFLineIndent;
126     ::boost::scoped_ptr<::svx::ToolboxButtonColorUpdater>   mpColorUpdater;
127 
128     /**********************************************************
129      **
130      ** Resources
131      **
132     ***********************************************************/
133     FixedImage  maFISpace1;
134     FixedImage  maFISpace2;
135     FixedImage  maFIndent1;
136     FixedImage  maFIndent2;
137     FixedImage  maFIndent3;
138 
139     Image  maSpace1;
140     Image  maSpace2;
141     Image  maSpace3;
142     Image  maIndent1;
143     Image  maIndent2;
144     Image  maIndent3;
145 
146     Image  maLeftPara;
147     Image  maCentPara;
148     Image  maRightPara;
149     Image  maJusPara;
150 
151     Image  maIndInc;
152     Image  maIndDec;
153     Image  maIndInc_BD;
154     Image  maIndDec_BD;
155     Image  maIndHang;
156     Image  maParInc;
157     Image  maParDec;
158 
159     ImageList   maVertImageList;
160     ImageList   maVertImageListH;
161     ImageList   maNumBImageList;
162     ImageList   maNumBImageListH;
163     ImageList   maNumBImageListRTL; //sym2_7380
164     Image       maImgBackColorHigh;
165     Image       maImgBackColor;
166 
167     /****************************************************************
168     **
169     ** Data Member
170     **
171     *****************************************************************/
172     long                maTxtLeft;
173     //Line spacing
174     SvxLineSpacingItem  *mpLnSPItem;
175     SfxItemState            meLnSpState;
176     bool                    mbOutLineLeft;
177     bool                    mbOutLineRight;
178     long                    maUpper;
179     long                    maLower;
180 
181     sal_uInt16          nBulletTypeIndex;
182     sal_uInt16          nNumTypeIndex;
183     Color               maColor;
184     bool                    mbColorAvailable;
185     FieldUnit                       m_eMetricUnit;
186     FieldUnit                       m_last_eMetricUnit;
187     SfxMapUnit                      m_eLRSpaceUnit;
188     SfxMapUnit                      m_eULSpaceUnit;
189     /****************************************************************
190     **
191     ** Controll Itemb
192     **
193     *****************************************************************/
194 
195     ::sfx2::sidebar::ControllerItem  maLeftAlignControl;
196     ::sfx2::sidebar::ControllerItem  maCenterAlignControl;
197     ::sfx2::sidebar::ControllerItem  maRightAlignControl;
198     ::sfx2::sidebar::ControllerItem  maJustifyAlignControl;
199     ::sfx2::sidebar::ControllerItem  maLRSpaceControl;
200     //::sfx2::sidebar::ControllerItem  maLRSpaceControl2;
201     ::sfx2::sidebar::ControllerItem  maLNSpaceControl;
202     ::sfx2::sidebar::ControllerItem  maULSpaceControl;
203     //::sfx2::sidebar::ControllerItem  maULSpaceControl2;
204     ::sfx2::sidebar::ControllerItem  maOutLineLeftControl;
205     ::sfx2::sidebar::ControllerItem  maOutLineRightControl;
206     ::sfx2::sidebar::ControllerItem  maDecIndentControl;
207     ::sfx2::sidebar::ControllerItem  maIncIndentControl;
208     ::sfx2::sidebar::ControllerItem  maVertTop;
209     ::sfx2::sidebar::ControllerItem  maVertCenter;
210     ::sfx2::sidebar::ControllerItem  maVertBottom;
211     ::sfx2::sidebar::ControllerItem  maBulletOnOff;
212     ::sfx2::sidebar::ControllerItem  maNumberOnOff;
213     ::sfx2::sidebar::ControllerItem  maBackColorControl;
214     ::sfx2::sidebar::ControllerItem  m_aMetricCtl;
215     ::sfx2::sidebar::ControllerItem  maBulletNumRuleIndex;
216     ::sfx2::sidebar::ControllerItem  maNumNumRuleIndex;
217 
218     cssu::Reference<css::frame::XFrame> mxFrame;
219     ::sfx2::sidebar::EnumContext maContext;
220     SfxBindings* mpBindings;
221 
222 
223     ParaLineSpacingPopup maLineSpacePopup;
224     ParaBulletsPopup maBulletsPopup;
225     ParaNumberingPopup maNumberingPopup;
226     ColorPopup maBGColorPopup;
227 
228     ParaPropertyPanel (
229         Window* pParent,
230         const cssu::Reference<css::frame::XFrame>& rxFrame,
231         SfxBindings* pBindings);
232     virtual ~ParaPropertyPanel (void);
233 
234     void InitImageList(::boost::scoped_ptr<ToolBox>& rTbx, ImageList& rImglst, ImageList& rImgHlst);
235 
236     DECL_LINK(AlignStyleModifyHdl_Impl, ToolBox*);
237     DECL_LINK(VertTbxSelectHandler, ToolBox*);
238     DECL_LINK(NumBTbxSelectHandler, ToolBox*);
239     DECL_LINK(ModifyIndentHdl_Impl, SvxRelativeField*);
240     DECL_LINK(ClickIndent_IncDec_Hdl_Impl, ToolBox*);
241     DECL_LINK(ClickProDemote_Hdl_Impl, ToolBox*);
242     DECL_LINK(ULSpaceHdl_Impl, SvxRelativeField*);
243     DECL_LINK(ClickUL_IncDec_Hdl_Impl, ToolBox*);
244     DECL_LINK(ImplPopupModeEndHdl, FloatingWindow* );
245 
246     void VertStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
247     void ParaBKGStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState);
248     void StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
249     void StateChangedIndentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
250     void StateChangedLnSPImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
251     void StateChangedULImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
252     void StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
253     void StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
254     //Sym3_1093. Add toggle state for numbering and bullet icons
255     void StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
256     //Modified for Numbering&Bullets Dialog UX Enh(Story 992) by chengjh,2011.7.5
257     //Handing the transferred the num rule index data of the current selection
258     void StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
259 
260     void initial();
261     void ReSize(bool bSize);
262 
263 
264     PopupControl* CreateLineSpacingControl (PopupContainer* pParent);
265     PopupControl* CreateBulletsPopupControl (PopupContainer* pParent);
266     PopupControl* CreateNumberingPopupControl (PopupContainer* pParent);
267     PopupControl* CreateBGColorPopupControl (PopupContainer* pParent);
268     DECL_LINK(ClickLineSPDropDownHdl_Impl, ToolBox*);
269     DECL_LINK(NumBTbxDDHandler, ToolBox*);
270     DECL_LINK(ToolBoxBackColorDDHandler, ToolBox *);
271 
272     void SetupIcons (void);
273     void InitToolBoxAlign();
274     void InitToolBoxVertAlign();
275     void InitToolBoxIndent();
276     void InitToolBoxBGColor();
277     void InitToolBoxBulletsNumbering();
278     void InitToolBoxSpacing();
279     void InitToolBoxLineSpacing();
280 
281     Color GetBGColor (void) const;
282     void SetBGColor (const String& rsColorName, const Color aColor);
283 };
284 
285 } } // end of namespace ::svx::sidebar
286 
287 #endif
288 
289