xref: /aoo4110/main/cui/source/tabpages/tpshadow.cxx (revision b1cdbd2c)
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 <sfx2/app.hxx>
30 #include <sfx2/module.hxx>
31 #include <svx/dialogs.hrc>
32 
33 #define _SVX_TPSHADOW_CXX
34 
35 #include "svx/xattr.hxx"
36 #include <svx/xpool.hxx>
37 #include <cuires.hrc>
38 #include "tabarea.hrc"
39 #include <svx/svdattr.hxx>
40 #include "svx/drawitem.hxx"
41 #include "cuitabarea.hxx"
42 #include <dialmgr.hxx>
43 #include "svx/dlgutil.hxx"
44 #include <cuitabline.hxx>
45 #include "paragrph.hrc"
46 #include <svx/xlineit0.hxx>
47 #include <sfx2/request.hxx> //add CHINA001
48 
49 #define DLGWIN this->GetParent()->GetParent()
50 
51 // static ----------------------------------------------------------------
52 
53 static sal_uInt16 pShadowRanges[] =
54 {
55 	SDRATTR_SHADOWCOLOR,
56 	SDRATTR_SHADOWTRANSPARENCE,
57 	SID_ATTR_FILL_SHADOW,
58 	SID_ATTR_FILL_SHADOW,
59 	0
60 };
61 
62 /*************************************************************************
63 |*
64 |*	Dialog zum Aendern des Schattens
65 |*
66 \************************************************************************/
67 
SvxShadowTabPage(Window * pParent,const SfxItemSet & rInAttrs)68 SvxShadowTabPage::SvxShadowTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
69 
70 	SvxTabPage			( pParent, CUI_RES( RID_SVXPAGE_SHADOW ), rInAttrs ),
71 
72     aFlProp             ( this, CUI_RES( FL_PROP ) ),
73     aTsbShowShadow      ( this, CUI_RES( TSB_SHOW_SHADOW ) ),
74     aFtPosition         ( this, CUI_RES( FT_POSITION ) ),
75     aCtlPosition        ( this, CUI_RES( CTL_POSITION ) ),
76 	aFtDistance			( this, CUI_RES( FT_DISTANCE ) ),
77 	aMtrDistance		( this, CUI_RES( MTR_FLD_DISTANCE ) ),
78 	aFtShadowColor		( this, CUI_RES( FT_SHADOW_COLOR ) ),
79 	aLbShadowColor		( this, CUI_RES( LB_SHADOW_COLOR ) ),
80 	aFtTransparent      ( this, CUI_RES( FT_TRANSPARENT ) ),
81 	aMtrTransparent      ( this, CUI_RES( MTR_SHADOW_TRANSPARENT ) ),
82     aCtlXRectPreview    ( this, CUI_RES( CTL_COLOR_PREVIEW ) ),
83 	rOutAttrs			( rInAttrs ),
84     maColorTab(),
85     bDisable            ( sal_False ),
86     pXPool              ( (XOutdevItemPool*) rInAttrs.GetPool() ),
87     aXFillAttr          ( pXPool ),
88     rXFSet              ( aXFillAttr.GetItemSet() )
89 {
90 	FreeResource();
91 
92 	// diese Page braucht ExchangeSupport
93 	SetExchangeSupport();
94 
95 	// Metrik einstellen
96 	FieldUnit eFUnit = GetModuleFieldUnit( rInAttrs );
97 
98 	switch ( eFUnit )
99 	{
100 		case FUNIT_M:
101 		case FUNIT_KM:
102 			eFUnit = FUNIT_MM;
103 			break;
104         default: ;//prevent warning
105 	}
106 	SetFieldUnit( aMtrDistance, eFUnit );
107 
108 	// PoolUnit ermitteln
109 	SfxItemPool* pPool = rOutAttrs.GetPool();
110 	DBG_ASSERT( pPool, "Wo ist der Pool?" );
111 	ePoolUnit = pPool->GetMetric( SDRATTR_SHADOWXDIST );
112 
113 	// Setzen des Output-Devices
114 	XFillStyle eXFS = XFILL_SOLID;
115 	if( rOutAttrs.GetItemState( XATTR_FILLSTYLE ) != SFX_ITEM_DONTCARE )
116 	{
117 		eXFS = (XFillStyle) ( ( ( const XFillStyleItem& ) rOutAttrs.
118 								Get( GetWhich( XATTR_FILLSTYLE ) ) ).GetValue() );
119 		switch( eXFS )
120 		{
121 			//case XFILL_NONE: --> NICHTS
122 
123 			case XFILL_SOLID:
124 				if( SFX_ITEM_DONTCARE != rOutAttrs.GetItemState( XATTR_FILLCOLOR ) )
125 				{
126 					XFillColorItem aColorItem( ( const XFillColorItem& )
127 										rOutAttrs.Get( XATTR_FILLCOLOR ) );
128 					rXFSet.Put( aColorItem );
129 				}
130 			break;
131 
132 			case XFILL_GRADIENT:
133 				if( SFX_ITEM_DONTCARE != rOutAttrs.GetItemState( XATTR_FILLGRADIENT ) )
134 				{
135 					XFillGradientItem aGradientItem( ( ( const XFillGradientItem& )
136 											rOutAttrs.Get( XATTR_FILLGRADIENT ) ) );
137 					rXFSet.Put( aGradientItem );
138 				}
139 			break;
140 
141 			case XFILL_HATCH:
142 				if( SFX_ITEM_DONTCARE != rOutAttrs.GetItemState( XATTR_FILLHATCH ) )
143 				{
144 					XFillHatchItem aHatchItem( ( ( const XFillHatchItem& )
145 									rOutAttrs.Get( XATTR_FILLHATCH ) ) );
146 					rXFSet.Put( aHatchItem );
147 				}
148 			break;
149 
150 			case XFILL_BITMAP:
151 			{
152 				if( SFX_ITEM_DONTCARE != rOutAttrs.GetItemState( XATTR_FILLBITMAP ) )
153 				{
154 					XFillBitmapItem aBitmapItem( ( const XFillBitmapItem& )
155 										rOutAttrs.Get( XATTR_FILLBITMAP ) );
156 					rXFSet.Put( aBitmapItem );
157 				}
158 			}
159 			break;
160             case XFILL_NONE : break;
161 		}
162 	}
163 	else
164 	{
165 		rXFSet.Put( XFillColorItem( String(), COL_LIGHTRED ) );
166 	}
167 
168     if(XFILL_NONE == eXFS)
169     {
170         // #i96350#
171         // fallback to solid fillmode when no fill mode is provided to have
172         // a reasonable shadow preview. The used color will be a set one or
173         // the default (currently blue8)
174         eXFS = XFILL_SOLID;
175     }
176 
177 	rXFSet.Put( XFillStyleItem( eXFS ) );
178 	aCtlXRectPreview.SetRectangleAttributes(aXFillAttr.GetItemSet());
179 	//aCtlXRectPreview.SetFillAttr( aXFillAttr );
180 
181 	aTsbShowShadow.SetClickHdl( LINK( this, SvxShadowTabPage, ClickShadowHdl_Impl ) );
182 	Link aLink = LINK( this, SvxShadowTabPage, ModifyShadowHdl_Impl );
183 	aLbShadowColor.SetSelectHdl( aLink );
184 	aMtrTransparent.SetModifyHdl( aLink );
185 	aMtrDistance.SetModifyHdl( aLink );
186 
187 	aCtlXRectPreview.SetAccessibleName(String(CUI_RES(STR_EXAMPLE)));
188 	aCtlPosition.SetAccessibleRelationMemberOf( &aFlProp );
189 }
190 
191 // -----------------------------------------------------------------------
192 
Construct()193 void SvxShadowTabPage::Construct()
194 {
195 	// Farbtabelle fuellen
196 	aLbShadowColor.Fill( maColorTab );
197 
198 	if( bDisable )
199 	{
200 		aTsbShowShadow.Disable();
201 		aFtPosition.Disable();
202 		aCtlPosition.Disable();
203 		aFtDistance.Disable();
204 		aMtrDistance.Disable();
205 		aFtShadowColor.Disable();
206 		aLbShadowColor.Disable();
207 		aFtTransparent.Disable();
208 		aMtrTransparent.Disable();
209 	}
210 }
211 
212 // -----------------------------------------------------------------------
213 
ActivatePage(const SfxItemSet & rSet)214 void SvxShadowTabPage::ActivatePage( const SfxItemSet& rSet )
215 {
216 	sal_uInt16 nPos;
217 	sal_uInt16 nCount;
218 	//add CHINA001 Begin
219 	SFX_ITEMSET_ARG (&rSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
220 	if (pPageTypeItem)
221 		SetPageType(pPageTypeItem->GetValue());
222 	//add CHINA001 end
223 	if( nDlgType == 0 ) //CHINA001 // Flaechen-Dialogif( *pDlgType == 0 ) // Flaechen-Dialog
224 	{
225 		if( maColorTab.get() )
226 		{
227 			// ColorTable
228 			if( *pnColorTableState & CT_CHANGED ||
229 				*pnColorTableState & CT_MODIFIED )
230 			{
231 				if( *pnColorTableState & CT_CHANGED )
232 				{
233 					SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( DLGWIN );
234 					if( pArea )
235 					{
236 						maColorTab = pArea->GetNewColorTable();
237 					}
238 					else
239 					{
240 						SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( DLGWIN );
241 						if( pLine )
242 							maColorTab = pLine->GetNewColorTable();
243 					}
244 				}
245 
246 				// aLbShadowColor
247 				nPos = aLbShadowColor.GetSelectEntryPos();
248 				aLbShadowColor.Clear();
249 				aLbShadowColor.Fill( maColorTab );
250 				nCount = aLbShadowColor.GetEntryCount();
251 				if( nCount == 0 )
252 					; // Dieser Fall sollte nicht auftreten
253 				else if( nCount <= nPos )
254 					aLbShadowColor.SelectEntryPos( 0 );
255 				else
256 					aLbShadowColor.SelectEntryPos( nPos );
257 
258 				ModifyShadowHdl_Impl( this );
259 			}
260 			nPageType = PT_SHADOW;//CHINA001 *pPageType = PT_SHADOW;
261 		}
262 	}
263 }
264 
265 // -----------------------------------------------------------------------
266 
DeactivatePage(SfxItemSet * _pSet)267 int SvxShadowTabPage::DeactivatePage( SfxItemSet* _pSet )
268 {
269     if( _pSet )
270         FillItemSet( *_pSet );
271 
272 	return( LEAVE_PAGE );
273 }
274 
275 // -----------------------------------------------------------------------
276 
FillItemSet(SfxItemSet & rAttrs)277 sal_Bool SvxShadowTabPage::FillItemSet( SfxItemSet& rAttrs )
278 {
279 	const SfxPoolItem*	pOld = NULL;
280 	sal_Bool				bModified = sal_False;
281 
282 	if( !bDisable )
283 	{
284 		// Schatten
285 		TriState eState = aTsbShowShadow.GetState();
286 		if( eState != aTsbShowShadow.GetSavedValue() )
287 		{
288 			SdrShadowItem aItem( sal::static_int_cast< sal_Bool >( eState ) );
289 			pOld = GetOldItem( rAttrs, SDRATTR_SHADOW );
290 			if ( !pOld || !( *(const SdrShadowItem*)pOld == aItem ) )
291 			{
292 				rAttrs.Put( aItem );
293 				bModified = sal_True;
294 			}
295 		}
296 
297 		// Schatten-Entfernung
298 		// Etwas umstaendliche Abfrage, ob etwas geaendert wurde,
299 		// da Items nicht direkt auf Controls abbildbar sind
300 		sal_Int32 nX = 0L, nY = 0L;
301 		sal_Int32 nXY = GetCoreValue( aMtrDistance, ePoolUnit );
302 
303 		switch( aCtlPosition.GetActualRP() )
304 		{
305 			case RP_LT: nX = nY = -nXY; 	 break;
306 			case RP_MT: nY = -nXY;			 break;
307 			case RP_RT: nX = nXY; nY = -nXY; break;
308 			case RP_LM: nX = -nXY;			 break;
309 			case RP_RM: nX = nXY;			 break;
310 			case RP_LB: nX = -nXY; nY = nXY; break;
311 			case RP_MB: nY = nXY; 			 break;
312 			case RP_RB: nX = nY = nXY; 		 break;
313             case RP_MM: break;
314 		}
315 
316 		// Wenn die Werte des Schattenabstanden==SFX_ITEM_DONTCARE und der angezeigte
317 		// String im entspr. MetricField=="", dann w�rde der Vergleich zw. alten und
318 		// neuen Distance-Werte ein falsches Ergebnis liefern, da in so einem Fall die
319 		// neuen Distance-Werte den Default-Werten des MetricField entspr�chen !!!!
320 		if ( !aMtrDistance.IsEmptyFieldValue()                                  ||
321 			 rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SFX_ITEM_DONTCARE ||
322 			 rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SFX_ITEM_DONTCARE    )
323 		{
324 			sal_Int32 nOldX = 9876543; // Unmoeglicher Wert, entspr. DontCare
325 			sal_Int32 nOldY = 9876543;
326 			if( rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SFX_ITEM_DONTCARE &&
327 				rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SFX_ITEM_DONTCARE )
328 			{
329 				nOldX = ( ( const SdrShadowXDistItem& ) rOutAttrs.
330 									Get( SDRATTR_SHADOWXDIST ) ).GetValue();
331 				nOldY = ( ( const SdrShadowYDistItem& ) rOutAttrs.
332 									Get( SDRATTR_SHADOWYDIST ) ).GetValue();
333 			}
334 			SdrShadowXDistItem aXItem( nX );
335 			pOld = GetOldItem( rAttrs, SDRATTR_SHADOWXDIST );
336 			if ( nX != nOldX &&
337 				( !pOld || !( *(const SdrShadowXDistItem*)pOld == aXItem ) ) )
338 			{
339 				rAttrs.Put( aXItem );
340 				bModified = sal_True;
341 			}
342 			SdrShadowYDistItem aYItem( nY );
343 			pOld = GetOldItem( rAttrs, SDRATTR_SHADOWYDIST );
344 			if ( nY != nOldY &&
345 				( !pOld || !( *(const SdrShadowYDistItem*)pOld == aYItem ) ) )
346 			{
347 				rAttrs.Put( aYItem );
348 				bModified = sal_True;
349 			}
350 		}
351 
352 		// ShadowColor
353 		sal_uInt16 nPos = aLbShadowColor.GetSelectEntryPos();
354 		if( nPos != LISTBOX_ENTRY_NOTFOUND &&
355 			nPos != aLbShadowColor.GetSavedValue() )
356 		{
357 			SdrShadowColorItem aItem( aLbShadowColor.GetSelectEntry(),
358 									aLbShadowColor.GetSelectEntryColor() );
359 			pOld = GetOldItem( rAttrs, SDRATTR_SHADOWCOLOR );
360 			if ( !pOld || !( *(const SdrShadowColorItem*)pOld == aItem ) )
361 			{
362 				rAttrs.Put( aItem );
363 				bModified = sal_True;
364 			}
365 		}
366 
367 		// Transparenz
368 		sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue();
369 		if( nVal != (sal_uInt16)aMtrTransparent.GetSavedValue().ToInt32() )
370 		{
371 			SdrShadowTransparenceItem aItem( nVal );
372 			pOld = GetOldItem( rAttrs, SDRATTR_SHADOWTRANSPARENCE );
373 			if ( !pOld || !( *(const SdrShadowTransparenceItem*)pOld == aItem ) )
374 			{
375 				rAttrs.Put( aItem );
376 				bModified = sal_True;
377 			}
378 		}
379 	}
380 	//add CHINA001  begin
381 	rAttrs.Put (CntUInt16Item(SID_PAGE_TYPE,nPageType));
382 	//add CHINA001  end
383 	return( bModified );
384 }
385 
386 // -----------------------------------------------------------------------
387 
Reset(const SfxItemSet & rAttrs)388 void SvxShadowTabPage::Reset( const SfxItemSet& rAttrs )
389 {
390 	if( !bDisable )
391 	{
392 		// Alle Objekte koennen einen Schatten besitzen
393 		// z.Z. gibt es nur 8 m�gliche Positionen den Schatten zu setzen
394 
395 		// Ist Schatten gesetzt?
396 		if( rAttrs.GetItemState( SDRATTR_SHADOW ) != SFX_ITEM_DONTCARE )
397 		{
398 			aTsbShowShadow.EnableTriState( sal_False );
399 
400 			if( ( ( const SdrShadowItem& ) rAttrs.Get( SDRATTR_SHADOW ) ).GetValue() )
401 				aTsbShowShadow.SetState( STATE_CHECK );
402 			else
403 			{
404 				aTsbShowShadow.SetState( STATE_NOCHECK );
405 			}
406 		}
407 		else
408 			aTsbShowShadow.SetState( STATE_DONTKNOW );
409 
410 		// Entfernung (nur 8 moegliche Positionen), deshalb
411 		// wird nur ein Item ausgewertet
412 
413 		if( rAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SFX_ITEM_DONTCARE &&
414 			rAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SFX_ITEM_DONTCARE )
415 		{
416 			sal_Int32 nX = ( ( const SdrShadowXDistItem& ) rAttrs.Get( SDRATTR_SHADOWXDIST ) ).GetValue();
417 			sal_Int32 nY = ( ( const SdrShadowYDistItem& ) rAttrs.Get( SDRATTR_SHADOWYDIST ) ).GetValue();
418 
419 			if( nX != 0 )
420 				SetMetricValue( aMtrDistance, nX < 0L ? -nX : nX, ePoolUnit );
421 			else
422 				SetMetricValue( aMtrDistance, nY < 0L ? -nY : nY, ePoolUnit );
423 
424 			// Setzen des Schatten-Controls
425 			if	   ( nX <  0L && nY <  0L ) aCtlPosition.SetActualRP( RP_LT );
426 			else if( nX == 0L && nY <  0L ) aCtlPosition.SetActualRP( RP_MT );
427 			else if( nX >  0L && nY <  0L ) aCtlPosition.SetActualRP( RP_RT );
428 			else if( nX <  0L && nY == 0L ) aCtlPosition.SetActualRP( RP_LM );
429 			// Mittelpunkt gibt es nicht mehr
430 			else if( nX == 0L && nY == 0L ) aCtlPosition.SetActualRP( RP_RB );
431 			else if( nX >  0L && nY == 0L ) aCtlPosition.SetActualRP( RP_RM );
432 			else if( nX <  0L && nY >  0L ) aCtlPosition.SetActualRP( RP_LB );
433 			else if( nX == 0L && nY >  0L ) aCtlPosition.SetActualRP( RP_MB );
434 			else if( nX >  0L && nY >  0L ) aCtlPosition.SetActualRP( RP_RB );
435 		}
436 		else
437 		{
438 			// determine default-distance
439 			SfxItemPool* pPool = rOutAttrs.GetPool();
440 			SdrShadowXDistItem* pXDistItem = (SdrShadowXDistItem*)&pPool->GetDefaultItem (SDRATTR_SHADOWXDIST);
441 			SdrShadowYDistItem* pYDistItem = (SdrShadowYDistItem*)&pPool->GetDefaultItem (SDRATTR_SHADOWYDIST);
442 			if (pXDistItem && pYDistItem)
443 			{
444 				sal_Int32 nX = pXDistItem->GetValue();
445 				sal_Int32 nY = pYDistItem->GetValue();
446 				if( nX != 0 )
447 					SetMetricValue( aMtrDistance, nX < 0L ? -nX : nX, ePoolUnit );
448 				else
449 					SetMetricValue( aMtrDistance, nY < 0L ? -nY : nY, ePoolUnit );
450 			}
451 
452 			// Tristate, z.B. mehrer Objekte wurden markiert, wovon einige einen Schatten besitzen, einige nicht.
453 			// Der anzuzeigende Text des MetricFields wird auf "" gesetzt und dient in der Methode FillItemSet
454 			// als Erkennungszeichen daf�r, das der Distance-Wert NICHT ver�ndert wurde !!!!
455 			aMtrDistance.SetText( String() );
456 			aCtlPosition.SetActualRP( RP_MM );
457 		}
458 
459 		// SchattenFarbe:
460 		if( rAttrs.GetItemState( SDRATTR_SHADOWCOLOR ) != SFX_ITEM_DONTCARE )
461 		{
462 			aLbShadowColor.SelectEntry( ( ( const SdrShadowColorItem& ) rAttrs.Get( SDRATTR_SHADOWCOLOR ) ).GetColorValue() );
463 		}
464 		else
465 			aLbShadowColor.SetNoSelection();
466 
467 		// Transparenz
468 		if( rAttrs.GetItemState( SDRATTR_SHADOWTRANSPARENCE ) != SFX_ITEM_DONTCARE )
469 		{
470 			sal_uInt16 nTransp = ( ( const SdrShadowTransparenceItem& ) rAttrs.Get( SDRATTR_SHADOWTRANSPARENCE ) ).GetValue();
471 			aMtrTransparent.SetValue( nTransp );
472 		}
473 		else
474 			aMtrTransparent.SetText( String() );
475 
476 		// Werte sichern
477 		//aCtlPosition
478 		aMtrDistance.SaveValue();
479 		aLbShadowColor.SaveValue();
480 		aTsbShowShadow.SaveValue();
481 
482 		// #66832# This field was not saved, but used to determine changes.
483 		// Why? Seems to be the error.
484 		// It IS the error.
485 		aMtrTransparent.SaveValue();
486 
487 		ClickShadowHdl_Impl( NULL );
488 		ModifyShadowHdl_Impl( NULL );
489 	}
490 }
491 
492 // -----------------------------------------------------------------------
493 
Create(Window * pWindow,const SfxItemSet & rAttrs)494 SfxTabPage* SvxShadowTabPage::Create( Window* pWindow,
495 				const SfxItemSet& rAttrs )
496 {
497 	return( new SvxShadowTabPage( pWindow, rAttrs ) );
498 }
499 
500 //------------------------------------------------------------------------
501 
GetRanges()502 sal_uInt16*	SvxShadowTabPage::GetRanges()
503 {
504 	return( pShadowRanges );
505 }
506 
507 //------------------------------------------------------------------------
508 
IMPL_LINK(SvxShadowTabPage,ClickShadowHdl_Impl,void *,EMPTYARG)509 IMPL_LINK( SvxShadowTabPage, ClickShadowHdl_Impl, void *, EMPTYARG )
510 {
511 	if( aTsbShowShadow.GetState() == STATE_NOCHECK )
512 	{
513 		aFtPosition.Disable();
514 		aCtlPosition.Disable();
515 		aFtDistance.Disable();
516 		aMtrDistance.Disable();
517 		aFtShadowColor.Disable();
518 		aLbShadowColor.Disable();
519 		aFtTransparent.Disable();
520 		aMtrTransparent.Disable();
521 	}
522 	else
523 	{
524 		aFtPosition.Enable();
525 		aCtlPosition.Enable();
526 		aFtDistance.Enable();
527 		aMtrDistance.Enable();
528 		aFtShadowColor.Enable();
529 		aLbShadowColor.Enable();
530 		aFtTransparent.Enable();
531 		aMtrTransparent.Enable();
532 	}
533 	aCtlPosition.Invalidate();
534 
535 	ModifyShadowHdl_Impl( NULL );
536 
537 	return( 0L );
538 }
539 
540 //------------------------------------------------------------------------
541 
IMPL_LINK(SvxShadowTabPage,ModifyShadowHdl_Impl,void *,EMPTYARG)542 IMPL_LINK( SvxShadowTabPage, ModifyShadowHdl_Impl, void *, EMPTYARG )
543 {
544 	if( aTsbShowShadow.GetState() == STATE_CHECK )
545 		rXFSet.Put( XFillStyleItem( XFILL_SOLID ) );
546 	else
547 		rXFSet.Put( XFillStyleItem( XFILL_NONE ) );
548 
549 	sal_uInt16 nPos = aLbShadowColor.GetSelectEntryPos();
550 	if( nPos != LISTBOX_ENTRY_NOTFOUND )
551 	{
552 		rXFSet.Put( XFillColorItem( String(),
553 						aLbShadowColor.GetSelectEntryColor() ) );
554 	}
555 	sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue();
556 	XFillTransparenceItem aItem( nVal );
557 	rXFSet.Put( XFillTransparenceItem( aItem ) );
558 
559 	// Schatten-Entfernung
560 	sal_Int32 nX = 0L, nY = 0L;
561 	sal_Int32 nXY = GetCoreValue( aMtrDistance, ePoolUnit );
562 	switch( aCtlPosition.GetActualRP() )
563 	{
564 		case RP_LT: nX = nY = -nXY; 	 break;
565 		case RP_MT: nY = -nXY;			 break;
566 		case RP_RT: nX = nXY; nY = -nXY; break;
567 		case RP_LM: nX = -nXY;			 break;
568 		case RP_RM: nX = nXY;			 break;
569 		case RP_LB: nX = -nXY; nY = nXY; break;
570 		case RP_MB: nY = nXY; 			 break;
571 		case RP_RB: nX = nY = nXY; 		 break;
572         case RP_MM: break;
573     }
574 
575     aCtlXRectPreview.SetShadowPosition(Point(nX, nY));
576 
577 	aCtlXRectPreview.SetShadowAttributes(aXFillAttr.GetItemSet());
578 	//aCtlXRectPreview.SetFillAttr( aXFillAttr );
579 	aCtlXRectPreview.Invalidate();
580 
581 	return( 0L );
582 }
583 
584 //------------------------------------------------------------------------
585 
PointChanged(Window * pWindow,RECT_POINT eRcPt)586 void SvxShadowTabPage::PointChanged( Window* pWindow, RECT_POINT eRcPt )
587 {
588 	eRP = eRcPt;
589 
590 	// Schatten neu zeichnen
591 	ModifyShadowHdl_Impl( pWindow );
592 }
593 
PageCreated(SfxAllItemSet aSet)594 void SvxShadowTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
595 {
596 	SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False);
597 	SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
598 	SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False);
599 
600 
601 	if (pColorTabItem)
602 		SetColorTable(pColorTabItem->GetColorTable());
603 	if (pPageTypeItem)
604 		SetPageType(pPageTypeItem->GetValue());
605 	if (pDlgTypeItem)
606 		SetDlgType(pDlgTypeItem->GetValue());
607 	Construct();
608 }
609