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

Caolán McNamara caolanm at redhat.com
Tue Jun 6 11:43:58 UTC 2017


 sc/source/ui/view/viewfunc.cxx |   50 ++++++++++++++++++-----------------------
 1 file changed, 22 insertions(+), 28 deletions(-)

New commits:
commit 097cb414ab890f4a1bc4a3f826b5cbc10f0b8ec8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 6 10:45:28 2017 +0100

    pOldOuter etc couldn't be null
    
    Change-Id: I0fb0168fa4199a21640e248ee3bb4b88608b1597
    Reviewed-on: https://gerrit.libreoffice.org/38432
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index ca21a561fed8..96ac268c1f80 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -909,15 +909,15 @@ void ScViewFunc::ApplyAttributes( const SfxItemSet* pDialogSet,
         // font language has changed.  Redo the online spelling.
         ResetAutoSpell();
 
-    const SvxBoxItem*     pOldOuter = static_cast<const SvxBoxItem*>     (&pOldSet->Get( ATTR_BORDER ));
-    const SvxBoxItem*     pNewOuter = static_cast<const SvxBoxItem*>     (&pDialogSet->Get( ATTR_BORDER ));
-    const SvxBoxInfoItem* pOldInner = static_cast<const SvxBoxInfoItem*> (&pOldSet->Get( ATTR_BORDER_INNER ));
-    const SvxBoxInfoItem* pNewInner = static_cast<const SvxBoxInfoItem*> (&pDialogSet->Get( ATTR_BORDER_INNER ));
+    const SvxBoxItem&     rOldOuter = static_cast<const SvxBoxItem&>     (pOldSet->Get(ATTR_BORDER));
+    const SvxBoxItem&     rNewOuter = static_cast<const SvxBoxItem&>     (pDialogSet->Get(ATTR_BORDER));
+    const SvxBoxInfoItem& rOldInner = static_cast<const SvxBoxInfoItem&> (pOldSet->Get(ATTR_BORDER_INNER));
+    const SvxBoxInfoItem& rNewInner = static_cast<const SvxBoxInfoItem&> (pDialogSet->Get(ATTR_BORDER_INNER));
     SfxItemSet&           rNewSet   = aNewAttrs.GetItemSet();
     SfxItemPool*          pNewPool  = rNewSet.GetPool();
 
-    pNewPool->Put( *pNewOuter );        // don't delete yet
-    pNewPool->Put( *pNewInner );
+    pNewPool->Put(rNewOuter);        // don't delete yet
+    pNewPool->Put(rNewInner);
     rNewSet.ClearItem( ATTR_BORDER );
     rNewSet.ClearItem( ATTR_BORDER_INNER );
 
@@ -931,44 +931,38 @@ void ScViewFunc::ApplyAttributes( const SfxItemSet* pDialogSet,
     bool bFrame =    (pDialogSet->GetItemState( ATTR_BORDER ) != SfxItemState::DEFAULT)
                   || (pDialogSet->GetItemState( ATTR_BORDER_INNER ) != SfxItemState::DEFAULT);
 
-    if ( pNewOuter==pOldOuter && pNewInner==pOldInner )
+    if (&rNewOuter == &rOldOuter && &rNewInner == &rOldInner)
         bFrame = false;
 
     //  this should be intercepted by the pool: ?!??!??
 
-    if ( bFrame && pNewOuter && pNewInner )
-        if ( *pNewOuter == *pOldOuter && *pNewInner == *pOldInner )
-            bFrame = false;
-
-    if ( pNewInner )
-    {
-        bFrame =   bFrame
-                && (   pNewInner->IsValid(SvxBoxInfoItemValidFlags::LEFT)
-                    || pNewInner->IsValid(SvxBoxInfoItemValidFlags::RIGHT)
-                    || pNewInner->IsValid(SvxBoxInfoItemValidFlags::TOP)
-                    || pNewInner->IsValid(SvxBoxInfoItemValidFlags::BOTTOM)
-                    || pNewInner->IsValid(SvxBoxInfoItemValidFlags::HORI)
-                    || pNewInner->IsValid(SvxBoxInfoItemValidFlags::VERT) );
-    }
-    else
+    if (bFrame && rNewOuter == rOldOuter && rNewInner == rOldInner)
         bFrame = false;
 
+    bFrame =   bFrame
+            && (   rNewInner.IsValid(SvxBoxInfoItemValidFlags::LEFT)
+                || rNewInner.IsValid(SvxBoxInfoItemValidFlags::RIGHT)
+                || rNewInner.IsValid(SvxBoxInfoItemValidFlags::TOP)
+                || rNewInner.IsValid(SvxBoxInfoItemValidFlags::BOTTOM)
+                || rNewInner.IsValid(SvxBoxInfoItemValidFlags::HORI)
+                || rNewInner.IsValid(SvxBoxInfoItemValidFlags::VERT) );
+
     if (!bFrame)
         ApplySelectionPattern( aNewAttrs );            // standard only
     else
     {
         // if new items are default-items, overwrite the old items:
 
-        bool bDefNewOuter = IsStaticDefaultItem(pNewOuter);
-        bool bDefNewInner = IsStaticDefaultItem(pNewInner);
+        bool bDefNewOuter = IsStaticDefaultItem(&rNewOuter);
+        bool bDefNewInner = IsStaticDefaultItem(&rNewInner);
 
         ApplyPatternLines( aNewAttrs,
-                           bDefNewOuter ? pOldOuter : pNewOuter,
-                           bDefNewInner ? pOldInner : pNewInner );
+                           bDefNewOuter ? &rOldOuter : &rNewOuter,
+                           bDefNewInner ? &rOldInner : &rNewInner );
     }
 
-    pNewPool->Remove( *pNewOuter );         // release
-    pNewPool->Remove( *pNewInner );
+    pNewPool->Remove(rNewOuter);         // release
+    pNewPool->Remove(rNewInner);
 
     //  adjust height
     AdjustBlockHeight();


More information about the Libreoffice-commits mailing list