loplugin:passstuffbyref improved return in xmloff,sfx2

Change-Id: I7161dfca77f944027bd20614616e22d6acfa27cd
Reviewed-on: https://gerrit.libreoffice.org/47081
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/compilerplugins/clang/passstuffbyref.cxx b/compilerplugins/clang/passstuffbyref.cxx
index e152ace..a9c1348 100644
--- a/compilerplugins/clang/passstuffbyref.cxx
+++ b/compilerplugins/clang/passstuffbyref.cxx
@@ -249,7 +249,8 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C
            .GlobalNamespace())
        || (dc.MemberFunction().Class("Submission").Namespace("xforms")
            .GlobalNamespace())
        || (dc.Function("TopLeft").Class("SwRect").GlobalNamespace()))
        || (dc.Function("TopLeft").Class("SwRect").GlobalNamespace())
        || (dc.Function("ConvDicList_CreateInstance").GlobalNamespace()))
    {
        return;
    }
diff --git a/include/sfx2/classificationhelper.hxx b/include/sfx2/classificationhelper.hxx
index dada1dc..2be662a 100644
--- a/include/sfx2/classificationhelper.hxx
+++ b/include/sfx2/classificationhelper.hxx
@@ -89,9 +89,9 @@ public:
    bool HasDocumentFooter();
    void UpdateInfobar(SfxViewFrame& rViewFrame);

    const std::vector<OUString> GetMarkings();
    const std::vector<OUString> GetIntellectualPropertyParts();
    const std::vector<OUString> GetIntellectualPropertyPartNumbers();
    std::vector<OUString> const & GetMarkings();
    std::vector<OUString> const & GetIntellectualPropertyParts();
    std::vector<OUString> const & GetIntellectualPropertyPartNumbers();

    /// Does a best-effort conversion of rType to SfxClassificationPolicyType.
    static SfxClassificationPolicyType stringToPolicyType(const OUString& rType);
@@ -130,7 +130,7 @@ private:
    sal_Int32 m_nIPPartNumber;
    sal_Int32 m_nMarkingNumber;

    OUString getPolicyKey() const
    OUString const & getPolicyKey() const
    {
        return m_sPolicy;
    }
diff --git a/include/sfx2/docfile.hxx b/include/sfx2/docfile.hxx
index 9fd18fd..ecf0232 100644
--- a/include/sfx2/docfile.hxx
+++ b/include/sfx2/docfile.hxx
@@ -132,7 +132,7 @@ public:

    void                CheckFileDate( const css::util::DateTime& aInitDate );
    SAL_WARN_UNUSED_RESULT bool  DocNeedsFileDateCheck() const;
    css::util::DateTime GetInitFileDate( bool bIgnoreOldValue );
    css::util::DateTime const & GetInitFileDate( bool bIgnoreOldValue );

    css::uno::Reference< css::ucb::XContent > GetContent() const;
    const OUString& GetPhysicalName() const;
@@ -144,7 +144,7 @@ public:
    ErrCode             GetErrorCode() const;
    ErrCode             GetError() const
                        { return GetErrorCode().IgnoreWarning(); }
    ErrCode             GetLastStorageCreationState();
    ErrCode const &     GetLastStorageCreationState();

    void                SetError(ErrCode nError);

@@ -191,7 +191,7 @@ public:
    // independent of later changes via SetOpenMode; used for SID_RELOAD:
    SAL_WARN_UNUSED_RESULT bool IsOriginallyLoadedReadOnly() const;

    css::uno::Reference< css::io::XInputStream >  GetInputStream();
    css::uno::Reference< css::io::XInputStream > const &  GetInputStream();

    void                CreateTempFile( bool bReplace = true );
    void                CreateTempFileNoCopy();
