[Libreoffice-commits] core.git: cui/source

Noel Grandin noel at peralex.com
Mon Jun 27 05:19:12 UTC 2016


 cui/source/customize/macropg.cxx |    1 
 cui/source/dialogs/iconcdlg.cxx  |   82 +--------
 cui/source/inc/cuitabarea.hxx    |    4 
 cui/source/inc/iconcdlg.hxx      |    5 
 cui/source/inc/macropg.hxx       |    2 
 cui/source/inc/treeopt.hxx       |    1 
 cui/source/options/treeopt.cxx   |    5 
 cui/source/tabpages/tpcolor.cxx  |    1 
 cui/source/tabpages/tpshadow.cxx |  331 ++++++++++++++++++---------------------
 9 files changed, 173 insertions(+), 259 deletions(-)

New commits:
commit 98747742b20c82382ed16b193e7bec175e905978
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Jun 24 13:12:25 2016 +0200

    loplugin:singlevalfields in cui
    
    Change-Id: Iead1e3130779566661eccf91556816724afcaa66
    Reviewed-on: https://gerrit.libreoffice.org/26635
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index 0c32d0b..ad8517c 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -229,7 +229,6 @@ SvxMacroTabPage_::SvxMacroTabPage_(vcl::Window* pParent, const OString& rID,
     : SfxTabPage( pParent, rID, rUIXMLDescription, &rAttrSet ),
     m_xAppEvents(nullptr),
     m_xDocEvents(nullptr),
-    bReadOnly(false),
     bDocModified(false),
     bAppEvents(false),
     bInitialized(false)
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx
index 5f13d48..1a89730 100644
--- a/cui/source/dialogs/iconcdlg.cxx
+++ b/cui/source/dialogs/iconcdlg.cxx
@@ -165,10 +165,7 @@ IconChoiceDialog::IconChoiceDialog ( vcl::Window* pParent, const OUString& rID,
     pExampleSet     ( nullptr ),
     pRanges         ( nullptr ),
 
-    bHideResetBtn   ( false ),
-    bModal          ( false ),
-    bInOK           ( false ),
-    bItemsReset     ( false )
+    bInOK           ( false )
 {
     get(m_pOKBtn, "ok");
     get(m_pApplyBtn, "apply");
@@ -232,8 +229,6 @@ void IconChoiceDialog::dispose()
                 //SetViewOptUserItem( aTabPageOpt, aPageData );
             }
 
-            if ( pData->bOnDemand )
-                delete &pData->pPage->GetItemSet();
             pData->pPage.disposeAndClear();
         }
         delete pData;
@@ -283,7 +278,6 @@ SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage(
     maPageList.push_back( pData );
 
     pData->fnGetRanges = nullptr;
-    pData->bOnDemand = false;
 
     sal_uInt16 *pId = new sal_uInt16 ( nId );
     SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->InsertEntry( rIconText, rChoiceIcon );
@@ -370,13 +364,8 @@ IMPL_LINK_NOARG_TYPED(IconChoiceDialog, OkHdl, Button*, void)
 
     if ( OK_Impl() )
     {
-        if ( bModal )
-            EndDialog( Ok() );
-        else
-        {
-            Ok();
-            Close();
-        }
+        Ok();
+        Close();
     }
 }
 
@@ -387,13 +376,8 @@ IMPL_LINK_NOARG_TYPED(IconChoiceDialog, ApplyHdl, Button*, void)
 
     if ( OK_Impl() )
     {
-        if ( bModal )
-            EndDialog( Ok() );
-        else
-        {
-            Ok();
-            Close();
-        }
+        Ok();
+        Close();
     }
 }
 
@@ -404,14 +388,7 @@ IMPL_LINK_NOARG_TYPED(IconChoiceDialog, ResetHdl, Button*, void)
     IconChoicePageData* pData = GetPageData ( mnCurrentPageId );
     DBG_ASSERT( pData, "Id nicht bekannt" );
 
-    if ( pData->bOnDemand )
-    {
-        // CSet on AIS has problems here, therefore separated
-        const SfxItemSet* _pSet = &( pData->pPage->GetItemSet() );
-        pData->pPage->Reset( *const_cast<SfxItemSet*>(_pSet) );
-    }
-    else
-        pData->pPage->Reset( *pSet );
+    pData->pPage->Reset( *pSet );
 }
 
 
