update dev300-m58
[ooovba.git] / svx / source / cui / tparea.cxx
blob961c878df2686256414e4c570ab195232284ed95
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tparea.cxx,v $
10 * $Revision: 1.31 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #ifdef SVX_DLLIMPLEMENTATION
35 #undef SVX_DLLIMPLEMENTATION
36 #endif
38 // include ---------------------------------------------------------------
39 #include <tools/shl.hxx>
40 #include <tools/urlobj.hxx>
41 #include <sfx2/app.hxx>
42 #include <sfx2/module.hxx>
44 #define _SVX_TPAREA_CXX
46 #if defined (UNX) || defined (WTC) || defined (ICC) || defined(WNT)
47 #include <stdlib.h>
48 #endif
50 #include "xattr.hxx"
51 #include <svx/xpool.hxx>
52 #include <svx/dialogs.hrc>
53 #include "tabarea.hrc"
54 #include "dlgname.hrc"
55 #include <svx/xflbckit.hxx>
56 #include <svx/svdattr.hxx>
57 #include <svx/xtable.hxx>
58 #include <svx/xlineit0.hxx>
59 #include "drawitem.hxx"
60 #include "cuitabarea.hxx"
61 #include "dlgname.hxx"
62 #include <svx/dialmgr.hxx>
63 #include "dlgutil.hxx"
64 #include <svtools/intitem.hxx> //add CHINA001
65 #include <sfx2/request.hxx>//add CHINA001
67 #define DLGWIN this->GetParent()->GetParent()
69 // static ----------------------------------------------------------------
71 static USHORT pAreaRanges[] =
73 XATTR_GRADIENTSTEPCOUNT,
74 XATTR_GRADIENTSTEPCOUNT,
75 SID_ATTR_FILL_STYLE,
76 SID_ATTR_FILL_BITMAP,
80 static USHORT pTransparenceRanges[] =
82 XATTR_FILLTRANSPARENCE,
83 XATTR_FILLTRANSPARENCE,
84 SDRATTR_SHADOWTRANSPARENCE,
85 SDRATTR_SHADOWTRANSPARENCE,
86 XATTR_FILLFLOATTRANSPARENCE,
87 XATTR_FILLFLOATTRANSPARENCE,
91 /*************************************************************************
93 |* Dialog for transparence
95 \************************************************************************/
97 IMPL_LINK(SvxTransparenceTabPage, ClickTransOffHdl_Impl, void *, EMPTYARG)
99 // disable all other controls
100 ActivateLinear(FALSE);
101 ActivateGradient(FALSE);
103 // Preview
104 rXFSet.ClearItem (XATTR_FILLTRANSPARENCE);
105 rXFSet.ClearItem (XATTR_FILLFLOATTRANSPARENCE);
106 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
107 aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() );
109 InvalidatePreview( FALSE );
111 return( 0L );
114 IMPL_LINK(SvxTransparenceTabPage, ClickTransLinearHdl_Impl, void *, EMPTYARG)
116 // enable linear, disable other
117 ActivateLinear(TRUE);
118 ActivateGradient(FALSE);
120 // preview
121 rXFSet.ClearItem (XATTR_FILLFLOATTRANSPARENCE);
122 ModifyTransparentHdl_Impl (NULL);
124 return( 0L );
127 IMPL_LINK(SvxTransparenceTabPage, ClickTransGradientHdl_Impl, void *, EMPTYARG)
129 // enable gradient, disable other
130 ActivateLinear(FALSE);
131 ActivateGradient(TRUE);
133 // preview
134 rXFSet.ClearItem (XATTR_FILLTRANSPARENCE);
135 ModifiedTrgrHdl_Impl (NULL);
137 return( 0L );
140 void SvxTransparenceTabPage::ActivateLinear(BOOL bActivate)
142 aMtrTransparent.Enable(bActivate);
145 IMPL_LINK(SvxTransparenceTabPage, ModifyTransparentHdl_Impl, void*, EMPTYARG)
147 UINT16 nPos = (UINT16)aMtrTransparent.GetValue();
148 XFillTransparenceItem aItem(nPos);
149 rXFSet.Put(XFillTransparenceItem(aItem));
151 // preview
152 InvalidatePreview();
154 return 0L;
157 IMPL_LINK(SvxTransparenceTabPage, ModifiedTrgrHdl_Impl, void *, pControl)
159 if(pControl == &aLbTrgrGradientType || pControl == this)
161 XGradientStyle eXGS = (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos();
162 SetControlState_Impl( eXGS );
165 // preview
166 UINT8 nStartCol = (UINT8)(((UINT16)aMtrTrgrStartValue.GetValue() * 255) / 100);
167 UINT8 nEndCol = (UINT8)(((UINT16)aMtrTrgrEndValue.GetValue() * 255) / 100);
168 XGradient aTmpGradient(
169 Color(nStartCol, nStartCol, nStartCol),
170 Color(nEndCol, nEndCol, nEndCol),
171 (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos(),
172 (UINT16)aMtrTrgrAngle.GetValue() * 10,
173 (UINT16)aMtrTrgrCenterX.GetValue(),
174 (UINT16)aMtrTrgrCenterY.GetValue(),
175 (UINT16)aMtrTrgrBorder.GetValue(),
176 100, 100);
178 String aString;
179 XFillFloatTransparenceItem aItem( rXFSet.GetPool()/*aString*/, aTmpGradient);
180 rXFSet.Put ( aItem );
182 InvalidatePreview();
184 return( 0L );
187 void SvxTransparenceTabPage::ActivateGradient(BOOL bActivate)
189 aFtTrgrType.Enable(bActivate);
190 aLbTrgrGradientType.Enable(bActivate);
191 aFtTrgrCenterX.Enable(bActivate);
192 aMtrTrgrCenterX.Enable(bActivate);
193 aFtTrgrCenterY.Enable(bActivate);
194 aMtrTrgrCenterY.Enable(bActivate);
195 aFtTrgrAngle.Enable(bActivate);
196 aMtrTrgrAngle.Enable(bActivate);
197 aFtTrgrBorder.Enable(bActivate);
198 aMtrTrgrBorder.Enable(bActivate);
199 aFtTrgrStartValue.Enable(bActivate);
200 aMtrTrgrStartValue.Enable(bActivate);
201 aFtTrgrEndValue.Enable(bActivate);
202 aMtrTrgrEndValue.Enable(bActivate);
204 if(bActivate)
206 XGradientStyle eXGS = (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos();
207 SetControlState_Impl( eXGS );
211 IMPL_LINK(SvxTransparenceTabPage, ChangeTrgrTypeHdl_Impl, void *, EMPTYARG)
213 return( 0L );
216 void SvxTransparenceTabPage::SetControlState_Impl(XGradientStyle eXGS)
218 switch(eXGS)
220 case XGRAD_LINEAR:
221 case XGRAD_AXIAL:
222 aFtTrgrCenterX.Disable();
223 aMtrTrgrCenterX.Disable();
224 aFtTrgrCenterY.Disable();
225 aMtrTrgrCenterY.Disable();
226 aFtTrgrAngle.Enable();
227 aMtrTrgrAngle.Enable();
228 break;
230 case XGRAD_RADIAL:
231 aFtTrgrCenterX.Enable();
232 aMtrTrgrCenterX.Enable();
233 aFtTrgrCenterY.Enable();
234 aMtrTrgrCenterY.Enable();
235 aFtTrgrAngle.Disable();
236 aMtrTrgrAngle.Disable();
237 break;
239 case XGRAD_ELLIPTICAL:
240 aFtTrgrCenterX.Enable();
241 aMtrTrgrCenterX.Enable();
242 aFtTrgrCenterY.Enable();
243 aMtrTrgrCenterY.Enable();
244 aFtTrgrAngle.Enable();
245 aMtrTrgrAngle.Enable();
246 break;
248 case XGRAD_SQUARE:
249 case XGRAD_RECT:
250 aFtTrgrCenterX.Enable();
251 aMtrTrgrCenterX.Enable();
252 aFtTrgrCenterY.Enable();
253 aMtrTrgrCenterY.Enable();
254 aFtTrgrAngle.Enable();
255 aMtrTrgrAngle.Enable();
256 break;
260 SvxTransparenceTabPage::SvxTransparenceTabPage(Window* pParent, const SfxItemSet& rInAttrs)
261 : SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_TRANSPARENCE ), rInAttrs),
262 rOutAttrs ( rInAttrs ),
263 nPageType(0),
264 nDlgType(0),
266 aFlProp ( this, SVX_RES( FL_PROP ) ),
267 aRbtTransOff ( this, SVX_RES( RBT_TRANS_OFF ) ),
268 aRbtTransLinear ( this, SVX_RES( RBT_TRANS_LINEAR ) ),
269 aRbtTransGradient ( this, SVX_RES( RBT_TRANS_GRADIENT ) ),
271 aMtrTransparent ( this, SVX_RES( MTR_TRANSPARENT ) ),
273 aFtTrgrType ( this, SVX_RES( FT_TRGR_TYPE ) ),
274 aLbTrgrGradientType ( this, SVX_RES( LB_TRGR_GRADIENT_TYPES ) ),
275 aFtTrgrCenterX ( this, SVX_RES( FT_TRGR_CENTER_X ) ),
276 aMtrTrgrCenterX ( this, SVX_RES( MTR_TRGR_CENTER_X ) ),
277 aFtTrgrCenterY ( this, SVX_RES( FT_TRGR_CENTER_Y ) ),
278 aMtrTrgrCenterY ( this, SVX_RES( MTR_TRGR_CENTER_Y ) ),
279 aFtTrgrAngle ( this, SVX_RES( FT_TRGR_ANGLE ) ),
280 aMtrTrgrAngle ( this, SVX_RES( MTR_TRGR_ANGLE ) ),
281 aFtTrgrBorder ( this, SVX_RES( FT_TRGR_BORDER ) ),
282 aMtrTrgrBorder ( this, SVX_RES( MTR_TRGR_BORDER ) ),
283 aFtTrgrStartValue ( this, SVX_RES( FT_TRGR_START_VALUE ) ),
284 aMtrTrgrStartValue ( this, SVX_RES( MTR_TRGR_START_VALUE ) ),
285 aFtTrgrEndValue ( this, SVX_RES( FT_TRGR_END_VALUE ) ),
286 aMtrTrgrEndValue ( this, SVX_RES( MTR_TRGR_END_VALUE ) ),
288 aCtlBitmapPreview ( this, SVX_RES( CTL_BITMAP_PREVIEW ) ),
289 aCtlXRectPreview ( this, SVX_RES( CTL_TRANS_PREVIEW ) ),
290 bBitmap ( FALSE ),
291 pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ),
292 aXFillAttr ( pXPool ),
293 rXFSet ( aXFillAttr.GetItemSet() )
295 FreeResource();
297 // main selection
298 aRbtTransOff.SetClickHdl(LINK(this, SvxTransparenceTabPage, ClickTransOffHdl_Impl));
299 aRbtTransLinear.SetClickHdl(LINK(this, SvxTransparenceTabPage, ClickTransLinearHdl_Impl));
300 aRbtTransGradient.SetClickHdl(LINK(this, SvxTransparenceTabPage, ClickTransGradientHdl_Impl));
302 // linear transparency
303 aMtrTransparent.SetValue( 50 );
304 aMtrTransparent.SetModifyHdl(LINK(this, SvxTransparenceTabPage, ModifyTransparentHdl_Impl));
306 // gradient transparency
307 aMtrTrgrEndValue.SetValue( 100 );
308 aMtrTrgrStartValue.SetValue( 0 );
309 aLbTrgrGradientType.SetSelectHdl(LINK(this, SvxTransparenceTabPage, ChangeTrgrTypeHdl_Impl));
310 Link aLink = LINK( this, SvxTransparenceTabPage, ModifiedTrgrHdl_Impl);
311 aLbTrgrGradientType.SetSelectHdl( aLink );
312 aMtrTrgrCenterX.SetModifyHdl( aLink );
313 aMtrTrgrCenterY.SetModifyHdl( aLink );
314 aMtrTrgrAngle.SetModifyHdl( aLink );
315 aMtrTrgrBorder.SetModifyHdl( aLink );
316 aMtrTrgrStartValue.SetModifyHdl( aLink );
317 aMtrTrgrEndValue.SetModifyHdl( aLink );
319 // this page needs ExchangeSupport
320 SetExchangeSupport();
323 void SvxTransparenceTabPage::Construct()
327 SfxTabPage* SvxTransparenceTabPage::Create(Window* pWindow, const SfxItemSet& rAttrs)
329 return(new SvxTransparenceTabPage(pWindow, rAttrs));
332 UINT16* SvxTransparenceTabPage::GetRanges()
334 return(pTransparenceRanges);
337 BOOL SvxTransparenceTabPage::FillItemSet(SfxItemSet& rAttrs)
339 const SfxPoolItem* pGradientItem = NULL;
340 const SfxPoolItem* pLinearItem = NULL;
341 SfxItemState eStateGradient(rOutAttrs.GetItemState(XATTR_FILLFLOATTRANSPARENCE, TRUE, &pGradientItem));
342 SfxItemState eStateLinear(rOutAttrs.GetItemState(XATTR_FILLTRANSPARENCE, TRUE, &pLinearItem));
343 BOOL bGradActive = (eStateGradient == SFX_ITEM_SET && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled());
344 BOOL bLinearActive = (eStateLinear == SFX_ITEM_SET && ((XFillTransparenceItem*)pLinearItem)->GetValue() != 0);
346 // #103765#
347 BOOL bGradUsed = (eStateGradient == SFX_ITEM_DONTCARE);
348 BOOL bLinearUsed = (eStateLinear == SFX_ITEM_DONTCARE);
350 BOOL bModified(FALSE);
351 BOOL bSwitchOffLinear(FALSE);
352 BOOL bSwitchOffGradient(FALSE);
354 if(aMtrTransparent.IsEnabled())
356 // linear transparence
357 UINT16 nPos = (UINT16)aMtrTransparent.GetValue();
358 if(nPos != (UINT16)aMtrTransparent.GetSavedValue().ToInt32() || !bLinearActive)
360 XFillTransparenceItem aItem(nPos);
361 SdrShadowTransparenceItem aShadowItem(nPos);
362 const SfxPoolItem* pOld = GetOldItem(rAttrs, XATTR_FILLTRANSPARENCE);
363 if(!pOld || !(*(const XFillTransparenceItem*)pOld == aItem) || !bLinearActive)
365 rAttrs.Put(aItem);
366 rAttrs.Put(aShadowItem);
367 bModified = TRUE;
368 bSwitchOffGradient = TRUE;
372 else if(aLbTrgrGradientType.IsEnabled())
374 // transparence gradient, fill ItemSet from values
375 if(!bGradActive
376 || (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos() != (XGradientStyle)aLbTrgrGradientType.GetSavedValue()
377 || (UINT16)aMtrTrgrAngle.GetValue() != (UINT16)aMtrTrgrAngle.GetSavedValue().ToInt32()
378 || (UINT16)aMtrTrgrCenterX.GetValue() != (UINT16)aMtrTrgrCenterX.GetSavedValue().ToInt32()
379 || (UINT16)aMtrTrgrCenterY.GetValue() != (UINT16)aMtrTrgrCenterY.GetSavedValue().ToInt32()
380 || (UINT16)aMtrTrgrBorder.GetValue() != (UINT16)aMtrTrgrBorder.GetSavedValue().ToInt32()
381 || (UINT16)aMtrTrgrStartValue.GetValue() != (UINT16)aMtrTrgrStartValue.GetSavedValue().ToInt32()
382 || (UINT16)aMtrTrgrEndValue.GetValue() != (UINT16)aMtrTrgrEndValue.GetSavedValue().ToInt32() )
384 UINT8 nStartCol = (UINT8)(((UINT16)aMtrTrgrStartValue.GetValue() * 255) / 100);
385 UINT8 nEndCol = (UINT8)(((UINT16)aMtrTrgrEndValue.GetValue() * 255) / 100);
386 XGradient aTmpGradient(
387 Color(nStartCol, nStartCol, nStartCol),
388 Color(nEndCol, nEndCol, nEndCol),
389 (XGradientStyle)aLbTrgrGradientType.GetSelectEntryPos(),
390 (UINT16)aMtrTrgrAngle.GetValue() * 10,
391 (UINT16)aMtrTrgrCenterX.GetValue(),
392 (UINT16)aMtrTrgrCenterY.GetValue(),
393 (UINT16)aMtrTrgrBorder.GetValue(),
394 100, 100);
396 String aString;
397 XFillFloatTransparenceItem aItem( rXFSet.GetPool()/*aString*/, aTmpGradient);
398 const SfxPoolItem* pOld = GetOldItem(rAttrs, XATTR_FILLFLOATTRANSPARENCE);
400 if(!pOld || !(*(const XFillFloatTransparenceItem*)pOld == aItem) || !bGradActive)
402 rAttrs.Put(aItem);
403 bModified = TRUE;
404 bSwitchOffLinear = TRUE;
408 else
410 // no transparence
411 bSwitchOffGradient = TRUE;
412 bSwitchOffLinear = TRUE;
415 // disable unused XFillFloatTransparenceItem
416 if(bSwitchOffGradient && (bGradActive || bGradUsed))
418 Color aColor(COL_BLACK);
419 XGradient aGrad(aColor, Color(COL_WHITE));
420 aGrad.SetStartIntens(100);
421 aGrad.SetEndIntens(100);
422 String aString;
423 XFillFloatTransparenceItem aItem( rXFSet.GetPool()/*aString*/, aGrad);
424 aItem.SetEnabled(FALSE);
425 rAttrs.Put(aItem);
426 bModified = TRUE;
429 // disable unused XFillFloatTransparenceItem
430 if(bSwitchOffLinear && (bLinearActive || bLinearUsed))
432 XFillTransparenceItem aItem(0);
433 SdrShadowTransparenceItem aShadowItem(0);
434 rAttrs.Put(aItem);
435 rAttrs.Put(aShadowItem);
436 bModified = TRUE;
438 //add CHINA001 begin
439 rAttrs.Put (CntUInt16Item(SID_PAGE_TYPE,nPageType));
440 //add CHINA001 end
441 return bModified;
444 void SvxTransparenceTabPage::Reset(const SfxItemSet& rAttrs)
446 const SfxPoolItem* pGradientItem = NULL;
447 SfxItemState eStateGradient(rAttrs.GetItemState(XATTR_FILLFLOATTRANSPARENCE, TRUE, &pGradientItem));
448 if(!pGradientItem)
449 pGradientItem = &rAttrs.Get(XATTR_FILLFLOATTRANSPARENCE);
450 BOOL bGradActive = (eStateGradient == SFX_ITEM_SET && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled());
452 const SfxPoolItem* pLinearItem = NULL;
453 SfxItemState eStateLinear(rAttrs.GetItemState(XATTR_FILLTRANSPARENCE, TRUE, &pLinearItem));
454 if(!pLinearItem)
455 pLinearItem = &rAttrs.Get(XATTR_FILLTRANSPARENCE);
456 BOOL bLinearActive = (eStateLinear == SFX_ITEM_SET && ((XFillTransparenceItem*)pLinearItem)->GetValue() != 0);
458 // transparence gradient
459 const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue();
460 XGradientStyle eXGS(rGradient.GetGradientStyle());
461 aLbTrgrGradientType.SelectEntryPos(sal::static_int_cast< USHORT >(eXGS));
462 aMtrTrgrAngle.SetValue(rGradient.GetAngle() / 10);
463 aMtrTrgrBorder.SetValue(rGradient.GetBorder());
464 aMtrTrgrCenterX.SetValue(rGradient.GetXOffset());
465 aMtrTrgrCenterY.SetValue(rGradient.GetYOffset());
466 aMtrTrgrStartValue.SetValue((UINT16)((((UINT16)rGradient.GetStartColor().GetRed() + 1) * 100) / 255));
467 aMtrTrgrEndValue.SetValue((UINT16)((((UINT16)rGradient.GetEndColor().GetRed() + 1) * 100) / 255));
469 // linear transparence
470 UINT16 nTransp = ((XFillTransparenceItem*)pLinearItem)->GetValue();
471 aMtrTransparent.SetValue(bLinearActive ? nTransp : 50);
472 ModifyTransparentHdl_Impl(NULL);
474 // select the correct radio button
475 if(bGradActive)
477 // transparence gradient, set controls appropriate to item
478 aRbtTransGradient.Check();
479 ClickTransGradientHdl_Impl(NULL);
481 else if(bLinearActive)
483 // linear transparence
484 aRbtTransLinear.Check();
485 ClickTransLinearHdl_Impl(NULL);
487 else
489 // no transparence
490 aRbtTransOff.Check();
491 ClickTransOffHdl_Impl(NULL);
492 ModifiedTrgrHdl_Impl(NULL);
495 // save values
496 aMtrTransparent.SaveValue();
497 aLbTrgrGradientType.SaveValue();
498 aMtrTrgrCenterX.SaveValue();
499 aMtrTrgrCenterY.SaveValue();
500 aMtrTrgrAngle.SaveValue();
501 aMtrTrgrBorder.SaveValue();
502 aMtrTrgrStartValue.SaveValue();
503 aMtrTrgrEndValue.SaveValue();
505 BOOL bActive = InitPreview ( rAttrs );
506 InvalidatePreview ( bActive );
509 void SvxTransparenceTabPage::ActivatePage(const SfxItemSet& rSet)
511 //add CHINA001 Begin
512 SFX_ITEMSET_ARG (&rSet,pPageTypeItem,CntUInt16Item,SID_PAGE_TYPE,sal_False);
513 if (pPageTypeItem)
514 SetPageType(pPageTypeItem->GetValue());
515 //add CHINA001 end
516 //CHINA001 if(*pDlgType == 0) // Flaechen-Dialog
517 //CHINA001 *pPageType = PT_TRANSPARENCE;
518 if(nDlgType == 0) //add CHINA001 // Flaechen-Dialog
519 nPageType = PT_TRANSPARENCE; //add CHINA001
521 InitPreview ( rSet );
524 int SvxTransparenceTabPage::DeactivatePage(SfxItemSet* _pSet)
526 if( _pSet )
527 FillItemSet( *_pSet );
528 return(LEAVE_PAGE);
531 void SvxTransparenceTabPage::PointChanged(Window* , RECT_POINT eRcPt)
533 eRP = eRcPt;
537 // Preview-Methods
539 BOOL SvxTransparenceTabPage::InitPreview ( const SfxItemSet& rSet )
541 // set transparencetyp for preview
542 if ( aRbtTransOff.IsChecked() )
544 ClickTransOffHdl_Impl(NULL);
545 } else if ( aRbtTransLinear.IsChecked() )
547 ClickTransLinearHdl_Impl(NULL);
548 } else if ( aRbtTransGradient.IsChecked() )
550 ClickTransGradientHdl_Impl(NULL);
553 // Get fillstyle for preview
554 rXFSet.Put ( ( XFillStyleItem& ) rSet.Get(XATTR_FILLSTYLE) );
555 rXFSet.Put ( ( XFillColorItem& ) rSet.Get(XATTR_FILLCOLOR) );
556 rXFSet.Put ( ( XFillGradientItem& ) rSet.Get(XATTR_FILLGRADIENT) );
557 rXFSet.Put ( ( XFillHatchItem& ) rSet.Get(XATTR_FILLHATCH) );
558 rXFSet.Put ( ( XFillBackgroundItem&)rSet.Get(XATTR_FILLBACKGROUND) );
559 rXFSet.Put ( ( XFillBitmapItem& ) rSet.Get(XATTR_FILLBITMAP) );
561 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
562 aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() );
564 bBitmap = ( ( ( XFillStyleItem& )rSet.Get(XATTR_FILLSTYLE) ).GetValue() == XFILL_BITMAP );
566 // show the right preview window
567 if ( bBitmap )
569 aCtlBitmapPreview.Show();
570 aCtlXRectPreview.Hide();
572 else
574 aCtlBitmapPreview.Hide();
575 aCtlXRectPreview.Show();
578 return !aRbtTransOff.IsChecked();
581 void SvxTransparenceTabPage::InvalidatePreview (BOOL bEnable)
583 if ( bBitmap )
585 if ( bEnable )
587 aCtlBitmapPreview.Enable();
588 aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() );
590 else
591 aCtlBitmapPreview.Disable();
592 aCtlBitmapPreview.Invalidate();
594 else
596 if ( bEnable )
598 aCtlXRectPreview.Enable();
599 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
601 else
602 aCtlXRectPreview.Disable();
603 aCtlXRectPreview.Invalidate();
607 void SvxTransparenceTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
609 SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
610 SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False);
612 if (pPageTypeItem)
613 SetPageType(pPageTypeItem->GetValue());
614 if (pDlgTypeItem)
615 SetDlgType(pDlgTypeItem->GetValue());
616 Construct();
618 /*************************************************************************
620 |* Dialog to modify fill-attributes
622 \************************************************************************/
624 SvxAreaTabPage::SvxAreaTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
626 SvxTabPage ( pParent, SVX_RES( RID_SVXPAGE_AREA ), rInAttrs ),
628 aFlProp ( this, SVX_RES( FL_PROP ) ),
629 aTypeLB ( this, SVX_RES( LB_AREA_TYPE ) ),
631 aLbColor ( this, SVX_RES( LB_COLOR ) ),
632 aLbGradient ( this, SVX_RES( LB_GRADIENT ) ),
633 aLbHatching ( this, SVX_RES( LB_HATCHING ) ),
634 aLbBitmap ( this, SVX_RES( LB_BITMAP ) ),
635 aCtlBitmapPreview ( this, SVX_RES( CTL_BITMAP_PREVIEW ) ),
637 aTsbStepCount ( this, SVX_RES( TSB_STEPCOUNT ) ),
638 aFlStepCount ( this, SVX_RES( FL_STEPCOUNT ) ),
639 aNumFldStepCount ( this, SVX_RES( NUM_FLD_STEPCOUNT ) ),
641 aCbxHatchBckgrd ( this, SVX_RES( CB_HATCHBCKGRD ) ),
642 aLbHatchBckgrdColor ( this, SVX_RES( LB_HATCHBCKGRDCOLOR ) ),
644 aFlSize ( this, SVX_RES( FL_SIZE ) ),
645 aTsbOriginal ( this, SVX_RES( TSB_ORIGINAL ) ),
646 aTsbScale ( this, SVX_RES( TSB_SCALE ) ),
647 aFtXSize ( this, SVX_RES( FT_X_SIZE ) ),
648 aMtrFldXSize ( this, SVX_RES( MTR_FLD_X_SIZE ) ),
649 aFtYSize ( this, SVX_RES( FT_Y_SIZE ) ),
650 aMtrFldYSize ( this, SVX_RES( MTR_FLD_Y_SIZE ) ),
651 aFlPosition ( this, SVX_RES( FL_POSITION ) ),
652 aCtlPosition ( this, SVX_RES( CTL_POSITION ), RP_RM, 110, 80, CS_RECT ),
653 aFtXOffset ( this, SVX_RES( FT_X_OFFSET ) ),
654 aMtrFldXOffset ( this, SVX_RES( MTR_FLD_X_OFFSET ) ),
655 aFtYOffset ( this, SVX_RES( FT_Y_OFFSET ) ),
656 aMtrFldYOffset ( this, SVX_RES( MTR_FLD_Y_OFFSET ) ),
657 aTsbTile ( this, SVX_RES( TSB_TILE ) ),
658 aTsbStretch ( this, SVX_RES( TSB_STRETCH ) ),
659 aFlOffset ( this, SVX_RES( FL_OFFSET ) ),
660 aRbtRow ( this, SVX_RES( RBT_ROW ) ),
661 aRbtColumn ( this, SVX_RES( RBT_COLUMN ) ),
662 aMtrFldOffset ( this, SVX_RES( MTR_FLD_OFFSET ) ),
664 aCtlXRectPreview ( this, SVX_RES( CTL_COLOR_PREVIEW ) ),
666 rOutAttrs ( rInAttrs ),
668 pColorTab( NULL ),
669 pGradientList( NULL ),
670 pHatchingList( NULL ),
671 pBitmapList( NULL ),
673 pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ),
674 aXFillAttr ( pXPool ),
675 rXFSet ( aXFillAttr.GetItemSet() )
677 FreeResource();
679 // Gruppen, die sich ueberlagern
680 aLbBitmap.Hide();
681 aCtlBitmapPreview.Hide();
683 aFlStepCount.Hide();
684 aTsbStepCount.Hide();
685 aNumFldStepCount.Hide();
687 aTsbTile.Hide();
688 aTsbStretch.Hide();
689 aTsbScale.Hide();
690 aTsbOriginal.Hide();
691 aFtXSize.Hide();
692 aMtrFldXSize.Hide();
693 aFtYSize.Hide();
694 aMtrFldYSize.Hide();
695 aFlSize.Hide();
696 aRbtRow.Hide();
697 aRbtColumn.Hide();
698 aMtrFldOffset.Hide();
699 aFlOffset.Hide();
700 aCtlPosition.Hide();
701 aFtXOffset.Hide();
702 aMtrFldXOffset.Hide();
703 aFtYOffset.Hide();
704 aMtrFldYOffset.Hide();
705 aFlPosition.Hide();
706 // Controls for Hatch-Background
707 aCbxHatchBckgrd.Hide();
708 aLbHatchBckgrdColor.Hide();
711 aTsbOriginal.EnableTriState( FALSE );
714 // this page needs ExchangeSupport
715 SetExchangeSupport();
717 // set Metrics
718 eFUnit = GetModuleFieldUnit( &rInAttrs );
720 switch ( eFUnit )
722 case FUNIT_M:
723 case FUNIT_KM:
724 eFUnit = FUNIT_MM;
725 break;
726 default: ;//prevent warning
728 SetFieldUnit( aMtrFldXSize, eFUnit, TRUE );
729 SetFieldUnit( aMtrFldYSize, eFUnit, TRUE );
731 // get PoolUnit
732 SfxItemPool* pPool = rOutAttrs.GetPool();
733 DBG_ASSERT( pPool, "Wo ist der Pool?" );
734 ePoolUnit = pPool->GetMetric( XATTR_FILLBMP_SIZEX );
736 // Setzen Output-Devices
737 rXFSet.Put( XFillStyleItem( XFILL_SOLID ) );
738 rXFSet.Put( XFillColorItem( String(), COL_BLACK ) );
739 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
740 aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() );
742 aLbColor.SetSelectHdl( LINK( this, SvxAreaTabPage, ModifyColorHdl_Impl ) );
743 aLbHatchBckgrdColor.SetSelectHdl( LINK( this, SvxAreaTabPage, ModifyHatchBckgrdColorHdl_Impl ) );
744 aCbxHatchBckgrd.SetToggleHdl( LINK( this, SvxAreaTabPage, ToggleHatchBckgrdColorHdl_Impl ) );
746 aLbGradient.SetSelectHdl(
747 LINK( this, SvxAreaTabPage, ModifyGradientHdl_Impl ) );
748 aLbHatching.SetSelectHdl(
749 LINK( this, SvxAreaTabPage, ModifyHatchingHdl_Impl ) );
750 aLbBitmap.SetSelectHdl(
751 LINK( this, SvxAreaTabPage, ModifyBitmapHdl_Impl ) );
753 aTsbStepCount.SetClickHdl(
754 LINK( this, SvxAreaTabPage, ModifyStepCountHdl_Impl ) );
755 aNumFldStepCount.SetModifyHdl(
756 LINK( this, SvxAreaTabPage, ModifyStepCountHdl_Impl ) );
758 Link aLink( LINK( this, SvxAreaTabPage, ModifyTileHdl_Impl ) );
759 aTsbTile.SetClickHdl( aLink );
760 aTsbStretch.SetClickHdl( aLink );
761 aTsbOriginal.SetClickHdl( aLink );
762 aMtrFldXSize.SetModifyHdl( aLink );
763 aMtrFldYSize.SetModifyHdl( aLink );
764 aRbtRow.SetClickHdl( aLink );
765 aRbtColumn.SetClickHdl( aLink );
766 aMtrFldOffset.SetModifyHdl( aLink );
767 aMtrFldXOffset.SetModifyHdl( aLink );
768 aMtrFldYOffset.SetModifyHdl( aLink );
769 aTsbScale.SetClickHdl( LINK( this, SvxAreaTabPage, ClickScaleHdl_Impl ) );
771 aTypeLB.SetSelectHdl( LINK( this, SvxAreaTabPage, SelectDialogTypeHdl_Impl ) );
773 // #i76307# always paint the preview in LTR, because this is what the document does
774 aCtlXRectPreview.EnableRTL(FALSE);
777 // -----------------------------------------------------------------------
779 void SvxAreaTabPage::Construct()
781 // fill colortables / lists
782 aLbColor.Fill( pColorTab );
783 aLbHatchBckgrdColor.Fill ( pColorTab );
785 aLbGradient.Fill( pGradientList );
786 aLbHatching.Fill( pHatchingList );
787 aLbBitmap.Fill( pBitmapList );
790 // -----------------------------------------------------------------------
792 void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet )
794 USHORT _nPos = 0;
795 USHORT nCount;
796 //add CHINA001 Begin
797 SFX_ITEMSET_ARG (&rSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
798 SFX_ITEMSET_ARG (&rSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,sal_False);
799 if (pPageTypeItem)
800 SetPageType(pPageTypeItem->GetValue());
801 if (pPosItem)
802 SetPos(pPosItem->GetValue());
803 //add CHINA001 end
804 if( nDlgType == 0 )//CHINA001 if( *pDlgType == 0 ) // Flaechen-Dialog
806 *pbAreaTP = TRUE;
808 if( pColorTab )
810 // Bitmapliste
811 if( *pnBitmapListState )
813 if( *pnBitmapListState & CT_CHANGED )
814 pBitmapList = ( (SvxAreaTabDialog*) DLGWIN )->
815 GetNewBitmapList();
817 _nPos = aLbBitmap.GetSelectEntryPos();
819 aLbBitmap.Clear();
820 aLbBitmap.Fill( pBitmapList );
821 nCount = aLbBitmap.GetEntryCount();
822 if( nCount == 0 )
823 ; // This case should never occur
824 else if( nCount <= _nPos )
825 aLbBitmap.SelectEntryPos( 0 );
826 else
827 aLbBitmap.SelectEntryPos( _nPos );
828 ModifyBitmapHdl_Impl( this );
830 // hatch-liste
831 if( *pnHatchingListState )
833 if( *pnHatchingListState & CT_CHANGED )
834 pHatchingList = ( (SvxAreaTabDialog*) DLGWIN )->
835 GetNewHatchingList();
837 _nPos = aLbHatching.GetSelectEntryPos();
839 aLbHatching.Clear();
840 aLbHatching.Fill( pHatchingList );
841 nCount = aLbHatching.GetEntryCount();
842 if( nCount == 0 )
843 ; // This case should never occur
844 else if( nCount <= _nPos )
845 aLbHatching.SelectEntryPos( 0 );
846 else
847 aLbHatching.SelectEntryPos( _nPos );
848 ModifyHatchingHdl_Impl( this );
850 ModifyHatchBckgrdColorHdl_Impl( this );
852 // gradient-liste
853 if( *pnGradientListState )
855 if( *pnGradientListState & CT_CHANGED )
856 pGradientList = ( (SvxAreaTabDialog*) DLGWIN )->
857 GetNewGradientList();
859 _nPos = aLbGradient.GetSelectEntryPos();
861 aLbGradient.Clear();
862 aLbGradient.Fill( pGradientList );
863 nCount = aLbGradient.GetEntryCount();
864 if( nCount == 0 )
865 ; // This case should never occur
866 else if( nCount <= _nPos )
867 aLbGradient.SelectEntryPos( 0 );
868 else
869 aLbGradient.SelectEntryPos( _nPos );
870 ModifyGradientHdl_Impl( this );
872 // ColorTable
873 if( *pnColorTableState )
875 if( *pnColorTableState & CT_CHANGED )
876 pColorTab = ( (SvxAreaTabDialog*) DLGWIN )->
877 GetNewColorTable();
878 // aLbColor
879 _nPos = aLbColor.GetSelectEntryPos();
880 aLbColor.Clear();
881 aLbColor.Fill( pColorTab );
882 nCount = aLbColor.GetEntryCount();
883 if( nCount == 0 )
884 ; // This case should never occur
885 else if( nCount <= _nPos )
886 aLbColor.SelectEntryPos( 0 );
887 else
888 aLbColor.SelectEntryPos( _nPos );
890 ModifyColorHdl_Impl( this );
892 // Backgroundcolor of hatch
893 _nPos = aLbHatchBckgrdColor.GetSelectEntryPos();
894 aLbHatchBckgrdColor.Clear();
895 aLbHatchBckgrdColor.Fill( pColorTab );
896 nCount = aLbHatchBckgrdColor.GetEntryCount();
897 if( nCount == 0 )
898 ; // This case should never occur
899 else if( nCount <= _nPos )
900 aLbHatchBckgrdColor.SelectEntryPos( 0 );
901 else
902 aLbHatchBckgrdColor.SelectEntryPos( _nPos );
904 ModifyHatchBckgrdColorHdl_Impl( this );
907 // evaluate if any other Tabpage set another filltype
908 if( aTypeLB.GetSelectEntryPos() > XFILL_NONE)
910 switch( nPageType )//CHINA001 switch( *pPageType )
912 case PT_GRADIENT:
913 aTypeLB.SelectEntryPos( XFILL_GRADIENT );
914 aLbGradient.SelectEntryPos( _nPos );//CHINA001 aLbGradient.SelectEntryPos( *pPos );
915 ClickGradientHdl_Impl( this );
916 break;
918 case PT_HATCH:
919 aTypeLB.SelectEntryPos( XFILL_HATCH );
920 aLbHatching.SelectEntryPos( _nPos );//CHINA001 aLbHatching.SelectEntryPos( *pPos );
921 ClickHatchingHdl_Impl( this );
922 break;
924 case PT_BITMAP:
925 aTypeLB.SelectEntryPos( XFILL_BITMAP );
926 aLbBitmap.SelectEntryPos( _nPos );//CHINA001 aLbBitmap.SelectEntryPos( *pPos );
927 ClickBitmapHdl_Impl( this );
928 break;
930 case PT_COLOR:
931 aTypeLB.SelectEntryPos( XFILL_SOLID );
932 aLbColor.SelectEntryPos( _nPos );//CHINA001 aLbColor.SelectEntryPos( *pPos );
933 aLbHatchBckgrdColor.SelectEntryPos( _nPos ); //CHINA001 aLbHatchBckgrdColor.SelectEntryPos( *pPos );
934 ClickColorHdl_Impl( this );
935 break;
938 nPageType = PT_AREA;//CHINA001 *pPageType = PT_AREA;
943 // -----------------------------------------------------------------------
945 int SvxAreaTabPage::DeactivatePage( SfxItemSet* _pSet )
947 if( nDlgType == 0 ) // Flaechen-Dialog//CHINA001 if( *pDlgType == 0 ) // Flaechen-Dialog
949 XFillStyle eStyle = (XFillStyle) aTypeLB.GetSelectEntryPos();
950 switch( eStyle )
952 case XFILL_GRADIENT:
954 nPageType = PT_GRADIENT;//CHINA001 *pPageType = PT_GRADIENT;
955 nPos = aLbGradient.GetSelectEntryPos();//CHINA001 *pPos = aLbGradient.GetSelectEntryPos();
957 break;
958 case XFILL_HATCH:
960 nPageType = PT_HATCH;//CHINA001 *pPageType = PT_HATCH;
961 nPos = aLbHatching.GetSelectEntryPos();//CHINA001 *pPos = aLbHatching.GetSelectEntryPos();
963 break;
964 case XFILL_BITMAP:
966 nPageType = PT_BITMAP;//CHINA001 *pPageType = PT_BITMAP;
967 nPos = aLbBitmap.GetSelectEntryPos();//CHINA001 *pPos = aLbBitmap.GetSelectEntryPos();
969 break;
970 case XFILL_SOLID:
972 nPageType = PT_COLOR;//CHINA001 *pPageType = PT_COLOR;
973 nPos = aLbColor.GetSelectEntryPos();//CHINA001 *pPos = aLbColor.GetSelectEntryPos();
975 break;
976 default: ;//prevent warning
980 if( _pSet )
981 FillItemSet( *_pSet );
983 return( LEAVE_PAGE );
986 // -----------------------------------------------------------------------
988 BOOL SvxAreaTabPage::FillItemSet( SfxItemSet& rAttrs )
990 const SfxPoolItem* pOld = NULL;
991 USHORT _nPos;
992 BOOL bModified = FALSE;
994 if( nDlgType != 0 || *pbAreaTP )//CHINA001 if( *pDlgType != 0 || *pbAreaTP )
996 XFillStyle eStyle = (XFillStyle) aTypeLB.GetSelectEntryPos();
997 XFillStyle eSavedStyle = (XFillStyle) aTypeLB.GetSavedValue();
998 switch( eStyle )
1000 case XFILL_NONE:
1002 if( eSavedStyle != eStyle )
1004 XFillStyleItem aStyleItem( XFILL_NONE );
1005 pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE );
1006 if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) )
1008 rAttrs.Put( aStyleItem );
1009 bModified = TRUE;
1013 break;
1014 case XFILL_SOLID:
1016 _nPos = aLbColor.GetSelectEntryPos();
1017 if( _nPos != LISTBOX_ENTRY_NOTFOUND &&
1018 _nPos != aLbColor.GetSavedValue() )
1020 XFillColorItem aItem( aLbColor.GetSelectEntry(),
1021 aLbColor.GetSelectEntryColor() );
1022 pOld = GetOldItem( rAttrs, XATTR_FILLCOLOR );
1023 if ( !pOld || !( *(const XFillColorItem*)pOld == aItem ) )
1025 rAttrs.Put( aItem );
1026 bModified = TRUE;
1029 // NEU
1030 if( (eSavedStyle != eStyle) &&
1031 ( bModified ||
1032 SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), TRUE ) ) )
1034 XFillStyleItem aStyleItem( XFILL_SOLID );
1035 pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE );
1036 if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) )
1038 rAttrs.Put( aStyleItem );
1039 bModified = TRUE;
1043 break;
1044 case XFILL_GRADIENT:
1046 _nPos = aLbGradient.GetSelectEntryPos();
1047 if( _nPos != LISTBOX_ENTRY_NOTFOUND &&
1048 _nPos != aLbGradient.GetSavedValue() )
1050 XGradient aGradient = pGradientList->GetGradient( _nPos )->GetGradient();
1051 String aString = aLbGradient.GetSelectEntry();
1052 XFillGradientItem aItem( aString, aGradient );
1053 pOld = GetOldItem( rAttrs, XATTR_FILLGRADIENT );
1054 if ( !pOld || !( *(const XFillGradientItem*)pOld == aItem ) )
1056 rAttrs.Put( aItem );
1057 bModified = TRUE;
1060 // NEU
1061 if( (eSavedStyle != eStyle) &&
1062 ( bModified ||
1063 SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), TRUE ) ) )
1065 XFillStyleItem aStyleItem( XFILL_GRADIENT );
1066 pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE );
1067 if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) )
1069 rAttrs.Put( aStyleItem );
1070 bModified = TRUE;
1074 break;
1075 case XFILL_HATCH:
1077 _nPos = aLbHatching.GetSelectEntryPos();
1078 if( _nPos != LISTBOX_ENTRY_NOTFOUND &&
1079 _nPos != aLbHatching.GetSavedValue() )
1081 XHatch aHatching = pHatchingList->GetHatch( _nPos )->GetHatch();
1082 String aString = aLbHatching.GetSelectEntry();
1083 XFillHatchItem aItem( aString, aHatching );
1084 pOld = GetOldItem( rAttrs, XATTR_FILLHATCH );
1085 if ( !pOld || !( *(const XFillHatchItem*)pOld == aItem ) )
1087 rAttrs.Put( aItem );
1088 bModified = TRUE;
1091 XFillBackgroundItem aItem ( aCbxHatchBckgrd.IsChecked() );
1092 rAttrs.Put( aItem );
1093 nPos = aLbHatchBckgrdColor.GetSelectEntryPos();
1094 if( nPos != LISTBOX_ENTRY_NOTFOUND &&
1095 nPos != aLbHatchBckgrdColor.GetSavedValue() )
1097 XFillColorItem aFillColorItem( aLbHatchBckgrdColor.GetSelectEntry(),
1098 aLbHatchBckgrdColor.GetSelectEntryColor() );
1099 pOld = GetOldItem( rAttrs, XATTR_FILLCOLOR );
1100 if ( !pOld || !( *(const XFillColorItem*)pOld == aFillColorItem ) )
1102 rAttrs.Put( aFillColorItem );
1103 bModified = TRUE;
1106 // NEU
1107 if( (eSavedStyle != eStyle) &&
1108 ( bModified ||
1109 SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), TRUE ) ) )
1111 XFillStyleItem aStyleItem( XFILL_HATCH );
1112 pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE );
1113 if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) )
1115 rAttrs.Put( aStyleItem );
1116 bModified = TRUE;
1120 break;
1121 case XFILL_BITMAP:
1123 nPos = aLbBitmap.GetSelectEntryPos();
1124 if( nPos != LISTBOX_ENTRY_NOTFOUND &&
1125 nPos != aLbBitmap.GetSavedValue() )
1127 XOBitmap aXOBitmap = pBitmapList->GetBitmap( nPos )->GetXBitmap();
1128 String aString = aLbBitmap.GetSelectEntry();
1129 XFillBitmapItem aFillBitmapItem( aString, aXOBitmap );
1130 pOld = GetOldItem( rAttrs, XATTR_FILLBITMAP );
1131 if ( !pOld || !( *(const XFillBitmapItem*)pOld == aFillBitmapItem ) )
1133 rAttrs.Put( aFillBitmapItem );
1134 bModified = TRUE;
1137 // NEU
1138 if( (eSavedStyle != eStyle) &&
1139 ( bModified ||
1140 SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), TRUE ) ) )
1142 XFillStyleItem aStyleItem( XFILL_BITMAP );
1143 pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE );
1144 if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) )
1146 rAttrs.Put( aStyleItem );
1147 bModified = TRUE;
1151 break;
1154 // Schrittweite
1155 if( aTsbStepCount.IsEnabled() )
1157 UINT16 nValue = 0;
1158 BOOL bValueModified = FALSE;
1159 TriState eState = aTsbStepCount.GetState();
1160 if( eState == STATE_CHECK )
1162 if( eState != aTsbStepCount.GetSavedValue() )
1163 bValueModified = TRUE;
1165 else
1167 // Zustand != Disabled ?
1168 if( aNumFldStepCount.GetText().Len() > 0 )
1170 nValue = (UINT16) aNumFldStepCount.GetValue();
1171 if( nValue != (UINT16) aNumFldStepCount.GetSavedValue().ToInt32() )
1172 bValueModified = TRUE;
1175 if( bValueModified )
1177 XGradientStepCountItem aFillBitmapItem( nValue );
1178 pOld = GetOldItem( rAttrs, XATTR_GRADIENTSTEPCOUNT );
1179 if ( !pOld || !( *(const XGradientStepCountItem*)pOld == aFillBitmapItem ) )
1181 rAttrs.Put( aFillBitmapItem );
1182 bModified = TRUE;
1187 // Kacheln
1188 if( aTsbTile.IsEnabled() )
1190 TriState eState = aTsbTile.GetState();
1191 if( eState != aTsbTile.GetSavedValue() )
1193 XFillBmpTileItem aFillBmpTileItem(
1194 sal::static_int_cast< BOOL >( eState ) );
1195 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_TILE );
1196 if ( !pOld || !( *(const XFillBmpTileItem*)pOld == aFillBmpTileItem ) )
1198 rAttrs.Put( aFillBmpTileItem );
1199 bModified = TRUE;
1203 // Stretchen
1204 if( aTsbStretch.IsEnabled() )
1206 TriState eState = aTsbStretch.GetState();
1207 if( eState != aTsbStretch.GetSavedValue() )
1209 XFillBmpStretchItem aFillBmpStretchItem(
1210 sal::static_int_cast< BOOL >( eState ) );
1211 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_STRETCH );
1212 if ( !pOld || !( *(const XFillBmpStretchItem*)pOld == aFillBmpStretchItem ) )
1214 rAttrs.Put( aFillBmpStretchItem );
1215 bModified = TRUE;
1220 // Originalgroesse (im UI) wird wie folgt benutzt:
1221 // Controls sind disabled, muessen aber gesetzt werden.
1222 // SizeX = 0; SizeY = 0; Log = TRUE
1224 //aTsbScale
1225 TriState eState = aTsbScale.GetState();
1226 if( eState != aTsbScale.GetSavedValue() ||
1227 ( !aTsbScale.IsEnabled() &&
1228 aTsbOriginal.IsEnabled() &&
1229 aTsbScale.GetSavedValue() != STATE_CHECK ) )
1231 XFillBmpSizeLogItem* pItem = NULL;
1232 if( aTsbScale.IsEnabled() )
1233 pItem = new XFillBmpSizeLogItem( eState == STATE_NOCHECK );
1234 else if( aTsbOriginal.IsEnabled() && aTsbOriginal.GetState() == STATE_CHECK )
1235 pItem = new XFillBmpSizeLogItem( TRUE );
1237 if( pItem )
1239 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_SIZELOG );
1240 if ( !pOld || !( *(const XFillBmpSizeLogItem*)pOld == *pItem ) )
1242 rAttrs.Put( *pItem );
1243 bModified = TRUE;
1245 delete pItem;
1249 //aMtrFldXSize
1250 String aStr = aMtrFldXSize.GetText();
1252 XFillBmpSizeXItem* pItem = NULL;
1253 TriState eScaleState = aTsbScale.GetState();
1255 if( aMtrFldXSize.IsEnabled() &&
1256 aStr.Len() > 0 &&
1257 aStr != aMtrFldXSize.GetSavedValue() )
1259 if( eScaleState == STATE_NOCHECK )
1260 pItem = new XFillBmpSizeXItem( GetCoreValue( aMtrFldXSize, ePoolUnit ) );
1261 else
1263 // Prozentwerte werden negativ gesetzt, damit
1264 // diese nicht skaliert werden; dieses wird
1265 // im Item beruecksichtigt ( KA05.11.96 )
1266 pItem = new XFillBmpSizeXItem( -labs( static_cast<long>(aMtrFldXSize.GetValue()) ) );
1269 else if( aTsbOriginal.IsEnabled() &&
1270 aTsbOriginal.GetState() == STATE_CHECK &&
1271 aMtrFldXSize.GetSavedValue().Len() > 0 )
1272 pItem = new XFillBmpSizeXItem( 0 );
1274 if( pItem )
1276 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_SIZEX );
1277 if ( !pOld || !( *(const XFillBmpSizeXItem*)pOld == *pItem ) )
1279 rAttrs.Put( *pItem );
1280 bModified = TRUE;
1282 delete pItem;
1286 //aMtrFldYSize
1287 aStr = aMtrFldYSize.GetText();
1289 XFillBmpSizeYItem* pItem = NULL;
1290 TriState eScaleState = aTsbScale.GetState();
1292 if( aMtrFldYSize.IsEnabled() &&
1293 aStr.Len() > 0 &&
1294 aStr != aMtrFldYSize.GetSavedValue() )
1296 if( eScaleState == STATE_NOCHECK )
1297 pItem = new XFillBmpSizeYItem( GetCoreValue( aMtrFldYSize, ePoolUnit ) );
1298 else
1300 // Prozentwerte werden negativ gesetzt, damit
1301 // diese vom MetricItem nicht skaliert werden;
1302 // dieses wird im Item beruecksichtigt ( KA05.11.96 )
1303 pItem = new XFillBmpSizeYItem( -labs( static_cast<long>(aMtrFldYSize.GetValue()) ) );
1306 else if( aTsbOriginal.IsEnabled() &&
1307 aTsbOriginal.GetState() == STATE_CHECK &&
1308 aMtrFldYSize.GetSavedValue().Len() > 0 )
1309 pItem = new XFillBmpSizeYItem( 0 );
1311 if( pItem )
1313 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_SIZEY );
1314 if ( !pOld || !( *(const XFillBmpSizeYItem*)pOld == *pItem ) )
1316 rAttrs.Put( *pItem );
1317 bModified = TRUE;
1319 delete pItem;
1323 //aRbtRow
1324 //aRbtColumn
1325 //aMtrFldOffset
1326 if( aMtrFldOffset.IsEnabled() )
1328 String aMtrString = aMtrFldOffset.GetText();
1329 if( ( aMtrString.Len() > 0 &&
1330 aMtrString != aMtrFldOffset.GetSavedValue() ) ||
1331 aRbtRow.GetSavedValue() != aRbtRow.IsChecked() ||
1332 aRbtColumn.GetSavedValue() != aRbtColumn.IsChecked() )
1334 if( aRbtRow.IsChecked() )
1336 XFillBmpTileOffsetXItem aFillBmpTileOffsetXItem( (UINT16) aMtrFldOffset.GetValue() );
1337 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_TILEOFFSETX );
1338 if ( !pOld || !( *(const XFillBmpTileOffsetXItem*)pOld == aFillBmpTileOffsetXItem ) )
1340 rAttrs.Put( aFillBmpTileOffsetXItem );
1341 rAttrs.Put( XFillBmpTileOffsetYItem( 0 ) );
1342 bModified = TRUE;
1345 else if( aRbtColumn.IsChecked() )
1347 XFillBmpTileOffsetYItem aFillBmpTileOffsetYItem( (UINT16) aMtrFldOffset.GetValue() );
1348 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_TILEOFFSETY );
1349 if ( !pOld || !( *(const XFillBmpTileOffsetYItem*)pOld == aFillBmpTileOffsetYItem ) )
1351 rAttrs.Put( aFillBmpTileOffsetYItem );
1352 rAttrs.Put( XFillBmpTileOffsetXItem( 0 ) );
1353 bModified = TRUE;
1359 //aCtlPosition
1360 if( aCtlPosition.IsEnabled() )
1362 BOOL bPut = FALSE;
1363 RECT_POINT _eRP = aCtlPosition.GetActualRP();
1365 if( SFX_ITEM_DONTCARE == rOutAttrs.GetItemState( XATTR_FILLBMP_POS ) )
1366 bPut = TRUE;
1367 else
1369 RECT_POINT eValue = ( ( const XFillBmpPosItem& ) rOutAttrs.Get( XATTR_FILLBMP_POS ) ).GetValue();
1370 if( eValue != _eRP )
1371 bPut = TRUE;
1373 if( bPut )
1375 XFillBmpPosItem aFillBmpPosItem( _eRP );
1376 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_POS );
1377 if ( !pOld || !( *(const XFillBmpPosItem*)pOld == aFillBmpPosItem ) )
1379 rAttrs.Put( aFillBmpPosItem );
1380 bModified = TRUE;
1385 //aMtrFldXOffset
1386 if( aMtrFldXOffset.IsEnabled() )
1388 String sMtrXOffset = aMtrFldXOffset.GetText();
1389 if( sMtrXOffset.Len() > 0 &&
1390 sMtrXOffset != aMtrFldXOffset.GetSavedValue() )
1392 XFillBmpPosOffsetXItem aFillBmpPosOffsetXItem( (UINT16) aMtrFldXOffset.GetValue() );
1393 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_POSOFFSETX );
1394 if ( !pOld || !( *(const XFillBmpPosOffsetXItem*)pOld == aFillBmpPosOffsetXItem ) )
1396 rAttrs.Put( aFillBmpPosOffsetXItem );
1397 bModified = TRUE;
1402 //aMtrFldYOffset
1403 if( aMtrFldYOffset.IsEnabled() )
1405 String sMtrYOffset = aMtrFldYOffset.GetText();
1406 if( sMtrYOffset.Len() > 0 &&
1407 sMtrYOffset != aMtrFldYOffset.GetSavedValue() )
1409 XFillBmpPosOffsetYItem aFillBmpPosOffsetYItem( (UINT16) aMtrFldYOffset.GetValue() );
1410 pOld = GetOldItem( rAttrs, XATTR_FILLBMP_POSOFFSETY );
1411 if ( !pOld || !( *(const XFillBmpPosOffsetYItem*)pOld == aFillBmpPosOffsetYItem ) )
1413 rAttrs.Put( aFillBmpPosOffsetYItem );
1414 bModified = TRUE;
1418 //add CHINA001 begin
1419 rAttrs.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
1420 rAttrs.Put (SfxUInt16Item(SID_TABPAGE_POS,nPos));
1421 //add CHINA001 end
1424 return( bModified );
1427 // -----------------------------------------------------------------------
1429 void SvxAreaTabPage::Reset( const SfxItemSet& rAttrs )
1431 //const SfxPoolItem *pPoolItem = NULL;
1433 XFillStyle eXFS;
1434 if( rAttrs.GetItemState( XATTR_FILLSTYLE ) != SFX_ITEM_DONTCARE )
1436 eXFS = (XFillStyle) ( ( ( const XFillStyleItem& ) rAttrs.
1437 Get( GetWhich( XATTR_FILLSTYLE ) ) ).GetValue() );
1438 aTypeLB.SelectEntryPos( sal::static_int_cast< USHORT >( eXFS ) );
1439 switch( eXFS )
1441 case XFILL_NONE:
1442 ClickInvisibleHdl_Impl( this );
1443 break;
1445 case XFILL_SOLID:
1446 //if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), TRUE, &pPoolItem ) )
1447 if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLCOLOR ) )
1449 XFillColorItem aColorItem( ( const XFillColorItem& )
1450 rAttrs.Get( XATTR_FILLCOLOR ) );
1452 aLbColor.SelectEntry( aColorItem.GetColorValue() );
1453 aLbHatchBckgrdColor.SelectEntry( aColorItem.GetColorValue() );
1455 ClickColorHdl_Impl( this );
1457 break;
1459 case XFILL_GRADIENT:
1460 //if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), TRUE, &pPoolItem ) )
1461 if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLGRADIENT ) )
1463 XFillGradientItem aGradientItem( ( ( const XFillGradientItem& )
1464 rAttrs.Get( XATTR_FILLGRADIENT ) ) );
1465 String aString( aGradientItem.GetName() );
1466 XGradient aGradient( aGradientItem.GetGradientValue() );
1468 aLbGradient.SelectEntryByList( pGradientList, aString, aGradient );
1470 ClickGradientHdl_Impl( this );
1471 break;
1473 case XFILL_HATCH:
1474 //if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), TRUE, &pPoolItem ) )
1475 if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLHATCH ) )
1477 aLbHatching.SelectEntry( ( ( const XFillHatchItem& )
1478 rAttrs.Get( XATTR_FILLHATCH ) ).GetName() );
1480 ClickHatchingHdl_Impl( this );
1482 if ( SFX_ITEM_DONTCARE != rAttrs.GetItemState ( XATTR_FILLBACKGROUND ) )
1484 aCbxHatchBckgrd.Check ( ( ( const XFillBackgroundItem& ) rAttrs.Get ( XATTR_FILLBACKGROUND ) ).GetValue() );
1486 ToggleHatchBckgrdColorHdl_Impl( this );
1487 if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLCOLOR ) )
1489 XFillColorItem aColorItem( ( const XFillColorItem& )
1490 rAttrs.Get( XATTR_FILLCOLOR ) );
1492 aLbColor.SelectEntry( aColorItem.GetColorValue() );
1493 aLbHatchBckgrdColor.SelectEntry( aColorItem.GetColorValue() );
1495 break;
1497 case XFILL_BITMAP:
1499 if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLBITMAP ) )
1501 XFillBitmapItem aBitmapItem( ( const XFillBitmapItem& )
1502 rAttrs.Get( XATTR_FILLBITMAP ) );
1504 String aString( aBitmapItem.GetName() );
1505 aLbBitmap.SelectEntry( aString );
1507 ClickBitmapHdl_Impl( this );
1509 break;
1511 default:
1512 //aLbColor.SelectEntryPos(0);
1513 //aRbtColor.Check();
1514 break;
1517 else
1519 // Alle LBs nicht zug"anglich machen
1520 aLbColor.Hide();
1521 aLbGradient.Hide();
1522 aLbHatching.Hide();
1523 aLbBitmap.Hide();
1524 aCtlBitmapPreview.Hide();
1525 aLbColor.Disable();
1526 aLbColor.Show();
1528 // Damit Reset() auch mit Zurueck richtig funktioniert
1529 aTypeLB.SetNoSelection();
1532 // Schrittweite
1533 if( ( rAttrs.GetItemState( XATTR_GRADIENTSTEPCOUNT ) != SFX_ITEM_DONTCARE ) ||
1534 ( rAttrs.GetItemState( XATTR_FILLSTYLE ) != SFX_ITEM_DONTCARE ) )
1536 aTsbStepCount.EnableTriState( FALSE );
1537 UINT16 nValue = ( ( const XGradientStepCountItem& ) rAttrs.Get( XATTR_GRADIENTSTEPCOUNT ) ).GetValue();
1538 if( nValue == 0 )
1540 aTsbStepCount.SetState( STATE_CHECK );
1541 aNumFldStepCount.SetText( String() );
1543 else
1545 aTsbStepCount.SetState( STATE_NOCHECK );
1546 aNumFldStepCount.SetValue( nValue );
1548 ModifyStepCountHdl_Impl( &aTsbStepCount );
1550 else
1552 aTsbStepCount.SetState( STATE_DONTKNOW );
1553 aNumFldStepCount.SetText( String() );
1556 // Attribute fuer die Bitmap-Fuellung
1558 // Ist Kacheln gesetzt?
1559 if( rAttrs.GetItemState( XATTR_FILLBMP_TILE ) != SFX_ITEM_DONTCARE )
1561 aTsbTile.EnableTriState( FALSE );
1563 if( ( ( const XFillBmpTileItem& ) rAttrs.Get( XATTR_FILLBMP_TILE ) ).GetValue() )
1564 aTsbTile.SetState( STATE_CHECK );
1565 else
1566 aTsbTile.SetState( STATE_NOCHECK );
1568 else
1569 aTsbTile.SetState( STATE_DONTKNOW );
1571 // Ist Stretchen gesetzt?
1572 if( rAttrs.GetItemState( XATTR_FILLBMP_STRETCH ) != SFX_ITEM_DONTCARE )
1574 aTsbStretch.EnableTriState( FALSE );
1576 if( ( ( const XFillBmpStretchItem& ) rAttrs.Get( XATTR_FILLBMP_STRETCH ) ).GetValue() )
1577 aTsbStretch.SetState( STATE_CHECK );
1578 else
1579 aTsbStretch.SetState( STATE_NOCHECK );
1581 else
1582 aTsbStretch.SetState( STATE_DONTKNOW );
1585 //aTsbScale
1586 if( rAttrs.GetItemState( XATTR_FILLBMP_SIZELOG ) != SFX_ITEM_DONTCARE )
1588 aTsbScale.EnableTriState( FALSE );
1590 if( ( ( const XFillBmpSizeLogItem& ) rAttrs.Get( XATTR_FILLBMP_SIZELOG ) ).GetValue() )
1591 aTsbScale.SetState( STATE_NOCHECK );
1592 else
1593 aTsbScale.SetState( STATE_CHECK );
1595 ClickScaleHdl_Impl( NULL );
1597 else
1598 aTsbScale.SetState( STATE_DONTKNOW );
1601 // Status fuer Originalgroesse ermitteln
1602 TriState eOriginal = STATE_NOCHECK;
1604 //aMtrFldXSize
1605 if( rAttrs.GetItemState( XATTR_FILLBMP_SIZEX ) != SFX_ITEM_DONTCARE )
1607 INT32 nValue = ( ( const XFillBmpSizeXItem& ) rAttrs.Get( XATTR_FILLBMP_SIZEX ) ).GetValue();
1608 if( aTsbScale.GetState() == STATE_CHECK )
1610 // Wenn im Item eine Prozentangabe steckt,
1611 // so ist diese wegen des MetricItems negativ
1612 aMtrFldXSize.SetValue( labs( nValue ) );
1614 else
1615 SetMetricValue( aMtrFldXSize, nValue, ePoolUnit );
1616 aMtrFldXSize.SaveValue();
1618 if( nValue == 0 )
1620 eOriginal = STATE_CHECK;
1621 // Wert ist beim Ausschalten von Originalgroesse sonst zu klein
1622 // (Performance-Problem)
1623 aMtrFldXSize.SetValue( 100 );
1626 else
1628 aMtrFldXSize.SetText( String() );
1629 aMtrFldXSize.SaveValue();
1632 //aMtrFldYSize
1633 if( rAttrs.GetItemState( XATTR_FILLBMP_SIZEY ) != SFX_ITEM_DONTCARE )
1635 INT32 nValue = ( ( const XFillBmpSizeYItem& ) rAttrs.Get( XATTR_FILLBMP_SIZEY ) ).GetValue();
1636 if( aTsbScale.GetState() == STATE_CHECK )
1638 // Wenn im Item eine Prozentangabe steckt,
1639 // so ist diese wegen des MetricItems negativ
1640 aMtrFldYSize.SetValue( labs( nValue ) );
1642 else
1643 SetMetricValue( aMtrFldYSize, nValue, ePoolUnit );
1644 aMtrFldYSize.SaveValue();
1646 if( nValue == 0 )
1647 aMtrFldYSize.SetValue( 100 ); //s.o.
1648 else
1649 eOriginal = STATE_NOCHECK;
1651 else
1653 aMtrFldYSize.SetText( String() );
1654 aMtrFldYSize.SaveValue();
1655 eOriginal = STATE_NOCHECK;
1658 // aTsbOriginal
1659 aTsbOriginal.SetState( eOriginal );
1661 // #93372# Setting proper state after changing button
1662 ModifyTileHdl_Impl( NULL );
1664 //aRbtRow
1665 //aRbtColumn
1666 //aMtrFldOffset
1667 if( rAttrs.GetItemState( XATTR_FILLBMP_TILEOFFSETX ) != SFX_ITEM_DONTCARE )
1669 UINT16 nValue = ( ( const XFillBmpTileOffsetXItem& ) rAttrs.Get( XATTR_FILLBMP_TILEOFFSETX ) ).GetValue();
1670 if( nValue > 0 )
1672 aMtrFldOffset.SetValue( nValue );
1673 aRbtRow.Check();
1675 else if( rAttrs.GetItemState( XATTR_FILLBMP_TILEOFFSETY ) != SFX_ITEM_DONTCARE )
1677 nValue = ( ( const XFillBmpTileOffsetYItem& ) rAttrs.Get( XATTR_FILLBMP_TILEOFFSETY ) ).GetValue();
1678 if( nValue > 0 )
1680 aMtrFldOffset.SetValue( nValue );
1681 aRbtColumn.Check();
1684 else
1685 aMtrFldOffset.SetValue( 0 );
1687 else
1688 aMtrFldOffset.SetText( String() );
1691 //aCtlPosition
1692 if( rAttrs.GetItemState( XATTR_FILLBMP_POS ) != SFX_ITEM_DONTCARE )
1694 RECT_POINT eValue = ( ( const XFillBmpPosItem& ) rAttrs.Get( XATTR_FILLBMP_POS ) ).GetValue();
1695 aCtlPosition.SetActualRP( eValue );
1697 else
1698 aCtlPosition.Reset();
1700 //aMtrFldXOffset
1701 if( rAttrs.GetItemState( XATTR_FILLBMP_POSOFFSETX ) != SFX_ITEM_DONTCARE )
1703 INT32 nValue = ( ( const XFillBmpPosOffsetXItem& ) rAttrs.Get( XATTR_FILLBMP_POSOFFSETX ) ).GetValue();
1704 aMtrFldXOffset.SetValue( nValue );
1706 else
1707 aMtrFldXOffset.SetText( String() );
1709 //aMtrFldYOffset
1710 if( rAttrs.GetItemState( XATTR_FILLBMP_POSOFFSETY ) != SFX_ITEM_DONTCARE )
1712 INT32 nValue = ( ( const XFillBmpPosOffsetYItem& ) rAttrs.Get( XATTR_FILLBMP_POSOFFSETY ) ).GetValue();
1713 aMtrFldYOffset.SetValue( nValue );
1715 else
1716 aMtrFldYOffset.SetText( String() );
1718 // Erst hier, damit Tile und Stretch mit beruecksichtigt wird
1719 if( aTypeLB.GetSelectEntryPos() == XFILL_BITMAP )
1720 ClickBitmapHdl_Impl( NULL );
1722 // Werte sichern
1723 aTypeLB.SaveValue();
1724 aLbColor.SaveValue();
1725 aLbGradient.SaveValue();
1726 aLbHatching.SaveValue();
1727 //aCbxHatchBckgrd.SaveValue();
1728 aLbHatchBckgrdColor.SaveValue();
1729 aLbBitmap.SaveValue();
1730 // aLbTransparent.SaveValue();
1731 aTsbStepCount.SaveValue();
1732 aNumFldStepCount.SaveValue();
1733 aTsbTile.SaveValue();
1734 aTsbStretch.SaveValue();
1735 aTsbScale.SaveValue();
1736 aRbtRow.SaveValue();
1737 aRbtColumn.SaveValue();
1738 aMtrFldOffset.SaveValue();
1739 aMtrFldXOffset.SaveValue();
1740 aMtrFldYOffset.SaveValue();
1741 //aMtrFldXSize.SaveValue(); <- wird oben behandelt
1742 //aMtrFldYSize.SaveValue(); <- wird oben behandelt
1745 // -----------------------------------------------------------------------
1747 SfxTabPage* SvxAreaTabPage::Create( Window* pWindow,
1748 const SfxItemSet& rAttrs )
1750 return( new SvxAreaTabPage( pWindow, rAttrs ) );
1753 //------------------------------------------------------------------------
1755 USHORT* SvxAreaTabPage::GetRanges()
1757 return( pAreaRanges );
1760 //------------------------------------------------------------------------
1761 IMPL_LINK( SvxAreaTabPage, SelectDialogTypeHdl_Impl, ListBox *, EMPTYARG )
1763 switch( (XFillStyle)aTypeLB.GetSelectEntryPos() )
1765 case XFILL_NONE: ClickInvisibleHdl_Impl( this ); break;
1766 case XFILL_SOLID: ClickColorHdl_Impl( this ); break;
1767 case XFILL_GRADIENT: ClickGradientHdl_Impl( this ); break;
1768 case XFILL_HATCH: ClickHatchingHdl_Impl( this ); break;
1769 case XFILL_BITMAP: ClickBitmapHdl_Impl( this ); break;
1772 return 0;
1775 IMPL_LINK( SvxAreaTabPage, ClickInvisibleHdl_Impl, void *, EMPTYARG )
1777 aTsbTile.Hide();
1778 aTsbStretch.Hide();
1779 aTsbScale.Hide();
1780 aTsbOriginal.Hide();
1781 aFtXSize.Hide();
1782 aMtrFldXSize.Hide();
1783 aFtYSize.Hide();
1784 aMtrFldYSize.Hide();
1785 aFlSize.Hide();
1786 aRbtRow.Hide();
1787 aRbtColumn.Hide();
1788 aMtrFldOffset.Hide();
1789 aFlOffset.Hide();
1790 aCtlPosition.Hide();
1791 aFtXOffset.Hide();
1792 aMtrFldXOffset.Hide();
1793 aFtYOffset.Hide();
1794 aMtrFldYOffset.Hide();
1795 aFlPosition.Hide();
1797 aLbColor.Hide();
1798 aLbGradient.Hide();
1799 aLbHatching.Hide();
1800 aLbBitmap.Hide();
1801 aCtlXRectPreview.Hide();
1802 aCtlBitmapPreview.Hide();
1804 aFlStepCount.Hide();
1805 aTsbStepCount.Hide();
1806 aNumFldStepCount.Hide();
1808 // Controls for Hatch-Background
1809 aCbxHatchBckgrd.Hide();
1810 aLbHatchBckgrdColor.Hide();
1812 rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
1813 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
1814 aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() );
1816 aCtlXRectPreview.Invalidate();
1817 aCtlBitmapPreview.Invalidate();
1819 return( 0L );
1822 //------------------------------------------------------------------------
1824 IMPL_LINK( SvxAreaTabPage, ClickColorHdl_Impl, void *, EMPTYARG )
1826 aTsbTile.Hide();
1827 aTsbStretch.Hide();
1828 aTsbScale.Hide();
1829 aTsbOriginal.Hide();
1830 aFtXSize.Hide();
1831 aMtrFldXSize.Hide();
1832 aFtYSize.Hide();
1833 aMtrFldYSize.Hide();
1834 aFlSize.Hide();
1835 aRbtRow.Hide();
1836 aRbtColumn.Hide();
1837 aMtrFldOffset.Hide();
1838 aFlOffset.Hide();
1839 aCtlPosition.Hide();
1840 aFtXOffset.Hide();
1841 aMtrFldXOffset.Hide();
1842 aFtYOffset.Hide();
1843 aMtrFldYOffset.Hide();
1844 aFlPosition.Hide();
1846 aLbColor.Enable();
1847 aLbColor.Show();
1848 aLbGradient.Hide();
1849 aLbHatching.Hide();
1850 aLbBitmap.Hide();
1851 aCtlXRectPreview.Enable();
1852 aCtlXRectPreview.Show();
1853 aCtlBitmapPreview.Hide();
1855 aFlStepCount.Hide();
1856 aTsbStepCount.Hide();
1857 aNumFldStepCount.Hide();
1859 // Controls for Hatch-Background
1860 aCbxHatchBckgrd.Hide();
1861 aLbHatchBckgrdColor.Hide();
1863 // Text der Tabelle setzen
1864 String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
1865 INetURLObject aURL( pColorTab->GetPath() );
1867 aURL.Append( pColorTab->GetName() );
1868 DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
1870 if( aURL.getBase().getLength() > 18 )
1872 aString += String(aURL.getBase()).Copy( 0, 15 );
1873 aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
1875 else
1876 aString += String(aURL.getBase());
1878 ModifyColorHdl_Impl( this );
1879 return( 0L );
1882 //------------------------------------------------------------------------
1884 IMPL_LINK( SvxAreaTabPage, ModifyColorHdl_Impl, void *, EMPTYARG )
1886 const SfxPoolItem* pPoolItem = NULL;
1887 USHORT _nPos = aLbColor.GetSelectEntryPos();
1888 aLbHatchBckgrdColor.SelectEntryPos( _nPos );
1889 if( _nPos != LISTBOX_ENTRY_NOTFOUND )
1891 rXFSet.Put( XFillStyleItem( XFILL_SOLID ) );
1892 rXFSet.Put( XFillColorItem( String(),
1893 aLbColor.GetSelectEntryColor() ) );
1895 // NEU
1896 else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), TRUE, &pPoolItem ) )
1898 rXFSet.Put( XFillStyleItem( XFILL_SOLID ) );
1899 Color aColor( ( ( const XFillColorItem* ) pPoolItem )->GetColorValue() );
1900 rXFSet.Put( XFillColorItem( String(), aColor ) );
1902 else
1903 rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
1905 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
1906 aCtlXRectPreview.Invalidate();
1908 return( 0L );
1910 //------------------------------------------------------------------------
1912 IMPL_LINK( SvxAreaTabPage, ClickGradientHdl_Impl, void *, EMPTYARG )
1914 aTsbTile.Hide();
1915 aTsbStretch.Hide();
1916 aTsbScale.Hide();
1917 aTsbOriginal.Hide();
1918 aFtXSize.Hide();
1919 aMtrFldXSize.Hide();
1920 aFtYSize.Hide();
1921 aMtrFldYSize.Hide();
1922 aFlSize.Hide();
1923 aRbtRow.Hide();
1924 aRbtColumn.Hide();
1925 aMtrFldOffset.Hide();
1926 aFlOffset.Hide();
1927 aCtlPosition.Hide();
1928 aFtXOffset.Hide();
1929 aMtrFldXOffset.Hide();
1930 aFtYOffset.Hide();
1931 aMtrFldYOffset.Hide();
1932 aFlPosition.Hide();
1934 aLbColor.Hide();
1935 aLbGradient.Enable();
1936 aLbGradient.Show();
1937 aLbHatching.Hide();
1938 aLbBitmap.Hide();
1939 aCtlXRectPreview.Enable();
1940 aCtlXRectPreview.Show();
1941 aCtlBitmapPreview.Hide();
1943 aFlStepCount.Enable();
1944 aFlStepCount.Show();
1945 aTsbStepCount.Enable();
1946 aTsbStepCount.Show();
1947 aNumFldStepCount.Show();
1949 // Controls for Hatch-Background
1950 aCbxHatchBckgrd.Hide();
1951 aLbHatchBckgrdColor.Hide();
1953 // Text der Tabelle setzen
1954 String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
1955 INetURLObject aURL( pGradientList->GetPath() );
1957 aURL.Append( pGradientList->GetName() );
1958 DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
1960 if( aURL.getBase().getLength() > 18 )
1962 aString += String(aURL.getBase()).Copy( 0, 15 );
1963 aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
1965 else
1966 aString += String(aURL.getBase());
1968 ModifyGradientHdl_Impl( this );
1969 ModifyStepCountHdl_Impl( &aTsbStepCount );
1970 return( 0L );
1973 //------------------------------------------------------------------------
1975 IMPL_LINK( SvxAreaTabPage, ModifyGradientHdl_Impl, void *, EMPTYARG )
1977 const SfxPoolItem* pPoolItem = NULL;
1978 USHORT _nPos = aLbGradient.GetSelectEntryPos();
1979 if( _nPos != LISTBOX_ENTRY_NOTFOUND )
1981 // ItemSet fuellen und an aCtlXRectPreview weiterleiten
1982 XGradientEntry* pEntry = pGradientList->GetGradient( _nPos );
1984 rXFSet.Put( XFillStyleItem( XFILL_GRADIENT ) );
1985 rXFSet.Put( XFillGradientItem( String(),
1986 pEntry->GetGradient() ) );
1988 // NEU
1989 else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), TRUE, &pPoolItem ) )
1991 rXFSet.Put( XFillStyleItem( XFILL_GRADIENT ) );
1992 rXFSet.Put( XFillGradientItem( String(), ( ( const XFillGradientItem* ) pPoolItem )->GetGradientValue() ) );
1994 else
1995 rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
1997 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
1998 aCtlXRectPreview.Invalidate();
2000 return( 0L );
2003 //------------------------------------------------------------------------
2005 IMPL_LINK( SvxAreaTabPage, ClickHatchingHdl_Impl, void *, EMPTYARG )
2007 aLbColor.Hide();
2008 aLbGradient.Hide();
2009 aLbHatching.Enable();
2010 aLbHatching.Show();
2011 aLbBitmap.Hide();
2012 aCtlXRectPreview.Enable();
2013 aCtlXRectPreview.Show();
2014 aCtlBitmapPreview.Hide();
2016 // aGrpTransparent.Hide();
2017 // aLbTransparent.Hide();
2018 aFlStepCount.Hide();
2019 aTsbStepCount.Hide();
2020 aNumFldStepCount.Hide();
2022 aTsbTile.Hide();
2023 aTsbStretch.Hide();
2024 aTsbScale.Hide();
2025 aTsbOriginal.Hide();
2026 aFtXSize.Hide();
2027 aMtrFldXSize.Hide();
2028 aFtYSize.Hide();
2029 aMtrFldYSize.Hide();
2030 aFlSize.Hide();
2031 aRbtRow.Hide();
2032 aRbtColumn.Hide();
2033 aMtrFldOffset.Hide();
2034 aFlOffset.Hide();
2035 aCtlPosition.Hide();
2036 aFtXOffset.Hide();
2037 aMtrFldXOffset.Hide();
2038 aFtYOffset.Hide();
2039 aMtrFldYOffset.Hide();
2040 aFlPosition.Hide();
2042 // Controls for Hatch-Background
2043 aCbxHatchBckgrd.Show();
2044 aLbHatchBckgrdColor.Show();
2045 aCbxHatchBckgrd.Enable();
2046 aLbHatchBckgrdColor.Enable();
2048 // Text der Tabelle setzen
2049 String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
2050 INetURLObject aURL( pHatchingList->GetPath() );
2052 aURL.Append( pHatchingList->GetName() );
2053 DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
2055 if( aURL.getBase().getLength() > 18 )
2057 aString += String(String(aURL.getBase()).Copy( 0, 15 ));
2058 aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
2060 else
2061 aString += String(aURL.getBase());
2063 ModifyHatchingHdl_Impl( this );
2064 ModifyHatchBckgrdColorHdl_Impl( this );
2065 ToggleHatchBckgrdColorHdl_Impl( this );
2067 return( 0L );
2070 //------------------------------------------------------------------------
2072 IMPL_LINK( SvxAreaTabPage, ModifyHatchingHdl_Impl, void *, EMPTYARG )
2074 const SfxPoolItem* pPoolItem = NULL;
2075 USHORT _nPos = aLbHatching.GetSelectEntryPos();
2076 if( _nPos != LISTBOX_ENTRY_NOTFOUND )
2078 // ItemSet fuellen und an aCtlXRectPreview weiterleiten
2079 XHatchEntry* pEntry = pHatchingList->GetHatch( _nPos );
2081 rXFSet.Put( XFillStyleItem( XFILL_HATCH ) );
2082 rXFSet.Put( XFillHatchItem( String(), pEntry->GetHatch() ) );
2084 // NEU
2085 else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), TRUE, &pPoolItem ) )
2087 rXFSet.Put( XFillStyleItem( XFILL_HATCH ) );
2088 rXFSet.Put( XFillHatchItem( String(), ( ( const XFillHatchItem* ) pPoolItem )->GetHatchValue() ) );
2090 else
2091 rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
2093 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
2094 aCtlXRectPreview.Invalidate();
2096 return( 0L );
2099 //------------------------------------------------------------------------
2101 IMPL_LINK( SvxAreaTabPage, ModifyHatchBckgrdColorHdl_Impl, void *, EMPTYARG )
2103 const SfxPoolItem* pPoolItem = NULL;
2104 USHORT _nPos = aLbHatchBckgrdColor.GetSelectEntryPos();
2105 aLbColor.SelectEntryPos( _nPos );
2106 if( _nPos != LISTBOX_ENTRY_NOTFOUND )
2108 // rXFSet.Put( XFillStyleItem( XFILL_SOLID ) );
2109 rXFSet.Put( XFillColorItem( String(),
2110 aLbHatchBckgrdColor.GetSelectEntryColor() ) );
2112 // NEU
2113 else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), TRUE, &pPoolItem ) )
2115 // rXFSet.Put( XFillStyleItem( XFILL_SOLID ) );
2116 Color aColor( ( ( const XFillColorItem* ) pPoolItem )->GetColorValue() );
2117 rXFSet.Put( XFillColorItem( String(), aColor ) );
2119 else
2120 rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
2122 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
2123 aCtlXRectPreview.Invalidate();
2125 return( 0L );
2128 //------------------------------------------------------------------------
2130 IMPL_LINK( SvxAreaTabPage, ToggleHatchBckgrdColorHdl_Impl, void *, EMPTYARG )
2132 // switch on/off backgroundcolor for hatches
2133 aLbHatchBckgrdColor.Enable( aCbxHatchBckgrd.IsChecked() );
2135 XFillBackgroundItem aItem( aCbxHatchBckgrd.IsChecked() );
2136 rXFSet.Put ( aItem, XATTR_FILLBACKGROUND );
2138 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
2139 aCtlXRectPreview.Invalidate();
2141 if( aLbHatchBckgrdColor.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND )
2143 if ( SFX_ITEM_SET == rOutAttrs.GetItemState( XATTR_FILLCOLOR ) )//>= SFX_ITEM_DEFAULT )
2145 XFillColorItem aColorItem( (const XFillColorItem&)rOutAttrs.Get( XATTR_FILLCOLOR ) );
2146 aLbHatchBckgrdColor.SelectEntry( aColorItem.GetColorValue() );
2150 return( 0L );
2153 //------------------------------------------------------------------------
2155 IMPL_LINK( SvxAreaTabPage, ClickBitmapHdl_Impl, void *, EMPTYARG )
2157 aLbColor.Hide();
2158 aLbGradient.Hide();
2159 aLbHatching.Hide();
2160 aLbBitmap.Enable();
2161 aLbBitmap.Show();
2162 aCtlBitmapPreview.Enable();
2163 aCtlBitmapPreview.Show();
2164 aCtlXRectPreview.Hide();
2165 // aGrpPreview.Hide();
2166 // aGrpTransparent.Hide();
2167 // aLbTransparent.Hide();
2168 aFlStepCount.Hide();
2169 aTsbStepCount.Hide();
2170 aNumFldStepCount.Hide();
2172 aTsbTile.Enable();
2173 aTsbStretch.Enable();
2174 aTsbScale.Enable();
2175 aTsbOriginal.Enable();
2176 aFtXSize.Enable();
2177 aMtrFldXSize.Enable();
2178 aFtYSize.Enable();
2179 aMtrFldYSize.Enable();
2180 aFlSize.Enable();
2181 aCtlPosition.Enable();
2182 aFtXOffset.Enable();
2183 aMtrFldXOffset.Enable();
2184 aFtYOffset.Enable();
2185 aMtrFldYOffset.Enable();
2186 aFlPosition.Enable();
2187 aRbtRow.Enable();
2188 aRbtColumn.Enable();
2189 aMtrFldOffset.Enable();
2190 aFlOffset.Enable();
2192 // Controls for Hatch-Background
2193 aCbxHatchBckgrd.Hide();
2194 aLbHatchBckgrdColor.Hide();
2196 aTsbTile.Show();
2197 aTsbStretch.Show();
2198 aTsbScale.Show();
2199 aTsbOriginal.Show();
2200 aFtXSize.Show();
2201 aMtrFldXSize.Show();
2202 aFtYSize.Show();
2203 aMtrFldYSize.Show();
2204 aFlSize.Show();
2205 aCtlPosition.Show();
2206 aFtXOffset.Show();
2207 aMtrFldXOffset.Show();
2208 aFtYOffset.Show();
2209 aMtrFldYOffset.Show();
2210 aFlPosition.Show();
2211 aRbtRow.Show();
2212 aRbtColumn.Show();
2213 aMtrFldOffset.Show();
2214 aFlOffset.Show();
2216 // Text der Tabelle setzen
2217 String aString( SVX_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
2218 INetURLObject aURL( pBitmapList->GetPath() );
2220 aURL.Append( pBitmapList->GetName() );
2221 DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
2223 if( aURL.getBase().getLength() > 18 )
2225 aString += String(aURL.getBase()).Copy( 0, 15 );
2226 aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
2228 else
2229 aString += String(aURL.getBase());
2231 ModifyBitmapHdl_Impl( this );
2232 ModifyTileHdl_Impl( &aTsbOriginal );
2233 return( 0L );
2236 //------------------------------------------------------------------------
2238 IMPL_LINK( SvxAreaTabPage, ModifyBitmapHdl_Impl, void *, EMPTYARG )
2240 const SfxPoolItem* pPoolItem = NULL;
2241 USHORT _nPos = aLbBitmap.GetSelectEntryPos();
2242 if( _nPos != LISTBOX_ENTRY_NOTFOUND )
2244 // ItemSet fuellen und an aCtlXRectPreview weiterleiten
2245 XBitmapEntry* pEntry = pBitmapList->GetBitmap( _nPos );
2247 rXFSet.Put( XFillStyleItem( XFILL_BITMAP ) );
2248 rXFSet.Put( XFillBitmapItem( String(), pEntry->GetXBitmap() ) );
2250 // NEU
2251 else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), TRUE, &pPoolItem ) )
2253 rXFSet.Put( XFillStyleItem( XFILL_BITMAP ) );
2254 rXFSet.Put( XFillBitmapItem( String(), ( ( const XFillBitmapItem* ) pPoolItem )->GetBitmapValue() ) );
2256 else
2257 rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
2259 aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() );
2260 aCtlBitmapPreview.Invalidate();
2262 return( 0L );
2265 //------------------------------------------------------------------------
2267 //IMPL_LINK( SvxAreaTabPage, ModifyTransparentHdl_Impl, void *, EMPTYARG )
2269 // USHORT nPos = aLbTransparent.GetSelectEntryPos();
2270 // if( nPos != LISTBOX_ENTRY_NOTFOUND )
2271 // {
2272 // XFillTransparenceItem aItem( nPos * 25 );
2274 // rXFSet.Put( XFillTransparenceItem( aItem ) );
2275 // aCtlXRectPreview.SetAttributes( aXFillAttr );
2277 // aCtlXRectPreview.Invalidate();
2278 // }
2280 // return( 0L );
2283 //------------------------------------------------------------------------
2285 IMPL_LINK( SvxAreaTabPage, ModifyStepCountHdl_Impl, void *, p )
2287 if( p == &aTsbStepCount )
2289 if( aTsbStepCount.GetState() == STATE_NOCHECK )
2291 if( aNumFldStepCount.GetText().Len() == 0 )
2292 aNumFldStepCount.SetText( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "64") ));
2294 aNumFldStepCount.Enable();
2296 else
2297 aNumFldStepCount.Disable();
2300 UINT16 nValue = 0;
2301 if( aTsbStepCount.GetState() != STATE_CHECK )
2303 // Zustand != Disabled ?
2304 if( aNumFldStepCount.GetText().Len() > 0 )
2305 nValue = (UINT16) aNumFldStepCount.GetValue();
2307 rXFSet.Put( XGradientStepCountItem( nValue ) );
2308 aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
2309 aCtlXRectPreview.Invalidate();
2311 return( 0L );
2314 //------------------------------------------------------------------------
2316 IMPL_LINK( SvxAreaTabPage, ModifyTileHdl_Impl, void *, EMPTYARG )
2318 TriState eState = aTsbTile.GetState();
2319 if( eState == STATE_CHECK )
2321 aTsbStretch.Disable();
2322 aRbtRow.Enable();
2323 aRbtColumn.Enable();
2324 aMtrFldOffset.Enable();
2325 aFlOffset.Enable();
2327 aCtlPosition.Enable();
2328 aCtlPosition.Invalidate();
2329 aFtXOffset.Enable();
2330 aMtrFldXOffset.Enable();
2331 aFtYOffset.Enable();
2332 aMtrFldYOffset.Enable();
2333 aFlPosition.Enable();
2335 aTsbScale.Enable();
2336 aTsbOriginal.Enable();
2337 aFtXSize.Enable();
2338 aMtrFldXSize.Enable();
2339 aFtYSize.Enable();
2340 aMtrFldYSize.Enable();
2341 aFlSize.Enable();
2343 else if( eState == STATE_NOCHECK )
2345 aTsbStretch.Enable();
2346 aRbtRow.Disable();
2347 aRbtColumn.Disable();
2348 aMtrFldOffset.Disable();
2349 aFlOffset.Disable();
2351 aCtlPosition.Disable();
2352 aCtlPosition.Invalidate();
2353 aFtXOffset.Disable();
2354 aMtrFldXOffset.Disable();
2355 aFtYOffset.Disable();
2356 aMtrFldYOffset.Disable();
2357 aFlPosition.Disable();
2359 if( aTsbStretch.GetState() != STATE_NOCHECK )
2361 aTsbScale.Disable();
2362 aTsbOriginal.Disable();
2363 aFtXSize.Disable();
2364 aMtrFldXSize.Disable();
2365 aFtYSize.Disable();
2366 aMtrFldYSize.Disable();
2367 aFlSize.Disable();
2369 else
2371 aTsbScale.Enable();
2372 aTsbOriginal.Enable();
2373 aFtXSize.Enable();
2374 aMtrFldXSize.Enable();
2375 aFtYSize.Enable();
2376 aMtrFldYSize.Enable();
2377 aFlSize.Enable();
2380 else
2382 aTsbStretch.Disable();
2383 aRbtRow.Disable();
2384 aRbtColumn.Disable();
2385 aMtrFldOffset.Disable();
2386 aFlOffset.Disable();
2388 aCtlPosition.Disable();
2389 aCtlPosition.Invalidate();
2390 aFtXOffset.Disable();
2391 aMtrFldXOffset.Disable();
2392 aFtYOffset.Disable();
2393 aMtrFldYOffset.Disable();
2394 aFlPosition.Disable();
2396 aTsbScale.Disable();
2397 aTsbOriginal.Disable();
2398 aFtXSize.Disable();
2399 aMtrFldXSize.Disable();
2400 aFtYSize.Disable();
2401 aMtrFldYSize.Disable();
2402 aFlSize.Disable();
2405 if( aTsbOriginal.GetState() == STATE_CHECK )
2407 aMtrFldXSize.SetText( String() );
2408 aMtrFldYSize.SetText( String() );
2409 aFtXSize.Disable();
2410 aFtYSize.Disable();
2411 aMtrFldXSize.Disable();
2412 aMtrFldYSize.Disable();
2413 aTsbScale.Disable();
2415 else
2417 aMtrFldXSize.SetValue( aMtrFldXSize.GetValue() );
2418 aMtrFldYSize.SetValue( aMtrFldYSize.GetValue() );
2420 if( eState == STATE_CHECK )
2422 aFtXSize.Enable();
2423 aFtYSize.Enable();
2424 aMtrFldXSize.Enable();
2425 aMtrFldYSize.Enable();
2430 rXFSet.Put( XFillBmpTileItem( sal::static_int_cast< BOOL >( eState ) ) );
2432 if( aTsbStretch.IsEnabled() )
2433 rXFSet.Put(
2434 XFillBmpStretchItem(
2435 sal::static_int_cast< BOOL >( aTsbStretch.GetState() ) ) );
2437 if( aTsbScale.IsEnabled() )
2438 rXFSet.Put( XFillBmpSizeLogItem( aTsbScale.GetState() == STATE_NOCHECK ) );
2440 if( aMtrFldXSize.IsEnabled() )
2442 XFillBmpSizeXItem* pItem = NULL;
2443 TriState eScaleState = aTsbScale.GetState();
2445 if( eScaleState == STATE_NOCHECK )
2446 pItem = new XFillBmpSizeXItem( GetCoreValue( aMtrFldXSize, ePoolUnit ) );
2447 else
2448 pItem = new XFillBmpSizeXItem( -labs( static_cast<long>(aMtrFldXSize.GetValue()) ) );
2450 rXFSet.Put( *pItem );
2452 delete pItem;
2454 else if( aTsbOriginal.IsEnabled() && aTsbOriginal.GetState() == STATE_CHECK )
2456 // Originalgroesse -> Size == 0
2457 rXFSet.Put( XFillBmpSizeXItem( 0 ) );
2458 rXFSet.Put( XFillBmpSizeLogItem( TRUE ) );
2461 if( aMtrFldYSize.IsEnabled() )
2463 XFillBmpSizeYItem* pItem = NULL;
2464 TriState eScaleState = aTsbScale.GetState();
2466 if( eScaleState == STATE_NOCHECK )
2467 pItem = new XFillBmpSizeYItem( GetCoreValue( aMtrFldYSize, ePoolUnit ) );
2468 else
2469 pItem = new XFillBmpSizeYItem( -labs( static_cast<long>(aMtrFldYSize.GetValue()) ) );
2471 rXFSet.Put( *pItem );
2473 delete pItem;
2475 else if( aTsbOriginal.IsEnabled() && aTsbOriginal.GetState() == STATE_CHECK )
2477 // Originalgroesse -> Size == 0
2478 rXFSet.Put( XFillBmpSizeYItem( 0 ) );
2479 rXFSet.Put( XFillBmpSizeLogItem( TRUE ) );
2482 if( aMtrFldOffset.IsEnabled() )
2484 if( aRbtRow.IsChecked() )
2486 rXFSet.Put( XFillBmpTileOffsetXItem( (UINT16) aMtrFldOffset.GetValue() ) );
2487 rXFSet.Put( XFillBmpTileOffsetYItem( (UINT16) 0 ) );
2489 else if( aRbtColumn.IsChecked() )
2491 rXFSet.Put( XFillBmpTileOffsetXItem( (UINT16) 0 ) );
2492 rXFSet.Put( XFillBmpTileOffsetYItem( (UINT16) aMtrFldOffset.GetValue() ) );
2496 if( aCtlPosition.IsEnabled() )
2497 rXFSet.Put( XFillBmpPosItem( aCtlPosition.GetActualRP() ) );
2499 if( aMtrFldXOffset.IsEnabled() )
2500 rXFSet.Put( XFillBmpPosOffsetXItem( (UINT16) aMtrFldXOffset.GetValue() ) );
2502 if( aMtrFldYOffset.IsEnabled() )
2503 rXFSet.Put( XFillBmpPosOffsetYItem( (UINT16) aMtrFldYOffset.GetValue() ) );
2506 aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() );
2507 aCtlBitmapPreview.Invalidate();
2509 return( 0L );
2512 //------------------------------------------------------------------------
2514 IMPL_LINK( SvxAreaTabPage, ClickScaleHdl_Impl, void *, EMPTYARG )
2516 if( aTsbScale.GetState() == STATE_CHECK )
2518 aMtrFldXSize.SetDecimalDigits( 0 );
2519 aMtrFldXSize.SetUnit( FUNIT_CUSTOM );
2520 aMtrFldXSize.SetValue( 100 );
2521 aMtrFldXSize.SetMax( 100 );
2522 aMtrFldXSize.SetLast( 100 );
2524 aMtrFldYSize.SetDecimalDigits( 0 );
2525 aMtrFldYSize.SetUnit( FUNIT_CUSTOM );
2526 aMtrFldYSize.SetValue( 100 );
2527 aMtrFldYSize.SetMax( 100 );
2528 aMtrFldYSize.SetLast( 100 );
2530 else
2532 aMtrFldXSize.SetDecimalDigits( 2 );
2533 aMtrFldXSize.SetUnit( eFUnit );
2534 aMtrFldXSize.SetValue( 100 );
2535 aMtrFldXSize.SetMax( 999900 );
2536 aMtrFldXSize.SetLast( 100000 );
2538 aMtrFldYSize.SetDecimalDigits( 2 );
2539 aMtrFldYSize.SetUnit( eFUnit );
2540 aMtrFldYSize.SetValue( 100 );
2541 aMtrFldYSize.SetMax( 999900 );
2542 aMtrFldYSize.SetLast( 100000 );
2545 ModifyTileHdl_Impl( NULL );
2547 return( 0L );
2550 //------------------------------------------------------------------------
2552 void SvxAreaTabPage::PointChanged( Window* pWindow, RECT_POINT eRcPt )
2554 eRP = eRcPt;
2556 // Ausrichtung der Bitmapfuellung
2557 ModifyTileHdl_Impl( pWindow );
2560 void SvxAreaTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
2562 SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False);
2563 SFX_ITEMSET_ARG (&aSet,pGradientListItem,SvxGradientListItem,SID_GRADIENT_LIST,sal_False);
2564 SFX_ITEMSET_ARG (&aSet,pHatchingListItem,SvxHatchListItem,SID_HATCH_LIST,sal_False);
2565 SFX_ITEMSET_ARG (&aSet,pBitmapListItem,SvxBitmapListItem,SID_BITMAP_LIST,sal_False);
2566 SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
2567 SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False);
2568 SFX_ITEMSET_ARG (&aSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,sal_False);
2570 if (pColorTabItem)
2571 SetColorTable(pColorTabItem->GetColorTable());
2572 if (pGradientListItem)
2573 SetGradientList(pGradientListItem->GetGradientList());
2574 if (pHatchingListItem)
2575 SetHatchingList(pHatchingListItem->GetHatchList());
2576 if (pBitmapListItem)
2577 SetBitmapList(pBitmapListItem->GetBitmapList());
2578 if (pPageTypeItem)
2579 SetPageType(pPageTypeItem->GetValue());
2580 if (pDlgTypeItem)
2581 SetDlgType(pDlgTypeItem->GetValue());
2582 if (pPosItem)
2583 SetPos(pPosItem->GetValue());
2584 Construct();