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