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