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