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_PARA_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_PARA_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_PARA_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_PARA_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_PARA_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_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); 911 } 912 } 913 } 914 break; 915 case ID_HANGING_INDENT: 916 { 917 SvxLRSpaceItem aMargin( SID_ATTR_PARA_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_PARA_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_PARA_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_PARA_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_PARA_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_PARA_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_PARA_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_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); 1032 } 1033 break; 1034 case UL_DECREMENT: 1035 { 1036 SvxULSpaceItem aMargin( SID_ATTR_PARA_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_PARA_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 //Get the num rule index data of the current selection 1104 if ( nSID == FN_BUL_NUM_RULE_INDEX ||nSID == FN_NUM_NUM_RULE_INDEX) 1105 StateChangeBulletNumRuleImpl( nSID, eState, pState ); 1106 1107 if ((nSID == SID_TABLE_VERT_NONE)||(nSID == SID_TABLE_VERT_CENTER)||(nSID == SID_TABLE_VERT_BOTTOM)) 1108 { 1109 VertStateChanged( nSID, eState, pState); 1110 } 1111 else if (nSID == SID_BACKGROUND_COLOR) 1112 { 1113 ParaBKGStateChanged(nSID, eState, pState); 1114 } 1115 } 1116 1117 void ParaPropertyPanel::StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1118 { 1119 if( eState >= SFX_ITEM_AVAILABLE ) 1120 { 1121 const SfxBoolItem* pItem = (const SfxBoolItem*)pState; 1122 bool IsChecked = (bool)pItem->GetValue(); 1123 switch (nSID) 1124 { 1125 case SID_ATTR_PARA_ADJUST_LEFT: 1126 { 1127 if(IsChecked) 1128 { 1129 maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_CHECK); 1130 maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 1131 maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 1132 maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 1133 } 1134 else 1135 maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 1136 } 1137 break; 1138 case SID_ATTR_PARA_ADJUST_CENTER: 1139 { 1140 if(IsChecked) 1141 { 1142 maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_CHECK); 1143 maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 1144 maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 1145 maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 1146 } 1147 else 1148 maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 1149 } 1150 break; 1151 case SID_ATTR_PARA_ADJUST_RIGHT: 1152 { 1153 if(IsChecked) 1154 { 1155 maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_CHECK); 1156 maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 1157 maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 1158 maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 1159 } 1160 else 1161 maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 1162 } 1163 break; 1164 case SID_ATTR_PARA_ADJUST_BLOCK: 1165 { 1166 if(IsChecked) 1167 { 1168 maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_CHECK); 1169 maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 1170 maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 1171 maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 1172 } 1173 else 1174 maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 1175 } 1176 break; 1177 } 1178 } 1179 else if( eState == SFX_ITEM_DISABLED ) 1180 { 1181 } 1182 else if ( eState == SFX_ITEM_DONTCARE ) 1183 { 1184 switch (nSID) 1185 { 1186 case SID_ATTR_PARA_ADJUST_LEFT: 1187 maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 1188 break; 1189 case SID_ATTR_PARA_ADJUST_CENTER: 1190 maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 1191 break; 1192 case SID_ATTR_PARA_ADJUST_RIGHT: 1193 maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 1194 break; 1195 case SID_ATTR_PARA_ADJUST_BLOCK: 1196 maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 1197 break; 1198 } 1199 } 1200 } 1201 1202 void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1203 { 1204 switch (maContext.GetCombinedContext()) 1205 { 1206 1207 case CombinedEnumContext(Application_Writer, Context_DrawText): 1208 case CombinedEnumContext(Application_Calc, Context_DrawText): 1209 case CombinedEnumContext(Application_Writer, Context_Annotation): 1210 { 1211 maLeftIndent->SetMin( DEFAULT_VALUE ); 1212 maRightIndent->SetMin( DEFAULT_VALUE ); 1213 maFLineIndent->SetMin( DEFAULT_VALUE ); 1214 maTbxIndent_IncDec->Show(); 1215 maTbxProDemote->Hide(); 1216 } 1217 break; 1218 case CombinedEnumContext(Application_Draw, Context_DrawText): 1219 case CombinedEnumContext(Application_Impress, Context_DrawText): 1220 case CombinedEnumContext(Application_Draw, Context_Draw): 1221 case CombinedEnumContext(Application_Draw, Context_TextObject): 1222 case CombinedEnumContext(Application_Draw, Context_Graphic): 1223 case CombinedEnumContext(Application_Impress, Context_Draw): 1224 case CombinedEnumContext(Application_Impress, Context_TextObject): 1225 case CombinedEnumContext(Application_Impress, Context_Graphic): 1226 case CombinedEnumContext(Application_Impress, Context_Table): 1227 case CombinedEnumContext(Application_Draw, Context_Table): 1228 { 1229 maLeftIndent->SetMin( DEFAULT_VALUE ); 1230 maRightIndent->SetMin( DEFAULT_VALUE ); 1231 maFLineIndent->SetMin( DEFAULT_VALUE ); 1232 maTbxIndent_IncDec->Hide(); 1233 maTbxProDemote->Show(); 1234 } 1235 break; 1236 case CombinedEnumContext(Application_Writer, Context_Default): 1237 case CombinedEnumContext(Application_Writer, Context_Text): 1238 case CombinedEnumContext(Application_Writer, Context_Table): 1239 { 1240 maLeftIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM ); 1241 maRightIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM ); 1242 maFLineIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM ); 1243 maTbxIndent_IncDec->Show(); 1244 maTbxProDemote->Hide(); 1245 } 1246 break; 1247 } 1248 1249 if( pState && eState >= SFX_ITEM_AVAILABLE ) 1250 { 1251 SvxLRSpaceItem* pSpace = ( SvxLRSpaceItem*)pState; 1252 maTxtLeft = pSpace->GetTxtLeft(); 1253 maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM ); 1254 maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1255 1256 long aTxtRight = pSpace->GetRight(); 1257 aTxtRight = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM ); 1258 aTxtRight = OutputDevice::LogicToLogic( aTxtRight, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1259 1260 long aTxtFirstLineOfst = pSpace->GetTxtFirstLineOfst(); 1261 aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM ); 1262 aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1263 1264 long nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1265 nVal = (long)maLeftIndent->Normalize( (long)nVal ); 1266 maLeftIndent->SetValue( nVal, FUNIT_100TH_MM ); 1267 1268 if(maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && 1269 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && 1270 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table)) 1271 { 1272 maFLineIndent->SetMin( nVal*(-1), FUNIT_100TH_MM ); 1273 } 1274 1275 long nrVal = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1276 nrVal = (long)maRightIndent->Normalize( (long)nrVal ); 1277 maRightIndent->SetValue( nrVal, FUNIT_100TH_MM ); 1278 1279 long nfVal = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1280 nfVal = (long)maFLineIndent->Normalize( (long)nfVal ); 1281 maFLineIndent->SetValue( nfVal, FUNIT_100TH_MM ); 1282 1283 switch (maContext.GetCombinedContext()) 1284 { 1285 case CombinedEnumContext(Application_Writer, Context_DrawText): 1286 case CombinedEnumContext(Application_Writer, Context_Text): 1287 case CombinedEnumContext(Application_Writer, Context_Default): 1288 case CombinedEnumContext(Application_Writer, Context_Table): 1289 case CombinedEnumContext(Application_Writer, Context_Annotation): 1290 { 1291 maLeftIndent->SetMax( MAX_SW - nrVal, FUNIT_100TH_MM ); 1292 maRightIndent->SetMax( MAX_SW - nVal, FUNIT_100TH_MM ); 1293 maFLineIndent->SetMax( MAX_SW - nVal - nrVal, FUNIT_100TH_MM ); 1294 } 1295 break; 1296 case CombinedEnumContext(Application_Draw, Context_DrawText): 1297 case CombinedEnumContext(Application_Draw, Context_Draw): 1298 case CombinedEnumContext(Application_Draw, Context_Table): 1299 case CombinedEnumContext(Application_Draw, Context_TextObject): 1300 case CombinedEnumContext(Application_Draw, Context_Graphic): 1301 case CombinedEnumContext(Application_Impress, Context_TextObject): 1302 case CombinedEnumContext(Application_Impress, Context_DrawText): 1303 case CombinedEnumContext(Application_Impress, Context_Table): 1304 case CombinedEnumContext(Application_Impress, Context_Draw): 1305 case CombinedEnumContext(Application_Impress, Context_Graphic): 1306 { 1307 maLeftIndent->SetMax( MAX_SC_SD - nrVal, FUNIT_100TH_MM ); 1308 maRightIndent->SetMax( MAX_SC_SD - nVal, FUNIT_100TH_MM ); 1309 maFLineIndent->SetMax( MAX_SC_SD - nVal - nrVal, FUNIT_100TH_MM ); 1310 } 1311 } 1312 1313 maTbxIndent_IncDec->Enable(); 1314 maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_True); 1315 if(maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) 1316 && maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) 1317 && maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table)) 1318 { 1319 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True); 1320 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True); 1321 } 1322 1323 // maTbxProDemote->Enable(); 1324 // if( !mbOutLineRight && !mbOutLineLeft ) 1325 // maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True); 1326 maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True); 1327 } 1328 else if( eState == SFX_ITEM_DISABLED ) 1329 { 1330 maLeftIndent-> Disable(); 1331 maRightIndent->Disable(); 1332 maFLineIndent->Disable(); 1333 maTbxIndent_IncDec->Disable(); 1334 if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && 1335 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && 1336 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) 1337 maTbxIndent_IncDec->Disable(); 1338 else 1339 maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False); 1340 1341 // maTbxProDemote->Disable(); 1342 maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False); 1343 } 1344 else 1345 { 1346 maLeftIndent->SetEmptyFieldValue(); 1347 maRightIndent->SetEmptyFieldValue(); 1348 maFLineIndent->SetEmptyFieldValue(); 1349 if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && 1350 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && 1351 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) 1352 maTbxIndent_IncDec->Disable(); 1353 else 1354 maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False); 1355 // maTbxProDemote->Disable(); 1356 maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False); 1357 } 1358 } 1359 1360 void ParaPropertyPanel::StateChangedLnSPImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1361 { 1362 meLnSpState = eState; 1363 1364 if( pState && eState >= SFX_ITEM_AVAILABLE ) 1365 { 1366 if(mpLnSPItem) 1367 delete mpLnSPItem; 1368 mpLnSPItem = ( SvxLineSpacingItem *)pState->Clone(); 1369 } 1370 } 1371 1372 void ParaPropertyPanel::StateChangedULImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1373 { 1374 maTopDist->SetMax( maTopDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) ); 1375 maBottomDist->SetMax( maBottomDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) ); 1376 1377 if( pState && eState >= SFX_ITEM_AVAILABLE ) 1378 { 1379 SvxULSpaceItem* pOldItem = (SvxULSpaceItem*)pState; 1380 1381 maUpper = pOldItem->GetUpper(); 1382 maUpper = OutputDevice::LogicToLogic( maUpper, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM ); 1383 maUpper = OutputDevice::LogicToLogic( maUpper, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1384 1385 maLower = pOldItem->GetLower(); 1386 maLower = OutputDevice::LogicToLogic( maLower, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM ); 1387 maLower = OutputDevice::LogicToLogic( maLower, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1388 1389 sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1390 nVal = maTopDist->Normalize( nVal ); 1391 maTopDist->SetValue( nVal, FUNIT_100TH_MM ); 1392 1393 nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1394 nVal = maBottomDist->Normalize( nVal ); 1395 maBottomDist->SetValue( nVal, FUNIT_100TH_MM ); 1396 maTbxUL_IncDec->Enable(); 1397 } 1398 else if(eState == SFX_ITEM_DISABLED ) 1399 { 1400 maTopDist->Disable(); 1401 maBottomDist->Disable(); 1402 maTbxUL_IncDec->Disable(); 1403 } 1404 else 1405 { 1406 maTopDist->SetEmptyFieldValue(); 1407 maBottomDist->SetEmptyFieldValue(); 1408 maTbxUL_IncDec->Disable(); 1409 } 1410 } 1411 1412 void ParaPropertyPanel::StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1413 { 1414 if (nSID==SID_OUTLINE_LEFT) 1415 { 1416 if( pState && eState == SFX_ITEM_UNKNOWN ) 1417 mbOutLineLeft = 1; 1418 else 1419 mbOutLineLeft = 0; 1420 } 1421 if (nSID==SID_OUTLINE_RIGHT) 1422 { 1423 if( pState && eState == SFX_ITEM_UNKNOWN ) 1424 mbOutLineRight = 1; 1425 else 1426 mbOutLineRight = 0; 1427 } 1428 if(mbOutLineLeft) 1429 maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_True); 1430 else 1431 maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_False); 1432 1433 if(mbOutLineRight) 1434 maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_True); 1435 else 1436 maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_False); 1437 1438 // if( !mbOutLineRight && !mbOutLineLeft ) 1439 // { 1440 // maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_True); 1441 // maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_True); 1442 // maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True); 1443 // } 1444 // else 1445 // maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False); 1446 } 1447 1448 void ParaPropertyPanel::StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1449 { 1450 if (nSID==SID_INC_INDENT) 1451 { 1452 if( pState && eState == SFX_ITEM_UNKNOWN ) 1453 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True); 1454 else 1455 if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && 1456 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && 1457 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) 1458 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_False); 1459 } 1460 if (nSID==SID_DEC_INDENT) 1461 { 1462 if( pState && eState == SFX_ITEM_UNKNOWN ) 1463 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True); 1464 else 1465 if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && 1466 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && 1467 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) 1468 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_False); 1469 } 1470 } 1471 // Add toggle state for numbering and bullet icons 1472 void ParaPropertyPanel::StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1473 { 1474 if (nSID==FN_NUM_NUMBERING_ON) 1475 { 1476 if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem))) 1477 { 1478 const SfxBoolItem* pItem= (const SfxBoolItem*)pState; 1479 sal_Bool aBool = (sal_Bool)pItem->GetValue(); 1480 if (aBool) { 1481 maTBxNumBullet->SetItemState(IID_NUMBER, STATE_CHECK); 1482 } else { 1483 maTBxNumBullet->SetItemState(IID_NUMBER, STATE_NOCHECK); 1484 } 1485 } 1486 } 1487 if (nSID==FN_NUM_BULLET_ON) 1488 { 1489 if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem))) 1490 { 1491 const SfxBoolItem* pItem= (const SfxBoolItem*)pState; 1492 sal_Bool aBool = (sal_Bool)pItem->GetValue(); 1493 if (aBool) { 1494 maTBxNumBullet->SetItemState(IID_BULLET, STATE_CHECK); 1495 } else { 1496 maTBxNumBullet->SetItemState(IID_BULLET, STATE_NOCHECK); 1497 } 1498 } 1499 } 1500 } 1501 //Modified for Numbering&Bullets Dialog UX Enh(Story 992) by chengjh,2011.7.5 1502 //Handing the transferred the num rule index data of the current selection 1503 void ParaPropertyPanel::StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1504 { 1505 1506 const SfxUInt16Item* pIt = (const SfxUInt16Item*)pState; 1507 sal_uInt16 nValue = (sal_uInt16)0xFFFF; 1508 if ( pIt ) 1509 nValue = pIt->GetValue(); 1510 1511 if ( nSID == FN_BUL_NUM_RULE_INDEX ) 1512 { 1513 mnBulletTypeIndex = nValue; 1514 }else if ( nSID == FN_NUM_NUM_RULE_INDEX ) 1515 { 1516 mnNumTypeIndex = nValue; 1517 } 1518 } 1519 //End 1520 FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ) 1521 { 1522 FieldUnit eUnit = FUNIT_NONE; 1523 1524 if ( pState && eState >= SFX_ITEM_DEFAULT ) 1525 eUnit = (FieldUnit)( (const SfxUInt16Item*)pState )->GetValue(); 1526 else 1527 { 1528 SfxViewFrame* pFrame = SfxViewFrame::Current(); 1529 SfxObjectShell* pSh = NULL; 1530 if ( pFrame ) 1531 pSh = pFrame->GetObjectShell(); 1532 if ( pSh ) //the object shell is not always available during reload 1533 { 1534 SfxModule* pModule = pSh->GetModule(); 1535 if ( pModule ) 1536 { 1537 const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); 1538 if ( pItem ) 1539 eUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue(); 1540 } 1541 else 1542 { 1543 DBG_ERRORFILE( "GetModuleFieldUnit(): no module found" ); 1544 } 1545 } 1546 } 1547 1548 return eUnit; 1549 } 1550 //new FixedText(this, SVX_RES(FT_COLOR)) 1551 1552 PopupControl* ParaPropertyPanel::CreateLineSpacingControl (PopupContainer* pParent) 1553 { 1554 return new ParaLineSpacingControl(pParent, *this); 1555 } 1556 1557 PopupControl* ParaPropertyPanel::CreateBulletsPopupControl (PopupContainer* pParent) 1558 { 1559 return new ParaBulletsControl(pParent, *this); 1560 } 1561 1562 PopupControl* ParaPropertyPanel::CreateNumberingPopupControl (PopupContainer* pParent) 1563 { 1564 return new ParaNumberingControl(pParent, *this); 1565 } 1566 1567 PopupControl* ParaPropertyPanel::CreateBGColorPopupControl (PopupContainer* pParent) 1568 { 1569 return new ColorControl( 1570 pParent, 1571 mpBindings, 1572 SVX_RES(RID_POPUPPANEL_TEXTPAGE_FONT_COLOR), 1573 SVX_RES(VS_FONT_COLOR), 1574 ::boost::bind(&ParaPropertyPanel::GetBGColor, this), 1575 ::boost::bind(&ParaPropertyPanel::SetBGColor, this, _1,_2), 1576 pParent, 1577 0); 1578 } 1579 1580 1581 ParaPropertyPanel::ParaPropertyPanel(Window* pParent, 1582 const cssu::Reference<css::frame::XFrame>& rxFrame, 1583 SfxBindings* pBindings, 1584 const cssu::Reference<css::ui::XSidebar>& rxSidebar) 1585 : Control(pParent, SVX_RES(RID_SIDEBAR_PARA_PANEL)), 1586 maAlignToolBoxBackground(ControlFactory::CreateToolBoxBackground(this)), 1587 maAlignToolBox (ControlFactory::CreateToolBox(maAlignToolBoxBackground.get(),SVX_RES(TBX_HORIZONTALALIGNMENT))), 1588 maTBxVertAlignBackground(ControlFactory::CreateToolBoxBackground(this)), 1589 maTBxVertAlign (ControlFactory::CreateToolBox(maTBxVertAlignBackground.get(),SVX_RES(TBX_VERT_ALIGN))), 1590 maTBxNumBulletBackground(ControlFactory::CreateToolBoxBackground(this)), 1591 maTBxNumBullet (ControlFactory::CreateToolBox(maTBxNumBulletBackground.get(),SVX_RES(TBX_NUM_BULLET))), 1592 maTBxBackColorBackground(ControlFactory::CreateToolBoxBackground(this)), 1593 maTBxBackColor (ControlFactory::CreateToolBox(maTBxBackColorBackground.get(),SVX_RES(TBX_BACK_COLOR))), 1594 maFTUL (new FixedText(this, SVX_RES(FT_SPACING))), 1595 maTbxUL_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)), 1596 maTbxUL_IncDec (ControlFactory::CreateToolBox(maTbxUL_IncDecBackground.get(),SVX_RES(TBX_UL_INC_DEC))), 1597 maTopDist (new SvxRelativeField(this, SVX_RES(MF_ABOVE_PARASPACING))), 1598 maBottomDist (new SvxRelativeField(this, SVX_RES(MF_BELOW_PARASPACING))), 1599 maLineSPTbxBackground(ControlFactory::CreateToolBoxBackground(this)), 1600 maLineSPTbx (ControlFactory::CreateToolBox(maLineSPTbxBackground.get(),SVX_RES(TBX_LINESP))), 1601 maFTIndent (new FixedText(this, SVX_RES(FT_INDENT))), 1602 maTbxIndent_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)), 1603 maTbxIndent_IncDec (ControlFactory::CreateToolBox(maTbxIndent_IncDecBackground.get(),SVX_RES(TBX_INDENT_INC_DEC))), 1604 maTbxProDemoteBackground(ControlFactory::CreateToolBoxBackground(this)), 1605 maTbxProDemote (ControlFactory::CreateToolBox(maTbxProDemoteBackground.get(),SVX_RES(TBX_INDENT_PRO_DEMOTE))), 1606 maLeftIndent (new SvxRelativeField(this, SVX_RES(MF_BEFORE_INDENT))), 1607 maRightIndent (new SvxRelativeField(this, SVX_RES(MF_AFTER_INDENT))), 1608 maFLineIndent (new SvxRelativeField(this, SVX_RES(MF_FL_INDENT))), 1609 mpColorUpdater (), 1610 maFISpace1 ( this, SVX_RES( FI_SPACE1)), 1611 maFISpace2 ( this, SVX_RES( FI_SPACE2)), 1612 maFIndent1 ( this, SVX_RES( FI_INDENT1)), 1613 maFIndent2 ( this, SVX_RES( FI_INDENT2)), 1614 maFIndent3 ( this, SVX_RES( FI_INDENT3)), 1615 maSpace1 (SVX_RES(IMG_SPACE1)), 1616 maSpace2 (SVX_RES(IMG_SPACE2)), 1617 maSpace3 (SVX_RES(IMG_SPACE3)), 1618 maIndent1 (SVX_RES(IMG_INDENT1)), 1619 maIndent2 (SVX_RES(IMG_INDENT2)), 1620 maIndent3 (SVX_RES(IMG_INDENT3)), 1621 maLeftPara (SVX_RES(IMG_LEFT_PARA)), 1622 maCentPara (SVX_RES(IMG_CENTER_PARA)), 1623 maRightPara (SVX_RES(IMG_RIGHT_PARA)), 1624 maJusPara (SVX_RES(IMG_JUSTIFY_PARA)), 1625 maIndInc (SVX_RES(IMG_INDENT_INC)), 1626 maIndDec (SVX_RES(IMG_INDENT_DEC)), 1627 maIndInc_BD (SVX_RES(IMG_INDENT_INC_BD)), 1628 maIndDec_BD (SVX_RES(IMG_INDENT_DEC_BD)), 1629 maIndHang (SVX_RES(IMG_INDENT_HANG)), 1630 maParInc (SVX_RES(IMG_PARA_INC)), 1631 maParDec (SVX_RES(IMG_PARA_DEC)), 1632 maVertImageList (SVX_RES(IL_VERT_ALIGN)), 1633 maVertImageListH (SVX_RES(IL_VERT_ALIGN)), 1634 maNumBImageList (SVX_RES(IL_NUM_BULLET)), 1635 maNumBImageListH (SVX_RES(ILH_NUM_BULLET)), 1636 maNumBImageListRTL (SVX_RES(IL_NUM_BULLET_RTL)), 1637 maImgBackColorHigh (SVX_RES(IMG_BACK_COLOR_H)), 1638 maImgBackColor (SVX_RES(IMG_BACK_COLOR)), 1639 maTxtLeft (0), 1640 mpLnSPItem (NULL), 1641 meLnSpState (SFX_ITEM_DONTCARE), 1642 mbOutLineLeft (false), 1643 mbOutLineRight (false), 1644 maUpper (0), 1645 maLower (0), 1646 mnBulletTypeIndex ((sal_uInt16)0xFFFF), 1647 mnNumTypeIndex ((sal_uInt16)0xFFFF), 1648 maColor (COL_AUTO), 1649 mbColorAvailable (true), 1650 //, m_eMetricUnit (FUNIT_INCH) 1651 //, m_last_eMetricUnit (FUNIT_INCH) 1652 m_eLRSpaceUnit(), 1653 m_eULSpaceUnit(), 1654 maLeftAlignControl (SID_ATTR_PARA_ADJUST_LEFT, *pBindings,*this), 1655 maCenterAlignControl (SID_ATTR_PARA_ADJUST_CENTER, *pBindings,*this), 1656 maRightAlignControl (SID_ATTR_PARA_ADJUST_RIGHT, *pBindings,*this), 1657 maJustifyAlignControl (SID_ATTR_PARA_ADJUST_BLOCK, *pBindings,*this), 1658 maLRSpaceControl (SID_ATTR_PARA_LRSPACE,*pBindings,*this), 1659 maLNSpaceControl (SID_ATTR_PARA_LINESPACE, *pBindings,*this), 1660 maULSpaceControl (SID_ATTR_PARA_ULSPACE, *pBindings,*this), 1661 maOutLineLeftControl (SID_OUTLINE_LEFT, *pBindings,*this), 1662 maOutLineRightControl (SID_OUTLINE_RIGHT, *pBindings,*this), 1663 maDecIndentControl (SID_DEC_INDENT, *pBindings,*this), 1664 maIncIndentControl (SID_INC_INDENT, *pBindings,*this), 1665 maVertTop (SID_TABLE_VERT_NONE, *pBindings,*this), 1666 maVertCenter (SID_TABLE_VERT_CENTER, *pBindings,*this), 1667 maVertBottom (SID_TABLE_VERT_BOTTOM,*pBindings,*this), 1668 maBulletOnOff (FN_NUM_BULLET_ON, *pBindings,*this), 1669 maNumberOnOff (FN_NUM_NUMBERING_ON, *pBindings,*this), 1670 maBackColorControl (SID_BACKGROUND_COLOR, *pBindings,*this), 1671 m_aMetricCtl (SID_ATTR_METRIC, *pBindings,*this), 1672 maBulletNumRuleIndex (FN_BUL_NUM_RULE_INDEX, *pBindings,*this), 1673 maNumNumRuleIndex (FN_NUM_NUM_RULE_INDEX, *pBindings,*this), 1674 maContext(), 1675 mpBindings(pBindings), 1676 maLineSpacePopup(this, ::boost::bind(&ParaPropertyPanel::CreateLineSpacingControl, this, _1)), 1677 maBulletsPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBulletsPopupControl, this, _1)), 1678 maNumberingPopup(this, ::boost::bind(&ParaPropertyPanel::CreateNumberingPopupControl, this, _1)), 1679 maBGColorPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBGColorPopupControl, this, _1)), 1680 mxSidebar(rxSidebar) 1681 { 1682 initial(); 1683 FreeResource(); 1684 } 1685 1686 } } // end of namespace svx::sidebar 1687