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