[Libreoffice-commits] core.git: basctl/source basegfx/source chart2/source comphelper/source compilerplugins/clang connectivity/source cui/source dbaccess/source extensions/source filter/source include/filter include/oox include/sfx2 include/svx include/vcl oox/source package/source reportdesign/source sc/source sd/source sfx2/source svl/source svx/source sw/inc sw/source toolkit/source vcl/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 30 09:25:16 UTC 2021


 basctl/source/basicide/baside2b.cxx                     |    2 -
 basctl/source/basicide/bastype3.cxx                     |    2 -
 basctl/source/basicide/moduldlg.cxx                     |    2 -
 basctl/source/inc/bastype2.hxx                          |    2 -
 basegfx/source/range/b2drangeclipper.cxx                |    2 -
 chart2/source/controller/dialogs/dlg_NumberFormat.cxx   |    2 -
 chart2/source/controller/dialogs/dlg_NumberFormat.hxx   |    2 -
 comphelper/source/misc/anytostring.cxx                  |    2 -
 compilerplugins/clang/constparams.cxx                   |   27 ++++++++++++++--
 compilerplugins/clang/test/constparams.cxx              |   22 +++++++++++++
 connectivity/source/drivers/dbase/DIndex.cxx            |    2 -
 connectivity/source/inc/dbase/DIndex.hxx                |    4 +-
 cui/source/dialogs/scriptdlg.cxx                        |    6 +--
 cui/source/inc/numfmt.hxx                               |    2 -
 cui/source/inc/scriptdlg.hxx                            |    6 +--
 cui/source/options/optcolor.cxx                         |    4 +-
 cui/source/tabpages/numfmt.cxx                          |    2 -
 dbaccess/source/ui/browser/unodatbr.cxx                 |    6 +--
 dbaccess/source/ui/control/tabletree.cxx                |    6 +--
 dbaccess/source/ui/inc/tabletree.hxx                    |    6 +--
 dbaccess/source/ui/inc/unodatbr.hxx                     |    6 +--
 extensions/source/propctrlr/selectlabeldialog.cxx       |    2 -
 extensions/source/propctrlr/selectlabeldialog.hxx       |    2 -
 filter/source/msfilter/svdfppt.cxx                      |    4 +-
 filter/source/pdf/impdialog.cxx                         |    2 -
 filter/source/pdf/impdialog.hxx                         |    2 -
 include/filter/msfilter/svdfppt.hxx                     |    4 +-
 include/oox/drawingml/shape.hxx                         |    4 +-
 include/sfx2/childwin.hxx                               |    2 -
 include/sfx2/frame.hxx                                  |    2 -
 include/sfx2/viewsh.hxx                                 |    2 -
 include/svx/svdedtv.hxx                                 |    2 -
 include/svx/svdpagv.hxx                                 |    2 -
 include/svx/svdpntv.hxx                                 |    2 -
 include/svx/svdtext.hxx                                 |    2 -
 include/vcl/weldutils.hxx                               |    3 +
 include/vcl/window.hxx                                  |    2 -
 oox/source/drawingml/shape.cxx                          |    4 +-
 oox/source/export/chartexport.cxx                       |    2 -
 package/source/xstor/xstorage.cxx                       |    2 -
 package/source/xstor/xstorage.hxx                       |    2 -
 reportdesign/source/ui/dlg/Navigator.cxx                |    4 +-
 sc/source/filter/inc/lotattr.hxx                        |    2 -
 sc/source/filter/lotus/lotattr.cxx                      |    2 -
 sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx  |    2 -
 sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx  |    2 -
 sc/source/filter/xml/xmlexprt.cxx                       |    2 -
 sc/source/filter/xml/xmlexprt.hxx                       |    2 -
 sc/source/ui/attrdlg/tabpages.cxx                       |    2 -
 sc/source/ui/docshell/dbdocfun.cxx                      |    2 -
 sc/source/ui/inc/dbdocfun.hxx                           |    2 -
 sc/source/ui/inc/tabpages.hxx                           |    2 -
 sc/source/ui/inc/xmlsourcedlg.hxx                       |    8 ++--
 sc/source/ui/xmlsource/xmlsourcedlg.cxx                 |   10 ++---
 sd/source/ui/accessibility/AccessibleViewForwarder.cxx  |    2 -
 sd/source/ui/dlg/sdtreelb.cxx                           |    2 -
 sd/source/ui/inc/AccessibleViewForwarder.hxx            |    2 -
 sd/source/ui/inc/sdtreelb.hxx                           |    2 -
 sd/source/ui/inc/slideshow.hxx                          |    2 -
 sd/source/ui/slideshow/slideshow.cxx                    |    2 -
 sd/source/ui/unoidl/unomodel.cxx                        |    6 +--
 sfx2/source/appl/childwin.cxx                           |    2 -
 sfx2/source/appl/workwin.cxx                            |    2 -
 sfx2/source/dialog/templdlg.cxx                         |    8 ++--
 sfx2/source/inc/templdgi.hxx                            |    8 ++--
 sfx2/source/inc/workwin.hxx                             |    2 -
 sfx2/source/view/frame2.cxx                             |    2 -
 sfx2/source/view/viewsh.cxx                             |    2 -
 svl/source/crypto/cryptosign.cxx                        |    2 -
 svx/source/svdraw/svdedtv1.cxx                          |    2 -
 svx/source/svdraw/svdpagv.cxx                           |    2 -
 svx/source/svdraw/svdpntv.cxx                           |    2 -
 svx/source/svdraw/svdtext.cxx                           |    2 -
 sw/inc/PostItMgr.hxx                                    |    4 +-
 sw/inc/textboxhelper.hxx                                |   14 ++++----
 sw/inc/view.hxx                                         |    2 -
 sw/inc/viewsh.hxx                                       |    2 -
 sw/source/core/doc/DocumentContentOperationsManager.cxx |    2 -
 sw/source/core/doc/textboxhelper.cxx                    |   15 ++++----
 sw/source/core/docnode/section.cxx                      |    2 -
 sw/source/core/draw/dflyobj.cxx                         |    2 -
 sw/source/core/edit/edfld.cxx                           |    6 +--
 sw/source/core/inc/DocumentContentOperationsManager.hxx |    2 -
 sw/source/core/inc/unoidx.hxx                           |    2 -
 sw/source/core/layout/paintfrm.cxx                      |    2 -
 sw/source/core/layout/wsfrm.cxx                         |    4 +-
 sw/source/core/txtnode/txtedt.cxx                       |    2 -
 sw/source/core/undo/undel.cxx                           |    2 -
 sw/source/core/unocore/unochart.cxx                     |    2 -
 sw/source/core/unocore/unoidx.cxx                       |    8 ++--
 sw/source/core/view/viewsh.cxx                          |    2 -
 sw/source/ui/chrdlg/drpcps.cxx                          |    2 -
 sw/source/ui/config/mailconfigpage.cxx                  |    2 -
 sw/source/ui/frmdlg/uiborder.cxx                        |    2 -
 sw/source/ui/frmdlg/wrap.cxx                            |    2 -
 sw/source/uibase/dochdl/swdtflvr.cxx                    |    2 -
 sw/source/uibase/docvw/PostItMgr.cxx                    |    2 -
 sw/source/uibase/inc/drpcps.hxx                         |    2 -
 sw/source/uibase/inc/mailconfigpage.hxx                 |    2 -
 sw/source/uibase/inc/swdtflvr.hxx                       |    2 -
 sw/source/uibase/inc/uiborder.hxx                       |    2 -
 sw/source/uibase/inc/wrap.hxx                           |    2 -
 sw/source/uibase/shells/olesh.cxx                       |    2 -
 sw/source/uibase/uiview/viewdraw.cxx                    |    2 -
 toolkit/source/awt/stylesettings.cxx                    |    2 -
 vcl/source/app/weldutils.cxx                            |    2 -
 vcl/source/window/paint.cxx                             |    2 -
 107 files changed, 207 insertions(+), 160 deletions(-)

New commits:
commit 3b8e53f66ffd4d631a850fe76250124dc4a195c3
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Sep 30 09:40:29 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Sep 30 11:24:33 2021 +0200

    loplugin:constparams improve handling of pointer params
    
    Change-Id: I4c0002e72703eded435bfe4985f5b0121bf8524b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122843
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 52befe373a4f..5457ebcce376 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -2283,7 +2283,7 @@ IMPL_LINK(WatchWindow, EditedEntryHdl, const IterString&, rIterString, bool)
 namespace
 {
 
-void implCollapseModifiedObjectEntry(weld::TreeIter& rParent, weld::TreeView& rTree)
+void implCollapseModifiedObjectEntry(const weld::TreeIter& rParent, weld::TreeView& rTree)
 {
     rTree.collapse_row(rParent);
 
diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx
index 5e409a267423..c85fcb734878 100644
--- a/basctl/source/basicide/bastype3.cxx
+++ b/basctl/source/basicide/bastype3.cxx
@@ -355,7 +355,7 @@ ItemType SbTreeListBox::ConvertType (EntryType eType)
     }
 }
 
-bool SbTreeListBox::IsValidEntry(weld::TreeIter& rEntry)
+bool SbTreeListBox::IsValidEntry(const weld::TreeIter& rEntry)
 {
     bool bIsValid = false;
 
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index 9f5daa34d644..2e3c8c2530d1 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -369,7 +369,7 @@ private:
         return DND_ACTION_NONE;
     }
 
