sc/source/ui/inc/viewfunc.hxx  |    2 +-
 sc/source/ui/view/cellsh3.cxx  |    2 +-
 sc/source/ui/view/formatsh.cxx |    8 ++++----
 sc/source/ui/view/tabvwsha.cxx |    2 +-
 sc/source/ui/view/viewfun2.cxx |    2 +-
 sc/source/ui/view/viewfunc.cxx |   28 ++++++++++++++--------------
 6 files changed, 22 insertions(+), 22 deletions(-)

New commits:
commit a7de97bc7b83790907bd6fdfb7a319e2467aba1d
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Nov 20 10:50:18 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Nov 20 11:58:56 2023 +0100

    pass by ref, not pointer, in ScViewFunc::ApplyAttributes
    
    since we always de-ref the input params
    
    Change-Id: I222e58547b37186841c6b435adcea73f4d43b55c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159733
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 323e7cbbe793..45b053f3d33d 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -172,7 +172,7 @@ public:
     bool            InsertName( const OUString& rName, const OUString& rSymbol,
                                 const OUString& rType );
 
-    void            ApplyAttributes( const SfxItemSet* pDialogSet, const 
SfxItemSet* pOldSet, bool bAdjustBlockHeight = true );
+    void            ApplyAttributes( const SfxItemSet& rDialogSet, const 
SfxItemSet& rOldSet, bool bAdjustBlockHeight = true );
     void            ApplyAttr( const SfxPoolItem& rAttrItem, bool 
bAdjustBlockHeight = true );
 
     void            ApplySelectionPattern( const ScPatternAttr& rAttr,
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 2b78e258aff0..e052952ff664 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -485,7 +485,7 @@ void ScCellShell::Execute( SfxRequest& rReq )
                         if ( pReqArgs->GetItemState( nWhich, true, &pAttr ) == 
SfxItemState::SET )
                             aNewSet.Put( *pAttr );
 
-                    pTabViewShell->ApplyAttributes( &aNewSet, &aEmptySet );
+                    pTabViewShell->ApplyAttributes( aNewSet, aEmptySet );
 
                     rReq.Done();
                 }
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 6556062f6c7a..93a456e46b53 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -507,7 +507,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
                     SfxItemPool* pDocPool = 
GetViewData().GetDocument().GetPool();
                     SfxItemSetFixed<ATTR_PATTERN_START, ATTR_PATTERN_END> 
aNewSet( *pDocPool );
                     aNewSet.Put( *pItem );
-                    pTabViewShell->ApplyAttributes( &aNewSet, &rOldSet );
+                    pTabViewShell->ApplyAttributes( aNewSet, rOldSet );
                 }
             }
             break;
@@ -1179,7 +1179,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
                     }
 
                     aOldSet.Put( rBorderAttr );
-                    pTabViewShell->ApplyAttributes( &aNewSet, &aOldSet );
+                    pTabViewShell->ApplyAttributes( aNewSet, aOldSet );
                 }
                 break;
 
@@ -1198,7 +1198,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
                             
aItem.SetLine(pNewAttrs->Get(ATTR_BORDER_TLBR).GetLine());
                             aNewSet.Put(aItem);
                             rReq.AppendItem(aItem);
-                            pTabViewShell->ApplyAttributes(&aNewSet, &aOldSet);
+                            pTabViewShell->ApplyAttributes(aNewSet, aOldSet);
                         }
                     }
                     else // if( nSlot == SID_ATTR_BORDER_DIAG_BLTR )
@@ -1209,7 +1209,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
                             
aItem.SetLine(pNewAttrs->Get(ATTR_BORDER_BLTR).GetLine());
                             aNewSet.Put(aItem);
                             rReq.AppendItem(aItem);
-                            pTabViewShell->ApplyAttributes(&aNewSet, &aOldSet);
+                            pTabViewShell->ApplyAttributes(aNewSet, aOldSet);
                         }
                     }
 
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index dd73c21a5076..84a3acbcdf44 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -622,7 +622,7 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, 
const OUString &rNam
                 UpdateNumberFormatter(*pItem);
             }
 
-            ApplyAttributes(pOutSet, pOldSet.get());
+            ApplyAttributes(*pOutSet, *pOldSet);
 
             pRequest->Done(*pOutSet);
         }
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index f787d1ec7012..c2a7bfac2797 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -3434,7 +3434,7 @@ void ScViewFunc::SetSelectionFrameLines( const 
SvxBorderLine* pLine,
             aNewSet.Put( aBLTRItem );
         }
 
