basic/source/basmgr/basmgr.cxx                      |    4 ++--
 basic/source/classes/sb.cxx                         |    4 ++--
 basic/source/comp/symtbl.cxx                        |    4 ++--
 basic/source/inc/symtbl.hxx                         |    2 +-
 basic/source/runtime/methods.cxx                    |    2 +-
 basic/source/sbx/sbxarray.cxx                       |    6 +++---
 cui/source/dialogs/postdlg.cxx                      |    5 +++--
 cui/source/inc/TextColumnsPage.hxx                  |    2 +-
 cui/source/inc/align.hxx                            |    2 +-
 cui/source/inc/backgrnd.hxx                         |    2 +-
 cui/source/inc/border.hxx                           |    2 +-
 cui/source/inc/chardlg.hxx                          |    8 ++++----
 cui/source/inc/connect.hxx                          |    2 +-
 cui/source/inc/cuitabarea.hxx                       |    6 +++---
 cui/source/inc/cuitabline.hxx                       |    2 +-
 cui/source/inc/labdlg.hxx                           |    2 +-
 cui/source/inc/macropg.hxx                          |    2 +-
 cui/source/inc/measure.hxx                          |    2 +-
 cui/source/inc/numfmt.hxx                           |    2 +-
 cui/source/inc/optasian.hxx                         |    2 +-
 cui/source/inc/page.hxx                             |    2 +-
 cui/source/inc/paragrph.hxx                         |   10 +++++-----
 cui/source/inc/postdlg.hxx                          |    2 +-
 cui/source/inc/swpossizetabpage.hxx                 |    2 +-
 cui/source/inc/tabstpge.hxx                         |    2 +-
 cui/source/inc/textanim.hxx                         |    2 +-
 cui/source/inc/textattr.hxx                         |    2 +-
 cui/source/inc/transfrm.hxx                         |    6 +++---
 cui/source/options/optasian.cxx                     |    5 +++--
 cui/source/tabpages/paragrph.cxx                    |    5 +++--
 cui/source/tabpages/swpossizetabpage.cxx            |    2 +-
 include/basic/basmgr.hxx                            |    2 +-
 include/basic/sbdef.hxx                             |    2 +-
 include/basic/sbstar.hxx                            |    2 +-
 include/basic/sbx.hxx                               |    2 +-
 include/sfx2/basedlgs.hxx                           |    2 +-
 include/sfx2/tabdlg.hxx                             |    2 +-
 include/svx/PaletteManager.hxx                      |    2 +-
 include/svx/annotation/Annotation.hxx               |   12 ++++++------
 include/svx/colorbox.hxx                            |    2 +-
 include/svx/hdft.hxx                                |    4 ++--
 include/svx/numvset.hxx                             |    2 +-
 include/svx/svdoole2.hxx                            |    2 +-
 include/svx/svdotable.hxx                           |    2 +-
 include/svx/svxdlg.hxx                              |    2 +-
 sc/source/ui/inc/tabpages.hxx                       |    2 +-
 sc/source/ui/inc/tphf.hxx                           |    4 ++--
 sc/source/ui/inc/tptable.hxx                        |    2 +-
 sc/source/ui/pagedlg/tphf.cxx                       |    4 ++--
 sd/source/ui/dlg/paragr.cxx                         |    7 ++++---
 svx/source/accessibility/AccessibleControlShape.cxx |    2 +-
 svx/source/accessibility/charmapacc.cxx             |    2 +-
 svx/source/form/fmshimp.cxx                         |    4 ++--
 svx/source/inc/charmapacc.hxx                       |    2 +-
 svx/source/inc/datanavi.hxx                         |    4 ++--
 svx/source/svdraw/svdmrkv.cxx                       |    2 +-
 svx/source/svdraw/svdoole2.cxx                      |    2 +-
 svx/source/table/svdotable.cxx                      |    2 +-
 svx/source/tbxctrls/PaletteManager.cxx              |    4 ++--
 sw/source/ui/misc/pggrid.cxx                        |    5 +++--
 sw/source/uibase/inc/column.hxx                     |    2 +-
 sw/source/uibase/inc/drpcps.hxx                     |    2 +-
 sw/source/uibase/inc/frmpage.hxx                    |    4 ++--
 sw/source/uibase/inc/numpara.hxx                    |    2 +-
 sw/source/uibase/inc/pgfnote.hxx                    |    2 +-
 sw/source/uibase/inc/pggrid.hxx                     |    2 +-
 sw/source/uibase/inc/swuiccoll.hxx                  |    2 +-
 sw/source/uibase/inc/wrap.hxx                       |    2 +-
 68 files changed, 107 insertions(+), 102 deletions(-)

New commits:
commit a6c3f0b62a53692efcc4056fdaade9263e200756
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed Nov 6 13:39:33 2024 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Wed Nov 6 15:45:24 2024 +0100

    loplugin:passstuffbyref in svx
    
    Change-Id: Ic5fd72cb64208c278ffc129591cd3d1131efdc08
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176137
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/cui/source/dialogs/postdlg.cxx b/cui/source/dialogs/postdlg.cxx
index f7c251055e18..a4fddee5f4dc 100644
--- a/cui/source/dialogs/postdlg.cxx
+++ b/cui/source/dialogs/postdlg.cxx
@@ -107,9 +107,10 @@ void SvxPostItDialog::ShowLastAuthor(std::u16string_view 
rAuthor, std::u16string
     m_xLastEditFT->set_label( sTxt );
 }
 
-WhichRangesContainer SvxPostItDialog::GetRanges()
+const WhichRangesContainer & SvxPostItDialog::GetRanges()
 {
-    return WhichRangesContainer(svl::Items<SID_ATTR_POSTIT_AUTHOR, 
SID_ATTR_POSTIT_TEXT>);
+    static const auto gRanges = 
WhichRangesContainer(svl::Items<SID_ATTR_POSTIT_AUTHOR, SID_ATTR_POSTIT_TEXT>);
+    return gRanges;
 }
 
 void SvxPostItDialog::EnableTravel(bool bNext, bool bPrev)
diff --git a/cui/source/inc/TextColumnsPage.hxx 
b/cui/source/inc/TextColumnsPage.hxx
index af45c23c93ca..0aa6e2c9e800 100644
--- a/cui/source/inc/TextColumnsPage.hxx
+++ b/cui/source/inc/TextColumnsPage.hxx
@@ -31,7 +31,7 @@ public:
 
     static std::unique_ptr<SfxTabPage>
     Create(weld::Container* pPage, weld::DialogController* pController, const 
SfxItemSet*);
-    static WhichRangesContainer GetRanges() { return pRanges; }
+    static const WhichRangesContainer& GetRanges() { return pRanges; }
 
     virtual bool FillItemSet(SfxItemSet*) override;
     virtual void Reset(const SfxItemSet*) override;
diff --git a/cui/source/inc/align.hxx b/cui/source/inc/align.hxx
index a1761607cfd8..0154e8ab19da 100644
--- a/cui/source/inc/align.hxx
+++ b/cui/source/inc/align.hxx
@@ -58,7 +58,7 @@ public:
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* rAttrSet );
     explicit            AlignmentTabPage(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet& rCoreSet);
 
-    static WhichRangesContainer GetRanges() { return s_pRanges; }
+    static const WhichRangesContainer & GetRanges() { return s_pRanges; }
 
     virtual bool        FillItemSet( SfxItemSet* rSet ) override;
     virtual void        Reset( const SfxItemSet* rSet ) override;
diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx
index 3d50d69e95f4..af23e6f0a198 100644
--- a/cui/source/inc/backgrnd.hxx
+++ b/cui/source/inc/backgrnd.hxx
@@ -58,7 +58,7 @@ public:
     virtual ~SvxBkgTabPage() override;
 
     // returns the area of the which-values
-    static WhichRangesContainer GetRanges() { return pBkgRanges; }
+    static const WhichRangesContainer & GetRanges() { return pBkgRanges; }
 
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* );
     virtual bool FillItemSet( SfxItemSet* ) override;
diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx
index accb555930dc..67efd02ea178 100644
--- a/cui/source/inc/border.hxx
+++ b/cui/source/inc/border.hxx
@@ -83,7 +83,7 @@ public:
     virtual ~SvxBorderTabPage() override;
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController,
                                 const SfxItemSet* rAttrSet);
-    static WhichRangesContainer GetRanges() { return pRanges; }
+    static const WhichRangesContainer & GetRanges() { return pRanges; }
 
     virtual bool        FillItemSet( SfxItemSet* rCoreAttrs ) override;
     virtual void        Reset( const SfxItemSet* ) override;
diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx
index b484c7419b83..03567a7f5ba4 100644
--- a/cui/source/inc/chardlg.hxx
+++ b/cui/source/inc/chardlg.hxx
@@ -143,7 +143,7 @@ public:
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* rSet );
     virtual ~SvxCharNamePage() override;
 
-    static WhichRangesContainer GetRanges() { return pNameRanges; }
+    static const WhichRangesContainer & GetRanges() { return pNameRanges; }
 
     virtual void        Reset( const SfxItemSet* rSet ) override;
     virtual bool        FillItemSet( SfxItemSet* rSet ) override;
@@ -222,7 +222,7 @@ public:
     virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
 
 public:
-    static WhichRangesContainer GetRanges() { return pEffectsRanges; }
+    static const WhichRangesContainer & GetRanges() { return pEffectsRanges; }
 
     virtual void        Reset( const SfxItemSet* rSet ) override;
     virtual bool        FillItemSet( SfxItemSet* rSet ) override;
@@ -292,7 +292,7 @@ public:
     virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
 
 public:
-    static WhichRangesContainer GetRanges() { return pPositionRanges; }
+    static const WhichRangesContainer & GetRanges() { return pPositionRanges; }
 
     virtual void        Reset( const SfxItemSet* rSet ) override;
     virtual bool        FillItemSet( SfxItemSet* rSet ) override;
@@ -331,7 +331,7 @@ public:
     virtual void        ActivatePage( const SfxItemSet& rSet ) override;
     virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
 
-    static WhichRangesContainer GetRanges() { return pTwoLinesRanges; }
+    static const WhichRangesContainer & GetRanges() { return pTwoLinesRanges; }
 
     virtual void        Reset( const SfxItemSet* rSet ) override;
     virtual bool        FillItemSet( SfxItemSet* rSet ) override;
diff --git a/cui/source/inc/connect.hxx b/cui/source/inc/connect.hxx
index 73891d0ff8e6..103e83c071e8 100644
--- a/cui/source/inc/connect.hxx
+++ b/cui/source/inc/connect.hxx
@@ -63,7 +63,7 @@ public:
     virtual ~SvxConnectionPage() override;
 
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* );
-    static WhichRangesContainer GetRanges() { return pRanges; }
+    static const WhichRangesContainer & GetRanges() { return pRanges; }
 
     virtual bool        FillItemSet( SfxItemSet* ) override;
     virtual void        Reset( const SfxItemSet * ) override;
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index 3e810c5b0dbe..f0f5bdc28a5b 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -195,7 +195,7 @@ public:
     virtual ~SvxTransparenceTabPage() override;
 
     static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet*);
-    static WhichRangesContainer GetRanges() { return pTransparenceRanges; }
+    static const WhichRangesContainer & GetRanges() { return 
pTransparenceRanges; }
 
     virtual bool FillItemSet(SfxItemSet*) override;
     virtual void Reset(const SfxItemSet*) override;
@@ -275,7 +275,7 @@ public:
     static std::unique_ptr<SfxTabPage>
     CreateWithSlideBackground(weld::Container* pPage, weld::DialogController* 
pController,
                               const SfxItemSet*);
-    static WhichRangesContainer GetRanges() { return pAreaRanges; }
+    static const WhichRangesContainer & GetRanges() { return pAreaRanges; }
 
     virtual OUString GetAllStrings() override;
 
@@ -337,7 +337,7 @@ public:
     virtual ~SvxShadowTabPage() override;
 
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* );
-    static WhichRangesContainer GetRanges() { return pShadowRanges; }
+    static const WhichRangesContainer & GetRanges() { return pShadowRanges; }
 
     virtual bool FillItemSet( SfxItemSet* ) override;
     virtual void Reset( const SfxItemSet * ) override;
diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx
index 5cd3b0fdb044..ce2a9c4887c8 100644
--- a/cui/source/inc/cuitabline.hxx
+++ b/cui/source/inc/cuitabline.hxx
@@ -206,7 +206,7 @@ public:
     void    Construct();
 
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* );
-    static WhichRangesContainer GetRanges() { return pLineRanges; }
+    static const WhichRangesContainer & GetRanges() { return pLineRanges; }
 
     virtual bool FillItemSet( SfxItemSet* ) override;
     virtual void Reset( const SfxItemSet* ) override;
diff --git a/cui/source/inc/labdlg.hxx b/cui/source/inc/labdlg.hxx
index 5d7f778d5c38..b04c2a2b6d05 100644
--- a/cui/source/inc/labdlg.hxx
+++ b/cui/source/inc/labdlg.hxx
@@ -81,7 +81,7 @@ public:
     virtual ~SvxCaptionTabPage() override;
 
     static std::unique_ptr<SfxTabPage>  Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* );
-    static WhichRangesContainer GetRanges() { return pCaptionRanges; }
+    static const WhichRangesContainer & GetRanges() { return pCaptionRanges; }
 
     virtual bool        FillItemSet( SfxItemSet* ) override;
     virtual void        Reset( const SfxItemSet * ) override;
diff --git a/cui/source/inc/macropg.hxx b/cui/source/inc/macropg.hxx
index 1d9f2230f048..b40555bb76b9 100644
--- a/cui/source/inc/macropg.hxx
+++ b/cui/source/inc/macropg.hxx
@@ -92,7 +92,7 @@ public:
 
 // class SvxMacroAssignDlg --------------------------------------------------
 
-typedef WhichRangesContainer (*GetTabPageRanges)(); // gives international 
Which-values
+typedef const WhichRangesContainer & (*GetTabPageRanges)(); // gives 
international Which-values
 
 class SvxMacroAssignSingleTabDialog : public SfxSingleTabDialogController
 {
diff --git a/cui/source/inc/measure.hxx b/cui/source/inc/measure.hxx
index 7e18c6485556..c30e83ee1ed4 100644
--- a/cui/source/inc/measure.hxx
+++ b/cui/source/inc/measure.hxx
@@ -70,7 +70,7 @@ public:
     virtual ~SvxMeasurePage() override;
 
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* );
-    static WhichRangesContainer GetRanges() { return pRanges; }
+    static const WhichRangesContainer & GetRanges() { return pRanges; }
 
     virtual bool        FillItemSet( SfxItemSet* ) override;
     virtual void        Reset( const SfxItemSet * ) override;
diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx
index 13f1a88e9eab..2df21ef094bd 100644
--- a/cui/source/inc/numfmt.hxx
+++ b/cui/source/inc/numfmt.hxx
@@ -64,7 +64,7 @@ public:
                                     const SfxItemSet* rAttrSet );
     virtual ~SvxNumberFormatTabPage() override;
     // Returns area information.
-    static WhichRangesContainer GetRanges() { return pRanges; }
+    static const WhichRangesContainer & GetRanges() { return pRanges; }
 
     virtual bool            FillItemSet( SfxItemSet* rSet ) override;
     virtual void            Reset( const SfxItemSet* rSet ) override;
diff --git a/cui/source/inc/optasian.hxx b/cui/source/inc/optasian.hxx
index 31a622f7a50d..26d8b1bfe604 100644
--- a/cui/source/inc/optasian.hxx
+++ b/cui/source/inc/optasian.hxx
@@ -52,7 +52,7 @@ public:
 
     static std::unique_ptr<SfxTabPage>
     Create(weld::Container* pPage, weld::DialogController* pController, const 
SfxItemSet* rAttrSet);
-    static WhichRangesContainer GetRanges();
+    static const WhichRangesContainer& GetRanges();
 
     virtual OUString GetAllStrings() override;
 
diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx
index 151569ac4634..81acdd58a7c8 100644
--- a/cui/source/inc/page.hxx
+++ b/cui/source/inc/page.hxx
@@ -172,7 +172,7 @@ public:
     virtual ~SvxPageDescPage() override;
 
     // returns the range of the Which values
-    static WhichRangesContainer GetRanges() { return pRanges; }
+    static const WhichRangesContainer & GetRanges() { return pRanges; }
 
     virtual bool        FillItemSet( SfxItemSet* rOutSet ) override;
     virtual void        Reset( const SfxItemSet* rSet ) override;
diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx
index e219aa622e07..3a1ef5d455ad 100644
--- a/cui/source/inc/paragrph.hxx
+++ b/cui/source/inc/paragrph.hxx
@@ -102,7 +102,7 @@ public:
 
     DECL_LINK(ELRLoseFocusHdl, weld::MetricSpinButton&, void);
 
-    static WhichRangesContainer GetRanges() { return pStdRanges; }
+    static const WhichRangesContainer & GetRanges() { return pStdRanges; }
 
     virtual bool            FillItemSet( SfxItemSet* rSet ) override;
     virtual void            Reset( const SfxItemSet* rSet ) override;
@@ -165,8 +165,8 @@ public:
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* rSet );
     virtual ~SvxParaAlignTabPage() override;
 
-    static WhichRangesContainer GetRanges() { return pAlignRanges; }
-    static WhichRangesContainer GetSdrRanges() { return pSdrAlignRanges; }
+    static const WhichRangesContainer & GetRanges() { return pAlignRanges; }
+    static const WhichRangesContainer & GetSdrRanges() { return 
pSdrAlignRanges; }
 
     virtual bool            FillItemSet( SfxItemSet* rSet ) override;
     virtual void            Reset( const SfxItemSet* rSet ) override;
@@ -201,7 +201,7 @@ public:
                                 const SfxItemSet* rSet );
     virtual ~SvxExtParagraphTabPage() override;
 
-    static WhichRangesContainer GetRanges() { return pExtRanges; }
+    static const WhichRangesContainer & GetRanges() { return pExtRanges; }
 
     virtual bool        FillItemSet( SfxItemSet* rSet ) override;
     virtual void        Reset( const SfxItemSet* rSet ) override;
@@ -315,7 +315,7 @@ public:
     static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* rSet);
     virtual ~SvxAsianTabPage() override;
 
-    static WhichRangesContainer GetRanges();
+    static const WhichRangesContainer & GetRanges();
 
     virtual bool        FillItemSet( SfxItemSet* rSet ) override;
     virtual void        Reset( const SfxItemSet* rSet ) override;
diff --git a/cui/source/inc/postdlg.hxx b/cui/source/inc/postdlg.hxx
index 66fd07af6255..5c6da9c75abb 100644
--- a/cui/source/inc/postdlg.hxx
+++ b/cui/source/inc/postdlg.hxx
@@ -44,7 +44,7 @@ public:
                     bool bPrevNext);
     virtual ~SvxPostItDialog() override;
 
-    static WhichRangesContainer GetRanges();
+    static const WhichRangesContainer & GetRanges();
     const SfxItemSet*   GetOutputItemSet() const { return m_xOutSet.get(); }
 
     void                SetPrevHdl( const Link<SvxPostItDialog&,void>& rLink )
diff --git a/cui/source/inc/swpossizetabpage.hxx 
b/cui/source/inc/swpossizetabpage.hxx
index 037cede29326..782d892a65a4 100644
--- a/cui/source/inc/swpossizetabpage.hxx
+++ b/cui/source/inc/swpossizetabpage.hxx
@@ -120,7 +120,7 @@ public:
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* );
     virtual ~SvxSwPosSizeTabPage() override;
 
-    static WhichRangesContainer GetRanges();
+    static const WhichRangesContainer & GetRanges();
 
     virtual bool FillItemSet( SfxItemSet* ) override;
     virtual void Reset( const SfxItemSet * ) override;
diff --git a/cui/source/inc/tabstpge.hxx b/cui/source/inc/tabstpge.hxx
index 207b8b70503d..189e9a579373 100644
--- a/cui/source/inc/tabstpge.hxx
+++ b/cui/source/inc/tabstpge.hxx
@@ -65,7 +65,7 @@ public:
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* rSet );
     virtual ~SvxTabulatorTabPage() override;
 
-    static WhichRangesContainer GetRanges() { return pRanges; }
+    static const WhichRangesContainer & GetRanges() { return pRanges; }
 
     virtual bool        FillItemSet( SfxItemSet* rSet ) override;
     virtual void        Reset( const SfxItemSet* rSet ) override;
diff --git a/cui/source/inc/textanim.hxx b/cui/source/inc/textanim.hxx
index 010d3954716c..02a75bab849a 100644
--- a/cui/source/inc/textanim.hxx
+++ b/cui/source/inc/textanim.hxx
@@ -80,7 +80,7 @@ public:
     virtual ~SvxTextAnimationPage() override;
 
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* );
-    static WhichRangesContainer GetRanges() { return pRanges; }
+    static const WhichRangesContainer & GetRanges() { return pRanges; }
 
     virtual bool        FillItemSet( SfxItemSet* ) override;
     virtual void        Reset( const SfxItemSet * ) override;
diff --git a/cui/source/inc/textattr.hxx b/cui/source/inc/textattr.hxx
index a6a7f2bd6f46..cf828cfa6a5e 100644
--- a/cui/source/inc/textattr.hxx
+++ b/cui/source/inc/textattr.hxx
@@ -77,7 +77,7 @@ public:
     virtual ~SvxTextAttrPage() override;
 
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* );
-    static WhichRangesContainer GetRanges() { return pRanges; }
+    static const WhichRangesContainer & GetRanges() { return pRanges; }
 
     virtual bool        FillItemSet( SfxItemSet* ) override;
     virtual void        Reset( const SfxItemSet * ) override;