@@ -207,9 +207,9 @@ public:
    SAL_DLLPRIVATE bool HasStorage_Impl() const;

    SAL_DLLPRIVATE void StorageBackup_Impl();
    SAL_DLLPRIVATE OUString GetBackup_Impl();
    SAL_DLLPRIVATE OUString const & GetBackup_Impl();

    SAL_DLLPRIVATE css::uno::Reference< css::embed::XStorage > GetZipStorageToSign_Impl( bool bReadOnly = true );
    SAL_DLLPRIVATE css::uno::Reference< css::embed::XStorage > const & GetZipStorageToSign_Impl( bool bReadOnly = true );
    SAL_DLLPRIVATE void CloseZipStorage_Impl();

    // the storage that will be returned by the medium on GetStorage request
diff --git a/include/sfx2/fcontnr.hxx b/include/sfx2/fcontnr.hxx
index a08f014..17aff3c 100644
--- a/include/sfx2/fcontnr.hxx
+++ b/include/sfx2/fcontnr.hxx
@@ -51,7 +51,7 @@ public:
                        ~SfxFilterContainer();


    const OUString      GetName() const;
    OUString const &      GetName() const;

    std::shared_ptr<const SfxFilter>    GetAnyFilter( SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
    std::shared_ptr<const SfxFilter>    GetFilter4EA( const OUString& rEA, SfxFilterFlags nMust = SfxFilterFlags::IMPORT, SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED ) const;
diff --git a/include/sfx2/filedlghelper.hxx b/include/sfx2/filedlghelper.hxx
index 9e58969..2ea5579 100644
--- a/include/sfx2/filedlghelper.hxx
+++ b/include/sfx2/filedlghelper.hxx
@@ -137,7 +137,7 @@ public:

    ErrCode                 Execute();
    void                    StartExecuteModal( const Link<FileDialogHelper*,void>& rEndDialogHdl );
    ErrCode          GetError() const { return m_nError; }
    ErrCode const &         GetError() const { return m_nError; }
    sal_Int16               GetDialogType() const;
    bool                    IsPasswordEnabled() const;
    OUString                GetRealFilter() const;
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index 51f7363..a8a6302 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -592,9 +592,9 @@ public:
                        const css::uno::Reference< css::embed::XStorage >& xStorage,
                        sal_Int32 nVersion, bool bTemplate, bool bChart = false ) const;

    css::uno::Reference< css::embed::XStorage > GetStorage();
    css::uno::Reference< css::embed::XStorage > const & GetStorage();

    SvGlobalName    GetClassName() const;
    SvGlobalName const & GetClassName() const;

    // comphelper::IEmbeddedHelper
    virtual css::uno::Reference< css::task::XInteractionHandler > getInteractionHandler() const override;
diff --git a/include/sfx2/opengrf.hxx b/include/sfx2/opengrf.hxx
index fbf3c57..21c0142 100644
--- a/include/sfx2/opengrf.hxx
+++ b/include/sfx2/opengrf.hxx
@@ -47,7 +47,7 @@ public:
    void                    SetCurrentFilter(const OUString&);

    //what was subsequently found to be the format
    OUString                GetDetectedFilter() const;
    OUString const &        GetDetectedFilter() const;
    void                    SetDetectedFilter(const OUString&);

private:
diff --git a/include/sfx2/sidebar/Deck.hxx b/include/sfx2/sidebar/Deck.hxx
index b1edcf9..c8273c5 100644
--- a/include/sfx2/sidebar/Deck.hxx
+++ b/include/sfx2/sidebar/Deck.hxx
@@ -46,7 +46,7 @@ public:

    const OUString& GetId() const { return msId; }

    VclPtr<DeckTitleBar> GetTitleBar() const;
    VclPtr<DeckTitleBar> const & GetTitleBar() const;
    tools::Rectangle GetContentArea() const;
    void ResetPanels (const SharedPanelContainer& rPanels);
    const SharedPanelContainer& GetPanels() const  { return maPanels; }
