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