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