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 const bool bIsEnabled) 752 { 753 (void)bIsEnabled; 754 755 XFillStyle eXFS; 756 SfxObjectShell* pSh = SfxObjectShell::Current(); 757 bool bFillTransparenceChanged(false); 758 759 if(SID_ATTR_FILL_TRANSPARENCE == nSID) 760 { 761 bFillTransparenceChanged = true; 762 763 if(eState >= SFX_ITEM_AVAILABLE) 764 { 765 const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState); 766 767 if(pItem && (!mpTransparanceItem || *pItem != *mpTransparanceItem)) 768 { 769 mpTransparanceItem.reset((SfxUInt16Item*)pItem->Clone()); 770 } 771 else 772 { 773 mpTransparanceItem.reset(); 774 } 775 } 776 else 777 { 778 mpTransparanceItem.reset(); 779 } 780 } 781 else if(SID_ATTR_FILL_FLOATTRANSPARENCE == nSID) 782 { 783 bFillTransparenceChanged = true; 784 785 if(eState >= SFX_ITEM_AVAILABLE) 786 { 787 const XFillFloatTransparenceItem* pItem = dynamic_cast< const XFillFloatTransparenceItem* >(pState); 788 789 if(pItem && (!mpFloatTransparenceItem || *pItem != *mpFloatTransparenceItem)) 790 { 791 mpFloatTransparenceItem.reset((XFillFloatTransparenceItem*)pItem->Clone()); 792 } 793 else 794 { 795 mpFloatTransparenceItem.reset(); 796 } 797 } 798 else 799 { 800 mpFloatTransparenceItem.reset(); 801 } 802 } 803 804 if(bFillTransparenceChanged) 805 { 806 // update transparency settings dependent of mpTransparanceItem and mpFloatTransparenceItem 807 ImpUpdateTransparencies(); 808 } 809 810 if (nSID == SID_ATTR_FILL_STYLE ) 811 { 812 if( eState == SFX_ITEM_DISABLED ) 813 { 814 mpLbFillType->Disable(); 815 mpLbFillType->SetNoSelection(); 816 mpLbFillAttr->Show(); 817 mpLbFillAttr->Disable(); 818 mpLbFillAttr->SetNoSelection(); 819 mpToolBoxColor->Hide(); 820 mbTBShow = false; 821 meLastXFS = -1; 822 mpStyleItem.reset(); 823 } 824 else if( SFX_ITEM_AVAILABLE == eState ) 825 { 826 mpStyleItem.reset(pState ? (XFillStyleItem*)pState->Clone() : 0); 827 mpLbFillType->Enable(); 828 829 eXFS = (XFillStyle)mpStyleItem->GetValue(); 830 meLastXFS = eXFS; 831 mpLbFillType->SelectEntryPos( 832 sal::static_int_cast< sal_uInt16 >( eXFS ) ); 833 //Added for select invisable 834 if(eXFS == XFILL_NONE) 835 { 836 mpLbFillAttr->SetNoSelection(); 837 mpLbFillAttr->Disable(); 838 } 839 //else 840 // mpLbFillAttr->Enable(); 841 Update(); 842 //SelectFillTypeHdl( NULL ); 843 } 844 else 845 { 846 mpLbFillType->SetNoSelection(); 847 mpLbFillAttr->Show(); 848 mpLbFillAttr->Disable(); 849 mpLbFillAttr->SetNoSelection(); 850 mpToolBoxColor->Hide(); 851 mbTBShow = false; 852 meLastXFS = -1; //Added 853 mpStyleItem.reset(); 854 } 855 } 856 else if(nSID == SID_ATTR_FILL_COLOR) 857 { 858 if( SFX_ITEM_AVAILABLE == eState) 859 { 860 mpColorItem.reset(pState ? (XFillColorItem*)pState->Clone() : 0); 861 } 862 if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_SOLID) 863 { 864 mpLbFillAttr->Hide(); 865 mpToolBoxColor->Show(); 866 mbTBShow = true; 867 if( SFX_ITEM_AVAILABLE == eState) 868 { 869 mpToolBoxColor->Enable(); 870 mbColorAvail = true; // 871 // maLastColor = mpColorItem->GetColorValue(); 872 Update(); 873 } 874 else if(SFX_ITEM_DISABLED == eState ) 875 { 876 mpToolBoxColor->Disable(); 877 mbColorAvail = false; // 878 mpColorUpdater->Update(COL_WHITE); 879 } 880 else 881 { 882 mbColorAvail = false; // 883 mpColorUpdater->Update(COL_WHITE); 884 } 885 } 886 } 887 else if(nSID == SID_ATTR_FILL_GRADIENT) 888 { 889 if( SFX_ITEM_AVAILABLE == eState) 890 { 891 mpFillGradientItem.reset(pState ? (XFillGradientItem*)pState->Clone() : 0); 892 } 893 if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_GRADIENT ) 894 { 895 mpLbFillAttr->Show(); 896 mpToolBoxColor->Hide(); 897 mbTBShow = false; 898 if( SFX_ITEM_AVAILABLE == eState) 899 { 900 mpLbFillAttr->Enable(); 901 Update(); 902 } 903 904 else if(SFX_ITEM_DISABLED == eState ) 905 { 906 mpLbFillAttr->Disable(); 907 mpLbFillAttr->SetNoSelection(); 908 } 909 else 910 mpLbFillAttr->SetNoSelection(); 911 } 912 } 913 else if(nSID == SID_ATTR_FILL_HATCH) 914 { 915 if( SFX_ITEM_AVAILABLE == eState) 916 { 917 mpHatchItem.reset(pState ? (XFillHatchItem*)pState->Clone() : 0); 918 } 919 if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_HATCH ) 920 { 921 mpLbFillAttr->Show(); 922 mpToolBoxColor->Hide(); 923 mbTBShow = false; 924 if( SFX_ITEM_AVAILABLE == eState) 925 { 926 mpLbFillAttr->Enable(); 927 Update(); 928 } 929 else if(SFX_ITEM_DISABLED == eState ) 930 { 931 mpLbFillAttr->Disable(); 932 mpLbFillAttr->SetNoSelection(); 933 } 934 else 935 mpLbFillAttr->SetNoSelection(); 936 } 937 } 938 else if(nSID == SID_ATTR_FILL_BITMAP) 939 { 940 if( SFX_ITEM_AVAILABLE == eState) 941 { 942 mpBitmapItem.reset(pState ? (XFillBitmapItem*)pState->Clone() : 0); 943 } 944 if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_BITMAP ) 945 { 946 mpLbFillAttr->Show(); 947 mpToolBoxColor->Hide(); 948 mbTBShow = false; 949 if( SFX_ITEM_AVAILABLE == eState) 950 { 951 mpLbFillAttr->Enable(); 952 Update(); 953 } 954 else if(SFX_ITEM_DISABLED == eState ) 955 { 956 mpLbFillAttr->Disable(); 957 mpLbFillAttr->SetNoSelection(); 958 } 959 else 960 mpLbFillAttr->SetNoSelection(); 961 } 962 } 963 else if(nSID == SID_COLOR_TABLE) 964 { 965 if( SFX_ITEM_AVAILABLE == eState) 966 { 967 mpColorTableItem.reset(pState ? (SvxColorTableItem*)pState->Clone() : 0); 968 969 if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue()== XFILL_SOLID) 970 { 971 if ( mpColorItem ) 972 { 973 String aString( mpColorItem->GetName() ); 974 Color aColor = mpColorItem->GetColorValue(); 975 mpLbFillAttr->Clear(); 976 SvxColorTableItem aItem( *(const SvxColorTableItem*)( 977 pSh->GetItem( SID_COLOR_TABLE ) ) ); 978 mpLbFillAttr->Enable(); 979 mpLbFillAttr->Fill( aItem.GetColorTable() ); 980 mpLbFillAttr->SelectEntry( aColor ); 981 } 982 else 983 mpLbFillAttr->SetNoSelection(); 984 } 985 } 986 } 987 else if(nSID == SID_GRADIENT_LIST) 988 { 989 if( SFX_ITEM_AVAILABLE == eState) 990 { 991 mpGradientListItem.reset(pState ? (SvxGradientListItem*)pState->Clone() : 0); 992 993 if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_GRADIENT) 994 { 995 if ( mpFillGradientItem ) 996 { 997 String aString( mpFillGradientItem->GetName() ); 998 mpLbFillAttr->Clear(); 999 SvxGradientListItem aItem( *(const SvxGradientListItem*)( 1000 pSh->GetItem( SID_GRADIENT_LIST ) ) ); 1001 mpLbFillAttr->Enable(); 1002 mpLbFillAttr->Fill( aItem.GetGradientList() ); 1003 mpLbFillAttr->SelectEntry( aString ); 1004 } 1005 else 1006 mpLbFillAttr->SetNoSelection(); 1007 } 1008 } 1009 } 1010 else if(nSID == SID_HATCH_LIST) 1011 { 1012 if( SFX_ITEM_AVAILABLE == eState) 1013 { 1014 mpHatchListItem.reset(pState ? (SvxHatchListItem*)pState->Clone() : 0); 1015 1016 if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_HATCH ) 1017 { 1018 if ( mpHatchItem) 1019 { 1020 String aString( mpHatchItem->GetName() ); 1021 mpLbFillAttr->Clear(); 1022 SvxHatchListItem aItem( *(const SvxHatchListItem*)( 1023 pSh->GetItem( SID_HATCH_LIST ) ) ); 1024 mpLbFillAttr->Enable(); 1025 mpLbFillAttr->Fill( aItem.GetHatchList() ); 1026 mpLbFillAttr->SelectEntry( aString ); 1027 } 1028 else 1029 mpLbFillAttr->SetNoSelection(); 1030 } 1031 } 1032 } 1033 else if(nSID == SID_BITMAP_LIST) 1034 { 1035 if( SFX_ITEM_AVAILABLE == eState) 1036 { 1037 mpBitmapListItem.reset(pState ? (SvxBitmapListItem*)pState->Clone() : 0); 1038 1039 if( mpStyleItem && (XFillStyle)mpStyleItem->GetValue() == XFILL_BITMAP ) 1040 { 1041 if ( mpBitmapItem ) 1042 { 1043 String aString( mpBitmapItem->GetName() ); 1044 mpLbFillAttr->Clear(); 1045 SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( 1046 pSh->GetItem( SID_BITMAP_LIST ) ) ); 1047 mpLbFillAttr->Enable(); 1048 mpLbFillAttr->Fill( aItem.GetBitmapList() ); 1049 mpLbFillAttr->SelectEntry( aString ); 1050 } 1051 else 1052 mpLbFillAttr->SetNoSelection(); 1053 } 1054 } 1055 } 1056 } 1057 1058 1059 1060 1061 SfxBindings* AreaPropertyPanel::GetBindings() 1062 { 1063 return mpBindings; 1064 } 1065 1066 1067 1068 void AreaPropertyPanel::Update() 1069 { 1070 if ( mpStyleItem ) 1071 { 1072 XFillStyle eXFS = (XFillStyle)mpStyleItem->GetValue(); 1073 SfxObjectShell* pSh = SfxObjectShell::Current(); 1074 1075 switch( eXFS ) 1076 { 1077 case XFILL_NONE: 1078 { 1079 mpLbFillAttr->Show(); //wj for new color picker 1080 mpToolBoxColor->Hide(); //wj for new color picker 1081 mbTBShow = false; 1082 } 1083 break; 1084 1085 case XFILL_SOLID: 1086 { 1087 if ( mpColorItem ) 1088 { 1089 mpLbFillAttr->Hide(); //wj for new color picker 1090 mpToolBoxColor->Show(); //wj for new color picker 1091 mbTBShow = true; 1092 mpColorUpdater->Update(mpColorItem->GetColorValue()); 1093 } 1094 else 1095 mpColorUpdater->Update(COL_WHITE); 1096 } 1097 break; 1098 1099 case XFILL_GRADIENT: 1100 { 1101 mpLbFillAttr->Show(); //wj for new color picker 1102 mpToolBoxColor->Hide(); //wj for new color picker 1103 mbTBShow = false; 1104 if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) 1105 { 1106 SvxGradientListItem aItem( *(const SvxGradientListItem*)( 1107 pSh->GetItem( SID_GRADIENT_LIST ) ) ); 1108 mpLbFillAttr->Enable(); 1109 mpLbFillAttr->Clear(); 1110 mpLbFillAttr->Fill( aItem.GetGradientList() ); 1111 if ( mpFillGradientItem ) 1112 { 1113 String aString( mpFillGradientItem->GetName() ); 1114 mpLbFillAttr->SelectEntry( aString ); 1115 } 1116 else 1117 mpLbFillAttr->SetNoSelection(); 1118 } 1119 else 1120 mpLbFillAttr->SetNoSelection(); 1121 } 1122 break; 1123 1124 case XFILL_HATCH: 1125 { 1126 mpLbFillAttr->Show(); //wj for new color picker 1127 mpToolBoxColor->Hide(); //wj for new color picker 1128 mbTBShow = false; 1129 if ( pSh && pSh->GetItem( SID_HATCH_LIST ) ) 1130 { 1131 SvxHatchListItem aItem( *(const SvxHatchListItem*)( 1132 pSh->GetItem( SID_HATCH_LIST ) ) ); 1133 mpLbFillAttr->Enable(); 1134 mpLbFillAttr->Clear(); 1135 mpLbFillAttr->Fill( aItem.GetHatchList() ); 1136 if ( mpHatchItem ) 1137 { 1138 String aString( mpHatchItem->GetName() ); 1139 mpLbFillAttr->SelectEntry( aString ); 1140 } 1141 else 1142 mpLbFillAttr->SetNoSelection(); 1143 } 1144 else 1145 mpLbFillAttr->SetNoSelection(); 1146 } 1147 break; 1148 1149 case XFILL_BITMAP: 1150 { 1151 mpLbFillAttr->Show(); //wj for new color picker 1152 mpToolBoxColor->Hide(); //wj for new color picker 1153 mbTBShow = false; 1154 //mpLbFillAttr->Fill( mpBitmapListItem->GetBitmapList() ); 1155 if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) ) 1156 { 1157 SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( 1158 pSh->GetItem( SID_BITMAP_LIST ) ) ); 1159 mpLbFillAttr->Enable(); 1160 mpLbFillAttr->Clear(); 1161 mpLbFillAttr->Fill( aItem.GetBitmapList() ); 1162 if ( mpBitmapItem ) 1163 { 1164 String aString( mpBitmapItem->GetName() ); 1165 mpLbFillAttr->SelectEntry( aString ); 1166 } 1167 else 1168 mpLbFillAttr->SetNoSelection(); 1169 } 1170 else 1171 mpLbFillAttr->SetNoSelection(); 1172 } 1173 break; 1174 1175 default: 1176 DBG_ERROR( "Nicht unterstuetzter Flaechentyp" ); 1177 break; 1178 } 1179 } 1180 } 1181 1182 1183 1184 IMPL_LINK( AreaPropertyPanel, ImplPopupModeEndHdl, FloatingWindow*, EMPTYARG ) 1185 { 1186 return 0; 1187 } 1188 1189 1190 1191 IMPL_LINK( AreaPropertyPanel, ClickTrGrHdl_Impl, ToolBox*, pToolBox ) 1192 { 1193 maTrGrPopup.Rearrange(mpFloatTransparenceItem.get()); 1194 1195 OSL_ASSERT(pToolBox->GetCurItemId() == TBI_BTX_GRADIENT); 1196 1197 maTrGrPopup.Show(*pToolBox); 1198 1199 return (0L); 1200 } 1201 1202 1203 1204 IMPL_LINK(AreaPropertyPanel, ChangeTrgrTypeHdl_Impl, void *, EMPTYARG) 1205 { 1206 sal_uInt16 nSelectType = mpLBTransType->GetSelectEntryPos(); 1207 bool bGradient = false; 1208 sal_uInt16 nTrans = 0; 1209 1210 if (nSelectType == 0) 1211 { 1212 mpBTNGradient->Hide(); 1213 mpMTRTransparent->Show(); 1214 mpMTRTransparent->Enable(); 1215 mpMTRTransparent->SetValue(0); 1216 } 1217 else if (nSelectType == 1) 1218 { 1219 mpBTNGradient->Hide(); 1220 mpMTRTransparent->Show(); 1221 nTrans = mnLastTransSolid; 1222 mpMTRTransparent->SetValue(nTrans); 1223 mpLBTransType->SelectEntryPos(1);// for multi-selected, choose solid no selection 1224 mpMTRTransparent->Enable(); 1225 } 1226 else 1227 { 1228 mpBTNGradient->Show(); 1229 //for beta1 1230 switch ( nSelectType ) 1231 { 1232 case 2: 1233 mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgLinearH : maImgLinear); // high contrast 1234 break; 1235 case 3: 1236 mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgAxialH : maImgAxial); 1237 break; 1238 case 4: 1239 mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgRadialH : maImgRadial); 1240 break; 1241 case 5: 1242 mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgElliH : maImgElli ); 1243 break; 1244 case 6: 1245 mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgQuadH : maImgQuad ); 1246 break; 1247 case 7: 1248 mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,GetSettings().GetStyleSettings().GetHighContrastMode()? maImgSquareH : maImgSquare); 1249 break; 1250 } 1251 //end of new code 1252 mpMTRTransparent->Hide(); 1253 mpBTNGradient->Enable(); 1254 bGradient = true; 1255 } 1256 1257 XFillTransparenceItem aLinearItem(nTrans); 1258 GetBindings()->GetDispatcher()->Execute( SID_ATTR_FILL_TRANSPARENCE, SFX_CALLMODE_RECORD, &aLinearItem, 0L ); 1259 1260 if (nSelectType > 1) nSelectType = nSelectType-2; 1261 1262 XGradient aTmpGradient; 1263 1264 switch(nSelectType) 1265 { 1266 case XGRAD_LINEAR: 1267 aTmpGradient = maGradientLinear; 1268 break; 1269 case XGRAD_AXIAL: 1270 aTmpGradient = maGradientAxial; 1271 break; 1272 case XGRAD_RADIAL: 1273 aTmpGradient = maGradientRadial; 1274 break; 1275 case XGRAD_ELLIPTICAL: 1276 aTmpGradient = maGradientElliptical; 1277 break; 1278 case XGRAD_SQUARE: 1279 aTmpGradient = maGradientSquare; 1280 break; 1281 case XGRAD_RECT: 1282 aTmpGradient = maGradientRect; 1283 break; 1284 } 1285 SfxItemPool* pPool = NULL; 1286 bool bEnable = false; 1287 if (bGradient) bEnable = true; 1288 XFillFloatTransparenceItem aGradientItem(pPool,aTmpGradient, bEnable ); 1289 1290 GetBindings()->GetDispatcher()->Execute( SID_ATTR_FILL_FLOATTRANSPARENCE, SFX_CALLMODE_RECORD, &aGradientItem, 0L ); 1291 1292 return( 0L ); 1293 } 1294 1295 1296 1297 IMPL_LINK(AreaPropertyPanel, ModifyTransparentHdl_Impl, void*, EMPTYARG) 1298 { 1299 sal_uInt16 nTrans = (sal_uInt16)mpMTRTransparent->GetValue(); 1300 mnLastTransSolid = nTrans; 1301 sal_uInt16 nSelectType = mpLBTransType->GetSelectEntryPos(); 1302 if (nTrans != 0 && nSelectType == 0) 1303 mpLBTransType->SelectEntryPos(1); 1304 XFillTransparenceItem aLinearItem(nTrans); 1305 GetBindings()->GetDispatcher()->Execute( SID_ATTR_FILL_TRANSPARENCE, SFX_CALLMODE_RECORD, &aLinearItem, 0L ); 1306 1307 return 0L; 1308 } 1309 1310 1311 Color AreaPropertyPanel::GetLastColor (void) const 1312 { 1313 return maLastColor; 1314 } 1315 1316 1317 1318 1319 XGradient AreaPropertyPanel::GetGradient (const XGradientStyle eStyle) const 1320 { 1321 switch (eStyle) 1322 { 1323 default: 1324 case XGRAD_LINEAR: 1325 return maGradientLinear; 1326 case XGRAD_AXIAL: 1327 return maGradientAxial; 1328 case XGRAD_RADIAL: 1329 return maGradientRadial; 1330 case XGRAD_ELLIPTICAL: 1331 return maGradientElliptical; 1332 case XGRAD_SQUARE: 1333 return maGradientSquare; 1334 case XGRAD_RECT: 1335 return maGradientRect; 1336 } 1337 } 1338 1339 1340 1341 1342 void AreaPropertyPanel::SetGradient (const XGradient& rGradient) 1343 { 1344 switch (rGradient.GetGradientStyle()) 1345 { 1346 case XGRAD_LINEAR: 1347 maGradientLinear = rGradient; 1348 break; 1349 case XGRAD_AXIAL: 1350 maGradientAxial = rGradient; 1351 break; 1352 case XGRAD_RADIAL: 1353 maGradientRadial = rGradient; 1354 break; 1355 case XGRAD_ELLIPTICAL: 1356 maGradientElliptical = rGradient; 1357 break; 1358 case XGRAD_SQUARE: 1359 maGradientSquare = rGradient; 1360 break; 1361 case XGRAD_RECT: 1362 maGradientRect = rGradient; 1363 break; 1364 } 1365 } 1366 1367 1368 1369 1370 sal_Int32 AreaPropertyPanel::GetSelectedTransparencyTypeIndex (void) const 1371 { 1372 return mpLBTransType->GetSelectEntryPos(); 1373 } 1374 1375 } } // end of namespace svx::sidebar 1376 1377 // eof 1378