Line data Source code
1 : /*
2 : * This file is part of the LibreOffice project.
3 : *
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/.
7 : *
8 : * This file incorporates work covered by the following license notice:
9 : *
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 .
17 : */
18 : #include <svx/sidebar/ColorControl.hxx>
19 :
20 : #include "ParaPropertyPanel.hxx"
21 : #include "ParaPropertyPanel.hrc"
22 :
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;
52 :
53 : const char UNO_LEFTPARA[] = ".uno:LeftPara";
54 : const char UNO_RIGHTPARA[] = ".uno:RightPara";
55 : const char UNO_CENTERPARA[] = ".uno:CenterPara";
56 : const char UNO_JUSTIFYPARA[] = ".uno:JustifyPara";
57 :
58 : const char UNO_DEFAULTBULLET[] = ".uno:DefaultBullet";
59 : const char UNO_DEFAULTNUMBERING[] = ".uno:DefaultNumbering";
60 :
61 : const char UNO_PARABACKCOLOR[] = ".uno:ParaBackColor";
62 :
63 : const char UNO_INCREMENTINDENT[] = ".uno:IncrementIndent";
64 : const char UNO_DECREMENTINDENT[] = ".uno:DecrementIndent";
65 : const char UNO_HANGINGINDENT[] = ".uno:HangingIndent";
66 :
67 : const char UNO_PROMOTE[] = ".uno:Promote";
68 : const char UNO_DEMOTE[] = ".uno:Demote";
69 : const char UNO_HANGINGINDENT2[] = ".uno:HangingIndent2";
70 :
71 : const char UNO_LINESPACING[] = ".uno:LineSpacing";
72 :
73 : const char UNO_CELLVERTTOP[] = ".uno:CellVertTop";
74 : const char UNO_CELLVERTCENTER[] = ".uno:CellVertCenter";
75 : const char UNO_CELLVERTBOTTOM[] = ".uno:CellVertBottom";
76 :
77 : const char UNO_PARASPACEINC[] = ".uno:ParaspaceIncrease";
78 : const char UNO_PARASPACEDEC[] = ".uno:ParaspaceDecrease";
79 :
80 : namespace svx {namespace sidebar {
81 : #define DEFAULT_VALUE 0
82 :
83 : #define MAX_DURCH 5670
84 :
85 : #define INDENT_STEP 706
86 : #define UL_STEP 58
87 :
88 : #define MAX_SW 1709400
89 : #define MAX_SC_SD 116220200
90 : #define NEGA_MAXVALUE -10000000
91 :
92 0 : ParaPropertyPanel* ParaPropertyPanel::Create (
93 : Window* pParent,
94 : const cssu::Reference<css::frame::XFrame>& rxFrame,
95 : SfxBindings* pBindings,
96 : const cssu::Reference<css::ui::XSidebar>& rxSidebar)
97 : {
98 0 : if (pParent == NULL)
99 0 : throw lang::IllegalArgumentException(A2S("no parent Window given to ParaPropertyPanel::Create"), NULL, 0);
100 0 : if ( ! rxFrame.is())
101 0 : throw lang::IllegalArgumentException(A2S("no XFrame given to ParaPropertyPanel::Create"), NULL, 1);
102 0 : if (pBindings == NULL)
103 0 : throw lang::IllegalArgumentException(A2S("no SfxBindings given to ParaPropertyPanel::Create"), NULL, 2);
104 :
105 : return new ParaPropertyPanel(
106 : pParent,
107 : rxFrame,
108 : pBindings,
109 0 : rxSidebar);
110 : }
111 :
112 0 : void ParaPropertyPanel::HandleContextChange (
113 : const ::sfx2::sidebar::EnumContext aContext)
114 : {
115 0 : if (maContext == aContext)
116 : {
117 : // Nothing to do.
118 0 : return;
119 : }
120 :
121 0 : maContext = aContext;
122 0 : switch (maContext.GetCombinedContext_DI())
123 : {
124 : case CombinedEnumContext(Application_Calc, Context_DrawText):
125 0 : mpTBxVertAlign->Show();
126 0 : mpTBxBackColor->Hide();
127 0 : mpTBxNumBullet->Hide();
128 0 : ReSize(false);
129 0 : mpTbxIndent_IncDec->Show();
130 0 : mpTbxProDemote->Hide();
131 0 : break;
132 :
133 : case CombinedEnumContext(Application_DrawImpress, Context_Draw):
134 : case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
135 : case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
136 0 : mpTBxVertAlign->Hide();
137 0 : mpTBxBackColor->Hide();
138 0 : mpTBxNumBullet->Show();
139 0 : ReSize(true);
140 0 : mpTbxIndent_IncDec->Hide();
141 0 : mpTbxProDemote->Show();
142 0 : break;
143 :
144 : case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
145 0 : mpTBxVertAlign->Show();
146 0 : mpTBxBackColor->Hide();
147 0 : mpTBxNumBullet->Show();
148 0 : ReSize(true);
149 0 : mpTbxIndent_IncDec->Hide();
150 0 : mpTbxProDemote->Show();
151 0 : break;
152 :
153 : case CombinedEnumContext(Application_DrawImpress, Context_Table):
154 0 : mpTBxVertAlign->Show();
155 0 : mpTBxBackColor->Hide();
156 0 : mpTBxNumBullet->Show();
157 0 : ReSize(true);
158 0 : mpTbxIndent_IncDec->Hide();
159 0 : mpTbxProDemote->Show();
160 0 : break;
161 :
162 : case CombinedEnumContext(Application_WriterVariants, Context_Default):
163 : case CombinedEnumContext(Application_WriterVariants, Context_Text):
164 0 : mpTBxVertAlign->Hide();
165 0 : mpTBxBackColor->Show();
166 0 : mpTBxNumBullet->Show();
167 :
168 0 : ReSize(true);
169 0 : mpTbxIndent_IncDec->Show();
170 0 : mpTbxProDemote->Hide();
171 0 : break;
172 :
173 : case CombinedEnumContext(Application_WriterVariants, Context_Table):
174 0 : mpTBxVertAlign->Show();
175 0 : mpTBxBackColor->Show();
176 0 : mpTBxNumBullet->Show();
177 0 : ReSize(true);
178 0 : mpTbxIndent_IncDec->Show();
179 0 : mpTbxProDemote->Hide();
180 0 : break;
181 :
182 : case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
183 0 : mpTBxVertAlign->Show();
184 0 : mpTBxBackColor->Hide();
185 0 : mpTBxNumBullet->Hide();
186 0 : ReSize(false);
187 0 : mpTbxIndent_IncDec->Show();
188 0 : mpTbxProDemote->Hide();
189 0 : break;
190 :
191 : case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
192 0 : mpTBxVertAlign->Hide();
193 0 : mpTBxBackColor->Hide();
194 0 : mpTBxNumBullet->Hide();
195 0 : ReSize(false);
196 0 : mpTbxIndent_IncDec->Show();
197 0 : mpTbxProDemote->Hide();
198 0 : break;
199 :
200 : case CombinedEnumContext(Application_Calc, Context_EditCell):
201 : case CombinedEnumContext(Application_Calc, Context_Cell):
202 : case CombinedEnumContext(Application_Calc, Context_Pivot):
203 : case CombinedEnumContext(Application_DrawImpress, Context_Text):
204 : case CombinedEnumContext(Application_DrawImpress, Context_OutlineText):
205 : /*{
206 : mpToolBoxScriptSw->Hide();
207 : mpToolBoxScript->Show();
208 : mpToolBoxSpacing->Show();
209 : mpToolBoxHighlight->Hide();
210 :
211 : Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT);
212 : aSize = LogicToPixel( aSize,MapMode(MAP_APPFONT) );
213 : aSize.setWidth(GetOutputSizePixel().Width());
214 : SetSizePixel(aSize);
215 : }*/
216 0 : break;
217 :
218 : default:
219 0 : break;
220 : }
221 : }
222 :
223 0 : SfxBindings* ParaPropertyPanel::GetBindings()
224 : {
225 0 : return mpBindings;
226 : }
227 :
228 :
229 :
230 :
231 0 : void ParaPropertyPanel::DataChanged (const DataChangedEvent& rEvent)
232 : {
233 : (void)rEvent;
234 0 : }
235 :
236 0 : ParaPropertyPanel::~ParaPropertyPanel()
237 : {
238 0 : delete mpLnSPItem;
239 0 : }
240 :
241 0 : void ParaPropertyPanel::ReSize(bool /* bSize */)
242 : {
243 0 : if (mxSidebar.is())
244 0 : mxSidebar->requestLayout();
245 0 : }
246 :
247 0 : void ParaPropertyPanel::EndSpacingPopupMode (void)
248 : {
249 0 : maLineSpacePopup.Hide();
250 0 : }
251 :
252 0 : void ParaPropertyPanel::EndBulletsPopupMode (void)
253 : {
254 : //i122054, Missed following line, for collapse the bullets popup
255 0 : maBulletsPopup.Hide();
256 0 : }
257 :
258 0 : void ParaPropertyPanel::EndNumberingPopupMode (void)
259 : {
260 : //i122054, Missed following line, for collapse the numbering popup
261 0 : maNumberingPopup.Hide();
262 0 : }
263 :
264 :
265 0 : void ParaPropertyPanel::InitToolBoxAlign()
266 : {
267 0 : const sal_uInt16 nIdLeft = mpAlignToolBox->GetItemId(UNO_LEFTPARA);
268 0 : const sal_uInt16 nIdCenter = mpAlignToolBox->GetItemId(UNO_CENTERPARA);
269 0 : const sal_uInt16 nIdRight = mpAlignToolBox->GetItemId(UNO_RIGHTPARA);
270 0 : const sal_uInt16 nIdJustify = mpAlignToolBox->GetItemId(UNO_JUSTIFYPARA);
271 :
272 0 : mpAlignToolBox->SetItemImage(nIdLeft, maLeftAlignControl.GetIcon());
273 0 : mpAlignToolBox->SetItemImage(nIdCenter, maCenterAlignControl.GetIcon());
274 0 : mpAlignToolBox->SetItemImage(nIdRight, maRightAlignControl.GetIcon());
275 0 : mpAlignToolBox->SetItemImage(nIdJustify, maJustifyAlignControl.GetIcon());
276 :
277 0 : Link aLink = LINK( this, ParaPropertyPanel, AlignStyleModifyHdl_Impl );
278 0 : mpAlignToolBox->SetSelectHdl( aLink );
279 0 : }
280 :
281 0 : void ParaPropertyPanel::InitToolBoxVertAlign()
282 : {
283 0 : const sal_uInt16 nIdVertTop = mpTBxVertAlign->GetItemId(UNO_CELLVERTTOP);
284 0 : const sal_uInt16 nIdVertCenter = mpTBxVertAlign->GetItemId(UNO_CELLVERTCENTER);
285 0 : const sal_uInt16 nIdVertBottom = mpTBxVertAlign->GetItemId(UNO_CELLVERTBOTTOM);
286 :
287 0 : mpTBxVertAlign->SetItemImage(nIdVertTop, maVertTop.GetIcon());
288 0 : mpTBxVertAlign->SetItemImage(nIdVertCenter, maVertCenter.GetIcon());
289 0 : mpTBxVertAlign->SetItemImage(nIdVertBottom, maVertBottom.GetIcon());
290 0 : mpTBxVertAlign->SetSelectHdl(LINK(this,ParaPropertyPanel,VertTbxSelectHandler));
291 0 : }
292 :
293 :
294 0 : void ParaPropertyPanel::InitToolBoxIndent()
295 : {
296 0 : Link aLink = LINK( this, ParaPropertyPanel, ModifyIndentHdl_Impl );
297 0 : mpLeftIndent->SetModifyHdl( aLink );
298 0 : mpRightIndent->SetModifyHdl( aLink );
299 0 : mpFLineIndent->SetModifyHdl( aLink );
300 :
301 0 : mpLeftIndent->SetAccessibleName(mpLeftIndent->GetQuickHelpText());
302 0 : mpRightIndent->SetAccessibleName(mpRightIndent->GetQuickHelpText());
303 0 : mpFLineIndent->SetAccessibleName(mpFLineIndent->GetQuickHelpText());
304 :
305 0 : const sal_uInt16 nIdIncrement = mpTbxIndent_IncDec->GetItemId(UNO_INCREMENTINDENT);
306 0 : const sal_uInt16 nIdDecrement = mpTbxIndent_IncDec->GetItemId(UNO_DECREMENTINDENT);
307 0 : const sal_uInt16 nIdHanging = mpTbxIndent_IncDec->GetItemId(UNO_HANGINGINDENT);
308 :
309 0 : if( Application::GetSettings().GetLayoutRTL())
310 : {
311 0 : mpTbxIndent_IncDec->SetItemImage(nIdIncrement, maIncIndentControl.GetIcon());
312 0 : mpTbxIndent_IncDec->SetItemImage(nIdDecrement, maDecIndentControl.GetIcon());
313 : }
314 : else
315 : {
316 0 : mpTbxIndent_IncDec->SetItemImage(nIdIncrement, maIncIndentControl.GetIcon());
317 0 : mpTbxIndent_IncDec->SetItemImage(nIdDecrement, maDecIndentControl.GetIcon());
318 : }
319 0 : mpTbxIndent_IncDec->SetItemImage(nIdHanging, maIndHang);
320 :
321 0 : aLink = LINK( this, ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl );
322 0 : mpTbxIndent_IncDec->SetSelectHdl(aLink);
323 0 : m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric();
324 :
325 0 : const sal_uInt16 nIdPromote = mpTbxProDemote->GetItemId(UNO_PROMOTE);
326 0 : const sal_uInt16 nIdDemote = mpTbxProDemote->GetItemId(UNO_DEMOTE);
327 0 : const sal_uInt16 nIdHanging2 = mpTbxProDemote->GetItemId(UNO_HANGINGINDENT2);
328 0 : if( Application::GetSettings().GetLayoutRTL())
329 : {
330 0 : mpTbxProDemote->SetItemImage(nIdPromote, maOutLineLeftControl.GetIcon());
331 0 : mpTbxProDemote->SetItemImage(nIdDemote, maOutLineRightControl.GetIcon());
332 : }
333 : else
334 : {
335 0 : mpTbxProDemote->SetItemImage(nIdPromote, maOutLineLeftControl.GetIcon());
336 0 : mpTbxProDemote->SetItemImage(nIdDemote, maOutLineRightControl.GetIcon());
337 : }
338 0 : mpTbxProDemote->SetItemImage(nIdHanging2, maIndHang);
339 0 : aLink = LINK( this, ParaPropertyPanel, ClickProDemote_Hdl_Impl );
340 0 : mpTbxProDemote->SetSelectHdl(aLink);
341 0 : m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric();
342 0 : }
343 :
344 0 : void ParaPropertyPanel::InitToolBoxBGColor()
345 : {
346 0 : const sal_uInt16 nIdBackColor = mpTBxBackColor->GetItemId(UNO_PARABACKCOLOR);
347 :
348 0 : mpColorUpdater.reset(new ::svx::ToolboxButtonColorUpdater(SID_BACKGROUND_COLOR, nIdBackColor, mpTBxBackColor));
349 :
350 0 : mpTBxBackColor->SetItemImage(nIdBackColor, GetDisplayBackground().GetColor().IsDark()? maImgBackColorHigh : maImgBackColor);
351 0 : mpTBxBackColor->SetItemBits( nIdBackColor, mpTBxBackColor->GetItemBits( nIdBackColor ) | TIB_DROPDOWNONLY );
352 :
353 0 : Link aLink = LINK(this, ParaPropertyPanel, ToolBoxBackColorDDHandler);
354 0 : mpTBxBackColor->SetDropdownClickHdl ( aLink );
355 0 : mpTBxBackColor->SetSelectHdl ( aLink );
356 0 : }
357 :
358 0 : void ParaPropertyPanel::InitToolBoxBulletsNumbering()
359 : {
360 0 : const sal_uInt16 nIdBullet = mpTBxNumBullet->GetItemId(UNO_DEFAULTBULLET);
361 0 : const sal_uInt16 nIdNumber = mpTBxNumBullet->GetItemId(UNO_DEFAULTNUMBERING);
362 :
363 0 : mpTBxNumBullet->SetItemImage(nIdBullet, maBulletOnOff.GetIcon());
364 0 : mpTBxNumBullet->SetItemImage(nIdNumber, maNumberOnOff.GetIcon());
365 :
366 0 : mpTBxNumBullet->SetDropdownClickHdl(LINK(this,ParaPropertyPanel,NumBTbxDDHandler));
367 0 : mpTBxNumBullet->SetSelectHdl(LINK(this,ParaPropertyPanel,NumBTbxSelectHandler));
368 0 : }
369 0 : void ParaPropertyPanel::InitToolBoxSpacing()
370 : {
371 0 : Link aLink = LINK( this, ParaPropertyPanel, ULSpaceHdl_Impl );
372 0 : mpTopDist->SetModifyHdl(aLink);
373 0 : mpBottomDist->SetModifyHdl( aLink );
374 :
375 0 : mpTopDist->SetAccessibleName(mpTopDist->GetQuickHelpText());
376 0 : mpBottomDist->SetAccessibleName(mpBottomDist->GetQuickHelpText());
377 :
378 : // Use a form of image loading that can handle both .uno:<command>
379 : // and private:graphirepository... syntax. This is necessary to
380 : // handle the workaround for accessing the images of commands
381 : // ParaspaceIncrease and ParaspaceDecrease.
382 : // See issue 122446 for more details.
383 :
384 0 : const sal_uInt16 nIdParaSpaceInc = mpTbxUL_IncDec->GetItemId(UNO_PARASPACEINC);
385 0 : const sal_uInt16 nIdParaSpaceDec = mpTbxUL_IncDec->GetItemId(UNO_PARASPACEDEC);
386 : mpTbxUL_IncDec->SetItemImage(
387 : nIdParaSpaceInc,
388 0 : sfx2::sidebar::Tools::GetImage("private:graphicrepository/cmd/sc_paraspaceincrease.png" /* i#122446 */, mxFrame));
389 : mpTbxUL_IncDec->SetItemImage(
390 : nIdParaSpaceDec,
391 0 : sfx2::sidebar::Tools::GetImage("private:graphicrepository/cmd/sc_paraspacedecrease.png" /* i#122446 */, mxFrame));
392 :
393 0 : aLink = LINK( this, ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl );
394 0 : mpTbxUL_IncDec->SetSelectHdl(aLink);
395 0 : m_eULSpaceUnit = maULSpaceControl.GetCoreMetric();
396 0 : }
397 :
398 0 : void ParaPropertyPanel::InitToolBoxLineSpacing()
399 : {
400 0 : Link aLink = LINK( this, ParaPropertyPanel, ClickLineSPDropDownHdl_Impl );
401 0 : mpLineSPTbx->SetDropdownClickHdl( aLink );
402 0 : mpLineSPTbx->SetSelectHdl( aLink ); //support keyinput "ENTER"
403 :
404 0 : const sal_uInt16 nIdSpacing = mpLineSPTbx->GetItemId(UNO_LINESPACING);
405 0 : mpLineSPTbx->SetItemBits( nIdSpacing, mpLineSPTbx->GetItemBits( nIdSpacing ) | TIB_DROPDOWNONLY );
406 0 : mpLineSPTbx->SetItemImage(nIdSpacing, maSpace3);
407 0 : }
408 :
409 0 : void ParaPropertyPanel::initial()
410 : {
411 0 : GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_LEFT,sal_True,sal_False);
412 0 : GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_CENTER,sal_True,sal_False);
413 0 : GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_RIGHT,sal_True,sal_False);
414 0 : GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_BLOCK,sal_True,sal_False);
415 :
416 : //toolbox
417 0 : InitToolBoxAlign();
418 0 : InitToolBoxVertAlign();
419 0 : InitToolBoxIndent();
420 0 : InitToolBoxBGColor();
421 0 : InitToolBoxBulletsNumbering();
422 0 : InitToolBoxSpacing();
423 0 : InitToolBoxLineSpacing();
424 :
425 : #ifdef HAS_IA2
426 : mpAlignToolBox->SetAccRelationLabeledBy(&mpAlignToolBox);
427 : mpTBxVertAlign->SetMpSubEditAccLableBy(&mpTBxVertAlign);
428 : mpTBxNumBullet->SetAccRelationLabeledBy(&mpTBxNumBullet);
429 : mpTBxBackColor->SetMpSubEditAccLableBy(&mpTBxBackColor);
430 : mpTbxUL_IncDec->SetAccRelationLabeledBy(&mpTbxUL_IncDec);
431 : mpTopDist->SetAccRelationLabeledBy(&mpTopDist);
432 : mpBottomDist->SetAccRelationLabeledBy(&mpBottomDist);
433 : mpLineSPTbx->SetAccRelationLabeledBy(&mpLineSPTbx);
434 : mpTbxIndent_IncDec->SetAccRelationLabeledBy(&mpTbxIndent_IncDec);
435 : mpTbxProDemote->SetAccRelationLabeledBy(&mpTbxProDemote);
436 : mpLeftIndent->SetAccRelationLabeledBy(&mpLeftIndent);
437 : mpRightIndent->SetAccRelationLabeledBy(&mpRightIndent);
438 : mpFLineIndent->SetAccRelationLabeledBy(&mpFLineIndent);
439 : mpColorUpdater->SetAccRelationLabeledBy(&mpColorUpdater);
440 : #endif
441 0 : }
442 :
443 0 : void ParaPropertyPanel::InitImageList(::boost::scoped_ptr<ToolBox>& rTbx, ImageList& rImglst, ImageList& rImgHlst)
444 : {
445 0 : sal_Bool bHighContrast = GetDisplayBackground().GetColor().IsDark();
446 :
447 0 : ImageList& rImgLst = bHighContrast ? rImgHlst : rImglst;
448 :
449 0 : sal_uInt16 nCount = rTbx->GetItemCount();
450 0 : for (sal_uInt16 i = 0; i < nCount; i++)
451 : {
452 0 : sal_uInt16 nId = rTbx->GetItemId(i);
453 0 : rTbx->SetItemImage( nId, rImgLst.GetImage( nId ) );
454 : }
455 0 : }
456 :
457 : //===========================for Numbering & Bullet================================================
458 :
459 :
460 :
461 0 : IMPL_LINK(ParaPropertyPanel, NumBTbxDDHandler, ToolBox*, pToolBox)
462 : {
463 0 : const sal_uInt16 nId = pToolBox->GetCurItemId();
464 0 : const OUString aCommand(pToolBox->GetItemCommand(nId));
465 :
466 0 : EndTracking();
467 0 : pToolBox->SetItemDown( nId, sal_True );
468 :
469 0 : if (aCommand == UNO_DEFAULTBULLET)
470 : {
471 0 : maBulletsPopup.UpdateValueSet();
472 0 : maBulletsPopup.Show(*pToolBox);
473 : }
474 0 : else if (aCommand == UNO_DEFAULTNUMBERING)
475 : {
476 0 : maNumberingPopup.UpdateValueSet();
477 0 : maNumberingPopup.Show(*pToolBox);
478 : }
479 0 : pToolBox->SetItemDown( nId, sal_False );
480 0 : return 0;
481 : }
482 :
483 0 : IMPL_LINK(ParaPropertyPanel, NumBTbxSelectHandler, ToolBox*, pToolBox)
484 : {
485 0 : const OUString aCommand(pToolBox->GetItemCommand(pToolBox->GetCurItemId()));
486 0 : sal_uInt16 nSID = SID_TABLE_VERT_NONE;
487 :
488 0 : EndTracking();
489 0 : if (aCommand == UNO_DEFAULTBULLET)
490 : {
491 0 : nSID = FN_NUM_BULLET_ON;
492 : }
493 0 : else if (aCommand == UNO_DEFAULTNUMBERING)
494 : {
495 0 : nSID = FN_NUM_NUMBERING_ON;
496 : }
497 0 : SfxBoolItem aBoolItem(nSID, sal_True);
498 0 : GetBindings()->GetDispatcher()->Execute(nSID, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
499 :
500 0 : return 0;
501 : }
502 :
503 :
504 : //================================for Vertical Alignment========================================
505 :
506 :
507 :
508 0 : IMPL_LINK(ParaPropertyPanel, VertTbxSelectHandler, ToolBox*, pToolBox)
509 : {
510 0 : const OUString aCommand(pToolBox->GetItemCommand(pToolBox->GetCurItemId()));
511 0 : sal_uInt16 nSID = SID_TABLE_VERT_NONE;
512 0 : EndTracking();
513 :
514 0 : const sal_uInt16 nIdVertTop = mpTBxVertAlign->GetItemId(UNO_CELLVERTTOP);
515 0 : const sal_uInt16 nIdVertCenter = mpTBxVertAlign->GetItemId(UNO_CELLVERTCENTER);
516 0 : const sal_uInt16 nIdVertBottom = mpTBxVertAlign->GetItemId(UNO_CELLVERTBOTTOM);
517 :
518 0 : if (aCommand == UNO_CELLVERTTOP)
519 : {
520 0 : nSID = SID_TABLE_VERT_NONE;
521 0 : mpTBxVertAlign->SetItemState(nIdVertTop, STATE_CHECK);
522 0 : mpTBxVertAlign->SetItemState(nIdVertCenter, STATE_NOCHECK);
523 0 : mpTBxVertAlign->SetItemState(nIdVertBottom, STATE_NOCHECK);
524 : }
525 0 : else if (aCommand == UNO_CELLVERTCENTER)
526 : {
527 0 : nSID = SID_TABLE_VERT_CENTER;
528 0 : mpTBxVertAlign->SetItemState(nIdVertTop, STATE_NOCHECK);
529 0 : mpTBxVertAlign->SetItemState(nIdVertCenter, STATE_CHECK);
530 0 : mpTBxVertAlign->SetItemState(nIdVertBottom, STATE_NOCHECK);
531 : }
532 0 : else if (aCommand == UNO_CELLVERTBOTTOM)
533 : {
534 0 : nSID = SID_TABLE_VERT_BOTTOM;
535 0 : mpTBxVertAlign->SetItemState(nIdVertTop, STATE_NOCHECK);
536 0 : mpTBxVertAlign->SetItemState(nIdVertCenter, STATE_NOCHECK);
537 0 : mpTBxVertAlign->SetItemState(nIdVertBottom, STATE_CHECK);
538 : }
539 0 : SfxBoolItem aBoolItem(nSID, sal_True);
540 0 : GetBindings()->GetDispatcher()->Execute(nSID, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
541 :
542 0 : return 0;
543 : }
544 :
545 0 : void ParaPropertyPanel::VertStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState)
546 : {
547 0 : const sal_uInt16 nIdVertTop = mpTBxVertAlign->GetItemId(UNO_CELLVERTTOP);
548 0 : const sal_uInt16 nIdVertCenter = mpTBxVertAlign->GetItemId(UNO_CELLVERTCENTER);
549 0 : const sal_uInt16 nIdVertBottom = mpTBxVertAlign->GetItemId(UNO_CELLVERTBOTTOM);
550 :
551 0 : if (eState < SFX_ITEM_DONTCARE)
552 : {
553 0 : mpTBxVertAlign->SetItemState(nIdVertTop, STATE_NOCHECK);
554 0 : mpTBxVertAlign->SetItemState(nIdVertCenter, STATE_NOCHECK);
555 0 : mpTBxVertAlign->SetItemState(nIdVertBottom, STATE_NOCHECK);
556 0 : mpTBxVertAlign->EnableItem(nIdVertTop, sal_False);
557 0 : mpTBxVertAlign->EnableItem(nIdVertCenter, sal_False);
558 0 : mpTBxVertAlign->EnableItem(nIdVertBottom, sal_False);
559 : }
560 : else
561 : {
562 0 : mpTBxVertAlign->EnableItem(nIdVertTop, sal_True);
563 0 : mpTBxVertAlign->EnableItem(nIdVertCenter, sal_True);
564 0 : mpTBxVertAlign->EnableItem(nIdVertBottom, sal_True);
565 0 : if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem)))
566 : {
567 0 : const SfxBoolItem* pItem= (const SfxBoolItem*)pState;
568 0 : sal_Bool aBool = (sal_Bool)pItem->GetValue();
569 :
570 0 : if (aBool)
571 : {
572 0 : if (nSID == SID_TABLE_VERT_NONE)
573 : {
574 0 : mpTBxVertAlign->SetItemState(nIdVertTop, STATE_CHECK);
575 0 : mpTBxVertAlign->SetItemState(nIdVertCenter, STATE_NOCHECK);
576 0 : mpTBxVertAlign->SetItemState(nIdVertBottom, STATE_NOCHECK);
577 : }
578 0 : else if (nSID == SID_TABLE_VERT_CENTER)
579 : {
580 0 : mpTBxVertAlign->SetItemState(nIdVertTop, STATE_NOCHECK);
581 0 : mpTBxVertAlign->SetItemState(nIdVertCenter, STATE_CHECK);
582 0 : mpTBxVertAlign->SetItemState(nIdVertBottom, STATE_NOCHECK);
583 : }
584 0 : else if (nSID == SID_TABLE_VERT_BOTTOM)
585 : {
586 0 : mpTBxVertAlign->SetItemState(nIdVertTop, STATE_NOCHECK);
587 0 : mpTBxVertAlign->SetItemState(nIdVertCenter, STATE_NOCHECK);
588 0 : mpTBxVertAlign->SetItemState(nIdVertBottom, STATE_CHECK);
589 : }
590 : }
591 : else
592 : {
593 0 : if (nSID == SID_TABLE_VERT_NONE)
594 : {
595 0 : mpTBxVertAlign->SetItemState(nIdVertTop, STATE_NOCHECK);
596 : }
597 0 : else if (nSID == SID_TABLE_VERT_CENTER)
598 : {
599 0 : mpTBxVertAlign->SetItemState(nIdVertCenter, STATE_NOCHECK);
600 : }
601 0 : else if (nSID == SID_TABLE_VERT_BOTTOM)
602 : {
603 0 : mpTBxVertAlign->SetItemState(nIdVertBottom, STATE_NOCHECK);
604 : }
605 : }
606 : }
607 : else
608 : {
609 0 : mpTBxVertAlign->SetItemState(nIdVertTop, STATE_NOCHECK);
610 0 : mpTBxVertAlign->SetItemState(nIdVertCenter, STATE_NOCHECK);
611 0 : mpTBxVertAlign->SetItemState(nIdVertBottom, STATE_NOCHECK);
612 : }
613 : }
614 0 : }
615 : //==================================for Background color=====================
616 :
617 0 : IMPL_LINK(ParaPropertyPanel, ToolBoxBackColorDDHandler,ToolBox*, pToolBox)
618 : {
619 0 : const sal_uInt16 nId = pToolBox->GetCurItemId();
620 0 : const OUString aCommand(pToolBox->GetItemCommand(nId));
621 :
622 0 : if(aCommand == UNO_PARABACKCOLOR)
623 : {
624 0 : pToolBox->SetItemDown( nId, true );
625 0 : maBGColorPopup.Show(*pToolBox);
626 0 : maBGColorPopup.SetCurrentColor(maColor, mbColorAvailable);
627 : }
628 0 : return 0;
629 : }
630 :
631 0 : IMPL_LINK( ParaPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG )
632 : {
633 0 : return 0;
634 : }
635 :
636 0 : void ParaPropertyPanel::ShowMenu (void)
637 : {
638 0 : if (mpBindings != NULL)
639 : {
640 0 : SfxDispatcher* pDispatcher = mpBindings->GetDispatcher();
641 0 : if (pDispatcher != NULL)
642 0 : pDispatcher->Execute(SID_PARA_DLG, SFX_CALLMODE_ASYNCHRON);
643 : }
644 0 : }
645 :
646 0 : void ParaPropertyPanel::ParaBKGStateChanged(sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState)
647 : {
648 0 : if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxColorItem))
649 : {
650 0 : const SvxColorItem* pItem = (const SvxColorItem*)pState;
651 0 : maColor = pItem->GetValue();
652 0 : mbColorAvailable = sal_True;
653 0 : mpColorUpdater->Update(maColor);
654 : }
655 : else
656 : {
657 0 : mbColorAvailable = sal_False;
658 0 : maColor.SetColor(COL_AUTO);
659 0 : mpColorUpdater->Update(maColor);
660 : }
661 0 : }
662 :
663 0 : void ParaPropertyPanel::SetBGColor (
664 : const String& /*rsColorName*/,
665 : const Color aColor)
666 : {
667 0 : SvxColorItem aColorItem(aColor, SID_BACKGROUND_COLOR);
668 0 : mpBindings->GetDispatcher()->Execute(SID_BACKGROUND_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L);
669 0 : maColor = aColor;
670 0 : }
671 :
672 : //==================================for Paragraph Alignment=====================
673 0 : IMPL_LINK( ParaPropertyPanel, AlignStyleModifyHdl_Impl, ToolBox*, pBox )
674 : {
675 0 : const sal_uInt16 nIdLeft = pBox->GetItemId(UNO_LEFTPARA);
676 0 : const sal_uInt16 nIdRight = pBox->GetItemId(UNO_RIGHTPARA);
677 0 : const sal_uInt16 nIdCenter = pBox->GetItemId(UNO_CENTERPARA);
678 0 : const sal_uInt16 nIdJustify = pBox->GetItemId(UNO_JUSTIFYPARA);
679 :
680 0 : const OUString aCommand(pBox->GetItemCommand(pBox->GetCurItemId()));
681 :
682 0 : if( aCommand == UNO_LEFTPARA )
683 : {
684 0 : pBox->SetItemState(nIdLeft, STATE_CHECK);
685 0 : pBox->SetItemState(nIdCenter, STATE_NOCHECK);
686 0 : pBox->SetItemState(nIdRight, STATE_NOCHECK);
687 0 : pBox->SetItemState(nIdJustify, STATE_NOCHECK);
688 0 : SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True );
689 0 : GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_LEFT, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
690 : }
691 0 : else if( aCommand == UNO_CENTERPARA )
692 : {
693 0 : pBox->SetItemState(nIdCenter, STATE_CHECK);
694 0 : pBox->SetItemState(nIdLeft, STATE_NOCHECK);
695 0 : pBox->SetItemState(nIdRight, STATE_NOCHECK);
696 0 : pBox->SetItemState(nIdJustify, STATE_NOCHECK);
697 0 : SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True );
698 0 : GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_CENTER, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
699 : }
700 0 : else if( aCommand == UNO_RIGHTPARA )
701 : {
702 0 : pBox->SetItemState(nIdRight, STATE_CHECK);
703 0 : pBox->SetItemState(nIdLeft, STATE_NOCHECK);
704 0 : pBox->SetItemState(nIdCenter, STATE_NOCHECK);
705 0 : pBox->SetItemState(nIdJustify, STATE_NOCHECK);
706 0 : SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True );
707 0 : GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_RIGHT, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
708 : }
709 0 : else if( aCommand == UNO_JUSTIFYPARA )
710 : {
711 0 : pBox->SetItemState(nIdJustify, STATE_CHECK);
712 0 : pBox->SetItemState(nIdLeft, STATE_NOCHECK);
713 0 : pBox->SetItemState(nIdRight, STATE_NOCHECK);
714 0 : pBox->SetItemState(nIdCenter, STATE_NOCHECK);
715 0 : SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True );
716 0 : GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_BLOCK, SFX_CALLMODE_RECORD, &aBoolItem, 0L);
717 : }
718 0 : return 0;
719 : }
720 :
721 : //==================================for Paragraph Indent=====================
722 0 : IMPL_LINK_NOARG( ParaPropertyPanel, ModifyIndentHdl_Impl)
723 : {
724 0 : SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
725 0 : aMargin.SetTxtLeft( (const long)GetCoreValue( *mpLeftIndent, m_eLRSpaceUnit ) );
726 0 : aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent, m_eLRSpaceUnit ) );
727 0 : aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *mpFLineIndent, m_eLRSpaceUnit ) );
728 :
729 : GetBindings()->GetDispatcher()->Execute(
730 0 : SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
731 0 : return 0;
732 : }
733 :
734 0 : IMPL_LINK(ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl, ToolBox *, pControl)
735 : {
736 0 : const OUString aCommand(pControl->GetItemCommand(pControl->GetCurItemId()));
737 :
738 0 : if (aCommand == UNO_INCREMENTINDENT)
739 : {
740 0 : switch (maContext.GetCombinedContext_DI())
741 : {
742 : case CombinedEnumContext(Application_WriterVariants, Context_Default):
743 : case CombinedEnumContext(Application_WriterVariants, Context_Text):
744 : case CombinedEnumContext(Application_WriterVariants, Context_Table):
745 : {
746 0 : SfxBoolItem aMargin( SID_INC_INDENT, sal_True );
747 : GetBindings()->GetDispatcher()->Execute(
748 0 : SID_INC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L);
749 : }
750 0 : break;
751 : default:
752 : {
753 0 : SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
754 :
755 0 : maTxtLeft += INDENT_STEP;
756 0 : sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
757 0 : nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
758 0 : aMargin.SetTxtLeft( (const long)nVal );
759 0 : aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent, m_eLRSpaceUnit ) );
760 0 : aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *mpFLineIndent, m_eLRSpaceUnit ) );
761 :
762 : GetBindings()->GetDispatcher()->Execute(
763 0 : SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
764 : }
765 : }
766 : }
767 0 : else if (aCommand == UNO_DECREMENTINDENT)
768 : {
769 0 : switch (maContext.GetCombinedContext_DI())
770 : {
771 : case CombinedEnumContext(Application_WriterVariants, Context_Default):
772 : case CombinedEnumContext(Application_WriterVariants, Context_Text):
773 : case CombinedEnumContext(Application_WriterVariants, Context_Table):
774 : {
775 0 : SfxBoolItem aMargin( SID_DEC_INDENT, sal_True );
776 : GetBindings()->GetDispatcher()->Execute(
777 0 : SID_DEC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L);
778 : }
779 0 : break;
780 : default:
781 : {
782 0 : if((maTxtLeft - INDENT_STEP) < 0)
783 0 : maTxtLeft = DEFAULT_VALUE;
784 : else
785 0 : maTxtLeft -= INDENT_STEP;
786 :
787 0 : SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
788 :
789 0 : sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
790 0 : nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
791 :
792 0 : aMargin.SetTxtLeft( (const long)nVal );
793 0 : aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent, m_eLRSpaceUnit ) );
794 0 : aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *mpFLineIndent, m_eLRSpaceUnit ) );
795 :
796 : GetBindings()->GetDispatcher()->Execute(
797 0 : SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
798 : }
799 : }
800 : }
801 0 : else if (aCommand == UNO_HANGINGINDENT)
802 : {
803 0 : SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
804 0 : aMargin.SetTxtLeft( (const long)GetCoreValue( *mpLeftIndent, m_eLRSpaceUnit ) + (const short)GetCoreValue( *mpFLineIndent, m_eLRSpaceUnit ) );
805 0 : aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent, m_eLRSpaceUnit ) );
806 0 : aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *mpFLineIndent, m_eLRSpaceUnit ))*(-1) );
807 :
808 : GetBindings()->GetDispatcher()->Execute(
809 0 : SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
810 : }
811 :
812 0 : return( 0L );
813 : }
814 :
815 0 : IMPL_LINK(ParaPropertyPanel, ClickProDemote_Hdl_Impl, ToolBox *, pControl)
816 : {
817 0 : const OUString aCommand(pControl->GetItemCommand(pControl->GetCurItemId()));
818 :
819 0 : if (aCommand == UNO_PROMOTE)
820 : {
821 0 : GetBindings()->GetDispatcher()->Execute( SID_OUTLINE_RIGHT, SFX_CALLMODE_RECORD );
822 : }
823 0 : else if (aCommand == UNO_DEMOTE)
824 : {
825 0 : GetBindings()->GetDispatcher()->Execute( SID_OUTLINE_LEFT, SFX_CALLMODE_RECORD );
826 : }
827 0 : else if (aCommand == UNO_HANGINGINDENT2)
828 : {
829 0 : SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
830 0 : aMargin.SetTxtLeft( (const long)GetCoreValue( *mpLeftIndent, m_eLRSpaceUnit ) + (const short)GetCoreValue( *mpFLineIndent, m_eLRSpaceUnit ) );
831 0 : aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent, m_eLRSpaceUnit ) );
832 0 : aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *mpFLineIndent, m_eLRSpaceUnit ))*(-1) );
833 :
834 0 : GetBindings()->GetDispatcher()->Execute( SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
835 : }
836 :
837 0 : return( 0L );
838 : }
839 : //==================================for Paragraph Line Spacing=====================
840 :
841 0 : IMPL_LINK( ParaPropertyPanel, ClickLineSPDropDownHdl_Impl, ToolBox*, pBox )
842 : {
843 0 : const sal_uInt16 nId = pBox->GetCurItemId();
844 0 : const OUString aCommand(pBox->GetItemCommand(nId));
845 :
846 0 : if (aCommand == UNO_LINESPACING)
847 : {
848 0 : pBox->SetItemDown( nId, true );
849 0 : maLineSpacePopup.Rearrange(meLnSpState,m_eMetricUnit,mpLnSPItem,maContext);
850 0 : maLineSpacePopup.Show(*pBox);
851 : }
852 0 : return (0L);
853 : }
854 :
855 : //==================================for Paragraph Spacing=====================
856 0 : IMPL_LINK_NOARG( ParaPropertyPanel, ULSpaceHdl_Impl)
857 : {
858 0 : SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE );
859 0 : aMargin.SetUpper( (sal_uInt16)GetCoreValue( *mpTopDist, m_eULSpaceUnit ) );
860 0 : aMargin.SetLower( (sal_uInt16)GetCoreValue( *mpBottomDist, m_eULSpaceUnit ) );
861 :
862 : GetBindings()->GetDispatcher()->Execute(
863 0 : SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
864 0 : return 0L;
865 : }
866 :
867 0 : IMPL_LINK(ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl, ToolBox *, pControl)
868 : {
869 0 : const OUString aCommand(pControl->GetItemCommand(pControl->GetCurItemId()));
870 :
871 0 : if( aCommand == UNO_PARASPACEINC)
872 : {
873 0 : SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE );
874 :
875 0 : maUpper += UL_STEP;
876 0 : sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
877 0 : nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
878 0 : aMargin.SetUpper( (const sal_uInt16)nVal );
879 :
880 0 : maLower += UL_STEP;
881 0 : nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
882 0 : nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
883 0 : aMargin.SetLower( (const sal_uInt16)nVal );
884 :
885 : GetBindings()->GetDispatcher()->Execute(
886 0 : SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
887 : }
888 0 : else if( aCommand == UNO_PARASPACEDEC)
889 : {
890 0 : SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE );
891 0 : if( maUpper >= UL_STEP )
892 : {
893 0 : maUpper -= UL_STEP;
894 0 : sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
895 0 : nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
896 0 : aMargin.SetUpper( (const sal_uInt16)nVal );
897 : }
898 : else
899 0 : aMargin.SetUpper( DEFAULT_VALUE );
900 :
901 0 : if( maLower >= UL_STEP )
902 : {
903 0 : maLower -= UL_STEP;
904 0 : sal_Int64 nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
905 0 : nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit );
906 0 : aMargin.SetLower( (const sal_uInt16)nVal );
907 : }
908 : else
909 0 : aMargin.SetLower( DEFAULT_VALUE );
910 :
911 : GetBindings()->GetDispatcher()->Execute(
912 0 : SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L);
913 : }
914 :
915 0 : return( 0L );
916 : }
917 :
918 : //==================================for Paragraph State change=====================
919 0 : void ParaPropertyPanel::NotifyItemUpdate(
920 : sal_uInt16 nSID,
921 : SfxItemState eState,
922 : const SfxPoolItem* pState,
923 : const bool bIsEnabled)
924 : {
925 : (void)bIsEnabled;
926 :
927 0 : switch (nSID)
928 : {
929 : case SID_ATTR_METRIC:
930 : {
931 0 : m_eMetricUnit = GetCurrentUnit(eState,pState);
932 0 : if( m_eMetricUnit!=m_last_eMetricUnit )
933 : {
934 0 : SetFieldUnit( *mpLeftIndent, m_eMetricUnit );
935 0 : SetFieldUnit( *mpRightIndent, m_eMetricUnit );
936 0 : SetFieldUnit( *mpFLineIndent, m_eMetricUnit );
937 0 : SetFieldUnit( *mpTopDist, m_eMetricUnit );
938 0 : SetFieldUnit( *mpBottomDist, m_eMetricUnit );
939 : }
940 0 : m_last_eMetricUnit = m_eMetricUnit;
941 : }
942 0 : break;
943 :
944 : case SID_ATTR_PARA_LRSPACE:
945 0 : StateChangedIndentImpl( nSID, eState, pState );
946 0 : break;
947 :
948 : case SID_ATTR_PARA_LINESPACE:
949 0 : StateChangedLnSPImpl( nSID, eState, pState );
950 0 : break;
951 :
952 : case SID_ATTR_PARA_ULSPACE:
953 0 : StateChangedULImpl( nSID, eState, pState );
954 0 : break;
955 :
956 : case SID_ATTR_PARA_ADJUST_LEFT:
957 : case SID_ATTR_PARA_ADJUST_CENTER:
958 : case SID_ATTR_PARA_ADJUST_RIGHT:
959 : case SID_ATTR_PARA_ADJUST_BLOCK:
960 0 : StateChangedAlignmentImpl( nSID, eState, pState );
961 0 : break;
962 :
963 : case SID_OUTLINE_LEFT:
964 : case SID_OUTLINE_RIGHT:
965 0 : StateChangeOutLineImpl( nSID, eState, pState );
966 0 : break;
967 :
968 : case SID_INC_INDENT:
969 : case SID_DEC_INDENT:
970 0 : StateChangeIncDecImpl( nSID, eState, pState );
971 0 : break;
972 :
973 : case FN_NUM_NUMBERING_ON:
974 : case FN_NUM_BULLET_ON:
975 0 : StateChangeBulletNumImpl( nSID, eState, pState );
976 0 : break;
977 :
978 : case FN_BUL_NUM_RULE_INDEX:
979 : case FN_NUM_NUM_RULE_INDEX:
980 0 : StateChangeBulletNumRuleImpl( nSID, eState, pState );
981 0 : break;
982 :
983 : case SID_TABLE_VERT_NONE:
984 : case SID_TABLE_VERT_CENTER:
985 : case SID_TABLE_VERT_BOTTOM:
986 0 : VertStateChanged( nSID, eState, pState);
987 0 : break;
988 :
989 : case SID_BACKGROUND_COLOR:
990 0 : ParaBKGStateChanged(nSID, eState, pState);
991 0 : break;
992 : }
993 0 : }
994 :
995 :
996 :
997 :
998 0 : void ParaPropertyPanel::StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
999 : {
1000 0 : const sal_uInt16 nIdLeft = mpAlignToolBox->GetItemId(UNO_LEFTPARA);
1001 0 : const sal_uInt16 nIdRight = mpAlignToolBox->GetItemId(UNO_RIGHTPARA);
1002 0 : const sal_uInt16 nIdCenter = mpAlignToolBox->GetItemId(UNO_CENTERPARA);
1003 0 : const sal_uInt16 nIdJustify = mpAlignToolBox->GetItemId(UNO_JUSTIFYPARA);
1004 :
1005 0 : if( eState >= SFX_ITEM_AVAILABLE )
1006 : {
1007 0 : const SfxBoolItem* pItem = (const SfxBoolItem*)pState;
1008 0 : bool IsChecked = (bool)pItem->GetValue();
1009 0 : switch (nSID)
1010 : {
1011 : case SID_ATTR_PARA_ADJUST_LEFT:
1012 : {
1013 0 : if(IsChecked)
1014 : {
1015 0 : mpAlignToolBox->SetItemState(nIdLeft,STATE_CHECK);
1016 0 : mpAlignToolBox->SetItemState(nIdCenter,STATE_NOCHECK);
1017 0 : mpAlignToolBox->SetItemState(nIdRight,STATE_NOCHECK);
1018 0 : mpAlignToolBox->SetItemState(nIdJustify,STATE_NOCHECK);
1019 : }
1020 : else
1021 0 : mpAlignToolBox->SetItemState(nIdLeft,STATE_NOCHECK);
1022 : }
1023 0 : break;
1024 : case SID_ATTR_PARA_ADJUST_CENTER:
1025 : {
1026 0 : if(IsChecked)
1027 : {
1028 0 : mpAlignToolBox->SetItemState(nIdCenter,STATE_CHECK);
1029 0 : mpAlignToolBox->SetItemState(nIdLeft,STATE_NOCHECK);
1030 0 : mpAlignToolBox->SetItemState(nIdRight,STATE_NOCHECK);
1031 0 : mpAlignToolBox->SetItemState(nIdJustify,STATE_NOCHECK);
1032 : }
1033 : else
1034 0 : mpAlignToolBox->SetItemState(nIdCenter,STATE_NOCHECK);
1035 : }
1036 0 : break;
1037 : case SID_ATTR_PARA_ADJUST_RIGHT:
1038 : {
1039 0 : if(IsChecked)
1040 : {
1041 0 : mpAlignToolBox->SetItemState(nIdRight,STATE_CHECK);
1042 0 : mpAlignToolBox->SetItemState(nIdLeft,STATE_NOCHECK);
1043 0 : mpAlignToolBox->SetItemState(nIdCenter,STATE_NOCHECK);
1044 0 : mpAlignToolBox->SetItemState(nIdJustify,STATE_NOCHECK);
1045 : }
1046 : else
1047 0 : mpAlignToolBox->SetItemState(nIdRight,STATE_NOCHECK);
1048 : }
1049 0 : break;
1050 : case SID_ATTR_PARA_ADJUST_BLOCK:
1051 : {
1052 0 : if(IsChecked)
1053 : {
1054 0 : mpAlignToolBox->SetItemState(nIdJustify,STATE_CHECK);
1055 0 : mpAlignToolBox->SetItemState(nIdLeft,STATE_NOCHECK);
1056 0 : mpAlignToolBox->SetItemState(nIdCenter,STATE_NOCHECK);
1057 0 : mpAlignToolBox->SetItemState(nIdRight,STATE_NOCHECK);
1058 : }
1059 : else
1060 0 : mpAlignToolBox->SetItemState(nIdJustify,STATE_NOCHECK);
1061 : }
1062 0 : break;
1063 : }
1064 : }
1065 0 : else if( eState == SFX_ITEM_DISABLED )
1066 : {
1067 : }
1068 0 : else if ( eState == SFX_ITEM_DONTCARE )
1069 : {
1070 0 : switch (nSID)
1071 : {
1072 : case SID_ATTR_PARA_ADJUST_LEFT:
1073 0 : mpAlignToolBox->SetItemState(nIdLeft,STATE_NOCHECK);
1074 0 : break;
1075 : case SID_ATTR_PARA_ADJUST_CENTER:
1076 0 : mpAlignToolBox->SetItemState(nIdCenter,STATE_NOCHECK);
1077 0 : break;
1078 : case SID_ATTR_PARA_ADJUST_RIGHT:
1079 0 : mpAlignToolBox->SetItemState(nIdRight,STATE_NOCHECK);
1080 0 : break;
1081 : case SID_ATTR_PARA_ADJUST_BLOCK:
1082 0 : mpAlignToolBox->SetItemState(nIdJustify,STATE_NOCHECK);
1083 0 : break;
1084 : }
1085 : }
1086 0 : }
1087 :
1088 0 : void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
1089 : {
1090 0 : switch (maContext.GetCombinedContext_DI())
1091 : {
1092 :
1093 : case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
1094 : case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
1095 : case CombinedEnumContext(Application_Calc, Context_DrawText):
1096 : {
1097 0 : mpLeftIndent->SetMin( DEFAULT_VALUE );
1098 0 : mpRightIndent->SetMin( DEFAULT_VALUE );
1099 0 : mpFLineIndent->SetMin( DEFAULT_VALUE );
1100 0 : mpTbxIndent_IncDec->Show();
1101 0 : mpTbxProDemote->Hide();
1102 : }
1103 0 : break;
1104 : case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
1105 : case CombinedEnumContext(Application_DrawImpress, Context_Draw):
1106 : case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
1107 : case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
1108 : case CombinedEnumContext(Application_DrawImpress, Context_Table):
1109 : {
1110 0 : mpLeftIndent->SetMin( DEFAULT_VALUE );
1111 0 : mpRightIndent->SetMin( DEFAULT_VALUE );
1112 0 : mpFLineIndent->SetMin( DEFAULT_VALUE );
1113 0 : mpTbxIndent_IncDec->Hide();
1114 0 : mpTbxProDemote->Show();
1115 : }
1116 0 : break;
1117 : case CombinedEnumContext(Application_WriterVariants, Context_Default):
1118 : case CombinedEnumContext(Application_WriterVariants, Context_Text):
1119 : case CombinedEnumContext(Application_WriterVariants, Context_Table):
1120 : {
1121 0 : mpLeftIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
1122 0 : mpRightIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
1123 0 : mpFLineIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
1124 0 : mpTbxIndent_IncDec->Show();
1125 0 : mpTbxProDemote->Hide();
1126 : }
1127 0 : break;
1128 : }
1129 :
1130 0 : const sal_uInt16 nIdHangingIndent = mpTbxIndent_IncDec->GetItemId(UNO_HANGINGINDENT);
1131 0 : const sal_uInt16 nIdHangingIndent2 = mpTbxIndent_IncDec->GetItemId(UNO_HANGINGINDENT2);
1132 0 : if( pState && eState >= SFX_ITEM_AVAILABLE )
1133 : {
1134 0 : SvxLRSpaceItem* pSpace = ( SvxLRSpaceItem*)pState;
1135 0 : maTxtLeft = pSpace->GetTxtLeft();
1136 0 : maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
1137 0 : maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1138 :
1139 0 : long aTxtRight = pSpace->GetRight();
1140 0 : aTxtRight = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
1141 0 : aTxtRight = OutputDevice::LogicToLogic( aTxtRight, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1142 :
1143 0 : long aTxtFirstLineOfst = pSpace->GetTxtFirstLineOfst();
1144 0 : aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM );
1145 0 : aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1146 :
1147 0 : long nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1148 0 : nVal = (long)mpLeftIndent->Normalize( (long)nVal );
1149 0 : mpLeftIndent->SetValue( nVal, FUNIT_100TH_MM );
1150 :
1151 0 : if ( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text)
1152 0 : && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default)
1153 0 : && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Table))
1154 : {
1155 0 : mpFLineIndent->SetMin( nVal*(-1), FUNIT_100TH_MM );
1156 : }
1157 :
1158 0 : long nrVal = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1159 0 : nrVal = (long)mpRightIndent->Normalize( (long)nrVal );
1160 0 : mpRightIndent->SetValue( nrVal, FUNIT_100TH_MM );
1161 :
1162 0 : long nfVal = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1163 0 : nfVal = (long)mpFLineIndent->Normalize( (long)nfVal );
1164 0 : mpFLineIndent->SetValue( nfVal, FUNIT_100TH_MM );
1165 :
1166 0 : switch (maContext.GetCombinedContext_DI())
1167 : {
1168 : case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
1169 : case CombinedEnumContext(Application_WriterVariants, Context_Text):
1170 : case CombinedEnumContext(Application_WriterVariants, Context_Default):
1171 : case CombinedEnumContext(Application_WriterVariants, Context_Table):
1172 : case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
1173 : {
1174 0 : mpLeftIndent->SetMax( MAX_SW - nrVal, FUNIT_100TH_MM );
1175 0 : mpRightIndent->SetMax( MAX_SW - nVal, FUNIT_100TH_MM );
1176 0 : mpFLineIndent->SetMax( MAX_SW - nVal - nrVal, FUNIT_100TH_MM );
1177 : }
1178 0 : break;
1179 : case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
1180 : case CombinedEnumContext(Application_DrawImpress, Context_Draw):
1181 : case CombinedEnumContext(Application_DrawImpress, Context_Table):
1182 : case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
1183 : case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
1184 : {
1185 0 : mpLeftIndent->SetMax( MAX_SC_SD - nrVal, FUNIT_100TH_MM );
1186 0 : mpRightIndent->SetMax( MAX_SC_SD - nVal, FUNIT_100TH_MM );
1187 0 : mpFLineIndent->SetMax( MAX_SC_SD - nVal - nrVal, FUNIT_100TH_MM );
1188 : }
1189 : }
1190 :
1191 0 : mpTbxIndent_IncDec->Enable();
1192 :
1193 0 : const sal_uInt16 nIdIncrIndent = mpTbxIndent_IncDec->GetItemId(UNO_INCREMENTINDENT);
1194 0 : const sal_uInt16 nIdDecrIndent = mpTbxIndent_IncDec->GetItemId(UNO_DECREMENTINDENT);
1195 :
1196 0 : mpTbxIndent_IncDec->EnableItem(nIdHangingIndent, sal_True);
1197 0 : if ( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text)
1198 0 : && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default)
1199 0 : && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Table) )
1200 : {
1201 0 : mpTbxIndent_IncDec->EnableItem(nIdIncrIndent, sal_True);
1202 0 : mpTbxIndent_IncDec->EnableItem(nIdDecrIndent, sal_True);
1203 : }
1204 :
1205 0 : mpTbxProDemote->EnableItem(nIdHangingIndent2, sal_True);
1206 : }
1207 0 : else if( eState == SFX_ITEM_DISABLED )
1208 : {
1209 0 : mpLeftIndent-> Disable();
1210 0 : mpRightIndent->Disable();
1211 0 : mpFLineIndent->Disable();
1212 0 : mpTbxIndent_IncDec->Disable();
1213 0 : if( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text) &&
1214 0 : maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default) &&
1215 0 : maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Table) )
1216 0 : mpTbxIndent_IncDec->Disable();
1217 : else
1218 0 : mpTbxIndent_IncDec->EnableItem(nIdHangingIndent, sal_False);
1219 :
1220 : // maTbxProDemote->Disable();
1221 0 : mpTbxProDemote->EnableItem(nIdHangingIndent2, sal_False);
1222 : }
1223 : else
1224 : {
1225 0 : mpLeftIndent->SetEmptyFieldValue();
1226 0 : mpRightIndent->SetEmptyFieldValue();
1227 0 : mpFLineIndent->SetEmptyFieldValue();
1228 0 : if( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text) &&
1229 0 : maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default) &&
1230 0 : maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Table) )
1231 0 : mpTbxIndent_IncDec->Disable();
1232 : else
1233 0 : mpTbxIndent_IncDec->EnableItem(nIdHangingIndent, sal_False);
1234 0 : mpTbxProDemote->EnableItem(nIdHangingIndent2, sal_False);
1235 : }
1236 0 : }
1237 :
1238 0 : void ParaPropertyPanel::StateChangedLnSPImpl( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
1239 : {
1240 0 : meLnSpState = eState;
1241 :
1242 0 : if( pState && eState >= SFX_ITEM_AVAILABLE )
1243 : {
1244 0 : if(mpLnSPItem)
1245 0 : delete mpLnSPItem;
1246 0 : mpLnSPItem = ( SvxLineSpacingItem *)pState->Clone();
1247 : }
1248 0 : }
1249 :
1250 0 : void ParaPropertyPanel::StateChangedULImpl( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
1251 : {
1252 0 : mpTopDist->SetMax( mpTopDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) );
1253 0 : mpBottomDist->SetMax( mpBottomDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) );
1254 :
1255 0 : if( pState && eState >= SFX_ITEM_AVAILABLE )
1256 : {
1257 0 : SvxULSpaceItem* pOldItem = (SvxULSpaceItem*)pState;
1258 :
1259 0 : maUpper = pOldItem->GetUpper();
1260 0 : maUpper = OutputDevice::LogicToLogic( maUpper, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM );
1261 0 : maUpper = OutputDevice::LogicToLogic( maUpper, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1262 :
1263 0 : maLower = pOldItem->GetLower();
1264 0 : maLower = OutputDevice::LogicToLogic( maLower, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM );
1265 0 : maLower = OutputDevice::LogicToLogic( maLower, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) );
1266 :
1267 0 : sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1268 0 : nVal = mpTopDist->Normalize( nVal );
1269 0 : mpTopDist->SetValue( nVal, FUNIT_100TH_MM );
1270 :
1271 0 : nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM );
1272 0 : nVal = mpBottomDist->Normalize( nVal );
1273 0 : mpBottomDist->SetValue( nVal, FUNIT_100TH_MM );
1274 0 : mpTbxUL_IncDec->Enable();
1275 : }
1276 0 : else if(eState == SFX_ITEM_DISABLED )
1277 : {
1278 0 : mpTopDist->Disable();
1279 0 : mpBottomDist->Disable();
1280 0 : mpTbxUL_IncDec->Disable();
1281 : }
1282 : else
1283 : {
1284 0 : mpTopDist->SetEmptyFieldValue();
1285 0 : mpBottomDist->SetEmptyFieldValue();
1286 0 : mpTbxUL_IncDec->Disable();
1287 : }
1288 0 : }
1289 :
1290 0 : void ParaPropertyPanel::StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1291 : {
1292 0 : if (nSID==SID_OUTLINE_LEFT)
1293 : {
1294 0 : if( pState && eState == SFX_ITEM_UNKNOWN )
1295 0 : mbOutLineLeft = 1;
1296 : else
1297 0 : mbOutLineLeft = 0;
1298 : }
1299 0 : if (nSID==SID_OUTLINE_RIGHT)
1300 : {
1301 0 : if( pState && eState == SFX_ITEM_UNKNOWN )
1302 0 : mbOutLineRight = 1;
1303 : else
1304 0 : mbOutLineRight = 0;
1305 : }
1306 :
1307 0 : const sal_uInt16 nIdDemote = mpTbxProDemote->GetItemId(UNO_DEMOTE);
1308 0 : if(mbOutLineLeft)
1309 0 : mpTbxProDemote->EnableItem(nIdDemote, sal_True);
1310 : else
1311 0 : mpTbxProDemote->EnableItem(nIdDemote, sal_False);
1312 :
1313 0 : const sal_uInt16 nIdPromote = mpTbxProDemote->GetItemId(UNO_PROMOTE);
1314 0 : if(mbOutLineRight)
1315 0 : mpTbxProDemote->EnableItem(nIdPromote, sal_True);
1316 : else
1317 0 : mpTbxProDemote->EnableItem(nIdPromote, sal_False);
1318 :
1319 0 : }
1320 :
1321 0 : void ParaPropertyPanel::StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1322 : {
1323 0 : if ( ( maContext.GetCombinedContext_DI() == CombinedEnumContext(Application_WriterVariants, Context_Text)
1324 0 : || maContext.GetCombinedContext_DI() == CombinedEnumContext(Application_WriterVariants, Context_Default)
1325 0 : || maContext.GetCombinedContext_DI() == CombinedEnumContext(Application_WriterVariants, Context_Table) )
1326 0 : && ( nSID == SID_INC_INDENT || nSID == SID_DEC_INDENT ) )
1327 : {
1328 : // Writer's text shell is the only one which provides reasonable states for Slots SID_INC_INDENT and SID_DEC_INDENT
1329 : // - namely SFX_ITEM_UNKNOWN and SFX_ITEM_DISABLED
1330 0 : const sal_uInt16 nIdIncrIndent = mpTbxIndent_IncDec->GetItemId(UNO_INCREMENTINDENT);
1331 0 : const sal_uInt16 nIdDecrIndent = mpTbxIndent_IncDec->GetItemId(UNO_DECREMENTINDENT);
1332 :
1333 : mpTbxIndent_IncDec->EnableItem(
1334 : nSID == SID_INC_INDENT ? nIdIncrIndent : nIdDecrIndent,
1335 0 : ( pState && eState == SFX_ITEM_UNKNOWN ) ? sal_True : sal_False );
1336 : }
1337 0 : }
1338 :
1339 :
1340 : // Add toggle state for numbering and bullet icons
1341 0 : void ParaPropertyPanel::StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1342 : {
1343 0 : if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem)) )
1344 : {
1345 0 : const SfxBoolItem* pItem= (const SfxBoolItem*)pState;
1346 0 : const sal_Bool aBool = (sal_Bool)pItem->GetValue();
1347 :
1348 0 : const sal_uInt16 nIdNumber = mpTBxNumBullet->GetItemId(UNO_DEFAULTNUMBERING);
1349 0 : const sal_uInt16 nIdBullet = mpTBxNumBullet->GetItemId(UNO_DEFAULTBULLET);
1350 :
1351 0 : if (nSID==FN_NUM_NUMBERING_ON)
1352 : {
1353 : mpTBxNumBullet->SetItemState(
1354 : nIdNumber,
1355 0 : aBool ? STATE_CHECK : STATE_NOCHECK );
1356 : }
1357 0 : else if (nSID==FN_NUM_BULLET_ON)
1358 : {
1359 : mpTBxNumBullet->SetItemState(
1360 : nIdBullet,
1361 0 : aBool ? STATE_CHECK : STATE_NOCHECK );
1362 : }
1363 : }
1364 0 : }
1365 :
1366 :
1367 0 : void ParaPropertyPanel::StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
1368 : {
1369 0 : if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxUInt16Item) )
1370 : {
1371 0 : sal_uInt16 nValue = (sal_uInt16)0xFFFF;
1372 : {
1373 0 : const SfxUInt16Item* pIt = (const SfxUInt16Item*)pState;
1374 0 : if ( pIt )
1375 0 : nValue = pIt->GetValue();
1376 : }
1377 :
1378 0 : if ( nSID == FN_BUL_NUM_RULE_INDEX )
1379 : {
1380 0 : mnBulletTypeIndex = nValue;
1381 : }
1382 0 : else if ( nSID == FN_NUM_NUM_RULE_INDEX )
1383 : {
1384 0 : mnNumTypeIndex = nValue;
1385 : }
1386 : }
1387 0 : }
1388 :
1389 :
1390 0 : FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState )
1391 : {
1392 0 : FieldUnit eUnit = FUNIT_NONE;
1393 :
1394 0 : if ( pState && eState >= SFX_ITEM_DEFAULT )
1395 0 : eUnit = (FieldUnit)( (const SfxUInt16Item*)pState )->GetValue();
1396 : else
1397 : {
1398 0 : SfxViewFrame* pFrame = SfxViewFrame::Current();
1399 0 : SfxObjectShell* pSh = NULL;
1400 0 : if ( pFrame )
1401 0 : pSh = pFrame->GetObjectShell();
1402 0 : if ( pSh ) //the object shell is not always available during reload
1403 : {
1404 0 : SfxModule* pModule = pSh->GetModule();
1405 0 : if ( pModule )
1406 : {
1407 0 : const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC );
1408 0 : if ( pItem )
1409 0 : eUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue();
1410 : }
1411 : else
1412 : {
1413 : DBG_ERRORFILE( "GetModuleFieldUnit(): no module found" );
1414 : }
1415 : }
1416 : }
1417 :
1418 0 : return eUnit;
1419 : }
1420 :
1421 :
1422 0 : PopupControl* ParaPropertyPanel::CreateLineSpacingControl (PopupContainer* pParent)
1423 : {
1424 0 : return new ParaLineSpacingControl(pParent, *this);
1425 : }
1426 :
1427 0 : PopupControl* ParaPropertyPanel::CreateBulletsPopupControl (PopupContainer* pParent)
1428 : {
1429 0 : return new ParaBulletsControl(pParent, *this);
1430 : }
1431 :
1432 0 : PopupControl* ParaPropertyPanel::CreateNumberingPopupControl (PopupContainer* pParent)
1433 : {
1434 0 : return new ParaNumberingControl(pParent, *this);
1435 : }
1436 :
1437 : namespace
1438 : {
1439 0 : Color GetNoBackgroundColor(void)
1440 : {
1441 0 : return COL_TRANSPARENT;
1442 : }
1443 : } // end of anonymous namespace
1444 :
1445 0 : PopupControl* ParaPropertyPanel::CreateBGColorPopupControl (PopupContainer* pParent)
1446 : {
1447 0 : const ResId aResId(SVX_RES(STR_NOFILL));
1448 :
1449 : return new ColorControl(
1450 : pParent,
1451 : mpBindings,
1452 0 : SVX_RES(RID_POPUPPANEL_PARAPAGE_BACK_COLOR),
1453 0 : SVX_RES(VS_FONT_COLOR),
1454 : ::boost::bind(GetNoBackgroundColor),
1455 : ::boost::bind(&ParaPropertyPanel::SetBGColor, this, _1,_2),
1456 : pParent,
1457 0 : &aResId);
1458 : }
1459 :
1460 :
1461 0 : ParaPropertyPanel::ParaPropertyPanel(Window* pParent,
1462 : const cssu::Reference<css::frame::XFrame>& rxFrame,
1463 : SfxBindings* pBindings,
1464 : const cssu::Reference<css::ui::XSidebar>& rxSidebar)
1465 : : PanelLayout(pParent, "ParaPropertyPanel", "svx/ui/sidebarparagraph.ui", rxFrame),
1466 :
1467 : mpColorUpdater (),
1468 0 : maSpace3 (SVX_RES(IMG_SPACE3)),
1469 0 : maIndHang (SVX_RES(IMG_INDENT_HANG)),
1470 0 : maNumBImageList (SVX_RES(IL_NUM_BULLET)),
1471 0 : maNumBImageListRTL (SVX_RES(IL_NUM_BULLET_RTL)),
1472 0 : maImgBackColorHigh (SVX_RES(IMG_BACK_COLOR_H)),
1473 0 : maImgBackColor (SVX_RES(IMG_BACK_COLOR)),
1474 : maTxtLeft (0),
1475 : mpLnSPItem (NULL),
1476 : meLnSpState (SFX_ITEM_DONTCARE),
1477 : mbOutLineLeft (false),
1478 : mbOutLineRight (false),
1479 : maUpper (0),
1480 : maLower (0),
1481 : mnBulletTypeIndex ((sal_uInt16)0xFFFF),
1482 : mnNumTypeIndex ((sal_uInt16)0xFFFF),
1483 : maColor (COL_AUTO),
1484 : mbColorAvailable (true),
1485 : m_eMetricUnit(FUNIT_NONE),
1486 : m_last_eMetricUnit(FUNIT_NONE),
1487 : m_eLRSpaceUnit(),
1488 : m_eULSpaceUnit(),
1489 0 : maLeftAlignControl(SID_ATTR_PARA_ADJUST_LEFT, *pBindings, *this, A2S("LeftPara"), rxFrame),
1490 0 : maCenterAlignControl(SID_ATTR_PARA_ADJUST_CENTER, *pBindings, *this, A2S("CenterPara"), rxFrame),
1491 0 : maRightAlignControl(SID_ATTR_PARA_ADJUST_RIGHT, *pBindings, *this, A2S("RightPara"), rxFrame),
1492 0 : maJustifyAlignControl(SID_ATTR_PARA_ADJUST_BLOCK, *pBindings, *this, A2S("JustifyPara"), rxFrame),
1493 : maLRSpaceControl (SID_ATTR_PARA_LRSPACE,*pBindings,*this),
1494 : maLNSpaceControl (SID_ATTR_PARA_LINESPACE, *pBindings,*this),
1495 : maULSpaceControl (SID_ATTR_PARA_ULSPACE, *pBindings,*this),
1496 0 : maOutLineLeftControl(SID_OUTLINE_LEFT, *pBindings, *this, A2S("OutlineRight"), rxFrame),
1497 0 : maOutLineRightControl(SID_OUTLINE_RIGHT, *pBindings, *this, A2S("OutlineLeft"), rxFrame),
1498 0 : maDecIndentControl(SID_DEC_INDENT, *pBindings,*this, A2S("DecrementIndent"), rxFrame),
1499 0 : maIncIndentControl(SID_INC_INDENT, *pBindings,*this, A2S("IncrementIndent"), rxFrame),
1500 0 : maVertTop (SID_TABLE_VERT_NONE, *pBindings, *this, A2S("CellVertTop"), rxFrame),
1501 0 : maVertCenter (SID_TABLE_VERT_CENTER, *pBindings,*this, A2S("CellVertCenter"), rxFrame),
1502 0 : maVertBottom (SID_TABLE_VERT_BOTTOM,*pBindings,*this, A2S("CellVertBottom"), rxFrame),
1503 0 : maBulletOnOff(FN_NUM_BULLET_ON, *pBindings, *this, A2S("DefaultBullet"), rxFrame),
1504 0 : maNumberOnOff(FN_NUM_NUMBERING_ON, *pBindings, *this, A2S("DefaultNumbering"), rxFrame),
1505 : maBackColorControl (SID_BACKGROUND_COLOR, *pBindings,*this),
1506 : m_aMetricCtl (SID_ATTR_METRIC, *pBindings,*this),
1507 : maBulletNumRuleIndex (FN_BUL_NUM_RULE_INDEX, *pBindings,*this),
1508 : maNumNumRuleIndex (FN_NUM_NUM_RULE_INDEX, *pBindings,*this),
1509 : mxFrame(rxFrame),
1510 : maContext(),
1511 : mpBindings(pBindings),
1512 : maLineSpacePopup(this, ::boost::bind(&ParaPropertyPanel::CreateLineSpacingControl, this, _1)),
1513 : maBulletsPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBulletsPopupControl, this, _1)),
1514 : maNumberingPopup(this, ::boost::bind(&ParaPropertyPanel::CreateNumberingPopupControl, this, _1)),
1515 : maBGColorPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBGColorPopupControl, this, _1)),
1516 0 : mxSidebar(rxSidebar)
1517 : {
1518 : //Alignment
1519 0 : get(mpAlignToolBox, "horizontalalignment");
1520 0 : get(mpTBxVertAlign, "verticalalignment");
1521 : //NumBullet&Backcolor
1522 0 : get(mpTBxNumBullet, "numberbullet");
1523 0 : get(mpTBxBackColor, "backgroundcolor");
1524 : //Paragraph spacing
1525 0 : get(mpTopDist, "aboveparaspacing");
1526 0 : get(mpBottomDist, "belowparaspacing");
1527 0 : get(mpTbxIndent_IncDec, "indent");
1528 0 : get(mpTbxProDemote, "promotedemote");
1529 0 : get(mpLineSPTbx, "linespacing");
1530 0 : get(mpTbxUL_IncDec, "paraspacing");
1531 0 : get(mpLeftIndent, "beforetextindent");
1532 0 : get(mpRightIndent, "aftertextindent");
1533 0 : get(mpFLineIndent, "firstlineindent");
1534 :
1535 0 : initial();
1536 0 : }
1537 :
1538 216 : } } // end of namespace svx::sidebar
|