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