diff --git a/cui/source/inc/transfrm.hxx b/cui/source/inc/transfrm.hxx
index 78ffd84e2794..25464e9a0bc5 100644
--- a/cui/source/inc/transfrm.hxx
+++ b/cui/source/inc/transfrm.hxx
@@ -139,7 +139,7 @@ public:
     virtual ~SvxPositionSizeTabPage() override;
 
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* );
-    static WhichRangesContainer GetRanges() {  return pPosSizeRanges; }
+    static const WhichRangesContainer & GetRanges() {  return pPosSizeRanges; }
 
     virtual bool FillItemSet( SfxItemSet* ) override;
     virtual void Reset( const SfxItemSet * ) override;
@@ -195,7 +195,7 @@ public:
     virtual ~SvxAngleTabPage() override;
 
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* );
-    static WhichRangesContainer GetRanges() { return pAngleRanges; }
+    static const WhichRangesContainer & GetRanges() { return pAngleRanges; }
 
     virtual bool FillItemSet( SfxItemSet* ) override;
     virtual void Reset( const SfxItemSet * ) override;
@@ -239,7 +239,7 @@ public:
     virtual ~SvxSlantTabPage() override;
 
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* );
-    static WhichRangesContainer GetRanges() {  return pSlantRanges; }
+    static const WhichRangesContainer & GetRanges() {  return pSlantRanges; }
 
     virtual bool FillItemSet( SfxItemSet* ) override;
     virtual void Reset( const SfxItemSet * ) override;
diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx
index 66f7f9818851..c7d219993ae1 100644
--- a/cui/source/options/optasian.cxx
+++ b/cui/source/options/optasian.cxx
@@ -400,10 +400,11 @@ IMPL_LINK(SvxAsianLayoutPage, ModifyHdl, weld::Entry&, 
rEdit, void)
     pImpl->aConfig.SetStartEndChars( aLocale, bEnable ? &sStart : nullptr, 
bEnable ? &sEnd : nullptr);
 }
 
-WhichRangesContainer SvxAsianLayoutPage::GetRanges()
+const WhichRangesContainer & SvxAsianLayoutPage::GetRanges()
 {
     //no items are used
-    return WhichRangesContainer();
+    static const WhichRangesContainer gEmpty;
+    return gEmpty;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 56b697a046a6..33c3005eebaa 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -2648,9 +2648,10 @@ std::unique_ptr<SfxTabPage> 
SvxAsianTabPage::Create(weld::Container* pPage, weld
     return std::make_unique<SvxAsianTabPage>(pPage, pController, *rSet);
 }
 
-WhichRangesContainer SvxAsianTabPage::GetRanges()
+const WhichRangesContainer & SvxAsianTabPage::GetRanges()
 {
-    return WhichRangesContainer(svl::Items<SID_ATTR_PARA_SCRIPTSPACE, 
SID_ATTR_PARA_FORBIDDEN_RULES>);
+    static const auto gRanges = 
WhichRangesContainer(svl::Items<SID_ATTR_PARA_SCRIPTSPACE, 
SID_ATTR_PARA_FORBIDDEN_RULES>);
+    return gRanges;
 }
 
 bool SvxAsianTabPage::FillItemSet( SfxItemSet* rSet )
diff --git a/cui/source/tabpages/swpossizetabpage.cxx 
b/cui/source/tabpages/swpossizetabpage.cxx
index 6789caaf477f..d84fb7131a91 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -743,7 +743,7 @@ std::unique_ptr<SfxTabPage> 
SvxSwPosSizeTabPage::Create(weld::Container* pPage,
     return std::make_unique<SvxSwPosSizeTabPage>(pPage, pController, *rSet);
 }
 
-WhichRangesContainer SvxSwPosSizeTabPage::GetRanges()
+const WhichRangesContainer & SvxSwPosSizeTabPage::GetRanges()
 {
     static const WhichRangesContainer ranges(svl::Items<
         SID_ATTR_TRANSFORM_POS_X, SID_ATTR_TRANSFORM_POS_Y,
diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx
index 0a7f653b0180..4f7cd0f29c8f 100644
--- a/include/sfx2/basedlgs.hxx
+++ b/include/sfx2/basedlgs.hxx
@@ -82,7 +82,7 @@ public:
     SfxBindings&            GetBindings() const { return *m_pBindings; }
 };
 
-typedef WhichRangesContainer (*GetTabPageRanges)(); // provides international 
Which values
+typedef const WhichRangesContainer & (*GetTabPageRanges)(); // provides 
international Which values
 
 class SFX2_DLLPUBLIC SfxOkDialogController : public SfxDialogController
 {
diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index 828054bc562d..336fe80c11dd 100644
--- a/include/sfx2/tabdlg.hxx
+++ b/include/sfx2/tabdlg.hxx
@@ -37,7 +37,7 @@
 class SfxTabPage;
 
 typedef std::unique_ptr<SfxTabPage> (*CreateTabPage)(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet *rAttrSet);
-typedef WhichRangesContainer (*GetTabPageRanges)(); // provides international 
Which-value
+typedef const WhichRangesContainer & (*GetTabPageRanges)(); // provides 
international Which-value
 struct TabPageImpl;
 
 struct TabDlg_Impl;
diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx
index 5882a7c465b7..5dd053f5a227 100644
--- a/include/svx/PaletteManager.hxx
+++ b/include/svx/PaletteManager.hxx
@@ -68,7 +68,7 @@ public:
     sal_Int32   GetPalette() const;
     sal_Int32   GetPaletteCount() const { return mnNumOfPalettes; }
     OUString    GetPaletteName();
-    OUString    GetSelectedPalettePath();
+    const OUString & GetSelectedPalettePath();
 
     tools::Long        GetColorCount() const;
     tools::Long        GetRecentColorCount() const;
diff --git a/include/svx/annotation/Annotation.hxx 
b/include/svx/annotation/Annotation.hxx
index ba2021a70ec6..3e442dc90d73 100644
--- a/include/svx/annotation/Annotation.hxx
+++ b/include/svx/annotation/Annotation.hxx
@@ -135,19 +135,19 @@ public:
     }
 
     // Changes without triggering notification broadcast
-    css::geometry::RealPoint2D GetPosition() const { return m_Position; }
+    const css::geometry::RealPoint2D& GetPosition() const { return m_Position; 
}
     void SetPosition(const css::geometry::RealPoint2D& rValue) { m_Position = 
rValue; }
 
-    css::geometry::RealSize2D GetSize() const { return m_Size; }
+    const css::geometry::RealSize2D& GetSize() const { return m_Size; }
     void SetSize(const css::geometry::RealSize2D& rValue) { m_Size = rValue; }
 
-    OUString GetAuthor() const { return m_Author; }
+    const OUString& GetAuthor() const { return m_Author; }
     void SetAuthor(const OUString& rValue) { m_Author = rValue; }
 
-    OUString GetInitials() const { return m_Initials; }
+    const OUString& GetInitials() const { return m_Initials; }
     void SetInitials(const OUString& rValue) { m_Initials = rValue; }
 
-    css::util::DateTime GetDateTime() const { return m_DateTime; }
+    const css::util::DateTime& GetDateTime() const { return m_DateTime; }
     void SetDateTime(const css::util::DateTime& rValue) { m_DateTime = rValue; 
}
 
     virtual css::uno::Reference<css::text::XText> SAL_CALL getTextRange() 
override;
@@ -160,7 +160,7 @@ public:
 
     OUString GetText();
     void SetText(OUString const& rText);
-    rtl::Reference<sdr::annotation::TextApiObject> getTextApiObject() { return 
m_TextRange; }
+    const rtl::Reference<sdr::annotation::TextApiObject>& getTextApiObject() { 
return m_TextRange; }
 
     SdrModel* GetModel() const;
     SdrPage const* getPage() const { return mpPage; }
diff --git a/include/svx/colorbox.hxx b/include/svx/colorbox.hxx
index fe134531d39a..04d1c740f2ff 100644
--- a/include/svx/colorbox.hxx
+++ b/include/svx/colorbox.hxx
@@ -63,7 +63,7 @@ public:
     void SetSlotId(sal_uInt16 nSlotId, bool bShowNoneButton = false);
 
     Color const& GetSelectEntryColor() const { return 
m_aSelectedColor.m_aColor; }
-    NamedColor GetSelectedEntry() const { return m_aSelectedColor; }
+    const NamedColor& GetSelectedEntry() const { return m_aSelectedColor; }
     const NamedColor& GetSelectedEntryThemedColor() const { return 
m_aSelectedColor; }
 
     void SelectEntry(const NamedColor& rColor);
diff --git a/include/svx/hdft.hxx b/include/svx/hdft.hxx
index 6890e23fc78b..091137eed358 100644
--- a/include/svx/hdft.hxx
+++ b/include/svx/hdft.hxx
@@ -97,7 +97,7 @@ class SVX_DLLPUBLIC SvxHeaderPage final : public SvxHFPage
 public:
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* rSet );
     // returns the Which values to the range
-    static WhichRangesContainer GetRanges() { return pRanges; }
+    static const WhichRangesContainer & GetRanges() { return pRanges; }
     SVX_DLLPRIVATE SvxHeaderPage(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet& rSet);
 };
 
