LCOV - code coverage report
Current view: top level - cui/source/tabpages - tpshadow.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 255 0.0 %
Date: 2014-11-03 Functions: 0 16 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             : static const sal_uInt16 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 : void SvxShadowTabPage::Construct()
     169             : {
     170           0 :     m_pLbShadowColor->Fill( pColorList );
     171             : 
     172           0 :     if( bDisable )
     173             :     {
     174           0 :         m_pTsbShowShadow->Disable();
     175           0 :         m_pGridShadow->Disable();
     176             :     }
     177           0 : }
     178             : 
     179             : 
     180             : 
     181           0 : void SvxShadowTabPage::ActivatePage( const SfxItemSet& rSet )
     182             : {
     183             :     sal_Int32 nPos;
     184             :     sal_Int32 nCount;
     185             : 
     186           0 :     SFX_ITEMSET_ARG (&rSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,false);
     187           0 :     if (pPageTypeItem)
     188           0 :         SetPageType(pPageTypeItem->GetValue());
     189             : 
     190           0 :     if( nDlgType == 0 )
     191             :     {
     192           0 :         if( pColorList.is() )
     193             :         {
     194             :             // ColorList
     195           0 :             if( *pnColorListState & CT_CHANGED ||
     196           0 :                 *pnColorListState & CT_MODIFIED )
     197             :             {
     198           0 :                 if( *pnColorListState & CT_CHANGED )
     199             :                 {
     200           0 :                     SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( GetParentDialog() );
     201           0 :                     if( pArea )
     202             :                     {
     203           0 :                         pColorList = pArea->GetNewColorList();
     204             :                     }
     205             :                     else
     206             :                     {
     207           0 :                         SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( GetParentDialog() );
     208           0 :                         if( pLine )
     209           0 :                             pColorList = pLine->GetNewColorList();
     210             :                     }
     211             :                 }
     212             : 
     213           0 :                 m_pCtlXRectPreview->SetRectangleAttributes(rSet);
     214             :                 // aLbShadowColor
     215           0 :                 nPos = m_pLbShadowColor->GetSelectEntryPos();
     216           0 :                 m_pLbShadowColor->Clear();
     217           0 :                 m_pLbShadowColor->Fill( pColorList );
     218           0 :                 nCount = m_pLbShadowColor->GetEntryCount();
     219           0 :                 if( nCount == 0 )
     220             :                     ; // this case should not occur
     221           0 :                 else if( nCount <= nPos )
     222           0 :                     m_pLbShadowColor->SelectEntryPos( 0 );
     223             :                 else
     224           0 :                     m_pLbShadowColor->SelectEntryPos( nPos );
     225             : 
     226           0 :                 ModifyShadowHdl_Impl( this );
     227             :             }
     228           0 :             nPageType = PT_SHADOW;
     229             :         }
     230             :     }
     231           0 : }
     232             : 
     233             : 
     234             : 
     235           0 : int SvxShadowTabPage::DeactivatePage( SfxItemSet* _pSet )
     236             : {
     237           0 :     if( _pSet )
     238           0 :         FillItemSet( _pSet );
     239             : 
     240           0 :     return( LEAVE_PAGE );
     241             : }
     242             : 
     243             : 
     244             : 
     245           0 : bool SvxShadowTabPage::FillItemSet( SfxItemSet* rAttrs )
     246             : {
     247           0 :     const SfxPoolItem*  pOld = NULL;
     248           0 :     bool                bModified = false;
     249             : 
     250           0 :     if( !bDisable )
     251             :     {
     252           0 :         TriState eState = m_pTsbShowShadow->GetState();
     253           0 :         if( m_pTsbShowShadow->IsValueChangedFromSaved() )
     254             :         {
     255           0 :             SdrOnOffItem aItem( makeSdrShadowItem(sal::static_int_cast< sal_Bool >( eState )) );
     256           0 :             pOld = GetOldItem( *rAttrs, SDRATTR_SHADOW );
     257           0 :             if ( !pOld || !( *static_cast<const SdrOnOffItem*>(pOld) == aItem ) )
     258             :             {
     259           0 :                 rAttrs->Put( aItem );
     260           0 :                 bModified = true;
     261           0 :             }
     262             :         }
     263             : 
     264             :         // shadow removal
     265             :         // a bit intricate inquiry whether there was something changed,
     266             :         // as the items can't be displayed directly on controls
     267           0 :         sal_Int32 nX = 0L, nY = 0L;
     268           0 :         sal_Int32 nXY = GetCoreValue( *m_pMtrDistance, ePoolUnit );
     269             : 
     270           0 :         switch( m_pCtlPosition->GetActualRP() )
     271             :         {
     272           0 :             case RP_LT: nX = nY = -nXY;      break;
     273           0 :             case RP_MT: nY = -nXY;           break;
     274           0 :             case RP_RT: nX = nXY; nY = -nXY; break;
     275           0 :             case RP_LM: nX = -nXY;           break;
     276           0 :             case RP_RM: nX = nXY;            break;
     277           0 :             case RP_LB: nX = -nXY; nY = nXY; break;
     278           0 :             case RP_MB: nY = nXY;            break;
     279           0 :             case RP_RB: nX = nY = nXY;       break;
     280           0 :             case RP_MM: break;
     281             :         }
     282             : 
     283             :         // If the values of the shadow distances==SfxItemState::DONTCARE and the displayed
     284             :         // string in the respective MetricField=="", then the comparison of the old
     285             :         // and the new distance values would return a wrong result because in such a
     286             :         // case the new distance values would matche the default values of the MetricField !!!!
     287           0 :         if ( !m_pMtrDistance->IsEmptyFieldValue()                                  ||
     288           0 :              rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::DONTCARE ||
     289           0 :              rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::DONTCARE    )
     290             :         {
     291           0 :             sal_Int32 nOldX = 9876543; // impossible value, so DontCare
     292           0 :             sal_Int32 nOldY = 9876543;
     293           0 :             if( rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::DONTCARE &&
     294           0 :                 rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::DONTCARE )
     295             :             {
     296             :                 nOldX = static_cast<const SdrMetricItem&>( rOutAttrs.
     297           0 :                                     Get( SDRATTR_SHADOWXDIST ) ).GetValue();
     298             :                 nOldY = static_cast<const SdrMetricItem&>( rOutAttrs.
     299           0 :                                     Get( SDRATTR_SHADOWYDIST ) ).GetValue();
     300             :             }
     301           0 :             SdrMetricItem aXItem( makeSdrShadowXDistItem(nX) );
     302           0 :             pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWXDIST );
     303           0 :             if ( nX != nOldX &&
     304           0 :                 ( !pOld || !( *static_cast<const SdrMetricItem*>(pOld) == aXItem ) ) )
     305             :             {
     306           0 :                 rAttrs->Put( aXItem );
     307           0 :                 bModified = true;
     308             :             }
     309           0 :             SdrMetricItem aYItem( makeSdrShadowYDistItem(nY) );
     310           0 :             pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWYDIST );
     311           0 :             if ( nY != nOldY &&
     312           0 :                 ( !pOld || !( *static_cast<const SdrMetricItem*>(pOld) == aYItem ) ) )
     313             :             {
     314           0 :                 rAttrs->Put( aYItem );
     315           0 :                 bModified = true;
     316           0 :             }
     317             :         }
     318             : 
     319             :         // ShadowColor
     320           0 :         sal_Int32 nPos = m_pLbShadowColor->GetSelectEntryPos();
     321           0 :         if( nPos != LISTBOX_ENTRY_NOTFOUND &&
     322           0 :             m_pLbShadowColor->IsValueChangedFromSaved() )
     323             :         {
     324           0 :             XColorItem aItem(makeSdrShadowColorItem(m_pLbShadowColor->GetSelectEntryColor()));
     325           0 :             pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWCOLOR );
     326           0 :             if ( !pOld || !( *static_cast<const XColorItem*>(pOld) == aItem ) )
     327             :             {
     328           0 :                 rAttrs->Put( aItem );
     329           0 :                 bModified = true;
     330           0 :             }
     331             :         }
     332             : 
     333             :         // transparency
     334           0 :         sal_uInt16 nVal = (sal_uInt16)m_pMtrTransparent->GetValue();
     335           0 :         if( m_pMtrTransparent->IsValueChangedFromSaved() )
     336             :         {
     337           0 :             SdrPercentItem aItem( makeSdrShadowTransparenceItem(nVal) );
     338           0 :             pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWTRANSPARENCE );
     339           0 :             if ( !pOld || !( *static_cast<const SdrPercentItem*>(pOld) == aItem ) )
     340             :             {
     341           0 :                 rAttrs->Put( aItem );
     342           0 :                 bModified = true;
     343           0 :             }
     344             :         }
     345             :     }
     346             : 
     347           0 :     rAttrs->Put (CntUInt16Item(SID_PAGE_TYPE,nPageType));
     348             : 
     349           0 :     return( bModified );
     350             : }
     351             : 
     352             : 
     353             : 
     354           0 : void SvxShadowTabPage::Reset( const SfxItemSet* rAttrs )
     355             : {
     356           0 :     if( !bDisable )
     357             :     {
     358             :         // all objects can have a shadow
     359             :         // at the moment there are only 8 possible positions where a shadow can be set
     360             : 
     361             :         // has a shadow been set?
     362           0 :         if( rAttrs->GetItemState( SDRATTR_SHADOW ) != SfxItemState::DONTCARE )
     363             :         {
     364           0 :             m_pTsbShowShadow->EnableTriState( false );
     365             : 
     366           0 :             if( static_cast<const SdrOnOffItem&>( rAttrs->Get( SDRATTR_SHADOW ) ).GetValue() )
     367           0 :                 m_pTsbShowShadow->SetState( TRISTATE_TRUE );
     368             :             else
     369             :             {
     370           0 :                 m_pTsbShowShadow->SetState( TRISTATE_FALSE );
     371             :             }
     372             :         }
     373             :         else
     374           0 :             m_pTsbShowShadow->SetState( TRISTATE_INDET );
     375             : 
     376             :         // distance (only 8 possible positions),
     377             :         // so there is only one item evaluated
     378             : 
     379           0 :         if( rAttrs->GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::DONTCARE &&
     380           0 :             rAttrs->GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::DONTCARE )
     381             :         {
     382           0 :             sal_Int32 nX = static_cast<const SdrMetricItem&>( rAttrs->Get( SDRATTR_SHADOWXDIST ) ).GetValue();
     383           0 :             sal_Int32 nY = static_cast<const SdrMetricItem&>( rAttrs->Get( SDRATTR_SHADOWYDIST ) ).GetValue();
     384             : 
     385           0 :             if( nX != 0 )
     386           0 :                 SetMetricValue( *m_pMtrDistance, nX < 0L ? -nX : nX, ePoolUnit );
     387             :             else
     388           0 :                 SetMetricValue( *m_pMtrDistance, nY < 0L ? -nY : nY, ePoolUnit );
     389             : 
     390             :             // setting the shadow control
     391           0 :             if     ( nX <  0L && nY <  0L ) m_pCtlPosition->SetActualRP( RP_LT );
     392           0 :             else if( nX == 0L && nY <  0L ) m_pCtlPosition->SetActualRP( RP_MT );
     393           0 :             else if( nX >  0L && nY <  0L ) m_pCtlPosition->SetActualRP( RP_RT );
     394           0 :             else if( nX <  0L && nY == 0L ) m_pCtlPosition->SetActualRP( RP_LM );
     395             :             // there's no center point anymore
     396           0 :             else if( nX == 0L && nY == 0L ) m_pCtlPosition->SetActualRP( RP_RB );
     397           0 :             else if( nX >  0L && nY == 0L ) m_pCtlPosition->SetActualRP( RP_RM );
     398           0 :             else if( nX <  0L && nY >  0L ) m_pCtlPosition->SetActualRP( RP_LB );
     399           0 :             else if( nX == 0L && nY >  0L ) m_pCtlPosition->SetActualRP( RP_MB );
     400           0 :             else if( nX >  0L && nY >  0L ) m_pCtlPosition->SetActualRP( RP_RB );
     401             :         }
     402             :         else
     403             :         {
     404             :             // determine default-distance
     405           0 :             SfxItemPool* pPool = rOutAttrs.GetPool();
     406           0 :             const SdrMetricItem* pXDistItem = static_cast<const SdrMetricItem*>(&pPool->GetDefaultItem(SDRATTR_SHADOWXDIST));
     407           0 :             const SdrMetricItem* pYDistItem = static_cast<const SdrMetricItem*>(&pPool->GetDefaultItem(SDRATTR_SHADOWYDIST));
     408           0 :             if (pXDistItem && pYDistItem)
     409             :             {
     410           0 :                 sal_Int32 nX = pXDistItem->GetValue();
     411           0 :                 sal_Int32 nY = pYDistItem->GetValue();
     412           0 :                 if( nX != 0 )
     413           0 :                     SetMetricValue( *m_pMtrDistance, nX < 0L ? -nX : nX, ePoolUnit );
     414             :                 else
     415           0 :                     SetMetricValue( *m_pMtrDistance, nY < 0L ? -nY : nY, ePoolUnit );
     416             :             }
     417             : 
     418             :             // Tristate, e. g. multiple objects have been marked of which some have a shadow and some don't.
     419             :             // The text (which shall be displayed) of the MetricFields is set to "" and serves as an
     420             :             // identification in the method FillItemSet for the fact that the distance value was NOT changed !!!!
     421           0 :             m_pMtrDistance->SetText( "" );
     422           0 :             m_pCtlPosition->SetActualRP( RP_MM );
     423             :         }
     424             : 
     425           0 :         if( rAttrs->GetItemState( SDRATTR_SHADOWCOLOR ) != SfxItemState::DONTCARE )
     426             :         {
     427           0 :             m_pLbShadowColor->SelectEntry( static_cast<const XColorItem&>( rAttrs->Get( SDRATTR_SHADOWCOLOR ) ).GetColorValue() );
     428             :         }
     429             :         else
     430           0 :             m_pLbShadowColor->SetNoSelection();
     431             : 
     432           0 :         if( rAttrs->GetItemState( SDRATTR_SHADOWTRANSPARENCE ) != SfxItemState::DONTCARE )
     433             :         {
     434           0 :             sal_uInt16 nTransp = static_cast<const SdrPercentItem&>( rAttrs->Get( SDRATTR_SHADOWTRANSPARENCE ) ).GetValue();
     435           0 :             m_pMtrTransparent->SetValue( nTransp );
     436             :         }
     437             :         else
     438           0 :             m_pMtrTransparent->SetText( "" );
     439             : 
     440             :         //aCtlPosition
     441           0 :         m_pMtrDistance->SaveValue();
     442           0 :         m_pLbShadowColor->SaveValue();
     443           0 :         m_pTsbShowShadow->SaveValue();
     444             : 
     445             :         // #66832# This field was not saved, but used to determine changes.
     446             :         // Why? Seems to be the error.
     447             :         // It IS the error.
     448           0 :         m_pMtrTransparent->SaveValue();
     449             : 
     450           0 :         ClickShadowHdl_Impl( NULL );
     451           0 :         ModifyShadowHdl_Impl( NULL );
     452             :     }
     453           0 : }
     454             : 
     455             : 
     456             : 
     457           0 : SfxTabPage* SvxShadowTabPage::Create( vcl::Window* pWindow,
     458             :                 const SfxItemSet* rAttrs )
     459             : {
     460           0 :     return( new SvxShadowTabPage( pWindow, *rAttrs ) );
     461             : }
     462             : 
     463             : 
     464             : 
     465           0 : const sal_uInt16* SvxShadowTabPage::GetRanges()
     466             : {
     467           0 :     return( pShadowRanges );
     468             : }
     469             : 
     470             : 
     471             : 
     472           0 : IMPL_LINK_NOARG(SvxShadowTabPage, ClickShadowHdl_Impl)
     473             : {
     474           0 :     if( m_pTsbShowShadow->GetState() == TRISTATE_FALSE )
     475             :     {
     476           0 :         m_pGridShadow->Disable();
     477             :     }
     478             :     else
     479             :     {
     480           0 :         m_pGridShadow->Enable();
     481             :     }
     482           0 :     m_pCtlPosition->Invalidate();
     483             : 
     484           0 :     ModifyShadowHdl_Impl( NULL );
     485             : 
     486           0 :     return( 0L );
     487             : }
     488             : 
     489             : 
     490             : 
     491           0 : IMPL_LINK_NOARG(SvxShadowTabPage, ModifyShadowHdl_Impl)
     492             : {
     493           0 :     if( m_pTsbShowShadow->GetState() == TRISTATE_TRUE )
     494           0 :         rXFSet.Put( XFillStyleItem( drawing::FillStyle_SOLID ) );
     495             :     else
     496           0 :         rXFSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) );
     497             : 
     498           0 :     sal_Int32 nPos = m_pLbShadowColor->GetSelectEntryPos();
     499           0 :     if( nPos != LISTBOX_ENTRY_NOTFOUND )
     500             :     {
     501           0 :         rXFSet.Put( XFillColorItem( OUString(), m_pLbShadowColor->GetSelectEntryColor() ) );
     502             :     }
     503           0 :     sal_uInt16 nVal = (sal_uInt16)m_pMtrTransparent->GetValue();
     504           0 :     XFillTransparenceItem aItem( nVal );
     505           0 :     rXFSet.Put( XFillTransparenceItem( aItem ) );
     506             : 
     507             :     // shadow removal
     508           0 :     sal_Int32 nX = 0L, nY = 0L;
     509           0 :     sal_Int32 nXY = GetCoreValue( *m_pMtrDistance, ePoolUnit );
     510           0 :     switch( m_pCtlPosition->GetActualRP() )
     511             :     {
     512           0 :         case RP_LT: nX = nY = -nXY;      break;
     513           0 :         case RP_MT: nY = -nXY;           break;
     514           0 :         case RP_RT: nX = nXY; nY = -nXY; break;
     515           0 :         case RP_LM: nX = -nXY;           break;
     516           0 :         case RP_RM: nX = nXY;            break;
     517           0 :         case RP_LB: nX = -nXY; nY = nXY; break;
     518           0 :         case RP_MB: nY = nXY;            break;
     519           0 :         case RP_RB: nX = nY = nXY;       break;
     520           0 :         case RP_MM: break;
     521             :     }
     522             : 
     523           0 :     m_pCtlXRectPreview->SetShadowPosition(Point(nX, nY));
     524             : 
     525           0 :     m_pCtlXRectPreview->SetShadowAttributes(aXFillAttr.GetItemSet());
     526             :     //aCtlXRectPreview.SetFillAttr( aXFillAttr );
     527           0 :     m_pCtlXRectPreview->Invalidate();
     528             : 
     529           0 :     return( 0L );
     530             : }
     531             : 
     532             : 
     533             : 
     534           0 : void SvxShadowTabPage::PointChanged( vcl::Window* pWindow, RECT_POINT eRcPt )
     535             : {
     536           0 :     eRP = eRcPt;
     537             : 
     538             :     // repaint shadow
     539           0 :     ModifyShadowHdl_Impl( pWindow );
     540           0 : }
     541             : 
     542           0 : void SvxShadowTabPage::PageCreated(const SfxAllItemSet& aSet)
     543             : {
     544           0 :     SFX_ITEMSET_ARG (&aSet,pColorListItem,SvxColorListItem,SID_COLOR_TABLE,false);
     545           0 :     SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,false);
     546           0 :     SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,false);
     547             : 
     548           0 :     if (pColorListItem)
     549           0 :         SetColorList(pColorListItem->GetColorList());
     550           0 :     if (pPageTypeItem)
     551           0 :         SetPageType(pPageTypeItem->GetValue());
     552           0 :     if (pDlgTypeItem)
     553           0 :         SetDlgType(pDlgTypeItem->GetValue());
     554           0 :     Construct();
     555           0 : }
     556             : 
     557             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10