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 24 #include "ParaPropertyPanel.hxx" 25 #include "ParaPropertyPanel.hrc" 26 27 #include "ParaLineSpacingPopup.hxx" 28 #include "ParaLineSpacingControl.hxx" 29 #include <sfx2/sidebar/Theme.hxx> 30 #include <sfx2/sidebar/propertypanel.hrc> 31 #include <sfx2/sidebar/ControlFactory.hxx> 32 #include <svx/sidebar/PopupContainer.hxx> 33 #include <sfx2/dispatch.hxx> 34 #include <editeng/colritem.hxx> 35 #include <editeng/brshitem.hxx> 36 #include <editeng/lrspitem.hxx> 37 #include <editeng/ulspitem.hxx> 38 #include <vcl/toolbox.hxx> 39 #include <vcl/fixed.hxx> 40 #include <vcl/svapp.hxx> 41 #include <svx/svxids.hrc> 42 #include <svl/intitem.hxx> 43 #include "svx/dialmgr.hxx" 44 #include <sfx2/objsh.hxx> 45 #include <svtools/unitconv.hxx> 46 #include <boost/bind.hpp> 47 using namespace css; 48 using namespace cssu; 49 using ::sfx2::sidebar::Theme; 50 using ::sfx2::sidebar::ControlFactory; 51 52 #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) 53 54 55 namespace svx {namespace sidebar { 56 #define DEFAULT_VALUE 0 57 #define TOOLBOX_ITEM1 1 58 #define TOOLBOX_ITEM2 2 59 #define TOOLBOX_ITEM3 3 60 #define TOOLBOX_ITEM4 4 61 62 #define MAX_DURCH 5670 63 64 #define INDENT_INCREMENT 1 65 #define INDENT_DECREMENT 2 66 #define INDENT_STEP 706 67 #define UL_STEP 58 68 #define UL_INCREMENT 1 69 #define UL_DECREMENT 2 70 71 #define NEGATIVE_MAX_VALUE -9999 72 #define BEGIN_VALUE 28 73 #define MAX_SW 1709400 74 #define MAX_SC_SD 116220200 75 #define NEGA_MAXVALUE -10000000 76 77 #define POS_FT_PARA_SPACE Point(LogicToPixel(Point(FT_PARA_SPACE_X,FT_PARA_SPACE_Y), MAP_APPFONT)) 78 #define POS_FT_PARA_SPACE2 Point(LogicToPixel(Point(FT_PARA_SPACE_X,FT_PARA_SPACE_Y2), MAP_APPFONT)) 79 #define POS_TBX_PARA_SPACE_INC_DEC Point(LogicToPixel(Point(TBX_PARA_SPACE_INC_DEC_X,TBX_PARA_SPACE_INC_DEC_Y), MAP_APPFONT)) 80 #define POS_TBX_PARA_SPACE_INC_DEC2 Point(LogicToPixel(Point(TBX_PARA_SPACE_INC_DEC_X,TBX_PARA_SPACE_INC_DEC_Y2), MAP_APPFONT)) 81 #define POS_FT_PARA_INDENT Point(LogicToPixel(Point(FT_PARA_INDENT_X,FT_PARA_INDENT_Y), MAP_APPFONT)) 82 #define POS_FT_PARA_INDENT2 Point(LogicToPixel(Point(FT_PARA_INDENT_X,FT_PARA_INDENT_Y2), MAP_APPFONT)) 83 #define POS_TBX_PARA_INDENT_INC_DEC Point(LogicToPixel(Point(TBX_PARA_INDENT_INC_DEC_X,TBX_PARA_INDENT_INC_DEC_Y), MAP_APPFONT)) 84 #define POS_TBX_PARA_INDENT_INC_DEC2 Point(LogicToPixel(Point(TBX_PARA_INDENT_INC_DEC_X,TBX_PARA_INDENT_INC_DEC_Y2), MAP_APPFONT)) 85 #define POS_MBX_TOP_DIST Point(LogicToPixel(Point(MBX_TOP_DIST_X,MBX_TOP_DIST_Y), MAP_APPFONT)) 86 #define POS_MBX_TOP_DIST2 Point(LogicToPixel(Point(MBX_TOP_DIST_X,MBX_TOP_DIST_Y2), MAP_APPFONT)) 87 #define POS_MBX_BOT_DIST Point(LogicToPixel(Point(MBX_BOT_DIST_X,MBX_BOT_DIST_Y), MAP_APPFONT)) 88 #define POS_MBX_BOT_DIST2 Point(LogicToPixel(Point(MBX_BOT_DIST_X,MBX_BOT_DIST_Y2), MAP_APPFONT)) 89 #define POS_MBX_LEFT_DIST Point(LogicToPixel(Point(MBX_LEFT_DIST_X,MBX_LEFT_DIST_Y), MAP_APPFONT)) 90 #define POS_MBX_LEFT_DIST2 Point(LogicToPixel(Point(MBX_LEFT_DIST_X,MBX_LEFT_DIST_Y2), MAP_APPFONT)) 91 #define POS_MBX_RIGHT_DIST Point(LogicToPixel(Point(MBX_RIGHT_DIST_X,MBX_RIGHT_DIST_Y), MAP_APPFONT)) 92 #define POS_MBX_RIGHT_DIST2 Point(LogicToPixel(Point(MBX_RIGHT_DIST_X,MBX_RIGHT_DIST_Y2), MAP_APPFONT)) 93 #define POS_MBX_FLINE_DIST Point(LogicToPixel(Point(MBX_FLINE_DIST_X,MBX_FLINE_DIST_Y), MAP_APPFONT)) 94 #define POS_MBX_FLINE_DIST2 Point(LogicToPixel(Point(MBX_FLINE_DIST_X,MBX_FLINE_DIST_Y2), MAP_APPFONT)) 95 #define POS_IMG_SPACE1 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE1_Y), MAP_APPFONT)) 96 #define POS_IMG_SPACE12 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE1_Y2), MAP_APPFONT)) 97 #define POS_IMG_SPACE2 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE2_Y), MAP_APPFONT)) 98 #define POS_IMG_SPACE22 Point(LogicToPixel(Point(IMG_SPACE_X,IMG_SPACE2_Y2), MAP_APPFONT)) 99 #define POS_IMG_INDENT1 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT1_Y), MAP_APPFONT)) 100 #define POS_IMG_INDENT12 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT1_Y2), MAP_APPFONT)) 101 #define POS_IMG_INDENT2 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT2_Y), MAP_APPFONT)) 102 #define POS_IMG_INDENT22 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT2_Y2), MAP_APPFONT)) 103 #define POS_IMG_INDENT3 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT3_Y), MAP_APPFONT)) 104 #define POS_IMG_INDENT32 Point(LogicToPixel(Point(IMG_INDENT_X,IMG_INDENT3_Y2), MAP_APPFONT)) 105 #define TBX_LINE_SPACE Point(LogicToPixel(Point(TBX_LINE_SPACE_X,TBX_LINE_SPACE_Y), MAP_APPFONT)) 106 #define TBX_LINE_SPACE2 Point(LogicToPixel(Point(TBX_LINE_SPACE_X,TBX_LINE_SPACE_Y2), MAP_APPFONT)) 107 108 #define LINE_POINT1_WHITE Point(LogicToPixel(Point(LINE_X_WHITE,LINE_TOP_Y), MAP_APPFONT)) 109 #define LINE_POINT2_WHITE Point(LogicToPixel(Point(LINE_X_WHITE,LINE_BOT_Y), MAP_APPFONT)) 110 #define LINE_POINT3_WHITE Point(LogicToPixel(Point(LINE_X_WHITE,LINE_TOP_Y2), MAP_APPFONT)) 111 #define LINE_POINT4_WHITE Point(LogicToPixel(Point(LINE_X_WHITE,LINE_BOT_Y2), MAP_APPFONT)) 112 113 ParaPropertyPanel* ParaPropertyPanel::Create ( 114 Window* pParent, 115 const cssu::Reference<css::frame::XFrame>& rxFrame, 116 SfxBindings* pBindings) 117 { 118 if (pParent == NULL) 119 throw lang::IllegalArgumentException(A2S("no parent Window given to ParaPropertyPanel::Create"), NULL, 0); 120 if ( ! rxFrame.is()) 121 throw lang::IllegalArgumentException(A2S("no XFrame given to ParaPropertyPanel::Create"), NULL, 1); 122 if (pBindings == NULL) 123 throw lang::IllegalArgumentException(A2S("no SfxBindings given to ParaPropertyPanel::Create"), NULL, 2); 124 125 return new ParaPropertyPanel( 126 pParent, 127 rxFrame, 128 pBindings); 129 } 130 131 void ParaPropertyPanel::HandleContextChange ( 132 const ::sfx2::sidebar::EnumContext aContext) 133 { 134 if (maContext == aContext) 135 { 136 // Nothing to do. 137 return; 138 } 139 140 maContext = aContext; 141 switch (maContext.GetCombinedContext()) 142 { 143 case CombinedEnumContext(Application_Calc, Context_DrawText): 144 { 145 maTBxVertAlign->Show(); 146 maTBxVertAlignBackground->Show(); 147 maTBxBackColor->Hide(); 148 maTBxBackColorBackground->Hide(); 149 maTBxNumBullet->Hide(); 150 maTBxNumBulletBackground->Hide(); 151 ReSize(0); 152 maTbxIndent_IncDec->Show(); 153 maTbxIndent_IncDecBackground->Show(); 154 maTbxProDemote->Hide(); 155 maTbxProDemoteBackground->Hide(); 156 } 157 break; 158 case CombinedEnumContext(Application_Draw, Context_Draw): 159 case CombinedEnumContext(Application_Draw, Context_TextObject): 160 case CombinedEnumContext(Application_Draw, Context_Graphic): 161 case CombinedEnumContext(Application_Impress, Context_Draw): 162 case CombinedEnumContext(Application_Impress, Context_TextObject): 163 case CombinedEnumContext(Application_Impress, Context_Graphic): 164 { 165 maTBxVertAlign->Hide(); 166 maTBxVertAlignBackground->Hide(); 167 maTBxBackColor->Hide(); 168 maTBxBackColorBackground->Hide(); 169 maTBxNumBullet->Show(); 170 maTBxNumBulletBackground->Show(); 171 ReSize(1); 172 maTbxIndent_IncDec->Hide(); 173 maTbxIndent_IncDecBackground->Hide(); 174 maTbxProDemote->Show(); 175 maTbxProDemoteBackground->Show(); 176 } 177 break; 178 case CombinedEnumContext(Application_Draw, Context_DrawText): 179 case CombinedEnumContext(Application_Impress, Context_DrawText): 180 { 181 maTBxVertAlign->Show(); 182 maTBxVertAlignBackground->Show(); 183 maTBxBackColor->Hide(); 184 maTBxBackColorBackground->Hide(); 185 maTBxNumBullet->Show(); 186 maTBxNumBulletBackground->Show(); 187 ReSize(1); 188 maTbxIndent_IncDec->Hide(); 189 maTbxIndent_IncDecBackground->Hide(); 190 maTbxProDemote->Show(); 191 maTbxProDemoteBackground->Show(); 192 } 193 break; 194 case CombinedEnumContext(Application_Impress, Context_Table): 195 case CombinedEnumContext(Application_Draw, Context_Table): 196 { 197 maTBxVertAlign->Show(); 198 maTBxVertAlignBackground->Show(); 199 maTBxBackColor->Hide(); 200 maTBxBackColorBackground->Hide(); 201 maTBxNumBullet->Show(); 202 maTBxNumBulletBackground->Show(); 203 ReSize(1); 204 maTbxIndent_IncDec->Hide(); 205 maTbxIndent_IncDecBackground->Hide(); 206 maTbxProDemote->Show(); 207 maTbxProDemoteBackground->Show(); 208 } 209 break; 210 case CombinedEnumContext(Application_Writer, Context_Default): 211 case CombinedEnumContext(Application_Writer, Context_Text): 212 { 213 maTBxVertAlign->Hide(); 214 maTBxVertAlignBackground->Hide(); 215 maTBxBackColor->Show(); 216 maTBxBackColorBackground->Show(); 217 maTBxNumBullet->Show(); 218 219 maTBxNumBulletBackground->Show(); 220 ReSize(1); 221 maTbxIndent_IncDec->Show(); 222 maTbxIndent_IncDecBackground->Show(); 223 maTbxProDemote->Hide(); 224 maTbxProDemoteBackground->Hide(); 225 } 226 break; 227 case CombinedEnumContext(Application_Writer, Context_Table): 228 { 229 maTBxVertAlign->Show(); 230 maTBxVertAlignBackground->Show(); 231 maTBxBackColor->Show(); 232 maTBxBackColorBackground->Show(); 233 maTBxNumBullet->Show(); 234 maTBxNumBulletBackground->Show(); 235 ReSize(1); 236 maTbxIndent_IncDec->Show(); 237 maTbxIndent_IncDecBackground->Show(); 238 maTbxProDemote->Hide(); 239 maTbxProDemoteBackground->Hide(); 240 } 241 break; 242 case CombinedEnumContext(Application_Writer, Context_DrawText): 243 { 244 maTBxVertAlign->Show(); 245 maTBxVertAlignBackground->Show(); 246 maTBxBackColor->Hide(); 247 maTBxBackColorBackground->Hide(); 248 maTBxNumBullet->Hide(); 249 maTBxNumBulletBackground->Hide(); 250 ReSize(0); 251 maTbxIndent_IncDec->Show(); 252 maTbxIndent_IncDecBackground->Show(); 253 maTbxProDemote->Hide(); 254 maTbxProDemoteBackground->Hide(); 255 } 256 break; 257 case CombinedEnumContext(Application_Writer, Context_Annotation): 258 { 259 maTBxVertAlign->Hide(); 260 maTBxVertAlignBackground->Hide(); 261 maTBxBackColor->Hide(); 262 maTBxBackColorBackground->Hide(); 263 maTBxNumBullet->Hide(); 264 maTBxNumBulletBackground->Hide(); 265 ReSize(0); 266 maTbxIndent_IncDec->Show(); 267 maTbxIndent_IncDecBackground->Show(); 268 maTbxProDemote->Hide(); 269 maTbxProDemoteBackground->Hide(); 270 } 271 break; 272 case CombinedEnumContext(Application_Calc, Context_EditCell): 273 case CombinedEnumContext(Application_Draw, Context_Text): 274 case CombinedEnumContext(Application_Draw, Context_OutlineText): 275 case CombinedEnumContext(Application_Calc, Context_Cell): 276 case CombinedEnumContext(Application_Calc, Context_Pivot): 277 case CombinedEnumContext(Application_Impress, Context_Text): 278 case CombinedEnumContext(Application_Impress, Context_OutlineText): 279 /*{ 280 mpToolBoxScriptSw->Hide(); 281 mpToolBoxScript->Show(); 282 mpToolBoxSpacing->Show(); 283 mpToolBoxHighlight->Hide(); 284 285 Size aSize(PROPERTYPAGE_WIDTH,TEXT_SECTIONPAGE_HEIGHT); 286 aSize = LogicToPixel( aSize,MapMode(MAP_APPFONT) ); 287 aSize.setWidth(GetOutputSizePixel().Width()); 288 SetSizePixel(aSize); 289 break; 290 }*/ 291 292 default: 293 break; 294 } 295 } 296 297 SfxBindings* ParaPropertyPanel::GetBindings() 298 { 299 return mpBindings; 300 } 301 302 void ParaPropertyPanel::SetupIcons (void) 303 { 304 if (Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) 305 { 306 } 307 else 308 { 309 } 310 } 311 312 void ParaPropertyPanel::DataChanged (const DataChangedEvent& rEvent) 313 { 314 (void)rEvent; 315 316 SetupIcons(); 317 } 318 319 ParaPropertyPanel::~ParaPropertyPanel() 320 { 321 delete mpLnSPItem; 322 } 323 324 void ParaPropertyPanel::ReSize(bool bSize) 325 { 326 if(bSize) 327 { 328 //Paragraph spacing 329 maFTUL->SetPosPixel(POS_FT_PARA_SPACE); 330 maTbxUL_IncDec->SetPosPixel(POS_TBX_PARA_SPACE_INC_DEC); 331 maTopDist->SetPosPixel(POS_MBX_TOP_DIST); 332 maBottomDist->SetPosPixel(POS_MBX_BOT_DIST); 333 //Indent 334 maFTIndent->SetPosPixel(POS_FT_PARA_INDENT); 335 maTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC); 336 maTbxProDemote->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC); 337 maLeftIndent->SetPosPixel(POS_MBX_LEFT_DIST); 338 maRightIndent->SetPosPixel(POS_MBX_RIGHT_DIST); 339 maFLineIndent->SetPosPixel(POS_MBX_FLINE_DIST); 340 //Line spacing 341 maLineSPTbx->SetPosPixel(TBX_LINE_SPACE); 342 //image 343 maFISpace1.SetPosPixel(POS_IMG_SPACE1); 344 maFISpace2.SetPosPixel(POS_IMG_SPACE2); 345 maFIndent1.SetPosPixel(POS_IMG_INDENT1); 346 maFIndent2.SetPosPixel(POS_IMG_INDENT2); 347 maFIndent3.SetPosPixel(POS_IMG_INDENT3); 348 Size aSize(GetOutputSizePixel().Width(),PARA_SECTIONPAGE_HEIGHT); 349 aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 350 aSize.setWidth(GetOutputSizePixel().Width()); 351 SetSizePixel(aSize); 352 } 353 else 354 { 355 //Paragraph spacing 356 maFTUL->SetPosPixel(POS_FT_PARA_SPACE2); 357 maTbxUL_IncDec->SetPosPixel(POS_TBX_PARA_SPACE_INC_DEC2); 358 maTopDist->SetPosPixel(POS_MBX_TOP_DIST2); 359 maBottomDist->SetPosPixel(POS_MBX_BOT_DIST2); 360 //Indent 361 maFTIndent->SetPosPixel(POS_FT_PARA_INDENT2); 362 maTbxIndent_IncDec->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC2); 363 maTbxProDemote->SetPosPixel(POS_TBX_PARA_INDENT_INC_DEC2); 364 maLeftIndent->SetPosPixel(POS_MBX_LEFT_DIST2); 365 maRightIndent->SetPosPixel(POS_MBX_RIGHT_DIST2); 366 maFLineIndent->SetPosPixel(POS_MBX_FLINE_DIST2); 367 //Line spacing 368 maLineSPTbx->SetPosPixel(TBX_LINE_SPACE2); 369 //image 370 maFISpace1.SetPosPixel(POS_IMG_SPACE12); 371 maFISpace2.SetPosPixel(POS_IMG_SPACE22); 372 maFIndent1.SetPosPixel(POS_IMG_INDENT12); 373 maFIndent2.SetPosPixel(POS_IMG_INDENT22); 374 maFIndent3.SetPosPixel(POS_IMG_INDENT32); 375 Size aSize(GetOutputSizePixel().Width(),PARA_SECTIONPAGE_HEIGHT_2); 376 aSize = LogicToPixel( aSize, MapMode(MAP_APPFONT) ); 377 aSize.setWidth(GetOutputSizePixel().Width()); 378 SetSizePixel(aSize); 379 } 380 } 381 382 void ParaPropertyPanel::EndSpacingPopupMode (void) 383 { 384 maLineSpacePopup.Hide(); 385 } 386 387 void ParaPropertyPanel::EndBulletsPopupMode (void) 388 { 389 //maUnderlinePopup.Hide(); 390 } 391 392 void ParaPropertyPanel::EndNumberingPopupMode (void) 393 { 394 //maUnderlinePopup.Hide(); 395 } 396 397 398 void ParaPropertyPanel::InitToolBoxAlign() 399 { 400 maAlignToolBox->SetItemImage(TOOLBOX_ITEM1,maLeftPara); 401 maAlignToolBox->SetItemImage(TOOLBOX_ITEM2,maCentPara); 402 maAlignToolBox->SetItemImage(TOOLBOX_ITEM3,maRightPara); 403 maAlignToolBox->SetItemImage(TOOLBOX_ITEM4,maJusPara); 404 Link aLink = LINK( this, ParaPropertyPanel, AlignStyleModifyHdl_Impl ); 405 maAlignToolBox->SetSelectHdl( aLink ); 406 Size aTbxSize (maAlignToolBox->CalcWindowSizePixel()); 407 maAlignToolBox->SetOutputSizePixel( aTbxSize ); 408 } 409 410 void ParaPropertyPanel::InitToolBoxVertAlign() 411 { 412 InitImageList(maTBxVertAlign, maVertImageList, maVertImageListH); 413 maTBxVertAlign->SetSelectHdl(LINK(this,ParaPropertyPanel,VertTbxSelectHandler)); 414 Size aTbxSize (maTBxVertAlign->CalcWindowSizePixel()); 415 maTBxVertAlign->SetOutputSizePixel( aTbxSize ); 416 } 417 418 419 void ParaPropertyPanel::InitToolBoxIndent() 420 { 421 Link aLink = LINK( this, ParaPropertyPanel, ModifyIndentHdl_Impl ); 422 maLeftIndent->SetModifyHdl( aLink ); 423 maRightIndent->SetModifyHdl( aLink ); 424 maFLineIndent->SetModifyHdl( aLink ); 425 426 if( Application::GetSettings().GetLayoutRTL()) 427 { 428 maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM1,maIndInc_BD); 429 maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM2,maIndDec_BD); 430 } 431 else 432 { 433 maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM1,maIndInc); 434 maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM2,maIndDec); 435 } 436 maTbxIndent_IncDec->SetItemImage(TOOLBOX_ITEM3,maIndHang); 437 aLink = LINK( this, ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl ); 438 maTbxIndent_IncDec->SetSelectHdl(aLink); 439 m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric(); 440 Size aTbxSize = maTbxIndent_IncDec->CalcWindowSizePixel(); 441 maTbxIndent_IncDec->SetOutputSizePixel( aTbxSize ); 442 443 if( Application::GetSettings().GetLayoutRTL()) 444 { 445 maTbxProDemote->SetItemImage(TOOLBOX_ITEM1,maIndInc_BD); 446 maTbxProDemote->SetItemImage(TOOLBOX_ITEM2,maIndDec_BD); 447 } 448 else 449 { 450 maTbxProDemote->SetItemImage(TOOLBOX_ITEM1,maIndInc); 451 maTbxProDemote->SetItemImage(TOOLBOX_ITEM2,maIndDec); 452 } 453 maTbxProDemote->SetItemImage(TOOLBOX_ITEM3,maIndHang); 454 aLink = LINK( this, ParaPropertyPanel, ClickProDemote_Hdl_Impl ); 455 maTbxProDemote->SetSelectHdl(aLink); 456 m_eLRSpaceUnit = maLRSpaceControl.GetCoreMetric(); 457 aTbxSize = maTbxProDemote->CalcWindowSizePixel(); 458 maTbxProDemote->SetOutputSizePixel( aTbxSize ); 459 } 460 461 void ParaPropertyPanel::InitToolBoxBGColor() 462 { 463 mpColorUpdater.reset(new ::svx::ToolboxButtonColorUpdater(SID_BACKGROUND_COLOR, TBI_BACK_COLOR, maTBxBackColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW )); 464 465 maTBxBackColor->SetItemImage(TBI_BACK_COLOR, GetDisplayBackground().GetColor().IsDark()? maImgBackColorHigh : maImgBackColor); 466 maTBxBackColor->SetItemBits( TBI_BACK_COLOR, maTBxBackColor->GetItemBits( TBI_BACK_COLOR ) | TIB_DROPDOWNONLY ); 467 468 Link aLink = LINK(this, ParaPropertyPanel, ToolBoxBackColorDDHandler); 469 maTBxBackColor->SetDropdownClickHdl ( aLink ); 470 maTBxBackColor->SetSelectHdl ( aLink ); 471 Size aTbxSize (maTBxBackColor->CalcWindowSizePixel()); 472 maTBxBackColor->SetOutputSizePixel( aTbxSize ); 473 } 474 475 void ParaPropertyPanel::InitToolBoxBulletsNumbering() 476 { 477 if( Application::GetSettings().GetLayoutRTL())//sym2_7380 478 { 479 maTBxNumBullet->SetItemImage( IID_BULLET, maNumBImageListRTL.GetImage( IID_BULLET ) ); 480 maTBxNumBullet->SetItemImage( IID_NUMBER, maNumBImageListRTL.GetImage( IID_NUMBER ) ); 481 } 482 else 483 InitImageList(maTBxNumBullet, maNumBImageList, maNumBImageListH); 484 485 maTBxNumBullet->SetDropdownClickHdl(LINK(this,ParaPropertyPanel,NumBTbxDDHandler)); 486 maTBxNumBullet->SetSelectHdl(LINK(this,ParaPropertyPanel,NumBTbxSelectHandler)); 487 Size aTbxSize (maTBxNumBullet->CalcWindowSizePixel()); 488 maTBxNumBullet->SetOutputSizePixel( aTbxSize ); 489 } 490 void ParaPropertyPanel::InitToolBoxSpacing() 491 { 492 Link aLink = LINK( this, ParaPropertyPanel, ULSpaceHdl_Impl ); 493 maTopDist->SetModifyHdl(aLink); 494 maBottomDist->SetModifyHdl( aLink ); 495 496 maTbxUL_IncDec->SetItemImage(TOOLBOX_ITEM1,maParInc); 497 maTbxUL_IncDec->SetItemImage(TOOLBOX_ITEM2,maParDec); 498 aLink = LINK( this, ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl ); 499 maTbxUL_IncDec->SetSelectHdl(aLink); 500 m_eULSpaceUnit = maULSpaceControl.GetCoreMetric(); 501 Size aTbxSize = maTbxUL_IncDec->CalcWindowSizePixel(); 502 maTbxUL_IncDec->SetOutputSizePixel( aTbxSize ); 503 } 504 void ParaPropertyPanel::InitToolBoxLineSpacing() 505 { 506 Link aLink = LINK( this, ParaPropertyPanel, ClickLineSPDropDownHdl_Impl ); 507 maLineSPTbx->SetDropdownClickHdl( aLink ); 508 maLineSPTbx->SetSelectHdl( aLink ); //support keyinput "ENTER" 509 maLineSPTbx->SetItemBits( TOOLBOX_ITEM1, maLineSPTbx->GetItemBits( TOOLBOX_ITEM1 ) | TIB_DROPDOWNONLY ); 510 maLineSPTbx->SetItemImage(TOOLBOX_ITEM1,maSpace3); 511 Size aTbxSize = maLineSPTbx->CalcWindowSizePixel(); 512 maLineSPTbx->SetOutputSizePixel( aTbxSize ); 513 } 514 515 void ParaPropertyPanel::initial() 516 { 517 maFISpace1.SetImage(maSpace1); 518 maFISpace2.SetImage(maSpace2); 519 maFIndent1.SetImage(maIndent3); 520 maFIndent2.SetImage(maIndent2); 521 maFIndent3.SetImage(maIndent1); 522 523 GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_LEFT,sal_True,sal_False); 524 GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_CENTER,sal_True,sal_False); 525 GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_RIGHT,sal_True,sal_False); 526 GetBindings()->Invalidate(SID_ATTR_PARA_ADJUST_BLOCK,sal_True,sal_False); 527 528 //toolbox 529 SetupIcons(); 530 InitToolBoxAlign(); 531 InitToolBoxVertAlign(); 532 InitToolBoxIndent(); 533 InitToolBoxBGColor(); 534 InitToolBoxBulletsNumbering(); 535 InitToolBoxSpacing(); 536 InitToolBoxLineSpacing(); 537 538 #ifdef HAS_IA2 539 maAlignToolBox->SetAccRelationLabeledBy(&maAlignToolBox); 540 maTBxVertAlign->SetMpSubEditAccLableBy(&maTBxVertAlign); 541 maTBxNumBullet->SetAccRelationLabeledBy(&maTBxNumBullet); 542 maTBxBackColor->SetMpSubEditAccLableBy(&maTBxBackColor); 543 maFTUL->SetAccRelationLabeledBy(&maFTUL); 544 maTbxUL_IncDec->SetAccRelationLabeledBy(&maTbxUL_IncDec); 545 maTopDist->SetAccRelationLabeledBy(&maTopDist); 546 maBottomDist->SetAccRelationLabeledBy(&maBottomDist); 547 maLineSPTbx->SetAccRelationLabeledBy(&maLineSPTbx); 548 maFTIndent->SetAccRelationLabeledBy(&maFTIndent); 549 maTbxIndent_IncDec->SetAccRelationLabeledBy(&maTbxIndent_IncDec); 550 maTbxProDemote->SetAccRelationLabeledBy(&maTbxProDemote); 551 maLeftIndent->SetAccRelationLabeledBy(&maLeftIndent); 552 maRightIndent->SetAccRelationLabeledBy(&maRightIndent); 553 maFLineIndent->SetAccRelationLabeledBy(&maFLineIndent); 554 mpColorUpdater->SetAccRelationLabeledBy(&mpColorUpdater); 555 #endif 556 } 557 558 void ParaPropertyPanel::InitImageList(::boost::scoped_ptr<ToolBox>& rTbx, ImageList& rImglst, ImageList& rImgHlst) 559 { 560 sal_Bool bHighContrast = GetDisplayBackground().GetColor().IsDark(); 561 562 ImageList& rImgLst = bHighContrast ? rImgHlst : rImglst; 563 564 sal_uInt16 nCount = rTbx->GetItemCount(); 565 for (sal_uInt16 i = 0; i < nCount; i++) 566 { 567 sal_uInt16 nId = rTbx->GetItemId(i); 568 rTbx->SetItemImage( nId, rImgLst.GetImage( nId ) ); 569 } 570 } 571 572 //===========================for Numbering & Bullet================================================ 573 574 575 576 IMPL_LINK(ParaPropertyPanel, NumBTbxDDHandler, ToolBox*, pToolBox) 577 { 578 sal_uInt16 nId = pToolBox->GetCurItemId(); 579 580 EndTracking(); 581 pToolBox->SetItemDown( nId, sal_True ); 582 583 if (nId == 1) 584 { 585 /*SvxParaBulletPage* pBulletPage = GetBulletPage(); 586 pBulletPage->UpdateValueSet(); 587 Size aFloatSz = pBulletPage->GetOutputSizePixel(); 588 GetBulletFloatWin()->SetSizePixel( aFloatSz ); 589 590 Point aPos=maTBxNumBullet->GetPosPixel(); 591 aPos = OutputToScreenPixel( aPos ); 592 Size aSize = maTBxNumBullet->GetSizePixel(); 593 Rectangle aRect( aPos, aSize ); 594 GetBulletFloatWin()->StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_NOFOCUSCLOSE); 595 GetBulletFloatWin()->SetPopupModeFlags(GetBulletFloatWin()->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ); 596 GetBulletPage()->ToGetFocus();*/ 597 } 598 else if (nId == 2) 599 { 600 /*SvxParaNumberPage* pNumberPage = GetNumberPage(); 601 pNumberPage->UpdateValueSet(); 602 Size aFloatSz = pNumberPage->GetOutputSizePixel(); 603 GetNumberFloatWin()->SetSizePixel( aFloatSz ); 604 605 Point aPos=maTBxNumBullet->GetPosPixel(); 606 aPos = OutputToScreenPixel( aPos ); 607 Size aSize = maTBxNumBullet->GetSizePixel(); 608 Rectangle aRect( aPos, aSize ); 609 610 GetNumberFloatWin()->StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_NOFOCUSCLOSE); 611 GetNumberFloatWin()->SetPopupModeFlags(GetNumberFloatWin()->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ); 612 GetNumberPage()->ToGetFocus();*/ 613 } 614 pToolBox->SetItemDown( nId, sal_False ); 615 return 0; 616 } 617 618 IMPL_LINK(ParaPropertyPanel, NumBTbxSelectHandler, ToolBox*, pToolBox) 619 { 620 sal_uInt16 nId = pToolBox->GetCurItemId(); 621 sal_uInt16 nSID = SID_TABLE_VERT_NONE; 622 623 EndTracking(); 624 if (nId == 1) 625 { 626 nSID = FN_NUM_BULLET_ON; 627 } 628 else if ( nId == 2) 629 { 630 nSID = FN_NUM_NUMBERING_ON; 631 } 632 SfxBoolItem aBoolItem(nSID, sal_True); 633 GetBindings()->GetDispatcher()->Execute(nSID, SFX_CALLMODE_RECORD, &aBoolItem, 0L); 634 635 return 0; 636 } 637 638 639 //================================for Vertical Alignment======================================== 640 641 642 643 IMPL_LINK(ParaPropertyPanel, VertTbxSelectHandler, ToolBox*, pToolBox) 644 { 645 sal_uInt16 nId = pToolBox->GetCurItemId(); 646 sal_uInt16 nSID = SID_TABLE_VERT_NONE; 647 EndTracking(); 648 if (nId == 1) 649 { 650 nSID = SID_TABLE_VERT_NONE; 651 maTBxVertAlign->SetItemState(1, STATE_CHECK); 652 maTBxVertAlign->SetItemState(2, STATE_NOCHECK); 653 maTBxVertAlign->SetItemState(3, STATE_NOCHECK); 654 } 655 else if (nId == 2) 656 { 657 nSID = SID_TABLE_VERT_CENTER; 658 maTBxVertAlign->SetItemState(1, STATE_NOCHECK); 659 maTBxVertAlign->SetItemState(2, STATE_CHECK); 660 maTBxVertAlign->SetItemState(3, STATE_NOCHECK); 661 } 662 else if (nId == 3) 663 { 664 nSID = SID_TABLE_VERT_BOTTOM; 665 maTBxVertAlign->SetItemState(1, STATE_NOCHECK); 666 maTBxVertAlign->SetItemState(2, STATE_NOCHECK); 667 maTBxVertAlign->SetItemState(3, STATE_CHECK); 668 } 669 SfxBoolItem aBoolItem(nSID, sal_True); 670 GetBindings()->GetDispatcher()->Execute(nSID, SFX_CALLMODE_RECORD, &aBoolItem, 0L); 671 672 return 0; 673 } 674 675 void ParaPropertyPanel::VertStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) 676 { 677 if (eState < SFX_ITEM_DONTCARE) 678 { 679 maTBxVertAlign->SetItemState(1, STATE_NOCHECK); 680 maTBxVertAlign->SetItemState(2, STATE_NOCHECK); 681 maTBxVertAlign->SetItemState(3, STATE_NOCHECK); 682 maTBxVertAlign->EnableItem(1, sal_False); 683 maTBxVertAlign->EnableItem(2, sal_False); 684 maTBxVertAlign->EnableItem(3, sal_False); 685 } 686 else 687 { 688 maTBxVertAlign->EnableItem(1, sal_True); 689 maTBxVertAlign->EnableItem(2, sal_True); 690 maTBxVertAlign->EnableItem(3, sal_True); 691 if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem))) 692 { 693 const SfxBoolItem* pItem= (const SfxBoolItem*)pState; 694 sal_Bool aBool = (sal_Bool)pItem->GetValue(); 695 696 if (aBool) 697 { 698 if (nSID == SID_TABLE_VERT_NONE) 699 { 700 maTBxVertAlign->SetItemState(1, STATE_CHECK); 701 maTBxVertAlign->SetItemState(2, STATE_NOCHECK); 702 maTBxVertAlign->SetItemState(3, STATE_NOCHECK); 703 } 704 else if (nSID == SID_TABLE_VERT_CENTER) 705 { 706 maTBxVertAlign->SetItemState(1, STATE_NOCHECK); 707 maTBxVertAlign->SetItemState(2, STATE_CHECK); 708 maTBxVertAlign->SetItemState(3, STATE_NOCHECK); 709 } 710 else if (nSID == SID_TABLE_VERT_BOTTOM) 711 { 712 maTBxVertAlign->SetItemState(1, STATE_NOCHECK); 713 maTBxVertAlign->SetItemState(2, STATE_NOCHECK); 714 maTBxVertAlign->SetItemState(3, STATE_CHECK); 715 } 716 } 717 else 718 { 719 if (nSID == SID_TABLE_VERT_NONE) 720 { 721 maTBxVertAlign->SetItemState(1, STATE_NOCHECK); 722 } 723 else if (nSID == SID_TABLE_VERT_CENTER) 724 { 725 maTBxVertAlign->SetItemState(2, STATE_NOCHECK); 726 } 727 else if (nSID == SID_TABLE_VERT_BOTTOM) 728 { 729 maTBxVertAlign->SetItemState(3, STATE_NOCHECK); 730 } 731 } 732 } 733 else 734 { 735 maTBxVertAlign->SetItemState(1, STATE_NOCHECK); 736 maTBxVertAlign->SetItemState(2, STATE_NOCHECK); 737 maTBxVertAlign->SetItemState(3, STATE_NOCHECK); 738 } 739 } 740 } 741 //==================================for Background color===================== 742 743 IMPL_LINK(ParaPropertyPanel, ToolBoxBackColorDDHandler,ToolBox*, pToolBox) 744 { 745 sal_uInt16 nId = pToolBox->GetCurItemId(); 746 if(nId == TBI_BACK_COLOR) 747 { 748 pToolBox->SetItemDown( nId, sal_True ); 749 750 /*SvxParaBackColorPage* pBackColorPage = GetBackColorPage(); 751 Size aFloatSz = pBackColorPage->GetOutputSizePixel(); 752 GetBackColorFloatWin()->SetSizePixel( aFloatSz ); 753 754 Point aPos = maTBxBackColor->GetPosPixel(); 755 aPos = OutputToScreenPixel( aPos ); 756 Size aSize = maTBxBackColor->GetSizePixel(); 757 Rectangle aRect( aPos, aSize ); 758 759 GetBackColorFloatWin()->StartPopupMode( aRect, FLOATWIN_POPUPMODE_NOFOCUSCLOSE|FLOATWIN_POPUPMODE_DOWN ); 760 GetBackColorFloatWin()->SetPopupModeFlags(GetBackColorFloatWin()->GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE ); 761 762 pBackColorPage->ToGetFocus(); 763 pBackColorPage->SetCurColorSelect(maColor, mbColorAvailable); */ 764 } 765 return 0; 766 } 767 768 IMPL_LINK( ParaPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG ) 769 { 770 return 0; 771 } 772 773 void ParaPropertyPanel::ShowMenu (void) 774 { 775 if (mpBindings != NULL) 776 { 777 SfxDispatcher* pDispatcher = mpBindings->GetDispatcher(); 778 if (pDispatcher != NULL) 779 pDispatcher->Execute(SID_PARA_DLG, SFX_CALLMODE_ASYNCHRON); 780 } 781 } 782 783 void ParaPropertyPanel::ParaBKGStateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) 784 { 785 if( eState >= SFX_ITEM_DEFAULT && pState->ISA(SvxBrushItem)) 786 { 787 const SvxBrushItem* pItem = (const SvxBrushItem*)pState; 788 maColor = pItem->GetColor(); 789 mbColorAvailable = sal_True; 790 mpColorUpdater->Update(maColor); 791 } 792 else 793 { 794 mbColorAvailable = sal_False; 795 maColor.SetColor(COL_AUTO); 796 mpColorUpdater->Update(maColor); 797 } 798 } 799 800 //==================================for Paragraph Alignment===================== 801 IMPL_LINK( ParaPropertyPanel, AlignStyleModifyHdl_Impl, ToolBox*, pBox ) 802 { 803 switch (pBox->GetCurItemId()) 804 { 805 case BT_SUBSTLEFT: 806 { 807 pBox->SetItemState(BT_SUBSTLEFT,STATE_CHECK); 808 pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 809 pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 810 pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 811 SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True ); 812 GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_LEFT, SFX_CALLMODE_RECORD, &aBoolItem, 0L); 813 } 814 break; 815 case BT_SUBSTCENTER: 816 { 817 pBox->SetItemState(BT_SUBSTCENTER,STATE_CHECK); 818 pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 819 pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 820 pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 821 SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True ); 822 GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_CENTER, SFX_CALLMODE_RECORD, &aBoolItem, 0L); 823 } 824 break; 825 case BT_SUBSTRIGHT: 826 { 827 pBox->SetItemState(BT_SUBSTRIGHT,STATE_CHECK); 828 pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 829 pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 830 pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 831 SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True ); 832 GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_RIGHT, SFX_CALLMODE_RECORD, &aBoolItem, 0L); 833 } 834 break; 835 case BT_SUBSTJUSTIFY: 836 { 837 pBox->SetItemState(BT_SUBSTJUSTIFY,STATE_CHECK); 838 pBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 839 pBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 840 pBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 841 SfxBoolItem aBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True ); 842 GetBindings()->GetDispatcher()->Execute(SID_ATTR_PARA_ADJUST_BLOCK, SFX_CALLMODE_RECORD, &aBoolItem, 0L); 843 } 844 break; 845 } 846 847 return 0; 848 } 849 //==================================for Paragraph Indent===================== 850 IMPL_LINK( ParaPropertyPanel, ModifyIndentHdl_Impl, SvxRelativeField*, pBox ) 851 { 852 SvxLRSpaceItem aMargin( SID_ATTR_LRSPACE ); 853 aMargin.SetTxtLeft( (const long)GetCoreValue( *maLeftIndent.get(), m_eLRSpaceUnit ) ); 854 aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); 855 aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); 856 857 GetBindings()->GetDispatcher()->Execute( 858 SID_ATTR_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); 859 return 0; 860 } 861 862 IMPL_LINK(ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl, ToolBox *, pControl) 863 { 864 switch (pControl->GetCurItemId()) 865 { 866 case INDENT_INCREMENT: 867 { 868 switch (maContext.GetCombinedContext()) 869 { 870 case CombinedEnumContext(Application_Writer, Context_Default): 871 case CombinedEnumContext(Application_Writer, Context_Text): 872 case CombinedEnumContext(Application_Writer, Context_Table): 873 { 874 SfxBoolItem aMargin( SID_INC_INDENT, sal_True ); 875 GetBindings()->GetDispatcher()->Execute( 876 SID_INC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L); 877 } 878 break; 879 default: 880 { 881 SvxLRSpaceItem aMargin( SID_ATTR_LRSPACE ); 882 883 maTxtLeft += INDENT_STEP; 884 sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 885 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); 886 aMargin.SetTxtLeft( (const long)nVal ); 887 aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); 888 aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); 889 890 GetBindings()->GetDispatcher()->Execute( 891 SID_ATTR_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); 892 } 893 } 894 } 895 break; 896 case INDENT_DECREMENT: 897 { 898 switch (maContext.GetCombinedContext()) 899 { 900 case CombinedEnumContext(Application_Writer, Context_Default): 901 case CombinedEnumContext(Application_Writer, Context_Text): 902 case CombinedEnumContext(Application_Writer, Context_Table): 903 { 904 SfxBoolItem aMargin( SID_DEC_INDENT, sal_True ); 905 GetBindings()->GetDispatcher()->Execute( 906 SID_DEC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L); 907 } 908 break; 909 default: 910 { 911 if((maTxtLeft - INDENT_STEP) < 0) 912 maTxtLeft = DEFAULT_VALUE; 913 else 914 maTxtLeft -= INDENT_STEP; 915 916 SvxLRSpaceItem aMargin( SID_ATTR_LRSPACE ); 917 918 sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 919 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); 920 921 aMargin.SetTxtLeft( (const long)nVal ); 922 aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); 923 aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); 924 925 GetBindings()->GetDispatcher()->Execute( 926 SID_ATTR_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); 927 } 928 } 929 } 930 break; 931 case ID_HANGING_INDENT: 932 { 933 SvxLRSpaceItem aMargin( SID_ATTR_LRSPACE ); 934 aMargin.SetTxtLeft( (const long)GetCoreValue( *maLeftIndent.get(), m_eLRSpaceUnit ) + (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); 935 aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); 936 aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ))*(-1) ); 937 938 GetBindings()->GetDispatcher()->Execute( 939 SID_ATTR_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); 940 } 941 break; 942 } 943 return( 0L ); 944 } 945 946 IMPL_LINK(ParaPropertyPanel, ClickProDemote_Hdl_Impl, ToolBox *, pControl) 947 { 948 switch (pControl->GetCurItemId()) 949 { 950 case BT_TBX_INDENT_PROMOTE: 951 { 952 /*SvxLRSpaceItem aMargin( SID_ATTR_PARA_RIGHT ); 953 954 maTxtLeft += INDENT_STEP; 955 sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 956 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); 957 aMargin.SetTxtLeft( (const long)nVal ); 958 aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); 959 aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) );*/ 960 961 //GetBindings()->GetDispatcher()->Execute( 962 // SID_ATTR_PARA_RIGHT, SFX_CALLMODE_RECORD, &aMargin, 0L); 963 } 964 break; 965 case BT_TBX_INDENT_DEMOTE: 966 { 967 if((maTxtLeft - INDENT_STEP) < 0) 968 maTxtLeft = DEFAULT_VALUE; 969 else 970 maTxtLeft -= INDENT_STEP; 971 972 /*SvxLRSpaceItem aMargin( SID_ATTR_PARA_LEFT ); 973 974 sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 975 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); 976 977 aMargin.SetTxtLeft( (const long)nVal ); 978 aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); 979 aMargin.SetTxtFirstLineOfst( (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) );*/ 980 981 //GetBindings()->GetDispatcher()->Execute( 982 // SID_ATTR_PARA_LEFT, SFX_CALLMODE_RECORD, &aMargin, 0L); 983 } 984 break; 985 case SD_HANGING_INDENT: 986 { 987 SvxLRSpaceItem aMargin( SID_ATTR_LRSPACE ); 988 aMargin.SetTxtLeft( (const long)GetCoreValue( *maLeftIndent.get(), m_eLRSpaceUnit ) + (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) ); 989 aMargin.SetRight( (const long)GetCoreValue( *maRightIndent.get(), m_eLRSpaceUnit ) ); 990 aMargin.SetTxtFirstLineOfst( ((const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ))*(-1) ); 991 992 GetBindings()->GetDispatcher()->Execute( 993 SID_ATTR_LRSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); 994 } 995 break; 996 } 997 return( 0L ); 998 } 999 //==================================for Paragraph Line Spacing===================== 1000 1001 IMPL_LINK( ParaPropertyPanel, ClickLineSPDropDownHdl_Impl, ToolBox*, pBox ) 1002 { 1003 1004 const sal_uInt16 nId = pBox->GetCurItemId(); 1005 OSL_ASSERT(nId == TOOLBOX_ITEM1); 1006 if(nId == TOOLBOX_ITEM1) 1007 { 1008 pBox->SetItemDown( nId, true ); 1009 maLineSpacePopup.Rearrange(meLnSpState,m_eMetricUnit,mpLnSPItem,maContext); 1010 maLineSpacePopup.Show(*pBox); 1011 1012 } 1013 /* 1014 ParaPropertyPanel::SvxLineSPPopPage* pLineSPPage = GetLineSPPopPage(); 1015 1016 1017 */ 1018 return (0L); 1019 } 1020 1021 /*IMPL_LINK( ParaPropertyPanel, LineSPCloseHdl_Impl, SfxPopupPanelWin*, pControl ) 1022 { 1023 1024 if( mbUseLineSPCustom ) 1025 { 1026 maLinePos = mpLineSPPage->maPos; 1027 maLineValue = mpLineSPPage->maValue; 1028 1029 SvtViewOptions aWinOpt( E_WINDOW, LSP_POS_GLOBAL_VALUE ); 1030 ::com::sun::star::uno::Sequence < ::com::sun::star::beans::NamedValue > aSeq(1); 1031 aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("maLinePos") ); 1032 aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( maLinePos )); 1033 aWinOpt.SetUserData( aSeq ); 1034 1035 SvtViewOptions aWinOpt2( E_WINDOW, LSP_LV_GLOBAL_VALUE ); 1036 aSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("maLineValue") ); 1037 aSeq[0].Value <<= ::rtl::OUString( String::CreateFromInt64( maLineValue )); 1038 aWinOpt2.SetUserData( aSeq ); 1039 } 1040 return 0; 1041 1042 }*/ 1043 //==================================for Paragraph Spacing===================== 1044 IMPL_LINK( ParaPropertyPanel, ULSpaceHdl_Impl, SvxRelativeField*, pBox ) 1045 { 1046 SvxULSpaceItem aMargin( SID_ATTR_ULSPACE ); 1047 aMargin.SetUpper( (sal_uInt16)GetCoreValue( *maTopDist.get(), m_eULSpaceUnit ) ); 1048 aMargin.SetLower( (sal_uInt16)GetCoreValue( *maBottomDist.get(), m_eULSpaceUnit ) ); 1049 1050 GetBindings()->GetDispatcher()->Execute( 1051 SID_ATTR_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); 1052 return 0L; 1053 } 1054 1055 IMPL_LINK(ParaPropertyPanel, ClickUL_IncDec_Hdl_Impl, ToolBox *, pControl) 1056 { 1057 switch (pControl->GetCurItemId()) 1058 { 1059 case UL_INCREMENT: 1060 { 1061 SvxULSpaceItem aMargin( SID_ATTR_ULSPACE ); 1062 1063 maUpper += UL_STEP; 1064 sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1065 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); 1066 aMargin.SetUpper( (const sal_uInt16)nVal ); 1067 1068 maLower += UL_STEP; 1069 nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1070 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); 1071 aMargin.SetLower( (const sal_uInt16)nVal ); 1072 1073 GetBindings()->GetDispatcher()->Execute( 1074 SID_ATTR_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); 1075 } 1076 break; 1077 case UL_DECREMENT: 1078 { 1079 SvxULSpaceItem aMargin( SID_ATTR_ULSPACE ); 1080 1081 if( maUpper >= UL_STEP ) 1082 { 1083 maUpper -= UL_STEP; 1084 sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1085 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); 1086 aMargin.SetUpper( (const sal_uInt16)nVal ); 1087 } 1088 else 1089 aMargin.SetUpper( DEFAULT_VALUE ); 1090 if( maLower >= UL_STEP ) 1091 { 1092 maLower -= UL_STEP; 1093 sal_Int64 nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1094 nVal = OutputDevice::LogicToLogic( (long)nVal, MAP_100TH_MM, (MapUnit)m_eLRSpaceUnit ); 1095 aMargin.SetLower( (const sal_uInt16)nVal ); 1096 } 1097 else 1098 aMargin.SetLower( DEFAULT_VALUE ); 1099 1100 GetBindings()->GetDispatcher()->Execute( 1101 SID_ATTR_ULSPACE, SFX_CALLMODE_RECORD, &aMargin, 0L); 1102 } 1103 break; 1104 } 1105 return( 0L ); 1106 } 1107 1108 //==================================for Paragraph State change===================== 1109 void ParaPropertyPanel::NotifyItemUpdate( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1110 { 1111 if( nSID == SID_ATTR_METRIC ) 1112 { 1113 m_eMetricUnit = GetCurrentUnit(eState,pState); 1114 if( m_eMetricUnit!=m_last_eMetricUnit ) 1115 { 1116 SetFieldUnit( *maLeftIndent.get(), m_eMetricUnit ); 1117 SetFieldUnit( *maRightIndent.get(), m_eMetricUnit ); 1118 SetFieldUnit( *maFLineIndent.get(), m_eMetricUnit ); 1119 SetFieldUnit( *maTopDist.get(), m_eMetricUnit ); 1120 SetFieldUnit( *maBottomDist.get(), m_eMetricUnit ); 1121 } 1122 m_last_eMetricUnit = m_eMetricUnit; 1123 } 1124 1125 if( nSID == SID_ATTR_LRSPACE ) 1126 StateChangedIndentImpl( nSID, eState, pState ); 1127 1128 if( nSID == SID_ATTR_PARA_LINESPACE ) 1129 StateChangedLnSPImpl( nSID, eState, pState ); 1130 1131 if( nSID == SID_ATTR_ULSPACE ) 1132 StateChangedULImpl( nSID, eState, pState ); 1133 1134 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) 1135 StateChangedAlignmentImpl( nSID, eState, pState ); 1136 1137 if (nSID==SID_OUTLINE_LEFT || nSID==SID_OUTLINE_RIGHT) 1138 StateChangeOutLineImpl( nSID, eState, pState ); 1139 1140 if (nSID==SID_INC_INDENT || nSID==SID_DEC_INDENT) 1141 StateChangeIncDecImpl( nSID, eState, pState ); 1142 //Sym3_1093. Add toggle state for numbering and bullet icons 1143 if (nSID==FN_NUM_NUMBERING_ON || nSID==FN_NUM_BULLET_ON) 1144 StateChangeBulletNumImpl( nSID, eState, pState ); 1145 1146 //Modified for Numbering&Bullets Dialog UX Enh(Story 992) by chengjh,2011.7.5 1147 //Get the num rule index data of the current selection 1148 if ( nSID == FN_BUL_NUM_RULE_INDEX ||nSID == FN_NUM_NUM_RULE_INDEX) 1149 StateChangeBulletNumRuleImpl( nSID, eState, pState ); 1150 //End 1151 1152 if ((nSID == SID_TABLE_VERT_NONE)||(nSID == SID_TABLE_VERT_CENTER)||(nSID == SID_TABLE_VERT_BOTTOM)) 1153 { 1154 VertStateChanged( nSID, eState, pState); 1155 } 1156 else if (nSID == SID_BACKGROUND_COLOR) 1157 { 1158 ParaBKGStateChanged(nSID, eState, pState); 1159 } 1160 } 1161 1162 void ParaPropertyPanel::StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1163 { 1164 if( eState >= SFX_ITEM_AVAILABLE ) 1165 { 1166 const SfxBoolItem* pItem = (const SfxBoolItem*)pState; 1167 bool IsChecked = (bool)pItem->GetValue(); 1168 switch (nSID) 1169 { 1170 case SID_ATTR_PARA_ADJUST_LEFT: 1171 { 1172 if(IsChecked) 1173 { 1174 maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_CHECK); 1175 maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 1176 maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 1177 maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 1178 } 1179 else 1180 maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 1181 } 1182 break; 1183 case SID_ATTR_PARA_ADJUST_CENTER: 1184 { 1185 if(IsChecked) 1186 { 1187 maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_CHECK); 1188 maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 1189 maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 1190 maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 1191 } 1192 else 1193 maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 1194 } 1195 break; 1196 case SID_ATTR_PARA_ADJUST_RIGHT: 1197 { 1198 if(IsChecked) 1199 { 1200 maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_CHECK); 1201 maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 1202 maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 1203 maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 1204 } 1205 else 1206 maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 1207 } 1208 break; 1209 case SID_ATTR_PARA_ADJUST_BLOCK: 1210 { 1211 if(IsChecked) 1212 { 1213 maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_CHECK); 1214 maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 1215 maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 1216 maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 1217 } 1218 else 1219 maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 1220 } 1221 break; 1222 } 1223 } 1224 else if( eState == SFX_ITEM_DISABLED ) 1225 { 1226 } 1227 else if ( eState == SFX_ITEM_DONTCARE ) 1228 { 1229 switch (nSID) 1230 { 1231 case SID_ATTR_PARA_ADJUST_LEFT: 1232 maAlignToolBox->SetItemState(BT_SUBSTLEFT,STATE_NOCHECK); 1233 break; 1234 case SID_ATTR_PARA_ADJUST_CENTER: 1235 maAlignToolBox->SetItemState(BT_SUBSTCENTER,STATE_NOCHECK); 1236 break; 1237 case SID_ATTR_PARA_ADJUST_RIGHT: 1238 maAlignToolBox->SetItemState(BT_SUBSTRIGHT,STATE_NOCHECK); 1239 break; 1240 case SID_ATTR_PARA_ADJUST_BLOCK: 1241 maAlignToolBox->SetItemState(BT_SUBSTJUSTIFY,STATE_NOCHECK); 1242 break; 1243 } 1244 } 1245 } 1246 1247 void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1248 { 1249 switch (maContext.GetCombinedContext()) 1250 { 1251 1252 case CombinedEnumContext(Application_Writer, Context_DrawText): 1253 case CombinedEnumContext(Application_Calc, Context_DrawText): 1254 case CombinedEnumContext(Application_Writer, Context_Annotation): 1255 { 1256 maLeftIndent->SetMin( DEFAULT_VALUE ); 1257 maRightIndent->SetMin( DEFAULT_VALUE ); 1258 maFLineIndent->SetMin( DEFAULT_VALUE ); 1259 maTbxIndent_IncDec->Show(); 1260 maTbxProDemote->Hide(); 1261 } 1262 break; 1263 case CombinedEnumContext(Application_Draw, Context_DrawText): 1264 case CombinedEnumContext(Application_Impress, Context_DrawText): 1265 case CombinedEnumContext(Application_Draw, Context_Draw): 1266 case CombinedEnumContext(Application_Draw, Context_TextObject): 1267 case CombinedEnumContext(Application_Draw, Context_Graphic): 1268 case CombinedEnumContext(Application_Impress, Context_Draw): 1269 case CombinedEnumContext(Application_Impress, Context_TextObject): 1270 case CombinedEnumContext(Application_Impress, Context_Graphic): 1271 case CombinedEnumContext(Application_Impress, Context_Table): 1272 case CombinedEnumContext(Application_Draw, Context_Table): 1273 { 1274 maLeftIndent->SetMin( DEFAULT_VALUE ); 1275 maRightIndent->SetMin( DEFAULT_VALUE ); 1276 maFLineIndent->SetMin( DEFAULT_VALUE ); 1277 maTbxIndent_IncDec->Hide(); 1278 maTbxProDemote->Show(); 1279 } 1280 break; 1281 case CombinedEnumContext(Application_Writer, Context_Default): 1282 case CombinedEnumContext(Application_Writer, Context_Text): 1283 case CombinedEnumContext(Application_Writer, Context_Table): 1284 { 1285 maLeftIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM ); 1286 maRightIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM ); 1287 maFLineIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM ); 1288 maTbxIndent_IncDec->Show(); 1289 maTbxProDemote->Hide(); 1290 } 1291 break; 1292 } 1293 1294 if( pState && eState >= SFX_ITEM_AVAILABLE ) 1295 { 1296 SvxLRSpaceItem* pSpace = ( SvxLRSpaceItem*)pState; 1297 maTxtLeft = pSpace->GetTxtLeft(); 1298 maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM ); 1299 maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1300 1301 long aTxtRight = pSpace->GetRight(); 1302 aTxtRight = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM ); 1303 aTxtRight = OutputDevice::LogicToLogic( aTxtRight, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1304 1305 long aTxtFirstLineOfst = pSpace->GetTxtFirstLineOfst(); 1306 aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)m_eLRSpaceUnit, MAP_100TH_MM ); 1307 aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1308 1309 long nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1310 nVal = (long)maLeftIndent->Normalize( (long)nVal ); 1311 maLeftIndent->SetValue( nVal, FUNIT_100TH_MM ); 1312 1313 if(maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && 1314 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && 1315 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table)) 1316 { 1317 maFLineIndent->SetMin( nVal*(-1), FUNIT_100TH_MM ); 1318 } 1319 1320 long nrVal = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1321 nrVal = (long)maRightIndent->Normalize( (long)nrVal ); 1322 maRightIndent->SetValue( nrVal, FUNIT_100TH_MM ); 1323 1324 long nfVal = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1325 nfVal = (long)maFLineIndent->Normalize( (long)nfVal ); 1326 maFLineIndent->SetValue( nfVal, FUNIT_100TH_MM ); 1327 1328 switch (maContext.GetCombinedContext()) 1329 { 1330 case CombinedEnumContext(Application_Writer, Context_DrawText): 1331 case CombinedEnumContext(Application_Writer, Context_Text): 1332 case CombinedEnumContext(Application_Writer, Context_Default): 1333 case CombinedEnumContext(Application_Writer, Context_Table): 1334 case CombinedEnumContext(Application_Writer, Context_Annotation): 1335 { 1336 maLeftIndent->SetMax( MAX_SW - nrVal, FUNIT_100TH_MM ); 1337 maRightIndent->SetMax( MAX_SW - nVal, FUNIT_100TH_MM ); 1338 maFLineIndent->SetMax( MAX_SW - nVal - nrVal, FUNIT_100TH_MM ); 1339 } 1340 break; 1341 case CombinedEnumContext(Application_Draw, Context_DrawText): 1342 case CombinedEnumContext(Application_Draw, Context_Draw): 1343 case CombinedEnumContext(Application_Draw, Context_Table): 1344 case CombinedEnumContext(Application_Draw, Context_TextObject): 1345 case CombinedEnumContext(Application_Draw, Context_Graphic): 1346 case CombinedEnumContext(Application_Impress, Context_TextObject): 1347 case CombinedEnumContext(Application_Impress, Context_DrawText): 1348 case CombinedEnumContext(Application_Impress, Context_Table): 1349 case CombinedEnumContext(Application_Impress, Context_Draw): 1350 case CombinedEnumContext(Application_Impress, Context_Graphic): 1351 { 1352 maLeftIndent->SetMax( MAX_SC_SD - nrVal, FUNIT_100TH_MM ); 1353 maRightIndent->SetMax( MAX_SC_SD - nVal, FUNIT_100TH_MM ); 1354 maFLineIndent->SetMax( MAX_SC_SD - nVal - nrVal, FUNIT_100TH_MM ); 1355 } 1356 } 1357 1358 maTbxIndent_IncDec->Enable(); 1359 maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_True); 1360 if(maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) 1361 && maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) 1362 && maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table)) 1363 { 1364 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True); 1365 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True); 1366 } 1367 1368 maTbxProDemote->Enable(); 1369 if( !mbOutLineRight && !mbOutLineLeft ) 1370 maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True); 1371 maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True); 1372 } 1373 else if( eState == SFX_ITEM_DISABLED ) 1374 { 1375 maLeftIndent-> Disable(); 1376 maRightIndent->Disable(); 1377 maFLineIndent->Disable(); 1378 maTbxIndent_IncDec->Disable(); 1379 if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && 1380 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && 1381 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) 1382 maTbxIndent_IncDec->Disable(); 1383 else 1384 maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False); 1385 1386 maTbxProDemote->Disable(); 1387 maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False); 1388 } 1389 else 1390 { 1391 maLeftIndent->SetEmptyFieldValue(); 1392 maRightIndent->SetEmptyFieldValue(); 1393 maFLineIndent->SetEmptyFieldValue(); 1394 if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && 1395 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && 1396 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) 1397 maTbxIndent_IncDec->Disable(); 1398 else 1399 maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False); 1400 maTbxProDemote->Disable(); 1401 maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False); 1402 } 1403 } 1404 1405 void ParaPropertyPanel::StateChangedLnSPImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1406 { 1407 meLnSpState = eState; 1408 1409 if( pState && eState >= SFX_ITEM_AVAILABLE ) 1410 { 1411 if(mpLnSPItem) 1412 delete mpLnSPItem; 1413 mpLnSPItem = ( SvxLineSpacingItem *)pState->Clone(); 1414 } 1415 } 1416 1417 void ParaPropertyPanel::StateChangedULImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1418 { 1419 maTopDist->SetMax( maTopDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) ); 1420 maBottomDist->SetMax( maBottomDist->Normalize( MAX_DURCH ), MapToFieldUnit(m_eULSpaceUnit) ); 1421 1422 if( pState && eState >= SFX_ITEM_AVAILABLE ) 1423 { 1424 SvxULSpaceItem* pOldItem = (SvxULSpaceItem*)pState; 1425 1426 maUpper = pOldItem->GetUpper(); 1427 maUpper = OutputDevice::LogicToLogic( maUpper, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM ); 1428 maUpper = OutputDevice::LogicToLogic( maUpper, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1429 1430 maLower = pOldItem->GetLower(); 1431 maLower = OutputDevice::LogicToLogic( maLower, (MapUnit)m_eULSpaceUnit, MAP_100TH_MM ); 1432 maLower = OutputDevice::LogicToLogic( maLower, MAP_100TH_MM, (MapUnit)(SFX_MAPUNIT_TWIP) ); 1433 1434 sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1435 nVal = maTopDist->Normalize( nVal ); 1436 maTopDist->SetValue( nVal, FUNIT_100TH_MM ); 1437 1438 nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(SFX_MAPUNIT_TWIP), MAP_100TH_MM ); 1439 nVal = maBottomDist->Normalize( nVal ); 1440 maBottomDist->SetValue( nVal, FUNIT_100TH_MM ); 1441 maTbxUL_IncDec->Enable(); 1442 } 1443 else if( eState == SFX_ITEM_DISABLED ) 1444 { 1445 maTopDist->Disable(); 1446 maBottomDist->Disable(); 1447 maTbxUL_IncDec->Disable(); 1448 } 1449 else 1450 { 1451 maTopDist->SetEmptyFieldValue(); 1452 maBottomDist->SetEmptyFieldValue(); 1453 maTbxUL_IncDec->Disable(); 1454 } 1455 } 1456 1457 void ParaPropertyPanel::StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1458 { 1459 if (nSID==SID_OUTLINE_LEFT) 1460 { 1461 if( pState && eState == SFX_ITEM_UNKNOWN ) 1462 mbOutLineLeft = 1; 1463 else 1464 mbOutLineLeft = 0; 1465 } 1466 if (nSID==SID_OUTLINE_RIGHT) 1467 { 1468 if( pState && eState == SFX_ITEM_UNKNOWN ) 1469 mbOutLineRight = 1; 1470 else 1471 mbOutLineRight = 0; 1472 } 1473 if(mbOutLineLeft) 1474 maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_True); 1475 else 1476 maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_False); 1477 1478 if(mbOutLineRight) 1479 maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_True); 1480 else 1481 maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_False); 1482 1483 if( !mbOutLineRight && !mbOutLineLeft ) 1484 { 1485 maTbxProDemote->EnableItem(BT_TBX_INDENT_PROMOTE, sal_True); 1486 maTbxProDemote->EnableItem(BT_TBX_INDENT_DEMOTE, sal_True); 1487 maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True); 1488 } 1489 else 1490 maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False); 1491 } 1492 1493 void ParaPropertyPanel::StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1494 { 1495 if (nSID==SID_INC_INDENT) 1496 { 1497 if( pState && eState == SFX_ITEM_UNKNOWN ) 1498 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True); 1499 else 1500 if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && 1501 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && 1502 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) 1503 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_False); 1504 } 1505 if (nSID==SID_DEC_INDENT) 1506 { 1507 if( pState && eState == SFX_ITEM_UNKNOWN ) 1508 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True); 1509 else 1510 if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text) && 1511 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) && 1512 maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) ) 1513 maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_False); 1514 } 1515 } 1516 //Sym3_1093. Add toggle state for numbering and bullet icons 1517 void ParaPropertyPanel::StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1518 { 1519 if (nSID==FN_NUM_NUMBERING_ON) 1520 { 1521 if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem))) 1522 { 1523 const SfxBoolItem* pItem= (const SfxBoolItem*)pState; 1524 sal_Bool aBool = (sal_Bool)pItem->GetValue(); 1525 if (aBool) { 1526 maTBxNumBullet->SetItemState(IID_NUMBER, STATE_CHECK); 1527 } else { 1528 maTBxNumBullet->SetItemState(IID_NUMBER, STATE_NOCHECK); 1529 } 1530 } 1531 } 1532 if (nSID==FN_NUM_BULLET_ON) 1533 { 1534 if ( (eState >= SFX_ITEM_DEFAULT) && (pState->ISA(SfxBoolItem))) 1535 { 1536 const SfxBoolItem* pItem= (const SfxBoolItem*)pState; 1537 sal_Bool aBool = (sal_Bool)pItem->GetValue(); 1538 if (aBool) { 1539 maTBxNumBullet->SetItemState(IID_BULLET, STATE_CHECK); 1540 } else { 1541 maTBxNumBullet->SetItemState(IID_BULLET, STATE_NOCHECK); 1542 } 1543 } 1544 } 1545 } 1546 //Modified for Numbering&Bullets Dialog UX Enh(Story 992) by chengjh,2011.7.5 1547 //Handing the transferred the num rule index data of the current selection 1548 void ParaPropertyPanel::StateChangeBulletNumRuleImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 1549 { 1550 1551 const SfxUInt16Item* pIt = (const SfxUInt16Item*)pState; 1552 sal_uInt16 nValue = (sal_uInt16)0xFFFF; 1553 if ( pIt ) 1554 nValue = pIt->GetValue(); 1555 1556 if ( nSID == FN_BUL_NUM_RULE_INDEX ) 1557 { 1558 nBulletTypeIndex = nValue; 1559 }else if ( nSID == FN_NUM_NUM_RULE_INDEX ) 1560 { 1561 nNumTypeIndex = nValue; 1562 } 1563 } 1564 //End 1565 FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ) 1566 { 1567 FieldUnit eUnit = FUNIT_NONE; 1568 1569 if ( pState && eState >= SFX_ITEM_DEFAULT ) 1570 eUnit = (FieldUnit)( (const SfxUInt16Item*)pState )->GetValue(); 1571 else 1572 { 1573 SfxViewFrame* pFrame = SfxViewFrame::Current(); 1574 SfxObjectShell* pSh = NULL; 1575 if ( pFrame ) 1576 pSh = pFrame->GetObjectShell(); 1577 if ( pSh ) //the object shell is not always available during reload 1578 { 1579 SfxModule* pModule = pSh->GetModule(); 1580 if ( pModule ) 1581 { 1582 const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); 1583 if ( pItem ) 1584 eUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue(); 1585 } 1586 else 1587 { 1588 DBG_ERRORFILE( "GetModuleFieldUnit(): no module found" ); 1589 } 1590 } 1591 } 1592 1593 return eUnit; 1594 } 1595 //new FixedText(this, SVX_RES(FT_COLOR)) 1596 1597 PopupControl* ParaPropertyPanel::CreateLineSpacingControl (PopupContainer* pParent) 1598 { 1599 return new ParaLineSpacingControl(pParent, *this); 1600 } 1601 1602 /*PopupControl* ParaPropertyPanel::CreateBulletsPopupControl (PopupContainer* pParent) 1603 { 1604 } 1605 1606 PopupControl* ParaPropertyPanel::CreateNumberingPopupControl (PopupContainer* pParent) 1607 { 1608 } 1609 1610 PopupControl* ParaPropertyPanel::CreateBGColorPopupControl (PopupContainer* pParent) 1611 { 1612 1613 }*/ 1614 1615 1616 ParaPropertyPanel::ParaPropertyPanel(Window* pParent, 1617 const cssu::Reference<css::frame::XFrame>& rxFrame, 1618 SfxBindings* pBindings) 1619 : Control(pParent, SVX_RES(RID_SIDEBAR_PARA_PANEL)) 1620 //, mnContextId (PROPERTY_CONTEXT_NOT_SUPPORT) 1621 //Alignment 1622 ,maAlignToolBoxBackground(ControlFactory::CreateToolBoxBackground(this)) 1623 , maAlignToolBox (ControlFactory::CreateToolBox(maAlignToolBoxBackground.get(),SVX_RES(TBX_HORIZONTALALIGNMENT))) 1624 ,maTBxVertAlignBackground(ControlFactory::CreateToolBoxBackground(this)) 1625 , maTBxVertAlign (ControlFactory::CreateToolBox(maTBxVertAlignBackground.get(),SVX_RES(TBX_VERT_ALIGN))) 1626 , maLeftPara (SVX_RES(IMG_LEFT_PARA)) 1627 , maCentPara (SVX_RES(IMG_CENTER_PARA)) 1628 , maRightPara (SVX_RES(IMG_RIGHT_PARA)) 1629 , maJusPara (SVX_RES(IMG_JUSTIFY_PARA)) 1630 , maVertImageList (SVX_RES(IL_VERT_ALIGN)) 1631 , maVertImageListH (SVX_RES(IL_VERT_ALIGN)) 1632 //Num&Backcolor 1633 ,maTBxNumBulletBackground(ControlFactory::CreateToolBoxBackground(this)) 1634 , maTBxNumBullet (ControlFactory::CreateToolBox(maTBxNumBulletBackground.get(),SVX_RES(TBX_NUM_BULLET))) 1635 ,maTBxBackColorBackground(ControlFactory::CreateToolBoxBackground(this)) 1636 , maTBxBackColor (ControlFactory::CreateToolBox(maTBxBackColorBackground.get(),SVX_RES(TBX_BACK_COLOR))) 1637 , maNumBImageList (SVX_RES(IL_NUM_BULLET)) 1638 , maNumBImageListH (SVX_RES(ILH_NUM_BULLET)) 1639 , maNumBImageListRTL (SVX_RES(IL_NUM_BULLET_RTL)) //wj sym2_7380 1640 , maImgBackColorHigh (SVX_RES(IMG_BACK_COLOR_H)) 1641 , maImgBackColor (SVX_RES(IMG_BACK_COLOR)) 1642 , mpColorUpdater () 1643 , maColor (COL_AUTO) 1644 , mbColorAvailable (sal_True) 1645 //Paragraph spacing 1646 , maFTUL (new FixedText(this, SVX_RES(FT_SPACING))) 1647 ,maTbxUL_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)) 1648 , maTbxUL_IncDec (ControlFactory::CreateToolBox(maTbxUL_IncDecBackground.get(),SVX_RES(TBX_UL_INC_DEC))) 1649 , maParInc (SVX_RES(IMG_PARA_INC)) 1650 , maParDec (SVX_RES(IMG_PARA_DEC)) 1651 , maTopDist (new SvxRelativeField(this, SVX_RES(MF_ABOVE_PARASPACING))) 1652 , maBottomDist (new SvxRelativeField(this, SVX_RES(MF_BELOW_PARASPACING))) 1653 //Indent 1654 , maFTIndent (new FixedText(this, SVX_RES(FT_INDENT))) 1655 ,maTbxIndent_IncDecBackground(ControlFactory::CreateToolBoxBackground(this)) 1656 , maTbxIndent_IncDec (ControlFactory::CreateToolBox(maTbxIndent_IncDecBackground.get(),SVX_RES(TBX_INDENT_INC_DEC))) 1657 ,maTbxProDemoteBackground(ControlFactory::CreateToolBoxBackground(this)) 1658 , maTbxProDemote (ControlFactory::CreateToolBox(maTbxProDemoteBackground.get(),SVX_RES(TBX_INDENT_PRO_DEMOTE))) 1659 , maLeftIndent (new SvxRelativeField(this, SVX_RES(MF_BEFORE_INDENT))) 1660 , maRightIndent (new SvxRelativeField(this, SVX_RES(MF_AFTER_INDENT))) 1661 , maFLineIndent (new SvxRelativeField(this, SVX_RES(MF_FL_INDENT))) 1662 , maIndInc (SVX_RES(IMG_INDENT_INC)) 1663 , maIndDec (SVX_RES(IMG_INDENT_DEC)) 1664 , maIndInc_BD (SVX_RES(IMG_INDENT_INC_BD)) 1665 , maIndDec_BD (SVX_RES(IMG_INDENT_DEC_BD)) 1666 , maIndHang (SVX_RES(IMG_INDENT_HANG)) 1667 , maTxtLeft (0) 1668 //Line spacing 1669 ,maLineSPTbxBackground(ControlFactory::CreateToolBoxBackground(this)) 1670 , maLineSPTbx (ControlFactory::CreateToolBox(maLineSPTbxBackground.get(),SVX_RES(TBX_LINESP))) 1671 , maSpace1 (SVX_RES(IMG_SPACE1)) 1672 , maSpace2 (SVX_RES(IMG_SPACE2)) 1673 , maSpace3 (SVX_RES(IMG_SPACE3)) 1674 , maIndent1 (SVX_RES(IMG_INDENT1)) 1675 , maIndent2 (SVX_RES(IMG_INDENT2)) 1676 , maIndent3 (SVX_RES(IMG_INDENT3)) 1677 , maLineSpacePopup(this, ::boost::bind(&ParaPropertyPanel::CreateLineSpacingControl, this, _1)) 1678 //Controller 1679 , maLeftAlignControl (SID_ATTR_PARA_ADJUST_LEFT, *pBindings,*this) 1680 , maCenterAlignControl (SID_ATTR_PARA_ADJUST_CENTER, *pBindings,*this) 1681 , maRightAlignControl (SID_ATTR_PARA_ADJUST_RIGHT, *pBindings,*this) 1682 , maJustifyAlignControl (SID_ATTR_PARA_ADJUST_BLOCK, *pBindings,*this) 1683 , maLRSpaceControl (SID_ATTR_LRSPACE,*pBindings,*this) 1684 , maLNSpaceControl (SID_ATTR_PARA_LINESPACE, *pBindings,*this) 1685 , maULSpaceControl (SID_ATTR_ULSPACE, *pBindings,*this) 1686 , maOutLineLeftControl (SID_OUTLINE_LEFT, *pBindings,*this) 1687 , maOutLineRightControl (SID_OUTLINE_RIGHT, *pBindings,*this) 1688 , maIncIndentControl (SID_INC_INDENT, *pBindings,*this) 1689 , maDecIndentControl (SID_DEC_INDENT, *pBindings,*this) 1690 , maVertTop (SID_TABLE_VERT_NONE, *pBindings,*this) 1691 , maVertCenter (SID_TABLE_VERT_CENTER, *pBindings,*this) 1692 , maVertBottom (SID_TABLE_VERT_BOTTOM,*pBindings,*this) 1693 , maBulletOnOff (FN_NUM_BULLET_ON, *pBindings,*this) 1694 , maNumberOnOff (FN_NUM_NUMBERING_ON, *pBindings,*this) 1695 //Modified for Numbering&Bullets Dialog UX Enh(Story 992) by chengjh,2011.7.5 1696 //Add entry to transfer number rule index data 1697 ,maBulletNumRuleIndex (FN_BUL_NUM_RULE_INDEX, *pBindings,*this) 1698 ,maNumNumRuleIndex (FN_NUM_NUM_RULE_INDEX, *pBindings,*this) 1699 //End 1700 , maBackColorControl (SID_BACKGROUND_COLOR, *pBindings,*this) 1701 , m_aMetricCtl (SID_ATTR_METRIC, *pBindings,*this) 1702 //, m_eMetricUnit (FUNIT_INCH) 1703 //, m_last_eMetricUnit (FUNIT_INCH) 1704 //internal var 1705 , maUpper (0) 1706 , maLower (0) 1707 , mpLnSPItem (NULL) 1708 , meLnSpState (SFX_ITEM_DONTCARE) 1709 , maFISpace1 ( this, SVX_RES( FI_SPACE1)) 1710 , maFISpace2 ( this, SVX_RES( FI_SPACE2)) 1711 , maFIndent1 ( this, SVX_RES( FI_INDENT1)) 1712 , maFIndent2 ( this, SVX_RES( FI_INDENT2)) 1713 , maFIndent3 ( this, SVX_RES( FI_INDENT3)) 1714 , mbOutLineRight (0) 1715 , mbOutLineLeft (0) 1716 //Modified for Numbering&Bullets Dialog UX Enh(Story 992) by chengjh,2011.7.5 1717 //Add variable to record bullet/numbering type index data 1718 ,nBulletTypeIndex (USHRT_MAX) 1719 ,nNumTypeIndex (USHRT_MAX) 1720 //End 1721 ,mpBindings(pBindings) 1722 { 1723 initial(); 1724 FreeResource(); 1725 } 1726 1727 }} 1728