basic/source/uno/namecont.cxx | 8 compilerplugins/clang/store/rtlref.cxx | 143 ++++++++++ compilerplugins/clang/store/test/rtlref.cxx | 33 ++ dbaccess/source/core/dataaccess/datasource.cxx | 8 dbaccess/source/core/dataaccess/documentdefinition.cxx | 7 dbaccess/source/core/dataaccess/myucp_datasupplier.cxx | 2 dbaccess/source/ui/browser/brwctrlr.cxx | 16 - dbaccess/source/ui/browser/brwview.cxx | 2 desktop/source/lib/init.cxx | 12 drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx | 3 editeng/source/uno/unotext2.cxx | 8 extensions/source/bibliography/datman.hxx | 14 extensions/source/bibliography/framectr.cxx | 5 extensions/source/scanner/scanunx.cxx | 3 filter/source/t602/t602filter.cxx | 10 forms/source/component/FormattedFieldWrapper.cxx | 3 forms/source/xforms/model_ui.cxx | 5 forms/source/xforms/submission/submission_get.cxx | 3 framework/source/loadenv/loadenv.cxx | 4 framework/source/services/frame.cxx | 8 framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx | 3 framework/source/uielement/popuptoolbarcontroller.cxx | 6 framework/source/uielement/toolbarmodemenucontroller.cxx | 2 framework/source/uielement/toolbarsmenucontroller.cxx | 2 package/source/xstor/xstorage.cxx | 3 package/source/zippackage/ZipPackageStream.cxx | 3 sfx2/source/appl/appopen.cxx | 3 sfx2/source/control/thumbnailviewacc.cxx | 2 sfx2/source/dialog/filedlghelper.cxx | 3 sfx2/source/sidebar/SidebarDockingWindow.cxx | 3 starmath/source/mathml/export.cxx | 6 starmath/source/mathml/import.cxx | 11 svtools/source/control/valueacc.cxx | 2 svtools/source/uno/unoimap.cxx | 3 svx/source/accessibility/AccessibleTextHelper.cxx | 4 svx/source/accessibility/ChildrenManagerImpl.cxx | 2 svx/source/accessibility/svxrectctaccessiblecontext.cxx | 4 svx/source/form/datanavi.cxx | 12 svx/source/form/fmobj.cxx | 3 svx/source/mnuctrls/smarttagmenu.cxx | 4 svx/source/table/accessibletableshape.cxx | 3 svx/source/unodraw/unopage.cxx | 2 test/source/unoapi_test.cxx | 3 toolkit/source/awt/vclxwindows.cxx | 3 toolkit/source/controls/controlmodelcontainerbase.cxx | 14 toolkit/source/controls/grid/defaultgridcolumnmodel.cxx | 4 ucb/source/ucp/gio/gio_provider.cxx | 2 ucb/source/ucp/package/pkgprovider.cxx | 2 ucb/source/ucp/tdoc/tdoc_provider.cxx | 4 unoxml/source/dom/elementlist.cxx | 8 unoxml/source/events/eventdispatcher.cxx | 5 vcl/source/accessibility/accessiblelistbox.cxx | 4 vcl/source/accessibility/vclxaccessiblestatusbar.cxx | 8 vcl/source/accessibility/vclxaccessibletoolbox.cxx | 2 xmlhelp/source/cxxhelp/provider/provider.cxx | 2 xmloff/source/transform/FormPropOASISTContext.cxx | 12 xmloff/source/transform/FrameOOoTContext.cxx | 3 xmloff/source/transform/OOo2Oasis.cxx | 3 58 files changed, 290 insertions(+), 172 deletions(-)
New commits: commit 09e2627a83d4769983c39fb2cb260e11fce354f3 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Feb 17 11:06:55 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Feb 26 16:56:56 2025 +0100 use more concrete UNO types in some local vars found by a little plugin I created. Plugin parked into store/ folder because it needs hand-holding when run. Change-Id: I2b4da7378f0becbc5f020ac9e78cd765aa0119b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181768 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index 45b95b654538..8c66cebbbfcf 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -2110,9 +2110,8 @@ SfxLibraryContainer::createLibrary_Impl(const OUString& Name, std::unique_lock<s checkStorageURL(pNewLib->maUnexpandedStorageURL, pNewLib->maLibInfoFileURL, pNewLib->maStorageURL, pNewLib->maUnexpandedStorageURL); - Reference< XNameAccess > xNameAccess( pNewLib ); Any aElement; - aElement <<= xNameAccess; + aElement <<= Reference< XNameAccess >( pNewLib ); maNameContainer.insertByName(Name, aElement, guard); maModifiable.setModified(true, guard); return pNewLib; @@ -2150,9 +2149,8 @@ SfxLibraryContainer::createLibraryLink_Impl(const OUString& Name, const OUString implLoadLibraryIndexFile(pNewLib.get(), aLibDesc, xDummyStor, OUString(), guard); implImportLibDescriptor(pNewLib.get(), aLibDesc, guard); - Reference< XNameAccess > xRet( pNewLib ); Any aElement; - aElement <<= xRet; + aElement <<= Reference< XNameAccess >( pNewLib ); maNameContainer.insertByName(Name, aElement, guard); maModifiable.setModified(true, guard); @@ -2167,7 +2165,7 @@ SfxLibraryContainer::createLibraryLink_Impl(const OUString& Name, const OUString pNewLib->mbReadOnly = true; } - return xRet; + return pNewLib; } void SAL_CALL SfxLibraryContainer::removeLibrary( const OUString& Name ) diff --git a/compilerplugins/clang/store/rtlref.cxx b/compilerplugins/clang/store/rtlref.cxx new file mode 100644 index 000000000000..0647d3dea702 --- /dev/null +++ b/compilerplugins/clang/store/rtlref.cxx @@ -0,0 +1,143 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * Based on LLVM/Clang. + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + */ +#ifndef LO_CLANG_SHARED_PLUGINS + +#include "plugin.hxx" +#include "check.hxx" +#include "config_clang.h" +#include <iostream> + +/* +This is a compile-time checker. + +Check for cases where we have + - two IDL interfaces A and B, + - B extends A + - we are converting a Reference<B> to a Reference<A> using UNO_QUERY + +This makes the code simpler and cheaper, because UNO_QUERY can be surprisingly expensive if used a lot. + +*/ + +namespace +{ +class RtlRef : public loplugin::FilteringPlugin<RtlRef> +{ +public: + explicit RtlRef(loplugin::InstantiationData const& data) + : FilteringPlugin(data) + { + } + + bool preRun() override + { + std::string fn(handler.getMainFileName()); + loplugin::normalizeDotDotInFilePath(fn); + if (fn == SRCDIR "/ucb/source/ucp/ext/ucpext_provider.cxx") + return false; + if (fn == SRCDIR "/ucb/source/ucp/hierarchy/hierarchyprovider.cxx") + return false; + if (fn == SRCDIR "/ucb/source/ucp/cmis/cmis_provider.cxx") + return false; + if (fn == SRCDIR "/ucb/source/ucp/webdav-curl/webdavprovider.cxx") + return false; + if (fn == SRCDIR "/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx") + return false; + if (fn == SRCDIR "/ucb/source/cacher/dynamicresultsetwrapper.cxx") + return false; + if (fn == SRCDIR "/sax/source/fastparser/fastparser.cxx") + return false; + if (fn == SRCDIR "/chart2/source/controller/main/ObjectHierarchy.cxx") + return false; + if (fn == SRCDIR "/chart2/source/controller/main/ShapeController.cxx") + return false; + if (fn == SRCDIR "/chart2/source/view/axes/VCartesianAxis.cxx") + return false; + if (fn == SRCDIR "/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx") + return false; + if (fn == SRCDIR "/chart2/source/view/main/DataTableView.cxx") + return false; + if (fn == SRCDIR "/svx/source/form/datanavi.cxx") + return false; + if (fn == SRCDIR "/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx") + return false; + if (fn == SRCDIR "/sd/source/ui/annotations/annotationwindow.cxx") + return false; + if (fn == SRCDIR "/sd/source/ui/unoidl/unopage.cxx") + return false; + if (fn == SRCDIR "/xmlsecurity/source/helper/xsecsign.cxx") + return false; + if (fn == SRCDIR "/xmlsecurity/source/helper/xsecctl.cxx") + return false; + if (fn == SRCDIR "/unoxml/source/events/eventdispatcher.cxx") + return false; + if (fn == SRCDIR "/unoxml/source/dom/element.cxx") + return false; + return true; + } + + void run() override + { + if (preRun()) + { + TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); + } + } + + bool VisitVarDecl(const VarDecl*); +}; + +bool RtlRef::VisitVarDecl(const VarDecl* varDecl) +{ + if (ignoreLocation(varDecl)) + return true; + + // don't bother processing anything in the Reference.h file. Makes my life easier when debugging this. + StringRef aFileName + = getFilenameOfLocation(compiler.getSourceManager().getSpellingLoc(varDecl->getBeginLoc())); + if (loplugin::isSamePathname(aFileName, SRCDIR "/include/com/sun/star/uno/Reference.h")) + return true; + if (loplugin::isSamePathname(aFileName, SRCDIR "/include/com/sun/star/uno/Reference.hxx")) + return true; + + if (!loplugin::TypeCheck(varDecl->getType()).Class("Reference").Namespace("uno")) + return true; + + if (varDecl->isStaticLocal()) + return true; + + auto init = varDecl->getInit(); + if (!init) + return true; + init = init->IgnoreImpCasts(); + + auto memberCall = dyn_cast<CXXMemberCallExpr>(init); + if (!memberCall) + return true; + if (memberCall->getNumArgs() > 1) + return true; + + auto innerExpr = memberCall->getImplicitObjectArgument()->IgnoreImpCasts(); + if (!loplugin::TypeCheck(innerExpr->getType()).Class("Reference").Namespace("rtl")) + return true; + + report(DiagnosticsEngine::Warning, "cast from %0", varDecl->getBeginLoc()) + << innerExpr->getType() << varDecl->getSourceRange(); + return true; +} + +loplugin::Plugin::Registration<RtlRef> rtlref("rtlref"); + +} // namespace + +#endif // LO_CLANG_SHARED_PLUGINS + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/compilerplugins/clang/store/test/rtlref.cxx b/compilerplugins/clang/store/test/rtlref.cxx new file mode 100644 index 000000000000..cf51149f9e21 --- /dev/null +++ b/compilerplugins/clang/store/test/rtlref.cxx @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "sal/config.h" + +#include "com/sun/star/uno/Sequence.hxx" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/io/XStreamListener.hpp" +#include "com/sun/star/io/XInputStream.hpp" +#include "com/sun/star/lang/XTypeProvider.hpp" +#include "com/sun/star/lang/XComponent.hpp" +#include "cppuhelper/implbase.hxx" +#include "cppuhelper/weak.hxx" +#include "rtl/ref.hxx" + +class FooStream : public css::io::XStreamListener +{ + virtual ~FooStream(); +}; +void test(rtl::Reference<FooStream> fooStream) +{ + // expected-error@+1 {{cast from rtl::Reference<FooStream> [loplugin:rtlref]}} + css::uno::Reference<css::io::XStreamListener> a(fooStream); + (void)a; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index 40b248411597..93845047d841 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -504,7 +504,7 @@ weld::Window* ODatabaseModelImpl::GetFrameWeld() if (m_xDialogParent.is()) return Application::GetFrameWeld(m_xDialogParent); - Reference<XModel> xModel = getModel_noCreate(); + rtl::Reference<ODatabaseDocument> xModel = getModel_noCreate(); if (!xModel.is()) return nullptr; Reference<XController> xController(xModel->getCurrentController()); @@ -526,7 +526,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const OUString #if ENABLE_FIREBIRD_SDBC bool bIgnoreMigration = false; bool bNeedMigration = false; - Reference< XModel > xModel = m_pImpl->getModel_noCreate(); + rtl::Reference< ODatabaseDocument > xModel = m_pImpl->getModel_noCreate(); if ( xModel) { //See ODbTypeWizDialogSetup::SaveDatabaseDocument @@ -1306,11 +1306,11 @@ Reference< XOfficeDatabaseDocument > SAL_CALL ODatabaseSource::getDatabaseDocume { ModelMethodGuard aGuard( *this ); - Reference< XModel > xModel( m_pImpl->getModel_noCreate() ); + rtl::Reference< ODatabaseDocument > xModel( m_pImpl->getModel_noCreate() ); if ( !xModel.is() ) xModel = m_pImpl->createNewModel_deliverOwnership(); - return Reference< XOfficeDatabaseDocument >( xModel, UNO_QUERY_THROW ); + return Reference< XOfficeDatabaseDocument >( static_cast<cppu::OWeakObject*>(xModel.get()), UNO_QUERY_THROW ); } void SAL_CALL ODatabaseSource::initialize( css::uno::Sequence< css::uno::Any > const & rArguments) diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 6d3ea6204fee..04da2b8f6e7e 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -1408,7 +1408,7 @@ namespace { Reference< XFrame > lcl_getDatabaseDocumentFrame( ODatabaseModelImpl const & _rImpl ) { - Reference< XModel > xDatabaseDocumentModel( _rImpl.getModel_noCreate() ); + rtl::Reference< ODatabaseDocument > xDatabaseDocumentModel( _rImpl.getModel_noCreate() ); Reference< XController > xDatabaseDocumentController; if ( xDatabaseDocumentModel.is() ) @@ -1469,10 +1469,9 @@ Sequence< PropertyValue > ODocumentDefinition::fillLoadArgs( const Reference< XC } m_pInterceptor = new OInterceptor( this ); - Reference<XDispatchProviderInterceptor> xInterceptor = m_pInterceptor; ::comphelper::NamedValueCollection aEmbeddedDescriptor; - aEmbeddedDescriptor.put( u"OutplaceDispatchInterceptor"_ustr, xInterceptor ); + aEmbeddedDescriptor.put( u"OutplaceDispatchInterceptor"_ustr, Reference<XDispatchProviderInterceptor>(m_pInterceptor) ); ::comphelper::NamedValueCollection aMediaDesc; separateOpenCommandArguments( i_rOpenCommandArguments, aMediaDesc, aEmbeddedDescriptor ); @@ -1771,7 +1770,7 @@ namespace { Reference< XDatabaseDocumentUI > xUI; - Reference< XModel > xModel( _rModelImpl.getModel_noCreate() ); + rtl::Reference< ODatabaseDocument > xModel( _rModelImpl.getModel_noCreate() ); if ( xModel.is() ) xUI.set( xModel->getCurrentController(), UNO_QUERY ); return xUI; diff --git a/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx b/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx index 597933b9db5f..483712b90dac 100644 --- a/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx +++ b/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx @@ -103,7 +103,7 @@ DataSupplier::queryContent( std::unique_lock<std::mutex>& rResultSetGuard, sal_u if ( static_cast<size_t>(_nIndex) < m_aResults.size() ) { - Reference< XContent > xContent = m_aResults[ _nIndex ]->xContent; + rtl::Reference< OContentHelper > xContent = m_aResults[ _nIndex ]->xContent; if ( xContent.is() ) { // Already cached. diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index 3512b6462757..46dc03d2fee6 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -436,8 +436,8 @@ Sequence< Reference< css::awt::XControl > > SAL_CALL SbaXDataBrowserController:: { if (m_pOwner->getBrowserView()) { - Reference< css::awt::XControl > xGrid = m_pOwner->getBrowserView()->getGridControl(); - return Sequence< Reference< css::awt::XControl > >(&xGrid, 1); + rtl::Reference< SbaXGridControl > xGrid = m_pOwner->getBrowserView()->getGridControl(); + return { Reference< css::awt::XControl >(xGrid) }; } return Sequence< Reference< css::awt::XControl > >(); } @@ -2195,16 +2195,12 @@ bool SbaXDataBrowserController::CommitCurrent() if (!getBrowserView()) return true; - Reference< css::awt::XControl > xActiveControl(getBrowserView()->getGridControl()); - Reference< css::form::XBoundControl > xLockingTest(xActiveControl, UNO_QUERY); - bool bControlIsLocked = xLockingTest.is() && xLockingTest->getLock(); + rtl::Reference< SbaXGridControl > xActiveControl(getBrowserView()->getGridControl()); + Reference< css::form::XBoundControl > xLockingTest(static_cast<cppu::OWeakObject*>(xActiveControl.get()), UNO_QUERY); + bool bControlIsLocked = xActiveControl.is() && xLockingTest->getLock(); if (xActiveControl.is() && !bControlIsLocked) { - // At first check Control if it supports the IFace - Reference< css::form::XBoundComponent > xBoundControl(xActiveControl, UNO_QUERY); - if (!xBoundControl.is()) - xBoundControl.set(xActiveControl->getModel(), UNO_QUERY); - if (xBoundControl.is() && !xBoundControl->commit()) + if (!xActiveControl->commit()) return false; } return true; diff --git a/dbaccess/source/ui/browser/brwview.cxx b/dbaccess/source/ui/browser/brwview.cxx index 102518a09b8d..c89d4fe88e42 100644 --- a/dbaccess/source/ui/browser/brwview.cxx +++ b/dbaccess/source/ui/browser/brwview.cxx @@ -43,7 +43,7 @@ namespace { bool bGrabFocus = false; SbaGridControl* pVclControl = _pView->getVclControl(); - const Reference< css::awt::XControl > xGrid = _pView->getGridControl(); + const rtl::Reference< SbaXGridControl > xGrid = _pView->getGridControl(); if (pVclControl && xGrid.is()) { bGrabFocus = true; diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 09590cd398f6..818f3d3cf176 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2333,8 +2333,7 @@ bool CallbackFlushHandler::processWindowEvent(int type, CallbackData& aCallbackD auto xClip = forceSetClipboardForCurrentView(m_pDocument); - uno::Reference<datatransfer::clipboard::XClipboard> xClipboard(xClip); - pWindow->SetClipboard(xClipboard); + pWindow->SetClipboard(uno::Reference<datatransfer::clipboard::XClipboard>(xClip)); } else if (aAction == "size_changed") { @@ -2869,7 +2868,6 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, pLib->mInteractionMap.erase(aURL.toUtf8()); } }); - uno::Reference<task::XInteractionHandler2> const xInteraction(pInteraction); int nMacroSecurityLevel = 1; const OUString aMacroSecurityLevel = extractParameter(aOptions, u"MacroSecurityLevel"); @@ -2911,7 +2909,7 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, // to bring saveas dialog which cannot work with LOK case uno::Sequence<css::beans::PropertyValue> aFilterOptions{ comphelper::makePropertyValue(u"FilterOptions"_ustr, aOptions), - comphelper::makePropertyValue(u"InteractionHandler"_ustr, xInteraction), + comphelper::makePropertyValue(u"InteractionHandler"_ustr, uno::Reference<task::XInteractionHandler2>(pInteraction)), comphelper::makePropertyValue(u"MacroExecutionMode"_ustr, nMacroExecMode), comphelper::makePropertyValue(u"AsTemplate"_ustr, false), comphelper::makePropertyValue(u"Silent"_ustr, !aBatch.isEmpty()) @@ -3800,9 +3798,8 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha // gImpl does not have to exist when running from a unit test rtl::Reference<LOKInteractionHandler> const pInteraction( new LOKInteractionHandler("saveas"_ostr, gImpl, pDocument)); - uno::Reference<task::XInteractionHandler2> const xInteraction(pInteraction); - aSaveMediaDescriptor[MediaDescriptor::PROP_INTERACTIONHANDLER] <<= xInteraction; + aSaveMediaDescriptor[MediaDescriptor::PROP_INTERACTIONHANDLER] <<= uno::Reference<task::XInteractionHandler2>(pInteraction); } @@ -5301,11 +5298,10 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma rtl::Reference<LOKInteractionHandler> const pInteraction( new LOKInteractionHandler("save"_ostr, gImpl, pDocument)); - uno::Reference<task::XInteractionHandler2> const xInteraction(pInteraction); beans::PropertyValue aValue; aValue.Name = u"InteractionHandler"_ustr; - aValue.Value <<= xInteraction; + aValue.Value <<= uno::Reference<task::XInteractionHandler2>(pInteraction); aPropertyValuesVector.push_back(aValue); bool bDontSaveIfUnmodified = false; diff --git a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx index 7690dd300f6e..cc689e6dc67a 100644 --- a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx +++ b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx @@ -233,8 +233,7 @@ namespace drawinglayer::primitive3d } // exchange aRetval content with texture group - const Primitive3DReference xRef(pNewTexturePrimitive3D); - aRetval = { xRef }; + aRetval = { Primitive3DReference(pNewTexturePrimitive3D) }; if(css::drawing::TextureKind2_LUMINANCE == aSdr3DObjectAttribute.getTextureKind()) { diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx index 5cfea9d63173..53fb94bfa23c 100644 --- a/editeng/source/uno/unotext2.cxx +++ b/editeng/source/uno/unotext2.cxx @@ -109,9 +109,9 @@ uno::Any SvxUnoTextContentEnumeration::nextElement() if(!hasMoreElements()) throw container::NoSuchElementException(); - uno::Reference< text::XTextContent > xRef( maContents.at(mnNextParagraph) ); + rtl::Reference< SvxUnoTextContent > xRef( maContents.at(mnNextParagraph) ); mnNextParagraph++; - return uno::Any( xRef ); + return uno::Any( uno::Reference< text::XTextContent >(xRef) ); } @@ -433,9 +433,9 @@ uno::Any SAL_CALL SvxUnoTextRangeEnumeration::nextElement() if( maPortions.empty() || mnNextPortion >= maPortions.size() ) throw container::NoSuchElementException(); - uno::Reference< text::XTextRange > xRange = maPortions.at(mnNextPortion); + rtl::Reference< SvxUnoTextRange > xRange = maPortions.at(mnNextPortion); mnNextPortion++; - return uno::Any( xRange ); + return uno::Any( uno::Reference< text::XTextRange >(xRange) ); } SvxUnoTextCursor::SvxUnoTextCursor( const SvxUnoTextBase& rText ) noexcept diff --git a/extensions/source/bibliography/datman.hxx b/extensions/source/bibliography/datman.hxx index 405cf83d85a5..ad8a948699ca 100644 --- a/extensions/source/bibliography/datman.hxx +++ b/extensions/source/bibliography/datman.hxx @@ -101,6 +101,13 @@ private: static css::uno::Reference< css::awt::XControlModel > createGridModel( const OUString& rName ); + using WeakComponentImplHelperBase::disposing; + +public: + + BibDataManager(); + virtual ~BibDataManager() override; + // XLoadable virtual void SAL_CALL load( ) override; virtual void SAL_CALL unload( ) override; @@ -109,13 +116,6 @@ private: virtual void SAL_CALL addLoadListener( const css::uno::Reference< css::form::XLoadListener >& aListener ) override; virtual void SAL_CALL removeLoadListener( const css::uno::Reference< css::form::XLoadListener >& aListener ) override; - using WeakComponentImplHelperBase::disposing; - -public: - - BibDataManager(); - virtual ~BibDataManager() override; - css::uno::Reference< css::form::XForm > createDatabaseForm( BibDBDescriptor& aDesc); css::uno::Reference< css::awt::XControlModel > updateGridModel(); diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx index 8a5ce26e7e74..a565bfb4abfe 100644 --- a/extensions/source/bibliography/framectr.cxx +++ b/extensions/source/bibliography/framectr.cxx @@ -818,11 +818,10 @@ void BibFrameController_Impl::ChangeDataSource(const uno::Sequence< beans::Prope } else { - Reference<css::form::XLoadable> xLoadable(m_xDatMan); - xLoadable->unload(); + m_xDatMan->unload(); m_xDatMan->setActiveDataTable(aDBTableName); m_xDatMan->updateGridModel(); - xLoadable->load(); + m_xDatMan->load(); } diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx index f3402d33804b..2afc24b3454d 100644 --- a/extensions/source/scanner/scanunx.cxx +++ b/extensions/source/scanner/scanunx.cxx @@ -333,8 +333,7 @@ Reference< css::awt::XBitmap > ScannerManager::getBitmap( const ScannerContext& osl::MutexGuard aProtGuard( pHolder->m_aProtector ); - Reference< css::awt::XBitmap > xRet( pHolder->m_xBitmap ); - pHolder->m_xBitmap.clear(); + rtl::Reference< BitmapTransporter > xRet = std::move( pHolder->m_xBitmap ); return xRet; } diff --git a/filter/source/t602/t602filter.cxx b/filter/source/t602/t602filter.cxx index 94c52f52bb0a..80fd1ceae947 100644 --- a/filter/source/t602/t602filter.cxx +++ b/filter/source/t602/t602filter.cxx @@ -190,7 +190,7 @@ void SAL_CALL T602ImportFilter::initialize( const Sequence< Any >& /*aArguments* void T602ImportFilter::inschr(unsigned char ch) { - Reference < XAttributeList > xAttrList ( mpAttrList ); + rtl::Reference < comphelper::AttributeList > xAttrList ( mpAttrList ); if(!ini.showcomm&&pst.comment) return; @@ -248,7 +248,7 @@ bool T602ImportFilter::importImpl( const Sequence< css::beans::PropertyValue >& mpAttrList = new comphelper::AttributeList; - Reference < XAttributeList > xAttrList ( mpAttrList ); + rtl::Reference < comphelper::AttributeList > xAttrList ( mpAttrList ); mxHandler->startDocument(); @@ -489,7 +489,7 @@ void T602ImportFilter::inschrdef(unsigned char ch) void T602ImportFilter::wrtfnt() { - Reference < XAttributeList > xAttrList ( mpAttrList ); + rtl::Reference < comphelper::AttributeList > xAttrList ( mpAttrList ); const char *style; switch(fst.nowfnt) { @@ -537,7 +537,7 @@ unsigned char T602ImportFilter::Readchar602() void T602ImportFilter::par602(bool endofpage) { sal_Int16 endp; - Reference < XAttributeList > xAttrList ( mpAttrList ); + rtl::Reference < comphelper::AttributeList > xAttrList ( mpAttrList ); if(!endofpage || !pst.waspar) { if(ini.showcomm||!pst.comment) { @@ -675,7 +675,7 @@ void T602ImportFilter::Read602() unsigned char ch=0; char cmd602[3] = {0}; - Reference < XAttributeList > xAttrList ( mpAttrList ); + rtl::Reference < comphelper::AttributeList > xAttrList ( mpAttrList ); if (node==tnode::QUIT) return; diff --git a/forms/source/component/FormattedFieldWrapper.cxx b/forms/source/component/FormattedFieldWrapper.cxx index 0c3b8103442a..1543a2068d8f 100644 --- a/forms/source/component/FormattedFieldWrapper.cxx +++ b/forms/source/component/FormattedFieldWrapper.cxx @@ -212,10 +212,9 @@ void SAL_CALL OFormattedFieldWrapper::write(const Reference<XObjectOutputStream> // for this we transfer the current props of the formatted part to the edit part Reference<XPropertySet> xFormatProps(m_xFormattedPart, UNO_QUERY); - Reference<XPropertySet> xEditProps = m_pEditPart; Locale aAppLanguage = Application::GetSettings().GetUILanguageTag().getLocale(); - dbtools::TransferFormComponentProperties(xFormatProps, xEditProps, aAppLanguage); + dbtools::TransferFormComponentProperties(xFormatProps, m_pEditPart, aAppLanguage); // then write the edit part, after switching to "fake mode" m_pEditPart->enableFormattedWriteFake(); diff --git a/forms/source/xforms/model_ui.cxx b/forms/source/xforms/model_ui.cxx index 1dd68d9fb84c..8d065f664cbc 100644 --- a/forms/source/xforms/model_ui.cxx +++ b/forms/source/xforms/model_ui.cxx @@ -372,9 +372,8 @@ css::uno::Reference< ::css::beans::XPropertySet > Model::cloneBindingAsGhost( co pBinding->deferNotifications(true); // Copy the propertyset and return result... - XPropertySet_t xNewBinding(pBinding); - copy( xBinding, xNewBinding ); - return xNewBinding; + copy( xBinding, XPropertySet_t(pBinding) ); + return pBinding; } void Model::removeBindingIfUseless( const css::uno::Reference< ::css::beans::XPropertySet >& xBinding ) diff --git a/forms/source/xforms/submission/submission_get.cxx b/forms/source/xforms/submission/submission_get.cxx index 4ee8140b2172..34f34040d39e 100644 --- a/forms/source/xforms/submission/submission_get.cxx +++ b/forms/source/xforms/submission/submission_get.cxx @@ -59,7 +59,6 @@ CSubmission::SubmissionResult CSubmissionGet::submit(const css::uno::Reference< pHelper->m_aProgressHandler.set(pProgressHelper); // UCB has ownership of environment... - css::uno::Reference< XCommandEnvironment > aEnvironment(pHelper); // append query string to the URL try { @@ -77,7 +76,7 @@ CSubmission::SubmissionResult CSubmissionGet::submit(const css::uno::Reference< aUTF8QueryURL.append("?" + aQueryString); } OUString aQueryURL = OStringToOUString(aUTF8QueryURL, RTL_TEXTENCODING_UTF8); - ucbhelper::Content aContent(aQueryURL, aEnvironment, m_xContext); + ucbhelper::Content aContent(aQueryURL, pHelper, m_xContext); // get reply try { m_aResultStream = aContent.openStream(); diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 328152765c93..db81c5ce4f3a 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -302,8 +302,8 @@ void LoadEnv::startLoading(const OUString& sURL, const uno::Sequence<beans::Prop m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_SILENT, false)) { rtl::Reference<QuietInteraction> pQuietInteraction = new QuietInteraction(); - uno::Reference<task::XInteractionHandler> xInteractionHandler(pQuietInteraction); - m_lMediaDescriptor[utl::MediaDescriptor::PROP_INTERACTIONHANDLER] <<= xInteractionHandler; + m_lMediaDescriptor[utl::MediaDescriptor::PROP_INTERACTIONHANDLER] <<= + uno::Reference<task::XInteractionHandler>(pQuietInteraction); } initializeUIDefaults(m_xContext, m_lMediaDescriptor, bUIMode, &m_pQuietInteraction); diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 02e72be1696d..20bc7ffc60e9 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -1794,7 +1794,7 @@ void SAL_CALL XFrameImpl::addTitleChangeListener( const css::uno::Reference< css // SAFE -> SolarMutexClearableGuard aReadLock; - css::uno::Reference< css::frame::XTitleChangeBroadcaster > xTitle(m_xTitleHelper); + rtl::Reference< TitleHelper > xTitle(m_xTitleHelper); aReadLock.clear(); // <- SAFE @@ -1807,7 +1807,7 @@ void SAL_CALL XFrameImpl::removeTitleChangeListener( const css::uno::Reference< // SAFE -> SolarMutexClearableGuard aReadLock; - css::uno::Reference< css::frame::XTitleChangeBroadcaster > xTitle(m_xTitleHelper); + rtl::Reference< TitleHelper > xTitle(m_xTitleHelper); aReadLock.clear(); // <- SAFE @@ -3102,7 +3102,7 @@ void XFrameImpl::implts_startWindowListening() // Make snapshot of necessary member! SolarMutexClearableGuard aReadLock; css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow; - css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > xDragDropListener = m_xDropTargetListener; + rtl::Reference< OpenFileDropTargetListener > xDragDropListener = m_xDropTargetListener; css::uno::Reference< css::awt::XWindowListener > xWindowListener(this); css::uno::Reference< css::awt::XFocusListener > xFocusListener(this); css::uno::Reference< css::awt::XTopWindowListener > xTopWindowListener(this); @@ -3138,7 +3138,7 @@ void XFrameImpl::implts_stopWindowListening() // Make snapshot of necessary member! SolarMutexClearableGuard aReadLock; css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow; - css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > xDragDropListener = m_xDropTargetListener; + rtl::Reference< OpenFileDropTargetListener > xDragDropListener = m_xDropTargetListener; css::uno::Reference< css::awt::XWindowListener > xWindowListener(this); css::uno::Reference< css::awt::XFocusListener > xFocusListener(this); css::uno::Reference< css::awt::XTopWindowListener > xTopWindowListener(this); diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index eeebdfc73730..b9c558512d98 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -912,8 +912,7 @@ void SAL_CALL ModuleUIConfigurationManager::dispose() /* SAFE AREA ----------------------------------------------------------------------------------------------- */ SolarMutexClearableGuard aGuard; - Reference< XComponent > xModuleImageManager( m_xModuleImageManager ); - m_xModuleImageManager.clear(); + rtl::Reference< ImageManager > xModuleImageManager = std::move( m_xModuleImageManager ); m_xModuleAcceleratorManager.clear(); m_aUIElements[LAYER_USERDEFINED].clear(); m_aUIElements[LAYER_DEFAULT].clear(); diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index 2b3b70da963b..bfe38aa7c60f 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -206,8 +206,8 @@ PopupMenuToolbarController::createPopupWindow() // its ToolBarManager can be disposed along with our controller, destroying // m_xPopupMenu, while the latter still in execute. This should be fixed at a // different level, for now just hold it here so it won't crash. - css::uno::Reference< css::awt::XPopupMenu > xPopupMenu ( m_xPopupMenu ); - sal_uInt16 nId = xPopupMenu->execute( + rtl::Reference< VCLXPopupMenu > xKeepAlivePopupMenu ( m_xPopupMenu ); + sal_uInt16 nId = xKeepAlivePopupMenu->execute( css::uno::Reference< css::awt::XWindowPeer >( getParent(), css::uno::UNO_QUERY ), vcl::unohelper::ConvertToAWTRect( pToolBox->GetItemRect( m_nToolBoxId ) ), ( eAlign == WindowAlign::Top || eAlign == WindowAlign::Bottom ) ? @@ -216,7 +216,7 @@ PopupMenuToolbarController::createPopupWindow() pToolBox->SetItemDown( m_nToolBoxId, false ); if ( nId ) - functionExecuted( xPopupMenu->getCommand( nId ) ); + functionExecuted( xKeepAlivePopupMenu->getCommand( nId ) ); return xRet; } diff --git a/framework/source/uielement/toolbarmodemenucontroller.cxx b/framework/source/uielement/toolbarmodemenucontroller.cxx index 4abf30394e68..937af50c8702 100644 --- a/framework/source/uielement/toolbarmodemenucontroller.cxx +++ b/framework/source/uielement/toolbarmodemenucontroller.cxx @@ -170,7 +170,7 @@ void SAL_CALL ToolbarModeMenuController::statusChanged( const FeatureStateEvent& // All other status events will be processed here std::unique_lock aLock( m_aMutex ); - Reference< css::awt::XPopupMenu > xPopupMenu( m_xPopupMenu ); + rtl::Reference< VCLXPopupMenu > xPopupMenu( m_xPopupMenu ); aLock.unlock(); if ( !xPopupMenu.is() ) diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index 6c0c09549dce..fe434bdc577e 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -466,7 +466,7 @@ void SAL_CALL ToolbarsMenuController::statusChanged( const FeatureStateEvent& Ev // All other status events will be processed here std::unique_lock aLock( m_aMutex ); - Reference< css::awt::XPopupMenu > xPopupMenu( m_xPopupMenu ); + rtl::Reference< VCLXPopupMenu > xPopupMenu( m_xPopupMenu ); aLock.unlock(); if ( !xPopupMenu.is() ) diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 2dbb2077fec4..1fca7c3df634 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -3386,14 +3386,13 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getRawEncrStreamElement( throw io::IOException( THROW_WHERE ); rtl::Reference < utl::TempFileFastService > xTempFile = new utl::TempFileFastService; - uno::Reference < io::XOutputStream > xTempOut = xTempFile; xTempIn = xTempFile; if ( !xTempFile ) throw io::IOException( THROW_WHERE ); // Copy temporary file to a new one - ::comphelper::OStorageHelper::CopyInputToOutput( xRawInStream, xTempOut ); + ::comphelper::OStorageHelper::CopyInputToOutput( xRawInStream, xTempFile ); xTempFile->closeOutput(); xTempFile->seek( 0 ); diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index 8280a048c7c5..32ef48b954e0 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -326,7 +326,6 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( // create another temporary file rtl::Reference < utl::TempFileFastService > xTempOut = new utl::TempFileFastService; - uno::Reference < io::XInputStream > xTempIn( xTempOut ); // copy the raw stream to the temporary file ::comphelper::OStorageHelper::CopyInputToOutput( xInRaw, xTempOut ); @@ -340,7 +339,7 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( xRootNameContainer.clear(); // return the stream representing the first temporary file - return xTempIn; + return xTempOut; } catch ( RuntimeException& ) { diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 0eb93a09571f..342c7c30c3e0 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -684,7 +684,6 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) // later if the following transaction was finished. rtl::Reference<sfx2::PreventDuplicateInteraction> pHandler = new sfx2::PreventDuplicateInteraction(comphelper::getProcessComponentContext()); - uno::Reference<task::XInteractionHandler> xHandler(pHandler); uno::Reference<task::XInteractionHandler> xWrappedHandler; // wrap existing handler or create new UUI handler @@ -698,7 +697,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) pHandler->setHandler(xWrappedHandler); else pHandler->useDefaultUUIHandler(); - rReq.AppendItem( SfxUnoAnyItem(SID_INTERACTIONHANDLER,css::uno::Any(xHandler)) ); + rReq.AppendItem( SfxUnoAnyItem(SID_INTERACTIONHANDLER,css::uno::Any(uno::Reference<task::XInteractionHandler>(pHandler))) ); // define rules for this handler css::uno::Type aInteraction = ::cppu::UnoType<css::task::ErrorCodeRequest>::get(); diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx index 4278a30fb683..faa27ac0cb88 100644 --- a/sfx2/source/control/thumbnailviewacc.cxx +++ b/sfx2/source/control/thumbnailviewacc.cxx @@ -71,7 +71,7 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ThumbnailViewAcc::getAcces if( !pItem ) throw lang::IndexOutOfBoundsException(); - uno::Reference< accessibility::XAccessible > xRet = pItem->GetAccessible(); + rtl::Reference< ThumbnailViewItemAcc > xRet = pItem->GetAccessible(); return xRet; } diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 8e7020d5cfe2..b6ba3a46685c 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -3031,10 +3031,9 @@ ErrCode RequestPassword(const std::shared_ptr<const SfxFilter>& pCurrentFilter, const bool bMSType = IsMSType(pCurrentFilter); - uno::Reference< css::task::XInteractionRequest > rRequest( pPasswordRequest ); do { - xInteractionHandler->handle( rRequest ); + xInteractionHandler->handle( uno::Reference< css::task::XInteractionRequest >( pPasswordRequest ) ); if (!pPasswordRequest->isPassword() || bMSType) { break; diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx index f0939c8433bc..5145b0db2f0b 100644 --- a/sfx2/source/sidebar/SidebarDockingWindow.cxx +++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx @@ -74,8 +74,7 @@ SidebarDockingWindow::~SidebarDockingWindow() void SidebarDockingWindow::dispose() { - Reference<lang::XComponent> xComponent(mpSidebarController); - mpSidebarController.clear(); + rtl::Reference<SidebarController> xComponent = std::move(mpSidebarController); if (xComponent.is()) xComponent->dispose(); diff --git a/starmath/source/mathml/export.cxx b/starmath/source/mathml/export.cxx index 80d9b4f79762..34f2394879ca 100644 --- a/starmath/source/mathml/export.cxx +++ b/starmath/source/mathml/export.cxx @@ -236,11 +236,9 @@ OUString SmMLExportWrapper::Export(SmMlElement* pElementTree) return u""_ustr; //Get model - uno::Reference<lang::XComponent> xModelComp = m_xModel; - SAL_WARN_IF(xModelComp == nullptr, "starmath", "Missing model component"); SmModel* pModel = m_xModel.get(); SAL_WARN_IF(pModel == nullptr, "starmath", "Failed to get threw uno tunnel"); - if (xModelComp == nullptr || pModel == nullptr) + if (pModel == nullptr) return u""_ustr; // Get doc shell @@ -273,7 +271,7 @@ OUString SmMLExportWrapper::Export(SmMlElement* pElementTree) // Write stuff // Note: export through an XML exporter component (memory stream version) - return WriteThroughComponentMS(xModelComp, xContext, xInfoSet); + return WriteThroughComponentMS(uno::Reference<lang::XComponent>(m_xModel), xContext, xInfoSet); } // export through an XML exporter component (output stream version) diff --git a/starmath/source/mathml/import.cxx b/starmath/source/mathml/import.cxx index b7d6699d1294..59d58ea0035d 100644 --- a/starmath/source/mathml/import.cxx +++ b/starmath/source/mathml/import.cxx @@ -300,14 +300,6 @@ ErrCode SmMLImportWrapper::Import(std::u16string_view aSource) return ERRCODE_SFX_DOLOADFAILED; } - // Make a model component from our SmModel - uno::Reference<lang::XComponent> xModelComp = m_xModel; - if (!xModelComp.is()) - { - SAL_WARN("starmath", "Failed to make model while file input"); - return ERRCODE_SFX_DOLOADFAILED; - } - // Get model via uno SmModel* pModel = m_xModel.get(); if (pModel == nullptr) @@ -339,7 +331,8 @@ ErrCode SmMLImportWrapper::Import(std::u16string_view aSource) // Read data // read a component from text - ErrCode nError = ReadThroughComponentMS(aSource, xModelComp, xContext, xInfoSet); + ErrCode nError = ReadThroughComponentMS(aSource, uno::Reference<lang::XComponent>(m_xModel), + xContext, xInfoSet); // Declare any error if (nError != ERRCODE_NONE) diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index 98eda5ce9f96..2faeeccc5ff3 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -366,7 +366,7 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessible if( !pItem ) throw lang::IndexOutOfBoundsException(); - uno::Reference< accessibility::XAccessible > xRet = pItem->GetAccessible(); + rtl::Reference< ValueItemAcc > xRet = pItem->GetAccessible(); return xRet; } diff --git a/svtools/source/uno/unoimap.cxx b/svtools/source/uno/unoimap.cxx index 637f13b98a47..139bd4227172 100644 --- a/svtools/source/uno/unoimap.cxx +++ b/svtools/source/uno/unoimap.cxx @@ -613,8 +613,7 @@ Any SAL_CALL SvUnoImageMap::getByIndex( sal_Int32 nIndex ) auto aIter = maObjectList.begin(); std::advance(aIter, nIndex); - Reference< XPropertySet > xObj( *aIter ); - return Any( xObj ); + return Any( Reference< XPropertySet >( *aIter ) ); } // XElementAccess diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx index ccd686cab2bd..f771f638c77d 100644 --- a/svx/source/accessibility/AccessibleTextHelper.cxx +++ b/svx/source/accessibility/AccessibleTextHelper.cxx @@ -1065,7 +1065,7 @@ namespace accessibility // #i61812# remember para to be removed for later notification // AFTER the new state is applied (that after the para got removed) - ::uno::Reference< XAccessible > xPara(begin->first.get()); + rtl::Reference<AccessibleEditableTextPara> xPara(begin->first.get()); // release everything from the remove position until the end maParaManager.Release(aFunctor.GetParaIndex(), nCurrParas); @@ -1081,7 +1081,7 @@ namespace accessibility // #i61812# notification for removed para if (xPara.is()) - FireEvent(AccessibleEventId::CHILD, uno::Any(), uno::Any( xPara) ); + FireEvent(AccessibleEventId::CHILD, uno::Any(), uno::Any( ::uno::Reference< XAccessible >(xPara) ) ); } #ifdef DBG_UTIL else diff --git a/svx/source/accessibility/ChildrenManagerImpl.cxx b/svx/source/accessibility/ChildrenManagerImpl.cxx index 29b3f76bf891..5d950014bff8 100644 --- a/svx/source/accessibility/ChildrenManagerImpl.cxx +++ b/svx/source/accessibility/ChildrenManagerImpl.cxx @@ -521,7 +521,7 @@ void ChildrenManagerImpl::RemoveShape (const Reference<drawing::XShape>& rxShape return; // Remove descriptor from that list. - Reference<XAccessible> xHoldAlive(I->mxAccessibleShape); + rtl::Reference<AccessibleShape> xHoldAlive(I->mxAccessibleShape); UnregisterAsDisposeListener (I->mxShape); // Dispose the accessible object. diff --git a/svx/source/accessibility/svxrectctaccessiblecontext.cxx b/svx/source/accessibility/svxrectctaccessiblecontext.cxx index e3d736e45510..e77c1f49b92f 100644 --- a/svx/source/accessibility/svxrectctaccessiblecontext.cxx +++ b/svx/source/accessibility/svxrectctaccessiblecontext.cxx @@ -136,14 +136,14 @@ Reference< XAccessible > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleChil { checkChildIndex( nIndex ); - Reference< XAccessible > xChild(mvChildren[ nIndex ]); + rtl::Reference< SvxRectCtlChildAccessibleContext > xChild(mvChildren[ nIndex ]); if( !xChild.is() ) { ::SolarMutexGuard aSolarGuard; ::osl::MutexGuard aGuard( m_aMutex ); - xChild = mvChildren[ nIndex ].get(); + xChild = mvChildren[ nIndex ]; if (!xChild.is() && mpRepr) { diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index 030bfa8757fc..c6053e6b1aa6 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -1330,8 +1330,7 @@ namespace svxform m_xFrame = pBindings->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(); DBG_ASSERT( m_xFrame.is(), "DataNavigatorWindow::LoadModels(): no frame" ); // add frameaction listener - Reference< XFrameActionListener > xListener = m_xDataListener; - m_xFrame->addFrameActionListener( xListener ); + m_xFrame->addFrameActionListener( Reference< XFrameActionListener >(m_xDataListener) ); // load xforms models of the current document LoadModels(); @@ -1349,8 +1348,7 @@ namespace svxform DataNavigatorWindow::~DataNavigatorWindow() { - Reference< XFrameActionListener > xListener = m_xDataListener; - m_xFrame->removeFrameActionListener( xListener ); + m_xFrame->removeFrameActionListener( Reference< XFrameActionListener >(m_xDataListener) ); SvtViewOptions aViewOpt( EViewType::TabDialog, CFGNAME_DATANAVIGATOR ); aViewOpt.SetPageID(m_xTabCtrl->get_current_page_ident()); @@ -1992,8 +1990,7 @@ namespace svxform void DataNavigatorWindow::AddContainerBroadcaster( const css::uno::Reference< css::container::XContainer >& xContainer ) { - Reference< XContainerListener > xListener = m_xDataListener; - xContainer->addContainerListener( xListener ); + xContainer->addContainerListener( Reference< XContainerListener >(m_xDataListener) ); m_aContainerList.push_back( xContainer ); } @@ -2010,10 +2007,9 @@ namespace svxform void DataNavigatorWindow::RemoveBroadcaster() { - Reference< XContainerListener > xContainerListener = m_xDataListener; sal_Int32 i, nCount = m_aContainerList.size(); for ( i = 0; i < nCount; ++i ) - m_aContainerList[i]->removeContainerListener( xContainerListener ); + m_aContainerList[i]->removeContainerListener( Reference< XContainerListener >(m_xDataListener) ); Reference< XEventListener > xEventListener = m_xDataListener; nCount = m_aEventTargetList.size(); for ( i = 0; i < nCount; ++i ) diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index 75ae86d60219..6a82eef6b2d3 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -164,8 +164,7 @@ void FmFormObj::impl_checkRefDevice_nothrow( bool _force ) { rtl::Reference<VCLXDevice> pUnoRefDevice = new VCLXDevice; pUnoRefDevice->SetOutputDevice( m_pLastKnownRefDevice ); - Reference< XDevice > xRefDevice( pUnoRefDevice ); - xModelProps->setPropertyValue( sRefDevicePropName, Any( xRefDevice ) ); + xModelProps->setPropertyValue( sRefDevicePropName, Any( Reference< XDevice >( pUnoRefDevice ) ) ); } } catch( const Exception& ) diff --git a/svx/source/mnuctrls/smarttagmenu.cxx b/svx/source/mnuctrls/smarttagmenu.cxx index 93ab777b96a7..e0bc17706bd0 100644 --- a/svx/source/mnuctrls/smarttagmenu.cxx +++ b/svx/source/mnuctrls/smarttagmenu.cxx @@ -145,11 +145,11 @@ void SmartTagMenuController::FillMenu() const OUString aSmartTagCaption = xFirstAction->getSmartTagCaption( nSmartTagIndex, rLocale ); // No sub-menus if there's only one smart tag type listed - css::uno::Reference<css::awt::XPopupMenu> xSubMenu = m_xPopupMenu; + rtl::Reference<VCLXPopupMenu> xSubMenu = m_xPopupMenu; if ( 1 < rActionComponentsSequence.getLength() ) { m_xPopupMenu->insertItem(nMenuId, aSmartTagCaption, 0, -1); - xSubMenu.set(new VCLXPopupMenu); + xSubMenu = new VCLXPopupMenu; m_xPopupMenu->setPopupMenu(nMenuId++, xSubMenu); } diff --git a/svx/source/table/accessibletableshape.cxx b/svx/source/table/accessibletableshape.cxx index a2ea65e4f056..2ef0efef4fd7 100644 --- a/svx/source/table/accessibletableshape.cxx +++ b/svx/source/table/accessibletableshape.cxx @@ -172,8 +172,7 @@ Reference< XAccessible > AccessibleTableShapeImpl::getAccessibleChild(sal_Int64 if( iter != maChildMap.end() ) { - Reference< XAccessible > xChild( (*iter).second ); - return xChild; + return (*iter).second; } else { diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx index 149058d02c86..7717f42fb4e5 100644 --- a/svx/source/unodraw/unopage.cxx +++ b/svx/source/unodraw/unopage.cxx @@ -808,7 +808,7 @@ rtl::Reference<SvxShape> SvxDrawPage::CreateShapeByTypeAndInventor( SdrObjKind n Reference< drawing::XShape > SvxDrawPage::CreateShape( SdrObject *pObj ) const { - Reference< drawing::XShape > xShape( CreateShapeByTypeAndInventor(pObj->GetObjIdentifier(), + rtl::Reference< SvxShape > xShape( CreateShapeByTypeAndInventor(pObj->GetObjIdentifier(), pObj->GetObjInventor(), pObj, const_cast<SvxDrawPage*>(this))); diff --git a/test/source/unoapi_test.cxx b/test/source/unoapi_test.cxx index 035bf8c1f5fb..277d611cf122 100644 --- a/test/source/unoapi_test.cxx +++ b/test/source/unoapi_test.cxx @@ -75,9 +75,8 @@ void UnoApiTest::setTestInteractionHandler(const char* pPassword, auto& rPropertyValue = rFilterOptions.emplace_back(); xInteractionHandler = rtl::Reference<TestInteractionHandler>(new TestInteractionHandler(sPassword)); - css::uno::Reference<task::XInteractionHandler2> const xInteraction(xInteractionHandler); rPropertyValue.Name = "InteractionHandler"; - rPropertyValue.Value <<= xInteraction; + rPropertyValue.Value <<= css::uno::Reference<task::XInteractionHandler2>(xInteractionHandler); } void UnoApiTest::loadFromURL(OUString const& rURL, const char* pPassword) diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index fb58403e9ef5..f2c183fb846f 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -6720,8 +6720,7 @@ css::uno::Any SVTXFormattedField::getProperty( const OUString& PropertyName ) { if (!bIsStandardSupplier) { // otherwise void - css::uno::Reference< css::util::XNumberFormatsSupplier > xSupplier = m_xCurrentSupplier; - aReturn <<= xSupplier; + aReturn <<= css::uno::Reference< css::util::XNumberFormatsSupplier >(m_xCurrentSupplier); } } break; diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx index b7c8466f1fe6..ff836be7d921 100644 --- a/toolkit/source/controls/controlmodelcontainerbase.cxx +++ b/toolkit/source/controls/controlmodelcontainerbase.cxx @@ -1346,8 +1346,7 @@ void ControlContainerBase::dispose() // --- SAFE --- SolarMutexClearableGuard aGuard; - Reference< XEventListener > xListener = mxListener; - mxListener.clear(); + rtl::Reference< ResourceListener > xListener = std::move(mxListener); aGuard.clear(); // --- SAFE --- @@ -1669,13 +1668,10 @@ void ControlContainerBase::ImplStartListingForResourceEvents() ImplGetPropertyValue( PROPERTY_RESOURCERESOLVER ) >>= xStringResourceResolver; - // Add our helper as listener to retrieve notifications about changes - Reference< util::XModifyListener > rListener( mxListener ); - ResourceListener* pResourceListener = static_cast< ResourceListener* >( rListener.get() ); - - // resource listener will stop listening if resolver reference is empty - if ( pResourceListener ) - pResourceListener->startListening( xStringResourceResolver ); + // Add our helper as listener to retrieve notifications about changes. + // Resource listener will stop listening if resolver reference is empty. + if ( mxListener ) + mxListener->startListening( xStringResourceResolver ); ImplUpdateResourceResolver(); } diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx index d650de56b252..cfd6d5263231 100644 --- a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx +++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx @@ -166,7 +166,7 @@ private: throw css::lang::IndexOutOfBoundsException( OUString(), *this ); Columns::iterator const pos = m_aColumns.begin() + i_columnIndex; - Reference< XGridColumn > const xColumn( *pos ); + rtl::Reference< GridColumn > const xColumn( *pos ); m_aColumns.erase( pos ); // update indexes of all subsequent columns @@ -184,7 +184,7 @@ private: ContainerEvent aEvent; aEvent.Source = *this; aEvent.Accessor <<= i_columnIndex; - aEvent.Element <<= xColumn; + aEvent.Element <<= Reference< XGridColumn >(xColumn); m_aContainerListeners.notifyEach( aGuard, &XContainerListener::elementRemoved, aEvent ); diff --git a/ucb/source/ucp/gio/gio_provider.cxx b/ucb/source/ucp/gio/gio_provider.cxx index d9c081358ba6..d070afb94190 100644 --- a/ucb/source/ucp/gio/gio_provider.cxx +++ b/ucb/source/ucp/gio/gio_provider.cxx @@ -37,7 +37,7 @@ ContentProvider::queryContent( osl::MutexGuard aGuard( m_aMutex ); // Check, if a content with given id already exists... - css::uno::Reference< css::ucb::XContent > xContent = queryExistingContent( Identifier ); + rtl::Reference< ucbhelper::ContentImplHelper > xContent = queryExistingContent( Identifier ); if ( xContent.is() ) return xContent; diff --git a/ucb/source/ucp/package/pkgprovider.cxx b/ucb/source/ucp/package/pkgprovider.cxx index fd87897960e3..ffac012e4993 100644 --- a/ucb/source/ucp/package/pkgprovider.cxx +++ b/ucb/source/ucp/package/pkgprovider.cxx @@ -180,7 +180,7 @@ uno::Reference< ucb::XContent > SAL_CALL ContentProvider::queryContent( osl::MutexGuard aGuard( m_aMutex ); // Check, if a content with given id already exists... - uno::Reference< ucb::XContent > xContent + rtl::Reference< ucbhelper::ContentImplHelper > xContent = queryExistingContent( xId ); if ( xContent.is() ) return xContent; diff --git a/ucb/source/ucp/tdoc/tdoc_provider.cxx b/ucb/source/ucp/tdoc/tdoc_provider.cxx index 1e65ee678aff..1d9554bc6cd2 100644 --- a/ucb/source/ucp/tdoc/tdoc_provider.cxx +++ b/ucb/source/ucp/tdoc/tdoc_provider.cxx @@ -112,7 +112,7 @@ ContentProvider::queryContent( osl::MutexGuard aGuard( m_aMutex ); // Check, if a content with given id already exists... - uno::Reference< ucb::XContent > xContent + rtl::Reference< ucbhelper::ContentImplHelper > xContent = queryExistingContent( xCanonicId ); if ( !xContent.is() ) @@ -169,7 +169,7 @@ ContentProvider::createDocumentContent( osl::MutexGuard aGuard( m_aMutex ); // Check, if a content with given id already exists... - uno::Reference< ucb::XContent > xContent + rtl::Reference< ucbhelper::ContentImplHelper > xContent = queryExistingContent( xId ); if ( !xContent.is() ) diff --git a/unoxml/source/dom/elementlist.cxx b/unoxml/source/dom/elementlist.cxx index 9fe297d5604e..92800d0c5da1 100644 --- a/unoxml/source/dom/elementlist.cxx +++ b/unoxml/source/dom/elementlist.cxx @@ -94,13 +94,7 @@ namespace DOM CElementListImpl::~CElementListImpl() { if (m_xEventListener.is() && m_pElement.is()) - { - Reference< XEventTarget > xTarget = m_pElement; - assert(xTarget.is()); - if (!xTarget.is()) - return; - xTarget->removeEventListener(u"DOMSubtreeModified"_ustr, m_xEventListener, false/*capture*/); - } + m_pElement->removeEventListener(u"DOMSubtreeModified"_ustr, m_xEventListener, false/*capture*/); } void CElementListImpl::registerListener(CElement & rElement) diff --git a/unoxml/source/events/eventdispatcher.cxx b/unoxml/source/events/eventdispatcher.cxx index 289962f97855..e990040ae17a 100644 --- a/unoxml/source/events/eventdispatcher.cxx +++ b/unoxml/source/events/eventdispatcher.cxx @@ -201,9 +201,8 @@ namespace DOM::events { xmlNodePtr cur = pNode; while (cur != nullptr) { - Reference< XEventTarget > const xRef( - rDocument.GetCNode(cur)); - captureVector.emplace_back(xRef, cur); + rtl::Reference< CNode > const xRef(rDocument.GetCNode(cur)); + captureVector.emplace_back(Reference< XEventTarget >(xRef), cur); cur = cur->parent; } } diff --git a/vcl/source/accessibility/accessiblelistbox.cxx b/vcl/source/accessibility/accessiblelistbox.cxx index 0de3d1c8f49d..efd0e9350cb6 100644 --- a/vcl/source/accessibility/accessiblelistbox.cxx +++ b/vcl/source/accessibility/accessiblelistbox.cxx @@ -167,13 +167,13 @@ void AccessibleListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEven SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() ); if ( pEntry ) { - Reference<XAccessible> const xChild(implGetAccessible(*pEntry)); + rtl::Reference<AccessibleListBoxEntry> const xChild(implGetAccessible(*pEntry)); const short nAccEvent = ( rVclWindowEvent.GetId() == VclEventId::ItemExpanded ) ? AccessibleEventId::LISTBOX_ENTRY_EXPANDED : AccessibleEventId::LISTBOX_ENTRY_COLLAPSED; uno::Any aListBoxEntry; - aListBoxEntry <<= xChild; + aListBoxEntry <<= Reference<XAccessible>(xChild); NotifyAccessibleEvent( nAccEvent, Any(), aListBoxEntry ); if ( getListBox() && getListBox()->HasFocus() ) { diff --git a/vcl/source/accessibility/vclxaccessiblestatusbar.cxx b/vcl/source/accessibility/vclxaccessiblestatusbar.cxx index 8840e4fe00cf..a4fabdac4a0c 100644 --- a/vcl/source/accessibility/vclxaccessiblestatusbar.cxx +++ b/vcl/source/accessibility/vclxaccessiblestatusbar.cxx @@ -111,7 +111,7 @@ void VCLXAccessibleStatusBar::RemoveChild( sal_Int32 i ) return; // get the accessible of the removed page - Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); + rtl::Reference< VCLXAccessibleStatusBarItem > xChild( m_aAccessibleChildren[i] ); // remove entry in child list m_aAccessibleChildren.erase( m_aAccessibleChildren.begin() + i ); @@ -120,12 +120,10 @@ void VCLXAccessibleStatusBar::RemoveChild( sal_Int32 i ) if ( xChild.is() ) { Any aOldValue, aNewValue; - aOldValue <<= xChild; + aOldValue <<= Reference< XAccessible >(xChild); NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue ); - Reference< XComponent > xComponent( xChild, UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); + xChild->dispose(); } } diff --git a/vcl/source/accessibility/vclxaccessibletoolbox.cxx b/vcl/source/accessibility/vclxaccessibletoolbox.cxx index c725eee6e0cf..91203cdcdc5e 100644 --- a/vcl/source/accessibility/vclxaccessibletoolbox.cxx +++ b/vcl/source/accessibility/vclxaccessibletoolbox.cxx @@ -627,7 +627,7 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleChild( sal xChild = new VCLXAccessibleToolBoxItem( pToolBox, i ); if ( pItemWindow ) { - Reference< XAccessible> xParent = xChild; + rtl::Reference<VCLXAccessibleToolBoxItem> xParent = xChild; auto const xInnerAcc(pItemWindow->GetAccessible()); if (xInnerAcc) // else child is being disposed - avoid crashing { diff --git a/xmlhelp/source/cxxhelp/provider/provider.cxx b/xmlhelp/source/cxxhelp/provider/provider.cxx index 457dec5b71d7..70f3e6b0380d 100644 --- a/xmlhelp/source/cxxhelp/provider/provider.cxx +++ b/xmlhelp/source/cxxhelp/provider/provider.cxx @@ -95,7 +95,7 @@ ContentProvider::queryContent( throw uno::RuntimeException(); // Check, if a content with given id already exists... - uno::Reference< ucb::XContent > xContent + rtl::Reference< ucbhelper::ContentImplHelper > xContent = queryExistingContent( xCanonicId ); if ( xContent.is() ) return xContent; diff --git a/xmloff/source/transform/FormPropOASISTContext.cxx b/xmloff/source/transform/FormPropOASISTContext.cxx index 042b57ae07e5..8cee944e39f4 100644 --- a/xmloff/source/transform/FormPropOASISTContext.cxx +++ b/xmloff/source/transform/FormPropOASISTContext.cxx @@ -106,15 +106,14 @@ void XMLFormPropOASISTransformerContext::StartElement( rtl::Reference<XMLMutableAttributeList> pMutableAttrList = new XMLMutableAttributeList( rAttrList ); - Reference< XAttributeList > xAttrList( pMutableAttrList ); sal_Int16 nValueTypeAttr = -1; OUString aValue; bool bIsVoid = false; - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + sal_Int16 nAttrCount = pMutableAttrList.is() ? pMutableAttrList->getLength() : 0; for( sal_Int16 i=0; i < nAttrCount; i++ ) { - const OUString aAttrName = xAttrList->getNameByIndex( i ); + const OUString aAttrName = pMutableAttrList->getNameByIndex( i ); OUString aLocalName; sal_uInt16 nPrefix = GetTransformer().GetNamespaceMap().GetKeyByAttrName( aAttrName, @@ -124,7 +123,7 @@ void XMLFormPropOASISTransformerContext::StartElement( pActions->find( aKey ); if( aIter != pActions->end() ) { - const OUString aAttrValue = xAttrList->getValueByIndex( i ); + const OUString aAttrValue = pMutableAttrList->getValueByIndex( i ); switch( (*aIter).second.m_nActionType ) { case XML_ATACTION_RENAME: @@ -178,12 +177,11 @@ void XMLFormPropOASISTransformerContext::StartElement( GetXMLToken( GetValueType( aValue ) ) ); if( !m_bIsListValue ) - XMLRenameElemTransformerContext::StartElement( xAttrList ); + XMLRenameElemTransformerContext::StartElement( pMutableAttrList ); if( m_bIsList ) return; pMutableAttrList = new XMLMutableAttributeList; - xAttrList = pMutableAttrList; if( bIsVoid ) { OUString aNewAttrQName( @@ -197,7 +195,7 @@ void XMLFormPropOASISTransformerContext::StartElement( GetTransformer().GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_FORM, GetXMLToken( XML_PROPERTY_VALUE ) ) ); GetTransformer().GetDocHandler()->startElement( aValueElemQName, - xAttrList ); + pMutableAttrList ); GetTransformer().GetDocHandler()->characters( aValue ); GetTransformer().GetDocHandler()->endElement( aValueElemQName ); } diff --git a/xmloff/source/transform/FrameOOoTContext.cxx b/xmloff/source/transform/FrameOOoTContext.cxx index 5054f94f1d1c..ff507e4dbbad 100644 --- a/xmloff/source/transform/FrameOOoTContext.cxx +++ b/xmloff/source/transform/FrameOOoTContext.cxx @@ -59,7 +59,6 @@ void XMLFrameOOoTransformerContext::StartElement( rtl::Reference<XMLMutableAttributeList> pFrameMutableAttrList = new XMLMutableAttributeList; - Reference< XAttributeList > xFrameAttrList( pFrameMutableAttrList ); sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; for( sal_Int16 i=0; i < nAttrCount; i++ ) @@ -91,7 +90,7 @@ void XMLFrameOOoTransformerContext::StartElement( } GetTransformer().GetDocHandler()->startElement( m_aElemQName, - xFrameAttrList ); + Reference< XAttributeList >( pFrameMutableAttrList ) ); XMLTransformerContext::StartElement( xAttrList ); } diff --git a/xmloff/source/transform/OOo2Oasis.cxx b/xmloff/source/transform/OOo2Oasis.cxx index e29c43b7f1d5..749ad826141b 100644 --- a/xmloff/source/transform/OOo2Oasis.cxx +++ b/xmloff/source/transform/OOo2Oasis.cxx @@ -1046,7 +1046,6 @@ void XMLBodyTransformerContext_Impl::StartElement( rtl::Reference<XMLMutableAttributeList> pMutableAttrList = new XMLMutableAttributeList( rAttrList ); - Reference< XAttributeList > xAttrList = pMutableAttrList; OUString aClass( GetTransformer().GetClass() ); if( aClass.isEmpty() ) { @@ -1065,7 +1064,7 @@ void XMLBodyTransformerContext_Impl::StartElement( m_aClassQName = GetTransformer().GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OFFICE, aClass ); GetTransformer().GetDocHandler()->startElement( m_aClassQName, - xAttrList ); + pMutableAttrList ); } void XMLBodyTransformerContext_Impl::EndElement()