clang-tidy performance-unnecessary-copy-init in test..xmlscript

Change-Id: I1ae16467a8e58e8a50f59b7a140e9f8b68bde07e
Reviewed-on: https://gerrit.libreoffice.org/62254
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/test/source/beans/xpropertyset.cxx b/test/source/beans/xpropertyset.cxx
index 63969e8..2da14e7 100644
--- a/test/source/beans/xpropertyset.cxx
+++ b/test/source/beans/xpropertyset.cxx
@@ -76,7 +76,7 @@ bool XPropertySet::isPropertyValueChangeable(const OUString& rName)
    try
    {
        uno::Any any = xPropSet->getPropertyValue(rName);
        uno::Type type = any.getValueType();
        const uno::Type& type = any.getValueType();
        if (type == cppu::UnoType<bool>::get())
        {
            // boolean type
diff --git a/test/source/mtfxmldump.cxx b/test/source/mtfxmldump.cxx
index b298f73..e54c78c 100644
--- a/test/source/mtfxmldump.cxx
+++ b/test/source/mtfxmldump.cxx
@@ -541,7 +541,6 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r
                writeStartPoint(rWriter, pMetaLineAction->GetStartPoint());
                writeEndPoint(rWriter, pMetaLineAction->GetEndPoint());

                LineInfo aLineInfo = pMetaLineAction->GetLineInfo();
                writeLineInfo(rWriter, pMetaLineAction->GetLineInfo());
                rWriter.endElement();
            }
diff --git a/test/source/primitive2dxmldump.cxx b/test/source/primitive2dxmldump.cxx
index 4f5c63e..fa2b02d4 100644
--- a/test/source/primitive2dxmldump.cxx
+++ b/test/source/primitive2dxmldump.cxx
@@ -127,7 +127,7 @@ void Primitive2dXmlDump::decomposeAndWrite(

                rWriter.startElement("polypolygoncolor");
                rWriter.attribute("color", convertColorToString(rPolyPolygonColorPrimitive2D.getBColor()));
                const basegfx::B2DPolyPolygon aB2DPolyPolygon(rPolyPolygonColorPrimitive2D.getB2DPolyPolygon());
                const basegfx::B2DPolyPolygon& aB2DPolyPolygon(rPolyPolygonColorPrimitive2D.getB2DPolyPolygon());
                const basegfx::B2DRange aB2DRange(aB2DPolyPolygon.getB2DRange());
                rWriter.attribute("height", aB2DRange.getHeight());
                rWriter.attribute("width", aB2DRange.getWidth());
@@ -148,7 +148,7 @@ void Primitive2dXmlDump::decomposeAndWrite(
                rWriter.startElement("polypolygonstroke");

                rWriter.startElement("line");
                drawinglayer::attribute::LineAttribute aLineAttribute = rPolyPolygonStrokePrimitive2D.getLineAttribute();
                const drawinglayer::attribute::LineAttribute& aLineAttribute = rPolyPolygonStrokePrimitive2D.getLineAttribute();
                rWriter.attribute("color", convertColorToString(aLineAttribute.getColor()));
                rWriter.attribute("width", aLineAttribute.getWidth());
                //rWriter.attribute("linejoin", aLineAttribute.getLineJoin());
@@ -197,7 +197,7 @@ void Primitive2dXmlDump::decomposeAndWrite(
                rWriter.attribute("text", rTextSimplePortionPrimitive2D.getText());
                rWriter.attribute("fontcolor", convertColorToString(rTextSimplePortionPrimitive2D.getFontColor()));

                drawinglayer::attribute::FontAttribute aFontAttribute = rTextSimplePortionPrimitive2D.getFontAttribute();
                const drawinglayer::attribute::FontAttribute& aFontAttribute = rTextSimplePortionPrimitive2D.getFontAttribute();
                rWriter.attribute("familyname", aFontAttribute.getFamilyName());
                rWriter.endElement();
            }
diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx
index 7521af3..12d9cb9 100644
--- a/tools/source/generic/poly2.cxx
+++ b/tools/source/generic/poly2.cxx
@@ -480,7 +480,7 @@ ImplPolyPolygon::ImplPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon)

        for(sal_uInt16 a(0); a < nCount; a++)
        {
            basegfx::B2DPolygon aCandidate(rPolyPolygon.getB2DPolygon(sal_uInt32(a)));
            const basegfx::B2DPolygon& aCandidate(rPolyPolygon.getB2DPolygon(sal_uInt32(a)));
            mvPolyAry[a] = tools::Polygon( aCandidate );
        }
    }
diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx
index 579c9c8..3b65f711 100644
--- a/ucb/source/ucp/file/bc.cxx
+++ b/ucb/source/ucp/file/bc.cxx
@@ -1127,7 +1127,7 @@ void BaseContent::insert( sal_Int32 nMyCommandIdentifier,
                        RTL_TEXTENCODING_UTF8),
                    static_cast<cppu::OWeakObject*>(this),
                    m_pMyShell,nMyCommandIdentifier);
            uno::Reference<task::XInteractionRequest> const xReq(aRequestImpl.getRequest());
            uno::Reference<task::XInteractionRequest> const& xReq(aRequestImpl.getRequest());

            m_pMyShell->handleTask( nMyCommandIdentifier, xReq );
            if (aRequestImpl.aborted() || aRequestImpl.newName().isEmpty())
diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx
index a07e626..5279a74 100644
--- a/ucb/source/ucp/ftp/ftpcontent.cxx
+++ b/ucb/source/ucp/ftp/ftpcontent.cxx
@@ -717,7 +717,7 @@ void FTPContent::insert(const InsertCommandArgument& aInsertCommand,
            }

            XInteractionRequestImpl request;
            Reference<XInteractionRequest> xReq(request.getRequest());
            const Reference<XInteractionRequest>& xReq(request.getRequest());
            xInt->handle(xReq);
            if (request.approved()) {
                bReplace = true;
diff --git a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
index bf28bb1..dcff8c7 100644
--- a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
@@ -1021,7 +1021,7 @@ void DAVResourceAccess::initialize()
    if ( m_aPath.isEmpty() )
    {
        NeonUri aURI( m_aURL );
        OUString aPath( aURI.GetPath() );
        const OUString& aPath( aURI.GetPath() );

        /* #134089# - Check URI */
        if ( aPath.isEmpty() )
diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx
index 28ed1b1..57ffe10 100644
--- a/ucb/source/ucp/webdav-neon/NeonSession.cxx
+++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx
@@ -294,7 +294,7 @@ int NeonSession::NeonAuth(const char* inAuthProtocol, const char* inRealm,
        try
        {
            NeonUri uri( getRequestEnvironment().m_aRequestURI );
            OUString aUserInfo( uri.GetUserInfo() );
            const OUString& aUserInfo( uri.GetUserInfo() );
            if ( !aUserInfo.isEmpty() )
            {
                sal_Int32 nPos = aUserInfo.indexOf( '@' );
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index 247b75f..86cac88 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -3849,7 +3849,7 @@ Content::ResourceType Content::getResourceType(
                {
                    // extract host name and connection port
                    NeonUri   theUri( rURL );
                    OUString  aHostName  = theUri.GetHost();
                    const OUString&  aHostName  = theUri.GetHost();
                    sal_Int32 nPort      = theUri.GetPort();
                    throw DAVException( DAVException::DAV_HTTP_TIMEOUT,
                                        NeonUri::makeConnectionEndPointString( aHostName,
diff --git a/ucbhelper/source/client/interceptedinteraction.cxx b/ucbhelper/source/client/interceptedinteraction.cxx
index 69aab51..afc2f3b 100644
--- a/ucbhelper/source/client/interceptedinteraction.cxx
+++ b/ucbhelper/source/client/interceptedinteraction.cxx
@@ -100,7 +100,7 @@ void InterceptedInteraction::impl_handleDefault(const css::uno::Reference< css::
InterceptedInteraction::EInterceptionState InterceptedInteraction::impl_interceptRequest(const css::uno::Reference< css::task::XInteractionRequest >& xRequest)
{
    css::uno::Any                                                                    aRequest       = xRequest->getRequest();
    css::uno::Type                                                                   aRequestType   = aRequest.getValueType();
    const css::uno::Type&                                                            aRequestType   = aRequest.getValueType();
    css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > lContinuations = xRequest->getContinuations();

    // check against the list of static requests
diff --git a/unodevtools/source/skeletonmaker/javacompskeleton.cxx b/unodevtools/source/skeletonmaker/javacompskeleton.cxx
index f64a341..741387c 100644
--- a/unodevtools/source/skeletonmaker/javacompskeleton.cxx
+++ b/unodevtools/source/skeletonmaker/javacompskeleton.cxx
@@ -492,8 +492,7 @@ static void generateMethodBodies(std::ostream& o,
         const OString& indentation, bool usepropertymixin)
{
    codemaker::GeneratedTypeSet generated;
    for (const auto& rIface : interfaces) {
        OUString type(rIface);
    for (const OUString& type : interfaces) {
        if (type == "com.sun.star.lang.XServiceInfo") {
            generateXServiceInfoBodies(o);
            generated.add(u2b(type));
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx
index 365cea6..89f9ab5 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -292,7 +292,7 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( const LanguageTag& rLan
    }
    else
    {
        Locale aLocale( aLanguageTag.getLocale());
        const Locale& aLocale( aLanguageTag.getLocale());
        if (MsLangId::isTraditionalChinese(aLocale))
            return OUString(FALLBACKFONT_UI_SANS_CHINTRD);
        else if (MsLangId::isSimplifiedChinese(aLocale))
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 8b47827..b9b4b78 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -507,7 +507,7 @@ bool LocaleDataWrapper::doesSecondaryCalendarUseEC( const OUString& rName ) cons

    // Check language tag first to avoid loading all calendars of this locale.
    LanguageTag aLoaded( getLoadedLanguageTag());
    OUString aBcp47( aLoaded.getBcp47());
    const OUString& aBcp47( aLoaded.getBcp47());
    // So far determine only by locale, we know for a few.
    /* TODO: check date format codes? or add to locale data? */
    if (    aBcp47 != "ja-JP" &&
diff --git a/unotools/source/misc/ZipPackageHelper.cxx b/unotools/source/misc/ZipPackageHelper.cxx
index 4d47204..2138801 100644
--- a/unotools/source/misc/ZipPackageHelper.cxx
+++ b/unotools/source/misc/ZipPackageHelper.cxx
@@ -158,19 +158,12 @@ void ZipPackageHelper::addFolderWithContent( Reference< XInterface > const & xRo
}

void ZipPackageHelper::addFile( css::uno::Reference< css::uno::XInterface > const & xRootFolder,
                                const OUString& rSourceFile )
                                const OUString& rSourceFileURL )
{
    OUString aFileURL( rSourceFile );

    /*if( !aFileURL.matchIgnoreAsciiCase("file://") )
    {
        aFileURL = URIHelper::SmartRel2Abs( aFileURL, Link<OUString *, bool>(), false );
    }*/

    INetURLObject aURL( aFileURL );
    INetURLObject aURL( rSourceFileURL );
    OUString aName( aURL.getName() );

    SvFileStream* pStream = new SvFileStream(aFileURL, StreamMode::READ );
    SvFileStream* pStream = new SvFileStream(rSourceFileURL, StreamMode::READ );
    Reference< XInputStream > xInput(  new utl::OSeekableInputStreamWrapper( pStream, true ) );
    Reference< XActiveDataSink > xSink( mxFactory->createInstance(), UNO_QUERY );
    Reference< XUnoTunnel > xTunnel( xSink, UNO_QUERY );
diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx
index 2ba945f..c05e0a0b 100644
--- a/unoxml/source/dom/document.cxx
+++ b/unoxml/source/dom/document.cxx
@@ -376,8 +376,7 @@ namespace DOM
        }

        // notify listeners about start
        for (const auto& rStreamListener : streamListeners) {
            Reference< XStreamListener > aListener = rStreamListener;
        for (const Reference< XStreamListener >& aListener : streamListeners) {
            aListener->started();
        }

@@ -395,8 +394,7 @@ namespace DOM
        }

        // call listeners
        for (const auto& rStreamListener : streamListeners) {
            Reference< XStreamListener > aListener = rStreamListener;
        for (const Reference< XStreamListener >& aListener : streamListeners) {
            aListener->closed();
        }
    }
diff --git a/vbahelper/source/vbahelper/vbashapes.cxx b/vbahelper/source/vbahelper/vbashapes.cxx
index 6d5849e..3a0137b 100644
--- a/vbahelper/source/vbahelper/vbashapes.cxx
+++ b/vbahelper/source/vbahelper/vbashapes.cxx
@@ -140,7 +140,7 @@ ScVbaShapes::getShapesByArrayIndices( const uno::Any& Index  )
    if ( Index.getValueTypeClass() != uno::TypeClass_SEQUENCE )
        throw uno::RuntimeException();

    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() );

diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 52fe3b4..170476d 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -2256,9 +2256,8 @@ void RadioButton::ImplUncheckAllOther()

    std::vector<VclPtr<RadioButton> > aGroup(GetRadioButtonGroup(false));
    // iterate over radio button group and checked buttons
    for (auto const& elem : aGroup)
    for (VclPtr<RadioButton>& pWindow : aGroup)
    {
        VclPtr<RadioButton> pWindow = elem;
        if ( pWindow->IsChecked() )
        {
            pWindow->SetState( false );
diff --git a/vcl/source/control/notebookbar.cxx b/vcl/source/control/notebookbar.cxx
index 5c8fed1..76ebd74 100644
--- a/vcl/source/control/notebookbar.cxx
+++ b/vcl/source/control/notebookbar.cxx
@@ -193,7 +193,7 @@ void NotebookBar::StateChanged(const  StateChangedType nStateChange )
void NotebookBar::UpdateBackground()
{
    const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
    const BitmapEx aPersona = rStyleSettings.GetPersonaHeader();
    const BitmapEx& aPersona = rStyleSettings.GetPersonaHeader();
        Wallpaper aWallpaper(aPersona);
        aWallpaper.SetStyle(WallpaperStyle::TopRight);
    if (!aPersona.IsEmpty())
diff --git a/vcl/source/filter/wmf/emfwr.cxx b/vcl/source/filter/wmf/emfwr.cxx
index 914b8a8c..d03b644 100644
--- a/vcl/source/filter/wmf/emfwr.cxx
+++ b/vcl/source/filter/wmf/emfwr.cxx
@@ -1206,7 +1206,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
            case MetaActionType::EPS:
            {
                const MetaEPSAction*    pA = static_cast<const MetaEPSAction*>(pAction);
                const GDIMetaFile       aSubstitute( pA->GetSubstitute() );
                const GDIMetaFile&      aSubstitute( pA->GetSubstitute() );

                for( size_t i = 0, nCount = aSubstitute.GetActionSize(); i < nCount; i++ )
                {
@@ -1328,7 +1328,7 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
            case MetaActionType::TEXTRECT:
            {
                const MetaTextRectAction*   pA = static_cast<const MetaTextRectAction*>(pAction);
                const OUString              aText( pA->GetText() );
                const OUString&             aText( pA->GetText() );

                ImplCheckTextAttr();
                ImplWriteTextRecord( pA->GetRect().TopLeft(), aText, nullptr, 0 );
diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index 9ba9c2b..ef3545b 100644
--- a/vcl/source/filter/wmf/wmfwr.cxx
+++ b/vcl/source/filter/wmf/wmfwr.cxx
@@ -1398,7 +1398,7 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
                    {
                        if( pA->GetMapMode().GetMapUnit() == MapUnit::MapRelative )
                        {
                            MapMode aMM = pA->GetMapMode();
                            const MapMode& aMM = pA->GetMapMode();
                            Fraction aScaleX = aMM.GetScaleX();
                            Fraction aScaleY = aMM.GetScaleY();

@@ -1526,7 +1526,7 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
                case MetaActionType::EPS :
                {
                    const MetaEPSAction* pA = static_cast<const MetaEPSAction*>(pMA);
                    const GDIMetaFile aGDIMetaFile( pA->GetSubstitute() );
                    const GDIMetaFile& aGDIMetaFile( pA->GetSubstitute() );

                    size_t nCount = aGDIMetaFile.GetActionSize();
                    for ( size_t i = 0; i < nCount; i++ )
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 29c9ac4..cb9493f 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -70,7 +70,7 @@ GenericSalLayout::~GenericSalLayout()
void GenericSalLayout::ParseFeatures(const OUString& aName)
{
    vcl::font::FeatureParser aParser(aName);
    OUString sLanguage = aParser.getLanguage();
    const OUString& sLanguage = aParser.getLanguage();
    if (!sLanguage.isEmpty())
        msLanguage = OUStringToOString(sLanguage, RTL_TEXTENCODING_ASCII_US);

diff --git a/vcl/source/gdi/bmpacc.cxx b/vcl/source/gdi/bmpacc.cxx
index d180d86..ba7a192 100644
--- a/vcl/source/gdi/bmpacc.cxx
+++ b/vcl/source/gdi/bmpacc.cxx
@@ -86,7 +86,7 @@ BitmapReadAccess::BitmapReadAccess( Bitmap& rBitmap, BitmapAccessMode nMode ) :
    if (!mpBuffer)
        return;

    std::shared_ptr<SalBitmap> xImpBmp = rBitmap.ImplGetSalBitmap();
    const std::shared_ptr<SalBitmap>& xImpBmp = rBitmap.ImplGetSalBitmap();
    if (!xImpBmp)
        return;

diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index 1572248..6607950 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -265,7 +265,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
        pDummyVDev->EnableOutput( false );
        pDummyVDev->SetMapMode( i_rMtf.GetPrefMapMode() );
    }
    GDIMetaFile aMtf( i_rMtf );
    const GDIMetaFile& aMtf( i_rMtf );

    for( sal_uInt32 i = 0, nCount = aMtf.GetActionSize(); i < nCount; )
    {
@@ -506,7 +506,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
                case MetaActionType::EPS:
                {
                    const MetaEPSAction*    pA = static_cast<const MetaEPSAction*>(pAction);
                    const GDIMetaFile       aSubstitute( pA->GetSubstitute() );
                    const GDIMetaFile&      aSubstitute( pA->GetSubstitute() );

                    m_rOuterFace.Push();
                    pDummyVDev->Push();
@@ -822,7 +822,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
                case MetaActionType::BMPEX:
                {
                    const MetaBmpExAction*  pA = static_cast<const MetaBmpExAction*>(pAction);
                    BitmapEx aBitmapEx( pA->GetBitmapEx() );
                    const BitmapEx& aBitmapEx( pA->GetBitmapEx() );
                    Size aSize( OutputDevice::LogicToLogic( aBitmapEx.GetPrefSize(),
                            aBitmapEx.GetPrefMapMode(), pDummyVDev->GetMapMode() ) );
                    Graphic aGraphic = i_pOutDevData ? i_pOutDevData->GetCurrentGraphic() : Graphic();
@@ -902,7 +902,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
                            m_rOuterFace.SetClipRegion( basegfx::B2DPolyPolygon() );
                        else
                        {
                            vcl::Region aReg( pA->GetRegion() );
                            const vcl::Region& aReg( pA->GetRegion() );
                            m_rOuterFace.SetClipRegion( aReg.GetAsB2DPolyPolygon() );
                        }
                    }
@@ -921,7 +921,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
                case MetaActionType::ISECTREGIONCLIPREGION:
                {
                    const MetaISectRegionClipRegionAction* pA = static_cast<const MetaISectRegionClipRegionAction*>(pAction);
                    vcl::Region aReg( pA->GetRegion() );
                    const vcl::Region& aReg( pA->GetRegion() );
                    m_rOuterFace.IntersectClipRegion( aReg.GetAsB2DPolyPolygon() );
                }
                break;
diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx
index fab8503..5338acc 100644
--- a/vcl/source/gdi/textlayout.cxx
+++ b/vcl/source/gdi/textlayout.cxx
@@ -106,7 +106,7 @@ namespace vcl
        ,m_aUnzoomedPointFont( _rControl.GetUnzoomedControlPointFont() )
        ,m_bRTLEnabled( _rControl.IsRTLEnabled() )
    {
        const Fraction aZoom( _rControl.GetZoom() );
        const Fraction& aZoom( _rControl.GetZoom() );
        m_rTargetDevice.Push( PushFlags::MAPMODE | PushFlags::FONT | PushFlags::TEXTLAYOUTMODE );

        MapMode aTargetMapMode( m_rTargetDevice.GetMapMode() );
diff --git a/vcl/source/outdev/polygon.cxx b/vcl/source/outdev/polygon.cxx
index 567c4d5..aacbe00 100644
--- a/vcl/source/outdev/polygon.cxx
+++ b/vcl/source/outdev/polygon.cxx
@@ -475,7 +475,7 @@ void OutputDevice::ImplDrawPolyPolygon( const tools::PolyPolygon& rPolyPoly, con
    }
    if( pPolyPoly->Count() == 1 )
    {
        const tools::Polygon rPoly = pPolyPoly->GetObject( 0 );
        const tools::Polygon& rPoly = pPolyPoly->GetObject( 0 );
        sal_uInt16 nSize = rPoly.GetSize();

        if( nSize >= 2 )
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
index 418d99a..8e60d8a 100644
--- a/vcl/source/window/brdwin.cxx
+++ b/vcl/source/window/brdwin.cxx
@@ -1782,7 +1782,7 @@ void ImplBorderWindow::Resize()
            long nNotebookBarHeight = mpNotebookBar->GetSizePixel().Height();

            const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
            const BitmapEx aPersona = rStyleSettings.GetPersonaHeader();
            const BitmapEx& aPersona = rStyleSettings.GetPersonaHeader();
            // since size of notebookbar changes, to make common persona for menubar
            // and notebookbar persona should be set again with changed coordinates
            if (!aPersona.IsEmpty())
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index ccfb6a1..261cf32 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -396,7 +396,7 @@ vcl::Window* ImplFindAccelWindow( vcl::Window* pParent, sal_uInt16& rIndex, sal_
    sal_uInt16  i = rIndex;
    vcl::Window* pWindow;

    uno::Reference<i18n::XCharacterClassification> const xCharClass(ImplGetCharClass());
    uno::Reference<i18n::XCharacterClassification> const& xCharClass(ImplGetCharClass());

    const css::lang::Locale& rLocale = Application::GetSettings().GetUILanguageTag().getLocale();
    cCharCode = xCharClass->toUpper( OUString(cCharCode), 0, 1, rLocale )[0];
diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx
index d714b08..ed99ba3 100644
--- a/vcl/unx/gtk/a11y/atkutil.cxx
+++ b/vcl/unx/gtk/a11y/atkutil.cxx
@@ -320,7 +320,7 @@ void DocumentFocusListener::attachRecursive(
        return;

    // If not already done, add the broadcaster to the list and attach as listener.
    uno::Reference< uno::XInterface > xInterface = xBroadcaster;
    const uno::Reference< uno::XInterface >& xInterface = xBroadcaster;
    if( m_aRefList.insert(xInterface).second )
    {
        xBroadcaster->addAccessibleEventListener(static_cast< accessibility::XAccessibleEventListener *>(this));
@@ -654,7 +654,7 @@ static void WindowEventHandler(void *, VclSimpleEvent& rEvent)
            }
            else if (const VclAccessibleEvent* pAccEvent = dynamic_cast<const VclAccessibleEvent*>(&rEvent))
            {
                uno::Reference< accessibility::XAccessible > xAccessible = pAccEvent->GetAccessible();
                const uno::Reference< accessibility::XAccessible >& xAccessible = pAccEvent->GetAccessible();
                if (xAccessible.is())
                    atk_wrapper_focus_tracker_notify_when_idle(xAccessible);
            }
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 5310d93..1e942e3 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1126,7 +1126,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
        }
        case NS_ooxml::LN_CT_DocPartGallery_val:
        {
            OUString sGlossaryEntryGallery = sStringValue;
            const OUString& sGlossaryEntryGallery = sStringValue;
            if(m_pImpl->GetTopContext().get())
            {
                OUString sName = sGlossaryEntryGallery + ":" + m_sGlossaryEntryName;
diff --git a/xmloff/source/chart/SchXMLSeriesHelper.cxx b/xmloff/source/chart/SchXMLSeriesHelper.cxx
index c4764a8..1a27fff 100644
--- a/xmloff/source/chart/SchXMLSeriesHelper.cxx
+++ b/xmloff/source/chart/SchXMLSeriesHelper.cxx
@@ -77,9 +77,8 @@ using ::com::sun::star::uno::Sequence;
    sal_Int32 nIndex=0;

    ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector( SchXMLSeriesHelper::getDataSeriesFromDiagram( xDiagram ));
    for( const auto& rSeries : aSeriesVector )
    for( const Reference< chart2::XDataSeries >& xSeries : aSeriesVector )
    {
        Reference< chart2::XDataSeries > xSeries( rSeries );
        if( xSeries.is() )
        {
            if( aRet.end() == aRet.find(xSeries) )
diff --git a/xmloff/source/core/SettingsExportHelper.cxx b/xmloff/source/core/SettingsExportHelper.cxx
index ca5f677..c3df15c 100644
--- a/xmloff/source/core/SettingsExportHelper.cxx
+++ b/xmloff/source/core/SettingsExportHelper.cxx
@@ -129,7 +129,7 @@ void XMLSettingsExportHelper::CallTypeFunction(const uno::Any& rAny,
        break;
        default:
        {
            uno::Type aType = aAny.getValueType();
            const uno::Type& aType = aAny.getValueType();
            if (aType.equals(cppu::UnoType<uno::Sequence<beans::PropertyValue>>::get() ) )
            {
                uno::Sequence< beans::PropertyValue> aProps;
diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx
index 0eb2051d..8163386 100644
--- a/xmloff/source/draw/sdxmlexp.cxx
+++ b/xmloff/source/draw/sdxmlexp.cxx
@@ -2303,7 +2303,7 @@ void SdXMLExport::ExportMasterStyles_()
                ImpXMLEXPPageMasterInfo* pInfo = mpHandoutPageMaster;
                if(pInfo)
                {
                    OUString sString = pInfo->GetName();
                    const OUString& sString = pInfo->GetName();
                    AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString );
                }

@@ -2348,7 +2348,7 @@ void SdXMLExport::ExportMasterStyles_()
            ImpXMLEXPPageMasterInfo* pInfo = mvPageMasterUsageList.at( nMPageId );
            if(pInfo)
            {
                OUString sString = pInfo->GetName();
                const OUString& sString = pInfo->GetName();
                AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString );
            }

@@ -2383,7 +2383,7 @@ void SdXMLExport::ExportMasterStyles_()
                            ImpXMLEXPPageMasterInfo* pMasterInfo = mvNotesPageMasterUsageList.at( nMPageId );
                            if(pMasterInfo)
                            {
                                OUString sString = pMasterInfo->GetName();
                                const OUString& sString = pMasterInfo->GetName();
                                AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString);
                            }

diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index b78d6c3..da1e94b 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -2255,7 +2255,7 @@ void XMLShapeExport::ImpExportPolygonShape(
        if(!aPolyPolygon.areControlPointsUsed() && 1 == aPolyPolygon.count())
        {
            // simple polygon shape, can be written as svg:points sequence
            const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(0));
            const basegfx::B2DPolygon& aPolygon(aPolyPolygon.getB2DPolygon(0));
            const OUString aPointString(basegfx::utils::exportToSvgPoints(aPolygon));

            // write point array
diff --git a/xmloff/source/table/XMLTableImport.cxx b/xmloff/source/table/XMLTableImport.cxx
index 9b2c646..5cc315c 100644
--- a/xmloff/source/table/XMLTableImport.cxx
+++ b/xmloff/source/table/XMLTableImport.cxx
@@ -596,10 +596,8 @@ void XMLTableImportContext::EndElement()
{
    if( !maMergeInfos.empty() )
    {
        for( const auto& rMergeInfo : maMergeInfos )
        for( const std::shared_ptr< MergeInfo >& xInfo : maMergeInfos )
        {
            std::shared_ptr< MergeInfo > xInfo( rMergeInfo );

            if( xInfo.get() ) try
            {
                Reference< XCellRange > xRange( mxTable->getCellRangeByPosition( xInfo->mnStartColumn, xInfo->mnStartRow, xInfo->mnEndColumn, xInfo->mnEndRow ) );
diff --git a/xmloff/source/text/XMLTextListBlockContext.cxx b/xmloff/source/text/XMLTextListBlockContext.cxx
index 595ffb5..aeb74de 100644
--- a/xmloff/source/text/XMLTextListBlockContext.cxx
+++ b/xmloff/source/text/XMLTextListBlockContext.cxx
@@ -189,7 +189,7 @@ XMLTextListBlockContext::XMLTextListBlockContext(
        if ( bIsContinueNumberingAttributePresent && !mbRestartNumbering &&
             msContinueListId.isEmpty() )
        {
            OUString Last( rTextListsHelper.GetLastProcessedListId() );
            const OUString& Last( rTextListsHelper.GetLastProcessedListId() );
            if ( rTextListsHelper.GetListStyleOfLastProcessedList() == msListStyleName
                 && Last != msListId )
            {
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 48d28cd..4b1ed30 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -2127,7 +2127,7 @@ void XMLParaContext::EndElement()
                    const XMLDrawHint_Impl *pDHint =
                        static_cast<const XMLDrawHint_Impl*>(pHint);
                    // Improvement: hint directly provides the shape. (#i33242#)
                    Reference < XShape > xShape = pDHint->GetShape();
                    const Reference < XShape >& xShape = pDHint->GetShape();
                    if ( xShape.is() )
                    {
                        // determine anchor type
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
index 344591d..239f795 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
@@ -232,7 +232,7 @@ void ProgressBarElement::endElement()
    if (xStyle.is())
    {
        StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
        pStyle->importBackgroundColorStyle( xControlModel );
        pStyle->importBorderStyle( xControlModel );
        pStyle->importFillColorStyle( xControlModel );
@@ -272,7 +272,7 @@ void ScrollBarElement::endElement()
    if (xStyle.is())
    {
        StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
        pStyle->importBackgroundColorStyle( xControlModel );
        pStyle->importBorderStyle( xControlModel );
    }
@@ -321,7 +321,7 @@ void SpinButtonElement::endElement()
    if (xStyle.is())
    {
        StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
        pStyle->importBackgroundColorStyle( xControlModel );
        pStyle->importBorderStyle( xControlModel );
    }
@@ -367,7 +367,7 @@ void FixedLineElement::endElement()
    if (xStyle.is())
    {
        StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
        pStyle->importTextColorStyle( xControlModel );
        pStyle->importTextLineColorStyle( xControlModel );
        pStyle->importFontStyle( xControlModel );
@@ -406,7 +406,7 @@ void PatternFieldElement::endElement()
    if (xStyle.is())
    {
        StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
        pStyle->importBackgroundColorStyle( xControlModel );
        pStyle->importTextColorStyle( xControlModel );
        pStyle->importTextLineColorStyle( xControlModel );
@@ -453,7 +453,7 @@ void FormattedFieldElement::endElement()
    if (xStyle.is())
    {
        StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
        pStyle->importBackgroundColorStyle( xControlModel );
        pStyle->importTextColorStyle( xControlModel );
        pStyle->importTextLineColorStyle( xControlModel );
@@ -580,7 +580,7 @@ void TimeFieldElement::endElement()
    if (xStyle.is())
    {
        StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
        pStyle->importBackgroundColorStyle( xControlModel );
        pStyle->importTextColorStyle( xControlModel );
        pStyle->importTextLineColorStyle( xControlModel );
@@ -633,7 +633,7 @@ void NumericFieldElement::endElement()
    if (xStyle.is())
    {
        StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
        pStyle->importBackgroundColorStyle( xControlModel );
        pStyle->importTextColorStyle( xControlModel );
        pStyle->importTextLineColorStyle( xControlModel );
@@ -688,7 +688,7 @@ void DateFieldElement::endElement()
    if (xStyle.is())
    {
        StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
        pStyle->importBackgroundColorStyle( xControlModel );
        pStyle->importTextColorStyle( xControlModel );
        pStyle->importTextLineColorStyle( xControlModel );
@@ -742,7 +742,7 @@ void CurrencyFieldElement::endElement()
    if (xStyle.is())
    {
        StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
        pStyle->importBackgroundColorStyle( xControlModel );
        pStyle->importTextColorStyle( xControlModel );
        pStyle->importTextLineColorStyle( xControlModel );
@@ -797,7 +797,7 @@ void FileControlElement::endElement()
    if (xStyle.is())
    {
        StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
        pStyle->importBackgroundColorStyle( xControlModel );
        pStyle->importTextColorStyle( xControlModel );
        pStyle->importTextLineColorStyle( xControlModel );
@@ -840,7 +840,7 @@ void TreeControlElement::endElement()
    if (xStyle.is())
    {
        StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
        pStyle->importBackgroundColorStyle( xControlModel );
        pStyle->importBorderStyle( xControlModel );
    }
@@ -885,7 +885,7 @@ void ImageControlElement::endElement()
    if (xStyle.is())
    {
        StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
        pStyle->importBackgroundColorStyle( xControlModel );
        pStyle->importBorderStyle( xControlModel );
    }
@@ -925,7 +925,7 @@ void TextElement::endElement()
    if (xStyle.is())
    {
        StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
        pStyle->importBackgroundColorStyle( xControlModel );
        pStyle->importTextColorStyle( xControlModel );
        pStyle->importTextLineColorStyle( xControlModel );
@@ -970,7 +970,7 @@ void FixedHyperLinkElement::endElement()
    if (xStyle.is())
    {
        StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
        pStyle->importBackgroundColorStyle( xControlModel );
        pStyle->importTextColorStyle( xControlModel );
        pStyle->importTextLineColorStyle( xControlModel );
@@ -1543,7 +1543,7 @@ void ButtonElement::endElement()
    if (xStyle.is())
    {
        StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
        Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
        const Reference< beans::XPropertySet >& xControlModel( ctx.getControlModel() );
        pStyle->importBackgroundColorStyle( xControlModel );
        pStyle->importTextColorStyle( xControlModel );
        pStyle->importTextLineColorStyle( xControlModel );