-        ApplyAttributes( &aNewSet, &aOldSet );
+        ApplyAttributes( aNewSet, aOldSet );
     }
     else // if ( eItemState == SfxItemState::DONTCARE )
     {
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 7c8a4e95be28..98d2a1ebbe42 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -993,8 +993,8 @@ void ScViewFunc::GetSelectionFrame(
 //
 //  complete set ( ATTR_STARTINDEX, ATTR_ENDINDEX )
 
-void ScViewFunc::ApplyAttributes( const SfxItemSet* pDialogSet,
-                                  const SfxItemSet* pOldSet,
+void ScViewFunc::ApplyAttributes( const SfxItemSet& rDialogSet,
+                                  const SfxItemSet& rOldSet,
                                   bool bAdjustBlockHeight)
 {
     // not editable because of matrix only? attribute OK nonetheless
@@ -1005,16 +1005,16 @@ void ScViewFunc::ApplyAttributes( const SfxItemSet* 
pDialogSet,
         return;
     }
 
-    ScPatternAttr aOldAttrs(( SfxItemSet(*pOldSet) ));
-    ScPatternAttr aNewAttrs(( SfxItemSet(*pDialogSet) ));
+    ScPatternAttr aOldAttrs(( SfxItemSet(rOldSet) ));
+    ScPatternAttr aNewAttrs(( SfxItemSet(rDialogSet) ));
     aNewAttrs.DeleteUnchanged( &aOldAttrs );
 
-    if ( pDialogSet->GetItemState( ATTR_VALUE_FORMAT ) == SfxItemState::SET )
+    if ( rDialogSet.GetItemState( ATTR_VALUE_FORMAT ) == SfxItemState::SET )
     {   // don't reset to default SYSTEM GENERAL if not intended
         sal_uInt32 nOldFormat =
-            pOldSet->Get( ATTR_VALUE_FORMAT ).GetValue();
+            rOldSet.Get( ATTR_VALUE_FORMAT ).GetValue();
         sal_uInt32 nNewFormat =
-            pDialogSet->Get( ATTR_VALUE_FORMAT ).GetValue();
+            rDialogSet.Get( ATTR_VALUE_FORMAT ).GetValue();
         if ( nNewFormat != nOldFormat )
         {
             SvNumberFormatter* pFormatter =
@@ -1039,14 +1039,14 @@ void ScViewFunc::ApplyAttributes( const SfxItemSet* 
pDialogSet,
         }
     }
 
-    if (pDialogSet->HasItem(ATTR_FONT_LANGUAGE))
+    if (rDialogSet.HasItem(ATTR_FONT_LANGUAGE))
         // font language has changed.  Redo the online spelling.
         ResetAutoSpell();
 
-    const SvxBoxItem&     rOldOuter = pOldSet->Get(ATTR_BORDER);
-    const SvxBoxItem&     rNewOuter = pDialogSet->Get(ATTR_BORDER);
-    const SvxBoxInfoItem& rOldInner = pOldSet->Get(ATTR_BORDER_INNER);
-    const SvxBoxInfoItem& rNewInner = pDialogSet->Get(ATTR_BORDER_INNER);
+    const SvxBoxItem&     rOldOuter = rOldSet.Get(ATTR_BORDER);
+    const SvxBoxItem&     rNewOuter = rDialogSet.Get(ATTR_BORDER);
+    const SvxBoxInfoItem& rOldInner = rOldSet.Get(ATTR_BORDER_INNER);
+    const SvxBoxInfoItem& rNewInner = rDialogSet.Get(ATTR_BORDER_INNER);
     SfxItemSet&           rNewSet   = aNewAttrs.GetItemSet();
     SfxItemPool*          pNewPool  = rNewSet.GetPool();
 
@@ -1062,8 +1062,8 @@ void ScViewFunc::ApplyAttributes( const SfxItemSet* 
pDialogSet,
      *
      */
 
-    bool bFrame =    (pDialogSet->GetItemState( ATTR_BORDER ) != 
SfxItemState::DEFAULT)
-                  || (pDialogSet->GetItemState( ATTR_BORDER_INNER ) != 
SfxItemState::DEFAULT);
+    bool bFrame =    (rDialogSet.GetItemState( ATTR_BORDER ) != 
SfxItemState::DEFAULT)
+                  || (rDialogSet.GetItemState( ATTR_BORDER_INNER ) != 
SfxItemState::DEFAULT);
 
     if (SfxPoolItem::areSame(rNewOuter, rOldOuter) && 
SfxPoolItem::areSame(rNewInner, rOldInner))
         bFrame = false;

Reply via email to