sc/inc/chgtrack.hxx                            |    2 -
 sc/inc/column.hxx                              |    2 -
 sc/inc/conditio.hxx                            |    6 +--
 sc/inc/document.hxx                            |    4 +-
 sc/inc/dpcache.hxx                             |    4 +-
 sc/inc/dpobject.hxx                            |    2 -
 sc/inc/patattr.hxx                             |    4 +-
 sc/inc/postit.hxx                              |    2 -
 sc/inc/queryevaluator.hxx                      |    2 -
 sc/inc/rangeseq.hxx                            |    2 -
 sc/inc/validat.hxx                             |    8 ++--
 sc/source/core/data/column3.cxx                |    2 -
 sc/source/core/data/column4.cxx                |    4 +-
 sc/source/core/data/conditio.cxx               |    8 ++--
 sc/source/core/data/documen4.cxx               |    2 -
 sc/source/core/data/dpcache.cxx                |    4 +-
 sc/source/core/data/dpobject.cxx               |    2 -
 sc/source/core/data/patattr.cxx                |    4 +-
 sc/source/core/data/postit.cxx                 |    6 +--
 sc/source/core/data/queryevaluator.cxx         |    3 +
 sc/source/core/data/validat.cxx                |    8 ++--
 sc/source/core/inc/interpre.hxx                |   12 +++---
 sc/source/core/tool/chgtrack.cxx               |    2 -
 sc/source/core/tool/interpr1.cxx               |    4 +-
 sc/source/core/tool/interpr4.cxx               |    8 ++--
 sc/source/core/tool/rangeseq.cxx               |    2 -
 sc/source/filter/excel/excdoc.cxx              |    2 -
 sc/source/filter/excel/export/ExportTools.cxx  |    4 +-
 sc/source/filter/excel/export/SparklineExt.cxx |    6 +--
 sc/source/filter/excel/xestyle.cxx             |    2 -
 sc/source/filter/inc/excdoc.hxx                |    2 -
 sc/source/filter/inc/export/ExportTools.hxx    |    4 +-
 sc/source/filter/inc/export/SparklineExt.hxx   |    6 +--
 sc/source/filter/inc/xestyle.hxx               |    2 -
 sc/source/filter/oox/SparklineFragment.cxx     |    2 -
 sc/source/filter/oox/commentsbuffer.cxx        |    2 -
 sc/source/filter/xml/XMLExportDataPilot.cxx    |    2 -
 sc/source/filter/xml/XMLExportDataPilot.hxx    |    2 -
 sc/source/filter/xml/XMLStylesExportHelper.cxx |    4 +-
 sc/source/filter/xml/XMLStylesExportHelper.hxx |    4 +-
 sc/source/filter/xml/xmlexprt.cxx              |   46 ++++++++++++-------------
 sc/source/filter/xml/xmlexprt.hxx              |   42 +++++++++++-----------
 sc/source/ui/app/inputhdl.cxx                  |    2 -
 sc/source/ui/docshell/docsh5.cxx               |    2 -
 sc/source/ui/inc/dbfunc.hxx                    |    2 -
 sc/source/ui/inc/docsh.hxx                     |    2 -
 sc/source/ui/inc/tabvwsh.hxx                   |    4 +-
 sc/source/ui/inc/undoblk.hxx                   |    2 -
 sc/source/ui/inc/viewdata.hxx                  |    2 -
 sc/source/ui/inc/viewfunc.hxx                  |    4 +-
 sc/source/ui/undo/undoblk.cxx                  |    2 -
 sc/source/ui/unoobj/docuno.cxx                 |    4 +-
 sc/source/ui/view/dbfunc.cxx                   |    2 -
 sc/source/ui/view/gridwin4.cxx                 |    2 -
 sc/source/ui/view/output2.cxx                  |    4 +-
 sc/source/ui/view/tabvwsh4.cxx                 |    4 +-
 sc/source/ui/view/viewfun5.cxx                 |    4 +-
 sc/source/ui/view/viewfunc.cxx                 |    6 +--
 58 files changed, 145 insertions(+), 144 deletions(-)

New commits:
commit 8bbba41d8730212931208434ee63efe913868a12
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Mar 27 11:09:17 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Mar 27 13:49:58 2025 +0100

    loplugin:constparam in sc
    
    Change-Id: I2aa9b016130918f15a33fadee7fb147aeba18559
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183370
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins

diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index 9e3aed17aa55..5b781f98d64c 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -644,7 +644,7 @@ class SAL_DLLPUBLIC_RTTI ScChangeActionContent final : 
public ScChangeAction
                           const ScCellValue& rOrgCell, const ScDocument* 
pFromDoc,
                           ScDocument* pToDoc );
 
-    static void SetCell( OUString& rStr, ScCellValue& rCell, sal_uLong 
nFormat, const ScDocument* pDoc );
+    static void SetCell( OUString& rStr, const ScCellValue& rCell, sal_uLong 
nFormat, const ScDocument* pDoc );
 
     static bool NeedsNumberFormat( const ScCellValue& rVal );
 
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 0e334fdb0704..92a9028ffec7 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -236,7 +236,7 @@ friend class sc::CellStoreEvent;
         SCROW nRow, SCTAB nTab, const OUString& rString, 
formula::FormulaGrammar::AddressConvention eConv,
         const ScSetStringParam* pParam );
 