@@ -105,7 +105,7 @@ class SVX_DLLPUBLIC SvxFooterPage final : public SvxHFPage
 {
 public:
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* rSet );
-    static WhichRangesContainer GetRanges() { return pRanges; }
+    static const WhichRangesContainer & GetRanges() { return pRanges; }
     SVX_DLLPRIVATE SvxFooterPage(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet& rSet);
 };
 
diff --git a/include/svx/numvset.hxx b/include/svx/numvset.hxx
index 7b96ffa6ee01..d54ad8f17a19 100644
--- a/include/svx/numvset.hxx
+++ b/include/svx/numvset.hxx
@@ -86,7 +86,7 @@ public:
             css::uno::Reference<css::text::XNumberingFormatter> const & 
xFormatter,
             const css::lang::Locale& rLocale);
 
-    std::vector<std::pair<OUString, OUString>> GetCustomBullets() { return 
maCustomBullets; }
+    const std::vector<std::pair<OUString, OUString>> & GetCustomBullets() { 
return maCustomBullets; }
     void SetCustomBullets(const std::vector<std::pair<OUString, OUString>>& 
rCustomBullets);
 
     virtual FactoryFunction GetUITestFactory() const override;
diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx
index 1f89c237c1e8..aa56e05f3e0c 100644
--- a/include/svx/svdoole2.hxx
+++ b/include/svx/svdoole2.hxx
@@ -172,7 +172,7 @@ public:
     void SetGraphicToObj( const css::uno::Reference< css::io::XInputStream >& 
xGrStream,
                           const OUString& aMediaType );
 
-    css::uno::Reference< css::frame::XModel > GetParentXModel()  const;
+    const css::uno::Reference< css::frame::XModel > & GetParentXModel()  const;
     bool CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHeight, 
Size& aObjAreaSize );
     bool AddOwnLightClient();
 
diff --git a/include/svx/svdotable.hxx b/include/svx/svdotable.hxx
index e22ef60a48b7..54688c17e499 100644
--- a/include/svx/svdotable.hxx
+++ b/include/svx/svdotable.hxx
@@ -118,7 +118,7 @@ public:
 
     css::uno::Reference< css::table::XTable > getTable() const;
     /// Get the concrete UNO class for the table
-    rtl::Reference< sdr::table::TableModel > getUnoTable() const;
+    const rtl::Reference< sdr::table::TableModel > & getUnoTable() const;
 
     bool isValid( const sdr::table::CellPos& rPos ) const;
     static CellPos getFirstCell();
diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx
index b92adec13b3d..a2ef0c03a47e 100644
--- a/include/svx/svxdlg.hxx
+++ b/include/svx/svxdlg.hxx
@@ -55,7 +55,7 @@ class SdrObject;
 class SvxSpellWrapper;
 struct FmSearchContext;
 
-typedef WhichRangesContainer (*DialogGetRanges)();
+typedef const WhichRangesContainer & (*DialogGetRanges)();
 
 typedef ::std::vector< OUString > TargetList;
 
diff --git a/sc/source/ui/inc/tabpages.hxx b/sc/source/ui/inc/tabpages.hxx
index 37d751523469..4a613f344b12 100644
--- a/sc/source/ui/inc/tabpages.hxx
+++ b/sc/source/ui/inc/tabpages.hxx
@@ -30,7 +30,7 @@ public:
                                               const SfxItemSet* rAttrSet);
     virtual ~ScTabPageProtection() override;
 
-    static WhichRangesContainer GetRanges () { return pProtectionRanges; }
+    static const WhichRangesContainer & GetRanges () { return 
pProtectionRanges; }
     virtual bool        FillItemSet     ( SfxItemSet* rCoreAttrs ) override;
     virtual void        Reset           ( const SfxItemSet* ) override;
 
diff --git a/sc/source/ui/inc/tphf.hxx b/sc/source/ui/inc/tphf.hxx
index 9af97f6d7080..f5e46ded1478 100644
--- a/sc/source/ui/inc/tphf.hxx
+++ b/sc/source/ui/inc/tphf.hxx
@@ -56,7 +56,7 @@ class ScHeaderPage : public ScHFPage
 public:
     static std::unique_ptr<SfxTabPage>  Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* rSet );
     ScHeaderPage(weld::Container* pPage, weld::DialogController* pController, 
const SfxItemSet& rSet);
-    static WhichRangesContainer GetRanges();
+    static const WhichRangesContainer & GetRanges();
 };
 
 class ScFooterPage : public ScHFPage
@@ -64,7 +64,7 @@ class ScFooterPage : public ScHFPage
 public:
     static std::unique_ptr<SfxTabPage>  Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* rSet );
     ScFooterPage(weld::Container* pPage, weld::DialogController* pController, 
const SfxItemSet& rSet);
-    static WhichRangesContainer GetRanges();
+    static const WhichRangesContainer & GetRanges();
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/tptable.hxx b/sc/source/ui/inc/tptable.hxx
index e843f769cb42..9e98c050a20e 100644
--- a/sc/source/ui/inc/tptable.hxx
+++ b/sc/source/ui/inc/tptable.hxx
@@ -29,7 +29,7 @@ public:
     static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* rCoreSet);
     virtual         ~ScTablePage() override;
 
-    static WhichRangesContainer GetRanges () { return pPageTableRanges; }
+    static const WhichRangesContainer & GetRanges () { return 
pPageTableRanges; }
     virtual bool        FillItemSet     ( SfxItemSet* rCoreSet ) override;
     virtual void        Reset           ( const SfxItemSet* rCoreSet ) 
override;
     virtual DeactivateRC   DeactivatePage  ( SfxItemSet* pSet ) override;
