bump product version to 4.1.6.2
[LibreOffice.git] / svx / source / sidebar / paragraph / ParaPropertyPanel.cxx
blob4934f97f7629b6190841b370862589bd7ef118ca
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 #include <svx/sidebar/ColorControl.hxx>
20 #include "ParaPropertyPanel.hxx"
21 #include "ParaPropertyPanel.hrc"
23 #include "ParaLineSpacingPopup.hxx"
24 #include "ParaLineSpacingControl.hxx"
25 #include "ParaBulletsPopup.hxx"
26 #include "ParaBulletsControl.hxx"
27 #include "ParaNumberingPopup.hxx"
28 #include "ParaNumberingControl.hxx"
29 #include <sfx2/sidebar/Theme.hxx>
30 #include <sfx2/sidebar/ResourceDefinitions.hrc>
31 #include <sfx2/sidebar/ControlFactory.hxx>
32 #include <sfx2/sidebar/Tools.hxx>
33 #include <svx/sidebar/PopupContainer.hxx>
34 #include <sfx2/dispatch.hxx>
35 #include <editeng/colritem.hxx>
36 #include <editeng/brushitem.hxx>
37 #include <editeng/lrspitem.hxx>
38 #include <editeng/ulspitem.hxx>
39 #include <vcl/toolbox.hxx>
40 #include <vcl/fixed.hxx>
41 #include <vcl/svapp.hxx>
42 #include <svx/svxids.hrc>
43 #include <svl/intitem.hxx>
44 #include "svx/dialmgr.hxx"
45 #include <sfx2/objsh.hxx>
46 #include <svtools/unitconv.hxx>
47 #include <boost/bind.hpp>
48 using namespace css;
49 using namespace cssu;
50 using ::sfx2::sidebar::Theme;
51 using ::sfx2::sidebar::ControlFactory;
53 namespace svx {namespace sidebar {
54 #define DEFAULT_VALUE 0
55 #define TOOLBOX_ITEM1 1
56 #define TOOLBOX_ITEM2 2
57 #define TOOLBOX_ITEM3 3
58 #define TOOLBOX_ITEM4 4
60 #define MAX_DURCH 5670
62 #define INDENT_INCREMENT 1
63 #define INDENT_DECREMENT 2
64 #define INDENT_STEP 706
65 #define UL_STEP 58
67 #define MAX_SW 1709400
68 #define MAX_SC_SD 116220200
69 #define NEGA_MAXVALUE -10000000
71 #define POS_FT_PARA_SPACE Point(LogicToPixel(Point(FT_PARA_SPACE_X,FT_PARA_SPACE_Y), MAP_APPFONT))
72 #define POS_FT_PARA_SPACE2 Point(LogicToPixel(Point(FT_PARA_SPACE_X,FT_PARA_SPACE_Y2), MAP_APPFONT))
73 #define POS_TBX_PARA_SPACE_INC_DEC Point(LogicToPixel(Point(TBX_PARA_SPACE_INC_DEC_X,TBX_PARA_SPACE_INC_DEC_Y), MAP_APPFONT))
74 #define POS_TBX_PARA_SPACE_INC_DEC2 Point(LogicToPixel(Point(TBX_PARA_SPACE_INC_DEC_X,TBX_PARA_SPACE_INC_DEC_Y2), MAP_APPFONT))
75 #define POS_FT_PARA_INDENT Point(LogicToPixel(Point(FT_PARA_INDENT_X,FT_PARA_INDENT_Y), MAP_APPFONT))
76 #define POS_FT_PARA_INDENT2 Point(LogicToPixel(Point(FT_PARA_INDENT_X,FT_PARA_INDENT_Y2), MAP_APPFONT))
77 #define POS_TBX_PARA_INDENT_INC_DEC Point(LogicToPixel(Point(TBX_PARA_INDENT_INC_DEC_X,TBX_PARA_INDENT_INC_DEC_Y), MAP_APPFONT))
78 #define POS_TBX_PARA_INDENT_INC_DEC2 Point(LogicToPixel(Point(TBX_PARA_INDENT_INC_DEC_X,TBX_PARA_INDENT_INC_DEC_Y2), MAP_APPFONT))
79 #define POS_MBX_TOP_DIST Point(LogicToPixel(Point(MBX_TOP_DIST_X,MBX_TOP_DIST_Y), MAP_APPFONT))
80 #define POS_MBX_TOP_DIST2 Point(LogicToPixel(Point(MBX_TOP_DIST_X,MBX_TOP_DIST_Y2), MAP_APPFONT))
81 #define POS_MBX_BOT_DIST Point(LogicToPixel(Point(MBX_BOT_DIST_X,MBX_BOT_DIST_Y), MAP_APPFONT))
82 #define POS_MBX_BOT_DIST2 Point(LogicToPixel(Point(MBX_BOT_DIST_X,MBX_BOT_DIST_Y2), MAP_APPFONT))
83 #define POS_MBX_LEFT_DIST Point(LogicToPixel(Point(MBX_LEFT_DIST_X,MBX_LEFT_DIST_Y), MAP_APPFONT))
84 #define POS_MBX_LEFT_DIST2 Point(LogicToPixel(Point(MBX_LEFT_DIST_X,MBX_LEFT_DIST_Y2), MAP_APPFONT))
85 #define POS_MBX_RIGHT_DIST Point(LogicToPixel(Point(MBX_RIGHT_DIST_X,MBX_RIGHT_DIST_Y), MAP_APPFONT))
86 #define POS_MBX_RIGHT_DIST2 Point(LogicToPixel(Point(MBX_RIGHT_DIST_X,MBX_RIGHT_DIST_Y2), MAP_APPFONT))
87 #define POS_MBX_FLINE_DIST Point(LogicToPixel(Point(MBX_FLINE_DIST_X,MBX_FLINE_DIST_Y), MAP_APPFONT))
88 #define POS_MBX_FLINE_DIST2 Point(LogicToPixel(Point(MBX_FLINE_DIST_X,MBX_FLINE_DIST_Y2), MAP_APPFONT))
89 #define POS_IMG_SPACE1 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE1_Y), MAP_APPFONT))
90 #define POS_IMG_SPACE12 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE1_Y2), MAP_APPFONT))
91 #define POS_IMG_SPACE2 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE2_Y), MAP_APPFONT))
92 #define POS_IMG_SPACE22 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE2_Y2), MAP_APPFONT))
93 #define POS_IMG_INDENT1 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT1_Y), MAP_APPFONT))
94 #define POS_IMG_INDENT12 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT1_Y2), MAP_APPFONT))
95 #define POS_IMG_INDENT2 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT2_Y), MAP_APPFONT))
96 #define POS_IMG_INDENT22 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT2_Y2), MAP_APPFONT))
97 #define POS_IMG_INDENT3 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT3_Y), MAP_APPFONT))
98 #define POS_IMG_INDENT32 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT3_Y2), MAP_APPFONT))
99 #define TBX_LINE_SPACE Point(LogicToPixel(Point(TBX_LINE_SPACE_X,TBX_LINE_SPACE_Y), MAP_APPFONT))
100 #define TBX_LINE_SPACE2 Point(LogicToPixel(Point(TBX_LINE_SPACE_X,TBX_LINE_SPACE_Y2), MAP_APPFONT))
102 ParaPropertyPanel* ParaPropertyPanel::Create (
103 Window* pParent,
104 const cssu::Reference<css::frame::XFrame>& rxFrame,
105 SfxBindings* pBindings,
106 const cssu::Reference<css::ui::XSidebar>& rxSidebar)
108 if (pParent == NULL)
109 throw lang::IllegalArgumentException(A2S("no parent Window given to ParaPropertyPanel::Create"), NULL, 0);
110 if ( ! rxFrame.is())
111 throw lang::IllegalArgumentException(A2S("no XFrame given to ParaPropertyPanel::Create"), NULL, 1);
112 if (pBindings == NULL)
113 throw lang::IllegalArgumentException(A2S("no SfxBindings given to ParaPropertyPanel::Create"), NULL, 2);
115 return new ParaPropertyPanel(
116 pParent,
117 rxFrame,
118 pBindings,
119 rxSidebar);
122 void ParaPropertyPanel::HandleContextChange (
123 const ::sfx2::sidebar::EnumContext aContext)
125 if (maContext == aContext)
127 // Nothing to do.
128 return;
131 maContext = aContext;
132 switch (maContext.GetCombinedContext_DI())
134 case CombinedEnumContext(Application_Calc, Context_DrawText):
135 mpTBxVertAlign->Show();
136 mpTBxVertAlignBackground->Show();
137 mpTBxBackColor->Hide();
138 mpTBxBackColorBackground->Hide();
139 mpTBxNumBullet->Hide();
140 mpTBxNumBulletBackground->Hide();
141 ReSize(false);
142 mpTbxIndent_IncDec->Show();
143 mpTbxIndent_IncDecBackground->Show();
144 mpTbxProDemote->Hide();
145 mpTbxProDemoteBackground->Hide();
146 break;
148 case CombinedEnumContext(Application_DrawImpress, Context_Draw):
149 case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
150 case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
151 mpTBxVertAlign->Hide();
152 mpTBxVertAlignBackground->Hide();
153 mpTBxBackColor->Hide();
154 mpTBxBackColorBackground->Hide();
155 mpTBxNumBullet->Show();
156 mpTBxNumBulletBackground->Show();
157 ReSize(true);
158 mpTbxIndent_IncDec->Hide();
159 mpTbxIndent_IncDecBackground->Hide();
160 mpTbxProDemote->Show();
161 mpTbxProDemoteBackground->Show();
162 break;
164 case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
165 mpTBxVertAlign->Show();
166 mpTBxVertAlignBackground->Show();
167 mpTBxBackColor->Hide();
168 mpTBxBackColorBackground->Hide();
169 mpTBxNumBullet->Show();
170 mpTBxNumBulletBackground->Show();
171 ReSize(true);
172 mpTbxIndent_IncDec->Hide();
173 mpTbxIndent_IncDecBackground->Hide();
174 mpTbxProDemote->Show();
175 mpTbxProDemoteBackground->Show();
176 break;
178 case CombinedEnumContext(Application_DrawImpress, Context_Table):
179 mpTBxVertAlign->Show();
180 mpTBxVertAlignBackground->Show();
181 mpTBxBackColor->Hide();
182 mpTBxBackColorBackground->Hide();
183 mpTBxNumBullet->Show();
184 mpTBxNumBulletBackground->Show();
185 ReSize(true);
186 mpTbxIndent_IncDec->Hide();
187 mpTbxIndent_IncDecBackground->Hide();
188 mpTbxProDemote->Show();
189 mpTbxProDemoteBackground->Show();
190 break;
192 case CombinedEnumContext(Application_WriterVariants, Context_Default):
193 case CombinedEnumContext(Application_WriterVariants, Context_Text):
194 mpTBxVertAlign->Hide();
195 mpTBxVertAlignBackground->Hide();
196 mpTBxBackColor->Show();
197 mpTBxBackColorBackground->Show();
198 mpTBxNumBullet->Show();
200 mpTBxNumBulletBackground->Show();
201 ReSize(true);
202 mpTbxIndent_IncDec->Show();
203 mpTbxIndent_IncDecBackground->Show();
204 mpTbxProDemote->Hide();
205 mpTbxProDemoteBackground->Hide();
206 break;
208 case CombinedEnumContext(Application_WriterVariants, Context_Table):
209 mpTBxVertAlign->Show();
210 mpTBxVertAlignBackground->Show();
211 mpTBxBackColor->Show();
212 mpTBxBackColorBackground->Show();
213 mpTBxNumBullet->Show();
214 mpTBxNumBulletBackground->Show();
215 ReSize(true);
216 mpTbxIndent_IncDec->Show();
217 mpTbxIndent_IncDecBackground->Show();
218 mpTbxProDemote->Hide();
219 mpTbxProDemoteBackground->Hide();
220 break;
222 case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
223 mpTBxVertAlign->Show();
224 mpTBxVertAlignBackground->Show();
225 mpTBxBackColor->Hide();
226 mpTBxBackColorBackground->Hide();
227 mpTBxNumBullet->Hide();
228 mpTBxNumBulletBackground->Hide();
229 ReSize(false);
230 mpTbxIndent_IncDec->Show();
231 mpTbxIndent_IncDecBackground->Show();
232 mpTbxProDemote->Hide();
233 mpTbxProDemoteBackground->Hide();
234 break;
236 case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
237 mpTBxVertAlign->Hide();
238 mpTBxVertAlignBackground->Hide();
239 mpTBxBackColor->Hide();
240 mpTBxBackColorBackground->Hide();
241 mpTBxNumBullet->Hide();
242 mpTBxNumBulletBackground->Hide();
243 ReSize(false);
244 mpTbxIndent_IncDec->Show();
245 mpTbxIndent_IncDecBackground->Show();
246 mpTbxProDemote->Hide();
247 mpTbxProDemoteBackground->Hide();
248 break;
250 case CombinedEnumContext(Application_Calc, Context_EditCell):
251 case CombinedEnumContext(Application_Calc, Context_Cell):
252 case CombinedEnumContext(Application_Calc, Context_Pivot):
253 case CombinedEnumContext(Application_DrawImpress, Context_Text):
254 case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
256 mpToolBoxScriptSw->Hide();
257 mpToolBoxScript->Show();
258 mpToolBoxSpacing->Show();
259 mpToolBoxHighlight->Hide();
261 Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT);
262 aSize = LogicToPixel( aSize,MapMode(MAP_APPFONT) );
263 aSize.setWidth(GetOutputSizePixel().Width());
264 SetSizePixel(aSize);
266 break;
268 default:
269 break;
273 SfxBindings* ParaPropertyPanel::GetBindings()
275 return mpBindings;
281 void ParaPropertyPanel::DataChanged (const DataChangedEvent& rEvent)
283 (void)rEvent;
286 ParaPropertyPanel::~ParaPropertyPanel()
288 delete mpLnSPItem;
291 void ParaPropertyPanel::ReSize(bool bSize)
293 if(bSize)
295 //Paragraph spacing
296 mpFTUL->SetPosPixel(POS_FT_PARA_SPACE);
297 mpTbxUL_IncDec->SetPosPixel(POS_TBX_PARA_SPACE_INC_DEC);
298 mpTopDist->SetPosPixel(POS_MBX_TOP_DIST);
299 mpBottomDist->SetPosPixel(POS_MBX_BOT_DIST);
300 //Indent
301 mpFTIndent->SetPosPixel(POS_FT_PARA_INDENT);
302 mpTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC);
303 mpTbxProDemote->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC);
304 mpLeftIndent->SetPosPixel(POS_MBX_LEFT_DIST);
305 mpRightIndent->SetPosPixel(POS_MBX_RIGHT_DIST);
306 mpFLineIndent->SetPosPixel(POS_MBX_FLINE_DIST);
307 //Line spacing
308 mpLineSPTbx->SetPosPixel(TBX_LINE_SPACE);
309 //image
310 maFISpace1.SetPosPixel(POS_IMG_SPACE1);
311 maFISpace2.SetPosPixel(POS_IMG_SPACE2);
312 maFIndent1.SetPosPixel(POS_IMG_INDENT1);
313 maFIndent2.SetPosPixel(POS_IMG_INDENT2);
314 maFIndent3.SetPosPixel(POS_IMG_INDENT3);
315 Size aSize(GetOutputSizePixel().Width(),PARA_SECTIONPAGE_HEIGHT);
316 aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
317 aSize.setWidth(GetOutputSizePixel().Width());
318 SetSizePixel(aSize);
320 else
322 //Paragraph spacing
323 mpFTUL->SetPosPixel(POS_FT_PARA_SPACE2);
324 mpTbxUL_IncDec->SetPosPixel(POS_TBX_PARA_SPACE_INC_DEC2);
325 mpTopDist->SetPosPixel(POS_MBX_TOP_DIST2);
326 mpBottomDist->SetPosPixel(POS_MBX_BOT_DIST2);
327 //Indent
328 mpFTIndent->SetPosPixel(POS_FT_PARA_INDENT2);
329 mpTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC2);
330 mpTbxProDemote->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC2);
331 mpLeftIndent->SetPosPixel(POS_MBX_LEFT_DIST2);
332 mpRightIndent->SetPosPixel(POS_MBX_RIGHT_DIST2);
333 mpFLineIndent->SetPosPixel(POS_MBX_FLINE_DIST2);
334 //Line spacing
335 mpLineSPTbx->SetPosPixel(TBX_LINE_SPACE2);
336 //image
337 maFISpace1.SetPosPixel(POS_IMG_SPACE12);
338 maFISpace2.SetPosPixel(POS_IMG_SPACE22);
339 maFIndent1.SetPosPixel(POS_IMG_INDENT12);
340 maFIndent2.SetPosPixel(POS_IMG_INDENT22);
341 maFIndent3.SetPosPixel(POS_IMG_INDENT32);
342 Size aSize(GetOutputSizePixel().Width(),PARA_SECTIONPAGE_HEIGHT_2);
343 aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) );
344 aSize.setWidth(GetOutputSizePixel().Width());
345 SetSizePixel(aSize);
348 if (mxSidebar.is())
349 mxSidebar->requestLayout();
352 void ParaPropertyPanel::EndSpacingPopupMode (void)
354 maLineSpacePopup.Hide();
357 void ParaPropertyPanel::EndBulletsPopupMode (void)
359 //i122054, Missed following line, for collapse the bullets popup
360 maBulletsPopup.Hide();
363 void ParaPropertyPanel::EndNumberingPopupMode (void)
365 //i122054, Missed following line, for collapse the numbering popup
366 maNumberingPopup.Hide();
370 void ParaPropertyPanel::InitToolBoxAlign()
372 mpAlignToolBox->SetItemImage(TOOLBOX_ITEM1, maLeftAlignControl.GetIcon());
373 mpAlignToolBox->SetItemImage(TOOLBOX_ITEM2, maCenterAlignControl.GetIcon());
374 mpAlignToolBox->SetItemImage(TOOLBOX_ITEM3, maRightAlignControl.GetIcon());
375 mpAlignToolBox->SetItemImage(TOOLBOX_ITEM4, maJustifyAlignControl.GetIcon());
377 Link aLink = LINK( this, ParaPropertyPanel, AlignStyleModifyHdl_Impl );
378 mpAlignToolBox->SetSelectHdl( aLink );
379 Size aTbxSize (mpAlignToolBox->CalcWindowSizePixel());
380 mpAlignToolBox->SetOutputSizePixel( aTbxSize );
383 void ParaPropertyPanel::InitToolBoxVertAlign()
385 mpTBxVertAlign->SetItemImage(IID_VERT_TOP, maVertTop.GetIcon());
386 mpTBxVertAlign->SetItemImage(IID_VERT_CENTER, maVertCenter.GetIcon());
387 mpTBxVertAlign->SetItemImage(IID_VERT_BOTTOM, maVertBottom.GetIcon());
388 mpTBxVertAlign->SetSelectHdl(LINK(this,ParaPropertyPanel,VertTbxSelectHandler));
389 Size aTbxSize (mpTBxVertAlign->CalcWindowSizePixel());
390 mpTBxVertAlign->SetOutputSizePixel( aTbxSize );
394 void ParaPropertyPanel::InitToolBoxIndent()
396 Link aLink = LINK( this, ParaPropertyPanel, ModifyIndentHdl_Impl );
397 mpLeftIndent->SetModifyHdl( aLink );
398 mpRightIndent->SetModifyHdl( aLink );
399 mpFLineIndent->SetModifyHdl( aLink );
401 mpLeftIndent->SetAccessibleName(mpLeftIndent->GetQuickHelpText());
402 mpRightIndent->SetAccessibleName(mpRightIndent->GetQuickHelpText());
403 mpFLineIndent->SetAccessibleName(mpFLineIndent->GetQuickHelpText());
405 if( Application::GetSettings().GetLayoutRTL())
407 mpTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM1, maIncIndentControl.GetIcon());
408 mpTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM2, maDecIndentControl.GetIcon());
410 else
412 mpTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM1, maIncIndentControl.GetIcon());
413 mpTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM2, maDecIndentControl.GetIcon());
415 mpTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM3,maIndHang);
416 aLink = LINK( this, ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl );
417 mpTbxIndent_IncDec->SetSelectHdl(aLink);
418 m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric();
419 Size aTbxSize = mpTbxIndent_IncDec->CalcWindowSizePixel();
420 mpTbxIndent_IncDec->SetOutputSizePixel( aTbxSize );
422 if( Application::GetSettings().GetLayoutRTL())
424 mpTbxProDemote->SetItemImage(TOOLBOX_ITEM1, maOutLineLeftControl.GetIcon());
425 mpTbxProDemote->SetItemImage(TOOLBOX_ITEM2, maOutLineRightControl.GetIcon());
427 else
429 mpTbxProDemote->SetItemImage(TOOLBOX_ITEM1, maOutLineLeftControl.GetIcon());
430 mpTbxProDemote->SetItemImage(TOOLBOX_ITEM2, maOutLineRightControl.GetIcon());
432 mpTbxProDemote->SetItemImage(TOOLBOX_ITEM3,maIndHang);
433 aLink = LINK( this, ParaPropertyPanel, ClickProDemote_Hdl_Impl );
434 mpTbxProDemote->SetSelectHdl(aLink);
435 m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric();
436 aTbxSize = mpTbxProDemote->CalcWindowSizePixel();
437 mpTbxProDemote->SetOutputSizePixel( aTbxSize );
440 void ParaPropertyPanel::InitToolBoxBGColor()
442 mpColorUpdater.reset(new ::svx::ToolboxButtonColorUpdater(SID_BACKGROUND_COLOR, TBI_BACK_COLOR, mpTBxBackColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW ));
444 mpTBxBackColor->SetItemImage(TBI_BACK_COLOR, GetDisplayBackground().GetColor().IsDark()? maImgBackColorHigh : maImgBackColor);
445 mpTBxBackColor->SetItemBits( TBI_BACK_COLOR, mpTBxBackColor->GetItemBits( TBI_BACK_COLOR ) | TIB_DROPDOWNONLY );
447 Link aLink = LINK(this, ParaPropertyPanel, ToolBoxBackColorDDHandler);
448 mpTBxBackColor->SetDropdownClickHdl ( aLink );
449 mpTBxBackColor->SetSelectHdl ( aLink );
450 Size aTbxSize (mpTBxBackColor->CalcWindowSizePixel());
451 mpTBxBackColor->SetOutputSizePixel( aTbxSize );
454 void ParaPropertyPanel::InitToolBoxBulletsNumbering()
456 mpTBxNumBullet->SetItemImage(IID_BULLET, maBulletOnOff.GetIcon());
457 mpTBxNumBullet->SetItemImage(IID_NUMBER, maNumberOnOff.GetIcon());
459 mpTBxNumBullet->SetDropdownClickHdl(LINK(this,ParaPropertyPanel,NumBTbxDDHandler));
460 mpTBxNumBullet->SetSelectHdl(LINK(this,ParaPropertyPanel,NumBTbxSelectHandler));
461 Size aTbxSize (mpTBxNumBullet->CalcWindowSizePixel());
462 mpTBxNumBullet->SetOutputSizePixel( aTbxSize );
464 void ParaPropertyPanel::InitToolBoxSpacing()
466 Link aLink = LINK( this, ParaPropertyPanel, ULSpaceHdl_Impl );
467 mpTopDist->SetModifyHdl(aLink);
468 mpBottomDist->SetModifyHdl( aLink );
470 mpTopDist->SetAccessibleName(mpTopDist->GetQuickHelpText());
471 mpBottomDist->SetAccessibleName(mpBottomDist->GetQuickHelpText());
473 // Use a form of image loading that can handle both .uno:<command>
474 // and private:graphirepository... syntax. This is necessary to
475 // handle the workaround for accessing the images of commands
476 // ParaspaceIncrease and ParaspaceDecrease.
477 // See issue 122446 for more details.
478 mpTbxUL_IncDec->SetItemImage(
479 BT_TBX_UL_INC,
480 sfx2::sidebar::Tools::GetImage(mpTbxUL_IncDec->GetItemCommand(BT_TBX_UL_INC), mxFrame));
481 mpTbxUL_IncDec->SetItemImage(
482 BT_TBX_UL_DEC,
483 sfx2::sidebar::Tools::GetImage(mpTbxUL_IncDec->GetItemCommand(BT_TBX_UL_DEC), mxFrame));
485 aLink = LINK( this, ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl );
486 mpTbxUL_IncDec->SetSelectHdl(aLink);
487 m_eULSpaceUnit = maULSpaceControl.GetCoreMetric();
488 Size aTbxSize = mpTbxUL_IncDec->CalcWindowSizePixel();
489 mpTbxUL_IncDec->SetOutputSizePixel( aTbxSize );
491 void ParaPropertyPanel::InitToolBoxLineSpacing()
493 Link aLink = LINK( this, ParaPropertyPanel, ClickLineSPDropDownHdl_Impl );
494 mpLineSPTbx->SetDropdownClickHdl( aLink );
495 mpLineSPTbx->SetSelectHdl( aLink ); //support keyinput "ENTER"
496 mpLineSPTbx->SetItemBits( TOOLBOX_ITEM1, mpLineSPTbx->GetItemBits( TOOLBOX_ITEM1 ) | TIB_DROPDOWNONLY );
497 mpLineSPTbx->SetItemImage(TOOLBOX_ITEM1,maSpace3);
498 Size aTbxSize = mpLineSPTbx->CalcWindowSizePixel();
499 mpLineSPTbx->SetOutputSizePixel( aTbxSize );
502 void ParaPropertyPanel::initial()
504 mpFTUL->SetBackground(Wallpaper());
505 mpFTIndent->SetBackground(Wallpaper());
506 maFISpace1.SetBackground(Wallpaper());
507 maFISpace2.SetBackground(Wallpaper());
508 maFIndent1.SetBackground(Wallpaper());
509 maFIndent2.SetBackground(Wallpaper());
510 maFIndent3.SetBackground(Wallpaper());
512 maFISpace1.SetImage(maSpace1);
513 maFISpace2.SetImage(maSpace2);
514 maFIndent1.SetImage(maIndent3);
515 maFIndent2.SetImage(maIndent2);
516 maFIndent3.SetImage(maIndent1);
518 GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_LEFT,sal_True,sal_False);
519 GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_CENTER,sal_True,sal_False);
520 GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_RIGHT,sal_True,sal_False);
521 GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_BLOCK,sal_True,sal_False);
523 //toolbox
524 InitToolBoxAlign();
525 InitToolBoxVertAlign();
526 InitToolBoxIndent();
527 InitToolBoxBGColor();
528 InitToolBoxBulletsNumbering();
529 InitToolBoxSpacing();
530 InitToolBoxLineSpacing();
532 #ifdef HAS_IA2
533 mpAlignToolBox->SetAccRelationLabeledBy(&mpAlignToolBox);
534 mpTBxVertAlign->SetMpSubEditAccLableBy(&mpTBxVertAlign);
535 mpTBxNumBullet->SetAccRelationLabeledBy(&mpTBxNumBullet);
536 mpTBxBackColor->SetMpSubEditAccLableBy(&mpTBxBackColor);
537 mpFTUL->SetAccRelationLabeledBy(&mpFTUL);
538 mpTbxUL_IncDec->SetAccRelationLabeledBy(&mpTbxUL_IncDec);
539 mpTopDist->SetAccRelationLabeledBy(&mpTopDist);
540 mpBottomDist->SetAccRelationLabeledBy(&mpBottomDist);
541 mpLineSPTbx->SetAccRelationLabeledBy(&mpLineSPTbx);
542 mpFTIndent->SetAccRelationLabeledBy(&mpFTIndent);
543 mpTbxIndent_IncDec->SetAccRelationLabeledBy(&mpTbxIndent_IncDec);
544 mpTbxProDemote->SetAccRelationLabeledBy(&mpTbxProDemote);
545 mpLeftIndent->SetAccRelationLabeledBy(&mpLeftIndent);
546 mpRightIndent->SetAccRelationLabeledBy(&mpRightIndent);
547 mpFLineIndent->SetAccRelationLabeledBy(&mpFLineIndent);
548 mpColorUpdater->SetAccRelationLabeledBy(&mpColorUpdater);
549 #endif
552 void ParaPropertyPanel::InitImageList(::boost::scoped_ptr<ToolBox>& rTbx, ImageList& rImglst, ImageList& rImgHlst)
554 sal_Bool bHighContrast = GetDisplayBackground().GetColor().IsDark();
556 ImageList& rImgLst = bHighContrast ? rImgHlst : rImglst;
558 sal_uInt16 nCount = rTbx->GetItemCount();
559 for (sal_uInt16 i = 0; i < nCount; i++)
561 sal_uInt16 nId = rTbx->GetItemId(i);
562 rTbx->SetItemImage( nId, rImgLst.GetImage( nId ) );
566 //===========================for Numbering & Bullet================================================
570 IMPL_LINK(ParaPropertyPanel, NumBTbxDDHandler, ToolBox*, pToolBox)
572 sal_uInt16 nId = pToolBox->GetCurItemId();
574 EndTracking();
575 pToolBox->SetItemDown( nId, sal_True );
577 if (nId == 1)
579 maBulletsPopup.UpdateValueSet();
580 maBulletsPopup.Show(*pToolBox);
582 else if (nId == 2)
584 maNumberingPopup.UpdateValueSet();
585 maNumberingPopup.Show(*pToolBox);
587 pToolBox->SetItemDown( nId, sal_False );
588 return 0;
591 IMPL_LINK(ParaPropertyPanel, NumBTbxSelectHandler, ToolBox*, pToolBox)
593 sal_uInt16 nId = pToolBox->GetCurItemId();
594 sal_uInt16 nSID = SID_TABLE_VERT_NONE;
596 EndTracking();
597 if (nId == 1)
599 nSID = FN_NUM_BULLET_ON;
601 else if ( nId == 2)
603 nSID = FN_NUM_NUMBERING_ON;
605 SfxBoolItem aBoolItem(nSID, sal_True);
606 GetBindings()->GetDispatcher()->Execute(nSID, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
608 return 0;
612 //================================for Vertical Alignment========================================
616 IMPL_LINK(ParaPropertyPanel, VertTbxSelectHandler, ToolBox*, pToolBox)
618 sal_uInt16 nId = pToolBox->GetCurItemId();
619 sal_uInt16 nSID = SID_TABLE_VERT_NONE;
620 EndTracking();
621 if (nId == 1)
623 nSID = SID_TABLE_VERT_NONE;
624 mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_CHECK);
625 mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
626 mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
628 else if (nId == 2)
630 nSID = SID_TABLE_VERT_CENTER;
631 mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
632 mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_CHECK);
633 mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
635 else if (nId == 3)
637 nSID = SID_TABLE_VERT_BOTTOM;
638 mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
639 mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
640 mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_CHECK);
642 SfxBoolItem aBoolItem(nSID, sal_True);
643 GetBindings()->GetDispatcher()->Execute(nSID, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
645 return 0;
648 void ParaPropertyPanel::VertStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState)
650 if (eState < SFX_ITEM_DONTCARE)
652 mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
653 mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
654 mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
655 mpTBxVertAlign->EnableItem(IID_VERT_TOP, sal_False);
656 mpTBxVertAlign->EnableItem(IID_VERT_CENTER, sal_False);
657 mpTBxVertAlign->EnableItem(IID_VERT_BOTTOM, sal_False);
659 else
661 mpTBxVertAlign->EnableItem(IID_VERT_TOP, sal_True);
662 mpTBxVertAlign->EnableItem(IID_VERT_CENTER, sal_True);
663 mpTBxVertAlign->EnableItem(IID_VERT_BOTTOM, sal_True);
664 if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem)))
666 const SfxBoolItem* pItem= (const SfxBoolItem*)pState;
667 sal_Bool aBool = (sal_Bool)pItem->GetValue();
669 if (aBool)
671 if (nSID == SID_TABLE_VERT_NONE)
673 mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_CHECK);
674 mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
675 mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
677 else if (nSID == SID_TABLE_VERT_CENTER)
679 mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
680 mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_CHECK);
681 mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
683 else if (nSID == SID_TABLE_VERT_BOTTOM)
685 mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
686 mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
687 mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_CHECK);
690 else
692 if (nSID == SID_TABLE_VERT_NONE)
694 mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
696 else if (nSID == SID_TABLE_VERT_CENTER)
698 mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
700 else if (nSID == SID_TABLE_VERT_BOTTOM)
702 mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
706 else
708 mpTBxVertAlign->SetItemState(IID_VERT_TOP, STATE_NOCHECK);
709 mpTBxVertAlign->SetItemState(IID_VERT_CENTER, STATE_NOCHECK);
710 mpTBxVertAlign->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK);
714 //==================================for Background color=====================
716 IMPL_LINK(ParaPropertyPanel, ToolBoxBackColorDDHandler,ToolBox*, pToolBox)
718 sal_uInt16 nId = pToolBox->GetCurItemId();
719 OSL_ASSERT(nId == TBI_BACK_COLOR);
720 if(nId == TBI_BACK_COLOR)
722 pToolBox->SetItemDown( nId, true );
723 maBGColorPopup.Show(*pToolBox);
724 maBGColorPopup.SetCurrentColor(maColor, mbColorAvailable);
726 return 0;
729 IMPL_LINK( ParaPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
731 return 0;
734 void ParaPropertyPanel::ShowMenu (void)
736 if (mpBindings != NULL)
738 SfxDispatcher* pDispatcher = mpBindings->GetDispatcher();
739 if (pDispatcher != NULL)
740 pDispatcher->Execute(SID_PARA_DLG, SFX_CALLMODE_ASYNCHRON);
744 void ParaPropertyPanel::ParaBKGStateChanged(sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState)
746 if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem))
748 const SvxColorItem* pItem = (const SvxColorItem*)pState;
749 maColor = pItem->GetValue();
750 mbColorAvailable = sal_True;
751 mpColorUpdater->Update(maColor);
753 else
755 mbColorAvailable = sal_False;
756 maColor.SetColor(COL_AUTO);
757 mpColorUpdater->Update(maColor);
761 void ParaPropertyPanel::SetBGColor (
762 const String& /*rsColorName*/,
763 const Color aColor)
765 SvxColorItem aColorItem(aColor, SID_BACKGROUND_COLOR);
766 mpBindings->GetDispatcher()->Execute(SID_BACKGROUND_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
767 maColor = aColor;
770 //==================================for Paragraph Alignment=====================
771 IMPL_LINK( ParaPropertyPanel, AlignStyleModifyHdl_Impl, ToolBox*, pBox )
773 switch (pBox->GetCurItemId())
775 case BT_SUBSTLEFT:
777 pBox->SetItemState(BT_SUBSTLEFT,STATE_CHECK);
778 pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
779 pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
780 pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
781 SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True );
782 GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_LEFT, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
784 break;
785 case BT_SUBSTCENTER:
787 pBox->SetItemState(BT_SUBSTCENTER,STATE_CHECK);
788 pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
789 pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
790 pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
791 SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True );
792 GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_CENTER, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
794 break;
795 case BT_SUBSTRIGHT:
797 pBox->SetItemState(BT_SUBSTRIGHT,STATE_CHECK);
798 pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
799 pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
800 pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
801 SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True );
802 GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_RIGHT, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
804 break;
805 case BT_SUBSTJUSTIFY:
807 pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_CHECK);
808 pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
809 pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
810 pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
811 SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True );
812 GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_BLOCK, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
814 break;
817 return 0;
819 //==================================for Paragraph Indent=====================
820 IMPL_LINK_NOARG( ParaPropertyPanel, ModifyIndentHdl_Impl)
822 SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
823 aMargin.SetTxtLeft( (const long)GetCoreValue( *mpLeftIndent.get(), m_eLRSpaceUnit ) );
824 aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent.get(), m_eLRSpaceUnit ) );
825 aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ) );
827 GetBindings()->GetDispatcher()->Execute(
828 SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
829 return 0;
832 IMPL_LINK(ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl, ToolBox *, pControl)
834 switch (pControl->GetCurItemId())
836 case INDENT_INCREMENT:
838 switch (maContext.GetCombinedContext_DI())
840 case CombinedEnumContext(Application_WriterVariants, Context_Default):
841 case CombinedEnumContext(Application_WriterVariants, Context_Text):
842 case CombinedEnumContext(Application_WriterVariants, Context_Table):
844 SfxBoolItem aMargin( SID_INC_INDENT, sal_True );
845 GetBindings()->GetDispatcher()->Execute(
846 SID_INC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L);
848 break;
849 default:
851 SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
853 maTxtLeft += INDENT_STEP;
854 sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
855 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
856 aMargin.SetTxtLeft( (const long)nVal );
857 aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent.get(), m_eLRSpaceUnit ) );
858 aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ) );
860 GetBindings()->GetDispatcher()->Execute(
861 SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
865 break;
866 case INDENT_DECREMENT:
868 switch (maContext.GetCombinedContext_DI())
870 case CombinedEnumContext(Application_WriterVariants, Context_Default):
871 case CombinedEnumContext(Application_WriterVariants, Context_Text):
872 case CombinedEnumContext(Application_WriterVariants, Context_Table):
874 SfxBoolItem aMargin( SID_DEC_INDENT, sal_True );
875 GetBindings()->GetDispatcher()->Execute(
876 SID_DEC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L);
878 break;
879 default:
881 if((maTxtLeft - INDENT_STEP) < 0)
882 maTxtLeft = DEFAULT_VALUE;
883 else
884 maTxtLeft -= INDENT_STEP;
886 SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
888 sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
889 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
891 aMargin.SetTxtLeft( (const long)nVal );
892 aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent.get(), m_eLRSpaceUnit ) );
893 aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ) );
895 GetBindings()->GetDispatcher()->Execute(
896 SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
900 break;
901 case ID_HANGING_INDENT:
903 SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
904 aMargin.SetTxtLeft( (const long)GetCoreValue( *mpLeftIndent.get(), m_eLRSpaceUnit ) + (const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ) );
905 aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent.get(), m_eLRSpaceUnit ) );
906 aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ))*(-1) );
908 GetBindings()->GetDispatcher()->Execute(
909 SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
911 break;
913 return( 0L );
916 IMPL_LINK(ParaPropertyPanel, ClickProDemote_Hdl_Impl, ToolBox *, pControl)
918 switch (pControl->GetCurItemId())
920 case BT_TBX_INDENT_PROMOTE:
922 GetBindings()->GetDispatcher()->Execute( SID_OUTLINE_RIGHT, SFX_CALLMODE_RECORD );
924 break;
925 case BT_TBX_INDENT_DEMOTE:
927 GetBindings()->GetDispatcher()->Execute( SID_OUTLINE_LEFT, SFX_CALLMODE_RECORD );
929 break;
930 case SD_HANGING_INDENT:
932 SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
933 aMargin.SetTxtLeft( (const long)GetCoreValue( *mpLeftIndent.get(), m_eLRSpaceUnit ) + (const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ) );
934 aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent.get(), m_eLRSpaceUnit ) );
935 aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *mpFLineIndent.get(), m_eLRSpaceUnit ))*(-1) );
937 GetBindings()->GetDispatcher()->Execute( SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
939 break;
941 return( 0L );
943 //==================================for Paragraph Line Spacing=====================
945 IMPL_LINK( ParaPropertyPanel, ClickLineSPDropDownHdl_Impl, ToolBox*, pBox )
948 const sal_uInt16 nId = pBox->GetCurItemId();
949 OSL_ASSERT(nId == TOOLBOX_ITEM1);
950 if(nId == TOOLBOX_ITEM1)
952 pBox->SetItemDown( nId, true );
953 maLineSpacePopup.Rearrange(meLnSpState,m_eMetricUnit,mpLnSPItem,maContext);
954 maLineSpacePopup.Show(*pBox);
957 return (0L);
960 //==================================for Paragraph Spacing=====================
961 IMPL_LINK_NOARG( ParaPropertyPanel, ULSpaceHdl_Impl)
963 SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE );
964 aMargin.SetUpper( (sal_uInt16)GetCoreValue( *mpTopDist, m_eULSpaceUnit ) );
965 aMargin.SetLower( (sal_uInt16)GetCoreValue( *mpBottomDist, m_eULSpaceUnit ) );
967 GetBindings()->GetDispatcher()->Execute(
968 SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
969 return 0L;
972 IMPL_LINK(ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl, ToolBox *, pControl)
974 switch (pControl->GetCurItemId())
976 case BT_TBX_UL_INC:
978 SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE );
980 maUpper += UL_STEP;
981 sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
982 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
983 aMargin.SetUpper( (const sal_uInt16)nVal );
985 maLower += UL_STEP;
986 nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
987 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
988 aMargin.SetLower( (const sal_uInt16)nVal );
990 GetBindings()->GetDispatcher()->Execute(
991 SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
993 break;
994 case BT_TBX_UL_DEC:
996 SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE );
998 if( maUpper >= UL_STEP )
1000 maUpper -= UL_STEP;
1001 sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1002 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
1003 aMargin.SetUpper( (const sal_uInt16)nVal );
1005 else
1006 aMargin.SetUpper( DEFAULT_VALUE );
1007 if( maLower >= UL_STEP )
1009 maLower -= UL_STEP;
1010 sal_Int64 nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1011 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
1012 aMargin.SetLower( (const sal_uInt16)nVal );
1014 else
1015 aMargin.SetLower( DEFAULT_VALUE );
1017 GetBindings()->GetDispatcher()->Execute(
1018 SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
1020 break;
1022 return( 0L );
1025 //==================================for Paragraph State change=====================
1026 void ParaPropertyPanel::NotifyItemUpdate(
1027 sal_uInt16 nSID,
1028 SfxItemState eState,
1029 const SfxPoolItem* pState,
1030 const bool bIsEnabled)
1032 (void)bIsEnabled;
1034 switch (nSID)
1036 case SID_ATTR_METRIC:
1038 m_eMetricUnit = GetCurrentUnit(eState,pState);
1039 if( m_eMetricUnit!=m_last_eMetricUnit )
1041 SetFieldUnit( *mpLeftIndent, m_eMetricUnit );
1042 SetFieldUnit( *mpRightIndent, m_eMetricUnit );
1043 SetFieldUnit( *mpFLineIndent, m_eMetricUnit );
1044 SetFieldUnit( *mpTopDist, m_eMetricUnit );
1045 SetFieldUnit( *mpBottomDist, m_eMetricUnit );
1047 m_last_eMetricUnit = m_eMetricUnit;
1049 break;
1051 case SID_ATTR_PARA_LRSPACE:
1052 StateChangedIndentImpl( nSID, eState, pState );
1053 break;
1055 case SID_ATTR_PARA_LINESPACE:
1056 StateChangedLnSPImpl( nSID, eState, pState );
1057 break;
1059 case SID_ATTR_PARA_ULSPACE:
1060 StateChangedULImpl( nSID, eState, pState );
1061 break;
1063 case SID_ATTR_PARA_ADJUST_LEFT:
1064 case SID_ATTR_PARA_ADJUST_CENTER:
1065 case SID_ATTR_PARA_ADJUST_RIGHT:
1066 case SID_ATTR_PARA_ADJUST_BLOCK:
1067 StateChangedAlignmentImpl( nSID, eState, pState );
1068 break;
1070 case SID_OUTLINE_LEFT:
1071 case SID_OUTLINE_RIGHT:
1072 StateChangeOutLineImpl( nSID, eState, pState );
1073 break;
1075 case SID_INC_INDENT:
1076 case SID_DEC_INDENT:
1077 StateChangeIncDecImpl( nSID, eState, pState );
1078 break;
1080 case FN_NUM_NUMBERING_ON:
1081 case FN_NUM_BULLET_ON:
1082 StateChangeBulletNumImpl( nSID, eState, pState );
1083 break;
1085 case FN_BUL_NUM_RULE_INDEX:
1086 case FN_NUM_NUM_RULE_INDEX:
1087 StateChangeBulletNumRuleImpl( nSID, eState, pState );
1088 break;
1090 case SID_TABLE_VERT_NONE:
1091 case SID_TABLE_VERT_CENTER:
1092 case SID_TABLE_VERT_BOTTOM:
1093 VertStateChanged( nSID, eState, pState);
1094 break;
1096 case SID_BACKGROUND_COLOR:
1097 ParaBKGStateChanged(nSID, eState, pState);
1098 break;
1105 void ParaPropertyPanel::StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1107 if( eState >= SFX_ITEM_AVAILABLE )
1109 const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
1110 bool IsChecked = (bool)pItem->GetValue();
1111 switch (nSID)
1113 case SID_ATTR_PARA_ADJUST_LEFT:
1115 if(IsChecked)
1117 mpAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_CHECK);
1118 mpAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1119 mpAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1120 mpAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1122 else
1123 mpAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1125 break;
1126 case SID_ATTR_PARA_ADJUST_CENTER:
1128 if(IsChecked)
1130 mpAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_CHECK);
1131 mpAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1132 mpAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1133 mpAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1135 else
1136 mpAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1138 break;
1139 case SID_ATTR_PARA_ADJUST_RIGHT:
1141 if(IsChecked)
1143 mpAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_CHECK);
1144 mpAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1145 mpAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1146 mpAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1148 else
1149 mpAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1151 break;
1152 case SID_ATTR_PARA_ADJUST_BLOCK:
1154 if(IsChecked)
1156 mpAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_CHECK);
1157 mpAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1158 mpAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1159 mpAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1161 else
1162 mpAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1164 break;
1167 else if( eState == SFX_ITEM_DISABLED )
1170 else if ( eState == SFX_ITEM_DONTCARE )
1172 switch (nSID)
1174 case SID_ATTR_PARA_ADJUST_LEFT:
1175 mpAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK);
1176 break;
1177 case SID_ATTR_PARA_ADJUST_CENTER:
1178 mpAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK);
1179 break;
1180 case SID_ATTR_PARA_ADJUST_RIGHT:
1181 mpAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK);
1182 break;
1183 case SID_ATTR_PARA_ADJUST_BLOCK:
1184 mpAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK);
1185 break;
1190 void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
1192 switch (maContext.GetCombinedContext_DI())
1195 case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
1196 case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
1197 case CombinedEnumContext(Application_Calc, Context_DrawText):
1199 mpLeftIndent->SetMin( DEFAULT_VALUE );
1200 mpRightIndent->SetMin( DEFAULT_VALUE );
1201 mpFLineIndent->SetMin( DEFAULT_VALUE );
1202 mpTbxIndent_IncDec->Show();
1203 mpTbxProDemote->Hide();
1205 break;
1206 case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
1207 case CombinedEnumContext(Application_DrawImpress, Context_Draw):
1208 case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
1209 case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
1210 case CombinedEnumContext(Application_DrawImpress, Context_Table):
1212 mpLeftIndent->SetMin( DEFAULT_VALUE );
1213 mpRightIndent->SetMin( DEFAULT_VALUE );
1214 mpFLineIndent->SetMin( DEFAULT_VALUE );
1215 mpTbxIndent_IncDec->Hide();
1216 mpTbxProDemote->Show();
1218 break;
1219 case CombinedEnumContext(Application_WriterVariants, Context_Default):
1220 case CombinedEnumContext(Application_WriterVariants, Context_Text):
1221 case CombinedEnumContext(Application_WriterVariants, Context_Table):
1223 mpLeftIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
1224 mpRightIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
1225 mpFLineIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
1226 mpTbxIndent_IncDec->Show();
1227 mpTbxProDemote->Hide();
1229 break;
1232 if( pState && eState >= SFX_ITEM_AVAILABLE )
1234 SvxLRSpaceItem* pSpace = ( SvxLRSpaceItem*)pState;
1235 maTxtLeft = pSpace->GetTxtLeft();
1236 maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
1237 maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1239 long aTxtRight = pSpace->GetRight();
1240 aTxtRight = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
1241 aTxtRight = OutputDevice::LogicToLogic( aTxtRight, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1243 long aTxtFirstLineOfst = pSpace->GetTxtFirstLineOfst();
1244 aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
1245 aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1247 long nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1248 nVal = (long)mpLeftIndent->Normalize( (long)nVal );
1249 mpLeftIndent->SetValue( nVal, FUNIT_100TH_MM );
1251 if ( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text)
1252 && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default)
1253 && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Table))
1255 mpFLineIndent->SetMin( nVal*(-1), FUNIT_100TH_MM );
1258 long nrVal = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1259 nrVal = (long)mpRightIndent->Normalize( (long)nrVal );
1260 mpRightIndent->SetValue( nrVal, FUNIT_100TH_MM );
1262 long nfVal = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1263 nfVal = (long)mpFLineIndent->Normalize( (long)nfVal );
1264 mpFLineIndent->SetValue( nfVal, FUNIT_100TH_MM );
1266 switch (maContext.GetCombinedContext_DI())
1268 case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
1269 case CombinedEnumContext(Application_WriterVariants, Context_Text):
1270 case CombinedEnumContext(Application_WriterVariants, Context_Default):
1271 case CombinedEnumContext(Application_WriterVariants, Context_Table):
1272 case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
1274 mpLeftIndent->SetMax( MAX_SW - nrVal, FUNIT_100TH_MM );
1275 mpRightIndent->SetMax( MAX_SW - nVal, FUNIT_100TH_MM );
1276 mpFLineIndent->SetMax( MAX_SW - nVal - nrVal, FUNIT_100TH_MM );
1278 break;
1279 case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
1280 case CombinedEnumContext(Application_DrawImpress, Context_Draw):
1281 case CombinedEnumContext(Application_DrawImpress, Context_Table):
1282 case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
1283 case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
1285 mpLeftIndent->SetMax( MAX_SC_SD - nrVal, FUNIT_100TH_MM );
1286 mpRightIndent->SetMax( MAX_SC_SD - nVal, FUNIT_100TH_MM );
1287 mpFLineIndent->SetMax( MAX_SC_SD - nVal - nrVal, FUNIT_100TH_MM );
1291 mpTbxIndent_IncDec->Enable();
1292 mpTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_True);
1293 if ( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text)
1294 && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default)
1295 && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Table) )
1297 mpTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True);
1298 mpTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True);
1301 mpTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True);
1303 else if( eState == SFX_ITEM_DISABLED )
1305 mpLeftIndent-> Disable();
1306 mpRightIndent->Disable();
1307 mpFLineIndent->Disable();
1308 mpTbxIndent_IncDec->Disable();
1309 if( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text) &&
1310 maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default) &&
1311 maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Table) )
1312 mpTbxIndent_IncDec->Disable();
1313 else
1314 mpTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False);
1316 // maTbxProDemote->Disable();
1317 mpTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False);
1319 else
1321 mpLeftIndent->SetEmptyFieldValue();
1322 mpRightIndent->SetEmptyFieldValue();
1323 mpFLineIndent->SetEmptyFieldValue();
1324 if( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text) &&
1325 maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default) &&
1326 maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Table) )
1327 mpTbxIndent_IncDec->Disable();
1328 else
1329 mpTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False);
1330 mpTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False);
1334 void ParaPropertyPanel::StateChangedLnSPImpl( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
1336 meLnSpState = eState;
1338 if( pState && eState >= SFX_ITEM_AVAILABLE )
1340 if(mpLnSPItem)
1341 delete mpLnSPItem;
1342 mpLnSPItem = ( SvxLineSpacingItem *)pState->Clone();
1346 void ParaPropertyPanel::StateChangedULImpl( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
1348 mpTopDist->SetMax( mpTopDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) );
1349 mpBottomDist->SetMax( mpBottomDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) );
1351 if( pState && eState >= SFX_ITEM_AVAILABLE )
1353 SvxULSpaceItem* pOldItem = (SvxULSpaceItem*)pState;
1355 maUpper = pOldItem->GetUpper();
1356 maUpper = OutputDevice::LogicToLogic( maUpper, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM );
1357 maUpper = OutputDevice::LogicToLogic( maUpper, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1359 maLower = pOldItem->GetLower();
1360 maLower = OutputDevice::LogicToLogic( maLower, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM );
1361 maLower = OutputDevice::LogicToLogic( maLower, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1363 sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1364 nVal = mpTopDist->Normalize( nVal );
1365 mpTopDist->SetValue( nVal, FUNIT_100TH_MM );
1367 nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1368 nVal = mpBottomDist->Normalize( nVal );
1369 mpBottomDist->SetValue( nVal, FUNIT_100TH_MM );
1370 mpTbxUL_IncDec->Enable();
1372 else if(eState == SFX_ITEM_DISABLED )
1374 mpTopDist->Disable();
1375 mpBottomDist->Disable();
1376 mpTbxUL_IncDec->Disable();
1378 else
1380 mpTopDist->SetEmptyFieldValue();
1381 mpBottomDist->SetEmptyFieldValue();
1382 mpTbxUL_IncDec->Disable();
1386 void ParaPropertyPanel::StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1388 if (nSID==SID_OUTLINE_LEFT)
1390 if( pState && eState == SFX_ITEM_UNKNOWN )
1391 mbOutLineLeft = 1;
1392 else
1393 mbOutLineLeft = 0;
1395 if (nSID==SID_OUTLINE_RIGHT)
1397 if( pState && eState == SFX_ITEM_UNKNOWN )
1398 mbOutLineRight = 1;
1399 else
1400 mbOutLineRight = 0;
1402 if(mbOutLineLeft)
1403 mpTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_True);
1404 else
1405 mpTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_False);
1407 if(mbOutLineRight)
1408 mpTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_True);
1409 else
1410 mpTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_False);
1414 void ParaPropertyPanel::StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1416 if ( ( maContext.GetCombinedContext_DI() == CombinedEnumContext(Application_WriterVariants, Context_Text)
1417 || maContext.GetCombinedContext_DI() == CombinedEnumContext(Application_WriterVariants, Context_Default)
1418 || maContext.GetCombinedContext_DI() == CombinedEnumContext(Application_WriterVariants, Context_Table) )
1419 && ( nSID == SID_INC_INDENT || nSID == SID_DEC_INDENT ) )
1421 // Writer's text shell is the only one which provides reasonable states for Slots SID_INC_INDENT and SID_DEC_INDENT
1422 // - namely SFX_ITEM_UNKNOWN and SFX_ITEM_DISABLED
1423 mpTbxIndent_IncDec->EnableItem(
1424 nSID == SID_INC_INDENT ? BT_TBX_INDENT_INC : BT_TBX_INDENT_DEC,
1425 ( pState && eState == SFX_ITEM_UNKNOWN ) ? sal_True : sal_False );
1430 // Add toggle state for numbering and bullet icons
1431 void ParaPropertyPanel::StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1433 if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem)) )
1435 const SfxBoolItem* pItem= (const SfxBoolItem*)pState;
1436 const sal_Bool aBool = (sal_Bool)pItem->GetValue();
1437 if (nSID==FN_NUM_NUMBERING_ON)
1439 mpTBxNumBullet->SetItemState(
1440 IID_NUMBER,
1441 aBool ? STATE_CHECK : STATE_NOCHECK );
1443 else if (nSID==FN_NUM_BULLET_ON)
1445 mpTBxNumBullet->SetItemState(
1446 IID_BULLET,
1447 aBool ? STATE_CHECK : STATE_NOCHECK );
1453 void ParaPropertyPanel::StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1455 if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxUInt16Item) )
1457 sal_uInt16 nValue = (sal_uInt16)0xFFFF;
1459 const SfxUInt16Item* pIt = (const SfxUInt16Item*)pState;
1460 if ( pIt )
1461 nValue = pIt->GetValue();
1464 if ( nSID == FN_BUL_NUM_RULE_INDEX )
1466 mnBulletTypeIndex = nValue;
1468 else if ( nSID == FN_NUM_NUM_RULE_INDEX )
1470 mnNumTypeIndex = nValue;
1476 FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState )
1478 FieldUnit eUnit = FUNIT_NONE;
1480 if ( pState && eState >= SFX_ITEM_DEFAULT )
1481 eUnit = (FieldUnit)( (const SfxUInt16Item*)pState )->GetValue();
1482 else
1484 SfxViewFrame* pFrame = SfxViewFrame::Current();
1485 SfxObjectShell* pSh = NULL;
1486 if ( pFrame )
1487 pSh = pFrame->GetObjectShell();
1488 if ( pSh ) //the object shell is not always available during reload
1490 SfxModule* pModule = pSh->GetModule();
1491 if ( pModule )
1493 const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC );
1494 if ( pItem )
1495 eUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue();
1497 else
1499 DBG_ERRORFILE( "GetModuleFieldUnit(): no module found" );
1504 return eUnit;
1508 PopupControl* ParaPropertyPanel::CreateLineSpacingControl (PopupContainer* pParent)
1510 return new ParaLineSpacingControl(pParent, *this);
1513 PopupControl* ParaPropertyPanel::CreateBulletsPopupControl (PopupContainer* pParent)
1515 return new ParaBulletsControl(pParent, *this);
1518 PopupControl* ParaPropertyPanel::CreateNumberingPopupControl (PopupContainer* pParent)
1520 return new ParaNumberingControl(pParent, *this);
1523 namespace
1525 Color GetNoBackgroundColor(void)
1527 return COL_TRANSPARENT;
1529 } // end of anonymous namespace
1531 PopupControl* ParaPropertyPanel::CreateBGColorPopupControl (PopupContainer* pParent)
1533 const ResId aResId(SVX_RES(STR_NOFILL));
1535 return new ColorControl(
1536 pParent,
1537 mpBindings,
1538 SVX_RES(RID_POPUPPANEL_PARAPAGE_BACK_COLOR),
1539 SVX_RES(VS_FONT_COLOR),
1540 ::boost::bind(GetNoBackgroundColor),
1541 ::boost::bind(&ParaPropertyPanel::SetBGColor, this, _1,_2),
1542 pParent,
1543 &aResId);
1547 ParaPropertyPanel::ParaPropertyPanel(Window* pParent,
1548 const cssu::Reference<css::frame::XFrame>& rxFrame,
1549 SfxBindings* pBindings,
1550 const cssu::Reference<css::ui::XSidebar>& rxSidebar)
1551 : Control(pParent, SVX_RES(RID_SIDEBAR_PARA_PANEL)),
1552 mpAlignToolBoxBackground(ControlFactory::CreateToolBoxBackground(this)),
1553 mpAlignToolBox (ControlFactory::CreateToolBox(mpAlignToolBoxBackground.get(),SVX_RES(TBX_HORIZONTALALIGNMENT))),
1554 mpTBxVertAlignBackground(ControlFactory::CreateToolBoxBackground(this)),
1555 mpTBxVertAlign (ControlFactory::CreateToolBox(mpTBxVertAlignBackground.get(),SVX_RES(TBX_VERT_ALIGN))),
1556 mpTBxNumBulletBackground(ControlFactory::CreateToolBoxBackground(this)),
1557 mpTBxNumBullet (ControlFactory::CreateToolBox(mpTBxNumBulletBackground.get(),SVX_RES(TBX_NUM_BULLET))),
1558 mpTBxBackColorBackground(ControlFactory::CreateToolBoxBackground(this)),
1559 mpTBxBackColor (ControlFactory::CreateToolBox(mpTBxBackColorBackground.get(),SVX_RES(TBX_BACK_COLOR))),
1560 mpFTUL (new FixedText(this, SVX_RES(FT_SPACING))),
1561 mpTbxUL_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)),
1562 mpTbxUL_IncDec (ControlFactory::CreateToolBox(mpTbxUL_IncDecBackground.get(),SVX_RES(TBX_UL_INC_DEC))),
1563 mpTopDist (new SvxRelativeField(this, SVX_RES(MF_ABOVE_PARASPACING))),
1564 mpBottomDist (new SvxRelativeField(this, SVX_RES(MF_BELOW_PARASPACING))),
1565 mpLineSPTbxBackground(ControlFactory::CreateToolBoxBackground(this)),
1566 mpLineSPTbx (ControlFactory::CreateToolBox(mpLineSPTbxBackground.get(),SVX_RES(TBX_LINESP))),
1567 mpFTIndent (new FixedText(this, SVX_RES(FT_INDENT))),
1568 mpTbxIndent_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)),
1569 mpTbxIndent_IncDec (ControlFactory::CreateToolBox(mpTbxIndent_IncDecBackground.get(),SVX_RES(TBX_INDENT_INC_DEC))),
1570 mpTbxProDemoteBackground(ControlFactory::CreateToolBoxBackground(this)),
1571 mpTbxProDemote (ControlFactory::CreateToolBox(mpTbxProDemoteBackground.get(),SVX_RES(TBX_INDENT_PRO_DEMOTE))),
1572 mpLeftIndent (new SvxRelativeField(this, SVX_RES(MF_BEFORE_INDENT))),
1573 mpRightIndent (new SvxRelativeField(this, SVX_RES(MF_AFTER_INDENT))),
1574 mpFLineIndent (new SvxRelativeField(this, SVX_RES(MF_FL_INDENT))),
1576 mpColorUpdater (),
1577 maFISpace1 ( this, SVX_RES( FI_SPACE1)),
1578 maFISpace2 ( this, SVX_RES( FI_SPACE2)),
1579 maFIndent1 ( this, SVX_RES( FI_INDENT1)),
1580 maFIndent2 ( this, SVX_RES( FI_INDENT2)),
1581 maFIndent3 ( this, SVX_RES( FI_INDENT3)),
1582 maSpace1 (SVX_RES(IMG_SPACE1)),
1583 maSpace2 (SVX_RES(IMG_SPACE2)),
1584 maSpace3 (SVX_RES(IMG_SPACE3)),
1585 maIndent1 (SVX_RES(IMG_INDENT1)),
1586 maIndent2 (SVX_RES(IMG_INDENT2)),
1587 maIndent3 (SVX_RES(IMG_INDENT3)),
1588 maIndHang (SVX_RES(IMG_INDENT_HANG)),
1589 maNumBImageList (SVX_RES(IL_NUM_BULLET)),
1590 maNumBImageListRTL (SVX_RES(IL_NUM_BULLET_RTL)),
1591 maImgBackColorHigh (SVX_RES(IMG_BACK_COLOR_H)),
1592 maImgBackColor (SVX_RES(IMG_BACK_COLOR)),
1593 maTxtLeft (0),
1594 mpLnSPItem (NULL),
1595 meLnSpState (SFX_ITEM_DONTCARE),
1596 mbOutLineLeft (false),
1597 mbOutLineRight (false),
1598 maUpper (0),
1599 maLower (0),
1600 mnBulletTypeIndex ((sal_uInt16)0xFFFF),
1601 mnNumTypeIndex ((sal_uInt16)0xFFFF),
1602 maColor (COL_AUTO),
1603 mbColorAvailable (true),
1604 m_eMetricUnit(FUNIT_NONE),
1605 m_last_eMetricUnit(FUNIT_NONE),
1606 m_eLRSpaceUnit(),
1607 m_eULSpaceUnit(),
1608 maLeftAlignControl(SID_ATTR_PARA_ADJUST_LEFT, *pBindings, *this, A2S("LeftPara"), rxFrame),
1609 maCenterAlignControl(SID_ATTR_PARA_ADJUST_CENTER, *pBindings, *this, A2S("CenterPara"), rxFrame),
1610 maRightAlignControl(SID_ATTR_PARA_ADJUST_RIGHT, *pBindings, *this, A2S("RightPara"), rxFrame),
1611 maJustifyAlignControl(SID_ATTR_PARA_ADJUST_BLOCK, *pBindings, *this, A2S("JustifyPara"), rxFrame),
1612 maLRSpaceControl (SID_ATTR_PARA_LRSPACE,*pBindings,*this),
1613 maLNSpaceControl (SID_ATTR_PARA_LINESPACE, *pBindings,*this),
1614 maULSpaceControl (SID_ATTR_PARA_ULSPACE, *pBindings,*this),
1615 maOutLineLeftControl(SID_OUTLINE_LEFT, *pBindings, *this, A2S("OutlineRight"), rxFrame),
1616 maOutLineRightControl(SID_OUTLINE_RIGHT, *pBindings, *this, A2S("OutlineLeft"), rxFrame),
1617 maDecIndentControl(SID_DEC_INDENT, *pBindings,*this, A2S("DecrementIndent"), rxFrame),
1618 maIncIndentControl(SID_INC_INDENT, *pBindings,*this, A2S("IncrementIndent"), rxFrame),
1619 maVertTop (SID_TABLE_VERT_NONE, *pBindings, *this, A2S("CellVertTop"), rxFrame),
1620 maVertCenter (SID_TABLE_VERT_CENTER, *pBindings,*this, A2S("CellVertCenter"), rxFrame),
1621 maVertBottom (SID_TABLE_VERT_BOTTOM,*pBindings,*this, A2S("CellVertBottom"), rxFrame),
1622 maBulletOnOff(FN_NUM_BULLET_ON, *pBindings, *this, A2S("DefaultBullet"), rxFrame),
1623 maNumberOnOff(FN_NUM_NUMBERING_ON, *pBindings, *this, A2S("DefaultNumbering"), rxFrame),
1624 maBackColorControl (SID_BACKGROUND_COLOR, *pBindings,*this),
1625 m_aMetricCtl (SID_ATTR_METRIC, *pBindings,*this),
1626 maBulletNumRuleIndex (FN_BUL_NUM_RULE_INDEX, *pBindings,*this),
1627 maNumNumRuleIndex (FN_NUM_NUM_RULE_INDEX, *pBindings,*this),
1628 mxFrame(rxFrame),
1629 maContext(),
1630 mpBindings(pBindings),
1631 maLineSpacePopup(this, ::boost::bind(&ParaPropertyPanel::CreateLineSpacingControl, this, _1)),
1632 maBulletsPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBulletsPopupControl, this, _1)),
1633 maNumberingPopup(this, ::boost::bind(&ParaPropertyPanel::CreateNumberingPopupControl, this, _1)),
1634 maBGColorPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBGColorPopupControl, this, _1)),
1635 mxSidebar(rxSidebar)
1637 initial();
1638 FreeResource();
1641 } } // end of namespace svx::sidebar