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