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