1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22 #include "precompiled_svx.hxx"
23 #include <svx/sidebar/ColorControl.hxx>
24
25 #include "ParaPropertyPanel.hxx"
26 #include "ParaPropertyPanel.hrc"
27
28 #include "ParaLineSpacingPopup.hxx"
29 #include "ParaLineSpacingControl.hxx"
30 #include "ParaBulletsPopup.hxx"
31 #include "ParaBulletsControl.hxx"
32 #include "ParaNumberingPopup.hxx"
33 #include "ParaNumberingControl.hxx"
34 #include <sfx2/sidebar/Theme.hxx>
35 #include <sfx2/sidebar/ResourceDefinitions.hrc>
36 #include <sfx2/sidebar/ControlFactory.hxx>
37 #include <sfx2/sidebar/Layouter.hxx>
38 #include <sfx2/sidebar/Tools.hxx>
39 #include <svx/sidebar/PopupContainer.hxx>
40 #include <sfx2/dispatch.hxx>
41 #include <editeng/colritem.hxx>
42 #include <editeng/brshitem.hxx>
43 #include <editeng/lrspitem.hxx>
44 #include <editeng/ulspitem.hxx>
45 #include <vcl/toolbox.hxx>
46 #include <vcl/fixed.hxx>
47 #include <vcl/svapp.hxx>
48 #include <svx/svxids.hrc>
49 #include <svl/intitem.hxx>
50 #include "svx/dialmgr.hxx"
51 #include <sfx2/objsh.hxx>
52 #include <svtools/unitconv.hxx>
53 #include <boost/bind.hpp>
54
55 using namespace css;
56 using namespace cssu;
57 using namespace ::sfx2::sidebar;
58 using ::sfx2::sidebar::Theme;
59 using ::sfx2::sidebar::ControlFactory;
60
61 namespace svx {namespace sidebar {
62 #define DEFAULT_VALUE 0
63 #define TOOLBOX_ITEM1 1
64 #define TOOLBOX_ITEM2 2
65 #define TOOLBOX_ITEM3 3
66 #define TOOLBOX_ITEM4 4
67
68 #define MAX_DURCH 5670
69
70 #define INDENT_INCREMENT 1
71 #define INDENT_DECREMENT 2
72 #define INDENT_STEP 706
73 #define UL_STEP 58
74
75 #define NEGATIVE_MAX_VALUE -9999
76 #define BEGIN_VALUE 28
77 #define MAX_SW 1709400
78 #define MAX_SC_SD 116220200
79 #define NEGA_MAXVALUE -10000000
80
81 #define POS_FT_PARA_SPACE Point(LogicToPixel(Point(FT_PARA_SPACE_X,FT_PARA_SPACE_Y), MAP_APPFONT))
82 #define POS_FT_PARA_SPACE2 Point(LogicToPixel(Point(FT_PARA_SPACE_X,FT_PARA_SPACE_Y2), MAP_APPFONT))
83 #define POS_TBX_PARA_SPACE_INC_DEC Point(LogicToPixel(Point(TBX_PARA_SPACE_INC_DEC_X,TBX_PARA_SPACE_INC_DEC_Y), MAP_APPFONT))
84 #define POS_TBX_PARA_SPACE_INC_DEC2 Point(LogicToPixel(Point(TBX_PARA_SPACE_INC_DEC_X,TBX_PARA_SPACE_INC_DEC_Y2), MAP_APPFONT))
85 #define POS_FT_PARA_INDENT Point(LogicToPixel(Point(FT_PARA_INDENT_X,FT_PARA_INDENT_Y), MAP_APPFONT))
86 #define POS_FT_PARA_INDENT2 Point(LogicToPixel(Point(FT_PARA_INDENT_X,FT_PARA_INDENT_Y2), MAP_APPFONT))
87 #define POS_TBX_PARA_INDENT_INC_DEC Point(LogicToPixel(Point(TBX_PARA_INDENT_INC_DEC_X,TBX_PARA_INDENT_INC_DEC_Y), MAP_APPFONT))
88 #define POS_TBX_PARA_INDENT_INC_DEC2 Point(LogicToPixel(Point(TBX_PARA_INDENT_INC_DEC_X,TBX_PARA_INDENT_INC_DEC_Y2), MAP_APPFONT))
89 #define POS_MBX_TOP_DIST Point(LogicToPixel(Point(MBX_TOP_DIST_X,MBX_TOP_DIST_Y), MAP_APPFONT))
90 #define POS_MBX_TOP_DIST2 Point(LogicToPixel(Point(MBX_TOP_DIST_X,MBX_TOP_DIST_Y2), MAP_APPFONT))
91 #define POS_MBX_BOT_DIST Point(LogicToPixel(Point(MBX_BOT_DIST_X,MBX_BOT_DIST_Y), MAP_APPFONT))
92 #define POS_MBX_BOT_DIST2 Point(LogicToPixel(Point(MBX_BOT_DIST_X,MBX_BOT_DIST_Y2), MAP_APPFONT))
93 #define POS_MBX_LEFT_DIST Point(LogicToPixel(Point(MBX_LEFT_DIST_X,MBX_LEFT_DIST_Y), MAP_APPFONT))
94 #define POS_MBX_LEFT_DIST2 Point(LogicToPixel(Point(MBX_LEFT_DIST_X,MBX_LEFT_DIST_Y2), MAP_APPFONT))
95 #define POS_MBX_RIGHT_DIST Point(LogicToPixel(Point(MBX_RIGHT_DIST_X,MBX_RIGHT_DIST_Y), MAP_APPFONT))
96 #define POS_MBX_RIGHT_DIST2 Point(LogicToPixel(Point(MBX_RIGHT_DIST_X,MBX_RIGHT_DIST_Y2), MAP_APPFONT))
97 #define POS_MBX_FLINE_DIST Point(LogicToPixel(Point(MBX_FLINE_DIST_X,MBX_FLINE_DIST_Y), MAP_APPFONT))
98 #define POS_MBX_FLINE_DIST2 Point(LogicToPixel(Point(MBX_FLINE_DIST_X,MBX_FLINE_DIST_Y2), MAP_APPFONT))
99 #define POS_IMG_SPACE1 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE1_Y), MAP_APPFONT))
100 #define POS_IMG_SPACE12 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE1_Y2), MAP_APPFONT))
101 #define POS_IMG_SPACE2 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE2_Y), MAP_APPFONT))
102 #define POS_IMG_SPACE22 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE2_Y2), MAP_APPFONT))
103 #define POS_IMG_INDENT1 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT1_Y), MAP_APPFONT))
104 #define POS_IMG_INDENT12 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT1_Y2), MAP_APPFONT))
105 #define POS_IMG_INDENT2 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT2_Y), MAP_APPFONT))
106 #define POS_IMG_INDENT22 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT2_Y2), MAP_APPFONT))
107 #define POS_IMG_INDENT3 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT3_Y), MAP_APPFONT))
108 #define POS_IMG_INDENT32 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT3_Y2), MAP_APPFONT))
109 #define TBX_LINE_SPACE Point(LogicToPixel(Point(TBX_LINE_SPACE_X,TBX_LINE_SPACE_Y), MAP_APPFONT))
110 #define TBX_LINE_SPACE2 Point(LogicToPixel(Point(TBX_LINE_SPACE_X,TBX_LINE_SPACE_Y2), MAP_APPFONT))
111
112 #define LINE_POINT1_WHITE Point(LogicToPixel(Point(LINE_X_WHITE,LINE_TOP_Y), MAP_APPFONT))
113 #define LINE_POINT2_WHITE Point(LogicToPixel(Point(LINE_X_WHITE,LINE_BOT_Y), MAP_APPFONT))
114 #define LINE_POINT3_WHITE Point(LogicToPixel(Point(LINE_X_WHITE,LINE_TOP_Y2), MAP_APPFONT))
115 #define LINE_POINT4_WHITE Point(LogicToPixel(Point(LINE_X_WHITE,LINE_BOT_Y2), MAP_APPFONT))
116
117
Create(Window * pParent,const cssu::Reference<css::frame::XFrame> & rxFrame,SfxBindings * pBindings,const cssu::Reference<css::ui::XSidebar> & rxSidebar)118 ParaPropertyPanel* ParaPropertyPanel::Create (
119 Window* pParent,
120 const cssu::Reference<css::frame::XFrame>& rxFrame,
121 SfxBindings* pBindings,
122 const cssu::Reference<css::ui::XSidebar>& rxSidebar)
123 {
124 if (pParent == NULL)
125 throw lang::IllegalArgumentException(A2S("no parent Window given to ParaPropertyPanel::Create"), NULL, 0);
126 if ( ! rxFrame.is())
127 throw lang::IllegalArgumentException(A2S("no XFrame given to ParaPropertyPanel::Create"), NULL, 1);
128 if (pBindings == NULL)
129 throw lang::IllegalArgumentException(A2S("no SfxBindings given to ParaPropertyPanel::Create"), NULL, 2);
130
131 return new ParaPropertyPanel(
132 pParent,
133 rxFrame,
134 pBindings,
135 rxSidebar);
136 }
137
HandleContextChange(const::sfx2::sidebar::EnumContext aContext)138 void ParaPropertyPanel::HandleContextChange (
139 const ::sfx2::sidebar::EnumContext aContext)
140 {
141 if (maContext == aContext)
142 {
143 // Nothing to do.
144 return;
145 }
146
147 maContext = aContext;
148 switch (maContext.GetCombinedContext_DI())
149 {
150 case CombinedEnumContext(Application_Calc, Context_DrawText):
151 mpTBxVertAlign->Show();
152 mpTBxVertAlignBackground->Show();
153 mpTBxBackColor->Hide();
154 mpTBxBackColorBackground->Hide();
155 mpTBxNumBullet->Hide();
156 mpTBxNumBulletBackground->Hide();
157 ReSize(false);
158 mpTbxIndent_IncDec->Show();
159 mpTbxIndent_IncDecBackground->Show();
160 mpTbxProDemote->Hide();
161 mpTbxProDemoteBackground->Hide();
162 break;
163
164 case CombinedEnumContext(Application_DrawImpress, Context_Draw):
165 case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
166 case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
167 mpTBxVertAlign->Hide();
168 mpTBxVertAlignBackground->Hide();
169 mpTBxBackColor->Hide();
170 mpTBxBackColorBackground->Hide();
171 mpTBxNumBullet->Show();
172 mpTBxNumBulletBackground->Show();
173 ReSize(true);
174 mpTbxIndent_IncDec->Hide();
175 mpTbxIndent_IncDecBackground->Hide();
176 mpTbxProDemote->Show();
177 mpTbxProDemoteBackground->Show();
178 break;
179
180 case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
181 mpTBxVertAlign->Show();
182 mpTBxVertAlignBackground->Show();
183 mpTBxBackColor->Hide();
184 mpTBxBackColorBackground->Hide();
185 mpTBxNumBullet->Show();
186 mpTBxNumBulletBackground->Show();
187 ReSize(true);
188 mpTbxIndent_IncDec->Hide();
189 mpTbxIndent_IncDecBackground->Hide();
190 mpTbxProDemote->Show();
191 mpTbxProDemoteBackground->Show();
192 break;
193
194 case CombinedEnumContext(Application_DrawImpress, Context_Table):
195 mpTBxVertAlign->Show();
196 mpTBxVertAlignBackground->Show();
197 mpTBxBackColor->Hide();
198 mpTBxBackColorBackground->Hide();
199 mpTBxNumBullet->Show();
200 mpTBxNumBulletBackground->Show();
201 ReSize(true);
202 mpTbxIndent_IncDec->Hide();
203 mpTbxIndent_IncDecBackground->Hide();
204 mpTbxProDemote->Show();
205 mpTbxProDemoteBackground->Show();
206 break;
207
208 case CombinedEnumContext(Application_WriterVariants, Context_Default):
209 case CombinedEnumContext(Application_WriterVariants, Context_Text):
210 mpTBxVertAlign->Hide();
211 mpTBxVertAlignBackground->Hide();
212 mpTBxBackColor->Show();
213 mpTBxBackColorBackground->Show();
214 mpTBxNumBullet->Show();
215
216 mpTBxNumBulletBackground->Show();
217 ReSize(true);
218 mpTbxIndent_IncDec->Show();
219 mpTbxIndent_IncDecBackground->Show();
220 mpTbxProDemote->Hide();
221 mpTbxProDemoteBackground->Hide();
222 break;
223
224 case CombinedEnumContext(Application_WriterVariants, Context_Table):
225 mpTBxVertAlign->Show();
226 mpTBxVertAlignBackground->Show();
227 mpTBxBackColor->Show();
228 mpTBxBackColorBackground->Show();
229 mpTBxNumBullet->Show();
230 mpTBxNumBulletBackground->Show();
231 ReSize(true);
232 mpTbxIndent_IncDec->Show();
233 mpTbxIndent_IncDecBackground->Show();
234 mpTbxProDemote->Hide();
235 mpTbxProDemoteBackground->Hide();
236 break;
237
238 case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
239 mpTBxVertAlign->Show();
240 mpTBxVertAlignBackground->Show();
241 mpTBxBackColor->Hide();
242 mpTBxBackColorBackground->Hide();
243 mpTBxNumBullet->Hide();
244 mpTBxNumBulletBackground->Hide();
245 ReSize(false);
246 mpTbxIndent_IncDec->Show();
247 mpTbxIndent_IncDecBackground->Show();
248 mpTbxProDemote->Hide();
249 mpTbxProDemoteBackground->Hide();
250 break;
251
252 case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
253 mpTBxVertAlign->Hide();
254 mpTBxVertAlignBackground->Hide();
255 mpTBxBackColor->Hide();
256 mpTBxBackColorBackground->Hide();
257 mpTBxNumBullet->Hide();
258 mpTBxNumBulletBackground->Hide();
259 ReSize(false);
260 mpTbxIndent_IncDec->Show();
261 mpTbxIndent_IncDecBackground->Show();
262 mpTbxProDemote->Hide();
263 mpTbxProDemoteBackground->Hide();
264 break;
265
266 case CombinedEnumContext(Application_Calc, Context_EditCell):
267 case CombinedEnumContext(Application_Calc, Context_Cell):
268 case CombinedEnumContext(Application_Calc, Context_Pivot):
269 case CombinedEnumContext(Application_DrawImpress, Context_Text):
270 case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
271 /*{
272 mpToolBoxScriptSw->Hide();
273 mpToolBoxScript->Show();
274 mpToolBoxSpacing->Show();
275 mpToolBoxHighlight->Hide();
276
277 Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT);
278 aSize = LogicToPixel( aSize,MapMode(MAP_APPFONT) );
279 aSize.setWidth(GetOutputSizePixel().Width());
280 SetSizePixel(aSize);
281 }*/
282 break;
283
284 default:
285 break;
286 }
287 }
288
GetBindings()289 SfxBindings* ParaPropertyPanel::GetBindings()
290 {
291 return mpBindings;
292 }
293
294
295
296
DataChanged(const DataChangedEvent & rEvent)297 void ParaPropertyPanel::DataChanged (const DataChangedEvent& rEvent)
298 {
299 (void)rEvent;
300 }
301
~ParaPropertyPanel()302 ParaPropertyPanel::~ParaPropertyPanel()
303 {
304 delete mpLnSPItem;
305 }
306
ReSize(bool bSize)307 void ParaPropertyPanel::ReSize(bool bSize)
308 {
309 if(bSize)
310 {
311 //Paragraph spacing
312 mpFTUL->SetPosPixel(POS_FT_PARA_SPACE);
313 mpTbxUL_IncDec->SetPosPixel(POS_TBX_PARA_SPACE_INC_DEC);
314 mpTopDist->SetPosPixel(POS_MBX_TOP_DIST);
315 mpBottomDist->SetPosPixel(POS_MBX_BOT_DIST);
316 //Indent
317 mpFTIndent->SetPosPixel(POS_FT_PARA_INDENT);
318 mpTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC);
319 mpTbxProDemote->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC);
320 mpLeftIndent->SetPosPixel(POS_MBX_LEFT_DIST);
321 mpRightIndent->SetPosPixel(POS_MBX_RIGHT_DIST);
322 mpFLineIndent->SetPosPixel(POS_MBX_FLINE_DIST);
323 //Line spacing
324 mpLineSPTbx->SetPosPixel(TBX_LINE_SPACE);
325 //image
326 maFISpace1.SetPosPixel(POS_IMG_SPACE1);
327 maFISpace2.SetPosPixel(POS_IMG_SPACE2);
328 maFIndent1.SetPosPixel(POS_IMG_INDENT1);
329 maFIndent2.SetPosPixel(POS_IMG_INDENT2);
330 maFIndent3.SetPosPixel(POS_IMG_INDENT3);
331 Size aSize(GetOutputSizePixel().Width(),PARA_SECTIONPAGE_HEIGHT);
332 aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
333 aSize.setWidth(GetOutputSizePixel().Width());
334 SetSizePixel(aSize);
335 }
336 else
337 {
338 //Paragraph spacing
339 mpFTUL->SetPosPixel(POS_FT_PARA_SPACE2);
340 mpTbxUL_IncDec->SetPosPixel(POS_TBX_PARA_SPACE_INC_DEC2);
341 mpTopDist->SetPosPixel(POS_MBX_TOP_DIST2);
342 mpBottomDist->SetPosPixel(POS_MBX_BOT_DIST2);
343 //Indent
344 mpFTIndent->SetPosPixel(POS_FT_PARA_INDENT2);
345 mpTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC2);
346 mpTbxProDemote->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC2);
347 mpLeftIndent->SetPosPixel(POS_MBX_LEFT_DIST2);
348 mpRightIndent->SetPosPixel(POS_MBX_RIGHT_DIST2);
349 mpFLineIndent->SetPosPixel(POS_MBX_FLINE_DIST2);
350 //Line spacing
351 mpLineSPTbx->SetPosPixel(TBX_LINE_SPACE2);
352 //image
353 maFISpace1.SetPosPixel(POS_IMG_SPACE12);
354 maFISpace2.SetPosPixel(POS_IMG_SPACE22);
355 maFIndent1.SetPosPixel(POS_IMG_INDENT12);
356 maFIndent2.SetPosPixel(POS_IMG_INDENT22);
357 maFIndent3.SetPosPixel(POS_IMG_INDENT32);
358 Size aSize(GetOutputSizePixel().Width(),PARA_SECTIONPAGE_HEIGHT_2);
359 aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
360 aSize.setWidth(GetOutputSizePixel().Width());
361 SetSizePixel(aSize);
362 }
363
364 maLayouter.Layout();
365
366 if (mxSidebar.is())
367 mxSidebar->requestLayout();
368 }
369
370
371
372
Resize(void)373 void ParaPropertyPanel::Resize (void)
374 {
375 switch (maContext.GetCombinedContext_DI())
376 {
377 case CombinedEnumContext(Application_Calc, Context_DrawText):
378 case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
379 case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
380 ReSize(false);
381 break;
382
383 default:
384 ReSize(true);
385 break;
386 }
387 }
388
389
390
391
EndSpacingPopupMode(void)392 void ParaPropertyPanel::EndSpacingPopupMode (void)
393 {
394 maLineSpacePopup.Hide();
395 }
396
EndBulletsPopupMode(void)397 void ParaPropertyPanel::EndBulletsPopupMode (void)
398 {
399 //i122054, Missed following line, for collapse the bullets popup
400 maBulletsPopup.Hide();
401 }
402
EndNumberingPopupMode(void)403 void ParaPropertyPanel::EndNumberingPopupMode (void)
404 {
405 //i122054, Missed following line, for collapse the numbering popup
406 maNumberingPopup.Hide();
407 }
408
409
InitToolBoxAlign()410 void ParaPropertyPanel::InitToolBoxAlign()
411 {
412 const bool bIsHighContrastModeActive (Theme::IsHighContrastMode());
413 mpAlignToolBox->SetItemImage(TOOLBOX_ITEM1, maLeftAlignControl.GetIcon(bIsHighContrastModeActive));
414 mpAlignToolBox->SetItemImage(TOOLBOX_ITEM2, maCenterAlignControl.GetIcon(bIsHighContrastModeActive));
415 mpAlignToolBox->SetItemImage(TOOLBOX_ITEM3, maRightAlignControl.GetIcon(bIsHighContrastModeActive));
416 mpAlignToolBox->SetItemImage(TOOLBOX_ITEM4, maJustifyAlignControl.GetIcon(bIsHighContrastModeActive));
417
418 Link aLink = LINK( this, ParaPropertyPanel, AlignStyleModifyHdl_Impl );
419 mpAlignToolBox->SetSelectHdl( aLink );
420 Size aTbxSize (mpAlignToolBox->CalcWindowSizePixel());
421 mpAlignToolBox->SetOutputSizePixel( aTbxSize );
422 }
423
InitToolBoxVertAlign()424 void ParaPropertyPanel::InitToolBoxVertAlign()
425 {
426 const bool bIsHighContrastModeActive (Theme::IsHighContrastMode());
427 mpTBxVertAlign->SetItemImage(IID_VERT_TOP, maVertTop.GetIcon(bIsHighContrastModeActive));
428 mpTBxVertAlign->SetItemImage(IID_VERT_CENTER, maVertCenter.GetIcon(bIsHighContrastModeActive));
429 mpTBxVertAlign->SetItemImage(IID_VERT_BOTTOM, maVertBottom.GetIcon(bIsHighContrastModeActive));
430 mpTBxVertAlign->SetSelectHdl(LINK(this,ParaPropertyPanel,VertTbxSelectHandler));
431 Size aTbxSize (mpTBxVertAlign->CalcWindowSizePixel());
432 mpTBxVertAlign->SetOutputSizePixel( aTbxSize );
433 }
434
435
InitToolBoxIndent()436 void ParaPropertyPanel::InitToolBoxIndent()
437 {
438 Link aLink = LINK( this, ParaPropertyPanel, ModifyIndentHdl_Impl );
439 mpLeftIndent->SetModifyHdl( aLink );
440 mpRightIndent->SetModifyHdl( aLink );
441 mpFLineIndent->SetModifyHdl( aLink );
442
443 mpLeftIndent->SetAccessibleName(mpLeftIndent->GetQuickHelpText());
444 mpRightIndent->SetAccessibleName(mpRightIndent->GetQuickHelpText());
445 mpFLineIndent->SetAccessibleName(mpFLineIndent->GetQuickHelpText());
446
447 const bool bIsHighContrastModeActive (Theme::IsHighContrastMode());
448
449 if( Application::GetSettings().GetLayoutRTL())
450 {
451 mpTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM1, maIncIndentControl.GetIcon(bIsHighContrastModeActive));
452 mpTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM2, maDecIndentControl.GetIcon(bIsHighContrastModeActive));
453 }
454 else
455 {
456 mpTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM1, maIncIndentControl.GetIcon(bIsHighContrastModeActive));
457 mpTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM2, maDecIndentControl.GetIcon(bIsHighContrastModeActive));
458 }
459 mpTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM3,maIndHang);
460 aLink = LINK( this, ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl );
461 mpTbxIndent_IncDec->SetSelectHdl(aLink);
462 m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric();
463 Size aTbxSize = mpTbxIndent_IncDec->CalcWindowSizePixel();
464 mpTbxIndent_IncDec->SetOutputSizePixel( aTbxSize );
465
466 if( Application::GetSettings().GetLayoutRTL())
467 {
468 mpTbxProDemote->SetItemImage(TOOLBOX_ITEM1, maOutLineLeftControl.GetIcon(bIsHighContrastModeActive));
469 mpTbxProDemote->SetItemImage(TOOLBOX_ITEM2, maOutLineRightControl.GetIcon(bIsHighContrastModeActive));
470 }
471 else
472 {
473 mpTbxProDemote->SetItemImage(TOOLBOX_ITEM1, maOutLineLeftControl.GetIcon(bIsHighContrastModeActive));
474 mpTbxProDemote->SetItemImage(TOOLBOX_ITEM2, maOutLineRightControl.GetIcon(bIsHighContrastModeActive));
475 }
476 mpTbxProDemote->SetItemImage(TOOLBOX_ITEM3,maIndHang);
477 aLink = LINK( this, ParaPropertyPanel, ClickProDemote_Hdl_Impl );
478 mpTbxProDemote->SetSelectHdl(aLink);
479 m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric();
480 aTbxSize = mpTbxProDemote->CalcWindowSizePixel();
481 mpTbxProDemote->SetOutputSizePixel( aTbxSize );
482 }
483
InitToolBoxBGColor()484 void ParaPropertyPanel::InitToolBoxBGColor()
485 {
486 mpColorUpdater.reset(new ::svx::ToolboxButtonColorUpdater(SID_BACKGROUND_COLOR, TBI_BACK_COLOR, mpTBxBackColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW ));
487
488 mpTBxBackColor->SetItemImage(TBI_BACK_COLOR, GetDisplayBackground().GetColor().IsDark()? maImgBackColorHigh : maImgBackColor);
489 mpTBxBackColor->SetItemBits( TBI_BACK_COLOR, mpTBxBackColor->GetItemBits( TBI_BACK_COLOR ) | TIB_DROPDOWNONLY );
490
491 Link aLink = LINK(this, ParaPropertyPanel, ToolBoxBackColorDDHandler);
492 mpTBxBackColor->SetDropdownClickHdl ( aLink );
493 mpTBxBackColor->SetSelectHdl ( aLink );
494 Size aTbxSize (mpTBxBackColor->CalcWindowSizePixel());
495 mpTBxBackColor->SetOutputSizePixel( aTbxSize );
496 }
497
InitToolBoxBulletsNumbering()498 void ParaPropertyPanel::InitToolBoxBulletsNumbering()
499 {
500 const bool bIsHighContrastModeActive (Theme::IsHighContrastMode());
501 mpTBxNumBullet->SetItemImage(IID_BULLET, maBulletOnOff.GetIcon(bIsHighContrastModeActive));
502 mpTBxNumBullet->SetItemImage(IID_NUMBER, maNumberOnOff.GetIcon(bIsHighContrastModeActive));
503
504 mpTBxNumBullet->SetDropdownClickHdl(LINK(this,ParaPropertyPanel,NumBTbxDDHandler));
505 mpTBxNumBullet->SetSelectHdl(LINK(this,ParaPropertyPanel,NumBTbxSelectHandler));
506 Size aTbxSize (mpTBxNumBullet->CalcWindowSizePixel());
507 mpTBxNumBullet->SetOutputSizePixel( aTbxSize );
508 }
InitToolBoxSpacing()509 void ParaPropertyPanel::InitToolBoxSpacing()
510 {
511 Link aLink = LINK( this, ParaPropertyPanel, ULSpaceHdl_Impl );
512 mpTopDist->SetModifyHdl(aLink);
513 mpBottomDist->SetModifyHdl( aLink );
514
515 mpTopDist->SetAccessibleName(mpTopDist->GetQuickHelpText());
516 mpBottomDist->SetAccessibleName(mpBottomDist->GetQuickHelpText());
517
518 // Use a form of image loading that can handle both .uno:<command>
519 // and private:graphirepository... syntax. This is necessary to
520 // handle the workaround for accessing the images of commands
521 // ParaspaceIncrease and ParaspaceDecrease.
522 // See issue 122446 for more details.
523 mpTbxUL_IncDec->SetItemImage(
524 BT_TBX_UL_INC,
525 sfx2::sidebar::Tools::GetImage(mpTbxUL_IncDec->GetItemCommand(BT_TBX_UL_INC), mxFrame));
526 mpTbxUL_IncDec->SetItemImage(
527 BT_TBX_UL_DEC,
528 sfx2::sidebar::Tools::GetImage(mpTbxUL_IncDec->GetItemCommand(BT_TBX_UL_DEC), mxFrame));
529
530 aLink = LINK( this, ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl );
531 mpTbxUL_IncDec->SetSelectHdl(aLink);
532 m_eULSpaceUnit = maULSpaceControl.GetCoreMetric();
533 Size aTbxSize = mpTbxUL_IncDec->CalcWindowSizePixel();
534 mpTbxUL_IncDec->SetOutputSizePixel( aTbxSize );
535 }
InitToolBoxLineSpacing()536 void ParaPropertyPanel::InitToolBoxLineSpacing()
537 {
538 Link aLink = LINK( this, ParaPropertyPanel, ClickLineSPDropDownHdl_Impl );
539 mpLineSPTbx->SetDropdownClickHdl( aLink );
540 mpLineSPTbx->SetSelectHdl( aLink ); //support keyinput "ENTER"
541 mpLineSPTbx->SetItemBits( TOOLBOX_ITEM1, mpLineSPTbx->GetItemBits( TOOLBOX_ITEM1 ) | TIB_DROPDOWNONLY );
542 mpLineSPTbx->SetItemImage(TOOLBOX_ITEM1,maSpace3);
543 Size aTbxSize = mpLineSPTbx->CalcWindowSizePixel();
544 mpLineSPTbx->SetOutputSizePixel( aTbxSize );
545 }
546
initial()547 void ParaPropertyPanel::initial()
548 {
549 mpFTUL->SetBackground(Wallpaper());
550 mpFTIndent->SetBackground(Wallpaper());
551 maFISpace1.SetBackground(Wallpaper());
552 maFISpace2.SetBackground(Wallpaper());
553 maFIndent1.SetBackground(Wallpaper());
554 maFIndent2.SetBackground(Wallpaper());
555 maFIndent3.SetBackground(Wallpaper());
556
557 maFISpace1.SetImage(maSpace1);
558 maFISpace2.SetImage(maSpace2);
559 maFIndent1.SetImage(maIndent3);
560 maFIndent2.SetImage(maIndent2);
561 maFIndent3.SetImage(maIndent1);
562
563 GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_LEFT,sal_True,sal_False);
564 GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_CENTER,sal_True,sal_False);
565 GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_RIGHT,sal_True,sal_False);
566 GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_BLOCK,sal_True,sal_False);
567
568 //toolbox
569 InitToolBoxAlign();
570 InitToolBoxVertAlign();
571 InitToolBoxIndent();
572 InitToolBoxBGColor();
573 InitToolBoxBulletsNumbering();
574 InitToolBoxSpacing();
575 InitToolBoxLineSpacing();
576
577 #ifdef HAS_IA2
578 mpAlignToolBox->SetAccRelationLabeledBy(&mpAlignToolBox);
579 mpTBxVertAlign->SetMpSubEditAccLableBy(&mpTBxVertAlign);
580 mpTBxNumBullet->SetAccRelationLabeledBy(&mpTBxNumBullet);
581 mpTBxBackColor->SetMpSubEditAccLableBy(&mpTBxBackColor);
582 mpFTUL->SetAccRelationLabeledBy(&mpFTUL);
583 mpTbxUL_IncDec->SetAccRelationLabeledBy(&mpTbxUL_IncDec);
584 mpTopDist->SetAccRelationLabeledBy(&mpTopDist);
585 mpBottomDist->SetAccRelationLabeledBy(&mpBottomDist);
586 mpLineSPTbx->SetAccRelationLabeledBy(&mpLineSPTbx);
587 mpFTIndent->SetAccRelationLabeledBy(&mpFTIndent);
588 mpTbxIndent_IncDec->SetAccRelationLabeledBy(&mpTbxIndent_IncDec);
589 mpTbxProDemote->SetAccRelationLabeledBy(&mpTbxProDemote);
590 mpLeftIndent->SetAccRelationLabeledBy(&mpLeftIndent);
591 mpRightIndent->SetAccRelationLabeledBy(&mpRightIndent);
592 mpFLineIndent->SetAccRelationLabeledBy(&mpFLineIndent);
593 mpColorUpdater->SetAccRelationLabeledBy(&mpColorUpdater);
594 #endif
595 }
596
InitImageList(::boost::scoped_ptr<ToolBox> & rTbx,ImageList & rImglst,ImageList & rImgHlst)597 void ParaPropertyPanel::InitImageList(::boost::scoped_ptr<ToolBox>& rTbx, ImageList& rImglst, ImageList& rImgHlst)
598 {
599 sal_Bool bHighContrast = GetDisplayBackground().GetColor().IsDark();
600
601 ImageList& rImgLst = bHighContrast ? rImgHlst : rImglst;
602
603 sal_uInt16 nCount = rTbx->GetItemCount();
604 for (sal_uInt16 i = 0; i < nCount; i++)
605 {
606 sal_uInt16 nId = rTbx->GetItemId(i);
607 rTbx->SetItemImage( nId, rImgLst.GetImage( nId ) );
608 }
609 }
610
611 //===========================for Numbering & Bullet================================================
612
613
614
IMPL_LINK(ParaPropertyPanel,NumBTbxDDHandler,ToolBox *,pToolBox)615 IMPL_LINK(ParaPropertyPanel, NumBTbxDDHandler, ToolBox*, pToolBox)
616 {
617 sal_uInt16 nId = pToolBox->GetCurItemId();
618
619 EndTracking();
620 pToolBox->SetItemDown( nId, sal_True );
621
622 if (nId == 1)
623 {
624 maBulletsPopup.UpdateValueSet();
625 maBulletsPopup.Show(*pToolBox);
626 }
627 else if (nId == 2)
628 {
629 maNumberingPopup.UpdateValueSet();
630 maNumberingPopup.Show(*pToolBox);
631 }
632 pToolBox->SetItemDown( nId, sal_False );
633 return 0;
634 }
635
IMPL_LINK(ParaPropertyPanel,NumBTbxSelectHandler,ToolBox *,pToolBox)636 IMPL_LINK(ParaPropertyPanel, NumBTbxSelectHandler, ToolBox*, pToolBox)
637 {
638 sal_uInt16 nId = pToolBox->GetCurItemId();
639 sal_uInt16 nSID = SID_TABLE_VERT_NONE;
640
641 EndTracking();
642 if (nId == 1)
643 {
644 nSID = FN_NUM_BULLET_ON;
645 }
646 else if ( nId == 2)
647 {
648 nSID = FN_NUM_NUMBERING_ON;
649 }
650 SfxBoolItem aBoolItem(nSID, sal_True);
651 GetBindings()->GetDispatcher()->Execute(nSID, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
652
653 return 0;
654 }
655
656
657 //================================for Vertical Alignment========================================
658
659
660
IMPL_LINK(ParaPropertyPanel,VertTbxSelectHandler,ToolBox *,pToolBox)661 IMPL_LINK(ParaPropertyPanel, VertTbxSelectHandler, ToolBox*, pToolBox)
662 {
663 sal_uInt16 nId = pToolBox->GetCurItemId();
664 sal_uInt16 nSID = SID_TABLE_VERT_NONE;
665 EndTracking();
666 if (nId == 1)
667 {
668 nSID = SID_TABLE_VERT_NONE;
669 mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_CHECK);
670 mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
671 mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
672 }
673 else if (nId == 2)
674 {
675 nSID = SID_TABLE_VERT_CENTER;
676 mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
677 mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_CHECK);
678 mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
679 }
680 else if (nId == 3)
681 {
682 nSID = SID_TABLE_VERT_BOTTOM;
683 mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
684 mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
685 mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_CHECK);
686 }
687 SfxBoolItem aBoolItem(nSID, sal_True);
688 GetBindings()->GetDispatcher()->Execute(nSID, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
689
690 return 0;
691 }
692
VertStateChanged(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)693 void ParaPropertyPanel::VertStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState)
694 {
695 if (eState < SFX_ITEM_DONTCARE)
696 {
697 mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
698 mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
699 mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
700 mpTBxVertAlign->EnableItem(IID_VERT_TOP, sal_False);
701 mpTBxVertAlign->EnableItem(IID_VERT_CENTER, sal_False);
702 mpTBxVertAlign->EnableItem(IID_VERT_BOTTOM, sal_False);
703 }
704 else
705 {
706 mpTBxVertAlign->EnableItem(IID_VERT_TOP, sal_True);
707 mpTBxVertAlign->EnableItem(IID_VERT_CENTER, sal_True);
708 mpTBxVertAlign->EnableItem(IID_VERT_BOTTOM, sal_True);
709 if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem)))
710 {
711 const SfxBoolItem* pItem= (const SfxBoolItem*)pState;
712 sal_Bool aBool = (sal_Bool)pItem->GetValue();
713
714 if (aBool)
715 {
716 if (nSID == SID_TABLE_VERT_NONE)
717 {
718 mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_CHECK);
719 mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
720 mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
721 }
722 else if (nSID == SID_TABLE_VERT_CENTER)
723 {
724 mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
725 mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_CHECK);
726 mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
727 }
728 else if (nSID == SID_TABLE_VERT_BOTTOM)
729 {
730 mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
731 mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
732 mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_CHECK);
733 }
734 }
735 else
736 {
737 if (nSID == SID_TABLE_VERT_NONE)
738 {
739 mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
740 }
741 else if (nSID == SID_TABLE_VERT_CENTER)
742 {
743 mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
744 }
745 else if (nSID == SID_TABLE_VERT_BOTTOM)
746 {
747 mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
748 }
749 }
750 }
751 else
752 {
753 mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
754 mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
755 mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
756 }
757 }
758 }
759 //==================================for Background color=====================
760
IMPL_LINK(ParaPropertyPanel,ToolBoxBackColorDDHandler,ToolBox *,pToolBox)761 IMPL_LINK(ParaPropertyPanel, ToolBoxBackColorDDHandler,ToolBox*, pToolBox)
762 {
763 sal_uInt16 nId = pToolBox->GetCurItemId();
764 OSL_ASSERT(nId == TBI_BACK_COLOR);
765 if(nId == TBI_BACK_COLOR)
766 {
767 pToolBox->SetItemDown( nId, true );
768 maBGColorPopup.Show(*pToolBox);
769 maBGColorPopup.SetCurrentColor(maColor, mbColorAvailable);
770 }
771 return 0;
772 }
773
IMPL_LINK(ParaPropertyPanel,ImplPopupModeEndHdl,FloatingWindow *,EMPTYARG)774 IMPL_LINK( ParaPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
775 {
776 return 0;
777 }
778
ShowMenu(void)779 void ParaPropertyPanel::ShowMenu (void)
780 {
781 if (mpBindings != NULL)
782 {
783 SfxDispatcher* pDispatcher = mpBindings->GetDispatcher();
784 if (pDispatcher != NULL)
785 pDispatcher->Execute(SID_PARA_DLG, SFX_CALLMODE_ASYNCHRON);
786 }
787 }
788
ParaBKGStateChanged(sal_uInt16,SfxItemState eState,const SfxPoolItem * pState)789 void ParaPropertyPanel::ParaBKGStateChanged(sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState)
790 {
791 if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem))
792 {
793 const SvxColorItem* pItem = (const SvxColorItem*)pState;
794 maColor = pItem->GetValue();
795 mbColorAvailable = sal_True;
796 mpColorUpdater->Update(maColor);
797 }
798 else
799 {
800 mbColorAvailable = sal_False;
801 maColor.SetColor(COL_AUTO);
802 mpColorUpdater->Update(maColor);
803 }
804 }
805
SetBGColor(const String &,const Color aColor)806 void ParaPropertyPanel::SetBGColor (
807 const String& /* rsColorName */,
808 const Color aColor)
809 {
810 SvxColorItem aColorItem(aColor, SID_BACKGROUND_COLOR);
811 mpBindings->GetDispatcher()->Execute(SID_BACKGROUND_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
812 maColor = aColor;
813 }
814
815 //==================================for Paragraph Alignment=====================
IMPL_LINK(ParaPropertyPanel,AlignStyleModifyHdl_Impl,ToolBox *,pBox)816 IMPL_LINK( ParaPropertyPanel, AlignStyleModifyHdl_Impl, ToolBox*, pBox )
817 {
818 switch (pBox->GetCurItemId())
819 {
820 case BT_SUBSTLEFT:
821 {
822 pBox->SetItemState(BT_SUBSTLEFT,STATE_CHECK);
823 pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
824 pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
825 pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
826 SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True );
827 GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_LEFT, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
828 }
829 break;
830 case BT_SUBSTCENTER:
831 {
832 pBox->SetItemState(BT_SUBSTCENTER,STATE_CHECK);
833 pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
834 pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
835 pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
836 SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True );
837 GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_CENTER, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
838 }
839 break;
840 case BT_SUBSTRIGHT:
841 {
842 pBox->SetItemState(BT_SUBSTRIGHT,STATE_CHECK);
843 pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
844 pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
845 pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
846 SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True );
847 GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_RIGHT, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
848 }
849 break;
850 case BT_SUBSTJUSTIFY:
851 {
852 pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_CHECK);
853 pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
854 pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
855 pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
856 SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True );
857 GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_BLOCK, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
858 }
859 break;
860 }
861
862 return 0;
863 }
864 //==================================for Paragraph Indent=====================
865 IMPL_LINK( ParaPropertyPanel, ModifyIndentHdl_Impl, SvxRelativeField*, /* pBox */ )
866 {
867 SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
868 aMargin.SetTxtLeft( (const long)GetCoreValue( *mpLeftIndent.get(), m_eLRSpaceUnit ) );
869 aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent.get(), m_eLRSpaceUnit ) );
870 aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ) );
871
872 GetBindings()->GetDispatcher()->Execute(
873 SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
874 return 0;
875 }
876
IMPL_LINK(ParaPropertyPanel,ClickIndent_IncDec_Hdl_Impl,ToolBox *,pControl)877 IMPL_LINK(ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl, ToolBox *, pControl)
878 {
879 switch (pControl->GetCurItemId())
880 {
881 case INDENT_INCREMENT:
882 {
883 switch (maContext.GetCombinedContext_DI())
884 {
885 case CombinedEnumContext(Application_WriterVariants, Context_Default):
886 case CombinedEnumContext(Application_WriterVariants, Context_Text):
887 case CombinedEnumContext(Application_WriterVariants, Context_Table):
888 {
889 SfxBoolItem aMargin( SID_INC_INDENT, sal_True );
890 GetBindings()->GetDispatcher()->Execute(
891 SID_INC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L);
892 }
893 break;
894 default:
895 {
896 SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
897
898 maTxtLeft += INDENT_STEP;
899 sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
900 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
901 aMargin.SetTxtLeft( (const long)nVal );
902 aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent.get(), m_eLRSpaceUnit ) );
903 aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ) );
904
905 GetBindings()->GetDispatcher()->Execute(
906 SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
907 }
908 }
909 }
910 break;
911 case INDENT_DECREMENT:
912 {
913 switch (maContext.GetCombinedContext_DI())
914 {
915 case CombinedEnumContext(Application_WriterVariants, Context_Default):
916 case CombinedEnumContext(Application_WriterVariants, Context_Text):
917 case CombinedEnumContext(Application_WriterVariants, Context_Table):
918 {
919 SfxBoolItem aMargin( SID_DEC_INDENT, sal_True );
920 GetBindings()->GetDispatcher()->Execute(
921 SID_DEC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L);
922 }
923 break;
924 default:
925 {
926 if((maTxtLeft - INDENT_STEP) < 0)
927 maTxtLeft = DEFAULT_VALUE;
928 else
929 maTxtLeft -= INDENT_STEP;
930
931 SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
932
933 sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
934 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
935
936 aMargin.SetTxtLeft( (const long)nVal );
937 aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent.get(), m_eLRSpaceUnit ) );
938 aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ) );
939
940 GetBindings()->GetDispatcher()->Execute(
941 SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
942 }
943 }
944 }
945 break;
946 case ID_HANGING_INDENT:
947 {
948 SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
949 aMargin.SetTxtLeft( (const long)GetCoreValue( *mpLeftIndent.get(), m_eLRSpaceUnit ) + (const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ) );
950 aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent.get(), m_eLRSpaceUnit ) );
951 aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ))*(-1) );
952
953 GetBindings()->GetDispatcher()->Execute(
954 SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
955 }
956 break;
957 }
958 return( 0L );
959 }
960
IMPL_LINK(ParaPropertyPanel,ClickProDemote_Hdl_Impl,ToolBox *,pControl)961 IMPL_LINK(ParaPropertyPanel, ClickProDemote_Hdl_Impl, ToolBox *, pControl)
962 {
963 switch (pControl->GetCurItemId())
964 {
965 case BT_TBX_INDENT_PROMOTE:
966 {
967 GetBindings()->GetDispatcher()->Execute( SID_OUTLINE_RIGHT, SFX_CALLMODE_RECORD );
968 }
969 break;
970 case BT_TBX_INDENT_DEMOTE:
971 {
972 GetBindings()->GetDispatcher()->Execute( SID_OUTLINE_LEFT, SFX_CALLMODE_RECORD );
973 }
974 break;
975 case SD_HANGING_INDENT:
976 {
977 SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
978 aMargin.SetTxtLeft( (const long)GetCoreValue( *mpLeftIndent.get(), m_eLRSpaceUnit ) + (const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ) );
979 aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent.get(), m_eLRSpaceUnit ) );
980 aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ))*(-1) );
981
982 GetBindings()->GetDispatcher()->Execute( SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
983 }
984 break;
985 }
986 return( 0L );
987 }
988 //==================================for Paragraph Line Spacing=====================
989
IMPL_LINK(ParaPropertyPanel,ClickLineSPDropDownHdl_Impl,ToolBox *,pBox)990 IMPL_LINK( ParaPropertyPanel, ClickLineSPDropDownHdl_Impl, ToolBox*, pBox )
991 {
992
993 const sal_uInt16 nId = pBox->GetCurItemId();
994 OSL_ASSERT(nId == TOOLBOX_ITEM1);
995 if(nId == TOOLBOX_ITEM1)
996 {
997 pBox->SetItemDown( nId, true );
998 maLineSpacePopup.Rearrange(meLnSpState,m_eMetricUnit,mpLnSPItem,maContext);
999 maLineSpacePopup.Show(*pBox);
1000
1001 }
1002 return (0L);
1003 }
1004
1005 //==================================for Paragraph Spacing=====================
1006 IMPL_LINK( ParaPropertyPanel, ULSpaceHdl_Impl, SvxRelativeField*, /* pBox */)
1007 {
1008 SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE );
1009 aMargin.SetUpper( (sal_uInt16)GetCoreValue( *mpTopDist, m_eULSpaceUnit ) );
1010 aMargin.SetLower( (sal_uInt16)GetCoreValue( *mpBottomDist, m_eULSpaceUnit ) );
1011
1012 GetBindings()->GetDispatcher()->Execute(
1013 SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
1014 return 0L;
1015 }
1016
IMPL_LINK(ParaPropertyPanel,ClickUL_IncDec_Hdl_Impl,ToolBox *,pControl)1017 IMPL_LINK(ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl, ToolBox *, pControl)
1018 {
1019 switch (pControl->GetCurItemId())
1020 {
1021 case BT_TBX_UL_INC:
1022 {
1023 SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE );
1024
1025 maUpper += UL_STEP;
1026 sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1027 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
1028 aMargin.SetUpper( (const sal_uInt16)nVal );
1029
1030 maLower += UL_STEP;
1031 nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1032 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
1033 aMargin.SetLower( (const sal_uInt16)nVal );
1034
1035 GetBindings()->GetDispatcher()->Execute(
1036 SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
1037 }
1038 break;
1039 case BT_TBX_UL_DEC:
1040 {
1041 SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE );
1042
1043 if( maUpper >= UL_STEP )
1044 {
1045 maUpper -= UL_STEP;
1046 sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1047 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
1048 aMargin.SetUpper( (const sal_uInt16)nVal );
1049 }
1050 else
1051 aMargin.SetUpper( DEFAULT_VALUE );
1052 if( maLower >= UL_STEP )
1053 {
1054 maLower -= UL_STEP;
1055 sal_Int64 nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1056 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
1057 aMargin.SetLower( (const sal_uInt16)nVal );
1058 }
1059 else
1060 aMargin.SetLower( DEFAULT_VALUE );
1061
1062 GetBindings()->GetDispatcher()->Execute(
1063 SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
1064 }
1065 break;
1066 }
1067 return( 0L );
1068 }
1069
1070 //==================================for Paragraph State change=====================
NotifyItemUpdate(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState,const bool bIsEnabled)1071 void ParaPropertyPanel::NotifyItemUpdate(
1072 sal_uInt16 nSID,
1073 SfxItemState eState,
1074 const SfxPoolItem* pState,
1075 const bool bIsEnabled)
1076 {
1077 (void)bIsEnabled;
1078
1079 switch (nSID)
1080 {
1081 case SID_ATTR_METRIC:
1082 {
1083 m_eMetricUnit = GetCurrentUnit(eState,pState);
1084 if( m_eMetricUnit!=m_last_eMetricUnit )
1085 {
1086 SetFieldUnit( *mpLeftIndent, m_eMetricUnit );
1087 SetFieldUnit( *mpRightIndent, m_eMetricUnit );
1088 SetFieldUnit( *mpFLineIndent, m_eMetricUnit );
1089 SetFieldUnit( *mpTopDist, m_eMetricUnit );
1090 SetFieldUnit( *mpBottomDist, m_eMetricUnit );
1091 }
1092 m_last_eMetricUnit = m_eMetricUnit;
1093 }
1094 break;
1095
1096 case SID_ATTR_PARA_LRSPACE:
1097 StateChangedIndentImpl( nSID, eState, pState );
1098 break;
1099
1100 case SID_ATTR_PARA_LINESPACE:
1101 StateChangedLnSPImpl( nSID, eState, pState );
1102 break;
1103
1104 case SID_ATTR_PARA_ULSPACE:
1105 StateChangedULImpl( nSID, eState, pState );
1106 break;
1107
1108 case SID_ATTR_PARA_ADJUST_LEFT:
1109 case SID_ATTR_PARA_ADJUST_CENTER:
1110 case SID_ATTR_PARA_ADJUST_RIGHT:
1111 case SID_ATTR_PARA_ADJUST_BLOCK:
1112 StateChangedAlignmentImpl( nSID, eState, pState );
1113 break;
1114
1115 case SID_OUTLINE_LEFT:
1116 case SID_OUTLINE_RIGHT:
1117 StateChangeOutLineImpl( nSID, eState, pState );
1118 break;
1119
1120 case SID_INC_INDENT:
1121 case SID_DEC_INDENT:
1122 StateChangeIncDecImpl( nSID, eState, pState );
1123 break;
1124
1125 case FN_NUM_NUMBERING_ON:
1126 case FN_NUM_BULLET_ON:
1127 StateChangeBulletNumImpl( nSID, eState, pState );
1128 break;
1129
1130 case FN_BUL_NUM_RULE_INDEX:
1131 case FN_NUM_NUM_RULE_INDEX:
1132 StateChangeBulletNumRuleImpl( nSID, eState, pState );
1133 break;
1134
1135 case SID_TABLE_VERT_NONE:
1136 case SID_TABLE_VERT_CENTER:
1137 case SID_TABLE_VERT_BOTTOM:
1138 VertStateChanged( nSID, eState, pState);
1139 break;
1140
1141 case SID_BACKGROUND_COLOR:
1142 ParaBKGStateChanged(nSID, eState, pState);
1143 break;
1144 }
1145 }
1146
1147
1148
1149
StateChangedAlignmentImpl(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)1150 void ParaPropertyPanel::StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1151 {
1152 if( eState >= SFX_ITEM_AVAILABLE )
1153 {
1154 const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
1155 bool IsChecked = (bool)pItem->GetValue();
1156 switch (nSID)
1157 {
1158 case SID_ATTR_PARA_ADJUST_LEFT:
1159 {
1160 if(IsChecked)
1161 {
1162 mpAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_CHECK);
1163 mpAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1164 mpAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1165 mpAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1166 }
1167 else
1168 mpAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1169 }
1170 break;
1171 case SID_ATTR_PARA_ADJUST_CENTER:
1172 {
1173 if(IsChecked)
1174 {
1175 mpAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_CHECK);
1176 mpAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1177 mpAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1178 mpAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1179 }
1180 else
1181 mpAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1182 }
1183 break;
1184 case SID_ATTR_PARA_ADJUST_RIGHT:
1185 {
1186 if(IsChecked)
1187 {
1188 mpAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_CHECK);
1189 mpAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1190 mpAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1191 mpAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1192 }
1193 else
1194 mpAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1195 }
1196 break;
1197 case SID_ATTR_PARA_ADJUST_BLOCK:
1198 {
1199 if(IsChecked)
1200 {
1201 mpAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_CHECK);
1202 mpAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1203 mpAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1204 mpAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1205 }
1206 else
1207 mpAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1208 }
1209 break;
1210 }
1211 }
1212 else if( eState == SFX_ITEM_DISABLED )
1213 {
1214 }
1215 else if ( eState == SFX_ITEM_DONTCARE )
1216 {
1217 switch (nSID)
1218 {
1219 case SID_ATTR_PARA_ADJUST_LEFT:
1220 mpAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1221 break;
1222 case SID_ATTR_PARA_ADJUST_CENTER:
1223 mpAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1224 break;
1225 case SID_ATTR_PARA_ADJUST_RIGHT:
1226 mpAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1227 break;
1228 case SID_ATTR_PARA_ADJUST_BLOCK:
1229 mpAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1230 break;
1231 }
1232 }
1233 }
1234
StateChangedIndentImpl(sal_uInt16,SfxItemState eState,const SfxPoolItem * pState)1235 void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState )
1236 {
1237 switch (maContext.GetCombinedContext_DI())
1238 {
1239
1240 case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
1241 case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
1242 case CombinedEnumContext(Application_Calc, Context_DrawText):
1243 {
1244 mpLeftIndent->SetMin( DEFAULT_VALUE );
1245 mpRightIndent->SetMin( DEFAULT_VALUE );
1246 mpFLineIndent->SetMin( DEFAULT_VALUE );
1247 mpTbxIndent_IncDec->Show();
1248 mpTbxProDemote->Hide();
1249 }
1250 break;
1251 case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
1252 case CombinedEnumContext(Application_DrawImpress, Context_Draw):
1253 case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
1254 case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
1255 case CombinedEnumContext(Application_DrawImpress, Context_Table):
1256 {
1257 mpLeftIndent->SetMin( DEFAULT_VALUE );
1258 mpRightIndent->SetMin( DEFAULT_VALUE );
1259 mpFLineIndent->SetMin( DEFAULT_VALUE );
1260 mpTbxIndent_IncDec->Hide();
1261 mpTbxProDemote->Show();
1262 }
1263 break;
1264 case CombinedEnumContext(Application_WriterVariants, Context_Default):
1265 case CombinedEnumContext(Application_WriterVariants, Context_Text):
1266 case CombinedEnumContext(Application_WriterVariants, Context_Table):
1267 {
1268 mpLeftIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
1269 mpRightIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
1270 mpFLineIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
1271 mpTbxIndent_IncDec->Show();
1272 mpTbxProDemote->Hide();
1273 }
1274 break;
1275 }
1276
1277 if( pState && eState >= SFX_ITEM_AVAILABLE )
1278 {
1279 SvxLRSpaceItem* pSpace = ( SvxLRSpaceItem*)pState;
1280 maTxtLeft = pSpace->GetTxtLeft();
1281 maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
1282 maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1283
1284 long aTxtRight = pSpace->GetRight();
1285 aTxtRight = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
1286 aTxtRight = OutputDevice::LogicToLogic( aTxtRight, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1287
1288 long aTxtFirstLineOfst = pSpace->GetTxtFirstLineOfst();
1289 aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
1290 aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1291
1292 long nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1293 nVal = (long)mpLeftIndent->Normalize( (long)nVal );
1294 mpLeftIndent->SetValue( nVal, FUNIT_100TH_MM );
1295
1296 if ( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text)
1297 && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default)
1298 && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Table))
1299 {
1300 mpFLineIndent->SetMin( nVal*(-1), FUNIT_100TH_MM );
1301 }
1302
1303 long nrVal = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1304 nrVal = (long)mpRightIndent->Normalize( (long)nrVal );
1305 mpRightIndent->SetValue( nrVal, FUNIT_100TH_MM );
1306
1307 long nfVal = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1308 nfVal = (long)mpFLineIndent->Normalize( (long)nfVal );
1309 mpFLineIndent->SetValue( nfVal, FUNIT_100TH_MM );
1310
1311 switch (maContext.GetCombinedContext_DI())
1312 {
1313 case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
1314 case CombinedEnumContext(Application_WriterVariants, Context_Text):
1315 case CombinedEnumContext(Application_WriterVariants, Context_Default):
1316 case CombinedEnumContext(Application_WriterVariants, Context_Table):
1317 case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
1318 {
1319 mpLeftIndent->SetMax( MAX_SW - nrVal, FUNIT_100TH_MM );
1320 mpRightIndent->SetMax( MAX_SW - nVal, FUNIT_100TH_MM );
1321 mpFLineIndent->SetMax( MAX_SW - nVal - nrVal, FUNIT_100TH_MM );
1322 }
1323 break;
1324 case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
1325 case CombinedEnumContext(Application_DrawImpress, Context_Draw):
1326 case CombinedEnumContext(Application_DrawImpress, Context_Table):
1327 case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
1328 case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
1329 {
1330 mpLeftIndent->SetMax( MAX_SC_SD - nrVal, FUNIT_100TH_MM );
1331 mpRightIndent->SetMax( MAX_SC_SD - nVal, FUNIT_100TH_MM );
1332 mpFLineIndent->SetMax( MAX_SC_SD - nVal - nrVal, FUNIT_100TH_MM );
1333 }
1334 }
1335
1336 mpTbxIndent_IncDec->Enable();
1337 mpTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_True);
1338 if ( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text)
1339 && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default)
1340 && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Table) )
1341 {
1342 mpTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True);
1343 mpTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True);
1344 }
1345
1346 mpTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True);
1347 }
1348 else if( eState == SFX_ITEM_DISABLED )
1349 {
1350 mpLeftIndent-> Disable();
1351 mpRightIndent->Disable();
1352 mpFLineIndent->Disable();
1353 mpTbxIndent_IncDec->Disable();
1354 if( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text) &&
1355 maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default) &&
1356 maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Table) )
1357 mpTbxIndent_IncDec->Disable();
1358 else
1359 mpTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False);
1360
1361 // maTbxProDemote->Disable();
1362 mpTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False);
1363 }
1364 else
1365 {
1366 mpLeftIndent->SetEmptyFieldValue();
1367 mpRightIndent->SetEmptyFieldValue();
1368 mpFLineIndent->SetEmptyFieldValue();
1369 if( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text) &&
1370 maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default) &&
1371 maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Table) )
1372 mpTbxIndent_IncDec->Disable();
1373 else
1374 mpTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False);
1375 mpTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False);
1376 }
1377 }
1378
StateChangedLnSPImpl(sal_uInt16,SfxItemState eState,const SfxPoolItem * pState)1379 void ParaPropertyPanel::StateChangedLnSPImpl( sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState )
1380 {
1381 meLnSpState = eState;
1382
1383 if( pState && eState >= SFX_ITEM_AVAILABLE )
1384 {
1385 if(mpLnSPItem)
1386 delete mpLnSPItem;
1387 mpLnSPItem = ( SvxLineSpacingItem *)pState->Clone();
1388 }
1389 }
1390
StateChangedULImpl(sal_uInt16,SfxItemState eState,const SfxPoolItem * pState)1391 void ParaPropertyPanel::StateChangedULImpl( sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState )
1392 {
1393 mpTopDist->SetMax( mpTopDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) );
1394 mpBottomDist->SetMax( mpBottomDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) );
1395
1396 if( pState && eState >= SFX_ITEM_AVAILABLE )
1397 {
1398 SvxULSpaceItem* pOldItem = (SvxULSpaceItem*)pState;
1399
1400 maUpper = pOldItem->GetUpper();
1401 maUpper = OutputDevice::LogicToLogic( maUpper, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM );
1402 maUpper = OutputDevice::LogicToLogic( maUpper, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1403
1404 maLower = pOldItem->GetLower();
1405 maLower = OutputDevice::LogicToLogic( maLower, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM );
1406 maLower = OutputDevice::LogicToLogic( maLower, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1407
1408 sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1409 nVal = mpTopDist->Normalize( nVal );
1410 mpTopDist->SetValue( nVal, FUNIT_100TH_MM );
1411
1412 nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1413 nVal = mpBottomDist->Normalize( nVal );
1414 mpBottomDist->SetValue( nVal, FUNIT_100TH_MM );
1415 mpTbxUL_IncDec->Enable();
1416 }
1417 else if(eState == SFX_ITEM_DISABLED )
1418 {
1419 mpTopDist->Disable();
1420 mpBottomDist->Disable();
1421 mpTbxUL_IncDec->Disable();
1422 }
1423 else
1424 {
1425 mpTopDist->SetEmptyFieldValue();
1426 mpBottomDist->SetEmptyFieldValue();
1427 mpTbxUL_IncDec->Disable();
1428 }
1429 }
1430
StateChangeOutLineImpl(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)1431 void ParaPropertyPanel::StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1432 {
1433 if (nSID==SID_OUTLINE_LEFT)
1434 {
1435 if( pState && eState == SFX_ITEM_UNKNOWN )
1436 mbOutLineLeft = 1;
1437 else
1438 mbOutLineLeft = 0;
1439 }
1440 if (nSID==SID_OUTLINE_RIGHT)
1441 {
1442 if( pState && eState == SFX_ITEM_UNKNOWN )
1443 mbOutLineRight = 1;
1444 else
1445 mbOutLineRight = 0;
1446 }
1447 if(mbOutLineLeft)
1448 mpTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_True);
1449 else
1450 mpTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_False);
1451
1452 if(mbOutLineRight)
1453 mpTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_True);
1454 else
1455 mpTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_False);
1456
1457 }
1458
StateChangeIncDecImpl(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)1459 void ParaPropertyPanel::StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1460 {
1461 if ( ( maContext.GetCombinedContext_DI() == CombinedEnumContext(Application_WriterVariants, Context_Text)
1462 || maContext.GetCombinedContext_DI() == CombinedEnumContext(Application_WriterVariants, Context_Default)
1463 || maContext.GetCombinedContext_DI() == CombinedEnumContext(Application_WriterVariants, Context_Table) )
1464 && ( nSID == SID_INC_INDENT || nSID == SID_DEC_INDENT ) )
1465 {
1466 // Writer's text shell is the only one which provides reasonable states for Slots SID_INC_INDENT and SID_DEC_INDENT
1467 // - namely SFX_ITEM_UNKNOWN and SFX_ITEM_DISABLED
1468 mpTbxIndent_IncDec->EnableItem(
1469 nSID == SID_INC_INDENT ? BT_TBX_INDENT_INC : BT_TBX_INDENT_DEC,
1470 ( pState && eState == SFX_ITEM_UNKNOWN ) ? sal_True : sal_False );
1471 }
1472 }
1473
1474
1475 // Add toggle state for numbering and bullet icons
StateChangeBulletNumImpl(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)1476 void ParaPropertyPanel::StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1477 {
1478 if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem)) )
1479 {
1480 const SfxBoolItem* pItem= (const SfxBoolItem*)pState;
1481 const sal_Bool aBool = (sal_Bool)pItem->GetValue();
1482 if (nSID==FN_NUM_NUMBERING_ON)
1483 {
1484 mpTBxNumBullet->SetItemState(
1485 IID_NUMBER,
1486 aBool ? STATE_CHECK : STATE_NOCHECK );
1487 }
1488 else if (nSID==FN_NUM_BULLET_ON)
1489 {
1490 mpTBxNumBullet->SetItemState(
1491 IID_BULLET,
1492 aBool ? STATE_CHECK : STATE_NOCHECK );
1493 }
1494 }
1495 }
1496
1497
StateChangeBulletNumRuleImpl(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)1498 void ParaPropertyPanel::StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1499 {
1500 if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxUInt16Item) )
1501 {
1502 sal_uInt16 nValue = (sal_uInt16)0xFFFF;
1503 {
1504 const SfxUInt16Item* pIt = (const SfxUInt16Item*)pState;
1505 if ( pIt )
1506 nValue = pIt->GetValue();
1507 }
1508
1509 if ( nSID == FN_BUL_NUM_RULE_INDEX )
1510 {
1511 mnBulletTypeIndex = nValue;
1512 }
1513 else if ( nSID == FN_NUM_NUM_RULE_INDEX )
1514 {
1515 mnNumTypeIndex = nValue;
1516 }
1517 }
1518 }
1519
1520
GetCurrentUnit(SfxItemState eState,const SfxPoolItem * pState)1521 FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState )
1522 {
1523 FieldUnit eUnit = FUNIT_NONE;
1524
1525 if ( pState && eState >= SFX_ITEM_DEFAULT )
1526 eUnit = (FieldUnit)( (const SfxUInt16Item*)pState )->GetValue();
1527 else
1528 {
1529 SfxViewFrame* pFrame = SfxViewFrame::Current();
1530 SfxObjectShell* pSh = NULL;
1531 if ( pFrame )
1532 pSh = pFrame->GetObjectShell();
1533 if ( pSh ) //the object shell is not always available during reload
1534 {
1535 SfxModule* pModule = pSh->GetModule();
1536 if ( pModule )
1537 {
1538 const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC );
1539 if ( pItem )
1540 eUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue();
1541 }
1542 else
1543 {
1544 DBG_ERRORFILE( "GetModuleFieldUnit(): no module found" );
1545 }
1546 }
1547 }
1548
1549 return eUnit;
1550 }
1551
1552
CreateLineSpacingControl(PopupContainer * pParent)1553 PopupControl* ParaPropertyPanel::CreateLineSpacingControl (PopupContainer* pParent)
1554 {
1555 return new ParaLineSpacingControl(pParent, *this);
1556 }
1557
CreateBulletsPopupControl(PopupContainer * pParent)1558 PopupControl* ParaPropertyPanel::CreateBulletsPopupControl (PopupContainer* pParent)
1559 {
1560 return new ParaBulletsControl(pParent, *this);
1561 }
1562
CreateNumberingPopupControl(PopupContainer * pParent)1563 PopupControl* ParaPropertyPanel::CreateNumberingPopupControl (PopupContainer* pParent)
1564 {
1565 return new ParaNumberingControl(pParent, *this);
1566 }
1567
1568 namespace
1569 {
GetNoBackgroundColor(void)1570 Color GetNoBackgroundColor(void)
1571 {
1572 return COL_TRANSPARENT;
1573 }
1574 } // end of anonymous namespace
1575
CreateBGColorPopupControl(PopupContainer * pParent)1576 PopupControl* ParaPropertyPanel::CreateBGColorPopupControl (PopupContainer* pParent)
1577 {
1578 const ResId aResId(SVX_RES(STR_NOFILL));
1579
1580 return new ColorControl(
1581 pParent,
1582 mpBindings,
1583 SVX_RES(RID_POPUPPANEL_PARAPAGE_BACK_COLOR),
1584 SVX_RES(VS_FONT_COLOR),
1585 ::boost::bind(GetNoBackgroundColor),
1586 ::boost::bind(&ParaPropertyPanel::SetBGColor, this, _1,_2),
1587 pParent,
1588 &aResId);
1589 }
1590
1591
ParaPropertyPanel(Window * pParent,const cssu::Reference<css::frame::XFrame> & rxFrame,SfxBindings * pBindings,const cssu::Reference<css::ui::XSidebar> & rxSidebar)1592 ParaPropertyPanel::ParaPropertyPanel(Window* pParent,
1593 const cssu::Reference<css::frame::XFrame>& rxFrame,
1594 SfxBindings* pBindings,
1595 const cssu::Reference<css::ui::XSidebar>& rxSidebar)
1596 : Control(pParent, SVX_RES(RID_SIDEBAR_PARA_PANEL)),
1597 mpAlignToolBoxBackground(ControlFactory::CreateToolBoxBackground(this)),
1598 mpAlignToolBox (ControlFactory::CreateToolBox(mpAlignToolBoxBackground.get(),SVX_RES(TBX_HORIZONTALALIGNMENT))),
1599 mpTBxVertAlignBackground(ControlFactory::CreateToolBoxBackground(this)),
1600 mpTBxVertAlign (ControlFactory::CreateToolBox(mpTBxVertAlignBackground.get(),SVX_RES(TBX_VERT_ALIGN))),
1601 mpTBxNumBulletBackground(ControlFactory::CreateToolBoxBackground(this)),
1602 mpTBxNumBullet (ControlFactory::CreateToolBox(mpTBxNumBulletBackground.get(),SVX_RES(TBX_NUM_BULLET))),
1603 mpTBxBackColorBackground(ControlFactory::CreateToolBoxBackground(this)),
1604 mpTBxBackColor (ControlFactory::CreateToolBox(mpTBxBackColorBackground.get(),SVX_RES(TBX_BACK_COLOR))),
1605 mpFTUL (new FixedText(this, SVX_RES(FT_SPACING))),
1606 mpTbxUL_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)),
1607 mpTbxUL_IncDec (ControlFactory::CreateToolBox(mpTbxUL_IncDecBackground.get(),SVX_RES(TBX_UL_INC_DEC))),
1608 mpTopDist (new SvxRelativeField(this, SVX_RES(MF_ABOVE_PARASPACING))),
1609 mpBottomDist (new SvxRelativeField(this, SVX_RES(MF_BELOW_PARASPACING))),
1610 mpLineSPTbxBackground(ControlFactory::CreateToolBoxBackground(this)),
1611 mpLineSPTbx (ControlFactory::CreateToolBox(mpLineSPTbxBackground.get(),SVX_RES(TBX_LINESP))),
1612 mpFTIndent (new FixedText(this, SVX_RES(FT_INDENT))),
1613 mpTbxIndent_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)),
1614 mpTbxIndent_IncDec (ControlFactory::CreateToolBox(mpTbxIndent_IncDecBackground.get(),SVX_RES(TBX_INDENT_INC_DEC))),
1615 mpTbxProDemoteBackground(ControlFactory::CreateToolBoxBackground(this)),
1616 mpTbxProDemote (ControlFactory::CreateToolBox(mpTbxProDemoteBackground.get(),SVX_RES(TBX_INDENT_PRO_DEMOTE))),
1617 mpLeftIndent (new SvxRelativeField(this, SVX_RES(MF_BEFORE_INDENT))),
1618 mpRightIndent (new SvxRelativeField(this, SVX_RES(MF_AFTER_INDENT))),
1619 mpFLineIndent (new SvxRelativeField(this, SVX_RES(MF_FL_INDENT))),
1620
1621 mpColorUpdater (),
1622 maFISpace1 ( this, SVX_RES( FI_SPACE1)),
1623 maFISpace2 ( this, SVX_RES( FI_SPACE2)),
1624 maFIndent1 ( this, SVX_RES( FI_INDENT1)),
1625 maFIndent2 ( this, SVX_RES( FI_INDENT2)),
1626 maFIndent3 ( this, SVX_RES( FI_INDENT3)),
1627 maSpace1 (SVX_RES(IMG_SPACE1)),
1628 maSpace2 (SVX_RES(IMG_SPACE2)),
1629 maSpace3 (SVX_RES(IMG_SPACE3)),
1630 maIndent1 (SVX_RES(IMG_INDENT1)),
1631 maIndent2 (SVX_RES(IMG_INDENT2)),
1632 maIndent3 (SVX_RES(IMG_INDENT3)),
1633 maIndHang (SVX_RES(IMG_INDENT_HANG)),
1634 maNumBImageList (SVX_RES(IL_NUM_BULLET)),
1635 maNumBImageListH (SVX_RES(ILH_NUM_BULLET)),
1636 maNumBImageListRTL (SVX_RES(IL_NUM_BULLET_RTL)),
1637 maImgBackColorHigh (SVX_RES(IMG_BACK_COLOR_H)),
1638 maImgBackColor (SVX_RES(IMG_BACK_COLOR)),
1639 maTxtLeft (0),
1640 mpLnSPItem (NULL),
1641 meLnSpState (SFX_ITEM_DONTCARE),
1642 mbOutLineLeft (false),
1643 mbOutLineRight (false),
1644 maUpper (0),
1645 maLower (0),
1646 mnBulletTypeIndex ((sal_uInt16)0xFFFF),
1647 mnNumTypeIndex ((sal_uInt16)0xFFFF),
1648 maColor (COL_AUTO),
1649 mbColorAvailable (true),
1650 m_eLRSpaceUnit(),
1651 m_eULSpaceUnit(),
1652 maLeftAlignControl(SID_ATTR_PARA_ADJUST_LEFT, *pBindings, *this, A2S("LeftPara"), rxFrame),
1653 maCenterAlignControl(SID_ATTR_PARA_ADJUST_CENTER, *pBindings, *this, A2S("CenterPara"), rxFrame),
1654 maRightAlignControl(SID_ATTR_PARA_ADJUST_RIGHT, *pBindings, *this, A2S("RightPara"), rxFrame),
1655 maJustifyAlignControl(SID_ATTR_PARA_ADJUST_BLOCK, *pBindings, *this, A2S("JustifyPara"), rxFrame),
1656 maLRSpaceControl (SID_ATTR_PARA_LRSPACE,*pBindings,*this),
1657 maLNSpaceControl (SID_ATTR_PARA_LINESPACE, *pBindings,*this),
1658 maULSpaceControl (SID_ATTR_PARA_ULSPACE, *pBindings,*this),
1659 maOutLineLeftControl(SID_OUTLINE_LEFT, *pBindings, *this, A2S("OutlineRight"), rxFrame),
1660 maOutLineRightControl(SID_OUTLINE_RIGHT, *pBindings, *this, A2S("OutlineLeft"), rxFrame),
1661 maDecIndentControl(SID_DEC_INDENT, *pBindings,*this, A2S("DecrementIndent"), rxFrame),
1662 maIncIndentControl(SID_INC_INDENT, *pBindings,*this, A2S("IncrementIndent"), rxFrame),
1663 maVertTop (SID_TABLE_VERT_NONE, *pBindings, *this, A2S("CellVertTop"), rxFrame),
1664 maVertCenter (SID_TABLE_VERT_CENTER, *pBindings,*this, A2S("CellVertCenter"), rxFrame),
1665 maVertBottom (SID_TABLE_VERT_BOTTOM,*pBindings,*this, A2S("CellVertBottom"), rxFrame),
1666 maBulletOnOff(FN_NUM_BULLET_ON, *pBindings, *this, A2S("DefaultBullet"), rxFrame),
1667 maNumberOnOff(FN_NUM_NUMBERING_ON, *pBindings, *this, A2S("DefaultNumbering"), rxFrame),
1668 maBackColorControl (SID_BACKGROUND_COLOR, *pBindings,*this),
1669 m_aMetricCtl (SID_ATTR_METRIC, *pBindings,*this),
1670 maBulletNumRuleIndex (FN_BUL_NUM_RULE_INDEX, *pBindings,*this),
1671 maNumNumRuleIndex (FN_NUM_NUM_RULE_INDEX, *pBindings,*this),
1672 mxFrame(rxFrame),
1673 maContext(),
1674 mpBindings(pBindings),
1675 maLineSpacePopup(this, ::boost::bind(&ParaPropertyPanel::CreateLineSpacingControl, this, _1)),
1676 maBulletsPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBulletsPopupControl, this, _1)),
1677 maNumberingPopup(this, ::boost::bind(&ParaPropertyPanel::CreateNumberingPopupControl, this, _1)),
1678 maBGColorPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBGColorPopupControl, this, _1)),
1679 mxSidebar(rxSidebar),
1680 maLayouter(*this)
1681 {
1682 initial();
1683 FreeResource();
1684
1685 // Setup the grid layouter.
1686 // const sal_Int32 nMappedImageWidth (Layouter::MapWidth(*this, IMAGE_SIZE));
1687 const sal_Int32 nMappedImageOffset (Layouter::MapWidth(*this, -3));
1688 const sal_Int32 nMappedToolBoxItemWidth (Layouter::MapWidth(*this, TOOLBOX_ITEM_WIDTH));
1689 const sal_Int32 nMappedControlWidth (Layouter::MapWidth(*this, CONTROL_WIDTH -10));
1690
1691 maLayouter.GetCell(0,0).SetControl(*mpFTUL).SetGridWidth(2);
1692 maLayouter.GetCell(1,0).SetControl(*mpTbxUL_IncDecBackground).SetGridWidth(2).SetFixedWidth();
1693
1694 maLayouter.GetCell(0,3).SetControl(*mpFTIndent).SetGridWidth(2);
1695 maLayouter.GetCell(1,3,0)
1696 .SetControl(*mpTbxIndent_IncDecBackground)
1697 .SetGridWidth(2).SetFixedWidth();
1698 maLayouter.GetCell(1,3,1)
1699 .SetControl(*mpTbxProDemoteBackground)
1700 .SetGridWidth(2).SetFixedWidth();
1701 maLayouter.GetCell(2,0).SetControl(maFISpace1).SetFixedWidth().SetOffset(nMappedImageOffset);
1702 maLayouter.GetCell(2,1).SetControl(*mpTopDist);
1703 maLayouter.GetCell(3,0).SetControl(maFISpace2).SetFixedWidth().SetOffset(nMappedImageOffset);
1704 maLayouter.GetCell(3,1).SetControl(*mpBottomDist);
1705 maLayouter.GetCell(4,0).SetControl(*mpLineSPTbxBackground).SetGridWidth(2).SetFixedWidth();
1706
1707 maLayouter.GetCell(2,3).SetControl(maFIndent1).SetFixedWidth().SetOffset(nMappedImageOffset);
1708 maLayouter.GetCell(2,4).SetControl(*mpLeftIndent);
1709 maLayouter.GetCell(3,3).SetControl(maFIndent2).SetFixedWidth().SetOffset(nMappedImageOffset);
1710 maLayouter.GetCell(3,4).SetControl(*mpRightIndent);
1711 maLayouter.GetCell(4,3).SetControl(maFIndent3).SetFixedWidth().SetOffset(nMappedImageOffset);
1712 maLayouter.GetCell(4,4).SetControl(*mpFLineIndent);
1713
1714 maLayouter.GetColumn(0)
1715 .SetWeight(0)
1716 .SetLeftPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL))
1717 .SetFixedWidth(nMappedToolBoxItemWidth + nMappedImageOffset);
1718 maLayouter.GetColumn(1)
1719 .SetWeight(1)
1720 .SetMinimumWidth(nMappedControlWidth);
1721 maLayouter.GetColumn(2)
1722 .SetWeight(0)
1723 .SetMinimumWidth(Layouter::MapWidth(*this, CONTROL_SPACING_HORIZONTAL));
1724 maLayouter.GetColumn(3)
1725 .SetWeight(0)
1726 .SetFixedWidth(nMappedToolBoxItemWidth + nMappedImageOffset);
1727 maLayouter.GetColumn(4)
1728 .SetWeight(1)
1729 .SetRightPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL))
1730 .SetMinimumWidth(nMappedControlWidth);
1731
1732 // Make controls that display text handle short widths more
1733 // graceful.
1734 sfx2::sidebar::Layouter::PrepareForLayouting(*mpFTUL);
1735 sfx2::sidebar::Layouter::PrepareForLayouting(*mpFTIndent);
1736
1737 if (mxSidebar.is())
1738 mxSidebar->requestLayout();
1739
1740 }
1741
1742 } } // end of namespace svx::sidebar
1743