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()) 843 { 844 case CombinedEnumContext(Application_Writer, Context_Default): 845 case CombinedEnumContext(Application_Writer, Context_Text): 846 case CombinedEnumContext(Application_Writer, 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()) 873 { 874 case CombinedEnumContext(Application_Writer, Context_Default): 875 case CombinedEnumContext(Application_Writer, Context_Text): 876 case CombinedEnumContext(Application_Writer, 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()) 1178 { 1179 1180 case CombinedEnumContext(Application_Writer, Context_DrawText): 1181 case CombinedEnumContext(Application_Calc, Context_DrawText): 1182 case CombinedEnumContext(Application_Writer, Context_Annotation): 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_Draw, Context_DrawText): 1192 case CombinedEnumContext(Application_Impress, Context_DrawText): 1193 case CombinedEnumContext(Application_Draw, Context_Draw): 1194 case CombinedEnumContext(Application_Draw, Context_TextObject): 1195 case CombinedEnumContext(Application_Draw, Context_Graphic): 1196 case CombinedEnumContext(Application_Impress, Context_Draw): 1197 case CombinedEnumContext(Application_Impress, Context_TextObject): 1198 case CombinedEnumContext(Application_Impress, Context_Graphic): 1199 case CombinedEnumContext(Application_Impress, Context_Table): 1200 case CombinedEnumContext(Application_Draw, Context_Table): 1201 { 1202 maLeftIndent->SetMin( DEFAULT_VALUE ); 1203 maRightIndent->SetMin( DEFAULT_VALUE ); 1204 maFLineIndent->SetMin( DEFAULT_VALUE ); 1205 maTbxIndent_IncDec->Hide(); 1206 maTbxProDemote->Show(); 1207 } 1208 break; 1209 case CombinedEnumContext(Application_Writer, Context_Default): 1210 case CombinedEnumContext(Application_Writer, Context_Text): 1211 case CombinedEnumContext(Application_Writer, Context_Table): 1212 { 1213 maLeftIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM ); 1214 maRightIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM ); 1215 maFLineIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM ); 1216 maTbxIndent_IncDec->Show(); 1217 maTbxProDemote->Hide(); 1218 } 1219 break; 1220 } 1221 1222 if( pState && eState >= SFX_ITEM_AVAILABLE ) 1223 { 1224 SvxLRSpaceItem* pSpace = ( SvxLRSpaceItem*)pState; 1225 maTxtLeft = pSpace->GetTxtLeft(); 1226 maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM ); 1227 maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1228 1229 long aTxtRight = pSpace->GetRight(); 1230 aTxtRight = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM ); 1231 aTxtRight = OutputDevice::LogicToLogic( aTxtRight, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1232 1233 long aTxtFirstLineOfst = pSpace->GetTxtFirstLineOfst(); 1234 aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM ); 1235 aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1236 1237 long nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1238 nVal = (long)maLeftIndent->Normalize( (long)nVal ); 1239 maLeftIndent->SetValue( nVal, FUNIT_100TH_MM ); 1240 1241 if(maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && 1242 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && 1243 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table)) 1244 { 1245 maFLineIndent->SetMin( nVal*(-1), FUNIT_100TH_MM ); 1246 } 1247 1248 long nrVal = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1249 nrVal = (long)maRightIndent->Normalize( (long)nrVal ); 1250 maRightIndent->SetValue( nrVal, FUNIT_100TH_MM ); 1251 1252 long nfVal = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1253 nfVal = (long)maFLineIndent->Normalize( (long)nfVal ); 1254 maFLineIndent->SetValue( nfVal, FUNIT_100TH_MM ); 1255 1256 switch (maContext.GetCombinedContext()) 1257 { 1258 case CombinedEnumContext(Application_Writer, Context_DrawText): 1259 case CombinedEnumContext(Application_Writer, Context_Text): 1260 case CombinedEnumContext(Application_Writer, Context_Default): 1261 case CombinedEnumContext(Application_Writer, Context_Table): 1262 case CombinedEnumContext(Application_Writer, Context_Annotation): 1263 { 1264 maLeftIndent->SetMax( MAX_SW - nrVal, FUNIT_100TH_MM ); 1265 maRightIndent->SetMax( MAX_SW - nVal, FUNIT_100TH_MM ); 1266 maFLineIndent->SetMax( MAX_SW - nVal - nrVal, FUNIT_100TH_MM ); 1267 } 1268 break; 1269 case CombinedEnumContext(Application_Draw, Context_DrawText): 1270 case CombinedEnumContext(Application_Draw, Context_Draw): 1271 case CombinedEnumContext(Application_Draw, Context_Table): 1272 case CombinedEnumContext(Application_Draw, Context_TextObject): 1273 case CombinedEnumContext(Application_Draw, Context_Graphic): 1274 case CombinedEnumContext(Application_Impress, Context_TextObject): 1275 case CombinedEnumContext(Application_Impress, Context_DrawText): 1276 case CombinedEnumContext(Application_Impress, Context_Table): 1277 case CombinedEnumContext(Application_Impress, Context_Draw): 1278 case CombinedEnumContext(Application_Impress, Context_Graphic): 1279 { 1280 maLeftIndent->SetMax( MAX_SC_SD - nrVal, FUNIT_100TH_MM ); 1281 maRightIndent->SetMax( MAX_SC_SD - nVal, FUNIT_100TH_MM ); 1282 maFLineIndent->SetMax( MAX_SC_SD - nVal - nrVal, FUNIT_100TH_MM ); 1283 } 1284 } 1285 1286 maTbxIndent_IncDec->Enable(); 1287 maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_True); 1288 if ( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) 1289 && maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) 1290 && maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) 1291 { 1292 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True); 1293 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True); 1294 } 1295 1296 // maTbxProDemote->Enable(); 1297 // if( !mbOutLineRight && !mbOutLineLeft ) 1298 // maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True); 1299 maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True); 1300 } 1301 else if( eState == SFX_ITEM_DISABLED ) 1302 { 1303 maLeftIndent-> Disable(); 1304 maRightIndent->Disable(); 1305 maFLineIndent->Disable(); 1306 maTbxIndent_IncDec->Disable(); 1307 if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && 1308 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && 1309 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) 1310 maTbxIndent_IncDec->Disable(); 1311 else 1312 maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False); 1313 1314 // maTbxProDemote->Disable(); 1315 maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False); 1316 } 1317 else 1318 { 1319 maLeftIndent->SetEmptyFieldValue(); 1320 maRightIndent->SetEmptyFieldValue(); 1321 maFLineIndent->SetEmptyFieldValue(); 1322 if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && 1323 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && 1324 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) 1325 maTbxIndent_IncDec->Disable(); 1326 else 1327 maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False); 1328 // maTbxProDemote->Disable(); 1329 maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False); 1330 } 1331 } 1332 1333 void ParaPropertyPanel::StateChangedLnSPImpl( sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState ) 1334 { 1335 meLnSpState = eState; 1336 1337 if( pState && eState >= SFX_ITEM_AVAILABLE ) 1338 { 1339 if(mpLnSPItem) 1340 delete mpLnSPItem; 1341 mpLnSPItem = ( SvxLineSpacingItem *)pState->Clone(); 1342 } 1343 } 1344 1345 void ParaPropertyPanel::StateChangedULImpl( sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState ) 1346 { 1347 maTopDist->SetMax( maTopDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) ); 1348 maBottomDist->SetMax( maBottomDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) ); 1349 1350 if( pState && eState >= SFX_ITEM_AVAILABLE ) 1351 { 1352 SvxULSpaceItem* pOldItem = (SvxULSpaceItem*)pState; 1353 1354 maUpper = pOldItem->GetUpper(); 1355 maUpper = OutputDevice::LogicToLogic( maUpper, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM ); 1356 maUpper = OutputDevice::LogicToLogic( maUpper, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1357 1358 maLower = pOldItem->GetLower(); 1359 maLower = OutputDevice::LogicToLogic( maLower, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM ); 1360 maLower = OutputDevice::LogicToLogic( maLower, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1361 1362 sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1363 nVal = maTopDist->Normalize( nVal ); 1364 maTopDist->SetValue( nVal, FUNIT_100TH_MM ); 1365 1366 nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1367 nVal = maBottomDist->Normalize( nVal ); 1368 maBottomDist->SetValue( nVal, FUNIT_100TH_MM ); 1369 maTbxUL_IncDec->Enable(); 1370 } 1371 else if(eState == SFX_ITEM_DISABLED ) 1372 { 1373 maTopDist->Disable(); 1374 maBottomDist->Disable(); 1375 maTbxUL_IncDec->Disable(); 1376 } 1377 else 1378 { 1379 maTopDist->SetEmptyFieldValue(); 1380 maBottomDist->SetEmptyFieldValue(); 1381 maTbxUL_IncDec->Disable(); 1382 } 1383 } 1384 1385 void ParaPropertyPanel::StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1386 { 1387 if (nSID==SID_OUTLINE_LEFT) 1388 { 1389 if( pState && eState == SFX_ITEM_UNKNOWN ) 1390 mbOutLineLeft = 1; 1391 else 1392 mbOutLineLeft = 0; 1393 } 1394 if (nSID==SID_OUTLINE_RIGHT) 1395 { 1396 if( pState && eState == SFX_ITEM_UNKNOWN ) 1397 mbOutLineRight = 1; 1398 else 1399 mbOutLineRight = 0; 1400 } 1401 if(mbOutLineLeft) 1402 maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_True); 1403 else 1404 maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_False); 1405 1406 if(mbOutLineRight) 1407 maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_True); 1408 else 1409 maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_False); 1410 1411 } 1412 1413 void ParaPropertyPanel::StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1414 { 1415 if ( ( maContext.GetCombinedContext() == CombinedEnumContext(Application_Writer, Context_Text) 1416 || maContext.GetCombinedContext() == CombinedEnumContext(Application_Writer, Context_Default) 1417 || maContext.GetCombinedContext() == CombinedEnumContext(Application_Writer, Context_Table) ) 1418 && ( nSID == SID_INC_INDENT || nSID == SID_DEC_INDENT ) ) 1419 { 1420 // Writer's text shell is the only one which provides reasonable states for Slots SID_INC_INDENT and SID_DEC_INDENT 1421 // - namely SFX_ITEM_UNKNOWN and SFX_ITEM_DISABLED 1422 maTbxIndent_IncDec->EnableItem( 1423 nSID == SID_INC_INDENT ? BT_TBX_INDENT_INC : BT_TBX_INDENT_DEC, 1424 ( pState && eState == SFX_ITEM_UNKNOWN ) ? sal_True : sal_False ); 1425 } 1426 } 1427 1428 1429 // Add toggle state for numbering and bullet icons 1430 void ParaPropertyPanel::StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1431 { 1432 if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem)) ) 1433 { 1434 if (nSID==FN_NUM_NUMBERING_ON) 1435 { 1436 const SfxBoolItem* pItem= (const SfxBoolItem*)pState; 1437 sal_Bool aBool = (sal_Bool)pItem->GetValue(); 1438 if (aBool) { 1439 maTBxNumBullet->SetItemState(IID_NUMBER, STATE_CHECK); 1440 } else { 1441 maTBxNumBullet->SetItemState(IID_NUMBER, STATE_NOCHECK); 1442 } 1443 } 1444 else if (nSID==FN_NUM_BULLET_ON) 1445 { 1446 const SfxBoolItem* pItem= (const SfxBoolItem*)pState; 1447 sal_Bool aBool = (sal_Bool)pItem->GetValue(); 1448 if (aBool) { 1449 maTBxNumBullet->SetItemState(IID_BULLET, STATE_CHECK); 1450 } else { 1451 maTBxNumBullet->SetItemState(IID_BULLET, STATE_NOCHECK); 1452 } 1453 } 1454 } 1455 } 1456 1457 1458 void ParaPropertyPanel::StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1459 { 1460 if ( eState >= SFX_ITEM_DEFAULT && pState->ISA(SfxUInt16Item) ) 1461 { 1462 sal_uInt16 nValue = (sal_uInt16)0xFFFF; 1463 { 1464 const SfxUInt16Item* pIt = (const SfxUInt16Item*)pState; 1465 if ( pIt ) 1466 nValue = pIt->GetValue(); 1467 } 1468 1469 if ( nSID == FN_BUL_NUM_RULE_INDEX ) 1470 { 1471 mnBulletTypeIndex = nValue; 1472 } 1473 else if ( nSID == FN_NUM_NUM_RULE_INDEX ) 1474 { 1475 mnNumTypeIndex = nValue; 1476 } 1477 } 1478 } 1479 1480 1481 FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ) 1482 { 1483 FieldUnit eUnit = FUNIT_NONE; 1484 1485 if ( pState && eState >= SFX_ITEM_DEFAULT ) 1486 eUnit = (FieldUnit)( (const SfxUInt16Item*)pState )->GetValue(); 1487 else 1488 { 1489 SfxViewFrame* pFrame = SfxViewFrame::Current(); 1490 SfxObjectShell* pSh = NULL; 1491 if ( pFrame ) 1492 pSh = pFrame->GetObjectShell(); 1493 if ( pSh ) //the object shell is not always available during reload 1494 { 1495 SfxModule* pModule = pSh->GetModule(); 1496 if ( pModule ) 1497 { 1498 const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); 1499 if ( pItem ) 1500 eUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue(); 1501 } 1502 else 1503 { 1504 DBG_ERRORFILE( "GetModuleFieldUnit(): no module found" ); 1505 } 1506 } 1507 } 1508 1509 return eUnit; 1510 } 1511 1512 1513 PopupControl* ParaPropertyPanel::CreateLineSpacingControl (PopupContainer* pParent) 1514 { 1515 return new ParaLineSpacingControl(pParent, *this); 1516 } 1517 1518 PopupControl* ParaPropertyPanel::CreateBulletsPopupControl (PopupContainer* pParent) 1519 { 1520 return new ParaBulletsControl(pParent, *this); 1521 } 1522 1523 PopupControl* ParaPropertyPanel::CreateNumberingPopupControl (PopupContainer* pParent) 1524 { 1525 return new ParaNumberingControl(pParent, *this); 1526 } 1527 1528 namespace 1529 { 1530 Color GetNoBackgroundColor(void) 1531 { 1532 return COL_TRANSPARENT; 1533 } 1534 } // end of anonymous namespace 1535 1536 PopupControl* ParaPropertyPanel::CreateBGColorPopupControl (PopupContainer* pParent) 1537 { 1538 const ResId aResId(SVX_RES(STR_NOFILL)); 1539 1540 return new ColorControl( 1541 pParent, 1542 mpBindings, 1543 SVX_RES(RID_POPUPPANEL_PARAPAGE_BACK_COLOR), 1544 SVX_RES(VS_FONT_COLOR), 1545 ::boost::bind(GetNoBackgroundColor), 1546 ::boost::bind(&ParaPropertyPanel::SetBGColor, this, _1,_2), 1547 pParent, 1548 &aResId); 1549 } 1550 1551 1552 ParaPropertyPanel::ParaPropertyPanel(Window* pParent, 1553 const cssu::Reference<css::frame::XFrame>& rxFrame, 1554 SfxBindings* pBindings, 1555 const cssu::Reference<css::ui::XSidebar>& rxSidebar) 1556 : Control(pParent, SVX_RES(RID_SIDEBAR_PARA_PANEL)), 1557 maAlignToolBoxBackground(ControlFactory::CreateToolBoxBackground(this)), 1558 maAlignToolBox (ControlFactory::CreateToolBox(maAlignToolBoxBackground.get(),SVX_RES(TBX_HORIZONTALALIGNMENT))), 1559 maTBxVertAlignBackground(ControlFactory::CreateToolBoxBackground(this)), 1560 maTBxVertAlign (ControlFactory::CreateToolBox(maTBxVertAlignBackground.get(),SVX_RES(TBX_VERT_ALIGN))), 1561 maTBxNumBulletBackground(ControlFactory::CreateToolBoxBackground(this)), 1562 maTBxNumBullet (ControlFactory::CreateToolBox(maTBxNumBulletBackground.get(),SVX_RES(TBX_NUM_BULLET))), 1563 maTBxBackColorBackground(ControlFactory::CreateToolBoxBackground(this)), 1564 maTBxBackColor (ControlFactory::CreateToolBox(maTBxBackColorBackground.get(),SVX_RES(TBX_BACK_COLOR))), 1565 maFTUL (new FixedText(this, SVX_RES(FT_SPACING))), 1566 maTbxUL_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)), 1567 maTbxUL_IncDec (ControlFactory::CreateToolBox(maTbxUL_IncDecBackground.get(),SVX_RES(TBX_UL_INC_DEC))), 1568 maFTIndent (new FixedText(this, SVX_RES(FT_INDENT))), 1569 maTbxIndent_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)), 1570 maTbxIndent_IncDec (ControlFactory::CreateToolBox(maTbxIndent_IncDecBackground.get(),SVX_RES(TBX_INDENT_INC_DEC))), 1571 1572 maTopDist (new SvxRelativeField(this, SVX_RES(MF_ABOVE_PARASPACING))), 1573 maLeftIndent (new SvxRelativeField(this, SVX_RES(MF_BEFORE_INDENT))), 1574 1575 maBottomDist (new SvxRelativeField(this, SVX_RES(MF_BELOW_PARASPACING))), 1576 maRightIndent (new SvxRelativeField(this, SVX_RES(MF_AFTER_INDENT))), 1577 1578 maLineSPTbxBackground(ControlFactory::CreateToolBoxBackground(this)), 1579 maLineSPTbx (ControlFactory::CreateToolBox(maLineSPTbxBackground.get(),SVX_RES(TBX_LINESP))), 1580 maFLineIndent (new SvxRelativeField(this, SVX_RES(MF_FL_INDENT))), 1581 1582 maTbxProDemoteBackground(ControlFactory::CreateToolBoxBackground(this)), 1583 maTbxProDemote (ControlFactory::CreateToolBox(maTbxProDemoteBackground.get(),SVX_RES(TBX_INDENT_PRO_DEMOTE))), 1584 mpColorUpdater (), 1585 maFISpace1 ( this, SVX_RES( FI_SPACE1)), 1586 maFISpace2 ( this, SVX_RES( FI_SPACE2)), 1587 maFIndent1 ( this, SVX_RES( FI_INDENT1)), 1588 maFIndent2 ( this, SVX_RES( FI_INDENT2)), 1589 maFIndent3 ( this, SVX_RES( FI_INDENT3)), 1590 maSpace1 (SVX_RES(IMG_SPACE1)), 1591 maSpace2 (SVX_RES(IMG_SPACE2)), 1592 maSpace3 (SVX_RES(IMG_SPACE3)), 1593 maIndent1 (SVX_RES(IMG_INDENT1)), 1594 maIndent2 (SVX_RES(IMG_INDENT2)), 1595 maIndent3 (SVX_RES(IMG_INDENT3)), 1596 maIndHang (SVX_RES(IMG_INDENT_HANG)), 1597 maParInc (SVX_RES(IMG_PARA_INC)), 1598 maParDec (SVX_RES(IMG_PARA_DEC)), 1599 maNumBImageList (SVX_RES(IL_NUM_BULLET)), 1600 maNumBImageListH (SVX_RES(ILH_NUM_BULLET)), 1601 maNumBImageListRTL (SVX_RES(IL_NUM_BULLET_RTL)), 1602 maImgBackColorHigh (SVX_RES(IMG_BACK_COLOR_H)), 1603 maImgBackColor (SVX_RES(IMG_BACK_COLOR)), 1604 maTxtLeft (0), 1605 mpLnSPItem (NULL), 1606 meLnSpState (SFX_ITEM_DONTCARE), 1607 mbOutLineLeft (false), 1608 mbOutLineRight (false), 1609 maUpper (0), 1610 maLower (0), 1611 mnBulletTypeIndex ((sal_uInt16)0xFFFF), 1612 mnNumTypeIndex ((sal_uInt16)0xFFFF), 1613 maColor (COL_AUTO), 1614 mbColorAvailable (true), 1615 m_eLRSpaceUnit(), 1616 m_eULSpaceUnit(), 1617 maLeftAlignControl(SID_ATTR_PARA_ADJUST_LEFT, *pBindings, *this, A2S("LeftPara"), rxFrame), 1618 maCenterAlignControl(SID_ATTR_PARA_ADJUST_CENTER, *pBindings, *this, A2S("CenterPara"), rxFrame), 1619 maRightAlignControl(SID_ATTR_PARA_ADJUST_RIGHT, *pBindings, *this, A2S("RightPara"), rxFrame), 1620 maJustifyAlignControl(SID_ATTR_PARA_ADJUST_BLOCK, *pBindings, *this, A2S("JustifyPara"), rxFrame), 1621 maLRSpaceControl (SID_ATTR_PARA_LRSPACE,*pBindings,*this), 1622 maLNSpaceControl (SID_ATTR_PARA_LINESPACE, *pBindings,*this), 1623 maULSpaceControl (SID_ATTR_PARA_ULSPACE, *pBindings,*this), 1624 maOutLineLeftControl(SID_OUTLINE_LEFT, *pBindings, *this, A2S("OutlineRight"), rxFrame), 1625 maOutLineRightControl(SID_OUTLINE_RIGHT, *pBindings, *this, A2S("OutlineLeft"), rxFrame), 1626 maDecIndentControl(SID_DEC_INDENT, *pBindings,*this, A2S("DecrementIndent"), rxFrame), 1627 maIncIndentControl(SID_INC_INDENT, *pBindings,*this, A2S("IncrementIndent"), rxFrame), 1628 maVertTop (SID_TABLE_VERT_NONE, *pBindings, *this, A2S("CellVertTop"), rxFrame), 1629 maVertCenter (SID_TABLE_VERT_CENTER, *pBindings,*this, A2S("CellVertCenter"), rxFrame), 1630 maVertBottom (SID_TABLE_VERT_BOTTOM,*pBindings,*this, A2S("CellVertBottom"), rxFrame), 1631 maBulletOnOff(FN_NUM_BULLET_ON, *pBindings, *this, A2S("DefaultBullet"), rxFrame), 1632 maNumberOnOff(FN_NUM_NUMBERING_ON, *pBindings, *this, A2S("DefaultNumbering"), rxFrame), 1633 maBackColorControl (SID_BACKGROUND_COLOR, *pBindings,*this), 1634 m_aMetricCtl (SID_ATTR_METRIC, *pBindings,*this), 1635 maBulletNumRuleIndex (FN_BUL_NUM_RULE_INDEX, *pBindings,*this), 1636 maNumNumRuleIndex (FN_NUM_NUM_RULE_INDEX, *pBindings,*this), 1637 mxFrame(rxFrame), 1638 maContext(), 1639 mpBindings(pBindings), 1640 maLineSpacePopup(this, ::boost::bind(&ParaPropertyPanel::CreateLineSpacingControl, this, _1)), 1641 maBulletsPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBulletsPopupControl, this, _1)), 1642 maNumberingPopup(this, ::boost::bind(&ParaPropertyPanel::CreateNumberingPopupControl, this, _1)), 1643 maBGColorPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBGColorPopupControl, this, _1)), 1644 mxSidebar(rxSidebar) 1645 { 1646 initial(); 1647 FreeResource(); 1648 } 1649 1650 } } // end of namespace svx::sidebar 1651