clang-tidy performance-unnecessary-copy-init in sc

Change-Id: I93ded61c22bd533a6ffaddd20d6e527f176e7651
Reviewed-on: https://gerrit.libreoffice.org/62218
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 7e9eb0b..a37aa92 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -1729,7 +1729,7 @@ public:
                    const ScFormulaCell* pCell = *it;
                    OUString aFormula;
                    pCell->GetFormula(aFormula, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1);
                    auto xCellGroup = pCell->GetCellGroup();
                    const auto& xCellGroup = pCell->GetCellGroup();
                    sal_uInt64 nGroupLength = 0;
                    if (xCellGroup)
                    {
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 136e34e..5741264 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -794,7 +794,7 @@ const SfxPoolItem* ScDocument::GetEffItem(
                    {
                        ScAddress aPos(nCol, nRow, nTab);
                        ScRefCellValue aCell(const_cast<ScDocument&>(*this), aPos);
                        OUString aStyle = pForm->GetCellStyle(aCell, aPos);
                        const OUString& aStyle = pForm->GetCellStyle(aCell, aPos);
                        if (!aStyle.isEmpty())
                        {
                            SfxStyleSheetBase* pStyleSheet = mxPoolHelper->GetStylePool()->Find(
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index a891b09..e20678d 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -828,8 +828,7 @@ void ScDPObject::ReloadGroupTableData()
        if (pData)
        {
            // Replace the existing group table data with the source data.
            shared_ptr<ScDPTableData> pSource = pData->GetSourceTableData();
            mpTableData = pSource;
            mpTableData = pData->GetSourceTableData();
        }
        return;
    }
@@ -839,7 +838,7 @@ void ScDPObject::ReloadGroupTableData()
    {
        // This is already a group table data. Salvage the source data and
        // re-create a new group data.
        shared_ptr<ScDPTableData> pSource = pData->GetSourceTableData();
        const shared_ptr<ScDPTableData>& pSource = pData->GetSourceTableData();
        shared_ptr<ScDPGroupTableData> pGroupData(new ScDPGroupTableData(pSource, pDoc));
        pDimData->WriteToData(*pGroupData);
        mpTableData = pGroupData;
diff --git a/sc/source/core/data/globalx.cxx b/sc/source/core/data/globalx.cxx
index a4a3283..81bd7bf 100644
--- a/sc/source/core/data/globalx.cxx
+++ b/sc/source/core/data/globalx.cxx
@@ -47,7 +47,7 @@ void ScGlobal::InitAddIns()

    // multi paths separated by semicolons
    SvtPathOptions aPathOpt;
    OUString aMultiPath = aPathOpt.GetAddinPath();
    const OUString& aMultiPath = aPathOpt.GetAddinPath();
    if (aMultiPath.isEmpty())
        return;

diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 2eaf1ce..27149c7 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -122,7 +122,7 @@ static bool SplitString( const OUString &sWhole,
        return false;

    // Get numeral element
    OUString sUser = ScGlobal::pLocaleData->getNumDecimalSep();
    const OUString& sUser = ScGlobal::pLocaleData->getNumDecimalSep();
    ParseResult aPRNum = ScGlobal::pCharClass->parsePredefinedToken(
        KParseType::ANY_NUMBER, sWhole, nPos,
        KParseTokens::ANY_NUMBER, "", KParseTokens::ANY_NUMBER, sUser );
diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx
index e00c594..0f6a179 100644
--- a/sc/source/core/tool/addincol.cxx
+++ b/sc/source/core/tool/addincol.cxx
@@ -146,7 +146,7 @@ bool ScUnoAddInFuncData::GetExcelName( LanguageType eDestLang, OUString& rRetExc
    if ( !rCompNames.empty() )
    {
        LanguageTag aLanguageTag( eDestLang);
        const OUString aSearch( aLanguageTag.getBcp47());
        const OUString& aSearch( aLanguageTag.getBcp47());

        // First, check exact match without fallback overhead.
        ::std::vector<LocalizedName>::const_iterator itNames( rCompNames.begin());
diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx
index eca8d48..9b36ea8 100644
--- a/sc/source/core/tool/charthelper.cxx
+++ b/sc/source/core/tool/charthelper.cxx
@@ -292,7 +292,7 @@ void ScChartHelper::AddRangesIfProtectedChart( ScRangeListVector& rRangesVector,
        SdrOle2Obj* pSdrOle2Obj = dynamic_cast< SdrOle2Obj* >( pObject );
        if ( pSdrOle2Obj && pSdrOle2Obj->IsChart() )
        {
            uno::Reference< embed::XEmbeddedObject > xEmbeddedObj = pSdrOle2Obj->GetObjRef();
            const uno::Reference< embed::XEmbeddedObject >& xEmbeddedObj = pSdrOle2Obj->GetObjRef();
            if ( xEmbeddedObj.is() )
            {
                bool bDisableDataTableDialog = false;
@@ -306,7 +306,7 @@ void ScChartHelper::AddRangesIfProtectedChart( ScRangeListVector& rRangesVector,
                    ScChartListenerCollection* pCollection = pDocument->GetChartListenerCollection();
                    if (pCollection)
                    {
                        OUString aChartName = pSdrOle2Obj->GetPersistName();
                        const OUString& aChartName = pSdrOle2Obj->GetPersistName();
                        const ScChartListener* pListener = pCollection->findByName(aChartName);
                        if (pListener)
                        {
@@ -378,12 +378,12 @@ void ScChartHelper::CreateProtectedChartListenersAndNotify( ScDocument* pDoc, co
                SdrOle2Obj* pSdrOle2Obj = dynamic_cast< SdrOle2Obj* >( pObject );
                if ( pSdrOle2Obj && pSdrOle2Obj->IsChart() )
                {
                    OUString aChartName = pSdrOle2Obj->GetPersistName();
                    const OUString& aChartName = pSdrOle2Obj->GetPersistName();
                    ::std::vector< OUString >::const_iterator aEnd = rExcludedChartNames.end();
                    ::std::vector< OUString >::const_iterator aFound = ::std::find( rExcludedChartNames.begin(), aEnd, aChartName );
                    if ( aFound == aEnd )
                    {
                        uno::Reference< embed::XEmbeddedObject > xEmbeddedObj = pSdrOle2Obj->GetObjRef();
                        const uno::Reference< embed::XEmbeddedObject >& xEmbeddedObj = pSdrOle2Obj->GetObjRef();
                        if ( xEmbeddedObj.is() && ( nRangeList < nRangeListCount ) )
                        {
                            bool bDisableDataTableDialog = false;
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index deee719..3123afd 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -353,7 +353,7 @@ static bool lcl_IsOtherTab( const basegfx::B2DPolyPolygon& rPolyPolygon )
    //  test if rPolygon is the line end for "other table" (rectangle)
    if(1 == rPolyPolygon.count())
    {
        const basegfx::B2DPolygon aSubPoly(rPolyPolygon.getB2DPolygon(0));
        const basegfx::B2DPolygon& aSubPoly(rPolyPolygon.getB2DPolygon(0));

        // #i73305# circle consists of 4 segments, too, distinguishable from square by
        // the use of control points
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 2cc8bc1..f5ca631 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1703,8 +1703,7 @@ void ScInterpreter::QueryMatrixType(const ScMatrixRef& xMat, SvNumFormatType& rR
            }
            else
            {
                svl::SharedString aStr( nMatVal.GetString());
                FormulaTokenRef xRes = new FormulaStringToken( aStr);
                FormulaTokenRef xRes = new FormulaStringToken( nMatVal.GetString() );
                PushTempToken( new ScMatrixFormulaCellToken(nCols, nRows, xMat, xRes.get()));
                rRetTypeExpr = SvNumFormatType::TEXT;
            }
@@ -3037,8 +3036,7 @@ void ScInterpreter::ScExternal()
            }
            else if ( aCall.HasMatrix() )
            {
                ScMatrixRef xMat = aCall.GetMatrix();
                PushMatrix( xMat );
                PushMatrix( aCall.GetMatrix() );
            }
            else if ( aCall.HasString() )
            {
diff --git a/sc/source/core/tool/sharedformula.cxx b/sc/source/core/tool/sharedformula.cxx
index e18e1ad..913b2fe 100644
--- a/sc/source/core/tool/sharedformula.cxx
+++ b/sc/source/core/tool/sharedformula.cxx
@@ -216,7 +216,7 @@ void SharedFormulaUtil::unshareFormulaCell(const CellStoreType::position_type& a
    if (rCell.aPos.Row() == rCell.GetSharedTopRow())
    {
        // Top of the shared range.
        ScFormulaCellGroupRef xGroup = rCell.GetCellGroup();
        const ScFormulaCellGroupRef& xGroup = rCell.GetCellGroup();
        if (xGroup->mnLength == 2)
        {
            // Group consists of only two cells. Mark the second one non-shared.
@@ -242,7 +242,7 @@ void SharedFormulaUtil::unshareFormulaCell(const CellStoreType::position_type& a
    else if (rCell.aPos.Row() == rCell.GetSharedTopRow() + rCell.GetSharedLength() - 1)
    {
        // Bottom of the shared range.
        ScFormulaCellGroupRef xGroup = rCell.GetCellGroup();
        const ScFormulaCellGroupRef& xGroup = rCell.GetCellGroup();
        if (xGroup->mnLength == 2)
        {
            // Mark the top cell non-shared.
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 7f1428d..a7752cf 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -2385,7 +2385,7 @@ namespace {

void GetExternalTableData(const ScDocument* pOldDoc, const ScDocument* pNewDoc, const SCTAB nTab, OUString& rTabName, sal_uInt16& rFileId)
{
    OUString aFileName = pOldDoc->GetFileURL();
    const OUString& aFileName = pOldDoc->GetFileURL();
    rFileId = pNewDoc->GetExternalRefManager()->getExternalFileId(aFileName);
    rTabName = pOldDoc->GetCopyTabName(nTab);
    if (rTabName.isEmpty())
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index be62186..09ff5e6 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -453,7 +453,7 @@ SdrObjectUniquePtr XclImpDrawObjBase::CreateSdrObject( XclImpDffConverter& rDffC
            SdrUnoObj* pSdrUnoObj = dynamic_cast< SdrUnoObj* >( xSdrObj.get() );
            if( pSdrUnoObj != nullptr )
            {
                Reference< XControlModel > xCtrlModel = pSdrUnoObj->GetUnoControlModel();
                const Reference< XControlModel >& xCtrlModel = pSdrUnoObj->GetUnoControlModel();
                Reference< XPropertySet > xPropSet(xCtrlModel,UNO_QUERY);
                const static rtl::OUString sPropertyName("ControlTypeinMSO");

@@ -1760,7 +1760,7 @@ void XclImpChartObj::DoPostProcessSdrObj( XclImpDffConverter& rDffConv, SdrObjec
    const SdrOle2Obj* pSdrOleObj = dynamic_cast< const SdrOle2Obj* >( &rSdrObj );
    if( mxChart && pSdrOleObj )
    {
        Reference< XEmbeddedObject > xEmbObj = pSdrOleObj->GetObjRef();
        const Reference< XEmbeddedObject >& xEmbObj = pSdrOleObj->GetObjRef();
        if( xEmbObj.is() && ::svt::EmbeddedObjectRef::TryRunningState( xEmbObj ) ) try
        {
            Reference< XEmbedPersist > xPersist( xEmbObj, UNO_QUERY_THROW );
diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx
index 4890596..d342371 100644
--- a/sc/source/filter/excel/xilink.cxx
+++ b/sc/source/filter/excel/xilink.cxx
@@ -527,8 +527,7 @@ bool XclImpExtName::CreateOleData(ScDocument& rDoc, const OUString& rUrl,
                break;
                case ScMatValType::String:
                {
                    const svl::SharedString aStr( aVal.GetString());
                    ScExternalRefCache::TokenRef pToken(new formula::FormulaStringToken(aStr));
                    ScExternalRefCache::TokenRef pToken(new formula::FormulaStringToken(aVal.GetString()));
                    xTab->setCell(nCol, nRow, pToken, 0, false);
                }
                break;
diff --git a/sc/source/filter/oox/unitconverter.cxx b/sc/source/filter/oox/unitconverter.cxx
index 02824f9..94ab790 100644
--- a/sc/source/filter/oox/unitconverter.cxx
+++ b/sc/source/filter/oox/unitconverter.cxx
@@ -132,7 +132,7 @@ void UnitConverter::finalizeImport()
        if( const oox::xls::Font* pDefFont = getStyles().getDefaultFont().get() )
        {
            // XDevice expects pixels in font descriptor, but font contains twips
            FontDescriptor aDesc = pDefFont->getFontDescriptor();
            const FontDescriptor& aDesc = pDefFont->getFontDescriptor();
            Reference< XFont > xFont = xDevice->getFont( aDesc );
            if( xFont.is() )
            {
diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
index 6e40a5e..7adec97 100644
--- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
@@ -104,8 +104,7 @@ void ScChangeTrackingExportHelper::WriteChangeInfo(const ScChangeAction* pAction
        SvXMLElementExport aCreatorElem( rExport, XML_NAMESPACE_DC,
                                            XML_CREATOR, true,
                                            false );
        OUString sAuthor(pAction->GetUser());
        rExport.Characters(sAuthor);
        rExport.Characters(pAction->GetUser());
    }

    {
@@ -117,7 +116,7 @@ void ScChangeTrackingExportHelper::WriteChangeInfo(const ScChangeAction* pAction
        rExport.Characters(sDate.makeStringAndClear());
    }

    OUString sComment(pAction->GetComment());
    const OUString& sComment(pAction->GetComment());
    if (!sComment.isEmpty())
    {
        SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TEXT, XML_P, true, false);
diff --git a/sc/source/filter/xml/xmlbodyi.cxx b/sc/source/filter/xml/xmlbodyi.cxx
index 686630b..21b436b 100644
--- a/sc/source/filter/xml/xmlbodyi.cxx
+++ b/sc/source/filter/xml/xmlbodyi.cxx
@@ -75,7 +75,7 @@ ScXMLBodyContext::ScXMLBodyContext( ScXMLImport& rImport,
        // ODF 1.1 and earlier => GRAM_PODF; ODF 1.2 and later => GRAM_ODFF;
        // no version => earlier than 1.2 => GRAM_PODF.
        formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_ODFF;
        OUString aVer( rImport.GetODFVersion());
        const OUString& aVer( rImport.GetODFVersion());
        sal_Int32 nLen = aVer.getLength();
        SAL_INFO("sc.filter", "ScXMLBodyContext ODFVersion: nLen: " << nLen << " str : " << aVer);
        if (!nLen)
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index bf20e97..4532b06 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2394,7 +2394,7 @@ void ScXMLExport::collectAutoStyles()
                    OSL_ENSURE( pNote, "note not found" );
                    if (pNote)
                    {
                        std::shared_ptr< SdrCaptionObj > pDrawObj = pNote->GetOrCreateCaption( aPos );
                        const std::shared_ptr< SdrCaptionObj >& pDrawObj = pNote->GetOrCreateCaption( aPos );
                        // all uno shapes are created anyway in CollectSharedData
                        uno::Reference<beans::XPropertySet> xShapeProperties( pDrawObj->getUnoShape(), uno::UNO_QUERY );
                        if (xShapeProperties.is())
@@ -2438,7 +2438,7 @@ void ScXMLExport::collectAutoStyles()
                    OSL_ENSURE( pNote, "note not found" );
                    if (pNote)
                    {
                        std::shared_ptr< SdrCaptionObj > pDrawObj = pNote->GetOrCreateCaption( aPos );
                        const std::shared_ptr< SdrCaptionObj >& pDrawObj = pNote->GetOrCreateCaption( aPos );
                        uno::Reference<container::XEnumerationAccess> xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY);
                        uno::Reference<beans::XPropertySet> xParaProp(
                            lcl_GetEnumerated( xCellText, aNoteParaIter->maSelection.nStartPara ), uno::UNO_QUERY );
@@ -2472,7 +2472,7 @@ void ScXMLExport::collectAutoStyles()
                    OSL_ENSURE( pNote, "note not found" );
                    if (pNote)
                    {
                        std::shared_ptr< SdrCaptionObj > pDrawObj = pNote->GetOrCreateCaption( aPos );
                        const std::shared_ptr< SdrCaptionObj >& pDrawObj = pNote->GetOrCreateCaption( aPos );
                        uno::Reference<text::XSimpleText> xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY);
                        uno::Reference<beans::XPropertySet> xCursorProp(xCellText->createTextCursor(), uno::UNO_QUERY);
                        ScDrawTextCursor* pCursor = ScDrawTextCursor::getImplementation( xCursorProp );
@@ -3072,10 +3072,10 @@ void writeContent(
                // <text:a xlink:href="url" xlink:type="simple">value</text:a>

                const SvxURLField* pURLField = static_cast<const SvxURLField*>(pField);
                OUString aURL = pURLField->GetURL();
                const OUString& aURL = pURLField->GetURL();
                rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, rExport.GetRelativeReference(aURL));
                rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, "simple");
                OUString aTargetFrame = pURLField->GetTargetFrame();
                const OUString& aTargetFrame = pURLField->GetTargetFrame();
                if (!aTargetFrame.isEmpty())
                    rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_TARGET_FRAME_NAME, aTargetFrame);

@@ -3628,12 +3628,12 @@ void ScXMLExport::exportAnnotationMeta( const uno::Reference < drawing::XShape >
        // TODO : notes
        //is it still useful, as this call back is only called from ScXMLExport::WriteAnnotation
        // and should be in sync with pCurrentCell
        std::shared_ptr< SdrCaptionObj > pNoteCaption = pNote->GetOrCreateCaption(pCurrentCell->maCellAddress);
        const std::shared_ptr< SdrCaptionObj >& pNoteCaption = pNote->GetOrCreateCaption(pCurrentCell->maCellAddress);
        uno::Reference<drawing::XShape> xCurrentShape( pNoteCaption->getUnoShape(), uno::UNO_QUERY );
        if (xCurrentShape.get()!=xShape.get())
            return;

        OUString sAuthor(pNote->GetAuthor());
        const OUString& sAuthor(pNote->GetAuthor());
        if (!sAuthor.isEmpty())
        {
            SvXMLElementExport aCreatorElem( *this, XML_NAMESPACE_DC,
@@ -3642,7 +3642,7 @@ void ScXMLExport::exportAnnotationMeta( const uno::Reference < drawing::XShape >
            Characters(sAuthor);
        }

        OUString aDate(pNote->GetDate());
        const OUString& aDate(pNote->GetDate());
        if (pDoc)
        {
            SvNumberFormatter* pNumForm = pDoc->GetFormatTable();
@@ -3685,7 +3685,7 @@ void ScXMLExport::WriteAnnotation(ScMyCell& rMyCell)

        pCurrentCell = &rMyCell;

        std::shared_ptr< SdrCaptionObj > pNoteCaption = pNote->GetOrCreateCaption(rMyCell.maCellAddress);
        const std::shared_ptr< SdrCaptionObj >& pNoteCaption = pNote->GetOrCreateCaption(rMyCell.maCellAddress);
        if (pNoteCaption)
        {
            uno::Reference<drawing::XShape> xShape( pNoteCaption->getUnoShape(), uno::UNO_QUERY );
diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx
index 759f3f9..a73b474 100644
--- a/sc/source/ui/app/drwtrans.cxx
+++ b/sc/source/ui/app/drwtrans.cxx
@@ -125,7 +125,7 @@ ScDrawTransferObj::ScDrawTransferObj( std::unique_ptr<SdrModel> pClipModel, ScDo
            SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObject );
            if (pUnoCtrl && SdrInventor::FmForm == pUnoCtrl->GetObjInventor())
            {
                uno::Reference<awt::XControlModel> xControlModel = pUnoCtrl->GetUnoControlModel();
                const uno::Reference<awt::XControlModel>& xControlModel = pUnoCtrl->GetUnoControlModel();
                OSL_ENSURE( xControlModel.is(), "uno control without model" );
                if ( xControlModel.is() )
                {
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 4824e0d..b064c73 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -2095,7 +2095,7 @@ IMPL_LINK( ScModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void )
    if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
    {
        // URLField
        OUString aURL = pURLField->GetURL();
        const OUString& aURL = pURLField->GetURL();

        switch ( pURLField->GetFormat() )
        {
diff --git a/sc/source/ui/app/seltrans.cxx b/sc/source/ui/app/seltrans.cxx
index 5b5aca2..84a0e6b 100644
--- a/sc/source/ui/app/seltrans.cxx
+++ b/sc/source/ui/app/seltrans.cxx
@@ -46,7 +46,7 @@ static bool lcl_IsURLButton( SdrObject* pObject )
    SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObject );
    if (pUnoCtrl && SdrInventor::FmForm == pUnoCtrl->GetObjInventor())
       {
        uno::Reference<awt::XControlModel> xControlModel = pUnoCtrl->GetUnoControlModel();
        const uno::Reference<awt::XControlModel>& xControlModel = pUnoCtrl->GetUnoControlModel();
        OSL_ENSURE( xControlModel.is(), "uno control without model" );
        if ( xControlModel.is() )
        {
diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
index ecb5622..6c9938b 100644
--- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
+++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx
@@ -342,7 +342,7 @@ void ScZoomSliderWnd::UpdateFromItem( const SvxZoomSliderItem* pZoomSliderItem )
            mpImpl->mnMaxZoom >= mpImpl->mnCurrentZoom &&
            mpImpl->mnMaxZoom > gnSliderCenter,
            "Looks like the zoom slider item is corrupted" );
       const css::uno::Sequence < sal_Int32 > rSnappingPoints = pZoomSliderItem->GetSnappingPoints();
       const css::uno::Sequence < sal_Int32 >& rSnappingPoints = pZoomSliderItem->GetSnappingPoints();
       mpImpl->maSnappingPointOffsets.clear();
       mpImpl->maSnappingPointZooms.clear();

diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx
index 0916ee4..0a5d662 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -152,8 +152,7 @@ void FillStyleListBox( const ScDocument* pDoc, ListBox& rLbStyle )
    SfxStyleSheetIterator aStyleIter( pDoc->GetStyleSheetPool(), SfxStyleFamily::Para );
    for ( SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle; pStyle = aStyleIter.Next() )
    {
        OUString aName = pStyle->GetName();
        aStyleNames.insert(aName);
        aStyleNames.insert(pStyle->GetName());
    }
    for(std::set<OUString>::const_iterator itr = aStyleNames.begin(), itrEnd = aStyleNames.end();
                        itr != itrEnd; ++itr)
@@ -213,8 +212,7 @@ ScConditionFrmtEntry::ScConditionFrmtEntry(vcl::Window* pParent, ScDocument* pDo

    if(pFormatEntry)
    {
        OUString aStyleName = pFormatEntry->GetStyle();
        maLbStyle->SelectEntry(aStyleName);
        maLbStyle->SelectEntry(pFormatEntry->GetStyle());
        StyleSelectHdl(*maLbStyle.get());
        ScConditionMode eMode = pFormatEntry->GetOperation();

@@ -507,7 +505,7 @@ void StyleSelect( ListBox& rLbStyle, const ScDocument* pDoc, SvxFontPrevWindow& 
        bool bFound = false;
        for ( SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle && !bFound; pStyle = aStyleIter.Next() )
        {
            OUString aName = pStyle->GetName();
            const OUString& aName = pStyle->GetName();
            if ( rLbStyle.GetEntryPos(aName) == LISTBOX_ENTRY_NOTFOUND )    // all lists contain the same entries
            {
                for( sal_Int32 i = 1, n = rLbStyle.GetEntryCount(); i <= n && !bFound; ++i)
@@ -1239,8 +1237,7 @@ ScDateFrmtEntry::ScDateFrmtEntry(vcl::Window* pParent, ScDocument* pDoc, const S
        sal_Int32 nPos = static_cast<sal_Int32>(pFormat->GetDateType());
        maLbDateEntry->SelectEntryPos(nPos);

        OUString aStyleName = pFormat->GetStyleName();
        maLbStyle->SelectEntry(aStyleName);
        maLbStyle->SelectEntry(pFormat->GetStyleName());
    }

    StyleSelectHdl(*maLbStyle.get());
diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx
index cddaf40..24592e0 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -247,12 +247,10 @@ static void lcl_LoadSeparators( OUString& rFieldSeparators, OUString& rTextSepar
}

static void lcl_SaveSeparators(
    const OUString& rSeparators, const OUString& rTxtSep, bool bMergeDelimiters, bool bQuotedAsText,
    const OUString& sFieldSeparators, const OUString& sTextSeparators, bool bMergeDelimiters, bool bQuotedAsText,
    bool bDetectSpecialNum, bool bFixedWidth, sal_Int32 nFromRow,
    sal_Int32 nCharSet, sal_Int32 nLanguage, bool bSkipEmptyCells, bool bRemoveSpace, ScImportAsciiCall eCall )
{
    OUString sFieldSeparators = rSeparators;
    OUString sTextSeparators = rTxtSep;
    Sequence<Any> aValues;
    Any *pProperties;
    Sequence<OUString> aNames;
diff --git a/sc/source/ui/dialogs/searchresults.cxx b/sc/source/ui/dialogs/searchresults.cxx
index 436e0ec..3b0a829 100644
--- a/sc/source/ui/dialogs/searchresults.cxx
+++ b/sc/source/ui/dialogs/searchresults.cxx
@@ -135,7 +135,7 @@ void SearchResultsDlg::FillResults( ScDocument* pDoc, const ScRangeList &rMatche
            ScCellIterator aIter(pDoc, rMatchedRanges[i]);
            for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
            {
                ScAddress aPos = aIter.GetPos();
                const ScAddress& aPos = aIter.GetPos();
                if (aPos.Tab() >= nTabCount)
                    // Out-of-bound sheet index.
                    continue;
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 480b8d4..90a24a9 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -596,7 +596,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
        case SID_GET_COLORLIST:
            {
                const SvxColorListItem* pColItem = GetItem(SID_COLOR_TABLE);
                XColorListRef pList = pColItem->GetColorList();
                const XColorListRef& pList = pColItem->GetColorList();
                rReq.SetReturnValue(OfaRefItem<XColorList>(SID_GET_COLORLIST, pList));
            }
            break;
@@ -863,7 +863,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
                {
                    if (const SfxStringItem* pStringItem = dynamic_cast<const SfxStringItem*>(pItem))
                    {
                        OUString aName = pStringItem->GetValue();
                        const OUString& aName = pStringItem->GetValue();
                        SCTAB nTab;
                        if (m_aDocument.GetTable( aName, nTab ))
                        {
@@ -1445,7 +1445,7 @@ void ScDocShell::NotifyStyle( const SfxStyleSheetHint& rHint )
        {
            ScDocShellModificator aModificator( *this );

            OUString aNewName = pStyle->GetName();
            const OUString& aNewName = pStyle->GetName();
            OUString aOldName = aNewName;
            const SfxStyleSheetModifiedHint* pExtendedHint = dynamic_cast<const SfxStyleSheetModifiedHint*>(&rHint); // name changed?
            if (pExtendedHint)
@@ -1483,7 +1483,7 @@ void ScDocShell::NotifyStyle( const SfxStyleSheetHint& rHint )
    {
        if ( nId == SfxHintId::StyleSheetModified)
        {
            OUString aNewName = pStyle->GetName();
            const OUString& aNewName = pStyle->GetName();
            OUString aOldName = aNewName;
            const SfxStyleSheetModifiedHint* pExtendedHint = dynamic_cast<const SfxStyleSheetModifiedHint*>(&rHint);
            if (pExtendedHint)
diff --git a/sc/source/ui/docshell/documentlinkmgr.cxx b/sc/source/ui/docshell/documentlinkmgr.cxx
index e38ad8a..7452f87 100644
--- a/sc/source/ui/docshell/documentlinkmgr.cxx
+++ b/sc/source/ui/docshell/documentlinkmgr.cxx
@@ -189,9 +189,9 @@ bool DocumentLinkManager::updateDdeOrOleOrWebServiceLinks(weld::Window* pWin)
        else
        {
            // Update failed.  Notify the user.
            OUString aFile = pDdeLink->GetTopic();
            OUString aElem = pDdeLink->GetItem();
            OUString aType = pDdeLink->GetAppl();
            const OUString& aFile = pDdeLink->GetTopic();
            const OUString& aElem = pDdeLink->GetItem();
            const OUString& aType = pDdeLink->GetAppl();

            OUStringBuffer aBuf;
            aBuf.append(ScResId(SCSTR_DDEDOC_NOT_LOADED));
diff --git a/sc/source/ui/docshell/servobj.cxx b/sc/source/ui/docshell/servobj.cxx
index 1b4190f..2470e30 100644
--- a/sc/source/ui/docshell/servobj.cxx
+++ b/sc/source/ui/docshell/servobj.cxx
@@ -229,7 +229,7 @@ void ScServerObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
            bDataChanged = true;
        else if (const ScAreaChangedHint *pChgHint = dynamic_cast<const ScAreaChangedHint*>(&rHint))      // position of broadcaster changed
        {
            ScRange aNewRange = pChgHint->GetRange();
            const ScRange& aNewRange = pChgHint->GetRange();
            if ( aRange != aNewRange )
            {
                bRefreshListener = true;
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 24ccaca..41923ef 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -325,7 +325,7 @@ void ScDrawShell::ExecuteMacroAssign( SdrObject* pObj, vcl::Window* pWin )
    if ( !pInfo->GetMacro().isEmpty() )
    {
        SvxMacroTableDtor aTab;
        OUString sMacro = pInfo->GetMacro();
        const OUString& sMacro = pInfo->GetMacro();
        aTab.Insert(SvMacroItemId::OnClick, SvxMacro(sMacro, OUString()));
        aItem.SetMacroTable( aTab );
    }
diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx
index cc036a2..81b9c31 100644
--- a/sc/source/ui/drawfunc/drawsh5.cxx
+++ b/sc/source/ui/drawfunc/drawsh5.cxx
@@ -81,7 +81,7 @@ void ScDrawShell::GetHLinkState( SfxItemSet& rSet )             //  Hyperlink
        SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObj );
        if (pUnoCtrl && SdrInventor::FmForm == pUnoCtrl->GetObjInventor())
        {
            uno::Reference<awt::XControlModel> xControlModel = pUnoCtrl->GetUnoControlModel();
            const uno::Reference<awt::XControlModel>& xControlModel = pUnoCtrl->GetUnoControlModel();
            OSL_ENSURE( xControlModel.is(), "UNO-Control without model" );
            if( !xControlModel.is() )
                return;
@@ -167,7 +167,7 @@ void ScDrawShell::ExecuteHLink( const SfxRequest& rReq )
                            SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObj  );
                            if (pUnoCtrl && SdrInventor::FmForm == pUnoCtrl->GetObjInventor())
                            {
                                uno::Reference<awt::XControlModel> xControlModel =
                                const uno::Reference<awt::XControlModel>& xControlModel =
                                                        pUnoCtrl->GetUnoControlModel();
                                OSL_ENSURE( xControlModel.is(), "UNO-Control without model" );
                                if( !xControlModel.is() )
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index 466e62b..385fbbe 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -227,7 +227,7 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq )
                    const SfxStringItem* pFontItem = dynamic_cast<const SfxStringItem*>( pFtItem  );
                    if ( pFontItem )
                    {
                        OUString aFontName(pFontItem->GetValue());
                        const OUString& aFontName(pFontItem->GetValue());
                        vcl::Font aFont(aFontName, Size(1,1)); // Size only because of CTOR
                        aNewItem = SvxFontItem( aFont.GetFamilyType(), aFont.GetFamilyName(),
                                    aFont.GetStyleName(), aFont.GetPitch(),
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index 84551c0..0bbc619 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -320,7 +320,7 @@ FuInsertGraphic::FuInsertGraphic( ScTabViewShell&   rViewSh,
            if( nError == ERRCODE_NONE )
            {
                OUString aFileName = aDlg.GetPath();
                OUString aFilterName = aDlg.GetDetectedFilter();
                const OUString& aFilterName = aDlg.GetDetectedFilter();
                bool bAsLink = aDlg.IsAsLink();

                // really store as link only?
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index 6ac928a..cebad75 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -241,7 +241,7 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView*
    const SfxGlobalNameItem* pNameItem = rReq.GetArg<SfxGlobalNameItem>(SID_INSERT_OBJECT);
    if ( nSlot == SID_INSERT_OBJECT && pNameItem )
    {
        SvGlobalName aClassName = pNameItem->GetValue();
        const SvGlobalName& aClassName = pNameItem->GetValue();
        xObj = rViewShell.GetViewFrame()->GetObjectShell()->GetEmbeddedObjectContainer().CreateEmbeddedObject( aClassName.GetByteSequence(), aName );
    }
    else if ( nSlot == SID_INSERT_SMATH )
diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx
index c0368ee..0cd4554 100644
--- a/sc/source/ui/drawfunc/graphsh.cxx
+++ b/sc/source/ui/drawfunc/graphsh.cxx
@@ -286,7 +286,7 @@ void ScGraphicShell::ExecuteSaveGraphic( SAL_UNUSED_PARAMETER SfxRequest& /*rReq
            }
            else if (nState == RET_NO)
            {
                GraphicObject aGraphicObject(pObj->GetGraphicObject());
                const GraphicObject& aGraphicObject(pObj->GetGraphicObject());
                GraphicHelper::ExportGraphic(pWinFrame, aGraphicObject.GetGraphic(), "");
            }
        }
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 489a12d..7644e14 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -426,7 +426,7 @@ IMPL_LINK_NOARG(ScContentTree, ContentDoubleClickHdl, SvTreeListBox*, bool)
                const ScAreaLink* pLink = GetLink( nChild );
                if( pLink )
                {
                    ScRange aRange = pLink->GetDestArea();
                    const ScRange& aRange = pLink->GetDestArea();
                    ScDocument* pSrcDoc = GetSourceDocument();
                    OUString aRangeStr(aRange.Format(ScRefFlags::RANGE_ABS_3D, pSrcDoc, pSrcDoc->GetAddressConvention()));
                    pParentWindow->SetCurrentCellStr( aRangeStr );
diff --git a/sc/source/ui/navipi/navcitem.cxx b/sc/source/ui/navipi/navcitem.cxx
index f69e9b8..976fca5 100644
--- a/sc/source/ui/navipi/navcitem.cxx
+++ b/sc/source/ui/navipi/navcitem.cxx
@@ -47,7 +47,7 @@ void ScNavigatorControllerItem::StateChanged( sal_uInt16 /* nSID */, SfxItemStat

                if ( pCellPosItem )
                {
                    OUString  aAddress( pCellPosItem->GetValue() );
                    const OUString&  aAddress( pCellPosItem->GetValue() );
                    ScAddress aScAddress;
                    aScAddress.Parse( aAddress );

diff --git a/sc/source/ui/navipi/scenwnd.cxx b/sc/source/ui/navipi/scenwnd.cxx
index 95adcca..df63657 100644
--- a/sc/source/ui/navipi/scenwnd.cxx
+++ b/sc/source/ui/navipi/scenwnd.cxx
@@ -256,7 +256,7 @@ void ScScenarioWindow::NotifyState( const SfxPoolItem* pState )

        if ( auto pStringItem = dynamic_cast<const SfxStringItem*>( pState) )
        {
            OUString aNewEntry( pStringItem->GetValue() );
            const OUString& aNewEntry( pStringItem->GetValue() );

            if ( !aNewEntry.isEmpty() )
                aLbScenario->SelectEntry( aNewEntry );
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
index 47f251e..28eb0ab0 100644
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
@@ -246,7 +246,7 @@ void NumberFormatPropertyPanel::NotifyItemUpdate(
            if( eState >= SfxItemState::DEFAULT)
            {
                const SfxStringItem* pItem = static_cast<const SfxStringItem*>(pState);
                OUString aCode = pItem->GetValue();
                const OUString& aCode = pItem->GetValue();
                sal_Int32 nIndex = 0;
                sal_Int32 aFormat[4] = {0};
                for (sal_Int32 & rn : aFormat)
diff --git a/sc/source/ui/unoobj/ChartTools.cxx b/sc/source/ui/unoobj/ChartTools.cxx
index c742636..6647e10 100644
--- a/sc/source/ui/unoobj/ChartTools.cxx
+++ b/sc/source/ui/unoobj/ChartTools.cxx
@@ -39,7 +39,7 @@ getPivotTableDataProvider(const SdrOle2Obj* pOleObject)
{
    uno::Reference<chart2::data::XPivotTableDataProvider> xPivotTableDataProvider;

    uno::Reference<embed::XEmbeddedObject> xObject = pOleObject->GetObjRef();
    const uno::Reference<embed::XEmbeddedObject>& xObject = pOleObject->GetObjRef();
    if (xObject.is())
    {
        uno::Reference<chart2::XChartDocument> xChartDoc(xObject->getComponent(), uno::UNO_QUERY);
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index f7bf1d0c..3a56fb1 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -344,8 +344,7 @@ ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByIndex_Impl( sal_Int32 nInd
                {
                    if ( nFound == nIndex )
                    {
                        OUString aName = rDPObj.GetName();
                        return new ScDataPilotTableObj( pDocShell, nTab, aName );
                        return new ScDataPilotTableObj( pDocShell, nTab, rDPObj.GetName() );
                    }
                    ++nFound;
                }
@@ -2538,7 +2537,7 @@ Reference< XDataPilotField > SAL_CALL ScDataPilotFieldObj::createNameGroup( cons
    ScDPObject* pDPObj = nullptr;
    if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
    {
        OUString aDimName = pDim->GetName();
        const OUString& aDimName = pDim->GetName();

        ScDPSaveData aSaveData = *pDPObj->GetSaveData();
        ScDPDimensionSaveData* pDimData = aSaveData.GetDimensionData();     // created if not there
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 10c2220..ef5aca3 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -2591,8 +2591,7 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const OUString& aPropertyName )
        }
        else if ( aPropertyName == SC_UNO_CODENAME )
        {
            OUString sCodeName = rDoc.GetCodeName();
            aRet <<= sCodeName;
            aRet <<= rDoc.GetCodeName();
        }

        else if ( aPropertyName == SC_UNO_CJK_CLOCAL )
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 6e5ff6f8..08bdca0 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -1870,7 +1870,7 @@ uno::Any ScStyleObj::getPropertyValue_Impl( const OUString& aPropertyName )
                        break;
                    case ATTR_PAGE_SCALETO:
                        {
                            ScPageScaleToItem aItem(pItemSet->Get(ATTR_PAGE_SCALETO));
                            const ScPageScaleToItem& aItem(pItemSet->Get(ATTR_PAGE_SCALETO));
                            if ( aPropertyName == SC_UNO_PAGE_SCALETOX )
                                aAny <<= static_cast<sal_Int16>(aItem.GetWidth());
                            else
diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx
index fb1a4e2..70fca98 100644
--- a/sc/source/ui/vba/vbaapplication.cxx
+++ b/sc/source/ui/vba/vbaapplication.cxx
@@ -927,7 +927,7 @@ static uno::Reference< util::XPathSettings > const & lcl_getPathSettingsService(
OUString ScVbaApplication::getOfficePath( const OUString& _sPathType )
{
    OUString sRetPath;
    uno::Reference< util::XPathSettings > xProps = lcl_getPathSettingsService( mxContext );
    const uno::Reference< util::XPathSettings >& xProps = lcl_getPathSettingsService( mxContext );
    try
    {
        OUString sUrl;
@@ -949,7 +949,7 @@ OUString ScVbaApplication::getOfficePath( const OUString& _sPathType )
void SAL_CALL
ScVbaApplication::setDefaultFilePath( const OUString& DefaultFilePath )
{
    uno::Reference< util::XPathSettings > xProps = lcl_getPathSettingsService( mxContext );
    const uno::Reference< util::XPathSettings >& xProps = lcl_getPathSettingsService( mxContext );
    OUString aURL;
    osl::FileBase::getFileURLFromSystemPath( DefaultFilePath, aURL );
    xProps->setWork( aURL );
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 2c2fd50..fafee68 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -278,7 +278,7 @@ void ScVbaRange::fireChangeEvent()
    if( ScVbaApplication::getDocumentEventsEnabled() )
    {
        ScDocument& rDoc = getScDocument();
        uno::Reference< script::vba::XVBAEventProcessor > xVBAEvents = rDoc.GetVbaEventProcessor();
        const uno::Reference< script::vba::XVBAEventProcessor >& xVBAEvents = rDoc.GetVbaEventProcessor();
        if( xVBAEvents.is() ) try
        {
            uno::Sequence< uno::Any > aArgs( 1 );
@@ -1532,7 +1532,7 @@ ScVbaRange::setValue( const uno::Any& aValue, ValueSetter& valueSetter )
    uno::TypeClass aClass = aValue.getValueTypeClass();
    if ( aClass == uno::TypeClass_SEQUENCE )
    {
        uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
        const uno::Reference< script::XTypeConverter >& xConverter = getTypeConverter( mxContext );
        uno::Any aConverted;
        try
        {
@@ -1957,7 +1957,7 @@ ScVbaRange::getFormulaArray()
        return uno::makeAny( xFormulaArray->getArrayFormula() );

    uno::Reference< sheet::XCellRangeFormula> xCellRangeFormula( mxRange, uno::UNO_QUERY_THROW );
    uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
    const uno::Reference< script::XTypeConverter >& xConverter = getTypeConverter( mxContext );
    uno::Any aSingleValueOrMatrix;
    // When dealing with a single element ( embedded in the sequence of sequence ) unwrap and return
    // that value
@@ -2167,7 +2167,7 @@ ScVbaRange::CellsHelper( const uno::Reference< ov::XHelperInterface >& xParent,
    // conversion routine e.g. bSuccess = getValueFromAny( nRow, nRowIndex, cppu::UnoType<sal_Int32>::get() )
    if ( nRowIndex.hasValue() && !( nRowIndex >>= nRow ) )
    {
        uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( xContext );
        const uno::Reference< script::XTypeConverter >& xConverter = getTypeConverter( xContext );
        uno::Any aConverted;
        try
        {
@@ -2194,7 +2194,7 @@ ScVbaRange::CellsHelper( const uno::Reference< ov::XHelperInterface >& xParent,
        {
            if ( !( nColumnIndex >>= nColumn ) )
            {
                uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( xContext );
                const uno::Reference< script::XTypeConverter >& xConverter = getTypeConverter( xContext );
                uno::Any aConverted;
                try
                {
@@ -4463,7 +4463,7 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const
    uno::Any Field( aField );
    if ( !( Field >>= nField ) )
    {
        uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
        const uno::Reference< script::XTypeConverter >& xConverter = getTypeConverter( mxContext );
        try
        {
            Field = xConverter->convertTo( aField, cppu::UnoType<sal_Int32>::get() );
diff --git a/sc/source/ui/vba/vbaworksheets.cxx b/sc/source/ui/vba/vbaworksheets.cxx
index 81870ab..681989b 100644
--- a/sc/source/ui/vba/vbaworksheets.cxx
+++ b/sc/source/ui/vba/vbaworksheets.cxx
@@ -432,7 +432,7 @@ ScVbaWorksheets::Item(const uno::Any& Index, const uno::Any& Index2)
{
    if ( Index.getValueTypeClass() == uno::TypeClass_SEQUENCE )
    {
        uno::Reference< script::XTypeConverter > xConverter = getTypeConverter(mxContext);
        const uno::Reference< script::XTypeConverter >& xConverter = getTypeConverter(mxContext);
        uno::Any aConverted;
        aConverted = xConverter->convertTo( Index, cppu::UnoType<uno::Sequence< uno::Any >>::get() );
        SheetMap aSheets;
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index c5060b3..4324698 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2397,7 +2397,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
            if ( pReqArgs && pReqArgs->HasItem( SID_ATTR_POSTIT_ID, &pId) )
            {
                const SvxPostItIdItem* pIdItem = static_cast<const SvxPostItIdItem*>(pId);
                OUString aCellId = pIdItem->GetValue();
                const OUString& aCellId = pIdItem->GetValue();
                if (!aCellId.isEmpty())
                {
                    SetTabNoAndCursor( GetViewData(), aCellId );
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 2a2956a..f62eecd 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -235,8 +235,8 @@ void ScCellShell::Execute( SfxRequest& rReq )
                    = static_cast<const ScInputStatusItem*>(&pReqArgs->
                            Get( FID_INPUTLINE_STATUS ));

                ScAddress aCursorPos = pStatusItem->GetPos();
                OUString aString = pStatusItem->GetString();
                const ScAddress& aCursorPos = pStatusItem->GetPos();
                const OUString& aString = pStatusItem->GetString();
                const EditTextObject* pData = pStatusItem->GetEditData();

                if (pData)
diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index ef904f5..7eb6750 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -176,7 +176,7 @@ void getRangeFromOle2Object(const SdrOle2Obj& rObj, std::vector<OUString>& rRang
        // not a chart object.
        return;

    uno::Reference<embed::XEmbeddedObject> xObj = rObj.GetObjRef();
    const uno::Reference<embed::XEmbeddedObject>& xObj = rObj.GetObjRef();
    if (!xObj.is())
        return;

diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index dc13c91..3882c0d 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -482,7 +482,7 @@ void ScDrawView::MarkListHasChanged()
    uno::Sequence< embed::VerbDescriptor > aVerbs;
    if ( pOle2Obj && !bOle )
    {
        uno::Reference < embed::XEmbeddedObject > xObj = pOle2Obj->GetObjRef();
        const uno::Reference < embed::XEmbeddedObject >& xObj = pOle2Obj->GetObjRef();
        OSL_ENSURE( xObj.is(), "SdrOle2Obj without ObjRef" );
        if (xObj.is())
            aVerbs = xObj->getSupportedVerbs();
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 8e0cd55..94bd48e 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -406,7 +406,7 @@ void ScEditShell::Execute( SfxRequest& rReq )
                    const SfxStringItem* pFontItem = dynamic_cast<const SfxStringItem*>( pFtItem  );
                    if ( pFontItem )
                    {
                        OUString aFontName(pFontItem->GetValue());
                        const OUString& aFontName(pFontItem->GetValue());
                        vcl::Font aFont(aFontName, Size(1,1)); // Size just because CTOR
                        aNewItem = SvxFontItem( aFont.GetFamilyType(), aFont.GetFamilyName(),
                                    aFont.GetStyleName(), aFont.GetPitch(),
@@ -535,7 +535,7 @@ void ScEditShell::Execute( SfxRequest& rReq )
                    aFinder.ToggleRel( aSel.nStartPos, aSel.nEndPos );
                    if (aFinder.GetFound())
                    {
                        OUString aNew = aFinder.GetText();
                        const OUString& aNew = aFinder.GetText();
                        ESelection aNewSel( 0,aFinder.GetSelStart(), 0,aFinder.GetSelEnd() );
                        pEngine->SetText( aNew );
                        pTableView->SetSelection( aNewSel );
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 4b9e14c..d931d38 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -1965,7 +1965,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
            // ATTR_BACKGROUND (=SID_ATTR_BRUSH) has to be set to two IDs:
            case SID_BACKGROUND_COLOR:
                {
                    const SvxColorItem  rNewColorItem = pNewAttrs->Get( SID_BACKGROUND_COLOR );
                    const SvxColorItem&  rNewColorItem = pNewAttrs->Get( SID_BACKGROUND_COLOR );

                    SvxBrushItem        aBrushItem(
                                            pTabViewShell->GetSelectionPattern()->
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index efabe0d..00a83cd 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4448,7 +4448,7 @@ void ScGridWindow::PasteSelection( const Point& rPosPixel )
        //  get selection from system

        TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSelection( this ) );
        uno::Reference<datatransfer::XTransferable> xTransferable = aDataHelper.GetTransferable();
        const uno::Reference<datatransfer::XTransferable>& xTransferable = aDataHelper.GetTransferable();
        if ( xTransferable.is() )
        {
            SotClipboardFormatId nFormatId = lcl_GetDropFormatId( xTransferable, true );
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index a9023e0..741e672 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -2007,7 +2007,7 @@ tools::Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, co
                        // in Metafiles always use DrawTextArray to ensure that positions are
                        // recorded (for non-proportional resize):

                        OUString aString = aVars.GetString();
                        const OUString& aString = aVars.GetString();
                        if (!aString.isEmpty())
                        {
                            // If the string is clipped, make it shorter for
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 2fef51b..1691981 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -3047,7 +3047,7 @@ void ScViewFunc::HideTable( const ScMarkData& rMark )
        ScMarkData::MarkedTabsType::const_iterator it;
        std::vector<SCTAB> undoTabs;

        ScMarkData::MarkedTabsType selectedTabs = rMark.GetSelectedTabs();
        const ScMarkData::MarkedTabsType& selectedTabs = rMark.GetSelectedTabs();
        for (it=selectedTabs.begin(); it!=selectedTabs.end(); ++it)
        {
            nTab = *it;
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 28413a8..7d6411c 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -461,7 +461,7 @@ void ScViewFunc::PasteDraw()
    const ScDrawTransferObj* pDrawClip = ScDrawTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(rViewData.GetActiveWin()));
    if (pDrawClip)
    {
        OUString aSrcShellID = pDrawClip->GetShellID();
        const OUString& aSrcShellID = pDrawClip->GetShellID();
        OUString aDestShellID = SfxObjectShell::CreateShellID(rViewData.GetDocShell());
        PasteDraw(aPos, pDrawClip->GetModel(), false, aSrcShellID, aDestShellID);
    }
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 25e8fb0..4babeee 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -268,7 +268,7 @@ void ScViewFunc::DoRefConversion()
                if (aFinder.GetFound())
                {
                    ScAddress aPos = pCell->aPos;
                    OUString aNew = aFinder.GetText();
                    const OUString& aNew = aFinder.GetText();
                    ScCompiler aComp( pDoc, aPos, pDoc->GetGrammar());
                    std::unique_ptr<ScTokenArray> pArr(aComp.CompileString(aNew));
                    ScFormulaCell* pNewCell =