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