xref: /aoo42x/main/cui/source/tabpages/tparea.cxx (revision 7ea7a1cc)
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     maColorTab(),
664     maGradientList(),
665     maHatchingList(),
666     maBitmapList(),
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( maColorTab );
791 	aLbHatchBckgrdColor.Fill ( maColorTab );
792 
793 	aLbGradient.Fill( maGradientList );
794 	aLbHatching.Fill( maHatchingList );
795 	aLbBitmap.Fill( maBitmapList );
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( maColorTab.get() )
817 		{
818 			// Bitmapliste
819 			if( *pnBitmapListState )
820 			{
821 				if( *pnBitmapListState & CT_CHANGED )
822 					maBitmapList = ( (SvxAreaTabDialog*) DLGWIN )->GetNewBitmapList();
823 
824                 _nPos = aLbBitmap.GetSelectEntryPos();
825 
826 				aLbBitmap.Clear();
827 				aLbBitmap.Fill( maBitmapList );
828 				nCount = aLbBitmap.GetEntryCount();
829 				if( nCount == 0 )
830 					; // This case should never occur
831                 else if( nCount <= _nPos )
832 					aLbBitmap.SelectEntryPos( 0 );
833 				else
834                     aLbBitmap.SelectEntryPos( _nPos );
835 				ModifyBitmapHdl_Impl( this );
836 			}
837 			// hatch-liste
838 			if( *pnHatchingListState )
839 			{
840 				if( *pnHatchingListState & CT_CHANGED )
841 					maHatchingList = ( (SvxAreaTabDialog*) DLGWIN )->GetNewHatchingList();
842 
843                 _nPos = aLbHatching.GetSelectEntryPos();
844 
845 				aLbHatching.Clear();
846 				aLbHatching.Fill( maHatchingList );
847 				nCount = aLbHatching.GetEntryCount();
848 				if( nCount == 0 )
849 					; // This case should never occur
850                 else if( nCount <= _nPos )
851 					aLbHatching.SelectEntryPos( 0 );
852 				else
853                     aLbHatching.SelectEntryPos( _nPos );
854 				ModifyHatchingHdl_Impl( this );
855 
856 				ModifyHatchBckgrdColorHdl_Impl( this );
857 			}
858 			// gradient-liste
859 			if( *pnGradientListState )
860 			{
861 				if( *pnGradientListState & CT_CHANGED )
862 					maGradientList = ( (SvxAreaTabDialog*) DLGWIN )->GetNewGradientList();
863 
864                 _nPos = aLbGradient.GetSelectEntryPos();
865 
866 				aLbGradient.Clear();
867 				aLbGradient.Fill( maGradientList );
868 				nCount = aLbGradient.GetEntryCount();
869 				if( nCount == 0 )
870 					; // This case should never occur
871                 else if( nCount <= _nPos )
872 					aLbGradient.SelectEntryPos( 0 );
873 				else
874                     aLbGradient.SelectEntryPos( _nPos );
875 				ModifyGradientHdl_Impl( this );
876 			}
877 			// ColorTable
878 			if( *pnColorTableState )
879 			{
880 				if( *pnColorTableState & CT_CHANGED )
881 					maColorTab = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorTable();
882 				// aLbColor
883                 _nPos = aLbColor.GetSelectEntryPos();
884 				aLbColor.Clear();
885 				aLbColor.Fill( maColorTab );
886 				nCount = aLbColor.GetEntryCount();
887 				if( nCount == 0 )
888 					; // This case should never occur
889                 else if( nCount <= _nPos )
890 					aLbColor.SelectEntryPos( 0 );
891 				else
892                     aLbColor.SelectEntryPos( _nPos );
893 
894 				ModifyColorHdl_Impl( this );
895 
896 				// Backgroundcolor of hatch
897                 _nPos = aLbHatchBckgrdColor.GetSelectEntryPos();
898 				aLbHatchBckgrdColor.Clear();
899 				aLbHatchBckgrdColor.Fill( maColorTab );
900 				nCount = aLbHatchBckgrdColor.GetEntryCount();
901 				if( nCount == 0 )
902 					; // This case should never occur
903                 else if( nCount <= _nPos )
904 					aLbHatchBckgrdColor.SelectEntryPos( 0 );
905 				else
906                     aLbHatchBckgrdColor.SelectEntryPos( _nPos );
907 
908 				ModifyHatchBckgrdColorHdl_Impl( this );
909 			}
910 
911 			// evaluate if any other Tabpage set another filltype
912             if( aTypeLB.GetSelectEntryPos() > XFILL_NONE)
913             {
914 				switch( nPageType )//CHINA001 switch( *pPageType )
915 				{
916 					case PT_GRADIENT:
917 					    aTypeLB.SelectEntryPos( XFILL_GRADIENT );
918                         aLbGradient.SelectEntryPos( _nPos );//CHINA001 aLbGradient.SelectEntryPos( *pPos );
919                         ClickGradientHdl_Impl( this );
920 					break;
921 
922 					case PT_HATCH:
923 					    aTypeLB.SelectEntryPos( XFILL_HATCH );
924                         aLbHatching.SelectEntryPos( _nPos );//CHINA001 aLbHatching.SelectEntryPos( *pPos );
925                         ClickHatchingHdl_Impl( this );
926 					break;
927 
928 					case PT_BITMAP:
929 					    aTypeLB.SelectEntryPos( XFILL_BITMAP );
930                         aLbBitmap.SelectEntryPos( _nPos );//CHINA001 aLbBitmap.SelectEntryPos( *pPos );
931                         ClickBitmapHdl_Impl( this );
932 					break;
933 
934 					case PT_COLOR:
935 					    aTypeLB.SelectEntryPos( XFILL_SOLID );
936                         aLbColor.SelectEntryPos( _nPos );//CHINA001 aLbColor.SelectEntryPos( *pPos );
937                         aLbHatchBckgrdColor.SelectEntryPos( _nPos ); //CHINA001 aLbHatchBckgrdColor.SelectEntryPos( *pPos );
938                         ClickColorHdl_Impl( this );
939 					break;
940                 }
941 			}
942 			nPageType = PT_AREA;//CHINA001 *pPageType = PT_AREA;
943 		}
944 	}
945 }
946 
947 // -----------------------------------------------------------------------
948 
949 int SvxAreaTabPage::DeactivatePage( SfxItemSet* _pSet )
950 {
951 	if( nDlgType == 0 ) // Flaechen-Dialog//CHINA001 if( *pDlgType == 0 ) // Flaechen-Dialog
952 	{
953         XFillStyle eStyle = (XFillStyle) aTypeLB.GetSelectEntryPos();
954         switch( eStyle )
955         {
956             case XFILL_GRADIENT:
957             {
958                         nPageType = PT_GRADIENT;//CHINA001 *pPageType = PT_GRADIENT;
959                         nPos = aLbGradient.GetSelectEntryPos();//CHINA001 *pPos = aLbGradient.GetSelectEntryPos();
960             }
961             break;
962             case XFILL_HATCH:
963             {
964                 nPageType = PT_HATCH;//CHINA001 *pPageType = PT_HATCH;
965                 nPos = aLbHatching.GetSelectEntryPos();//CHINA001 *pPos = aLbHatching.GetSelectEntryPos();
966             }
967             break;
968             case XFILL_BITMAP:
969             {
970                 nPageType = PT_BITMAP;//CHINA001 *pPageType = PT_BITMAP;
971                 nPos = aLbBitmap.GetSelectEntryPos();//CHINA001 *pPos = aLbBitmap.GetSelectEntryPos();
972             }
973             break;
974             case XFILL_SOLID:
975             {
976                 nPageType = PT_COLOR;//CHINA001 *pPageType = PT_COLOR;
977                 nPos = aLbColor.GetSelectEntryPos();//CHINA001 *pPos = aLbColor.GetSelectEntryPos();
978             }
979             break;
980             default: ;//prevent warning
981         }
982 	}
983 
984     if( _pSet )
985         FillItemSet( *_pSet );
986 
987 	return( LEAVE_PAGE );
988 }
989 
990 // -----------------------------------------------------------------------
991 
992 sal_Bool SvxAreaTabPage::FillItemSet( SfxItemSet& rAttrs )
993 {
994 	const SfxPoolItem* pOld = NULL;
995     sal_uInt16  _nPos;
996 	sal_Bool	bModified = sal_False;
997 
998 	if( nDlgType != 0 || *pbAreaTP )//CHINA001 if( *pDlgType != 0 || *pbAreaTP )
999 	{
1000         XFillStyle eStyle = (XFillStyle) aTypeLB.GetSelectEntryPos();
1001         XFillStyle eSavedStyle = (XFillStyle) aTypeLB.GetSavedValue();
1002         switch( eStyle )
1003         {
1004             case XFILL_NONE:
1005             {
1006                 if(  eSavedStyle != eStyle )
1007                 {
1008                     XFillStyleItem aStyleItem( XFILL_NONE );
1009                     pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE );
1010                     if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) )
1011                     {
1012                         rAttrs.Put( aStyleItem );
1013                         bModified = sal_True;
1014                     }
1015                 }
1016             }
1017             break;
1018             case XFILL_SOLID:
1019             {
1020                  _nPos = aLbColor.GetSelectEntryPos();
1021                  if( _nPos != LISTBOX_ENTRY_NOTFOUND &&
1022                      _nPos != aLbColor.GetSavedValue() )
1023                  {
1024                      XFillColorItem aItem( aLbColor.GetSelectEntry(),
1025                                            aLbColor.GetSelectEntryColor() );
1026                      pOld = GetOldItem( rAttrs, XATTR_FILLCOLOR );
1027                      if ( !pOld || !( *(const XFillColorItem*)pOld == aItem ) )
1028                      {
1029                          rAttrs.Put( aItem );
1030                          bModified = sal_True;
1031                      }
1032                  }
1033                  // NEU
1034                  if( (eSavedStyle != eStyle) &&
1035                      ( bModified ||
1036                        SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), sal_True ) ) )
1037                  {
1038                      XFillStyleItem aStyleItem( XFILL_SOLID );
1039                      pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE );
1040                      if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) )
1041                      {
1042                          rAttrs.Put( aStyleItem );
1043                          bModified = sal_True;
1044                      }
1045                  }
1046             }
1047             break;
1048             case XFILL_GRADIENT:
1049             {
1050                 _nPos = aLbGradient.GetSelectEntryPos();
1051                 if( _nPos != LISTBOX_ENTRY_NOTFOUND &&
1052                     _nPos != aLbGradient.GetSavedValue() )
1053                 {
1054                     XGradient aGradient = maGradientList->GetGradient( _nPos )->GetGradient();
1055                     String aString = aLbGradient.GetSelectEntry();
1056                     XFillGradientItem aItem( aString, aGradient );
1057                     pOld = GetOldItem( rAttrs, XATTR_FILLGRADIENT );
1058                     if ( !pOld || !( *(const XFillGradientItem*)pOld == aItem ) )
1059                     {
1060                         rAttrs.Put( aItem );
1061                         bModified = sal_True;
1062                     }
1063                 }
1064                 // NEU
1065                 if( (eSavedStyle != eStyle) &&
1066                     ( bModified ||
1067                       SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), sal_True ) ) )
1068                 {
1069                     XFillStyleItem aStyleItem( XFILL_GRADIENT );
1070                     pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE );
1071                     if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) )
1072                     {
1073                         rAttrs.Put( aStyleItem );
1074                         bModified = sal_True;
1075                     }
1076                 }
1077             }
1078             break;
1079             case XFILL_HATCH:
1080             {
1081                 _nPos = aLbHatching.GetSelectEntryPos();
1082                 if( _nPos != LISTBOX_ENTRY_NOTFOUND &&
1083                    _nPos != aLbHatching.GetSavedValue() )
1084                 {
1085                     XHatch aHatching = maHatchingList->GetHatch( _nPos )->GetHatch();
1086                     String aString = aLbHatching.GetSelectEntry();
1087                     XFillHatchItem aItem( aString, aHatching );
1088                     pOld = GetOldItem( rAttrs, XATTR_FILLHATCH );
1089                     if ( !pOld || !( *(const XFillHatchItem*)pOld == aItem ) )
1090                     {
1091                         rAttrs.Put( aItem );
1092                         bModified = sal_True;
1093                     }
1094                 }
1095                 XFillBackgroundItem aItem ( aCbxHatchBckgrd.IsChecked() );
1096                 rAttrs.Put( aItem );
1097                 nPos = aLbHatchBckgrdColor.GetSelectEntryPos();
1098                 if( nPos != LISTBOX_ENTRY_NOTFOUND &&
1099                      nPos != aLbHatchBckgrdColor.GetSavedValue() )
1100                 {
1101                     XFillColorItem aFillColorItem( aLbHatchBckgrdColor.GetSelectEntry(),
1102                                           aLbHatchBckgrdColor.GetSelectEntryColor() );
1103                     pOld = GetOldItem( rAttrs, XATTR_FILLCOLOR );
1104                     if ( !pOld || !( *(const XFillColorItem*)pOld == aFillColorItem ) )
1105                     {
1106                         rAttrs.Put( aFillColorItem );
1107                         bModified = sal_True;
1108                     }
1109                 }
1110                 // NEU
1111                 if( (eSavedStyle != eStyle) &&
1112                     ( bModified ||
1113                       SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), sal_True ) ) )
1114                 {
1115                     XFillStyleItem aStyleItem( XFILL_HATCH );
1116                     pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE );
1117                     if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) )
1118                     {
1119                         rAttrs.Put( aStyleItem );
1120                         bModified = sal_True;
1121                     }
1122                 }
1123             }
1124             break;
1125             case XFILL_BITMAP:
1126             {
1127                 nPos = aLbBitmap.GetSelectEntryPos();
1128                 if( nPos != LISTBOX_ENTRY_NOTFOUND &&
1129                     nPos != aLbBitmap.GetSavedValue() )
1130                 {
1131                     const XBitmapEntry* pXBitmapEntry = maBitmapList->GetBitmap(nPos);
1132                     const String aString(aLbBitmap.GetSelectEntry());
1133                     const XFillBitmapItem aFillBitmapItem(aString, pXBitmapEntry->GetGraphicObject());
1134                     pOld = GetOldItem( rAttrs, XATTR_FILLBITMAP );
1135                     if ( !pOld || !( *(const XFillBitmapItem*)pOld == aFillBitmapItem ) )
1136                     {
1137                         rAttrs.Put( aFillBitmapItem );
1138                         bModified = sal_True;
1139                     }
1140                 }
1141                 // NEU
1142                 if( (eSavedStyle != eStyle) &&
1143                     ( bModified ||
1144                       SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), sal_True ) ) )
1145                 {
1146                     XFillStyleItem aStyleItem( XFILL_BITMAP );
1147                     pOld = GetOldItem( rAttrs, XATTR_FILLSTYLE );
1148                     if ( !pOld || !( *(const XFillStyleItem*)pOld == aStyleItem ) )
1149                     {
1150                         rAttrs.Put( aStyleItem );
1151                         bModified = sal_True;
1152                     }
1153                }
1154            }
1155            break;
1156        }
1157 
1158 		// Schrittweite
1159 		if( aTsbStepCount.IsEnabled() )
1160 		{
1161 			sal_uInt16 nValue = 0;
1162 			sal_Bool   bValueModified = sal_False;
1163 			TriState eState = aTsbStepCount.GetState();
1164 			if( eState == STATE_CHECK )
1165 			{
1166 				if( eState != aTsbStepCount.GetSavedValue() )
1167 					bValueModified = sal_True;
1168 			}
1169 			else
1170 			{
1171 				// Zustand != Disabled ?
1172 				if( aNumFldStepCount.GetText().Len() > 0 )
1173 				{
1174 					nValue = (sal_uInt16) aNumFldStepCount.GetValue();
1175 					if( nValue != (sal_uInt16) aNumFldStepCount.GetSavedValue().ToInt32() )
1176 						bValueModified = sal_True;
1177 				}
1178 			}
1179 			if( bValueModified )
1180 			{
1181                 XGradientStepCountItem aFillBitmapItem( nValue );
1182 				pOld = GetOldItem( rAttrs, XATTR_GRADIENTSTEPCOUNT );
1183                 if ( !pOld || !( *(const XGradientStepCountItem*)pOld == aFillBitmapItem ) )
1184 				{
1185                     rAttrs.Put( aFillBitmapItem );
1186 					bModified = sal_True;
1187 				}
1188 			}
1189 		}
1190 
1191 		// Kacheln
1192 		if( aTsbTile.IsEnabled() )
1193 		{
1194 			TriState eState = aTsbTile.GetState();
1195 			if( eState != aTsbTile.GetSavedValue() )
1196 			{
1197                 XFillBmpTileItem aFillBmpTileItem(
1198                     sal::static_int_cast< sal_Bool >( eState ) );
1199 				pOld = GetOldItem( rAttrs, XATTR_FILLBMP_TILE );
1200                 if ( !pOld || !( *(const XFillBmpTileItem*)pOld == aFillBmpTileItem ) )
1201 				{
1202                     rAttrs.Put( aFillBmpTileItem );
1203 					bModified = sal_True;
1204 				}
1205 			}
1206 		}
1207 		// Stretchen
1208 		if( aTsbStretch.IsEnabled() )
1209 		{
1210 			TriState eState = aTsbStretch.GetState();
1211 			if( eState != aTsbStretch.GetSavedValue() )
1212 			{
1213                 XFillBmpStretchItem aFillBmpStretchItem(
1214                     sal::static_int_cast< sal_Bool >( eState ) );
1215 				pOld = GetOldItem( rAttrs, XATTR_FILLBMP_STRETCH );
1216                 if ( !pOld || !( *(const XFillBmpStretchItem*)pOld == aFillBmpStretchItem ) )
1217 				{
1218                     rAttrs.Put( aFillBmpStretchItem );
1219 					bModified = sal_True;
1220 				}
1221 			}
1222 		}
1223 
1224 		// Originalgroesse (im UI) wird wie folgt benutzt:
1225 		// Controls sind disabled, muessen aber gesetzt werden.
1226 		// SizeX = 0; SizeY = 0; Log = sal_True
1227 
1228 		//aTsbScale
1229 		TriState eState = aTsbScale.GetState();
1230 		if( eState != aTsbScale.GetSavedValue() ||
1231 			( !aTsbScale.IsEnabled() &&
1232 			  aTsbOriginal.IsEnabled() &&
1233 			  aTsbScale.GetSavedValue() != STATE_CHECK ) )
1234 		{
1235 			XFillBmpSizeLogItem* pItem = NULL;
1236 			if( aTsbScale.IsEnabled() )
1237 				pItem = new XFillBmpSizeLogItem( eState == STATE_NOCHECK );
1238 			else if( aTsbOriginal.IsEnabled() && aTsbOriginal.GetState() == STATE_CHECK )
1239 				pItem = new XFillBmpSizeLogItem( sal_True );
1240 
1241 			if( pItem )
1242 			{
1243 				pOld = GetOldItem( rAttrs, XATTR_FILLBMP_SIZELOG );
1244 				if ( !pOld || !( *(const XFillBmpSizeLogItem*)pOld == *pItem ) )
1245 				{
1246 					rAttrs.Put( *pItem );
1247 					bModified = sal_True;
1248 				}
1249 				delete pItem;
1250 			}
1251 		}
1252 
1253 		//aMtrFldXSize
1254 		String aStr = aMtrFldXSize.GetText();
1255 		{
1256 			XFillBmpSizeXItem* pItem = NULL;
1257             TriState eScaleState = aTsbScale.GetState();
1258 
1259 			if( aMtrFldXSize.IsEnabled() &&
1260 				aStr.Len() > 0  &&
1261 				aStr != aMtrFldXSize.GetSavedValue() )
1262 			{
1263                 if( eScaleState == STATE_NOCHECK )
1264 					pItem = new XFillBmpSizeXItem( GetCoreValue( aMtrFldXSize, ePoolUnit ) );
1265 				else
1266 				{
1267 					// Prozentwerte werden negativ gesetzt, damit
1268 					// diese nicht skaliert werden; dieses wird
1269 					// im Item beruecksichtigt ( KA05.11.96 )
1270 					pItem = new XFillBmpSizeXItem( -labs( static_cast<long>(aMtrFldXSize.GetValue()) ) );
1271 				}
1272 			}
1273 			else if( aTsbOriginal.IsEnabled() &&
1274 					 aTsbOriginal.GetState() == STATE_CHECK &&
1275 					 aMtrFldXSize.GetSavedValue().Len() > 0 )
1276 				pItem = new XFillBmpSizeXItem( 0 );
1277 
1278 			if( pItem )
1279 			{
1280 				pOld = GetOldItem( rAttrs, XATTR_FILLBMP_SIZEX );
1281 				if ( !pOld || !( *(const XFillBmpSizeXItem*)pOld == *pItem ) )
1282 				{
1283 					rAttrs.Put( *pItem );
1284 					bModified = sal_True;
1285 				}
1286 				delete pItem;
1287 			}
1288 		}
1289 
1290 		//aMtrFldYSize
1291 		aStr = aMtrFldYSize.GetText();
1292 		{
1293 			XFillBmpSizeYItem* pItem = NULL;
1294             TriState eScaleState = aTsbScale.GetState();
1295 
1296 			if( aMtrFldYSize.IsEnabled() &&
1297 				aStr.Len() > 0  &&
1298 				aStr != aMtrFldYSize.GetSavedValue() )
1299 			{
1300                 if( eScaleState == STATE_NOCHECK )
1301 					pItem = new XFillBmpSizeYItem( GetCoreValue( aMtrFldYSize, ePoolUnit ) );
1302 				else
1303 				{
1304 					// Prozentwerte werden negativ gesetzt, damit
1305 					// diese vom MetricItem nicht skaliert werden;
1306 					// dieses wird im Item beruecksichtigt ( KA05.11.96 )
1307 					pItem = new XFillBmpSizeYItem( -labs( static_cast<long>(aMtrFldYSize.GetValue()) ) );
1308 				}
1309 			}
1310 			else if( aTsbOriginal.IsEnabled() &&
1311 					 aTsbOriginal.GetState() == STATE_CHECK &&
1312 					 aMtrFldYSize.GetSavedValue().Len() > 0 )
1313 				pItem = new XFillBmpSizeYItem( 0 );
1314 
1315 			if( pItem )
1316 			{
1317 				pOld = GetOldItem( rAttrs, XATTR_FILLBMP_SIZEY );
1318 				if ( !pOld || !( *(const XFillBmpSizeYItem*)pOld == *pItem ) )
1319 				{
1320 					rAttrs.Put( *pItem );
1321 					bModified = sal_True;
1322 				}
1323 				delete pItem;
1324 			}
1325 		}
1326 
1327 		//aRbtRow
1328 		//aRbtColumn
1329 		//aMtrFldOffset
1330 		if( aMtrFldOffset.IsEnabled() )
1331 		{
1332             String aMtrString = aMtrFldOffset.GetText();
1333             if( ( aMtrString.Len() > 0  &&
1334                   aMtrString != aMtrFldOffset.GetSavedValue() ) ||
1335 				  aRbtRow.GetSavedValue() != aRbtRow.IsChecked() ||
1336 				  aRbtColumn.GetSavedValue() != aRbtColumn.IsChecked() )
1337 			{
1338 				if( aRbtRow.IsChecked() )
1339 				{
1340                     XFillBmpTileOffsetXItem aFillBmpTileOffsetXItem( (sal_uInt16) aMtrFldOffset.GetValue() );
1341 					pOld = GetOldItem( rAttrs, XATTR_FILLBMP_TILEOFFSETX );
1342                     if ( !pOld || !( *(const XFillBmpTileOffsetXItem*)pOld == aFillBmpTileOffsetXItem ) )
1343 					{
1344                         rAttrs.Put( aFillBmpTileOffsetXItem );
1345 						rAttrs.Put( XFillBmpTileOffsetYItem( 0 ) );
1346 						bModified = sal_True;
1347 					}
1348 				}
1349 				else if( aRbtColumn.IsChecked() )
1350 				{
1351                     XFillBmpTileOffsetYItem aFillBmpTileOffsetYItem( (sal_uInt16) aMtrFldOffset.GetValue() );
1352 					pOld = GetOldItem( rAttrs, XATTR_FILLBMP_TILEOFFSETY );
1353                     if ( !pOld || !( *(const XFillBmpTileOffsetYItem*)pOld == aFillBmpTileOffsetYItem ) )
1354 					{
1355                         rAttrs.Put( aFillBmpTileOffsetYItem );
1356 						rAttrs.Put( XFillBmpTileOffsetXItem( 0 ) );
1357 						bModified = sal_True;
1358 					}
1359 				}
1360 			}
1361 		}
1362 
1363 		//aCtlPosition
1364 		if( aCtlPosition.IsEnabled() )
1365 		{
1366 			sal_Bool bPut = sal_False;
1367             RECT_POINT _eRP = aCtlPosition.GetActualRP();
1368 
1369 			if( SFX_ITEM_DONTCARE == rOutAttrs.GetItemState( XATTR_FILLBMP_POS ) )
1370 				bPut = sal_True;
1371 			else
1372 			{
1373 				RECT_POINT eValue = ( ( const XFillBmpPosItem& ) rOutAttrs.Get( XATTR_FILLBMP_POS ) ).GetValue();
1374                 if( eValue != _eRP )
1375 					bPut = sal_True;
1376 			}
1377 			if( bPut )
1378 			{
1379                 XFillBmpPosItem aFillBmpPosItem( _eRP );
1380 				pOld = GetOldItem( rAttrs, XATTR_FILLBMP_POS );
1381                 if ( !pOld || !( *(const XFillBmpPosItem*)pOld == aFillBmpPosItem ) )
1382 				{
1383                     rAttrs.Put( aFillBmpPosItem );
1384 					bModified = sal_True;
1385 				}
1386 			}
1387 		}
1388 
1389 		//aMtrFldXOffset
1390 		if( aMtrFldXOffset.IsEnabled() )
1391 		{
1392             String sMtrXOffset = aMtrFldXOffset.GetText();
1393             if( sMtrXOffset.Len() > 0  &&
1394                 sMtrXOffset != aMtrFldXOffset.GetSavedValue() )
1395 			{
1396                 XFillBmpPosOffsetXItem aFillBmpPosOffsetXItem( (sal_uInt16) aMtrFldXOffset.GetValue() );
1397 				pOld = GetOldItem( rAttrs, XATTR_FILLBMP_POSOFFSETX );
1398                 if ( !pOld || !( *(const XFillBmpPosOffsetXItem*)pOld == aFillBmpPosOffsetXItem ) )
1399 				{
1400                     rAttrs.Put( aFillBmpPosOffsetXItem );
1401 					bModified = sal_True;
1402 				}
1403 			}
1404 		}
1405 
1406 		//aMtrFldYOffset
1407 		if( aMtrFldYOffset.IsEnabled() )
1408 		{
1409             String sMtrYOffset = aMtrFldYOffset.GetText();
1410             if( sMtrYOffset.Len() > 0  &&
1411                 sMtrYOffset != aMtrFldYOffset.GetSavedValue() )
1412 			{
1413                 XFillBmpPosOffsetYItem aFillBmpPosOffsetYItem( (sal_uInt16) aMtrFldYOffset.GetValue() );
1414 				pOld = GetOldItem( rAttrs, XATTR_FILLBMP_POSOFFSETY );
1415                 if ( !pOld || !( *(const XFillBmpPosOffsetYItem*)pOld == aFillBmpPosOffsetYItem ) )
1416 				{
1417                     rAttrs.Put( aFillBmpPosOffsetYItem );
1418 					bModified = sal_True;
1419 				}
1420 			}
1421 		}
1422 		//add CHINA001  begin
1423 		rAttrs.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
1424 		rAttrs.Put (SfxUInt16Item(SID_TABPAGE_POS,nPos));
1425 		//add CHINA001  end
1426 	}
1427 
1428 	return( bModified );
1429 }
1430 
1431 // -----------------------------------------------------------------------
1432 
1433 void SvxAreaTabPage::Reset( const SfxItemSet& rAttrs )
1434 {
1435 	//const SfxPoolItem *pPoolItem = NULL;
1436 
1437 	XFillStyle eXFS;
1438 	if( rAttrs.GetItemState( XATTR_FILLSTYLE ) != SFX_ITEM_DONTCARE )
1439 	{
1440 		eXFS = (XFillStyle) ( ( ( const XFillStyleItem& ) rAttrs.
1441 								Get( GetWhich( XATTR_FILLSTYLE ) ) ).GetValue() );
1442 	    aTypeLB.SelectEntryPos( sal::static_int_cast< sal_uInt16 >( eXFS ) );
1443 		switch( eXFS )
1444 		{
1445 			case XFILL_NONE:
1446                 ClickInvisibleHdl_Impl( this );
1447 			break;
1448 
1449 			case XFILL_SOLID:
1450 				//if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), sal_True, &pPoolItem ) )
1451 				if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLCOLOR ) )
1452 				{
1453 					XFillColorItem aColorItem( ( const XFillColorItem& )
1454 										rAttrs.Get( XATTR_FILLCOLOR ) );
1455 
1456 					aLbColor.SelectEntry( aColorItem.GetColorValue() );
1457 					aLbHatchBckgrdColor.SelectEntry( aColorItem.GetColorValue() );
1458 				}
1459                 ClickColorHdl_Impl( this );
1460 
1461 			break;
1462 
1463 			case XFILL_GRADIENT:
1464 				//if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), sal_True, &pPoolItem ) )
1465 				if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLGRADIENT ) )
1466 				{
1467 					XFillGradientItem aGradientItem( ( ( const XFillGradientItem& )
1468 											rAttrs.Get( XATTR_FILLGRADIENT ) ) );
1469 					String	  aString( aGradientItem.GetName() );
1470                     XGradient aGradient( aGradientItem.GetGradientValue() );
1471 
1472 					aLbGradient.SelectEntryByList( maGradientList, aString, aGradient );
1473 				}
1474                 ClickGradientHdl_Impl( this );
1475 			break;
1476 
1477 			case XFILL_HATCH:
1478 				//if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), sal_True, &pPoolItem ) )
1479 				if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLHATCH ) )
1480 				{
1481 					aLbHatching.SelectEntry( ( ( const XFillHatchItem& )
1482 									rAttrs.Get( XATTR_FILLHATCH ) ).GetName() );
1483 				}
1484                 ClickHatchingHdl_Impl( this );
1485 
1486                 if ( SFX_ITEM_DONTCARE != rAttrs.GetItemState ( XATTR_FILLBACKGROUND ) )
1487 				{
1488 					aCbxHatchBckgrd.Check ( ( ( const XFillBackgroundItem& ) rAttrs.Get ( XATTR_FILLBACKGROUND ) ).GetValue() );
1489 				}
1490 				ToggleHatchBckgrdColorHdl_Impl( this );
1491 				if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLCOLOR ) )
1492 				{
1493 					XFillColorItem aColorItem( ( const XFillColorItem& )
1494 										rAttrs.Get( XATTR_FILLCOLOR ) );
1495 
1496 					aLbColor.SelectEntry( aColorItem.GetColorValue() );
1497 					aLbHatchBckgrdColor.SelectEntry( aColorItem.GetColorValue() );
1498 				}
1499 			break;
1500 
1501 			case XFILL_BITMAP:
1502 			{
1503 				if( SFX_ITEM_DONTCARE != rAttrs.GetItemState( XATTR_FILLBITMAP ) )
1504 				{
1505 					XFillBitmapItem aBitmapItem( ( const XFillBitmapItem& )
1506 										rAttrs.Get( XATTR_FILLBITMAP ) );
1507 
1508 					String aString( aBitmapItem.GetName() );
1509 					aLbBitmap.SelectEntry( aString );
1510 				}
1511                 ClickBitmapHdl_Impl( this );
1512 			}
1513 			break;
1514 
1515 			default:
1516 				//aLbColor.SelectEntryPos(0);
1517 				//aRbtColor.Check();
1518 			break;
1519 		}
1520 	}
1521 	else
1522 	{
1523 		// Alle LBs nicht zug"anglich machen
1524 		aLbColor.Hide();
1525 		aLbGradient.Hide();
1526 		aLbHatching.Hide();
1527 		aLbBitmap.Hide();
1528 		aCtlBitmapPreview.Hide();
1529 		aLbColor.Disable();
1530 		aLbColor.Show();
1531 
1532 		// Damit Reset() auch mit Zurueck richtig funktioniert
1533 		aTypeLB.SetNoSelection();
1534 	}
1535 
1536 	// Schrittweite
1537 	if( ( rAttrs.GetItemState( XATTR_GRADIENTSTEPCOUNT ) != SFX_ITEM_DONTCARE ) ||
1538 		( rAttrs.GetItemState( XATTR_FILLSTYLE ) != SFX_ITEM_DONTCARE ) )
1539 	{
1540 		aTsbStepCount.EnableTriState( sal_False );
1541 		sal_uInt16 nValue = ( ( const XGradientStepCountItem& ) rAttrs.Get( XATTR_GRADIENTSTEPCOUNT ) ).GetValue();
1542 		if( nValue == 0 )
1543 		{
1544 			aTsbStepCount.SetState( STATE_CHECK );
1545 			aNumFldStepCount.SetText( String() );
1546 		}
1547 		else
1548 		{
1549 			aTsbStepCount.SetState( STATE_NOCHECK );
1550 			aNumFldStepCount.SetValue( nValue );
1551 		}
1552 		ModifyStepCountHdl_Impl( &aTsbStepCount );
1553 	}
1554 	else
1555 	{
1556 		aTsbStepCount.SetState( STATE_DONTKNOW );
1557 		aNumFldStepCount.SetText( String() );
1558 	}
1559 
1560 	// Attribute fuer die Bitmap-Fuellung
1561 
1562 	// Ist Kacheln gesetzt?
1563 	if( rAttrs.GetItemState( XATTR_FILLBMP_TILE ) != SFX_ITEM_DONTCARE )
1564 	{
1565 		aTsbTile.EnableTriState( sal_False );
1566 
1567 		if( ( ( const XFillBmpTileItem& ) rAttrs.Get( XATTR_FILLBMP_TILE ) ).GetValue() )
1568 			aTsbTile.SetState( STATE_CHECK );
1569 		else
1570 			aTsbTile.SetState( STATE_NOCHECK );
1571 	}
1572 	else
1573 		aTsbTile.SetState( STATE_DONTKNOW );
1574 
1575 	// Ist Stretchen gesetzt?
1576 	if( rAttrs.GetItemState( XATTR_FILLBMP_STRETCH ) != SFX_ITEM_DONTCARE )
1577 	{
1578 		aTsbStretch.EnableTriState( sal_False );
1579 
1580 		if( ( ( const XFillBmpStretchItem& ) rAttrs.Get( XATTR_FILLBMP_STRETCH ) ).GetValue() )
1581 			aTsbStretch.SetState( STATE_CHECK );
1582 		else
1583 			aTsbStretch.SetState( STATE_NOCHECK );
1584 	}
1585 	else
1586 		aTsbStretch.SetState( STATE_DONTKNOW );
1587 
1588 
1589 	//aTsbScale
1590 	if( rAttrs.GetItemState( XATTR_FILLBMP_SIZELOG ) != SFX_ITEM_DONTCARE )
1591 	{
1592 		aTsbScale.EnableTriState( sal_False );
1593 
1594 		if( ( ( const XFillBmpSizeLogItem& ) rAttrs.Get( XATTR_FILLBMP_SIZELOG ) ).GetValue() )
1595 			aTsbScale.SetState( STATE_NOCHECK );
1596 		else
1597 			aTsbScale.SetState( STATE_CHECK );
1598 
1599 		ClickScaleHdl_Impl( NULL );
1600 	}
1601 	else
1602 		aTsbScale.SetState( STATE_DONTKNOW );
1603 
1604 
1605 	// Status fuer Originalgroesse ermitteln
1606 	TriState eOriginal = STATE_NOCHECK;
1607 
1608 	//aMtrFldXSize
1609 	if( rAttrs.GetItemState( XATTR_FILLBMP_SIZEX ) != SFX_ITEM_DONTCARE )
1610 	{
1611 		sal_Int32 nValue = ( ( const XFillBmpSizeXItem& ) rAttrs.Get( XATTR_FILLBMP_SIZEX ) ).GetValue();
1612 		if( aTsbScale.GetState() == STATE_CHECK )
1613 		{
1614 			// Wenn im Item eine Prozentangabe steckt,
1615 			// so ist diese wegen des MetricItems negativ
1616 			aMtrFldXSize.SetValue( labs( nValue ) );
1617 		}
1618 		else
1619 			SetMetricValue( aMtrFldXSize, nValue, ePoolUnit );
1620 		aMtrFldXSize.SaveValue();
1621 
1622 		if( nValue == 0 )
1623 		{
1624 			eOriginal = STATE_CHECK;
1625 			// Wert ist beim Ausschalten von Originalgroesse sonst zu klein
1626 			// (Performance-Problem)
1627 			aMtrFldXSize.SetValue( 100 );
1628 		}
1629 	}
1630 	else
1631 	{
1632 		aMtrFldXSize.SetText( String() );
1633 		aMtrFldXSize.SaveValue();
1634 	}
1635 
1636 	//aMtrFldYSize
1637 	if( rAttrs.GetItemState( XATTR_FILLBMP_SIZEY ) != SFX_ITEM_DONTCARE )
1638 	{
1639 		sal_Int32 nValue = ( ( const XFillBmpSizeYItem& ) rAttrs.Get( XATTR_FILLBMP_SIZEY ) ).GetValue();
1640 		if( aTsbScale.GetState() == STATE_CHECK )
1641 		{
1642 			// Wenn im Item eine Prozentangabe steckt,
1643 			// so ist diese wegen des MetricItems negativ
1644 			aMtrFldYSize.SetValue( labs( nValue ) );
1645 		}
1646 		else
1647 			SetMetricValue( aMtrFldYSize, nValue, ePoolUnit );
1648 		aMtrFldYSize.SaveValue();
1649 
1650 		if( nValue == 0 )
1651 			aMtrFldYSize.SetValue( 100 ); //s.o.
1652 		else
1653 			eOriginal = STATE_NOCHECK;
1654 	}
1655 	else
1656 	{
1657 		aMtrFldYSize.SetText( String() );
1658 		aMtrFldYSize.SaveValue();
1659 		eOriginal = STATE_NOCHECK;
1660 	}
1661 
1662 	// aTsbOriginal
1663 	aTsbOriginal.SetState( eOriginal );
1664 
1665     // #93372# Setting proper state after changing button
1666 	ModifyTileHdl_Impl( NULL );
1667 
1668 	//aRbtRow
1669 	//aRbtColumn
1670 	//aMtrFldOffset
1671 	if( rAttrs.GetItemState( XATTR_FILLBMP_TILEOFFSETX ) != SFX_ITEM_DONTCARE )
1672 	{
1673 		sal_uInt16 nValue = ( ( const XFillBmpTileOffsetXItem& ) rAttrs.Get( XATTR_FILLBMP_TILEOFFSETX ) ).GetValue();
1674 		if( nValue > 0 )
1675 		{
1676 			aMtrFldOffset.SetValue( nValue );
1677 			aRbtRow.Check();
1678 		}
1679 		else if( rAttrs.GetItemState( XATTR_FILLBMP_TILEOFFSETY ) != SFX_ITEM_DONTCARE )
1680 		{
1681 			nValue = ( ( const XFillBmpTileOffsetYItem& ) rAttrs.Get( XATTR_FILLBMP_TILEOFFSETY ) ).GetValue();
1682 			if( nValue > 0 )
1683 			{
1684 				aMtrFldOffset.SetValue( nValue );
1685 				aRbtColumn.Check();
1686 			}
1687 		}
1688 		else
1689 			aMtrFldOffset.SetValue( 0 );
1690 	}
1691 	else
1692 		aMtrFldOffset.SetText( String() );
1693 
1694 
1695 	//aCtlPosition
1696 	if( rAttrs.GetItemState( XATTR_FILLBMP_POS ) != SFX_ITEM_DONTCARE )
1697 	{
1698 		RECT_POINT eValue = ( ( const XFillBmpPosItem& ) rAttrs.Get( XATTR_FILLBMP_POS ) ).GetValue();
1699 		aCtlPosition.SetActualRP( eValue );
1700 	}
1701 	else
1702 		aCtlPosition.Reset();
1703 
1704 	//aMtrFldXOffset
1705 	if( rAttrs.GetItemState( XATTR_FILLBMP_POSOFFSETX ) != SFX_ITEM_DONTCARE )
1706 	{
1707 		sal_Int32 nValue = ( ( const XFillBmpPosOffsetXItem& ) rAttrs.Get( XATTR_FILLBMP_POSOFFSETX ) ).GetValue();
1708 		aMtrFldXOffset.SetValue( nValue );
1709 	}
1710 	else
1711 		aMtrFldXOffset.SetText( String() );
1712 
1713 	//aMtrFldYOffset
1714 	if( rAttrs.GetItemState( XATTR_FILLBMP_POSOFFSETY ) != SFX_ITEM_DONTCARE )
1715 	{
1716 		sal_Int32 nValue = ( ( const XFillBmpPosOffsetYItem& ) rAttrs.Get( XATTR_FILLBMP_POSOFFSETY ) ).GetValue();
1717 		aMtrFldYOffset.SetValue( nValue );
1718 	}
1719 	else
1720 		aMtrFldYOffset.SetText( String() );
1721 
1722 	// Erst hier, damit Tile und Stretch mit beruecksichtigt wird
1723     if( aTypeLB.GetSelectEntryPos() == XFILL_BITMAP )
1724 		ClickBitmapHdl_Impl( NULL );
1725 
1726 	// Werte sichern
1727     aTypeLB.SaveValue();
1728 	aLbColor.SaveValue();
1729 	aLbGradient.SaveValue();
1730 	aLbHatching.SaveValue();
1731 	//aCbxHatchBckgrd.SaveValue();
1732 	aLbHatchBckgrdColor.SaveValue();
1733 	aLbBitmap.SaveValue();
1734 //	aLbTransparent.SaveValue();
1735 	aTsbStepCount.SaveValue();
1736 	aNumFldStepCount.SaveValue();
1737 	aTsbTile.SaveValue();
1738 	aTsbStretch.SaveValue();
1739 	aTsbScale.SaveValue();
1740 	aRbtRow.SaveValue();
1741 	aRbtColumn.SaveValue();
1742 	aMtrFldOffset.SaveValue();
1743 	aMtrFldXOffset.SaveValue();
1744 	aMtrFldYOffset.SaveValue();
1745 	//aMtrFldXSize.SaveValue(); <- wird oben behandelt
1746 	//aMtrFldYSize.SaveValue(); <- wird oben behandelt
1747 }
1748 
1749 // -----------------------------------------------------------------------
1750 
1751 SfxTabPage* SvxAreaTabPage::Create( Window* pWindow,
1752 				const SfxItemSet& rAttrs )
1753 {
1754 	return( new SvxAreaTabPage( pWindow, rAttrs ) );
1755 }
1756 
1757 //------------------------------------------------------------------------
1758 
1759 sal_uInt16*	SvxAreaTabPage::GetRanges()
1760 {
1761 	return( pAreaRanges );
1762 }
1763 
1764 //------------------------------------------------------------------------
1765 IMPL_LINK( SvxAreaTabPage, SelectDialogTypeHdl_Impl, ListBox *, EMPTYARG )
1766 {
1767     switch( (XFillStyle)aTypeLB.GetSelectEntryPos() )
1768     {
1769         case XFILL_NONE: ClickInvisibleHdl_Impl( this ); break;
1770         case XFILL_SOLID: ClickColorHdl_Impl( this ); break;
1771         case XFILL_GRADIENT: ClickGradientHdl_Impl( this ); break;
1772         case XFILL_HATCH: ClickHatchingHdl_Impl( this ); break;
1773         case XFILL_BITMAP: ClickBitmapHdl_Impl( this ); break;
1774     }
1775 
1776     return 0;
1777 }
1778 
1779 IMPL_LINK( SvxAreaTabPage, ClickInvisibleHdl_Impl, void *, EMPTYARG )
1780 {
1781 	aTsbTile.Hide();
1782 	aTsbStretch.Hide();
1783 	aTsbScale.Hide();
1784 	aTsbOriginal.Hide();
1785 	aFtXSize.Hide();
1786 	aMtrFldXSize.Hide();
1787 	aFtYSize.Hide();
1788 	aMtrFldYSize.Hide();
1789     aFlSize.Hide();
1790 	aRbtRow.Hide();
1791 	aRbtColumn.Hide();
1792 	aMtrFldOffset.Hide();
1793     aFlOffset.Hide();
1794 	aCtlPosition.Hide();
1795 	aFtXOffset.Hide();
1796 	aMtrFldXOffset.Hide();
1797 	aFtYOffset.Hide();
1798 	aMtrFldYOffset.Hide();
1799     aFlPosition.Hide();
1800 
1801     aLbColor.Hide();
1802 	aLbGradient.Hide();
1803 	aLbHatching.Hide();
1804 	aLbBitmap.Hide();
1805     aCtlXRectPreview.Hide();
1806 	aCtlBitmapPreview.Hide();
1807 
1808     aFlStepCount.Hide();
1809 	aTsbStepCount.Hide();
1810 	aNumFldStepCount.Hide();
1811 
1812     // Controls for Hatch-Background
1813     aCbxHatchBckgrd.Hide();
1814     aLbHatchBckgrdColor.Hide();
1815 
1816 	rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
1817 	aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
1818 	aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() );
1819 
1820 	aCtlXRectPreview.Invalidate();
1821 	aCtlBitmapPreview.Invalidate();
1822 
1823 	return( 0L );
1824 }
1825 
1826 //------------------------------------------------------------------------
1827 
1828 IMPL_LINK( SvxAreaTabPage, ClickColorHdl_Impl, void *, EMPTYARG )
1829 {
1830 	aTsbTile.Hide();
1831 	aTsbStretch.Hide();
1832 	aTsbScale.Hide();
1833 	aTsbOriginal.Hide();
1834 	aFtXSize.Hide();
1835 	aMtrFldXSize.Hide();
1836 	aFtYSize.Hide();
1837 	aMtrFldYSize.Hide();
1838     aFlSize.Hide();
1839 	aRbtRow.Hide();
1840 	aRbtColumn.Hide();
1841 	aMtrFldOffset.Hide();
1842     aFlOffset.Hide();
1843 	aCtlPosition.Hide();
1844 	aFtXOffset.Hide();
1845 	aMtrFldXOffset.Hide();
1846 	aFtYOffset.Hide();
1847 	aMtrFldYOffset.Hide();
1848     aFlPosition.Hide();
1849 
1850 	aLbColor.Enable();
1851 	aLbColor.Show();
1852 	aLbGradient.Hide();
1853 	aLbHatching.Hide();
1854 	aLbBitmap.Hide();
1855 	aCtlXRectPreview.Enable();
1856 	aCtlXRectPreview.Show();
1857 	aCtlBitmapPreview.Hide();
1858 
1859     aFlStepCount.Hide();
1860 	aTsbStepCount.Hide();
1861 	aNumFldStepCount.Hide();
1862 
1863 	// Controls for Hatch-Background
1864 	aCbxHatchBckgrd.Hide();
1865 	aLbHatchBckgrdColor.Hide();
1866 
1867 	// Text der Tabelle setzen
1868 	String			aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
1869 	INetURLObject	aURL( maColorTab->GetPath() );
1870 
1871 	aURL.Append( maColorTab->GetName() );
1872 	DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
1873 
1874 	if( aURL.getBase().getLength() > 18 )
1875 	{
1876 		aString += String(aURL.getBase()).Copy( 0, 15 );
1877 		aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
1878 	}
1879 	else
1880 		aString += String(aURL.getBase());
1881 
1882 	ModifyColorHdl_Impl( this );
1883 	return( 0L );
1884 }
1885 
1886 //------------------------------------------------------------------------
1887 
1888 IMPL_LINK( SvxAreaTabPage, ModifyColorHdl_Impl, void *, EMPTYARG )
1889 {
1890 	const SfxPoolItem* pPoolItem = NULL;
1891     sal_uInt16 _nPos = aLbColor.GetSelectEntryPos();
1892     aLbHatchBckgrdColor.SelectEntryPos( _nPos );
1893     if( _nPos != LISTBOX_ENTRY_NOTFOUND )
1894 	{
1895 		rXFSet.Put( XFillStyleItem( XFILL_SOLID ) );
1896 		rXFSet.Put( XFillColorItem( String(),
1897 									aLbColor.GetSelectEntryColor() ) );
1898 	}
1899 	// NEU
1900 	else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), sal_True, &pPoolItem ) )
1901 	{
1902 		rXFSet.Put( XFillStyleItem( XFILL_SOLID ) );
1903         Color aColor( ( ( const XFillColorItem* ) pPoolItem )->GetColorValue() );
1904 		rXFSet.Put( XFillColorItem( String(), aColor ) );
1905 	}
1906 	else
1907 		rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
1908 
1909 	aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
1910 	aCtlXRectPreview.Invalidate();
1911 
1912 	return( 0L );
1913 }
1914 //------------------------------------------------------------------------
1915 
1916 IMPL_LINK( SvxAreaTabPage, ClickGradientHdl_Impl, void *, EMPTYARG )
1917 {
1918 	aTsbTile.Hide();
1919 	aTsbStretch.Hide();
1920 	aTsbScale.Hide();
1921 	aTsbOriginal.Hide();
1922 	aFtXSize.Hide();
1923 	aMtrFldXSize.Hide();
1924 	aFtYSize.Hide();
1925 	aMtrFldYSize.Hide();
1926     aFlSize.Hide();
1927 	aRbtRow.Hide();
1928 	aRbtColumn.Hide();
1929 	aMtrFldOffset.Hide();
1930     aFlOffset.Hide();
1931 	aCtlPosition.Hide();
1932 	aFtXOffset.Hide();
1933 	aMtrFldXOffset.Hide();
1934 	aFtYOffset.Hide();
1935 	aMtrFldYOffset.Hide();
1936     aFlPosition.Hide();
1937 
1938 	aLbColor.Hide();
1939 	aLbGradient.Enable();
1940 	aLbGradient.Show();
1941 	aLbHatching.Hide();
1942 	aLbBitmap.Hide();
1943 	aCtlXRectPreview.Enable();
1944 	aCtlXRectPreview.Show();
1945 	aCtlBitmapPreview.Hide();
1946 
1947     aFlStepCount.Enable();
1948     aFlStepCount.Show();
1949 	aTsbStepCount.Enable();
1950 	aTsbStepCount.Show();
1951 	aNumFldStepCount.Show();
1952 
1953 	// Controls for Hatch-Background
1954 	aCbxHatchBckgrd.Hide();
1955 	aLbHatchBckgrdColor.Hide();
1956 
1957 	// Text der Tabelle setzen
1958 	String			aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
1959 	INetURLObject	aURL( maGradientList->GetPath() );
1960 
1961 	aURL.Append( maGradientList->GetName() );
1962 	DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
1963 
1964 	if( aURL.getBase().getLength() > 18 )
1965 	{
1966 		aString += String(aURL.getBase()).Copy( 0, 15 );
1967 		aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
1968 	}
1969 	else
1970 		aString += String(aURL.getBase());
1971 
1972 	ModifyGradientHdl_Impl( this );
1973 	ModifyStepCountHdl_Impl( &aTsbStepCount );
1974 	return( 0L );
1975 }
1976 
1977 //------------------------------------------------------------------------
1978 
1979 IMPL_LINK( SvxAreaTabPage, ModifyGradientHdl_Impl, void *, EMPTYARG )
1980 {
1981 	const SfxPoolItem* pPoolItem = NULL;
1982     sal_uInt16 _nPos = aLbGradient.GetSelectEntryPos();
1983     if( _nPos != LISTBOX_ENTRY_NOTFOUND )
1984 	{
1985 		// ItemSet fuellen und an aCtlXRectPreview weiterleiten
1986         XGradientEntry* pEntry = maGradientList->GetGradient( _nPos );
1987 
1988 		rXFSet.Put( XFillStyleItem( XFILL_GRADIENT ) );
1989 		rXFSet.Put( XFillGradientItem( String(),
1990 									   pEntry->GetGradient() ) );
1991 	}
1992 	// NEU
1993 	else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLGRADIENT ), sal_True, &pPoolItem ) )
1994 	{
1995 		rXFSet.Put( XFillStyleItem( XFILL_GRADIENT ) );
1996         rXFSet.Put( XFillGradientItem( String(), ( ( const XFillGradientItem* ) pPoolItem )->GetGradientValue() ) );
1997 	}
1998 	else
1999 		rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
2000 
2001 	aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
2002 	aCtlXRectPreview.Invalidate();
2003 
2004 	return( 0L );
2005 }
2006 
2007 //------------------------------------------------------------------------
2008 
2009 IMPL_LINK( SvxAreaTabPage, ClickHatchingHdl_Impl, void *, EMPTYARG )
2010 {
2011 	aLbColor.Hide();
2012 	aLbGradient.Hide();
2013 	aLbHatching.Enable();
2014 	aLbHatching.Show();
2015 	aLbBitmap.Hide();
2016 	aCtlXRectPreview.Enable();
2017 	aCtlXRectPreview.Show();
2018 	aCtlBitmapPreview.Hide();
2019 
2020 //	aGrpTransparent.Hide();
2021 //	aLbTransparent.Hide();
2022     aFlStepCount.Hide();
2023 	aTsbStepCount.Hide();
2024 	aNumFldStepCount.Hide();
2025 
2026 	aTsbTile.Hide();
2027 	aTsbStretch.Hide();
2028 	aTsbScale.Hide();
2029 	aTsbOriginal.Hide();
2030 	aFtXSize.Hide();
2031 	aMtrFldXSize.Hide();
2032 	aFtYSize.Hide();
2033 	aMtrFldYSize.Hide();
2034     aFlSize.Hide();
2035 	aRbtRow.Hide();
2036 	aRbtColumn.Hide();
2037 	aMtrFldOffset.Hide();
2038     aFlOffset.Hide();
2039 	aCtlPosition.Hide();
2040 	aFtXOffset.Hide();
2041 	aMtrFldXOffset.Hide();
2042 	aFtYOffset.Hide();
2043 	aMtrFldYOffset.Hide();
2044     aFlPosition.Hide();
2045 
2046 	// Controls for Hatch-Background
2047 	aCbxHatchBckgrd.Show();
2048 	aLbHatchBckgrdColor.Show();
2049 	aCbxHatchBckgrd.Enable();
2050 	aLbHatchBckgrdColor.Enable();
2051 
2052 	// Text der Tabelle setzen
2053 	String			aString( CUI_RES( RID_SVXSTR_TABLE ) ); 	aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
2054 	INetURLObject	aURL( maHatchingList->GetPath() );
2055 
2056 	aURL.Append( maHatchingList->GetName() );
2057 	DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
2058 
2059 	if( aURL.getBase().getLength() > 18 )
2060 	{
2061 		aString += String(String(aURL.getBase()).Copy( 0, 15 ));
2062 		aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
2063 	}
2064 	else
2065 		aString += String(aURL.getBase());
2066 
2067 	ModifyHatchingHdl_Impl( this );
2068 	ModifyHatchBckgrdColorHdl_Impl( this );
2069 	ToggleHatchBckgrdColorHdl_Impl( this );
2070 
2071 	return( 0L );
2072 }
2073 
2074 //------------------------------------------------------------------------
2075 
2076 IMPL_LINK( SvxAreaTabPage, ModifyHatchingHdl_Impl, void *, EMPTYARG )
2077 {
2078 	const SfxPoolItem* pPoolItem = NULL;
2079     sal_uInt16 _nPos = aLbHatching.GetSelectEntryPos();
2080     if( _nPos != LISTBOX_ENTRY_NOTFOUND )
2081 	{
2082 		// ItemSet fuellen und an aCtlXRectPreview weiterleiten
2083         XHatchEntry* pEntry = maHatchingList->GetHatch( _nPos );
2084 
2085 		rXFSet.Put( XFillStyleItem( XFILL_HATCH ) );
2086 		rXFSet.Put( XFillHatchItem( String(), pEntry->GetHatch() ) );
2087 	}
2088 	// NEU
2089 	else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLHATCH ), sal_True, &pPoolItem ) )
2090 	{
2091 		rXFSet.Put( XFillStyleItem( XFILL_HATCH ) );
2092         rXFSet.Put( XFillHatchItem( String(), ( ( const XFillHatchItem* ) pPoolItem )->GetHatchValue() ) );
2093 	}
2094 	else
2095 		rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
2096 
2097 	aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
2098 	aCtlXRectPreview.Invalidate();
2099 
2100 	return( 0L );
2101 }
2102 
2103 //------------------------------------------------------------------------
2104 
2105 IMPL_LINK( SvxAreaTabPage, ModifyHatchBckgrdColorHdl_Impl, void *, EMPTYARG )
2106 {
2107 	const SfxPoolItem* pPoolItem = NULL;
2108     sal_uInt16 _nPos = aLbHatchBckgrdColor.GetSelectEntryPos();
2109     aLbColor.SelectEntryPos( _nPos );
2110     if( _nPos != LISTBOX_ENTRY_NOTFOUND )
2111 	{
2112 //		rXFSet.Put( XFillStyleItem( XFILL_SOLID ) );
2113 		rXFSet.Put( XFillColorItem( String(),
2114 									aLbHatchBckgrdColor.GetSelectEntryColor() ) );
2115 	}
2116 	// NEU
2117 	else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLCOLOR ), sal_True, &pPoolItem ) )
2118 	{
2119 //		rXFSet.Put( XFillStyleItem( XFILL_SOLID ) );
2120         Color aColor( ( ( const XFillColorItem* ) pPoolItem )->GetColorValue() );
2121 		rXFSet.Put( XFillColorItem( String(), aColor ) );
2122 	}
2123 	else
2124 		rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
2125 
2126 	aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
2127 	aCtlXRectPreview.Invalidate();
2128 
2129 	return( 0L );
2130 }
2131 
2132 //------------------------------------------------------------------------
2133 
2134 IMPL_LINK( SvxAreaTabPage, ToggleHatchBckgrdColorHdl_Impl, void *, EMPTYARG )
2135 {
2136 	// switch on/off backgroundcolor for hatches
2137 	aLbHatchBckgrdColor.Enable( aCbxHatchBckgrd.IsChecked() );
2138 
2139 	XFillBackgroundItem aItem( aCbxHatchBckgrd.IsChecked() );
2140 	rXFSet.Put ( aItem, XATTR_FILLBACKGROUND );
2141 
2142 	aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
2143 	aCtlXRectPreview.Invalidate();
2144 
2145 	if( aLbHatchBckgrdColor.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND )
2146 	{
2147 		if ( SFX_ITEM_SET == rOutAttrs.GetItemState( XATTR_FILLCOLOR ) )//>= SFX_ITEM_DEFAULT )
2148 		{
2149 			XFillColorItem aColorItem( (const XFillColorItem&)rOutAttrs.Get( XATTR_FILLCOLOR ) );
2150 			aLbHatchBckgrdColor.SelectEntry( aColorItem.GetColorValue() );
2151 		}
2152 	}
2153 
2154 	return( 0L );
2155 }
2156 
2157 //------------------------------------------------------------------------
2158 
2159 IMPL_LINK( SvxAreaTabPage, ClickBitmapHdl_Impl, void *, EMPTYARG )
2160 {
2161 	aLbColor.Hide();
2162 	aLbGradient.Hide();
2163 	aLbHatching.Hide();
2164 	aLbBitmap.Enable();
2165 	aLbBitmap.Show();
2166 	aCtlBitmapPreview.Enable();
2167 	aCtlBitmapPreview.Show();
2168 	aCtlXRectPreview.Hide();
2169 //  	aGrpPreview.Hide();
2170 //	aGrpTransparent.Hide();
2171 //	aLbTransparent.Hide();
2172     aFlStepCount.Hide();
2173 	aTsbStepCount.Hide();
2174 	aNumFldStepCount.Hide();
2175 
2176 	aTsbTile.Enable();
2177 	aTsbStretch.Enable();
2178 	aTsbScale.Enable();
2179 	aTsbOriginal.Enable();
2180 	aFtXSize.Enable();
2181 	aMtrFldXSize.Enable();
2182 	aFtYSize.Enable();
2183 	aMtrFldYSize.Enable();
2184     aFlSize.Enable();
2185 	aCtlPosition.Enable();
2186 	aFtXOffset.Enable();
2187 	aMtrFldXOffset.Enable();
2188 	aFtYOffset.Enable();
2189 	aMtrFldYOffset.Enable();
2190     aFlPosition.Enable();
2191 	aRbtRow.Enable();
2192 	aRbtColumn.Enable();
2193 	aMtrFldOffset.Enable();
2194     aFlOffset.Enable();
2195 
2196 	// Controls for Hatch-Background
2197 	aCbxHatchBckgrd.Hide();
2198 	aLbHatchBckgrdColor.Hide();
2199 
2200 	aTsbTile.Show();
2201 	aTsbStretch.Show();
2202 	aTsbScale.Show();
2203 	aTsbOriginal.Show();
2204 	aFtXSize.Show();
2205 	aMtrFldXSize.Show();
2206 	aFtYSize.Show();
2207 	aMtrFldYSize.Show();
2208     aFlSize.Show();
2209 	aCtlPosition.Show();
2210 	aFtXOffset.Show();
2211 	aMtrFldXOffset.Show();
2212 	aFtYOffset.Show();
2213 	aMtrFldYOffset.Show();
2214     aFlPosition.Show();
2215 	aRbtRow.Show();
2216 	//Solution:Check one when initializing.
2217 	if(!aRbtRow.IsChecked()&&!aRbtColumn.IsChecked())
2218 	        aRbtRow.Check();
2219 	aRbtColumn.Show();
2220 	aMtrFldOffset.Show();
2221     aFlOffset.Show();
2222 
2223 	// Text der Tabelle setzen
2224 	String			aString( CUI_RES( RID_SVXSTR_TABLE ) ); 	aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
2225 	INetURLObject	aURL( maBitmapList->GetPath() );
2226 
2227 	aURL.Append( maBitmapList->GetName() );
2228 	DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
2229 
2230 	if( aURL.getBase().getLength() > 18 )
2231 	{
2232 		aString += String(aURL.getBase()).Copy( 0, 15 );
2233 		aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
2234 	}
2235 	else
2236 		aString += String(aURL.getBase());
2237 
2238 	ModifyBitmapHdl_Impl( this );
2239 	ModifyTileHdl_Impl( &aTsbOriginal );
2240 	return( 0L );
2241 }
2242 
2243 //------------------------------------------------------------------------
2244 
2245 IMPL_LINK( SvxAreaTabPage, ModifyBitmapHdl_Impl, void *, EMPTYARG )
2246 {
2247 	const SfxPoolItem* pPoolItem = NULL;
2248     sal_uInt16 _nPos = aLbBitmap.GetSelectEntryPos();
2249     if( _nPos != LISTBOX_ENTRY_NOTFOUND )
2250 	{
2251 		// ItemSet fuellen und an aCtlXRectPreview weiterleiten
2252         const XBitmapEntry* pEntry = maBitmapList->GetBitmap(_nPos);
2253 
2254 		rXFSet.Put(XFillStyleItem(XFILL_BITMAP));
2255 		rXFSet.Put(XFillBitmapItem(String(), pEntry->GetGraphicObject()));
2256 	}
2257 	// NEU
2258 	else if( SFX_ITEM_SET == rOutAttrs.GetItemState( GetWhich( XATTR_FILLBITMAP ), sal_True, &pPoolItem ) )
2259 	{
2260 		rXFSet.Put(XFillStyleItem(XFILL_BITMAP));
2261         rXFSet.Put(XFillBitmapItem(String(), ((const XFillBitmapItem*)pPoolItem)->GetGraphicObject()));
2262 	}
2263 	else
2264 		rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
2265 
2266 	aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() );
2267 	aCtlBitmapPreview.Invalidate();
2268 
2269 	return( 0L );
2270 }
2271 
2272 //------------------------------------------------------------------------
2273 
2274 //IMPL_LINK( SvxAreaTabPage, ModifyTransparentHdl_Impl, void *, EMPTYARG )
2275 //{
2276 //	sal_uInt16 nPos = aLbTransparent.GetSelectEntryPos();
2277 //	if( nPos != LISTBOX_ENTRY_NOTFOUND )
2278 //	{
2279 //		XFillTransparenceItem aItem( nPos * 25 );
2280 //
2281 //		rXFSet.Put( XFillTransparenceItem( aItem ) );
2282 //		aCtlXRectPreview.SetAttributes( aXFillAttr );
2283 //
2284 //		aCtlXRectPreview.Invalidate();
2285 //	}
2286 //
2287 //	return( 0L );
2288 //}
2289 
2290 //------------------------------------------------------------------------
2291 
2292 IMPL_LINK( SvxAreaTabPage, ModifyStepCountHdl_Impl, void *, p )
2293 {
2294 	if( p == &aTsbStepCount )
2295 	{
2296 		if( aTsbStepCount.GetState() == STATE_NOCHECK )
2297 		{
2298 			if( aNumFldStepCount.GetText().Len() == 0 )
2299 				aNumFldStepCount.SetText( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "64") ));
2300 
2301 			aNumFldStepCount.Enable();
2302 		}
2303 		else
2304 			aNumFldStepCount.Disable();
2305 	}
2306 
2307 	sal_uInt16 nValue = 0;
2308 	if( aTsbStepCount.GetState() != STATE_CHECK )
2309 	{
2310 		// Zustand != Disabled ?
2311 		if( aNumFldStepCount.GetText().Len() > 0 )
2312 			nValue = (sal_uInt16) aNumFldStepCount.GetValue();
2313 	}
2314 	rXFSet.Put( XGradientStepCountItem( nValue ) );
2315 	aCtlXRectPreview.SetAttributes( aXFillAttr.GetItemSet() );
2316 	aCtlXRectPreview.Invalidate();
2317 
2318 	return( 0L );
2319 }
2320 
2321 //------------------------------------------------------------------------
2322 
2323 IMPL_LINK( SvxAreaTabPage, ModifyTileHdl_Impl, void *, EMPTYARG )
2324 {
2325 	TriState eState = aTsbTile.GetState();
2326 	if( eState == STATE_CHECK )
2327 	{
2328 		aTsbStretch.Disable();
2329 		aRbtRow.Enable();
2330 		aRbtColumn.Enable();
2331 		aMtrFldOffset.Enable();
2332         aFlOffset.Enable();
2333 
2334 		aCtlPosition.Enable();
2335 		aCtlPosition.Invalidate();
2336 		aFtXOffset.Enable();
2337 		aMtrFldXOffset.Enable();
2338 		aFtYOffset.Enable();
2339 		aMtrFldYOffset.Enable();
2340         aFlPosition.Enable();
2341 
2342 		aTsbScale.Enable();
2343 		aTsbOriginal.Enable();
2344 		aFtXSize.Enable();
2345 		aMtrFldXSize.Enable();
2346 		aFtYSize.Enable();
2347 		aMtrFldYSize.Enable();
2348         aFlSize.Enable();
2349 	}
2350 	else if( eState == STATE_NOCHECK )
2351 	{
2352 		aTsbStretch.Enable();
2353 		aRbtRow.Disable();
2354 		aRbtColumn.Disable();
2355 		aMtrFldOffset.Disable();
2356         aFlOffset.Disable();
2357 
2358 		aCtlPosition.Disable();
2359 		aCtlPosition.Invalidate();
2360 		aFtXOffset.Disable();
2361 		aMtrFldXOffset.Disable();
2362 		aFtYOffset.Disable();
2363 		aMtrFldYOffset.Disable();
2364         aFlPosition.Disable();
2365 
2366 		if( aTsbStretch.GetState() != STATE_NOCHECK )
2367 		{
2368 			aTsbScale.Disable();
2369 			aTsbOriginal.Disable();
2370 			aFtXSize.Disable();
2371 			aMtrFldXSize.Disable();
2372 			aFtYSize.Disable();
2373 			aMtrFldYSize.Disable();
2374             aFlSize.Disable();
2375 		}
2376 		else
2377 		{
2378 			aTsbScale.Enable();
2379 			aTsbOriginal.Enable();
2380 			aFtXSize.Enable();
2381 			aMtrFldXSize.Enable();
2382 			aFtYSize.Enable();
2383 			aMtrFldYSize.Enable();
2384             aFlSize.Enable();
2385 		}
2386 	}
2387 	else
2388 	{
2389 		aTsbStretch.Disable();
2390 		aRbtRow.Disable();
2391 		aRbtColumn.Disable();
2392 		aMtrFldOffset.Disable();
2393         aFlOffset.Disable();
2394 
2395 		aCtlPosition.Disable();
2396 		aCtlPosition.Invalidate();
2397 		aFtXOffset.Disable();
2398 		aMtrFldXOffset.Disable();
2399 		aFtYOffset.Disable();
2400 		aMtrFldYOffset.Disable();
2401         aFlPosition.Disable();
2402 
2403 		aTsbScale.Disable();
2404 		aTsbOriginal.Disable();
2405 		aFtXSize.Disable();
2406 		aMtrFldXSize.Disable();
2407 		aFtYSize.Disable();
2408 		aMtrFldYSize.Disable();
2409         aFlSize.Disable();
2410 	}
2411 
2412 	if( aTsbOriginal.GetState() == STATE_CHECK )
2413 	{
2414 		aMtrFldXSize.SetText( String() );
2415 		aMtrFldYSize.SetText( String() );
2416 		aFtXSize.Disable();
2417 		aFtYSize.Disable();
2418 		aMtrFldXSize.Disable();
2419 		aMtrFldYSize.Disable();
2420 		aTsbScale.Disable();
2421 	}
2422 	else
2423 	{
2424 		aMtrFldXSize.SetValue( aMtrFldXSize.GetValue() );
2425 		aMtrFldYSize.SetValue( aMtrFldYSize.GetValue() );
2426 		/*
2427 		if( eState == STATE_CHECK )
2428 		{
2429 			aFtXSize.Enable();
2430 			aFtYSize.Enable();
2431 			aMtrFldXSize.Enable();
2432 			aMtrFldYSize.Enable();
2433 		}
2434 		*/
2435 	}
2436 
2437 	rXFSet.Put( XFillBmpTileItem( sal::static_int_cast< sal_Bool >( eState ) ) );
2438 
2439 	if( aTsbStretch.IsEnabled() )
2440 		rXFSet.Put(
2441             XFillBmpStretchItem(
2442                 sal::static_int_cast< sal_Bool >( aTsbStretch.GetState() ) ) );
2443 
2444 	if( aTsbScale.IsEnabled() )
2445 		rXFSet.Put( XFillBmpSizeLogItem( aTsbScale.GetState() == STATE_NOCHECK ) );
2446 
2447 	if( aMtrFldXSize.IsEnabled() )
2448 	{
2449 		XFillBmpSizeXItem* pItem = NULL;
2450         TriState eScaleState = aTsbScale.GetState();
2451 
2452         if( eScaleState == STATE_NOCHECK )
2453 			pItem = new XFillBmpSizeXItem( GetCoreValue( aMtrFldXSize, ePoolUnit ) );
2454 		else
2455 			pItem = new XFillBmpSizeXItem( -labs( static_cast<long>(aMtrFldXSize.GetValue()) ) );
2456 
2457 		rXFSet.Put( *pItem );
2458 
2459 		delete pItem;
2460 	}
2461 	else if( aTsbOriginal.IsEnabled() && aTsbOriginal.GetState() == STATE_CHECK )
2462 	{
2463 		// Originalgroesse -> Size == 0
2464 		rXFSet.Put( XFillBmpSizeXItem( 0 ) );
2465 		rXFSet.Put( XFillBmpSizeLogItem( sal_True ) );
2466 	}
2467 
2468 	if( aMtrFldYSize.IsEnabled() )
2469 	{
2470 		XFillBmpSizeYItem* pItem = NULL;
2471         TriState eScaleState = aTsbScale.GetState();
2472 
2473         if( eScaleState == STATE_NOCHECK )
2474 			pItem = new XFillBmpSizeYItem( GetCoreValue( aMtrFldYSize, ePoolUnit ) );
2475 		else
2476 			pItem = new XFillBmpSizeYItem( -labs( static_cast<long>(aMtrFldYSize.GetValue()) ) );
2477 
2478 		rXFSet.Put( *pItem );
2479 
2480 		delete pItem;
2481 	}
2482 	else if( aTsbOriginal.IsEnabled() && aTsbOriginal.GetState() == STATE_CHECK )
2483 	{
2484 		// Originalgroesse -> Size == 0
2485 		rXFSet.Put( XFillBmpSizeYItem( 0 ) );
2486 		rXFSet.Put( XFillBmpSizeLogItem( sal_True ) );
2487 	}
2488 
2489 	if( aMtrFldOffset.IsEnabled() )
2490 	{
2491 		if( aRbtRow.IsChecked() )
2492 		{
2493 			rXFSet.Put( XFillBmpTileOffsetXItem( (sal_uInt16) aMtrFldOffset.GetValue() ) );
2494 			rXFSet.Put( XFillBmpTileOffsetYItem( (sal_uInt16) 0 ) );
2495 		}
2496 		else if( aRbtColumn.IsChecked() )
2497 		{
2498 			rXFSet.Put( XFillBmpTileOffsetXItem( (sal_uInt16) 0 ) );
2499 			rXFSet.Put( XFillBmpTileOffsetYItem( (sal_uInt16) aMtrFldOffset.GetValue() ) );
2500 		}
2501 	}
2502 
2503 	if( aCtlPosition.IsEnabled() )
2504 		rXFSet.Put( XFillBmpPosItem( aCtlPosition.GetActualRP() ) );
2505 
2506 	if( aMtrFldXOffset.IsEnabled() )
2507 		rXFSet.Put( XFillBmpPosOffsetXItem( (sal_uInt16) aMtrFldXOffset.GetValue() ) );
2508 
2509 	if( aMtrFldYOffset.IsEnabled() )
2510 		rXFSet.Put( XFillBmpPosOffsetYItem( (sal_uInt16) aMtrFldYOffset.GetValue() ) );
2511 
2512 
2513 	aCtlBitmapPreview.SetAttributes( aXFillAttr.GetItemSet() );
2514 	aCtlBitmapPreview.Invalidate();
2515 
2516 	return( 0L );
2517 }
2518 
2519 //------------------------------------------------------------------------
2520 
2521 IMPL_LINK( SvxAreaTabPage, ClickScaleHdl_Impl, void *, EMPTYARG )
2522 {
2523 	if( aTsbScale.GetState() == STATE_CHECK )
2524 	{
2525 		aMtrFldXSize.SetDecimalDigits( 0 );
2526 		aMtrFldXSize.SetUnit( FUNIT_PERCENT );
2527 		aMtrFldXSize.SetValue( 100 );
2528         aMtrFldXSize.SetMax( 100 );
2529 		aMtrFldXSize.SetLast( 100 );
2530 
2531 		aMtrFldYSize.SetDecimalDigits( 0 );
2532 		aMtrFldYSize.SetUnit( FUNIT_PERCENT );
2533 		aMtrFldYSize.SetValue( 100 );
2534         aMtrFldYSize.SetMax( 100 );
2535 		aMtrFldYSize.SetLast( 100 );
2536 	}
2537 	else
2538 	{
2539 		aMtrFldXSize.SetDecimalDigits( 2 );
2540 		aMtrFldXSize.SetUnit( eFUnit );
2541 		aMtrFldXSize.SetValue( 100 );
2542         aMtrFldXSize.SetMax( 999900 );
2543 		aMtrFldXSize.SetLast( 100000 );
2544 
2545 		aMtrFldYSize.SetDecimalDigits( 2 );
2546 		aMtrFldYSize.SetUnit( eFUnit );
2547 		aMtrFldYSize.SetValue( 100 );
2548         aMtrFldYSize.SetMax( 999900 );
2549 		aMtrFldYSize.SetLast( 100000 );
2550 	}
2551 
2552 	ModifyTileHdl_Impl( NULL );
2553 
2554 	return( 0L );
2555 }
2556 
2557 //------------------------------------------------------------------------
2558 
2559 void SvxAreaTabPage::PointChanged( Window* pWindow, RECT_POINT eRcPt )
2560 {
2561 	eRP = eRcPt;
2562 
2563 	// Ausrichtung der Bitmapfuellung
2564 	ModifyTileHdl_Impl( pWindow );
2565 }
2566 
2567 void SvxAreaTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
2568 {
2569 	SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False);
2570 	SFX_ITEMSET_ARG (&aSet,pGradientListItem,SvxGradientListItem,SID_GRADIENT_LIST,sal_False);
2571 	SFX_ITEMSET_ARG (&aSet,pHatchingListItem,SvxHatchListItem,SID_HATCH_LIST,sal_False);
2572 	SFX_ITEMSET_ARG (&aSet,pBitmapListItem,SvxBitmapListItem,SID_BITMAP_LIST,sal_False);
2573 	SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
2574 	SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False);
2575 	SFX_ITEMSET_ARG (&aSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,sal_False);
2576 
2577 	if (pColorTabItem)
2578 		SetColorTable(pColorTabItem->GetColorTable());
2579 	if (pGradientListItem)
2580 		SetGradientList(pGradientListItem->GetGradientList());
2581 	if (pHatchingListItem)
2582 		SetHatchingList(pHatchingListItem->GetHatchList());
2583 	if (pBitmapListItem)
2584 		SetBitmapList(pBitmapListItem->GetBitmapList());
2585 	if (pPageTypeItem)
2586 		SetPageType(pPageTypeItem->GetValue());
2587 	if (pDlgTypeItem)
2588 		SetDlgType(pDlgTypeItem->GetValue());
2589 	if (pPosItem)
2590 		SetPos(pPosItem->GetValue());
2591 	Construct();
2592 }
2593 
2594