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 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_cui.hxx" 26 27 // include --------------------------------------------------------------- 28 #include <tools/shl.hxx> 29 #include <tools/urlobj.hxx> 30 #include <sfx2/app.hxx> 31 #include <sfx2/module.hxx> 32 #include <svx/dialogs.hrc> 33 34 #define _SVX_TPAREA_CXX 35 36 #if defined (UNX) || defined (WTC) || defined (ICC) || defined(WNT) 37 #include <stdlib.h> 38 #endif 39 40 #include "svx/xattr.hxx" 41 #include <svx/xpool.hxx> 42 #include <cuires.hrc> 43 #include "tabarea.hrc" 44 //#include "dlgname.hrc" 45 #include <svx/xflbckit.hxx> 46 #include <svx/svdattr.hxx> 47 #include <svx/xtable.hxx> 48 #include <svx/xlineit0.hxx> 49 #include "svx/drawitem.hxx" 50 #include "cuitabarea.hxx" 51 #include "dlgname.hxx" 52 #include <dialmgr.hxx> 53 #include "svx/dlgutil.hxx" 54 #include <svl/intitem.hxx> //add CHINA001 55 #include <sfx2/request.hxx>//add CHINA001 56 #include "paragrph.hrc" 57 #define DLGWIN this->GetParent()->GetParent() 58 59 // static ---------------------------------------------------------------- 60 61 static sal_uInt16 pAreaRanges[] = 62 { 63 XATTR_GRADIENTSTEPCOUNT, 64 XATTR_GRADIENTSTEPCOUNT, 65 SID_ATTR_FILL_STYLE, 66 SID_ATTR_FILL_BITMAP, 67 0 68 }; 69 70 static sal_uInt16 pTransparenceRanges[] = 71 { 72 XATTR_FILLTRANSPARENCE, 73 XATTR_FILLTRANSPARENCE, 74 SDRATTR_SHADOWTRANSPARENCE, 75 SDRATTR_SHADOWTRANSPARENCE, 76 XATTR_FILLFLOATTRANSPARENCE, 77 XATTR_FILLFLOATTRANSPARENCE, 78 0 79 }; 80 81 /************************************************************************* 82 |* 83 |* Dialog for transparence 84 |* 85 \************************************************************************/ 86 87 IMPL_LINK(SvxTransparenceTabPage, ClickTransOffHdl_Impl, void *, EMPTYARG) 88 { 89 // disable all other controls 90 ActivateLinear(sal_False); 91 ActivateGradient(sal_False); 92 93 // Preview 94 rXFSet.ClearItem (XATTR_FILLTRANSPARENCE); 95 rXFSet.ClearItem (XATTR_FILLFLOATTRANSPARENCE); 96 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); 97 aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); 98 99 InvalidatePreview( sal_False ); 100 101 return( 0L ); 102 } 103 104 IMPL_LINK(SvxTransparenceTabPage, ClickTransLinearHdl_Impl, void *, EMPTYARG) 105 { 106 // enable linear, disable other 107 ActivateLinear(sal_True); 108 ActivateGradient(sal_False); 109 110 // preview 111 rXFSet.ClearItem (XATTR_FILLFLOATTRANSPARENCE); 112 ModifyTransparentHdl_Impl (NULL); 113 114 return( 0L ); 115 } 116 117 IMPL_LINK(SvxTransparenceTabPage, ClickTransGradientHdl_Impl, void *, EMPTYARG) 118 { 119 // enable gradient, disable other 120 ActivateLinear(sal_False); 121 ActivateGradient(sal_True); 122 123 // preview 124 rXFSet.ClearItem (XATTR_FILLTRANSPARENCE); 125 ModifiedTrgrHdl_Impl (NULL); 126 127 return( 0L ); 128 } 129 130 void SvxTransparenceTabPage::ActivateLinear(sal_Bool bActivate) 131 { 132 aMtrTransparent.Enable(bActivate); 133 } 134 135 IMPL_LINK(SvxTransparenceTabPage, ModifyTransparentHdl_Impl, void*, EMPTYARG) 136 { 137 sal_uInt16 nPos = (sal_uInt16)aMtrTransparent.GetValue(); 138 XFillTransparenceItem aItem(nPos); 139 rXFSet.Put(XFillTransparenceItem(aItem)); 140 141 // preview 142 InvalidatePreview(); 143 144 return 0L; 145 } 146 147 IMPL_LINK(SvxTransparenceTabPage, ModifiedTrgrHdl_Impl, void *, pControl) 148 { 149 if(pControl == &aLbTrgrGradientType || pControl == this) 150 { 151 XGradientStyle eXGS = (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos(); 152 SetControlState_Impl( eXGS ); 153 } 154 155 // preview 156 sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)aMtrTrgrStartValue.GetValue() * 255) / 100); 157 sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)aMtrTrgrEndValue.GetValue() * 255) / 100); 158 XGradient aTmpGradient( 159 Color(nStartCol, nStartCol, nStartCol), 160 Color(nEndCol, nEndCol, nEndCol), 161 (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos(), 162 (sal_uInt16)aMtrTrgrAngle.GetValue() * 10, 163 (sal_uInt16)aMtrTrgrCenterX.GetValue(), 164 (sal_uInt16)aMtrTrgrCenterY.GetValue(), 165 (sal_uInt16)aMtrTrgrBorder.GetValue(), 166 100, 100); 167 168 String aString; 169 XFillFloatTransparenceItem aItem( rXFSet.GetPool()/*aString*/, aTmpGradient); 170 rXFSet.Put ( aItem ); 171 172 InvalidatePreview(); 173 174 return( 0L ); 175 } 176 177 void SvxTransparenceTabPage::ActivateGradient(sal_Bool bActivate) 178 { 179 aFtTrgrType.Enable(bActivate); 180 aLbTrgrGradientType.Enable(bActivate); 181 aFtTrgrCenterX.Enable(bActivate); 182 aMtrTrgrCenterX.Enable(bActivate); 183 aFtTrgrCenterY.Enable(bActivate); 184 aMtrTrgrCenterY.Enable(bActivate); 185 aFtTrgrAngle.Enable(bActivate); 186 aMtrTrgrAngle.Enable(bActivate); 187 aFtTrgrBorder.Enable(bActivate); 188 aMtrTrgrBorder.Enable(bActivate); 189 aFtTrgrStartValue.Enable(bActivate); 190 aMtrTrgrStartValue.Enable(bActivate); 191 aFtTrgrEndValue.Enable(bActivate); 192 aMtrTrgrEndValue.Enable(bActivate); 193 194 if(bActivate) 195 { 196 XGradientStyle eXGS = (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos(); 197 SetControlState_Impl( eXGS ); 198 } 199 } 200 201 IMPL_LINK(SvxTransparenceTabPage, ChangeTrgrTypeHdl_Impl, void *, EMPTYARG) 202 { 203 return( 0L ); 204 } 205 206 void SvxTransparenceTabPage::SetControlState_Impl(XGradientStyle eXGS) 207 { 208 switch(eXGS) 209 { 210 case XGRAD_LINEAR: 211 case XGRAD_AXIAL: 212 aFtTrgrCenterX.Disable(); 213 aMtrTrgrCenterX.Disable(); 214 aFtTrgrCenterY.Disable(); 215 aMtrTrgrCenterY.Disable(); 216 aFtTrgrAngle.Enable(); 217 aMtrTrgrAngle.Enable(); 218 break; 219 220 case XGRAD_RADIAL: 221 aFtTrgrCenterX.Enable(); 222 aMtrTrgrCenterX.Enable(); 223 aFtTrgrCenterY.Enable(); 224 aMtrTrgrCenterY.Enable(); 225 aFtTrgrAngle.Disable(); 226 aMtrTrgrAngle.Disable(); 227 break; 228 229 case XGRAD_ELLIPTICAL: 230 aFtTrgrCenterX.Enable(); 231 aMtrTrgrCenterX.Enable(); 232 aFtTrgrCenterY.Enable(); 233 aMtrTrgrCenterY.Enable(); 234 aFtTrgrAngle.Enable(); 235 aMtrTrgrAngle.Enable(); 236 break; 237 238 case XGRAD_SQUARE: 239 case XGRAD_RECT: 240 aFtTrgrCenterX.Enable(); 241 aMtrTrgrCenterX.Enable(); 242 aFtTrgrCenterY.Enable(); 243 aMtrTrgrCenterY.Enable(); 244 aFtTrgrAngle.Enable(); 245 aMtrTrgrAngle.Enable(); 246 break; 247 } 248 } 249 250 SvxTransparenceTabPage::SvxTransparenceTabPage(Window* pParent, const SfxItemSet& rInAttrs) 251 : SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_TRANSPARENCE ), rInAttrs), 252 rOutAttrs ( rInAttrs ), 253 nPageType(0), 254 nDlgType(0), 255 256 aFlProp ( this, CUI_RES( FL_PROP ) ), 257 aRbtTransOff ( this, CUI_RES( RBT_TRANS_OFF ) ), 258 aRbtTransLinear ( this, CUI_RES( RBT_TRANS_LINEAR ) ), 259 aRbtTransGradient ( this, CUI_RES( RBT_TRANS_GRADIENT ) ), 260 261 aMtrTransparent ( this, CUI_RES( MTR_TRANSPARENT ) ), 262 263 aFtTrgrType ( this, CUI_RES( FT_TRGR_TYPE ) ), 264 aLbTrgrGradientType ( this, CUI_RES( LB_TRGR_GRADIENT_TYPES ) ), 265 aFtTrgrCenterX ( this, CUI_RES( FT_TRGR_CENTER_X ) ), 266 aMtrTrgrCenterX ( this, CUI_RES( MTR_TRGR_CENTER_X ) ), 267 aFtTrgrCenterY ( this, CUI_RES( FT_TRGR_CENTER_Y ) ), 268 aMtrTrgrCenterY ( this, CUI_RES( MTR_TRGR_CENTER_Y ) ), 269 aFtTrgrAngle ( this, CUI_RES( FT_TRGR_ANGLE ) ), 270 aMtrTrgrAngle ( this, CUI_RES( MTR_TRGR_ANGLE ) ), 271 aFtTrgrBorder ( this, CUI_RES( FT_TRGR_BORDER ) ), 272 aMtrTrgrBorder ( this, CUI_RES( MTR_TRGR_BORDER ) ), 273 aFtTrgrStartValue ( this, CUI_RES( FT_TRGR_START_VALUE ) ), 274 aMtrTrgrStartValue ( this, CUI_RES( MTR_TRGR_START_VALUE ) ), 275 aFtTrgrEndValue ( this, CUI_RES( FT_TRGR_END_VALUE ) ), 276 aMtrTrgrEndValue ( this, CUI_RES( MTR_TRGR_END_VALUE ) ), 277 278 aCtlBitmapPreview ( this, CUI_RES( CTL_BITMAP_PREVIEW ) ), 279 aCtlXRectPreview ( this, CUI_RES( CTL_TRANS_PREVIEW ) ), 280 bBitmap ( sal_False ), 281 pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), 282 aXFillAttr ( pXPool ), 283 rXFSet ( aXFillAttr.GetItemSet() ) 284 { 285 FreeResource(); 286 287 String accName = String(CUI_RES(STR_EXAMPLE)); 288 aCtlBitmapPreview.SetAccessibleName(accName); 289 aCtlXRectPreview.SetAccessibleName(accName); 290 aMtrTransparent.SetAccessibleRelationLabeledBy( &aRbtTransLinear ); 291 292 // main selection 293 aRbtTransOff.SetClickHdl(LINK(this, SvxTransparenceTabPage, ClickTransOffHdl_Impl)); 294 aRbtTransLinear.SetClickHdl(LINK(this, SvxTransparenceTabPage, ClickTransLinearHdl_Impl)); 295 aRbtTransGradient.SetClickHdl(LINK(this, SvxTransparenceTabPage, ClickTransGradientHdl_Impl)); 296 297 // linear transparency 298 aMtrTransparent.SetValue( 50 ); 299 aMtrTransparent.SetModifyHdl(LINK(this, SvxTransparenceTabPage, ModifyTransparentHdl_Impl)); 300 301 // gradient transparency 302 aMtrTrgrEndValue.SetValue( 100 ); 303 aMtrTrgrStartValue.SetValue( 0 ); 304 aLbTrgrGradientType.SetSelectHdl(LINK(this, SvxTransparenceTabPage, ChangeTrgrTypeHdl_Impl)); 305 Link aLink = LINK( this, SvxTransparenceTabPage, ModifiedTrgrHdl_Impl); 306 aLbTrgrGradientType.SetSelectHdl( aLink ); 307 aMtrTrgrCenterX.SetModifyHdl( aLink ); 308 aMtrTrgrCenterY.SetModifyHdl( aLink ); 309 aMtrTrgrAngle.SetModifyHdl( aLink ); 310 aMtrTrgrBorder.SetModifyHdl( aLink ); 311 aMtrTrgrStartValue.SetModifyHdl( aLink ); 312 aMtrTrgrEndValue.SetModifyHdl( aLink ); 313 314 // this page needs ExchangeSupport 315 SetExchangeSupport(); 316 } 317 318 void SvxTransparenceTabPage::Construct() 319 { 320 } 321 322 SfxTabPage* SvxTransparenceTabPage::Create(Window* pWindow, const SfxItemSet& rAttrs) 323 { 324 return(new SvxTransparenceTabPage(pWindow, rAttrs)); 325 } 326 327 sal_uInt16* SvxTransparenceTabPage::GetRanges() 328 { 329 return(pTransparenceRanges); 330 } 331 332 sal_Bool SvxTransparenceTabPage::FillItemSet(SfxItemSet& rAttrs) 333 { 334 const SfxPoolItem* pGradientItem = NULL; 335 const SfxPoolItem* pLinearItem = NULL; 336 SfxItemState eStateGradient(rOutAttrs.GetItemState(XATTR_FILLFLOATTRANSPARENCE, sal_True, &pGradientItem)); 337 SfxItemState eStateLinear(rOutAttrs.GetItemState(XATTR_FILLTRANSPARENCE, sal_True, &pLinearItem)); 338 sal_Bool bGradActive = (eStateGradient == SFX_ITEM_SET && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled()); 339 sal_Bool bLinearActive = (eStateLinear == SFX_ITEM_SET && ((XFillTransparenceItem*)pLinearItem)->GetValue() != 0); 340 341 // #103765# 342 sal_Bool bGradUsed = (eStateGradient == SFX_ITEM_DONTCARE); 343 sal_Bool bLinearUsed = (eStateLinear == SFX_ITEM_DONTCARE); 344 345 sal_Bool bModified(sal_False); 346 sal_Bool bSwitchOffLinear(sal_False); 347 sal_Bool bSwitchOffGradient(sal_False); 348 349 if(aMtrTransparent.IsEnabled()) 350 { 351 // linear transparence 352 sal_uInt16 nPos = (sal_uInt16)aMtrTransparent.GetValue(); 353 if(nPos != (sal_uInt16)aMtrTransparent.GetSavedValue().ToInt32() || !bLinearActive) 354 { 355 XFillTransparenceItem aItem(nPos); 356 SdrShadowTransparenceItem aShadowItem(nPos); 357 const SfxPoolItem* pOld = GetOldItem(rAttrs, XATTR_FILLTRANSPARENCE); 358 if(!pOld || !(*(const XFillTransparenceItem*)pOld == aItem) || !bLinearActive) 359 { 360 rAttrs.Put(aItem); 361 rAttrs.Put(aShadowItem); 362 bModified = sal_True; 363 bSwitchOffGradient = sal_True; 364 } 365 } 366 } 367 else if(aLbTrgrGradientType.IsEnabled()) 368 { 369 // transparence gradient, fill ItemSet from values 370 if(!bGradActive 371 || (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos() != (XGradientStyle)aLbTrgrGradientType.GetSavedValue() 372 || (sal_uInt16)aMtrTrgrAngle.GetValue() != (sal_uInt16)aMtrTrgrAngle.GetSavedValue().ToInt32() 373 || (sal_uInt16)aMtrTrgrCenterX.GetValue() != (sal_uInt16)aMtrTrgrCenterX.GetSavedValue().ToInt32() 374 || (sal_uInt16)aMtrTrgrCenterY.GetValue() != (sal_uInt16)aMtrTrgrCenterY.GetSavedValue().ToInt32() 375 || (sal_uInt16)aMtrTrgrBorder.GetValue() != (sal_uInt16)aMtrTrgrBorder.GetSavedValue().ToInt32() 376 || (sal_uInt16)aMtrTrgrStartValue.GetValue() != (sal_uInt16)aMtrTrgrStartValue.GetSavedValue().ToInt32() 377 || (sal_uInt16)aMtrTrgrEndValue.GetValue() != (sal_uInt16)aMtrTrgrEndValue.GetSavedValue().ToInt32() ) 378 { 379 sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)aMtrTrgrStartValue.GetValue() * 255) / 100); 380 sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)aMtrTrgrEndValue.GetValue() * 255) / 100); 381 XGradient aTmpGradient( 382 Color(nStartCol, nStartCol, nStartCol), 383 Color(nEndCol, nEndCol, nEndCol), 384 (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos(), 385 (sal_uInt16)aMtrTrgrAngle.GetValue() * 10, 386 (sal_uInt16)aMtrTrgrCenterX.GetValue(), 387 (sal_uInt16)aMtrTrgrCenterY.GetValue(), 388 (sal_uInt16)aMtrTrgrBorder.GetValue(), 389 100, 100); 390 391 String aString; 392 XFillFloatTransparenceItem aItem( rXFSet.GetPool()/*aString*/, aTmpGradient); 393 const SfxPoolItem* pOld = GetOldItem(rAttrs, XATTR_FILLFLOATTRANSPARENCE); 394 395 if(!pOld || !(*(const XFillFloatTransparenceItem*)pOld == aItem) || !bGradActive) 396 { 397 rAttrs.Put(aItem); 398 bModified = sal_True; 399 bSwitchOffLinear = sal_True; 400 } 401 } 402 } 403 else 404 { 405 // no transparence 406 bSwitchOffGradient = sal_True; 407 bSwitchOffLinear = sal_True; 408 } 409 410 // disable unused XFillFloatTransparenceItem 411 if(bSwitchOffGradient && (bGradActive || bGradUsed)) 412 { 413 Color aColor(COL_BLACK); 414 XGradient aGrad(aColor, Color(COL_WHITE)); 415 aGrad.SetStartIntens(100); 416 aGrad.SetEndIntens(100); 417 String aString; 418 XFillFloatTransparenceItem aItem( rXFSet.GetPool()/*aString*/, aGrad); 419 aItem.SetEnabled(sal_False); 420 rAttrs.Put(aItem); 421 bModified = sal_True; 422 } 423 424 // disable unused XFillFloatTransparenceItem 425 if(bSwitchOffLinear && (bLinearActive || bLinearUsed)) 426 { 427 XFillTransparenceItem aItem(0); 428 SdrShadowTransparenceItem aShadowItem(0); 429 rAttrs.Put(aItem); 430 rAttrs.Put(aShadowItem); 431 bModified = sal_True; 432 } 433 //add CHINA001 begin 434 rAttrs.Put (CntUInt16Item(SID_PAGE_TYPE,nPageType)); 435 //add CHINA001 end 436 return bModified; 437 } 438 439 void SvxTransparenceTabPage::Reset(const SfxItemSet& rAttrs) 440 { 441 const SfxPoolItem* pGradientItem = NULL; 442 SfxItemState eStateGradient(rAttrs.GetItemState(XATTR_FILLFLOATTRANSPARENCE, sal_True, &pGradientItem)); 443 if(!pGradientItem) 444 pGradientItem = &rAttrs.Get(XATTR_FILLFLOATTRANSPARENCE); 445 sal_Bool bGradActive = (eStateGradient == SFX_ITEM_SET && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled()); 446 447 const SfxPoolItem* pLinearItem = NULL; 448 SfxItemState eStateLinear(rAttrs.GetItemState(XATTR_FILLTRANSPARENCE, sal_True, &pLinearItem)); 449 if(!pLinearItem) 450 pLinearItem = &rAttrs.Get(XATTR_FILLTRANSPARENCE); 451 sal_Bool bLinearActive = (eStateLinear == SFX_ITEM_SET && ((XFillTransparenceItem*)pLinearItem)->GetValue() != 0); 452 453 // transparence gradient 454 const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue(); 455 XGradientStyle eXGS(rGradient.GetGradientStyle()); 456 aLbTrgrGradientType.SelectEntryPos(sal::static_int_cast< sal_uInt16 >(eXGS)); 457 aMtrTrgrAngle.SetValue(rGradient.GetAngle() / 10); 458 aMtrTrgrBorder.SetValue(rGradient.GetBorder()); 459 aMtrTrgrCenterX.SetValue(rGradient.GetXOffset()); 460 aMtrTrgrCenterY.SetValue(rGradient.GetYOffset()); 461 aMtrTrgrStartValue.SetValue((sal_uInt16)((((sal_uInt16)rGradient.GetStartColor().GetRed() + 1) * 100) / 255)); 462 aMtrTrgrEndValue.SetValue((sal_uInt16)((((sal_uInt16)rGradient.GetEndColor().GetRed() + 1) * 100) / 255)); 463 464 // linear transparence 465 sal_uInt16 nTransp = ((XFillTransparenceItem*)pLinearItem)->GetValue(); 466 aMtrTransparent.SetValue(bLinearActive ? nTransp : 50); 467 ModifyTransparentHdl_Impl(NULL); 468 469 // select the correct radio button 470 if(bGradActive) 471 { 472 // transparence gradient, set controls appropriate to item 473 aRbtTransGradient.Check(); 474 ClickTransGradientHdl_Impl(NULL); 475 } 476 else if(bLinearActive) 477 { 478 // linear transparence 479 aRbtTransLinear.Check(); 480 ClickTransLinearHdl_Impl(NULL); 481 } 482 else 483 { 484 // no transparence 485 aRbtTransOff.Check(); 486 ClickTransOffHdl_Impl(NULL); 487 ModifiedTrgrHdl_Impl(NULL); 488 } 489 490 // save values 491 aMtrTransparent.SaveValue(); 492 aLbTrgrGradientType.SaveValue(); 493 aMtrTrgrCenterX.SaveValue(); 494 aMtrTrgrCenterY.SaveValue(); 495 aMtrTrgrAngle.SaveValue(); 496 aMtrTrgrBorder.SaveValue(); 497 aMtrTrgrStartValue.SaveValue(); 498 aMtrTrgrEndValue.SaveValue(); 499 500 sal_Bool bActive = InitPreview ( rAttrs ); 501 InvalidatePreview ( bActive ); 502 } 503 504 void SvxTransparenceTabPage::ActivatePage(const SfxItemSet& rSet) 505 { 506 //add CHINA001 Begin 507 SFX_ITEMSET_ARG (&rSet,pPageTypeItem,CntUInt16Item,SID_PAGE_TYPE,sal_False); 508 if (pPageTypeItem) 509 SetPageType(pPageTypeItem->GetValue()); 510 //add CHINA001 end 511 //CHINA001 if(*pDlgType == 0) // Flaechen-Dialog 512 //CHINA001 *pPageType = PT_TRANSPARENCE; 513 if(nDlgType == 0) //add CHINA001 // Flaechen-Dialog 514 nPageType = PT_TRANSPARENCE; //add CHINA001 515 516 InitPreview ( rSet ); 517 } 518 519 int SvxTransparenceTabPage::DeactivatePage(SfxItemSet* _pSet) 520 { 521 if( _pSet ) 522 FillItemSet( *_pSet ); 523 return(LEAVE_PAGE); 524 } 525 526 void SvxTransparenceTabPage::PointChanged(Window* , RECT_POINT eRcPt) 527 { 528 eRP = eRcPt; 529 } 530 531 // 532 // Preview-Methods 533 // 534 sal_Bool SvxTransparenceTabPage::InitPreview ( const SfxItemSet& rSet ) 535 { 536 // set transparencetyp for preview 537 if ( aRbtTransOff.IsChecked() ) 538 { 539 ClickTransOffHdl_Impl(NULL); 540 } else if ( aRbtTransLinear.IsChecked() ) 541 { 542 ClickTransLinearHdl_Impl(NULL); 543 } else if ( aRbtTransGradient.IsChecked() ) 544 { 545 ClickTransGradientHdl_Impl(NULL); 546 } 547 548 // Get fillstyle for preview 549 rXFSet.Put ( ( XFillStyleItem& ) rSet.Get(XATTR_FILLSTYLE) ); 550 rXFSet.Put ( ( XFillColorItem& ) rSet.Get(XATTR_FILLCOLOR) ); 551 rXFSet.Put ( ( XFillGradientItem& ) rSet.Get(XATTR_FILLGRADIENT) ); 552 rXFSet.Put ( ( XFillHatchItem& ) rSet.Get(XATTR_FILLHATCH) ); 553 rXFSet.Put ( ( XFillBackgroundItem&)rSet.Get(XATTR_FILLBACKGROUND) ); 554 rXFSet.Put ( ( XFillBitmapItem& ) rSet.Get(XATTR_FILLBITMAP) ); 555 556 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); 557 aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); 558 559 bBitmap = ( ( ( XFillStyleItem& )rSet.Get(XATTR_FILLSTYLE) ).GetValue() == XFILL_BITMAP ); 560 561 // show the right preview window 562 if ( bBitmap ) 563 { 564 aCtlBitmapPreview.Show(); 565 aCtlXRectPreview.Hide(); 566 } 567 else 568 { 569 aCtlBitmapPreview.Hide(); 570 aCtlXRectPreview.Show(); 571 } 572 573 return !aRbtTransOff.IsChecked(); 574 } 575 576 void SvxTransparenceTabPage::InvalidatePreview (sal_Bool bEnable) 577 { 578 if ( bBitmap ) 579 { 580 if ( bEnable ) 581 { 582 aCtlBitmapPreview.Enable(); 583 aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); 584 } 585 else 586 aCtlBitmapPreview.Disable(); 587 aCtlBitmapPreview.Invalidate(); 588 } 589 else 590 { 591 if ( bEnable ) 592 { 593 aCtlXRectPreview.Enable(); 594 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); 595 } 596 else 597 aCtlXRectPreview.Disable(); 598 aCtlXRectPreview.Invalidate(); 599 } 600 } 601 602 void SvxTransparenceTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001 603 { 604 SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); 605 SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False); 606 607 if (pPageTypeItem) 608 SetPageType(pPageTypeItem->GetValue()); 609 if (pDlgTypeItem) 610 SetDlgType(pDlgTypeItem->GetValue()); 611 Construct(); 612 } 613 /************************************************************************* 614 |* 615 |* Dialog to modify fill-attributes 616 |* 617 \************************************************************************/ 618 619 SvxAreaTabPage::SvxAreaTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : 620 621 SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_AREA ), rInAttrs ), 622 623 aFlProp ( this, CUI_RES( FL_PROP ) ), 624 aTypeLB ( this, CUI_RES( LB_AREA_TYPE ) ), 625 626 aLbColor ( this, CUI_RES( LB_COLOR ) ), 627 aLbGradient ( this, CUI_RES( LB_GRADIENT ) ), 628 aLbHatching ( this, CUI_RES( LB_HATCHING ) ), 629 aLbBitmap ( this, CUI_RES( LB_BITMAP ) ), 630 aCtlBitmapPreview ( this, CUI_RES( CTL_BITMAP_PREVIEW ) ), 631 632 aTsbStepCount ( this, CUI_RES( TSB_STEPCOUNT ) ), 633 aFlStepCount ( this, CUI_RES( FL_STEPCOUNT ) ), 634 aNumFldStepCount ( this, CUI_RES( NUM_FLD_STEPCOUNT ) ), 635 636 aCbxHatchBckgrd ( this, CUI_RES( CB_HATCHBCKGRD ) ), 637 aLbHatchBckgrdColor ( this, CUI_RES( LB_HATCHBCKGRDCOLOR ) ), 638 639 aFlSize ( this, CUI_RES( FL_SIZE ) ), 640 aTsbOriginal ( this, CUI_RES( TSB_ORIGINAL ) ), 641 aTsbScale ( this, CUI_RES( TSB_SCALE ) ), 642 aFtXSize ( this, CUI_RES( FT_X_SIZE ) ), 643 aMtrFldXSize ( this, CUI_RES( MTR_FLD_X_SIZE ) ), 644 aFtYSize ( this, CUI_RES( FT_Y_SIZE ) ), 645 aMtrFldYSize ( this, CUI_RES( MTR_FLD_Y_SIZE ) ), 646 aFlPosition ( this, CUI_RES( FL_POSITION ) ), 647 aCtlPosition ( this, CUI_RES( CTL_POSITION ), RP_RM, 110, 80, CS_RECT ), 648 aFtXOffset ( this, CUI_RES( FT_X_OFFSET ) ), 649 aMtrFldXOffset ( this, CUI_RES( MTR_FLD_X_OFFSET ) ), 650 aFtYOffset ( this, CUI_RES( FT_Y_OFFSET ) ), 651 aMtrFldYOffset ( this, CUI_RES( MTR_FLD_Y_OFFSET ) ), 652 aTsbTile ( this, CUI_RES( TSB_TILE ) ), 653 aTsbStretch ( this, CUI_RES( TSB_STRETCH ) ), 654 aFlOffset ( this, CUI_RES( FL_OFFSET ) ), 655 aRbtRow ( this, CUI_RES( RBT_ROW ) ), 656 aRbtColumn ( this, CUI_RES( RBT_COLUMN ) ), 657 aMtrFldOffset ( this, CUI_RES( MTR_FLD_OFFSET ) ), 658 659 aCtlXRectPreview ( this, CUI_RES( CTL_COLOR_PREVIEW ) ), 660 661 rOutAttrs ( rInAttrs ), 662 663 pColorTab( NULL ), 664 pGradientList( NULL ), 665 pHatchingList( NULL ), 666 pBitmapList( NULL ), 667 668 pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), 669 aXFillAttr ( pXPool ), 670 rXFSet ( aXFillAttr.GetItemSet() ) 671 { 672 FreeResource(); 673 674 String accName = String(CUI_RES(STR_EXAMPLE)); 675 aCtlXRectPreview.SetAccessibleName(accName); 676 aCtlBitmapPreview.SetAccessibleName(accName); 677 678 // Gruppen, die sich ueberlagern 679 aLbBitmap.Hide(); 680 aCtlBitmapPreview.Hide(); 681 682 aFlStepCount.Hide(); 683 aTsbStepCount.Hide(); 684 aNumFldStepCount.Hide(); 685 686 aTsbTile.Hide(); 687 aTsbStretch.Hide(); 688 aTsbScale.Hide(); 689 aTsbOriginal.Hide(); 690 aFtXSize.Hide(); 691 aMtrFldXSize.Hide(); 692 aFtYSize.Hide(); 693 aMtrFldYSize.Hide(); 694 aFlSize.Hide(); 695 aRbtRow.Hide(); 696 aRbtColumn.Hide(); 697 aMtrFldOffset.Hide(); 698 aFlOffset.Hide(); 699 aCtlPosition.Hide(); 700 aFtXOffset.Hide(); 701 aMtrFldXOffset.Hide(); 702 aFtYOffset.Hide(); 703 aMtrFldYOffset.Hide(); 704 aFlPosition.Hide(); 705 // Controls for Hatch-Background 706 aCbxHatchBckgrd.Hide(); 707 aLbHatchBckgrdColor.Hide(); 708 709 710 aTsbOriginal.EnableTriState( sal_False ); 711 712 713 // this page needs ExchangeSupport 714 SetExchangeSupport(); 715 716 // set Metrics 717 eFUnit = GetModuleFieldUnit( rInAttrs ); 718 719 switch ( eFUnit ) 720 { 721 case FUNIT_M: 722 case FUNIT_KM: 723 eFUnit = FUNIT_MM; 724 break; 725 default: ;//prevent warning 726 } 727 SetFieldUnit( aMtrFldXSize, eFUnit, sal_True ); 728 SetFieldUnit( aMtrFldYSize, eFUnit, sal_True ); 729 730 // get PoolUnit 731 SfxItemPool* pPool = rOutAttrs.GetPool(); 732 DBG_ASSERT( pPool, "Wo ist der Pool?" ); 733 ePoolUnit = pPool->GetMetric( XATTR_FILLBMP_SIZEX ); 734 735 // Setzen Output-Devices 736 rXFSet.Put( XFillStyleItem( XFILL_SOLID ) ); 737 rXFSet.Put( XFillColorItem( String(), COL_BLACK ) ); 738 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); 739 aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); 740 741 aLbColor.SetSelectHdl( LINK( this, SvxAreaTabPage, ModifyColorHdl_Impl ) ); 742 aLbHatchBckgrdColor.SetSelectHdl( LINK( this, SvxAreaTabPage, ModifyHatchBckgrdColorHdl_Impl ) ); 743 aCbxHatchBckgrd.SetToggleHdl( LINK( this, SvxAreaTabPage, ToggleHatchBckgrdColorHdl_Impl ) ); 744 745 aLbGradient.SetSelectHdl( 746 LINK( this, SvxAreaTabPage, ModifyGradientHdl_Impl ) ); 747 aLbHatching.SetSelectHdl( 748 LINK( this, SvxAreaTabPage, ModifyHatchingHdl_Impl ) ); 749 aLbBitmap.SetSelectHdl( 750 LINK( this, SvxAreaTabPage, ModifyBitmapHdl_Impl ) ); 751 752 aTsbStepCount.SetClickHdl( 753 LINK( this, SvxAreaTabPage, ModifyStepCountHdl_Impl ) ); 754 aNumFldStepCount.SetModifyHdl( 755 LINK( this, SvxAreaTabPage, ModifyStepCountHdl_Impl ) ); 756 757 Link aLink( LINK( this, SvxAreaTabPage, ModifyTileHdl_Impl ) ); 758 aTsbTile.SetClickHdl( aLink ); 759 aTsbStretch.SetClickHdl( aLink ); 760 aTsbOriginal.SetClickHdl( aLink ); 761 aMtrFldXSize.SetModifyHdl( aLink ); 762 aMtrFldYSize.SetModifyHdl( aLink ); 763 aRbtRow.SetClickHdl( aLink ); 764 aRbtColumn.SetClickHdl( aLink ); 765 aMtrFldOffset.SetModifyHdl( aLink ); 766 aMtrFldXOffset.SetModifyHdl( aLink ); 767 aMtrFldYOffset.SetModifyHdl( aLink ); 768 aTsbScale.SetClickHdl( LINK( this, SvxAreaTabPage, ClickScaleHdl_Impl ) ); 769 770 aTypeLB.SetSelectHdl( LINK( this, SvxAreaTabPage, SelectDialogTypeHdl_Impl ) ); 771 772 // #i76307# always paint the preview in LTR, because this is what the document does 773 aCtlXRectPreview.EnableRTL(sal_False); 774 775 aNumFldStepCount.SetAccessibleRelationLabeledBy( &aTsbStepCount ); 776 aCtlPosition.SetAccessibleRelationMemberOf( &aFlPosition ); 777 aLbHatchBckgrdColor.SetAccessibleRelationLabeledBy( &aCbxHatchBckgrd ); 778 aLbHatchBckgrdColor.SetAccessibleName(aCbxHatchBckgrd.GetText()); 779 780 aLbColor.SetAccessibleRelationMemberOf( &aFlProp ); 781 aMtrFldOffset.SetAccessibleRelationLabeledBy(&aFlOffset); 782 aMtrFldOffset.SetAccessibleName(aFlOffset.GetText()); 783 } 784 785 // ----------------------------------------------------------------------- 786 787 void SvxAreaTabPage::Construct() 788 { 789 // fill colortables / lists 790 aLbColor.Fill( pColorTab ); 791 aLbHatchBckgrdColor.Fill ( pColorTab ); 792 793 aLbGradient.Fill( pGradientList ); 794 aLbHatching.Fill( pHatchingList ); 795 aLbBitmap.Fill( pBitmapList ); 796 } 797 798 // ----------------------------------------------------------------------- 799 800 void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) 801 { 802 sal_uInt16 _nPos = 0; 803 sal_uInt16 nCount; 804 //add CHINA001 Begin 805 SFX_ITEMSET_ARG (&rSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); 806 SFX_ITEMSET_ARG (&rSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,sal_False); 807 if (pPageTypeItem) 808 SetPageType(pPageTypeItem->GetValue()); 809 if (pPosItem) 810 SetPos(pPosItem->GetValue()); 811 //add CHINA001 end 812 if( nDlgType == 0 )//CHINA001 if( *pDlgType == 0 ) // Flaechen-Dialog 813 { 814 *pbAreaTP = sal_True; 815 816 if( pColorTab ) 817 { 818 // Bitmapliste 819 if( *pnBitmapListState ) 820 { 821 if( *pnBitmapListState & CT_CHANGED ) 822 pBitmapList = ( (SvxAreaTabDialog*) DLGWIN )-> 823 GetNewBitmapList(); 824 825 _nPos = aLbBitmap.GetSelectEntryPos(); 826 827 aLbBitmap.Clear(); 828 aLbBitmap.Fill( pBitmapList ); 829 nCount = aLbBitmap.GetEntryCount(); 830 if( nCount == 0 ) 831 ; // This case should never occur 832 else if( nCount <= _nPos ) 833 aLbBitmap.SelectEntryPos( 0 ); 834 else 835 aLbBitmap.SelectEntryPos( _nPos ); 836 ModifyBitmapHdl_Impl( this ); 837 } 838 // hatch-liste 839 if( *pnHatchingListState ) 840 { 841 if( *pnHatchingListState & CT_CHANGED ) 842 pHatchingList = ( (SvxAreaTabDialog*) DLGWIN )-> 843 GetNewHatchingList(); 844 845 _nPos = aLbHatching.GetSelectEntryPos(); 846 847 aLbHatching.Clear(); 848 aLbHatching.Fill( pHatchingList ); 849 nCount = aLbHatching.GetEntryCount(); 850 if( nCount == 0 ) 851 ; // This case should never occur 852 else if( nCount <= _nPos ) 853 aLbHatching.SelectEntryPos( 0 ); 854 else 855 aLbHatching.SelectEntryPos( _nPos ); 856 ModifyHatchingHdl_Impl( this ); 857 858 ModifyHatchBckgrdColorHdl_Impl( this ); 859 } 860 // gradient-liste 861 if( *pnGradientListState ) 862 { 863 if( *pnGradientListState & CT_CHANGED ) 864 pGradientList = ( (SvxAreaTabDialog*) DLGWIN )-> 865 GetNewGradientList(); 866 867 _nPos = aLbGradient.GetSelectEntryPos(); 868 869 aLbGradient.Clear(); 870 aLbGradient.Fill( pGradientList ); 871 nCount = aLbGradient.GetEntryCount(); 872 if( nCount == 0 ) 873 ; // This case should never occur 874 else if( nCount <= _nPos ) 875 aLbGradient.SelectEntryPos( 0 ); 876 else 877 aLbGradient.SelectEntryPos( _nPos ); 878 ModifyGradientHdl_Impl( this ); 879 } 880 // ColorTable 881 if( *pnColorTableState ) 882 { 883 if( *pnColorTableState & CT_CHANGED ) 884 pColorTab = ( (SvxAreaTabDialog*) DLGWIN )-> 885 GetNewColorTable(); 886 // aLbColor 887 _nPos = aLbColor.GetSelectEntryPos(); 888 aLbColor.Clear(); 889 aLbColor.Fill( pColorTab ); 890 nCount = aLbColor.GetEntryCount(); 891 if( nCount == 0 ) 892 ; // This case should never occur 893 else if( nCount <= _nPos ) 894 aLbColor.SelectEntryPos( 0 ); 895 else 896 aLbColor.SelectEntryPos( _nPos ); 897 898 ModifyColorHdl_Impl( this ); 899 900 // Backgroundcolor of hatch 901 _nPos = aLbHatchBckgrdColor.GetSelectEntryPos(); 902 aLbHatchBckgrdColor.Clear(); 903 aLbHatchBckgrdColor.Fill( pColorTab ); 904 nCount = aLbHatchBckgrdColor.GetEntryCount(); 905 if( nCount == 0 ) 906 ; // This case should never occur 907 else if( nCount <= _nPos ) 908 aLbHatchBckgrdColor.SelectEntryPos( 0 ); 909 else 910 aLbHatchBckgrdColor.SelectEntryPos( _nPos ); 911 912 ModifyHatchBckgrdColorHdl_Impl( this ); 913 } 914 915 // evaluate if any other Tabpage set another filltype 916 if( aTypeLB.GetSelectEntryPos() > XFILL_NONE) 917 { 918 switch( nPageType )//CHINA001 switch( *pPageType ) 919 { 920 case PT_GRADIENT: 921 aTypeLB.SelectEntryPos( XFILL_GRADIENT ); 922 aLbGradient.SelectEntryPos( _nPos );//CHINA001 aLbGradient.SelectEntryPos( *pPos ); 923 ClickGradientHdl_Impl( this ); 924 break; 925 926 case PT_HATCH: 927 aTypeLB.SelectEntryPos( XFILL_HATCH ); 928 aLbHatching.SelectEntryPos( _nPos );//CHINA001 aLbHatching.SelectEntryPos( *pPos ); 929 ClickHatchingHdl_Impl( this ); 930 break; 931 932 case PT_BITMAP: 933 aTypeLB.SelectEntryPos( XFILL_BITMAP ); 934 aLbBitmap.SelectEntryPos( _nPos );//CHINA001 aLbBitmap.SelectEntryPos( *pPos ); 935 ClickBitmapHdl_Impl( this ); 936 break; 937 938 case PT_COLOR: 939 aTypeLB.SelectEntryPos( XFILL_SOLID ); 940 aLbColor.SelectEntryPos( _nPos );//CHINA001 aLbColor.SelectEntryPos( *pPos ); 941 aLbHatchBckgrdColor.SelectEntryPos( _nPos ); //CHINA001 aLbHatchBckgrdColor.SelectEntryPos( *pPos ); 942 ClickColorHdl_Impl( this ); 943 break; 944 } 945 } 946 nPageType = PT_AREA;//CHINA001 *pPageType = PT_AREA; 947 } 948 } 949 } 950 951 // ----------------------------------------------------------------------- 952 953 int SvxAreaTabPage::DeactivatePage( SfxItemSet* _pSet ) 954 { 955 if( nDlgType == 0 ) // Flaechen-Dialog//CHINA001 if( *pDlgType == 0 ) // Flaechen-Dialog 956 { 957 XFillStyle eStyle = (XFillStyle) aTypeLB.GetSelectEntryPos(); 958 switch( eStyle ) 959 { 960 case XFILL_GRADIENT: 961 { 962 nPageType = PT_GRADIENT;//CHINA001 *pPageType = PT_GRADIENT; 963 nPos = aLbGradient.GetSelectEntryPos();//CHINA001 *pPos = aLbGradient.GetSelectEntryPos(); 964 } 965 break; 966 case XFILL_HATCH: 967 { 968 nPageType = PT_HATCH;//CHINA001 *pPageType = PT_HATCH; 969 nPos = aLbHatching.GetSelectEntryPos();//CHINA001 *pPos = aLbHatching.GetSelectEntryPos(); 970 } 971 break; 972 case XFILL_BITMAP: 973 { 974 nPageType = PT_BITMAP;//CHINA001 *pPageType = PT_BITMAP; 975 nPos = aLbBitmap.GetSelectEntryPos();//CHINA001 *pPos = aLbBitmap.GetSelectEntryPos(); 976 } 977 break; 978 case XFILL_SOLID: 979 { 980 nPageType = PT_COLOR;//CHINA001 *pPageType = PT_COLOR; 981 nPos = aLbColor.GetSelectEntryPos();//CHINA001 *pPos = aLbColor.GetSelectEntryPos(); 982 } 983 break; 984 default: ;//prevent warning 985 } 986 } 987 988 if( _pSet ) 989 FillItemSet( *_pSet ); 990 991 return( LEAVE_PAGE ); 992 } 993 994 // ----------------------------------------------------------------------- 995 996 sal_Bool SvxAreaTabPage::FillItemSet( SfxItemSet& rAttrs ) 997 { 998 const SfxPoolItem* pOld = NULL; 999 sal_uInt16 _nPos; 1000 sal_Bool bModified = sal_False; 1001 1002 if( nDlgType != 0 || *pbAreaTP )//CHINA001 if( *pDlgType != 0 || *pbAreaTP ) 1003 { 1004 XFillStyle eStyle = (XFillStyle) aTypeLB.GetSelectEntryPos(); 1005 XFillStyle eSavedStyle = (XFillStyle) aTypeLB.GetSavedValue(); 1006 switch( eStyle ) 1007 { 1008 case XFILL_NONE: 1009 { 1010 if( eSavedStyle != eStyle ) 1011 { 1012 XFillStyleItem aStyleItem( XFILL_NONE ); 1013 pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE ); 1014 if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) ) 1015 { 1016 rAttrs.Put( aStyleItem ); 1017 bModified = sal_True; 1018 } 1019 } 1020 } 1021 break; 1022 case XFILL_SOLID: 1023 { 1024 _nPos = aLbColor.GetSelectEntryPos(); 1025 if( _nPos != LISTBOX_ENTRY_NOTFOUND && 1026 _nPos != aLbColor.GetSavedValue() ) 1027 { 1028 XFillColorItem aItem( aLbColor.GetSelectEntry(), 1029 aLbColor.GetSelectEntryColor() ); 1030 pOld = GetOldItem( rAttrs, XATTR_FILLCOLOR ); 1031 if ( !pOld || !( *(const XFillColorItem*)pOld == aItem ) ) 1032 { 1033 rAttrs.Put( aItem ); 1034 bModified = sal_True; 1035 } 1036 } 1037 // NEU 1038 if( (eSavedStyle != eStyle) && 1039 ( bModified || 1040 SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), sal_True ) ) ) 1041 { 1042 XFillStyleItem aStyleItem( XFILL_SOLID ); 1043 pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE ); 1044 if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) ) 1045 { 1046 rAttrs.Put( aStyleItem ); 1047 bModified = sal_True; 1048 } 1049 } 1050 } 1051 break; 1052 case XFILL_GRADIENT: 1053 { 1054 _nPos = aLbGradient.GetSelectEntryPos(); 1055 if( _nPos != LISTBOX_ENTRY_NOTFOUND && 1056 _nPos != aLbGradient.GetSavedValue() ) 1057 { 1058 XGradient aGradient = pGradientList->GetGradient( _nPos )->GetGradient(); 1059 String aString = aLbGradient.GetSelectEntry(); 1060 XFillGradientItem aItem( aString, aGradient ); 1061 pOld = GetOldItem( rAttrs, XATTR_FILLGRADIENT ); 1062 if ( !pOld || !( *(const XFillGradientItem*)pOld == aItem ) ) 1063 { 1064 rAttrs.Put( aItem ); 1065 bModified = sal_True; 1066 } 1067 } 1068 // NEU 1069 if( (eSavedStyle != eStyle) && 1070 ( bModified || 1071 SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), sal_True ) ) ) 1072 { 1073 XFillStyleItem aStyleItem( XFILL_GRADIENT ); 1074 pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE ); 1075 if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) ) 1076 { 1077 rAttrs.Put( aStyleItem ); 1078 bModified = sal_True; 1079 } 1080 } 1081 } 1082 break; 1083 case XFILL_HATCH: 1084 { 1085 _nPos = aLbHatching.GetSelectEntryPos(); 1086 if( _nPos != LISTBOX_ENTRY_NOTFOUND && 1087 _nPos != aLbHatching.GetSavedValue() ) 1088 { 1089 XHatch aHatching = pHatchingList->GetHatch( _nPos )->GetHatch(); 1090 String aString = aLbHatching.GetSelectEntry(); 1091 XFillHatchItem aItem( aString, aHatching ); 1092 pOld = GetOldItem( rAttrs, XATTR_FILLHATCH ); 1093 if ( !pOld || !( *(const XFillHatchItem*)pOld == aItem ) ) 1094 { 1095 rAttrs.Put( aItem ); 1096 bModified = sal_True; 1097 } 1098 } 1099 XFillBackgroundItem aItem ( aCbxHatchBckgrd.IsChecked() ); 1100 rAttrs.Put( aItem ); 1101 nPos = aLbHatchBckgrdColor.GetSelectEntryPos(); 1102 if( nPos != LISTBOX_ENTRY_NOTFOUND && 1103 nPos != aLbHatchBckgrdColor.GetSavedValue() ) 1104 { 1105 XFillColorItem aFillColorItem( aLbHatchBckgrdColor.GetSelectEntry(), 1106 aLbHatchBckgrdColor.GetSelectEntryColor() ); 1107 pOld = GetOldItem( rAttrs, XATTR_FILLCOLOR ); 1108 if ( !pOld || !( *(const XFillColorItem*)pOld == aFillColorItem ) ) 1109 { 1110 rAttrs.Put( aFillColorItem ); 1111 bModified = sal_True; 1112 } 1113 } 1114 // NEU 1115 if( (eSavedStyle != eStyle) && 1116 ( bModified || 1117 SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), sal_True ) ) ) 1118 { 1119 XFillStyleItem aStyleItem( XFILL_HATCH ); 1120 pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE ); 1121 if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) ) 1122 { 1123 rAttrs.Put( aStyleItem ); 1124 bModified = sal_True; 1125 } 1126 } 1127 } 1128 break; 1129 case XFILL_BITMAP: 1130 { 1131 nPos = aLbBitmap.GetSelectEntryPos(); 1132 if( nPos != LISTBOX_ENTRY_NOTFOUND && 1133 nPos != aLbBitmap.GetSavedValue() ) 1134 { 1135 const XBitmapEntry* pXBitmapEntry = pBitmapList->GetBitmap(nPos); 1136 const String aString(aLbBitmap.GetSelectEntry()); 1137 const XFillBitmapItem aFillBitmapItem(aString, pXBitmapEntry->GetGraphicObject()); 1138 pOld = GetOldItem( rAttrs, XATTR_FILLBITMAP ); 1139 if ( !pOld || !( *(const XFillBitmapItem*)pOld == aFillBitmapItem ) ) 1140 { 1141 rAttrs.Put( aFillBitmapItem ); 1142 bModified = sal_True; 1143 } 1144 } 1145 // NEU 1146 if( (eSavedStyle != eStyle) && 1147 ( bModified || 1148 SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), sal_True ) ) ) 1149 { 1150 XFillStyleItem aStyleItem( XFILL_BITMAP ); 1151 pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE ); 1152 if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) ) 1153 { 1154 rAttrs.Put( aStyleItem ); 1155 bModified = sal_True; 1156 } 1157 } 1158 } 1159 break; 1160 } 1161 1162 // Schrittweite 1163 if( aTsbStepCount.IsEnabled() ) 1164 { 1165 sal_uInt16 nValue = 0; 1166 sal_Bool bValueModified = sal_False; 1167 TriState eState = aTsbStepCount.GetState(); 1168 if( eState == STATE_CHECK ) 1169 { 1170 if( eState != aTsbStepCount.GetSavedValue() ) 1171 bValueModified = sal_True; 1172 } 1173 else 1174 { 1175 // Zustand != Disabled ? 1176 if( aNumFldStepCount.GetText().Len() > 0 ) 1177 { 1178 nValue = (sal_uInt16) aNumFldStepCount.GetValue(); 1179 if( nValue != (sal_uInt16) aNumFldStepCount.GetSavedValue().ToInt32() ) 1180 bValueModified = sal_True; 1181 } 1182 } 1183 if( bValueModified ) 1184 { 1185 XGradientStepCountItem aFillBitmapItem( nValue ); 1186 pOld = GetOldItem( rAttrs, XATTR_GRADIENTSTEPCOUNT ); 1187 if ( !pOld || !( *(const XGradientStepCountItem*)pOld == aFillBitmapItem ) ) 1188 { 1189 rAttrs.Put( aFillBitmapItem ); 1190 bModified = sal_True; 1191 } 1192 } 1193 } 1194 1195 // Kacheln 1196 if( aTsbTile.IsEnabled() ) 1197 { 1198 TriState eState = aTsbTile.GetState(); 1199 if( eState != aTsbTile.GetSavedValue() ) 1200 { 1201 XFillBmpTileItem aFillBmpTileItem( 1202 sal::static_int_cast< sal_Bool >( eState ) ); 1203 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_TILE ); 1204 if ( !pOld || !( *(const XFillBmpTileItem*)pOld == aFillBmpTileItem ) ) 1205 { 1206 rAttrs.Put( aFillBmpTileItem ); 1207 bModified = sal_True; 1208 } 1209 } 1210 } 1211 // Stretchen 1212 if( aTsbStretch.IsEnabled() ) 1213 { 1214 TriState eState = aTsbStretch.GetState(); 1215 if( eState != aTsbStretch.GetSavedValue() ) 1216 { 1217 XFillBmpStretchItem aFillBmpStretchItem( 1218 sal::static_int_cast< sal_Bool >( eState ) ); 1219 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_STRETCH ); 1220 if ( !pOld || !( *(const XFillBmpStretchItem*)pOld == aFillBmpStretchItem ) ) 1221 { 1222 rAttrs.Put( aFillBmpStretchItem ); 1223 bModified = sal_True; 1224 } 1225 } 1226 } 1227 1228 // Originalgroesse (im UI) wird wie folgt benutzt: 1229 // Controls sind disabled, muessen aber gesetzt werden. 1230 // SizeX = 0; SizeY = 0; Log = sal_True 1231 1232 //aTsbScale 1233 TriState eState = aTsbScale.GetState(); 1234 if( eState != aTsbScale.GetSavedValue() || 1235 ( !aTsbScale.IsEnabled() && 1236 aTsbOriginal.IsEnabled() && 1237 aTsbScale.GetSavedValue() != STATE_CHECK ) ) 1238 { 1239 XFillBmpSizeLogItem* pItem = NULL; 1240 if( aTsbScale.IsEnabled() ) 1241 pItem = new XFillBmpSizeLogItem( eState == STATE_NOCHECK ); 1242 else if( aTsbOriginal.IsEnabled() && aTsbOriginal.GetState() == STATE_CHECK ) 1243 pItem = new XFillBmpSizeLogItem( sal_True ); 1244 1245 if( pItem ) 1246 { 1247 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_SIZELOG ); 1248 if ( !pOld || !( *(const XFillBmpSizeLogItem*)pOld == *pItem ) ) 1249 { 1250 rAttrs.Put( *pItem ); 1251 bModified = sal_True; 1252 } 1253 delete pItem; 1254 } 1255 } 1256 1257 //aMtrFldXSize 1258 String aStr = aMtrFldXSize.GetText(); 1259 { 1260 XFillBmpSizeXItem* pItem = NULL; 1261 TriState eScaleState = aTsbScale.GetState(); 1262 1263 if( aMtrFldXSize.IsEnabled() && 1264 aStr.Len() > 0 && 1265 aStr != aMtrFldXSize.GetSavedValue() ) 1266 { 1267 if( eScaleState == STATE_NOCHECK ) 1268 pItem = new XFillBmpSizeXItem( GetCoreValue( aMtrFldXSize, ePoolUnit ) ); 1269 else 1270 { 1271 // Prozentwerte werden negativ gesetzt, damit 1272 // diese nicht skaliert werden; dieses wird 1273 // im Item beruecksichtigt ( KA05.11.96 ) 1274 pItem = new XFillBmpSizeXItem( -labs( static_cast<long>(aMtrFldXSize.GetValue()) ) ); 1275 } 1276 } 1277 else if( aTsbOriginal.IsEnabled() && 1278 aTsbOriginal.GetState() == STATE_CHECK && 1279 aMtrFldXSize.GetSavedValue().Len() > 0 ) 1280 pItem = new XFillBmpSizeXItem( 0 ); 1281 1282 if( pItem ) 1283 { 1284 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_SIZEX ); 1285 if ( !pOld || !( *(const XFillBmpSizeXItem*)pOld == *pItem ) ) 1286 { 1287 rAttrs.Put( *pItem ); 1288 bModified = sal_True; 1289 } 1290 delete pItem; 1291 } 1292 } 1293 1294 //aMtrFldYSize 1295 aStr = aMtrFldYSize.GetText(); 1296 { 1297 XFillBmpSizeYItem* pItem = NULL; 1298 TriState eScaleState = aTsbScale.GetState(); 1299 1300 if( aMtrFldYSize.IsEnabled() && 1301 aStr.Len() > 0 && 1302 aStr != aMtrFldYSize.GetSavedValue() ) 1303 { 1304 if( eScaleState == STATE_NOCHECK ) 1305 pItem = new XFillBmpSizeYItem( GetCoreValue( aMtrFldYSize, ePoolUnit ) ); 1306 else 1307 { 1308 // Prozentwerte werden negativ gesetzt, damit 1309 // diese vom MetricItem nicht skaliert werden; 1310 // dieses wird im Item beruecksichtigt ( KA05.11.96 ) 1311 pItem = new XFillBmpSizeYItem( -labs( static_cast<long>(aMtrFldYSize.GetValue()) ) ); 1312 } 1313 } 1314 else if( aTsbOriginal.IsEnabled() && 1315 aTsbOriginal.GetState() == STATE_CHECK && 1316 aMtrFldYSize.GetSavedValue().Len() > 0 ) 1317 pItem = new XFillBmpSizeYItem( 0 ); 1318 1319 if( pItem ) 1320 { 1321 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_SIZEY ); 1322 if ( !pOld || !( *(const XFillBmpSizeYItem*)pOld == *pItem ) ) 1323 { 1324 rAttrs.Put( *pItem ); 1325 bModified = sal_True; 1326 } 1327 delete pItem; 1328 } 1329 } 1330 1331 //aRbtRow 1332 //aRbtColumn 1333 //aMtrFldOffset 1334 if( aMtrFldOffset.IsEnabled() ) 1335 { 1336 String aMtrString = aMtrFldOffset.GetText(); 1337 if( ( aMtrString.Len() > 0 && 1338 aMtrString != aMtrFldOffset.GetSavedValue() ) || 1339 aRbtRow.GetSavedValue() != aRbtRow.IsChecked() || 1340 aRbtColumn.GetSavedValue() != aRbtColumn.IsChecked() ) 1341 { 1342 if( aRbtRow.IsChecked() ) 1343 { 1344 XFillBmpTileOffsetXItem aFillBmpTileOffsetXItem( (sal_uInt16) aMtrFldOffset.GetValue() ); 1345 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_TILEOFFSETX ); 1346 if ( !pOld || !( *(const XFillBmpTileOffsetXItem*)pOld == aFillBmpTileOffsetXItem ) ) 1347 { 1348 rAttrs.Put( aFillBmpTileOffsetXItem ); 1349 rAttrs.Put( XFillBmpTileOffsetYItem( 0 ) ); 1350 bModified = sal_True; 1351 } 1352 } 1353 else if( aRbtColumn.IsChecked() ) 1354 { 1355 XFillBmpTileOffsetYItem aFillBmpTileOffsetYItem( (sal_uInt16) aMtrFldOffset.GetValue() ); 1356 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_TILEOFFSETY ); 1357 if ( !pOld || !( *(const XFillBmpTileOffsetYItem*)pOld == aFillBmpTileOffsetYItem ) ) 1358 { 1359 rAttrs.Put( aFillBmpTileOffsetYItem ); 1360 rAttrs.Put( XFillBmpTileOffsetXItem( 0 ) ); 1361 bModified = sal_True; 1362 } 1363 } 1364 } 1365 } 1366 1367 //aCtlPosition 1368 if( aCtlPosition.IsEnabled() ) 1369 { 1370 sal_Bool bPut = sal_False; 1371 RECT_POINT _eRP = aCtlPosition.GetActualRP(); 1372 1373 if( SFX_ITEM_DONTCARE == rOutAttrs.GetItemState( XATTR_FILLBMP_POS ) ) 1374 bPut = sal_True; 1375 else 1376 { 1377 RECT_POINT eValue = ( ( const XFillBmpPosItem& ) rOutAttrs.Get( XATTR_FILLBMP_POS ) ).GetValue(); 1378 if( eValue != _eRP ) 1379 bPut = sal_True; 1380 } 1381 if( bPut ) 1382 { 1383 XFillBmpPosItem aFillBmpPosItem( _eRP ); 1384 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_POS ); 1385 if ( !pOld || !( *(const XFillBmpPosItem*)pOld == aFillBmpPosItem ) ) 1386 { 1387 rAttrs.Put( aFillBmpPosItem ); 1388 bModified = sal_True; 1389 } 1390 } 1391 } 1392 1393 //aMtrFldXOffset 1394 if( aMtrFldXOffset.IsEnabled() ) 1395 { 1396 String sMtrXOffset = aMtrFldXOffset.GetText(); 1397 if( sMtrXOffset.Len() > 0 && 1398 sMtrXOffset != aMtrFldXOffset.GetSavedValue() ) 1399 { 1400 XFillBmpPosOffsetXItem aFillBmpPosOffsetXItem( (sal_uInt16) aMtrFldXOffset.GetValue() ); 1401 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_POSOFFSETX ); 1402 if ( !pOld || !( *(const XFillBmpPosOffsetXItem*)pOld == aFillBmpPosOffsetXItem ) ) 1403 { 1404 rAttrs.Put( aFillBmpPosOffsetXItem ); 1405 bModified = sal_True; 1406 } 1407 } 1408 } 1409 1410 //aMtrFldYOffset 1411 if( aMtrFldYOffset.IsEnabled() ) 1412 { 1413 String sMtrYOffset = aMtrFldYOffset.GetText(); 1414 if( sMtrYOffset.Len() > 0 && 1415 sMtrYOffset != aMtrFldYOffset.GetSavedValue() ) 1416 { 1417 XFillBmpPosOffsetYItem aFillBmpPosOffsetYItem( (sal_uInt16) aMtrFldYOffset.GetValue() ); 1418 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_POSOFFSETY ); 1419 if ( !pOld || !( *(const XFillBmpPosOffsetYItem*)pOld == aFillBmpPosOffsetYItem ) ) 1420 { 1421 rAttrs.Put( aFillBmpPosOffsetYItem ); 1422 bModified = sal_True; 1423 } 1424 } 1425 } 1426 //add CHINA001 begin 1427 rAttrs.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType)); 1428 rAttrs.Put (SfxUInt16Item(SID_TABPAGE_POS,nPos)); 1429 //add CHINA001 end 1430 } 1431 1432 return( bModified ); 1433 } 1434 1435 // ----------------------------------------------------------------------- 1436 1437 void SvxAreaTabPage::Reset( const SfxItemSet& rAttrs ) 1438 { 1439 //const SfxPoolItem *pPoolItem = NULL; 1440 1441 XFillStyle eXFS; 1442 if( rAttrs.GetItemState( XATTR_FILLSTYLE ) != SFX_ITEM_DONTCARE ) 1443 { 1444 eXFS = (XFillStyle) ( ( ( const XFillStyleItem& ) rAttrs. 1445 Get( GetWhich( XATTR_FILLSTYLE ) ) ).GetValue() ); 1446 aTypeLB.SelectEntryPos( sal::static_int_cast< sal_uInt16 >( eXFS ) ); 1447 switch( eXFS ) 1448 { 1449 case XFILL_NONE: 1450 ClickInvisibleHdl_Impl( this ); 1451 break; 1452 1453 case XFILL_SOLID: 1454 //if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), sal_True, &pPoolItem ) ) 1455 if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLCOLOR ) ) 1456 { 1457 XFillColorItem aColorItem( ( const XFillColorItem& ) 1458 rAttrs.Get( XATTR_FILLCOLOR ) ); 1459 1460 aLbColor.SelectEntry( aColorItem.GetColorValue() ); 1461 aLbHatchBckgrdColor.SelectEntry( aColorItem.GetColorValue() ); 1462 } 1463 ClickColorHdl_Impl( this ); 1464 1465 break; 1466 1467 case XFILL_GRADIENT: 1468 //if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), sal_True, &pPoolItem ) ) 1469 if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLGRADIENT ) ) 1470 { 1471 XFillGradientItem aGradientItem( ( ( const XFillGradientItem& ) 1472 rAttrs.Get( XATTR_FILLGRADIENT ) ) ); 1473 String aString( aGradientItem.GetName() ); 1474 XGradient aGradient( aGradientItem.GetGradientValue() ); 1475 1476 aLbGradient.SelectEntryByList( pGradientList, aString, aGradient ); 1477 } 1478 ClickGradientHdl_Impl( this ); 1479 break; 1480 1481 case XFILL_HATCH: 1482 //if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), sal_True, &pPoolItem ) ) 1483 if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLHATCH ) ) 1484 { 1485 aLbHatching.SelectEntry( ( ( const XFillHatchItem& ) 1486 rAttrs.Get( XATTR_FILLHATCH ) ).GetName() ); 1487 } 1488 ClickHatchingHdl_Impl( this ); 1489 1490 if ( SFX_ITEM_DONTCARE != rAttrs.GetItemState ( XATTR_FILLBACKGROUND ) ) 1491 { 1492 aCbxHatchBckgrd.Check ( ( ( const XFillBackgroundItem& ) rAttrs.Get ( XATTR_FILLBACKGROUND ) ).GetValue() ); 1493 } 1494 ToggleHatchBckgrdColorHdl_Impl( this ); 1495 if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLCOLOR ) ) 1496 { 1497 XFillColorItem aColorItem( ( const XFillColorItem& ) 1498 rAttrs.Get( XATTR_FILLCOLOR ) ); 1499 1500 aLbColor.SelectEntry( aColorItem.GetColorValue() ); 1501 aLbHatchBckgrdColor.SelectEntry( aColorItem.GetColorValue() ); 1502 } 1503 break; 1504 1505 case XFILL_BITMAP: 1506 { 1507 if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLBITMAP ) ) 1508 { 1509 XFillBitmapItem aBitmapItem( ( const XFillBitmapItem& ) 1510 rAttrs.Get( XATTR_FILLBITMAP ) ); 1511 1512 String aString( aBitmapItem.GetName() ); 1513 aLbBitmap.SelectEntry( aString ); 1514 } 1515 ClickBitmapHdl_Impl( this ); 1516 } 1517 break; 1518 1519 default: 1520 //aLbColor.SelectEntryPos(0); 1521 //aRbtColor.Check(); 1522 break; 1523 } 1524 } 1525 else 1526 { 1527 // Alle LBs nicht zug"anglich machen 1528 aLbColor.Hide(); 1529 aLbGradient.Hide(); 1530 aLbHatching.Hide(); 1531 aLbBitmap.Hide(); 1532 aCtlBitmapPreview.Hide(); 1533 aLbColor.Disable(); 1534 aLbColor.Show(); 1535 1536 // Damit Reset() auch mit Zurueck richtig funktioniert 1537 aTypeLB.SetNoSelection(); 1538 } 1539 1540 // Schrittweite 1541 if( ( rAttrs.GetItemState( XATTR_GRADIENTSTEPCOUNT ) != SFX_ITEM_DONTCARE ) || 1542 ( rAttrs.GetItemState( XATTR_FILLSTYLE ) != SFX_ITEM_DONTCARE ) ) 1543 { 1544 aTsbStepCount.EnableTriState( sal_False ); 1545 sal_uInt16 nValue = ( ( const XGradientStepCountItem& ) rAttrs.Get( XATTR_GRADIENTSTEPCOUNT ) ).GetValue(); 1546 if( nValue == 0 ) 1547 { 1548 aTsbStepCount.SetState( STATE_CHECK ); 1549 aNumFldStepCount.SetText( String() ); 1550 } 1551 else 1552 { 1553 aTsbStepCount.SetState( STATE_NOCHECK ); 1554 aNumFldStepCount.SetValue( nValue ); 1555 } 1556 ModifyStepCountHdl_Impl( &aTsbStepCount ); 1557 } 1558 else 1559 { 1560 aTsbStepCount.SetState( STATE_DONTKNOW ); 1561 aNumFldStepCount.SetText( String() ); 1562 } 1563 1564 // Attribute fuer die Bitmap-Fuellung 1565 1566 // Ist Kacheln gesetzt? 1567 if( rAttrs.GetItemState( XATTR_FILLBMP_TILE ) != SFX_ITEM_DONTCARE ) 1568 { 1569 aTsbTile.EnableTriState( sal_False ); 1570 1571 if( ( ( const XFillBmpTileItem& ) rAttrs.Get( XATTR_FILLBMP_TILE ) ).GetValue() ) 1572 aTsbTile.SetState( STATE_CHECK ); 1573 else 1574 aTsbTile.SetState( STATE_NOCHECK ); 1575 } 1576 else 1577 aTsbTile.SetState( STATE_DONTKNOW ); 1578 1579 // Ist Stretchen gesetzt? 1580 if( rAttrs.GetItemState( XATTR_FILLBMP_STRETCH ) != SFX_ITEM_DONTCARE ) 1581 { 1582 aTsbStretch.EnableTriState( sal_False ); 1583 1584 if( ( ( const XFillBmpStretchItem& ) rAttrs.Get( XATTR_FILLBMP_STRETCH ) ).GetValue() ) 1585 aTsbStretch.SetState( STATE_CHECK ); 1586 else 1587 aTsbStretch.SetState( STATE_NOCHECK ); 1588 } 1589 else 1590 aTsbStretch.SetState( STATE_DONTKNOW ); 1591 1592 1593 //aTsbScale 1594 if( rAttrs.GetItemState( XATTR_FILLBMP_SIZELOG ) != SFX_ITEM_DONTCARE ) 1595 { 1596 aTsbScale.EnableTriState( sal_False ); 1597 1598 if( ( ( const XFillBmpSizeLogItem& ) rAttrs.Get( XATTR_FILLBMP_SIZELOG ) ).GetValue() ) 1599 aTsbScale.SetState( STATE_NOCHECK ); 1600 else 1601 aTsbScale.SetState( STATE_CHECK ); 1602 1603 ClickScaleHdl_Impl( NULL ); 1604 } 1605 else 1606 aTsbScale.SetState( STATE_DONTKNOW ); 1607 1608 1609 // Status fuer Originalgroesse ermitteln 1610 TriState eOriginal = STATE_NOCHECK; 1611 1612 //aMtrFldXSize 1613 if( rAttrs.GetItemState( XATTR_FILLBMP_SIZEX ) != SFX_ITEM_DONTCARE ) 1614 { 1615 sal_Int32 nValue = ( ( const XFillBmpSizeXItem& ) rAttrs.Get( XATTR_FILLBMP_SIZEX ) ).GetValue(); 1616 if( aTsbScale.GetState() == STATE_CHECK ) 1617 { 1618 // Wenn im Item eine Prozentangabe steckt, 1619 // so ist diese wegen des MetricItems negativ 1620 aMtrFldXSize.SetValue( labs( nValue ) ); 1621 } 1622 else 1623 SetMetricValue( aMtrFldXSize, nValue, ePoolUnit ); 1624 aMtrFldXSize.SaveValue(); 1625 1626 if( nValue == 0 ) 1627 { 1628 eOriginal = STATE_CHECK; 1629 // Wert ist beim Ausschalten von Originalgroesse sonst zu klein 1630 // (Performance-Problem) 1631 aMtrFldXSize.SetValue( 100 ); 1632 } 1633 } 1634 else 1635 { 1636 aMtrFldXSize.SetText( String() ); 1637 aMtrFldXSize.SaveValue(); 1638 } 1639 1640 //aMtrFldYSize 1641 if( rAttrs.GetItemState( XATTR_FILLBMP_SIZEY ) != SFX_ITEM_DONTCARE ) 1642 { 1643 sal_Int32 nValue = ( ( const XFillBmpSizeYItem& ) rAttrs.Get( XATTR_FILLBMP_SIZEY ) ).GetValue(); 1644 if( aTsbScale.GetState() == STATE_CHECK ) 1645 { 1646 // Wenn im Item eine Prozentangabe steckt, 1647 // so ist diese wegen des MetricItems negativ 1648 aMtrFldYSize.SetValue( labs( nValue ) ); 1649 } 1650 else 1651 SetMetricValue( aMtrFldYSize, nValue, ePoolUnit ); 1652 aMtrFldYSize.SaveValue(); 1653 1654 if( nValue == 0 ) 1655 aMtrFldYSize.SetValue( 100 ); //s.o. 1656 else 1657 eOriginal = STATE_NOCHECK; 1658 } 1659 else 1660 { 1661 aMtrFldYSize.SetText( String() ); 1662 aMtrFldYSize.SaveValue(); 1663 eOriginal = STATE_NOCHECK; 1664 } 1665 1666 // aTsbOriginal 1667 aTsbOriginal.SetState( eOriginal ); 1668 1669 // #93372# Setting proper state after changing button 1670 ModifyTileHdl_Impl( NULL ); 1671 1672 //aRbtRow 1673 //aRbtColumn 1674 //aMtrFldOffset 1675 if( rAttrs.GetItemState( XATTR_FILLBMP_TILEOFFSETX ) != SFX_ITEM_DONTCARE ) 1676 { 1677 sal_uInt16 nValue = ( ( const XFillBmpTileOffsetXItem& ) rAttrs.Get( XATTR_FILLBMP_TILEOFFSETX ) ).GetValue(); 1678 if( nValue > 0 ) 1679 { 1680 aMtrFldOffset.SetValue( nValue ); 1681 aRbtRow.Check(); 1682 } 1683 else if( rAttrs.GetItemState( XATTR_FILLBMP_TILEOFFSETY ) != SFX_ITEM_DONTCARE ) 1684 { 1685 nValue = ( ( const XFillBmpTileOffsetYItem& ) rAttrs.Get( XATTR_FILLBMP_TILEOFFSETY ) ).GetValue(); 1686 if( nValue > 0 ) 1687 { 1688 aMtrFldOffset.SetValue( nValue ); 1689 aRbtColumn.Check(); 1690 } 1691 } 1692 else 1693 aMtrFldOffset.SetValue( 0 ); 1694 } 1695 else 1696 aMtrFldOffset.SetText( String() ); 1697 1698 1699 //aCtlPosition 1700 if( rAttrs.GetItemState( XATTR_FILLBMP_POS ) != SFX_ITEM_DONTCARE ) 1701 { 1702 RECT_POINT eValue = ( ( const XFillBmpPosItem& ) rAttrs.Get( XATTR_FILLBMP_POS ) ).GetValue(); 1703 aCtlPosition.SetActualRP( eValue ); 1704 } 1705 else 1706 aCtlPosition.Reset(); 1707 1708 //aMtrFldXOffset 1709 if( rAttrs.GetItemState( XATTR_FILLBMP_POSOFFSETX ) != SFX_ITEM_DONTCARE ) 1710 { 1711 sal_Int32 nValue = ( ( const XFillBmpPosOffsetXItem& ) rAttrs.Get( XATTR_FILLBMP_POSOFFSETX ) ).GetValue(); 1712 aMtrFldXOffset.SetValue( nValue ); 1713 } 1714 else 1715 aMtrFldXOffset.SetText( String() ); 1716 1717 //aMtrFldYOffset 1718 if( rAttrs.GetItemState( XATTR_FILLBMP_POSOFFSETY ) != SFX_ITEM_DONTCARE ) 1719 { 1720 sal_Int32 nValue = ( ( const XFillBmpPosOffsetYItem& ) rAttrs.Get( XATTR_FILLBMP_POSOFFSETY ) ).GetValue(); 1721 aMtrFldYOffset.SetValue( nValue ); 1722 } 1723 else 1724 aMtrFldYOffset.SetText( String() ); 1725 1726 // Erst hier, damit Tile und Stretch mit beruecksichtigt wird 1727 if( aTypeLB.GetSelectEntryPos() == XFILL_BITMAP ) 1728 ClickBitmapHdl_Impl( NULL ); 1729 1730 // Werte sichern 1731 aTypeLB.SaveValue(); 1732 aLbColor.SaveValue(); 1733 aLbGradient.SaveValue(); 1734 aLbHatching.SaveValue(); 1735 //aCbxHatchBckgrd.SaveValue(); 1736 aLbHatchBckgrdColor.SaveValue(); 1737 aLbBitmap.SaveValue(); 1738 // aLbTransparent.SaveValue(); 1739 aTsbStepCount.SaveValue(); 1740 aNumFldStepCount.SaveValue(); 1741 aTsbTile.SaveValue(); 1742 aTsbStretch.SaveValue(); 1743 aTsbScale.SaveValue(); 1744 aRbtRow.SaveValue(); 1745 aRbtColumn.SaveValue(); 1746 aMtrFldOffset.SaveValue(); 1747 aMtrFldXOffset.SaveValue(); 1748 aMtrFldYOffset.SaveValue(); 1749 //aMtrFldXSize.SaveValue(); <- wird oben behandelt 1750 //aMtrFldYSize.SaveValue(); <- wird oben behandelt 1751 } 1752 1753 // ----------------------------------------------------------------------- 1754 1755 SfxTabPage* SvxAreaTabPage::Create( Window* pWindow, 1756 const SfxItemSet& rAttrs ) 1757 { 1758 return( new SvxAreaTabPage( pWindow, rAttrs ) ); 1759 } 1760 1761 //------------------------------------------------------------------------ 1762 1763 sal_uInt16* SvxAreaTabPage::GetRanges() 1764 { 1765 return( pAreaRanges ); 1766 } 1767 1768 //------------------------------------------------------------------------ 1769 IMPL_LINK( SvxAreaTabPage, SelectDialogTypeHdl_Impl, ListBox *, EMPTYARG ) 1770 { 1771 switch( (XFillStyle)aTypeLB.GetSelectEntryPos() ) 1772 { 1773 case XFILL_NONE: ClickInvisibleHdl_Impl( this ); break; 1774 case XFILL_SOLID: ClickColorHdl_Impl( this ); break; 1775 case XFILL_GRADIENT: ClickGradientHdl_Impl( this ); break; 1776 case XFILL_HATCH: ClickHatchingHdl_Impl( this ); break; 1777 case XFILL_BITMAP: ClickBitmapHdl_Impl( this ); break; 1778 } 1779 1780 return 0; 1781 } 1782 1783 IMPL_LINK( SvxAreaTabPage, ClickInvisibleHdl_Impl, void *, EMPTYARG ) 1784 { 1785 aTsbTile.Hide(); 1786 aTsbStretch.Hide(); 1787 aTsbScale.Hide(); 1788 aTsbOriginal.Hide(); 1789 aFtXSize.Hide(); 1790 aMtrFldXSize.Hide(); 1791 aFtYSize.Hide(); 1792 aMtrFldYSize.Hide(); 1793 aFlSize.Hide(); 1794 aRbtRow.Hide(); 1795 aRbtColumn.Hide(); 1796 aMtrFldOffset.Hide(); 1797 aFlOffset.Hide(); 1798 aCtlPosition.Hide(); 1799 aFtXOffset.Hide(); 1800 aMtrFldXOffset.Hide(); 1801 aFtYOffset.Hide(); 1802 aMtrFldYOffset.Hide(); 1803 aFlPosition.Hide(); 1804 1805 aLbColor.Hide(); 1806 aLbGradient.Hide(); 1807 aLbHatching.Hide(); 1808 aLbBitmap.Hide(); 1809 aCtlXRectPreview.Hide(); 1810 aCtlBitmapPreview.Hide(); 1811 1812 aFlStepCount.Hide(); 1813 aTsbStepCount.Hide(); 1814 aNumFldStepCount.Hide(); 1815 1816 // Controls for Hatch-Background 1817 aCbxHatchBckgrd.Hide(); 1818 aLbHatchBckgrdColor.Hide(); 1819 1820 rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); 1821 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); 1822 aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); 1823 1824 aCtlXRectPreview.Invalidate(); 1825 aCtlBitmapPreview.Invalidate(); 1826 1827 return( 0L ); 1828 } 1829 1830 //------------------------------------------------------------------------ 1831 1832 IMPL_LINK( SvxAreaTabPage, ClickColorHdl_Impl, void *, EMPTYARG ) 1833 { 1834 aTsbTile.Hide(); 1835 aTsbStretch.Hide(); 1836 aTsbScale.Hide(); 1837 aTsbOriginal.Hide(); 1838 aFtXSize.Hide(); 1839 aMtrFldXSize.Hide(); 1840 aFtYSize.Hide(); 1841 aMtrFldYSize.Hide(); 1842 aFlSize.Hide(); 1843 aRbtRow.Hide(); 1844 aRbtColumn.Hide(); 1845 aMtrFldOffset.Hide(); 1846 aFlOffset.Hide(); 1847 aCtlPosition.Hide(); 1848 aFtXOffset.Hide(); 1849 aMtrFldXOffset.Hide(); 1850 aFtYOffset.Hide(); 1851 aMtrFldYOffset.Hide(); 1852 aFlPosition.Hide(); 1853 1854 aLbColor.Enable(); 1855 aLbColor.Show(); 1856 aLbGradient.Hide(); 1857 aLbHatching.Hide(); 1858 aLbBitmap.Hide(); 1859 aCtlXRectPreview.Enable(); 1860 aCtlXRectPreview.Show(); 1861 aCtlBitmapPreview.Hide(); 1862 1863 aFlStepCount.Hide(); 1864 aTsbStepCount.Hide(); 1865 aNumFldStepCount.Hide(); 1866 1867 // Controls for Hatch-Background 1868 aCbxHatchBckgrd.Hide(); 1869 aLbHatchBckgrdColor.Hide(); 1870 1871 // Text der Tabelle setzen 1872 String aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); 1873 INetURLObject aURL( pColorTab->GetPath() ); 1874 1875 aURL.Append( pColorTab->GetName() ); 1876 DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); 1877 1878 if( aURL.getBase().getLength() > 18 ) 1879 { 1880 aString += String(aURL.getBase()).Copy( 0, 15 ); 1881 aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); 1882 } 1883 else 1884 aString += String(aURL.getBase()); 1885 1886 ModifyColorHdl_Impl( this ); 1887 return( 0L ); 1888 } 1889 1890 //------------------------------------------------------------------------ 1891 1892 IMPL_LINK( SvxAreaTabPage, ModifyColorHdl_Impl, void *, EMPTYARG ) 1893 { 1894 const SfxPoolItem* pPoolItem = NULL; 1895 sal_uInt16 _nPos = aLbColor.GetSelectEntryPos(); 1896 aLbHatchBckgrdColor.SelectEntryPos( _nPos ); 1897 if( _nPos != LISTBOX_ENTRY_NOTFOUND ) 1898 { 1899 rXFSet.Put( XFillStyleItem( XFILL_SOLID ) ); 1900 rXFSet.Put( XFillColorItem( String(), 1901 aLbColor.GetSelectEntryColor() ) ); 1902 } 1903 // NEU 1904 else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), sal_True, &pPoolItem ) ) 1905 { 1906 rXFSet.Put( XFillStyleItem( XFILL_SOLID ) ); 1907 Color aColor( ( ( const XFillColorItem* ) pPoolItem )->GetColorValue() ); 1908 rXFSet.Put( XFillColorItem( String(), aColor ) ); 1909 } 1910 else 1911 rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); 1912 1913 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); 1914 aCtlXRectPreview.Invalidate(); 1915 1916 return( 0L ); 1917 } 1918 //------------------------------------------------------------------------ 1919 1920 IMPL_LINK( SvxAreaTabPage, ClickGradientHdl_Impl, void *, EMPTYARG ) 1921 { 1922 aTsbTile.Hide(); 1923 aTsbStretch.Hide(); 1924 aTsbScale.Hide(); 1925 aTsbOriginal.Hide(); 1926 aFtXSize.Hide(); 1927 aMtrFldXSize.Hide(); 1928 aFtYSize.Hide(); 1929 aMtrFldYSize.Hide(); 1930 aFlSize.Hide(); 1931 aRbtRow.Hide(); 1932 aRbtColumn.Hide(); 1933 aMtrFldOffset.Hide(); 1934 aFlOffset.Hide(); 1935 aCtlPosition.Hide(); 1936 aFtXOffset.Hide(); 1937 aMtrFldXOffset.Hide(); 1938 aFtYOffset.Hide(); 1939 aMtrFldYOffset.Hide(); 1940 aFlPosition.Hide(); 1941 1942 aLbColor.Hide(); 1943 aLbGradient.Enable(); 1944 aLbGradient.Show(); 1945 aLbHatching.Hide(); 1946 aLbBitmap.Hide(); 1947 aCtlXRectPreview.Enable(); 1948 aCtlXRectPreview.Show(); 1949 aCtlBitmapPreview.Hide(); 1950 1951 aFlStepCount.Enable(); 1952 aFlStepCount.Show(); 1953 aTsbStepCount.Enable(); 1954 aTsbStepCount.Show(); 1955 aNumFldStepCount.Show(); 1956 1957 // Controls for Hatch-Background 1958 aCbxHatchBckgrd.Hide(); 1959 aLbHatchBckgrdColor.Hide(); 1960 1961 // Text der Tabelle setzen 1962 String aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); 1963 INetURLObject aURL( pGradientList->GetPath() ); 1964 1965 aURL.Append( pGradientList->GetName() ); 1966 DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); 1967 1968 if( aURL.getBase().getLength() > 18 ) 1969 { 1970 aString += String(aURL.getBase()).Copy( 0, 15 ); 1971 aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); 1972 } 1973 else 1974 aString += String(aURL.getBase()); 1975 1976 ModifyGradientHdl_Impl( this ); 1977 ModifyStepCountHdl_Impl( &aTsbStepCount ); 1978 return( 0L ); 1979 } 1980 1981 //------------------------------------------------------------------------ 1982 1983 IMPL_LINK( SvxAreaTabPage, ModifyGradientHdl_Impl, void *, EMPTYARG ) 1984 { 1985 const SfxPoolItem* pPoolItem = NULL; 1986 sal_uInt16 _nPos = aLbGradient.GetSelectEntryPos(); 1987 if( _nPos != LISTBOX_ENTRY_NOTFOUND ) 1988 { 1989 // ItemSet fuellen und an aCtlXRectPreview weiterleiten 1990 XGradientEntry* pEntry = pGradientList->GetGradient( _nPos ); 1991 1992 rXFSet.Put( XFillStyleItem( XFILL_GRADIENT ) ); 1993 rXFSet.Put( XFillGradientItem( String(), 1994 pEntry->GetGradient() ) ); 1995 } 1996 // NEU 1997 else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), sal_True, &pPoolItem ) ) 1998 { 1999 rXFSet.Put( XFillStyleItem( XFILL_GRADIENT ) ); 2000 rXFSet.Put( XFillGradientItem( String(), ( ( const XFillGradientItem* ) pPoolItem )->GetGradientValue() ) ); 2001 } 2002 else 2003 rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); 2004 2005 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); 2006 aCtlXRectPreview.Invalidate(); 2007 2008 return( 0L ); 2009 } 2010 2011 //------------------------------------------------------------------------ 2012 2013 IMPL_LINK( SvxAreaTabPage, ClickHatchingHdl_Impl, void *, EMPTYARG ) 2014 { 2015 aLbColor.Hide(); 2016 aLbGradient.Hide(); 2017 aLbHatching.Enable(); 2018 aLbHatching.Show(); 2019 aLbBitmap.Hide(); 2020 aCtlXRectPreview.Enable(); 2021 aCtlXRectPreview.Show(); 2022 aCtlBitmapPreview.Hide(); 2023 2024 // aGrpTransparent.Hide(); 2025 // aLbTransparent.Hide(); 2026 aFlStepCount.Hide(); 2027 aTsbStepCount.Hide(); 2028 aNumFldStepCount.Hide(); 2029 2030 aTsbTile.Hide(); 2031 aTsbStretch.Hide(); 2032 aTsbScale.Hide(); 2033 aTsbOriginal.Hide(); 2034 aFtXSize.Hide(); 2035 aMtrFldXSize.Hide(); 2036 aFtYSize.Hide(); 2037 aMtrFldYSize.Hide(); 2038 aFlSize.Hide(); 2039 aRbtRow.Hide(); 2040 aRbtColumn.Hide(); 2041 aMtrFldOffset.Hide(); 2042 aFlOffset.Hide(); 2043 aCtlPosition.Hide(); 2044 aFtXOffset.Hide(); 2045 aMtrFldXOffset.Hide(); 2046 aFtYOffset.Hide(); 2047 aMtrFldYOffset.Hide(); 2048 aFlPosition.Hide(); 2049 2050 // Controls for Hatch-Background 2051 aCbxHatchBckgrd.Show(); 2052 aLbHatchBckgrdColor.Show(); 2053 aCbxHatchBckgrd.Enable(); 2054 aLbHatchBckgrdColor.Enable(); 2055 2056 // Text der Tabelle setzen 2057 String aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); 2058 INetURLObject aURL( pHatchingList->GetPath() ); 2059 2060 aURL.Append( pHatchingList->GetName() ); 2061 DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); 2062 2063 if( aURL.getBase().getLength() > 18 ) 2064 { 2065 aString += String(String(aURL.getBase()).Copy( 0, 15 )); 2066 aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); 2067 } 2068 else 2069 aString += String(aURL.getBase()); 2070 2071 ModifyHatchingHdl_Impl( this ); 2072 ModifyHatchBckgrdColorHdl_Impl( this ); 2073 ToggleHatchBckgrdColorHdl_Impl( this ); 2074 2075 return( 0L ); 2076 } 2077 2078 //------------------------------------------------------------------------ 2079 2080 IMPL_LINK( SvxAreaTabPage, ModifyHatchingHdl_Impl, void *, EMPTYARG ) 2081 { 2082 const SfxPoolItem* pPoolItem = NULL; 2083 sal_uInt16 _nPos = aLbHatching.GetSelectEntryPos(); 2084 if( _nPos != LISTBOX_ENTRY_NOTFOUND ) 2085 { 2086 // ItemSet fuellen und an aCtlXRectPreview weiterleiten 2087 XHatchEntry* pEntry = pHatchingList->GetHatch( _nPos ); 2088 2089 rXFSet.Put( XFillStyleItem( XFILL_HATCH ) ); 2090 rXFSet.Put( XFillHatchItem( String(), pEntry->GetHatch() ) ); 2091 } 2092 // NEU 2093 else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), sal_True, &pPoolItem ) ) 2094 { 2095 rXFSet.Put( XFillStyleItem( XFILL_HATCH ) ); 2096 rXFSet.Put( XFillHatchItem( String(), ( ( const XFillHatchItem* ) pPoolItem )->GetHatchValue() ) ); 2097 } 2098 else 2099 rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); 2100 2101 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); 2102 aCtlXRectPreview.Invalidate(); 2103 2104 return( 0L ); 2105 } 2106 2107 //------------------------------------------------------------------------ 2108 2109 IMPL_LINK( SvxAreaTabPage, ModifyHatchBckgrdColorHdl_Impl, void *, EMPTYARG ) 2110 { 2111 const SfxPoolItem* pPoolItem = NULL; 2112 sal_uInt16 _nPos = aLbHatchBckgrdColor.GetSelectEntryPos(); 2113 aLbColor.SelectEntryPos( _nPos ); 2114 if( _nPos != LISTBOX_ENTRY_NOTFOUND ) 2115 { 2116 // rXFSet.Put( XFillStyleItem( XFILL_SOLID ) ); 2117 rXFSet.Put( XFillColorItem( String(), 2118 aLbHatchBckgrdColor.GetSelectEntryColor() ) ); 2119 } 2120 // NEU 2121 else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), sal_True, &pPoolItem ) ) 2122 { 2123 // rXFSet.Put( XFillStyleItem( XFILL_SOLID ) ); 2124 Color aColor( ( ( const XFillColorItem* ) pPoolItem )->GetColorValue() ); 2125 rXFSet.Put( XFillColorItem( String(), aColor ) ); 2126 } 2127 else 2128 rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); 2129 2130 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); 2131 aCtlXRectPreview.Invalidate(); 2132 2133 return( 0L ); 2134 } 2135 2136 //------------------------------------------------------------------------ 2137 2138 IMPL_LINK( SvxAreaTabPage, ToggleHatchBckgrdColorHdl_Impl, void *, EMPTYARG ) 2139 { 2140 // switch on/off backgroundcolor for hatches 2141 aLbHatchBckgrdColor.Enable( aCbxHatchBckgrd.IsChecked() ); 2142 2143 XFillBackgroundItem aItem( aCbxHatchBckgrd.IsChecked() ); 2144 rXFSet.Put ( aItem, XATTR_FILLBACKGROUND ); 2145 2146 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); 2147 aCtlXRectPreview.Invalidate(); 2148 2149 if( aLbHatchBckgrdColor.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ) 2150 { 2151 if ( SFX_ITEM_SET == rOutAttrs.GetItemState( XATTR_FILLCOLOR ) )//>= SFX_ITEM_DEFAULT ) 2152 { 2153 XFillColorItem aColorItem( (const XFillColorItem&)rOutAttrs.Get( XATTR_FILLCOLOR ) ); 2154 aLbHatchBckgrdColor.SelectEntry( aColorItem.GetColorValue() ); 2155 } 2156 } 2157 2158 return( 0L ); 2159 } 2160 2161 //------------------------------------------------------------------------ 2162 2163 IMPL_LINK( SvxAreaTabPage, ClickBitmapHdl_Impl, void *, EMPTYARG ) 2164 { 2165 aLbColor.Hide(); 2166 aLbGradient.Hide(); 2167 aLbHatching.Hide(); 2168 aLbBitmap.Enable(); 2169 aLbBitmap.Show(); 2170 aCtlBitmapPreview.Enable(); 2171 aCtlBitmapPreview.Show(); 2172 aCtlXRectPreview.Hide(); 2173 // aGrpPreview.Hide(); 2174 // aGrpTransparent.Hide(); 2175 // aLbTransparent.Hide(); 2176 aFlStepCount.Hide(); 2177 aTsbStepCount.Hide(); 2178 aNumFldStepCount.Hide(); 2179 2180 aTsbTile.Enable(); 2181 aTsbStretch.Enable(); 2182 aTsbScale.Enable(); 2183 aTsbOriginal.Enable(); 2184 aFtXSize.Enable(); 2185 aMtrFldXSize.Enable(); 2186 aFtYSize.Enable(); 2187 aMtrFldYSize.Enable(); 2188 aFlSize.Enable(); 2189 aCtlPosition.Enable(); 2190 aFtXOffset.Enable(); 2191 aMtrFldXOffset.Enable(); 2192 aFtYOffset.Enable(); 2193 aMtrFldYOffset.Enable(); 2194 aFlPosition.Enable(); 2195 aRbtRow.Enable(); 2196 aRbtColumn.Enable(); 2197 aMtrFldOffset.Enable(); 2198 aFlOffset.Enable(); 2199 2200 // Controls for Hatch-Background 2201 aCbxHatchBckgrd.Hide(); 2202 aLbHatchBckgrdColor.Hide(); 2203 2204 aTsbTile.Show(); 2205 aTsbStretch.Show(); 2206 aTsbScale.Show(); 2207 aTsbOriginal.Show(); 2208 aFtXSize.Show(); 2209 aMtrFldXSize.Show(); 2210 aFtYSize.Show(); 2211 aMtrFldYSize.Show(); 2212 aFlSize.Show(); 2213 aCtlPosition.Show(); 2214 aFtXOffset.Show(); 2215 aMtrFldXOffset.Show(); 2216 aFtYOffset.Show(); 2217 aMtrFldYOffset.Show(); 2218 aFlPosition.Show(); 2219 aRbtRow.Show(); 2220 //IAccessible2 Implementation 2009----- 2221 //Solution:Check one when initializing. 2222 if(!aRbtRow.IsChecked()&&!aRbtColumn.IsChecked()) 2223 aRbtRow.Check(); 2224 //-----IAccessible2 Implementation 2009 2225 aRbtColumn.Show(); 2226 aMtrFldOffset.Show(); 2227 aFlOffset.Show(); 2228 2229 // Text der Tabelle setzen 2230 String aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); 2231 INetURLObject aURL( pBitmapList->GetPath() ); 2232 2233 aURL.Append( pBitmapList->GetName() ); 2234 DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); 2235 2236 if( aURL.getBase().getLength() > 18 ) 2237 { 2238 aString += String(aURL.getBase()).Copy( 0, 15 ); 2239 aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); 2240 } 2241 else 2242 aString += String(aURL.getBase()); 2243 2244 ModifyBitmapHdl_Impl( this ); 2245 ModifyTileHdl_Impl( &aTsbOriginal ); 2246 return( 0L ); 2247 } 2248 2249 //------------------------------------------------------------------------ 2250 2251 IMPL_LINK( SvxAreaTabPage, ModifyBitmapHdl_Impl, void *, EMPTYARG ) 2252 { 2253 const SfxPoolItem* pPoolItem = NULL; 2254 sal_uInt16 _nPos = aLbBitmap.GetSelectEntryPos(); 2255 if( _nPos != LISTBOX_ENTRY_NOTFOUND ) 2256 { 2257 // ItemSet fuellen und an aCtlXRectPreview weiterleiten 2258 const XBitmapEntry* pEntry = pBitmapList->GetBitmap(_nPos); 2259 2260 rXFSet.Put(XFillStyleItem(XFILL_BITMAP)); 2261 rXFSet.Put(XFillBitmapItem(String(), pEntry->GetGraphicObject())); 2262 } 2263 // NEU 2264 else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), sal_True, &pPoolItem ) ) 2265 { 2266 rXFSet.Put(XFillStyleItem(XFILL_BITMAP)); 2267 rXFSet.Put(XFillBitmapItem(String(), ((const XFillBitmapItem*)pPoolItem)->GetGraphicObject())); 2268 } 2269 else 2270 rXFSet.Put( XFillStyleItem( XFILL_NONE ) ); 2271 2272 aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); 2273 aCtlBitmapPreview.Invalidate(); 2274 2275 return( 0L ); 2276 } 2277 2278 //------------------------------------------------------------------------ 2279 2280 //IMPL_LINK( SvxAreaTabPage, ModifyTransparentHdl_Impl, void *, EMPTYARG ) 2281 //{ 2282 // sal_uInt16 nPos = aLbTransparent.GetSelectEntryPos(); 2283 // if( nPos != LISTBOX_ENTRY_NOTFOUND ) 2284 // { 2285 // XFillTransparenceItem aItem( nPos * 25 ); 2286 // 2287 // rXFSet.Put( XFillTransparenceItem( aItem ) ); 2288 // aCtlXRectPreview.SetAttributes( aXFillAttr ); 2289 // 2290 // aCtlXRectPreview.Invalidate(); 2291 // } 2292 // 2293 // return( 0L ); 2294 //} 2295 2296 //------------------------------------------------------------------------ 2297 2298 IMPL_LINK( SvxAreaTabPage, ModifyStepCountHdl_Impl, void *, p ) 2299 { 2300 if( p == &aTsbStepCount ) 2301 { 2302 if( aTsbStepCount.GetState() == STATE_NOCHECK ) 2303 { 2304 if( aNumFldStepCount.GetText().Len() == 0 ) 2305 aNumFldStepCount.SetText( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "64") )); 2306 2307 aNumFldStepCount.Enable(); 2308 } 2309 else 2310 aNumFldStepCount.Disable(); 2311 } 2312 2313 sal_uInt16 nValue = 0; 2314 if( aTsbStepCount.GetState() != STATE_CHECK ) 2315 { 2316 // Zustand != Disabled ? 2317 if( aNumFldStepCount.GetText().Len() > 0 ) 2318 nValue = (sal_uInt16) aNumFldStepCount.GetValue(); 2319 } 2320 rXFSet.Put( XGradientStepCountItem( nValue ) ); 2321 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() ); 2322 aCtlXRectPreview.Invalidate(); 2323 2324 return( 0L ); 2325 } 2326 2327 //------------------------------------------------------------------------ 2328 2329 IMPL_LINK( SvxAreaTabPage, ModifyTileHdl_Impl, void *, EMPTYARG ) 2330 { 2331 TriState eState = aTsbTile.GetState(); 2332 if( eState == STATE_CHECK ) 2333 { 2334 aTsbStretch.Disable(); 2335 aRbtRow.Enable(); 2336 aRbtColumn.Enable(); 2337 aMtrFldOffset.Enable(); 2338 aFlOffset.Enable(); 2339 2340 aCtlPosition.Enable(); 2341 aCtlPosition.Invalidate(); 2342 aFtXOffset.Enable(); 2343 aMtrFldXOffset.Enable(); 2344 aFtYOffset.Enable(); 2345 aMtrFldYOffset.Enable(); 2346 aFlPosition.Enable(); 2347 2348 aTsbScale.Enable(); 2349 aTsbOriginal.Enable(); 2350 aFtXSize.Enable(); 2351 aMtrFldXSize.Enable(); 2352 aFtYSize.Enable(); 2353 aMtrFldYSize.Enable(); 2354 aFlSize.Enable(); 2355 } 2356 else if( eState == STATE_NOCHECK ) 2357 { 2358 aTsbStretch.Enable(); 2359 aRbtRow.Disable(); 2360 aRbtColumn.Disable(); 2361 aMtrFldOffset.Disable(); 2362 aFlOffset.Disable(); 2363 2364 aCtlPosition.Disable(); 2365 aCtlPosition.Invalidate(); 2366 aFtXOffset.Disable(); 2367 aMtrFldXOffset.Disable(); 2368 aFtYOffset.Disable(); 2369 aMtrFldYOffset.Disable(); 2370 aFlPosition.Disable(); 2371 2372 if( aTsbStretch.GetState() != STATE_NOCHECK ) 2373 { 2374 aTsbScale.Disable(); 2375 aTsbOriginal.Disable(); 2376 aFtXSize.Disable(); 2377 aMtrFldXSize.Disable(); 2378 aFtYSize.Disable(); 2379 aMtrFldYSize.Disable(); 2380 aFlSize.Disable(); 2381 } 2382 else 2383 { 2384 aTsbScale.Enable(); 2385 aTsbOriginal.Enable(); 2386 aFtXSize.Enable(); 2387 aMtrFldXSize.Enable(); 2388 aFtYSize.Enable(); 2389 aMtrFldYSize.Enable(); 2390 aFlSize.Enable(); 2391 } 2392 } 2393 else 2394 { 2395 aTsbStretch.Disable(); 2396 aRbtRow.Disable(); 2397 aRbtColumn.Disable(); 2398 aMtrFldOffset.Disable(); 2399 aFlOffset.Disable(); 2400 2401 aCtlPosition.Disable(); 2402 aCtlPosition.Invalidate(); 2403 aFtXOffset.Disable(); 2404 aMtrFldXOffset.Disable(); 2405 aFtYOffset.Disable(); 2406 aMtrFldYOffset.Disable(); 2407 aFlPosition.Disable(); 2408 2409 aTsbScale.Disable(); 2410 aTsbOriginal.Disable(); 2411 aFtXSize.Disable(); 2412 aMtrFldXSize.Disable(); 2413 aFtYSize.Disable(); 2414 aMtrFldYSize.Disable(); 2415 aFlSize.Disable(); 2416 } 2417 2418 if( aTsbOriginal.GetState() == STATE_CHECK ) 2419 { 2420 aMtrFldXSize.SetText( String() ); 2421 aMtrFldYSize.SetText( String() ); 2422 aFtXSize.Disable(); 2423 aFtYSize.Disable(); 2424 aMtrFldXSize.Disable(); 2425 aMtrFldYSize.Disable(); 2426 aTsbScale.Disable(); 2427 } 2428 else 2429 { 2430 aMtrFldXSize.SetValue( aMtrFldXSize.GetValue() ); 2431 aMtrFldYSize.SetValue( aMtrFldYSize.GetValue() ); 2432 /* 2433 if( eState == STATE_CHECK ) 2434 { 2435 aFtXSize.Enable(); 2436 aFtYSize.Enable(); 2437 aMtrFldXSize.Enable(); 2438 aMtrFldYSize.Enable(); 2439 } 2440 */ 2441 } 2442 2443 rXFSet.Put( XFillBmpTileItem( sal::static_int_cast< sal_Bool >( eState ) ) ); 2444 2445 if( aTsbStretch.IsEnabled() ) 2446 rXFSet.Put( 2447 XFillBmpStretchItem( 2448 sal::static_int_cast< sal_Bool >( aTsbStretch.GetState() ) ) ); 2449 2450 if( aTsbScale.IsEnabled() ) 2451 rXFSet.Put( XFillBmpSizeLogItem( aTsbScale.GetState() == STATE_NOCHECK ) ); 2452 2453 if( aMtrFldXSize.IsEnabled() ) 2454 { 2455 XFillBmpSizeXItem* pItem = NULL; 2456 TriState eScaleState = aTsbScale.GetState(); 2457 2458 if( eScaleState == STATE_NOCHECK ) 2459 pItem = new XFillBmpSizeXItem( GetCoreValue( aMtrFldXSize, ePoolUnit ) ); 2460 else 2461 pItem = new XFillBmpSizeXItem( -labs( static_cast<long>(aMtrFldXSize.GetValue()) ) ); 2462 2463 rXFSet.Put( *pItem ); 2464 2465 delete pItem; 2466 } 2467 else if( aTsbOriginal.IsEnabled() && aTsbOriginal.GetState() == STATE_CHECK ) 2468 { 2469 // Originalgroesse -> Size == 0 2470 rXFSet.Put( XFillBmpSizeXItem( 0 ) ); 2471 rXFSet.Put( XFillBmpSizeLogItem( sal_True ) ); 2472 } 2473 2474 if( aMtrFldYSize.IsEnabled() ) 2475 { 2476 XFillBmpSizeYItem* pItem = NULL; 2477 TriState eScaleState = aTsbScale.GetState(); 2478 2479 if( eScaleState == STATE_NOCHECK ) 2480 pItem = new XFillBmpSizeYItem( GetCoreValue( aMtrFldYSize, ePoolUnit ) ); 2481 else 2482 pItem = new XFillBmpSizeYItem( -labs( static_cast<long>(aMtrFldYSize.GetValue()) ) ); 2483 2484 rXFSet.Put( *pItem ); 2485 2486 delete pItem; 2487 } 2488 else if( aTsbOriginal.IsEnabled() && aTsbOriginal.GetState() == STATE_CHECK ) 2489 { 2490 // Originalgroesse -> Size == 0 2491 rXFSet.Put( XFillBmpSizeYItem( 0 ) ); 2492 rXFSet.Put( XFillBmpSizeLogItem( sal_True ) ); 2493 } 2494 2495 if( aMtrFldOffset.IsEnabled() ) 2496 { 2497 if( aRbtRow.IsChecked() ) 2498 { 2499 rXFSet.Put( XFillBmpTileOffsetXItem( (sal_uInt16) aMtrFldOffset.GetValue() ) ); 2500 rXFSet.Put( XFillBmpTileOffsetYItem( (sal_uInt16) 0 ) ); 2501 } 2502 else if( aRbtColumn.IsChecked() ) 2503 { 2504 rXFSet.Put( XFillBmpTileOffsetXItem( (sal_uInt16) 0 ) ); 2505 rXFSet.Put( XFillBmpTileOffsetYItem( (sal_uInt16) aMtrFldOffset.GetValue() ) ); 2506 } 2507 } 2508 2509 if( aCtlPosition.IsEnabled() ) 2510 rXFSet.Put( XFillBmpPosItem( aCtlPosition.GetActualRP() ) ); 2511 2512 if( aMtrFldXOffset.IsEnabled() ) 2513 rXFSet.Put( XFillBmpPosOffsetXItem( (sal_uInt16) aMtrFldXOffset.GetValue() ) ); 2514 2515 if( aMtrFldYOffset.IsEnabled() ) 2516 rXFSet.Put( XFillBmpPosOffsetYItem( (sal_uInt16) aMtrFldYOffset.GetValue() ) ); 2517 2518 2519 aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() ); 2520 aCtlBitmapPreview.Invalidate(); 2521 2522 return( 0L ); 2523 } 2524 2525 //------------------------------------------------------------------------ 2526 2527 IMPL_LINK( SvxAreaTabPage, ClickScaleHdl_Impl, void *, EMPTYARG ) 2528 { 2529 if( aTsbScale.GetState() == STATE_CHECK ) 2530 { 2531 aMtrFldXSize.SetDecimalDigits( 0 ); 2532 aMtrFldXSize.SetUnit( FUNIT_CUSTOM ); 2533 aMtrFldXSize.SetValue( 100 ); 2534 aMtrFldXSize.SetMax( 100 ); 2535 aMtrFldXSize.SetLast( 100 ); 2536 2537 aMtrFldYSize.SetDecimalDigits( 0 ); 2538 aMtrFldYSize.SetUnit( FUNIT_CUSTOM ); 2539 aMtrFldYSize.SetValue( 100 ); 2540 aMtrFldYSize.SetMax( 100 ); 2541 aMtrFldYSize.SetLast( 100 ); 2542 } 2543 else 2544 { 2545 aMtrFldXSize.SetDecimalDigits( 2 ); 2546 aMtrFldXSize.SetUnit( eFUnit ); 2547 aMtrFldXSize.SetValue( 100 ); 2548 aMtrFldXSize.SetMax( 999900 ); 2549 aMtrFldXSize.SetLast( 100000 ); 2550 2551 aMtrFldYSize.SetDecimalDigits( 2 ); 2552 aMtrFldYSize.SetUnit( eFUnit ); 2553 aMtrFldYSize.SetValue( 100 ); 2554 aMtrFldYSize.SetMax( 999900 ); 2555 aMtrFldYSize.SetLast( 100000 ); 2556 } 2557 2558 ModifyTileHdl_Impl( NULL ); 2559 2560 return( 0L ); 2561 } 2562 2563 //------------------------------------------------------------------------ 2564 2565 void SvxAreaTabPage::PointChanged( Window* pWindow, RECT_POINT eRcPt ) 2566 { 2567 eRP = eRcPt; 2568 2569 // Ausrichtung der Bitmapfuellung 2570 ModifyTileHdl_Impl( pWindow ); 2571 } 2572 2573 void SvxAreaTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001 2574 { 2575 SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False); 2576 SFX_ITEMSET_ARG (&aSet,pGradientListItem,SvxGradientListItem,SID_GRADIENT_LIST,sal_False); 2577 SFX_ITEMSET_ARG (&aSet,pHatchingListItem,SvxHatchListItem,SID_HATCH_LIST,sal_False); 2578 SFX_ITEMSET_ARG (&aSet,pBitmapListItem,SvxBitmapListItem,SID_BITMAP_LIST,sal_False); 2579 SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); 2580 SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False); 2581 SFX_ITEMSET_ARG (&aSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,sal_False); 2582 2583 if (pColorTabItem) 2584 SetColorTable(pColorTabItem->GetColorTable()); 2585 if (pGradientListItem) 2586 SetGradientList(pGradientListItem->GetGradientList()); 2587 if (pHatchingListItem) 2588 SetHatchingList(pHatchingListItem->GetHatchList()); 2589 if (pBitmapListItem) 2590 SetBitmapList(pBitmapListItem->GetBitmapList()); 2591 if (pPageTypeItem) 2592 SetPageType(pPageTypeItem->GetValue()); 2593 if (pDlgTypeItem) 2594 SetDlgType(pDlgTypeItem->GetValue()); 2595 if (pPosItem) 2596 SetPos(pPosItem->GetValue()); 2597 Construct(); 2598 } 2599 2600