LCOV - code coverage report
Current view: top level - cui/source/tabpages - tpshadow.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 269 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 18 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <sfx2/app.hxx>
      21             : #include <sfx2/module.hxx>
      22             : #include <svx/dialogs.hrc>
      23             : 
      24             : #include "svx/xattr.hxx"
      25             : #include <svx/xpool.hxx>
      26             : #include <cuires.hrc>
      27             : #include <svx/svdattr.hxx>
      28             : #include "svx/drawitem.hxx"
      29             : #include "cuitabarea.hxx"
      30             : #include <dialmgr.hxx>
      31             : #include "svx/dlgutil.hxx"
      32             : #include <cuitabline.hxx>
      33             : #include "paragrph.hrc"
      34             : #include <svx/xlineit0.hxx>
      35             : #include <sfx2/request.hxx>
      36             : 
      37             : using namespace com::sun::star;
      38             : 
      39             : const sal_uInt16 SvxShadowTabPage::pShadowRanges[] =
      40             : {
      41             :     SDRATTR_SHADOWCOLOR,
      42             :     SDRATTR_SHADOWTRANSPARENCE,
      43             :     SID_ATTR_FILL_SHADOW,
      44             :     SID_ATTR_FILL_SHADOW,
      45             :     0
      46             : };
      47             : 
      48           0 : SvxShadowTabPage::SvxShadowTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ) :
      49             : 
      50             :     SvxTabPage          ( pParent,
      51             :                           "ShadowTabPage",
      52             :                           "cui/ui/shadowtabpage.ui",
      53             :                           rInAttrs ),
      54             :     rOutAttrs           ( rInAttrs ),
      55             :     eRP                 ( RP_LT ),
      56             :     pnColorListState    ( 0 ),
      57             :     nPageType           ( 0 ),
      58             :     nDlgType            ( 0 ),
      59             :     pbAreaTP            ( 0 ),
      60             :     bDisable            ( false ),
      61           0 :     pXPool              ( static_cast<XOutdevItemPool*>(rInAttrs.GetPool()) ),
      62             :     aXFillAttr          ( pXPool ),
      63           0 :     rXFSet              ( aXFillAttr.GetItemSet() )
      64             : {
      65           0 :     get(m_pTsbShowShadow,"TSB_SHOW_SHADOW");
      66           0 :     get(m_pGridShadow,"gridSHADOW");
      67           0 :     get(m_pCtlPosition,"CTL_POSITION");
      68           0 :     get(m_pMtrDistance,"MTR_FLD_DISTANCE");
      69           0 :     get(m_pLbShadowColor,"LB_SHADOW_COLOR");
      70           0 :     get(m_pMtrTransparent,"MTR_SHADOW_TRANSPARENT");
      71           0 :     get(m_pCtlXRectPreview,"CTL_COLOR_PREVIEW");
      72             : 
      73             :     // this page needs ExchangeSupport
      74           0 :     SetExchangeSupport();
      75             : 
      76             :     // adjust metric
      77           0 :     FieldUnit eFUnit = GetModuleFieldUnit( rInAttrs );
      78             : 
      79           0 :     switch ( eFUnit )
      80             :     {
      81             :         case FUNIT_M:
      82             :         case FUNIT_KM:
      83           0 :             eFUnit = FUNIT_MM;
      84           0 :             break;
      85             :         default: ;//prevent warning
      86             :     }
      87           0 :     SetFieldUnit( *m_pMtrDistance, eFUnit );
      88             : 
      89             :     // determine PoolUnit
      90           0 :     SfxItemPool* pPool = rOutAttrs.GetPool();
      91             :     DBG_ASSERT( pPool, "Wo ist der Pool?" );
      92           0 :     ePoolUnit = pPool->GetMetric( SDRATTR_SHADOWXDIST );
      93             : 
      94             :     // setting the output device
      95           0 :     drawing::FillStyle eXFS = drawing::FillStyle_SOLID;
      96           0 :     if( rOutAttrs.GetItemState( XATTR_FILLSTYLE ) != SfxItemState::DONTCARE )
      97             :     {
      98             :         eXFS = (drawing::FillStyle) ( static_cast<const XFillStyleItem&>( rOutAttrs.
      99           0 :                                 Get( GetWhich( XATTR_FILLSTYLE ) ) ).GetValue() );
     100           0 :         switch( eXFS )
     101             :         {
     102             :             case drawing::FillStyle_SOLID:
     103           0 :                 if( SfxItemState::DONTCARE != rOutAttrs.GetItemState( XATTR_FILLCOLOR ) )
     104             :                 {
     105             :                     XFillColorItem aColorItem( static_cast<const XFillColorItem&>(
     106           0 :                                         rOutAttrs.Get( XATTR_FILLCOLOR ) ) );
     107           0 :                     rXFSet.Put( aColorItem );
     108             :                 }
     109           0 :             break;
     110             : 
     111             :             case drawing::FillStyle_GRADIENT:
     112           0 :                 if( SfxItemState::DONTCARE != rOutAttrs.GetItemState( XATTR_FILLGRADIENT ) )
     113             :                 {
     114             :                     XFillGradientItem aGradientItem( static_cast<const XFillGradientItem&>(
     115           0 :                                             rOutAttrs.Get( XATTR_FILLGRADIENT ) ) );
     116           0 :                     rXFSet.Put( aGradientItem );
     117             :                 }
     118           0 :             break;
     119             : 
     120             :             case drawing::FillStyle_HATCH:
     121           0 :                 if( SfxItemState::DONTCARE != rOutAttrs.GetItemState( XATTR_FILLHATCH ) )
     122             :                 {
     123             :                     XFillHatchItem aHatchItem( static_cast<const XFillHatchItem& >(
     124           0 :                                     rOutAttrs.Get( XATTR_FILLHATCH ) ) );
     125           0 :                     rXFSet.Put( aHatchItem );
     126             :                 }
     127           0 :             break;
     128             : 
     129             :             case drawing::FillStyle_BITMAP:
     130             :             {
     131           0 :                 if( SfxItemState::DONTCARE != rOutAttrs.GetItemState( XATTR_FILLBITMAP ) )
     132             :                 {
     133             :                     XFillBitmapItem aBitmapItem( static_cast<const XFillBitmapItem& >(
     134           0 :                                         rOutAttrs.Get( XATTR_FILLBITMAP ) ) );
     135           0 :                     rXFSet.Put( aBitmapItem );
     136             :                 }
     137             :             }
     138           0 :             break;
     139           0 :             case drawing::FillStyle_NONE : break;
     140           0 :             default: break;
     141             :         }
     142             :     }
     143             :     else
     144             :     {
     145           0 :         rXFSet.Put( XFillColorItem( OUString(), COL_LIGHTRED ) );
     146             :     }
     147             : 
     148           0 :     if(drawing::FillStyle_NONE == eXFS)
     149             :     {
     150             :         // #i96350#
     151             :         // fallback to solid fillmode when no fill mode is provided to have
     152             :         // a reasonable shadow preview. The used color will be a set one or
     153             :         // the default (currently blue8)
     154           0 :         eXFS = drawing::FillStyle_SOLID;
     155             :     }
     156             : 
     157           0 :     rXFSet.Put( XFillStyleItem( eXFS ) );
     158           0 :     m_pCtlXRectPreview->SetRectangleAttributes(aXFillAttr.GetItemSet());
     159             :     //aCtlXRectPreview.SetFillAttr( aXFillAttr );
     160             : 
     161           0 :     m_pTsbShowShadow->SetClickHdl( LINK( this, SvxShadowTabPage, ClickShadowHdl_Impl ) );
     162           0 :     Link<> aLink = LINK( this, SvxShadowTabPage, ModifyShadowHdl_Impl );
     163           0 :     m_pLbShadowColor->SetSelectHdl( aLink );
     164           0 :     m_pMtrTransparent->SetModifyHdl( aLink );
     165           0 :     m_pMtrDistance->SetModifyHdl( aLink );
     166           0 : }
     167             : 
     168           0 : SvxShadowTabPage::~SvxShadowTabPage()
     169             : {
     170           0 :     disposeOnce();
     171           0 : }
     172             : 
     173           0 : void SvxShadowTabPage::dispose()
     174             : {
     175           0 :     m_pTsbShowShadow.clear();
     176           0 :     m_pGridShadow.clear();
     177           0 :     m_pCtlPosition.clear();
     178           0 :     m_pMtrDistance.clear();
     179           0 :     m_pLbShadowColor.clear();
     180           0 :     m_pMtrTransparent.clear();
     181           0 :     m_pCtlXRectPreview.clear();
     182           0 :     SvxTabPage::dispose();
     183           0 : }
     184             : 
     185           0 : void SvxShadowTabPage::Construct()
     186             : {
     187           0 :     m_pLbShadowColor->Fill( pColorList );
     188             : 
     189           0 :     if( bDisable )
     190             :     {
     191           0 :         m_pTsbShowShadow->Disable();
     192           0 :         m_pGridShadow->Disable();
     193             :     }
     194           0 : }
     195             : 
     196             : 
     197             : 
     198           0 : void SvxShadowTabPage::ActivatePage( const SfxItemSet& rSet )
     199             : {
     200             :     sal_Int32 nPos;
     201             :     sal_Int32 nCount;
     202             : 
     203           0 :     SFX_ITEMSET_ARG (&rSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,false);
     204           0 :     if (pPageTypeItem)
     205           0 :         SetPageType(pPageTypeItem->GetValue());
     206             : 
     207           0 :     if( nDlgType == 0 )
     208             :     {
     209           0 :         if( pColorList.is() )
     210             :         {
     211             :             // ColorList
     212           0 :             if( *pnColorListState & ChangeType::CHANGED ||
     213           0 :                 *pnColorListState & ChangeType::MODIFIED )
     214             :             {
     215           0 :                 if( *pnColorListState & ChangeType::CHANGED )
     216             :                 {
     217           0 :                     SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( GetParentDialog() );
     218           0 :                     if( pArea )
     219             :                     {
     220           0 :                         pColorList = pArea->GetNewColorList();
     221             :                     }
     222             :                     else
     223             :                     {
     224           0 :                         SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( GetParentDialog() );
     225           0 :                         if( pLine )
     226           0 :                             pColorList = pLine->GetNewColorList();
     227             :                     }
     228             :                 }
     229             : 
     230             :                 // aLbShadowColor
     231           0 :                 nPos = m_pLbShadowColor->GetSelectEntryPos();
     232           0 :                 m_pLbShadowColor->Clear();
     233           0 :                 m_pLbShadowColor->Fill( pColorList );
     234           0 :                 nCount = m_pLbShadowColor->GetEntryCount();
     235           0 :                 if( nCount == 0 )
     236             :                     ; // this case should not occur
     237           0 :                 else if( nCount <= nPos )
     238           0 :                     m_pLbShadowColor->SelectEntryPos( 0 );
     239             :                 else
     240           0 :                     m_pLbShadowColor->SelectEntryPos( nPos );
     241             : 
     242           0 :                 SfxItemSet rAttribs( rSet );
     243             :                 // rSet contains shadow attributes too, but we want
     244             :                 // to use it for updating rectangle attributes only,
     245             :                 // so set the shadow to none here
     246           0 :                 SdrOnOffItem aItem( makeSdrShadowItem( false ));
     247           0 :                 rAttribs.Put( aItem );
     248             : 
     249           0 :                 m_pCtlXRectPreview->SetRectangleAttributes( rAttribs );
     250           0 :                 ModifyShadowHdl_Impl( this );
     251             :             }
     252           0 :             nPageType = PT_SHADOW;
     253             :         }
     254             :     }
     255           0 : }
     256             : 
     257             : 
     258             : 
     259           0 : SfxTabPage::sfxpg SvxShadowTabPage::DeactivatePage( SfxItemSet* _pSet )
     260             : {
     261           0 :     if( _pSet )
     262           0 :         FillItemSet( _pSet );
     263             : 
     264           0 :     return LEAVE_PAGE;
     265             : }
     266             : 
     267             : 
     268             : 
     269           0 : bool SvxShadowTabPage::FillItemSet( SfxItemSet* rAttrs )
     270             : {
     271           0 :     bool                bModified = false;
     272             : 
     273           0 :     if( !bDisable )
     274             :     {
     275           0 :         const SfxPoolItem*  pOld = NULL;
     276             : 
     277           0 :         if( m_pTsbShowShadow->IsValueChangedFromSaved() )
     278             :         {
     279           0 :             TriState eState = m_pTsbShowShadow->GetState();
     280             :             assert(eState != TRISTATE_INDET);
     281             :                 // given how m_pTsbShowShadow is set up and saved in Reset(),
     282             :                 // eState == TRISTATE_INDET would imply
     283             :                 // !IsValueChangedFromSaved()
     284           0 :             SdrOnOffItem aItem( makeSdrShadowItem(eState == TRISTATE_TRUE) );
     285           0 :             pOld = GetOldItem( *rAttrs, SDRATTR_SHADOW );
     286           0 :             if ( !pOld || !( *static_cast<const SdrOnOffItem*>(pOld) == aItem ) )
     287             :             {
     288           0 :                 rAttrs->Put( aItem );
     289           0 :                 bModified = true;
     290           0 :             }
     291             :         }
     292             : 
     293             :         // shadow removal
     294             :         // a bit intricate inquiry whether there was something changed,
     295             :         // as the items can't be displayed directly on controls
     296           0 :         sal_Int32 nX = 0L, nY = 0L;
     297           0 :         sal_Int32 nXY = GetCoreValue( *m_pMtrDistance, ePoolUnit );
     298             : 
     299           0 :         switch( m_pCtlPosition->GetActualRP() )
     300             :         {
     301           0 :             case RP_LT: nX = nY = -nXY;      break;
     302           0 :             case RP_MT: nY = -nXY;           break;
     303           0 :             case RP_RT: nX = nXY; nY = -nXY; break;
     304           0 :             case RP_LM: nX = -nXY;           break;
     305           0 :             case RP_RM: nX = nXY;            break;
     306           0 :             case RP_LB: nX = -nXY; nY = nXY; break;
     307           0 :             case RP_MB: nY = nXY;            break;
     308           0 :             case RP_RB: nX = nY = nXY;       break;
     309           0 :             case RP_MM: break;
     310             :         }
     311             : 
     312             :         // If the values of the shadow distances==SfxItemState::DONTCARE and the displayed
     313             :         // string in the respective MetricField=="", then the comparison of the old
     314             :         // and the new distance values would return a wrong result because in such a
     315             :         // case the new distance values would matche the default values of the MetricField !!!!
     316           0 :         if ( !m_pMtrDistance->IsEmptyFieldValue()                                  ||
     317           0 :              rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::DONTCARE ||
     318           0 :              rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::DONTCARE    )
     319             :         {
     320           0 :             sal_Int32 nOldX = 9876543; // impossible value, so DontCare
     321           0 :             sal_Int32 nOldY = 9876543;
     322           0 :             if( rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::DONTCARE &&
     323           0 :                 rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::DONTCARE )
     324             :             {
     325             :                 nOldX = static_cast<const SdrMetricItem&>( rOutAttrs.
     326           0 :                                     Get( SDRATTR_SHADOWXDIST ) ).GetValue();
     327             :                 nOldY = static_cast<const SdrMetricItem&>( rOutAttrs.
     328           0 :                                     Get( SDRATTR_SHADOWYDIST ) ).GetValue();
     329             :             }
     330           0 :             SdrMetricItem aXItem( makeSdrShadowXDistItem(nX) );
     331           0 :             pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWXDIST );
     332           0 :             if ( nX != nOldX &&
     333           0 :                 ( !pOld || !( *static_cast<const SdrMetricItem*>(pOld) == aXItem ) ) )
     334             :             {
     335           0 :                 rAttrs->Put( aXItem );
     336           0 :                 bModified = true;
     337             :             }
     338           0 :             SdrMetricItem aYItem( makeSdrShadowYDistItem(nY) );
     339           0 :             pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWYDIST );
     340           0 :             if ( nY != nOldY &&
     341           0 :                 ( !pOld || !( *static_cast<const SdrMetricItem*>(pOld) == aYItem ) ) )
     342             :             {
     343           0 :                 rAttrs->Put( aYItem );
     344           0 :                 bModified = true;
     345           0 :             }
     346             :         }
     347             : 
     348             :         // ShadowColor
     349           0 :         sal_Int32 nPos = m_pLbShadowColor->GetSelectEntryPos();
     350           0 :         if( nPos != LISTBOX_ENTRY_NOTFOUND &&
     351           0 :             m_pLbShadowColor->IsValueChangedFromSaved() )
     352             :         {
     353           0 :             XColorItem aItem(makeSdrShadowColorItem(m_pLbShadowColor->GetSelectEntryColor()));
     354           0 :             pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWCOLOR );
     355           0 :             if ( !pOld || !( *static_cast<const XColorItem*>(pOld) == aItem ) )
     356             :             {
     357           0 :                 rAttrs->Put( aItem );
     358           0 :                 bModified = true;
     359           0 :             }
     360             :         }
     361             : 
     362             :         // transparency
     363           0 :         sal_uInt16 nVal = (sal_uInt16)m_pMtrTransparent->GetValue();
     364           0 :         if( m_pMtrTransparent->IsValueChangedFromSaved() )
     365             :         {
     366           0 :             SdrPercentItem aItem( makeSdrShadowTransparenceItem(nVal) );
     367           0 :             pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWTRANSPARENCE );
     368           0 :             if ( !pOld || !( *static_cast<const SdrPercentItem*>(pOld) == aItem ) )
     369             :             {
     370           0 :                 rAttrs->Put( aItem );
     371           0 :                 bModified = true;
     372           0 :             }
     373             :         }
     374             :     }
     375             : 
     376           0 :     rAttrs->Put (CntUInt16Item(SID_PAGE_TYPE,nPageType));
     377             : 
     378           0 :     return bModified;
     379             : }
     380             : 
     381             : 
     382             : 
     383           0 : void SvxShadowTabPage::Reset( const SfxItemSet* rAttrs )
     384             : {
     385           0 :     if( !bDisable )
     386             :     {
     387             :         // all objects can have a shadow
     388             :         // at the moment there are only 8 possible positions where a shadow can be set
     389             : 
     390             :         // has a shadow been set?
     391           0 :         if( rAttrs->GetItemState( SDRATTR_SHADOW ) != SfxItemState::DONTCARE )
     392             :         {
     393           0 :             m_pTsbShowShadow->EnableTriState( false );
     394             : 
     395           0 :             if( static_cast<const SdrOnOffItem&>( rAttrs->Get( SDRATTR_SHADOW ) ).GetValue() )
     396           0 :                 m_pTsbShowShadow->SetState( TRISTATE_TRUE );
     397             :             else
     398             :             {
     399           0 :                 m_pTsbShowShadow->SetState( TRISTATE_FALSE );
     400             :             }
     401             :         }
     402             :         else
     403           0 :             m_pTsbShowShadow->SetState( TRISTATE_INDET );
     404             : 
     405             :         // distance (only 8 possible positions),
     406             :         // so there is only one item evaluated
     407             : 
     408           0 :         if( rAttrs->GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::DONTCARE &&
     409           0 :             rAttrs->GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::DONTCARE )
     410             :         {
     411           0 :             sal_Int32 nX = static_cast<const SdrMetricItem&>( rAttrs->Get( SDRATTR_SHADOWXDIST ) ).GetValue();
     412           0 :             sal_Int32 nY = static_cast<const SdrMetricItem&>( rAttrs->Get( SDRATTR_SHADOWYDIST ) ).GetValue();
     413             : 
     414           0 :             if( nX != 0 )
     415           0 :                 SetMetricValue( *m_pMtrDistance, nX < 0L ? -nX : nX, ePoolUnit );
     416             :             else
     417           0 :                 SetMetricValue( *m_pMtrDistance, nY < 0L ? -nY : nY, ePoolUnit );
     418             : 
     419             :             // setting the shadow control
     420           0 :             if     ( nX <  0L && nY <  0L ) m_pCtlPosition->SetActualRP( RP_LT );
     421           0 :             else if( nX == 0L && nY <  0L ) m_pCtlPosition->SetActualRP( RP_MT );
     422           0 :             else if( nX >  0L && nY <  0L ) m_pCtlPosition->SetActualRP( RP_RT );
     423           0 :             else if( nX <  0L && nY == 0L ) m_pCtlPosition->SetActualRP( RP_LM );
     424             :             // there's no center point anymore
     425           0 :             else if( nX == 0L && nY == 0L ) m_pCtlPosition->SetActualRP( RP_RB );
     426           0 :             else if( nX >  0L && nY == 0L ) m_pCtlPosition->SetActualRP( RP_RM );
     427           0 :             else if( nX <  0L && nY >  0L ) m_pCtlPosition->SetActualRP( RP_LB );
     428           0 :             else if( nX == 0L && nY >  0L ) m_pCtlPosition->SetActualRP( RP_MB );
     429           0 :             else if( nX >  0L && nY >  0L ) m_pCtlPosition->SetActualRP( RP_RB );
     430             :         }
     431             :         else
     432             :         {
     433             :             // determine default-distance
     434           0 :             SfxItemPool* pPool = rOutAttrs.GetPool();
     435           0 :             const SdrMetricItem* pXDistItem = static_cast<const SdrMetricItem*>(&pPool->GetDefaultItem(SDRATTR_SHADOWXDIST));
     436           0 :             const SdrMetricItem* pYDistItem = static_cast<const SdrMetricItem*>(&pPool->GetDefaultItem(SDRATTR_SHADOWYDIST));
     437           0 :             if (pXDistItem && pYDistItem)
     438             :             {
     439           0 :                 sal_Int32 nX = pXDistItem->GetValue();
     440           0 :                 sal_Int32 nY = pYDistItem->GetValue();
     441           0 :                 if( nX != 0 )
     442           0 :                     SetMetricValue( *m_pMtrDistance, nX < 0L ? -nX : nX, ePoolUnit );
     443             :                 else
     444           0 :                     SetMetricValue( *m_pMtrDistance, nY < 0L ? -nY : nY, ePoolUnit );
     445             :             }
     446             : 
     447             :             // Tristate, e. g. multiple objects have been marked of which some have a shadow and some don't.
     448             :             // The text (which shall be displayed) of the MetricFields is set to "" and serves as an
     449             :             // identification in the method FillItemSet for the fact that the distance value was NOT changed !!!!
     450           0 :             m_pMtrDistance->SetText( "" );
     451           0 :             m_pCtlPosition->SetActualRP( RP_MM );
     452             :         }
     453             : 
     454           0 :         if( rAttrs->GetItemState( SDRATTR_SHADOWCOLOR ) != SfxItemState::DONTCARE )
     455             :         {
     456           0 :             m_pLbShadowColor->SelectEntry( static_cast<const XColorItem&>( rAttrs->Get( SDRATTR_SHADOWCOLOR ) ).GetColorValue() );
     457             :         }
     458             :         else
     459           0 :             m_pLbShadowColor->SetNoSelection();
     460             : 
     461           0 :         if( rAttrs->GetItemState( SDRATTR_SHADOWTRANSPARENCE ) != SfxItemState::DONTCARE )
     462             :         {
     463           0 :             sal_uInt16 nTransp = static_cast<const SdrPercentItem&>( rAttrs->Get( SDRATTR_SHADOWTRANSPARENCE ) ).GetValue();
     464           0 :             m_pMtrTransparent->SetValue( nTransp );
     465             :         }
     466             :         else
     467           0 :             m_pMtrTransparent->SetText( "" );
     468             : 
     469             :         //aCtlPosition
     470           0 :         m_pMtrDistance->SaveValue();
     471           0 :         m_pLbShadowColor->SaveValue();
     472           0 :         m_pTsbShowShadow->SaveValue();
     473             : 
     474             :         // #66832# This field was not saved, but used to determine changes.
     475             :         // Why? Seems to be the error.
     476             :         // It IS the error.
     477           0 :         m_pMtrTransparent->SaveValue();
     478             : 
     479           0 :         ClickShadowHdl_Impl( NULL );
     480           0 :         ModifyShadowHdl_Impl( NULL );
     481             :     }
     482           0 : }
     483             : 
     484             : 
     485             : 
     486           0 : VclPtr<SfxTabPage> SvxShadowTabPage::Create( vcl::Window* pWindow,
     487             :                                              const SfxItemSet* rAttrs )
     488             : {
     489           0 :     return VclPtr<SvxShadowTabPage>::Create( pWindow, *rAttrs );
     490             : }
     491             : 
     492             : 
     493             : 
     494           0 : IMPL_LINK_NOARG(SvxShadowTabPage, ClickShadowHdl_Impl)
     495             : {
     496           0 :     if( m_pTsbShowShadow->GetState() == TRISTATE_FALSE )
     497             :     {
     498           0 :         m_pGridShadow->Disable();
     499             :     }
     500             :     else
     501             :     {
     502           0 :         m_pGridShadow->Enable();
     503             :     }
     504           0 :     m_pCtlPosition->Invalidate();
     505             : 
     506           0 :     ModifyShadowHdl_Impl( NULL );
     507             : 
     508           0 :     return 0L;
     509             : }
     510             : 
     511             : 
     512             : 
     513           0 : IMPL_LINK_NOARG(SvxShadowTabPage, ModifyShadowHdl_Impl)
     514             : {
     515           0 :     if( m_pTsbShowShadow->GetState() == TRISTATE_TRUE )
     516           0 :         rXFSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
     517             :     else
     518           0 :         rXFSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
     519             : 
     520           0 :     sal_Int32 nPos = m_pLbShadowColor->GetSelectEntryPos();
     521           0 :     if( nPos != LISTBOX_ENTRY_NOTFOUND )
     522             :     {
     523           0 :         rXFSet.Put( XFillColorItem( OUString(), m_pLbShadowColor->GetSelectEntryColor() ) );
     524             :     }
     525           0 :     sal_uInt16 nVal = (sal_uInt16)m_pMtrTransparent->GetValue();
     526           0 :     XFillTransparenceItem aItem( nVal );
     527           0 :     rXFSet.Put( XFillTransparenceItem( aItem ) );
     528             : 
     529             :     // shadow removal
     530           0 :     sal_Int32 nX = 0L, nY = 0L;
     531           0 :     sal_Int32 nXY = GetCoreValue( *m_pMtrDistance, ePoolUnit );
     532           0 :     switch( m_pCtlPosition->GetActualRP() )
     533             :     {
     534           0 :         case RP_LT: nX = nY = -nXY;      break;
     535           0 :         case RP_MT: nY = -nXY;           break;
     536           0 :         case RP_RT: nX = nXY; nY = -nXY; break;
     537           0 :         case RP_LM: nX = -nXY;           break;
     538           0 :         case RP_RM: nX = nXY;            break;
     539           0 :         case RP_LB: nX = -nXY; nY = nXY; break;
     540           0 :         case RP_MB: nY = nXY;            break;
     541           0 :         case RP_RB: nX = nY = nXY;       break;
     542           0 :         case RP_MM: break;
     543             :     }
     544             : 
     545           0 :     m_pCtlXRectPreview->SetShadowPosition(Point(nX, nY));
     546             : 
     547           0 :     m_pCtlXRectPreview->SetShadowAttributes(aXFillAttr.GetItemSet());
     548             :     //aCtlXRectPreview.SetFillAttr( aXFillAttr );
     549           0 :     m_pCtlXRectPreview->Invalidate();
     550             : 
     551           0 :     return 0L;
     552             : }
     553             : 
     554             : 
     555             : 
     556           0 : void SvxShadowTabPage::PointChanged( vcl::Window* pWindow, RECT_POINT eRcPt )
     557             : {
     558           0 :     eRP = eRcPt;
     559             : 
     560             :     // repaint shadow
     561           0 :     ModifyShadowHdl_Impl( pWindow );
     562           0 : }
     563             : 
     564           0 : void SvxShadowTabPage::PageCreated(const SfxAllItemSet& aSet)
     565             : {
     566           0 :     SFX_ITEMSET_ARG (&aSet,pColorListItem,SvxColorListItem,SID_COLOR_TABLE,false);
     567           0 :     SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,false);
     568           0 :     SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,false);
     569             : 
     570           0 :     if (pColorListItem)
     571           0 :         SetColorList(pColorListItem->GetColorList());
     572           0 :     if (pPageTypeItem)
     573           0 :         SetPageType(pPageTypeItem->GetValue());
     574           0 :     if (pDlgTypeItem)
     575           0 :         SetDlgType(pDlgTypeItem->GetValue());
     576           0 :     Construct();
     577           0 : }
     578             : 
     579             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11