diff --git a/sc/source/ui/pagedlg/tphf.cxx b/sc/source/ui/pagedlg/tphf.cxx
index dfd8868e3397..b6421f2b948e 100644
--- a/sc/source/ui/pagedlg/tphf.cxx
+++ b/sc/source/ui/pagedlg/tphf.cxx
@@ -238,7 +238,7 @@ std::unique_ptr<SfxTabPage> 
ScHeaderPage::Create(weld::Container* pPage, weld::D
     return std::make_unique<ScHeaderPage>(pPage, pController, *rCoreSet);
 }
 
-WhichRangesContainer ScHeaderPage::GetRanges()
+const WhichRangesContainer & ScHeaderPage::GetRanges()
 {
     return SvxHeaderPage::GetRanges();
 }
@@ -254,7 +254,7 @@ std::unique_ptr<SfxTabPage> 
ScFooterPage::Create(weld::Container* pPage, weld::D
     return std::make_unique<ScFooterPage>(pPage, pController, *rCoreSet);
 }
 
-WhichRangesContainer ScFooterPage::GetRanges()
+const WhichRangesContainer & ScFooterPage::GetRanges()
 {
     return SvxHeaderPage::GetRanges();
 }
diff --git a/sd/source/ui/dlg/paragr.cxx b/sd/source/ui/dlg/paragr.cxx
index 6a514cf2f937..a41e3c99d56f 100644
--- a/sd/source/ui/dlg/paragr.cxx
+++ b/sd/source/ui/dlg/paragr.cxx
@@ -37,7 +37,7 @@ public:
     SdParagraphNumTabPage(weld::Container* pPage, weld::DialogController* 
pController, const SfxItemSet& rSet);
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* rSet );
 
-    static WhichRangesContainer GetRanges();
+    static const WhichRangesContainer & GetRanges();
 
     virtual bool        FillItemSet( SfxItemSet* rSet ) override;
     virtual void        Reset( const SfxItemSet* rSet ) override;
@@ -69,9 +69,10 @@ std::unique_ptr<SfxTabPage> 
SdParagraphNumTabPage::Create(weld::Container* pPage
     return std::make_unique<SdParagraphNumTabPage>(pPage, pController, 
*rAttrSet);
 }
 
-WhichRangesContainer SdParagraphNumTabPage::GetRanges()
+const WhichRangesContainer & SdParagraphNumTabPage::GetRanges()
 {
-    return WhichRangesContainer(svl::Items<ATTR_PARANUMBERING_START, 
ATTR_PARANUMBERING_END>);
+    static const auto gRanges = 
WhichRangesContainer(svl::Items<ATTR_PARANUMBERING_START, 
ATTR_PARANUMBERING_END>);
+    return gRanges;
 }
 
 bool SdParagraphNumTabPage::FillItemSet( SfxItemSet* rSet )
diff --git a/svx/source/accessibility/AccessibleControlShape.cxx 
b/svx/source/accessibility/AccessibleControlShape.cxx
index 28d2cdf3a001..ed04609bbfbd 100644
--- a/svx/source/accessibility/AccessibleControlShape.cxx
+++ b/svx/source/accessibility/AccessibleControlShape.cxx
@@ -67,7 +67,7 @@ namespace
     constexpr OUString LABEL_CONTROL_PROPERTY_NAME = u"LabelControl"_ustr;
 
     // return the property which should be used as AccessibleName
-    OUString lcl_getPreferredAccNameProperty( const Reference< 
XPropertySetInfo >& _rxPSI )
+    const OUString & lcl_getPreferredAccNameProperty( const Reference< 
XPropertySetInfo >& _rxPSI )
     {
         if ( _rxPSI.is() && _rxPSI->hasPropertyByName( LABEL_PROPERTY_NAME ) )
             return LABEL_PROPERTY_NAME;
diff --git a/svx/source/accessibility/charmapacc.cxx 
b/svx/source/accessibility/charmapacc.cxx
index 191f71efc4ad..0f1fbf2b7f42 100644
--- a/svx/source/accessibility/charmapacc.cxx
+++ b/svx/source/accessibility/charmapacc.cxx
@@ -55,7 +55,7 @@ SvxShowCharSetItem::~SvxShowCharSetItem()
     }
 }
 
-rtl::Reference<SvxShowCharSetItemAcc> SvxShowCharSetItem::GetAccessible()
+const rtl::Reference<SvxShowCharSetItemAcc> & 
SvxShowCharSetItem::GetAccessible()
 {
     if( !m_xItem.is() )
     {
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index 8fd0b05635d5..7f3e8f5a7956 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -431,7 +431,7 @@ namespace
     }
 
 
-    OUString getServiceNameByControlType(SdrObjKind nType)
+    const OUString & getServiceNameByControlType(SdrObjKind nType)
     {
         switch (nType)
         {
@@ -459,7 +459,7 @@ namespace
             case SdrObjKind::FormNavigationBar   : return 
FM_SUN_COMPONENT_NAVIGATIONBAR;
             default:;
         }
-        return OUString();
+        return EMPTY_OUSTRING;
     }
 
 }
diff --git a/svx/source/inc/charmapacc.hxx b/svx/source/inc/charmapacc.hxx
index 43ab846d5b6f..995aa97ae866 100644
--- a/svx/source/inc/charmapacc.hxx
+++ b/svx/source/inc/charmapacc.hxx
@@ -52,7 +52,7 @@ namespace svx
         SvxShowCharSetItem( SvxShowCharSet& rParent, SvxShowCharSetAcc* 
_pParent, sal_uInt16 _nPos );
         ~SvxShowCharSetItem();
 
-        rtl::Reference< SvxShowCharSetItemAcc > GetAccessible();
+        const rtl::Reference< SvxShowCharSetItemAcc > & GetAccessible();
     };
 
 
diff --git a/svx/source/inc/datanavi.hxx b/svx/source/inc/datanavi.hxx
index c3d0564a90f3..fe5a51508d1f 100644
--- a/svx/source/inc/datanavi.hxx
+++ b/svx/source/inc/datanavi.hxx
@@ -112,7 +112,7 @@ namespace svxform
 
         /** convert submission replace string from UI to API.
             Use 'none' as default. */
-        OUString toAPI( std::u16string_view rStr ) const
+        const OUString & toAPI( std::u16string_view rStr ) const
         {
             if( rStr == m_sDoc_UI )
                 return m_sDoc_API;
@@ -156,7 +156,7 @@ namespace svxform
         }
 
         /** convert from UI to API; put is default */
-        OUString toAPI( std::u16string_view rStr ) const
+        const OUString & toAPI( std::u16string_view rStr ) const
         {
             if( rStr == m_sGet_UI )
                 return m_sGet_API;
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index d63556a50d3d..0c8e1c2f74bc 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -812,7 +812,7 @@ namespace
         {
         }
 
-        basegfx::B2DRange getTextBounds(const sdr::contact::ViewObjectContact 
&rVOC, sdr::contact::DisplayInfo &raDisplayInfo)
+        const basegfx::B2DRange & getTextBounds(const 
sdr::contact::ViewObjectContact &rVOC, sdr::contact::DisplayInfo &raDisplayInfo)
         {
             this->process(rVOC.getPrimitive2DSequence(raDisplayInfo));
             return maTextRange;
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 3212314f4ade..e744fc613a27 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -1914,7 +1914,7 @@ bool SdrOle2Obj::IsCalc() const
         || SvGlobalName(SO3_SC_CLASSID) == aObjClsId;
 }
 
-uno::Reference< frame::XModel > SdrOle2Obj::GetParentXModel() const
+const uno::Reference< frame::XModel > & SdrOle2Obj::GetParentXModel() const
 {
     return getSdrModelFromSdrObject().getUnoModel();
 }
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index b300c4284c38..455d561f283a 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -912,7 +912,7 @@ Reference< XTable > SdrTableObj::getTable() const
     return mpImpl->mxTable;
 }
 
