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 "svx/sidebar/PopupContainer.hxx" 23 #include "AreaTransparencyGradientControl.hxx" 24 25 #include <sfx2/sidebar/propertypanel.hrc> 26 #include <sfx2/sidebar/Theme.hxx> 27 #include <sfx2/sidebar/ControlFactory.hxx> 28 #include <AreaPropertyPanel.hxx> 29 #include <AreaPropertyPanel.hrc> 30 #include <svx/dialogs.hrc> 31 #include <svx/dialmgr.hxx> 32 #include <sfx2/objsh.hxx> 33 #include <svx/xfltrit.hxx> 34 #include <svx/xflftrit.hxx> 35 #include <svx/xtable.hxx> 36 #include <sfx2/dispatch.hxx> 37 #include <sfx2/bindings.hxx> 38 #include <helpid.hrc> 39 #include <svtools/valueset.hxx> 40 #include <unotools/pathoptions.hxx> 41 #include <svx/svxitems.hrc> 42 #include <vcl/toolbox.hxx> 43 #include <svtools/toolbarmenu.hxx> 44 #include <svx/sidebar/ColorControl.hxx> 45 46 #include <boost/bind.hpp> 47 48 using namespace css; 49 using namespace cssu; 50 using ::sfx2::sidebar::Theme; 51 52 #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) 53 54 55 56 57 namespace svx { namespace sidebar { 58 59 const sal_Int32 AreaPropertyPanel::DEFAULT_CENTERX = 50; 60 const sal_Int32 AreaPropertyPanel::DEFAULT_CENTERY = 50; 61 const sal_Int32 AreaPropertyPanel::DEFAULT_ANGLE = 0; 62 const sal_Int32 AreaPropertyPanel::DEFAULT_STARTVALUE = 0; 63 const sal_Int32 AreaPropertyPanel::DEFAULT_ENDVALUE = 16777215; 64 const sal_Int32 AreaPropertyPanel::DEFAULT_BORDER = 0; 65 66 67 AreaPropertyPanel::AreaPropertyPanel( 68 Window* pParent, 69 const cssu::Reference<css::frame::XFrame>& rxFrame, 70 SfxBindings* pBindings) 71 : Control(pParent, SVX_RES(RID_SIDEBAR_AREA_PANEL)), 72 meLastXFS(-1), 73 maLastColor(Color(COL_DEFAULT_SHAPE_FILLING)), 74 mnLastPosGradient(0), 75 mnLastPosHatch(0), 76 mnLastPosBitmap(0), 77 mnLastTransSolid(50), 78 maGradientLinear(), 79 maGradientAxial(), 80 maGradientRadial(), 81 maGradientElliptical(), 82 maGradientSquare(), 83 maGradientRect(), 84 mpColorTextFT(new FixedText(this, SVX_RES(FT_COLOR_LIST))), 85 mpLbFillType(new SvxFillTypeBox(this)), 86 mpLbFillAttr(new SvxFillAttrBox(this)), 87 mpToolBoxColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), 88 mpToolBoxColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpToolBoxColorBackground.get(), SVX_RES(TB_COLOR))), 89 mpTrspTextFT(new FixedText(this, SVX_RES(FL_TRSP_TEXT))), 90 mpLBTransType(new ListBox(this, SVX_RES(LB_TRGR_TYPES))), 91 mpMTRTransparent(new MetricField(this, SVX_RES(MTR_TRANSPARENT))), 92 mpBTNGradientBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), 93 mpBTNGradient(sfx2::sidebar::ControlFactory::CreateToolBox(mpBTNGradientBackground.get(), SVX_RES(BTN_GRADIENT))), 94 mpColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_FILL_COLOR, TBI_COLOR, mpToolBoxColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)), 95 mpStyleItem(), 96 mpColorItem(), 97 mpFillGradientItem(), 98 mpHatchItem(), 99 mpBitmapItem(), 100 mpColorTableItem(), 101 mpGradientListItem(), 102 mpHatchListItem(), 103 mpBitmapListItem(), 104 maStyleControl(SID_ATTR_FILL_STYLE, *pBindings, *this), 105 maColorControl(SID_ATTR_FILL_COLOR, *pBindings, *this), 106 maGradientControl(SID_ATTR_FILL_GRADIENT, *pBindings, *this), 107 maHatchControl(SID_ATTR_FILL_HATCH, *pBindings, *this), 108 maBitmapControl(SID_ATTR_FILL_BITMAP, *pBindings, *this), 109 maColorTableControl(SID_COLOR_TABLE, *pBindings, *this), 110 maGradientListControl(SID_GRADIENT_LIST, *pBindings, *this), 111 maHatchListControl(SID_HATCH_LIST, *pBindings, *this), 112 maBitmapListControl(SID_BITMAP_LIST, *pBindings, *this), 113 maFillTransparenceController(SID_ATTR_FILL_TRANSPARENCE, *pBindings, *this), 114 maFillFloatTransparenceController(SID_ATTR_FILL_FLOATTRANSPARENCE, *pBindings, *this), 115 maImgAxial(SVX_RES(IMG_AXIAL)), 116 maImgElli(SVX_RES(IMG_ELLI)), 117 maImgQuad(SVX_RES(IMG_QUAD)), 118 maImgRadial(SVX_RES(IMG_RADIAL)), 119 maImgSquare(SVX_RES(IMG_SQUARE)), 120 maImgLinear(SVX_RES(IMG_LINEAR)), 121 maImgColor(SVX_RES(IMG_COLOR)), 122 maImgAxialH(SVX_RES(IMG_AXIAL_H)), 123 maImgElliH(SVX_RES(IMG_ELLI_H)), 124 maImgQuadH(SVX_RES(IMG_QUAD_H)), 125 maImgRadialH(SVX_RES(IMG_RADIAL_H)), 126 maImgSquareH(SVX_RES(IMG_SQUARE_H)), 127 maImgLinearH(SVX_RES(IMG_LINEAR_H)), 128 maImgColorH(SVX_RES(IMG_COLOR_H)), 129 msHelpFillType(SVX_RES(STR_HELP_TYPE)), 130 msHelpFillAttr(SVX_RES(STR_HELP_ATTR)), 131 maTrGrPopup(this, ::boost::bind(&AreaPropertyPanel::CreateTransparencyGradientControl, this, _1)), 132 maColorPopup(this, ::boost::bind(&AreaPropertyPanel::CreateColorPopupControl, this, _1)), 133 mpFloatTransparenceItem(), 134 mpTransparanceItem(), 135 mxFrame(rxFrame), 136 mpBindings(pBindings), 137 mbTBShow(true), 138 mbColorAvail(true) 139 { 140 Initialize(); 141 FreeResource(); 142 } 143 144 145 146 AreaPropertyPanel::~AreaPropertyPanel() 147 { 148 // Destroy the toolboxes, then their background windows. 149 mpToolBoxColor.reset(); 150 mpBTNGradient.reset(); 151 mpToolBoxColorBackground.reset(); 152 mpBTNGradientBackground.reset(); 153 } 154 155 156 157 void AreaPropertyPanel::Initialize() 158 { 159 mpColorTextFT->SetBackground(Wallpaper()); 160 mpTrspTextFT->SetBackground(Wallpaper()); 161 162 maGradientLinear.SetXOffset(DEFAULT_CENTERX); 163 maGradientLinear.SetYOffset(DEFAULT_CENTERY); 164 maGradientLinear.SetAngle(DEFAULT_ANGLE); 165 maGradientLinear.SetStartColor(Color(DEFAULT_STARTVALUE)); 166 maGradientLinear.SetEndColor(Color(DEFAULT_ENDVALUE)); 167 maGradientLinear.SetBorder(DEFAULT_BORDER); 168 maGradientLinear.SetGradientStyle(XGRAD_LINEAR); 169 170 maGradientAxial = maGradientLinear; 171 maGradientAxial.SetGradientStyle(XGRAD_AXIAL); 172 173 maGradientRadial = maGradientLinear; 174 maGradientRadial.SetGradientStyle(XGRAD_RADIAL); 175 176 maGradientElliptical = maGradientLinear; 177 maGradientElliptical.SetGradientStyle(XGRAD_ELLIPTICAL); 178 179 maGradientSquare = maGradientLinear; 180 maGradientSquare.SetGradientStyle(XGRAD_SQUARE); 181 182 maGradientRect = maGradientLinear; 183 maGradientRect.SetGradientStyle(XGRAD_RECT); 184 185 Size aLogicalFillSize(MBOX_WIDTH,LISTBOX_HEIGHT); 186 Size aLogicalAttrSize(MBOX_WIDTH + 1,LISTBOX_HEIGHT); 187 188 Point aPoint(SECTIONPAGE_MARGIN_HORIZONTAL,SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL); 189 Point aPoint_Picker(SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL,SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL); 190 191 Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT)); 192 Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT)); 193 194 Point aTypePoint(LogicToPixel(aPoint, MAP_APPFONT)); 195 Point aAttrPoint(LogicToPixel(aPoint_Picker, MAP_APPFONT)); 196 197 mpLbFillType->SetPosSizePixel(aTypePoint,aTypeSize); 198 mpLbFillAttr->SetPosSizePixel(aAttrPoint,aAttrSize); 199 200 mpLbFillType->SetHelpId(HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES); 201 mpLbFillAttr->SetHelpId(HID_PPROPERTYPANEL_AREA_LB_FILL_ATTR); 202 203 mpLbFillType->SetQuickHelpText(msHelpFillType); 204 mpLbFillAttr->SetQuickHelpText(msHelpFillAttr); 205 206 mpLbFillType->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Fill"))); //wj acc 207 mpLbFillAttr->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Fill"))); //wj acc 208 209 Link aLink = LINK( this, AreaPropertyPanel, SelectFillTypeHdl ); 210 mpLbFillType->SetSelectHdl( aLink ); 211 212 aLink = LINK( this, AreaPropertyPanel, SelectFillAttrHdl ); 213 mpLbFillAttr->SetSelectHdl( aLink ); 214 215 //add for new color picker 216 mpLbFillAttr->Hide(); 217 mpToolBoxColor->SetItemImage(TBI_COLOR, GetDisplayBackground().GetColor().IsDark()? maImgColorH : maImgColor); 218 Size aTbxSize( mpToolBoxColor->CalcWindowSizePixel() ); 219 mpToolBoxColor->SetOutputSizePixel( aTbxSize ); 220 mpToolBoxColor->SetItemBits( TBI_COLOR, mpToolBoxColor->GetItemBits( TBI_COLOR ) | TIB_DROPDOWNONLY ); 221 mpToolBoxColor->SetBackground(Wallpaper()); 222 mpToolBoxColor->SetPaintTransparent(true); 223 mpToolBoxColor->SetQuickHelpText(TBI_COLOR, String(SVX_RES(STR_HELP_COLOR))); //wj acc 224 //mpToolBoxColor->SetItemText(TBI_COLOR, msHelpFillAttr); 225 226 long aHeightLBStyle = mpLbFillType->GetSizePixel().getHeight(); 227 long aLBPosY = mpLbFillType->GetPosPixel().getY(); 228 long aHeightTBAttr = mpToolBoxColor->GetSizePixel().getHeight(); 229 Point aPointTBAttr = mpToolBoxColor->GetPosPixel(); 230 aPointTBAttr.setY( aLBPosY + aHeightLBStyle / 2 - aHeightTBAttr / 2); 231 mpToolBoxColor->SetPosPixel(aPointTBAttr); 232 233 aLink = LINK(this, AreaPropertyPanel, ToolBoxColorDropHdl); 234 mpToolBoxColor->SetDropdownClickHdl ( aLink ); 235 mpToolBoxColor->SetSelectHdl ( aLink ); 236 237 //add end 238 mpLBTransType->SetSelectHdl(LINK(this, AreaPropertyPanel, ChangeTrgrTypeHdl_Impl)); 239 mpLBTransType->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency"))); //wj acc 240 241 mpMTRTransparent->SetValue( 50 ); 242 mpMTRTransparent->SetModifyHdl(LINK(this, AreaPropertyPanel, ModifyTransparentHdl_Impl)); 243 mpMTRTransparent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency"))); //wj acc 244 245 mpBTNGradient->SetItemBits( TBI_BTX_GRADIENT, mpBTNGradient->GetItemBits( TBI_BTX_GRADIENT ) | TIB_DROPDOWNONLY ); 246 aLink = LINK( this, AreaPropertyPanel, ClickTrGrHdl_Impl ); 247 mpBTNGradient->SetDropdownClickHdl( aLink ); 248 mpBTNGradient->SetSelectHdl( aLink ); 249 aTbxSize = mpBTNGradient->CalcWindowSizePixel(); 250 mpBTNGradient->SetOutputSizePixel( aTbxSize ); 251 mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,maImgLinear); 252 mpBTNGradient->SetQuickHelpText(TBI_BTX_GRADIENT, String(SVX_RES(STR_HELP_GRADIENT))); //wj acc 253 mpBTNGradient->Hide(); 254 255 long aHeightLBTrans = mpLBTransType->GetSizePixel().getHeight(); 256 Point aPointLB = mpLBTransType->GetPosPixel(); 257 long aPosY = aPointLB.getY(); 258 259 Point aPointMetric = mpMTRTransparent->GetPosPixel(); 260 Point aPointTB = mpMTRTransparent->GetPosPixel(); 261 long aHeightMetric = mpMTRTransparent->GetSizePixel().getHeight(); 262 long aHeightTool = mpBTNGradient->GetSizePixel().getHeight(); 263 aPointMetric.setY(aPosY+aHeightLBTrans/2-aHeightMetric/2); 264 aPointTB.setY(aPosY+aHeightLBTrans/2-aHeightTool/2); 265 aPointTB.setX(aPointTB.getX()+3); 266 mpMTRTransparent->SetPosPixel(aPointMetric); 267 mpBTNGradient->SetPosPixel(aPointTB); 268 269 mpLbFillType->SetAccessibleRelationLabeledBy(mpColorTextFT.get()); 270 mpLbFillAttr->SetAccessibleRelationLabeledBy(mpLbFillAttr.get()); 271 mpToolBoxColor->SetAccessibleRelationLabeledBy(mpToolBoxColor.get()); 272 mpLBTransType->SetAccessibleRelationLabeledBy(mpTrspTextFT.get()); 273 mpMTRTransparent->SetAccessibleRelationLabeledBy(mpMTRTransparent.get()); 274 mpBTNGradient->SetAccessibleRelationLabeledBy(mpBTNGradient.get()); 275 276 SetupIcons(); 277 } 278 279 280 281 IMPL_LINK( AreaPropertyPanel, SelectFillTypeHdl, ListBox *, pToolBox ) 282 { 283 XFillStyle eXFS = (XFillStyle)mpLbFillType->GetSelectEntryPos(); 284 285 if( (XFillStyle) meLastXFS != eXFS ) 286 { 287 mpLbFillAttr->Clear(); 288 SfxObjectShell* pSh = SfxObjectShell::Current(); 289 XFillStyleItem aXFillStyleItem( eXFS ); 290 GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_STYLE, SFX_CALLMODE_RECORD, &aXFillStyleItem, 0L); 291 292 switch( eXFS ) 293 { 294 case XFILL_NONE: 295 { 296 mpLbFillAttr->Show(); 297 mpToolBoxColor->Hide(); 298 mbTBShow = false; 299 mpLbFillType->Selected(); 300 mpLbFillAttr->Disable(); 301 } 302 break; 303 304 case XFILL_SOLID: 305 { 306 mpLbFillAttr->Hide(); 307 mpToolBoxColor->Show(); 308 mbTBShow = true; 309 String aTmpStr; 310 Color aColor = maLastColor; 311 XFillColorItem aXFillColorItem( aTmpStr, aColor ); 312 GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_COLOR, SFX_CALLMODE_RECORD, &aXFillColorItem, 0L); 313 } 314 break; 315 316 case XFILL_GRADIENT: 317 { 318 mpLbFillAttr->Show(); 319 mpToolBoxColor->Hide(); 320 mbTBShow = false; 321 if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) 322 { 323 // 324 if(mpLbFillAttr->GetEntryCount() == 0) 325 { 326 SvxGradientListItem aItem( *(const SvxGradientListItem*)( 327 pSh->GetItem( SID_GRADIENT_LIST ) ) ); 328 mpLbFillAttr->Enable(); 329 mpLbFillAttr->Clear(); 330 mpLbFillAttr->Fill( aItem.GetGradientList() ); 331 } 332 333 if ( mnLastPosGradient != LISTBOX_ENTRY_NOTFOUND) 334 { 335 SvxGradientListItem aItem( *(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) ); 336 if ( mnLastPosGradient < aItem.GetGradientList()->Count() ) 337 { 338 XGradient aGradient = aItem.GetGradientList()->GetGradient( mnLastPosGradient )->GetGradient(); 339 XFillGradientItem aXFillGradientItem( mpLbFillAttr->GetEntry(mnLastPosGradient), aGradient ); 340 GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_GRADIENT, SFX_CALLMODE_RECORD, &aXFillGradientItem, 0L); 341 mpLbFillAttr->SelectEntryPos(mnLastPosGradient); //add 342 } 343 } 344 } 345 else 346 mpLbFillAttr->Disable(); 347 } 348 break; 349 350 case XFILL_HATCH: 351 { 352 mpLbFillAttr->Show(); 353 mpToolBoxColor->Hide(); 354 mbTBShow = false; 355 if ( pSh && pSh->GetItem( SID_HATCH_LIST ) ) 356 { 357 // 358 if(mpLbFillAttr->GetEntryCount() == 0) 359 { 360 SvxHatchListItem aItem( *(const SvxHatchListItem*)( 361 pSh->GetItem( SID_HATCH_LIST ) ) ); 362 mpLbFillAttr->Enable(); 363 mpLbFillAttr->Clear(); 364 mpLbFillAttr->Fill( aItem.GetHatchList() ); 365 } 366 367 if ( mnLastPosHatch != LISTBOX_ENTRY_NOTFOUND ) 368 { 369 SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) ); 370 if ( mnLastPosHatch < aItem.GetHatchList()->Count() ) 371 { 372 XHatch aHatch = aItem.GetHatchList()->GetHatch( mnLastPosHatch )->GetHatch(); 373 XFillHatchItem aXFillHatchItem( mpLbFillAttr->GetSelectEntry(), aHatch ); 374 GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_HATCH, SFX_CALLMODE_RECORD, &aXFillHatchItem, 0L); 375 mpLbFillAttr->SelectEntryPos(mnLastPosHatch); //add 376 } 377 } 378 } 379 else 380 mpLbFillAttr->Disable(); 381 } 382 break; 383 384 case XFILL_BITMAP: 385 { 386 mpLbFillAttr->Show(); 387 mpToolBoxColor->Hide(); 388 mbTBShow = false; 389 if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) ) 390 { 391 // 392 if(mpLbFillAttr->GetEntryCount() == 0) 393 { 394 SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( 395 pSh->GetItem( SID_BITMAP_LIST ) ) ); 396 mpLbFillAttr->Enable(); 397 mpLbFillAttr->Clear(); 398 mpLbFillAttr->Fill( aItem.GetBitmapList() ); 399 } 400 401 if ( mnLastPosBitmap != LISTBOX_ENTRY_NOTFOUND ) 402 { 403 SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) ); 404 if ( mnLastPosBitmap < aItem.GetBitmapList()->Count() ) 405 { 406 const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(mnLastPosBitmap); 407 XFillBitmapItem aXFillBitmapItem( mpLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject() ); 408 GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_BITMAP, SFX_CALLMODE_RECORD, &aXFillBitmapItem, 0L); 409 mpLbFillAttr->SelectEntryPos(mnLastPosBitmap); //add 410 } 411 } 412 } 413 else 414 mpLbFillAttr->Disable(); 415 } 416 break; 417 } 418 meLastXFS = (sal_uInt16)eXFS; 419 if( eXFS != XFILL_NONE ) 420 { 421 if ( pToolBox ) 422 mpLbFillType->Selected(); 423 } 424 } 425 return 0; 426 } 427 428 429 430 IMPL_LINK( AreaPropertyPanel, SelectFillAttrHdl, ListBox*, pToolBox ) 431 { 432 XFillStyle eXFS = (XFillStyle)mpLbFillType->GetSelectEntryPos(); 433 XFillStyleItem aXFillStyleItem( eXFS ); 434 SfxObjectShell* pSh = SfxObjectShell::Current(); 435 436 if(pToolBox) 437 { 438 if( (XFillStyle) meLastXFS != eXFS ) 439 { 440 GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_STYLE, SFX_CALLMODE_RECORD, &aXFillStyleItem, 0L); //Added 20090909 441 } 442 443 switch( eXFS ) 444 { 445 case XFILL_SOLID: 446 //{ 447 // //String aTmpStr = mpLbFillAttr->GetSelectEntry(); 448 // //Color aColor = mpLbFillAttr->GetSelectEntryColor(); 449 // //if(aColor.GetColor() == 0 && aTmpStr.Equals(String::CreateFromAscii(""))) 450 // String aTmpStr; 451 // Color aColor = maLastColor; 452 // XFillColorItem aXFillColorItem( aTmpStr, aColor ); 453 // GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_COLOR, SFX_CALLMODE_RECORD, &aXFillColorItem, 0L); 454 // maLastColor = aColor; 455 //} 456 break; 457 458 case XFILL_GRADIENT: 459 { 460 sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos(); 461 if( nPos == LISTBOX_ENTRY_NOTFOUND ) 462 nPos = mnLastPosGradient; 463 464 if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) 465 { 466 SvxGradientListItem aItem( *(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) ); 467 if ( nPos < aItem.GetGradientList()->Count() ) 468 { 469 XGradient aGradient = aItem.GetGradientList()->GetGradient( nPos )->GetGradient(); 470 XFillGradientItem aXFillGradientItem( mpLbFillAttr->GetSelectEntry(), aGradient ); 471 GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_GRADIENT, SFX_CALLMODE_RECORD, &aXFillGradientItem, 0L); 472 } 473 } 474 if(nPos != LISTBOX_ENTRY_NOTFOUND) 475 mnLastPosGradient = nPos; 476 } 477 break; 478 479 case XFILL_HATCH: 480 { 481 sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos(); 482 if( nPos == LISTBOX_ENTRY_NOTFOUND ) 483 nPos = mnLastPosHatch; 484 if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_HATCH_LIST ) ) 485 { 486 SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) ); 487 if ( nPos < aItem.GetHatchList()->Count() ) 488 { 489 XHatch aHatch = aItem.GetHatchList()->GetHatch( nPos )->GetHatch(); 490 XFillHatchItem aXFillHatchItem( mpLbFillAttr->GetSelectEntry(), aHatch ); 491 GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_HATCH, SFX_CALLMODE_RECORD, &aXFillHatchItem, 0L); 492 } 493 } 494 if(nPos != LISTBOX_ENTRY_NOTFOUND) 495 mnLastPosHatch = nPos; 496 } 497 break; 498 499 case XFILL_BITMAP: 500 { 501 sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos(); 502 if( nPos == LISTBOX_ENTRY_NOTFOUND ) 503 nPos = mnLastPosBitmap; 504 if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_BITMAP_LIST ) ) 505 { 506 SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) ); 507 if ( nPos < aItem.GetBitmapList()->Count() ) 508 { 509 const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(nPos); 510 XFillBitmapItem aXFillBitmapItem( mpLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject() ); 511 GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_BITMAP, SFX_CALLMODE_RECORD, &aXFillBitmapItem, 0L); 512 } 513 } 514 if(nPos != LISTBOX_ENTRY_NOTFOUND) 515 mnLastPosBitmap = nPos; 516 } 517 break; 518 519 default: 520 break; 521 } 522 } 523 return 0; 524 } 525 526 527 //add for color picker 528 529 IMPL_LINK(AreaPropertyPanel, ToolBoxColorDropHdl, ToolBox*, pToolBox) 530 { 531 sal_uInt16 nId = pToolBox->GetCurItemId(); 532 533 if(nId == TBI_COLOR) 534 { 535 maColorPopup.Show(*pToolBox); 536 if (mpColorItem) 537 maColorPopup.SetCurrentColor(mpColorItem->GetColorValue(), mbColorAvail); 538 else 539 maColorPopup.SetCurrentColor(COL_WHITE, false); 540 } 541 542 return 0; 543 } 544 545 546 547 void AreaPropertyPanel::SetColor ( 548 const String& rsColorName, 549 const Color aColor) 550 { 551 XFillColorItem aXFillColorItem (rsColorName, aColor); 552 mpBindings->GetDispatcher()->Execute(SID_ATTR_FILL_COLOR, SFX_CALLMODE_RECORD, &aXFillColorItem, 0L); 553 maLastColor = aColor; 554 } 555 556 557 558 559 PopupControl* AreaPropertyPanel::CreateTransparencyGradientControl (PopupContainer* pParent) 560 { 561 return new AreaTransparencyGradientControl(pParent, *this); 562 } 563 564 565 566 567 PopupControl* AreaPropertyPanel::CreateColorPopupControl (PopupContainer* pParent) 568 { 569 return new ColorControl( 570 pParent, 571 mpBindings, 572 SVX_RES(RID_POPUPPANEL_AERAPAGE_COLOR), 573 SVX_RES(VS_COLOR), 574 ::boost::bind(&AreaPropertyPanel::GetLastColor, this), 575 ::boost::bind(&AreaPropertyPanel::SetColor, this, _1,_2), 576 pParent, 577 0); 578 } 579 580 581 582 583 void AreaPropertyPanel::SetupIcons(void) 584 { 585 if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) 586 { 587 // todo 588 } 589 else 590 { 591 // todo 592 } 593 } 594 595 596 597 AreaPropertyPanel* AreaPropertyPanel::Create ( 598 Window* pParent, 599 const cssu::Reference<css::frame::XFrame>& rxFrame, 600 SfxBindings* pBindings) 601 { 602 if (pParent == NULL) 603 throw lang::IllegalArgumentException(A2S("no parent Window given to AreaPropertyPanel::Create"), NULL, 0); 604 if ( ! rxFrame.is()) 605 throw lang::IllegalArgumentException(A2S("no XFrame given to AreaPropertyPanel::Create"), NULL, 1); 606 if (pBindings == NULL) 607 throw lang::IllegalArgumentException(A2S("no SfxBindings given to AreaPropertyPanel::Create"), NULL, 2); 608 609 return new AreaPropertyPanel( 610 pParent, 611 rxFrame, 612 pBindings); 613 } 614 615 616 617 void AreaPropertyPanel::DataChanged( 618 const DataChangedEvent& rEvent) 619 { 620 (void)rEvent; 621 622 SetupIcons(); 623 } 624 625 626 627 void AreaPropertyPanel::ImpUpdateTransparencies() 628 { 629 if(mpTransparanceItem.get() || mpFloatTransparenceItem.get()) 630 { 631 bool bZeroValue(false); 632 633 if(mpTransparanceItem.get()) 634 { 635 const sal_uInt16 nValue(mpTransparanceItem->GetValue()); 636 637 if(!nValue) 638 { 639 bZeroValue = true; 640 } 641 else if(nValue <= 100) 642 { 643 mpLBTransType->Enable(); 644 mpLBTransType->SelectEntryPos(1); 645 mpBTNGradient->Hide(); 646 mpMTRTransparent->Show(); 647 mpMTRTransparent->Enable(); 648 mpMTRTransparent->SetValue(nValue); 649 } 650 651 if(!bZeroValue) 652 { 653 maTrGrPopup.Hide(); 654 } 655 } 656 657 if(bZeroValue && mpFloatTransparenceItem.get()) 658 { 659 if(mpFloatTransparenceItem->IsEnabled()) 660 { 661 const XGradient& rGradient = mpFloatTransparenceItem->GetGradientValue(); 662 const bool bHighContrast(GetSettings().GetStyleSettings().GetHighContrastMode()); 663 sal_uInt16 nEntryPos(0); 664 Image* pImage = 0; 665 666 mpLBTransType->Enable(); 667 mpMTRTransparent->Hide(); 668 mpBTNGradient->Enable(); 669 mpBTNGradient->Show(); 670 671 switch(rGradient.GetGradientStyle()) 672 { 673 case XGRAD_LINEAR: 674 { 675 nEntryPos = 2; 676 pImage = bHighContrast ? &maImgLinearH : &maImgLinear; 677 break; 678 } 679 case XGRAD_AXIAL: 680 { 681 nEntryPos = 3; 682 pImage = bHighContrast ? &maImgAxialH : &maImgAxial; 683 break; 684 } 685 case XGRAD_RADIAL: 686 { 687 nEntryPos = 4; 688 pImage = bHighContrast ? &maImgRadialH : &maImgRadial; 689 break; 690 } 691 case XGRAD_ELLIPTICAL: 692 { 693 nEntryPos = 5; 694 pImage = bHighContrast ? &maImgElliH : &maImgElli; 695 break; 696 } 697 case XGRAD_SQUARE: 698 { 699 nEntryPos = 6; 700 pImage = bHighContrast ? &maImgQuadH : &maImgQuad; 701 break; 702 } 703 case XGRAD_RECT: 704 { 705 nEntryPos = 7; 706 pImage = bHighContrast ? &maImgSquareH : &maImgSquare; 707 break; 708 } 709 } 710 711 mpLBTransType->SelectEntryPos(nEntryPos); 712 mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT, *pImage); 713 bZeroValue = false; 714 } 715 else 716 { 717 bZeroValue = true; 718 } 719 } 720 721 if(bZeroValue) 722 { 723 mpLBTransType->Enable(); 724 mpLBTransType->SelectEntryPos(0); 725 mpBTNGradient->Hide(); 726 mpMTRTransparent->Enable(); 727 mpMTRTransparent->Show(); 728 mpMTRTransparent->SetValue(0); 729 } 730 } 731 else 732 { 733 // no transparency at all 734 mpLBTransType->SetNoSelection(); 735 mpMTRTransparent->Disable(); 736 mpMTRTransparent->Show(); 737 mpBTNGradient->Disable(); 738 mpBTNGradient->Hide(); 739 } 740 } 741 742 743 744 void AreaPropertyPanel::NotifyItemUpdate( 745 sal_uInt16 nSID, 746 SfxItemState eState, 747 const SfxPoolItem* pState) 748 { 749 XFillStyle eXFS; 750 SfxObjectShell* pSh = SfxObjectShell::Current(); 751 bool bFillTransparenceChanged(false); 752 753 if(SID_ATTR_FILL_TRANSPARENCE == nSID) 754 { 755 bFillTransparenceChanged = true; 756 757 if(eState >= SFX_ITEM_AVAILABLE) 758 { 759 const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState); 760 761 if(pItem && (!mpTransparanceItem || *pItem != *mpTransparanceItem)) 762 { 763 mpTransparanceItem.reset((SfxUInt16Item*)pItem->Clone()); 764 } 765 else 766 { 767 mpTransparanceItem.reset(); 768 } 769 } 770 else 771 { 772 mpTransparanceItem.reset(); 773 } 774 } 775 else if(SID_ATTR_FILL_FLOATTRANSPARENCE == nSID) 776 { 777 bFillTransparenceChanged = true; 778 779 if(eState >= SFX_ITEM_AVAILABLE) 780 { 781 const XFillFloatTransparenceItem* pItem = dynamic_cast< const XFillFloatTransparenceItem* >(pState); 782 783 if(pItem && (!mpFloatTransparenceItem || *pItem != *mpFloatTransparenceItem)) 784 { 785 mpFloatTransparenceItem.reset((XFillFloatTransparenceItem*)pItem->Clone()); 786 } 787 else 788 { 789 mpFloatTransparenceItem.reset(); 790 } 791 } 792 else 793 { 794 mpFloatTransparenceItem.reset(); 795 } 796 } 797 798 if(bFillTransparenceChanged) 799 { 800 // update transparency settings dependent of mpTransparanceItem and mpFloatTransparenceItem 801 ImpUpdateTransparencies(); 802 } 803 804 if (nSID == SID_ATTR_FILL_STYLE ) 805 { 806 if( eState == SFX_ITEM_DISABLED ) 807 { 808 mpLbFillType->Disable(); 809 mpLbFillType->SetNoSelection(); 810 mpLbFillAttr->Show(); 811 mpLbFillAttr->Disable(); 812 mpLbFillAttr->SetNoSelection(); 813 mpToolBoxColor->Hide(); 814 mbTBShow = false; 815 meLastXFS = -1; 816 mpStyleItem.reset(); 817 } 818 else if( SFX_ITEM_AVAILABLE == eState ) 819 { 820 mpStyleItem.reset(pState ? (XFillStyleItem*)pState->Clone() : 0); 821 mpLbFillType->Enable(); 822 823 eXFS = (XFillStyle)mpStyleItem->GetValue(); 824 meLastXFS = eXFS; 825 mpLbFillType->SelectEntryPos( 826 sal::static_int_cast< sal_uInt16 >( eXFS ) ); 827 //Added for select invisable 828 if(eXFS == XFILL_NONE) 829 { 830 mpLbFillAttr->SetNoSelection(); 831 mpLbFillAttr->Disable(); 832 } 833 //else 834 // mpLbFillAttr->Enable(); 835 Update(); 836 //SelectFillTypeHdl( NULL ); 837 } 838 else 839 { 840 mpLbFillType->SetNoSelection(); 841 mpLbFillAttr->Show(); 842 mpLbFillAttr->Disable(); 843 mpLbFillAttr->SetNoSelection(); 844 mpToolBoxColor->Hide(); 845 mbTBShow = false; 846 meLastXFS = -1; //Added 847 mpStyleItem.reset(); 848 } 849 } 850 else if(nSID == SID_ATTR_FILL_COLOR) 851 { 852 if( SFX_ITEM_AVAILABLE == eState) 853 { 854 mpColorItem.reset(pState ? (XFillColorItem*)pState->Clone() : 0); 855 } 856 if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_SOLID) 857 { 858 mpLbFillAttr->Hide(); 859 mpToolBoxColor->Show(); 860 mbTBShow = true; 861 if( SFX_ITEM_AVAILABLE == eState) 862 { 863 mpToolBoxColor->Enable(); 864 mbColorAvail = true; // 865 // maLastColor = mpColorItem->GetColorValue(); 866 Update(); 867 } 868 else if(SFX_ITEM_DISABLED == eState ) 869 { 870 mpToolBoxColor->Disable(); 871 mbColorAvail = false; // 872 mpColorUpdater->Update(COL_WHITE); 873 } 874 else 875 { 876 mbColorAvail = false; // 877 mpColorUpdater->Update(COL_WHITE); 878 } 879 } 880 } 881 else if(nSID == SID_ATTR_FILL_GRADIENT) 882 { 883 if( SFX_ITEM_AVAILABLE == eState) 884 { 885 mpFillGradientItem.reset(pState ? (XFillGradientItem*)pState->Clone() : 0); 886 } 887 if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_GRADIENT ) 888 { 889 mpLbFillAttr->Show(); 890 mpToolBoxColor->Hide(); 891 mbTBShow = false; 892 if( SFX_ITEM_AVAILABLE == eState) 893 { 894 mpLbFillAttr->Enable(); 895 Update(); 896 } 897 898 else if(SFX_ITEM_DISABLED == eState ) 899 { 900 mpLbFillAttr->Disable(); 901 mpLbFillAttr->SetNoSelection(); 902 } 903 else 904 mpLbFillAttr->SetNoSelection(); 905 } 906 } 907 else if(nSID == SID_ATTR_FILL_HATCH) 908 { 909 if( SFX_ITEM_AVAILABLE == eState) 910 { 911 mpHatchItem.reset(pState ? (XFillHatchItem*)pState->Clone() : 0); 912 } 913 if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_HATCH ) 914 { 915 mpLbFillAttr->Show(); 916 mpToolBoxColor->Hide(); 917 mbTBShow = false; 918 if( SFX_ITEM_AVAILABLE == eState) 919 { 920 mpLbFillAttr->Enable(); 921 Update(); 922 } 923 else if(SFX_ITEM_DISABLED == eState ) 924 { 925 mpLbFillAttr->Disable(); 926 mpLbFillAttr->SetNoSelection(); 927 } 928 else 929 mpLbFillAttr->SetNoSelection(); 930 } 931 } 932 else if(nSID == SID_ATTR_FILL_BITMAP) 933 { 934 if( SFX_ITEM_AVAILABLE == eState) 935 { 936 mpBitmapItem.reset(pState ? (XFillBitmapItem*)pState->Clone() : 0); 937 } 938 if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_BITMAP ) 939 { 940 mpLbFillAttr->Show(); 941 mpToolBoxColor->Hide(); 942 mbTBShow = false; 943 if( SFX_ITEM_AVAILABLE == eState) 944 { 945 mpLbFillAttr->Enable(); 946 Update(); 947 } 948 else if(SFX_ITEM_DISABLED == eState ) 949 { 950 mpLbFillAttr->Disable(); 951 mpLbFillAttr->SetNoSelection(); 952 } 953 else 954 mpLbFillAttr->SetNoSelection(); 955 } 956 } 957 else if(nSID == SID_COLOR_TABLE) 958 { 959 if( SFX_ITEM_AVAILABLE == eState) 960 { 961 mpColorTableItem.reset(pState ? (SvxColorTableItem*)pState->Clone() : 0); 962 963 if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue()== XFILL_SOLID) 964 { 965 if ( mpColorItem ) 966 { 967 String aString( mpColorItem->GetName() ); 968 Color aColor = mpColorItem->GetColorValue(); 969 mpLbFillAttr->Clear(); 970 SvxColorTableItem aItem( *(const SvxColorTableItem*)( 971 pSh->GetItem( SID_COLOR_TABLE ) ) ); 972 mpLbFillAttr->Enable(); 973 mpLbFillAttr->Fill( aItem.GetColorTable() ); 974 mpLbFillAttr->SelectEntry( aColor ); 975 } 976 else 977 mpLbFillAttr->SetNoSelection(); 978 } 979 } 980 } 981 else if(nSID == SID_GRADIENT_LIST) 982 { 983 if( SFX_ITEM_AVAILABLE == eState) 984 { 985 mpGradientListItem.reset(pState ? (SvxGradientListItem*)pState->Clone() : 0); 986 987 if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_GRADIENT) 988 { 989 if ( mpFillGradientItem ) 990 { 991 String aString( mpFillGradientItem->GetName() ); 992 mpLbFillAttr->Clear(); 993 SvxGradientListItem aItem( *(const SvxGradientListItem*)( 994 pSh->GetItem( SID_GRADIENT_LIST ) ) ); 995 mpLbFillAttr->Enable(); 996 mpLbFillAttr->Fill( aItem.GetGradientList() ); 997 mpLbFillAttr->SelectEntry( aString ); 998 } 999 else 1000 mpLbFillAttr->SetNoSelection(); 1001 } 1002 } 1003 } 1004 else if(nSID == SID_HATCH_LIST) 1005 { 1006 if( SFX_ITEM_AVAILABLE == eState) 1007 { 1008 mpHatchListItem.reset(pState ? (SvxHatchListItem*)pState->Clone() : 0); 1009 1010 if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_HATCH ) 1011 { 1012 if ( mpHatchItem) 1013 { 1014 String aString( mpHatchItem->GetName() ); 1015 mpLbFillAttr->Clear(); 1016 SvxHatchListItem aItem( *(const SvxHatchListItem*)( 1017 pSh->GetItem( SID_HATCH_LIST ) ) ); 1018 mpLbFillAttr->Enable(); 1019 mpLbFillAttr->Fill( aItem.GetHatchList() ); 1020 mpLbFillAttr->SelectEntry( aString ); 1021 } 1022 else 1023 mpLbFillAttr->SetNoSelection(); 1024 } 1025 } 1026 } 1027 else if(nSID == SID_BITMAP_LIST) 1028 { 1029 if( SFX_ITEM_AVAILABLE == eState) 1030 { 1031 mpBitmapListItem.reset(pState ? (SvxBitmapListItem*)pState->Clone() : 0); 1032 1033 if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_BITMAP ) 1034 { 1035 if ( mpBitmapItem ) 1036 { 1037 String aString( mpBitmapItem->GetName() ); 1038 mpLbFillAttr->Clear(); 1039 SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( 1040 pSh->GetItem( SID_BITMAP_LIST ) ) ); 1041 mpLbFillAttr->Enable(); 1042 mpLbFillAttr->Fill( aItem.GetBitmapList() ); 1043 mpLbFillAttr->SelectEntry( aString ); 1044 } 1045 else 1046 mpLbFillAttr->SetNoSelection(); 1047 } 1048 } 1049 } 1050 } 1051 1052 1053 1054 SfxBindings* AreaPropertyPanel::GetBindings() 1055 { 1056 return mpBindings; 1057 } 1058 1059 1060 1061 void AreaPropertyPanel::Update() 1062 { 1063 if ( mpStyleItem ) 1064 { 1065 XFillStyle eXFS = (XFillStyle)mpStyleItem->GetValue(); 1066 SfxObjectShell* pSh = SfxObjectShell::Current(); 1067 1068 switch( eXFS ) 1069 { 1070 case XFILL_NONE: 1071 { 1072 mpLbFillAttr->Show(); //wj for new color picker 1073 mpToolBoxColor->Hide(); //wj for new color picker 1074 mbTBShow = false; 1075 } 1076 break; 1077 1078 case XFILL_SOLID: 1079 { 1080 if ( mpColorItem ) 1081 { 1082 mpLbFillAttr->Hide(); //wj for new color picker 1083 mpToolBoxColor->Show(); //wj for new color picker 1084 mbTBShow = true; 1085 mpColorUpdater->Update(mpColorItem->GetColorValue()); 1086 } 1087 else 1088 mpColorUpdater->Update(COL_WHITE); 1089 } 1090 break; 1091 1092 case XFILL_GRADIENT: 1093 { 1094 mpLbFillAttr->Show(); //wj for new color picker 1095 mpToolBoxColor->Hide(); //wj for new color picker 1096 mbTBShow = false; 1097 if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) 1098 { 1099 SvxGradientListItem aItem( *(const SvxGradientListItem*)( 1100 pSh->GetItem( SID_GRADIENT_LIST ) ) ); 1101 mpLbFillAttr->Enable(); 1102 mpLbFillAttr->Clear(); 1103 mpLbFillAttr->Fill( aItem.GetGradientList() ); 1104 if ( mpFillGradientItem ) 1105 { 1106 String aString( mpFillGradientItem->GetName() ); 1107 mpLbFillAttr->SelectEntry( aString ); 1108 } 1109 else 1110 mpLbFillAttr->SetNoSelection(); 1111 } 1112 else 1113 mpLbFillAttr->SetNoSelection(); 1114 } 1115 break; 1116 1117 case XFILL_HATCH: 1118 { 1119 mpLbFillAttr->Show(); //wj for new color picker 1120 mpToolBoxColor->Hide(); //wj for new color picker 1121 mbTBShow = false; 1122 if ( pSh && pSh->GetItem( SID_HATCH_LIST ) ) 1123 { 1124 SvxHatchListItem aItem( *(const SvxHatchListItem*)( 1125 pSh->GetItem( SID_HATCH_LIST ) ) ); 1126 mpLbFillAttr->Enable(); 1127 mpLbFillAttr->Clear(); 1128 mpLbFillAttr->Fill( aItem.GetHatchList() ); 1129 if ( mpHatchItem ) 1130 { 1131 String aString( mpHatchItem->GetName() ); 1132 mpLbFillAttr->SelectEntry( aString ); 1133 } 1134 else 1135 mpLbFillAttr->SetNoSelection(); 1136 } 1137 else 1138 mpLbFillAttr->SetNoSelection(); 1139 } 1140 break; 1141 1142 case XFILL_BITMAP: 1143 { 1144 mpLbFillAttr->Show(); //wj for new color picker 1145 mpToolBoxColor->Hide(); //wj for new color picker 1146 mbTBShow = false; 1147 //mpLbFillAttr->Fill( mpBitmapListItem->GetBitmapList() ); 1148 if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) ) 1149 { 1150 SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( 1151 pSh->GetItem( SID_BITMAP_LIST ) ) ); 1152 mpLbFillAttr->Enable(); 1153 mpLbFillAttr->Clear(); 1154 mpLbFillAttr->Fill( aItem.GetBitmapList() ); 1155 if ( mpBitmapItem ) 1156 { 1157 String aString( mpBitmapItem->GetName() ); 1158 mpLbFillAttr->SelectEntry( aString ); 1159 } 1160 else 1161 mpLbFillAttr->SetNoSelection(); 1162 } 1163 else 1164 mpLbFillAttr->SetNoSelection(); 1165 } 1166 break; 1167 1168 default: 1169 DBG_ERROR( "Nicht unterstuetzter Flaechentyp" ); 1170 break; 1171 } 1172 } 1173 } 1174 1175 1176 1177 IMPL_LINK( AreaPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG ) 1178 { 1179 return 0; 1180 } 1181 1182 1183 1184 IMPL_LINK( AreaPropertyPanel, ClickTrGrHdl_Impl, ToolBox*, pToolBox ) 1185 { 1186 maTrGrPopup.Rearrange(mpFloatTransparenceItem.get()); 1187 1188 OSL_ASSERT(pToolBox->GetCurItemId() == TBI_BTX_GRADIENT); 1189 1190 maTrGrPopup.Show(*pToolBox); 1191 1192 return (0L); 1193 } 1194 1195 1196 1197 IMPL_LINK(AreaPropertyPanel, ChangeTrgrTypeHdl_Impl, void *, EMPTYARG) 1198 { 1199 sal_uInt16 nSelectType = mpLBTransType->GetSelectEntryPos(); 1200 bool bGradient = false; 1201 sal_uInt16 nTrans = 0; 1202 1203 if (nSelectType == 0) 1204 { 1205 mpBTNGradient->Hide(); 1206 mpMTRTransparent->Show(); 1207 mpMTRTransparent->Enable(); 1208 mpMTRTransparent->SetValue(0); 1209 } 1210 else if (nSelectType == 1) 1211 { 1212 mpBTNGradient->Hide(); 1213 mpMTRTransparent->Show(); 1214 nTrans = mnLastTransSolid; 1215 mpMTRTransparent->SetValue(nTrans); 1216 mpLBTransType->SelectEntryPos(1);// for multi-selected, choose solid no selection 1217 mpMTRTransparent->Enable(); 1218 } 1219 else 1220 { 1221 mpBTNGradient->Show(); 1222 //for beta1 1223 switch ( nSelectType ) 1224 { 1225 case 2: 1226 mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgLinearH : maImgLinear); // high contrast 1227 break; 1228 case 3: 1229 mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgAxialH : maImgAxial); 1230 break; 1231 case 4: 1232 mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgRadialH : maImgRadial); 1233 break; 1234 case 5: 1235 mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgElliH : maImgElli ); 1236 break; 1237 case 6: 1238 mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgQuadH : maImgQuad ); 1239 break; 1240 case 7: 1241 mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSquareH : maImgSquare); 1242 break; 1243 } 1244 //end of new code 1245 mpMTRTransparent->Hide(); 1246 mpBTNGradient->Enable(); 1247 bGradient = true; 1248 } 1249 1250 XFillTransparenceItem aLinearItem(nTrans); 1251 GetBindings()->GetDispatcher()->Execute( SID_ATTR_FILL_TRANSPARENCE, SFX_CALLMODE_RECORD, &aLinearItem, 0L ); 1252 1253 if (nSelectType > 1) nSelectType = nSelectType-2; 1254 1255 XGradient aTmpGradient; 1256 1257 switch(nSelectType) 1258 { 1259 case XGRAD_LINEAR: 1260 aTmpGradient = maGradientLinear; 1261 break; 1262 case XGRAD_AXIAL: 1263 aTmpGradient = maGradientAxial; 1264 break; 1265 case XGRAD_RADIAL: 1266 aTmpGradient = maGradientRadial; 1267 break; 1268 case XGRAD_ELLIPTICAL: 1269 aTmpGradient = maGradientElliptical; 1270 break; 1271 case XGRAD_SQUARE: 1272 aTmpGradient = maGradientSquare; 1273 break; 1274 case XGRAD_RECT: 1275 aTmpGradient = maGradientRect; 1276 break; 1277 } 1278 SfxItemPool* pPool = NULL; 1279 bool bEnable = false; 1280 if (bGradient) bEnable = true; 1281 XFillFloatTransparenceItem aGradientItem(pPool,aTmpGradient, bEnable ); 1282 1283 GetBindings()->GetDispatcher()->Execute( SID_ATTR_FILL_FLOATTRANSPARENCE, SFX_CALLMODE_RECORD, &aGradientItem, 0L ); 1284 1285 return( 0L ); 1286 } 1287 1288 1289 1290 IMPL_LINK(AreaPropertyPanel, ModifyTransparentHdl_Impl, void*, EMPTYARG) 1291 { 1292 sal_uInt16 nTrans = (sal_uInt16)mpMTRTransparent->GetValue(); 1293 mnLastTransSolid = nTrans; 1294 sal_uInt16 nSelectType = mpLBTransType->GetSelectEntryPos(); 1295 if (nTrans != 0 && nSelectType == 0) 1296 mpLBTransType->SelectEntryPos(1); 1297 XFillTransparenceItem aLinearItem(nTrans); 1298 GetBindings()->GetDispatcher()->Execute( SID_ATTR_FILL_TRANSPARENCE, SFX_CALLMODE_RECORD, &aLinearItem, 0L ); 1299 1300 return 0L; 1301 } 1302 1303 1304 Color AreaPropertyPanel::GetLastColor (void) const 1305 { 1306 return maLastColor; 1307 } 1308 1309 1310 1311 1312 XGradient AreaPropertyPanel::GetGradient (const XGradientStyle eStyle) const 1313 { 1314 switch (eStyle) 1315 { 1316 default: 1317 case XGRAD_LINEAR: 1318 return maGradientLinear; 1319 case XGRAD_AXIAL: 1320 return maGradientAxial; 1321 case XGRAD_RADIAL: 1322 return maGradientRadial; 1323 case XGRAD_ELLIPTICAL: 1324 return maGradientElliptical; 1325 case XGRAD_SQUARE: 1326 return maGradientSquare; 1327 case XGRAD_RECT: 1328 return maGradientRect; 1329 } 1330 } 1331 1332 1333 1334 1335 void AreaPropertyPanel::SetGradient (const XGradient& rGradient) 1336 { 1337 switch (rGradient.GetGradientStyle()) 1338 { 1339 case XGRAD_LINEAR: 1340 maGradientLinear = rGradient; 1341 break; 1342 case XGRAD_AXIAL: 1343 maGradientAxial = rGradient; 1344 break; 1345 case XGRAD_RADIAL: 1346 maGradientRadial = rGradient; 1347 break; 1348 case XGRAD_ELLIPTICAL: 1349 maGradientElliptical = rGradient; 1350 break; 1351 case XGRAD_SQUARE: 1352 maGradientSquare = rGradient; 1353 break; 1354 case XGRAD_RECT: 1355 maGradientRect = rGradient; 1356 break; 1357 } 1358 } 1359 1360 1361 1362 1363 sal_Int32 AreaPropertyPanel::GetSelectedTransparencyTypeIndex (void) const 1364 { 1365 return mpLBTransType->GetSelectEntryPos(); 1366 } 1367 1368 } } // end of namespace svx::sidebar 1369 1370 // eof 1371