@@ -431,30 +408,13 @@ void IconChoiceDialog::ActivatePageImpl ()
     DBG_ASSERT( !maPageList.empty(), "keine Pages angemeldet" );
     IconChoicePageData* pData = GetPageData ( mnCurrentPageId );
     DBG_ASSERT( pData, "Id nicht bekannt" );
-    bool bReadOnly = false;
     if ( pData )
     {
         if ( !pData->pPage )
         {
-            const SfxItemSet* pTmpSet = nullptr;
-
-            if ( pSet )
-            {
-                if ( bItemsReset && pSet->GetParent() )
-                    pTmpSet = pSet->GetParent();
-                else
-                    pTmpSet = pSet;
-            }
+            pData->pPage = (pData->fnCreatePage)( m_pTabContainer, this, *CreateInputItemSet( mnCurrentPageId ) );
 
-            if ( pTmpSet && !pData->bOnDemand )
-                pData->pPage = (pData->fnCreatePage)( m_pTabContainer, this, *pTmpSet );
-            else
-                pData->pPage = (pData->fnCreatePage)( m_pTabContainer, this, *CreateInputItemSet( mnCurrentPageId ) );
-
-            if ( pData->bOnDemand )
-                pData->pPage->Reset( (SfxItemSet &)pData->pPage->GetItemSet() );
-            else
-                pData->pPage->Reset( *pSet );
+            pData->pPage->Reset( *pSet );
 
             PageCreated( mnCurrentPageId, *pData->pPage );
         }
@@ -468,15 +428,9 @@ void IconChoiceDialog::ActivatePageImpl ()
         if ( pExampleSet )
             pData->pPage->ActivatePage( *pExampleSet );
         SetHelpId( pData->pPage->GetHelpId() );
-        bReadOnly = false;
     }
 
-
-    if ( bReadOnly || bHideResetBtn )
-        m_pResetBtn->Hide();
-    else
-        m_pResetBtn->Show();
-
+    m_pResetBtn->Show();
 }
 
 
@@ -545,14 +499,7 @@ void IconChoiceDialog::ResetPageImpl ()
 
     DBG_ASSERT( pData, "Id nicht bekannt" );
 