-rtl::Reference< TableModel > SdrTableObj::getUnoTable() const
+const rtl::Reference< TableModel > & SdrTableObj::getUnoTable() const
 {
     return mpImpl->mxTable;
 }
diff --git a/svx/source/tbxctrls/PaletteManager.cxx 
b/svx/source/tbxctrls/PaletteManager.cxx
index 15799432eedf..894d38808f84 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -350,12 +350,12 @@ OUString PaletteManager::GetPaletteName()
     return aNames[mnCurrentPalette];
 }
 
-OUString PaletteManager::GetSelectedPalettePath()
+const OUString & PaletteManager::GetSelectedPalettePath()
 {
     if (mnCurrentPalette < m_Palettes.size() && mnCurrentPalette != 0)
         return m_Palettes[mnCurrentPalette - 1]->GetPath();
     else
-        return OUString();
+        return EMPTY_OUSTRING;
 }
 
 tools::Long PaletteManager::GetColorCount() const
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index 7339d2695018..64dbdf825277 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -350,9 +350,10 @@ void SwTextGridPage::SetLinesOrCharsRanges(weld::Label& 
rField, const sal_Int32
     rField.set_label(aFieldStr);
 }
 
-WhichRangesContainer SwTextGridPage::GetRanges()
+const WhichRangesContainer & SwTextGridPage::GetRanges()
 {
-    return WhichRangesContainer(svl::Items<RES_TEXTGRID, RES_TEXTGRID>);
+    static const auto gRanges = WhichRangesContainer(svl::Items<RES_TEXTGRID, 
RES_TEXTGRID>);
+    return gRanges;
 }
 
 IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, weld::SpinButton&, rField, 
void)
diff --git a/sw/source/uibase/inc/column.hxx b/sw/source/uibase/inc/column.hxx
index d45331cddfcd..6eabca9db70c 100644
--- a/sw/source/uibase/inc/column.hxx
+++ b/sw/source/uibase/inc/column.hxx
@@ -171,7 +171,7 @@ public:
     virtual ~SwColumnPage() override;
 
     static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet *rSet);
-    static WhichRangesContainer GetRanges() { return s_aPageRg; }
+    static const WhichRangesContainer & GetRanges() { return s_aPageRg; }
 
     virtual bool    FillItemSet(SfxItemSet *rSet) override;
     virtual void    Reset(const SfxItemSet *rSet) override;
diff --git a/sw/source/uibase/inc/drpcps.hxx b/sw/source/uibase/inc/drpcps.hxx
index afc7c6482253..4542ebc24749 100644
--- a/sw/source/uibase/inc/drpcps.hxx
+++ b/sw/source/uibase/inc/drpcps.hxx
@@ -151,7 +151,7 @@ public:
     virtual ~SwDropCapsPage() override;
 
     static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet *rSet);
-    static WhichRangesContainer GetRanges() { return s_aPageRg; }
+    static const WhichRangesContainer & GetRanges() { return s_aPageRg; }
 
 
     virtual bool FillItemSet(      SfxItemSet *rSet) override;
diff --git a/sw/source/uibase/inc/frmpage.hxx b/sw/source/uibase/inc/frmpage.hxx
index 0ee921dc05aa..567b11a79c81 100644
--- a/sw/source/uibase/inc/frmpage.hxx
+++ b/sw/source/uibase/inc/frmpage.hxx
@@ -197,7 +197,7 @@ public:
     virtual ~SwFramePage() override;
 
     static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet *rSet);
-    static WhichRangesContainer GetRanges() { return s_aPageRg; }
+    static const WhichRangesContainer & GetRanges() { return s_aPageRg; }
 
     virtual bool FillItemSet(SfxItemSet *rSet) override;
     virtual void Reset(const SfxItemSet *rSet) override;
@@ -324,7 +324,7 @@ public:
     virtual ~SwFrameAddPage() override;
 
     static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet *rSet);
-    static WhichRangesContainer GetRanges() { return s_aAddPgRg; }
+    static const WhichRangesContainer & GetRanges() { return s_aAddPgRg; }
 
     virtual bool FillItemSet(SfxItemSet *rSet) override;
     virtual void Reset(const SfxItemSet *rSet) override;
diff --git a/sw/source/uibase/inc/numpara.hxx b/sw/source/uibase/inc/numpara.hxx
index f6da0b9f7174..cb6524f3eeff 100644
--- a/sw/source/uibase/inc/numpara.hxx
+++ b/sw/source/uibase/inc/numpara.hxx
@@ -70,7 +70,7 @@ public:
 
     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, 
weld::DialogController* pController,
                                       const SfxItemSet* rSet );
-    static WhichRangesContainer GetRanges() { return s_aPageRg; }
+    static const WhichRangesContainer & GetRanges() { return s_aPageRg; }
 
     virtual bool        FillItemSet( SfxItemSet* rSet ) override;
     virtual void        Reset( const SfxItemSet* rSet ) override;
diff --git a/sw/source/uibase/inc/pgfnote.hxx b/sw/source/uibase/inc/pgfnote.hxx
index 0abb09a80a9d..77b367230c67 100644
--- a/sw/source/uibase/inc/pgfnote.hxx
+++ b/sw/source/uibase/inc/pgfnote.hxx
@@ -32,7 +32,7 @@ public:
     static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet *rSet);
     virtual ~SwFootNotePage() override;
 
-    static WhichRangesContainer GetRanges() { return s_aPageRg; }
+    static const WhichRangesContainer & GetRanges() { return s_aPageRg; }
 
     virtual bool FillItemSet(SfxItemSet *rSet) override;
     virtual void Reset(const SfxItemSet *rSet) override;
diff --git a/sw/source/uibase/inc/pggrid.hxx b/sw/source/uibase/inc/pggrid.hxx
index 58d5c9467188..52964df5b5cc 100644
--- a/sw/source/uibase/inc/pggrid.hxx
+++ b/sw/source/uibase/inc/pggrid.hxx
@@ -76,7 +76,7 @@ public:
     virtual ~SwTextGridPage() override;
 
     static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet *rSet);
-    static WhichRangesContainer GetRanges();
+    static const WhichRangesContainer & GetRanges();
 
     virtual bool    FillItemSet(SfxItemSet *rSet) override;
     virtual void    Reset(const SfxItemSet *rSet) override;
diff --git a/sw/source/uibase/inc/swuiccoll.hxx 
b/sw/source/uibase/inc/swuiccoll.hxx
index 74e6920b0275..8bdf59a22e40 100644
--- a/sw/source/uibase/inc/swuiccoll.hxx
+++ b/sw/source/uibase/inc/swuiccoll.hxx
@@ -56,7 +56,7 @@ public:
     virtual ~SwCondCollPage() override;
 
     static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet *rSet);
-    static WhichRangesContainer GetRanges() { return s_aPageRg; }
+    static const WhichRangesContainer & GetRanges() { return s_aPageRg; }
 
     virtual bool FillItemSet(      SfxItemSet *rSet) override;
     virtual void Reset      (const SfxItemSet *rSet) override;
