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