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