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(SvxColorItem)) 756 { 757 const SvxColorItem* pItem = (const SvxColorItem*)pState; 758 maColor = pItem->GetValue(); 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 void ParaPropertyPanel::SetBGColor ( 771 const String& /* rsColorName */, 772 const Color aColor) 773 { 774 SvxColorItem aColorItem(aColor, SID_BACKGROUND_COLOR); 775 mpBindings->GetDispatcher()->Execute(SID_BACKGROUND_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); 776 maColor = aColor; 777 } 778 779 //==================================for Paragraph Alignment===================== 780 IMPL_LINK( ParaPropertyPanel, AlignStyleModifyHdl_Impl, ToolBox*, pBox ) 781 { 782 switch (pBox->GetCurItemId()) 783 { 784 case BT_SUBSTLEFT: 785 { 786 pBox->SetItemState(BT_SUBSTLEFT,STATE_CHECK); 787 pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 788 pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 789 pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 790 SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True ); 791 GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_LEFT, SFX_CALLMODE_RECORD, &aBoolItem, 0L); 792 } 793 break; 794 case BT_SUBSTCENTER: 795 { 796 pBox->SetItemState(BT_SUBSTCENTER,STATE_CHECK); 797 pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 798 pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 799 pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 800 SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True ); 801 GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_CENTER, SFX_CALLMODE_RECORD, &aBoolItem, 0L); 802 } 803 break; 804 case BT_SUBSTRIGHT: 805 { 806 pBox->SetItemState(BT_SUBSTRIGHT,STATE_CHECK); 807 pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 808 pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 809 pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 810 SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True ); 811 GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_RIGHT, SFX_CALLMODE_RECORD, &aBoolItem, 0L); 812 } 813 break; 814 case BT_SUBSTJUSTIFY: 815 { 816 pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_CHECK); 817 pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 818 pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 819 pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 820 SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True ); 821 GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_BLOCK, SFX_CALLMODE_RECORD, &aBoolItem, 0L); 822 } 823 break; 824 } 825 826 return 0; 827 } 828 //==================================for Paragraph Indent===================== 829 IMPL_LINK( ParaPropertyPanel, ModifyIndentHdl_Impl, SvxRelativeField*, /* pBox */ ) 830 { 831 SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE ); 832 aMargin.SetTxtLeft( (const long)GetCoreValue( *maLeftIndent.get(), m_eLRSpaceUnit ) ); 833 aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); 834 aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); 835 836 GetBindings()->GetDispatcher()->Execute( 837 SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); 838 return 0; 839 } 840 841 IMPL_LINK(ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl, ToolBox *, pControl) 842 { 843 switch (pControl->GetCurItemId()) 844 { 845 case INDENT_INCREMENT: 846 { 847 switch (maContext.GetCombinedContext()) 848 { 849 case CombinedEnumContext(Application_Writer, Context_Default): 850 case CombinedEnumContext(Application_Writer, Context_Text): 851 case CombinedEnumContext(Application_Writer, Context_Table): 852 { 853 SfxBoolItem aMargin( SID_INC_INDENT, sal_True ); 854 GetBindings()->GetDispatcher()->Execute( 855 SID_INC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L); 856 } 857 break; 858 default: 859 { 860 SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE ); 861 862 maTxtLeft += INDENT_STEP; 863 sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 864 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); 865 aMargin.SetTxtLeft( (const long)nVal ); 866 aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); 867 aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); 868 869 GetBindings()->GetDispatcher()->Execute( 870 SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); 871 } 872 } 873 } 874 break; 875 case INDENT_DECREMENT: 876 { 877 switch (maContext.GetCombinedContext()) 878 { 879 case CombinedEnumContext(Application_Writer, Context_Default): 880 case CombinedEnumContext(Application_Writer, Context_Text): 881 case CombinedEnumContext(Application_Writer, Context_Table): 882 { 883 SfxBoolItem aMargin( SID_DEC_INDENT, sal_True ); 884 GetBindings()->GetDispatcher()->Execute( 885 SID_DEC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L); 886 } 887 break; 888 default: 889 { 890 if((maTxtLeft - INDENT_STEP) < 0) 891 maTxtLeft = DEFAULT_VALUE; 892 else 893 maTxtLeft -= INDENT_STEP; 894 895 SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE ); 896 897 sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 898 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); 899 900 aMargin.SetTxtLeft( (const long)nVal ); 901 aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); 902 aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); 903 904 GetBindings()->GetDispatcher()->Execute( 905 SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); 906 } 907 } 908 } 909 break; 910 case ID_HANGING_INDENT: 911 { 912 SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE ); 913 aMargin.SetTxtLeft( (const long)GetCoreValue( *maLeftIndent.get(), m_eLRSpaceUnit ) + (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); 914 aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); 915 aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ))*(-1) ); 916 917 GetBindings()->GetDispatcher()->Execute( 918 SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); 919 } 920 break; 921 } 922 return( 0L ); 923 } 924 925 IMPL_LINK(ParaPropertyPanel, ClickProDemote_Hdl_Impl, ToolBox *, pControl) 926 { 927 switch (pControl->GetCurItemId()) 928 { 929 case BT_TBX_INDENT_PROMOTE: 930 { 931 GetBindings()->GetDispatcher()->Execute( SID_OUTLINE_RIGHT, SFX_CALLMODE_RECORD ); 932 } 933 break; 934 case BT_TBX_INDENT_DEMOTE: 935 { 936 GetBindings()->GetDispatcher()->Execute( SID_OUTLINE_LEFT, SFX_CALLMODE_RECORD ); 937 } 938 break; 939 case SD_HANGING_INDENT: 940 { 941 SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE ); 942 aMargin.SetTxtLeft( (const long)GetCoreValue( *maLeftIndent.get(), m_eLRSpaceUnit ) + (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); 943 aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); 944 aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ))*(-1) ); 945 946 GetBindings()->GetDispatcher()->Execute( SID_ATTR_PARA_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); 947 } 948 break; 949 } 950 return( 0L ); 951 } 952 //==================================for Paragraph Line Spacing===================== 953 954 IMPL_LINK( ParaPropertyPanel, ClickLineSPDropDownHdl_Impl, ToolBox*, pBox ) 955 { 956 957 const sal_uInt16 nId = pBox->GetCurItemId(); 958 OSL_ASSERT(nId == TOOLBOX_ITEM1); 959 if(nId == TOOLBOX_ITEM1) 960 { 961 pBox->SetItemDown( nId, true ); 962 maLineSpacePopup.Rearrange(meLnSpState,m_eMetricUnit,mpLnSPItem,maContext); 963 maLineSpacePopup.Show(*pBox); 964 965 } 966 return (0L); 967 } 968 969 //==================================for Paragraph Spacing===================== 970 IMPL_LINK( ParaPropertyPanel, ULSpaceHdl_Impl, SvxRelativeField*, /* pBox */) 971 { 972 SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE ); 973 aMargin.SetUpper( (sal_uInt16)GetCoreValue( *maTopDist.get(), m_eULSpaceUnit ) ); 974 aMargin.SetLower( (sal_uInt16)GetCoreValue( *maBottomDist.get(), m_eULSpaceUnit ) ); 975 976 GetBindings()->GetDispatcher()->Execute( 977 SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); 978 return 0L; 979 } 980 981 IMPL_LINK(ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl, ToolBox *, pControl) 982 { 983 switch (pControl->GetCurItemId()) 984 { 985 case UL_INCREMENT: 986 { 987 SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE ); 988 989 maUpper += UL_STEP; 990 sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 991 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); 992 aMargin.SetUpper( (const sal_uInt16)nVal ); 993 994 maLower += UL_STEP; 995 nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 996 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); 997 aMargin.SetLower( (const sal_uInt16)nVal ); 998 999 GetBindings()->GetDispatcher()->Execute( 1000 SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); 1001 } 1002 break; 1003 case UL_DECREMENT: 1004 { 1005 SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE ); 1006 1007 if( maUpper >= UL_STEP ) 1008 { 1009 maUpper -= UL_STEP; 1010 sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1011 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); 1012 aMargin.SetUpper( (const sal_uInt16)nVal ); 1013 } 1014 else 1015 aMargin.SetUpper( DEFAULT_VALUE ); 1016 if( maLower >= UL_STEP ) 1017 { 1018 maLower -= UL_STEP; 1019 sal_Int64 nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1020 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); 1021 aMargin.SetLower( (const sal_uInt16)nVal ); 1022 } 1023 else 1024 aMargin.SetLower( DEFAULT_VALUE ); 1025 1026 GetBindings()->GetDispatcher()->Execute( 1027 SID_ATTR_PARA_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); 1028 } 1029 break; 1030 } 1031 return( 0L ); 1032 } 1033 1034 //==================================for Paragraph State change===================== 1035 void ParaPropertyPanel::NotifyItemUpdate( 1036 sal_uInt16 nSID, 1037 SfxItemState eState, 1038 const SfxPoolItem* pState, 1039 const bool bIsEnabled) 1040 { 1041 (void)bIsEnabled; 1042 1043 if( nSID == SID_ATTR_METRIC ) 1044 { 1045 m_eMetricUnit = GetCurrentUnit(eState,pState); 1046 if( m_eMetricUnit!=m_last_eMetricUnit ) 1047 { 1048 SetFieldUnit( *maLeftIndent.get(), m_eMetricUnit ); 1049 SetFieldUnit( *maRightIndent.get(), m_eMetricUnit ); 1050 SetFieldUnit( *maFLineIndent.get(), m_eMetricUnit ); 1051 SetFieldUnit( *maTopDist.get(), m_eMetricUnit ); 1052 SetFieldUnit( *maBottomDist.get(), m_eMetricUnit ); 1053 } 1054 m_last_eMetricUnit = m_eMetricUnit; 1055 } 1056 1057 if( nSID == SID_ATTR_PARA_LRSPACE ) 1058 StateChangedIndentImpl( nSID, eState, pState ); 1059 1060 if( nSID == SID_ATTR_PARA_LINESPACE ) 1061 StateChangedLnSPImpl( nSID, eState, pState ); 1062 1063 if( nSID == SID_ATTR_PARA_ULSPACE) 1064 StateChangedULImpl( nSID, eState, pState ); 1065 1066 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) 1067 StateChangedAlignmentImpl( nSID, eState, pState ); 1068 1069 if (nSID==SID_OUTLINE_LEFT || nSID==SID_OUTLINE_RIGHT) 1070 StateChangeOutLineImpl( nSID, eState, pState ); 1071 1072 if (nSID==SID_INC_INDENT || nSID==SID_DEC_INDENT) 1073 StateChangeIncDecImpl( nSID, eState, pState ); 1074 // Add toggle state for numbering and bullet icons 1075 if (nSID==FN_NUM_NUMBERING_ON || nSID==FN_NUM_BULLET_ON) 1076 StateChangeBulletNumImpl( nSID, eState, pState ); 1077 1078 //Get the num rule index data of the current selection 1079 if ( nSID == FN_BUL_NUM_RULE_INDEX ||nSID == FN_NUM_NUM_RULE_INDEX) 1080 StateChangeBulletNumRuleImpl( nSID, eState, pState ); 1081 1082 if ((nSID == SID_TABLE_VERT_NONE)||(nSID == SID_TABLE_VERT_CENTER)||(nSID == SID_TABLE_VERT_BOTTOM)) 1083 { 1084 VertStateChanged( nSID, eState, pState); 1085 } 1086 else if (nSID == SID_BACKGROUND_COLOR) 1087 { 1088 ParaBKGStateChanged(nSID, eState, pState); 1089 } 1090 } 1091 1092 1093 1094 1095 void ParaPropertyPanel::StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1096 { 1097 if( eState >= SFX_ITEM_AVAILABLE ) 1098 { 1099 const SfxBoolItem* pItem = (const SfxBoolItem*)pState; 1100 bool IsChecked = (bool)pItem->GetValue(); 1101 switch (nSID) 1102 { 1103 case SID_ATTR_PARA_ADJUST_LEFT: 1104 { 1105 if(IsChecked) 1106 { 1107 maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_CHECK); 1108 maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 1109 maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 1110 maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 1111 } 1112 else 1113 maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 1114 } 1115 break; 1116 case SID_ATTR_PARA_ADJUST_CENTER: 1117 { 1118 if(IsChecked) 1119 { 1120 maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_CHECK); 1121 maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 1122 maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 1123 maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 1124 } 1125 else 1126 maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 1127 } 1128 break; 1129 case SID_ATTR_PARA_ADJUST_RIGHT: 1130 { 1131 if(IsChecked) 1132 { 1133 maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_CHECK); 1134 maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 1135 maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 1136 maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 1137 } 1138 else 1139 maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 1140 } 1141 break; 1142 case SID_ATTR_PARA_ADJUST_BLOCK: 1143 { 1144 if(IsChecked) 1145 { 1146 maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_CHECK); 1147 maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 1148 maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 1149 maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 1150 } 1151 else 1152 maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 1153 } 1154 break; 1155 } 1156 } 1157 else if( eState == SFX_ITEM_DISABLED ) 1158 { 1159 } 1160 else if ( eState == SFX_ITEM_DONTCARE ) 1161 { 1162 switch (nSID) 1163 { 1164 case SID_ATTR_PARA_ADJUST_LEFT: 1165 maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 1166 break; 1167 case SID_ATTR_PARA_ADJUST_CENTER: 1168 maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 1169 break; 1170 case SID_ATTR_PARA_ADJUST_RIGHT: 1171 maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 1172 break; 1173 case SID_ATTR_PARA_ADJUST_BLOCK: 1174 maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 1175 break; 1176 } 1177 } 1178 } 1179 1180 void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState ) 1181 { 1182 switch (maContext.GetCombinedContext()) 1183 { 1184 1185 case CombinedEnumContext(Application_Writer, Context_DrawText): 1186 case CombinedEnumContext(Application_Calc, Context_DrawText): 1187 case CombinedEnumContext(Application_Writer, Context_Annotation): 1188 { 1189 maLeftIndent->SetMin( DEFAULT_VALUE ); 1190 maRightIndent->SetMin( DEFAULT_VALUE ); 1191 maFLineIndent->SetMin( DEFAULT_VALUE ); 1192 maTbxIndent_IncDec->Show(); 1193 maTbxProDemote->Hide(); 1194 } 1195 break; 1196 case CombinedEnumContext(Application_Draw, Context_DrawText): 1197 case CombinedEnumContext(Application_Impress, Context_DrawText): 1198 case CombinedEnumContext(Application_Draw, Context_Draw): 1199 case CombinedEnumContext(Application_Draw, Context_TextObject): 1200 case CombinedEnumContext(Application_Draw, Context_Graphic): 1201 case CombinedEnumContext(Application_Impress, Context_Draw): 1202 case CombinedEnumContext(Application_Impress, Context_TextObject): 1203 case CombinedEnumContext(Application_Impress, Context_Graphic): 1204 case CombinedEnumContext(Application_Impress, Context_Table): 1205 case CombinedEnumContext(Application_Draw, Context_Table): 1206 { 1207 maLeftIndent->SetMin( DEFAULT_VALUE ); 1208 maRightIndent->SetMin( DEFAULT_VALUE ); 1209 maFLineIndent->SetMin( DEFAULT_VALUE ); 1210 maTbxIndent_IncDec->Hide(); 1211 maTbxProDemote->Show(); 1212 } 1213 break; 1214 case CombinedEnumContext(Application_Writer, Context_Default): 1215 case CombinedEnumContext(Application_Writer, Context_Text): 1216 case CombinedEnumContext(Application_Writer, Context_Table): 1217 { 1218 maLeftIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM ); 1219 maRightIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM ); 1220 maFLineIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM ); 1221 maTbxIndent_IncDec->Show(); 1222 maTbxProDemote->Hide(); 1223 } 1224 break; 1225 } 1226 1227 if( pState && eState >= SFX_ITEM_AVAILABLE ) 1228 { 1229 SvxLRSpaceItem* pSpace = ( SvxLRSpaceItem*)pState; 1230 maTxtLeft = pSpace->GetTxtLeft(); 1231 maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM ); 1232 maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1233 1234 long aTxtRight = pSpace->GetRight(); 1235 aTxtRight = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM ); 1236 aTxtRight = OutputDevice::LogicToLogic( aTxtRight, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1237 1238 long aTxtFirstLineOfst = pSpace->GetTxtFirstLineOfst(); 1239 aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM ); 1240 aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1241 1242 long nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1243 nVal = (long)maLeftIndent->Normalize( (long)nVal ); 1244 maLeftIndent->SetValue( nVal, FUNIT_100TH_MM ); 1245 1246 if(maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && 1247 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && 1248 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table)) 1249 { 1250 maFLineIndent->SetMin( nVal*(-1), FUNIT_100TH_MM ); 1251 } 1252 1253 long nrVal = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1254 nrVal = (long)maRightIndent->Normalize( (long)nrVal ); 1255 maRightIndent->SetValue( nrVal, FUNIT_100TH_MM ); 1256 1257 long nfVal = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1258 nfVal = (long)maFLineIndent->Normalize( (long)nfVal ); 1259 maFLineIndent->SetValue( nfVal, FUNIT_100TH_MM ); 1260 1261 switch (maContext.GetCombinedContext()) 1262 { 1263 case CombinedEnumContext(Application_Writer, Context_DrawText): 1264 case CombinedEnumContext(Application_Writer, Context_Text): 1265 case CombinedEnumContext(Application_Writer, Context_Default): 1266 case CombinedEnumContext(Application_Writer, Context_Table): 1267 case CombinedEnumContext(Application_Writer, Context_Annotation): 1268 { 1269 maLeftIndent->SetMax( MAX_SW - nrVal, FUNIT_100TH_MM ); 1270 maRightIndent->SetMax( MAX_SW - nVal, FUNIT_100TH_MM ); 1271 maFLineIndent->SetMax( MAX_SW - nVal - nrVal, FUNIT_100TH_MM ); 1272 } 1273 break; 1274 case CombinedEnumContext(Application_Draw, Context_DrawText): 1275 case CombinedEnumContext(Application_Draw, Context_Draw): 1276 case CombinedEnumContext(Application_Draw, Context_Table): 1277 case CombinedEnumContext(Application_Draw, Context_TextObject): 1278 case CombinedEnumContext(Application_Draw, Context_Graphic): 1279 case CombinedEnumContext(Application_Impress, Context_TextObject): 1280 case CombinedEnumContext(Application_Impress, Context_DrawText): 1281 case CombinedEnumContext(Application_Impress, Context_Table): 1282 case CombinedEnumContext(Application_Impress, Context_Draw): 1283 case CombinedEnumContext(Application_Impress, Context_Graphic): 1284 { 1285 maLeftIndent->SetMax( MAX_SC_SD - nrVal, FUNIT_100TH_MM ); 1286 maRightIndent->SetMax( MAX_SC_SD - nVal, FUNIT_100TH_MM ); 1287 maFLineIndent->SetMax( MAX_SC_SD - nVal - nrVal, FUNIT_100TH_MM ); 1288 } 1289 } 1290 1291 maTbxIndent_IncDec->Enable(); 1292 maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_True); 1293 if(maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) 1294 && maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) 1295 && maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table)) 1296 { 1297 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True); 1298 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True); 1299 } 1300 1301 // maTbxProDemote->Enable(); 1302 // if( !mbOutLineRight && !mbOutLineLeft ) 1303 // maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True); 1304 maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True); 1305 } 1306 else if( eState == SFX_ITEM_DISABLED ) 1307 { 1308 maLeftIndent-> Disable(); 1309 maRightIndent->Disable(); 1310 maFLineIndent->Disable(); 1311 maTbxIndent_IncDec->Disable(); 1312 if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && 1313 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && 1314 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) 1315 maTbxIndent_IncDec->Disable(); 1316 else 1317 maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False); 1318 1319 // maTbxProDemote->Disable(); 1320 maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False); 1321 } 1322 else 1323 { 1324 maLeftIndent->SetEmptyFieldValue(); 1325 maRightIndent->SetEmptyFieldValue(); 1326 maFLineIndent->SetEmptyFieldValue(); 1327 if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && 1328 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && 1329 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) 1330 maTbxIndent_IncDec->Disable(); 1331 else 1332 maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False); 1333 // maTbxProDemote->Disable(); 1334 maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False); 1335 } 1336 } 1337 1338 void ParaPropertyPanel::StateChangedLnSPImpl( sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState ) 1339 { 1340 meLnSpState = eState; 1341 1342 if( pState && eState >= SFX_ITEM_AVAILABLE ) 1343 { 1344 if(mpLnSPItem) 1345 delete mpLnSPItem; 1346 mpLnSPItem = ( SvxLineSpacingItem *)pState->Clone(); 1347 } 1348 } 1349 1350 void ParaPropertyPanel::StateChangedULImpl( sal_uInt16 /* nSID */, SfxItemState eState, const SfxPoolItem* pState ) 1351 { 1352 maTopDist->SetMax( maTopDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) ); 1353 maBottomDist->SetMax( maBottomDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) ); 1354 1355 if( pState && eState >= SFX_ITEM_AVAILABLE ) 1356 { 1357 SvxULSpaceItem* pOldItem = (SvxULSpaceItem*)pState; 1358 1359 maUpper = pOldItem->GetUpper(); 1360 maUpper = OutputDevice::LogicToLogic( maUpper, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM ); 1361 maUpper = OutputDevice::LogicToLogic( maUpper, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1362 1363 maLower = pOldItem->GetLower(); 1364 maLower = OutputDevice::LogicToLogic( maLower, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM ); 1365 maLower = OutputDevice::LogicToLogic( maLower, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1366 1367 sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1368 nVal = maTopDist->Normalize( nVal ); 1369 maTopDist->SetValue( nVal, FUNIT_100TH_MM ); 1370 1371 nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1372 nVal = maBottomDist->Normalize( nVal ); 1373 maBottomDist->SetValue( nVal, FUNIT_100TH_MM ); 1374 maTbxUL_IncDec->Enable(); 1375 } 1376 else if(eState == SFX_ITEM_DISABLED ) 1377 { 1378 maTopDist->Disable(); 1379 maBottomDist->Disable(); 1380 maTbxUL_IncDec->Disable(); 1381 } 1382 else 1383 { 1384 maTopDist->SetEmptyFieldValue(); 1385 maBottomDist->SetEmptyFieldValue(); 1386 maTbxUL_IncDec->Disable(); 1387 } 1388 } 1389 1390 void ParaPropertyPanel::StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1391 { 1392 if (nSID==SID_OUTLINE_LEFT) 1393 { 1394 if( pState && eState == SFX_ITEM_UNKNOWN ) 1395 mbOutLineLeft = 1; 1396 else 1397 mbOutLineLeft = 0; 1398 } 1399 if (nSID==SID_OUTLINE_RIGHT) 1400 { 1401 if( pState && eState == SFX_ITEM_UNKNOWN ) 1402 mbOutLineRight = 1; 1403 else 1404 mbOutLineRight = 0; 1405 } 1406 if(mbOutLineLeft) 1407 maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_True); 1408 else 1409 maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_False); 1410 1411 if(mbOutLineRight) 1412 maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_True); 1413 else 1414 maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_False); 1415 1416 // if( !mbOutLineRight && !mbOutLineLeft ) 1417 // { 1418 // maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_True); 1419 // maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_True); 1420 // maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True); 1421 // } 1422 // else 1423 // maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False); 1424 } 1425 1426 void ParaPropertyPanel::StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1427 { 1428 if (nSID==SID_INC_INDENT) 1429 { 1430 if( pState && eState == SFX_ITEM_UNKNOWN ) 1431 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True); 1432 else 1433 if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && 1434 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && 1435 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) 1436 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_False); 1437 } 1438 if (nSID==SID_DEC_INDENT) 1439 { 1440 if( pState && eState == SFX_ITEM_UNKNOWN ) 1441 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True); 1442 else 1443 if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && 1444 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && 1445 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) 1446 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_False); 1447 } 1448 } 1449 // Add toggle state for numbering and bullet icons 1450 void ParaPropertyPanel::StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1451 { 1452 if (nSID==FN_NUM_NUMBERING_ON) 1453 { 1454 if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem))) 1455 { 1456 const SfxBoolItem* pItem= (const SfxBoolItem*)pState; 1457 sal_Bool aBool = (sal_Bool)pItem->GetValue(); 1458 if (aBool) { 1459 maTBxNumBullet->SetItemState(IID_NUMBER, STATE_CHECK); 1460 } else { 1461 maTBxNumBullet->SetItemState(IID_NUMBER, STATE_NOCHECK); 1462 } 1463 } 1464 } 1465 if (nSID==FN_NUM_BULLET_ON) 1466 { 1467 if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem))) 1468 { 1469 const SfxBoolItem* pItem= (const SfxBoolItem*)pState; 1470 sal_Bool aBool = (sal_Bool)pItem->GetValue(); 1471 if (aBool) { 1472 maTBxNumBullet->SetItemState(IID_BULLET, STATE_CHECK); 1473 } else { 1474 maTBxNumBullet->SetItemState(IID_BULLET, STATE_NOCHECK); 1475 } 1476 } 1477 } 1478 } 1479 //Modified for Numbering&Bullets Dialog UX Enh(Story 992) by chengjh,2011.7.5 1480 //Handing the transferred the num rule index data of the current selection 1481 void ParaPropertyPanel::StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState /* eState */, const SfxPoolItem* pState ) 1482 { 1483 1484 const SfxUInt16Item* pIt = (const SfxUInt16Item*)pState; 1485 sal_uInt16 nValue = (sal_uInt16)0xFFFF; 1486 if ( pIt ) 1487 nValue = pIt->GetValue(); 1488 1489 if ( nSID == FN_BUL_NUM_RULE_INDEX ) 1490 { 1491 mnBulletTypeIndex = nValue; 1492 }else if ( nSID == FN_NUM_NUM_RULE_INDEX ) 1493 { 1494 mnNumTypeIndex = nValue; 1495 } 1496 } 1497 //End 1498 FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ) 1499 { 1500 FieldUnit eUnit = FUNIT_NONE; 1501 1502 if ( pState && eState >= SFX_ITEM_DEFAULT ) 1503 eUnit = (FieldUnit)( (const SfxUInt16Item*)pState )->GetValue(); 1504 else 1505 { 1506 SfxViewFrame* pFrame = SfxViewFrame::Current(); 1507 SfxObjectShell* pSh = NULL; 1508 if ( pFrame ) 1509 pSh = pFrame->GetObjectShell(); 1510 if ( pSh ) //the object shell is not always available during reload 1511 { 1512 SfxModule* pModule = pSh->GetModule(); 1513 if ( pModule ) 1514 { 1515 const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); 1516 if ( pItem ) 1517 eUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue(); 1518 } 1519 else 1520 { 1521 DBG_ERRORFILE( "GetModuleFieldUnit(): no module found" ); 1522 } 1523 } 1524 } 1525 1526 return eUnit; 1527 } 1528 //new FixedText(this, SVX_RES(FT_COLOR)) 1529 1530 PopupControl* ParaPropertyPanel::CreateLineSpacingControl (PopupContainer* pParent) 1531 { 1532 return new ParaLineSpacingControl(pParent, *this); 1533 } 1534 1535 PopupControl* ParaPropertyPanel::CreateBulletsPopupControl (PopupContainer* pParent) 1536 { 1537 return new ParaBulletsControl(pParent, *this); 1538 } 1539 1540 PopupControl* ParaPropertyPanel::CreateNumberingPopupControl (PopupContainer* pParent) 1541 { 1542 return new ParaNumberingControl(pParent, *this); 1543 } 1544 1545 namespace 1546 { 1547 Color GetNoBackgroundColor(void) 1548 { 1549 return COL_TRANSPARENT; 1550 } 1551 } // end of anonymous namespace 1552 1553 PopupControl* ParaPropertyPanel::CreateBGColorPopupControl (PopupContainer* pParent) 1554 { 1555 const ResId aResId(SVX_RES(STR_NOFILL)); 1556 1557 return new ColorControl( 1558 pParent, 1559 mpBindings, 1560 SVX_RES(RID_POPUPPANEL_PARAPAGE_BACK_COLOR), 1561 SVX_RES(VS_FONT_COLOR), 1562 ::boost::bind(GetNoBackgroundColor), 1563 ::boost::bind(&ParaPropertyPanel::SetBGColor, this, _1,_2), 1564 pParent, 1565 &aResId); 1566 } 1567 1568 1569 ParaPropertyPanel::ParaPropertyPanel(Window* pParent, 1570 const cssu::Reference<css::frame::XFrame>& /* rxFrame */, 1571 SfxBindings* pBindings, 1572 const cssu::Reference<css::ui::XSidebar>& rxSidebar) 1573 : Control(pParent, SVX_RES(RID_SIDEBAR_PARA_PANEL)), 1574 maAlignToolBoxBackground(ControlFactory::CreateToolBoxBackground(this)), 1575 maAlignToolBox (ControlFactory::CreateToolBox(maAlignToolBoxBackground.get(),SVX_RES(TBX_HORIZONTALALIGNMENT))), 1576 maTBxVertAlignBackground(ControlFactory::CreateToolBoxBackground(this)), 1577 maTBxVertAlign (ControlFactory::CreateToolBox(maTBxVertAlignBackground.get(),SVX_RES(TBX_VERT_ALIGN))), 1578 maTBxNumBulletBackground(ControlFactory::CreateToolBoxBackground(this)), 1579 maTBxNumBullet (ControlFactory::CreateToolBox(maTBxNumBulletBackground.get(),SVX_RES(TBX_NUM_BULLET))), 1580 maTBxBackColorBackground(ControlFactory::CreateToolBoxBackground(this)), 1581 maTBxBackColor (ControlFactory::CreateToolBox(maTBxBackColorBackground.get(),SVX_RES(TBX_BACK_COLOR))), 1582 maFTUL (new FixedText(this, SVX_RES(FT_SPACING))), 1583 maTbxUL_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)), 1584 maTbxUL_IncDec (ControlFactory::CreateToolBox(maTbxUL_IncDecBackground.get(),SVX_RES(TBX_UL_INC_DEC))), 1585 maTopDist (new SvxRelativeField(this, SVX_RES(MF_ABOVE_PARASPACING))), 1586 maBottomDist (new SvxRelativeField(this, SVX_RES(MF_BELOW_PARASPACING))), 1587 maLineSPTbxBackground(ControlFactory::CreateToolBoxBackground(this)), 1588 maLineSPTbx (ControlFactory::CreateToolBox(maLineSPTbxBackground.get(),SVX_RES(TBX_LINESP))), 1589 maFTIndent (new FixedText(this, SVX_RES(FT_INDENT))), 1590 maTbxIndent_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)), 1591 maTbxIndent_IncDec (ControlFactory::CreateToolBox(maTbxIndent_IncDecBackground.get(),SVX_RES(TBX_INDENT_INC_DEC))), 1592 maTbxProDemoteBackground(ControlFactory::CreateToolBoxBackground(this)), 1593 maTbxProDemote (ControlFactory::CreateToolBox(maTbxProDemoteBackground.get(),SVX_RES(TBX_INDENT_PRO_DEMOTE))), 1594 maLeftIndent (new SvxRelativeField(this, SVX_RES(MF_BEFORE_INDENT))), 1595 maRightIndent (new SvxRelativeField(this, SVX_RES(MF_AFTER_INDENT))), 1596 maFLineIndent (new SvxRelativeField(this, SVX_RES(MF_FL_INDENT))), 1597 mpColorUpdater (), 1598 maFISpace1 ( this, SVX_RES( FI_SPACE1)), 1599 maFISpace2 ( this, SVX_RES( FI_SPACE2)), 1600 maFIndent1 ( this, SVX_RES( FI_INDENT1)), 1601 maFIndent2 ( this, SVX_RES( FI_INDENT2)), 1602 maFIndent3 ( this, SVX_RES( FI_INDENT3)), 1603 maSpace1 (SVX_RES(IMG_SPACE1)), 1604 maSpace2 (SVX_RES(IMG_SPACE2)), 1605 maSpace3 (SVX_RES(IMG_SPACE3)), 1606 maIndent1 (SVX_RES(IMG_INDENT1)), 1607 maIndent2 (SVX_RES(IMG_INDENT2)), 1608 maIndent3 (SVX_RES(IMG_INDENT3)), 1609 maLeftPara (SVX_RES(IMG_LEFT_PARA)), 1610 maCentPara (SVX_RES(IMG_CENTER_PARA)), 1611 maRightPara (SVX_RES(IMG_RIGHT_PARA)), 1612 maJusPara (SVX_RES(IMG_JUSTIFY_PARA)), 1613 maIndInc (SVX_RES(IMG_INDENT_INC)), 1614 maIndDec (SVX_RES(IMG_INDENT_DEC)), 1615 maIndInc_BD (SVX_RES(IMG_INDENT_INC_BD)), 1616 maIndDec_BD (SVX_RES(IMG_INDENT_DEC_BD)), 1617 maIndHang (SVX_RES(IMG_INDENT_HANG)), 1618 maParInc (SVX_RES(IMG_PARA_INC)), 1619 maParDec (SVX_RES(IMG_PARA_DEC)), 1620 maVertImageList (SVX_RES(IL_VERT_ALIGN)), 1621 maVertImageListH (SVX_RES(IL_VERT_ALIGN)), 1622 maNumBImageList (SVX_RES(IL_NUM_BULLET)), 1623 maNumBImageListH (SVX_RES(ILH_NUM_BULLET)), 1624 maNumBImageListRTL (SVX_RES(IL_NUM_BULLET_RTL)), 1625 maImgBackColorHigh (SVX_RES(IMG_BACK_COLOR_H)), 1626 maImgBackColor (SVX_RES(IMG_BACK_COLOR)), 1627 maTxtLeft (0), 1628 mpLnSPItem (NULL), 1629 meLnSpState (SFX_ITEM_DONTCARE), 1630 mbOutLineLeft (false), 1631 mbOutLineRight (false), 1632 maUpper (0), 1633 maLower (0), 1634 mnBulletTypeIndex ((sal_uInt16)0xFFFF), 1635 mnNumTypeIndex ((sal_uInt16)0xFFFF), 1636 maColor (COL_AUTO), 1637 mbColorAvailable (true), 1638 //, m_eMetricUnit (FUNIT_INCH) 1639 //, m_last_eMetricUnit (FUNIT_INCH) 1640 m_eLRSpaceUnit(), 1641 m_eULSpaceUnit(), 1642 maLeftAlignControl (SID_ATTR_PARA_ADJUST_LEFT, *pBindings,*this), 1643 maCenterAlignControl (SID_ATTR_PARA_ADJUST_CENTER, *pBindings,*this), 1644 maRightAlignControl (SID_ATTR_PARA_ADJUST_RIGHT, *pBindings,*this), 1645 maJustifyAlignControl (SID_ATTR_PARA_ADJUST_BLOCK, *pBindings,*this), 1646 maLRSpaceControl (SID_ATTR_PARA_LRSPACE,*pBindings,*this), 1647 maLNSpaceControl (SID_ATTR_PARA_LINESPACE, *pBindings,*this), 1648 maULSpaceControl (SID_ATTR_PARA_ULSPACE, *pBindings,*this), 1649 maOutLineLeftControl (SID_OUTLINE_LEFT, *pBindings,*this), 1650 maOutLineRightControl (SID_OUTLINE_RIGHT, *pBindings,*this), 1651 maDecIndentControl (SID_DEC_INDENT, *pBindings,*this), 1652 maIncIndentControl (SID_INC_INDENT, *pBindings,*this), 1653 maVertTop (SID_TABLE_VERT_NONE, *pBindings,*this), 1654 maVertCenter (SID_TABLE_VERT_CENTER, *pBindings,*this), 1655 maVertBottom (SID_TABLE_VERT_BOTTOM,*pBindings,*this), 1656 maBulletOnOff (FN_NUM_BULLET_ON, *pBindings,*this), 1657 maNumberOnOff (FN_NUM_NUMBERING_ON, *pBindings,*this), 1658 maBackColorControl (SID_BACKGROUND_COLOR, *pBindings,*this), 1659 m_aMetricCtl (SID_ATTR_METRIC, *pBindings,*this), 1660 maBulletNumRuleIndex (FN_BUL_NUM_RULE_INDEX, *pBindings,*this), 1661 maNumNumRuleIndex (FN_NUM_NUM_RULE_INDEX, *pBindings,*this), 1662 maContext(), 1663 mpBindings(pBindings), 1664 maLineSpacePopup(this, ::boost::bind(&ParaPropertyPanel::CreateLineSpacingControl, this, _1)), 1665 maBulletsPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBulletsPopupControl, this, _1)), 1666 maNumberingPopup(this, ::boost::bind(&ParaPropertyPanel::CreateNumberingPopupControl, this, _1)), 1667 maBGColorPopup(this, ::boost::bind(&ParaPropertyPanel::CreateBGColorPopupControl, this, _1)), 1668 mxSidebar(rxSidebar) 1669 { 1670 initial(); 1671 FreeResource(); 1672 } 1673 1674 } } // end of namespace svx::sidebar 1675