diff --git a/include/sfx2/sidebar/Panel.hxx b/include/sfx2/sidebar/Panel.hxx
index 4d65467..119843c 100644
--- a/include/sfx2/sidebar/Panel.hxx
+++ b/include/sfx2/sidebar/Panel.hxx
@@ -47,7 +47,7 @@ public:
    virtual ~Panel() override;
    virtual void dispose() override;

    VclPtr<PanelTitleBar> GetTitleBar() const;
    VclPtr<PanelTitleBar> const & GetTitleBar() const;
    bool IsTitleBarOptional() const { return mbIsTitleBarOptional;}
    void SetUIElement (const css::uno::Reference<css::ui::XUIElement>& rxElement);
    const css::uno::Reference<css::ui::XSidebarPanel>& GetPanelComponent() const { return mxPanelComponent;}
diff --git a/include/sfx2/sidebar/Theme.hxx b/include/sfx2/sidebar/Theme.hxx
index 31e9a3f..5064742 100644
--- a/include/sfx2/sidebar/Theme.hxx
+++ b/include/sfx2/sidebar/Theme.hxx
@@ -217,7 +217,7 @@ private:
    void SetupPropertyMaps();
    void UpdateTheme();
    static PropertyType GetPropertyType (const ThemeItem eItem);
    static css::uno::Type GetCppuType (const PropertyType eType);
    static css::uno::Type const & GetCppuType (const PropertyType eType);
    static sal_Int32 GetIndex (
        const ThemeItem eItem,
        const PropertyType eType);
diff --git a/include/sfx2/thumbnailviewitem.hxx b/include/sfx2/thumbnailviewitem.hxx
index cf58e18..dc7f7c8 100644
--- a/include/sfx2/thumbnailviewitem.hxx
+++ b/include/sfx2/thumbnailviewitem.hxx
@@ -104,7 +104,7 @@ public:
    void setHelpText (const OUString &sText) { maHelpText = sText; }

    virtual OUString getHelpText() const { return maHelpText; };
    OUString getTitle() const { return maTitle; };
    OUString const & getTitle() const { return maTitle; };

    void setTitle (const OUString& rTitle);

diff --git a/include/sfx2/watermarkitem.hxx b/include/sfx2/watermarkitem.hxx
index 104c330..43abdfe 100644
--- a/include/sfx2/watermarkitem.hxx
+++ b/include/sfx2/watermarkitem.hxx
@@ -22,9 +22,9 @@ public:
    virtual bool            QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
    virtual bool            PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;

    const OUString          GetText() const { return m_aText; }
    OUString const &        GetText() const { return m_aText; }
    void                    SetText(const OUString& aText) { m_aText = aText; }
    const OUString          GetFont() const { return m_aFont; }
    OUString const &        GetFont() const { return m_aFont; }
    void                    SetFont(const OUString& aFont) { m_aFont = aFont; }
    sal_Int16               GetAngle() const { return m_nAngle; }
    void                    SetAngle(const sal_Int16 nAngle) { m_nAngle = nAngle; }
diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx
index 921ef4a..287413b 100644
--- a/include/xmloff/txtimp.hxx
+++ b/include/xmloff/txtimp.hxx
@@ -683,7 +683,7 @@ public:
        const css::uno::Sequence<sal_Int8> & rProtectionKey );

    /// get the last open redline ID
    OUString GetOpenRedlineId();
    OUString const & GetOpenRedlineId();
    /// modify the last open redline ID
    void SetOpenRedlineId( OUString const & rId);
    /// reset the last open redline ID
diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx
index 0812bc6..ad934e1 100644
--- a/include/xmloff/xmlexp.hxx
+++ b/include/xmloff/xmlexp.hxx
@@ -215,8 +215,8 @@ protected:
    /// Override this method to export the content of <office:body>.
    virtual void ExportContent_() = 0;

    OUString GetSourceShellID() const;
    OUString GetDestinationShellID() const;
    OUString const & GetSourceShellID() const;
    OUString const & GetDestinationShellID() const;

    // save linked sections? (may be false in global documents)
    bool mbSaveLinkedSections;
