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