1766ce4d0SZheng Fan /**************************************************************
2766ce4d0SZheng Fan  *
3766ce4d0SZheng Fan  * Licensed to the Apache Software Foundation (ASF) under one
4766ce4d0SZheng Fan  * or more contributor license agreements.  See the NOTICE file
5766ce4d0SZheng Fan  * distributed with this work for additional information
6766ce4d0SZheng Fan  * regarding copyright ownership.  The ASF licenses this file
7766ce4d0SZheng Fan  * to you under the Apache License, Version 2.0 (the
8766ce4d0SZheng Fan  * "License"); you may not use this file except in compliance
9766ce4d0SZheng Fan  * with the License.  You may obtain a copy of the License at
10766ce4d0SZheng Fan  *
11766ce4d0SZheng Fan  *   http://www.apache.org/licenses/LICENSE-2.0
12766ce4d0SZheng Fan  *
13766ce4d0SZheng Fan  * Unless required by applicable law or agreed to in writing,
14766ce4d0SZheng Fan  * software distributed under the License is distributed on an
15766ce4d0SZheng Fan  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16766ce4d0SZheng Fan  * KIND, either express or implied.  See the License for the
17766ce4d0SZheng Fan  * specific language governing permissions and limitations
18766ce4d0SZheng Fan  * under the License.
19766ce4d0SZheng Fan  *
20766ce4d0SZheng Fan  *************************************************************/
21766ce4d0SZheng Fan 
22766ce4d0SZheng Fan #include "precompiled_svx.hxx"
23766ce4d0SZheng Fan #include <svx/sidebar/ColorControl.hxx>
24766ce4d0SZheng Fan 
25766ce4d0SZheng Fan #include "ParaPropertyPanel.hxx"
26766ce4d0SZheng Fan #include "ParaPropertyPanel.hrc"
27766ce4d0SZheng Fan 
28766ce4d0SZheng Fan #include "ParaLineSpacingPopup.hxx"
29766ce4d0SZheng Fan #include "ParaLineSpacingControl.hxx"
30766ce4d0SZheng Fan #include "ParaBulletsPopup.hxx"
31766ce4d0SZheng Fan #include "ParaBulletsControl.hxx"
32766ce4d0SZheng Fan #include "ParaNumberingPopup.hxx"
33766ce4d0SZheng Fan #include "ParaNumberingControl.hxx"
34766ce4d0SZheng Fan #include <sfx2/sidebar/Theme.hxx>
35d29c2fc2SAndre Fischer #include <sfx2/sidebar/ResourceDefinitions.hrc>
36766ce4d0SZheng Fan #include <sfx2/sidebar/ControlFactory.hxx>
376a606da0SAndre Fischer #include <sfx2/sidebar/Layouter.hxx>
38e1bac94cSAndre Fischer #include <sfx2/sidebar/Tools.hxx>
39766ce4d0SZheng Fan #include <svx/sidebar/PopupContainer.hxx>
40766ce4d0SZheng Fan #include <sfx2/dispatch.hxx>
41766ce4d0SZheng Fan #include <editeng/colritem.hxx>
42766ce4d0SZheng Fan #include <editeng/brshitem.hxx>
43766ce4d0SZheng Fan #include <editeng/lrspitem.hxx>
44766ce4d0SZheng Fan #include <editeng/ulspitem.hxx>
45766ce4d0SZheng Fan #include <vcl/toolbox.hxx>
46766ce4d0SZheng Fan #include <vcl/fixed.hxx>
47766ce4d0SZheng Fan #include <vcl/svapp.hxx>
48766ce4d0SZheng Fan #include <svx/svxids.hrc>
49766ce4d0SZheng Fan #include <svl/intitem.hxx>
50766ce4d0SZheng Fan #include "svx/dialmgr.hxx"
51766ce4d0SZheng Fan #include <sfx2/objsh.hxx>
52766ce4d0SZheng Fan #include <svtools/unitconv.hxx>
53766ce4d0SZheng Fan #include <boost/bind.hpp>
546a606da0SAndre Fischer 
55766ce4d0SZheng Fan using namespace css;
56766ce4d0SZheng Fan using namespace cssu;
576a606da0SAndre Fischer using namespace ::sfx2::sidebar;
58766ce4d0SZheng Fan using ::sfx2::sidebar::Theme;
59766ce4d0SZheng Fan using ::sfx2::sidebar::ControlFactory;
60766ce4d0SZheng Fan 
61766ce4d0SZheng Fan namespace svx {namespace sidebar {
62766ce4d0SZheng Fan #define DEFAULT_VALUE          0
63766ce4d0SZheng Fan #define TOOLBOX_ITEM1          1
64766ce4d0SZheng Fan #define TOOLBOX_ITEM2          2
65766ce4d0SZheng Fan #define TOOLBOX_ITEM3          3
66766ce4d0SZheng Fan #define TOOLBOX_ITEM4          4
67766ce4d0SZheng Fan 
68766ce4d0SZheng Fan #define MAX_DURCH             5670
69766ce4d0SZheng Fan 
70766ce4d0SZheng Fan #define INDENT_INCREMENT       1
71766ce4d0SZheng Fan #define INDENT_DECREMENT       2
72766ce4d0SZheng Fan #define INDENT_STEP            706
73766ce4d0SZheng Fan #define UL_STEP                58
74766ce4d0SZheng Fan 
75766ce4d0SZheng Fan #define NEGATIVE_MAX_VALUE              -9999
76766ce4d0SZheng Fan #define BEGIN_VALUE            28
77766ce4d0SZheng Fan #define MAX_SW                  1709400
78766ce4d0SZheng Fan #define MAX_SC_SD				116220200
79766ce4d0SZheng Fan #define NEGA_MAXVALUE          -10000000
80766ce4d0SZheng Fan 
81766ce4d0SZheng Fan #define POS_FT_PARA_SPACE								Point(LogicToPixel(Point(FT_PARA_SPACE_X,FT_PARA_SPACE_Y), MAP_APPFONT))
82766ce4d0SZheng Fan #define POS_FT_PARA_SPACE2								Point(LogicToPixel(Point(FT_PARA_SPACE_X,FT_PARA_SPACE_Y2), MAP_APPFONT))
83766ce4d0SZheng Fan #define POS_TBX_PARA_SPACE_INC_DEC						Point(LogicToPixel(Point(TBX_PARA_SPACE_INC_DEC_X,TBX_PARA_SPACE_INC_DEC_Y), MAP_APPFONT))
84766ce4d0SZheng Fan #define POS_TBX_PARA_SPACE_INC_DEC2						Point(LogicToPixel(Point(TBX_PARA_SPACE_INC_DEC_X,TBX_PARA_SPACE_INC_DEC_Y2), MAP_APPFONT))
85766ce4d0SZheng Fan #define POS_FT_PARA_INDENT								Point(LogicToPixel(Point(FT_PARA_INDENT_X,FT_PARA_INDENT_Y), MAP_APPFONT))
86766ce4d0SZheng Fan #define POS_FT_PARA_INDENT2								Point(LogicToPixel(Point(FT_PARA_INDENT_X,FT_PARA_INDENT_Y2), MAP_APPFONT))
87766ce4d0SZheng Fan #define POS_TBX_PARA_INDENT_INC_DEC						Point(LogicToPixel(Point(TBX_PARA_INDENT_INC_DEC_X,TBX_PARA_INDENT_INC_DEC_Y), MAP_APPFONT))
88766ce4d0SZheng Fan #define POS_TBX_PARA_INDENT_INC_DEC2					Point(LogicToPixel(Point(TBX_PARA_INDENT_INC_DEC_X,TBX_PARA_INDENT_INC_DEC_Y2), MAP_APPFONT))
89766ce4d0SZheng Fan #define POS_MBX_TOP_DIST								Point(LogicToPixel(Point(MBX_TOP_DIST_X,MBX_TOP_DIST_Y), MAP_APPFONT))
90766ce4d0SZheng Fan #define POS_MBX_TOP_DIST2								Point(LogicToPixel(Point(MBX_TOP_DIST_X,MBX_TOP_DIST_Y2), MAP_APPFONT))
91766ce4d0SZheng Fan #define POS_MBX_BOT_DIST								Point(LogicToPixel(Point(MBX_BOT_DIST_X,MBX_BOT_DIST_Y), MAP_APPFONT))
92766ce4d0SZheng Fan #define POS_MBX_BOT_DIST2								Point(LogicToPixel(Point(MBX_BOT_DIST_X,MBX_BOT_DIST_Y2), MAP_APPFONT))
93766ce4d0SZheng Fan #define POS_MBX_LEFT_DIST								Point(LogicToPixel(Point(MBX_LEFT_DIST_X,MBX_LEFT_DIST_Y), MAP_APPFONT))
94766ce4d0SZheng Fan #define POS_MBX_LEFT_DIST2								Point(LogicToPixel(Point(MBX_LEFT_DIST_X,MBX_LEFT_DIST_Y2), MAP_APPFONT))
95766ce4d0SZheng Fan #define POS_MBX_RIGHT_DIST								Point(LogicToPixel(Point(MBX_RIGHT_DIST_X,MBX_RIGHT_DIST_Y), MAP_APPFONT))
96766ce4d0SZheng Fan #define POS_MBX_RIGHT_DIST2								Point(LogicToPixel(Point(MBX_RIGHT_DIST_X,MBX_RIGHT_DIST_Y2), MAP_APPFONT))
97766ce4d0SZheng Fan #define POS_MBX_FLINE_DIST								Point(LogicToPixel(Point(MBX_FLINE_DIST_X,MBX_FLINE_DIST_Y), MAP_APPFONT))
98766ce4d0SZheng Fan #define POS_MBX_FLINE_DIST2								Point(LogicToPixel(Point(MBX_FLINE_DIST_X,MBX_FLINE_DIST_Y2), MAP_APPFONT))
99766ce4d0SZheng Fan #define POS_IMG_SPACE1									Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE1_Y), MAP_APPFONT))
100766ce4d0SZheng Fan #define POS_IMG_SPACE12									Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE1_Y2), MAP_APPFONT))
101766ce4d0SZheng Fan #define POS_IMG_SPACE2									Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE2_Y), MAP_APPFONT))
102766ce4d0SZheng Fan #define POS_IMG_SPACE22									Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE2_Y2), MAP_APPFONT))
103766ce4d0SZheng Fan #define POS_IMG_INDENT1									Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT1_Y), MAP_APPFONT))
104766ce4d0SZheng Fan #define POS_IMG_INDENT12								Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT1_Y2), MAP_APPFONT))
105766ce4d0SZheng Fan #define POS_IMG_INDENT2									Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT2_Y), MAP_APPFONT))
106766ce4d0SZheng Fan #define POS_IMG_INDENT22								Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT2_Y2), MAP_APPFONT))
107766ce4d0SZheng Fan #define POS_IMG_INDENT3									Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT3_Y), MAP_APPFONT))
108766ce4d0SZheng Fan #define POS_IMG_INDENT32								Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT3_Y2), MAP_APPFONT))
109766ce4d0SZheng Fan #define TBX_LINE_SPACE									Point(LogicToPixel(Point(TBX_LINE_SPACE_X,TBX_LINE_SPACE_Y), MAP_APPFONT))
110766ce4d0SZheng Fan #define TBX_LINE_SPACE2									Point(LogicToPixel(Point(TBX_LINE_SPACE_X,TBX_LINE_SPACE_Y2), MAP_APPFONT))
111766ce4d0SZheng Fan 
112766ce4d0SZheng Fan #define LINE_POINT1_WHITE								Point(LogicToPixel(Point(LINE_X_WHITE,LINE_TOP_Y), MAP_APPFONT))
113766ce4d0SZheng Fan #define LINE_POINT2_WHITE								Point(LogicToPixel(Point(LINE_X_WHITE,LINE_BOT_Y), MAP_APPFONT))
114766ce4d0SZheng Fan #define LINE_POINT3_WHITE								Point(LogicToPixel(Point(LINE_X_WHITE,LINE_TOP_Y2), MAP_APPFONT))
115766ce4d0SZheng Fan #define LINE_POINT4_WHITE								Point(LogicToPixel(Point(LINE_X_WHITE,LINE_BOT_Y2), MAP_APPFONT))
116766ce4d0SZheng Fan 
1176a606da0SAndre Fischer 
Create(Window * pParent,const cssu::Reference<css::frame::XFrame> & rxFrame,SfxBindings * pBindings,const cssu::Reference<css::ui::XSidebar> & rxSidebar)118766ce4d0SZheng Fan ParaPropertyPanel* ParaPropertyPanel::Create (
119766ce4d0SZheng Fan     Window* pParent,
120766ce4d0SZheng Fan     const cssu::Reference<css::frame::XFrame>& rxFrame,
12137fee4fdSAndre Fischer     SfxBindings* pBindings,
12237fee4fdSAndre Fischer     const cssu::Reference<css::ui::XSidebar>& rxSidebar)
123766ce4d0SZheng Fan {
124766ce4d0SZheng Fan     if (pParent == NULL)
125766ce4d0SZheng Fan         throw lang::IllegalArgumentException(A2S("no parent Window given to ParaPropertyPanel::Create"), NULL, 0);
126766ce4d0SZheng Fan     if ( ! rxFrame.is())
127766ce4d0SZheng Fan         throw lang::IllegalArgumentException(A2S("no XFrame given to ParaPropertyPanel::Create"), NULL, 1);
128766ce4d0SZheng Fan     if (pBindings == NULL)
129766ce4d0SZheng Fan         throw lang::IllegalArgumentException(A2S("no SfxBindings given to ParaPropertyPanel::Create"), NULL, 2);
130766ce4d0SZheng Fan 
131766ce4d0SZheng Fan     return new ParaPropertyPanel(
132766ce4d0SZheng Fan         pParent,
133766ce4d0SZheng Fan         rxFrame,
13437fee4fdSAndre Fischer         pBindings,
13537fee4fdSAndre Fischer         rxSidebar);
136766ce4d0SZheng Fan }
137766ce4d0SZheng Fan 
HandleContextChange(const::sfx2::sidebar::EnumContext aContext)138766ce4d0SZheng Fan void ParaPropertyPanel::HandleContextChange (
139766ce4d0SZheng Fan     const ::sfx2::sidebar::EnumContext aContext)
140766ce4d0SZheng Fan {
141766ce4d0SZheng Fan     if (maContext == aContext)
142766ce4d0SZheng Fan     {
143766ce4d0SZheng Fan         // Nothing to do.
144766ce4d0SZheng Fan         return;
145766ce4d0SZheng Fan     }
146766ce4d0SZheng Fan 
147766ce4d0SZheng Fan     maContext = aContext;
14837fee4fdSAndre Fischer     switch (maContext.GetCombinedContext_DI())
149766ce4d0SZheng Fan     {
150766ce4d0SZheng Fan         case CombinedEnumContext(Application_Calc, Context_DrawText):
151b6ab65a3SAndre Fischer             mpTBxVertAlign->Show();
152b6ab65a3SAndre Fischer             mpTBxVertAlignBackground->Show();
153b6ab65a3SAndre Fischer             mpTBxBackColor->Hide();
154b6ab65a3SAndre Fischer             mpTBxBackColorBackground->Hide();
155b6ab65a3SAndre Fischer             mpTBxNumBullet->Hide();
156b6ab65a3SAndre Fischer             mpTBxNumBulletBackground->Hide();
15737fee4fdSAndre Fischer             ReSize(false);
158b6ab65a3SAndre Fischer             mpTbxIndent_IncDec->Show();
159b6ab65a3SAndre Fischer             mpTbxIndent_IncDecBackground->Show();
160b6ab65a3SAndre Fischer             mpTbxProDemote->Hide();
161b6ab65a3SAndre Fischer             mpTbxProDemoteBackground->Hide();
16237fee4fdSAndre Fischer             break;
16337fee4fdSAndre Fischer 
16437fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Draw):
16537fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
16637fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
167b6ab65a3SAndre Fischer             mpTBxVertAlign->Hide();
168b6ab65a3SAndre Fischer 		    mpTBxVertAlignBackground->Hide();
169b6ab65a3SAndre Fischer             mpTBxBackColor->Hide();
170b6ab65a3SAndre Fischer             mpTBxBackColorBackground->Hide();
171b6ab65a3SAndre Fischer             mpTBxNumBullet->Show();
172b6ab65a3SAndre Fischer             mpTBxNumBulletBackground->Show();
17337fee4fdSAndre Fischer             ReSize(true);
174b6ab65a3SAndre Fischer             mpTbxIndent_IncDec->Hide();
175b6ab65a3SAndre Fischer             mpTbxIndent_IncDecBackground->Hide();
176b6ab65a3SAndre Fischer             mpTbxProDemote->Show();
177b6ab65a3SAndre Fischer             mpTbxProDemoteBackground->Show();
17837fee4fdSAndre Fischer             break;
17937fee4fdSAndre Fischer 
18037fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
181b6ab65a3SAndre Fischer             mpTBxVertAlign->Show();
182b6ab65a3SAndre Fischer             mpTBxVertAlignBackground->Show();
183b6ab65a3SAndre Fischer             mpTBxBackColor->Hide();
184b6ab65a3SAndre Fischer             mpTBxBackColorBackground->Hide();
185b6ab65a3SAndre Fischer             mpTBxNumBullet->Show();
186b6ab65a3SAndre Fischer             mpTBxNumBulletBackground->Show();
18737fee4fdSAndre Fischer             ReSize(true);
188b6ab65a3SAndre Fischer             mpTbxIndent_IncDec->Hide();
189b6ab65a3SAndre Fischer             mpTbxIndent_IncDecBackground->Hide();
190b6ab65a3SAndre Fischer             mpTbxProDemote->Show();
191b6ab65a3SAndre Fischer             mpTbxProDemoteBackground->Show();
19237fee4fdSAndre Fischer             break;
19337fee4fdSAndre Fischer 
19437fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Table):
195b6ab65a3SAndre Fischer             mpTBxVertAlign->Show();
196b6ab65a3SAndre Fischer             mpTBxVertAlignBackground->Show();
197b6ab65a3SAndre Fischer             mpTBxBackColor->Hide();
198b6ab65a3SAndre Fischer             mpTBxBackColorBackground->Hide();
199b6ab65a3SAndre Fischer             mpTBxNumBullet->Show();
200b6ab65a3SAndre Fischer             mpTBxNumBulletBackground->Show();
20137fee4fdSAndre Fischer             ReSize(true);
202b6ab65a3SAndre Fischer             mpTbxIndent_IncDec->Hide();
203b6ab65a3SAndre Fischer             mpTbxIndent_IncDecBackground->Hide();
204b6ab65a3SAndre Fischer             mpTbxProDemote->Show();
205b6ab65a3SAndre Fischer             mpTbxProDemoteBackground->Show();
20637fee4fdSAndre Fischer             break;
20737fee4fdSAndre Fischer 
20885f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_Default):
20985f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_Text):
210b6ab65a3SAndre Fischer             mpTBxVertAlign->Hide();
211b6ab65a3SAndre Fischer             mpTBxVertAlignBackground->Hide();
212b6ab65a3SAndre Fischer             mpTBxBackColor->Show();
213b6ab65a3SAndre Fischer             mpTBxBackColorBackground->Show();
214b6ab65a3SAndre Fischer             mpTBxNumBullet->Show();
215766ce4d0SZheng Fan 
216b6ab65a3SAndre Fischer             mpTBxNumBulletBackground->Show();
21737fee4fdSAndre Fischer             ReSize(true);
218b6ab65a3SAndre Fischer             mpTbxIndent_IncDec->Show();
219b6ab65a3SAndre Fischer             mpTbxIndent_IncDecBackground->Show();
220b6ab65a3SAndre Fischer             mpTbxProDemote->Hide();
221b6ab65a3SAndre Fischer             mpTbxProDemoteBackground->Hide();
22237fee4fdSAndre Fischer             break;
22337fee4fdSAndre Fischer 
22485f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_Table):
225b6ab65a3SAndre Fischer             mpTBxVertAlign->Show();
226b6ab65a3SAndre Fischer             mpTBxVertAlignBackground->Show();
227b6ab65a3SAndre Fischer             mpTBxBackColor->Show();
228b6ab65a3SAndre Fischer             mpTBxBackColorBackground->Show();
229b6ab65a3SAndre Fischer             mpTBxNumBullet->Show();
230b6ab65a3SAndre Fischer             mpTBxNumBulletBackground->Show();
23137fee4fdSAndre Fischer             ReSize(true);
232b6ab65a3SAndre Fischer             mpTbxIndent_IncDec->Show();
233b6ab65a3SAndre Fischer             mpTbxIndent_IncDecBackground->Show();
234b6ab65a3SAndre Fischer             mpTbxProDemote->Hide();
235b6ab65a3SAndre Fischer             mpTbxProDemoteBackground->Hide();
23637fee4fdSAndre Fischer             break;
23737fee4fdSAndre Fischer 
23885f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
239b6ab65a3SAndre Fischer             mpTBxVertAlign->Show();
240b6ab65a3SAndre Fischer             mpTBxVertAlignBackground->Show();
241b6ab65a3SAndre Fischer             mpTBxBackColor->Hide();
242b6ab65a3SAndre Fischer             mpTBxBackColorBackground->Hide();
243b6ab65a3SAndre Fischer             mpTBxNumBullet->Hide();
244b6ab65a3SAndre Fischer             mpTBxNumBulletBackground->Hide();
24537fee4fdSAndre Fischer             ReSize(false);
246b6ab65a3SAndre Fischer             mpTbxIndent_IncDec->Show();
247b6ab65a3SAndre Fischer             mpTbxIndent_IncDecBackground->Show();
248b6ab65a3SAndre Fischer             mpTbxProDemote->Hide();
249b6ab65a3SAndre Fischer             mpTbxProDemoteBackground->Hide();
25037fee4fdSAndre Fischer             break;
25137fee4fdSAndre Fischer 
25285f1aca2SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
253b6ab65a3SAndre Fischer             mpTBxVertAlign->Hide();
254b6ab65a3SAndre Fischer             mpTBxVertAlignBackground->Hide();
255b6ab65a3SAndre Fischer             mpTBxBackColor->Hide();
256b6ab65a3SAndre Fischer             mpTBxBackColorBackground->Hide();
257b6ab65a3SAndre Fischer             mpTBxNumBullet->Hide();
258b6ab65a3SAndre Fischer             mpTBxNumBulletBackground->Hide();
25937fee4fdSAndre Fischer             ReSize(false);
260b6ab65a3SAndre Fischer             mpTbxIndent_IncDec->Show();
261b6ab65a3SAndre Fischer             mpTbxIndent_IncDecBackground->Show();
262b6ab65a3SAndre Fischer             mpTbxProDemote->Hide();
263b6ab65a3SAndre Fischer             mpTbxProDemoteBackground->Hide();
26437fee4fdSAndre Fischer             break;
26537fee4fdSAndre Fischer 
266766ce4d0SZheng Fan         case CombinedEnumContext(Application_Calc, Context_EditCell):
267766ce4d0SZheng Fan         case CombinedEnumContext(Application_Calc, Context_Cell):
268766ce4d0SZheng Fan         case CombinedEnumContext(Application_Calc, Context_Pivot):
26937fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Text):
27037fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
271766ce4d0SZheng Fan         /*{
272766ce4d0SZheng Fan             mpToolBoxScriptSw->Hide();
273766ce4d0SZheng Fan             mpToolBoxScript->Show();
274766ce4d0SZheng Fan             mpToolBoxSpacing->Show();
275766ce4d0SZheng Fan             mpToolBoxHighlight->Hide();
276766ce4d0SZheng Fan 
277766ce4d0SZheng Fan             Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT);
278766ce4d0SZheng Fan             aSize = LogicToPixel( aSize,MapMode(MAP_APPFONT) );
279766ce4d0SZheng Fan             aSize.setWidth(GetOutputSizePixel().Width());
280766ce4d0SZheng Fan             SetSizePixel(aSize);
281766ce4d0SZheng Fan         }*/
28237fee4fdSAndre Fischer             break;
283766ce4d0SZheng Fan 
284766ce4d0SZheng Fan         default:
285766ce4d0SZheng Fan             break;
286766ce4d0SZheng Fan     }
287766ce4d0SZheng Fan }
288766ce4d0SZheng Fan 
GetBindings()289766ce4d0SZheng Fan SfxBindings* ParaPropertyPanel::GetBindings()
290766ce4d0SZheng Fan {
291766ce4d0SZheng Fan     return mpBindings;
292766ce4d0SZheng Fan }
293766ce4d0SZheng Fan 
2943cac12cfSAndre Fischer 
2953cac12cfSAndre Fischer 
296766ce4d0SZheng Fan 
DataChanged(const DataChangedEvent & rEvent)297766ce4d0SZheng Fan void ParaPropertyPanel::DataChanged (const DataChangedEvent& rEvent)
298766ce4d0SZheng Fan {
299766ce4d0SZheng Fan     (void)rEvent;
300766ce4d0SZheng Fan }
301766ce4d0SZheng Fan 
~ParaPropertyPanel()302766ce4d0SZheng Fan ParaPropertyPanel::~ParaPropertyPanel()
303766ce4d0SZheng Fan {
304766ce4d0SZheng Fan 	delete mpLnSPItem;
305766ce4d0SZheng Fan }
306766ce4d0SZheng Fan 
ReSize(bool bSize)307766ce4d0SZheng Fan void ParaPropertyPanel::ReSize(bool bSize)
308766ce4d0SZheng Fan {
309766ce4d0SZheng Fan 	if(bSize)
310766ce4d0SZheng Fan 	{
311766ce4d0SZheng Fan 		//Paragraph spacing
312b6ab65a3SAndre Fischer 		mpFTUL->SetPosPixel(POS_FT_PARA_SPACE);
313b6ab65a3SAndre Fischer 		mpTbxUL_IncDec->SetPosPixel(POS_TBX_PARA_SPACE_INC_DEC);
314b6ab65a3SAndre Fischer 		mpTopDist->SetPosPixel(POS_MBX_TOP_DIST);
315b6ab65a3SAndre Fischer 		mpBottomDist->SetPosPixel(POS_MBX_BOT_DIST);
316766ce4d0SZheng Fan 		//Indent
317b6ab65a3SAndre Fischer 		mpFTIndent->SetPosPixel(POS_FT_PARA_INDENT);
3186a606da0SAndre Fischer         mpTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC);
319b6ab65a3SAndre Fischer 		mpTbxProDemote->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC);
320b6ab65a3SAndre Fischer 		mpLeftIndent->SetPosPixel(POS_MBX_LEFT_DIST);
321b6ab65a3SAndre Fischer 		mpRightIndent->SetPosPixel(POS_MBX_RIGHT_DIST);
322b6ab65a3SAndre Fischer 		mpFLineIndent->SetPosPixel(POS_MBX_FLINE_DIST);
323766ce4d0SZheng Fan 		//Line spacing
324b6ab65a3SAndre Fischer 		mpLineSPTbx->SetPosPixel(TBX_LINE_SPACE);
325766ce4d0SZheng Fan 		//image
326766ce4d0SZheng Fan 		maFISpace1.SetPosPixel(POS_IMG_SPACE1);
327766ce4d0SZheng Fan 		maFISpace2.SetPosPixel(POS_IMG_SPACE2);
328766ce4d0SZheng Fan 		maFIndent1.SetPosPixel(POS_IMG_INDENT1);
329766ce4d0SZheng Fan 		maFIndent2.SetPosPixel(POS_IMG_INDENT2);
330766ce4d0SZheng Fan 		maFIndent3.SetPosPixel(POS_IMG_INDENT3);
331766ce4d0SZheng Fan 		Size aSize(GetOutputSizePixel().Width(),PARA_SECTIONPAGE_HEIGHT);
332766ce4d0SZheng Fan 		aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
333766ce4d0SZheng Fan 		aSize.setWidth(GetOutputSizePixel().Width());
334766ce4d0SZheng Fan 		SetSizePixel(aSize);
335766ce4d0SZheng Fan 	}
336766ce4d0SZheng Fan 	else
337766ce4d0SZheng Fan 	{
338766ce4d0SZheng Fan 		//Paragraph spacing
339b6ab65a3SAndre Fischer 		mpFTUL->SetPosPixel(POS_FT_PARA_SPACE2);
340b6ab65a3SAndre Fischer 		mpTbxUL_IncDec->SetPosPixel(POS_TBX_PARA_SPACE_INC_DEC2);
341b6ab65a3SAndre Fischer 		mpTopDist->SetPosPixel(POS_MBX_TOP_DIST2);
342b6ab65a3SAndre Fischer 		mpBottomDist->SetPosPixel(POS_MBX_BOT_DIST2);
343766ce4d0SZheng Fan 		//Indent
344b6ab65a3SAndre Fischer 		mpFTIndent->SetPosPixel(POS_FT_PARA_INDENT2);
3456a606da0SAndre Fischer         mpTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC2);
346b6ab65a3SAndre Fischer 		mpTbxProDemote->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC2);
347b6ab65a3SAndre Fischer 		mpLeftIndent->SetPosPixel(POS_MBX_LEFT_DIST2);
348b6ab65a3SAndre Fischer 		mpRightIndent->SetPosPixel(POS_MBX_RIGHT_DIST2);
349b6ab65a3SAndre Fischer 		mpFLineIndent->SetPosPixel(POS_MBX_FLINE_DIST2);
350766ce4d0SZheng Fan 		//Line spacing
351b6ab65a3SAndre Fischer 		mpLineSPTbx->SetPosPixel(TBX_LINE_SPACE2);
352766ce4d0SZheng Fan 		//image
353766ce4d0SZheng Fan 		maFISpace1.SetPosPixel(POS_IMG_SPACE12);
354766ce4d0SZheng Fan 		maFISpace2.SetPosPixel(POS_IMG_SPACE22);
355766ce4d0SZheng Fan 		maFIndent1.SetPosPixel(POS_IMG_INDENT12);
356766ce4d0SZheng Fan 		maFIndent2.SetPosPixel(POS_IMG_INDENT22);
357766ce4d0SZheng Fan 		maFIndent3.SetPosPixel(POS_IMG_INDENT32);
358766ce4d0SZheng Fan 		Size aSize(GetOutputSizePixel().Width(),PARA_SECTIONPAGE_HEIGHT_2);
359766ce4d0SZheng Fan 		aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
360766ce4d0SZheng Fan 		aSize.setWidth(GetOutputSizePixel().Width());
361766ce4d0SZheng Fan 		SetSizePixel(aSize);
362766ce4d0SZheng Fan 	}
36337fee4fdSAndre Fischer 
3646a606da0SAndre Fischer     maLayouter.Layout();
3656a606da0SAndre Fischer 
36637fee4fdSAndre Fischer     if (mxSidebar.is())
36737fee4fdSAndre Fischer         mxSidebar->requestLayout();
368766ce4d0SZheng Fan }
369766ce4d0SZheng Fan 
3706a606da0SAndre Fischer 
3716a606da0SAndre Fischer 
3726a606da0SAndre Fischer 
Resize(void)3736a606da0SAndre Fischer void ParaPropertyPanel::Resize (void)
3746a606da0SAndre Fischer {
3756a606da0SAndre Fischer     switch (maContext.GetCombinedContext_DI())
3766a606da0SAndre Fischer     {
3776a606da0SAndre Fischer         case CombinedEnumContext(Application_Calc, Context_DrawText):
3786a606da0SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
3796a606da0SAndre Fischer         case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
3806a606da0SAndre Fischer             ReSize(false);
3816a606da0SAndre Fischer             break;
3826a606da0SAndre Fischer 
3836a606da0SAndre Fischer         default:
3846a606da0SAndre Fischer             ReSize(true);
3856a606da0SAndre Fischer             break;
3866a606da0SAndre Fischer     }
3876a606da0SAndre Fischer }
3886a606da0SAndre Fischer 
3896a606da0SAndre Fischer 
3906a606da0SAndre Fischer 
3916a606da0SAndre Fischer 
EndSpacingPopupMode(void)392766ce4d0SZheng Fan void ParaPropertyPanel::EndSpacingPopupMode (void)
393766ce4d0SZheng Fan {
394766ce4d0SZheng Fan     maLineSpacePopup.Hide();
395766ce4d0SZheng Fan }
396766ce4d0SZheng Fan 
EndBulletsPopupMode(void)397766ce4d0SZheng Fan void ParaPropertyPanel::EndBulletsPopupMode (void)
398766ce4d0SZheng Fan {
3998a9f1ce2SZheng Fan 	//i122054, Missed following line, for collapse the bullets popup
4008a9f1ce2SZheng Fan 	maBulletsPopup.Hide();
401766ce4d0SZheng Fan }
402766ce4d0SZheng Fan 
EndNumberingPopupMode(void)403766ce4d0SZheng Fan void ParaPropertyPanel::EndNumberingPopupMode (void)
404766ce4d0SZheng Fan {
4058a9f1ce2SZheng Fan 	//i122054, Missed following line, for collapse the numbering popup
4068a9f1ce2SZheng Fan 	maNumberingPopup.Hide();
407766ce4d0SZheng Fan }
408766ce4d0SZheng Fan 
409766ce4d0SZheng Fan 
InitToolBoxAlign()410766ce4d0SZheng Fan void ParaPropertyPanel::InitToolBoxAlign()
411766ce4d0SZheng Fan {
4123cac12cfSAndre Fischer     const bool bIsHighContrastModeActive (Theme::IsHighContrastMode());
413b6ab65a3SAndre Fischer 	mpAlignToolBox->SetItemImage(TOOLBOX_ITEM1, maLeftAlignControl.GetIcon(bIsHighContrastModeActive));
414b6ab65a3SAndre Fischer 	mpAlignToolBox->SetItemImage(TOOLBOX_ITEM2, maCenterAlignControl.GetIcon(bIsHighContrastModeActive));
415b6ab65a3SAndre Fischer 	mpAlignToolBox->SetItemImage(TOOLBOX_ITEM3, maRightAlignControl.GetIcon(bIsHighContrastModeActive));
416b6ab65a3SAndre Fischer 	mpAlignToolBox->SetItemImage(TOOLBOX_ITEM4, maJustifyAlignControl.GetIcon(bIsHighContrastModeActive));
4173cac12cfSAndre Fischer 
418766ce4d0SZheng Fan 	Link aLink = LINK( this, ParaPropertyPanel, AlignStyleModifyHdl_Impl );
419b6ab65a3SAndre Fischer 	mpAlignToolBox->SetSelectHdl( aLink );
420b6ab65a3SAndre Fischer 	Size aTbxSize (mpAlignToolBox->CalcWindowSizePixel());
421b6ab65a3SAndre Fischer 	mpAlignToolBox->SetOutputSizePixel( aTbxSize );
422766ce4d0SZheng Fan }
423766ce4d0SZheng Fan 
InitToolBoxVertAlign()424766ce4d0SZheng Fan void ParaPropertyPanel::InitToolBoxVertAlign()
425766ce4d0SZheng Fan {
4263cac12cfSAndre Fischer     const bool bIsHighContrastModeActive (Theme::IsHighContrastMode());
427b6ab65a3SAndre Fischer     mpTBxVertAlign->SetItemImage(IID_VERT_TOP, maVertTop.GetIcon(bIsHighContrastModeActive));
428b6ab65a3SAndre Fischer     mpTBxVertAlign->SetItemImage(IID_VERT_CENTER, maVertCenter.GetIcon(bIsHighContrastModeActive));
429b6ab65a3SAndre Fischer     mpTBxVertAlign->SetItemImage(IID_VERT_BOTTOM, maVertBottom.GetIcon(bIsHighContrastModeActive));
430b6ab65a3SAndre Fischer 	mpTBxVertAlign->SetSelectHdl(LINK(this,ParaPropertyPanel,VertTbxSelectHandler));
431b6ab65a3SAndre Fischer 	Size aTbxSize (mpTBxVertAlign->CalcWindowSizePixel());
432b6ab65a3SAndre Fischer 	mpTBxVertAlign->SetOutputSizePixel( aTbxSize );
433766ce4d0SZheng Fan }
434766ce4d0SZheng Fan 
435766ce4d0SZheng Fan 
InitToolBoxIndent()436766ce4d0SZheng Fan void ParaPropertyPanel::InitToolBoxIndent()
437766ce4d0SZheng Fan {
438766ce4d0SZheng Fan 	Link aLink = LINK( this, ParaPropertyPanel, ModifyIndentHdl_Impl );
439b6ab65a3SAndre Fischer 	mpLeftIndent->SetModifyHdl( aLink );
440b6ab65a3SAndre Fischer 	mpRightIndent->SetModifyHdl( aLink );
441b6ab65a3SAndre Fischer 	mpFLineIndent->SetModifyHdl( aLink );
442766ce4d0SZheng Fan 
443b6ab65a3SAndre Fischer     mpLeftIndent->SetAccessibleName(mpLeftIndent->GetQuickHelpText());
444b6ab65a3SAndre Fischer 	mpRightIndent->SetAccessibleName(mpRightIndent->GetQuickHelpText());
445b6ab65a3SAndre Fischer 	mpFLineIndent->SetAccessibleName(mpFLineIndent->GetQuickHelpText());
4465dda62ceSAndre Fischer 
4473cac12cfSAndre Fischer     const bool bIsHighContrastModeActive (Theme::IsHighContrastMode());
4483cac12cfSAndre Fischer 
449766ce4d0SZheng Fan 	if( Application::GetSettings().GetLayoutRTL())
450766ce4d0SZheng Fan 	{
451b6ab65a3SAndre Fischer 		mpTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM1, maIncIndentControl.GetIcon(bIsHighContrastModeActive));
452b6ab65a3SAndre Fischer 		mpTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM2, maDecIndentControl.GetIcon(bIsHighContrastModeActive));
453766ce4d0SZheng Fan 	}
454766ce4d0SZheng Fan 	else
455766ce4d0SZheng Fan 	{
456b6ab65a3SAndre Fischer 		mpTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM1, maIncIndentControl.GetIcon(bIsHighContrastModeActive));
457b6ab65a3SAndre Fischer 		mpTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM2, maDecIndentControl.GetIcon(bIsHighContrastModeActive));
458766ce4d0SZheng Fan 	}
459b6ab65a3SAndre Fischer 	mpTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM3,maIndHang);
460766ce4d0SZheng Fan 	aLink = LINK( this, ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl );
461b6ab65a3SAndre Fischer 	mpTbxIndent_IncDec->SetSelectHdl(aLink);
462766ce4d0SZheng Fan 	m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric();
463b6ab65a3SAndre Fischer 	Size aTbxSize = mpTbxIndent_IncDec->CalcWindowSizePixel();
464b6ab65a3SAndre Fischer 	mpTbxIndent_IncDec->SetOutputSizePixel( aTbxSize );
465766ce4d0SZheng Fan 
466766ce4d0SZheng Fan 	if( Application::GetSettings().GetLayoutRTL())
467766ce4d0SZheng Fan 	{
468b6ab65a3SAndre Fischer 		mpTbxProDemote->SetItemImage(TOOLBOX_ITEM1, maOutLineLeftControl.GetIcon(bIsHighContrastModeActive));
469b6ab65a3SAndre Fischer 		mpTbxProDemote->SetItemImage(TOOLBOX_ITEM2, maOutLineRightControl.GetIcon(bIsHighContrastModeActive));
470766ce4d0SZheng Fan 	}
471766ce4d0SZheng Fan 	else
472766ce4d0SZheng Fan 	{
473b6ab65a3SAndre Fischer 		mpTbxProDemote->SetItemImage(TOOLBOX_ITEM1, maOutLineLeftControl.GetIcon(bIsHighContrastModeActive));
474b6ab65a3SAndre Fischer 		mpTbxProDemote->SetItemImage(TOOLBOX_ITEM2, maOutLineRightControl.GetIcon(bIsHighContrastModeActive));
475766ce4d0SZheng Fan 	}
476b6ab65a3SAndre Fischer 	mpTbxProDemote->SetItemImage(TOOLBOX_ITEM3,maIndHang);
477766ce4d0SZheng Fan 	aLink = LINK( this, ParaPropertyPanel, ClickProDemote_Hdl_Impl );
478b6ab65a3SAndre Fischer 	mpTbxProDemote->SetSelectHdl(aLink);
479766ce4d0SZheng Fan 	m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric();
480b6ab65a3SAndre Fischer 	aTbxSize = mpTbxProDemote->CalcWindowSizePixel();
481b6ab65a3SAndre Fischer 	mpTbxProDemote->SetOutputSizePixel( aTbxSize );
482766ce4d0SZheng Fan }
483766ce4d0SZheng Fan 
InitToolBoxBGColor()484766ce4d0SZheng Fan void ParaPropertyPanel::InitToolBoxBGColor()
485766ce4d0SZheng Fan {
486b6ab65a3SAndre Fischer 	mpColorUpdater.reset(new ::svx::ToolboxButtonColorUpdater(SID_BACKGROUND_COLOR, TBI_BACK_COLOR, mpTBxBackColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW ));
487766ce4d0SZheng Fan 
488b6ab65a3SAndre Fischer 	mpTBxBackColor->SetItemImage(TBI_BACK_COLOR, GetDisplayBackground().GetColor().IsDark()? maImgBackColorHigh : maImgBackColor);
489b6ab65a3SAndre Fischer 	mpTBxBackColor->SetItemBits( TBI_BACK_COLOR, mpTBxBackColor->GetItemBits( TBI_BACK_COLOR ) | TIB_DROPDOWNONLY );
490766ce4d0SZheng Fan 
491766ce4d0SZheng Fan 	Link aLink = LINK(this, ParaPropertyPanel, ToolBoxBackColorDDHandler);
492b6ab65a3SAndre Fischer 	mpTBxBackColor->SetDropdownClickHdl ( aLink );
493b6ab65a3SAndre Fischer 	mpTBxBackColor->SetSelectHdl ( aLink );
494b6ab65a3SAndre Fischer 	Size aTbxSize (mpTBxBackColor->CalcWindowSizePixel());
495b6ab65a3SAndre Fischer 	mpTBxBackColor->SetOutputSizePixel( aTbxSize );
496766ce4d0SZheng Fan }
497766ce4d0SZheng Fan 
InitToolBoxBulletsNumbering()498766ce4d0SZheng Fan void ParaPropertyPanel::InitToolBoxBulletsNumbering()
499766ce4d0SZheng Fan {
5003cac12cfSAndre Fischer     const bool bIsHighContrastModeActive (Theme::IsHighContrastMode());
501b6ab65a3SAndre Fischer     mpTBxNumBullet->SetItemImage(IID_BULLET, maBulletOnOff.GetIcon(bIsHighContrastModeActive));
502b6ab65a3SAndre Fischer     mpTBxNumBullet->SetItemImage(IID_NUMBER, maNumberOnOff.GetIcon(bIsHighContrastModeActive));
503766ce4d0SZheng Fan 
504b6ab65a3SAndre Fischer 	mpTBxNumBullet->SetDropdownClickHdl(LINK(this,ParaPropertyPanel,NumBTbxDDHandler));
505b6ab65a3SAndre Fischer 	mpTBxNumBullet->SetSelectHdl(LINK(this,ParaPropertyPanel,NumBTbxSelectHandler));
506b6ab65a3SAndre Fischer 	Size aTbxSize (mpTBxNumBullet->CalcWindowSizePixel());
507b6ab65a3SAndre Fischer 	mpTBxNumBullet->SetOutputSizePixel( aTbxSize );
508766ce4d0SZheng Fan }
InitToolBoxSpacing()509766ce4d0SZheng Fan void ParaPropertyPanel::InitToolBoxSpacing()
510766ce4d0SZheng Fan {
511766ce4d0SZheng Fan 	Link aLink = LINK( this, ParaPropertyPanel, ULSpaceHdl_Impl );
512b6ab65a3SAndre Fischer 	mpTopDist->SetModifyHdl(aLink);
513b6ab65a3SAndre Fischer 	mpBottomDist->SetModifyHdl( aLink );
514766ce4d0SZheng Fan 
515b6ab65a3SAndre Fischer     mpTopDist->SetAccessibleName(mpTopDist->GetQuickHelpText());
516b6ab65a3SAndre Fischer     mpBottomDist->SetAccessibleName(mpBottomDist->GetQuickHelpText());
5175dda62ceSAndre Fischer 
518e1bac94cSAndre Fischer     // Use a form of image loading that can handle both .uno:<command>
519e1bac94cSAndre Fischer     // and private:graphirepository... syntax.  This is necessary to
520e1bac94cSAndre Fischer     // handle the workaround for accessing the images of commands
521e1bac94cSAndre Fischer     // ParaspaceIncrease and ParaspaceDecrease.
522e1bac94cSAndre Fischer     // See issue 122446 for more details.
523b6ab65a3SAndre Fischer     mpTbxUL_IncDec->SetItemImage(
524e1bac94cSAndre Fischer         BT_TBX_UL_INC,
525b6ab65a3SAndre Fischer         sfx2::sidebar::Tools::GetImage(mpTbxUL_IncDec->GetItemCommand(BT_TBX_UL_INC), mxFrame));
526b6ab65a3SAndre Fischer     mpTbxUL_IncDec->SetItemImage(
527e1bac94cSAndre Fischer         BT_TBX_UL_DEC,
528b6ab65a3SAndre Fischer         sfx2::sidebar::Tools::GetImage(mpTbxUL_IncDec->GetItemCommand(BT_TBX_UL_DEC), mxFrame));
529e1bac94cSAndre Fischer 
530766ce4d0SZheng Fan 	aLink = LINK( this, ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl );
531b6ab65a3SAndre Fischer 	mpTbxUL_IncDec->SetSelectHdl(aLink);
532766ce4d0SZheng Fan 	m_eULSpaceUnit = maULSpaceControl.GetCoreMetric();
533b6ab65a3SAndre Fischer 	Size aTbxSize = mpTbxUL_IncDec->CalcWindowSizePixel();
534b6ab65a3SAndre Fischer 	mpTbxUL_IncDec->SetOutputSizePixel( aTbxSize );
535766ce4d0SZheng Fan }
InitToolBoxLineSpacing()536766ce4d0SZheng Fan void ParaPropertyPanel::InitToolBoxLineSpacing()
537766ce4d0SZheng Fan {
538766ce4d0SZheng Fan 	Link aLink = LINK( this, ParaPropertyPanel, ClickLineSPDropDownHdl_Impl );
539b6ab65a3SAndre Fischer 	mpLineSPTbx->SetDropdownClickHdl( aLink );
540b6ab65a3SAndre Fischer 	mpLineSPTbx->SetSelectHdl( aLink );		//support keyinput "ENTER"
541b6ab65a3SAndre Fischer 	mpLineSPTbx->SetItemBits( TOOLBOX_ITEM1, mpLineSPTbx->GetItemBits( TOOLBOX_ITEM1 ) | TIB_DROPDOWNONLY );
542b6ab65a3SAndre Fischer 	mpLineSPTbx->SetItemImage(TOOLBOX_ITEM1,maSpace3);
543b6ab65a3SAndre Fischer 	Size aTbxSize = mpLineSPTbx->CalcWindowSizePixel();
544b6ab65a3SAndre Fischer 	mpLineSPTbx->SetOutputSizePixel( aTbxSize );
545766ce4d0SZheng Fan }
546766ce4d0SZheng Fan 
initial()547766ce4d0SZheng Fan void ParaPropertyPanel::initial()
548766ce4d0SZheng Fan {
549b6ab65a3SAndre Fischer     mpFTUL->SetBackground(Wallpaper());
550b6ab65a3SAndre Fischer     mpFTIndent->SetBackground(Wallpaper());
55137fee4fdSAndre Fischer     maFISpace1.SetBackground(Wallpaper());
55237fee4fdSAndre Fischer     maFISpace2.SetBackground(Wallpaper());
55337fee4fdSAndre Fischer     maFIndent1.SetBackground(Wallpaper());
55437fee4fdSAndre Fischer     maFIndent2.SetBackground(Wallpaper());
55537fee4fdSAndre Fischer     maFIndent3.SetBackground(Wallpaper());
55637fee4fdSAndre Fischer 
55737fee4fdSAndre Fischer     maFISpace1.SetImage(maSpace1);
558766ce4d0SZheng Fan 	maFISpace2.SetImage(maSpace2);
559766ce4d0SZheng Fan 	maFIndent1.SetImage(maIndent3);
560766ce4d0SZheng Fan 	maFIndent2.SetImage(maIndent2);
561766ce4d0SZheng Fan 	maFIndent3.SetImage(maIndent1);
562766ce4d0SZheng Fan 
563766ce4d0SZheng Fan 	GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_LEFT,sal_True,sal_False);
564766ce4d0SZheng Fan 	GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_CENTER,sal_True,sal_False);
565766ce4d0SZheng Fan 	GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_RIGHT,sal_True,sal_False);
566766ce4d0SZheng Fan 	GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_BLOCK,sal_True,sal_False);
567766ce4d0SZheng Fan 
568766ce4d0SZheng Fan 	//toolbox
569766ce4d0SZheng Fan 	InitToolBoxAlign();
570766ce4d0SZheng Fan 	InitToolBoxVertAlign();
571766ce4d0SZheng Fan 	InitToolBoxIndent();
572766ce4d0SZheng Fan 	InitToolBoxBGColor();
573766ce4d0SZheng Fan 	InitToolBoxBulletsNumbering();
574766ce4d0SZheng Fan 	InitToolBoxSpacing();
575766ce4d0SZheng Fan 	InitToolBoxLineSpacing();
576766ce4d0SZheng Fan 
577766ce4d0SZheng Fan #ifdef HAS_IA2
578b6ab65a3SAndre Fischer 	mpAlignToolBox->SetAccRelationLabeledBy(&mpAlignToolBox);
579b6ab65a3SAndre Fischer 	mpTBxVertAlign->SetMpSubEditAccLableBy(&mpTBxVertAlign);
580b6ab65a3SAndre Fischer 	mpTBxNumBullet->SetAccRelationLabeledBy(&mpTBxNumBullet);
581b6ab65a3SAndre Fischer 	mpTBxBackColor->SetMpSubEditAccLableBy(&mpTBxBackColor);
582b6ab65a3SAndre Fischer 	mpFTUL->SetAccRelationLabeledBy(&mpFTUL);
583b6ab65a3SAndre Fischer 	mpTbxUL_IncDec->SetAccRelationLabeledBy(&mpTbxUL_IncDec);
584b6ab65a3SAndre Fischer 	mpTopDist->SetAccRelationLabeledBy(&mpTopDist);
585b6ab65a3SAndre Fischer 	mpBottomDist->SetAccRelationLabeledBy(&mpBottomDist);
586b6ab65a3SAndre Fischer 	mpLineSPTbx->SetAccRelationLabeledBy(&mpLineSPTbx);
587b6ab65a3SAndre Fischer 	mpFTIndent->SetAccRelationLabeledBy(&mpFTIndent);
588b6ab65a3SAndre Fischer 	mpTbxIndent_IncDec->SetAccRelationLabeledBy(&mpTbxIndent_IncDec);
589b6ab65a3SAndre Fischer 	mpTbxProDemote->SetAccRelationLabeledBy(&mpTbxProDemote);
590b6ab65a3SAndre Fischer 	mpLeftIndent->SetAccRelationLabeledBy(&mpLeftIndent);
591b6ab65a3SAndre Fischer 	mpRightIndent->SetAccRelationLabeledBy(&mpRightIndent);
592b6ab65a3SAndre Fischer 	mpFLineIndent->SetAccRelationLabeledBy(&mpFLineIndent);
593766ce4d0SZheng Fan 	mpColorUpdater->SetAccRelationLabeledBy(&mpColorUpdater);
594766ce4d0SZheng Fan #endif
595766ce4d0SZheng Fan }
596766ce4d0SZheng Fan 
InitImageList(::boost::scoped_ptr<ToolBox> & rTbx,ImageList & rImglst,ImageList & rImgHlst)597766ce4d0SZheng Fan void ParaPropertyPanel::InitImageList(::boost::scoped_ptr<ToolBox>& rTbx, ImageList& rImglst, ImageList& rImgHlst)
598766ce4d0SZheng Fan {
599766ce4d0SZheng Fan 	sal_Bool bHighContrast = GetDisplayBackground().GetColor().IsDark();
600766ce4d0SZheng Fan 
601766ce4d0SZheng Fan     ImageList& rImgLst = bHighContrast ? rImgHlst : rImglst;
602766ce4d0SZheng Fan 
603766ce4d0SZheng Fan 	sal_uInt16 nCount = rTbx->GetItemCount();
604766ce4d0SZheng Fan     for (sal_uInt16 i = 0; i < nCount; i++)
605766ce4d0SZheng Fan     {
606766ce4d0SZheng Fan     	sal_uInt16 nId = rTbx->GetItemId(i);
607766ce4d0SZheng Fan 		rTbx->SetItemImage( nId, rImgLst.GetImage( nId ) );
608766ce4d0SZheng Fan     }
609766ce4d0SZheng Fan }
610766ce4d0SZheng Fan 
611766ce4d0SZheng Fan //===========================for Numbering & Bullet================================================
612766ce4d0SZheng Fan 
613766ce4d0SZheng Fan 
614766ce4d0SZheng Fan 
IMPL_LINK(ParaPropertyPanel,NumBTbxDDHandler,ToolBox *,pToolBox)615766ce4d0SZheng Fan IMPL_LINK(ParaPropertyPanel, NumBTbxDDHandler, ToolBox*, pToolBox)
616766ce4d0SZheng Fan {
617766ce4d0SZheng Fan 	sal_uInt16 nId = pToolBox->GetCurItemId();
618766ce4d0SZheng Fan 
619766ce4d0SZheng Fan 	EndTracking();
620766ce4d0SZheng Fan 	pToolBox->SetItemDown( nId, sal_True );
621766ce4d0SZheng Fan 
622766ce4d0SZheng Fan 	if (nId == 1)
623766ce4d0SZheng Fan     {
624766ce4d0SZheng Fan 		maBulletsPopup.UpdateValueSet();
625766ce4d0SZheng Fan 		maBulletsPopup.Show(*pToolBox);
626766ce4d0SZheng Fan 	}
627766ce4d0SZheng Fan 	else if (nId == 2)
628766ce4d0SZheng Fan 	{
629766ce4d0SZheng Fan 		maNumberingPopup.UpdateValueSet();
630766ce4d0SZheng Fan 		maNumberingPopup.Show(*pToolBox);
631766ce4d0SZheng Fan 	}
632766ce4d0SZheng Fan 	pToolBox->SetItemDown( nId, sal_False );
633766ce4d0SZheng Fan 	return 0;
634766ce4d0SZheng Fan }
635766ce4d0SZheng Fan 
IMPL_LINK(ParaPropertyPanel,NumBTbxSelectHandler,ToolBox *,pToolBox)636766ce4d0SZheng Fan IMPL_LINK(ParaPropertyPanel, NumBTbxSelectHandler, ToolBox*, pToolBox)
637766ce4d0SZheng Fan {
638766ce4d0SZheng Fan 	sal_uInt16 nId = pToolBox->GetCurItemId();
639766ce4d0SZheng Fan 	sal_uInt16 nSID = SID_TABLE_VERT_NONE;
640766ce4d0SZheng Fan 
641766ce4d0SZheng Fan 	EndTracking();
642766ce4d0SZheng Fan 	if (nId == 1)
643766ce4d0SZheng Fan     {
644766ce4d0SZheng Fan 		nSID = FN_NUM_BULLET_ON;
645766ce4d0SZheng Fan 	}
646766ce4d0SZheng Fan 	else if ( nId == 2)
647766ce4d0SZheng Fan 	{
648766ce4d0SZheng Fan 		nSID = FN_NUM_NUMBERING_ON;
649766ce4d0SZheng Fan 	}
650766ce4d0SZheng Fan 	SfxBoolItem aBoolItem(nSID, sal_True);
651766ce4d0SZheng Fan 	GetBindings()->GetDispatcher()->Execute(nSID, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
652766ce4d0SZheng Fan 
653766ce4d0SZheng Fan 	return 0;
654766ce4d0SZheng Fan }
655766ce4d0SZheng Fan 
656766ce4d0SZheng Fan 
657766ce4d0SZheng Fan //================================for Vertical Alignment========================================
658766ce4d0SZheng Fan 
659766ce4d0SZheng Fan 
660766ce4d0SZheng Fan 
IMPL_LINK(ParaPropertyPanel,VertTbxSelectHandler,ToolBox *,pToolBox)661766ce4d0SZheng Fan IMPL_LINK(ParaPropertyPanel, VertTbxSelectHandler, ToolBox*, pToolBox)
662766ce4d0SZheng Fan {
663766ce4d0SZheng Fan 	sal_uInt16 nId = pToolBox->GetCurItemId();
664766ce4d0SZheng Fan 	sal_uInt16 nSID = SID_TABLE_VERT_NONE;
665766ce4d0SZheng Fan 	EndTracking();
666766ce4d0SZheng Fan 	if (nId == 1)
667766ce4d0SZheng Fan     {
668766ce4d0SZheng Fan         nSID = SID_TABLE_VERT_NONE;
669b6ab65a3SAndre Fischer 		mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_CHECK);
670b6ab65a3SAndre Fischer 		mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
671b6ab65a3SAndre Fischer 		mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
672766ce4d0SZheng Fan 	}
673766ce4d0SZheng Fan 	else if (nId == 2)
674766ce4d0SZheng Fan 	{
675766ce4d0SZheng Fan 		nSID = SID_TABLE_VERT_CENTER;
676b6ab65a3SAndre Fischer 		mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
677b6ab65a3SAndre Fischer 		mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_CHECK);
678b6ab65a3SAndre Fischer 		mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
679766ce4d0SZheng Fan 	}
680766ce4d0SZheng Fan 	else if (nId == 3)
681766ce4d0SZheng Fan 	{
682766ce4d0SZheng Fan 		nSID = SID_TABLE_VERT_BOTTOM;
683b6ab65a3SAndre Fischer 		mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
684b6ab65a3SAndre Fischer 		mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
685b6ab65a3SAndre Fischer 		mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_CHECK);
686766ce4d0SZheng Fan 	}
687766ce4d0SZheng Fan 	SfxBoolItem aBoolItem(nSID, sal_True);
688766ce4d0SZheng Fan 	GetBindings()->GetDispatcher()->Execute(nSID, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
689766ce4d0SZheng Fan 
690766ce4d0SZheng Fan 	return 0;
691766ce4d0SZheng Fan }
692766ce4d0SZheng Fan 
VertStateChanged(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)693766ce4d0SZheng Fan void ParaPropertyPanel::VertStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState)
694766ce4d0SZheng Fan {
695766ce4d0SZheng Fan 	if (eState < SFX_ITEM_DONTCARE)
696766ce4d0SZheng Fan 	{
697b6ab65a3SAndre Fischer 		mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
698b6ab65a3SAndre Fischer 		mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
699b6ab65a3SAndre Fischer 		mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
700b6ab65a3SAndre Fischer 		mpTBxVertAlign->EnableItem(IID_VERT_TOP, sal_False);
701b6ab65a3SAndre Fischer 		mpTBxVertAlign->EnableItem(IID_VERT_CENTER, sal_False);
702b6ab65a3SAndre Fischer 		mpTBxVertAlign->EnableItem(IID_VERT_BOTTOM, sal_False);
703766ce4d0SZheng Fan 	}
704766ce4d0SZheng Fan 	else
705766ce4d0SZheng Fan 	{
706b6ab65a3SAndre Fischer 		mpTBxVertAlign->EnableItem(IID_VERT_TOP, sal_True);
707b6ab65a3SAndre Fischer 		mpTBxVertAlign->EnableItem(IID_VERT_CENTER, sal_True);
708b6ab65a3SAndre Fischer 		mpTBxVertAlign->EnableItem(IID_VERT_BOTTOM, sal_True);
709766ce4d0SZheng Fan 		if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem)))
710766ce4d0SZheng Fan 		{
711766ce4d0SZheng Fan 			const SfxBoolItem* pItem= (const SfxBoolItem*)pState;
712766ce4d0SZheng Fan 			sal_Bool aBool = (sal_Bool)pItem->GetValue();
713766ce4d0SZheng Fan 
714766ce4d0SZheng Fan 			if (aBool)
715766ce4d0SZheng Fan 			{
716766ce4d0SZheng Fan 				if (nSID == SID_TABLE_VERT_NONE)
717766ce4d0SZheng Fan 				{
718b6ab65a3SAndre Fischer 					mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_CHECK);
719b6ab65a3SAndre Fischer 					mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
720b6ab65a3SAndre Fischer 					mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
721766ce4d0SZheng Fan 				}
722766ce4d0SZheng Fan 				else if (nSID == SID_TABLE_VERT_CENTER)
723766ce4d0SZheng Fan 				{
724b6ab65a3SAndre Fischer 					mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
725b6ab65a3SAndre Fischer 					mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_CHECK);
726b6ab65a3SAndre Fischer 					mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
727766ce4d0SZheng Fan 				}
728766ce4d0SZheng Fan 				else if (nSID == SID_TABLE_VERT_BOTTOM)
729766ce4d0SZheng Fan 				{
730b6ab65a3SAndre Fischer 					mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
731b6ab65a3SAndre Fischer 					mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
732b6ab65a3SAndre Fischer 					mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_CHECK);
733766ce4d0SZheng Fan 				}
734766ce4d0SZheng Fan 			}
735766ce4d0SZheng Fan 			else
736766ce4d0SZheng Fan 			{
737766ce4d0SZheng Fan 				if (nSID == SID_TABLE_VERT_NONE)
738766ce4d0SZheng Fan 				{
739b6ab65a3SAndre Fischer 					mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
740766ce4d0SZheng Fan 				}
741766ce4d0SZheng Fan 				else if (nSID == SID_TABLE_VERT_CENTER)
742766ce4d0SZheng Fan 				{
743b6ab65a3SAndre Fischer 					mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
744766ce4d0SZheng Fan 				}
745766ce4d0SZheng Fan 				else if (nSID == SID_TABLE_VERT_BOTTOM)
746766ce4d0SZheng Fan 				{
747b6ab65a3SAndre Fischer 					mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
748766ce4d0SZheng Fan 				}
749766ce4d0SZheng Fan 			}
750766ce4d0SZheng Fan 		}
751766ce4d0SZheng Fan 		else
752766ce4d0SZheng Fan 		{
753b6ab65a3SAndre Fischer 			mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
754b6ab65a3SAndre Fischer 			mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
755b6ab65a3SAndre Fischer 			mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
756766ce4d0SZheng Fan 		}
757766ce4d0SZheng Fan 	}
758766ce4d0SZheng Fan }
759766ce4d0SZheng Fan //==================================for Background color=====================
760766ce4d0SZheng Fan 
IMPL_LINK(ParaPropertyPanel,ToolBoxBackColorDDHandler,ToolBox *,pToolBox)761766ce4d0SZheng Fan IMPL_LINK(ParaPropertyPanel, ToolBoxBackColorDDHandler,ToolBox*, pToolBox)
762766ce4d0SZheng Fan {
763766ce4d0SZheng Fan 	sal_uInt16 nId = pToolBox->GetCurItemId();
764766ce4d0SZheng Fan 	OSL_ASSERT(nId == TBI_BACK_COLOR);
765766ce4d0SZheng Fan 	if(nId == TBI_BACK_COLOR)
766766ce4d0SZheng Fan 	{
767766ce4d0SZheng Fan 		pToolBox->SetItemDown( nId, true );
768766ce4d0SZheng Fan 		maBGColorPopup.Show(*pToolBox);
769766ce4d0SZheng Fan 		maBGColorPopup.SetCurrentColor(maColor, mbColorAvailable);
770766ce4d0SZheng Fan 	}
771766ce4d0SZheng Fan 	return 0;
772766ce4d0SZheng Fan }
773766ce4d0SZheng Fan 
IMPL_LINK(ParaPropertyPanel,ImplPopupModeEndHdl,FloatingWindow *,EMPTYARG)774766ce4d0SZheng Fan IMPL_LINK( ParaPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
775766ce4d0SZheng Fan {
776766ce4d0SZheng Fan 	return 0;
777766ce4d0SZheng Fan }
778766ce4d0SZheng Fan 
ShowMenu(void)779766ce4d0SZheng Fan void ParaPropertyPanel::ShowMenu (void)
780766ce4d0SZheng Fan {
781766ce4d0SZheng Fan     if (mpBindings != NULL)
782766ce4d0SZheng Fan     {
783766ce4d0SZheng Fan         SfxDispatcher* pDispatcher = mpBindings->GetDispatcher();
784766ce4d0SZheng Fan         if (pDispatcher != NULL)
785766ce4d0SZheng Fan             pDispatcher->Execute(SID_PARA_DLG, SFX_CALLMODE_ASYNCHRON);
786766ce4d0SZheng Fan     }
787766ce4d0SZheng Fan }
788766ce4d0SZheng Fan 
ParaBKGStateChanged(sal_uInt16,SfxItemState eState,const SfxPoolItem * pState)7891715803bSPavel Janík void ParaPropertyPanel::ParaBKGStateChanged(sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState)
790766ce4d0SZheng Fan {
791445e496eSZheng Fan 	if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem))
792766ce4d0SZheng Fan 	{
793445e496eSZheng Fan 		const SvxColorItem* pItem =  (const SvxColorItem*)pState;
794445e496eSZheng Fan 		maColor = pItem->GetValue();
795766ce4d0SZheng Fan 		mbColorAvailable = sal_True;
796766ce4d0SZheng Fan 		mpColorUpdater->Update(maColor);
797766ce4d0SZheng Fan 	}
798766ce4d0SZheng Fan 	else
799766ce4d0SZheng Fan 	{
800766ce4d0SZheng Fan 		mbColorAvailable = sal_False;
801766ce4d0SZheng Fan 		maColor.SetColor(COL_AUTO);
802766ce4d0SZheng Fan 		mpColorUpdater->Update(maColor);
803766ce4d0SZheng Fan 	}
804766ce4d0SZheng Fan }
805766ce4d0SZheng Fan 
SetBGColor(const String &,const Color aColor)806766ce4d0SZheng Fan void ParaPropertyPanel::SetBGColor (
8071715803bSPavel Janík     const String& /* rsColorName */,
808766ce4d0SZheng Fan     const Color aColor)
809766ce4d0SZheng Fan {
810766ce4d0SZheng Fan 	SvxColorItem aColorItem(aColor, SID_BACKGROUND_COLOR);
811766ce4d0SZheng Fan 	mpBindings->GetDispatcher()->Execute(SID_BACKGROUND_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
812766ce4d0SZheng Fan 	maColor = aColor;
813766ce4d0SZheng Fan }
814766ce4d0SZheng Fan 
815766ce4d0SZheng Fan //==================================for Paragraph Alignment=====================
IMPL_LINK(ParaPropertyPanel,AlignStyleModifyHdl_Impl,ToolBox *,pBox)816766ce4d0SZheng Fan IMPL_LINK( ParaPropertyPanel, AlignStyleModifyHdl_Impl, ToolBox*, pBox )
817766ce4d0SZheng Fan {
818766ce4d0SZheng Fan 	switch (pBox->GetCurItemId())
819766ce4d0SZheng Fan 	{
820766ce4d0SZheng Fan 	case BT_SUBSTLEFT:
821766ce4d0SZheng Fan 		{
822766ce4d0SZheng Fan 			pBox->SetItemState(BT_SUBSTLEFT,STATE_CHECK);
823766ce4d0SZheng Fan 			pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
824766ce4d0SZheng Fan 			pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
825766ce4d0SZheng Fan 			pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
826766ce4d0SZheng Fan 			SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_LEFT,  sal_True );
827766ce4d0SZheng Fan 			GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_LEFT, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
828766ce4d0SZheng Fan 		}
829766ce4d0SZheng Fan 		break;
830766ce4d0SZheng Fan 	case BT_SUBSTCENTER:
831766ce4d0SZheng Fan 		{
832766ce4d0SZheng Fan 			pBox->SetItemState(BT_SUBSTCENTER,STATE_CHECK);
833766ce4d0SZheng Fan 			pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
834766ce4d0SZheng Fan 			pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
835766ce4d0SZheng Fan 			pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
836766ce4d0SZheng Fan 			SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True );
837766ce4d0SZheng Fan 			GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_CENTER, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
838766ce4d0SZheng Fan 		}
839766ce4d0SZheng Fan 		break;
840766ce4d0SZheng Fan 	case BT_SUBSTRIGHT:
841766ce4d0SZheng Fan 		{
842766ce4d0SZheng Fan 			pBox->SetItemState(BT_SUBSTRIGHT,STATE_CHECK);
843766ce4d0SZheng Fan 			pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
844766ce4d0SZheng Fan 			pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
845766ce4d0SZheng Fan 			pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
846766ce4d0SZheng Fan 			SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True );
847766ce4d0SZheng Fan 			GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_RIGHT, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
848766ce4d0SZheng Fan 		}
849766ce4d0SZheng Fan 		break;
850766ce4d0SZheng Fan 	case BT_SUBSTJUSTIFY:
851766ce4d0SZheng Fan 		{
852766ce4d0SZheng Fan 			pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_CHECK);
853766ce4d0SZheng Fan 			pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
854766ce4d0SZheng Fan 			pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
855766ce4d0SZheng Fan 			pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
856766ce4d0SZheng Fan 			SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True );
857766ce4d0SZheng Fan 			GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_BLOCK, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
858766ce4d0SZheng Fan 		}
859766ce4d0SZheng Fan 		break;
860766ce4d0SZheng Fan 	}
861766ce4d0SZheng Fan 
862766ce4d0SZheng Fan 	return 0;
863766ce4d0SZheng Fan }
864766ce4d0SZheng Fan //==================================for Paragraph Indent=====================
8651715803bSPavel Janík IMPL_LINK( ParaPropertyPanel, ModifyIndentHdl_Impl, SvxRelativeField*, /* pBox */ )
866766ce4d0SZheng Fan {
867512ec161SZheng Fan 	SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
868b6ab65a3SAndre Fischer 	aMargin.SetTxtLeft( (const long)GetCoreValue( *mpLeftIndent.get(), m_eLRSpaceUnit ) );
869b6ab65a3SAndre Fischer 	aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent.get(), m_eLRSpaceUnit ) );
870b6ab65a3SAndre Fischer 	aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ) );
871766ce4d0SZheng Fan 
872766ce4d0SZheng Fan 	GetBindings()->GetDispatcher()->Execute(
873512ec161SZheng Fan 		SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
874766ce4d0SZheng Fan 	return 0;
875766ce4d0SZheng Fan }
876766ce4d0SZheng Fan 
IMPL_LINK(ParaPropertyPanel,ClickIndent_IncDec_Hdl_Impl,ToolBox *,pControl)877766ce4d0SZheng Fan IMPL_LINK(ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl, ToolBox *, pControl)
878766ce4d0SZheng Fan {
8798eda4adfSOliver-Rainer Wittmann     switch (pControl->GetCurItemId())
8808eda4adfSOliver-Rainer Wittmann     {
8818eda4adfSOliver-Rainer Wittmann     case INDENT_INCREMENT:
8828eda4adfSOliver-Rainer Wittmann         {
8838eda4adfSOliver-Rainer Wittmann             switch (maContext.GetCombinedContext_DI())
8848eda4adfSOliver-Rainer Wittmann             {
8858eda4adfSOliver-Rainer Wittmann             case CombinedEnumContext(Application_WriterVariants, Context_Default):
8868eda4adfSOliver-Rainer Wittmann             case CombinedEnumContext(Application_WriterVariants, Context_Text):
8878eda4adfSOliver-Rainer Wittmann             case CombinedEnumContext(Application_WriterVariants, Context_Table):
8888eda4adfSOliver-Rainer Wittmann                 {
8898eda4adfSOliver-Rainer Wittmann                     SfxBoolItem aMargin( SID_INC_INDENT, sal_True );
8908eda4adfSOliver-Rainer Wittmann                     GetBindings()->GetDispatcher()->Execute(
8918eda4adfSOliver-Rainer Wittmann                         SID_INC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L);
8928eda4adfSOliver-Rainer Wittmann                 }
8938eda4adfSOliver-Rainer Wittmann                 break;
8948eda4adfSOliver-Rainer Wittmann             default:
8958eda4adfSOliver-Rainer Wittmann                 {
8968eda4adfSOliver-Rainer Wittmann                     SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
8978eda4adfSOliver-Rainer Wittmann 
8988eda4adfSOliver-Rainer Wittmann                     maTxtLeft += INDENT_STEP;
8998eda4adfSOliver-Rainer Wittmann                     sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
9008eda4adfSOliver-Rainer Wittmann                     nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
9018eda4adfSOliver-Rainer Wittmann                     aMargin.SetTxtLeft( (const long)nVal );
902b6ab65a3SAndre Fischer                     aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent.get(), m_eLRSpaceUnit ) );
903b6ab65a3SAndre Fischer                     aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ) );
9048eda4adfSOliver-Rainer Wittmann 
9058eda4adfSOliver-Rainer Wittmann                     GetBindings()->GetDispatcher()->Execute(
9068eda4adfSOliver-Rainer Wittmann                         SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
9078eda4adfSOliver-Rainer Wittmann                 }
9088eda4adfSOliver-Rainer Wittmann             }
9098eda4adfSOliver-Rainer Wittmann         }
9108eda4adfSOliver-Rainer Wittmann         break;
9118eda4adfSOliver-Rainer Wittmann     case INDENT_DECREMENT:
9128eda4adfSOliver-Rainer Wittmann         {
9138eda4adfSOliver-Rainer Wittmann             switch (maContext.GetCombinedContext_DI())
9148eda4adfSOliver-Rainer Wittmann             {
9158eda4adfSOliver-Rainer Wittmann             case CombinedEnumContext(Application_WriterVariants, Context_Default):
9168eda4adfSOliver-Rainer Wittmann             case CombinedEnumContext(Application_WriterVariants, Context_Text):
9178eda4adfSOliver-Rainer Wittmann             case CombinedEnumContext(Application_WriterVariants, Context_Table):
9188eda4adfSOliver-Rainer Wittmann                 {
9198eda4adfSOliver-Rainer Wittmann                     SfxBoolItem aMargin( SID_DEC_INDENT, sal_True );
9208eda4adfSOliver-Rainer Wittmann                     GetBindings()->GetDispatcher()->Execute(
9218eda4adfSOliver-Rainer Wittmann                         SID_DEC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L);
9228eda4adfSOliver-Rainer Wittmann                 }
9238eda4adfSOliver-Rainer Wittmann                 break;
9248eda4adfSOliver-Rainer Wittmann             default:
9258eda4adfSOliver-Rainer Wittmann                 {
9268eda4adfSOliver-Rainer Wittmann                     if((maTxtLeft - INDENT_STEP) < 0)
9278eda4adfSOliver-Rainer Wittmann                         maTxtLeft = DEFAULT_VALUE;
9288eda4adfSOliver-Rainer Wittmann                     else
9298eda4adfSOliver-Rainer Wittmann                         maTxtLeft -= INDENT_STEP;
9308eda4adfSOliver-Rainer Wittmann 
9318eda4adfSOliver-Rainer Wittmann                     SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
9328eda4adfSOliver-Rainer Wittmann 
9338eda4adfSOliver-Rainer Wittmann                     sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
9348eda4adfSOliver-Rainer Wittmann                     nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
9358eda4adfSOliver-Rainer Wittmann 
9368eda4adfSOliver-Rainer Wittmann                     aMargin.SetTxtLeft( (const long)nVal );
937b6ab65a3SAndre Fischer                     aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent.get(), m_eLRSpaceUnit ) );
938b6ab65a3SAndre Fischer                     aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ) );
9398eda4adfSOliver-Rainer Wittmann 
9408eda4adfSOliver-Rainer Wittmann                     GetBindings()->GetDispatcher()->Execute(
9418eda4adfSOliver-Rainer Wittmann                         SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
9428eda4adfSOliver-Rainer Wittmann                 }
9438eda4adfSOliver-Rainer Wittmann             }
9448eda4adfSOliver-Rainer Wittmann         }
9458eda4adfSOliver-Rainer Wittmann         break;
9468eda4adfSOliver-Rainer Wittmann     case ID_HANGING_INDENT:
9478eda4adfSOliver-Rainer Wittmann         {
9488eda4adfSOliver-Rainer Wittmann             SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
949b6ab65a3SAndre Fischer             aMargin.SetTxtLeft( (const long)GetCoreValue( *mpLeftIndent.get(), m_eLRSpaceUnit ) + (const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ) );
950b6ab65a3SAndre Fischer             aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent.get(), m_eLRSpaceUnit ) );
951b6ab65a3SAndre Fischer             aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ))*(-1) );
952766ce4d0SZheng Fan 
9538eda4adfSOliver-Rainer Wittmann             GetBindings()->GetDispatcher()->Execute(
9548eda4adfSOliver-Rainer Wittmann                 SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
9558eda4adfSOliver-Rainer Wittmann         }
9568eda4adfSOliver-Rainer Wittmann         break;
9578eda4adfSOliver-Rainer Wittmann     }
9588eda4adfSOliver-Rainer Wittmann     return( 0L );
959766ce4d0SZheng Fan }
960766ce4d0SZheng Fan 
IMPL_LINK(ParaPropertyPanel,ClickProDemote_Hdl_Impl,ToolBox *,pControl)961766ce4d0SZheng Fan IMPL_LINK(ParaPropertyPanel, ClickProDemote_Hdl_Impl, ToolBox *, pControl)
962766ce4d0SZheng Fan {
963395b75f9SOliver-Rainer Wittmann     switch (pControl->GetCurItemId())
964395b75f9SOliver-Rainer Wittmann     {
965395b75f9SOliver-Rainer Wittmann         case BT_TBX_INDENT_PROMOTE:
966395b75f9SOliver-Rainer Wittmann         {
967395b75f9SOliver-Rainer Wittmann             GetBindings()->GetDispatcher()->Execute( SID_OUTLINE_RIGHT, SFX_CALLMODE_RECORD );
968395b75f9SOliver-Rainer Wittmann         }
969395b75f9SOliver-Rainer Wittmann         break;
970395b75f9SOliver-Rainer Wittmann         case BT_TBX_INDENT_DEMOTE:
971395b75f9SOliver-Rainer Wittmann         {
972395b75f9SOliver-Rainer Wittmann             GetBindings()->GetDispatcher()->Execute( SID_OUTLINE_LEFT, SFX_CALLMODE_RECORD );
973395b75f9SOliver-Rainer Wittmann         }
974395b75f9SOliver-Rainer Wittmann         break;
975395b75f9SOliver-Rainer Wittmann         case SD_HANGING_INDENT:
976395b75f9SOliver-Rainer Wittmann         {
977395b75f9SOliver-Rainer Wittmann             SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
978b6ab65a3SAndre Fischer             aMargin.SetTxtLeft( (const long)GetCoreValue( *mpLeftIndent.get(), m_eLRSpaceUnit ) + (const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ) );
979b6ab65a3SAndre Fischer             aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent.get(), m_eLRSpaceUnit ) );
980b6ab65a3SAndre Fischer             aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ))*(-1) );
981395b75f9SOliver-Rainer Wittmann 
982395b75f9SOliver-Rainer Wittmann             GetBindings()->GetDispatcher()->Execute( SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
983395b75f9SOliver-Rainer Wittmann         }
984395b75f9SOliver-Rainer Wittmann         break;
985395b75f9SOliver-Rainer Wittmann     }
986395b75f9SOliver-Rainer Wittmann     return( 0L );
987766ce4d0SZheng Fan }
988766ce4d0SZheng Fan //==================================for Paragraph Line Spacing=====================
989766ce4d0SZheng Fan 
IMPL_LINK(ParaPropertyPanel,ClickLineSPDropDownHdl_Impl,ToolBox *,pBox)990766ce4d0SZheng Fan IMPL_LINK( ParaPropertyPanel, ClickLineSPDropDownHdl_Impl, ToolBox*, pBox )
991766ce4d0SZheng Fan {
992766ce4d0SZheng Fan 
993766ce4d0SZheng Fan 	const sal_uInt16 nId = pBox->GetCurItemId();
994766ce4d0SZheng Fan 	OSL_ASSERT(nId == TOOLBOX_ITEM1);
995766ce4d0SZheng Fan 	if(nId == TOOLBOX_ITEM1)
996766ce4d0SZheng Fan 	{
997766ce4d0SZheng Fan 		pBox->SetItemDown( nId, true );
998766ce4d0SZheng Fan 		maLineSpacePopup.Rearrange(meLnSpState,m_eMetricUnit,mpLnSPItem,maContext);
999766ce4d0SZheng Fan 		maLineSpacePopup.Show(*pBox);
1000766ce4d0SZheng Fan 
1001766ce4d0SZheng Fan 	}
1002766ce4d0SZheng Fan 	return (0L);
1003766ce4d0SZheng Fan }
1004766ce4d0SZheng Fan 
1005766ce4d0SZheng Fan //==================================for Paragraph Spacing=====================
10061715803bSPavel Janík IMPL_LINK( ParaPropertyPanel, ULSpaceHdl_Impl, SvxRelativeField*, /* pBox */)
1007766ce4d0SZheng Fan {
1008512ec161SZheng Fan 	SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE );
1009b6ab65a3SAndre Fischer 	aMargin.SetUpper( (sal_uInt16)GetCoreValue( *mpTopDist, m_eULSpaceUnit ) );
1010b6ab65a3SAndre Fischer 	aMargin.SetLower( (sal_uInt16)GetCoreValue( *mpBottomDist, m_eULSpaceUnit ) );
1011766ce4d0SZheng Fan 
1012766ce4d0SZheng Fan 	GetBindings()->GetDispatcher()->Execute(
1013512ec161SZheng Fan 		SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
1014766ce4d0SZheng Fan 	return 0L;
1015766ce4d0SZheng Fan }
1016766ce4d0SZheng Fan 
IMPL_LINK(ParaPropertyPanel,ClickUL_IncDec_Hdl_Impl,ToolBox *,pControl)1017766ce4d0SZheng Fan IMPL_LINK(ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl, ToolBox *, pControl)
1018766ce4d0SZheng Fan {
1019766ce4d0SZheng Fan 	switch (pControl->GetCurItemId())
1020766ce4d0SZheng Fan 		{
1021e1bac94cSAndre Fischer             case BT_TBX_UL_INC:
1022766ce4d0SZheng Fan 		     {
1023512ec161SZheng Fan 				 SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE );
1024766ce4d0SZheng Fan 
1025766ce4d0SZheng Fan 				 maUpper += UL_STEP;
1026766ce4d0SZheng Fan 				 sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1027766ce4d0SZheng Fan 				 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
1028766ce4d0SZheng Fan 				 aMargin.SetUpper( (const sal_uInt16)nVal );
1029766ce4d0SZheng Fan 
1030766ce4d0SZheng Fan 				 maLower += UL_STEP;
1031766ce4d0SZheng Fan 				 nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1032766ce4d0SZheng Fan 				 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
1033766ce4d0SZheng Fan 	             aMargin.SetLower( (const sal_uInt16)nVal );
1034766ce4d0SZheng Fan 
1035766ce4d0SZheng Fan 				 GetBindings()->GetDispatcher()->Execute(
1036512ec161SZheng Fan 					 SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
1037766ce4d0SZheng Fan 			 }
1038766ce4d0SZheng Fan 			 break;
1039e1bac94cSAndre Fischer 		case BT_TBX_UL_DEC:
1040766ce4d0SZheng Fan 			{
1041512ec161SZheng Fan 				 SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE );
1042766ce4d0SZheng Fan 
1043766ce4d0SZheng Fan 				 if( maUpper >= UL_STEP )
1044766ce4d0SZheng Fan 				 {
1045766ce4d0SZheng Fan 					maUpper -= UL_STEP;
1046766ce4d0SZheng Fan 					sal_Int64	nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1047766ce4d0SZheng Fan 					nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
1048766ce4d0SZheng Fan 					aMargin.SetUpper( (const sal_uInt16)nVal );
1049766ce4d0SZheng Fan 				 }
1050766ce4d0SZheng Fan 				 else
1051766ce4d0SZheng Fan 					aMargin.SetUpper( DEFAULT_VALUE );
1052766ce4d0SZheng Fan 				 if( maLower >= UL_STEP )
1053766ce4d0SZheng Fan 				 {
1054766ce4d0SZheng Fan 					maLower -= UL_STEP;
1055766ce4d0SZheng Fan 					sal_Int64	nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1056766ce4d0SZheng Fan 					nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
1057766ce4d0SZheng Fan 					aMargin.SetLower( (const sal_uInt16)nVal );
1058766ce4d0SZheng Fan 				 }
1059766ce4d0SZheng Fan 				 else
1060766ce4d0SZheng Fan 					aMargin.SetLower( DEFAULT_VALUE );
1061766ce4d0SZheng Fan 
1062766ce4d0SZheng Fan 				 GetBindings()->GetDispatcher()->Execute(
1063512ec161SZheng Fan 					 SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
1064766ce4d0SZheng Fan 			}
1065766ce4d0SZheng Fan 			break;
1066766ce4d0SZheng Fan 		}
1067766ce4d0SZheng Fan 	return( 0L );
1068766ce4d0SZheng Fan }
1069766ce4d0SZheng Fan 
1070766ce4d0SZheng Fan //==================================for Paragraph State change=====================
NotifyItemUpdate(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState,const bool bIsEnabled)107145da7d5eSAndre Fischer void ParaPropertyPanel::NotifyItemUpdate(
107245da7d5eSAndre Fischer     sal_uInt16 nSID,
107345da7d5eSAndre Fischer     SfxItemState eState,
107445da7d5eSAndre Fischer     const SfxPoolItem* pState,
107545da7d5eSAndre Fischer     const bool bIsEnabled)
107645da7d5eSAndre Fischer {
107745da7d5eSAndre Fischer     (void)bIsEnabled;
1078766ce4d0SZheng Fan 
1079af89ca6eSOliver-Rainer Wittmann     switch (nSID)
1080af89ca6eSOliver-Rainer Wittmann     {
1081af89ca6eSOliver-Rainer Wittmann     case SID_ATTR_METRIC:
1082af89ca6eSOliver-Rainer Wittmann         {
1083af89ca6eSOliver-Rainer Wittmann             m_eMetricUnit = GetCurrentUnit(eState,pState);
1084af89ca6eSOliver-Rainer Wittmann             if( m_eMetricUnit!=m_last_eMetricUnit )
1085af89ca6eSOliver-Rainer Wittmann             {
1086b6ab65a3SAndre Fischer                 SetFieldUnit( *mpLeftIndent, m_eMetricUnit );
1087b6ab65a3SAndre Fischer                 SetFieldUnit( *mpRightIndent, m_eMetricUnit );
1088b6ab65a3SAndre Fischer                 SetFieldUnit( *mpFLineIndent, m_eMetricUnit );
1089b6ab65a3SAndre Fischer                 SetFieldUnit( *mpTopDist, m_eMetricUnit );
1090b6ab65a3SAndre Fischer                 SetFieldUnit( *mpBottomDist, m_eMetricUnit );
1091af89ca6eSOliver-Rainer Wittmann             }
1092af89ca6eSOliver-Rainer Wittmann             m_last_eMetricUnit = m_eMetricUnit;
1093af89ca6eSOliver-Rainer Wittmann         }
1094af89ca6eSOliver-Rainer Wittmann         break;
1095766ce4d0SZheng Fan 
1096af89ca6eSOliver-Rainer Wittmann     case SID_ATTR_PARA_LRSPACE:
1097af89ca6eSOliver-Rainer Wittmann         StateChangedIndentImpl( nSID, eState, pState );
1098af89ca6eSOliver-Rainer Wittmann         break;
1099766ce4d0SZheng Fan 
1100af89ca6eSOliver-Rainer Wittmann     case SID_ATTR_PARA_LINESPACE:
1101af89ca6eSOliver-Rainer Wittmann         StateChangedLnSPImpl( nSID, eState, pState );
1102af89ca6eSOliver-Rainer Wittmann         break;
1103766ce4d0SZheng Fan 
1104af89ca6eSOliver-Rainer Wittmann     case SID_ATTR_PARA_ULSPACE:
1105af89ca6eSOliver-Rainer Wittmann         StateChangedULImpl( nSID, eState, pState );
1106af89ca6eSOliver-Rainer Wittmann         break;
1107766ce4d0SZheng Fan 
1108af89ca6eSOliver-Rainer Wittmann     case SID_ATTR_PARA_ADJUST_LEFT:
1109af89ca6eSOliver-Rainer Wittmann     case SID_ATTR_PARA_ADJUST_CENTER:
1110af89ca6eSOliver-Rainer Wittmann     case SID_ATTR_PARA_ADJUST_RIGHT:
1111af89ca6eSOliver-Rainer Wittmann     case SID_ATTR_PARA_ADJUST_BLOCK:
1112af89ca6eSOliver-Rainer Wittmann         StateChangedAlignmentImpl( nSID, eState, pState );
1113af89ca6eSOliver-Rainer Wittmann         break;
1114766ce4d0SZheng Fan 
1115af89ca6eSOliver-Rainer Wittmann     case SID_OUTLINE_LEFT:
1116af89ca6eSOliver-Rainer Wittmann     case SID_OUTLINE_RIGHT:
1117af89ca6eSOliver-Rainer Wittmann         StateChangeOutLineImpl( nSID, eState, pState );
1118af89ca6eSOliver-Rainer Wittmann         break;
1119766ce4d0SZheng Fan 
1120af89ca6eSOliver-Rainer Wittmann     case SID_INC_INDENT:
1121af89ca6eSOliver-Rainer Wittmann     case SID_DEC_INDENT:
1122af89ca6eSOliver-Rainer Wittmann         StateChangeIncDecImpl( nSID, eState, pState );
1123af89ca6eSOliver-Rainer Wittmann         break;
1124af89ca6eSOliver-Rainer Wittmann 
1125af89ca6eSOliver-Rainer Wittmann     case FN_NUM_NUMBERING_ON:
1126af89ca6eSOliver-Rainer Wittmann     case FN_NUM_BULLET_ON:
1127af89ca6eSOliver-Rainer Wittmann         StateChangeBulletNumImpl( nSID, eState, pState );
1128af89ca6eSOliver-Rainer Wittmann         break;
1129af89ca6eSOliver-Rainer Wittmann 
1130af89ca6eSOliver-Rainer Wittmann     case FN_BUL_NUM_RULE_INDEX:
1131af89ca6eSOliver-Rainer Wittmann     case FN_NUM_NUM_RULE_INDEX:
1132af89ca6eSOliver-Rainer Wittmann         StateChangeBulletNumRuleImpl( nSID, eState, pState );
1133af89ca6eSOliver-Rainer Wittmann         break;
1134af89ca6eSOliver-Rainer Wittmann 
1135af89ca6eSOliver-Rainer Wittmann     case SID_TABLE_VERT_NONE:
1136af89ca6eSOliver-Rainer Wittmann     case SID_TABLE_VERT_CENTER:
1137af89ca6eSOliver-Rainer Wittmann     case SID_TABLE_VERT_BOTTOM:
1138af89ca6eSOliver-Rainer Wittmann         VertStateChanged( nSID, eState, pState);
1139af89ca6eSOliver-Rainer Wittmann         break;
1140af89ca6eSOliver-Rainer Wittmann 
1141af89ca6eSOliver-Rainer Wittmann     case SID_BACKGROUND_COLOR:
1142af89ca6eSOliver-Rainer Wittmann         ParaBKGStateChanged(nSID, eState, pState);
1143af89ca6eSOliver-Rainer Wittmann         break;
1144af89ca6eSOliver-Rainer Wittmann     }
1145766ce4d0SZheng Fan }
1146766ce4d0SZheng Fan 
114745da7d5eSAndre Fischer 
114845da7d5eSAndre Fischer 
114945da7d5eSAndre Fischer 
StateChangedAlignmentImpl(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)1150766ce4d0SZheng Fan void ParaPropertyPanel::StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1151766ce4d0SZheng Fan {
1152766ce4d0SZheng Fan 	if( eState >= SFX_ITEM_AVAILABLE )
1153766ce4d0SZheng Fan 	{
1154766ce4d0SZheng Fan 		const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
1155766ce4d0SZheng Fan 		bool IsChecked = (bool)pItem->GetValue();
1156766ce4d0SZheng Fan 		switch (nSID)
1157766ce4d0SZheng Fan 		{
1158766ce4d0SZheng Fan 		case SID_ATTR_PARA_ADJUST_LEFT:
1159766ce4d0SZheng Fan 			{
1160766ce4d0SZheng Fan 				if(IsChecked)
1161766ce4d0SZheng Fan 				{
1162b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_CHECK);
1163b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1164b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1165b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1166766ce4d0SZheng Fan 				}
1167766ce4d0SZheng Fan 				else
1168b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1169766ce4d0SZheng Fan 			}
1170766ce4d0SZheng Fan 			break;
1171766ce4d0SZheng Fan 		case SID_ATTR_PARA_ADJUST_CENTER:
1172766ce4d0SZheng Fan 			{
1173766ce4d0SZheng Fan 				if(IsChecked)
1174766ce4d0SZheng Fan 				{
1175b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_CHECK);
1176b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1177b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1178b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1179766ce4d0SZheng Fan 				}
1180766ce4d0SZheng Fan 				else
1181b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1182766ce4d0SZheng Fan 			}
1183766ce4d0SZheng Fan 			break;
1184766ce4d0SZheng Fan 		case SID_ATTR_PARA_ADJUST_RIGHT:
1185766ce4d0SZheng Fan 			{
1186766ce4d0SZheng Fan 				if(IsChecked)
1187766ce4d0SZheng Fan 				{
1188b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_CHECK);
1189b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1190b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1191b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1192766ce4d0SZheng Fan 				}
1193766ce4d0SZheng Fan 				else
1194b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1195766ce4d0SZheng Fan 			}
1196766ce4d0SZheng Fan 			break;
1197766ce4d0SZheng Fan 		case SID_ATTR_PARA_ADJUST_BLOCK:
1198766ce4d0SZheng Fan 			{
1199766ce4d0SZheng Fan 				if(IsChecked)
1200766ce4d0SZheng Fan 				{
1201b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_CHECK);
1202b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1203b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1204b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1205766ce4d0SZheng Fan 				}
1206766ce4d0SZheng Fan 				else
1207b6ab65a3SAndre Fischer 					mpAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1208766ce4d0SZheng Fan 			}
1209766ce4d0SZheng Fan 			break;
1210766ce4d0SZheng Fan 		}
1211766ce4d0SZheng Fan 	}
1212766ce4d0SZheng Fan 	else if( eState == SFX_ITEM_DISABLED )
1213766ce4d0SZheng Fan 	{
1214766ce4d0SZheng Fan 	}
1215766ce4d0SZheng Fan 	else if ( eState == SFX_ITEM_DONTCARE )
1216766ce4d0SZheng Fan 	{
1217766ce4d0SZheng Fan 		switch (nSID)
1218766ce4d0SZheng Fan 		{
1219766ce4d0SZheng Fan 		case SID_ATTR_PARA_ADJUST_LEFT:
1220b6ab65a3SAndre Fischer 			mpAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1221766ce4d0SZheng Fan 			break;
1222766ce4d0SZheng Fan 		case SID_ATTR_PARA_ADJUST_CENTER:
1223b6ab65a3SAndre Fischer 			mpAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1224766ce4d0SZheng Fan 			break;
1225766ce4d0SZheng Fan 		case SID_ATTR_PARA_ADJUST_RIGHT:
1226b6ab65a3SAndre Fischer 			mpAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1227766ce4d0SZheng Fan 			break;
1228766ce4d0SZheng Fan 		case SID_ATTR_PARA_ADJUST_BLOCK:
1229b6ab65a3SAndre Fischer 			mpAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1230766ce4d0SZheng Fan 			break;
1231766ce4d0SZheng Fan 		}
1232766ce4d0SZheng Fan 	}
1233766ce4d0SZheng Fan }
1234766ce4d0SZheng Fan 
StateChangedIndentImpl(sal_uInt16,SfxItemState eState,const SfxPoolItem * pState)12351715803bSPavel Janík void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState )
1236766ce4d0SZheng Fan {
12378eda4adfSOliver-Rainer Wittmann     switch (maContext.GetCombinedContext_DI())
12388eda4adfSOliver-Rainer Wittmann     {
1239766ce4d0SZheng Fan 
12408eda4adfSOliver-Rainer Wittmann     case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
12418eda4adfSOliver-Rainer Wittmann     case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
12428eda4adfSOliver-Rainer Wittmann     case CombinedEnumContext(Application_Calc, Context_DrawText):
12438eda4adfSOliver-Rainer Wittmann         {
1244b6ab65a3SAndre Fischer             mpLeftIndent->SetMin( DEFAULT_VALUE );
1245b6ab65a3SAndre Fischer             mpRightIndent->SetMin( DEFAULT_VALUE );
1246b6ab65a3SAndre Fischer             mpFLineIndent->SetMin( DEFAULT_VALUE );
1247b6ab65a3SAndre Fischer             mpTbxIndent_IncDec->Show();
1248b6ab65a3SAndre Fischer             mpTbxProDemote->Hide();
12498eda4adfSOliver-Rainer Wittmann         }
12508eda4adfSOliver-Rainer Wittmann         break;
12518eda4adfSOliver-Rainer Wittmann     case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
12528eda4adfSOliver-Rainer Wittmann     case CombinedEnumContext(Application_DrawImpress, Context_Draw):
12538eda4adfSOliver-Rainer Wittmann     case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
12548eda4adfSOliver-Rainer Wittmann     case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
12558eda4adfSOliver-Rainer Wittmann     case CombinedEnumContext(Application_DrawImpress, Context_Table):
12568eda4adfSOliver-Rainer Wittmann         {
1257b6ab65a3SAndre Fischer             mpLeftIndent->SetMin( DEFAULT_VALUE );
1258b6ab65a3SAndre Fischer             mpRightIndent->SetMin( DEFAULT_VALUE );
1259b6ab65a3SAndre Fischer             mpFLineIndent->SetMin( DEFAULT_VALUE );
1260b6ab65a3SAndre Fischer             mpTbxIndent_IncDec->Hide();
1261b6ab65a3SAndre Fischer             mpTbxProDemote->Show();
12628eda4adfSOliver-Rainer Wittmann         }
12638eda4adfSOliver-Rainer Wittmann         break;
12648eda4adfSOliver-Rainer Wittmann     case CombinedEnumContext(Application_WriterVariants, Context_Default):
12658eda4adfSOliver-Rainer Wittmann     case CombinedEnumContext(Application_WriterVariants, Context_Text):
12668eda4adfSOliver-Rainer Wittmann     case CombinedEnumContext(Application_WriterVariants, Context_Table):
12678eda4adfSOliver-Rainer Wittmann         {
1268b6ab65a3SAndre Fischer             mpLeftIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
1269b6ab65a3SAndre Fischer             mpRightIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
1270b6ab65a3SAndre Fischer             mpFLineIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
1271b6ab65a3SAndre Fischer             mpTbxIndent_IncDec->Show();
1272b6ab65a3SAndre Fischer             mpTbxProDemote->Hide();
12738eda4adfSOliver-Rainer Wittmann         }
12748eda4adfSOliver-Rainer Wittmann         break;
12758eda4adfSOliver-Rainer Wittmann     }
1276766ce4d0SZheng Fan 
12778eda4adfSOliver-Rainer Wittmann     if( pState && eState >= SFX_ITEM_AVAILABLE )
12788eda4adfSOliver-Rainer Wittmann     {
12798eda4adfSOliver-Rainer Wittmann         SvxLRSpaceItem* pSpace = ( SvxLRSpaceItem*)pState;
12808eda4adfSOliver-Rainer Wittmann         maTxtLeft = pSpace->GetTxtLeft();
12818eda4adfSOliver-Rainer Wittmann         maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
12828eda4adfSOliver-Rainer Wittmann         maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
12838eda4adfSOliver-Rainer Wittmann 
12848eda4adfSOliver-Rainer Wittmann         long aTxtRight = pSpace->GetRight();
12858eda4adfSOliver-Rainer Wittmann         aTxtRight = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
12868eda4adfSOliver-Rainer Wittmann         aTxtRight = OutputDevice::LogicToLogic( aTxtRight, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
12878eda4adfSOliver-Rainer Wittmann 
12888eda4adfSOliver-Rainer Wittmann         long aTxtFirstLineOfst = pSpace->GetTxtFirstLineOfst();
12898eda4adfSOliver-Rainer Wittmann         aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
12908eda4adfSOliver-Rainer Wittmann         aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
12918eda4adfSOliver-Rainer Wittmann 
12928eda4adfSOliver-Rainer Wittmann         long nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1293b6ab65a3SAndre Fischer         nVal = (long)mpLeftIndent->Normalize( (long)nVal );
1294b6ab65a3SAndre Fischer         mpLeftIndent->SetValue( nVal, FUNIT_100TH_MM );
12958eda4adfSOliver-Rainer Wittmann 
12968eda4adfSOliver-Rainer Wittmann         if ( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text)
12978eda4adfSOliver-Rainer Wittmann              && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default)
12988eda4adfSOliver-Rainer Wittmann              && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Table))
12998eda4adfSOliver-Rainer Wittmann         {
1300b6ab65a3SAndre Fischer             mpFLineIndent->SetMin( nVal*(-1), FUNIT_100TH_MM );
13018eda4adfSOliver-Rainer Wittmann         }
1302766ce4d0SZheng Fan 
13038eda4adfSOliver-Rainer Wittmann         long nrVal = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1304b6ab65a3SAndre Fischer         nrVal = (long)mpRightIndent->Normalize( (long)nrVal );
1305b6ab65a3SAndre Fischer         mpRightIndent->SetValue( nrVal, FUNIT_100TH_MM );
1306766ce4d0SZheng Fan 
13078eda4adfSOliver-Rainer Wittmann         long nfVal = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1308b6ab65a3SAndre Fischer         nfVal = (long)mpFLineIndent->Normalize( (long)nfVal );
1309b6ab65a3SAndre Fischer         mpFLineIndent->SetValue( nfVal, FUNIT_100TH_MM );
13108eda4adfSOliver-Rainer Wittmann 
13118eda4adfSOliver-Rainer Wittmann         switch (maContext.GetCombinedContext_DI())
13128eda4adfSOliver-Rainer Wittmann         {
13138eda4adfSOliver-Rainer Wittmann         case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
13148eda4adfSOliver-Rainer Wittmann         case CombinedEnumContext(Application_WriterVariants, Context_Text):
13158eda4adfSOliver-Rainer Wittmann         case CombinedEnumContext(Application_WriterVariants, Context_Default):
13168eda4adfSOliver-Rainer Wittmann         case CombinedEnumContext(Application_WriterVariants, Context_Table):
13178eda4adfSOliver-Rainer Wittmann         case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
13188eda4adfSOliver-Rainer Wittmann             {
1319b6ab65a3SAndre Fischer                 mpLeftIndent->SetMax( MAX_SW - nrVal, FUNIT_100TH_MM );
1320b6ab65a3SAndre Fischer                 mpRightIndent->SetMax( MAX_SW - nVal, FUNIT_100TH_MM );
1321b6ab65a3SAndre Fischer                 mpFLineIndent->SetMax( MAX_SW - nVal - nrVal, FUNIT_100TH_MM );
13228eda4adfSOliver-Rainer Wittmann             }
13238eda4adfSOliver-Rainer Wittmann             break;
13248eda4adfSOliver-Rainer Wittmann         case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
13258eda4adfSOliver-Rainer Wittmann         case CombinedEnumContext(Application_DrawImpress, Context_Draw):
13268eda4adfSOliver-Rainer Wittmann         case CombinedEnumContext(Application_DrawImpress, Context_Table):
13278eda4adfSOliver-Rainer Wittmann         case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
13288eda4adfSOliver-Rainer Wittmann         case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
13298eda4adfSOliver-Rainer Wittmann             {
1330b6ab65a3SAndre Fischer                 mpLeftIndent->SetMax( MAX_SC_SD - nrVal, FUNIT_100TH_MM );
1331b6ab65a3SAndre Fischer                 mpRightIndent->SetMax( MAX_SC_SD - nVal, FUNIT_100TH_MM );
1332b6ab65a3SAndre Fischer                 mpFLineIndent->SetMax( MAX_SC_SD - nVal - nrVal, FUNIT_100TH_MM );
13338eda4adfSOliver-Rainer Wittmann             }
13348eda4adfSOliver-Rainer Wittmann         }
1335766ce4d0SZheng Fan 
1336b6ab65a3SAndre Fischer         mpTbxIndent_IncDec->Enable();
1337b6ab65a3SAndre Fischer         mpTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_True);
13388eda4adfSOliver-Rainer Wittmann         if ( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text)
13398eda4adfSOliver-Rainer Wittmann              && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default)
13408eda4adfSOliver-Rainer Wittmann              && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Table) )
1341eeb4e5d3SOliver-Rainer Wittmann         {
1342b6ab65a3SAndre Fischer             mpTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True);
1343b6ab65a3SAndre Fischer             mpTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True);
1344eeb4e5d3SOliver-Rainer Wittmann         }
1345766ce4d0SZheng Fan 
1346b6ab65a3SAndre Fischer         mpTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True);
13478eda4adfSOliver-Rainer Wittmann     }
13488eda4adfSOliver-Rainer Wittmann     else if( eState == SFX_ITEM_DISABLED )
13498eda4adfSOliver-Rainer Wittmann     {
1350b6ab65a3SAndre Fischer         mpLeftIndent-> Disable();
1351b6ab65a3SAndre Fischer         mpRightIndent->Disable();
1352b6ab65a3SAndre Fischer         mpFLineIndent->Disable();
1353b6ab65a3SAndre Fischer         mpTbxIndent_IncDec->Disable();
13548eda4adfSOliver-Rainer Wittmann         if( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text)  &&
13558eda4adfSOliver-Rainer Wittmann             maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default) &&
13568eda4adfSOliver-Rainer Wittmann             maContext.GetCombinedContext_DI() !=  CombinedEnumContext(Application_WriterVariants, Context_Table) )
1357b6ab65a3SAndre Fischer             mpTbxIndent_IncDec->Disable();
13588eda4adfSOliver-Rainer Wittmann         else
1359b6ab65a3SAndre Fischer             mpTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False);
13608eda4adfSOliver-Rainer Wittmann 
13618eda4adfSOliver-Rainer Wittmann         //		maTbxProDemote->Disable();
1362b6ab65a3SAndre Fischer         mpTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False);
13638eda4adfSOliver-Rainer Wittmann     }
13648eda4adfSOliver-Rainer Wittmann     else
13658eda4adfSOliver-Rainer Wittmann     {
1366b6ab65a3SAndre Fischer         mpLeftIndent->SetEmptyFieldValue();
1367b6ab65a3SAndre Fischer         mpRightIndent->SetEmptyFieldValue();
1368b6ab65a3SAndre Fischer         mpFLineIndent->SetEmptyFieldValue();
13698eda4adfSOliver-Rainer Wittmann         if( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text)  &&
13708eda4adfSOliver-Rainer Wittmann             maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default) &&
13718eda4adfSOliver-Rainer Wittmann             maContext.GetCombinedContext_DI() !=  CombinedEnumContext(Application_WriterVariants, Context_Table) )
1372b6ab65a3SAndre Fischer             mpTbxIndent_IncDec->Disable();
13738eda4adfSOliver-Rainer Wittmann         else
1374b6ab65a3SAndre Fischer             mpTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False);
1375b6ab65a3SAndre Fischer         mpTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False);
13768eda4adfSOliver-Rainer Wittmann     }
1377766ce4d0SZheng Fan }
1378766ce4d0SZheng Fan 
StateChangedLnSPImpl(sal_uInt16,SfxItemState eState,const SfxPoolItem * pState)13791715803bSPavel Janík void ParaPropertyPanel::StateChangedLnSPImpl( sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState )
1380766ce4d0SZheng Fan {
1381766ce4d0SZheng Fan 	meLnSpState = eState;
1382766ce4d0SZheng Fan 
1383766ce4d0SZheng Fan 	if( pState && eState >= SFX_ITEM_AVAILABLE )
1384766ce4d0SZheng Fan 	{
1385766ce4d0SZheng Fan 		if(mpLnSPItem)
1386766ce4d0SZheng Fan 			delete mpLnSPItem;
1387766ce4d0SZheng Fan 		mpLnSPItem = ( SvxLineSpacingItem *)pState->Clone();
1388766ce4d0SZheng Fan 	}
1389766ce4d0SZheng Fan }
1390766ce4d0SZheng Fan 
StateChangedULImpl(sal_uInt16,SfxItemState eState,const SfxPoolItem * pState)13911715803bSPavel Janík void ParaPropertyPanel::StateChangedULImpl( sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState )
1392766ce4d0SZheng Fan {
1393b6ab65a3SAndre Fischer 	mpTopDist->SetMax( mpTopDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) );
1394b6ab65a3SAndre Fischer 	mpBottomDist->SetMax( mpBottomDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) );
1395766ce4d0SZheng Fan 
1396766ce4d0SZheng Fan 	if( pState && eState >= SFX_ITEM_AVAILABLE )
1397766ce4d0SZheng Fan 	{
1398766ce4d0SZheng Fan 		SvxULSpaceItem* pOldItem = (SvxULSpaceItem*)pState;
1399766ce4d0SZheng Fan 
1400766ce4d0SZheng Fan 		maUpper = pOldItem->GetUpper();
1401766ce4d0SZheng Fan 		maUpper = OutputDevice::LogicToLogic( maUpper, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM );
1402766ce4d0SZheng Fan 		maUpper = OutputDevice::LogicToLogic( maUpper, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1403766ce4d0SZheng Fan 
1404766ce4d0SZheng Fan 		maLower = pOldItem->GetLower();
1405766ce4d0SZheng Fan 		maLower = OutputDevice::LogicToLogic( maLower, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM );
1406766ce4d0SZheng Fan 		maLower = OutputDevice::LogicToLogic( maLower, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1407766ce4d0SZheng Fan 
1408766ce4d0SZheng Fan 		sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1409b6ab65a3SAndre Fischer 		nVal = mpTopDist->Normalize( nVal );
1410b6ab65a3SAndre Fischer 		mpTopDist->SetValue( nVal, FUNIT_100TH_MM );
1411766ce4d0SZheng Fan 
1412766ce4d0SZheng Fan 		nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1413b6ab65a3SAndre Fischer 		nVal = mpBottomDist->Normalize( nVal );
1414b6ab65a3SAndre Fischer 		mpBottomDist->SetValue( nVal, FUNIT_100TH_MM );
1415b6ab65a3SAndre Fischer 		mpTbxUL_IncDec->Enable();
1416766ce4d0SZheng Fan 	}
1417512ec161SZheng Fan 	else if(eState == SFX_ITEM_DISABLED )
1418766ce4d0SZheng Fan 	{
1419b6ab65a3SAndre Fischer 		mpTopDist->Disable();
1420b6ab65a3SAndre Fischer 		mpBottomDist->Disable();
1421b6ab65a3SAndre Fischer 		mpTbxUL_IncDec->Disable();
1422766ce4d0SZheng Fan 	}
1423512ec161SZheng Fan 	else
1424766ce4d0SZheng Fan 	{
1425b6ab65a3SAndre Fischer 		mpTopDist->SetEmptyFieldValue();
1426b6ab65a3SAndre Fischer 		mpBottomDist->SetEmptyFieldValue();
1427b6ab65a3SAndre Fischer 		mpTbxUL_IncDec->Disable();
1428766ce4d0SZheng Fan 	}
1429766ce4d0SZheng Fan }
1430766ce4d0SZheng Fan 
StateChangeOutLineImpl(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)1431766ce4d0SZheng Fan void ParaPropertyPanel::StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1432766ce4d0SZheng Fan {
1433766ce4d0SZheng Fan     if (nSID==SID_OUTLINE_LEFT)
1434766ce4d0SZheng Fan 	{
1435766ce4d0SZheng Fan 		if( pState && eState == SFX_ITEM_UNKNOWN )
1436766ce4d0SZheng Fan 			mbOutLineLeft = 1;
1437766ce4d0SZheng Fan 		else
1438766ce4d0SZheng Fan 			mbOutLineLeft = 0;
1439766ce4d0SZheng Fan 	}
1440766ce4d0SZheng Fan 	if (nSID==SID_OUTLINE_RIGHT)
1441766ce4d0SZheng Fan 	{
1442766ce4d0SZheng Fan 		if( pState && eState == SFX_ITEM_UNKNOWN )
1443766ce4d0SZheng Fan 			mbOutLineRight = 1;
1444766ce4d0SZheng Fan 		else
1445766ce4d0SZheng Fan 			mbOutLineRight = 0;
1446766ce4d0SZheng Fan 	}
1447766ce4d0SZheng Fan 	if(mbOutLineLeft)
1448b6ab65a3SAndre Fischer 		mpTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_True);
1449766ce4d0SZheng Fan 	else
1450b6ab65a3SAndre Fischer 		mpTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_False);
1451766ce4d0SZheng Fan 
1452766ce4d0SZheng Fan 	if(mbOutLineRight)
1453b6ab65a3SAndre Fischer 		mpTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_True);
1454766ce4d0SZheng Fan 	else
1455b6ab65a3SAndre Fischer 		mpTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_False);
1456766ce4d0SZheng Fan 
1457766ce4d0SZheng Fan }
1458766ce4d0SZheng Fan 
StateChangeIncDecImpl(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)1459766ce4d0SZheng Fan void ParaPropertyPanel::StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1460766ce4d0SZheng Fan {
14618eda4adfSOliver-Rainer Wittmann     if ( ( maContext.GetCombinedContext_DI() == CombinedEnumContext(Application_WriterVariants, Context_Text)
14628eda4adfSOliver-Rainer Wittmann            || maContext.GetCombinedContext_DI() == CombinedEnumContext(Application_WriterVariants, Context_Default)
14638eda4adfSOliver-Rainer Wittmann            || maContext.GetCombinedContext_DI() ==  CombinedEnumContext(Application_WriterVariants, Context_Table) )
1464eeb4e5d3SOliver-Rainer Wittmann          && ( nSID == SID_INC_INDENT || nSID == SID_DEC_INDENT ) )
1465eeb4e5d3SOliver-Rainer Wittmann     {
1466eeb4e5d3SOliver-Rainer Wittmann         // Writer's text shell is the only one which provides reasonable states for Slots SID_INC_INDENT and SID_DEC_INDENT
1467eeb4e5d3SOliver-Rainer Wittmann         // - namely SFX_ITEM_UNKNOWN and SFX_ITEM_DISABLED
1468b6ab65a3SAndre Fischer         mpTbxIndent_IncDec->EnableItem(
1469eeb4e5d3SOliver-Rainer Wittmann             nSID == SID_INC_INDENT ? BT_TBX_INDENT_INC : BT_TBX_INDENT_DEC,
1470eeb4e5d3SOliver-Rainer Wittmann             ( pState && eState == SFX_ITEM_UNKNOWN ) ? sal_True : sal_False );
1471eeb4e5d3SOliver-Rainer Wittmann     }
1472766ce4d0SZheng Fan }
1473eeb4e5d3SOliver-Rainer Wittmann 
1474eeb4e5d3SOliver-Rainer Wittmann 
147537fee4fdSAndre Fischer // Add toggle state for numbering and bullet icons
StateChangeBulletNumImpl(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)1476766ce4d0SZheng Fan void ParaPropertyPanel::StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1477766ce4d0SZheng Fan {
14787aed46aaSOliver-Rainer Wittmann     if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem)) )
14797aed46aaSOliver-Rainer Wittmann     {
1480af89ca6eSOliver-Rainer Wittmann         const SfxBoolItem* pItem= (const SfxBoolItem*)pState;
1481af89ca6eSOliver-Rainer Wittmann         const sal_Bool aBool = (sal_Bool)pItem->GetValue();
14827aed46aaSOliver-Rainer Wittmann         if (nSID==FN_NUM_NUMBERING_ON)
14837aed46aaSOliver-Rainer Wittmann         {
1484b6ab65a3SAndre Fischer             mpTBxNumBullet->SetItemState(
1485af89ca6eSOliver-Rainer Wittmann                 IID_NUMBER,
1486af89ca6eSOliver-Rainer Wittmann                 aBool ? STATE_CHECK : STATE_NOCHECK );
14877aed46aaSOliver-Rainer Wittmann         }
14887aed46aaSOliver-Rainer Wittmann         else if (nSID==FN_NUM_BULLET_ON)
14897aed46aaSOliver-Rainer Wittmann         {
1490b6ab65a3SAndre Fischer             mpTBxNumBullet->SetItemState(
1491af89ca6eSOliver-Rainer Wittmann                 IID_BULLET,
1492af89ca6eSOliver-Rainer Wittmann                 aBool ? STATE_CHECK : STATE_NOCHECK );
14937aed46aaSOliver-Rainer Wittmann         }
14947aed46aaSOliver-Rainer Wittmann     }
1495766ce4d0SZheng Fan }
14967aed46aaSOliver-Rainer Wittmann 
14977aed46aaSOliver-Rainer Wittmann 
StateChangeBulletNumRuleImpl(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)14987aed46aaSOliver-Rainer Wittmann void ParaPropertyPanel::StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1499766ce4d0SZheng Fan {
15007aed46aaSOliver-Rainer Wittmann     if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxUInt16Item) )
15017aed46aaSOliver-Rainer Wittmann     {
15027aed46aaSOliver-Rainer Wittmann         sal_uInt16 nValue = (sal_uInt16)0xFFFF;
15037aed46aaSOliver-Rainer Wittmann         {
15047aed46aaSOliver-Rainer Wittmann             const SfxUInt16Item* pIt = (const SfxUInt16Item*)pState;
15057aed46aaSOliver-Rainer Wittmann             if ( pIt )
15067aed46aaSOliver-Rainer Wittmann                 nValue = pIt->GetValue();
15077aed46aaSOliver-Rainer Wittmann         }
1508766ce4d0SZheng Fan 
15097aed46aaSOliver-Rainer Wittmann         if ( nSID == FN_BUL_NUM_RULE_INDEX )
15107aed46aaSOliver-Rainer Wittmann         {
15117aed46aaSOliver-Rainer Wittmann             mnBulletTypeIndex = nValue;
15127aed46aaSOliver-Rainer Wittmann         }
15137aed46aaSOliver-Rainer Wittmann         else if ( nSID == FN_NUM_NUM_RULE_INDEX )
15147aed46aaSOliver-Rainer Wittmann         {
15157aed46aaSOliver-Rainer Wittmann             mnNumTypeIndex = nValue;
15167aed46aaSOliver-Rainer Wittmann         }
15177aed46aaSOliver-Rainer Wittmann     }
1518766ce4d0SZheng Fan }
15197aed46aaSOliver-Rainer Wittmann 
15207aed46aaSOliver-Rainer Wittmann 
GetCurrentUnit(SfxItemState eState,const SfxPoolItem * pState)1521766ce4d0SZheng Fan FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState )
1522766ce4d0SZheng Fan {
1523766ce4d0SZheng Fan 	FieldUnit eUnit = FUNIT_NONE;
1524766ce4d0SZheng Fan 
1525766ce4d0SZheng Fan 	if ( pState && eState >= SFX_ITEM_DEFAULT )
1526766ce4d0SZheng Fan 		eUnit = (FieldUnit)( (const SfxUInt16Item*)pState )->GetValue();
1527766ce4d0SZheng Fan 	else
1528766ce4d0SZheng Fan 	{
1529766ce4d0SZheng Fan 		SfxViewFrame* pFrame = SfxViewFrame::Current();
1530766ce4d0SZheng Fan 		SfxObjectShell* pSh = NULL;
1531766ce4d0SZheng Fan 		if ( pFrame )
1532766ce4d0SZheng Fan 			pSh = pFrame->GetObjectShell();
1533766ce4d0SZheng Fan 		if ( pSh )  //the object shell is not always available during reload
1534766ce4d0SZheng Fan 		{
1535766ce4d0SZheng Fan 			SfxModule* pModule = pSh->GetModule();
1536766ce4d0SZheng Fan 			if ( pModule )
1537766ce4d0SZheng Fan 			{
1538766ce4d0SZheng Fan 				const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC );
1539766ce4d0SZheng Fan 				if ( pItem )
1540766ce4d0SZheng Fan 					eUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue();
1541766ce4d0SZheng Fan 			}
1542766ce4d0SZheng Fan 			else
1543766ce4d0SZheng Fan 			{
1544766ce4d0SZheng Fan 				DBG_ERRORFILE( "GetModuleFieldUnit(): no module found" );
1545766ce4d0SZheng Fan 			}
1546766ce4d0SZheng Fan 		}
1547766ce4d0SZheng Fan 	}
1548766ce4d0SZheng Fan 
1549766ce4d0SZheng Fan 	return eUnit;
1550766ce4d0SZheng Fan }
15517aed46aaSOliver-Rainer Wittmann 
1552766ce4d0SZheng Fan 
CreateLineSpacingControl(PopupContainer * pParent)1553766ce4d0SZheng Fan PopupControl* ParaPropertyPanel::CreateLineSpacingControl (PopupContainer* pParent)
1554766ce4d0SZheng Fan {
1555766ce4d0SZheng Fan 	return new ParaLineSpacingControl(pParent, *this);
1556766ce4d0SZheng Fan }
1557766ce4d0SZheng Fan 
CreateBulletsPopupControl(PopupContainer * pParent)1558766ce4d0SZheng Fan PopupControl* ParaPropertyPanel::CreateBulletsPopupControl (PopupContainer* pParent)
1559766ce4d0SZheng Fan {
1560766ce4d0SZheng Fan 	return new ParaBulletsControl(pParent, *this);
1561766ce4d0SZheng Fan }
1562766ce4d0SZheng Fan 
CreateNumberingPopupControl(PopupContainer * pParent)1563766ce4d0SZheng Fan PopupControl* ParaPropertyPanel::CreateNumberingPopupControl (PopupContainer* pParent)
1564766ce4d0SZheng Fan {
1565766ce4d0SZheng Fan 	return new ParaNumberingControl(pParent, *this);
1566766ce4d0SZheng Fan }
1567766ce4d0SZheng Fan 
1568b7a56e95SArmin Le Grand namespace
1569b7a56e95SArmin Le Grand {
GetNoBackgroundColor(void)1570b7a56e95SArmin Le Grand     Color GetNoBackgroundColor(void)
1571b7a56e95SArmin Le Grand     {
1572b7a56e95SArmin Le Grand         return COL_TRANSPARENT;
1573b7a56e95SArmin Le Grand     }
1574b7a56e95SArmin Le Grand } // end of anonymous namespace
1575b7a56e95SArmin Le Grand 
CreateBGColorPopupControl(PopupContainer * pParent)1576766ce4d0SZheng Fan PopupControl* ParaPropertyPanel::CreateBGColorPopupControl (PopupContainer* pParent)
1577766ce4d0SZheng Fan {
1578b7a56e95SArmin Le Grand     const ResId aResId(SVX_RES(STR_NOFILL));
1579b7a56e95SArmin Le Grand 
1580b7a56e95SArmin Le Grand     return new ColorControl(
1581766ce4d0SZheng Fan         pParent,
1582766ce4d0SZheng Fan         mpBindings,
1583b7a56e95SArmin Le Grand         SVX_RES(RID_POPUPPANEL_PARAPAGE_BACK_COLOR),
1584766ce4d0SZheng Fan         SVX_RES(VS_FONT_COLOR),
1585b7a56e95SArmin Le Grand         ::boost::bind(GetNoBackgroundColor),
1586766ce4d0SZheng Fan         ::boost::bind(&ParaPropertyPanel::SetBGColor, this, _1,_2),
1587766ce4d0SZheng Fan         pParent,
1588b7a56e95SArmin Le Grand         &aResId);
1589766ce4d0SZheng Fan }
1590766ce4d0SZheng Fan 
1591766ce4d0SZheng Fan 
ParaPropertyPanel(Window * pParent,const cssu::Reference<css::frame::XFrame> & rxFrame,SfxBindings * pBindings,const cssu::Reference<css::ui::XSidebar> & rxSidebar)1592766ce4d0SZheng Fan ParaPropertyPanel::ParaPropertyPanel(Window* pParent,
15933cac12cfSAndre Fischer     const cssu::Reference<css::frame::XFrame>& rxFrame,
159437fee4fdSAndre Fischer     SfxBindings* pBindings,
159537fee4fdSAndre Fischer     const cssu::Reference<css::ui::XSidebar>& rxSidebar)
159637fee4fdSAndre Fischer     : Control(pParent, SVX_RES(RID_SIDEBAR_PARA_PANEL)),
1597b6ab65a3SAndre Fischer       mpAlignToolBoxBackground(ControlFactory::CreateToolBoxBackground(this)),
1598b6ab65a3SAndre Fischer       mpAlignToolBox (ControlFactory::CreateToolBox(mpAlignToolBoxBackground.get(),SVX_RES(TBX_HORIZONTALALIGNMENT))),
1599b6ab65a3SAndre Fischer       mpTBxVertAlignBackground(ControlFactory::CreateToolBoxBackground(this)),
1600b6ab65a3SAndre Fischer       mpTBxVertAlign (ControlFactory::CreateToolBox(mpTBxVertAlignBackground.get(),SVX_RES(TBX_VERT_ALIGN))),
1601b6ab65a3SAndre Fischer       mpTBxNumBulletBackground(ControlFactory::CreateToolBoxBackground(this)),
1602b6ab65a3SAndre Fischer       mpTBxNumBullet (ControlFactory::CreateToolBox(mpTBxNumBulletBackground.get(),SVX_RES(TBX_NUM_BULLET))),
1603b6ab65a3SAndre Fischer       mpTBxBackColorBackground(ControlFactory::CreateToolBoxBackground(this)),
1604b6ab65a3SAndre Fischer       mpTBxBackColor (ControlFactory::CreateToolBox(mpTBxBackColorBackground.get(),SVX_RES(TBX_BACK_COLOR))),
1605b6ab65a3SAndre Fischer       mpFTUL (new FixedText(this, SVX_RES(FT_SPACING))),
1606b6ab65a3SAndre Fischer       mpTbxUL_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)),
1607b6ab65a3SAndre Fischer       mpTbxUL_IncDec (ControlFactory::CreateToolBox(mpTbxUL_IncDecBackground.get(),SVX_RES(TBX_UL_INC_DEC))),
1608b6ab65a3SAndre Fischer       mpTopDist (new SvxRelativeField(this, SVX_RES(MF_ABOVE_PARASPACING))),
1609b6ab65a3SAndre Fischer       mpBottomDist (new SvxRelativeField(this, SVX_RES(MF_BELOW_PARASPACING))),
1610b6ab65a3SAndre Fischer       mpLineSPTbxBackground(ControlFactory::CreateToolBoxBackground(this)),
1611b6ab65a3SAndre Fischer       mpLineSPTbx (ControlFactory::CreateToolBox(mpLineSPTbxBackground.get(),SVX_RES(TBX_LINESP))),
1612b6ab65a3SAndre Fischer       mpFTIndent (new FixedText(this, SVX_RES(FT_INDENT))),
1613b6ab65a3SAndre Fischer       mpTbxIndent_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)),
1614b6ab65a3SAndre Fischer       mpTbxIndent_IncDec (ControlFactory::CreateToolBox(mpTbxIndent_IncDecBackground.get(),SVX_RES(TBX_INDENT_INC_DEC))),
1615b6ab65a3SAndre Fischer       mpTbxProDemoteBackground(ControlFactory::CreateToolBoxBackground(this)),
1616b6ab65a3SAndre Fischer       mpTbxProDemote (ControlFactory::CreateToolBox(mpTbxProDemoteBackground.get(),SVX_RES(TBX_INDENT_PRO_DEMOTE))),
1617b6ab65a3SAndre Fischer       mpLeftIndent (new SvxRelativeField(this, SVX_RES(MF_BEFORE_INDENT))),
1618b6ab65a3SAndre Fischer       mpRightIndent (new SvxRelativeField(this, SVX_RES(MF_AFTER_INDENT))),
1619b6ab65a3SAndre Fischer       mpFLineIndent (new SvxRelativeField(this, SVX_RES(MF_FL_INDENT))),
1620b6ab65a3SAndre Fischer 
162137fee4fdSAndre Fischer       mpColorUpdater (),
162237fee4fdSAndre Fischer       maFISpace1 ( this, SVX_RES( FI_SPACE1)),
162337fee4fdSAndre Fischer       maFISpace2 ( this, SVX_RES( FI_SPACE2)),
162437fee4fdSAndre Fischer       maFIndent1 ( this, SVX_RES( FI_INDENT1)),
162537fee4fdSAndre Fischer       maFIndent2 ( this, SVX_RES( FI_INDENT2)),
162637fee4fdSAndre Fischer       maFIndent3 ( this, SVX_RES( FI_INDENT3)),
162737fee4fdSAndre Fischer       maSpace1 (SVX_RES(IMG_SPACE1)),
162837fee4fdSAndre Fischer       maSpace2 (SVX_RES(IMG_SPACE2)),
162937fee4fdSAndre Fischer       maSpace3 (SVX_RES(IMG_SPACE3)),
163037fee4fdSAndre Fischer       maIndent1 (SVX_RES(IMG_INDENT1)),
163137fee4fdSAndre Fischer       maIndent2 (SVX_RES(IMG_INDENT2)),
163237fee4fdSAndre Fischer       maIndent3 (SVX_RES(IMG_INDENT3)),
163337fee4fdSAndre Fischer       maIndHang (SVX_RES(IMG_INDENT_HANG)),
163437fee4fdSAndre Fischer       maNumBImageList (SVX_RES(IL_NUM_BULLET)),
163537fee4fdSAndre Fischer       maNumBImageListH (SVX_RES(ILH_NUM_BULLET)),
163637fee4fdSAndre Fischer       maNumBImageListRTL (SVX_RES(IL_NUM_BULLET_RTL)),
163737fee4fdSAndre Fischer       maImgBackColorHigh (SVX_RES(IMG_BACK_COLOR_H)),
163837fee4fdSAndre Fischer       maImgBackColor (SVX_RES(IMG_BACK_COLOR)),
163937fee4fdSAndre Fischer       maTxtLeft (0),
164037fee4fdSAndre Fischer       mpLnSPItem (NULL),
164137fee4fdSAndre Fischer       meLnSpState (SFX_ITEM_DONTCARE),
164237fee4fdSAndre Fischer       mbOutLineLeft (false),
164337fee4fdSAndre Fischer       mbOutLineRight (false),
164437fee4fdSAndre Fischer       maUpper (0),
164537fee4fdSAndre Fischer       maLower (0),
164637fee4fdSAndre Fischer       mnBulletTypeIndex ((sal_uInt16)0xFFFF),
164737fee4fdSAndre Fischer       mnNumTypeIndex ((sal_uInt16)0xFFFF),
164837fee4fdSAndre Fischer       maColor (COL_AUTO),
164937fee4fdSAndre Fischer       mbColorAvailable (true),
165037fee4fdSAndre Fischer       m_eLRSpaceUnit(),
165137fee4fdSAndre Fischer       m_eULSpaceUnit(),
16523cac12cfSAndre Fischer       maLeftAlignControl(SID_ATTR_PARA_ADJUST_LEFT, *pBindings, *this, A2S("LeftPara"), rxFrame),
16533cac12cfSAndre Fischer       maCenterAlignControl(SID_ATTR_PARA_ADJUST_CENTER, *pBindings, *this, A2S("CenterPara"), rxFrame),
16543cac12cfSAndre Fischer       maRightAlignControl(SID_ATTR_PARA_ADJUST_RIGHT, *pBindings, *this, A2S("RightPara"), rxFrame),
16553cac12cfSAndre Fischer       maJustifyAlignControl(SID_ATTR_PARA_ADJUST_BLOCK, *pBindings, *this, A2S("JustifyPara"), rxFrame),
165637fee4fdSAndre Fischer       maLRSpaceControl (SID_ATTR_PARA_LRSPACE,*pBindings,*this),
165737fee4fdSAndre Fischer       maLNSpaceControl (SID_ATTR_PARA_LINESPACE, *pBindings,*this),
165837fee4fdSAndre Fischer       maULSpaceControl (SID_ATTR_PARA_ULSPACE, *pBindings,*this),
16593cac12cfSAndre Fischer       maOutLineLeftControl(SID_OUTLINE_LEFT, *pBindings, *this, A2S("OutlineRight"), rxFrame),
16603cac12cfSAndre Fischer       maOutLineRightControl(SID_OUTLINE_RIGHT, *pBindings, *this, A2S("OutlineLeft"), rxFrame),
16613cac12cfSAndre Fischer       maDecIndentControl(SID_DEC_INDENT, *pBindings,*this, A2S("DecrementIndent"), rxFrame),
16623cac12cfSAndre Fischer       maIncIndentControl(SID_INC_INDENT, *pBindings,*this, A2S("IncrementIndent"), rxFrame),
16633cac12cfSAndre Fischer       maVertTop (SID_TABLE_VERT_NONE, *pBindings, *this, A2S("CellVertTop"), rxFrame),
16643cac12cfSAndre Fischer       maVertCenter (SID_TABLE_VERT_CENTER, *pBindings,*this, A2S("CellVertCenter"), rxFrame),
16653cac12cfSAndre Fischer       maVertBottom (SID_TABLE_VERT_BOTTOM,*pBindings,*this, A2S("CellVertBottom"), rxFrame),
16663cac12cfSAndre Fischer       maBulletOnOff(FN_NUM_BULLET_ON, *pBindings, *this, A2S("DefaultBullet"), rxFrame),
16673cac12cfSAndre Fischer       maNumberOnOff(FN_NUM_NUMBERING_ON, *pBindings, *this, A2S("DefaultNumbering"), rxFrame),
166837fee4fdSAndre Fischer       maBackColorControl (SID_BACKGROUND_COLOR,	*pBindings,*this),
166937fee4fdSAndre Fischer       m_aMetricCtl (SID_ATTR_METRIC, *pBindings,*this),
167037fee4fdSAndre Fischer       maBulletNumRuleIndex (FN_BUL_NUM_RULE_INDEX, *pBindings,*this),
167137fee4fdSAndre Fischer       maNumNumRuleIndex (FN_NUM_NUM_RULE_INDEX, *pBindings,*this),
16728cdef556SPavel Janík       mxFrame(rxFrame),
167337fee4fdSAndre Fischer       maContext(),
167437fee4fdSAndre Fischer       mpBindings(pBindings),
167537fee4fdSAndre Fischer       maLineSpacePopup(this, ::boost::bind(&ParaPropertyPanel::CreateLineSpacingControl, this, _1)),
167637fee4fdSAndre Fischer       maBulletsPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBulletsPopupControl, this, _1)),
167737fee4fdSAndre Fischer       maNumberingPopup(this, ::boost::bind(&ParaPropertyPanel::CreateNumberingPopupControl, this, _1)),
167837fee4fdSAndre Fischer       maBGColorPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBGColorPopupControl, this, _1)),
16796a606da0SAndre Fischer       mxSidebar(rxSidebar),
16806a606da0SAndre Fischer       maLayouter(*this)
1681766ce4d0SZheng Fan {
1682766ce4d0SZheng Fan 	initial();
16833cac12cfSAndre Fischer 	FreeResource();
16846a606da0SAndre Fischer 
16856a606da0SAndre Fischer     // Setup the grid layouter.
1686*9f6656caSPavel Janík     // const sal_Int32 nMappedImageWidth (Layouter::MapWidth(*this, IMAGE_SIZE));
16876a606da0SAndre Fischer     const sal_Int32 nMappedImageOffset (Layouter::MapWidth(*this, -3));
16886a606da0SAndre Fischer     const sal_Int32 nMappedToolBoxItemWidth (Layouter::MapWidth(*this, TOOLBOX_ITEM_WIDTH));
16896a606da0SAndre Fischer     const sal_Int32 nMappedControlWidth (Layouter::MapWidth(*this, CONTROL_WIDTH -10));
16906a606da0SAndre Fischer 
16916a606da0SAndre Fischer     maLayouter.GetCell(0,0).SetControl(*mpFTUL).SetGridWidth(2);
16926a606da0SAndre Fischer     maLayouter.GetCell(1,0).SetControl(*mpTbxUL_IncDecBackground).SetGridWidth(2).SetFixedWidth();
16936a606da0SAndre Fischer 
16946a606da0SAndre Fischer     maLayouter.GetCell(0,3).SetControl(*mpFTIndent).SetGridWidth(2);
16956a606da0SAndre Fischer     maLayouter.GetCell(1,3,0)
16966a606da0SAndre Fischer         .SetControl(*mpTbxIndent_IncDecBackground)
16976a606da0SAndre Fischer         .SetGridWidth(2).SetFixedWidth();
16986a606da0SAndre Fischer     maLayouter.GetCell(1,3,1)
16996a606da0SAndre Fischer         .SetControl(*mpTbxProDemoteBackground)
17006a606da0SAndre Fischer         .SetGridWidth(2).SetFixedWidth();
17016a606da0SAndre Fischer     maLayouter.GetCell(2,0).SetControl(maFISpace1).SetFixedWidth().SetOffset(nMappedImageOffset);
17026a606da0SAndre Fischer     maLayouter.GetCell(2,1).SetControl(*mpTopDist);
17036a606da0SAndre Fischer     maLayouter.GetCell(3,0).SetControl(maFISpace2).SetFixedWidth().SetOffset(nMappedImageOffset);
17046a606da0SAndre Fischer     maLayouter.GetCell(3,1).SetControl(*mpBottomDist);
17056a606da0SAndre Fischer     maLayouter.GetCell(4,0).SetControl(*mpLineSPTbxBackground).SetGridWidth(2).SetFixedWidth();
17066a606da0SAndre Fischer 
17076a606da0SAndre Fischer     maLayouter.GetCell(2,3).SetControl(maFIndent1).SetFixedWidth().SetOffset(nMappedImageOffset);
17086a606da0SAndre Fischer     maLayouter.GetCell(2,4).SetControl(*mpLeftIndent);
17096a606da0SAndre Fischer     maLayouter.GetCell(3,3).SetControl(maFIndent2).SetFixedWidth().SetOffset(nMappedImageOffset);
17106a606da0SAndre Fischer     maLayouter.GetCell(3,4).SetControl(*mpRightIndent);
17116a606da0SAndre Fischer     maLayouter.GetCell(4,3).SetControl(maFIndent3).SetFixedWidth().SetOffset(nMappedImageOffset);
17126a606da0SAndre Fischer     maLayouter.GetCell(4,4).SetControl(*mpFLineIndent);
17136a606da0SAndre Fischer 
17146a606da0SAndre Fischer     maLayouter.GetColumn(0)
17156a606da0SAndre Fischer         .SetWeight(0)
17166a606da0SAndre Fischer         .SetLeftPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL))
17176a606da0SAndre Fischer         .SetFixedWidth(nMappedToolBoxItemWidth + nMappedImageOffset);
17186a606da0SAndre Fischer     maLayouter.GetColumn(1)
17196a606da0SAndre Fischer         .SetWeight(1)
17206a606da0SAndre Fischer         .SetMinimumWidth(nMappedControlWidth);
17216a606da0SAndre Fischer     maLayouter.GetColumn(2)
17226a606da0SAndre Fischer         .SetWeight(0)
17236a606da0SAndre Fischer         .SetMinimumWidth(Layouter::MapWidth(*this, CONTROL_SPACING_HORIZONTAL));
17246a606da0SAndre Fischer     maLayouter.GetColumn(3)
17256a606da0SAndre Fischer         .SetWeight(0)
17266a606da0SAndre Fischer         .SetFixedWidth(nMappedToolBoxItemWidth + nMappedImageOffset);
17276a606da0SAndre Fischer     maLayouter.GetColumn(4)
17286a606da0SAndre Fischer         .SetWeight(1)
17296a606da0SAndre Fischer         .SetRightPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL))
17306a606da0SAndre Fischer         .SetMinimumWidth(nMappedControlWidth);
17316a606da0SAndre Fischer 
17326a606da0SAndre Fischer     // Make controls that display text handle short widths more
17336a606da0SAndre Fischer     // graceful.
17346a606da0SAndre Fischer     sfx2::sidebar::Layouter::PrepareForLayouting(*mpFTUL);
17356a606da0SAndre Fischer     sfx2::sidebar::Layouter::PrepareForLayouting(*mpFTIndent);
17366a606da0SAndre Fischer 
17376a606da0SAndre Fischer     if (mxSidebar.is())
17386a606da0SAndre Fischer         mxSidebar->requestLayout();
17396a606da0SAndre Fischer 
1740766ce4d0SZheng Fan }
1741766ce4d0SZheng Fan 
174237fee4fdSAndre Fischer } } // end of namespace svx::sidebar
1743