-    void duplicateSparkline(sc::CopyFromClipContext& rContext, 
sc::ColumnBlockPosition* pBlockPos,
+    void duplicateSparkline(const sc::CopyFromClipContext& rContext, 
sc::ColumnBlockPosition* pBlockPos,
                             size_t nColOffset, size_t nDestSize, ScAddress 
aDestPosition);
 
 public:
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 2e3ea5639f96..abcf24b00933 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -366,7 +366,7 @@ public:
 
     virtual void SetParent( ScConditionalFormat* pNew ) override;
 
-    bool IsCellValid( ScRefCellValue& rCell, const ScAddress& rPos ) const;
+    bool IsCellValid( const ScRefCellValue& rCell, const ScAddress& rPos ) 
const;
 
     ScConditionMode GetOperation() const        { return eOp; }
     void SetOperation(ScConditionMode eMode);
@@ -605,9 +605,9 @@ public:
 
     SC_DLLPUBLIC const ScFormatEntry* GetEntry( sal_uInt16 nPos ) const;
 
-    SC_DLLPUBLIC OUString GetCellStyle( ScRefCellValue& rCell, const 
ScAddress& rPos ) const;
+    SC_DLLPUBLIC OUString GetCellStyle( const ScRefCellValue& rCell, const 
ScAddress& rPos ) const;
 
-    SC_DLLPUBLIC ScCondFormatData GetData( ScRefCellValue& rCell, const 
ScAddress& rPos ) const;
+    SC_DLLPUBLIC ScCondFormatData GetData( const ScRefCellValue& rCell, const 
ScAddress& rPos ) const;
 
     bool            EqualEntries( const ScConditionalFormat& r, bool 
bIgnoreSrcPos = false ) const;
 
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 06ae276b3484..a38e5d01c3be 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -631,7 +631,7 @@ public:
     void setHasConnectionXml(bool bUse) { mbConnectionXml = bUse; }
     bool hasConnectionXml() { return mbConnectionXml; }
 
-    void setHasCustomXml(bool bUse, OUString& sCustomXmlPath)
+    void setHasCustomXml(bool bUse, const OUString& sCustomXmlPath)
     {
         mbCustomXml = bUse;
         aCustomXmlFragmentPath = sCustomXmlPath;
@@ -1903,7 +1903,7 @@ public:
     // pCell is an optimization, must point to rPos
     SC_DLLPUBLIC const SfxItemSet*          GetCondResult( SCCOL nCol, SCROW 
nRow, SCTAB nTab,
                                                            ScRefCellValue* 
pCell = nullptr ) const;
-    const SfxItemSet*                       GetCondResult( ScRefCellValue& 
rCell, const ScAddress& rPos,
+    const SfxItemSet*                       GetCondResult( const 
ScRefCellValue& rCell, const ScAddress& rPos,
                                                            const 
ScConditionalFormatList& rList,
                                                            const 
ScCondFormatIndexes& rIndex ) const;
     const SfxPoolItem*                      GetEffItem( SCCOL nCol, SCROW 
nRow, SCTAB nTab, sal_uInt16 nWhich ) const;
diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx
index 1e7d7075e813..5a1b77241acb 100644
--- a/sc/inc/dpcache.hxx
+++ b/sc/inc/dpcache.hxx
@@ -139,9 +139,9 @@ public:
 
     SCROW GetIdByItemData(tools::Long nDim, const ScDPItemData& rItem) const;
 
-    static sal_uInt32 GetLocaleIndependentFormat( ScInterpreterContext& 
rContext, sal_uInt32 nNumFormat );
+    static sal_uInt32 GetLocaleIndependentFormat( const ScInterpreterContext& 
rContext, sal_uInt32 nNumFormat );
     static OUString GetLocaleIndependentFormattedNumberString( double fValue );
-    static OUString GetLocaleIndependentFormattedString( double fValue, 
ScInterpreterContext& rContext, sal_uInt32 nNumFormat );
+    static OUString GetLocaleIndependentFormattedString( double fValue, const 
ScInterpreterContext& rContext, sal_uInt32 nNumFormat );
     SC_DLLPUBLIC OUString GetFormattedString(tools::Long nDim, const 
ScDPItemData& rItem, bool bLocaleIndependent) const;
     ScInterpreterContext& GetInterpreterContext() const;
 
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index ce05a46f7c6b..ce0a147a4cae 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -193,7 +193,7 @@ public:
                                        tools::Rectangle& rPosRect, 
css::sheet::DataPilotFieldOrientation& rOrient, tools::Long& rDimPos );
     bool                IsFilterButton( const ScAddress& rPos );
 
-    static OUString GetFormattedString(ScDPTableData* pTableData, tools::Long 
nDimension, const double fValue);
+    static OUString GetFormattedString(const ScDPTableData* pTableData, 
tools::Long nDimension, const double fValue);
     SC_DLLPUBLIC OUString GetFormattedString( std::u16string_view rDimName, 
const double fValue );
 
     double GetPivotData(
diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx
index 70e72ba403e6..99d0d1e51788 100644
--- a/sc/inc/patattr.hxx
+++ b/sc/inc/patattr.hxx
@@ -91,9 +91,9 @@ public:
     SfxItemPool& GetPool() const { return mrSfxItemPool; }
 
     void CellStyleDeleted(const ScStyleSheet& rStyle);
-    void CellStyleCreated(ScDocument& rDoc, const OUString& rName);
+    void CellStyleCreated(const ScDocument& rDoc, const OUString& rName);
     void RenameCellStyle(ScStyleSheet& rStyle, const OUString& rNewName);
-    void UpdateAllStyleSheets(ScDocument& rDoc);
+    void UpdateAllStyleSheets(const ScDocument& rDoc);
     void AllStylesToNames();
     void ReIndexRegistered();
 };
diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index 407ee0d3ce09..2e54e64c44b5 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -189,7 +189,7 @@ class SC_DLLPUBLIC ScNoteUtil
                                 bool bAlwaysCreateCaption, sal_uInt32 
nPostItId,
                                 bool bShouldAutoStamp = true);
 
-    static ScNoteData CreateNoteData(ScDocument& rDoc, const ScAddress& rPos,
+    static ScNoteData CreateNoteData(const ScDocument& rDoc, const ScAddress& 
rPos,
                                      const tools::Rectangle& rCaptionRect, 
bool bShown);
 public:
 
diff --git a/sc/inc/queryevaluator.hxx b/sc/inc/queryevaluator.hxx
index ff086e9fa8bf..d522a766f455 100644
--- a/sc/inc/queryevaluator.hxx
+++ b/sc/inc/queryevaluator.hxx
@@ -103,7 +103,7 @@ class ScQueryEvaluator
                                                       const ScQueryEntry& 
rEntry,
                                                       const 
ScQueryEntry::Item& rItem);
 
-    std::pair<bool, bool> processEntry(SCROW nRow, SCCOL nCol, ScRefCellValue& 
aCell,
+    std::pair<bool, bool> processEntry(SCROW nRow, SCCOL nCol, const 
ScRefCellValue& aCell,
                                        const ScQueryEntry& rEntry, size_t 
nEntryIndex);
 
     bool equalCellSharedString(const ScRefCellValue& rCell, SCROW nRow, 
SCCOLROW nField,
diff --git a/sc/inc/rangeseq.hxx b/sc/inc/rangeseq.hxx
index 1657811e2e40..289c37a10b7e 100644
--- a/sc/inc/rangeseq.hxx
+++ b/sc/inc/rangeseq.hxx
@@ -43,7 +43,7 @@ public:
     static bool FillStringArray( css::uno::Any& rAny,
                                 ScDocument& rDoc, const ScRange& rRange );
     static bool FillStringArray( css::uno::Any& rAny,
-                                const ScMatrix* pMatrix, ScInterpreterContext& 
rContext );
+                                const ScMatrix* pMatrix, const 
ScInterpreterContext& rContext );
     static bool FillMixedArray( css::uno::Any& rAny,
                                 ScDocument& rDoc, const ScRange& rRange,
                                 bool bAllowNV = false );
diff --git a/sc/inc/validat.hxx b/sc/inc/validat.hxx
index 365cc3aca074..8316ec64ae52 100644
--- a/sc/inc/validat.hxx
+++ b/sc/inc/validat.hxx
@@ -152,7 +152,7 @@ public:
         const OUString& rTest, const ScPatternAttr& rPattern,
         const ScAddress& rPos, const CustomValidationPrivateAccess& ) const;
 
-    SC_DLLPUBLIC bool IsDataValid( ScRefCellValue& rCell, const ScAddress& 
rPos ) const;
+    SC_DLLPUBLIC bool IsDataValid( const ScRefCellValue& rCell, const 
ScAddress& rPos ) const;
 
     /** Test, if formula is valid. */
     bool isFormulaResultsValidatable(const OUString& rTest, const ScAddress& 
rPos, SvNumberFormatter* pFormatter,
@@ -182,14 +182,14 @@ private:
         @param rMatch    (out-param) the index of the first item that matched, 
-1 if nothing matched.
         @return  true = Cell range found, rRange is valid, or an error entry 
stuffed into the list if pCell==NULL. */
     bool GetSelectionFromFormula(
-        std::vector<ScTypedStrData>* pStrings, ScRefCellValue& rCell, const 
ScAddress& rPos,
+        std::vector<ScTypedStrData>* pStrings, const ScRefCellValue& rCell, 
const ScAddress& rPos,
         const ScTokenArray& rTokArr, int& rMatch) const;
 
     /** Tests, if pCell is equal to what the passed token array represents. */
-    bool IsEqualToTokenArray( ScRefCellValue& rCell, const ScAddress& rPos, 
const ScTokenArray& rTokArr ) const;
+    bool IsEqualToTokenArray( const ScRefCellValue& rCell, const ScAddress& 
rPos, const ScTokenArray& rTokArr ) const;
 
     /** Tests, if contents of pCell occur in cell range referenced by own 
formula, or in a string list. */
-    bool IsListValid( ScRefCellValue& rCell, const ScAddress& rPos ) const;
+    bool IsListValid( const ScRefCellValue& rCell, const ScAddress& rPos ) 
const;
 
     /** Tests, if string or numeric data has valid text length.
         @param pDataNumeric
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 8d9a4e9731b2..973bdaeb7c09 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -2572,7 +2572,7 @@ class FilterEntriesHandler
     bool mbFiltering;
     bool mbFilteredRow;
 
-    void processCell(const ScColumn& rColumn, SCROW nRow, ScRefCellValue& 
rCell, bool bIsEmptyCell=false)
+    void processCell(const ScColumn& rColumn, SCROW nRow, const 
ScRefCellValue& rCell, bool bIsEmptyCell=false)
     {
         ScInterpreterContext& rContext = 
mrColumn.GetDoc().GetNonThreadedContext();
         sal_uInt32 nFormat = mrColumn.GetNumberFormat(rContext, nRow);
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 79ca0357361a..452786cfbf87 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -368,7 +368,7 @@ void ScColumn::CopyOneCellFromClip( 
sc::CopyFromClipContext& rCxt, SCROW nRow1,
     }
 }
 
-void ScColumn::duplicateSparkline(sc::CopyFromClipContext& rContext, 
sc::ColumnBlockPosition* pBlockPos,
+void ScColumn::duplicateSparkline(const sc::CopyFromClipContext& rContext, 
sc::ColumnBlockPosition* pBlockPos,
                                   size_t nColOffset, size_t nDestSize, 
ScAddress aDestPosition)
 {
     if ((rContext.getInsertFlag() & InsertDeleteFlags::SPARKLINES) == 
InsertDeleteFlags::NONE)
@@ -1130,7 +1130,7 @@ class ScriptTypeUpdater
     bool mbUpdated;
 
 private:
-    void updateScriptType( size_t nRow, ScRefCellValue& rCell )
+    void updateScriptType( size_t nRow, const ScRefCellValue& rCell )
     {
         sc::CellTextAttrStoreType::position_type aAttrPos = 
mrTextAttrs.position(miPosAttr, nRow);
         miPosAttr = aAttrPos.first;
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 97b1c73b0e08..625d3bac2bd7 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -755,7 +755,7 @@ void ScConditionEntry::Interpret( const ScAddress& rPos )
     bFirstRun = false;
 }
 
-static bool lcl_GetCellContent( ScRefCellValue& rCell, bool bIsStr1, double& 
rArg, OUString& rArgStr,
+static bool lcl_GetCellContent( const ScRefCellValue& rCell, bool bIsStr1, 
double& rArg, OUString& rArgStr,
         const ScDocument* pDoc )
 {
 
@@ -1261,7 +1261,7 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, 
const ScAddress& rPos )
     return bValid;
 }
 
-bool ScConditionEntry::IsCellValid( ScRefCellValue& rCell, const ScAddress& 
rPos ) const
+bool ScConditionEntry::IsCellValid( const ScRefCellValue& rCell, const 
ScAddress& rPos ) const
 {
     const_cast<ScConditionEntry*>(this)->Interpret(rPos); // Evaluate formula
 
@@ -1862,7 +1862,7 @@ const ScFormatEntry* ScConditionalFormat::GetEntry( 
sal_uInt16 nPos ) const
         return nullptr;
 }
 
-OUString ScConditionalFormat::GetCellStyle( ScRefCellValue& rCell, const 
ScAddress& rPos ) const
+OUString ScConditionalFormat::GetCellStyle( const ScRefCellValue& rCell, const 
ScAddress& rPos ) const
 {
     for (const auto& rxEntry : maEntries)
     {
@@ -1884,7 +1884,7 @@ OUString ScConditionalFormat::GetCellStyle( 
ScRefCellValue& rCell, const ScAddre
     return OUString();
 }
 
-ScCondFormatData ScConditionalFormat::GetData( ScRefCellValue& rCell, const 
ScAddress& rPos ) const
+ScCondFormatData ScConditionalFormat::GetData( const ScRefCellValue& rCell, 
const ScAddress& rPos ) const
 {
     ScCondFormatData aData;
     for(const auto& rxEntry : maEntries)
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index f86fedc4b472..d69d71913238 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -799,7 +799,7 @@ const SfxItemSet* ScDocument::GetCondResult( SCCOL nCol, 
SCROW nRow, SCTAB nTab,
 }
 
 const SfxItemSet* ScDocument::GetCondResult(
-    ScRefCellValue& rCell, const ScAddress& rPos, const 
ScConditionalFormatList& rList,
+    const ScRefCellValue& rCell, const ScAddress& rPos, const 
ScConditionalFormatList& rList,
     const ScCondFormatIndexes& rIndex ) const
 {
     for (const auto& rItem : rIndex)
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index 412a058bb5b9..19d96c50e9da 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -1160,7 +1160,7 @@ SCROW ScDPCache::GetIdByItemData(tools::Long nDim, const 
ScDPItemData& rItem) co
 }
 
 // static
-sal_uInt32 ScDPCache::GetLocaleIndependentFormat(ScInterpreterContext& 
rContext, sal_uInt32 nNumFormat)
+sal_uInt32 ScDPCache::GetLocaleIndependentFormat(const ScInterpreterContext& 
rContext, sal_uInt32 nNumFormat)
 {
     // For a date or date+time format use ISO format so it works across locales
     // and can be matched against string based item queries. For time use 24h
@@ -1187,7 +1187,7 @@ OUString 
ScDPCache::GetLocaleIndependentFormattedNumberString( double fValue )
 
 // static
 OUString ScDPCache::GetLocaleIndependentFormattedString( double fValue,
-        ScInterpreterContext& rContext, sal_uInt32 nNumFormat )
+        const ScInterpreterContext& rContext, sal_uInt32 nNumFormat )
 {
     nNumFormat = GetLocaleIndependentFormat( rContext, nNumFormat);
     if ((nNumFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0)
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 512a4a52cbb3..5608384604cb 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -1447,7 +1447,7 @@ void 
ScDPObject::GetMemberResultNames(ScDPUniqueStringSet& rNames, tools::Long n
     mpOutput->GetMemberResultNames(rNames, nDimension);    // used only with 
table data -> level not needed
 }
 
-OUString ScDPObject::GetFormattedString(ScDPTableData* pTableData, tools::Long 
nDimension, const double fValue)
+OUString ScDPObject::GetFormattedString(const ScDPTableData* pTableData, 
tools::Long nDimension, const double fValue)
 {
     ScDPItemData aItemData;
     aItemData.SetValue(fValue);
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 846556ae2aa8..0e406b8c6cf8 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -224,7 +224,7 @@ void CellAttributeHelper::RenameCellStyle(ScStyleSheet& 
rStyle, const OUString&
         maRegisteredCellAttributes.insert(p);
 }
 
-void CellAttributeHelper::CellStyleCreated(ScDocument& rDoc, const OUString& 
rName)
+void CellAttributeHelper::CellStyleCreated(const ScDocument& rDoc, const 
OUString& rName)
 {
     // If a style was created, don't keep any pattern with its name string in 
the pool,
     // because it would compare equal to a pattern with a pointer to the new 
style.
@@ -255,7 +255,7 @@ void CellAttributeHelper::CellStyleCreated(ScDocument& 
rDoc, const OUString& rNa
         maRegisteredCellAttributes.insert(p);
 }
 
-void CellAttributeHelper::UpdateAllStyleSheets(ScDocument& rDoc)
+void CellAttributeHelper::UpdateAllStyleSheets(const ScDocument& rDoc)
 {
     bool bNameChanged = false;
     for (const ScPatternAttr* pCheck : maRegisteredCellAttributes)
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 7034e6d2122f..817c33566ba3 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -368,7 +368,7 @@ public:
     /** Create a new caption object and inserts it into the document. */
     explicit            ScNoteCaptionCreator( ScDocument& rDoc, const 
ScAddress& rPos, ScNoteData& rNoteData );
     /** Manipulate an existing caption. */
-    explicit            ScNoteCaptionCreator( ScDocument& rDoc, const 
ScAddress& rPos, rtl::Reference<SdrCaptionObj>& xCaption, bool bShown );
+    explicit            ScNoteCaptionCreator( ScDocument& rDoc, const 
ScAddress& rPos, const rtl::Reference<SdrCaptionObj>& xCaption, bool bShown );
 };
 
 ScNoteCaptionCreator::ScNoteCaptionCreator( ScDocument& rDoc, const ScAddress& 
rPos, ScNoteData& rNoteData ) :
@@ -392,7 +392,7 @@ ScNoteCaptionCreator::ScNoteCaptionCreator( ScDocument& 
rDoc, const ScAddress& r
     }
 }
 