-    void NotifyCopyingMoving(weld::TreeIter& rTarget, bool bMove)
+    void NotifyCopyingMoving(const weld::TreeIter& rTarget, bool bMove)
     {
         sal_uInt16 nDepth = m_rTreeView.get_iter_depth(rTarget);
         std::unique_ptr<weld::TreeIter> xNewParent(m_rTreeView.make_iterator(&rTarget));
diff --git a/basctl/source/inc/bastype2.hxx b/basctl/source/inc/bastype2.hxx
index 3eb4de6beec9..e2e81a26916c 100644
--- a/basctl/source/inc/bastype2.hxx
+++ b/basctl/source/inc/bastype2.hxx
@@ -222,7 +222,7 @@ public:
     EntryDescriptor GetEntryDescriptor(const weld::TreeIter* pEntry);
 
     static ItemType ConvertType (EntryType eType);
-    bool            IsValidEntry(weld::TreeIter& rEntry);
+    bool            IsValidEntry(const weld::TreeIter& rEntry);
     void AddEntry(const OUString& rText, const OUString& rImage,
                   const weld::TreeIter* pParent, bool bChildrenOnDemand,
                   std::unique_ptr<Entry>&& rUserData,
diff --git a/basegfx/source/range/b2drangeclipper.cxx b/basegfx/source/range/b2drangeclipper.cxx
index 2920cda5ebd0..d371011f0361 100644
--- a/basegfx/source/range/b2drangeclipper.cxx
+++ b/basegfx/source/range/b2drangeclipper.cxx
@@ -333,7 +333,7 @@ namespace basegfx
 
         private:
             void handleInitialOwnEdge(SweepLineEvent const & rEvent,
-                                      ActiveEdge&            rActiveEdge) const
+                                      ActiveEdge const & rActiveEdge) const
             {
                 const bool isActiveEdgeProceedLeft(
                     rActiveEdge.getEdgeDirection() == ActiveEdge::PROCEED_LEFT);
diff --git a/chart2/source/controller/dialogs/dlg_NumberFormat.cxx b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
index bba04b70ad2b..7750588ccaa7 100644
--- a/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
+++ b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx
@@ -29,7 +29,7 @@ namespace chart
 {
 using namespace ::com::sun::star;
 
-NumberFormatDialog::NumberFormatDialog(weld::Window* pParent, SfxItemSet& rSet)
+NumberFormatDialog::NumberFormatDialog(weld::Window* pParent, const SfxItemSet& rSet)
     : SfxSingleTabDialogController(pParent, &rSet, "cui/ui/formatnumberdialog.ui", "FormatNumberDialog")
 {
     SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
diff --git a/chart2/source/controller/dialogs/dlg_NumberFormat.hxx b/chart2/source/controller/dialogs/dlg_NumberFormat.hxx
index 3cb5107158b8..56d5acd20867 100644
--- a/chart2/source/controller/dialogs/dlg_NumberFormat.hxx
+++ b/chart2/source/controller/dialogs/dlg_NumberFormat.hxx
@@ -32,7 +32,7 @@ namespace chart
 class NumberFormatDialog : public SfxSingleTabDialogController
 {
 public:
-    NumberFormatDialog(weld::Window* pParent, SfxItemSet& rSet);
+    NumberFormatDialog(weld::Window* pParent, const SfxItemSet& rSet);
 
     static SfxItemSet CreateEmptyItemSetForNumberFormatDialog(SfxItemPool& rItemPool);
 };
diff --git a/comphelper/source/misc/anytostring.cxx b/comphelper/source/misc/anytostring.cxx
index 37242356e12b..4e068cec9acd 100644
--- a/comphelper/source/misc/anytostring.cxx
+++ b/comphelper/source/misc/anytostring.cxx
@@ -29,7 +29,7 @@ namespace comphelper {
 namespace {
 
 void appendTypeError(
-    OUStringBuffer & buf, typelib_TypeDescriptionReference * typeRef )
+    OUStringBuffer & buf, const typelib_TypeDescriptionReference * typeRef )
 {
     buf.append( "<cannot get type description of type " );
     buf.append( OUString::unacquired( &typeRef->pTypeName ) );
diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx
index c72ccc9dd488..17cd941f8f22 100644
--- a/compilerplugins/clang/constparams.cxx
+++ b/compilerplugins/clang/constparams.cxx
@@ -60,6 +60,8 @@ public:
             || loplugin::hasPathnamePrefix(fn, SRCDIR "/pyuno/source/module/pyuno_struct.cxx")
             || loplugin::hasPathnamePrefix(fn, SRCDIR "/pyuno/source/module/pyuno.cxx")
             || loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/filter/ascii/ascatr.cxx")
+            // TODO this plugin doesn't handle it well when we take the address of a poiner
+            || loplugin::hasPathnamePrefix(fn, SRCDIR "/svl/source/misc/sharedstringpool.cxx")
             )
             return;
 
@@ -96,6 +98,7 @@ public:
     bool TraverseCXXMethodDecl(CXXMethodDecl * f);
     bool TraverseCXXConstructorDecl(CXXConstructorDecl * f);
     bool VisitDeclRefExpr(const DeclRefExpr *);
+    bool VisitLambdaExpr(const LambdaExpr*);
 
 private:
     bool CheckTraverseFunctionDecl(FunctionDecl *);
@@ -159,6 +162,8 @@ bool ConstParams::CheckTraverseFunctionDecl(FunctionDecl * functionDecl)
     if (functionDecl->isMain()) {
         return false;
     }
+    if (functionDecl->getTemplatedKind() != FunctionDecl::TK_NonTemplate)
+        return false;
 
     // ignore the macros from include/tools/link.hxx
     auto canonicalDecl = functionDecl->getCanonicalDecl();
@@ -189,6 +194,7 @@ bool ConstParams::CheckTraverseFunctionDecl(FunctionDecl * functionDecl)
             || name.startswith("Read_F_")
                 // UNO component entry points
             || name.endswith("component_getFactory")
+            || name.endswith("_get_implementation")
             // callback for some external code?
             || name == "ScAddInAsyncCallBack"
             // used as function pointers
@@ -256,6 +262,23 @@ bool ConstParams::VisitDeclRefExpr( const DeclRefExpr* declRefExpr )
     return true;
 }
 
+bool ConstParams::VisitLambdaExpr(const LambdaExpr* lambdaExpr)
+{
+    if (ignoreLocation(lambdaExpr))
+        return true;
+    for (auto captureIt = lambdaExpr->capture_begin(); captureIt != lambdaExpr->capture_end();
+         ++captureIt)
+    {
+        const LambdaCapture& capture = *captureIt;
+        if (capture.capturesVariable())
+        {
+            if (auto varDecl = dyn_cast<ParmVarDecl>(capture.getCapturedVar()))
+                interestingParamSet.erase(varDecl);
+        }
+    }
+    return true;
+}
+
 // Walk up from a statement that contains a DeclRefExpr, checking if the usage means that the
 // related ParamVarDecl can be const.
 bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVarDecl)
@@ -308,11 +331,11 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
 
     if (auto unaryOperator = dyn_cast<UnaryOperator>(parent)) {
         UnaryOperator::Opcode op = unaryOperator->getOpcode();
-        if (op == UO_AddrOf || op == UO_PreInc || op == UO_PostInc
+        if (op == UO_PreInc || op == UO_PostInc
             || op == UO_PreDec || op == UO_PostDec) {
             return false;
         }
-        if (op == UO_Deref) {
+        if (op == UO_Deref || op == UO_AddrOf) {
             return checkIfCanBeConst(parent, parmVarDecl);
         }
         return true;
diff --git a/compilerplugins/clang/test/constparams.cxx b/compilerplugins/clang/test/constparams.cxx
index 60d0148c1d69..e6b22ca91529 100644
--- a/compilerplugins/clang/test/constparams.cxx
+++ b/compilerplugins/clang/test/constparams.cxx
@@ -48,4 +48,26 @@ void f4(std::string * p) {
     *p = std::string("xxx");
 }
 
+
+namespace test5
+{
+struct Rectangle {};
+
+struct Foo
+{
+    void CallConst(const Rectangle*);
+    void CallNonConst(Rectangle*);
+    // expected-error at +1 {{this parameter can be const test5::Foo::ImplInvalidateParentFrameRegion [loplugin:constparams]}}
+    void ImplInvalidateParentFrameRegion( Rectangle& rRegion )
+    {
+        CallConst( &rRegion );
+    }
+    // no warning expected
+    void ImplInvalidateParentFrameRegion2( Rectangle& rRegion )
+    {
+        CallNonConst( &rRegion );
+    }
+};
+
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx
index 462756993cad..245c49b58e2f 100644
--- a/connectivity/source/drivers/dbase/DIndex.cxx
+++ b/connectivity/source/drivers/dbase/DIndex.cxx
@@ -354,7 +354,7 @@ SvStream& connectivity::dbase::operator >> (SvStream &rStream, ODbaseIndex& rInd
     return rStream;
 }
 
-SvStream& connectivity::dbase::WriteODbaseIndex(SvStream &rStream, ODbaseIndex& rIndex)
+SvStream& connectivity::dbase::WriteODbaseIndex(SvStream &rStream, const ODbaseIndex& rIndex)
 {
     rStream.Seek(0);
     rStream.WriteUInt32(rIndex.m_aHeader.db_rootpage);
diff --git a/connectivity/source/inc/dbase/DIndex.hxx b/connectivity/source/inc/dbase/DIndex.hxx
index 12d7574e4b28..e936a7e37c65 100644
--- a/connectivity/source/inc/dbase/DIndex.hxx
+++ b/connectivity/source/inc/dbase/DIndex.hxx
@@ -34,7 +34,7 @@ namespace connectivity::dbase
 
         class ODbaseIndex : public ODbaseIndex_BASE
         {
-            friend SvStream& WriteODbaseIndex(SvStream &rStream, ODbaseIndex&);
+            friend SvStream& WriteODbaseIndex(SvStream &rStream, const ODbaseIndex&);
             friend SvStream& operator >> (SvStream &rStream, ODbaseIndex&);
 
             friend class ONDXNode;
@@ -129,7 +129,7 @@ namespace connectivity::dbase
             bool ConvertToKey(ONDXKey* rKey, sal_uInt32 nRec, const ORowSetValue& rValue);
         };
 
-        SvStream& WriteODbaseIndex(SvStream &rStream, ODbaseIndex&);
+        SvStream& WriteODbaseIndex(SvStream &rStream, const ODbaseIndex&);
         SvStream& operator >> (SvStream &rStream, ODbaseIndex&);
 
         void ReadHeader(SvStream & rStream, ODbaseIndex::NDXHeader & rHeader);
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 1258ee54d432..f4d347b0ef84 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -75,7 +75,7 @@ void SvxScriptOrgDialog::delUserData(const weld::TreeIter& rIter)
     }
 }
 
-void SvxScriptOrgDialog::deleteTree(weld::TreeIter& rIter)
+void SvxScriptOrgDialog::deleteTree(const weld::TreeIter& rIter)
 {
     delUserData(rIter);
     std::unique_ptr<weld::TreeIter> xIter = m_xScriptsBox->make_iterator(&rIter);
@@ -697,7 +697,7 @@ Reference< XModel > SvxScriptOrgDialog::getModel(const weld::TreeIter& rEntry)
     return model;
 }
 
-void SvxScriptOrgDialog::createEntry(weld::TreeIter& rEntry)
+void SvxScriptOrgDialog::createEntry(const weld::TreeIter& rEntry)
 {
 
     Reference< browse::XBrowseNode >  aChildNode;
@@ -927,7 +927,7 @@ void SvxScriptOrgDialog::renameEntry(const weld::TreeIter& rEntry)
     }
 }
 
-void SvxScriptOrgDialog::deleteEntry(weld::TreeIter& rEntry)
+void SvxScriptOrgDialog::deleteEntry(const weld::TreeIter& rEntry)
 {
     bool result = false;
     Reference< browse::XBrowseNode > node = getBrowseNode(rEntry);
diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx
index b4bddde39aaa..13f1a88e9eab 100644
--- a/cui/source/inc/numfmt.hxx
+++ b/cui/source/inc/numfmt.hxx
@@ -129,7 +129,7 @@ private:
     void    MakePreviewText( const OUString& rFormat );
     void    ChangePreviewText( sal_uInt16 nPos );
     void    AddAutomaticLanguage_Impl(LanguageType eAutoLang, bool bSelect);
-    bool    Click_Impl(weld::Button& rIB);
+    bool    Click_Impl(const weld::Button& rIB);
     // Handler
     DECL_LINK(LostFocusHdl_Impl, weld::Widget&, void);
     DECL_LINK(DoubleClickHdl_Impl, weld::TreeView&, bool);
diff --git a/cui/source/inc/scriptdlg.hxx b/cui/source/inc/scriptdlg.hxx
index 6a1cbd15ae5c..3f16d8a66bab 100644
--- a/cui/source/inc/scriptdlg.hxx
+++ b/cui/source/inc/scriptdlg.hxx
@@ -106,9 +106,9 @@ protected:
     static bool         getBoolProperty( css::uno::Reference< css::beans::XPropertySet > const & xProps, OUString const & propName );
     void                CheckButtons(  css::uno::Reference< css::script::browse::XBrowseNode > const & node );
 
-    void        createEntry(weld::TreeIter& rEntry);
+    void        createEntry(const weld::TreeIter& rEntry);
     void        renameEntry(const weld::TreeIter& rEntry);
-    void        deleteEntry(weld::TreeIter& rEntry);
+    void        deleteEntry(const weld::TreeIter& rEntry);
     css::uno::Reference<css::script::browse::XBrowseNode> getBrowseNode(const weld::TreeIter& rEntry);
     css::uno::Reference<css::frame::XModel> getModel(const weld::TreeIter& rEntry);
     OUString    getListOfChildren( const css::uno::Reference< css::script::browse::XBrowseNode >& node, int depth );
@@ -117,7 +117,7 @@ protected:
 
     void        Init(std::u16string_view language);
     void        delUserData(const weld::TreeIter& rIter);
-    void        deleteTree(weld::TreeIter& rIter);
+    void        deleteTree(const weld::TreeIter& rIter);
     void        deleteAllTree();
     void        insertEntry(OUString const & rText, OUString const & rBitmap,
                               const weld::TreeIter* pParent,
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index 9ab34dd61434..ebe066b1073e 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -170,7 +170,7 @@ public:
                   Link<weld::Widget&,void> const&,
                   weld::ScrolledWindow& rScroll);
     void Update(EditableColorConfig const*, EditableExtendedColorConfig const*);
-    void ClickHdl(EditableColorConfig*, weld::Toggleable&);
+    void ClickHdl(EditableColorConfig*, const weld::Toggleable&);
     void ColorHdl(EditableColorConfig*, EditableExtendedColorConfig*, const ColorListBox*);
 
     weld::Widget& GetWidget1()
@@ -496,7 +496,7 @@ void ColorConfigWindow_Impl::Update (
 }
 
 // ClickHdl()
-void ColorConfigWindow_Impl::ClickHdl(EditableColorConfig* pConfig, weld::Toggleable& rBox)
+void ColorConfigWindow_Impl::ClickHdl(EditableColorConfig* pConfig, const weld::Toggleable& rBox)
 {
     for (unsigned i = 0; i != ColorConfigEntryCount; ++i)
     {
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index a04aaf767afd..21f60f29e598 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -1288,7 +1288,7 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, weld::Button&, rIB, void)
     Click_Impl(rIB);
 }
 
-bool SvxNumberFormatTabPage::Click_Impl(weld::Button& rIB)
+bool SvxNumberFormatTabPage::Click_Impl(const weld::Button& rIB)
 {
     sal_uLong       nReturn = 0;
     constexpr sal_uLong nReturnChanged  = 0x1;  // THE boolean return value
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 3d0fd95acc43..d4e7ed28acdb 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -2477,7 +2477,7 @@ IMPL_LINK_NOARG(SbaTableQueryBrowser, OnSelectionChange, LinkParamNone*, void)
     implSelect(xSelection.get());
 }
 
-std::unique_ptr<weld::TreeIter> SbaTableQueryBrowser::implGetConnectionEntry(weld::TreeIter& rEntry) const
+std::unique_ptr<weld::TreeIter> SbaTableQueryBrowser::implGetConnectionEntry(const weld::TreeIter& rEntry) const
 {
     weld::TreeView& rTreeView = m_pTreeView->GetWidget();
     std::unique_ptr<weld::TreeIter> xCurrentEntry(rTreeView.make_iterator(&rEntry));
@@ -2973,7 +2973,7 @@ void SbaTableQueryBrowser::disposeConnection(const weld::TreeIter* pDSEntry)
     }
 }
 
-void SbaTableQueryBrowser::closeConnection(weld::TreeIter& rDSEntry, bool _bDisposeConnection)
+void SbaTableQueryBrowser::closeConnection(const weld::TreeIter& rDSEntry, bool _bDisposeConnection)
 {
     OSL_ENSURE(impl_isDataSourceEntry(&rDSEntry), "SbaTableQueryBrowser::closeConnection: invalid entry (not top-level)!");
 
@@ -3435,7 +3435,7 @@ int SbaTableQueryBrowser::OnTreeEntryCompare(const weld::TreeIter& rLHS, const w
     return nCompareResult;
 }
 
-void SbaTableQueryBrowser::implAdministrate(weld::TreeIter& rApplyTo)
+void SbaTableQueryBrowser::implAdministrate(const weld::TreeIter& rApplyTo)
 {
     try
     {
diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx
index 32a62da248e7..2c3f0976fe60 100644
--- a/dbaccess/source/ui/control/tabletree.cxx
+++ b/dbaccess/source/ui/control/tabletree.cxx
@@ -463,7 +463,7 @@ std::unique_ptr<weld::TreeIter> OTableTreeListBox::implAddEntry(
     return nullptr;
 }
 
-NamedDatabaseObject OTableTreeListBox::describeObject(weld::TreeIter& rEntry)
+NamedDatabaseObject OTableTreeListBox::describeObject(const weld::TreeIter& rEntry)
 {
     NamedDatabaseObject aObject;
 
@@ -511,7 +511,7 @@ bool OTableTreeListBox::impl_getAndAssertMetaData( Reference< XDatabaseMetaData
     return _out_rMetaData.is();
 }
 
-OUString OTableTreeListBox::getQualifiedTableName(weld::TreeIter& rEntry) const
+OUString OTableTreeListBox::getQualifiedTableName(const weld::TreeIter& rEntry) const
 {
     OSL_PRECOND( !isFolderEntry(rEntry), "OTableTreeListBox::getQualifiedTableName: folder entries not allowed here!" );
 
@@ -625,7 +625,7 @@ void OTableTreeListBox::CheckButtons()
     } while (m_xTreeView->iter_next_sibling(*xEntry));
 }
 
-TriState OTableTreeListBox::implDetermineState(weld::TreeIter& rEntry)
+TriState OTableTreeListBox::implDetermineState(const weld::TreeIter& rEntry)
 {
     if (!m_bShowToggles)
         return TRISTATE_FALSE;
diff --git a/dbaccess/source/ui/inc/tabletree.hxx b/dbaccess/source/ui/inc/tabletree.hxx
index 941ba2a1a80c..ebfbf7d29c4a 100644
--- a/dbaccess/source/ui/inc/tabletree.hxx
+++ b/dbaccess/source/ui/inc/tabletree.hxx
@@ -104,7 +104,7 @@ public:
 
     void            checkedButton_noBroadcast(const weld::TreeIter& rEntry);
 private:
-    TriState implDetermineState(weld::TreeIter& rEntry);
+    TriState implDetermineState(const weld::TreeIter& rEntry);
 
     void implEmphasize(const weld::TreeIter& rEntry, bool _bChecked, bool _bUpdateDescendants = true, bool _bUpdateAncestors = true);
 
@@ -139,13 +139,13 @@ public:
     /** returns a NamedDatabaseObject record which describes the given entry
     */
     css::sdb::application::NamedDatabaseObject
-            describeObject(weld::TreeIter& rEntry);
+            describeObject(const weld::TreeIter& rEntry);
 
     /** returns the fully qualified name of a table entry
         @param _pEntry
             the entry whose name is to be obtained. Must not denote a folder entry.
     */
-    OUString getQualifiedTableName(weld::TreeIter& rEntry) const;
+    OUString getQualifiedTableName(const weld::TreeIter& rEntry) const;
 
     std::unique_ptr<weld::TreeIter> getEntryByQualifiedName(const OUString& rName);
 };
diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx
index 7899fed5fec6..07240e843378 100644
--- a/dbaccess/source/ui/inc/unodatbr.hxx
+++ b/dbaccess/source/ui/inc/unodatbr.hxx
@@ -290,7 +290,7 @@ namespace dbaui
 
         /** close the connection (and collapse the list entries) of the given list entries
         */
-        void        closeConnection(weld::TreeIter& rEntry, bool bDisposeConnection = true);
+        void        closeConnection(const weld::TreeIter& rEntry, bool bDisposeConnection = true);
 
         void        populateTree(const css::uno::Reference< css::container::XNameAccess>& xNameAccess, const weld::TreeIter& rParent, EntryType eEntryType);
         void        initializeTreeModel();
@@ -309,7 +309,7 @@ namespace dbaui
         */
         std::unique_ptr<ImageProvider> getImageProviderFor(const weld::TreeIter* pAnyEntry);
 
-        void    implAdministrate(weld::TreeIter& rApplyTo);
+        void    implAdministrate(const weld::TreeIter& rApplyTo);
 
         bool implCopyObject(ODataClipboard& rExchange, const weld::TreeIter& rApplyTo, sal_Int32 nCommandType);
 
@@ -350,7 +350,7 @@ namespace dbaui
             bool _bSelectDirect
         );
 
-        std::unique_ptr<weld::TreeIter> implGetConnectionEntry(weld::TreeIter& rEntry) const;
+        std::unique_ptr<weld::TreeIter> implGetConnectionEntry(const weld::TreeIter& rEntry) const;
         /// inserts an entry into the tree
         std::unique_ptr<weld::TreeIter> implAppendEntry(
             const weld::TreeIter* pParent,
diff --git a/extensions/source/propctrlr/selectlabeldialog.cxx b/extensions/source/propctrlr/selectlabeldialog.cxx
index 7cf09af05dd2..216ff4967e13 100644
--- a/extensions/source/propctrlr/selectlabeldialog.cxx
+++ b/extensions/source/propctrlr/selectlabeldialog.cxx
@@ -149,7 +149,7 @@ namespace pcr
     {
     }
 
-    sal_Int32 OSelectLabelDialog::InsertEntries(const Reference< XInterface > & _xContainer, weld::TreeIter& rContainerEntry)
+    sal_Int32 OSelectLabelDialog::InsertEntries(const Reference< XInterface > & _xContainer, const weld::TreeIter& rContainerEntry)
     {
         Reference< XIndexAccess >  xContainer(_xContainer, UNO_QUERY);
         if (!xContainer.is())
diff --git a/extensions/source/propctrlr/selectlabeldialog.hxx b/extensions/source/propctrlr/selectlabeldialog.hxx
index bf55725382f6..9affa3512aa1 100644
--- a/extensions/source/propctrlr/selectlabeldialog.hxx
+++ b/extensions/source/propctrlr/selectlabeldialog.hxx
@@ -52,7 +52,7 @@ namespace pcr
         css::uno::Reference< css::beans::XPropertySet >  GetSelected() const { return m_xNoAssignment->get_active() ? css::uno::Reference< css::beans::XPropertySet > () : m_xSelectedControl; }
 
     private:
-        sal_Int32 InsertEntries(const css::uno::Reference< css::uno::XInterface >& _xContainer, weld::TreeIter& rContainerEntry);
+        sal_Int32 InsertEntries(const css::uno::Reference< css::uno::XInterface >& _xContainer, const weld::TreeIter& rContainerEntry);
 
         DECL_LINK(OnEntrySelected, weld::TreeView&, void);
         DECL_LINK(OnNoAssignmentClicked, weld::Toggleable&, void);
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 3762f78ff80a..e0682f04e453 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -4683,7 +4683,7 @@ bool PPTTextRulerInterpreter::GetBulletOfs( sal_uInt32 nLevel, sal_uInt16& nValu
     return true;
 }
 
-PPTTextRulerInterpreter& PPTTextRulerInterpreter::operator=( PPTTextRulerInterpreter& rRuler )
+PPTTextRulerInterpreter& PPTTextRulerInterpreter::operator=( const PPTTextRulerInterpreter& rRuler )
 {
     if ( this != &rRuler )
     {
@@ -7137,7 +7137,7 @@ const SfxItemSet* PPTTextObj::GetBackground() const
         return nullptr;
 }
 
-PPTTextObj& PPTTextObj::operator=( PPTTextObj& rTextObj )
+PPTTextObj& PPTTextObj::operator=( const PPTTextObj& rTextObj )
 {
     if ( this != &rTextObj )
     {
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index ca46732cc174..e15d8a4c9bdd 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -54,7 +54,7 @@ using namespace ::com::sun::star::uno;
     Please note: the default used here are the same as per specification,
     They should be the same in  PDFFilter::implExport and  in PDFExport::PDFExport
  */
-ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, Sequence< PropertyValue >& rFilterData,
+ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, const Sequence< PropertyValue >& rFilterData,
     const Reference< XComponent >& rxDoc)
     : SfxTabDialogController(pParent, "filter/ui/pdfoptionsdialog.ui", "PdfOptionsDialog"),
     mrDoc(rxDoc),
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index d527c3797edb..9682adbc111d 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -151,7 +151,7 @@ public:
     friend class                ImpPDFTabLinksPage;
     friend class                ImpPDFTabSigningPage;
 
-    ImpPDFTabDialog(weld::Window* pParent, Sequence< PropertyValue >& rFilterData,
+    ImpPDFTabDialog(weld::Window* pParent, const Sequence< PropertyValue >& rFilterData,
                     const css::uno::Reference< XComponent >& rDoc);
     virtual                     ~ImpPDFTabDialog() override;
 
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index fbb0896d71d1..e8bce27fffae 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -1022,7 +1022,7 @@ struct PPTTextRulerInterpreter
         bool        GetTextOfs( sal_uInt32 nLevel, sal_uInt16& nValue ) const;
         bool        GetBulletOfs( sal_uInt32 nLevel, sal_uInt16& nValue ) const;
 
-        PPTTextRulerInterpreter& operator=( PPTTextRulerInterpreter& rRuler );
+        PPTTextRulerInterpreter& operator=( const PPTTextRulerInterpreter& rRuler );
 };
 
 #define PPT_SPEC_NEWLINE            0x10000
@@ -1269,7 +1269,7 @@ public:
 
     const SfxItemSet*       GetBackground() const;
 
-    PPTTextObj&             operator=( PPTTextObj& rTextObj );
+    PPTTextObj&             operator=( const PPTTextObj& rTextObj );
 };
 
 class PPTConvertOCXControls final : public SvxMSConvertOCXControls
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 1abc9c0a211a..96686f26f03c 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -187,7 +187,7 @@ public:
                             const Theme* pTheme,
                             const css::uno::Reference< css::drawing::XShapes >& rxShapes,
                             const basegfx::B2DHomMatrix& aTransformation,
-                            FillProperties& rShapeOrParentShapeFillProps,
+                            const FillProperties& rShapeOrParentShapeFillProps,
                             ShapeIdMap* pShapeMap = nullptr,
                             oox::drawingml::ShapePtr pParentGroupShape = nullptr);
 
@@ -265,7 +265,7 @@ protected:
                             bool bClearText,
                             bool bDoNotInsertEmptyTextBody,
                             basegfx::B2DHomMatrix& aTransformation,
-                            FillProperties& rShapeOrParentShapeFillProps,
+                            const FillProperties& rShapeOrParentShapeFillProps,
                             oox::drawingml::ShapePtr pParentGroupShape = nullptr
                              );
 
diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx
index cccfa4d87a0b..66d125accaf5 100644
--- a/include/sfx2/childwin.hxx
+++ b/include/sfx2/childwin.hxx
@@ -152,7 +152,7 @@ public:
     SAL_DLLPRIVATE void SetWorkWindow_Impl( SfxWorkWindow* );
     SAL_DLLPRIVATE void Activate_Impl();
 
-    SAL_DLLPRIVATE void SetFactory_Impl( SfxChildWinFactory* );
+    SAL_DLLPRIVATE void SetFactory_Impl( const SfxChildWinFactory* );
 };
 
 
diff --git a/include/sfx2/frame.hxx b/include/sfx2/frame.hxx
index 26af0c08f957..26560b3db1f6 100644
--- a/include/sfx2/frame.hxx
+++ b/include/sfx2/frame.hxx
@@ -134,7 +134,7 @@ public:
     SAL_DLLPRIVATE void CreateWorkWindow_Impl();
     SAL_DLLPRIVATE void GrabFocusOnComponent_Impl();
 
-    SAL_DLLPRIVATE void PrepareForDoc_Impl( SfxObjectShell& i_rDoc );
+    SAL_DLLPRIVATE void PrepareForDoc_Impl( const SfxObjectShell& i_rDoc );
     SAL_DLLPRIVATE void LockResize_Impl( bool bLock );
     SAL_DLLPRIVATE void SetMenuBarOn_Impl( bool bOn );
     SAL_DLLPRIVATE bool IsMenuBarOn_Impl() const;
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index f0d3938fe677..64b56e1c1293 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -296,7 +296,7 @@ public:
     void                        SetController( SfxBaseController* pController );
     css::uno::Reference<css::frame::XController> GetController() const;
 
-    bool                        TryContextMenuInterception( Menu& rIn, const OUString& rMenuIdentifier, VclPtr<Menu>& rpOut, css::ui::ContextMenuExecuteEvent aEvent );
+    bool                        TryContextMenuInterception( const Menu& rIn, const OUString& rMenuIdentifier, VclPtr<Menu>& rpOut, css::ui::ContextMenuExecuteEvent aEvent );
     bool                        TryContextMenuInterception( Menu& rMenu, const OUString& rMenuIdentifier, css::ui::ContextMenuExecuteEvent aEvent );
 
     void                        ExecPrint( const css::uno::Sequence < css::beans::PropertyValue >&, bool, bool );
diff --git a/include/svx/svdedtv.hxx b/include/svx/svdedtv.hxx
index 5d834d05bde7..a21eeb3e0a43 100644
--- a/include/svx/svdedtv.hxx
+++ b/include/svx/svdedtv.hxx
@@ -189,7 +189,7 @@ public:
      */
     void EndTextEditAllViews() const;
 
-    std::vector< std::unique_ptr<SdrUndoAction> > CreateConnectorUndo( SdrObject& rO );
+    std::vector< std::unique_ptr<SdrUndoAction> > CreateConnectorUndo( const SdrObject& rO );
     void AddUndoActions( std::vector< std::unique_ptr<SdrUndoAction> > );
 
     // Layermanagement with Undo.
diff --git a/include/svx/svdpagv.hxx b/include/svx/svdpagv.hxx
index 3aceb48d1d4b..2f77dfa6692a 100644
--- a/include/svx/svdpagv.hxx
+++ b/include/svx/svdpagv.hxx
@@ -87,7 +87,7 @@ private:
 
 public:
     sal_uInt32 PageWindowCount() const { return maPageWindows.size(); }
-    SdrPageWindow* FindPageWindow( SdrPaintWindow& rPaintWindow ) const;
+    SdrPageWindow* FindPageWindow( const SdrPaintWindow& rPaintWindow ) const;
     SdrPageWindow* FindPageWindow( const OutputDevice& rOutDev ) const;
     SdrPageWindow* GetPageWindow(sal_uInt32 nIndex) const;
 
diff --git a/include/svx/svdpntv.hxx b/include/svx/svdpntv.hxx
index 048c5f6b5cd8..66c1e33e378b 100644
--- a/include/svx/svdpntv.hxx
+++ b/include/svx/svdpntv.hxx
@@ -210,7 +210,7 @@ protected:
     Color                           maGridColor;
 
     // Interface to SdrPaintWindow
-    void DeletePaintWindow(SdrPaintWindow& rOld);
+    void DeletePaintWindow(const SdrPaintWindow& rOld);
     void ConfigurationChanged( ::utl::ConfigurationBroadcaster*, ConfigurationHints ) override;
     static void InitOverlayManager(rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager);
 
diff --git a/include/svx/svdtext.hxx b/include/svx/svdtext.hxx
index b3c5cbbf90ec..727273454905 100644
--- a/include/svx/svdtext.hxx
+++ b/include/svx/svdtext.hxx
@@ -54,7 +54,7 @@ public:
     OutlinerParaObject* GetOutlinerParaObject();
     const OutlinerParaObject* GetOutlinerParaObject() const;
 
-    void CheckPortionInfo(SdrOutliner& rOutliner);
+    void CheckPortionInfo(const SdrOutliner& rOutliner);
     void ReformatText();
 
     // default uses GetObjectItemSet, but may be overridden to
diff --git a/include/vcl/weldutils.hxx b/include/vcl/weldutils.hxx
index b75b94d99e52..8cb591ce8140 100644
--- a/include/vcl/weldutils.hxx
+++ b/include/vcl/weldutils.hxx
@@ -425,7 +425,8 @@ VCL_DLLPUBLIC size_t GetAbsPos(const weld::TreeView& rTreeView, const weld::Tree
 VCL_DLLPUBLIC bool IsEntryVisible(const weld::TreeView& rTreeView, const weld::TreeIter& rIter);
 
 // A Parent's Children are turned into Children of the Parent which comes next in hierarchy
-VCL_DLLPUBLIC void RemoveParentKeepChildren(weld::TreeView& rTreeView, weld::TreeIter& rParent);
+VCL_DLLPUBLIC void RemoveParentKeepChildren(weld::TreeView& rTreeView,
+                                            const weld::TreeIter& rParent);
 
 // return the min height of a weld::Entry
 VCL_DLLPUBLIC int GetMinimumEditHeight();
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 834f6a2d205c..ce2464a1e976 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -572,7 +572,7 @@ protected:
 
     SAL_DLLPRIVATE Point                ImplOutputToFrame( const Point& rPos );
 
-    SAL_DLLPRIVATE void                 ImplInvalidateParentFrameRegion( vcl::Region& rRegion );
+    SAL_DLLPRIVATE void                 ImplInvalidateParentFrameRegion( const vcl::Region& rRegion );
     SAL_DLLPRIVATE void                 ImplValidateFrameRegion( const vcl::Region* rRegion, ValidateFlags nFlags );
     SAL_DLLPRIVATE void                 ImplValidate();
     SAL_DLLPRIVATE void                 ImplMoveInvalidateRegion( const tools::Rectangle& rRect, tools::Long nHorzScroll, tools::Long nVertScroll, bool bChildren );
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index abb6115b08c0..50a3c6ae5528 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -266,7 +266,7 @@ void Shape::addShape(
         const Theme* pTheme,
         const Reference< XShapes >& rxShapes,
         const basegfx::B2DHomMatrix& aTransformation,
-        FillProperties& rShapeOrParentShapeFillProps,
+        const FillProperties& rShapeOrParentShapeFillProps,
         ShapeIdMap* pShapeMap,
         oox::drawingml::ShapePtr pParentGroupShape)
 {
@@ -679,7 +679,7 @@ Reference< XShape > const & Shape::createAndInsert(
         bool bClearText,
         bool bDoNotInsertEmptyTextBody,
         basegfx::B2DHomMatrix& aParentTransformation,
-        FillProperties& rShapeOrParentShapeFillProps,
+        const FillProperties& rShapeOrParentShapeFillProps,
         oox::drawingml::ShapePtr pParentGroupShape)
 {
     bool bIsEmbMedia = false;
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index e2052dc93909..452b5f5ef851 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2230,7 +2230,7 @@ void ChartExport::exportDoughnutChart( const Reference< chart2::XChartType >& xC
 
 namespace {
 
-void writeDataLabelsRange(FSHelperPtr& pFS, XmlFilterBase* pFB, DataLabelsRange& rDLblsRange)
+void writeDataLabelsRange(const FSHelperPtr& pFS, const XmlFilterBase* pFB, DataLabelsRange& rDLblsRange)
 {
     if (rDLblsRange.empty())
         return;
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index 27d84e97fa6f..ddadab15afce 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -376,7 +376,7 @@ void OStorage_Impl::SetReadOnlyWrap( OStorage& aStorage )
     m_aReadOnlyWrapVector.emplace_back( &aStorage );
 }
 
-void OStorage_Impl::RemoveReadOnlyWrap( OStorage& aStorage )
+void OStorage_Impl::RemoveReadOnlyWrap( const OStorage& aStorage )
 {
     for ( StorageHoldersType::iterator pStorageIter = m_aReadOnlyWrapVector.begin();
       pStorageIter != m_aReadOnlyWrapVector.end();)
diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx
index 1929cc9df305..92cfc62c14eb 100644
--- a/package/source/xstor/xstorage.hxx
+++ b/package/source/xstor/xstorage.hxx
@@ -190,7 +190,7 @@ struct OStorage_Impl
     ~OStorage_Impl();
 
     void SetReadOnlyWrap( OStorage& aStorage );
-    void RemoveReadOnlyWrap( OStorage& aStorage );
+    void RemoveReadOnlyWrap( const OStorage& aStorage );
 
     void OpenOwnPackage();
     void ReadContents();
diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx
index ed7b2b6f6669..e8f8a2b1f8dc 100644
--- a/reportdesign/source/ui/dlg/Navigator.cxx
+++ b/reportdesign/source/ui/dlg/Navigator.cxx
@@ -179,7 +179,7 @@ public:
     virtual void traverseDetail(const uno::Reference< report::XSection>& xSection) override;
 
     bool find(const uno::Reference<uno::XInterface>& xContent, weld::TreeIter& rIter);
-    void removeEntry(weld::TreeIter& rEntry, bool bRemove = true);
+    void removeEntry(const weld::TreeIter& rEntry, bool bRemove = true);
 
     void grab_focus() { m_xTreeView->grab_focus(); }
 
@@ -663,7 +663,7 @@ void NavigatorTree::_disposing(const lang::EventObject& _rSource)
         removeEntry(*xEntry);
 }
 
-void NavigatorTree::removeEntry(weld::TreeIter& rEntry, bool bRemove)
+void NavigatorTree::removeEntry(const weld::TreeIter& rEntry, bool bRemove)
 {
     std::unique_ptr<weld::TreeIter> xChild = m_xTreeView->make_iterator(&rEntry);
     bool bChild = m_xTreeView->iter_children(*xChild);
diff --git a/sc/source/filter/inc/lotattr.hxx b/sc/source/filter/inc/lotattr.hxx
index b58b8c31eee7..475d46547e4a 100644
--- a/sc/source/filter/inc/lotattr.hxx
+++ b/sc/source/filter/inc/lotattr.hxx
@@ -121,7 +121,7 @@ class LotAttrTable
 public:
     LotAttrTable(LotusContext& rContext);
 
-    void SetAttr(LotusContext& rContext, const SCCOL nColFirst, const SCCOL nColLast, const SCROW nRow, const LotAttrWK3& );
+    void SetAttr(const LotusContext& rContext, const SCCOL nColFirst, const SCCOL nColLast, const SCROW nRow, const LotAttrWK3& );
 
     void Apply(LotusContext& rContext, const SCTAB nTabNum);
 
diff --git a/sc/source/filter/lotus/lotattr.cxx b/sc/source/filter/lotus/lotattr.cxx
index 0fae3b719162..eaa6b4b61685 100644
--- a/sc/source/filter/lotus/lotattr.cxx
+++ b/sc/source/filter/lotus/lotattr.cxx
@@ -227,7 +227,7 @@ LotAttrTable::LotAttrTable(LotusContext& rContext):
 {
 }
 
-void LotAttrTable::SetAttr( LotusContext& rContext, const SCCOL nColFirst, const SCCOL nColLast, const SCROW nRow,
+void LotAttrTable::SetAttr( const LotusContext& rContext, const SCCOL nColFirst, const SCCOL nColLast, const SCROW nRow,
                             const LotAttrWK3& rAttr )
 {
     // With the current implementation of MAXCOLCOUNT>=1024 and nColFirst and
diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
index e8090e02366e..90941e66a0f5 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
@@ -569,7 +569,7 @@ void ScXMLChangeTrackingImportHelper::SetMovementDependencies(ScMyMoveAction* pA
     }
 }
 
-void ScXMLChangeTrackingImportHelper::SetContentDependencies(const ScMyContentAction* pAction, ScChangeActionContent* pActContent, ScDocument& rDoc)
+void ScXMLChangeTrackingImportHelper::SetContentDependencies(const ScMyContentAction* pAction, ScChangeActionContent* pActContent, const ScDocument& rDoc)
 {
     if (!pActContent || !pAction->nPreviousAction)
         return;
diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx
index 182f36cf494a..d7c9f3664586 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.hxx
@@ -209,7 +209,7 @@ public:
 
     void SetDeletionDependencies(ScMyDelAction* pAction, ScChangeActionDel* pDelAct);
     void SetMovementDependencies(ScMyMoveAction* pAction, ScChangeActionMove* pMoveAct);
-    void SetContentDependencies(const ScMyContentAction* pAction, ScChangeActionContent* pActContent, ScDocument& rDoc);
+    void SetContentDependencies(const ScMyContentAction* pAction, ScChangeActionContent* pActContent, const ScDocument& rDoc);
     void SetDependencies(ScMyBaseAction* pAction, ScDocument& rDoc);
 
     void SetNewCell(const ScMyContentAction* pAction, ScDocument& rDoc);
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 79ea4631d5ac..1cf9ec4fdc37 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3711,7 +3711,7 @@ void ScXMLExport::exportAnnotationMeta( const uno::Reference < drawing::XShape >
     }
 }
 
-void ScXMLExport::WriteAnnotation(ScMyCell& rMyCell)
+void ScXMLExport::WriteAnnotation(const ScMyCell& rMyCell)
 {
     ScPostIt* pNote = pDoc->GetNote(rMyCell.maCellAddress);
     if (!pNote)
diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx
index 88685b27f6a4..e4a165ab0511 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -178,7 +178,7 @@ class ScXMLExport : public SvXMLExport
     void WriteEditCell(const EditTextObject* pText);
     void WriteMultiLineFormulaResult(const ScFormulaCell* pCell);
     void WriteAreaLink(const ScMyCell& rMyCell);
-    void WriteAnnotation(ScMyCell& rMyCell);
+    void WriteAnnotation(const ScMyCell& rMyCell);
     void WriteDetective(const ScMyCell& rMyCell);
     void ExportShape(const css::uno::Reference < css::drawing::XShape >& xShape, css::awt::Point* pPoint);
     void WriteShapes(const ScMyCell& rMyCell);
diff --git a/sc/source/ui/attrdlg/tabpages.cxx b/sc/source/ui/attrdlg/tabpages.cxx
index 899a56b011d9..af0ed1d6ab9c 100644
--- a/sc/source/ui/attrdlg/tabpages.cxx
+++ b/sc/source/ui/attrdlg/tabpages.cxx
@@ -161,7 +161,7 @@ IMPL_LINK(ScTabPageProtection, HidePrintClickHdl, weld::Toggleable&, rBox, void)
     ButtonClick(rBox);
 }
 
-void ScTabPageProtection::ButtonClick(weld::Toggleable& rBox)
+void ScTabPageProtection::ButtonClick(const weld::Toggleable& rBox)
 {
     TriState eState = rBox.get_state();
     if (eState == TRISTATE_INDET)
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index db9337c7d86b..097432b414e0 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -1396,7 +1396,7 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
     return true;
 }
 
-bool ScDBDocFunc::RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
+bool ScDBDocFunc::RemovePivotTable(const ScDPObject& rDPObj, bool bRecord, bool bApi)
 {
     ScDocShellModificator aModificator(rDocShell);
     weld::WaitObject aWait(ScDocShell::GetActiveDialogParent());
diff --git a/sc/source/ui/inc/dbdocfun.hxx b/sc/source/ui/inc/dbdocfun.hxx
index a3ef18cd0cf0..780e523b5193 100644
--- a/sc/source/ui/inc/dbdocfun.hxx
+++ b/sc/source/ui/inc/dbdocfun.hxx
@@ -81,7 +81,7 @@ public:
     bool DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewObj,
                           bool bRecord, bool bApi, bool bAllowMove = false );
 
-    bool RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi);
+    bool RemovePivotTable(const ScDPObject& rDPObj, bool bRecord, bool bApi);
     bool CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool bApi);
     bool UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi);
 
diff --git a/sc/source/ui/inc/tabpages.hxx b/sc/source/ui/inc/tabpages.hxx
index 8880f738f3f2..37d751523469 100644
--- a/sc/source/ui/inc/tabpages.hxx
+++ b/sc/source/ui/inc/tabpages.hxx
@@ -61,7 +61,7 @@ private:
     DECL_LINK(HideCellClickHdl, weld::Toggleable&, void);
     DECL_LINK(HideFormulaClickHdl, weld::Toggleable&, void);
     DECL_LINK(HidePrintClickHdl, weld::Toggleable&, void);
-    void ButtonClick(weld::Toggleable& rBox);
+    void ButtonClick(const weld::Toggleable& rBox);
     void UpdateButtons();
 };
 
diff --git a/sc/source/ui/inc/xmlsourcedlg.hxx b/sc/source/ui/inc/xmlsourcedlg.hxx
index d4a030f78ecc..3d45d27a824d 100644
--- a/sc/source/ui/inc/xmlsourcedlg.hxx
+++ b/sc/source/ui/inc/xmlsourcedlg.hxx
@@ -76,14 +76,14 @@ private:
     void SelectSourceFile();
     void LoadSourceFileStructure(const OUString& rPath);
     void TreeItemSelected();
-    void DefaultElementSelected(weld::TreeIter& rEntry);
-    void RepeatElementSelected(weld::TreeIter& rEntry);
-    void AttributeSelected(weld::TreeIter& rEntry);
+    void DefaultElementSelected(const weld::TreeIter& rEntry);
+    void RepeatElementSelected(const weld::TreeIter& rEntry);
+    void AttributeSelected(const weld::TreeIter& rEntry);
 
     void SetNonLinkable();
     void SetSingleLinkable();
     void SetRangeLinkable();
-    void SelectAllChildEntries(weld::TreeIter& rEntry);
+    void SelectAllChildEntries(const weld::TreeIter& rEntry);
 
     /**
      * Check if any of its parents is linked or repeated.  The passed entry is
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index 0bbfa9d200b8..12837914d314 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -209,7 +209,7 @@ namespace {
  * the current entry position.  The mapped cell position for a range link is
  * stored with the reference entry.
  */
-std::unique_ptr<weld::TreeIter> getReferenceEntry(const weld::TreeView& rTree, weld::TreeIter& rCurEntry)
+std::unique_ptr<weld::TreeIter> getReferenceEntry(const weld::TreeView& rTree, const weld::TreeIter& rCurEntry)
 {
     std::unique_ptr<weld::TreeIter> xParent(rTree.make_iterator(&rCurEntry));
     bool bParent = rTree.iter_parent(*xParent);
@@ -274,7 +274,7 @@ void ScXMLSourceDlg::TreeItemSelected()
     }
 }
 
-void ScXMLSourceDlg::DefaultElementSelected(weld::TreeIter& rEntry)
+void ScXMLSourceDlg::DefaultElementSelected(const weld::TreeIter& rEntry)
 {
     if (mxLbTree->iter_has_child(rEntry))
     {
@@ -313,7 +313,7 @@ void ScXMLSourceDlg::DefaultElementSelected(weld::TreeIter& rEntry)
     SetSingleLinkable();
 }
 
-void ScXMLSourceDlg::RepeatElementSelected(weld::TreeIter& rEntry)
+void ScXMLSourceDlg::RepeatElementSelected(const weld::TreeIter& rEntry)
 {
     // Check all its parents first.
 
@@ -343,7 +343,7 @@ void ScXMLSourceDlg::RepeatElementSelected(weld::TreeIter& rEntry)
     SetRangeLinkable();
 }
 
-void ScXMLSourceDlg::AttributeSelected(weld::TreeIter& rEntry)
+void ScXMLSourceDlg::AttributeSelected(const weld::TreeIter& rEntry)
 {
     // Check all its parent elements and make sure non of them are linked nor
     // repeat elements.  In attribute's case, it's okay to have the immediate
@@ -384,7 +384,7 @@ void ScXMLSourceDlg::SetRangeLinkable()
     mxMapGrid->set_sensitive(true);
 }
 
-void ScXMLSourceDlg::SelectAllChildEntries(weld::TreeIter& rEntry)
+void ScXMLSourceDlg::SelectAllChildEntries(const weld::TreeIter& rEntry)
 {
     std::unique_ptr<weld::TreeIter> xChild(mxLbTree->make_iterator(&rEntry));
     if (!mxLbTree->iter_children(*xChild))
diff --git a/sd/source/ui/accessibility/AccessibleViewForwarder.cxx b/sd/source/ui/accessibility/AccessibleViewForwarder.cxx
index 9cebb322f006..09225e27ff06 100644
--- a/sd/source/ui/accessibility/AccessibleViewForwarder.cxx
+++ b/sd/source/ui/accessibility/AccessibleViewForwarder.cxx
@@ -32,7 +32,7 @@ namespace accessibility
     May change in the future.
 */
 
-AccessibleViewForwarder::AccessibleViewForwarder(SdrPaintView* pView, OutputDevice& rDevice)
+AccessibleViewForwarder::AccessibleViewForwarder(SdrPaintView* pView, const OutputDevice& rDevice)
     : mpView(pView)
     , mnWindowId(0)
 {
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 8e87e73eb040..e181c58accdb 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -524,7 +524,7 @@ sal_Int8 SdPageObjsTLVDropTarget::ExecuteDrop( const ExecuteDropEvent& rEvt )
 
 void SdPageObjsTLV::AddShapeToTransferable (
     SdTransferable& rTransferable,
-    SdrObject& rObject) const
+    const SdrObject& rObject) const
 {
     std::unique_ptr<TransferableObjectDescriptor> pObjectDescriptor(new TransferableObjectDescriptor);
     bool bIsDescriptorFillingPending (true);
diff --git a/sd/source/ui/inc/AccessibleViewForwarder.hxx b/sd/source/ui/inc/AccessibleViewForwarder.hxx
index 974fdbf93ca3..c791921e6f17 100644
--- a/sd/source/ui/inc/AccessibleViewForwarder.hxx
+++ b/sd/source/ui/inc/AccessibleViewForwarder.hxx
@@ -42,7 +42,7 @@ class AccessibleViewForwarder final : public IAccessibleViewForwarder
 public:
     //=====  internal  ========================================================
 
-    AccessibleViewForwarder(SdrPaintView* pView, OutputDevice& rDevice);
+    AccessibleViewForwarder(SdrPaintView* pView, const OutputDevice& rDevice);
 
     virtual ~AccessibleViewForwarder() override;
 
diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx
index e57bcb3a367e..57a98dabfb47 100644
--- a/sd/source/ui/inc/sdtreelb.hxx
+++ b/sd/source/ui/inc/sdtreelb.hxx
@@ -315,7 +315,7 @@ public:
     */
     void AddShapeToTransferable (
         SdTransferable& rTransferable,
-        SdrObject& rObject) const;
+        const SdrObject& rObject) const;
 
     /** return selected entries
           nDepth == 0 -> pages
diff --git a/sd/source/ui/inc/slideshow.hxx b/sd/source/ui/inc/slideshow.hxx
index 68fe77125647..b6d199bdda5e 100644
--- a/sd/source/ui/inc/slideshow.hxx
+++ b/sd/source/ui/inc/slideshow.hxx
@@ -100,7 +100,7 @@ public:
 
     /// returns true if there is a running presentation inside the given ViewShell
     /// returns false even if there is a running presentation but in another ViewShell
-    static bool IsRunning( ViewShell& rViewShell );
+    static bool IsRunning( const ViewShell& rViewShell );
 
     // helper api
 
diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx
index ac63931689b5..9f90799f8ddd 100644
--- a/sd/source/ui/slideshow/slideshow.cxx
+++ b/sd/source/ui/slideshow/slideshow.cxx
@@ -211,7 +211,7 @@ bool SlideShow::IsRunning( ViewShellBase const & rBase )
     return xSlideShow.is() && xSlideShow->isRunning();
 }
 
-bool SlideShow::IsRunning( ViewShell& rViewShell )
+bool SlideShow::IsRunning( const ViewShell& rViewShell )
 {
     rtl::Reference< SlideShow > xSlideShow( GetSlideShow( rViewShell.GetViewShellBase() ) );
     return xSlideShow.is() && xSlideShow->isRunning() && (xSlideShow->mxController->getViewShell() == &rViewShell);
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 632be3183bef..d064f6434c98 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1494,7 +1494,7 @@ class ImplRenderPaintProc : public sdr::contact::ViewObjectContactRedirector
     SdrPageView*            pSdrPageView;
     vcl::PDFExtOutDevData*  pPDFExtOutDevData;
 
-    vcl::PDFWriter::StructElement ImplBegStructureTag( SdrObject& rObject );
+    vcl::PDFWriter::StructElement ImplBegStructureTag( const SdrObject& rObject );
 
 public:
     bool IsVisible  ( const SdrObject* pObj ) const;
@@ -1711,7 +1711,7 @@ static void ImplPDFExportShapeInteraction( const uno::Reference< drawing::XShape
     }
 }
 
-vcl::PDFWriter::StructElement ImplRenderPaintProc::ImplBegStructureTag( SdrObject& rObject )
+vcl::PDFWriter::StructElement ImplRenderPaintProc::ImplBegStructureTag( const SdrObject& rObject )
 {
     vcl::PDFWriter::StructElement eElement(vcl::PDFWriter::NonStructElement);
 
@@ -1729,7 +1729,7 @@ vcl::PDFWriter::StructElement ImplRenderPaintProc::ImplBegStructureTag( SdrObjec
                 eElement = vcl::PDFWriter::Heading;
             else if ( nIdentifier == OBJ_OUTLINETEXT )
                 eElement = vcl::PDFWriter::Division;
-            else if ( !bIsTextObj || !static_cast<SdrTextObj&>(rObject).HasText() )
+            else if ( !bIsTextObj || !static_cast<const SdrTextObj&>(rObject).HasText() )
                 eElement = vcl::PDFWriter::Figure;
         }
     }
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx
index 51f58a4193c0..f03489bf688d 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -420,7 +420,7 @@ bool ParentIsFloatingWindow(const vcl::Window *pParent)
     return false;
 }
 
-void SfxChildWindow::SetFactory_Impl( SfxChildWinFactory *pF )
+void SfxChildWindow::SetFactory_Impl( const SfxChildWinFactory *pF )
 {
     pImpl->aFact = *pF;
 }
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index 4bdad2e492b9..ce2459d15748 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -924,7 +924,7 @@ void SfxWorkWindow::ReleaseChild_Impl( vcl::Window& rWindow )
     OSL_FAIL( "releasing unregistered child" );
 }
 
-void SfxWorkWindow::ReleaseChild_Impl(SfxDialogController& rController)
+void SfxWorkWindow::ReleaseChild_Impl(const SfxDialogController& rController)
 {
 
     SfxChild_Impl *pChild = nullptr;
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index be5b0806b5e8..ef056973efe6 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -911,22 +911,22 @@ void SfxCommonTemplateDialog_Impl::EnableEdit(bool b, StyleList* rStyleList)
     if (rStyleList == &m_aStyleList || rStyleList == nullptr)
         m_aStyleList.Enableedit(b);
 }
-void SfxCommonTemplateDialog_Impl::EnableDel(bool b, StyleList* rStyleList)
+void SfxCommonTemplateDialog_Impl::EnableDel(bool b, const StyleList* rStyleList)
 {
     if (rStyleList == &m_aStyleList || rStyleList == nullptr)
         m_aStyleList.Enabledel(b);
 }
-void SfxCommonTemplateDialog_Impl::EnableNew(bool b, StyleList* rStyleList)
+void SfxCommonTemplateDialog_Impl::EnableNew(bool b, const StyleList* rStyleList)
 {
     if (rStyleList == &m_aStyleList || rStyleList == nullptr)
         m_aStyleList.Enablenew(b);
 }
-void SfxCommonTemplateDialog_Impl::EnableHide(bool b, StyleList* rStyleList)
+void SfxCommonTemplateDialog_Impl::EnableHide(bool b, const StyleList* rStyleList)
 {
     if (rStyleList == &m_aStyleList || rStyleList == nullptr)
         m_aStyleList.Enablehide(b);
 }
-void SfxCommonTemplateDialog_Impl::EnableShow(bool b, StyleList* rStyleList)
+void SfxCommonTemplateDialog_Impl::EnableShow(bool b, const StyleList* rStyleList)
 {
     if (rStyleList == &m_aStyleList || rStyleList == nullptr)
         m_aStyleList.Enableshow(b);
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx
index 31a38ac294d5..a6934cbc9b6f 100644
--- a/sfx2/source/inc/templdgi.hxx
+++ b/sfx2/source/inc/templdgi.hxx
@@ -159,10 +159,10 @@ public:
     // Used in StyleList::SelectStyle, StyleList::Notify, IMPL_LINK(PopupFlatMenuHdl)
     // These functions are used when a style is edited, deleted, created etc..
     virtual void EnableEdit(bool b, StyleList* rStyleList);
-    void EnableDel(bool b, StyleList* rStyleList);
-    void EnableNew(bool b, StyleList* rStyleList);
-    void EnableHide(bool b, StyleList* rStyleList);
-    void EnableShow(bool b, StyleList* rStyleList);
+    void EnableDel(bool b, const StyleList* rStyleList);
+    void EnableNew(bool b, const StyleList* rStyleList);
+    void EnableHide(bool b, const StyleList* rStyleList);
+    void EnableShow(bool b, const StyleList* rStyleList);
 
     // Used in TreeDrag
     void EnableTreeDrag(bool b);
diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx
index e407fcf54244..350901910554 100644
--- a/sfx2/source/inc/workwin.hxx
+++ b/sfx2/source/inc/workwin.hxx
@@ -243,7 +243,7 @@ public:
     // Methods for all Child windows
     void                    DataChanged_Impl();
     void                    ReleaseChild_Impl( vcl::Window& rWindow );
-    void                    ReleaseChild_Impl(SfxDialogController&);
+    void                    ReleaseChild_Impl(const SfxDialogController&);
     SfxChild_Impl*          RegisterChild_Impl( vcl::Window& rWindow, SfxChildAlignment eAlign );
     SfxChild_Impl*          RegisterChild_Impl(std::shared_ptr<SfxDialogController>& rController, SfxChildAlignment eAlign);
     void                    ShowChildren_Impl();
diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx
index 990f46a53f86..2811c32185f0 100644
--- a/sfx2/source/view/frame2.cxx
+++ b/sfx2/source/view/frame2.cxx
@@ -379,7 +379,7 @@ bool SfxFrame::IsMenuBarOn_Impl() const
     return pImpl->bMenuBarOn;
 }
 
-void SfxFrame::PrepareForDoc_Impl( SfxObjectShell& i_rDoc )
+void SfxFrame::PrepareForDoc_Impl( const SfxObjectShell& i_rDoc )
 {
     const ::comphelper::NamedValueCollection aDocumentArgs( i_rDoc.GetModel()->getArgs2( { "Hidden", "PluginMode" } ) );
 
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 6bbc18f86ca7..009c16f9feb4 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1831,7 +1831,7 @@ static void Change( Menu* pMenu, SfxViewShell* pView )
 }
 
 
-bool SfxViewShell::TryContextMenuInterception( Menu& rIn, const OUString& rMenuIdentifier, VclPtr<Menu>& rpOut, ui::ContextMenuExecuteEvent aEvent )
+bool SfxViewShell::TryContextMenuInterception( const Menu& rIn, const OUString& rMenuIdentifier, VclPtr<Menu>& rpOut, ui::ContextMenuExecuteEvent aEvent )
 {
     rpOut = nullptr;
     bool bModified = false;
diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx
index b99dab35bf62..e7c5964f6d9e 100644
--- a/svl/source/crypto/cryptosign.cxx
+++ b/svl/source/crypto/cryptosign.cxx
@@ -540,7 +540,7 @@ my_NSS_CMSArray_Add(PLArenaPool *poolp, void ***array, void *obj)
 }
 
 SECOidTag
-my_NSS_CMSAttribute_GetType(NSSCMSAttribute *attr)
+my_NSS_CMSAttribute_GetType(const NSSCMSAttribute *attr)
 {
     SECOidData *typetag;
 
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 307f673da391..81cf6e6f0b0b 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -147,7 +147,7 @@ void SdrEditView::SetMarkedObjRect(const tools::Rectangle& rRect)
         EndUndo();
 }
 
-std::vector< std::unique_ptr<SdrUndoAction> > SdrEditView::CreateConnectorUndo( SdrObject& rO )
+std::vector< std::unique_ptr<SdrUndoAction> > SdrEditView::CreateConnectorUndo( const SdrObject& rO )
 {
     std::vector< std::unique_ptr<SdrUndoAction> > vUndoActions;
 
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
index 7b156881d0c3..791a1fc30e70 100644
--- a/svx/source/svdraw/svdpagv.cxx
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -40,7 +40,7 @@ using namespace ::com::sun::star;
 
 // interface to SdrPageWindow
 
-SdrPageWindow* SdrPageView::FindPageWindow(SdrPaintWindow& rPaintWindow) const
+SdrPageWindow* SdrPageView::FindPageWindow(const SdrPaintWindow& rPaintWindow) const
 {
     for(auto & a : maPageWindows)
     {
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index 15e4aefcb897..addf221c9bb1 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -75,7 +75,7 @@ SdrPaintWindow* SdrPaintView::GetPaintWindow(sal_uInt32 nIndex) const
     return maPaintWindows[nIndex].get();
 }
 
-void SdrPaintView::DeletePaintWindow(SdrPaintWindow& rOld)
+void SdrPaintView::DeletePaintWindow(const SdrPaintWindow& rOld)
 {
     auto aFindResult = ::std::find_if(maPaintWindows.begin(), maPaintWindows.end(),
                             [&](const std::unique_ptr<SdrPaintWindow>& p) { return p.get() == &rOld; });
diff --git a/svx/source/svdraw/svdtext.cxx b/svx/source/svdraw/svdtext.cxx
index bd06940e25ac..72591ef67d92 100644
--- a/svx/source/svdraw/svdtext.cxx
+++ b/svx/source/svdraw/svdtext.cxx
@@ -39,7 +39,7 @@ SdrText::~SdrText()
     clearWeak();
 }
 
-void SdrText::CheckPortionInfo( SdrOutliner& rOutliner )
+void SdrText::CheckPortionInfo( const SdrOutliner& rOutliner )
 {
     if(mbPortionInfoChecked)
         return;
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index a2f0af3b9dea..c12f840dfd52 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -158,7 +158,7 @@ class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public SfxListener
         bool            ArrowEnabled(sal_uInt16 aDirection,tools::ULong aPage) const;
         bool            BorderOverPageBorder(tools::ULong aPage) const;
         bool            HasScrollbars() const;
-        void            Focus(SfxBroadcaster& rBC);
+        void            Focus(const SfxBroadcaster& rBC);
 
         sal_Int32       GetInitialAnchorDistance() const;
         sal_Int32       GetScrollSize() const;
@@ -252,7 +252,7 @@ class SAL_DLLPUBLIC_RTTI SwPostItMgr final : public SfxListener
         static Color           GetColorLight(std::size_t aAuthorIndex);
         static Color           GetColorAnchor(std::size_t aAuthorIndex);
 
-        void                RegisterAnswer(OutlinerParaObject* pAnswer) { if (pAnswer) mpAnswer =* pAnswer; else mpAnswer.reset(); }
+        void                RegisterAnswer(const OutlinerParaObject* pAnswer) { if (pAnswer) mpAnswer =* pAnswer; else mpAnswer.reset(); }
         OutlinerParaObject* IsAnswer() { return mpAnswer ? &*mpAnswer : nullptr; }
         void                RegisterAnswerText(const OUString& aAnswerText) { maAnswerText = aAnswerText; }
         const OUString&     GetAnswerText() const { return maAnswerText; }
diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index 978cf77327b9..2e5b27cfccb0 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -63,7 +63,7 @@ public:
     /// Destroy a TextBox for a shape. If the format has more textboxes
     /// like group shapes, it will destroy only that textbox what belongs
     /// to the given pObject shape.
-    static void destroy(SwFrameFormat* pShape, SdrObject* pObject);
+    static void destroy(const SwFrameFormat* pShape, const SdrObject* pObject);
     /// Get interface of a shape's TextBox, if there is any.
     static css::uno::Any queryInterface(const SwFrameFormat* pShape, const css::uno::Type& rType);
 
@@ -112,7 +112,7 @@ public:
 
     // Returns true on success. Synchronize z-order of the text frame of the given textbox
     // by setting it one level higher than the z-order of the shape of the textbox.
-    static bool DoTextBoxZOrderCorrection(SwFrameFormat* pShape, SdrObject* pObj);
+    static bool DoTextBoxZOrderCorrection(SwFrameFormat* pShape, const SdrObject* pObj);
 
     /**
      * If we have an associated TextFrame, then return that.
@@ -126,7 +126,7 @@ public:
      * @see isTextBox
      */
     static SwFrameFormat* getOtherTextBoxFormat(const SwFrameFormat* pFormat, sal_uInt16 nType,
-                                                SdrObject* pObject = nullptr);
+                                                const SdrObject* pObject = nullptr);
     /// If we have an associated TextFrame, then return that.
     static SwFrameFormat*
     getOtherTextBoxFormat(css::uno::Reference<css::drawing::XShape> const& xShape);
@@ -153,7 +153,7 @@ public:
      *                 the textbox what belongs to the pObject will only be inspected.
      */
     static bool isTextBox(const SwFrameFormat* pFormat, sal_uInt16 nType,
-                          SdrObject* pObject = nullptr);
+                          const SdrObject* pObject = nullptr);
 
     /// Returns true if the SdrObject has a SwTextFrame otherwise false
     static bool hasTextFrame(const SdrObject* pObj);
@@ -223,7 +223,7 @@ public:
     // This will remove the textbox entry.
     // Parameters:
     //     pDrawObject: The shape which have the textbox to be deleted.
-    void DelTextBox(SdrObject* pDrawObject);
+    void DelTextBox(const SdrObject* pDrawObject);
 
     // This will return with the frame format of the textbox what belongs
     // to the given shape (pDrawObject)
@@ -233,8 +233,8 @@ public:
     bool IsTextBoxActive(const SdrObject* pDrawObject) const;
 
     // Setters for the state flag.
-    void SetTextBoxInactive(SdrObject* pDrawObject);
-    void SetTextBoxActive(SdrObject* pDrawObject);
+    void SetTextBoxInactive(const SdrObject* pDrawObject);
+    void SetTextBoxActive(const SdrObject* pDrawObject);
 
     // If this is a group shape, that returns true.
     bool IsGroupTextBox() const;
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index 7b3f6d490066..a69e0c2e1483 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -504,7 +504,7 @@ public:
     void            ExecDlgExt(SfxRequest const &);
     void            ExecColl(SfxRequest const &);
     void            ExecutePrint(SfxRequest&);
-    void            ExecDraw(SfxRequest&);
+    void            ExecDraw(const SfxRequest&);
     void            ExecTabWin(SfxRequest const &);
     void            ExecuteStatusLine(SfxRequest&);
     DECL_LINK( ExecRulerClick, Ruler *, void );
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 4800cadcf9ba..6c0b40302a72 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -150,7 +150,7 @@ class SW_DLLPUBLIC SwViewShell : public sw::Ring<SwViewShell>
 
 
 
-    SAL_DLLPRIVATE void PaintDesktop(vcl::RenderContext& rRenderContext, const SwRect&);  // Collect values for painting of desktop
+    SAL_DLLPRIVATE void PaintDesktop(const vcl::RenderContext& rRenderContext, const SwRect&);  // Collect values for painting of desktop
                                                         // and calling.
     // PaintDesktop split. This pars is also used by PreviewPage.
     SAL_DLLPRIVATE void PaintDesktop_(const SwRegionRects &rRegion);
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 29fd60545ff0..787e3ee6c2ff 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -230,7 +230,7 @@ namespace
 namespace sw
 {
     // TODO: use SaveBookmark (from DelBookmarks)
-    void CopyBookmarks(const SwPaM& rPam, SwPosition& rCpyPam)
+    void CopyBookmarks(const SwPaM& rPam, const SwPosition& rCpyPam)
     {
         const SwDoc& rSrcDoc = rPam.GetDoc();
         SwDoc& rDestDoc =  rCpyPam.GetDoc();
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 93b9564a59bf..7c6110e714d2 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -207,7 +207,7 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape, SdrObject* pObject, bool bCo
     }
 }
 
-void SwTextBoxHelper::destroy(SwFrameFormat* pShape, SdrObject* pObject)
+void SwTextBoxHelper::destroy(const SwFrameFormat* pShape, const SdrObject* pObject)
 {
     // If a TextBox was enabled previously
     auto pTextBox = pShape->GetOtherTextBoxFormat();
@@ -221,7 +221,8 @@ void SwTextBoxHelper::destroy(SwFrameFormat* pShape, SdrObject* pObject)
     }
 }
 
-bool SwTextBoxHelper::isTextBox(const SwFrameFormat* pFormat, sal_uInt16 nType, SdrObject* pObject)
+bool SwTextBoxHelper::isTextBox(const SwFrameFormat* pFormat, sal_uInt16 nType,
+                                const SdrObject* pObject)
 {
     SolarMutexGuard aGuard;
     assert(nType == RES_FLYFRMFMT || nType == RES_DRAWFRMFMT);
@@ -338,7 +339,7 @@ void SwTextBoxHelper::getShapeWrapThrough(const SwFrameFormat* pTextBox, bool& r
 }
 
 SwFrameFormat* SwTextBoxHelper::getOtherTextBoxFormat(const SwFrameFormat* pFormat,
-                                                      sal_uInt16 nType, SdrObject* pObject)
+                                                      sal_uInt16 nType, const SdrObject* pObject)
 {
     SolarMutexGuard aGuard;
     if (!isTextBox(pFormat, nType, pObject))
@@ -1324,7 +1325,7 @@ bool SwTextBoxHelper::isTextBoxShapeHasValidTextFrame(const SwFrameFormat* pShap
     return false;
 }
 
-bool SwTextBoxHelper::DoTextBoxZOrderCorrection(SwFrameFormat* pShape, SdrObject* pObj)
+bool SwTextBoxHelper::DoTextBoxZOrderCorrection(SwFrameFormat* pShape, const SdrObject* pObj)
 {
     // TODO: do this with group shape textboxes.
     SdrObject* pShpObj = nullptr;
@@ -1418,7 +1419,7 @@ void SwTextBoxNode::AddTextBox(SdrObject* pDrawObject, SwFrameFormat* pNewTextBo
     m_pTextBoxes.push_back(aElem);
 }
 
-void SwTextBoxNode::DelTextBox(SdrObject* pDrawObject)
+void SwTextBoxNode::DelTextBox(const SdrObject* pDrawObject)
 {
     assert(pDrawObject);
     if (m_pTextBoxes.size())
@@ -1471,7 +1472,7 @@ bool SwTextBoxNode::IsTextBoxActive(const SdrObject* pDrawObject) const
     return false;
 }
 
-void SwTextBoxNode::SetTextBoxActive(SdrObject* pDrawObject)
+void SwTextBoxNode::SetTextBoxActive(const SdrObject* pDrawObject)
 {
     assert(pDrawObject);
 
@@ -1487,7 +1488,7 @@ void SwTextBoxNode::SetTextBoxActive(SdrObject* pDrawObject)
     }
 }
 
-void SwTextBoxNode::SetTextBoxInactive(SdrObject* pDrawObject)
+void SwTextBoxNode::SetTextBoxInactive(const SdrObject* pDrawObject)
 {
     assert(pDrawObject);
 
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index afa8b905e99e..4efc335d4f33 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -1065,7 +1065,7 @@ static void lcl_BreakSectionLinksInSect( const SwSectionNode& rSectNd )
     }
 }
 
-static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
+static void lcl_UpdateLinksInSect( const SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
 {
     SwDoc& rDoc = rSectNd.GetDoc();
     SwDocShell* pDShell = rDoc.GetDocShell();
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index 59e606692dc8..6d0a1ee0d917 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -1291,7 +1291,7 @@ SdrObject* SwVirtFlyDrawObj::CheckMacroHit( const SdrObjMacroHitRec& rRec ) cons
 
 bool SwVirtFlyDrawObj::IsTextBox() const
 {
-    return SwTextBoxHelper::isTextBox(GetFormat(), RES_FLYFRMFMT, const_cast<SwVirtFlyDrawObj*>(this));
+    return SwTextBoxHelper::isTextBox(GetFormat(), RES_FLYFRMFMT, this);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index 9fb2546b238c..bef3f2b286fb 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -160,13 +160,13 @@ void SwEditShell::Insert2(SwField const & rField, const bool bForceExpandHints)
 }
 
 /// Are the PaMs positioned on fields?
-static SwTextField* lcl_FindInputField( SwDoc* pDoc, SwField& rField )
+static SwTextField* lcl_FindInputField( SwDoc* pDoc, const SwField& rField )
 {
     // Search field via its address. For input fields this needs to be done in protected fields.
     SwTextField* pTField = nullptr;
     if (SwFieldIds::Input == rField.Which()
         || (SwFieldIds::SetExp == rField.Which()
-            && static_cast<SwSetExpField&>(rField).GetInputFlag()
+            && static_cast<const SwSetExpField&>(rField).GetInputFlag()
             && (static_cast<SwSetExpFieldType*>(rField.GetTyp())->GetType()
                 & nsSwGetSetExpType::GSE_STRING)))
     {
@@ -181,7 +181,7 @@ static SwTextField* lcl_FindInputField( SwDoc* pDoc, SwField& rField )
         }
     }
     else if( SwFieldIds::SetExp == rField.Which()
-        && static_cast<SwSetExpField&>(rField).GetInputFlag() )
+        && static_cast<const SwSetExpField&>(rField).GetInputFlag() )
     {
         for (const SfxPoolItem* pItem : pDoc->GetAttrPool().GetItemSurrogates(RES_TXTATR_FIELD))
         {
diff --git a/sw/source/core/inc/DocumentContentOperationsManager.hxx b/sw/source/core/inc/DocumentContentOperationsManager.hxx
index a7a50e48d890..4d30a1736b0a 100644
--- a/sw/source/core/inc/DocumentContentOperationsManager.hxx
+++ b/sw/source/core/inc/DocumentContentOperationsManager.hxx
@@ -178,7 +178,7 @@ private:
 };
 
 
-void CopyBookmarks(const SwPaM& rPam, SwPosition& rTarget);
+void CopyBookmarks(const SwPaM& rPam, const SwPosition& rTarget);
 
 void CalcBreaks(std::vector<std::pair<sal_uLong, sal_Int32>> & rBreaks,
         SwPaM const & rPam, bool const isOnlyFieldmarks = false);
diff --git a/sw/source/core/inc/unoidx.hxx b/sw/source/core/inc/unoidx.hxx
index 13619f2b2f1f..d7db053734f5 100644
--- a/sw/source/core/inc/unoidx.hxx
+++ b/sw/source/core/inc/unoidx.hxx
@@ -161,7 +161,7 @@ private:
     virtual ~SwXDocumentIndexMark() override;
 
     SwXDocumentIndexMark(SwDoc & rDoc,
-                SwTOXType & rType, SwTOXMark & rMark);
+                const SwTOXType & rType, const SwTOXMark & rMark);
 
     /// descriptor
     SwXDocumentIndexMark(const TOXTypes eToxType);
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 0c52ba001fe8..11ca12857070 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1666,7 +1666,7 @@ static void lcl_DrawGraphicBackground( const SvxBrushItem& _rBackgrdBrush,
  * Also, change type of <bGrfNum> and <bClip> from <bool> to <bool>
  */
 static void lcl_DrawGraphic( const SvxBrushItem& rBrush, vcl::RenderContext &rOutDev,
-                      SwViewShell &rSh, const SwRect &rGrf, const SwRect &rOut,
+                      const SwViewShell &rSh, const SwRect &rGrf, const SwRect &rOut,
                       bool bGrfNum,
                       SwPaintProperties const & properties,
                       bool bBackgrdAlreadyDrawn )
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 86628d906bcf..8e060913913d 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -4230,10 +4230,10 @@ void SwRootFrame::InvalidateAllObjPos()
 static void AddRemoveFlysForNode(
         SwTextFrame & rFrame, SwTextNode & rTextNode,
         std::set<sal_uLong> *const pSkipped,
-        SwFrameFormats & rTable,
+        const SwFrameFormats & rTable,
         SwPageFrame *const pPage,
         SwTextNode const*const pNode,
-        std::vector<sw::Extent>::const_iterator & rIterFirst,
+        std::vector<sw::Extent>::const_iterator const& rIterFirst,
         std::vector<sw::Extent>::const_iterator const& rIterEnd,
         SwTextNode const*const pFirstNode, SwTextNode const*const pLastNode)
 {
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 943c09148155..9fabb33aa6e1 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -221,7 +221,7 @@ lcl_MaskRedlinesAndHiddenText( const SwTextNode& rNode, OUStringBuffer& rText,
  * Used for spell checking. Calculates a rectangle for repaint.
  */
 static SwRect lcl_CalculateRepaintRect(
-        SwTextFrame & rTextFrame, SwTextNode & rNode,
+        const SwTextFrame & rTextFrame, const SwTextNode & rNode,
         sal_Int32 const nChgStart, sal_Int32 const nChgEnd)
 {
     TextFrameIndex const iChgStart(rTextFrame.MapModelToView(&rNode, nChgStart));
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 790dd2e3ea67..891e63d06fd7 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -819,7 +819,7 @@ SwRewriter SwUndoDelete::GetRewriter() const
 }
 
 // Every object, anchored "AtContent" will be reanchored at rPos
-static void lcl_ReAnchorAtContentFlyFrames( const SwFrameFormats& rSpzArr, SwPosition &rPos, sal_uLong nOldIdx )
+static void lcl_ReAnchorAtContentFlyFrames( const SwFrameFormats& rSpzArr, const SwPosition &rPos, sal_uLong nOldIdx )
 {
     if( rSpzArr.empty() )
         return;
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index fd0be53e8a91..b40a42a49a41 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -199,7 +199,7 @@ bool FillRangeDescriptor(
     return true;
 }
 
-static OUString GetCellRangeName( SwFrameFormat &rTableFormat, SwUnoCursor &rTableCursor )
+static OUString GetCellRangeName( const SwFrameFormat &rTableFormat, SwUnoCursor &rTableCursor )
 {
     OUString aRes;
 
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index 8582726eafa5..b7f2681953a0 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -1552,10 +1552,10 @@ public:
         Invalidate();
     }
 
-    void InsertTOXMark(SwTOXType & rTOXType, SwTOXMark & rMark, SwPaM & rPam,
+    void InsertTOXMark(const SwTOXType & rTOXType, SwTOXMark & rMark, SwPaM & rPam,
             SwXTextCursor const*const pTextCursor);
 
-    void ReplaceTOXMark(SwTOXType & rTOXType, SwTOXMark & rMark, SwPaM & rPam)
+    void ReplaceTOXMark(const SwTOXType & rTOXType, SwTOXMark & rMark, SwPaM & rPam)
     {
         m_bInReplaceMark = true;
         DeleteTOXMark();
@@ -1611,7 +1611,7 @@ SwXDocumentIndexMark::SwXDocumentIndexMark(const TOXTypes eToxType)
 }
 
 SwXDocumentIndexMark::SwXDocumentIndexMark(SwDoc & rDoc,
-                SwTOXType & rType, SwTOXMark & rMark)
+                const SwTOXType & rType, const SwTOXMark & rMark)
     : m_pImpl( new SwXDocumentIndexMark::Impl(*this, &rDoc, rType.GetType(),
                     &rType, &rMark) )
 {
@@ -1896,7 +1896,7 @@ template<typename T> struct NotContainedIn
 }
 
 void SwXDocumentIndexMark::Impl::InsertTOXMark(
-        SwTOXType & rTOXType, SwTOXMark & rMark, SwPaM & rPam,
+        const SwTOXType & rTOXType, SwTOXMark & rMark, SwPaM & rPam,
         SwXTextCursor const*const pTextCursor)
 {
     SwDoc& rDoc(rPam.GetDoc());
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index dfddb9d72574..91de951d9eb4 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1475,7 +1475,7 @@ bool SwViewShell::SmoothScroll( tools::Long lXDiff, tools::Long lYDiff, const to
     return false;
 }
 
-void SwViewShell::PaintDesktop(vcl::RenderContext& rRenderContext, const SwRect &rRect)
+void SwViewShell::PaintDesktop(const vcl::RenderContext& rRenderContext, const SwRect &rRect)
 {
     if ( !GetWin() && !GetOut()->GetConnectMetaFile() )
         return;                     //for the printer we don't do anything here.
diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx
index 13993d1b20f8..1ecb6cefeddc 100644
--- a/sw/source/ui/chrdlg/drpcps.cxx
+++ b/sw/source/ui/chrdlg/drpcps.cxx
@@ -622,7 +622,7 @@ IMPL_LINK_NOARG(SwDropCapsPage, WholeWordHdl, weld::Toggleable&, void)
     bModified = true;
 }
 
-void SwDropCapsPage::ModifyEntry(weld::Entry& rEdit)
+void SwDropCapsPage::ModifyEntry(const weld::Entry& rEdit)
 {
     OUString sPreview;
 
diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx
index f42ba0364c45..14160f27eb41 100644
--- a/sw/source/ui/config/mailconfigpage.cxx
+++ b/sw/source/ui/config/mailconfigpage.cxx
@@ -352,7 +352,7 @@ void SwTestAccountSettingsDialog::Test()
     }
 }
 
-SwMailConfigDlg::SwMailConfigDlg(weld::Window* pParent, SfxItemSet& rSet)
+SwMailConfigDlg::SwMailConfigDlg(weld::Window* pParent, const SfxItemSet& rSet)
     : SfxSingleTabDialogController(pParent, &rSet)
 {
     // create TabPage
diff --git a/sw/source/ui/frmdlg/uiborder.cxx b/sw/source/ui/frmdlg/uiborder.cxx
index 81917da684c2..73c55b0e3cd3 100644
--- a/sw/source/ui/frmdlg/uiborder.cxx
+++ b/sw/source/ui/frmdlg/uiborder.cxx
@@ -29,7 +29,7 @@
 #include <uiborder.hxx>
 #include <strings.hrc>
 
-SwBorderDlg::SwBorderDlg(weld::Window* pParent, SfxItemSet& rSet, SwBorderModes nType)
+SwBorderDlg::SwBorderDlg(weld::Window* pParent, const SfxItemSet& rSet, SwBorderModes nType)
     : SfxSingleTabDialogController(pParent, &rSet)
 {
     m_xDialog->set_title(SwResId(STR_FRMUI_BORDER));
diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx
index e9e8a28f3c33..5f608db7108d 100644
--- a/sw/source/ui/frmdlg/wrap.cxx
+++ b/sw/source/ui/frmdlg/wrap.cxx
@@ -50,7 +50,7 @@ const WhichRangesContainer SwWrapTabPage::m_aWrapPageRg(svl::Items<
     RES_PROTECT, RES_SURROUND
 >);
 
-SwWrapDlg::SwWrapDlg(weld::Window* pParent, SfxItemSet& rSet, SwWrtShell* pWrtShell, bool bDrawMode)
+SwWrapDlg::SwWrapDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtShell, bool bDrawMode)
     : SfxSingleTabDialogController(pParent, &rSet, "modules/swriter/ui/wrapdialog.ui", "WrapDialog")
 {
     // create TabPage
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 13c0584fb562..913c94135acd 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -4182,7 +4182,7 @@ void SwTransferable::CreateSelection( SwWrtShell& rSh,
     pNew->CopyToPrimarySelection();
 }
 
-void SwTransferable::ClearSelection( SwWrtShell& rSh,
+void SwTransferable::ClearSelection( const SwWrtShell& rSh,
                                      const SwFrameShell * _pCreatorView)
 {
     SwModule *pMod = SW_MOD();
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 3dd0944d052f..d63a01644293 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -495,7 +495,7 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
     }
 }
 
-void SwPostItMgr::Focus(SfxBroadcaster& rBC)
+void SwPostItMgr::Focus(const SfxBroadcaster& rBC)
 {
     if (!mpWrtShell->GetViewOptions()->IsPostIts())
     {
diff --git a/sw/source/uibase/inc/drpcps.hxx b/sw/source/uibase/inc/drpcps.hxx
index 4c2274cf25aa..d1b0a09d082a 100644
--- a/sw/source/uibase/inc/drpcps.hxx
+++ b/sw/source/uibase/inc/drpcps.hxx
@@ -135,7 +135,7 @@ friend class SwDropCapsPict;
     virtual DeactivateRC   DeactivatePage(SfxItemSet *pSet) override;
     void    FillSet( SfxItemSet &rSet );
 
-    void ModifyEntry(weld::Entry& rEdit);
+    void ModifyEntry(const weld::Entry& rEdit);
 
     DECL_LINK(ClickHdl, weld::Toggleable&, void);
     DECL_LINK(MetricValueChangedHdl, weld::MetricSpinButton&, void);
diff --git a/sw/source/uibase/inc/mailconfigpage.hxx b/sw/source/uibase/inc/mailconfigpage.hxx
index 47c1f8bdaaa5..734b39aa9e67 100644
--- a/sw/source/uibase/inc/mailconfigpage.hxx
+++ b/sw/source/uibase/inc/mailconfigpage.hxx
@@ -61,7 +61,7 @@ public:
 class SwMailConfigDlg final : public SfxSingleTabDialogController
 {
 public:
-    SwMailConfigDlg(weld::Window* pParent, SfxItemSet& rSet);
+    SwMailConfigDlg(weld::Window* pParent, const SfxItemSet& rSet);
 };
 
 #endif
diff --git a/sw/source/uibase/inc/swdtflvr.hxx b/sw/source/uibase/inc/swdtflvr.hxx
index 7f410739f079..5c58acf2a572 100644
--- a/sw/source/uibase/inc/swdtflvr.hxx
+++ b/sw/source/uibase/inc/swdtflvr.hxx
@@ -230,7 +230,7 @@ public:
     /* #96392# Added pCreator to distinguish SwFrameShell from SwWrtShell. */
     static void CreateSelection( SwWrtShell & rSh,
                                  const SwFrameShell * pCreator = nullptr );
-    static void ClearSelection( SwWrtShell& rSh,
+    static void ClearSelection( const SwWrtShell& rSh,
                                 const SwFrameShell * pCreator = nullptr );
 
     // the related SwView is being closed and the SwTransferable is invalid now
diff --git a/sw/source/uibase/inc/uiborder.hxx b/sw/source/uibase/inc/uiborder.hxx
index e0b98570dc26..bd23157b7f37 100644
--- a/sw/source/uibase/inc/uiborder.hxx
+++ b/sw/source/uibase/inc/uiborder.hxx
@@ -30,7 +30,7 @@ public:
     // SW_BORDER_MODE_TABLE
     // SW_BORDER_MODE_FRAME
 
-    SwBorderDlg(weld::Window* pParent, SfxItemSet& rSet, SwBorderModes nType);
+    SwBorderDlg(weld::Window* pParent, const SfxItemSet& rSet, SwBorderModes nType);
     virtual ~SwBorderDlg() override;
 };
 
diff --git a/sw/source/uibase/inc/wrap.hxx b/sw/source/uibase/inc/wrap.hxx
index d4d63ad16945..c947eee3a896 100644
--- a/sw/source/uibase/inc/wrap.hxx
+++ b/sw/source/uibase/inc/wrap.hxx
@@ -29,7 +29,7 @@ class SwWrtShell;
 class SwWrapDlg final : public SfxSingleTabDialogController
 {
 public:
-    SwWrapDlg(weld::Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, bool bDrawMode);
+    SwWrapDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pSh, bool bDrawMode);
 };
 
 // circulation TabPage
diff --git a/sw/source/uibase/shells/olesh.cxx b/sw/source/uibase/shells/olesh.cxx
index 4fd3b434c32e..acddd3eb6975 100644
--- a/sw/source/uibase/shells/olesh.cxx
+++ b/sw/source/uibase/shells/olesh.cxx
@@ -34,7 +34,7 @@ using namespace sfx2::sidebar;
 
 namespace {
 
-bool inChartContext(SwView& rViewShell)
+bool inChartContext(const SwView& rViewShell)
 {
     SidebarController* pSidebar = SidebarController::GetSidebarControllerForView(&rViewShell);
     if (pSidebar)
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index ccc82d329024..e45bc9adbe35 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -70,7 +70,7 @@ using namespace ::com::sun::star;
 
 // Execute Drawing-Ids
 
-void SwView::ExecDraw(SfxRequest& rReq)
+void SwView::ExecDraw(const SfxRequest& rReq)
 {
     const SfxItemSet *pArgs = rReq.GetArgs();
     const SfxPoolItem* pItem;
diff --git a/toolkit/source/awt/stylesettings.cxx b/toolkit/source/awt/stylesettings.cxx
index 359e59077049..d978fe2799e7 100644
--- a/toolkit/source/awt/stylesettings.cxx
+++ b/toolkit/source/awt/stylesettings.cxx
@@ -64,7 +64,7 @@ namespace toolkit
     class StyleMethodGuard
     {
     public:
-        explicit StyleMethodGuard( VCLXWindow* pOwningWindow )
+        explicit StyleMethodGuard( const VCLXWindow* pOwningWindow )
         {
             if ( pOwningWindow == nullptr )
                 throw DisposedException();
diff --git a/vcl/source/app/weldutils.cxx b/vcl/source/app/weldutils.cxx
index 12a8c6547199..4c160cfd6930 100644
--- a/vcl/source/app/weldutils.cxx
+++ b/vcl/source/app/weldutils.cxx
@@ -115,7 +115,7 @@ void TriStateEnabled::ButtonToggled(weld::Toggleable& rToggle)
     eState = rToggle.get_state();
 }
 
-void RemoveParentKeepChildren(weld::TreeView& rTreeView, weld::TreeIter& rParent)
+void RemoveParentKeepChildren(weld::TreeView& rTreeView, const weld::TreeIter& rParent)
 {
     if (rTreeView.iter_has_child(rParent))
     {
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 302faae5df06..b3f9557ad2f0 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -781,7 +781,7 @@ void Window::ImplInvalidateOverlapFrameRegion( const vcl::Region& rRegion )
     }
 }
 
-void Window::ImplInvalidateParentFrameRegion( vcl::Region& rRegion )
+void Window::ImplInvalidateParentFrameRegion( const vcl::Region& rRegion )
 {
     if ( mpWindowImpl->mbOverlapWin )
         mpWindowImpl->mpFrameWindow->ImplInvalidateOverlapFrameRegion( rRegion );


More information about the Libreoffice-commits mailing list