xref: /trunk/main/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx (revision b7a56e9525dbbc7cf6ebaf6f248eafa91bb9b095)
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>
35766ce4d0SZheng Fan #include <sfx2/sidebar/propertypanel.hrc>
36766ce4d0SZheng Fan #include <sfx2/sidebar/ControlFactory.hxx>
37766ce4d0SZheng Fan #include <svx/sidebar/PopupContainer.hxx>
38766ce4d0SZheng Fan #include <sfx2/dispatch.hxx>
39766ce4d0SZheng Fan #include <editeng/colritem.hxx>
40766ce4d0SZheng Fan #include <editeng/brshitem.hxx>
41766ce4d0SZheng Fan #include <editeng/lrspitem.hxx>
42766ce4d0SZheng Fan #include <editeng/ulspitem.hxx>
43766ce4d0SZheng Fan #include <vcl/toolbox.hxx>
44766ce4d0SZheng Fan #include <vcl/fixed.hxx>
45766ce4d0SZheng Fan #include <vcl/svapp.hxx>
46766ce4d0SZheng Fan #include <svx/svxids.hrc>
47766ce4d0SZheng Fan #include <svl/intitem.hxx>
48766ce4d0SZheng Fan #include "svx/dialmgr.hxx"
49766ce4d0SZheng Fan #include <sfx2/objsh.hxx>
50766ce4d0SZheng Fan #include <svtools/unitconv.hxx>
51766ce4d0SZheng Fan #include <boost/bind.hpp>
52766ce4d0SZheng Fan using namespace css;
53766ce4d0SZheng Fan using namespace cssu;
54766ce4d0SZheng Fan using ::sfx2::sidebar::Theme;
55766ce4d0SZheng Fan using ::sfx2::sidebar::ControlFactory;
56766ce4d0SZheng Fan 
57766ce4d0SZheng Fan #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
58766ce4d0SZheng Fan 
59766ce4d0SZheng Fan 
60766ce4d0SZheng Fan namespace svx {namespace sidebar {
61766ce4d0SZheng Fan #define DEFAULT_VALUE          0
62766ce4d0SZheng Fan #define TOOLBOX_ITEM1          1
63766ce4d0SZheng Fan #define TOOLBOX_ITEM2          2
64766ce4d0SZheng Fan #define TOOLBOX_ITEM3          3
65766ce4d0SZheng Fan #define TOOLBOX_ITEM4          4
66766ce4d0SZheng Fan 
67766ce4d0SZheng Fan #define MAX_DURCH             5670
68766ce4d0SZheng Fan 
69766ce4d0SZheng Fan #define INDENT_INCREMENT       1
70766ce4d0SZheng Fan #define INDENT_DECREMENT       2
71766ce4d0SZheng Fan #define INDENT_STEP            706
72766ce4d0SZheng Fan #define UL_STEP                58
73766ce4d0SZheng Fan #define UL_INCREMENT           1
74766ce4d0SZheng Fan #define UL_DECREMENT           2
75766ce4d0SZheng Fan 
76766ce4d0SZheng Fan #define NEGATIVE_MAX_VALUE              -9999
77766ce4d0SZheng Fan #define BEGIN_VALUE            28
78766ce4d0SZheng Fan #define MAX_SW                  1709400
79766ce4d0SZheng Fan #define MAX_SC_SD               116220200
80766ce4d0SZheng Fan #define NEGA_MAXVALUE          -10000000
81766ce4d0SZheng Fan 
82766ce4d0SZheng Fan #define POS_FT_PARA_SPACE                               Point(LogicToPixel(Point(FT_PARA_SPACE_X,FT_PARA_SPACE_Y), MAP_APPFONT))
83766ce4d0SZheng Fan #define POS_FT_PARA_SPACE2                              Point(LogicToPixel(Point(FT_PARA_SPACE_X,FT_PARA_SPACE_Y2), MAP_APPFONT))
84766ce4d0SZheng 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))
85766ce4d0SZheng 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))
86766ce4d0SZheng Fan #define POS_FT_PARA_INDENT                              Point(LogicToPixel(Point(FT_PARA_INDENT_X,FT_PARA_INDENT_Y), MAP_APPFONT))
87766ce4d0SZheng Fan #define POS_FT_PARA_INDENT2                             Point(LogicToPixel(Point(FT_PARA_INDENT_X,FT_PARA_INDENT_Y2), MAP_APPFONT))
88766ce4d0SZheng 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))
89766ce4d0SZheng 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))
90766ce4d0SZheng Fan #define POS_MBX_TOP_DIST                                Point(LogicToPixel(Point(MBX_TOP_DIST_X,MBX_TOP_DIST_Y), MAP_APPFONT))
91766ce4d0SZheng Fan #define POS_MBX_TOP_DIST2                               Point(LogicToPixel(Point(MBX_TOP_DIST_X,MBX_TOP_DIST_Y2), MAP_APPFONT))
92766ce4d0SZheng Fan #define POS_MBX_BOT_DIST                                Point(LogicToPixel(Point(MBX_BOT_DIST_X,MBX_BOT_DIST_Y), MAP_APPFONT))
93766ce4d0SZheng Fan #define POS_MBX_BOT_DIST2                               Point(LogicToPixel(Point(MBX_BOT_DIST_X,MBX_BOT_DIST_Y2), MAP_APPFONT))
94766ce4d0SZheng Fan #define POS_MBX_LEFT_DIST                               Point(LogicToPixel(Point(MBX_LEFT_DIST_X,MBX_LEFT_DIST_Y), MAP_APPFONT))
95766ce4d0SZheng Fan #define POS_MBX_LEFT_DIST2                              Point(LogicToPixel(Point(MBX_LEFT_DIST_X,MBX_LEFT_DIST_Y2), MAP_APPFONT))
96766ce4d0SZheng Fan #define POS_MBX_RIGHT_DIST                              Point(LogicToPixel(Point(MBX_RIGHT_DIST_X,MBX_RIGHT_DIST_Y), MAP_APPFONT))
97766ce4d0SZheng Fan #define POS_MBX_RIGHT_DIST2                             Point(LogicToPixel(Point(MBX_RIGHT_DIST_X,MBX_RIGHT_DIST_Y2), MAP_APPFONT))
98766ce4d0SZheng Fan #define POS_MBX_FLINE_DIST                              Point(LogicToPixel(Point(MBX_FLINE_DIST_X,MBX_FLINE_DIST_Y), MAP_APPFONT))
99766ce4d0SZheng Fan #define POS_MBX_FLINE_DIST2                             Point(LogicToPixel(Point(MBX_FLINE_DIST_X,MBX_FLINE_DIST_Y2), MAP_APPFONT))
100766ce4d0SZheng Fan #define POS_IMG_SPACE1                                  Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE1_Y), MAP_APPFONT))
101766ce4d0SZheng Fan #define POS_IMG_SPACE12                                 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE1_Y2), MAP_APPFONT))
102766ce4d0SZheng Fan #define POS_IMG_SPACE2                                  Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE2_Y), MAP_APPFONT))
103766ce4d0SZheng Fan #define POS_IMG_SPACE22                                 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE2_Y2), MAP_APPFONT))
104766ce4d0SZheng Fan #define POS_IMG_INDENT1                                 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT1_Y), MAP_APPFONT))
105766ce4d0SZheng Fan #define POS_IMG_INDENT12                                Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT1_Y2), MAP_APPFONT))
106766ce4d0SZheng Fan #define POS_IMG_INDENT2                                 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT2_Y), MAP_APPFONT))
107766ce4d0SZheng Fan #define POS_IMG_INDENT22                                Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT2_Y2), MAP_APPFONT))
108766ce4d0SZheng Fan #define POS_IMG_INDENT3                                 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT3_Y), MAP_APPFONT))
109766ce4d0SZheng Fan #define POS_IMG_INDENT32                                Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT3_Y2), MAP_APPFONT))
110766ce4d0SZheng Fan #define TBX_LINE_SPACE                                  Point(LogicToPixel(Point(TBX_LINE_SPACE_X,TBX_LINE_SPACE_Y), MAP_APPFONT))
111766ce4d0SZheng Fan #define TBX_LINE_SPACE2                                 Point(LogicToPixel(Point(TBX_LINE_SPACE_X,TBX_LINE_SPACE_Y2), MAP_APPFONT))
112766ce4d0SZheng Fan 
113766ce4d0SZheng Fan #define LINE_POINT1_WHITE                               Point(LogicToPixel(Point(LINE_X_WHITE,LINE_TOP_Y), MAP_APPFONT))
114766ce4d0SZheng Fan #define LINE_POINT2_WHITE                               Point(LogicToPixel(Point(LINE_X_WHITE,LINE_BOT_Y), MAP_APPFONT))
115766ce4d0SZheng Fan #define LINE_POINT3_WHITE                               Point(LogicToPixel(Point(LINE_X_WHITE,LINE_TOP_Y2), MAP_APPFONT))
116766ce4d0SZheng Fan #define LINE_POINT4_WHITE                               Point(LogicToPixel(Point(LINE_X_WHITE,LINE_BOT_Y2), MAP_APPFONT))
117766ce4d0SZheng Fan 
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 
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):
151766ce4d0SZheng Fan             maTBxVertAlign->Show();
152766ce4d0SZheng Fan             maTBxVertAlignBackground->Show();
153766ce4d0SZheng Fan             maTBxBackColor->Hide();
154766ce4d0SZheng Fan             maTBxBackColorBackground->Hide();
155766ce4d0SZheng Fan             maTBxNumBullet->Hide();
156766ce4d0SZheng Fan             maTBxNumBulletBackground->Hide();
15737fee4fdSAndre Fischer             ReSize(false);
158766ce4d0SZheng Fan             maTbxIndent_IncDec->Show();
159766ce4d0SZheng Fan             maTbxIndent_IncDecBackground->Show();
160766ce4d0SZheng Fan             maTbxProDemote->Hide();
161766ce4d0SZheng Fan             maTbxProDemoteBackground->Hide();
162766ce4d0SZheng Fan             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):
167766ce4d0SZheng Fan             maTBxVertAlign->Hide();
168766ce4d0SZheng Fan             maTBxVertAlignBackground->Hide();
169766ce4d0SZheng Fan             maTBxBackColor->Hide();
170766ce4d0SZheng Fan             maTBxBackColorBackground->Hide();
171766ce4d0SZheng Fan             maTBxNumBullet->Show();
172766ce4d0SZheng Fan             maTBxNumBulletBackground->Show();
17337fee4fdSAndre Fischer             ReSize(true);
174766ce4d0SZheng Fan             maTbxIndent_IncDec->Hide();
175766ce4d0SZheng Fan             maTbxIndent_IncDecBackground->Hide();
176766ce4d0SZheng Fan             maTbxProDemote->Show();
177766ce4d0SZheng Fan             maTbxProDemoteBackground->Show();
178766ce4d0SZheng Fan             break;
17937fee4fdSAndre Fischer 
18037fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
181766ce4d0SZheng Fan             maTBxVertAlign->Show();
182766ce4d0SZheng Fan             maTBxVertAlignBackground->Show();
183766ce4d0SZheng Fan             maTBxBackColor->Hide();
184766ce4d0SZheng Fan             maTBxBackColorBackground->Hide();
185766ce4d0SZheng Fan             maTBxNumBullet->Show();
186766ce4d0SZheng Fan             maTBxNumBulletBackground->Show();
18737fee4fdSAndre Fischer             ReSize(true);
188766ce4d0SZheng Fan             maTbxIndent_IncDec->Hide();
189766ce4d0SZheng Fan             maTbxIndent_IncDecBackground->Hide();
190766ce4d0SZheng Fan             maTbxProDemote->Show();
191766ce4d0SZheng Fan             maTbxProDemoteBackground->Show();
192766ce4d0SZheng Fan             break;
19337fee4fdSAndre Fischer 
19437fee4fdSAndre Fischer         case CombinedEnumContext(Application_DrawImpress, Context_Table):
195766ce4d0SZheng Fan             maTBxVertAlign->Show();
196766ce4d0SZheng Fan             maTBxVertAlignBackground->Show();
197766ce4d0SZheng Fan             maTBxBackColor->Hide();
198766ce4d0SZheng Fan             maTBxBackColorBackground->Hide();
199766ce4d0SZheng Fan             maTBxNumBullet->Show();
200766ce4d0SZheng Fan             maTBxNumBulletBackground->Show();
20137fee4fdSAndre Fischer             ReSize(true);
202766ce4d0SZheng Fan             maTbxIndent_IncDec->Hide();
203766ce4d0SZheng Fan             maTbxIndent_IncDecBackground->Hide();
204766ce4d0SZheng Fan             maTbxProDemote->Show();
205766ce4d0SZheng Fan             maTbxProDemoteBackground->Show();
206766ce4d0SZheng Fan             break;
20737fee4fdSAndre Fischer 
20837fee4fdSAndre Fischer         case CombinedEnumContext(Application_WriterAndWeb, Context_Default):
20937fee4fdSAndre Fischer         case CombinedEnumContext(Application_WriterAndWeb, Context_Text):
210766ce4d0SZheng Fan             maTBxVertAlign->Hide();
211766ce4d0SZheng Fan             maTBxVertAlignBackground->Hide();
212766ce4d0SZheng Fan             maTBxBackColor->Show();
213766ce4d0SZheng Fan             maTBxBackColorBackground->Show();
214766ce4d0SZheng Fan             maTBxNumBullet->Show();
215766ce4d0SZheng Fan 
216766ce4d0SZheng Fan             maTBxNumBulletBackground->Show();
21737fee4fdSAndre Fischer             ReSize(true);
218766ce4d0SZheng Fan             maTbxIndent_IncDec->Show();
219766ce4d0SZheng Fan             maTbxIndent_IncDecBackground->Show();
220766ce4d0SZheng Fan             maTbxProDemote->Hide();
221766ce4d0SZheng Fan             maTbxProDemoteBackground->Hide();
222766ce4d0SZheng Fan             break;
22337fee4fdSAndre Fischer 
22437fee4fdSAndre Fischer         case CombinedEnumContext(Application_WriterAndWeb, Context_Table):
225766ce4d0SZheng Fan             maTBxVertAlign->Show();
226766ce4d0SZheng Fan             maTBxVertAlignBackground->Show();
227766ce4d0SZheng Fan             maTBxBackColor->Show();
228766ce4d0SZheng Fan             maTBxBackColorBackground->Show();
229766ce4d0SZheng Fan             maTBxNumBullet->Show();
230766ce4d0SZheng Fan             maTBxNumBulletBackground->Show();
23137fee4fdSAndre Fischer             ReSize(true);
232766ce4d0SZheng Fan             maTbxIndent_IncDec->Show();
233766ce4d0SZheng Fan             maTbxIndent_IncDecBackground->Show();
234766ce4d0SZheng Fan             maTbxProDemote->Hide();
235766ce4d0SZheng Fan             maTbxProDemoteBackground->Hide();
236766ce4d0SZheng Fan             break;
23737fee4fdSAndre Fischer 
23837fee4fdSAndre Fischer         case CombinedEnumContext(Application_WriterAndWeb, Context_DrawText):
239766ce4d0SZheng Fan             maTBxVertAlign->Show();
240766ce4d0SZheng Fan             maTBxVertAlignBackground->Show();
241766ce4d0SZheng Fan             maTBxBackColor->Hide();
242766ce4d0SZheng Fan             maTBxBackColorBackground->Hide();
243766ce4d0SZheng Fan             maTBxNumBullet->Hide();
244766ce4d0SZheng Fan             maTBxNumBulletBackground->Hide();
24537fee4fdSAndre Fischer             ReSize(false);
246766ce4d0SZheng Fan             maTbxIndent_IncDec->Show();
247766ce4d0SZheng Fan             maTbxIndent_IncDecBackground->Show();
248766ce4d0SZheng Fan             maTbxProDemote->Hide();
249766ce4d0SZheng Fan             maTbxProDemoteBackground->Hide();
250766ce4d0SZheng Fan             break;
25137fee4fdSAndre Fischer 
25237fee4fdSAndre Fischer         case CombinedEnumContext(Application_WriterAndWeb, Context_Annotation):
253766ce4d0SZheng Fan             maTBxVertAlign->Hide();
254766ce4d0SZheng Fan             maTBxVertAlignBackground->Hide();
255766ce4d0SZheng Fan             maTBxBackColor->Hide();
256766ce4d0SZheng Fan             maTBxBackColorBackground->Hide();
257766ce4d0SZheng Fan             maTBxNumBullet->Hide();
258766ce4d0SZheng Fan             maTBxNumBulletBackground->Hide();
25937fee4fdSAndre Fischer             ReSize(false);
260766ce4d0SZheng Fan             maTbxIndent_IncDec->Show();
261766ce4d0SZheng Fan             maTbxIndent_IncDecBackground->Show();
262766ce4d0SZheng Fan             maTbxProDemote->Hide();
263766ce4d0SZheng Fan             maTbxProDemoteBackground->Hide();
264766ce4d0SZheng Fan             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 
289766ce4d0SZheng Fan SfxBindings* ParaPropertyPanel::GetBindings()
290766ce4d0SZheng Fan {
291766ce4d0SZheng Fan     return mpBindings;
292766ce4d0SZheng Fan }
293766ce4d0SZheng Fan 
294766ce4d0SZheng Fan void ParaPropertyPanel::SetupIcons (void)
295766ce4d0SZheng Fan {
296766ce4d0SZheng Fan     if (Theme::GetBoolean(Theme::Bool_UseSymphonyIcons))
297766ce4d0SZheng Fan     {
298766ce4d0SZheng Fan     }
299766ce4d0SZheng Fan     else
300766ce4d0SZheng Fan     {
301766ce4d0SZheng Fan     }
302766ce4d0SZheng Fan }
303766ce4d0SZheng Fan 
304766ce4d0SZheng Fan void ParaPropertyPanel::DataChanged (const DataChangedEvent& rEvent)
305766ce4d0SZheng Fan {
306766ce4d0SZheng Fan     (void)rEvent;
307766ce4d0SZheng Fan 
308766ce4d0SZheng Fan     SetupIcons();
309766ce4d0SZheng Fan }
310766ce4d0SZheng Fan 
311766ce4d0SZheng Fan ParaPropertyPanel::~ParaPropertyPanel()
312766ce4d0SZheng Fan {
313766ce4d0SZheng Fan     delete mpLnSPItem;
314766ce4d0SZheng Fan }
315766ce4d0SZheng Fan 
316766ce4d0SZheng Fan void ParaPropertyPanel::ReSize(bool bSize)
317766ce4d0SZheng Fan {
318766ce4d0SZheng Fan     if(bSize)
319766ce4d0SZheng Fan     {
320766ce4d0SZheng Fan         //Paragraph spacing
321766ce4d0SZheng Fan         maFTUL->SetPosPixel(POS_FT_PARA_SPACE);
322766ce4d0SZheng Fan         maTbxUL_IncDec->SetPosPixel(POS_TBX_PARA_SPACE_INC_DEC);
323766ce4d0SZheng Fan         maTopDist->SetPosPixel(POS_MBX_TOP_DIST);
324766ce4d0SZheng Fan         maBottomDist->SetPosPixel(POS_MBX_BOT_DIST);
325766ce4d0SZheng Fan         //Indent
326766ce4d0SZheng Fan         maFTIndent->SetPosPixel(POS_FT_PARA_INDENT);
327766ce4d0SZheng Fan         maTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC);
328766ce4d0SZheng Fan         maTbxProDemote->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC);
329766ce4d0SZheng Fan         maLeftIndent->SetPosPixel(POS_MBX_LEFT_DIST);
330766ce4d0SZheng Fan         maRightIndent->SetPosPixel(POS_MBX_RIGHT_DIST);
331766ce4d0SZheng Fan         maFLineIndent->SetPosPixel(POS_MBX_FLINE_DIST);
332766ce4d0SZheng Fan         //Line spacing
333766ce4d0SZheng Fan         maLineSPTbx->SetPosPixel(TBX_LINE_SPACE);
334766ce4d0SZheng Fan         //image
335766ce4d0SZheng Fan         maFISpace1.SetPosPixel(POS_IMG_SPACE1);
336766ce4d0SZheng Fan         maFISpace2.SetPosPixel(POS_IMG_SPACE2);
337766ce4d0SZheng Fan         maFIndent1.SetPosPixel(POS_IMG_INDENT1);
338766ce4d0SZheng Fan         maFIndent2.SetPosPixel(POS_IMG_INDENT2);
339766ce4d0SZheng Fan         maFIndent3.SetPosPixel(POS_IMG_INDENT3);
340766ce4d0SZheng Fan         Size aSize(GetOutputSizePixel().Width(),PARA_SECTIONPAGE_HEIGHT);
341766ce4d0SZheng Fan         aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
342766ce4d0SZheng Fan         aSize.setWidth(GetOutputSizePixel().Width());
343766ce4d0SZheng Fan         SetSizePixel(aSize);
344766ce4d0SZheng Fan     }
345766ce4d0SZheng Fan     else
346766ce4d0SZheng Fan     {
347766ce4d0SZheng Fan         //Paragraph spacing
348766ce4d0SZheng Fan         maFTUL->SetPosPixel(POS_FT_PARA_SPACE2);
349766ce4d0SZheng Fan         maTbxUL_IncDec->SetPosPixel(POS_TBX_PARA_SPACE_INC_DEC2);
350766ce4d0SZheng Fan         maTopDist->SetPosPixel(POS_MBX_TOP_DIST2);
351766ce4d0SZheng Fan         maBottomDist->SetPosPixel(POS_MBX_BOT_DIST2);
352766ce4d0SZheng Fan         //Indent
353766ce4d0SZheng Fan         maFTIndent->SetPosPixel(POS_FT_PARA_INDENT2);
354766ce4d0SZheng Fan         maTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC2);
355766ce4d0SZheng Fan         maTbxProDemote->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC2);
356766ce4d0SZheng Fan         maLeftIndent->SetPosPixel(POS_MBX_LEFT_DIST2);
357766ce4d0SZheng Fan         maRightIndent->SetPosPixel(POS_MBX_RIGHT_DIST2);
358766ce4d0SZheng Fan         maFLineIndent->SetPosPixel(POS_MBX_FLINE_DIST2);
359766ce4d0SZheng Fan         //Line spacing
360766ce4d0SZheng Fan         maLineSPTbx->SetPosPixel(TBX_LINE_SPACE2);
361766ce4d0SZheng Fan         //image
362766ce4d0SZheng Fan         maFISpace1.SetPosPixel(POS_IMG_SPACE12);
363766ce4d0SZheng Fan         maFISpace2.SetPosPixel(POS_IMG_SPACE22);
364766ce4d0SZheng Fan         maFIndent1.SetPosPixel(POS_IMG_INDENT12);
365766ce4d0SZheng Fan         maFIndent2.SetPosPixel(POS_IMG_INDENT22);
366766ce4d0SZheng Fan         maFIndent3.SetPosPixel(POS_IMG_INDENT32);
367766ce4d0SZheng Fan         Size aSize(GetOutputSizePixel().Width(),PARA_SECTIONPAGE_HEIGHT_2);
368766ce4d0SZheng Fan         aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
369766ce4d0SZheng Fan         aSize.setWidth(GetOutputSizePixel().Width());
370766ce4d0SZheng Fan         SetSizePixel(aSize);
371766ce4d0SZheng Fan     }
37237fee4fdSAndre Fischer 
37337fee4fdSAndre Fischer     if (mxSidebar.is())
37437fee4fdSAndre Fischer         mxSidebar->requestLayout();
375766ce4d0SZheng Fan }
376766ce4d0SZheng Fan 
377766ce4d0SZheng Fan void ParaPropertyPanel::EndSpacingPopupMode (void)
378766ce4d0SZheng Fan {
379766ce4d0SZheng Fan     maLineSpacePopup.Hide();
380766ce4d0SZheng Fan }
381766ce4d0SZheng Fan 
382766ce4d0SZheng Fan void ParaPropertyPanel::EndBulletsPopupMode (void)
383766ce4d0SZheng Fan {
384766ce4d0SZheng Fan     //maUnderlinePopup.Hide();
385766ce4d0SZheng Fan }
386766ce4d0SZheng Fan 
387766ce4d0SZheng Fan void ParaPropertyPanel::EndNumberingPopupMode (void)
388766ce4d0SZheng Fan {
389766ce4d0SZheng Fan     //maUnderlinePopup.Hide();
390766ce4d0SZheng Fan }
391766ce4d0SZheng Fan 
392766ce4d0SZheng Fan 
393766ce4d0SZheng Fan void ParaPropertyPanel::InitToolBoxAlign()
394766ce4d0SZheng Fan {
395766ce4d0SZheng Fan     maAlignToolBox->SetItemImage(TOOLBOX_ITEM1,maLeftPara);
396766ce4d0SZheng Fan     maAlignToolBox->SetItemImage(TOOLBOX_ITEM2,maCentPara);
397766ce4d0SZheng Fan     maAlignToolBox->SetItemImage(TOOLBOX_ITEM3,maRightPara);
398766ce4d0SZheng Fan     maAlignToolBox->SetItemImage(TOOLBOX_ITEM4,maJusPara);
399766ce4d0SZheng Fan     Link aLink = LINK( this, ParaPropertyPanel, AlignStyleModifyHdl_Impl );
400766ce4d0SZheng Fan     maAlignToolBox->SetSelectHdl( aLink );
401766ce4d0SZheng Fan     Size aTbxSize (maAlignToolBox->CalcWindowSizePixel());
402766ce4d0SZheng Fan     maAlignToolBox->SetOutputSizePixel( aTbxSize );
403766ce4d0SZheng Fan }
404766ce4d0SZheng Fan 
405766ce4d0SZheng Fan void ParaPropertyPanel::InitToolBoxVertAlign()
406766ce4d0SZheng Fan {
407766ce4d0SZheng Fan     InitImageList(maTBxVertAlign, maVertImageList, maVertImageListH);
408766ce4d0SZheng Fan     maTBxVertAlign->SetSelectHdl(LINK(this,ParaPropertyPanel,VertTbxSelectHandler));
409766ce4d0SZheng Fan     Size aTbxSize (maTBxVertAlign->CalcWindowSizePixel());
410766ce4d0SZheng Fan     maTBxVertAlign->SetOutputSizePixel( aTbxSize );
411766ce4d0SZheng Fan }
412766ce4d0SZheng Fan 
413766ce4d0SZheng Fan 
414766ce4d0SZheng Fan void ParaPropertyPanel::InitToolBoxIndent()
415766ce4d0SZheng Fan {
416766ce4d0SZheng Fan     Link aLink = LINK( this, ParaPropertyPanel, ModifyIndentHdl_Impl );
417766ce4d0SZheng Fan     maLeftIndent->SetModifyHdl( aLink );
418766ce4d0SZheng Fan     maRightIndent->SetModifyHdl( aLink );
419766ce4d0SZheng Fan     maFLineIndent->SetModifyHdl( aLink );
420766ce4d0SZheng Fan 
421766ce4d0SZheng Fan     if( Application::GetSettings().GetLayoutRTL())
422766ce4d0SZheng Fan     {
423766ce4d0SZheng Fan         maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM1,maIndInc_BD);
424766ce4d0SZheng Fan         maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM2,maIndDec_BD);
425766ce4d0SZheng Fan     }
426766ce4d0SZheng Fan     else
427766ce4d0SZheng Fan     {
428766ce4d0SZheng Fan         maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM1,maIndInc);
429766ce4d0SZheng Fan         maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM2,maIndDec);
430766ce4d0SZheng Fan     }
431766ce4d0SZheng Fan     maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM3,maIndHang);
432766ce4d0SZheng Fan     aLink = LINK( this, ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl );
433766ce4d0SZheng Fan     maTbxIndent_IncDec->SetSelectHdl(aLink);
434766ce4d0SZheng Fan     m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric();
435766ce4d0SZheng Fan     Size aTbxSize = maTbxIndent_IncDec->CalcWindowSizePixel();
436766ce4d0SZheng Fan     maTbxIndent_IncDec->SetOutputSizePixel( aTbxSize );
437766ce4d0SZheng Fan 
438766ce4d0SZheng Fan     if( Application::GetSettings().GetLayoutRTL())
439766ce4d0SZheng Fan     {
440766ce4d0SZheng Fan         maTbxProDemote->SetItemImage(TOOLBOX_ITEM1,maIndInc_BD);
441766ce4d0SZheng Fan         maTbxProDemote->SetItemImage(TOOLBOX_ITEM2,maIndDec_BD);
442766ce4d0SZheng Fan     }
443766ce4d0SZheng Fan     else
444766ce4d0SZheng Fan     {
445766ce4d0SZheng Fan         maTbxProDemote->SetItemImage(TOOLBOX_ITEM1,maIndInc);
446766ce4d0SZheng Fan         maTbxProDemote->SetItemImage(TOOLBOX_ITEM2,maIndDec);
447766ce4d0SZheng Fan     }
448766ce4d0SZheng Fan     maTbxProDemote->SetItemImage(TOOLBOX_ITEM3,maIndHang);
449766ce4d0SZheng Fan     aLink = LINK( this, ParaPropertyPanel, ClickProDemote_Hdl_Impl );
450766ce4d0SZheng Fan     maTbxProDemote->SetSelectHdl(aLink);
451766ce4d0SZheng Fan     m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric();
452766ce4d0SZheng Fan     aTbxSize = maTbxProDemote->CalcWindowSizePixel();
453766ce4d0SZheng Fan     maTbxProDemote->SetOutputSizePixel( aTbxSize );
454766ce4d0SZheng Fan }
455766ce4d0SZheng Fan 
456766ce4d0SZheng Fan void ParaPropertyPanel::InitToolBoxBGColor()
457766ce4d0SZheng Fan {
458766ce4d0SZheng Fan     mpColorUpdater.reset(new ::svx::ToolboxButtonColorUpdater(SID_BACKGROUND_COLOR, TBI_BACK_COLOR, maTBxBackColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW ));
459766ce4d0SZheng Fan 
460766ce4d0SZheng Fan     maTBxBackColor->SetItemImage(TBI_BACK_COLOR, GetDisplayBackground().GetColor().IsDark()? maImgBackColorHigh : maImgBackColor);
461766ce4d0SZheng Fan     maTBxBackColor->SetItemBits( TBI_BACK_COLOR, maTBxBackColor->GetItemBits( TBI_BACK_COLOR ) | TIB_DROPDOWNONLY );
462766ce4d0SZheng Fan 
463766ce4d0SZheng Fan     Link aLink = LINK(this, ParaPropertyPanel, ToolBoxBackColorDDHandler);
464766ce4d0SZheng Fan     maTBxBackColor->SetDropdownClickHdl ( aLink );
465766ce4d0SZheng Fan     maTBxBackColor->SetSelectHdl ( aLink );
466766ce4d0SZheng Fan     Size aTbxSize (maTBxBackColor->CalcWindowSizePixel());
467766ce4d0SZheng Fan     maTBxBackColor->SetOutputSizePixel( aTbxSize );
468766ce4d0SZheng Fan }
469766ce4d0SZheng Fan 
470766ce4d0SZheng Fan void ParaPropertyPanel::InitToolBoxBulletsNumbering()
471766ce4d0SZheng Fan {
47237fee4fdSAndre Fischer     if( Application::GetSettings().GetLayoutRTL())
473766ce4d0SZheng Fan     {
474766ce4d0SZheng Fan         maTBxNumBullet->SetItemImage( IID_BULLET, maNumBImageListRTL.GetImage( IID_BULLET ) );
475766ce4d0SZheng Fan         maTBxNumBullet->SetItemImage( IID_NUMBER, maNumBImageListRTL.GetImage( IID_NUMBER ) );
476766ce4d0SZheng Fan     }
477766ce4d0SZheng Fan     else
478766ce4d0SZheng Fan         InitImageList(maTBxNumBullet, maNumBImageList, maNumBImageListH);
479766ce4d0SZheng Fan 
480766ce4d0SZheng Fan     maTBxNumBullet->SetDropdownClickHdl(LINK(this,ParaPropertyPanel,NumBTbxDDHandler));
481766ce4d0SZheng Fan     maTBxNumBullet->SetSelectHdl(LINK(this,ParaPropertyPanel,NumBTbxSelectHandler));
482766ce4d0SZheng Fan     Size aTbxSize (maTBxNumBullet->CalcWindowSizePixel());
483766ce4d0SZheng Fan     maTBxNumBullet->SetOutputSizePixel( aTbxSize );
484766ce4d0SZheng Fan }
485766ce4d0SZheng Fan void ParaPropertyPanel::InitToolBoxSpacing()
486766ce4d0SZheng Fan {
487766ce4d0SZheng Fan     Link aLink = LINK( this, ParaPropertyPanel, ULSpaceHdl_Impl );
488766ce4d0SZheng Fan     maTopDist->SetModifyHdl(aLink);
489766ce4d0SZheng Fan     maBottomDist->SetModifyHdl( aLink );
490766ce4d0SZheng Fan 
491766ce4d0SZheng Fan     maTbxUL_IncDec->SetItemImage(TOOLBOX_ITEM1,maParInc);
492766ce4d0SZheng Fan     maTbxUL_IncDec->SetItemImage(TOOLBOX_ITEM2,maParDec);
493766ce4d0SZheng Fan     aLink = LINK( this, ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl );
494766ce4d0SZheng Fan     maTbxUL_IncDec->SetSelectHdl(aLink);
495766ce4d0SZheng Fan     m_eULSpaceUnit = maULSpaceControl.GetCoreMetric();
496766ce4d0SZheng Fan     Size aTbxSize = maTbxUL_IncDec->CalcWindowSizePixel();
497766ce4d0SZheng Fan     maTbxUL_IncDec->SetOutputSizePixel( aTbxSize );
498766ce4d0SZheng Fan }
499766ce4d0SZheng Fan void ParaPropertyPanel::InitToolBoxLineSpacing()
500766ce4d0SZheng Fan {
501766ce4d0SZheng Fan     Link aLink = LINK( this, ParaPropertyPanel, ClickLineSPDropDownHdl_Impl );
502766ce4d0SZheng Fan     maLineSPTbx->SetDropdownClickHdl( aLink );
503766ce4d0SZheng Fan     maLineSPTbx->SetSelectHdl( aLink );     //support keyinput "ENTER"
504766ce4d0SZheng Fan     maLineSPTbx->SetItemBits( TOOLBOX_ITEM1, maLineSPTbx->GetItemBits( TOOLBOX_ITEM1 ) | TIB_DROPDOWNONLY );
505766ce4d0SZheng Fan     maLineSPTbx->SetItemImage(TOOLBOX_ITEM1,maSpace3);
506766ce4d0SZheng Fan     Size aTbxSize = maLineSPTbx->CalcWindowSizePixel();
507766ce4d0SZheng Fan     maLineSPTbx->SetOutputSizePixel( aTbxSize );
508766ce4d0SZheng Fan }
509766ce4d0SZheng Fan 
510766ce4d0SZheng Fan void ParaPropertyPanel::initial()
511766ce4d0SZheng Fan {
51237fee4fdSAndre Fischer     maFTUL->SetBackground(Wallpaper());
51337fee4fdSAndre Fischer     maFTIndent->SetBackground(Wallpaper());
51437fee4fdSAndre Fischer     maFISpace1.SetBackground(Wallpaper());
51537fee4fdSAndre Fischer     maFISpace2.SetBackground(Wallpaper());
51637fee4fdSAndre Fischer     maFIndent1.SetBackground(Wallpaper());
51737fee4fdSAndre Fischer     maFIndent2.SetBackground(Wallpaper());
51837fee4fdSAndre Fischer     maFIndent3.SetBackground(Wallpaper());
51937fee4fdSAndre Fischer 
520766ce4d0SZheng Fan     maFISpace1.SetImage(maSpace1);
521766ce4d0SZheng Fan     maFISpace2.SetImage(maSpace2);
522766ce4d0SZheng Fan     maFIndent1.SetImage(maIndent3);
523766ce4d0SZheng Fan     maFIndent2.SetImage(maIndent2);
524766ce4d0SZheng Fan     maFIndent3.SetImage(maIndent1);
525766ce4d0SZheng Fan 
526766ce4d0SZheng Fan     GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_LEFT,sal_True,sal_False);
527766ce4d0SZheng Fan     GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_CENTER,sal_True,sal_False);
528766ce4d0SZheng Fan     GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_RIGHT,sal_True,sal_False);
529766ce4d0SZheng Fan     GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_BLOCK,sal_True,sal_False);
530766ce4d0SZheng Fan 
531766ce4d0SZheng Fan     //toolbox
532766ce4d0SZheng Fan     SetupIcons();
533766ce4d0SZheng Fan     InitToolBoxAlign();
534766ce4d0SZheng Fan     InitToolBoxVertAlign();
535766ce4d0SZheng Fan     InitToolBoxIndent();
536766ce4d0SZheng Fan     InitToolBoxBGColor();
537766ce4d0SZheng Fan     InitToolBoxBulletsNumbering();
538766ce4d0SZheng Fan     InitToolBoxSpacing();
539766ce4d0SZheng Fan     InitToolBoxLineSpacing();
540766ce4d0SZheng Fan 
541766ce4d0SZheng Fan #ifdef HAS_IA2
542766ce4d0SZheng Fan     maAlignToolBox->SetAccRelationLabeledBy(&maAlignToolBox);
543766ce4d0SZheng Fan     maTBxVertAlign->SetMpSubEditAccLableBy(&maTBxVertAlign);
544766ce4d0SZheng Fan     maTBxNumBullet->SetAccRelationLabeledBy(&maTBxNumBullet);
545766ce4d0SZheng Fan     maTBxBackColor->SetMpSubEditAccLableBy(&maTBxBackColor);
546766ce4d0SZheng Fan     maFTUL->SetAccRelationLabeledBy(&maFTUL);
547766ce4d0SZheng Fan     maTbxUL_IncDec->SetAccRelationLabeledBy(&maTbxUL_IncDec);
548766ce4d0SZheng Fan     maTopDist->SetAccRelationLabeledBy(&maTopDist);
549766ce4d0SZheng Fan     maBottomDist->SetAccRelationLabeledBy(&maBottomDist);
550766ce4d0SZheng Fan     maLineSPTbx->SetAccRelationLabeledBy(&maLineSPTbx);
551766ce4d0SZheng Fan     maFTIndent->SetAccRelationLabeledBy(&maFTIndent);
552766ce4d0SZheng Fan     maTbxIndent_IncDec->SetAccRelationLabeledBy(&maTbxIndent_IncDec);
553766ce4d0SZheng Fan     maTbxProDemote->SetAccRelationLabeledBy(&maTbxProDemote);
554766ce4d0SZheng Fan     maLeftIndent->SetAccRelationLabeledBy(&maLeftIndent);
555766ce4d0SZheng Fan     maRightIndent->SetAccRelationLabeledBy(&maRightIndent);
556766ce4d0SZheng Fan     maFLineIndent->SetAccRelationLabeledBy(&maFLineIndent);
557766ce4d0SZheng Fan     mpColorUpdater->SetAccRelationLabeledBy(&mpColorUpdater);
558766ce4d0SZheng Fan #endif
559766ce4d0SZheng Fan }
560766ce4d0SZheng Fan 
561766ce4d0SZheng Fan void ParaPropertyPanel::InitImageList(::boost::scoped_ptr<ToolBox>& rTbx, ImageList& rImglst, ImageList& rImgHlst)
562766ce4d0SZheng Fan {
563766ce4d0SZheng Fan     sal_Bool bHighContrast = GetDisplayBackground().GetColor().IsDark();
564766ce4d0SZheng Fan 
565766ce4d0SZheng Fan     ImageList& rImgLst = bHighContrast ? rImgHlst : rImglst;
566766ce4d0SZheng Fan 
567766ce4d0SZheng Fan     sal_uInt16 nCount = rTbx->GetItemCount();
568766ce4d0SZheng Fan     for (sal_uInt16 i = 0; i < nCount; i++)
569766ce4d0SZheng Fan     {
570766ce4d0SZheng Fan         sal_uInt16 nId = rTbx->GetItemId(i);
571766ce4d0SZheng Fan         rTbx->SetItemImage( nId, rImgLst.GetImage( nId ) );
572766ce4d0SZheng Fan     }
573766ce4d0SZheng Fan }
574766ce4d0SZheng Fan 
575766ce4d0SZheng Fan //===========================for Numbering & Bullet================================================
576766ce4d0SZheng Fan 
577766ce4d0SZheng Fan 
578766ce4d0SZheng Fan 
579766ce4d0SZheng Fan IMPL_LINK(ParaPropertyPanel, NumBTbxDDHandler, ToolBox*, pToolBox)
580766ce4d0SZheng Fan {
581766ce4d0SZheng Fan     sal_uInt16 nId = pToolBox->GetCurItemId();
582766ce4d0SZheng Fan 
583766ce4d0SZheng Fan     EndTracking();
584766ce4d0SZheng Fan     pToolBox->SetItemDown( nId, sal_True );
585766ce4d0SZheng Fan 
586766ce4d0SZheng Fan     if (nId == 1)
587766ce4d0SZheng Fan     {
588766ce4d0SZheng Fan         maBulletsPopup.UpdateValueSet();
589766ce4d0SZheng Fan         maBulletsPopup.Show(*pToolBox);
590766ce4d0SZheng Fan     }
591766ce4d0SZheng Fan     else if (nId == 2)
592766ce4d0SZheng Fan     {
593766ce4d0SZheng Fan         maNumberingPopup.UpdateValueSet();
594766ce4d0SZheng Fan         maNumberingPopup.Show(*pToolBox);
595766ce4d0SZheng Fan     }
596766ce4d0SZheng Fan     pToolBox->SetItemDown( nId, sal_False );
597766ce4d0SZheng Fan     return 0;
598766ce4d0SZheng Fan }
599766ce4d0SZheng Fan 
600766ce4d0SZheng Fan IMPL_LINK(ParaPropertyPanel, NumBTbxSelectHandler, ToolBox*, pToolBox)
601766ce4d0SZheng Fan {
602766ce4d0SZheng Fan     sal_uInt16 nId = pToolBox->GetCurItemId();
603766ce4d0SZheng Fan     sal_uInt16 nSID = SID_TABLE_VERT_NONE;
604766ce4d0SZheng Fan 
605766ce4d0SZheng Fan     EndTracking();
606766ce4d0SZheng Fan     if (nId == 1)
607766ce4d0SZheng Fan     {
608766ce4d0SZheng Fan         nSID = FN_NUM_BULLET_ON;
609766ce4d0SZheng Fan     }
610766ce4d0SZheng Fan     else if ( nId == 2)
611766ce4d0SZheng Fan     {
612766ce4d0SZheng Fan         nSID = FN_NUM_NUMBERING_ON;
613766ce4d0SZheng Fan     }
614766ce4d0SZheng Fan     SfxBoolItem aBoolItem(nSID, sal_True);
615766ce4d0SZheng Fan     GetBindings()->GetDispatcher()->Execute(nSID, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
616766ce4d0SZheng Fan 
617766ce4d0SZheng Fan     return 0;
618766ce4d0SZheng Fan }
619766ce4d0SZheng Fan 
620766ce4d0SZheng Fan 
621766ce4d0SZheng Fan //================================for Vertical Alignment========================================
622766ce4d0SZheng Fan 
623766ce4d0SZheng Fan 
624766ce4d0SZheng Fan 
625766ce4d0SZheng Fan IMPL_LINK(ParaPropertyPanel, VertTbxSelectHandler, ToolBox*, pToolBox)
626766ce4d0SZheng Fan {
627766ce4d0SZheng Fan     sal_uInt16 nId = pToolBox->GetCurItemId();
628766ce4d0SZheng Fan     sal_uInt16 nSID = SID_TABLE_VERT_NONE;
629766ce4d0SZheng Fan     EndTracking();
630766ce4d0SZheng Fan     if (nId == 1)
631766ce4d0SZheng Fan     {
632766ce4d0SZheng Fan         nSID = SID_TABLE_VERT_NONE;
633766ce4d0SZheng Fan         maTBxVertAlign->SetItemState(1, STATE_CHECK);
634766ce4d0SZheng Fan         maTBxVertAlign->SetItemState(2, STATE_NOCHECK);
635766ce4d0SZheng Fan         maTBxVertAlign->SetItemState(3, STATE_NOCHECK);
636766ce4d0SZheng Fan     }
637766ce4d0SZheng Fan     else if (nId == 2)
638766ce4d0SZheng Fan     {
639766ce4d0SZheng Fan         nSID = SID_TABLE_VERT_CENTER;
640766ce4d0SZheng Fan         maTBxVertAlign->SetItemState(1, STATE_NOCHECK);
641766ce4d0SZheng Fan         maTBxVertAlign->SetItemState(2, STATE_CHECK);
642766ce4d0SZheng Fan         maTBxVertAlign->SetItemState(3, STATE_NOCHECK);
643766ce4d0SZheng Fan     }
644766ce4d0SZheng Fan     else if (nId == 3)
645766ce4d0SZheng Fan     {
646766ce4d0SZheng Fan         nSID = SID_TABLE_VERT_BOTTOM;
647766ce4d0SZheng Fan         maTBxVertAlign->SetItemState(1, STATE_NOCHECK);
648766ce4d0SZheng Fan         maTBxVertAlign->SetItemState(2, STATE_NOCHECK);
649766ce4d0SZheng Fan         maTBxVertAlign->SetItemState(3, STATE_CHECK);
650766ce4d0SZheng Fan     }
651766ce4d0SZheng Fan     SfxBoolItem aBoolItem(nSID, sal_True);
652766ce4d0SZheng Fan     GetBindings()->GetDispatcher()->Execute(nSID, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
653766ce4d0SZheng Fan 
654766ce4d0SZheng Fan     return 0;
655766ce4d0SZheng Fan }
656766ce4d0SZheng Fan 
657766ce4d0SZheng Fan void ParaPropertyPanel::VertStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState)
658766ce4d0SZheng Fan {
659766ce4d0SZheng Fan     if (eState < SFX_ITEM_DONTCARE)
660766ce4d0SZheng Fan     {
661766ce4d0SZheng Fan         maTBxVertAlign->SetItemState(1, STATE_NOCHECK);
662766ce4d0SZheng Fan         maTBxVertAlign->SetItemState(2, STATE_NOCHECK);
663766ce4d0SZheng Fan         maTBxVertAlign->SetItemState(3, STATE_NOCHECK);
664766ce4d0SZheng Fan         maTBxVertAlign->EnableItem(1, sal_False);
665766ce4d0SZheng Fan         maTBxVertAlign->EnableItem(2, sal_False);
666766ce4d0SZheng Fan         maTBxVertAlign->EnableItem(3, sal_False);
667766ce4d0SZheng Fan     }
668766ce4d0SZheng Fan     else
669766ce4d0SZheng Fan     {
670766ce4d0SZheng Fan         maTBxVertAlign->EnableItem(1, sal_True);
671766ce4d0SZheng Fan         maTBxVertAlign->EnableItem(2, sal_True);
672766ce4d0SZheng Fan         maTBxVertAlign->EnableItem(3, sal_True);
673766ce4d0SZheng Fan         if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem)))
674766ce4d0SZheng Fan         {
675766ce4d0SZheng Fan             const SfxBoolItem* pItem= (const SfxBoolItem*)pState;
676766ce4d0SZheng Fan             sal_Bool aBool = (sal_Bool)pItem->GetValue();
677766ce4d0SZheng Fan 
678766ce4d0SZheng Fan             if (aBool)
679766ce4d0SZheng Fan             {
680766ce4d0SZheng Fan                 if (nSID == SID_TABLE_VERT_NONE)
681766ce4d0SZheng Fan                 {
682766ce4d0SZheng Fan                     maTBxVertAlign->SetItemState(1, STATE_CHECK);
683766ce4d0SZheng Fan                     maTBxVertAlign->SetItemState(2, STATE_NOCHECK);
684766ce4d0SZheng Fan                     maTBxVertAlign->SetItemState(3, STATE_NOCHECK);
685766ce4d0SZheng Fan                 }
686766ce4d0SZheng Fan                 else if (nSID == SID_TABLE_VERT_CENTER)
687766ce4d0SZheng Fan                 {
688766ce4d0SZheng Fan                     maTBxVertAlign->SetItemState(1, STATE_NOCHECK);
689766ce4d0SZheng Fan                     maTBxVertAlign->SetItemState(2, STATE_CHECK);
690766ce4d0SZheng Fan                     maTBxVertAlign->SetItemState(3, STATE_NOCHECK);
691766ce4d0SZheng Fan                 }
692766ce4d0SZheng Fan                 else if (nSID == SID_TABLE_VERT_BOTTOM)
693766ce4d0SZheng Fan                 {
694766ce4d0SZheng Fan                     maTBxVertAlign->SetItemState(1, STATE_NOCHECK);
695766ce4d0SZheng Fan                     maTBxVertAlign->SetItemState(2, STATE_NOCHECK);
696766ce4d0SZheng Fan                     maTBxVertAlign->SetItemState(3, STATE_CHECK);
697766ce4d0SZheng Fan                 }
698766ce4d0SZheng Fan             }
699766ce4d0SZheng Fan             else
700766ce4d0SZheng Fan             {
701766ce4d0SZheng Fan                 if (nSID == SID_TABLE_VERT_NONE)
702766ce4d0SZheng Fan                 {
703766ce4d0SZheng Fan                     maTBxVertAlign->SetItemState(1, STATE_NOCHECK);
704766ce4d0SZheng Fan                 }
705766ce4d0SZheng Fan                 else if (nSID == SID_TABLE_VERT_CENTER)
706766ce4d0SZheng Fan                 {
707766ce4d0SZheng Fan                     maTBxVertAlign->SetItemState(2, STATE_NOCHECK);
708766ce4d0SZheng Fan                 }
709766ce4d0SZheng Fan                 else if (nSID == SID_TABLE_VERT_BOTTOM)
710766ce4d0SZheng Fan                 {
711766ce4d0SZheng Fan                     maTBxVertAlign->SetItemState(3, STATE_NOCHECK);
712766ce4d0SZheng Fan                 }
713766ce4d0SZheng Fan             }
714766ce4d0SZheng Fan         }
715766ce4d0SZheng Fan         else
716766ce4d0SZheng Fan         {
717766ce4d0SZheng Fan             maTBxVertAlign->SetItemState(1, STATE_NOCHECK);
718766ce4d0SZheng Fan             maTBxVertAlign->SetItemState(2, STATE_NOCHECK);
719766ce4d0SZheng Fan             maTBxVertAlign->SetItemState(3, STATE_NOCHECK);
720766ce4d0SZheng Fan         }
721766ce4d0SZheng Fan     }
722766ce4d0SZheng Fan }
723766ce4d0SZheng Fan //==================================for Background color=====================
724766ce4d0SZheng Fan 
725766ce4d0SZheng Fan IMPL_LINK(ParaPropertyPanel, ToolBoxBackColorDDHandler,ToolBox*, pToolBox)
726766ce4d0SZheng Fan {
727766ce4d0SZheng Fan     sal_uInt16 nId = pToolBox->GetCurItemId();
728766ce4d0SZheng Fan     OSL_ASSERT(nId == TBI_BACK_COLOR);
729766ce4d0SZheng Fan     if(nId == TBI_BACK_COLOR)
730766ce4d0SZheng Fan     {
731766ce4d0SZheng Fan         pToolBox->SetItemDown( nId, true );
732766ce4d0SZheng Fan         maBGColorPopup.Show(*pToolBox);
733766ce4d0SZheng Fan         maBGColorPopup.SetCurrentColor(maColor, mbColorAvailable);
734766ce4d0SZheng Fan     }
735766ce4d0SZheng Fan     return 0;
736766ce4d0SZheng Fan }
737766ce4d0SZheng Fan 
738766ce4d0SZheng Fan IMPL_LINK( ParaPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
739766ce4d0SZheng Fan {
740766ce4d0SZheng Fan     return 0;
741766ce4d0SZheng Fan }
742766ce4d0SZheng Fan 
743766ce4d0SZheng Fan void ParaPropertyPanel::ShowMenu (void)
744766ce4d0SZheng Fan {
745766ce4d0SZheng Fan     if (mpBindings != NULL)
746766ce4d0SZheng Fan     {
747766ce4d0SZheng Fan         SfxDispatcher* pDispatcher = mpBindings->GetDispatcher();
748766ce4d0SZheng Fan         if (pDispatcher != NULL)
749766ce4d0SZheng Fan             pDispatcher->Execute(SID_PARA_DLG, SFX_CALLMODE_ASYNCHRON);
750766ce4d0SZheng Fan     }
751766ce4d0SZheng Fan }
752766ce4d0SZheng Fan 
7531715803bSPavel Janík void ParaPropertyPanel::ParaBKGStateChanged(sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState)
754766ce4d0SZheng Fan {
755445e496eSZheng Fan     if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem))
756766ce4d0SZheng Fan     {
757445e496eSZheng Fan         const SvxColorItem* pItem =  (const SvxColorItem*)pState;
758445e496eSZheng Fan         maColor = pItem->GetValue();
759766ce4d0SZheng Fan         mbColorAvailable = sal_True;
760766ce4d0SZheng Fan         mpColorUpdater->Update(maColor);
761766ce4d0SZheng Fan     }
762766ce4d0SZheng Fan     else
763766ce4d0SZheng Fan     {
764766ce4d0SZheng Fan         mbColorAvailable = sal_False;
765766ce4d0SZheng Fan         maColor.SetColor(COL_AUTO);
766766ce4d0SZheng Fan         mpColorUpdater->Update(maColor);
767766ce4d0SZheng Fan     }
768766ce4d0SZheng Fan }
769766ce4d0SZheng Fan 
770766ce4d0SZheng Fan void ParaPropertyPanel::SetBGColor (
7711715803bSPavel Janík     const String& /* rsColorName */,
772766ce4d0SZheng Fan     const Color aColor)
773766ce4d0SZheng Fan {
774766ce4d0SZheng Fan     SvxColorItem aColorItem(aColor, SID_BACKGROUND_COLOR);
775766ce4d0SZheng Fan     mpBindings->GetDispatcher()->Execute(SID_BACKGROUND_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
776766ce4d0SZheng Fan     maColor = aColor;
777766ce4d0SZheng Fan }
778766ce4d0SZheng Fan 
779766ce4d0SZheng Fan //==================================for Paragraph Alignment=====================
780766ce4d0SZheng Fan IMPL_LINK( ParaPropertyPanel, AlignStyleModifyHdl_Impl, ToolBox*, pBox )
781766ce4d0SZheng Fan {
782766ce4d0SZheng Fan     switch (pBox->GetCurItemId())
783766ce4d0SZheng Fan     {
784766ce4d0SZheng Fan     case BT_SUBSTLEFT:
785766ce4d0SZheng Fan         {
786766ce4d0SZheng Fan             pBox->SetItemState(BT_SUBSTLEFT,STATE_CHECK);
787766ce4d0SZheng Fan             pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
788766ce4d0SZheng Fan             pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
789766ce4d0SZheng Fan             pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
790766ce4d0SZheng Fan             SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_LEFT,  sal_True );
791766ce4d0SZheng Fan             GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_LEFT, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
792766ce4d0SZheng Fan         }
793766ce4d0SZheng Fan         break;
794766ce4d0SZheng Fan     case BT_SUBSTCENTER:
795766ce4d0SZheng Fan         {
796766ce4d0SZheng Fan             pBox->SetItemState(BT_SUBSTCENTER,STATE_CHECK);
797766ce4d0SZheng Fan             pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
798766ce4d0SZheng Fan             pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
799766ce4d0SZheng Fan             pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
800766ce4d0SZheng Fan             SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True );
801766ce4d0SZheng Fan             GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_CENTER, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
802766ce4d0SZheng Fan         }
803766ce4d0SZheng Fan         break;
804766ce4d0SZheng Fan     case BT_SUBSTRIGHT:
805766ce4d0SZheng Fan         {
806766ce4d0SZheng Fan             pBox->SetItemState(BT_SUBSTRIGHT,STATE_CHECK);
807766ce4d0SZheng Fan             pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
808766ce4d0SZheng Fan             pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
809766ce4d0SZheng Fan             pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
810766ce4d0SZheng Fan             SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True );
811766ce4d0SZheng Fan             GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_RIGHT, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
812766ce4d0SZheng Fan         }
813766ce4d0SZheng Fan         break;
814766ce4d0SZheng Fan     case BT_SUBSTJUSTIFY:
815766ce4d0SZheng Fan         {
816766ce4d0SZheng Fan             pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_CHECK);
817766ce4d0SZheng Fan             pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
818766ce4d0SZheng Fan             pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
819766ce4d0SZheng Fan             pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
820766ce4d0SZheng Fan             SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True );
821766ce4d0SZheng Fan             GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_BLOCK, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
822766ce4d0SZheng Fan         }
823766ce4d0SZheng Fan         break;
824766ce4d0SZheng Fan     }
825766ce4d0SZheng Fan 
826766ce4d0SZheng Fan     return 0;
827766ce4d0SZheng Fan }
828766ce4d0SZheng Fan //==================================for Paragraph Indent=====================
8291715803bSPavel Janík IMPL_LINK( ParaPropertyPanel, ModifyIndentHdl_Impl, SvxRelativeField*, /* pBox */ )
830766ce4d0SZheng Fan {
831512ec161SZheng Fan     SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
832766ce4d0SZheng Fan     aMargin.SetTxtLeft( (const long)GetCoreValue( *maLeftIndent.get(), m_eLRSpaceUnit ) );
833766ce4d0SZheng Fan     aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) );
834766ce4d0SZheng Fan     aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) );
835766ce4d0SZheng Fan 
836766ce4d0SZheng Fan     GetBindings()->GetDispatcher()->Execute(
837512ec161SZheng Fan         SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
838766ce4d0SZheng Fan     return 0;
839766ce4d0SZheng Fan }
840766ce4d0SZheng Fan 
841766ce4d0SZheng Fan IMPL_LINK(ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl, ToolBox *, pControl)
842766ce4d0SZheng Fan {
843766ce4d0SZheng Fan     switch (pControl->GetCurItemId())
844766ce4d0SZheng Fan     {
845766ce4d0SZheng Fan         case INDENT_INCREMENT:
846766ce4d0SZheng Fan         {
847766ce4d0SZheng Fan             switch (maContext.GetCombinedContext())
848766ce4d0SZheng Fan             {
849766ce4d0SZheng Fan                 case CombinedEnumContext(Application_Writer, Context_Default):
850766ce4d0SZheng Fan                 case CombinedEnumContext(Application_Writer, Context_Text):
851766ce4d0SZheng Fan                 case CombinedEnumContext(Application_Writer, Context_Table):
852766ce4d0SZheng Fan                 {
853766ce4d0SZheng Fan                     SfxBoolItem aMargin( SID_INC_INDENT, sal_True );
854766ce4d0SZheng Fan                     GetBindings()->GetDispatcher()->Execute(
855766ce4d0SZheng Fan                         SID_INC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L);
856766ce4d0SZheng Fan                 }
857766ce4d0SZheng Fan                 break;
858766ce4d0SZheng Fan                 default:
859766ce4d0SZheng Fan                 {
860512ec161SZheng Fan                     SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
861766ce4d0SZheng Fan 
862766ce4d0SZheng Fan                     maTxtLeft += INDENT_STEP;
863766ce4d0SZheng Fan                     sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
864766ce4d0SZheng Fan                     nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
865766ce4d0SZheng Fan                     aMargin.SetTxtLeft( (const long)nVal );
866766ce4d0SZheng Fan                     aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) );
867766ce4d0SZheng Fan                     aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) );
868766ce4d0SZheng Fan 
869766ce4d0SZheng Fan                     GetBindings()->GetDispatcher()->Execute(
870512ec161SZheng Fan                         SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
871766ce4d0SZheng Fan                 }
872766ce4d0SZheng Fan             }
873766ce4d0SZheng Fan         }
874766ce4d0SZheng Fan         break;
875766ce4d0SZheng Fan         case INDENT_DECREMENT:
876766ce4d0SZheng Fan         {
877766ce4d0SZheng Fan             switch (maContext.GetCombinedContext())
878766ce4d0SZheng Fan             {
879766ce4d0SZheng Fan                 case CombinedEnumContext(Application_Writer, Context_Default):
880766ce4d0SZheng Fan                 case CombinedEnumContext(Application_Writer, Context_Text):
881766ce4d0SZheng Fan                 case CombinedEnumContext(Application_Writer, Context_Table):
882766ce4d0SZheng Fan                 {
883766ce4d0SZheng Fan                     SfxBoolItem aMargin( SID_DEC_INDENT, sal_True );
884766ce4d0SZheng Fan                     GetBindings()->GetDispatcher()->Execute(
885766ce4d0SZheng Fan                         SID_DEC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L);
886766ce4d0SZheng Fan                 }
887766ce4d0SZheng Fan                 break;
888766ce4d0SZheng Fan                 default:
889766ce4d0SZheng Fan                 {
890766ce4d0SZheng Fan                     if((maTxtLeft - INDENT_STEP) < 0)
891766ce4d0SZheng Fan                         maTxtLeft = DEFAULT_VALUE;
892766ce4d0SZheng Fan                     else
893766ce4d0SZheng Fan                         maTxtLeft -= INDENT_STEP;
894766ce4d0SZheng Fan 
895512ec161SZheng Fan                     SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
896766ce4d0SZheng Fan 
897766ce4d0SZheng Fan                     sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
898766ce4d0SZheng Fan                     nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
899766ce4d0SZheng Fan 
900766ce4d0SZheng Fan                     aMargin.SetTxtLeft( (const long)nVal );
901766ce4d0SZheng Fan                     aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) );
902766ce4d0SZheng Fan                     aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) );
903766ce4d0SZheng Fan 
904766ce4d0SZheng Fan                     GetBindings()->GetDispatcher()->Execute(
905512ec161SZheng Fan                         SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
906766ce4d0SZheng Fan                 }
907766ce4d0SZheng Fan             }
908766ce4d0SZheng Fan         }
909766ce4d0SZheng Fan         break;
910766ce4d0SZheng Fan         case ID_HANGING_INDENT:
911766ce4d0SZheng Fan         {
912512ec161SZheng Fan             SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
913766ce4d0SZheng Fan             aMargin.SetTxtLeft( (const long)GetCoreValue( *maLeftIndent.get(), m_eLRSpaceUnit ) + (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) );
914766ce4d0SZheng Fan             aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) );
915766ce4d0SZheng Fan             aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ))*(-1) );
916766ce4d0SZheng Fan 
917766ce4d0SZheng Fan             GetBindings()->GetDispatcher()->Execute(
918512ec161SZheng Fan                 SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
919766ce4d0SZheng Fan         }
920766ce4d0SZheng Fan         break;
921766ce4d0SZheng Fan     }
922766ce4d0SZheng Fan     return( 0L );
923766ce4d0SZheng Fan }
924766ce4d0SZheng Fan 
925766ce4d0SZheng Fan IMPL_LINK(ParaPropertyPanel, ClickProDemote_Hdl_Impl, ToolBox *, pControl)
926766ce4d0SZheng Fan {
927766ce4d0SZheng Fan     switch (pControl->GetCurItemId())
928766ce4d0SZheng Fan     {
929766ce4d0SZheng Fan         case BT_TBX_INDENT_PROMOTE:
930766ce4d0SZheng Fan         {
931395b75f9SOliver-Rainer Wittmann             GetBindings()->GetDispatcher()->Execute( SID_OUTLINE_RIGHT, SFX_CALLMODE_RECORD );
932766ce4d0SZheng Fan         }
933766ce4d0SZheng Fan         break;
934766ce4d0SZheng Fan         case BT_TBX_INDENT_DEMOTE:
935766ce4d0SZheng Fan         {
936395b75f9SOliver-Rainer Wittmann             GetBindings()->GetDispatcher()->Execute( SID_OUTLINE_LEFT, SFX_CALLMODE_RECORD );
937766ce4d0SZheng Fan         }
938766ce4d0SZheng Fan         break;
939766ce4d0SZheng Fan         case SD_HANGING_INDENT:
940766ce4d0SZheng Fan         {
941512ec161SZheng Fan             SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
942766ce4d0SZheng Fan             aMargin.SetTxtLeft( (const long)GetCoreValue( *maLeftIndent.get(), m_eLRSpaceUnit ) + (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) );
943766ce4d0SZheng Fan             aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) );
944766ce4d0SZheng Fan             aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ))*(-1) );
945766ce4d0SZheng Fan 
946395b75f9SOliver-Rainer Wittmann             GetBindings()->GetDispatcher()->Execute( SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
947766ce4d0SZheng Fan         }
948766ce4d0SZheng Fan         break;
949766ce4d0SZheng Fan     }
950766ce4d0SZheng Fan     return( 0L );
951766ce4d0SZheng Fan }
952766ce4d0SZheng Fan //==================================for Paragraph Line Spacing=====================
953766ce4d0SZheng Fan 
954766ce4d0SZheng Fan IMPL_LINK( ParaPropertyPanel, ClickLineSPDropDownHdl_Impl, ToolBox*, pBox )
955766ce4d0SZheng Fan {
956766ce4d0SZheng Fan 
957766ce4d0SZheng Fan     const sal_uInt16 nId = pBox->GetCurItemId();
958766ce4d0SZheng Fan     OSL_ASSERT(nId == TOOLBOX_ITEM1);
959766ce4d0SZheng Fan     if(nId == TOOLBOX_ITEM1)
960766ce4d0SZheng Fan     {
961766ce4d0SZheng Fan         pBox->SetItemDown( nId, true );
962766ce4d0SZheng Fan         maLineSpacePopup.Rearrange(meLnSpState,m_eMetricUnit,mpLnSPItem,maContext);
963766ce4d0SZheng Fan         maLineSpacePopup.Show(*pBox);
964766ce4d0SZheng Fan 
965766ce4d0SZheng Fan     }
966766ce4d0SZheng Fan     return (0L);
967766ce4d0SZheng Fan }
968766ce4d0SZheng Fan 
969766ce4d0SZheng Fan //==================================for Paragraph Spacing=====================
9701715803bSPavel Janík IMPL_LINK( ParaPropertyPanel, ULSpaceHdl_Impl, SvxRelativeField*, /* pBox */)
971766ce4d0SZheng Fan {
972512ec161SZheng Fan     SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE );
973766ce4d0SZheng Fan     aMargin.SetUpper( (sal_uInt16)GetCoreValue( *maTopDist.get(), m_eULSpaceUnit ) );
974766ce4d0SZheng Fan     aMargin.SetLower( (sal_uInt16)GetCoreValue( *maBottomDist.get(), m_eULSpaceUnit ) );
975766ce4d0SZheng Fan 
976766ce4d0SZheng Fan     GetBindings()->GetDispatcher()->Execute(
977512ec161SZheng Fan         SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
978766ce4d0SZheng Fan     return 0L;
979766ce4d0SZheng Fan }
980766ce4d0SZheng Fan 
981766ce4d0SZheng Fan IMPL_LINK(ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl, ToolBox *, pControl)
982766ce4d0SZheng Fan {
983766ce4d0SZheng Fan     switch (pControl->GetCurItemId())
984766ce4d0SZheng Fan         {
985766ce4d0SZheng Fan         case UL_INCREMENT:
986766ce4d0SZheng Fan              {
987512ec161SZheng Fan                  SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE );
988766ce4d0SZheng Fan 
989766ce4d0SZheng Fan                  maUpper += UL_STEP;
990766ce4d0SZheng Fan                  sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
991766ce4d0SZheng Fan                  nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
992766ce4d0SZheng Fan                  aMargin.SetUpper( (const sal_uInt16)nVal );
993766ce4d0SZheng Fan 
994766ce4d0SZheng Fan                  maLower += UL_STEP;
995766ce4d0SZheng Fan                  nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
996766ce4d0SZheng Fan                  nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
997766ce4d0SZheng Fan                  aMargin.SetLower( (const sal_uInt16)nVal );
998766ce4d0SZheng Fan 
999766ce4d0SZheng Fan                  GetBindings()->GetDispatcher()->Execute(
1000512ec161SZheng Fan                      SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
1001766ce4d0SZheng Fan              }
1002766ce4d0SZheng Fan              break;
1003766ce4d0SZheng Fan         case UL_DECREMENT:
1004766ce4d0SZheng Fan             {
1005512ec161SZheng Fan                  SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE );
1006766ce4d0SZheng Fan 
1007766ce4d0SZheng Fan                  if( maUpper >= UL_STEP )
1008766ce4d0SZheng Fan                  {
1009766ce4d0SZheng Fan                     maUpper -= UL_STEP;
1010766ce4d0SZheng Fan                     sal_Int64   nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1011766ce4d0SZheng Fan                     nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
1012766ce4d0SZheng Fan                     aMargin.SetUpper( (const sal_uInt16)nVal );
1013766ce4d0SZheng Fan                  }
1014766ce4d0SZheng Fan                  else
1015766ce4d0SZheng Fan                     aMargin.SetUpper( DEFAULT_VALUE );
1016766ce4d0SZheng Fan                  if( maLower >= UL_STEP )
1017766ce4d0SZheng Fan                  {
1018766ce4d0SZheng Fan                     maLower -= UL_STEP;
1019766ce4d0SZheng Fan                     sal_Int64   nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1020766ce4d0SZheng Fan                     nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
1021766ce4d0SZheng Fan                     aMargin.SetLower( (const sal_uInt16)nVal );
1022766ce4d0SZheng Fan                  }
1023766ce4d0SZheng Fan                  else
1024766ce4d0SZheng Fan                     aMargin.SetLower( DEFAULT_VALUE );
1025766ce4d0SZheng Fan 
1026766ce4d0SZheng Fan                  GetBindings()->GetDispatcher()->Execute(
1027512ec161SZheng Fan                      SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
1028766ce4d0SZheng Fan             }
1029766ce4d0SZheng Fan             break;
1030766ce4d0SZheng Fan         }
1031766ce4d0SZheng Fan     return( 0L );
1032766ce4d0SZheng Fan }
1033766ce4d0SZheng Fan 
1034766ce4d0SZheng Fan //==================================for Paragraph State change=====================
1035766ce4d0SZheng Fan void ParaPropertyPanel::NotifyItemUpdate( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1036766ce4d0SZheng Fan {
1037766ce4d0SZheng Fan     if( nSID == SID_ATTR_METRIC )
1038766ce4d0SZheng Fan     {
1039766ce4d0SZheng Fan         m_eMetricUnit = GetCurrentUnit(eState,pState);
1040766ce4d0SZheng Fan         if( m_eMetricUnit!=m_last_eMetricUnit )
1041766ce4d0SZheng Fan         {
1042766ce4d0SZheng Fan             SetFieldUnit( *maLeftIndent.get(), m_eMetricUnit );
1043766ce4d0SZheng Fan             SetFieldUnit( *maRightIndent.get(), m_eMetricUnit );
1044766ce4d0SZheng Fan             SetFieldUnit( *maFLineIndent.get(), m_eMetricUnit );
1045766ce4d0SZheng Fan             SetFieldUnit( *maTopDist.get(), m_eMetricUnit );
1046766ce4d0SZheng Fan             SetFieldUnit( *maBottomDist.get(), m_eMetricUnit );
1047766ce4d0SZheng Fan         }
1048766ce4d0SZheng Fan         m_last_eMetricUnit = m_eMetricUnit;
1049766ce4d0SZheng Fan     }
1050766ce4d0SZheng Fan 
1051766ce4d0SZheng Fan     if( nSID == SID_ATTR_PARA_LRSPACE )
1052766ce4d0SZheng Fan         StateChangedIndentImpl( nSID, eState, pState );
1053766ce4d0SZheng Fan 
1054766ce4d0SZheng Fan     if( nSID == SID_ATTR_PARA_LINESPACE )
1055766ce4d0SZheng Fan         StateChangedLnSPImpl( nSID, eState, pState );
1056766ce4d0SZheng Fan 
1057766ce4d0SZheng Fan     if( nSID == SID_ATTR_PARA_ULSPACE)
1058766ce4d0SZheng Fan         StateChangedULImpl( nSID, eState, pState );
1059766ce4d0SZheng Fan 
1060766ce4d0SZheng Fan     if (nSID==SID_ATTR_PARA_ADJUST_LEFT || nSID==SID_ATTR_PARA_ADJUST_CENTER || nSID==SID_ATTR_PARA_ADJUST_RIGHT || nSID==SID_ATTR_PARA_ADJUST_BLOCK)
1061766ce4d0SZheng Fan         StateChangedAlignmentImpl( nSID, eState, pState );
1062766ce4d0SZheng Fan 
1063766ce4d0SZheng Fan     if (nSID==SID_OUTLINE_LEFT || nSID==SID_OUTLINE_RIGHT)
1064766ce4d0SZheng Fan         StateChangeOutLineImpl( nSID, eState, pState );
1065766ce4d0SZheng Fan 
1066766ce4d0SZheng Fan     if (nSID==SID_INC_INDENT || nSID==SID_DEC_INDENT)
1067766ce4d0SZheng Fan         StateChangeIncDecImpl( nSID, eState, pState );
106837fee4fdSAndre Fischer     // Add toggle state for numbering and bullet icons
1069766ce4d0SZheng Fan     if (nSID==FN_NUM_NUMBERING_ON || nSID==FN_NUM_BULLET_ON)
1070766ce4d0SZheng Fan         StateChangeBulletNumImpl( nSID, eState, pState );
1071766ce4d0SZheng Fan 
1072766ce4d0SZheng Fan     //Get the num rule index data of the current selection
1073766ce4d0SZheng Fan     if ( nSID == FN_BUL_NUM_RULE_INDEX ||nSID == FN_NUM_NUM_RULE_INDEX)
1074766ce4d0SZheng Fan         StateChangeBulletNumRuleImpl( nSID, eState, pState );
1075766ce4d0SZheng Fan 
1076766ce4d0SZheng Fan     if ((nSID == SID_TABLE_VERT_NONE)||(nSID == SID_TABLE_VERT_CENTER)||(nSID == SID_TABLE_VERT_BOTTOM))
1077766ce4d0SZheng Fan     {
1078766ce4d0SZheng Fan         VertStateChanged( nSID, eState, pState);
1079766ce4d0SZheng Fan     }
1080766ce4d0SZheng Fan     else if (nSID == SID_BACKGROUND_COLOR)
1081766ce4d0SZheng Fan     {
1082766ce4d0SZheng Fan         ParaBKGStateChanged(nSID, eState, pState);
1083766ce4d0SZheng Fan     }
1084766ce4d0SZheng Fan }
1085766ce4d0SZheng Fan 
1086766ce4d0SZheng Fan void ParaPropertyPanel::StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1087766ce4d0SZheng Fan {
1088766ce4d0SZheng Fan     if( eState >= SFX_ITEM_AVAILABLE )
1089766ce4d0SZheng Fan     {
1090766ce4d0SZheng Fan         const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
1091766ce4d0SZheng Fan         bool IsChecked = (bool)pItem->GetValue();
1092766ce4d0SZheng Fan         switch (nSID)
1093766ce4d0SZheng Fan         {
1094766ce4d0SZheng Fan         case SID_ATTR_PARA_ADJUST_LEFT:
1095766ce4d0SZheng Fan             {
1096766ce4d0SZheng Fan                 if(IsChecked)
1097766ce4d0SZheng Fan                 {
1098766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_CHECK);
1099766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1100766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1101766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1102766ce4d0SZheng Fan                 }
1103766ce4d0SZheng Fan                 else
1104766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1105766ce4d0SZheng Fan             }
1106766ce4d0SZheng Fan             break;
1107766ce4d0SZheng Fan         case SID_ATTR_PARA_ADJUST_CENTER:
1108766ce4d0SZheng Fan             {
1109766ce4d0SZheng Fan                 if(IsChecked)
1110766ce4d0SZheng Fan                 {
1111766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_CHECK);
1112766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1113766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1114766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1115766ce4d0SZheng Fan                 }
1116766ce4d0SZheng Fan                 else
1117766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1118766ce4d0SZheng Fan             }
1119766ce4d0SZheng Fan             break;
1120766ce4d0SZheng Fan         case SID_ATTR_PARA_ADJUST_RIGHT:
1121766ce4d0SZheng Fan             {
1122766ce4d0SZheng Fan                 if(IsChecked)
1123766ce4d0SZheng Fan                 {
1124766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_CHECK);
1125766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1126766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1127766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1128766ce4d0SZheng Fan                 }
1129766ce4d0SZheng Fan                 else
1130766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1131766ce4d0SZheng Fan             }
1132766ce4d0SZheng Fan             break;
1133766ce4d0SZheng Fan         case SID_ATTR_PARA_ADJUST_BLOCK:
1134766ce4d0SZheng Fan             {
1135766ce4d0SZheng Fan                 if(IsChecked)
1136766ce4d0SZheng Fan                 {
1137766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_CHECK);
1138766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1139766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1140766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1141766ce4d0SZheng Fan                 }
1142766ce4d0SZheng Fan                 else
1143766ce4d0SZheng Fan                     maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1144766ce4d0SZheng Fan             }
1145766ce4d0SZheng Fan             break;
1146766ce4d0SZheng Fan         }
1147766ce4d0SZheng Fan     }
1148766ce4d0SZheng Fan     else if( eState == SFX_ITEM_DISABLED )
1149766ce4d0SZheng Fan     {
1150766ce4d0SZheng Fan     }
1151766ce4d0SZheng Fan     else if ( eState == SFX_ITEM_DONTCARE )
1152766ce4d0SZheng Fan     {
1153766ce4d0SZheng Fan         switch (nSID)
1154766ce4d0SZheng Fan         {
1155766ce4d0SZheng Fan         case SID_ATTR_PARA_ADJUST_LEFT:
1156766ce4d0SZheng Fan             maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1157766ce4d0SZheng Fan             break;
1158766ce4d0SZheng Fan         case SID_ATTR_PARA_ADJUST_CENTER:
1159766ce4d0SZheng Fan             maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1160766ce4d0SZheng Fan             break;
1161766ce4d0SZheng Fan         case SID_ATTR_PARA_ADJUST_RIGHT:
1162766ce4d0SZheng Fan             maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1163766ce4d0SZheng Fan             break;
1164766ce4d0SZheng Fan         case SID_ATTR_PARA_ADJUST_BLOCK:
1165766ce4d0SZheng Fan             maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1166766ce4d0SZheng Fan             break;
1167766ce4d0SZheng Fan         }
1168766ce4d0SZheng Fan     }
1169766ce4d0SZheng Fan }
1170766ce4d0SZheng Fan 
11711715803bSPavel Janík void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState )
1172766ce4d0SZheng Fan {
1173766ce4d0SZheng Fan     switch (maContext.GetCombinedContext())
1174766ce4d0SZheng Fan     {
1175766ce4d0SZheng Fan 
1176766ce4d0SZheng Fan         case CombinedEnumContext(Application_Writer, Context_DrawText):
1177766ce4d0SZheng Fan         case CombinedEnumContext(Application_Calc, Context_DrawText):
1178766ce4d0SZheng Fan         case CombinedEnumContext(Application_Writer, Context_Annotation):
1179766ce4d0SZheng Fan         {
1180766ce4d0SZheng Fan             maLeftIndent->SetMin( DEFAULT_VALUE );
1181766ce4d0SZheng Fan             maRightIndent->SetMin( DEFAULT_VALUE );
1182766ce4d0SZheng Fan             maFLineIndent->SetMin( DEFAULT_VALUE );
1183766ce4d0SZheng Fan             maTbxIndent_IncDec->Show();
1184766ce4d0SZheng Fan             maTbxProDemote->Hide();
1185766ce4d0SZheng Fan         }
1186766ce4d0SZheng Fan         break;
1187766ce4d0SZheng Fan         case CombinedEnumContext(Application_Draw, Context_DrawText):
1188766ce4d0SZheng Fan             case CombinedEnumContext(Application_Impress, Context_DrawText):
1189766ce4d0SZheng Fan         case CombinedEnumContext(Application_Draw, Context_Draw):
1190766ce4d0SZheng Fan         case CombinedEnumContext(Application_Draw, Context_TextObject):
1191766ce4d0SZheng Fan         case CombinedEnumContext(Application_Draw, Context_Graphic):
1192766ce4d0SZheng Fan         case CombinedEnumContext(Application_Impress, Context_Draw):
1193766ce4d0SZheng Fan         case CombinedEnumContext(Application_Impress, Context_TextObject):
1194766ce4d0SZheng Fan         case CombinedEnumContext(Application_Impress, Context_Graphic):
1195766ce4d0SZheng Fan         case CombinedEnumContext(Application_Impress, Context_Table):
1196766ce4d0SZheng Fan             case CombinedEnumContext(Application_Draw, Context_Table):
1197766ce4d0SZheng Fan         {
1198766ce4d0SZheng Fan             maLeftIndent->SetMin( DEFAULT_VALUE );
1199766ce4d0SZheng Fan             maRightIndent->SetMin( DEFAULT_VALUE );
1200766ce4d0SZheng Fan             maFLineIndent->SetMin( DEFAULT_VALUE );
1201766ce4d0SZheng Fan             maTbxIndent_IncDec->Hide();
1202766ce4d0SZheng Fan             maTbxProDemote->Show();
1203766ce4d0SZheng Fan         }
1204766ce4d0SZheng Fan         break;
1205766ce4d0SZheng Fan         case CombinedEnumContext(Application_Writer, Context_Default):
1206766ce4d0SZheng Fan         case CombinedEnumContext(Application_Writer, Context_Text):
1207766ce4d0SZheng Fan         case CombinedEnumContext(Application_Writer, Context_Table):
1208766ce4d0SZheng Fan         {
1209766ce4d0SZheng Fan             maLeftIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
1210766ce4d0SZheng Fan             maRightIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
1211766ce4d0SZheng Fan             maFLineIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
1212766ce4d0SZheng Fan             maTbxIndent_IncDec->Show();
1213766ce4d0SZheng Fan             maTbxProDemote->Hide();
1214766ce4d0SZheng Fan         }
1215766ce4d0SZheng Fan         break;
1216766ce4d0SZheng Fan     }
1217766ce4d0SZheng Fan 
1218766ce4d0SZheng Fan     if( pState && eState >= SFX_ITEM_AVAILABLE )
1219766ce4d0SZheng Fan     {
1220766ce4d0SZheng Fan         SvxLRSpaceItem* pSpace = ( SvxLRSpaceItem*)pState;
1221766ce4d0SZheng Fan         maTxtLeft = pSpace->GetTxtLeft();
1222766ce4d0SZheng Fan         maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
1223766ce4d0SZheng Fan         maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1224766ce4d0SZheng Fan 
1225766ce4d0SZheng Fan         long aTxtRight = pSpace->GetRight();
1226766ce4d0SZheng Fan         aTxtRight = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
1227766ce4d0SZheng Fan         aTxtRight = OutputDevice::LogicToLogic( aTxtRight, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1228766ce4d0SZheng Fan 
1229766ce4d0SZheng Fan         long aTxtFirstLineOfst = pSpace->GetTxtFirstLineOfst();
1230766ce4d0SZheng Fan         aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
1231766ce4d0SZheng Fan         aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1232766ce4d0SZheng Fan 
1233766ce4d0SZheng Fan         long nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1234766ce4d0SZheng Fan         nVal = (long)maLeftIndent->Normalize( (long)nVal );
1235766ce4d0SZheng Fan         maLeftIndent->SetValue( nVal, FUNIT_100TH_MM );
1236766ce4d0SZheng Fan 
1237766ce4d0SZheng Fan         if(maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) &&
1238766ce4d0SZheng Fan             maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) &&
1239766ce4d0SZheng Fan             maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table))
1240766ce4d0SZheng Fan         {
1241766ce4d0SZheng Fan             maFLineIndent->SetMin( nVal*(-1), FUNIT_100TH_MM );
1242766ce4d0SZheng Fan         }
1243766ce4d0SZheng Fan 
1244766ce4d0SZheng Fan         long nrVal = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1245766ce4d0SZheng Fan         nrVal = (long)maRightIndent->Normalize( (long)nrVal );
1246766ce4d0SZheng Fan         maRightIndent->SetValue( nrVal, FUNIT_100TH_MM );
1247766ce4d0SZheng Fan 
1248766ce4d0SZheng Fan         long nfVal = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1249766ce4d0SZheng Fan         nfVal = (long)maFLineIndent->Normalize( (long)nfVal );
1250766ce4d0SZheng Fan         maFLineIndent->SetValue( nfVal, FUNIT_100TH_MM );
1251766ce4d0SZheng Fan 
1252766ce4d0SZheng Fan         switch (maContext.GetCombinedContext())
1253766ce4d0SZheng Fan         {
1254766ce4d0SZheng Fan             case CombinedEnumContext(Application_Writer, Context_DrawText):
1255766ce4d0SZheng Fan             case CombinedEnumContext(Application_Writer, Context_Text):
1256766ce4d0SZheng Fan             case CombinedEnumContext(Application_Writer, Context_Default):
1257766ce4d0SZheng Fan             case CombinedEnumContext(Application_Writer, Context_Table):
1258766ce4d0SZheng Fan             case CombinedEnumContext(Application_Writer, Context_Annotation):
1259766ce4d0SZheng Fan             {
1260766ce4d0SZheng Fan                 maLeftIndent->SetMax( MAX_SW - nrVal, FUNIT_100TH_MM );
1261766ce4d0SZheng Fan                 maRightIndent->SetMax( MAX_SW - nVal, FUNIT_100TH_MM );
1262766ce4d0SZheng Fan                 maFLineIndent->SetMax( MAX_SW - nVal - nrVal, FUNIT_100TH_MM );
1263766ce4d0SZheng Fan             }
1264766ce4d0SZheng Fan             break;
1265766ce4d0SZheng Fan             case CombinedEnumContext(Application_Draw, Context_DrawText):
1266766ce4d0SZheng Fan             case CombinedEnumContext(Application_Draw, Context_Draw):
1267766ce4d0SZheng Fan                 case CombinedEnumContext(Application_Draw, Context_Table):
1268766ce4d0SZheng Fan             case CombinedEnumContext(Application_Draw, Context_TextObject):
1269766ce4d0SZheng Fan             case CombinedEnumContext(Application_Draw, Context_Graphic):
1270766ce4d0SZheng Fan             case CombinedEnumContext(Application_Impress, Context_TextObject):
1271766ce4d0SZheng Fan                 case CombinedEnumContext(Application_Impress, Context_DrawText):
1272766ce4d0SZheng Fan             case CombinedEnumContext(Application_Impress, Context_Table):
1273766ce4d0SZheng Fan             case CombinedEnumContext(Application_Impress, Context_Draw):
1274766ce4d0SZheng Fan             case CombinedEnumContext(Application_Impress, Context_Graphic):
1275766ce4d0SZheng Fan             {
1276766ce4d0SZheng Fan                 maLeftIndent->SetMax( MAX_SC_SD - nrVal, FUNIT_100TH_MM );
1277766ce4d0SZheng Fan                 maRightIndent->SetMax( MAX_SC_SD - nVal, FUNIT_100TH_MM );
1278766ce4d0SZheng Fan                 maFLineIndent->SetMax( MAX_SC_SD - nVal - nrVal, FUNIT_100TH_MM );
1279766ce4d0SZheng Fan             }
1280766ce4d0SZheng Fan         }
1281766ce4d0SZheng Fan 
1282766ce4d0SZheng Fan         maTbxIndent_IncDec->Enable();
1283766ce4d0SZheng Fan         maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_True);
1284766ce4d0SZheng Fan         if(maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text)
1285766ce4d0SZheng Fan             && maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default)
1286766ce4d0SZheng Fan             && maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table))
1287766ce4d0SZheng Fan         {
1288766ce4d0SZheng Fan             maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True);
1289766ce4d0SZheng Fan             maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True);
1290766ce4d0SZheng Fan         }
1291766ce4d0SZheng Fan 
12921ff378efSZheng Fan //      maTbxProDemote->Enable();
12931ff378efSZheng Fan //      if( !mbOutLineRight && !mbOutLineLeft )
12941ff378efSZheng Fan //          maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True);
1295766ce4d0SZheng Fan         maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True);
1296766ce4d0SZheng Fan     }
1297766ce4d0SZheng Fan     else if( eState == SFX_ITEM_DISABLED )
1298766ce4d0SZheng Fan     {
1299766ce4d0SZheng Fan         maLeftIndent-> Disable();
1300766ce4d0SZheng Fan         maRightIndent->Disable();
1301766ce4d0SZheng Fan         maFLineIndent->Disable();
1302766ce4d0SZheng Fan         maTbxIndent_IncDec->Disable();
1303766ce4d0SZheng Fan         if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text)  &&
1304766ce4d0SZheng Fan             maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) &&
1305766ce4d0SZheng Fan             maContext.GetCombinedContext() !=  CombinedEnumContext(Application_Writer, Context_Table) )
1306766ce4d0SZheng Fan             maTbxIndent_IncDec->Disable();
1307766ce4d0SZheng Fan         else
1308766ce4d0SZheng Fan             maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False);
1309766ce4d0SZheng Fan 
13101ff378efSZheng Fan //      maTbxProDemote->Disable();
1311766ce4d0SZheng Fan         maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False);
1312766ce4d0SZheng Fan     }
1313766ce4d0SZheng Fan     else
1314766ce4d0SZheng Fan     {
1315766ce4d0SZheng Fan         maLeftIndent->SetEmptyFieldValue();
1316766ce4d0SZheng Fan         maRightIndent->SetEmptyFieldValue();
1317766ce4d0SZheng Fan         maFLineIndent->SetEmptyFieldValue();
1318766ce4d0SZheng Fan         if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text)  &&
1319766ce4d0SZheng Fan             maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) &&
1320766ce4d0SZheng Fan             maContext.GetCombinedContext() !=  CombinedEnumContext(Application_Writer, Context_Table) )
1321766ce4d0SZheng Fan             maTbxIndent_IncDec->Disable();
1322766ce4d0SZheng Fan         else
1323766ce4d0SZheng Fan             maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False);
13241ff378efSZheng Fan //      maTbxProDemote->Disable();
1325766ce4d0SZheng Fan         maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False);
1326766ce4d0SZheng Fan     }
1327766ce4d0SZheng Fan }
1328766ce4d0SZheng Fan 
13291715803bSPavel Janík void ParaPropertyPanel::StateChangedLnSPImpl( sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState )
1330766ce4d0SZheng Fan {
1331766ce4d0SZheng Fan     meLnSpState = eState;
1332766ce4d0SZheng Fan 
1333766ce4d0SZheng Fan     if( pState && eState >= SFX_ITEM_AVAILABLE )
1334766ce4d0SZheng Fan     {
1335766ce4d0SZheng Fan         if(mpLnSPItem)
1336766ce4d0SZheng Fan             delete mpLnSPItem;
1337766ce4d0SZheng Fan         mpLnSPItem = ( SvxLineSpacingItem *)pState->Clone();
1338766ce4d0SZheng Fan     }
1339766ce4d0SZheng Fan }
1340766ce4d0SZheng Fan 
13411715803bSPavel Janík void ParaPropertyPanel::StateChangedULImpl( sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState )
1342766ce4d0SZheng Fan {
1343766ce4d0SZheng Fan     maTopDist->SetMax( maTopDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) );
1344766ce4d0SZheng Fan     maBottomDist->SetMax( maBottomDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) );
1345766ce4d0SZheng Fan 
1346766ce4d0SZheng Fan     if( pState && eState >= SFX_ITEM_AVAILABLE )
1347766ce4d0SZheng Fan     {
1348766ce4d0SZheng Fan         SvxULSpaceItem* pOldItem = (SvxULSpaceItem*)pState;
1349766ce4d0SZheng Fan 
1350766ce4d0SZheng Fan         maUpper = pOldItem->GetUpper();
1351766ce4d0SZheng Fan         maUpper = OutputDevice::LogicToLogic( maUpper, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM );
1352766ce4d0SZheng Fan         maUpper = OutputDevice::LogicToLogic( maUpper, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1353766ce4d0SZheng Fan 
1354766ce4d0SZheng Fan         maLower = pOldItem->GetLower();
1355766ce4d0SZheng Fan         maLower = OutputDevice::LogicToLogic( maLower, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM );
1356766ce4d0SZheng Fan         maLower = OutputDevice::LogicToLogic( maLower, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1357766ce4d0SZheng Fan 
1358766ce4d0SZheng Fan         sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1359766ce4d0SZheng Fan         nVal = maTopDist->Normalize( nVal );
1360766ce4d0SZheng Fan         maTopDist->SetValue( nVal, FUNIT_100TH_MM );
1361766ce4d0SZheng Fan 
1362766ce4d0SZheng Fan         nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1363766ce4d0SZheng Fan         nVal = maBottomDist->Normalize( nVal );
1364766ce4d0SZheng Fan         maBottomDist->SetValue( nVal, FUNIT_100TH_MM );
1365766ce4d0SZheng Fan         maTbxUL_IncDec->Enable();
1366766ce4d0SZheng Fan     }
1367512ec161SZheng Fan     else if(eState == SFX_ITEM_DISABLED )
1368766ce4d0SZheng Fan     {
1369766ce4d0SZheng Fan         maTopDist->Disable();
1370766ce4d0SZheng Fan         maBottomDist->Disable();
1371766ce4d0SZheng Fan         maTbxUL_IncDec->Disable();
1372766ce4d0SZheng Fan     }
1373512ec161SZheng Fan     else
1374766ce4d0SZheng Fan     {
1375766ce4d0SZheng Fan         maTopDist->SetEmptyFieldValue();
1376766ce4d0SZheng Fan         maBottomDist->SetEmptyFieldValue();
1377766ce4d0SZheng Fan         maTbxUL_IncDec->Disable();
1378766ce4d0SZheng Fan     }
1379766ce4d0SZheng Fan }
1380766ce4d0SZheng Fan 
1381766ce4d0SZheng Fan void ParaPropertyPanel::StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1382766ce4d0SZheng Fan {
1383766ce4d0SZheng Fan     if (nSID==SID_OUTLINE_LEFT)
1384766ce4d0SZheng Fan     {
1385766ce4d0SZheng Fan         if( pState && eState == SFX_ITEM_UNKNOWN )
1386766ce4d0SZheng Fan             mbOutLineLeft = 1;
1387766ce4d0SZheng Fan         else
1388766ce4d0SZheng Fan             mbOutLineLeft = 0;
1389766ce4d0SZheng Fan     }
1390766ce4d0SZheng Fan     if (nSID==SID_OUTLINE_RIGHT)
1391766ce4d0SZheng Fan     {
1392766ce4d0SZheng Fan         if( pState && eState == SFX_ITEM_UNKNOWN )
1393766ce4d0SZheng Fan             mbOutLineRight = 1;
1394766ce4d0SZheng Fan         else
1395766ce4d0SZheng Fan             mbOutLineRight = 0;
1396766ce4d0SZheng Fan     }
1397766ce4d0SZheng Fan     if(mbOutLineLeft)
1398766ce4d0SZheng Fan         maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_True);
1399766ce4d0SZheng Fan     else
1400766ce4d0SZheng Fan         maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_False);
1401766ce4d0SZheng Fan 
1402766ce4d0SZheng Fan     if(mbOutLineRight)
1403766ce4d0SZheng Fan         maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_True);
1404766ce4d0SZheng Fan     else
1405766ce4d0SZheng Fan         maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_False);
1406766ce4d0SZheng Fan 
14071ff378efSZheng Fan //  if( !mbOutLineRight && !mbOutLineLeft )
14081ff378efSZheng Fan //  {
14091ff378efSZheng Fan //      maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_True);
14101ff378efSZheng Fan //      maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_True);
14111ff378efSZheng Fan //      maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True);
14121ff378efSZheng Fan //  }
14131ff378efSZheng Fan //  else
14141ff378efSZheng Fan //      maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False);
1415766ce4d0SZheng Fan }
1416766ce4d0SZheng Fan 
1417766ce4d0SZheng Fan void ParaPropertyPanel::StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1418766ce4d0SZheng Fan {
1419766ce4d0SZheng Fan     if (nSID==SID_INC_INDENT)
1420766ce4d0SZheng Fan     {
1421766ce4d0SZheng Fan         if( pState && eState == SFX_ITEM_UNKNOWN )
1422766ce4d0SZheng Fan             maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True);
1423766ce4d0SZheng Fan         else
1424766ce4d0SZheng Fan             if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text)  &&
1425766ce4d0SZheng Fan                 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) &&
1426766ce4d0SZheng Fan             maContext.GetCombinedContext() !=  CombinedEnumContext(Application_Writer, Context_Table) )
1427766ce4d0SZheng Fan                 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_False);
1428766ce4d0SZheng Fan     }
1429766ce4d0SZheng Fan     if (nSID==SID_DEC_INDENT)
1430766ce4d0SZheng Fan     {
1431766ce4d0SZheng Fan         if( pState && eState == SFX_ITEM_UNKNOWN )
1432766ce4d0SZheng Fan             maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True);
1433766ce4d0SZheng Fan         else
1434766ce4d0SZheng Fan             if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text)  &&
1435766ce4d0SZheng Fan                 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) &&
1436766ce4d0SZheng Fan             maContext.GetCombinedContext() !=  CombinedEnumContext(Application_Writer, Context_Table) )
1437766ce4d0SZheng Fan                 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_False);
1438766ce4d0SZheng Fan     }
1439766ce4d0SZheng Fan }
144037fee4fdSAndre Fischer // Add toggle state for numbering and bullet icons
1441766ce4d0SZheng Fan void ParaPropertyPanel::StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1442766ce4d0SZheng Fan {
1443766ce4d0SZheng Fan     if (nSID==FN_NUM_NUMBERING_ON)
1444766ce4d0SZheng Fan     {
1445766ce4d0SZheng Fan         if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem)))
1446766ce4d0SZheng Fan         {
1447766ce4d0SZheng Fan             const SfxBoolItem* pItem= (const SfxBoolItem*)pState;
1448766ce4d0SZheng Fan             sal_Bool aBool = (sal_Bool)pItem->GetValue();
1449766ce4d0SZheng Fan             if (aBool) {
1450766ce4d0SZheng Fan                 maTBxNumBullet->SetItemState(IID_NUMBER,    STATE_CHECK);
1451766ce4d0SZheng Fan             } else {
1452766ce4d0SZheng Fan                 maTBxNumBullet->SetItemState(IID_NUMBER,    STATE_NOCHECK);
1453766ce4d0SZheng Fan             }
1454766ce4d0SZheng Fan         }
1455766ce4d0SZheng Fan     }
1456766ce4d0SZheng Fan     if (nSID==FN_NUM_BULLET_ON)
1457766ce4d0SZheng Fan     {
1458766ce4d0SZheng Fan         if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem)))
1459766ce4d0SZheng Fan         {
1460766ce4d0SZheng Fan             const SfxBoolItem* pItem= (const SfxBoolItem*)pState;
1461766ce4d0SZheng Fan             sal_Bool aBool = (sal_Bool)pItem->GetValue();
1462766ce4d0SZheng Fan             if (aBool) {
1463766ce4d0SZheng Fan                 maTBxNumBullet->SetItemState(IID_BULLET,    STATE_CHECK);
1464766ce4d0SZheng Fan             } else {
1465766ce4d0SZheng Fan                 maTBxNumBullet->SetItemState(IID_BULLET,    STATE_NOCHECK);
1466766ce4d0SZheng Fan             }
1467766ce4d0SZheng Fan         }
1468766ce4d0SZheng Fan     }
1469766ce4d0SZheng Fan }
1470766ce4d0SZheng Fan //Modified for Numbering&Bullets Dialog UX Enh(Story 992) by chengjh,2011.7.5
1471766ce4d0SZheng Fan //Handing the transferred the num rule index data of the current selection
14721715803bSPavel Janík void ParaPropertyPanel::StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState /* eState */, const SfxPoolItem* pState )
1473766ce4d0SZheng Fan {
1474766ce4d0SZheng Fan 
1475766ce4d0SZheng Fan     const SfxUInt16Item* pIt = (const SfxUInt16Item*)pState;
1476766ce4d0SZheng Fan     sal_uInt16 nValue = (sal_uInt16)0xFFFF;
1477766ce4d0SZheng Fan     if ( pIt )
1478766ce4d0SZheng Fan         nValue = pIt->GetValue();
1479766ce4d0SZheng Fan 
1480766ce4d0SZheng Fan     if ( nSID == FN_BUL_NUM_RULE_INDEX )
1481766ce4d0SZheng Fan     {
148237fee4fdSAndre Fischer         mnBulletTypeIndex = nValue;
1483766ce4d0SZheng Fan     }else if ( nSID == FN_NUM_NUM_RULE_INDEX )
1484766ce4d0SZheng Fan     {
148537fee4fdSAndre Fischer         mnNumTypeIndex = nValue;
1486766ce4d0SZheng Fan     }
1487766ce4d0SZheng Fan }
1488766ce4d0SZheng Fan //End
1489766ce4d0SZheng Fan FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState )
1490766ce4d0SZheng Fan {
1491766ce4d0SZheng Fan     FieldUnit eUnit = FUNIT_NONE;
1492766ce4d0SZheng Fan 
1493766ce4d0SZheng Fan     if ( pState && eState >= SFX_ITEM_DEFAULT )
1494766ce4d0SZheng Fan         eUnit = (FieldUnit)( (const SfxUInt16Item*)pState )->GetValue();
1495766ce4d0SZheng Fan     else
1496766ce4d0SZheng Fan     {
1497766ce4d0SZheng Fan         SfxViewFrame* pFrame = SfxViewFrame::Current();
1498766ce4d0SZheng Fan         SfxObjectShell* pSh = NULL;
1499766ce4d0SZheng Fan         if ( pFrame )
1500766ce4d0SZheng Fan             pSh = pFrame->GetObjectShell();
1501766ce4d0SZheng Fan         if ( pSh )  //the object shell is not always available during reload
1502766ce4d0SZheng Fan         {
1503766ce4d0SZheng Fan             SfxModule* pModule = pSh->GetModule();
1504766ce4d0SZheng Fan             if ( pModule )
1505766ce4d0SZheng Fan             {
1506766ce4d0SZheng Fan                 const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC );
1507766ce4d0SZheng Fan                 if ( pItem )
1508766ce4d0SZheng Fan                     eUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue();
1509766ce4d0SZheng Fan             }
1510766ce4d0SZheng Fan             else
1511766ce4d0SZheng Fan             {
1512766ce4d0SZheng Fan                 DBG_ERRORFILE( "GetModuleFieldUnit(): no module found" );
1513766ce4d0SZheng Fan             }
1514766ce4d0SZheng Fan         }
1515766ce4d0SZheng Fan     }
1516766ce4d0SZheng Fan 
1517766ce4d0SZheng Fan     return eUnit;
1518766ce4d0SZheng Fan }
1519766ce4d0SZheng Fan //new FixedText(this, SVX_RES(FT_COLOR))
1520766ce4d0SZheng Fan 
1521766ce4d0SZheng Fan PopupControl* ParaPropertyPanel::CreateLineSpacingControl (PopupContainer* pParent)
1522766ce4d0SZheng Fan {
1523766ce4d0SZheng Fan     return new ParaLineSpacingControl(pParent, *this);
1524766ce4d0SZheng Fan }
1525766ce4d0SZheng Fan 
1526766ce4d0SZheng Fan PopupControl* ParaPropertyPanel::CreateBulletsPopupControl (PopupContainer* pParent)
1527766ce4d0SZheng Fan {
1528766ce4d0SZheng Fan     return new ParaBulletsControl(pParent, *this);
1529766ce4d0SZheng Fan }
1530766ce4d0SZheng Fan 
1531766ce4d0SZheng Fan PopupControl* ParaPropertyPanel::CreateNumberingPopupControl (PopupContainer* pParent)
1532766ce4d0SZheng Fan {
1533766ce4d0SZheng Fan     return new ParaNumberingControl(pParent, *this);
1534766ce4d0SZheng Fan }
1535766ce4d0SZheng Fan 
1536*b7a56e95SArmin Le Grand namespace
1537*b7a56e95SArmin Le Grand {
1538*b7a56e95SArmin Le Grand     Color GetNoBackgroundColor(void)
1539*b7a56e95SArmin Le Grand     {
1540*b7a56e95SArmin Le Grand         return COL_TRANSPARENT;
1541*b7a56e95SArmin Le Grand     }
1542*b7a56e95SArmin Le Grand } // end of anonymous namespace
1543*b7a56e95SArmin Le Grand 
1544766ce4d0SZheng Fan PopupControl* ParaPropertyPanel::CreateBGColorPopupControl (PopupContainer* pParent)
1545766ce4d0SZheng Fan {
1546*b7a56e95SArmin Le Grand     const ResId aResId(SVX_RES(STR_NOFILL));
1547*b7a56e95SArmin Le Grand 
1548766ce4d0SZheng Fan     return new ColorControl(
1549766ce4d0SZheng Fan         pParent,
1550766ce4d0SZheng Fan         mpBindings,
1551*b7a56e95SArmin Le Grand         SVX_RES(RID_POPUPPANEL_PARAPAGE_BACK_COLOR),
1552766ce4d0SZheng Fan         SVX_RES(VS_FONT_COLOR),
1553*b7a56e95SArmin Le Grand         ::boost::bind(GetNoBackgroundColor),
1554766ce4d0SZheng Fan         ::boost::bind(&ParaPropertyPanel::SetBGColor, this, _1,_2),
1555766ce4d0SZheng Fan         pParent,
1556*b7a56e95SArmin Le Grand         &aResId);
1557766ce4d0SZheng Fan }
1558766ce4d0SZheng Fan 
1559766ce4d0SZheng Fan 
1560766ce4d0SZheng Fan ParaPropertyPanel::ParaPropertyPanel(Window* pParent,
15611715803bSPavel Janík     const cssu::Reference<css::frame::XFrame>& /* rxFrame */,
156237fee4fdSAndre Fischer     SfxBindings* pBindings,
156337fee4fdSAndre Fischer     const cssu::Reference<css::ui::XSidebar>& rxSidebar)
156437fee4fdSAndre Fischer     : Control(pParent, SVX_RES(RID_SIDEBAR_PARA_PANEL)),
156537fee4fdSAndre Fischer       maAlignToolBoxBackground(ControlFactory::CreateToolBoxBackground(this)),
156637fee4fdSAndre Fischer       maAlignToolBox (ControlFactory::CreateToolBox(maAlignToolBoxBackground.get(),SVX_RES(TBX_HORIZONTALALIGNMENT))),
156737fee4fdSAndre Fischer       maTBxVertAlignBackground(ControlFactory::CreateToolBoxBackground(this)),
156837fee4fdSAndre Fischer       maTBxVertAlign (ControlFactory::CreateToolBox(maTBxVertAlignBackground.get(),SVX_RES(TBX_VERT_ALIGN))),
156937fee4fdSAndre Fischer       maTBxNumBulletBackground(ControlFactory::CreateToolBoxBackground(this)),
157037fee4fdSAndre Fischer       maTBxNumBullet (ControlFactory::CreateToolBox(maTBxNumBulletBackground.get(),SVX_RES(TBX_NUM_BULLET))),
157137fee4fdSAndre Fischer       maTBxBackColorBackground(ControlFactory::CreateToolBoxBackground(this)),
157237fee4fdSAndre Fischer       maTBxBackColor (ControlFactory::CreateToolBox(maTBxBackColorBackground.get(),SVX_RES(TBX_BACK_COLOR))),
157337fee4fdSAndre Fischer       maFTUL (new FixedText(this, SVX_RES(FT_SPACING))),
157437fee4fdSAndre Fischer       maTbxUL_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)),
157537fee4fdSAndre Fischer       maTbxUL_IncDec (ControlFactory::CreateToolBox(maTbxUL_IncDecBackground.get(),SVX_RES(TBX_UL_INC_DEC))),
157637fee4fdSAndre Fischer       maTopDist (new SvxRelativeField(this, SVX_RES(MF_ABOVE_PARASPACING))),
157737fee4fdSAndre Fischer       maBottomDist (new SvxRelativeField(this, SVX_RES(MF_BELOW_PARASPACING))),
157837fee4fdSAndre Fischer       maLineSPTbxBackground(ControlFactory::CreateToolBoxBackground(this)),
157937fee4fdSAndre Fischer       maLineSPTbx (ControlFactory::CreateToolBox(maLineSPTbxBackground.get(),SVX_RES(TBX_LINESP))),
158037fee4fdSAndre Fischer       maFTIndent (new FixedText(this, SVX_RES(FT_INDENT))),
158137fee4fdSAndre Fischer       maTbxIndent_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)),
158237fee4fdSAndre Fischer       maTbxIndent_IncDec (ControlFactory::CreateToolBox(maTbxIndent_IncDecBackground.get(),SVX_RES(TBX_INDENT_INC_DEC))),
158337fee4fdSAndre Fischer       maTbxProDemoteBackground(ControlFactory::CreateToolBoxBackground(this)),
158437fee4fdSAndre Fischer       maTbxProDemote (ControlFactory::CreateToolBox(maTbxProDemoteBackground.get(),SVX_RES(TBX_INDENT_PRO_DEMOTE))),
158537fee4fdSAndre Fischer       maLeftIndent (new SvxRelativeField(this, SVX_RES(MF_BEFORE_INDENT))),
158637fee4fdSAndre Fischer       maRightIndent (new SvxRelativeField(this, SVX_RES(MF_AFTER_INDENT))),
158737fee4fdSAndre Fischer       maFLineIndent (new SvxRelativeField(this, SVX_RES(MF_FL_INDENT))),
158837fee4fdSAndre Fischer       mpColorUpdater (),
158937fee4fdSAndre Fischer       maFISpace1 ( this, SVX_RES( FI_SPACE1)),
159037fee4fdSAndre Fischer       maFISpace2 ( this, SVX_RES( FI_SPACE2)),
159137fee4fdSAndre Fischer       maFIndent1 ( this, SVX_RES( FI_INDENT1)),
159237fee4fdSAndre Fischer       maFIndent2 ( this, SVX_RES( FI_INDENT2)),
159337fee4fdSAndre Fischer       maFIndent3 ( this, SVX_RES( FI_INDENT3)),
159437fee4fdSAndre Fischer       maSpace1 (SVX_RES(IMG_SPACE1)),
159537fee4fdSAndre Fischer       maSpace2 (SVX_RES(IMG_SPACE2)),
159637fee4fdSAndre Fischer       maSpace3 (SVX_RES(IMG_SPACE3)),
159737fee4fdSAndre Fischer       maIndent1 (SVX_RES(IMG_INDENT1)),
159837fee4fdSAndre Fischer       maIndent2 (SVX_RES(IMG_INDENT2)),
159937fee4fdSAndre Fischer       maIndent3 (SVX_RES(IMG_INDENT3)),
160037fee4fdSAndre Fischer       maLeftPara (SVX_RES(IMG_LEFT_PARA)),
160137fee4fdSAndre Fischer       maCentPara (SVX_RES(IMG_CENTER_PARA)),
160237fee4fdSAndre Fischer       maRightPara (SVX_RES(IMG_RIGHT_PARA)),
160337fee4fdSAndre Fischer       maJusPara (SVX_RES(IMG_JUSTIFY_PARA)),
160437fee4fdSAndre Fischer       maIndInc (SVX_RES(IMG_INDENT_INC)),
160537fee4fdSAndre Fischer       maIndDec (SVX_RES(IMG_INDENT_DEC)),
160637fee4fdSAndre Fischer       maIndInc_BD (SVX_RES(IMG_INDENT_INC_BD)),
160737fee4fdSAndre Fischer       maIndDec_BD (SVX_RES(IMG_INDENT_DEC_BD)),
160837fee4fdSAndre Fischer       maIndHang (SVX_RES(IMG_INDENT_HANG)),
160937fee4fdSAndre Fischer       maParInc (SVX_RES(IMG_PARA_INC)),
161037fee4fdSAndre Fischer       maParDec (SVX_RES(IMG_PARA_DEC)),
161137fee4fdSAndre Fischer       maVertImageList (SVX_RES(IL_VERT_ALIGN)),
161237fee4fdSAndre Fischer       maVertImageListH (SVX_RES(IL_VERT_ALIGN)),
161337fee4fdSAndre Fischer       maNumBImageList (SVX_RES(IL_NUM_BULLET)),
161437fee4fdSAndre Fischer       maNumBImageListH (SVX_RES(ILH_NUM_BULLET)),
161537fee4fdSAndre Fischer       maNumBImageListRTL (SVX_RES(IL_NUM_BULLET_RTL)),
161637fee4fdSAndre Fischer       maImgBackColorHigh (SVX_RES(IMG_BACK_COLOR_H)),
161737fee4fdSAndre Fischer       maImgBackColor (SVX_RES(IMG_BACK_COLOR)),
161837fee4fdSAndre Fischer       maTxtLeft (0),
161937fee4fdSAndre Fischer       mpLnSPItem (NULL),
162037fee4fdSAndre Fischer       meLnSpState (SFX_ITEM_DONTCARE),
162137fee4fdSAndre Fischer       mbOutLineLeft (false),
162237fee4fdSAndre Fischer       mbOutLineRight (false),
162337fee4fdSAndre Fischer       maUpper (0),
162437fee4fdSAndre Fischer       maLower (0),
162537fee4fdSAndre Fischer       mnBulletTypeIndex ((sal_uInt16)0xFFFF),
162637fee4fdSAndre Fischer       mnNumTypeIndex ((sal_uInt16)0xFFFF),
162737fee4fdSAndre Fischer       maColor (COL_AUTO),
162837fee4fdSAndre Fischer       mbColorAvailable (true),
1629766ce4d0SZheng Fan  //, m_eMetricUnit            (FUNIT_INCH)
1630766ce4d0SZheng Fan //, m_last_eMetricUnit      (FUNIT_INCH)
163137fee4fdSAndre Fischer       m_eLRSpaceUnit(),
163237fee4fdSAndre Fischer       m_eULSpaceUnit(),
163337fee4fdSAndre Fischer       maLeftAlignControl (SID_ATTR_PARA_ADJUST_LEFT, *pBindings,*this),
163437fee4fdSAndre Fischer       maCenterAlignControl (SID_ATTR_PARA_ADJUST_CENTER, *pBindings,*this),
163537fee4fdSAndre Fischer       maRightAlignControl (SID_ATTR_PARA_ADJUST_RIGHT, *pBindings,*this),
163637fee4fdSAndre Fischer       maJustifyAlignControl (SID_ATTR_PARA_ADJUST_BLOCK, *pBindings,*this),
163737fee4fdSAndre Fischer       maLRSpaceControl (SID_ATTR_PARA_LRSPACE,*pBindings,*this),
163837fee4fdSAndre Fischer       maLNSpaceControl (SID_ATTR_PARA_LINESPACE, *pBindings,*this),
163937fee4fdSAndre Fischer       maULSpaceControl (SID_ATTR_PARA_ULSPACE, *pBindings,*this),
164037fee4fdSAndre Fischer       maOutLineLeftControl (SID_OUTLINE_LEFT, *pBindings,*this),
164137fee4fdSAndre Fischer       maOutLineRightControl (SID_OUTLINE_RIGHT, *pBindings,*this),
164237fee4fdSAndre Fischer       maDecIndentControl (SID_DEC_INDENT, *pBindings,*this),
164337fee4fdSAndre Fischer       maIncIndentControl (SID_INC_INDENT, *pBindings,*this),
164437fee4fdSAndre Fischer       maVertTop (SID_TABLE_VERT_NONE, *pBindings,*this),
164537fee4fdSAndre Fischer       maVertCenter (SID_TABLE_VERT_CENTER, *pBindings,*this),
164637fee4fdSAndre Fischer       maVertBottom (SID_TABLE_VERT_BOTTOM,*pBindings,*this),
164737fee4fdSAndre Fischer       maBulletOnOff (FN_NUM_BULLET_ON, *pBindings,*this),
164837fee4fdSAndre Fischer       maNumberOnOff (FN_NUM_NUMBERING_ON, *pBindings,*this),
164937fee4fdSAndre Fischer       maBackColorControl (SID_BACKGROUND_COLOR, *pBindings,*this),
165037fee4fdSAndre Fischer       m_aMetricCtl (SID_ATTR_METRIC, *pBindings,*this),
165137fee4fdSAndre Fischer       maBulletNumRuleIndex (FN_BUL_NUM_RULE_INDEX, *pBindings,*this),
165237fee4fdSAndre Fischer       maNumNumRuleIndex (FN_NUM_NUM_RULE_INDEX, *pBindings,*this),
165337fee4fdSAndre Fischer       maContext(),
165437fee4fdSAndre Fischer       mpBindings(pBindings),
165537fee4fdSAndre Fischer       maLineSpacePopup(this, ::boost::bind(&ParaPropertyPanel::CreateLineSpacingControl, this, _1)),
165637fee4fdSAndre Fischer       maBulletsPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBulletsPopupControl, this, _1)),
165737fee4fdSAndre Fischer       maNumberingPopup(this, ::boost::bind(&ParaPropertyPanel::CreateNumberingPopupControl, this, _1)),
165837fee4fdSAndre Fischer       maBGColorPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBGColorPopupControl, this, _1)),
165937fee4fdSAndre Fischer       mxSidebar(rxSidebar)
1660766ce4d0SZheng Fan {
1661766ce4d0SZheng Fan     initial();
1662766ce4d0SZheng Fan     FreeResource();
1663766ce4d0SZheng Fan }
1664766ce4d0SZheng Fan 
166537fee4fdSAndre Fischer } } // end of namespace svx::sidebar
1666