-ScNoteCaptionCreator::ScNoteCaptionCreator( ScDocument& rDoc, const ScAddress& 
rPos, rtl::Reference<SdrCaptionObj>& xCaption, bool bShown ) :
+ScNoteCaptionCreator::ScNoteCaptionCreator( ScDocument& rDoc, const ScAddress& 
rPos, const rtl::Reference<SdrCaptionObj>& xCaption, bool bShown ) :
     ScCaptionCreator( rDoc, rPos, xCaption )
 {
     SdrPage* pDrawPage = GetDrawPage();
@@ -931,7 +931,7 @@ ScPostIt* ScNoteUtil::CreateNoteFromCaption(
     return pNote;
 }
 
-ScNoteData ScNoteUtil::CreateNoteData(ScDocument& rDoc, const ScAddress& rPos,
+ScNoteData ScNoteUtil::CreateNoteData(const ScDocument& rDoc, const ScAddress& 
rPos,
                                       const tools::Rectangle& rCaptionRect, 
bool bShown)
 {
     ScNoteData aNoteData( bShown );
diff --git a/sc/source/core/data/queryevaluator.cxx 
b/sc/source/core/data/queryevaluator.cxx
index 98ef255946e2..4fc793b4d73e 100644
--- a/sc/source/core/data/queryevaluator.cxx
+++ b/sc/source/core/data/queryevaluator.cxx
@@ -665,7 +665,8 @@ std::pair<bool, bool> 
ScQueryEvaluator::compareByRangeLookup(const ScRefCellValu
     return std::pair<bool, bool>(!rCell.hasNumeric(), bTestEqual);
 }
 
-std::pair<bool, bool> ScQueryEvaluator::processEntry(SCROW nRow, SCCOL nCol, 
ScRefCellValue& aCell,
+std::pair<bool, bool> ScQueryEvaluator::processEntry(SCROW nRow, SCCOL nCol,
+                                                     const ScRefCellValue& 
aCell,
                                                      const ScQueryEntry& 
rEntry, size_t nEntryIndex)
 {
     std::pair<bool, bool> aRes(false, false);
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 5bedbb6a8c6c..6acc7185df42 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -597,7 +597,7 @@ bool ScValidationData::IsDataValid(
     return bRet;
 }
 
-bool ScValidationData::IsDataValid( ScRefCellValue& rCell, const ScAddress& 
rPos ) const
+bool ScValidationData::IsDataValid( const ScRefCellValue& rCell, const 
ScAddress& rPos ) const
 {
     if( eDataMode == SC_VALID_LIST )
         return IsListValid(rCell, rPos);
@@ -804,7 +804,7 @@ bool ScValidationData::HasSelectionList() const
 }
 
 bool ScValidationData::GetSelectionFromFormula(
-    std::vector<ScTypedStrData>* pStrings, ScRefCellValue& rCell, const 
ScAddress& rPos,
+    std::vector<ScTypedStrData>* pStrings, const ScRefCellValue& rCell, const 
ScAddress& rPos,
     const ScTokenArray& rTokArr, int& rMatch) const
 {
     bool bOk = true;
@@ -1032,7 +1032,7 @@ bool 
ScValidationData::FillSelectionList(std::vector<ScTypedStrData>& rStrColl,
     return bOk;
 }
 
-bool ScValidationData::IsEqualToTokenArray( ScRefCellValue& rCell, const 
ScAddress& rPos, const ScTokenArray& rTokArr ) const
+bool ScValidationData::IsEqualToTokenArray( const ScRefCellValue& rCell, const 
ScAddress& rPos, const ScTokenArray& rTokArr ) const
 {
     // create a condition entry that tests on equality and set the passed 
token array
     ScConditionEntry aCondEntry( ScConditionMode::Equal, &rTokArr, nullptr, 
*GetDocument(), rPos );
@@ -1041,7 +1041,7 @@ bool ScValidationData::IsEqualToTokenArray( 
ScRefCellValue& rCell, const ScAddre
     return aCondEntry.IsCellValid(rCell, rPos);
 }
 
-bool ScValidationData::IsListValid( ScRefCellValue& rCell, const ScAddress& 
rPos ) const
+bool ScValidationData::IsListValid( const ScRefCellValue& rCell, const 
ScAddress& rPos ) const
 {
     bool bIsValid = false;
 
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 7f07ed329619..a3d04081450a 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -295,11 +295,11 @@ private:
 
     void ReplaceCell( ScAddress& );     // for TableOp
     bool IsTableOpInRange( const ScRange& );
-    sal_uInt32 GetCellNumberFormat( const ScAddress& rPos, ScRefCellValue& 
rCell );
+    sal_uInt32 GetCellNumberFormat( const ScAddress& rPos, const 
ScRefCellValue& rCell );
     double ConvertStringToValue( const OUString& );
     bool SearchVectorForValue( VectorSearchArguments& );
-    bool SearchMatrixForValue( VectorSearchArguments&, ScQueryParam&, 
ScQueryEntry&, ScQueryEntry::Item& );
-    bool SearchRangeForValue( VectorSearchArguments&, ScQueryParam&, 
ScQueryEntry& );
+    bool SearchMatrixForValue( VectorSearchArguments&, const ScQueryParam&, 
const ScQueryEntry&, const ScQueryEntry::Item& );
+    bool SearchRangeForValue( VectorSearchArguments&, ScQueryParam&, const 
ScQueryEntry& );
 
 public:
     static double ScGetGCD(double fx, double fy);
@@ -307,10 +307,10 @@ public:
         Uses rError instead of nGlobalError and rCurFmtType instead of 
nCurFmtType. */
     double ConvertStringToValue( const OUString&, FormulaError& rError, 
SvNumFormatType& rCurFmtType );
 private:
-    double GetCellValue( const ScAddress&, ScRefCellValue& rCell );
-    double GetCellValueOrZero( const ScAddress&, ScRefCellValue& rCell );
+    double GetCellValue( const ScAddress&, const ScRefCellValue& rCell );
+    double GetCellValueOrZero( const ScAddress&, const ScRefCellValue& rCell );
     double GetValueCellValue( const ScAddress&, double fOrig );
-    void GetCellString( svl::SharedString& rStr, ScRefCellValue& rCell );
+    void GetCellString( svl::SharedString& rStr, const ScRefCellValue& rCell );
     static FormulaError GetCellErrCode( const ScRefCellValue& rCell );
 
     bool CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index f5ccfd579afb..e054d3e91004 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -1667,7 +1667,7 @@ void ScChangeActionContent::SetValue(
         rCell.clear();
 }
 
-void ScChangeActionContent::SetCell( OUString& rStr, ScCellValue& rCell, 
sal_uLong nFormat, const ScDocument* pDoc )
+void ScChangeActionContent::SetCell( OUString& rStr, const ScCellValue& rCell, 
sal_uLong nFormat, const ScDocument* pDoc )
 {
     rStr.clear();
     if (rCell.isEmpty())
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 50fbd8244d37..0b193b8708f0 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -12334,7 +12334,7 @@ utl::SearchParam::SearchType 
ScInterpreter::DetectSearchType( std::u16string_vie
     return utl::SearchParam::SearchType::Normal;
 }
 
-bool ScInterpreter::SearchMatrixForValue( VectorSearchArguments& vsa, 
ScQueryParam& rParam, ScQueryEntry& rEntry, ScQueryEntry::Item& rItem )
+bool ScInterpreter::SearchMatrixForValue( VectorSearchArguments& vsa, const 
ScQueryParam& rParam, const ScQueryEntry& rEntry, const ScQueryEntry::Item& 
rItem )
 {
     SCSIZE nC, nR;
     vsa.pMatSrc->GetDimensions( nC, nR);
@@ -12554,7 +12554,7 @@ bool ScInterpreter::SearchMatrixForValue( 
VectorSearchArguments& vsa, ScQueryPar
     return true;
 }
 
-bool ScInterpreter::SearchRangeForValue( VectorSearchArguments& vsa, 
ScQueryParam& rParam, ScQueryEntry& rEntry )
+bool ScInterpreter::SearchRangeForValue( VectorSearchArguments& vsa, 
ScQueryParam& rParam, const ScQueryEntry& rEntry )
 {
     vsa.bVLookup = ( vsa.nCol1 == vsa.nCol2 );
     switch ( vsa.eSearchMode )
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 1781ea6b99e0..3a996bd331f5 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -123,7 +123,7 @@ bool ScInterpreter::IsTableOpInRange( const ScRange& rRange 
)
     return false;
 }
 
-sal_uInt32 ScInterpreter::GetCellNumberFormat( const ScAddress& rPos, 
ScRefCellValue& rCell )
+sal_uInt32 ScInterpreter::GetCellNumberFormat( const ScAddress& rPos, const 
ScRefCellValue& rCell )
 {
     sal_uInt32 nFormat;
     FormulaError nErr;
@@ -176,7 +176,7 @@ double ScInterpreter::ConvertStringToValue( const OUString& 
rStr, FormulaError&
     return ScGlobal::ConvertStringToValue( rStr, maCalcConfig, rError, 
mnStringNoValueError, mrContext, rCurFmtType);
 }
 
-double ScInterpreter::GetCellValue( const ScAddress& rPos, ScRefCellValue& 
rCell )
+double ScInterpreter::GetCellValue( const ScAddress& rPos, const 
ScRefCellValue& rCell )
 {
     FormulaError nErr = nGlobalError;
     nGlobalError = FormulaError::NONE;
@@ -188,7 +188,7 @@ double ScInterpreter::GetCellValue( const ScAddress& rPos, 
ScRefCellValue& rCell
     return nVal;
 }
 
-double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, 
ScRefCellValue& rCell )
+double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, const 
ScRefCellValue& rCell )
 {
     double fValue = 0.0;
 
@@ -245,7 +245,7 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& 
rPos, ScRefCellValue&
     return fValue;
 }
 
-void ScInterpreter::GetCellString( svl::SharedString& rStr, ScRefCellValue& 
rCell )
+void ScInterpreter::GetCellString( svl::SharedString& rStr, const 
ScRefCellValue& rCell )
 {
     FormulaError nErr = FormulaError::NONE;
 
diff --git a/sc/source/core/tool/rangeseq.cxx b/sc/source/core/tool/rangeseq.cxx
index 63731b3236c9..9549a78c1952 100644
--- a/sc/source/core/tool/rangeseq.cxx
+++ b/sc/source/core/tool/rangeseq.cxx
@@ -197,7 +197,7 @@ bool ScRangeToSequence::FillStringArray( uno::Any& rAny, 
ScDocument& rDoc, const
     return !bHasErrors;
 }
 
-bool ScRangeToSequence::FillStringArray(uno::Any& rAny, const ScMatrix* 
pMatrix, ScInterpreterContext& rContext)
+bool ScRangeToSequence::FillStringArray(uno::Any& rAny, const ScMatrix* 
pMatrix, const ScInterpreterContext& rContext)
 {
     if (!pMatrix)
         return false;
diff --git a/sc/source/filter/excel/excdoc.cxx 
b/sc/source/filter/excel/excdoc.cxx
index 7907a87223c0..f62dfe0ace60 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -1281,7 +1281,7 @@ void ExcDocument::WriteXml( XclExpXmlStream& rStrm )
     rWorkbook.reset();
 }
 
-void 
ExcDocument::addElemensToAttrList(rtl::Reference<sax_fastparser::FastAttributeList>&
 pAttrList,
+void ExcDocument::addElemensToAttrList(const 
rtl::Reference<sax_fastparser::FastAttributeList>& pAttrList,
                                        css::uno::Sequence<css::uno::Any>& 
aSeqs)
 {
     css::uno::Sequence<css::xml::FastAttribute> aFastSeq;
diff --git a/sc/source/filter/excel/export/ExportTools.cxx 
b/sc/source/filter/excel/export/ExportTools.cxx
index b093da012581..dacd4e469a4a 100644
--- a/sc/source/filter/excel/export/ExportTools.cxx
+++ b/sc/source/filter/excel/export/ExportTools.cxx
@@ -15,7 +15,7 @@
 
 namespace oox::xls
 {
-void writeComplexColor(sax_fastparser::FSHelperPtr& pFS, sal_Int32 nElement,
+void writeComplexColor(const sax_fastparser::FSHelperPtr& pFS, sal_Int32 
nElement,
                        model::ComplexColor const& rComplexColor, Color const& 
rColor)
 {
     if (rComplexColor.isValidThemeType())
@@ -32,7 +32,7 @@ void writeComplexColor(sax_fastparser::FSHelperPtr& pFS, 
sal_Int32 nElement,
     }
 }
 
-void writeComplexColor(sax_fastparser::FSHelperPtr& pFS, sal_Int32 nElement,
+void writeComplexColor(const sax_fastparser::FSHelperPtr& pFS, sal_Int32 
nElement,
                        model::ComplexColor const& rComplexColor)
 {
     if (rComplexColor.isValidThemeType() || rComplexColor.getType() == 
model::ColorType::RGB)
diff --git a/sc/source/filter/excel/export/SparklineExt.cxx 
b/sc/source/filter/excel/export/SparklineExt.cxx
index e61a16c70f2c..96bfc805761e 100644
--- a/sc/source/filter/excel/export/SparklineExt.cxx
+++ b/sc/source/filter/excel/export/SparklineExt.cxx
@@ -54,8 +54,8 @@ void SparklineExt::SaveXml(XclExpXmlStream& rStream)
 }
 
 void SparklineExt::addSparklineGroupAttributes(
-    rtl::Reference<sax_fastparser::FastAttributeList>& pAttrList,
-    sc::SparklineAttributes& rAttributes)
+    const rtl::Reference<sax_fastparser::FastAttributeList>& pAttrList,
+    const sc::SparklineAttributes& rAttributes)
 {
     if (rAttributes.getLineWeight() != 0.75)
         pAttrList->add(XML_lineWeight, 
OString::number(rAttributes.getLineWeight()));
@@ -123,7 +123,7 @@ void SparklineExt::addSparklineGroupAttributes(
 }
 
 void SparklineExt::addSparklineGroupColors(XclExpXmlStream& rStream,
-                                           sc::SparklineAttributes& 
rAttributes)
+                                           const sc::SparklineAttributes& 
rAttributes)
 {
     sax_fastparser::FSHelperPtr& rWorksheet = rStream.GetCurrentStream();
 
diff --git a/sc/source/filter/excel/xestyle.cxx 
b/sc/source/filter/excel/xestyle.cxx
index 01bc9bfe8d81..cee24d9ca352 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -3180,7 +3180,7 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot )
     }
 }
 
-void XclExpDxfs::fillDxfFrom(SfxItemSet& rItemSet, SvNumberFormatterPtr& 
xFormatter)
+void XclExpDxfs::fillDxfFrom(const SfxItemSet& rItemSet, const 
SvNumberFormatterPtr& xFormatter)
 {
     std::unique_ptr<XclExpCellBorder> pBorder(new XclExpCellBorder);
     if (!pBorder->FillFromItemSet(rItemSet, GetPalette(), GetBiff()))
diff --git a/sc/source/filter/inc/excdoc.hxx b/sc/source/filter/inc/excdoc.hxx
index af0ffade53e5..af9b83b570af 100644
--- a/sc/source/filter/inc/excdoc.hxx
+++ b/sc/source/filter/inc/excdoc.hxx
@@ -96,7 +96,7 @@ public:
     void                WriteXml( XclExpXmlStream& );
 
     // add an element attributes and values to FastAttributeList
-    static void 
addElemensToAttrList(rtl::Reference<sax_fastparser::FastAttributeList>& 
pAttrList,
+    static void addElemensToAttrList(const 
rtl::Reference<sax_fastparser::FastAttributeList>& pAttrList,
                                      css::uno::Sequence<css::uno::Any>& aSeqs);
 };
 
diff --git a/sc/source/filter/inc/export/ExportTools.hxx 
b/sc/source/filter/inc/export/ExportTools.hxx
index 369728f06e10..dc08c33846b1 100644
--- a/sc/source/filter/inc/export/ExportTools.hxx
+++ b/sc/source/filter/inc/export/ExportTools.hxx
@@ -14,9 +14,9 @@
 
 namespace oox::xls
 {
-void writeComplexColor(sax_fastparser::FSHelperPtr& pFS, sal_Int32 nElement,
+void writeComplexColor(const sax_fastparser::FSHelperPtr& pFS, sal_Int32 
nElement,
                        model::ComplexColor const& rComplexColor, Color const& 
rColor);
-void writeComplexColor(sax_fastparser::FSHelperPtr& pFS, sal_Int32 nElement,
+void writeComplexColor(const sax_fastparser::FSHelperPtr& pFS, sal_Int32 
nElement,
                        model::ComplexColor const& rComplexColor);
 }
 
diff --git a/sc/source/filter/inc/export/SparklineExt.hxx 
b/sc/source/filter/inc/export/SparklineExt.hxx
index f2bff1c7d377..16559d1c5b76 100644
--- a/sc/source/filter/inc/export/SparklineExt.hxx
+++ b/sc/source/filter/inc/export/SparklineExt.hxx
@@ -35,10 +35,10 @@ public:
                            std::vector<std::shared_ptr<sc::Sparkline>> const& 
rSparklines);
 
     static void
-    
addSparklineGroupAttributes(rtl::Reference<sax_fastparser::FastAttributeList>& 
pAttrList,
-                                sc::SparklineAttributes& rSparklineAttributes);
+    addSparklineGroupAttributes(const 
rtl::Reference<sax_fastparser::FastAttributeList>& pAttrList,
+                                const sc::SparklineAttributes& 
rSparklineAttributes);
     static void addSparklineGroupColors(XclExpXmlStream& rStream,
-                                        sc::SparklineAttributes& 
rSparklineAttributes);
+                                        const sc::SparklineAttributes& 
rSparklineAttributes);
 
     XclExpExtType GetType() override { return XclExpExtSparklineType; }
 };
diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx
index fc2e0858be33..a54a1fe827c4 100644
--- a/sc/source/filter/inc/xestyle.hxx
+++ b/sc/source/filter/inc/xestyle.hxx
@@ -776,7 +776,7 @@ private:
     DxfContainer maDxf;
     std::unique_ptr<NfKeywordTable>   mpKeywordTable; /// Replacement table.
 
-    void fillDxfFrom(SfxItemSet& rItemSet, SvNumberFormatterPtr& xFormatter);
+    void fillDxfFrom(const SfxItemSet& rItemSet, const SvNumberFormatterPtr& 
xFormatter);
 
 };
 
diff --git a/sc/source/filter/oox/SparklineFragment.cxx 
b/sc/source/filter/oox/SparklineFragment.cxx
index ab0733d0efc7..44d2fe7e479e 100644
--- a/sc/source/filter/oox/SparklineFragment.cxx
+++ b/sc/source/filter/oox/SparklineFragment.cxx
@@ -69,7 +69,7 @@ model::ComplexColor fillComplexColor(const AttributeList& 
rAttribs, ThemeBuffer
 }
 
 void addColorsToSparklineAttributes(sc::SparklineAttributes& rAttributes, 
sal_Int32 nElement,
-                                    const AttributeList& rAttribs, 
ThemeBuffer& rThemeBuffer,
+                                    const AttributeList& rAttribs, const 
ThemeBuffer& rThemeBuffer,
                                     const GraphicHelper& rHelper)
 {
     switch (nElement)
diff --git a/sc/source/filter/oox/commentsbuffer.cxx 
b/sc/source/filter/oox/commentsbuffer.cxx
index 83f9f9ac0304..1f1b0b242fde 100644
--- a/sc/source/filter/oox/commentsbuffer.cxx
+++ b/sc/source/filter/oox/commentsbuffer.cxx
@@ -156,7 +156,7 @@ namespace
         std::shared_ptr<RichString> mxText;
         OUString msAuthorName;
 
-        OOXGenerateNoteCaption(std::shared_ptr<RichString>& rText, const 
OUString& rAuthorName = "")
+        OOXGenerateNoteCaption(const std::shared_ptr<RichString>& rText, const 
OUString& rAuthorName = "")
             : mxText(rText)
             , msAuthorName(rAuthorName)
         {
diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx 
b/sc/source/filter/xml/XMLExportDataPilot.cxx
index b49bad992a42..4eb7ddefa82c 100644
--- a/sc/source/filter/xml/XMLExportDataPilot.cxx
+++ b/sc/source/filter/xml/XMLExportDataPilot.cxx
@@ -136,7 +136,7 @@ void ScXMLExportDataPilot::WriteDPCondition(const 
ScQueryEntry& aQueryEntry, boo
     SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, 
XML_FILTER_CONDITION, true, true);
 }
 
-void ScXMLExportDataPilot::WriteDPFilter(ScDocument& rDoc, const ScQueryParam& 
aQueryParam)
+void ScXMLExportDataPilot::WriteDPFilter(const ScDocument& rDoc, const 
ScQueryParam& aQueryParam)
 {
     SCSIZE nQueryEntryCount = aQueryParam.GetEntryCount();
     if (nQueryEntryCount <= 0)
diff --git a/sc/source/filter/xml/XMLExportDataPilot.hxx 
b/sc/source/filter/xml/XMLExportDataPilot.hxx
index 882ebc9c86c6..5c593c07ad55 100644
--- a/sc/source/filter/xml/XMLExportDataPilot.hxx
+++ b/sc/source/filter/xml/XMLExportDataPilot.hxx
@@ -46,7 +46,7 @@ class ScXMLExportDataPilot
     static OUString getDPOperatorXML(const ScQueryOp aFilterOperator, const 
utl::SearchParam::SearchType eSearchType);
     void WriteDPCondition(const ScQueryEntry& aQueryEntry, bool 
bIsCaseSensitive,
             utl::SearchParam::SearchType eSearchType);
-    void WriteDPFilter(ScDocument& rDoc, const ScQueryParam& aQueryParam);
+    void WriteDPFilter(const ScDocument& rDoc, const ScQueryParam& 
aQueryParam);
 
     void WriteFieldReference(const ScDPSaveDimension* pDim);
     void WriteSortInfo(const ScDPSaveDimension* pDim);
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx 
b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index c6dfd84c3bdb..b531306f5af8 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -146,7 +146,7 @@ void ScMyValidationsContainer::AddValidation(const 
uno::Any& aTempAny,
     }
 }
 
-OUString ScMyValidationsContainer::GetCondition(ScDocument& rDoc, ScXMLExport& 
rExport, const ScMyValidation& aValidation)
+OUString ScMyValidationsContainer::GetCondition(const ScDocument& rDoc, const 
ScXMLExport& rExport, const ScMyValidation& aValidation)
 {
     /* ATTENTION! Should the condition to not write sheet::ValidationType_ANY
      * ever be changed, adapt the conditional call of
@@ -308,7 +308,7 @@ void ScMyValidationsContainer::WriteMessage(ScXMLExport& 
rExport,
     }
 }
 
-void ScMyValidationsContainer::WriteValidations(ScDocument& rDoc, ScXMLExport& 
rExport)
+void ScMyValidationsContainer::WriteValidations(const ScDocument& rDoc, 
ScXMLExport& rExport)
 {
     if (aValidationVec.empty())
         return;
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.hxx 
b/sc/source/filter/xml/XMLStylesExportHelper.hxx
index a23c6b393ac5..f94108df7b44 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.hxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.hxx
@@ -68,12 +68,12 @@ public:
                            ~ScMyValidationsContainer();
     void                   AddValidation(const css::uno::Any& aAny,
                                     sal_Int32& nValidationIndex);
-    static OUString        GetCondition(ScDocument& rDoc, ScXMLExport& 
rExport, const ScMyValidation& aValidation);
+    static OUString        GetCondition(const ScDocument& rDoc, const 
ScXMLExport& rExport, const ScMyValidation& aValidation);
     static OUString        GetBaseCellAddress(const ScDocument* pDoc, const 
ScAddress& aCell);
     static void            WriteMessage(ScXMLExport& rExport,
                                     const OUString& sTitle, const OUString& 
sMessage,
                                     const bool bShowMessage, const bool 
bIsHelpMessage);
-    void                   WriteValidations(ScDocument& rDoc, ScXMLExport& 
rExport);
+    void                   WriteValidations(const ScDocument& rDoc, 
ScXMLExport& rExport);
     const OUString&        GetValidationName(const sal_Int32 nIndex);
 };
 
diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index 33525f249051..0bef31563dfc 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -706,7 +706,7 @@ ScMyAreaLinksContainer 
ScXMLExport::GetAreaLinks(ScDocument& rDoc)
 }
 
 // core implementation
-ScMyDetectiveOpContainer ScXMLExport::GetDetectiveOpList(ScDocument& rDoc)
+ScMyDetectiveOpContainer ScXMLExport::GetDetectiveOpList(const ScDocument& 
rDoc)
 {
     ScDetOpList* pOpList(rDoc.GetDetOpList());
     if( !pOpList )
@@ -877,7 +877,7 @@ void ScXMLExport::ExportColumns(const sal_Int32 nTable, 
const ScRange& aColumnHe
         pGroupColumns->CloseGroups(nColumn - 1);
 }
 
-void ScXMLExport::ExportExternalRefCacheStyles(ScDocument& rDoc)
+void ScXMLExport::ExportExternalRefCacheStyles(const ScDocument& rDoc)
 {
     sal_Int32 nEntryIndex = GetCellStylesPropertySetMapper()->FindEntryIndex(
         "NumberFormat", XML_NAMESPACE_STYLE, u"data-style-name");
@@ -1251,7 +1251,7 @@ const SvxFieldData* toXMLPropertyStates(
 
 }
 
-void ScXMLExport::ExportCellTextAutoStyles(ScDocument& rDoc, sal_Int32 nTable)
+void ScXMLExport::ExportCellTextAutoStyles(const ScDocument& rDoc, sal_Int32 
nTable)
 {
     if (!ValidTab(nTable))
         return;
@@ -1616,7 +1616,7 @@ void ScXMLExport::ExportFormatRanges(ScDocument& rDoc, 
const sal_Int32 nStartCol
     }
 }
 
-void ScXMLExport::GetColumnRowHeader(ScDocument& rDoc, bool& rHasColumnHeader, 
ScRange& rColumnHeaderRange,
+void ScXMLExport::GetColumnRowHeader(const ScDocument& rDoc, bool& 
rHasColumnHeader, ScRange& rColumnHeaderRange,
                                      bool& rHasRowHeader, ScRange& 
rRowHeaderRange,
                                      OUString& rPrintRanges) const
 {
@@ -3047,7 +3047,7 @@ void ScXMLExport::WriteTable(ScDocument& rDoc, sal_Int32 
nTable, const uno::Refe
 
 namespace {
 
-void writeContent(ScDocument& rDoc, ScXMLExport& rExport, const OUString& 
rStyleName,
+void writeContent(const ScDocument& rDoc, ScXMLExport& rExport, const 
OUString& rStyleName,
                   const OUString& rContent, const SvxFieldData* pField)
 {
     std::unique_ptr<SvXMLElementExport> pElem;
@@ -3138,7 +3138,7 @@ void writeContent(ScDocument& rDoc, ScXMLExport& rExport, 
const OUString& rStyle
 }
 
 void flushParagraph(
-    ScDocument& rDoc,
+    const ScDocument& rDoc,
     ScXMLExport& rExport, std::u16string_view rParaText,
     rtl::Reference<XMLPropertySetMapper> const & xMapper, 
rtl::Reference<SvXMLAutoStylePoolP> const & xStylePool,
     const ScXMLEditAttributeMap& rAttrMap,
@@ -3180,7 +3180,7 @@ void flushParagraph(
 
 }
 
-void ScXMLExport::WriteCell(ScDocument& rDoc, ScMyCell& aCell, sal_Int32 
nEqualCellCount)
+void ScXMLExport::WriteCell(ScDocument& rDoc, const ScMyCell& aCell, sal_Int32 
nEqualCellCount)
 {
     // nEqualCellCount is the number of additional cells
     SetRepeatAttribute(nEqualCellCount, (aCell.nType != 
table::CellContentType_EMPTY));
@@ -3341,7 +3341,7 @@ void ScXMLExport::WriteCell(ScDocument& rDoc, ScMyCell& 
aCell, sal_Int32 nEqualC
         IncrementProgressBar(false);
 }
 
-void ScXMLExport::WriteEditCell(ScDocument& rDoc, const EditTextObject* pText)
+void ScXMLExport::WriteEditCell(const ScDocument& rDoc, const EditTextObject* 
pText)
 {
     rtl::Reference<XMLPropertySetMapper> xMapper = 
GetTextParagraphExport()->GetTextPropMapper()->getPropertySetMapper();
     rtl::Reference<SvXMLAutoStylePoolP> xStylePool = GetAutoStylePool();
@@ -3412,7 +3412,7 @@ void ScXMLExport::WriteMultiLineFormulaResult(const 
ScFormulaCell* pCell)
     Characters(aContent);
 }
 
-void ScXMLExport::ExportShape(ScDocument& rDoc, const uno::Reference < 
drawing::XShape >& xShape, awt::Point* pPoint)
+void ScXMLExport::ExportShape(const ScDocument& rDoc, const uno::Reference < 
drawing::XShape >& xShape, awt::Point* pPoint)
 {
     uno::Reference < beans::XPropertySet > xShapeProps ( xShape, 
uno::UNO_QUERY );
     bool bIsChart( false );
@@ -3506,7 +3506,7 @@ void ScXMLExport::ExportShape(ScDocument& rDoc, const 
uno::Reference < drawing::
     IncrementProgressBar(false);
 }
 
-void ScXMLExport::WriteShapes(ScDocument& rDoc, const ScMyCell& rMyCell)
+void ScXMLExport::WriteShapes(const ScDocument& rDoc, const ScMyCell& rMyCell)
 {
     if( !(rMyCell.bHasShape && !rMyCell.aShapeList.empty()) )
         return;
@@ -3674,7 +3674,7 @@ void ScXMLExport::WriteShapes(ScDocument& rDoc, const 
ScMyCell& rMyCell)
     }
 }
 
-void ScXMLExport::WriteTableShapes(ScDocument& rDoc)
+void ScXMLExport::WriteTableShapes(const ScDocument& rDoc)
 {
     ScMyTableShapes* pTableShapes(pSharedData->GetTableShapes());
     if (!pTableShapes || (*pTableShapes)[nCurrentTable].empty())
@@ -3832,7 +3832,7 @@ void ScXMLExport::WriteAnnotation(ScDocument& rDoc, const 
ScMyCell& rMyCell)
     pCurrentCell = nullptr;
 }
 
-void ScXMLExport::WriteDetective(ScDocument& rDoc, const ScMyCell& rMyCell)
+void ScXMLExport::WriteDetective(const ScDocument& rDoc, const ScMyCell& 
rMyCell)
 {
     if( !(rMyCell.bHasDetectiveObj || rMyCell.bHasDetectiveOp) )
         return;
@@ -3893,7 +3893,7 @@ bool ScXMLExport::IsEditCell(const ScMyCell& rCell)
 }
 
 //static
-bool ScXMLExport::IsCellEqual(ScDocument& rDoc, const ScMyCell& aCell1, const 
ScMyCell& aCell2)
+bool ScXMLExport::IsCellEqual(const ScDocument& rDoc, const ScMyCell& aCell1, 
const ScMyCell& aCell2)
 {
     bool bIsEqual = false;
     if( !aCell1.bIsMergedBase && !aCell2.bIsMergedBase &&
@@ -3961,7 +3961,7 @@ bool ScXMLExport::IsCellEqual(ScDocument& rDoc, const 
ScMyCell& aCell1, const Sc
     return bIsEqual;
 }
 
-void ScXMLExport::WriteCalculationSettings(ScDocument& rDoc, const 
uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc)
+void ScXMLExport::WriteCalculationSettings(const ScDocument& rDoc, const 
uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc)
 {
     uno::Reference<beans::XPropertySet> xPropertySet(xSpreadDoc, 
uno::UNO_QUERY);
     if (!xPropertySet.is())
@@ -4103,7 +4103,7 @@ void ScXMLExport::WriteTableSource()
 }
 
 // core implementation
-void ScXMLExport::WriteScenario(ScDocument& rDoc)
+void ScXMLExport::WriteScenario(const ScDocument& rDoc)
 {
     if (!rDoc.IsScenario(static_cast<SCTAB>(nCurrentTable)))
         return;
@@ -4137,7 +4137,7 @@ void ScXMLExport::WriteScenario(ScDocument& rDoc)
     SvXMLElementExport aElem(*this, XML_NAMESPACE_TABLE, XML_SCENARIO, true, 
true);
 }
 
-void ScXMLExport::WriteTheLabelRanges(ScDocument& rDoc, const uno::Reference< 
sheet::XSpreadsheetDocument >& xSpreadDoc)
+void ScXMLExport::WriteTheLabelRanges(const ScDocument& rDoc, const 
uno::Reference< sheet::XSpreadsheetDocument >& xSpreadDoc)
 {
     uno::Reference< beans::XPropertySet > xDocProp( xSpreadDoc, uno::UNO_QUERY 
);
     if( !xDocProp.is() ) return;
@@ -4159,7 +4159,7 @@ void ScXMLExport::WriteTheLabelRanges(ScDocument& rDoc, 
const uno::Reference< sh
     }
 }
 
-void ScXMLExport::WriteLabelRanges(ScDocument& rDoc, const uno::Reference< 
container::XIndexAccess >& xRangesIAccess, bool bColumn)
+void ScXMLExport::WriteLabelRanges(const ScDocument& rDoc, const 
uno::Reference< container::XIndexAccess >& xRangesIAccess, bool bColumn)
 {
     if( !xRangesIAccess.is() ) return;
 
@@ -4182,7 +4182,7 @@ void ScXMLExport::WriteLabelRanges(ScDocument& rDoc, 
const uno::Reference< conta
     }
 }
 
-void ScXMLExport::WriteNamedExpressions(ScDocument& rDoc)
+void ScXMLExport::WriteNamedExpressions(const ScDocument& rDoc)
 {
     ScRangeName* pNamedRanges = rDoc.GetRangeName();
     WriteNamedRange(rDoc, pNamedRanges);
@@ -4552,7 +4552,7 @@ void ScXMLExport::WriteDataStream(ScDocument& rDoc)
     SvXMLElementExport aElem(*this, XML_NAMESPACE_CALC_EXT, 
XML_DATA_STREAM_SOURCE, true, true);
 }
 
-void ScXMLExport::WriteNamedRange(ScDocument& rDoc, ScRangeName* pRangeName)
+void ScXMLExport::WriteNamedRange(const ScDocument& rDoc, ScRangeName* 
pRangeName)
 {
     //write a global or local ScRangeName
     SvXMLElementExport aElemNEs(*this, XML_NAMESPACE_TABLE, 
XML_NAMED_EXPRESSIONS, true, true);
@@ -4692,7 +4692,7 @@ OUString 
getDateStringForType(condformat::ScCondFormatDateType eType)
 
 }
 
-void ScXMLExport::ExportConditionalFormat(ScDocument& rDoc, SCTAB nTab)
+void ScXMLExport::ExportConditionalFormat(const ScDocument& rDoc, SCTAB nTab)
 {
     ScConditionalFormatList* pCondFormatList = rDoc.GetCondFormList(nTab);
     if(!pCondFormatList)
@@ -4985,7 +4985,7 @@ void ScXMLExport::ExportConditionalFormat(ScDocument& 
rDoc, SCTAB nTab)
     }
 }
 
-void ScXMLExport::WriteExternalRefCaches(ScDocument& rDoc)
+void ScXMLExport::WriteExternalRefCaches(const ScDocument& rDoc)
 {
     ScExternalRefManager* pRefMgr = rDoc.GetExternalRefManager();
     pRefMgr->resetSrcFileData(GetOrigFileName());
@@ -5173,7 +5173,7 @@ void ScXMLExport::WriteExternalRefCaches(ScDocument& rDoc)
 }
 
 // core implementation
-void ScXMLExport::WriteConsolidation(ScDocument& rDoc)
+void ScXMLExport::WriteConsolidation(const ScDocument& rDoc)
 {
     const ScConsolidateParam* pCons(rDoc.GetConsolidateDlgData());
     if( !pCons )
@@ -5214,7 +5214,7 @@ XMLPageExport* ScXMLExport::CreatePageExport()
 }
 
 //static
-void ScXMLExport::GetChangeTrackViewSettings(ScDocument& rDoc, 
uno::Sequence<beans::PropertyValue>& rProps)
+void ScXMLExport::GetChangeTrackViewSettings(const ScDocument& rDoc, 
uno::Sequence<beans::PropertyValue>& rProps)
 {
     ScChangeViewSettings* pViewSettings(rDoc.GetChangeViewSettings());
     if (!pViewSettings)
diff --git a/sc/source/filter/xml/xmlexprt.hxx 
b/sc/source/filter/xml/xmlexprt.hxx
index d7ad2c726187..5136b4ef6308 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -141,7 +141,7 @@ class ScXMLExport : public SvXMLExport
 
     static css::table::CellRangeAddress GetEndAddress(const 
css::uno::Reference<css::sheet::XSpreadsheet>& xTable);
     static ScMyAreaLinksContainer GetAreaLinks(ScDocument& rDoc);
-    ScMyDetectiveOpContainer GetDetectiveOpList(ScDocument& rDoc);
+    ScMyDetectiveOpContainer GetDetectiveOpList(const ScDocument& rDoc);
     void WriteSingleColumn(const sal_Int32 nRepeatColumns, const sal_Int32 
nStyleIndex,
         const sal_Int32 nIndex, const bool bIsAutoStyle, const bool 
bIsVisible);
     void WriteColumn(const sal_Int32 nColumn, const sal_Int32 nRepeatColumns,
@@ -149,8 +149,8 @@ class ScXMLExport : public SvXMLExport
     void OpenHeaderColumn();
     void CloseHeaderColumn();
     void ExportColumns(const sal_Int32 nTable, const ScRange& 
aColumnHeaderRange, const bool bHasColumnHeader);
-    void ExportExternalRefCacheStyles(ScDocument& rDoc);
-    void ExportCellTextAutoStyles(ScDocument& rDoc, sal_Int32 nTable);
+    void ExportExternalRefCacheStyles(const ScDocument& rDoc);
+    void ExportCellTextAutoStyles(const ScDocument& rDoc, sal_Int32 nTable);
     void ExportFormatRanges(ScDocument& rDoc, const sal_Int32 nStartCol, const 
sal_Int32 nStartRow,
         const sal_Int32 nEndCol, const sal_Int32 nEndRow, const sal_Int32 
nSheet);
     void WriteRowContent();
@@ -163,7 +163,7 @@ class ScXMLExport : public SvXMLExport
                          bool bHidden, bool bFiltered);
     void OpenRow(const sal_Int32 nTable, const sal_Int32 nStartRow, const 
sal_Int32 nRepeatRow, ScXMLCachedRowAttrAccess& rRowAttr);
     void CloseRow(const sal_Int32 nRow);
-    void GetColumnRowHeader(ScDocument& rDoc, bool& bHasColumnHeader, ScRange& 
aColumnHeaderRange,
+    void GetColumnRowHeader(const ScDocument& rDoc, bool& bHasColumnHeader, 
ScRange& aColumnHeaderRange,
         bool& bHasRowHeader, ScRange& aRowHeaderRange, OUString& rPrintRanges) 
const;
     static void FillFieldGroup(ScOutlineArray* pFields, 
ScMyOpenCloseColumnRowGroup* pGroups);
     void FillColumnRowGroups(ScDocument& rDoc);
@@ -172,34 +172,34 @@ class ScXMLExport : public SvXMLExport
         const css::uno::Reference <css::sheet::XSpreadsheet>& xTable);
 
     void WriteTable(ScDocument& rDoc, sal_Int32 nTable, const 
css::uno::Reference< css::sheet::XSpreadsheet>& xTable);
-    void WriteCell(ScDocument& rDoc, ScMyCell& aCell, sal_Int32 
nEqualCellCount);
-    void WriteEditCell(ScDocument& rDoc, const EditTextObject* pText);
+    void WriteCell(ScDocument& rDoc, const ScMyCell& aCell, sal_Int32 
nEqualCellCount);
+    void WriteEditCell(const ScDocument& rDoc, const EditTextObject* pText);
     void WriteMultiLineFormulaResult(const ScFormulaCell* pCell);
     void WriteAreaLink(const ScMyCell& rMyCell);
     void WriteAnnotation(ScDocument& rDoc, const ScMyCell& rMyCell);
-    void WriteDetective(ScDocument& rDoc, const ScMyCell& rMyCell);
-    void ExportShape(ScDocument& rDoc, const css::uno::Reference < 
css::drawing::XShape >& xShape, css::awt::Point* pPoint);
-    void WriteShapes(ScDocument& rDoc, const ScMyCell& rMyCell);
-    void WriteTableShapes(ScDocument& rDoc);
+    void WriteDetective(const ScDocument& rDoc, const ScMyCell& rMyCell);
+    void ExportShape(const ScDocument& rDoc, const css::uno::Reference < 
css::drawing::XShape >& xShape, css::awt::Point* pPoint);
+    void WriteShapes(const ScDocument& rDoc, const ScMyCell& rMyCell);
+    void WriteTableShapes(const ScDocument& rDoc);
     void SetRepeatAttribute(sal_Int32 nEqualCellCount, bool bIncProgress);
 
     static bool IsEditCell(const ScMyCell& rCell);
-    static bool IsCellEqual(ScDocument& rDoc, const ScMyCell& aCell1, const 
ScMyCell& aCell2);
+    static bool IsCellEqual(const ScDocument& rDoc, const ScMyCell& aCell1, 
const ScMyCell& aCell2);
 
-    void WriteCalculationSettings(ScDocument& rDoc, const css::uno::Reference 
<css::sheet::XSpreadsheetDocument>& xSpreadDoc);
+    void WriteCalculationSettings(const ScDocument& rDoc, const 
css::uno::Reference <css::sheet::XSpreadsheetDocument>& xSpreadDoc);
     void WriteTableSource();
-    void WriteScenario(ScDocument& rDoc);   // core implementation
-    void WriteTheLabelRanges(ScDocument& rDoc, const css::uno::Reference< 
css::sheet::XSpreadsheetDocument >& xSpreadDoc);
-    void WriteLabelRanges(ScDocument& rDoc, const css::uno::Reference< 
css::container::XIndexAccess >& xRangesIAccess, bool bColumn);
-    void WriteNamedExpressions(ScDocument& rDoc);
+    void WriteScenario(const ScDocument& rDoc);   // core implementation
+    void WriteTheLabelRanges(const ScDocument& rDoc, const 
css::uno::Reference< css::sheet::XSpreadsheetDocument >& xSpreadDoc);
+    void WriteLabelRanges(const ScDocument& rDoc, const css::uno::Reference< 
css::container::XIndexAccess >& xRangesIAccess, bool bColumn);
+    void WriteNamedExpressions(const ScDocument& rDoc);
     void WriteExternalDataMapping(ScDocument& rDoc);
     void WriteExternalDataTransformations(ScDocument& rDoc, const 
std::vector<std::shared_ptr<sc::DataTransformation>>& rDataTransformations);
     void WriteDataStream(ScDocument& rDoc);
-    void WriteNamedRange(ScDocument& rDoc, ScRangeName* pRangeName);
+    void WriteNamedRange(const ScDocument& rDoc, ScRangeName* pRangeName);
     void exportSparklineGroups(ScDocument& rDoc, SCTAB nTab);
-    void ExportConditionalFormat(ScDocument& rDoc, SCTAB nTab);
-    void WriteExternalRefCaches(ScDocument& rDoc);
-    void WriteConsolidation(ScDocument& rDoc);  // core implementation
+    void ExportConditionalFormat(const ScDocument& rDoc, SCTAB nTab);
+    void WriteExternalRefCaches(const ScDocument& rDoc);
+    void WriteConsolidation(const ScDocument& rDoc);  // core implementation
 
     void CollectUserDefinedNamespaces(const SfxItemPool* pPool, sal_uInt16 
nAttrib);
 
@@ -246,7 +246,7 @@ public:
 
     void SetSourceStream( const css::uno::Reference<css::io::XInputStream>& 
xNewStream );
 
-    static void GetChangeTrackViewSettings(ScDocument& rDoc, 
css::uno::Sequence<css::beans::PropertyValue>& rProps);
+    static void GetChangeTrackViewSettings(const ScDocument& rDoc, 
css::uno::Sequence<css::beans::PropertyValue>& rProps);
     virtual void 
GetViewSettings(css::uno::Sequence<css::beans::PropertyValue>& rProps) override;
     virtual void 
GetConfigurationSettings(css::uno::Sequence<css::beans::PropertyValue>& rProps) 
override;
 
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 0f3433a0050b..a02a5e3df809 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1823,7 +1823,7 @@ void ScInputHandler::LOKPasteFunctionData(const OUString& 
rFunctionName)
     }
 }
 
-void ScTabViewShell::LOKSendFormulabarUpdate(EditView* pActiveView,
+void ScTabViewShell::LOKSendFormulabarUpdate(const EditView* pActiveView,
                                              const OUString& rText,
                                              const ESelection& rSelection)
 {
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index aa1269aa70b0..924ef33f1333 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -508,7 +508,7 @@ static OUString lcl_GetAreaName( ScDocument* pDoc, const 
ScArea* pArea )
     return aName;
 }
 
-static ScDBData* getUndoData(ScDBData* pDestData)
+static ScDBData* getUndoData(const ScDBData* pDestData)
 {
     if (!pDestData)
         return nullptr;
diff --git a/sc/source/ui/inc/dbfunc.hxx b/sc/source/ui/inc/dbfunc.hxx
index 5f99c763b47a..79da5609f714 100644
--- a/sc/source/ui/inc/dbfunc.hxx
+++ b/sc/source/ui/inc/dbfunc.hxx
@@ -36,7 +36,7 @@ class SAL_DLLPUBLIC_RTTI ScDBFunc : public ScViewFunc
 private:
     void GetSelectedMemberList(ScDPUniqueStringSet& rEntries, tools::Long& 
rDimension);
     static void ModifiedAutoFilter(ScDocShell* pDocSh);
-    static void ApplyAutoFilter(ScDocShell* pDocSh, ScViewData* pViewData, 
ScDBData* pDBData,
+    static void ApplyAutoFilter(ScDocShell* pDocSh, const ScViewData* 
pViewData, ScDBData* pDBData,
                                 SCROW nRow, SCTAB nTab, const ScQueryParam& 
aParam);
 
     DECL_STATIC_LINK(ScDBFunc, InstallLOKNotifierHdl, void*, 
vcl::ILibreOfficeKitNotifier*);
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index c6fd97f16db0..ee9c642fea2d 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -505,7 +505,7 @@ namespace HelperNotifyChanges
         return false;
     }
 
-    inline bool getMustPropagateChangesModel(ScModelObj* pModelObj)
+    inline bool getMustPropagateChangesModel(const ScModelObj* pModelObj)
     {
         return pModelObj && pModelObj->HasChangesListeners();
     }
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index a1be44905351..431f915ce4e1 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -270,7 +270,7 @@ public:
     SC_DLLPUBLIC bool IsRefInputMode() const;
     void            ExecuteInputDirect();
 
-    void HandleDuplicateRecords(css::uno::Reference<css::sheet::XSpreadsheet> 
ActiveSheet,
+    void HandleDuplicateRecords(const 
css::uno::Reference<css::sheet::XSpreadsheet>& ActiveSheet,
                                 const css::table::CellRangeAddress& aRange, 
bool bRemove,
                                 bool bIncludesHeaders, bool bDuplicateRows,
                                 const std::vector<int>& rSelectedEntries);
@@ -452,7 +452,7 @@ public:
     /// is equal to nCurrentTabIndex
     static void notifyAllViewsSheetGeomInvalidation(const SfxViewShell* 
pForViewShell, bool bColumns, bool bRows, bool bSizes,
                                                     bool bHidden, bool 
bFiltered, bool bGroups, SCTAB nCurrentTabIndex);
-    void LOKSendFormulabarUpdate(EditView* pEditView, const OUString& rText, 
const ESelection& rSelection);
+    void LOKSendFormulabarUpdate(const EditView* pEditView, const OUString& 
rText, const ESelection& rSelection);
     css::uno::Reference<css::drawing::XShapes> getSelectedXShapes();
     SC_DLLPUBLIC static css::uno::Reference<css::datatransfer::XTransferable2> 
GetClipData(vcl::Window* pWin);
 
diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx
index 8c8805b3dce8..b6dde6b5f484 100644
--- a/sc/source/ui/inc/undoblk.hxx
+++ b/sc/source/ui/inc/undoblk.hxx
@@ -633,7 +633,7 @@ public:
 
 private:
     ScDocumentUniquePtr createUndoRedoData();
-    void DoChange(ScDocument* pDoc);
+    void DoChange(const ScDocument* pDoc);
     SCTAB mnTab;
     ScDocumentUniquePtr mpUndoDoc;
     ScDocumentUniquePtr mpRedoDoc;
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 7c79bb91d65f..00417885c7a0 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -704,7 +704,7 @@ public:
                                     SCROW & rPosY, SCROW nStartRow, double 
nPPTY,
                                     const ScDocument * pDoc, SCTAB nTabNo );
 
-    void setupSizeDeviceProviderForColWidth(ScSizeDeviceProvider& rProv, 
Fraction& rZoomX, Fraction& rZoomY, double& rPPTX, double &rPPTY);
+    void setupSizeDeviceProviderForColWidth(const ScSizeDeviceProvider& rProv, 
Fraction& rZoomX, Fraction& rZoomY, double& rPPTX, double &rPPTY);
 };
 
 inline tools::Long ScViewData::ToPixel( sal_uInt16 nTwips, double nFactor )
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index e46762e2d992..ef3c9e2311b0 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -377,11 +377,11 @@ private:
     bool            PasteDataFormatSource( SotClipboardFormatId nFormatId,
                                         SCCOL nPosX, SCROW nPosY,
                                         bool bAllowDialogs,
-                                        TransferableDataHelper& rDataHelper, 
Point& rPos);
+                                        const TransferableDataHelper& 
rDataHelper, const Point& rPos);
     bool            PasteDataFormatFormattedText( SotClipboardFormatId 
nFormatId,
                                         const css::uno::Reference< 
css::datatransfer::XTransferable >& rxTransferable,
                                         SCCOL nPosX, SCROW nPosY,
-                                        bool bAllowDialogs, 
TransferableDataHelper& rDataHelper );
+                                        bool bAllowDialogs, const 
TransferableDataHelper& rDataHelper );
 
     sal_uInt16      GetOptimalColWidth( SCCOL nCol, SCTAB nTab, bool bFormula 
);
 
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index f5b3124c8795..3b844b9509d0 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -1645,7 +1645,7 @@ void ScUndoConditionalFormat::Redo()
     DoChange(mpRedoDoc.get());
 }
 
-void ScUndoConditionalFormat::DoChange(ScDocument* pSrcDoc)
+void ScUndoConditionalFormat::DoChange(const ScDocument* pSrcDoc)
 {
     ScDocument& rDoc = pDocShell->GetDocument();
 
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index f15a8c02bbe9..4618f8ddbe7a 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -503,7 +503,7 @@ void ScModelObj::RepaintRange( const ScRangeList& rRange )
         pDocShell->PostPaint(rRange, PaintPartFlags::Grid, SC_PF_TESTMERGE);
 }
 
-static OString getTabViewRenderState(ScTabViewShell& rTabViewShell)
+static OString getTabViewRenderState(const ScTabViewShell& rTabViewShell)
 {
     OStringBuffer aState;
     const ScViewRenderingOptions& rViewRenderingOptions = 
rTabViewShell.GetViewRenderingData();
@@ -2374,7 +2374,7 @@ static void lcl_PDFExportBookmarkHelper(OutputDevice* 
pDev, ScDocument& rDoc,
 }
 
 static void lcl_SetMediaScreen(const uno::Reference<drawing::XShape>& 
xMediaShape,
-                               const OutputDevice* pDev, tools::Rectangle& 
aRect,
+                               const OutputDevice* pDev, const 
tools::Rectangle& aRect,
                                sal_Int32 nPageNumb)
 {
     OUString sMediaURL;
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index a594832b1107..197daf644b6d 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -375,7 +375,7 @@ IMPL_STATIC_LINK_NOARG(ScDBFunc, InstallLOKNotifierHdl, 
void*, vcl::ILibreOffice
     return GetpApp();
 }
 
-void ScDBFunc::ApplyAutoFilter(ScDocShell* pDocSh, ScViewData* pViewData, 
ScDBData* pDBData,
+void ScDBFunc::ApplyAutoFilter(ScDocShell* pDocSh, const ScViewData* 
pViewData, ScDBData* pDBData,
                                SCROW nRow, SCTAB nTab, const ScQueryParam& 
aParam)
 {
     ScDocument& rDoc = pViewData->GetDocument();
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 77e102519760..69fc57fce967 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -94,7 +94,7 @@ static void lcl_LimitRect( tools::Rectangle& rRect, const 
tools::Rectangle& rVis
 static void lcl_DrawOneFrame( vcl::RenderContext* pDev, const 
tools::Rectangle& rInnerPixel,
                         const OUString& rTitle, const Color& rColor, bool 
bTextBelow,
                         double nPPTX, double nPPTY, const Fraction& rZoomY,
-                        ScDocument& rDoc, ScViewData& rButtonViewData, bool 
bLayoutRTL )
+                        const ScDocument& rDoc, ScViewData& rButtonViewData, 
bool bLayoutRTL )
 {
     // rButtonViewData is only used to set the button size,
 
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 6f08e3f2de8d..866ac2eb6cbb 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -872,7 +872,7 @@ double ScOutputData::GetStretch() const
 
 //  output strings
 
-static void lcl_DoHyperlinkResult( const OutputDevice* pDev, const 
tools::Rectangle& rRect, ScRefCellValue& rCell )
+static void lcl_DoHyperlinkResult( const OutputDevice* pDev, const 
tools::Rectangle& rRect, const ScRefCellValue& rCell )
 {
     vcl::PDFExtOutDevData* pPDFData = dynamic_cast< vcl::PDFExtOutDevData* >( 
pDev->GetExtOutDevData() );
 
@@ -2302,7 +2302,7 @@ static void lcl_ClearEdit( EditEngine& rEngine )       // 
text and attributes
     rEngine.EnableSkipOutsideFormat(false);
 }
 
-static bool lcl_SafeIsValue( ScRefCellValue& rCell )
+static bool lcl_SafeIsValue( const ScRefCellValue& rCell )
 {
     switch (rCell.getType())
     {
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index af8496c347b6..a50842624ae6 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1779,7 +1779,7 @@ 
ScViewOptiChangesListener::ScViewOptiChangesListener(ScTabViewShell& rViewShell)
         m_xColorSchemeChangesNotifier->addChangesListener(this);
 }
 
-static void lcl_RemoveCells(uno::Reference<sheet::XSpreadsheet>& rSheet, 
sal_uInt16 nSheet,
+static void lcl_RemoveCells(const uno::Reference<sheet::XSpreadsheet>& rSheet, 
sal_uInt16 nSheet,
                      sal_uInt32 nStartColumn, sal_uInt32 nStartRow, sal_uInt32 
nEndColumn,
                      sal_uInt32 nEndRow, bool bRows)
 {
@@ -1887,7 +1887,7 @@ void 
ScTabViewShell::ExtendSingleSelection(css::table::CellRangeAddress& rRangeD
 }
 
 /* bool bRemove == false ==> highlight duplicate rows */
-void 
ScTabViewShell::HandleDuplicateRecords(css::uno::Reference<css::sheet::XSpreadsheet>
 ActiveSheet,
+void ScTabViewShell::HandleDuplicateRecords(const 
css::uno::Reference<css::sheet::XSpreadsheet>& ActiveSheet,
                                 const css::table::CellRangeAddress& aRange, 
bool bRemove,
                                 bool bIncludesHeaders, bool bDuplicateRows,
                                 const std::vector<int>& rSelectedEntries)
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index 3786db723629..42c59672fad5 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -459,7 +459,7 @@ bool ScViewFunc::PasteLink( const 
uno::Reference<datatransfer::XTransferable>& r
 
 bool ScViewFunc::PasteDataFormatSource( SotClipboardFormatId nFormatId,
                     SCCOL nPosX, SCROW nPosY, bool bAllowDialogs,
-                    TransferableDataHelper& rDataHelper, Point& rPos )
+                    const TransferableDataHelper& rDataHelper, const Point& 
rPos )
 {
     bool bRet = false;
     uno::Reference < io::XInputStream > xStm;
@@ -658,7 +658,7 @@ bool ScViewFunc::PasteDataFormatSource( 
SotClipboardFormatId nFormatId,
 bool ScViewFunc::PasteDataFormatFormattedText( SotClipboardFormatId nFormatId,
                     const uno::Reference<datatransfer::XTransferable>& 
rxTransferable,
                     SCCOL nPosX, SCROW nPosY, bool bAllowDialogs,
-                    TransferableDataHelper& rDataHelper )
+                    const TransferableDataHelper& rDataHelper )
 {
     if ( nFormatId == SotClipboardFormatId::RTF && rDataHelper.HasFormat( 
SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT ) )
     {
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index fd4099ff17d5..8dcb2cb7e4cc 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -307,7 +307,7 @@ void ScViewFunc::DoAutoAttributes( SCCOL nCol, SCROW nRow, 
SCTAB nTab,
 
 //      additional routines
 
-void ScViewData::setupSizeDeviceProviderForColWidth(ScSizeDeviceProvider& 
rProv, Fraction& rZoomX, Fraction& rZoomY, double& rPPTX, double &rPPTY)
+void ScViewData::setupSizeDeviceProviderForColWidth(const 
ScSizeDeviceProvider& rProv, Fraction& rZoomX, Fraction& rZoomY, double& rPPTX, 
double &rPPTY)
 {
     if (rProv.IsPrinter())
     {
@@ -1019,7 +1019,7 @@ SvtScriptType ScViewFunc::GetSelectionScriptType()
     return nScript;
 }
 
-static void ShrinkToDataArea(ScMarkData& rFuncMark, ScDocument& rDoc);
+static void ShrinkToDataArea(ScMarkData& rFuncMark, const ScDocument& rDoc);
 
 const ScPatternAttr* ScViewFunc::GetSelectionPattern()
 {
@@ -1308,7 +1308,7 @@ void ScViewFunc::ApplyPatternLines( const ScPatternAttr& 
rAttr, const SvxBoxItem
 // tdf#147842 if the marked area is the entire sheet, then shrink it to the 
data area.
 // Otherwise ctrl-A, perform-action, will take a very long time as it tries to 
modify
 // cells that we are not using.
-static void ShrinkToDataArea(ScMarkData& rFuncMark, ScDocument& rDoc)
+static void ShrinkToDataArea(ScMarkData& rFuncMark, const ScDocument& rDoc)
 {
     // do not make it marked if it is not already marked
     if (!rFuncMark.IsMarked())

Reply via email to