diff --git a/sw/source/uibase/inc/wrap.hxx b/sw/source/uibase/inc/wrap.hxx
index f9ee8a69131f..d2142deabc6a 100644
--- a/sw/source/uibase/inc/wrap.hxx
+++ b/sw/source/uibase/inc/wrap.hxx
@@ -96,7 +96,7 @@ public:
     virtual bool    FillItemSet(SfxItemSet *rSet) override;
     virtual void    Reset(const SfxItemSet *rSet) override;
 
-    static WhichRangesContainer GetRanges() { return s_aWrapPageRg; }
+    static const WhichRangesContainer & GetRanges() { return s_aWrapPageRg; }
     void     SetNewFrame(bool bNewFrame) { m_bNew = bNewFrame; }
     void     SetFormatUsed(bool bFormat, bool bDrawMode) { m_bFormat = 
bFormat; m_bDrawMode = bDrawMode; }
     void     SetShell(SwWrtShell* pSh) { m_pWrtSh = pSh; }
commit d5b55513cdc05e8d622897201e233eb0ad5147b7
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed Nov 6 13:39:01 2024 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Wed Nov 6 15:45:14 2024 +0100

    loplugin:passstuffbyref in basic
    
    Change-Id: I1aee08f0ff2a3dabcedc49a31e7ff4de9428007e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176136
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 17e5d1760bbc..4173ad9c694c 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -1215,14 +1215,14 @@ bool BasicManager::HasLib( std::u16string_view rName ) 
const
     return false;
 }
 
-OUString BasicManager::GetLibName( sal_uInt16 nLib )
+const OUString & BasicManager::GetLibName( sal_uInt16 nLib )
 {
     DBG_ASSERT(  nLib < maLibs.size(), "Lib?!" );
     if ( nLib < maLibs.size() )
     {
         return maLibs[nLib]->GetLibName();
     }
-    return OUString();
+    return EMPTY_OUSTRING;
 }
 
 bool BasicManager::LoadLib( sal_uInt16 nLib )
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index e2fe5dfb3059..58ded6c8c3d1 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -1712,7 +1712,7 @@ ErrCode StarBASIC::GetErrBasic()
 }
 
 // make the additional message for the RTL function error accessible
-OUString StarBASIC::GetErrorMsg()
+const OUString & StarBASIC::GetErrorMsg()
 {
     if( GetSbData()->pInst )
     {
@@ -1720,7 +1720,7 @@ OUString StarBASIC::GetErrorMsg()
     }
     else
     {
-        return OUString();
+        return EMPTY_OUSTRING;
     }
 }
 
diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx
index 0040e55613d5..6f8b53ed0d5a 100644
--- a/basic/source/comp/symtbl.cxx
+++ b/basic/source/comp/symtbl.cxx
@@ -40,10 +40,10 @@ SbiStringPool::SbiStringPool( )
 SbiStringPool::~SbiStringPool()
 {}
 
-OUString SbiStringPool::Find( sal_uInt32 n ) const
+const OUString & SbiStringPool::Find( sal_uInt32 n ) const
 {
     if( n == 0 || n > aData.size() )
-        return OUString();
+        return EMPTY_OUSTRING;
     else
         return aData[n - 1];
 }
diff --git a/basic/source/inc/symtbl.hxx b/basic/source/inc/symtbl.hxx
index 56f68d4fe882..eeb37844dbd1 100644
--- a/basic/source/inc/symtbl.hxx
+++ b/basic/source/inc/symtbl.hxx
@@ -42,7 +42,7 @@ public:
     sal_uInt32 GetSize() const { return aData.size(); }
     short Add( const OUString& );
     short Add( double, SbxDataType );
-    OUString Find( sal_uInt32 ) const;
+    const OUString & Find( sal_uInt32 ) const;
 };
 
 
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index d0cf61f9fa42..597537385c7c 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -3564,7 +3564,7 @@ void SbRtl_VarType(StarBASIC *, SbxArray & rPar, bool)
 }
 
 // Exported function
-OUString getBasicTypeName( SbxDataType eType )
+const OUString & getBasicTypeName( SbxDataType eType )
 {
     static constexpr OUString pTypeNames[] =
     {
diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx
index 6cfbefad5500..f4025745e3d0 100644
--- a/basic/source/sbx/sbxarray.cxx
+++ b/basic/source/sbx/sbxarray.cxx
@@ -144,17 +144,17 @@ void SbxArray::Put( SbxVariable* pVar, sal_uInt32 nIdx )
     }
 }
 
-OUString SbxArray::GetAlias( sal_uInt32 nIdx )
+const OUString & SbxArray::GetAlias( sal_uInt32 nIdx )
 {
     if( !CanRead() )
     {
         SetError( ERRCODE_BASIC_PROP_WRITEONLY );
-        return OUString();
+        return EMPTY_OUSTRING;
     }
     SbxVarEntry& rRef = reinterpret_cast<SbxVarEntry&>(GetRef( nIdx ));
 
     if (!rRef.maAlias)
-        return OUString();
+        return EMPTY_OUSTRING;
 
     return *rRef.maAlias;
 }
diff --git a/include/basic/basmgr.hxx b/include/basic/basmgr.hxx
index c9633425c4bc..b650c6f6cba7 100644
--- a/include/basic/basmgr.hxx
+++ b/include/basic/basmgr.hxx
@@ -127,7 +127,7 @@ public:
     StarBASIC* GetLib( std::u16string_view rName ) const;
     sal_uInt16      GetLibId( std::u16string_view rName ) const;
 
-    OUString        GetLibName( sal_uInt16 nLib );
+    const OUString &        GetLibName( sal_uInt16 nLib );
 
     /** announces the library containers which belong to this BasicManager
 
diff --git a/include/basic/sbdef.hxx b/include/basic/sbdef.hxx
index 0fe4ce52b686..a82fc1c9461d 100644
--- a/include/basic/sbdef.hxx
+++ b/include/basic/sbdef.hxx
@@ -28,7 +28,7 @@ class ErrCode;
 
 // Returns type name for Basic type, array flag is ignored
 // implementation: basic/source/runtime/methods.cxx
-BASIC_DLLPUBLIC OUString getBasicTypeName( SbxDataType eType );
+BASIC_DLLPUBLIC const OUString & getBasicTypeName( SbxDataType eType );
 
 // Returns type name for Basic objects, especially
 // important for SbUnoObj instances
diff --git a/include/basic/sbstar.hxx b/include/basic/sbstar.hxx
index 5c4779de5949..f75845e93be7 100644
--- a/include/basic/sbstar.hxx
+++ b/include/basic/sbstar.hxx
@@ -93,7 +93,7 @@ public:
     static bool     IsRunning();
     static ErrCode  GetErrBasic();
     // #66536 make additional message accessible by RTL function Error
-    static OUString GetErrorMsg();
+    static const OUString & GetErrorMsg();
     static sal_Int32 GetErl();
 
     virtual SbxVariable* Find( const OUString&, SbxClassType ) override;
diff --git a/include/basic/sbx.hxx b/include/basic/sbx.hxx
index eb9007232391..dc4fdb7934e3 100644
--- a/include/basic/sbx.hxx
+++ b/include/basic/sbx.hxx
@@ -122,7 +122,7 @@ public:
     void                 Remove( sal_uInt32 );
     void                 Remove( SbxVariable const * );
     void                 Merge( SbxArray* );
-    OUString GetAlias(sal_uInt32);
+    const OUString & GetAlias(sal_uInt32);
     void PutAlias(const OUString&, sal_uInt32);
     SbxVariable* Find( const OUString&, SbxClassType );
 };

Reply via email to