-    if ( pData->bOnDemand )
-    {
-        // CSet on AIS has problems here, therefore separated
-        const SfxItemSet* _pSet = &pData->pPage->GetItemSet();
-        pData->pPage->Reset( *const_cast<SfxItemSet*>(_pSet) );
-    }
-    else
-        pData->pPage->Reset( *pSet );
+    pData->pPage->Reset( *pSet );
 }
 
 /**********************************************************************
@@ -656,7 +603,6 @@ short IconChoiceDialog::Execute()
 void IconChoiceDialog::Start()
 {
     m_pCancelBtn->SetClickHdl( LINK( this, IconChoiceDialog, CancelHdl ) );
-    bModal = false;
 
     Start_Impl();
 }
@@ -765,13 +711,7 @@ short IconChoiceDialog::Ok()
 
         if ( pPage )
         {
-            if ( pData->bOnDemand )
-            {
-                SfxItemSet& rSet = (SfxItemSet&)pPage->GetItemSet();
-                rSet.ClearItem();
-                _bModified |= pPage->FillItemSet( &rSet );
-            }
-            else if ( pSet && !pPage->HasExchangeSupport() )
+            if ( pSet && !pPage->HasExchangeSupport() )
             {
                 SfxItemSet aTmp( *pSet->GetPool(), pSet->GetRanges() );
 
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index b382e72..d2a0391 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -337,8 +337,6 @@ private:
     sal_uInt16          m_nDlgType;
     bool*               m_pbAreaTP;
 
-    bool                m_bDisable;
-
     XFillAttrSetItem    m_aXFillAttr;
     SfxItemSet&         m_rXFSet;
     SfxMapUnit          m_ePoolUnit;
@@ -647,7 +645,7 @@ class SvxColorTabPage : public SfxTabPage
     using TabPage::DeactivatePage;
 
 private:
-    XPropertyListType   meType;
+    static const XPropertyListType meType = XCOLOR_LIST;
 
     VclPtr<Window>             mpTopDlg;
     VclPtr<CheckBox>           m_pBoxEmbed;
diff --git a/cui/source/inc/iconcdlg.hxx b/cui/source/inc/iconcdlg.hxx
index eb58bb2..b592f7f 100644
--- a/cui/source/inc/iconcdlg.hxx
+++ b/cui/source/inc/iconcdlg.hxx
@@ -48,7 +48,6 @@ struct IconChoicePageData
     CreatePage fnCreatePage;    ///< pointer to the factory
     GetPageRanges fnGetRanges;  ///< pointer to the ranges-function
     VclPtr<IconChoicePage> pPage;      ///< the TabPage itself
-    bool bOnDemand;         ///< Flag: ItemSet onDemand
     bool bRefresh;          ///< Flag: page has to be newly initialized
 
     // constructor
@@ -57,7 +56,6 @@ struct IconChoicePageData
           fnCreatePage  ( fnPage ),
           fnGetRanges   ( fnRanges ),
           pPage         ( nullptr ),
-          bOnDemand     ( false ),
           bRefresh      ( false )
     {}
 };
@@ -123,10 +121,7 @@ private:
     SfxItemSet*             pExampleSet;
     sal_uInt16*                 pRanges;
 
-    bool                    bHideResetBtn;
-    bool                    bModal;
     bool                    bInOK;
-    bool                    bItemsReset;
 
     DECL_LINK_TYPED( ChosePageHdl_Impl, SvtIconChoiceCtrl*, void );
     DECL_LINK_TYPED( OkHdl, Button*, void );
diff --git a/cui/source/inc/macropg.hxx b/cui/source/inc/macropg.hxx
index e78045b..b5eb5ab 100644
--- a/cui/source/inc/macropg.hxx
+++ b/cui/source/inc/macropg.hxx
@@ -71,7 +71,7 @@ protected:
     css::uno::Reference< css::util::XModifiable > m_xModifiable;
     EventsHash m_appEventsHash;
     EventsHash m_docEventsHash;
-    bool bReadOnly, bDocModified, bAppEvents, bInitialized;
+    bool bDocModified, bAppEvents, bInitialized;
     EventDisplayNames aDisplayNames;
 
     SvxMacroTabPage_( vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const SfxItemSet& rItemSet );
diff --git a/cui/source/inc/treeopt.hxx b/cui/source/inc/treeopt.hxx
index 9cac992..35bff4e 100644
--- a/cui/source/inc/treeopt.hxx
+++ b/cui/source/inc/treeopt.hxx
@@ -246,7 +246,6 @@ private:
                         m_xEventHdl;
     css::uno::Reference< css::awt::XContainerWindowProvider >
                         m_xWinProvider;
-    bool                m_bIsWindowHidden;
 
     void                CreateDialogWithHandler();
     bool                DispatchAction( const OUString& rAction );
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index ecdb269..188c7bd 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -2155,9 +2155,7 @@ ExtensionsTabPage::ExtensionsTabPage(
 
     m_sPageURL          ( rPageURL ),
     m_sEventHdl         ( rEvtHdl ),
-    m_xWinProvider      ( rProvider ),
-    m_bIsWindowHidden   ( false )
-
+    m_xWinProvider      ( rProvider )
 {
 }
 
@@ -2272,7 +2270,6 @@ void ExtensionsTabPage::ActivatePage()
     if ( m_xPage.is() )
     {
         m_xPage->setVisible( true );
-        m_bIsWindowHidden = false;
     }
 }
 
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index a66c27c..c85a80e 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -305,7 +305,6 @@ struct SvxColorTabPageShadow
 
 SvxColorTabPage::SvxColorTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs)
     : SfxTabPage(pParent, "ColorPage", "cui/ui/colorpage.ui", &rInAttrs)
-    , meType( XCOLOR_LIST )
     , mpTopDlg( GetParentDialog() )
     , pShadow             ( new SvxColorTabPageShadow() )
     , rOutAttrs           ( rInAttrs )
diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx
index b114f74..a363fc5 100644
--- a/cui/source/tabpages/tpshadow.cxx
+++ b/cui/source/tabpages/tpshadow.cxx
@@ -59,7 +59,6 @@ SvxShadowTabPage::SvxShadowTabPage( vcl::Window* pParent, const SfxItemSet& rInA
     m_nPageType           ( 0 ),
     m_nDlgType            ( 0 ),
     m_pbAreaTP            ( nullptr ),
-    m_bDisable            ( false ),
     m_aXFillAttr          ( rInAttrs.GetPool() ),
     m_rXFSet              ( m_aXFillAttr.GetItemSet() )
 {
@@ -186,12 +185,6 @@ void SvxShadowTabPage::dispose()
 void SvxShadowTabPage::Construct()
 {
     m_pLbShadowColor->Fill( m_pColorList );
-
-    if( m_bDisable )
-    {
-        m_pTsbShowShadow->Disable();
-        m_pGridShadow->Disable();
-    }
 }
 
 
@@ -268,106 +261,103 @@ bool SvxShadowTabPage::FillItemSet( SfxItemSet* rAttrs )
 {
     bool                bModified = false;
 
-    if( !m_bDisable )
-    {
-        const SfxPoolItem*  pOld = nullptr;
+    const SfxPoolItem*  pOld = nullptr;
 
-        if( m_pTsbShowShadow->IsValueChangedFromSaved() )
+    if( m_pTsbShowShadow->IsValueChangedFromSaved() )
+    {
+        TriState eState = m_pTsbShowShadow->GetState();
+        assert(eState != TRISTATE_INDET);
+            // given how m_pTsbShowShadow is set up and saved in Reset(),
+            // eState == TRISTATE_INDET would imply
+            // !IsValueChangedFromSaved()
+        SdrOnOffItem aItem( makeSdrShadowItem(eState == TRISTATE_TRUE) );
+        pOld = GetOldItem( *rAttrs, SDRATTR_SHADOW );
+        if ( !pOld || !( *static_cast<const SdrOnOffItem*>(pOld) == aItem ) )
         {
-            TriState eState = m_pTsbShowShadow->GetState();
-            assert(eState != TRISTATE_INDET);
-                // given how m_pTsbShowShadow is set up and saved in Reset(),
-                // eState == TRISTATE_INDET would imply
-                // !IsValueChangedFromSaved()
-            SdrOnOffItem aItem( makeSdrShadowItem(eState == TRISTATE_TRUE) );
-            pOld = GetOldItem( *rAttrs, SDRATTR_SHADOW );
-            if ( !pOld || !( *static_cast<const SdrOnOffItem*>(pOld) == aItem ) )
-            {
-                rAttrs->Put( aItem );
-                bModified = true;
-            }
+            rAttrs->Put( aItem );
+            bModified = true;
         }
+    }
 
-        // shadow removal
-        // a bit intricate inquiry whether there was something changed,
-        // as the items can't be displayed directly on controls
-        sal_Int32 nX = 0L, nY = 0L;
-        sal_Int32 nXY = GetCoreValue( *m_pMtrDistance, m_ePoolUnit );
+    // shadow removal
+    // a bit intricate inquiry whether there was something changed,
+    // as the items can't be displayed directly on controls
+    sal_Int32 nX = 0L, nY = 0L;
+    sal_Int32 nXY = GetCoreValue( *m_pMtrDistance, m_ePoolUnit );
+
+    switch( m_pCtlPosition->GetActualRP() )
+    {
+        case RP_LT: nX = nY = -nXY;      break;
+        case RP_MT: nY = -nXY;           break;
+        case RP_RT: nX = nXY; nY = -nXY; break;
+        case RP_LM: nX = -nXY;           break;
+        case RP_RM: nX = nXY;            break;
+        case RP_LB: nX = -nXY; nY = nXY; break;
+        case RP_MB: nY = nXY;            break;
+        case RP_RB: nX = nY = nXY;       break;
+        case RP_MM: break;
+    }
 
-        switch( m_pCtlPosition->GetActualRP() )
+    // If the values of the shadow distances==SfxItemState::DONTCARE and the displayed
+    // string in the respective MetricField=="", then the comparison of the old
+    // and the new distance values would return a wrong result because in such a
+    // case the new distance values would match the default values of the MetricField !!!!
+    if ( !m_pMtrDistance->IsEmptyFieldValue()                                  ||
+         m_rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::DONTCARE ||
+         m_rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::DONTCARE    )
+    {
+        sal_Int32 nOldX = 9876543; // impossible value, so DontCare
+        sal_Int32 nOldY = 9876543;
+        if( m_rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::DONTCARE &&
+            m_rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::DONTCARE )
         {
-            case RP_LT: nX = nY = -nXY;      break;
-            case RP_MT: nY = -nXY;           break;
-            case RP_RT: nX = nXY; nY = -nXY; break;
-            case RP_LM: nX = -nXY;           break;
-            case RP_RM: nX = nXY;            break;
-            case RP_LB: nX = -nXY; nY = nXY; break;
-            case RP_MB: nY = nXY;            break;
-            case RP_RB: nX = nY = nXY;       break;
-            case RP_MM: break;
+            nOldX = static_cast<const SdrMetricItem&>( m_rOutAttrs.
+                                Get( SDRATTR_SHADOWXDIST ) ).GetValue();
+            nOldY = static_cast<const SdrMetricItem&>( m_rOutAttrs.
+                                Get( SDRATTR_SHADOWYDIST ) ).GetValue();
         }
-
-        // If the values of the shadow distances==SfxItemState::DONTCARE and the displayed
-        // string in the respective MetricField=="", then the comparison of the old
-        // and the new distance values would return a wrong result because in such a
-        // case the new distance values would match the default values of the MetricField !!!!
-        if ( !m_pMtrDistance->IsEmptyFieldValue()                                  ||
-             m_rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::DONTCARE ||
-             m_rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::DONTCARE    )
+        SdrMetricItem aXItem( makeSdrShadowXDistItem(nX) );
+        pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWXDIST );
+        if ( nX != nOldX &&
+            ( !pOld || !( *static_cast<const SdrMetricItem*>(pOld) == aXItem ) ) )
         {
-            sal_Int32 nOldX = 9876543; // impossible value, so DontCare
-            sal_Int32 nOldY = 9876543;
-            if( m_rOutAttrs.GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::DONTCARE &&
-                m_rOutAttrs.GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::DONTCARE )
-            {
-                nOldX = static_cast<const SdrMetricItem&>( m_rOutAttrs.
-                                    Get( SDRATTR_SHADOWXDIST ) ).GetValue();
-                nOldY = static_cast<const SdrMetricItem&>( m_rOutAttrs.
-                                    Get( SDRATTR_SHADOWYDIST ) ).GetValue();
-            }
-            SdrMetricItem aXItem( makeSdrShadowXDistItem(nX) );
-            pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWXDIST );
-            if ( nX != nOldX &&
-                ( !pOld || !( *static_cast<const SdrMetricItem*>(pOld) == aXItem ) ) )
-            {
-                rAttrs->Put( aXItem );
-                bModified = true;
-            }
-            SdrMetricItem aYItem( makeSdrShadowYDistItem(nY) );
-            pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWYDIST );
-            if ( nY != nOldY &&
-                ( !pOld || !( *static_cast<const SdrMetricItem*>(pOld) == aYItem ) ) )
-            {
-                rAttrs->Put( aYItem );
-                bModified = true;
-            }
+            rAttrs->Put( aXItem );
+            bModified = true;
+        }
+        SdrMetricItem aYItem( makeSdrShadowYDistItem(nY) );
+        pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWYDIST );
+        if ( nY != nOldY &&
+            ( !pOld || !( *static_cast<const SdrMetricItem*>(pOld) == aYItem ) ) )
+        {
+            rAttrs->Put( aYItem );
+            bModified = true;
         }
+    }
 
-        // ShadowColor
-        sal_Int32 nPos = m_pLbShadowColor->GetSelectEntryPos();
-        if( nPos != LISTBOX_ENTRY_NOTFOUND &&
-            m_pLbShadowColor->IsValueChangedFromSaved() )
+    // ShadowColor
+    sal_Int32 nPos = m_pLbShadowColor->GetSelectEntryPos();
+    if( nPos != LISTBOX_ENTRY_NOTFOUND &&
+        m_pLbShadowColor->IsValueChangedFromSaved() )
+    {
+        XColorItem aItem(makeSdrShadowColorItem(m_pLbShadowColor->GetSelectEntryColor()));
+        pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWCOLOR );
+        if ( !pOld || !( *static_cast<const XColorItem*>(pOld) == aItem ) )
         {
-            XColorItem aItem(makeSdrShadowColorItem(m_pLbShadowColor->GetSelectEntryColor()));
-            pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWCOLOR );
-            if ( !pOld || !( *static_cast<const XColorItem*>(pOld) == aItem ) )
-            {
-                rAttrs->Put( aItem );
-                bModified = true;
-            }
+            rAttrs->Put( aItem );
+            bModified = true;
         }
+    }
 
-        // transparency
-        sal_uInt16 nVal = (sal_uInt16)m_pMtrTransparent->GetValue();
-        if( m_pMtrTransparent->IsValueChangedFromSaved() )
+    // transparency
+    sal_uInt16 nVal = (sal_uInt16)m_pMtrTransparent->GetValue();
+    if( m_pMtrTransparent->IsValueChangedFromSaved() )
+    {
+        SdrPercentItem aItem( makeSdrShadowTransparenceItem(nVal) );
+        pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWTRANSPARENCE );
+        if ( !pOld || !( *static_cast<const SdrPercentItem*>(pOld) == aItem ) )
         {
-            SdrPercentItem aItem( makeSdrShadowTransparenceItem(nVal) );
-            pOld = GetOldItem( *rAttrs, SDRATTR_SHADOWTRANSPARENCE );
-            if ( !pOld || !( *static_cast<const SdrPercentItem*>(pOld) == aItem ) )
-            {
-                rAttrs->Put( aItem );
-                bModified = true;
-            }
+            rAttrs->Put( aItem );
+            bModified = true;
         }
     }
 
@@ -379,103 +369,100 @@ bool SvxShadowTabPage::FillItemSet( SfxItemSet* rAttrs )
 
 void SvxShadowTabPage::Reset( const SfxItemSet* rAttrs )
 {
-    if( !m_bDisable )
+    // all objects can have a shadow
+    // at the moment there are only 8 possible positions where a shadow can be set
+
+    // has a shadow been set?
+    if( rAttrs->GetItemState( SDRATTR_SHADOW ) != SfxItemState::DONTCARE )
     {
-        // all objects can have a shadow
-        // at the moment there are only 8 possible positions where a shadow can be set
+        m_pTsbShowShadow->EnableTriState( false );
 
-        // has a shadow been set?
-        if( rAttrs->GetItemState( SDRATTR_SHADOW ) != SfxItemState::DONTCARE )
+        if( static_cast<const SdrOnOffItem&>( rAttrs->Get( SDRATTR_SHADOW ) ).GetValue() )
+            m_pTsbShowShadow->SetState( TRISTATE_TRUE );
+        else
         {
-            m_pTsbShowShadow->EnableTriState( false );
-
-            if( static_cast<const SdrOnOffItem&>( rAttrs->Get( SDRATTR_SHADOW ) ).GetValue() )
-                m_pTsbShowShadow->SetState( TRISTATE_TRUE );
-            else
-            {
-                m_pTsbShowShadow->SetState( TRISTATE_FALSE );
-            }
+            m_pTsbShowShadow->SetState( TRISTATE_FALSE );
         }
-        else
-            m_pTsbShowShadow->SetState( TRISTATE_INDET );
+    }
+    else
+        m_pTsbShowShadow->SetState( TRISTATE_INDET );
 
-        // distance (only 8 possible positions),
-        // so there is only one item evaluated
+    // distance (only 8 possible positions),
+    // so there is only one item evaluated
 
-        if( rAttrs->GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::DONTCARE &&
-            rAttrs->GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::DONTCARE )
-        {
-            sal_Int32 nX = static_cast<const SdrMetricItem&>( rAttrs->Get( SDRATTR_SHADOWXDIST ) ).GetValue();
-            sal_Int32 nY = static_cast<const SdrMetricItem&>( rAttrs->Get( SDRATTR_SHADOWYDIST ) ).GetValue();
+    if( rAttrs->GetItemState( SDRATTR_SHADOWXDIST ) != SfxItemState::DONTCARE &&
+        rAttrs->GetItemState( SDRATTR_SHADOWYDIST ) != SfxItemState::DONTCARE )
+    {
+        sal_Int32 nX = static_cast<const SdrMetricItem&>( rAttrs->Get( SDRATTR_SHADOWXDIST ) ).GetValue();
+        sal_Int32 nY = static_cast<const SdrMetricItem&>( rAttrs->Get( SDRATTR_SHADOWYDIST ) ).GetValue();
 
+        if( nX != 0 )
+            SetMetricValue( *m_pMtrDistance, nX < 0L ? -nX : nX, m_ePoolUnit );
+        else
+            SetMetricValue( *m_pMtrDistance, nY < 0L ? -nY : nY, m_ePoolUnit );
+
+        // setting the shadow control
+        if     ( nX <  0L && nY <  0L ) m_pCtlPosition->SetActualRP( RP_LT );
+        else if( nX == 0L && nY <  0L ) m_pCtlPosition->SetActualRP( RP_MT );
+        else if( nX >  0L && nY <  0L ) m_pCtlPosition->SetActualRP( RP_RT );
+        else if( nX <  0L && nY == 0L ) m_pCtlPosition->SetActualRP( RP_LM );
+        // there's no center point anymore
+        else if( nX == 0L && nY == 0L ) m_pCtlPosition->SetActualRP( RP_RB );
+        else if( nX >  0L && nY == 0L ) m_pCtlPosition->SetActualRP( RP_RM );
+        else if( nX <  0L && nY >  0L ) m_pCtlPosition->SetActualRP( RP_LB );
+        else if( nX == 0L && nY >  0L ) m_pCtlPosition->SetActualRP( RP_MB );
+        else if( nX >  0L && nY >  0L ) m_pCtlPosition->SetActualRP( RP_RB );
+    }
+    else
+    {
+        // determine default-distance
+        SfxItemPool* pPool = m_rOutAttrs.GetPool();
+        const SdrMetricItem* pXDistItem = static_cast<const SdrMetricItem*>(&pPool->GetDefaultItem(SDRATTR_SHADOWXDIST));
+        const SdrMetricItem* pYDistItem = static_cast<const SdrMetricItem*>(&pPool->GetDefaultItem(SDRATTR_SHADOWYDIST));
+        if (pXDistItem && pYDistItem)
+        {
+            sal_Int32 nX = pXDistItem->GetValue();
+            sal_Int32 nY = pYDistItem->GetValue();
             if( nX != 0 )
                 SetMetricValue( *m_pMtrDistance, nX < 0L ? -nX : nX, m_ePoolUnit );
             else
                 SetMetricValue( *m_pMtrDistance, nY < 0L ? -nY : nY, m_ePoolUnit );
-
-            // setting the shadow control
-            if     ( nX <  0L && nY <  0L ) m_pCtlPosition->SetActualRP( RP_LT );
-            else if( nX == 0L && nY <  0L ) m_pCtlPosition->SetActualRP( RP_MT );
-            else if( nX >  0L && nY <  0L ) m_pCtlPosition->SetActualRP( RP_RT );
-            else if( nX <  0L && nY == 0L ) m_pCtlPosition->SetActualRP( RP_LM );
-            // there's no center point anymore
-            else if( nX == 0L && nY == 0L ) m_pCtlPosition->SetActualRP( RP_RB );
-            else if( nX >  0L && nY == 0L ) m_pCtlPosition->SetActualRP( RP_RM );
-            else if( nX <  0L && nY >  0L ) m_pCtlPosition->SetActualRP( RP_LB );
-            else if( nX == 0L && nY >  0L ) m_pCtlPosition->SetActualRP( RP_MB );
-            else if( nX >  0L && nY >  0L ) m_pCtlPosition->SetActualRP( RP_RB );
         }
-        else
-        {
-            // determine default-distance
-            SfxItemPool* pPool = m_rOutAttrs.GetPool();
-            const SdrMetricItem* pXDistItem = static_cast<const SdrMetricItem*>(&pPool->GetDefaultItem(SDRATTR_SHADOWXDIST));
-            const SdrMetricItem* pYDistItem = static_cast<const SdrMetricItem*>(&pPool->GetDefaultItem(SDRATTR_SHADOWYDIST));
-            if (pXDistItem && pYDistItem)
-            {
-                sal_Int32 nX = pXDistItem->GetValue();
-                sal_Int32 nY = pYDistItem->GetValue();
-                if( nX != 0 )
-                    SetMetricValue( *m_pMtrDistance, nX < 0L ? -nX : nX, m_ePoolUnit );
-                else
-                    SetMetricValue( *m_pMtrDistance, nY < 0L ? -nY : nY, m_ePoolUnit );
-            }
 
-            // Tristate, e. g. multiple objects have been marked of which some have a shadow and some don't.
-            // The text (which shall be displayed) of the MetricFields is set to "" and serves as an
-            // identification in the method FillItemSet for the fact that the distance value was NOT changed !!!!
-            m_pMtrDistance->SetText( "" );
-            m_pCtlPosition->SetActualRP( RP_MM );
-        }
+        // Tristate, e. g. multiple objects have been marked of which some have a shadow and some don't.
+        // The text (which shall be displayed) of the MetricFields is set to "" and serves as an
+        // identification in the method FillItemSet for the fact that the distance value was NOT changed !!!!
+        m_pMtrDistance->SetText( "" );
+        m_pCtlPosition->SetActualRP( RP_MM );
+    }
 
-        if( rAttrs->GetItemState( SDRATTR_SHADOWCOLOR ) != SfxItemState::DONTCARE )
-        {
-            m_pLbShadowColor->SelectEntry( static_cast<const XColorItem&>( rAttrs->Get( SDRATTR_SHADOWCOLOR ) ).GetColorValue() );
-        }
-        else
-            m_pLbShadowColor->SetNoSelection();
+    if( rAttrs->GetItemState( SDRATTR_SHADOWCOLOR ) != SfxItemState::DONTCARE )
+    {
+        m_pLbShadowColor->SelectEntry( static_cast<const XColorItem&>( rAttrs->Get( SDRATTR_SHADOWCOLOR ) ).GetColorValue() );
+    }
+    else
+        m_pLbShadowColor->SetNoSelection();
 
-        if( rAttrs->GetItemState( SDRATTR_SHADOWTRANSPARENCE ) != SfxItemState::DONTCARE )
-        {
-            sal_uInt16 nTransp = static_cast<const SdrPercentItem&>( rAttrs->Get( SDRATTR_SHADOWTRANSPARENCE ) ).GetValue();
-            m_pMtrTransparent->SetValue( nTransp );
-        }
-        else
-            m_pMtrTransparent->SetText( "" );
+    if( rAttrs->GetItemState( SDRATTR_SHADOWTRANSPARENCE ) != SfxItemState::DONTCARE )
+    {
+        sal_uInt16 nTransp = static_cast<const SdrPercentItem&>( rAttrs->Get( SDRATTR_SHADOWTRANSPARENCE ) ).GetValue();
+        m_pMtrTransparent->SetValue( nTransp );
+    }
+    else
+        m_pMtrTransparent->SetText( "" );
 
-        //aCtlPosition
-        m_pMtrDistance->SaveValue();
-        m_pLbShadowColor->SaveValue();
-        m_pTsbShowShadow->SaveValue();
+    //aCtlPosition
+    m_pMtrDistance->SaveValue();
+    m_pLbShadowColor->SaveValue();
+    m_pTsbShowShadow->SaveValue();
 
-        // #66832# This field was not saved, but used to determine changes.
-        // Why? Seems to be the error.
-        // It IS the error.
-        m_pMtrTransparent->SaveValue();
+    // #66832# This field was not saved, but used to determine changes.
+    // Why? Seems to be the error.
+    // It IS the error.
+    m_pMtrTransparent->SaveValue();
 
-        ClickShadowHdl_Impl( nullptr );
-        ModifyShadowHdl_Impl( *m_pMtrTransparent );
-    }
+    ClickShadowHdl_Impl( nullptr );
+    ModifyShadowHdl_Impl( *m_pMtrTransparent );
 }
 
 


More information about the Libreoffice-commits mailing list