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 68 AreaPropertyPanel::AreaPropertyPanel( 69 Window* pParent, 70 const cssu::Reference<css::frame::XFrame>& rxFrame, 71 SfxBindings* pBindings) 72 : Control( 73 pParent, 74 SVX_RES(RID_SIDEBAR_AREA_PANEL)), 75 meLastXFS(-1), 76 maLastColor(Color(COL_DEFAULT_SHAPE_FILLING)), 77 mnLastPosGradient(0), 78 mnLastPosHatch(0), 79 mnLastPosBitmap(0), 80 mnLastTransSolid(50), 81 maGradientLinear(), 82 maGradientAxial(), 83 maGradientRadial(), 84 maGradientElliptical(), 85 maGradientSquare(), 86 maGradientRect(), 87 mpColorTextFT(new FixedText(this, SVX_RES(FT_COLOR_LIST))), 88 mpLbFillType(new SvxFillTypeBox(this)), 89 mpLbFillAttr(new SvxFillAttrBox(this)), 90 mpToolBoxColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), 91 mpToolBoxColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpToolBoxColorBackground.get(), SVX_RES(TB_COLOR))), 92 mpTrspTextFT(new FixedText(this, SVX_RES(FL_TRSP_TEXT))), 93 mpLBTransType(new ListBox(this, SVX_RES(LB_TRGR_TYPES))), 94 mpMTRTransparent(new MetricField(this, SVX_RES(MTR_TRANSPARENT))), 95 mpBTNGradientBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), 96 mpBTNGradient(sfx2::sidebar::ControlFactory::CreateToolBox(mpBTNGradientBackground.get(), SVX_RES(BTN_GRADIENT))), 97 mpColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_FILL_COLOR, TBI_COLOR, mpToolBoxColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)), 98 mpStyleItem(), 99 mpColorItem(), 100 mpFillGradientItem(), 101 mpHatchItem(), 102 mpBitmapItem(), 103 mpColorTableItem(), 104 mpGradientListItem(), 105 mpHatchListItem(), 106 mpBitmapListItem(), 107 maStyleControl(SID_ATTR_FILL_STYLE, *pBindings, *this), 108 maColorControl(SID_ATTR_FILL_COLOR, *pBindings, *this), 109 maGradientControl(SID_ATTR_FILL_GRADIENT, *pBindings, *this), 110 maHatchControl(SID_ATTR_FILL_HATCH, *pBindings, *this), 111 maBitmapControl(SID_ATTR_FILL_BITMAP, *pBindings, *this), 112 maColorTableControl(SID_COLOR_TABLE, *pBindings, *this), 113 maGradientListControl(SID_GRADIENT_LIST, *pBindings, *this), 114 maHatchListControl(SID_HATCH_LIST, *pBindings, *this), 115 maBitmapListControl(SID_BITMAP_LIST, *pBindings, *this), 116 maFillTransparenceController(SID_ATTR_FILL_TRANSPARENCE, *pBindings, *this), 117 maFillFloatTransparenceController(SID_ATTR_FILL_FLOATTRANSPARENCE, *pBindings, *this), 118 maImgAxial(SVX_RES(IMG_AXIAL)), 119 maImgElli(SVX_RES(IMG_ELLI)), 120 maImgQuad(SVX_RES(IMG_QUAD)), 121 maImgRadial(SVX_RES(IMG_RADIAL)), 122 maImgSquare(SVX_RES(IMG_SQUARE)), 123 maImgLinear(SVX_RES(IMG_LINEAR)), 124 maImgColor(SVX_RES(IMG_COLOR)), 125 maImgAxialH(SVX_RES(IMG_AXIAL_H)), 126 maImgElliH(SVX_RES(IMG_ELLI_H)), 127 maImgQuadH(SVX_RES(IMG_QUAD_H)), 128 maImgRadialH(SVX_RES(IMG_RADIAL_H)), 129 maImgSquareH(SVX_RES(IMG_SQUARE_H)), 130 maImgLinearH(SVX_RES(IMG_LINEAR_H)), 131 maImgColorH(SVX_RES(IMG_COLOR_H)), 132 msHelpFillType(SVX_RES(STR_HELP_TYPE)), 133 msHelpFillAttr(SVX_RES(STR_HELP_ATTR)), 134 maTrGrPopup(this, ::boost::bind(&AreaPropertyPanel::CreateTransparencyGradientControl, this, _1)), 135 maColorPopup(this, ::boost::bind(&AreaPropertyPanel::CreateColorPopupControl, this, _1)), 136 mpFloatTransparenceItem(), 137 mpTransparanceItem(), 138 mxFrame(rxFrame), 139 maContext(), 140 mpBindings(pBindings), 141 mbTBShow(true), 142 mbColorAvail(true) 143 { 144 Initialize(); 145 FreeResource(); 146 } 147 148 149 150 AreaPropertyPanel::~AreaPropertyPanel() 151 { 152 // Destroy the toolboxes, then their background windows. 153 mpToolBoxColor.reset(); 154 mpBTNGradient.reset(); 155 mpToolBoxColorBackground.reset(); 156 mpBTNGradientBackground.reset(); 157 } 158 159 160 161 void AreaPropertyPanel::ShowMenu (void) 162 { 163 if (mpBindings != NULL) 164 { 165 SfxDispatcher* pDispatcher = mpBindings->GetDispatcher(); 166 if (pDispatcher != NULL) 167 pDispatcher->Execute(SID_ATTRIBUTES_AREA, SFX_CALLMODE_ASYNCHRON); 168 } 169 } 170 171 172 173 void AreaPropertyPanel::Initialize() 174 { 175 maGradientLinear.SetXOffset(DEFAULT_CENTERX); 176 maGradientLinear.SetYOffset(DEFAULT_CENTERY); 177 maGradientLinear.SetAngle(DEFAULT_ANGLE); 178 maGradientLinear.SetStartColor(Color(DEFAULT_STARTVALUE)); 179 maGradientLinear.SetEndColor(Color(DEFAULT_ENDVALUE)); 180 maGradientLinear.SetBorder(DEFAULT_BORDER); 181 maGradientLinear.SetGradientStyle(XGRAD_LINEAR); 182 183 maGradientAxial = maGradientLinear; 184 maGradientAxial.SetGradientStyle(XGRAD_AXIAL); 185 186 maGradientRadial = maGradientLinear; 187 maGradientRadial.SetGradientStyle(XGRAD_RADIAL); 188 189 maGradientElliptical = maGradientLinear; 190 maGradientElliptical.SetGradientStyle(XGRAD_ELLIPTICAL); 191 192 maGradientSquare = maGradientLinear; 193 maGradientSquare.SetGradientStyle(XGRAD_SQUARE); 194 195 maGradientRect = maGradientLinear; 196 maGradientRect.SetGradientStyle(XGRAD_RECT); 197 198 Size aLogicalFillSize(MBOX_WIDTH,LISTBOX_HEIGHT); 199 Size aLogicalAttrSize(MBOX_WIDTH + 1,LISTBOX_HEIGHT); 200 201 Point aPoint(SECTIONPAGE_MARGIN_HORIZONTAL,SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL); 202 Point aPoint_Picker(SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH + CONTROL_SPACING_HORIZONTAL,SECTIONPAGE_MARGIN_VERTICAL_TOP + FIXED_TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL); 203 204 Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT)); 205 Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT)); 206 207 Point aTypePoint(LogicToPixel(aPoint, MAP_APPFONT)); 208 Point aAttrPoint(LogicToPixel(aPoint_Picker, MAP_APPFONT)); 209 210 mpLbFillType->SetPosSizePixel(aTypePoint,aTypeSize); 211 mpLbFillAttr->SetPosSizePixel(aAttrPoint,aAttrSize); 212 213 mpLbFillType->SetHelpId(HID_PPROPERTYPANEL_AREA_LB_FILL_TYPES); 214 mpLbFillAttr->SetHelpId(HID_PPROPERTYPANEL_AREA_LB_FILL_ATTR); 215 216 mpLbFillType->SetQuickHelpText(msHelpFillType); 217 mpLbFillAttr->SetQuickHelpText(msHelpFillAttr); 218 219 mpLbFillType->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Fill"))); //wj acc 220 mpLbFillAttr->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Fill"))); //wj acc 221 222 Link aLink = LINK( this, AreaPropertyPanel, SelectFillTypeHdl ); 223 mpLbFillType->SetSelectHdl( aLink ); 224 225 aLink = LINK( this, AreaPropertyPanel, SelectFillAttrHdl ); 226 mpLbFillAttr->SetSelectHdl( aLink ); 227 228 //add for new color picker 229 mpLbFillAttr->Hide(); 230 mpToolBoxColor->SetItemImage(TBI_COLOR, GetDisplayBackground().GetColor().IsDark()? maImgColorH : maImgColor); 231 Size aTbxSize( mpToolBoxColor->CalcWindowSizePixel() ); 232 mpToolBoxColor->SetOutputSizePixel( aTbxSize ); 233 mpToolBoxColor->SetItemBits( TBI_COLOR, mpToolBoxColor->GetItemBits( TBI_COLOR ) | TIB_DROPDOWNONLY ); 234 mpToolBoxColor->SetBackground(Wallpaper()); 235 mpToolBoxColor->SetPaintTransparent(true); 236 mpToolBoxColor->SetQuickHelpText(TBI_COLOR, String(SVX_RES(STR_HELP_COLOR))); //wj acc 237 //mpToolBoxColor->SetItemText(TBI_COLOR, msHelpFillAttr); 238 239 long aHeightLBStyle = mpLbFillType->GetSizePixel().getHeight(); 240 long aLBPosY = mpLbFillType->GetPosPixel().getY(); 241 long aHeightTBAttr = mpToolBoxColor->GetSizePixel().getHeight(); 242 Point aPointTBAttr = mpToolBoxColor->GetPosPixel(); 243 aPointTBAttr.setY( aLBPosY + aHeightLBStyle / 2 - aHeightTBAttr / 2); 244 mpToolBoxColor->SetPosPixel(aPointTBAttr); 245 246 aLink = LINK(this, AreaPropertyPanel, ToolBoxColorDropHdl); 247 mpToolBoxColor->SetDropdownClickHdl ( aLink ); 248 mpToolBoxColor->SetSelectHdl ( aLink ); 249 250 //add end 251 mpLBTransType->SetSelectHdl(LINK(this, AreaPropertyPanel, ChangeTrgrTypeHdl_Impl)); 252 mpLBTransType->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency"))); //wj acc 253 254 mpMTRTransparent->SetValue( 50 ); 255 mpMTRTransparent->SetModifyHdl(LINK(this, AreaPropertyPanel, ModifyTransparentHdl_Impl)); 256 mpMTRTransparent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency"))); //wj acc 257 258 mpBTNGradient->SetItemBits( TBI_BTX_GRADIENT, mpBTNGradient->GetItemBits( TBI_BTX_GRADIENT ) | TIB_DROPDOWNONLY ); 259 aLink = LINK( this, AreaPropertyPanel, ClickTrGrHdl_Impl ); 260 mpBTNGradient->SetDropdownClickHdl( aLink ); 261 mpBTNGradient->SetSelectHdl( aLink ); 262 aTbxSize = mpBTNGradient->CalcWindowSizePixel(); 263 mpBTNGradient->SetOutputSizePixel( aTbxSize ); 264 mpBTNGradient->SetItemImage(TBI_BTX_GRADIENT,maImgLinear); 265 mpBTNGradient->SetQuickHelpText(TBI_BTX_GRADIENT, String(SVX_RES(STR_HELP_GRADIENT))); //wj acc 266 mpBTNGradient->Hide(); 267 268 long aHeightLBTrans = mpLBTransType->GetSizePixel().getHeight(); 269 Point aPointLB = mpLBTransType->GetPosPixel(); 270 long aPosY = aPointLB.getY(); 271 272 Point aPointMetric = mpMTRTransparent->GetPosPixel(); 273 Point aPointTB = mpMTRTransparent->GetPosPixel(); 274 long aHeightMetric = mpMTRTransparent->GetSizePixel().getHeight(); 275 long aHeightTool = mpBTNGradient->GetSizePixel().getHeight(); 276 aPointMetric.setY(aPosY+aHeightLBTrans/2-aHeightMetric/2); 277 aPointTB.setY(aPosY+aHeightLBTrans/2-aHeightTool/2); 278 aPointTB.setX(aPointTB.getX()+3); 279 mpMTRTransparent->SetPosPixel(aPointMetric); 280 mpBTNGradient->SetPosPixel(aPointTB); 281 282 mpLbFillType->SetAccessibleRelationLabeledBy(mpColorTextFT.get()); 283 mpLbFillAttr->SetAccessibleRelationLabeledBy(mpLbFillAttr.get()); 284 mpToolBoxColor->SetAccessibleRelationLabeledBy(mpToolBoxColor.get()); 285 mpLBTransType->SetAccessibleRelationLabeledBy(mpTrspTextFT.get()); 286 mpMTRTransparent->SetAccessibleRelationLabeledBy(mpMTRTransparent.get()); 287 mpBTNGradient->SetAccessibleRelationLabeledBy(mpBTNGradient.get()); 288 289 SetupIcons(); 290 } 291 292 293 294 IMPL_LINK( AreaPropertyPanel, SelectFillTypeHdl, ListBox *, pToolBox ) 295 { 296 XFillStyle eXFS = (XFillStyle)mpLbFillType->GetSelectEntryPos(); 297 298 if( (XFillStyle) meLastXFS != eXFS ) 299 { 300 mpLbFillAttr->Clear(); 301 SfxObjectShell* pSh = SfxObjectShell::Current(); 302 XFillStyleItem aXFillStyleItem( eXFS ); 303 GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_STYLE, SFX_CALLMODE_RECORD, &aXFillStyleItem, 0L); 304 305 switch( eXFS ) 306 { 307 case XFILL_NONE: 308 { 309 mpLbFillAttr->Show(); 310 mpToolBoxColor->Hide(); 311 mbTBShow = false; 312 mpLbFillType->Selected(); 313 mpLbFillAttr->Disable(); 314 } 315 break; 316 317 case XFILL_SOLID: 318 { 319 mpLbFillAttr->Hide(); 320 mpToolBoxColor->Show(); 321 mbTBShow = true; 322 String aTmpStr; 323 Color aColor = maLastColor; 324 XFillColorItem aXFillColorItem( aTmpStr, aColor ); 325 GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_COLOR, SFX_CALLMODE_RECORD, &aXFillColorItem, 0L); 326 } 327 break; 328 329 case XFILL_GRADIENT: 330 { 331 mpLbFillAttr->Show(); 332 mpToolBoxColor->Hide(); 333 mbTBShow = false; 334 if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) 335 { 336 // 337 if(mpLbFillAttr->GetEntryCount() == 0) 338 { 339 SvxGradientListItem aItem( *(const SvxGradientListItem*)( 340 pSh->GetItem( SID_GRADIENT_LIST ) ) ); 341 mpLbFillAttr->Enable(); 342 mpLbFillAttr->Clear(); 343 mpLbFillAttr->Fill( aItem.GetGradientList() ); 344 } 345 346 if ( mnLastPosGradient != LISTBOX_ENTRY_NOTFOUND) 347 { 348 SvxGradientListItem aItem( *(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) ); 349 if ( mnLastPosGradient < aItem.GetGradientList()->Count() ) 350 { 351 XGradient aGradient = aItem.GetGradientList()->GetGradient( mnLastPosGradient )->GetGradient(); 352 XFillGradientItem aXFillGradientItem( mpLbFillAttr->GetEntry(mnLastPosGradient), aGradient ); 353 GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_GRADIENT, SFX_CALLMODE_RECORD, &aXFillGradientItem, 0L); 354 mpLbFillAttr->SelectEntryPos(mnLastPosGradient); //add 355 } 356 } 357 } 358 else 359 mpLbFillAttr->Disable(); 360 } 361 break; 362 363 case XFILL_HATCH: 364 { 365 mpLbFillAttr->Show(); 366 mpToolBoxColor->Hide(); 367 mbTBShow = false; 368 if ( pSh && pSh->GetItem( SID_HATCH_LIST ) ) 369 { 370 // 371 if(mpLbFillAttr->GetEntryCount() == 0) 372 { 373 SvxHatchListItem aItem( *(const SvxHatchListItem*)( 374 pSh->GetItem( SID_HATCH_LIST ) ) ); 375 mpLbFillAttr->Enable(); 376 mpLbFillAttr->Clear(); 377 mpLbFillAttr->Fill( aItem.GetHatchList() ); 378 } 379 380 if ( mnLastPosHatch != LISTBOX_ENTRY_NOTFOUND ) 381 { 382 SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) ); 383 if ( mnLastPosHatch < aItem.GetHatchList()->Count() ) 384 { 385 XHatch aHatch = aItem.GetHatchList()->GetHatch( mnLastPosHatch )->GetHatch(); 386 XFillHatchItem aXFillHatchItem( mpLbFillAttr->GetSelectEntry(), aHatch ); 387 GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_HATCH, SFX_CALLMODE_RECORD, &aXFillHatchItem, 0L); 388 mpLbFillAttr->SelectEntryPos(mnLastPosHatch); //add 389 } 390 } 391 } 392 else 393 mpLbFillAttr->Disable(); 394 } 395 break; 396 397 case XFILL_BITMAP: 398 { 399 mpLbFillAttr->Show(); 400 mpToolBoxColor->Hide(); 401 mbTBShow = false; 402 if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) ) 403 { 404 // 405 if(mpLbFillAttr->GetEntryCount() == 0) 406 { 407 SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( 408 pSh->GetItem( SID_BITMAP_LIST ) ) ); 409 mpLbFillAttr->Enable(); 410 mpLbFillAttr->Clear(); 411 mpLbFillAttr->Fill( aItem.GetBitmapList() ); 412 } 413 414 if ( mnLastPosBitmap != LISTBOX_ENTRY_NOTFOUND ) 415 { 416 SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) ); 417 if ( mnLastPosBitmap < aItem.GetBitmapList()->Count() ) 418 { 419 const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(mnLastPosBitmap); 420 XFillBitmapItem aXFillBitmapItem( mpLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject() ); 421 GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_BITMAP, SFX_CALLMODE_RECORD, &aXFillBitmapItem, 0L); 422 mpLbFillAttr->SelectEntryPos(mnLastPosBitmap); //add 423 } 424 } 425 } 426 else 427 mpLbFillAttr->Disable(); 428 } 429 break; 430 } 431 meLastXFS = (sal_uInt16)eXFS; 432 if( eXFS != XFILL_NONE ) 433 { 434 if ( pToolBox ) 435 mpLbFillType->Selected(); 436 } 437 } 438 return 0; 439 } 440 441 442 443 IMPL_LINK( AreaPropertyPanel, SelectFillAttrHdl, ListBox*, pToolBox ) 444 { 445 XFillStyle eXFS = (XFillStyle)mpLbFillType->GetSelectEntryPos(); 446 XFillStyleItem aXFillStyleItem( eXFS ); 447 SfxObjectShell* pSh = SfxObjectShell::Current(); 448 449 if(pToolBox) 450 { 451 if( (XFillStyle) meLastXFS != eXFS ) 452 { 453 GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_STYLE, SFX_CALLMODE_RECORD, &aXFillStyleItem, 0L); //Added 20090909 454 } 455 456 switch( eXFS ) 457 { 458 case XFILL_SOLID: 459 //{ 460 // //String aTmpStr = mpLbFillAttr->GetSelectEntry(); 461 // //Color aColor = mpLbFillAttr->GetSelectEntryColor(); 462 // //if(aColor.GetColor() == 0 && aTmpStr.Equals(String::CreateFromAscii(""))) 463 // String aTmpStr; 464 // Color aColor = maLastColor; 465 // XFillColorItem aXFillColorItem( aTmpStr, aColor ); 466 // GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_COLOR, SFX_CALLMODE_RECORD, &aXFillColorItem, 0L); 467 // maLastColor = aColor; 468 //} 469 break; 470 471 case XFILL_GRADIENT: 472 { 473 sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos(); 474 if( nPos == LISTBOX_ENTRY_NOTFOUND ) 475 nPos = mnLastPosGradient; 476 477 if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_GRADIENT_LIST ) ) 478 { 479 SvxGradientListItem aItem( *(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) ); 480 if ( nPos < aItem.GetGradientList()->Count() ) 481 { 482 XGradient aGradient = aItem.GetGradientList()->GetGradient( nPos )->GetGradient(); 483 XFillGradientItem aXFillGradientItem( mpLbFillAttr->GetSelectEntry(), aGradient ); 484 GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_GRADIENT, SFX_CALLMODE_RECORD, &aXFillGradientItem, 0L); 485 } 486 } 487 if(nPos != LISTBOX_ENTRY_NOTFOUND) 488 mnLastPosGradient = nPos; 489 } 490 break; 491 492 case XFILL_HATCH: 493 { 494 sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos(); 495 if( nPos == LISTBOX_ENTRY_NOTFOUND ) 496 nPos = mnLastPosHatch; 497 if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_HATCH_LIST ) ) 498 { 499 SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) ); 500 if ( nPos < aItem.GetHatchList()->Count() ) 501 { 502 XHatch aHatch = aItem.GetHatchList()->GetHatch( nPos )->GetHatch(); 503 XFillHatchItem aXFillHatchItem( mpLbFillAttr->GetSelectEntry(), aHatch ); 504 GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_HATCH, SFX_CALLMODE_RECORD, &aXFillHatchItem, 0L); 505 } 506 } 507 if(nPos != LISTBOX_ENTRY_NOTFOUND) 508 mnLastPosHatch = nPos; 509 } 510 break; 511 512 case XFILL_BITMAP: 513 { 514 sal_uInt16 nPos = mpLbFillAttr->GetSelectEntryPos(); 515 if( nPos == LISTBOX_ENTRY_NOTFOUND ) 516 nPos = mnLastPosBitmap; 517 if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_BITMAP_LIST ) ) 518 { 519 SvxBitmapListItem aItem( *(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) ); 520 if ( nPos < aItem.GetBitmapList()->Count() ) 521 { 522 const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(nPos); 523 XFillBitmapItem aXFillBitmapItem( mpLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject() ); 524 GetBindings()->GetDispatcher()->Execute(SID_ATTR_FILL_BITMAP, SFX_CALLMODE_RECORD, &aXFillBitmapItem, 0L); 525 } 526 } 527 if(nPos != LISTBOX_ENTRY_NOTFOUND) 528 mnLastPosBitmap = nPos; 529 } 530 break; 531 532 default: 533 break; 534 } 535 } 536 return 0; 537 } 538 539 540 //add for color picker 541 542 IMPL_LINK(AreaPropertyPanel, ToolBoxColorDropHdl, ToolBox*, pToolBox) 543 { 544 sal_uInt16 nId = pToolBox->GetCurItemId(); 545 546 if(nId == TBI_COLOR) 547 { 548 maColorPopup.Show(*pToolBox); 549 if (mpColorItem) 550 maColorPopup.SetCurrentColor(mpColorItem->GetColorValue(), mbColorAvail); 551 else 552 maColorPopup.SetCurrentColor(COL_WHITE, false); 553 } 554 555 return 0; 556 } 557 558 559 560 void AreaPropertyPanel::SetColor ( 561 const String& rsColorName, 562 const Color aColor) 563 { 564 XFillColorItem aXFillColorItem (rsColorName, aColor); 565 mpBindings->GetDispatcher()->Execute(SID_ATTR_FILL_COLOR, SFX_CALLMODE_RECORD, &aXFillColorItem, 0L); 566 maLastColor = aColor; 567 } 568 569 570 571 572 PopupControl* AreaPropertyPanel::CreateTransparencyGradientControl (PopupContainer* pParent) 573 { 574 return new AreaTransparencyGradientControl(pParent, *this); 575 } 576 577 578 579 580 PopupControl* AreaPropertyPanel::CreateColorPopupControl (PopupContainer* pParent) 581 { 582 return new ColorControl( 583 pParent, 584 mpBindings, 585 SVX_RES(RID_POPUPPANEL_AERAPAGE_COLOR), 586 SVX_RES(VS_COLOR), 587 ::boost::bind(&AreaPropertyPanel::GetLastColor, this), 588 ::boost::bind(&AreaPropertyPanel::SetColor, this, _1,_2), 589 pParent, 590 0); 591 } 592 593 594 595 596 void AreaPropertyPanel::SetupIcons(void) 597 { 598 if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) 599 { 600 // todo 601 } 602 else 603 { 604 // todo 605 } 606 } 607 608 609 610 AreaPropertyPanel* AreaPropertyPanel::Create ( 611 Window* pParent, 612 const cssu::Reference<css::frame::XFrame>& rxFrame, 613 SfxBindings* pBindings) 614 { 615 if (pParent == NULL) 616 throw lang::IllegalArgumentException(A2S("no parent Window given to AreaPropertyPanel::Create"), NULL, 0); 617 if ( ! rxFrame.is()) 618 throw lang::IllegalArgumentException(A2S("no XFrame given to AreaPropertyPanel::Create"), NULL, 1); 619 if (pBindings == NULL) 620 throw lang::IllegalArgumentException(A2S("no SfxBindings given to AreaPropertyPanel::Create"), NULL, 2); 621 622 return new AreaPropertyPanel( 623 pParent, 624 rxFrame, 625 pBindings); 626 } 627 628 629 630 void AreaPropertyPanel::DataChanged( 631 const DataChangedEvent& rEvent) 632 { 633 (void)rEvent; 634 635 SetupIcons(); 636 } 637 638 639 640 void AreaPropertyPanel::HandleContextChange( 641 const ::sfx2::sidebar::EnumContext aContext) 642 { 643 if(maContext == aContext) 644 { 645 // Nothing to do. 646 return; 647 } 648 649 maContext = aContext; 650 651 652 653 // todo 654 } 655 656 657 658 void AreaPropertyPanel::ImpUpdateTransparencies() 659 { 660 if(mpTransparanceItem.get() || mpFloatTransparenceItem.get()) 661 { 662 bool bZeroValue(false); 663 664 if(mpTransparanceItem.get()) 665 { 666 const sal_uInt16 nValue(mpTransparanceItem->GetValue()); 667 668 if(!nValue) 669 { 670 bZeroValue = true; 671 } 672 else if(nValue <= 100) 673 { 674 mpLBTransType->Enable(); 675 mpLBTransType->SelectEntryPos(1); 676 mpBTNGradient->Hide(); 677 mpMTRTransparent->Show(); 678 mpMTRTransparent->Enable(); 679 mpMTRTransparent->SetValue(nValue); 680 } 681 682 maTrGrPopup.Hide(); 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