@@ -533,7 +533,7 @@ public:
    // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
    bool writeOutlineStyleAsNormalListStyle() const;

    css::uno::Reference< css::embed::XStorage > GetTargetStorage();
    css::uno::Reference< css::embed::XStorage > const & GetTargetStorage();

    /// returns the currently configured default version for odf export
    SvtSaveOptions::ODFDefaultVersion getDefaultVersion() const;
@@ -559,7 +559,7 @@ public:
    bool SetNullDateOnUnitConverter();

    /// Get clamped mimetype for image export (empty if none)
    OUString GetImageFilterName() const;
    OUString const & GetImageFilterName() const;
};

inline rtl::Reference< XMLTextParagraphExport > const & SvXMLExport::GetTextParagraphExport()
diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 483a1a36..7cc0d76 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -416,7 +416,7 @@ public:
    OUString ResolveEmbeddedObjectURLFromBase64();

    // get source storage we're importing from (if available)
    css::uno::Reference< css::embed::XStorage >
    css::uno::Reference< css::embed::XStorage > const &
          GetSourceStorage();

    void AddStyleDisplayName( sal_uInt16 nFamily,
@@ -450,7 +450,7 @@ public:

    bool IsTableShapeSupported() const { return mbIsTableShapeSupported; }

    OUString GetODFVersion() const;
    OUString const & GetODFVersion() const;
    bool IsOOoXML() const; // legacy non-ODF format?

    /**
@@ -481,7 +481,7 @@ public:

    ::comphelper::UnoInterfaceToUniqueIdentifierMapper& getInterfaceToIdentifierMapper();

    css::uno::Reference< css::uno::XComponentContext >
    css::uno::Reference< css::uno::XComponentContext > const &
    GetComponentContext() const;

    // Convert drawing object positions from OOo file format to OASIS file format and vice versa (#i28749#)
diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx
index 9b8af00..b5388a3 100644
--- a/sfx2/source/appl/newhelp.hxx
+++ b/sfx2/source/appl/newhelp.hxx
@@ -337,7 +337,7 @@ public:
    void                SetDoubleClickHdl( const Link<Control*,bool>& rLink );
    void         SetSelectFactoryHdl( const Link<SfxHelpIndexWindow_Impl*,void>& rLink ) { aSelectFactoryLink = rLink; }
    void                SetFactory( const OUString& rFactory, bool bActive );
    OUString     GetFactory() const { return pIPage->GetFactory(); }
    OUString const &    GetFactory() const { return pIPage->GetFactory(); }
    OUString            GetSelectedEntry() const;
    void                AddBookmarks( const OUString& rTitle, const OUString& rURL );
    bool                IsValidFactory( const OUString& _rFactory );
@@ -538,7 +538,7 @@ public:
    virtual bool        PreNotify( NotifyEvent& rNEvt ) override;

    void                setContainerWindow( const css::uno::Reference < css::awt::XWindow >& xWin );
    css::uno::Reference < css::frame::XFrame2 >
    css::uno::Reference < css::frame::XFrame2 > const &
                        getTextFrame() const { return pTextWin->getFrame(); }

    void                SetFactory( const OUString& rFactory );
diff --git a/sfx2/source/appl/opengrf.cxx b/sfx2/source/appl/opengrf.cxx
index 9407c88..ad779ac 100644
--- a/sfx2/source/appl/opengrf.cxx
+++ b/sfx2/source/appl/opengrf.cxx
@@ -254,7 +254,7 @@ OUString SvxOpenGraphicDialog::GetCurrentFilter() const
    return mpImpl->aFileDlg.GetCurrentFilter();
}

OUString SvxOpenGraphicDialog::GetDetectedFilter() const
OUString const & SvxOpenGraphicDialog::GetDetectedFilter() const
{
    return mpImpl->sDetectedFilter;
}
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx
index 11ee264..2899d4f 100644
--- a/sfx2/source/bastyp/fltfnc.cxx
+++ b/sfx2/source/bastyp/fltfnc.cxx
@@ -172,7 +172,7 @@ SfxFilterContainer::~SfxFilterContainer()
}


const OUString SfxFilterContainer::GetName() const
OUString const & SfxFilterContainer::GetName() const
{
    return pImpl->aName;
}
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 0e3f8e5..d6e883a 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -2130,7 +2130,7 @@ void SfxCommonTemplateDialog_Impl::EnableExample_Impl(sal_uInt16 nId, bool bEnab
    EnableItem(nId, bEnable);
}

VclPtr<PopupMenu> SfxCommonTemplateDialog_Impl::CreateContextMenu()
VclPtr<PopupMenu> const & SfxCommonTemplateDialog_Impl::CreateContextMenu()
{
    if ( bBindingUpdate )
    {
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 757336c..48d69a2 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -302,7 +302,7 @@ void SfxMedium::ResetError()
        pImpl->m_pOutStream->ResetError();
}

ErrCode SfxMedium::GetLastStorageCreationState()
ErrCode const & SfxMedium::GetLastStorageCreationState()
{
    return pImpl->nLastStorageError;
}
@@ -365,7 +365,7 @@ bool SfxMedium::DocNeedsFileDateCheck() const
                                GetURLObject().isAnyKnownWebDAVScheme() ) );
}

util::DateTime SfxMedium::GetInitFileDate( bool bIgnoreOldValue )
util::DateTime const & SfxMedium::GetInitFileDate( bool bIgnoreOldValue )
{
    if ( ( bIgnoreOldValue || !pImpl->m_bGotDateTime ) && !pImpl->m_aLogicName.isEmpty() )
    {
@@ -749,7 +749,7 @@ void SfxMedium::StorageBackup_Impl()
}


OUString SfxMedium::GetBackup_Impl()
OUString const & SfxMedium::GetBackup_Impl()
{
    if ( pImpl->m_aBackupURL.isEmpty() )
        StorageBackup_Impl();
@@ -1484,7 +1484,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( bool bCreateTempIfNo )
}


uno::Reference< embed::XStorage > SfxMedium::GetZipStorageToSign_Impl( bool bReadOnly )
uno::Reference< embed::XStorage > const & SfxMedium::GetZipStorageToSign_Impl( bool bReadOnly )
{
    if ( !GetError() && !pImpl->m_xZipStorage.is() )
    {
@@ -3191,7 +3191,7 @@ SvKeyValueIterator* SfxMedium::GetHeaderAttributes_Impl()
    return pImpl->xAttributes.get();
}

css::uno::Reference< css::io::XInputStream >  SfxMedium::GetInputStream()
css::uno::Reference< css::io::XInputStream > const &  SfxMedium::GetInputStream()
{
    if ( !pImpl->xInputStream.is() )
        GetMedium_Impl();
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 68730d3..e50fdfc 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -289,7 +289,7 @@ OUString SfxObjectShell::CreateTempCopyOfStorage_Impl( const uno::Reference< emb
}


SvGlobalName SfxObjectShell::GetClassName() const
SvGlobalName const & SfxObjectShell::GetClassName() const
{
    return GetFactory().GetClassId();
}
@@ -3009,7 +3009,7 @@ bool SfxObjectShell::SaveAsOwnFormat( SfxMedium& rMedium )
    else return false;
}

uno::Reference< embed::XStorage > SfxObjectShell::GetStorage()
uno::Reference< embed::XStorage > const & SfxObjectShell::GetStorage()
{
    if ( !pImpl->m_xDocStorage.is() )
    {
diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx
index 73af67e..f69d0ab 100644
--- a/sfx2/source/doc/oleprops.cxx
+++ b/sfx2/source/doc/oleprops.cxx
@@ -334,7 +334,7 @@ SfxOleObjectBase::~SfxOleObjectBase()
{
}

ErrCode SfxOleObjectBase::Load( SvStream& rStrm )
ErrCode const & SfxOleObjectBase::Load( SvStream& rStrm )
{
    mnErrCode = ERRCODE_NONE;
    ImplLoad( rStrm );
@@ -342,7 +342,7 @@ ErrCode SfxOleObjectBase::Load( SvStream& rStrm )
    return GetError();
}

ErrCode SfxOleObjectBase::Save( SvStream& rStrm )
ErrCode const & SfxOleObjectBase::Save( SvStream& rStrm )
{
    mnErrCode = ERRCODE_NONE;
    ImplSave( rStrm );
@@ -1090,7 +1090,7 @@ void SfxOleSection::SaveProperty( SvStream& rStrm, SfxOlePropertyBase& rProp, sa
}


ErrCode SfxOlePropertySet::LoadPropertySet( SotStorage* pStrg, const OUString& rStrmName )
ErrCode const & SfxOlePropertySet::LoadPropertySet( SotStorage* pStrg, const OUString& rStrmName )
{
    if( pStrg )
    {
@@ -1108,7 +1108,7 @@ ErrCode SfxOlePropertySet::LoadPropertySet( SotStorage* pStrg, const OUString& r
    return GetError();
}

ErrCode SfxOlePropertySet::SavePropertySet( SotStorage* pStrg, const OUString& rStrmName )
ErrCode const & SfxOlePropertySet::SavePropertySet( SotStorage* pStrg, const OUString& rStrmName )
{
    if( pStrg )
    {
diff --git a/sfx2/source/doc/oleprops.hxx b/sfx2/source/doc/oleprops.hxx
index 3ca0dddd..8494035 100644
--- a/sfx2/source/doc/oleprops.hxx
+++ b/sfx2/source/doc/oleprops.hxx
@@ -170,12 +170,12 @@ public:
    virtual             ~SfxOleObjectBase();

    /** Returns the current error code. */
    ErrCode      GetError() const { return mnErrCode; }
    ErrCode const &     GetError() const { return mnErrCode; }

    /** Loads this object from the passed stream. Calls virtual ImplLoad(). */
    ErrCode             Load( SvStream& rStrm );
    ErrCode const &     Load( SvStream& rStrm );
    /** Saves this object to the passed stream. Calls virtual ImplSave(). */
    ErrCode             Save( SvStream& rStrm );
    ErrCode const &     Save( SvStream& rStrm );

protected:
    /** Sets the passed error code. Will be returned by Load() and Save() functions.
@@ -359,9 +359,9 @@ public:
    explicit     SfxOlePropertySet() {}

    /** Loads this object from the passed storage. */
    ErrCode             LoadPropertySet( SotStorage* pStrg, const OUString& rStrmName );
    ErrCode const &     LoadPropertySet( SotStorage* pStrg, const OUString& rStrmName );
    /** Saves this object to the passed storage. */
    ErrCode             SavePropertySet( SotStorage* pStrg, const OUString& rStrmName );
    ErrCode const &     SavePropertySet( SotStorage* pStrg, const OUString& rStrmName );

    /** Returns the specified section, or an empty reference, if nothing found. */
    SfxOleSectionRef    GetSection( SfxOleSectionType eSection ) const;
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx
index 6ede992..4a911d2 100644
--- a/sfx2/source/inc/templdgi.hxx
+++ b/sfx2/source/inc/templdgi.hxx
@@ -327,7 +327,7 @@ public:
    }

    // normally for derivates from SvTreeListBoxes, but in this case the dialog handles context menus
    VclPtr<PopupMenu> CreateContextMenu();
    VclPtr<PopupMenu> const & CreateContextMenu();
};

class DropToolBox_Impl : public ToolBox, public DropTargetHelper
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 90bbe1e..f1396cb 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -92,7 +92,7 @@ void Deck::dispose()
    vcl::Window::dispose();
}

VclPtr<DeckTitleBar> Deck::GetTitleBar() const
VclPtr<DeckTitleBar> const & Deck::GetTitleBar() const
{
    return mpTitleBar;
}
diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx
index be3da21..a8671c1 100644
--- a/sfx2/source/sidebar/Panel.cxx
+++ b/sfx2/source/sidebar/Panel.cxx
@@ -100,7 +100,7 @@ void Panel::dispose()
    vcl::Window::dispose();
}

VclPtr<PanelTitleBar> Panel::GetTitleBar() const
VclPtr<PanelTitleBar> const & Panel::GetTitleBar() const
{
    return mpTitleBar;
}
diff --git a/sfx2/source/sidebar/Theme.cxx b/sfx2/source/sidebar/Theme.cxx
index 315bf05..44bff10 100644
--- a/sfx2/source/sidebar/Theme.cxx
+++ b/sfx2/source/sidebar/Theme.cxx
@@ -840,7 +840,7 @@ Theme::PropertyType Theme::GetPropertyType (const ThemeItem eItem)
    }
}

css::uno::Type Theme::GetCppuType (const PropertyType eType)
css::uno::Type const & Theme::GetCppuType (const PropertyType eType)
{
    switch(eType)
    {
diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx
index 1d7c0e9..f167dc8 100644
--- a/sfx2/source/view/classificationhelper.cxx
+++ b/sfx2/source/view/classificationhelper.cxx
@@ -582,17 +582,17 @@ SfxClassificationHelper::SfxClassificationHelper(const uno::Reference<document::

SfxClassificationHelper::~SfxClassificationHelper() = default;

const std::vector<OUString> SfxClassificationHelper::GetMarkings()
std::vector<OUString> const & SfxClassificationHelper::GetMarkings()
{
    return m_pImpl->m_aMarkings;
}

const std::vector<OUString> SfxClassificationHelper::GetIntellectualPropertyParts()
std::vector<OUString> const & SfxClassificationHelper::GetIntellectualPropertyParts()
{
    return m_pImpl->m_aIPParts;
}

const std::vector<OUString> SfxClassificationHelper::GetIntellectualPropertyPartNumbers()
std::vector<OUString> const & SfxClassificationHelper::GetIntellectualPropertyPartNumbers()
{
    return m_pImpl->m_aIPPartNumbers;
}
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index 1150ecc..cd1a4ec 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -125,7 +125,7 @@ public:

    void SizeHasChanged();
    DECL_LINK(TimerHdl, Timer *, void);
    uno::Reference < frame::XFrame > GetFrame() const;
    uno::Reference < frame::XFrame > const & GetFrame() const;

    // XEmbeddedClient
    virtual void SAL_CALL saveObject() override;
@@ -201,7 +201,7 @@ void SAL_CALL SfxInPlaceClient_Impl::disposing( const css::lang::EventObject& /*

// XEmbeddedClient

uno::Reference < frame::XFrame > SfxInPlaceClient_Impl::GetFrame() const
uno::Reference < frame::XFrame > const & SfxInPlaceClient_Impl::GetFrame() const
{
    if ( !m_pClient )
        throw uno::RuntimeException();
diff --git a/xmloff/inc/SchXMLExport.hxx b/xmloff/inc/SchXMLExport.hxx
index a2a3630..cc0835d 100644
--- a/xmloff/inc/SchXMLExport.hxx
+++ b/xmloff/inc/SchXMLExport.hxx
@@ -54,7 +54,7 @@ public:
        SvXMLExportFlags nExportFlags );
    virtual ~SchXMLExport() override;

    rtl::Reference< XMLPropertySetMapper > GetPropertySetMapper() const;
    rtl::Reference< XMLPropertySetMapper > const & GetPropertySetMapper() const;
};

#endif // INCLUDED_XMLOFF_INC_SCHXMLEXPORT_HXX
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index b28ec1b..3b51533 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -3613,7 +3613,7 @@ void SchXMLExport::ExportContent_()
    }
}

rtl::Reference< XMLPropertySetMapper > SchXMLExport::GetPropertySetMapper() const
rtl::Reference< XMLPropertySetMapper > const & SchXMLExport::GetPropertySetMapper() const
{
    return maExportHelper->m_pImpl->GetPropertySetMapper();
}
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 85b7152..2a0ecb1 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -1455,12 +1455,12 @@ void SvXMLExport::ResetNamespaceMap()
    delete mpNamespaceMap;    mpNamespaceMap = new SvXMLNamespaceMap;
}

OUString SvXMLExport::GetSourceShellID() const
OUString const & SvXMLExport::GetSourceShellID() const
{
    return mpImpl->maSrcShellID;
}

OUString SvXMLExport::GetDestinationShellID() const
OUString const & SvXMLExport::GetDestinationShellID() const
{
    return mpImpl->maDestShellID;
}
@@ -2337,7 +2337,7 @@ bool SvXMLExport::writeOutlineStyleAsNormalListStyle() const
    return mpImpl->mbOutlineStyleAsNormalListStyle;
}

uno::Reference< embed::XStorage > SvXMLExport::GetTargetStorage()
uno::Reference< embed::XStorage > const & SvXMLExport::GetTargetStorage()
{
    return mpImpl->mxTargetStorage;
}
@@ -2466,7 +2466,7 @@ bool SvXMLExport::SetNullDateOnUnitConverter()
    return mpImpl->mbNullDateInitialized;
}

OUString SvXMLExport::GetImageFilterName() const
OUString const & SvXMLExport::GetImageFilterName() const
{
    return msImgFilterName;
}
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index a95ba70..0718e7a 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -1421,7 +1421,7 @@ OUString SvXMLImport::ResolveEmbeddedObjectURL(
    return sRet;
}

Reference< embed::XStorage > SvXMLImport::GetSourceStorage()
Reference< embed::XStorage > const & SvXMLImport::GetSourceStorage()
{
    return mpImpl->mxSourceStorage;
}
@@ -1895,7 +1895,7 @@ void SvXMLImport::DisposingModel()
    return mpImpl->maInterfaceToIdentifierMapper;
}

uno::Reference< uno::XComponentContext >
uno::Reference< uno::XComponentContext > const &
SvXMLImport::GetComponentContext() const
{
    return mpImpl->mxComponentContext;
@@ -1966,7 +1966,7 @@ bool SvXMLImport::isGeneratorVersionOlderThan(
}


OUString SvXMLImport::GetODFVersion() const
OUString const & SvXMLImport::GetODFVersion() const
{
    return mpImpl->aODFVersion;
}
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 7ff3bec..53e8836 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -2864,7 +2864,7 @@ void XMLTextImportHelper::SetChangesProtectionKey(const Sequence<sal_Int8> &)
}


OUString XMLTextImportHelper::GetOpenRedlineId()
OUString const & XMLTextImportHelper::GetOpenRedlineId()
{
    return m_xImpl->m_sOpenRedlineIdentifier;
}
diff --git a/xmloff/source/text/txtparaimphint.hxx b/xmloff/source/text/txtparaimphint.hxx
index 2f5f231..2214fea 100644
--- a/xmloff/source/text/txtparaimphint.hxx
+++ b/xmloff/source/text/txtparaimphint.hxx
@@ -230,7 +230,7 @@ public:
    }

    // Frame "to character": anchor moves from first to last char after saving (#i33242#)
    css::uno::Reference < css::drawing::XShape > GetShape() const
    css::uno::Reference < css::drawing::XShape > const & GetShape() const
    {
        return static_cast<SvXMLShapeContext*>(xContext.get())->getShape();
    }