From 2660d24a07866e083c5135ea263030f3e3a2e729 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 13 Jul 2015 16:17:00 +0200 Subject: new loplugin: refcounting This was a feature requested by mmeeks, as a result of tdf#92611. It validates that things that extend XInterface are not directly heap/stack-allocated, but have their lifecycle managed via css::uno::Reference or rtl::Reference. Change-Id: I28e3b8b236f6a4a56d0a6d6f26ad54e44b36e692 Reviewed-on: https://gerrit.libreoffice.org/16924 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- UnoControls/source/controls/framecontrol.cxx | 18 +- UnoControls/source/inc/framecontrol.hxx | 6 +- basic/source/inc/namecont.hxx | 10 +- basic/source/uno/dlgcont.cxx | 2 +- basic/source/uno/namecont.cxx | 88 ++++---- basic/source/uno/scriptcont.cxx | 8 +- compilerplugins/clang/refcounting.cxx | 249 +++++++++++++++++++++ .../source/core/dataaccess/ComponentDefinition.cxx | 13 +- .../source/core/dataaccess/ComponentDefinition.hxx | 2 +- dbaccess/source/core/dataaccess/datasource.cxx | 4 +- dbaccess/source/core/dataaccess/datasource.hxx | 2 +- dbaccess/source/ui/misc/singledoccontroller.cxx | 10 +- .../source/processor2d/vclmetafileprocessor2d.cxx | 38 ++-- editeng/qa/unit/core-test.cxx | 56 ++--- .../accessibility/AccessibleEditableTextPara.cxx | 48 ++-- editeng/source/misc/svxacorr.cxx | 8 +- editeng/source/xml/xmltxtexp.cxx | 4 +- extensions/source/scanner/sanedlg.cxx | 12 +- filter/source/svg/svgwriter.cxx | 2 +- i18npool/inc/calendar_gregorian.hxx | 2 +- i18npool/source/calendar/calendar_gregorian.cxx | 4 +- i18npool/source/calendar/calendar_jewish.cxx | 2 +- .../characterclassification/cclass_unicode.cxx | 6 +- .../defaultnumberingprovider.cxx | 4 +- i18npool/source/indexentry/indexentrysupplier.cxx | 6 +- i18npool/source/transliteration/ignoreKana.cxx | 14 +- .../source/transliteration/ignoreSize_ja_JP.cxx | 14 +- i18npool/source/transliteration/ignoreWidth.cxx | 14 +- .../transliteration/transliteration_body.cxx | 12 +- .../transliteration/transliteration_caseignore.cxx | 16 +- oox/source/core/xmlfilterbase.cxx | 8 +- reportdesign/source/ui/dlg/GroupsSorting.cxx | 9 +- sax/qa/cppunit/attributes.cxx | 42 ++-- sax/qa/cppunit/parser.cxx | 9 +- sc/source/ui/dbgui/csvcontrol.cxx | 2 +- sc/source/ui/dbgui/csvgrid.cxx | 6 +- sc/source/ui/dbgui/csvruler.cxx | 2 +- sc/source/ui/dbgui/csvtablebox.cxx | 5 +- sc/source/ui/inc/csvcontrol.hxx | 2 +- sc/source/ui/inc/csvgrid.hxx | 2 +- sc/source/ui/inc/csvruler.hxx | 2 +- sc/source/ui/inc/csvtablebox.hxx | 2 +- sc/source/ui/unoobj/cellsuno.cxx | 10 +- sc/source/ui/unoobj/chart2uno.cxx | 4 +- sc/source/ui/unoobj/docuno.cxx | 16 +- sc/source/ui/vba/vbafont.cxx | 20 +- sc/source/ui/vba/vbawindow.cxx | 12 +- sc/source/ui/vba/vbawindows.cxx | 4 +- sd/source/ui/inc/EventMultiplexer.hxx | 3 +- sd/source/ui/tools/EventMultiplexer.cxx | 6 - sd/source/ui/view/drviews5.cxx | 2 +- sdext/source/pdfimport/test/pdf2xml.cxx | 6 +- sdext/source/pdfimport/test/tests.cxx | 12 +- svtools/source/edit/svmedit.cxx | 4 +- svx/source/sdr/contact/viewcontactofgraphic.cxx | 6 +- .../sdr/primitive2d/sdrmeasureprimitive2d.cxx | 14 +- svx/source/xml/xmlxtexp.cxx | 4 +- sw/source/core/swg/SwXMLTextBlocks1.cxx | 8 +- sw/source/core/unocore/unorefmk.cxx | 38 ++-- sw/source/filter/ww8/docxattributeoutput.cxx | 188 ++++++++++------ sw/source/filter/ww8/docxattributeoutput.hxx | 36 +-- sw/source/filter/ww8/docxsdrexport.cxx | 38 ++-- sw/source/filter/ww8/docxsdrexport.hxx | 8 +- sw/source/ui/vba/vbawindow.cxx | 12 +- sw/source/uibase/config/StoredChapterNumbering.cxx | 4 +- sw/source/uibase/dbui/dbtree.cxx | 6 +- ucb/source/ucp/cmis/cmis_content.cxx | 4 +- ucb/source/ucp/tdoc/tdoc_storage.cxx | 3 +- uui/source/requeststringresolver.hxx | 2 +- writerfilter/source/filter/WriterFilter.cxx | 4 +- .../source/ooxml/OOXMLFastDocumentHandler.cxx | 19 +- .../source/ooxml/OOXMLFastDocumentHandler.hxx | 4 +- xmloff/source/meta/xmlversion.cxx | 4 +- 73 files changed, 779 insertions(+), 487 deletions(-) create mode 100644 compilerplugins/clang/refcounting.cxx diff --git a/UnoControls/source/controls/framecontrol.cxx b/UnoControls/source/controls/framecontrol.cxx index 3b34a9fe4d29..e4fcd6d78ed6 100644 --- a/UnoControls/source/controls/framecontrol.cxx +++ b/UnoControls/source/controls/framecontrol.cxx @@ -47,11 +47,11 @@ namespace unocontrols{ // construct/destruct FrameControl::FrameControl( const Reference< XComponentContext >& rxContext) - : BaseControl ( rxContext ) - , OBroadcastHelper ( m_aMutex ) - , OPropertySetHelper ( *(static_cast< OBroadcastHelper * >(this)) ) - , m_aInterfaceContainer ( m_aMutex ) - , m_aConnectionPointContainer ( m_aMutex ) + : BaseControl ( rxContext ) + , OBroadcastHelper ( m_aMutex ) + , OPropertySetHelper ( *(static_cast< OBroadcastHelper * >(this)) ) + , m_aInterfaceContainer ( m_aMutex ) + , m_aConnectionPointContainer ( new OConnectionPointContainerHelper(m_aMutex) ) { } @@ -233,7 +233,7 @@ Reference< XGraphics > SAL_CALL FrameControl::getGraphics() throw( RuntimeExcept Sequence< Type > SAL_CALL FrameControl::getConnectionPointTypes() throw( RuntimeException, std::exception ) { // Forwarded to helper class - return m_aConnectionPointContainer.getConnectionPointTypes(); + return m_aConnectionPointContainer->getConnectionPointTypes(); } // XConnectionPointContainer @@ -241,7 +241,7 @@ Sequence< Type > SAL_CALL FrameControl::getConnectionPointTypes() throw( Runtime Reference< XConnectionPoint > SAL_CALL FrameControl::queryConnectionPoint( const Type& aType ) throw( RuntimeException, std::exception ) { // Forwarded to helper class - return m_aConnectionPointContainer.queryConnectionPoint( aType ); + return m_aConnectionPointContainer->queryConnectionPoint( aType ); } // XConnectionPointContainer @@ -250,7 +250,7 @@ void SAL_CALL FrameControl::advise( const Type& aType const Reference< XInterface >& xListener ) throw( RuntimeException, std::exception ) { // Forwarded to helper class - m_aConnectionPointContainer.advise( aType, xListener ); + m_aConnectionPointContainer->advise( aType, xListener ); } // XConnectionPointContainer @@ -259,7 +259,7 @@ void SAL_CALL FrameControl::unadvise( const Type& aTyp const Reference< XInterface >& xListener ) throw( RuntimeException, std::exception ) { // Forwarded to helper class - m_aConnectionPointContainer.unadvise( aType, xListener ); + m_aConnectionPointContainer->unadvise( aType, xListener ); } // impl but public method to register service diff --git a/UnoControls/source/inc/framecontrol.hxx b/UnoControls/source/inc/framecontrol.hxx index e1b48b7f96db..257edecfc55f 100644 --- a/UnoControls/source/inc/framecontrol.hxx +++ b/UnoControls/source/inc/framecontrol.hxx @@ -211,10 +211,10 @@ private: private: ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame2 > m_xFrame; - OUString m_sComponentURL; + OUString m_sComponentURL; ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_seqLoaderArguments; - ::cppu::OMultiTypeInterfaceContainerHelper m_aInterfaceContainer; - OConnectionPointContainerHelper m_aConnectionPointContainer; + ::cppu::OMultiTypeInterfaceContainerHelper m_aInterfaceContainer; + css::uno::Reference m_aConnectionPointContainer; }; // class FrameControl diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx index 19e611ae3d70..085d9e3945ce 100644 --- a/basic/source/inc/namecont.hxx +++ b/basic/source/inc/namecont.hxx @@ -231,7 +231,7 @@ protected: ::osl::Mutex maMutex; ModifiableHelper maModifiable; - NameContainer maNameContainer; + css::uno::Reference maNameContainer; bool mbOldInfoFormat; bool mbOasis2OOoFormat; @@ -560,11 +560,11 @@ class SfxLibrary friend class SfxDialogLibraryContainer; friend class SfxScriptLibraryContainer; - css::uno::Reference< css::uno::XComponentContext > mxContext; - css::uno::Reference< css::ucb::XSimpleFileAccess3 > mxSFI; + css::uno::Reference< css::uno::XComponentContext > mxContext; + css::uno::Reference< css::ucb::XSimpleFileAccess3 > mxSFI; - ModifiableHelper& mrModifiable; - NameContainer maNameContainer; + ModifiableHelper& mrModifiable; + css::uno::Reference maNameContainer; bool mbLoaded; bool mbIsModified; diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx index 758b6edee29b..f4aa67f972ac 100644 --- a/basic/source/uno/dlgcont.cxx +++ b/basic/source/uno/dlgcont.cxx @@ -401,7 +401,7 @@ Reference< css::resource::XStringResourcePersistence > void SfxDialogLibraryContainer::onNewRootStorage() { // the library container is not modified, go through the libraries and check whether they are modified - Sequence< OUString > aNames = maNameContainer.getElementNames(); + Sequence< OUString > aNames = maNameContainer->getElementNames(); const OUString* pNames = aNames.getConstArray(); sal_Int32 nNameCount = aNames.getLength(); diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index f274d79fbcbf..8bf3b5c6c672 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -383,7 +383,7 @@ SfxLibraryContainer::SfxLibraryContainer() , mnRunningVBAScripts( 0 ) , mbVBACompat( false ) , maModifiable( *this, maMutex ) - , maNameContainer( cppu::UnoType::get()) + , maNameContainer( new NameContainer(cppu::UnoType::get()) ) , mbOldInfoFormat( false ) , mbOasis2OOoFormat( false ) , mpBasMgr( NULL ) @@ -499,7 +499,7 @@ sal_Bool SfxLibraryContainer::isModified() return sal_True; } // the library container is not modified, go through the libraries and check whether they are modified - Sequence< OUString > aNames = maNameContainer.getElementNames(); + Sequence< OUString > aNames = maNameContainer->getElementNames(); const OUString* pNames = aNames.getConstArray(); sal_Int32 nNameCount = aNames.getLength(); @@ -1016,7 +1016,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL, // Preload? { - Sequence< OUString > aNames = maNameContainer.getElementNames(); + Sequence< OUString > aNames = maNameContainer->getElementNames(); const OUString* pNames = aNames.getConstArray(); sal_Int32 nNameCount = aNames.getLength(); for( sal_Int32 i = 0 ; i < nNameCount ; i++ ) @@ -1201,7 +1201,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL, if( aLibName == aStandardStr ) { - maNameContainer.removeByName( aLibName ); + maNameContainer->removeByName( aLibName ); } // Create library @@ -1341,7 +1341,7 @@ void SfxLibraryContainer::checkStorageURL( const OUString& aSourceURL, SfxLibrary* SfxLibraryContainer::getImplLib( const OUString& rLibraryName ) { - Any aLibAny = maNameContainer.getByName( rLibraryName ) ; + Any aLibAny = maNameContainer->getByName( rLibraryName ) ; Reference< XNameAccess > xNameAccess; aLibAny >>= xNameAccess; SfxLibrary* pImplLib = static_cast< SfxLibrary* >( xNameAccess.get() ); @@ -1781,7 +1781,7 @@ void SfxLibraryContainer::implImportLibDescriptor( SfxLibrary* pLib, Any aDummyElement = createEmptyLibraryElement(); for( sal_Int32 i = 0 ; i < nElementCount ; i++ ) { - pLib->maNameContainer.insertByName( pElementNames[i], aDummyElement ); + pLib->maNameContainer->insertByName( pElementNames[i], aDummyElement ); } pLib->mbPasswordProtected = rLib.bPasswordProtected; pLib->mbReadOnly = rLib.bReadOnly; @@ -1796,7 +1796,7 @@ void SfxLibraryContainer::implImportLibDescriptor( SfxLibrary* pLib, void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XStorage >& i_rStorage, bool bComplete ) { - const Sequence< OUString > aNames = maNameContainer.getElementNames(); + const Sequence< OUString > aNames = maNameContainer->getElementNames(); const sal_Int32 nNameCount = aNames.getLength(); const OUString* pName = aNames.getConstArray(); const OUString* pNamesEnd = aNames.getConstArray() + nNameCount; @@ -1832,7 +1832,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto // Don't write if only empty standard lib exists if ( ( nLibsToSave == 1 ) && ( aNames[0] == "Standard" ) ) { - Any aLibAny = maNameContainer.getByName( aNames[0] ); + Any aLibAny = maNameContainer->getByName( aNames[0] ); Reference< XNameAccess > xNameAccess; aLibAny >>= xNameAccess; if ( ! xNameAccess->hasElements() ) @@ -2187,14 +2187,14 @@ Type SAL_CALL SfxLibraryContainer::getElementType() throw(RuntimeException, std::exception) { LibraryContainerMethodGuard aGuard( *this ); - return maNameContainer.getElementType(); + return maNameContainer->getElementType(); } sal_Bool SfxLibraryContainer::hasElements() throw(RuntimeException, std::exception) { LibraryContainerMethodGuard aGuard( *this ); - bool bRet = maNameContainer.hasElements(); + bool bRet = maNameContainer->hasElements(); return bRet; } @@ -2203,7 +2203,7 @@ Any SfxLibraryContainer::getByName( const OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException, std::exception) { LibraryContainerMethodGuard aGuard( *this ); - Any aRetAny = maNameContainer.getByName( aName ) ; + Any aRetAny = maNameContainer->getByName( aName ) ; return aRetAny; } @@ -2211,14 +2211,14 @@ Sequence< OUString > SfxLibraryContainer::getElementNames() throw(RuntimeException, std::exception) { LibraryContainerMethodGuard aGuard( *this ); - return maNameContainer.getElementNames(); + return maNameContainer->getElementNames(); } sal_Bool SfxLibraryContainer::hasByName( const OUString& aName ) throw(RuntimeException, std::exception) { LibraryContainerMethodGuard aGuard( *this ); - return maNameContainer.hasByName( aName ) ; + return maNameContainer->hasByName( aName ) ; } // Methods XLibraryContainer @@ -2234,7 +2234,7 @@ Reference< XNameContainer > SAL_CALL SfxLibraryContainer::createLibrary( const O Reference< XNameAccess > xNameAccess = static_cast< XNameAccess* >( pNewLib ); Any aElement; aElement <<= xNameAccess; - maNameContainer.insertByName( Name, aElement ); + maNameContainer->insertByName( Name, aElement ); maModifiable.setModified( true ); Reference< XNameContainer > xRet( xNameAccess, UNO_QUERY ); return xRet; @@ -2270,7 +2270,7 @@ Reference< XNameAccess > SAL_CALL SfxLibraryContainer::createLibraryLink Reference< XNameAccess > xRet = static_cast< XNameAccess* >( pNewLib ); Any aElement; aElement <<= xRet; - maNameContainer.insertByName( Name, aElement ); + maNameContainer->insertByName( Name, aElement ); maModifiable.setModified( true ); OUString aUserSearchStr("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE"); @@ -2294,7 +2294,7 @@ void SAL_CALL SfxLibraryContainer::removeLibrary( const OUString& Name ) { LibraryContainerMethodGuard aGuard( *this ); // Get and hold library before removing - Any aLibAny = maNameContainer.getByName( Name ) ; + Any aLibAny = maNameContainer->getByName( Name ) ; Reference< XNameAccess > xNameAccess; aLibAny >>= xNameAccess; SfxLibrary* pImplLib = static_cast< SfxLibrary* >( xNameAccess.get() ); @@ -2303,7 +2303,7 @@ void SAL_CALL SfxLibraryContainer::removeLibrary( const OUString& Name ) throw IllegalArgumentException(); } // Remove from container - maNameContainer.removeByName( Name ); + maNameContainer->removeByName( Name ); maModifiable.setModified( true ); // Delete library files, but not for linked libraries @@ -2374,7 +2374,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name ) throw(NoSuchElementException, WrappedTargetException, RuntimeException, std::exception) { LibraryContainerMethodGuard aGuard( *this ); - Any aLibAny = maNameContainer.getByName( Name ) ; + Any aLibAny = maNameContainer->getByName( Name ) ; Reference< XNameAccess > xNameAccess; aLibAny >>= xNameAccess; SfxLibrary* pImplLib = static_cast< SfxLibrary* >( xNameAccess.get() ); @@ -2501,12 +2501,12 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name ) { if( aAny.hasValue() ) { - pImplLib->maNameContainer.replaceByName( aElementName, aAny ); + pImplLib->maNameContainer->replaceByName( aElementName, aAny ); } } else { - pImplLib->maNameContainer.insertNoCheck(aElementName, aAny); + pImplLib->maNameContainer->insertNoCheck(aElementName, aAny); } } pImplLib->implSetModified( false ); @@ -2574,12 +2574,12 @@ void SAL_CALL SfxLibraryContainer::renameLibrary( const OUString& Name, const OU throw (NoSuchElementException, ElementExistException, RuntimeException, std::exception) { LibraryContainerMethodGuard aGuard( *this ); - if( maNameContainer.hasByName( NewName ) ) + if( maNameContainer->hasByName( NewName ) ) { throw ElementExistException(); } // Get and hold library before removing - Any aLibAny = maNameContainer.getByName( Name ) ; + Any aLibAny = maNameContainer->getByName( Name ) ; // #i24094 Maybe lib is not loaded! Reference< XNameAccess > xNameAccess; @@ -2592,7 +2592,7 @@ void SAL_CALL SfxLibraryContainer::renameLibrary( const OUString& Name, const OU loadLibrary( Name ); // Remove from container - maNameContainer.removeByName( Name ); + maNameContainer->removeByName( Name ); maModifiable.setModified( true ); // Rename library folder, but not for linked libraries @@ -2686,7 +2686,7 @@ void SAL_CALL SfxLibraryContainer::renameLibrary( const OUString& Name, const OU catch(const Exception& ) { // Restore old library - maNameContainer.insertByName( Name, aLibAny ) ; + maNameContainer->insertByName( Name, aLibAny ) ; } } @@ -2696,7 +2696,7 @@ void SAL_CALL SfxLibraryContainer::renameLibrary( const OUString& Name, const OU } if( bMovedSuccessful ) { - maNameContainer.insertByName( NewName, aLibAny ) ; + maNameContainer->insertByName( NewName, aLibAny ) ; } } @@ -2816,15 +2816,15 @@ void SAL_CALL SfxLibraryContainer::addContainerListener( const Reference< XConta throw (RuntimeException, std::exception) { LibraryContainerMethodGuard aGuard( *this ); - maNameContainer.setEventSource( static_cast< XInterface* >( static_cast(this) ) ); - maNameContainer.addContainerListener( xListener ); + maNameContainer->setEventSource( static_cast< XInterface* >( static_cast(this) ) ); + maNameContainer->addContainerListener( xListener ); } void SAL_CALL SfxLibraryContainer::removeContainerListener( const Reference< XContainerListener >& xListener ) throw (RuntimeException, std::exception) { LibraryContainerMethodGuard aGuard( *this ); - maNameContainer.removeContainerListener( xListener ); + maNameContainer->removeContainerListener( xListener ); } // Methods XLibraryContainerExport @@ -3008,7 +3008,7 @@ SfxLibrary::SfxLibrary( ModifiableHelper& _rModifiable, const Type& aType, , mxContext( xContext ) , mxSFI( xSFI ) , mrModifiable( _rModifiable ) - , maNameContainer( aType ) + , maNameContainer( new NameContainer(aType) ) , mbLoaded( true ) , mbIsModified( true ) , mbInitialised( false ) @@ -3031,7 +3031,7 @@ SfxLibrary::SfxLibrary( ModifiableHelper& _rModifiable, const Type& aType, , mxContext( xContext ) , mxSFI( xSFI ) , mrModifiable( _rModifiable ) - , maNameContainer( aType ) + , maNameContainer( new NameContainer(aType) ) , mbLoaded( false ) , mbIsModified( true ) , mbInitialised( false ) @@ -3092,13 +3092,13 @@ Any SAL_CALL SfxLibrary::queryInterface( const Type& rType ) Type SfxLibrary::getElementType() throw(RuntimeException, std::exception) { - return maNameContainer.getElementType(); + return maNameContainer->getElementType(); } sal_Bool SfxLibrary::hasElements() throw(RuntimeException, std::exception) { - bool bRet = maNameContainer.hasElements(); + bool bRet = maNameContainer->hasElements(); return bRet; } @@ -3108,20 +3108,20 @@ Any SfxLibrary::getByName( const OUString& aName ) { impl_checkLoaded(); - Any aRetAny = maNameContainer.getByName( aName ) ; + Any aRetAny = maNameContainer->getByName( aName ) ; return aRetAny; } Sequence< OUString > SfxLibrary::getElementNames() throw(RuntimeException, std::exception) { - return maNameContainer.getElementNames(); + return maNameContainer->getElementNames(); } sal_Bool SfxLibrary::hasByName( const OUString& aName ) throw(RuntimeException, std::exception) { - bool bRet = maNameContainer.hasByName( aName ); + bool bRet = maNameContainer->hasByName( aName ); return bRet; } @@ -3163,7 +3163,7 @@ void SfxLibrary::replaceByName( const OUString& aName, const Any& aElement ) !isLibraryElementValid(aElement), "basic", "SfxLibrary::replaceByName: replacing element is invalid!"); - maNameContainer.replaceByName( aName, aElement ); + maNameContainer->replaceByName( aName, aElement ); implSetModified( true ); } @@ -3179,13 +3179,13 @@ void SfxLibrary::insertByName( const OUString& aName, const Any& aElement ) !isLibraryElementValid(aElement), "basic", "SfxLibrary::insertByName: to-be-inserted element is invalid!"); - maNameContainer.insertByName( aName, aElement ); + maNameContainer->insertByName( aName, aElement ); implSetModified( true ); } void SfxLibrary::impl_removeWithoutChecks( const OUString& _rElementName ) { - maNameContainer.removeByName( _rElementName ); + maNameContainer->removeByName( _rElementName ); implSetModified( true ); // Remove element file @@ -3254,28 +3254,28 @@ Sequence< sal_Int8 > SfxLibrary::getImplementationId() void SAL_CALL SfxLibrary::addContainerListener( const Reference< XContainerListener >& xListener ) throw (RuntimeException, std::exception) { - maNameContainer.setEventSource( static_cast< XInterface* >( static_cast(this) ) ); - maNameContainer.addContainerListener( xListener ); + maNameContainer->setEventSource( static_cast< XInterface* >( static_cast(this) ) ); + maNameContainer->addContainerListener( xListener ); } void SAL_CALL SfxLibrary::removeContainerListener( const Reference< XContainerListener >& xListener ) throw (RuntimeException, std::exception) { - maNameContainer.removeContainerListener( xListener ); + maNameContainer->removeContainerListener( xListener ); } // Methods XChangesNotifier void SAL_CALL SfxLibrary::addChangesListener( const Reference< XChangesListener >& xListener ) throw (RuntimeException, std::exception) { - maNameContainer.setEventSource( static_cast< XInterface* >( static_cast(this) ) ); - maNameContainer.addChangesListener( xListener ); + maNameContainer->setEventSource( static_cast< XInterface* >( static_cast(this) ) ); + maNameContainer->addChangesListener( xListener ); } void SAL_CALL SfxLibrary::removeChangesListener( const Reference< XChangesListener >& xListener ) throw (RuntimeException, std::exception) { - maNameContainer.removeChangesListener( xListener ); + maNameContainer->removeChangesListener( xListener ); } diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index 7b3ab75c72fa..c7df851a09e3 100644 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -999,12 +999,12 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary { if( aAny.hasValue() ) { - pLib->maNameContainer.replaceByName( aElementName, aAny ); + pLib->maNameContainer->replaceByName( aElementName, aAny ); } } else { - pLib->maNameContainer.insertByName( aElementName, aAny ); + pLib->maNameContainer->insertByName( aElementName, aAny ); } } } @@ -1113,12 +1113,12 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary { if( aAny.hasValue() ) { - pLib->maNameContainer.replaceByName( aElementName, aAny ); + pLib->maNameContainer->replaceByName( aElementName, aAny ); } } else { - pLib->maNameContainer.insertByName( aElementName, aAny ); + pLib->maNameContainer->insertByName( aElementName, aAny ); } } } diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx new file mode 100644 index 000000000000..0ecdf8e8037f --- /dev/null +++ b/compilerplugins/clang/refcounting.cxx @@ -0,0 +1,249 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 +#include + +#include "plugin.hxx" +#include "compat.hxx" +#include "clang/AST/CXXInheritance.h" + +/** + +If you have: + + class Foo : public css::foo::XBaa { + }; + +Then XBaa has acquire and release methods inherited from XInterface. +These are hard lifecycle controls. + +If you see another class: + + class Baz { + Foo aFooMember; + }; + +this is a bug =) since aFooMember assumes heap allocated lifecycle and +not delete on last 'release'. + +TODO check that things that extend SvRefBase are managed by SvRef +TODO fix the SvXMLImportContext class (mentioned below) +TODO fix the slideshow::internal::SlideView class (mentioned below) +*/ + +namespace { + +class RefCounting: + public RecursiveASTVisitor, public loplugin::Plugin +{ +public: + explicit RefCounting(InstantiationData const & data): Plugin(data) {} + + virtual void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); } + + bool VisitFieldDecl(const FieldDecl *); + bool VisitVarDecl(const VarDecl *); +}; + +bool BaseCheckNotSubclass(const CXXRecordDecl *BaseDefinition, void *p) { + if (!BaseDefinition) + return true; + const char *pString = static_cast(p); + if (BaseDefinition->getQualifiedNameAsString() == pString) { + return false; + } + return true; +} + +bool isDerivedFrom(const CXXRecordDecl *decl, const char *pString) { + if (!decl) + return false; + if (decl->getQualifiedNameAsString() == pString) + return true; + if (!decl->hasDefinition()) { + return false; + } + if (// not sure what hasAnyDependentBases() does, + // but it avoids classes we don't want, e.g. WeakAggComponentImplHelper1 + !decl->hasAnyDependentBases() && + !decl->forallBases(BaseCheckNotSubclass, static_cast(const_cast(pString)), true)) { + return true; + } + return false; +} + + +bool containsXInterfaceSubclass(const Type* pType0); + +bool containsXInterfaceSubclass(const QualType& qType) { + return containsXInterfaceSubclass(qType.getTypePtr()); +} + +static std::vector PROBABLY_GOOD_TEMPLATES = { + "(anonymous namespace)::FindUnoInstanceHint", + "abp::OMultiInstanceAutoRegistration", + "com::sun::star::uno::Reference", + "com::sun::star::uno::WeakReference", + "com::sun::star::uno::Sequence", + "accessibility::HardCppRef", + "accessibility::WeakCppRef", + "dba::OAutoRegistration", + "dba::OSingletonRegistration", + "dbp::OMultiInstanceAutoRegistration", + "dbaui::OMultiInstanceAutoRegistration", + "dbaxml::OMultiInstanceAutoRegistration", + "io_acceptor::ReferenceEqual", + "io_acceptor::ReferenceHash", + "comphelper::OAutoRegistration", + "comphelper::OInterfaceCompare", + "comphelper::module::OSingletonRegistration", + "comphelper::WeakBag", + "comphelper::service_decl::class_", + "comphelper::service_decl::vba_service_class_", + "comphelper::service_decl::inheritingClass_", + "comphelper::module::OAutoRegistration", + "comphelper::mem_fun1_t", + "comphelper::OSimpleListenerContainer", + "dbmm::OAutoRegistration", + "pcr::OAutoRegistration", + "logging::ComponentMethodGuard", + "logging::OSingletonRegistration", + "logging::OAutoRegistration", + "rtl::Reference", + "sdbtools::OAutoRegistration", + "stoc_connector::ReferenceEqual", + "stoc_connector::ReferenceHash", + "std::mem_fun_t", + "std::mem_fun1_t", + "SwIterator", + "toolkit::InitGuard", + "utl::SharedUNOComponent", + "utl::OAutoRegistration", + "vcl::DeleteUnoReferenceOnDeinit", + "xmloff::OInterfaceCompare", +}; + +bool containsXInterfaceSubclass(const Type* pType0) { + if (!pType0) + return false; + const Type* pType = pType0->getUnqualifiedDesugaredType(); + if (!pType) + return false; + const CXXRecordDecl* pRecordDecl = pType->getAsCXXRecordDecl(); + if (pRecordDecl) { + pRecordDecl = pRecordDecl->getCanonicalDecl(); + // these classes override acquire/release and forwards to it's parent + if (isDerivedFrom(pRecordDecl, "ListenerMultiplexerBase")) { // module UnoTools + return false; + } + if (isDerivedFrom(pRecordDecl, "toolkit::GridEventForwarder")) { // module toolkit + return false; + } + if (isDerivedFrom(pRecordDecl, "OWeakSubObject")) { // module svx + return false; + } + if (isDerivedFrom(pRecordDecl, "dbaui::OSbaWeakSubObject")) { // module dbaccess + return false; + } + // FIXME this class extends 2 different ref-counting bases, SvRefBase and XInterface (via. cppu::WeakImplHelper) + // I have no idea how to fix it + if (isDerivedFrom(pRecordDecl, "SvXMLImportContext")) { // module xmloff + return false; + } + // The actual problem child is SlideView, of which this is the parent. + // Everything in the hierarchy above this wants to be managed via boost::shared_ptr + if (isDerivedFrom(pRecordDecl, "slideshow::internal::UnoView")) { // module slideshow + return false; + } + // FIXME This class has private operator new, and I cannot figure out how it can be dynamically instantiated + if (isDerivedFrom(pRecordDecl, "XPropertyList")) { // module svx + return false; + } + } + if (pRecordDecl) { + const ClassTemplateSpecializationDecl* pTemplate = dyn_cast(pRecordDecl); + if (pTemplate) { + std::string aName = pTemplate->getQualifiedNameAsString(); + if (std::find(PROBABLY_GOOD_TEMPLATES.begin(), PROBABLY_GOOD_TEMPLATES.end(), aName) != PROBABLY_GOOD_TEMPLATES.end()) + return false; + for(unsigned i=0; igetTemplateArgs().size(); ++i) { + const TemplateArgument& rArg = pTemplate->getTemplateArgs()[i]; + if (rArg.getKind() == TemplateArgument::ArgKind::Type && + containsXInterfaceSubclass(rArg.getAsType())) + { + return true; + } + } + } + } + if (pType->isPointerType()) { + // ignore + return false; + } else if (pType->isArrayType()) { + const ArrayType* pArrayType = dyn_cast(pType); + QualType elementType = pArrayType->getElementType(); + return containsXInterfaceSubclass(elementType); + } else { + return isDerivedFrom(pRecordDecl, "com::sun::star::uno::XInterface"); + } +} + + + +bool RefCounting::VisitFieldDecl(const FieldDecl * fieldDecl) { + if (ignoreLocation(fieldDecl)) { + return true; + } + if (fieldDecl->isBitField()) { + return true; + } + std::string aParentName = fieldDecl->getParent()->getQualifiedNameAsString(); + if ( aParentName == "com::sun::star::uno::BaseReference" + || aParentName == "cppu::detail::element_alias" + // this is playing some kind of game to avoid circular references + || aParentName == "ucbhelper::ResultSetDataSupplier") + { + return true; + } + + if (containsXInterfaceSubclass(fieldDecl->getType())) { + report( + DiagnosticsEngine::Warning, + "XInterface subclass being directly heap managed, should be managed via uno::Reference, " + + fieldDecl->getType().getAsString() + + ", parent is " + aParentName, + fieldDecl->getLocation()) + << fieldDecl->getSourceRange(); + return true; + } + return true; +} + + +bool RefCounting::VisitVarDecl(const VarDecl * varDecl) { + if (ignoreLocation(varDecl)) { + return true; + } + if (containsXInterfaceSubclass(varDecl->getType())) { + report( + DiagnosticsEngine::Warning, + "XInterface subclass being directly stack managed, should be managed via uno::Reference, " + + varDecl->getType().getAsString(), + varDecl->getLocation()) + << varDecl->getSourceRange(); + } + return true; +} + +loplugin::Plugin::Registration< RefCounting > X("refcounting"); + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/dataaccess/ComponentDefinition.cxx b/dbaccess/source/core/dataaccess/ComponentDefinition.cxx index 7708a6a1ca0f..ae89078aa20a 100644 --- a/dbaccess/source/core/dataaccess/ComponentDefinition.cxx +++ b/dbaccess/source/core/dataaccess/ComponentDefinition.cxx @@ -191,8 +191,9 @@ Reference< XInterface > OComponentDefinition::Create( const Reference< XComponen void SAL_CALL OComponentDefinition::disposing() { OContentHelper::disposing(); - if ( m_pColumns.get() ) - m_pColumns->disposing(); + if ( m_xColumns.is() ) + m_xColumns->disposing(); + m_xColumns.clear(); m_xColumnPropertyListener->clear(); m_xColumnPropertyListener.clear(); } @@ -227,7 +228,7 @@ Reference< XNameAccess> OComponentDefinition::getColumns() throw (RuntimeExcepti ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(OContentHelper::rBHelper.bDisposed); - if ( !m_pColumns.get() ) + if ( !m_xColumns.is() ) { ::std::vector< OUString> aNames; @@ -239,10 +240,10 @@ Reference< XNameAccess> OComponentDefinition::getColumns() throw (RuntimeExcepti for ( ; aIter != aEnd; ++aIter ) aNames.push_back( aIter->first ); - m_pColumns.reset( new OColumns( *this, m_aMutex, true, aNames, this, NULL, true, false, false ) ); - m_pColumns->setParent( *this ); + m_xColumns = new OColumns( *this, m_aMutex, true, aNames, this, NULL, true, false, false ); + m_xColumns->setParent( *this ); } - return m_pColumns.get(); + return m_xColumns.get(); } OColumn* OComponentDefinition::createColumn(const OUString& _rName) const diff --git a/dbaccess/source/core/dataaccess/ComponentDefinition.hxx b/dbaccess/source/core/dataaccess/ComponentDefinition.hxx index ad177f52a067..b561874992c4 100644 --- a/dbaccess/source/core/dataaccess/ComponentDefinition.hxx +++ b/dbaccess/source/core/dataaccess/ComponentDefinition.hxx @@ -88,7 +88,7 @@ class OComponentDefinition :public OContentHelper OComponentDefinition(); protected: - ::std::unique_ptr< OColumns > m_pColumns; + css::uno::Reference< OColumns > m_xColumns; rtl::Reference m_xColumnPropertyListener; bool m_bTable; diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index 5568cb87bbad..1f80f08bf4fa 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -491,7 +491,7 @@ ODatabaseSource::ODatabaseSource(const ::rtl::Reference& _pI :ModelDependentComponent( _pImpl ) ,ODatabaseSource_Base( getMutex() ) ,OPropertySetHelper( ODatabaseSource_Base::rBHelper ) - ,m_aBookmarks( *this, getMutex() ) + ,m_xBookmarks( new OBookmarkContainer( *this, getMutex() ) ) ,m_aFlushListeners( getMutex() ) { // some kind of default @@ -1200,7 +1200,7 @@ Reference< XConnection > ODatabaseSource::getConnection(const OUString& user, co Reference< XNameAccess > SAL_CALL ODatabaseSource::getBookmarks( ) throw (RuntimeException, std::exception) { ModelMethodGuard aGuard( *this ); - return static_cast< XNameContainer* >(&m_aBookmarks); + return static_cast< XNameContainer* >(m_xBookmarks.get()); } Reference< XNameAccess > SAL_CALL ODatabaseSource::getQueryDefinitions( ) throw(RuntimeException, std::exception) diff --git a/dbaccess/source/core/dataaccess/datasource.hxx b/dbaccess/source/core/dataaccess/datasource.hxx index 8e53e9facd73..1aef2a7dad26 100644 --- a/dbaccess/source/core/dataaccess/datasource.hxx +++ b/dbaccess/source/core/dataaccess/datasource.hxx @@ -82,7 +82,7 @@ class ODatabaseSource :public ModelDependentComponent // must be first private: using ODatabaseSource_Base::rBHelper; - OBookmarkContainer m_aBookmarks; + css::uno::Reference m_xBookmarks; ::cppu::OInterfaceContainerHelper m_aFlushListeners; private: diff --git a/dbaccess/source/ui/misc/singledoccontroller.cxx b/dbaccess/source/ui/misc/singledoccontroller.cxx index 77408cdaf51a..ed6180b2937f 100644 --- a/dbaccess/source/ui/misc/singledoccontroller.cxx +++ b/dbaccess/source/ui/misc/singledoccontroller.cxx @@ -54,10 +54,10 @@ namespace dbaui // OSingleDocumentController_Data struct OSingleDocumentController_Data { - ::boost::scoped_ptr< UndoManager > m_pUndoManager; + Reference< UndoManager > m_xUndoManager; OSingleDocumentController_Data( ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex ) - :m_pUndoManager( new UndoManager( i_parent, i_mutex ) ) + :m_xUndoManager( new UndoManager( i_parent, i_mutex ) ) { } }; @@ -77,7 +77,7 @@ namespace dbaui { OSingleDocumentController_Base::disposing(); ClearUndoManager(); - m_pData->m_pUndoManager->disposing(); + m_pData->m_xUndoManager->disposing(); } void SAL_CALL OSingleDocumentController::disposing( const EventObject& i_event ) throw( RuntimeException, std::exception ) @@ -93,7 +93,7 @@ namespace dbaui SfxUndoManager& OSingleDocumentController::GetUndoManager() const { - return m_pData->m_pUndoManager->GetSfxUndoManager(); + return m_pData->m_xUndoManager->GetSfxUndoManager(); } void OSingleDocumentController::addUndoActionAndInvalidate(SfxUndoAction *_pAction) @@ -111,7 +111,7 @@ namespace dbaui Reference< XUndoManager > SAL_CALL OSingleDocumentController::getUndoManager( ) throw (RuntimeException, std::exception) { - return m_pData->m_pUndoManager.get(); + return m_pData->m_xUndoManager.get(); } FeatureState OSingleDocumentController::GetState(sal_uInt16 _nId) const diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 651e4068fd96..e6a12cda3399 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -1165,11 +1165,11 @@ namespace drawinglayer // per polygon. If there are more, split the polygon in half and call recursively basegfx::B2DPolygon aLeft, aRight; splitLinePolygon(rBasePolygon, aLeft, aRight); - const primitive2d::PolygonHairlinePrimitive2D aPLeft(aLeft, rHairlinePrimitive.getBColor()); - const primitive2d::PolygonHairlinePrimitive2D aPRight(aRight, rHairlinePrimitive.getBColor()); + uno::Reference< primitive2d::PolygonHairlinePrimitive2D > xPLeft(new primitive2d::PolygonHairlinePrimitive2D(aLeft, rHairlinePrimitive.getBColor())); + uno::Reference< primitive2d::PolygonHairlinePrimitive2D > xPRight(new primitive2d::PolygonHairlinePrimitive2D(aRight, rHairlinePrimitive.getBColor())); - processBasePrimitive2D(aPLeft); - processBasePrimitive2D(aPRight); + processBasePrimitive2D(*xPLeft.get()); + processBasePrimitive2D(*xPRight.get()); } else { @@ -1213,13 +1213,13 @@ namespace drawinglayer // per polygon. If there are more, split the polygon in half and call recursively basegfx::B2DPolygon aLeft, aRight; splitLinePolygon(rBasePolygon, aLeft, aRight); - const primitive2d::PolygonStrokePrimitive2D aPLeft( - aLeft, rStrokePrimitive.getLineAttribute(), rStrokePrimitive.getStrokeAttribute()); - const primitive2d::PolygonStrokePrimitive2D aPRight( - aRight, rStrokePrimitive.getLineAttribute(), rStrokePrimitive.getStrokeAttribute()); + uno::Reference< primitive2d::PolygonStrokePrimitive2D > xPLeft(new primitive2d::PolygonStrokePrimitive2D( + aLeft, rStrokePrimitive.getLineAttribute(), rStrokePrimitive.getStrokeAttribute())); + uno::Reference< primitive2d::PolygonStrokePrimitive2D > xPRight(new primitive2d::PolygonStrokePrimitive2D( + aRight, rStrokePrimitive.getLineAttribute(), rStrokePrimitive.getStrokeAttribute())); - processBasePrimitive2D(aPLeft); - processBasePrimitive2D(aPRight); + processBasePrimitive2D(*xPLeft.get()); + processBasePrimitive2D(*xPRight.get()); } else { @@ -1294,21 +1294,21 @@ namespace drawinglayer basegfx::B2DPolygon aLeft, aRight; splitLinePolygon(rBasePolygon, aLeft, aRight); const attribute::LineStartEndAttribute aEmpty; - const primitive2d::PolygonStrokeArrowPrimitive2D aPLeft( + uno::Reference< primitive2d::PolygonStrokeArrowPrimitive2D > xPLeft(new primitive2d::PolygonStrokeArrowPrimitive2D( aLeft, rStrokeArrowPrimitive.getLineAttribute(), rStrokeArrowPrimitive.getStrokeAttribute(), rStrokeArrowPrimitive.getStart(), - aEmpty); - const primitive2d::PolygonStrokeArrowPrimitive2D aPRight( + aEmpty)); + uno::Reference< primitive2d::PolygonStrokeArrowPrimitive2D > xPRight(new primitive2d::PolygonStrokeArrowPrimitive2D( aRight, rStrokeArrowPrimitive.getLineAttribute(), rStrokeArrowPrimitive.getStrokeAttribute(), aEmpty, - rStrokeArrowPrimitive.getEnd()); + rStrokeArrowPrimitive.getEnd())); - processBasePrimitive2D(aPLeft); - processBasePrimitive2D(aPRight); + processBasePrimitive2D(*xPLeft.get()); + processBasePrimitive2D(*xPRight.get()); } else { @@ -1372,11 +1372,11 @@ namespace drawinglayer { // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points // per polygon. If there are more use the splitted polygon and call recursively - const primitive2d::PolyPolygonGraphicPrimitive2D aSplitted( + uno::Reference< primitive2d::PolyPolygonGraphicPrimitive2D > xSplitted(new primitive2d::PolyPolygonGraphicPrimitive2D( aLocalPolyPolygon, - rBitmapCandidate.getFillGraphic()); + rBitmapCandidate.getFillGraphic())); - processBasePrimitive2D(aSplitted); + processBasePrimitive2D(*xSplitted.get()); } else { diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx index efb82d83ad4e..8d5fcf7056c9 100644 --- a/editeng/qa/unit/core-test.cxx +++ b/editeng/qa/unit/core-test.cxx @@ -110,112 +110,112 @@ void Test::testUnoTextFields() { { // DATE - SvxUnoTextField aField(text::textfield::Type::DATE); - uno::Sequence aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::DATE)); + uno::Sequence aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.DateTime"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // URL - SvxUnoTextField aField(text::textfield::Type::URL); - uno::Sequence aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::URL)); + uno::Sequence aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.URL"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // PAGE - SvxUnoTextField aField(text::textfield::Type::PAGE); - uno::Sequence aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::PAGE)); + uno::Sequence aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.PageNumber"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // PAGES - SvxUnoTextField aField(text::textfield::Type::PAGES); - uno::Sequence aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::PAGES)); + uno::Sequence aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.PageCount"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // TIME - SvxUnoTextField aField(text::textfield::Type::TIME); - uno::Sequence aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::TIME)); + uno::Sequence aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.DateTime"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // FILE - SvxUnoTextField aField(text::textfield::Type::DOCINFO_TITLE); - uno::Sequence aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::DOCINFO_TITLE)); + uno::Sequence aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.docinfo.Title"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // TABLE - SvxUnoTextField aField(text::textfield::Type::TABLE); - uno::Sequence aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::TABLE)); + uno::Sequence aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.SheetName"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // EXTENDED TIME - SvxUnoTextField aField(text::textfield::Type::EXTENDED_TIME); - uno::Sequence aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::EXTENDED_TIME)); + uno::Sequence aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.DateTime"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // EXTENDED FILE - SvxUnoTextField aField(text::textfield::Type::EXTENDED_FILE); - uno::Sequence aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::EXTENDED_FILE)); + uno::Sequence aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.FileName"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // AUTHOR - SvxUnoTextField aField(text::textfield::Type::AUTHOR); - uno::Sequence aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::AUTHOR)); + uno::Sequence aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.Author"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // MEASURE - SvxUnoTextField aField(text::textfield::Type::MEASURE); - uno::Sequence aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::MEASURE)); + uno::Sequence aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.text.textfield.Measure"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // PRESENTATION HEADER - SvxUnoTextField aField(text::textfield::Type::PRESENTATION_HEADER); - uno::Sequence aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::PRESENTATION_HEADER)); + uno::Sequence aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.presentation.textfield.Header"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // PRESENTATION FOOTER - SvxUnoTextField aField(text::textfield::Type::PRESENTATION_FOOTER); - uno::Sequence aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::PRESENTATION_FOOTER)); + uno::Sequence aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.presentation.textfield.Footer"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } { // PRESENTATION DATE TIME - SvxUnoTextField aField(text::textfield::Type::PRESENTATION_DATE_TIME); - uno::Sequence aSvcs = aField.getSupportedServiceNames(); + uno::Reference xField(new SvxUnoTextField(text::textfield::Type::PRESENTATION_DATE_TIME)); + uno::Sequence aSvcs = xField->getSupportedServiceNames(); bool bGood = includes(aSvcs, "com.sun.star.presentation.textfield.DateTime"); CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood); } diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index 8ce55d8010a6..87886f4d7e77 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -1612,11 +1612,11 @@ namespace accessibility // SvxAccessibleTextPropertySet aPropSet( &GetEditSource(), // ImplGetSvxCharAndParaPropertiesMap() ); // MT IA2 TODO: Check if this is the correct replacement for ImplGetSvxCharAndParaPropertiesMap - SvxAccessibleTextPropertySet aPropSet( &GetEditSource(), ImplGetSvxTextPortionSvxPropertySet() ); + uno::Reference< SvxAccessibleTextPropertySet > xPropSet( new SvxAccessibleTextPropertySet( &GetEditSource(), ImplGetSvxTextPortionSvxPropertySet() ) ); - aPropSet.SetSelection( MakeSelection( 0, GetTextLen() ) ); - rRes.Value = aPropSet._getPropertyValue( rRes.Name, mnParagraphIndex ); - rRes.State = aPropSet._getPropertyState( rRes.Name, mnParagraphIndex ); + xPropSet->SetSelection( MakeSelection( 0, GetTextLen() ) ); + rRes.Value = xPropSet->_getPropertyValue( rRes.Name, mnParagraphIndex ); + rRes.State = xPropSet->_getPropertyState( rRes.Name, mnParagraphIndex ); rRes.Handle = -1; } continue; @@ -1635,10 +1635,10 @@ namespace accessibility else { // MT IA2 TODO: Check if this is the correct replacement for ImplGetSvxCharAndParaPropertiesMap - SvxAccessibleTextPropertySet aPropSet( &GetEditSource(), ImplGetSvxTextPortionSvxPropertySet() ); - aPropSet.SetSelection( MakeSelection( 0, GetTextLen() ) ); - rRes.Value = aPropSet._getPropertyValue( rRes.Name, mnParagraphIndex ); - rRes.State = aPropSet._getPropertyState( rRes.Name, mnParagraphIndex ); + uno::Reference< SvxAccessibleTextPropertySet > xPropSet( new SvxAccessibleTextPropertySet( &GetEditSource(), ImplGetSvxTextPortionSvxPropertySet() ) ); + xPropSet->SetSelection( MakeSelection( 0, GetTextLen() ) ); + rRes.Value = xPropSet->_getPropertyValue( rRes.Name, mnParagraphIndex ); + rRes.State = xPropSet->_getPropertyState( rRes.Name, mnParagraphIndex ); rRes.Handle = -1; } continue; @@ -2416,13 +2416,13 @@ namespace accessibility // do the indices span the whole paragraph? Then use the outliner map // TODO: hold it as a member? - SvxAccessibleTextPropertySet aPropSet( &GetEditSource(), + uno::Reference< SvxAccessibleTextPropertySet > xPropSet( new SvxAccessibleTextPropertySet( &GetEditSource(), 0 == nStartIndex && rCacheTF.GetTextLen(nPara) == nEndIndex ? ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() : - ImplGetSvxTextPortionSvxPropertySet() ); + ImplGetSvxTextPortionSvxPropertySet() ) ); - aPropSet.SetSelection( MakeSelection(nStartIndex, nEndIndex) ); + xPropSet->SetSelection( MakeSelection(nStartIndex, nEndIndex) ); // convert from PropertyValue to Any sal_Int32 i, nLength( aAttributeSet.getLength() ); @@ -2431,7 +2431,7 @@ namespace accessibility { try { - aPropSet.setPropertyValue(pPropArray->Name, pPropArray->Value); + xPropSet->setPropertyValue(pPropArray->Name, pPropArray->Value); } catch (const uno::Exception&) { @@ -2481,10 +2481,10 @@ namespace accessibility // get XPropertySetInfo for paragraph attributes and // character attributes that span all the paragraphs text. - SvxAccessibleTextPropertySet aPropSet( &GetEditSource(), - ImplGetSvxCharAndParaPropertiesSet() ); - aPropSet.SetSelection( MakeSelection( 0, GetTextLen() ) ); - uno::Reference< beans::XPropertySetInfo > xPropSetInfo = aPropSet.getPropertySetInfo(); + uno::Reference< SvxAccessibleTextPropertySet > xPropSet( new SvxAccessibleTextPropertySet( &GetEditSource(), + ImplGetSvxCharAndParaPropertiesSet() ) ); + xPropSet->SetSelection( MakeSelection( 0, GetTextLen() ) ); + uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); if (!xPropSetInfo.is()) throw uno::RuntimeException("Cannot query XPropertySetInfo", uno::Reference< uno::XInterface > @@ -2530,7 +2530,7 @@ namespace accessibility // calling implementation functions: // _getPropertyState and _getPropertyValue (see below) to provide // the proper paragraph number when retrieving paragraph attributes - PropertyState eState = aPropSet._getPropertyState( pProperties->Name, mnParagraphIndex ); + PropertyState eState = xPropSet->_getPropertyState( pProperties->Name, mnParagraphIndex ); if ( eState == PropertyState_AMBIGUOUS_VALUE ) { OSL_FAIL( "ambiguous property value encountered" ); @@ -2543,7 +2543,7 @@ namespace accessibility { pOutSequence->Name = pProperties->Name; pOutSequence->Handle = pProperties->Handle; - pOutSequence->Value = aPropSet._getPropertyValue( pProperties->Name, mnParagraphIndex ); + pOutSequence->Value = xPropSet->_getPropertyValue( pProperties->Name, mnParagraphIndex ); pOutSequence->State = PropertyState_DEFAULT_VALUE; ++pOutSequence; @@ -2583,10 +2583,10 @@ namespace accessibility else CheckPosition(nIndex); - SvxAccessibleTextPropertySet aPropSet( &GetEditSource(), - ImplGetSvxCharAndParaPropertiesSet() ); - aPropSet.SetSelection( MakeSelection( nIndex ) ); - uno::Reference< beans::XPropertySetInfo > xPropSetInfo = aPropSet.getPropertySetInfo(); + uno::Reference< SvxAccessibleTextPropertySet > xPropSet( new SvxAccessibleTextPropertySet( &GetEditSource(), + ImplGetSvxCharAndParaPropertiesSet() ) ); + xPropSet->SetSelection( MakeSelection( nIndex ) ); + uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); if (!xPropSetInfo.is()) throw uno::RuntimeException("Cannot query XPropertySetInfo", uno::Reference< uno::XInterface > @@ -2630,12 +2630,12 @@ namespace accessibility for (sal_Int32 i = 0; i < nLength; ++i) { // calling 'regular' functions that will operate on the selection - PropertyState eState = aPropSet.getPropertyState( pProperties->Name ); + PropertyState eState = xPropSet->getPropertyState( pProperties->Name ); if (eState == PropertyState_DIRECT_VALUE) { pOutSequence->Name = pProperties->Name; pOutSequence->Handle = pProperties->Handle; - pOutSequence->Value = aPropSet.getPropertyValue( pProperties->Name ); + pOutSequence->Value = xPropSet->getPropertyValue( pProperties->Name ); pOutSequence->State = eState; ++pOutSequence; diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index cfeea481d447..3007ba034ee0 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -2091,9 +2091,9 @@ void SvxAutoCorrectLanguageLists::SaveExceptList_Imp( xWriter->setOutputStream(xOut); uno::Reference < xml::sax::XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW); - SvXMLExceptionListExport aExp( xContext, rLst, sStrmName, xHandler ); + uno::Reference< SvXMLExceptionListExport > xExp( new SvXMLExceptionListExport( xContext, rLst, sStrmName, xHandler ) ); - aExp.exportDoc( XML_BLOCK_LIST ); + xExp->exportDoc( XML_BLOCK_LIST ); xStrm->Commit(); if( xStrm->GetError() == SVSTREAM_OK ) @@ -2462,9 +2462,9 @@ bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SotStorage& rStg ) xWriter->setOutputStream(xOut); uno::Reference xHandler(xWriter, uno::UNO_QUERY); - SvXMLAutoCorrectExport aExp( xContext, pAutocorr_List, sStrmName, xHandler ); + uno::Reference< SvXMLAutoCorrectExport > xExp( new SvXMLAutoCorrectExport( xContext, pAutocorr_List, sStrmName, xHandler ) ); - aExp.exportDoc( XML_BLOCK_LIST ); + xExp->exportDoc( XML_BLOCK_LIST ); refList->Commit(); bRet = SVSTREAM_OK == refList->GetError(); diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx index 401472f27aff..5d575a1d7d60 100644 --- a/editeng/source/xml/xmltxtexp.cxx +++ b/editeng/source/xml/xmltxtexp.cxx @@ -429,9 +429,9 @@ void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& // SvxXMLTextExportComponent aExporter( &rEditEngine, rSel, aName, xHandler ); uno::Reference< xml::sax::XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW); - SvxXMLTextExportComponent aExporter( xContext, &rEditEngine, rSel, aName, xHandler ); + uno::Reference< SvxXMLTextExportComponent > xExporter( new SvxXMLTextExportComponent( xContext, &rEditEngine, rSel, aName, xHandler ) ); - aExporter.exportDoc(); + xExporter->exportDoc(); /* testcode aMedium.Commit(); diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx index 9078823b2b94..30b3778b3f9a 100644 --- a/extensions/source/scanner/sanedlg.cxx +++ b/extensions/source/scanner/sanedlg.cxx @@ -906,8 +906,8 @@ void SaneDlg::AcquirePreview() else mrSane.SetOptionValue( nOption, true ); - BitmapTransporter aTransporter; - if( ! mrSane.Start( aTransporter ) ) + Reference xTransporter(new BitmapTransporter); + if( ! mrSane.Start( *xTransporter.get() ) ) { ScopedVclPtrInstance< MessageDialog > aErrorBox(this, SaneResId(STR_ERROR_SCAN)); aErrorBox->Execute(); @@ -915,11 +915,11 @@ void SaneDlg::AcquirePreview() else { #if OSL_DEBUG_LEVEL > 1 - aTransporter.getStream().Seek( STREAM_SEEK_TO_END ); - fprintf( stderr, "Previewbitmapstream contains %d bytes\n", (int)aTransporter.getStream().Tell() ); + xTransporter->getStream().Seek( STREAM_SEEK_TO_END ); + fprintf( stderr, "Previewbitmapstream contains %d bytes\n", (int)xTransporter->getStream().Tell() ); #endif - aTransporter.getStream().Seek( STREAM_SEEK_TO_BEGIN ); - mpPreview->SetBitmap(aTransporter.getStream()); + xTransporter->getStream().Seek( STREAM_SEEK_TO_BEGIN ); + mpPreview->SetBitmap(xTransporter->getStream()); } SetAdjustedNumericalValue( "resolution", fResl ); diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index d637ccbaed3c..abd56349748e 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -3710,7 +3710,7 @@ void SAL_CALL SVGWriter::write( const Reference& rxDocHandler, ReadGDIMetaFile( aMemStm, aMtf ); const Reference< XDocumentHandler > xDocumentHandler( rxDocHandler ); - boost::scoped_ptr pWriter(new SVGExport( mxContext, xDocumentHandler, maFilterData )); + Reference pWriter(new SVGExport( mxContext, xDocumentHandler, maFilterData )); pWriter->writeMtf( aMtf ); } diff --git a/i18npool/inc/calendar_gregorian.hxx b/i18npool/inc/calendar_gregorian.hxx index f270779f7b87..a6b81c92431d 100644 --- a/i18npool/inc/calendar_gregorian.hxx +++ b/i18npool/inc/calendar_gregorian.hxx @@ -97,7 +97,7 @@ public: protected: const Era *eraArray; icu::Calendar *body; - NativeNumberSupplierService aNatNum; + css::uno::Reference mxNatNum; const sal_Char* cCalendar; com::sun::star::lang::Locale aLocale; sal_uInt32 fieldSet; diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx index 5b4a9b74b590..e455c53097b3 100644 --- a/i18npool/source/calendar/calendar_gregorian.cxx +++ b/i18npool/source/calendar/calendar_gregorian.cxx @@ -130,10 +130,12 @@ namespace com { namespace sun { namespace star { namespace i18n { #define ERROR RuntimeException() Calendar_gregorian::Calendar_gregorian() + : mxNatNum(new NativeNumberSupplierService) { init(NULL); } Calendar_gregorian::Calendar_gregorian(const Era *_earArray) + : mxNatNum(new NativeNumberSupplierService) { init(_earArray); } @@ -1180,7 +1182,7 @@ Calendar_gregorian::getDisplayStringImpl( sal_Int32 nCalendarDisplayCode, sal_In } sal_Int16 nNatNum = NatNumForCalendar(aLocale, nCalendarDisplayCode, nNativeNumberMode, value); if (nNatNum > 0) - return aNatNum.getNativeNumberString(aOUStr, aLocale, nNatNum); + return mxNatNum->getNativeNumberString(aOUStr, aLocale, nNatNum); } return aOUStr; } diff --git a/i18npool/source/calendar/calendar_jewish.cxx b/i18npool/source/calendar/calendar_jewish.cxx index 0dc82bd1ac56..1e399ebf5c05 100644 --- a/i18npool/source/calendar/calendar_jewish.cxx +++ b/i18npool/source/calendar/calendar_jewish.cxx @@ -287,7 +287,7 @@ Calendar_jewish::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNa if (nCalendarDisplayCode == CalendarDisplayCode::SHORT_YEAR) { sal_Int32 value = getValue(CalendarFieldIndex::YEAR) % 1000; // take last 3 digits - return aNatNum.getNativeNumberString(OUString::number(value), aLocale, nNativeNumberMode ); + return mxNatNum->getNativeNumberString(OUString::number(value), aLocale, nNativeNumberMode ); } else return Calendar_gregorian::getDisplayString(nCalendarDisplayCode, nNativeNumberMode ); diff --git a/i18npool/source/characterclassification/cclass_unicode.cxx b/i18npool/source/characterclassification/cclass_unicode.cxx index 495cd2139a79..86891ad38d3d 100644 --- a/i18npool/source/characterclassification/cclass_unicode.cxx +++ b/i18npool/source/characterclassification/cclass_unicode.cxx @@ -92,12 +92,12 @@ cclass_Unicode::toTitle( const OUString& Text, sal_Int32 nPos, sal_Int32 nCount, trans->setMappingType(MappingTypeToTitle, rLocale); rtl_uString* pStr = rtl_uString_alloc(nCount); sal_Unicode* out = pStr->buffer; - BreakIteratorImpl brk(m_xContext); - Boundary bdy = brk.getWordBoundary(Text, nPos, rLocale, + Reference< BreakIteratorImpl > xBrk(new BreakIteratorImpl(m_xContext)); + Boundary bdy = xBrk->getWordBoundary(Text, nPos, rLocale, WordType::ANYWORD_IGNOREWHITESPACES, sal_True); for (sal_Int32 i = nPos; i < nCount + nPos; i++, out++) { if (i >= bdy.endPos) - bdy = brk.nextWord(Text, bdy.endPos, rLocale, + bdy = xBrk->nextWord(Text, bdy.endPos, rLocale, WordType::ANYWORD_IGNOREWHITESPACES); *out = (i == bdy.startPos) ? trans->transliterateChar2Char(Text[i]) : Text[i]; diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index 5e4d58291438..a48f6e4655c9 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -858,8 +858,8 @@ DefaultNumberingProvider::makeNumberingString( const Sequence xNatNum(new NativeNumberSupplierService); + result += xNatNum->getNativeNumberString(OUString::number( number ), locale, natNum); } else if (tableSize) { if ( number > tableSize && !recycleSymbol) result += OUString::number( number); diff --git a/i18npool/source/indexentry/indexentrysupplier.cxx b/i18npool/source/indexentry/indexentrysupplier.cxx index fc109658fb40..96fef17c9f44 100644 --- a/i18npool/source/indexentry/indexentrysupplier.cxx +++ b/i18npool/source/indexentry/indexentrysupplier.cxx @@ -116,14 +116,14 @@ IndexEntrySupplier::getLocaleSpecificIndexEntrySupplier(const Locale& rLocale, c rLocale.Country == aLocale.Country && rLocale.Variant == aLocale.Variant) return xIES; else { - LocaleDataImpl ld; + uno::Reference ld(new LocaleDataImpl); aLocale = rLocale; if (rSortAlgorithm.isEmpty()) - aSortAlgorithm = ld.getDefaultIndexAlgorithm( rLocale ); + aSortAlgorithm = ld->getDefaultIndexAlgorithm( rLocale ); else aSortAlgorithm = rSortAlgorithm; - OUString module = ld.getIndexModuleByAlgorithm(rLocale, aSortAlgorithm); + OUString module = ld->getIndexModuleByAlgorithm(rLocale, aSortAlgorithm); if (!module.isEmpty() && createLocaleSpecificIndexEntrySupplier(module)) return xIES; diff --git a/i18npool/source/transliteration/ignoreKana.cxx b/i18npool/source/transliteration/ignoreKana.cxx index d468ecf1f2dd..6aa1e90dbd01 100644 --- a/i18npool/source/transliteration/ignoreKana.cxx +++ b/i18npool/source/transliteration/ignoreKana.cxx @@ -31,25 +31,25 @@ OUString SAL_CALL ignoreKana::folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset ) throw(RuntimeException, std::exception) { - hiraganaToKatakana t1; - return t1.transliterate(inStr, startPos, nCount, offset); + Reference< hiraganaToKatakana > t1(new hiraganaToKatakana); + return t1->transliterate(inStr, startPos, nCount, offset); } Sequence< OUString > SAL_CALL ignoreKana::transliterateRange( const OUString& str1, const OUString& str2 ) throw(RuntimeException, std::exception) { - hiraganaToKatakana t1; - katakanaToHiragana t2; + Reference< hiraganaToKatakana > t1(new hiraganaToKatakana); + Reference< katakanaToHiragana > t2(new katakanaToHiragana); - return transliteration_Ignore::transliterateRange(str1, str2, t1, t2); + return transliteration_Ignore::transliterateRange(str1, str2, *t1.get(), *t2.get()); } sal_Unicode SAL_CALL ignoreKana::transliterateChar2Char( sal_Unicode inChar) throw(RuntimeException, MultipleCharsOutputException, std::exception) { - hiraganaToKatakana t1; - return t1.transliterateChar2Char(inChar); + Reference< hiraganaToKatakana > t1(new hiraganaToKatakana); + return t1->transliterateChar2Char(inChar); } } } } } diff --git a/i18npool/source/transliteration/ignoreSize_ja_JP.cxx b/i18npool/source/transliteration/ignoreSize_ja_JP.cxx index e5645ad0986d..45f10be4f949 100644 --- a/i18npool/source/transliteration/ignoreSize_ja_JP.cxx +++ b/i18npool/source/transliteration/ignoreSize_ja_JP.cxx @@ -29,8 +29,8 @@ OUString SAL_CALL ignoreSize_ja_JP::folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset ) throw(RuntimeException, std::exception) { - smallToLarge_ja_JP t1; - return t1.transliterate(inStr, startPos, nCount, offset); + Reference< smallToLarge_ja_JP > t1(new smallToLarge_ja_JP); + return t1->transliterate(inStr, startPos, nCount, offset); } @@ -38,17 +38,17 @@ Sequence< OUString > SAL_CALL ignoreSize_ja_JP::transliterateRange( const OUString& str1, const OUString& str2 ) throw(RuntimeException, std::exception) { - smallToLarge_ja_JP t1; - largeToSmall_ja_JP t2; + Reference< smallToLarge_ja_JP > t1(new smallToLarge_ja_JP); + Reference< largeToSmall_ja_JP > t2(new largeToSmall_ja_JP); - return transliteration_Ignore::transliterateRange(str1, str2, t1, t2); + return transliteration_Ignore::transliterateRange(str1, str2, *t1.get(), *t2.get()); } sal_Unicode SAL_CALL ignoreSize_ja_JP::transliterateChar2Char( sal_Unicode inChar) throw(RuntimeException, MultipleCharsOutputException, std::exception) { - smallToLarge_ja_JP t1; - return t1.transliterateChar2Char(inChar); + Reference< smallToLarge_ja_JP > t1(new smallToLarge_ja_JP); + return t1->transliterateChar2Char(inChar); } } } } } diff --git a/i18npool/source/transliteration/ignoreWidth.cxx b/i18npool/source/transliteration/ignoreWidth.cxx index ebe640c44808..ab4ade0ace75 100644 --- a/i18npool/source/transliteration/ignoreWidth.cxx +++ b/i18npool/source/transliteration/ignoreWidth.cxx @@ -31,25 +31,25 @@ OUString SAL_CALL ignoreWidth::folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset ) throw(RuntimeException, std::exception) { - fullwidthToHalfwidth t1; - return t1.transliterate(inStr, startPos, nCount, offset); + Reference< fullwidthToHalfwidth > t1(new fullwidthToHalfwidth); + return t1->transliterate(inStr, startPos, nCount, offset); } Sequence< OUString > SAL_CALL ignoreWidth::transliterateRange( const OUString& str1, const OUString& str2 ) throw(RuntimeException, std::exception) { - fullwidthToHalfwidth t1; - halfwidthToFullwidth t2; + Reference< fullwidthToHalfwidth > t1(new fullwidthToHalfwidth); + Reference< halfwidthToFullwidth > t2(new halfwidthToFullwidth); - return transliteration_Ignore::transliterateRange(str1, str2, t1, t2); + return transliteration_Ignore::transliterateRange(str1, str2, *t1.get(), *t2.get()); } sal_Unicode SAL_CALL ignoreWidth::transliterateChar2Char( sal_Unicode inChar) throw(RuntimeException, MultipleCharsOutputException, std::exception) { - fullwidthToHalfwidth t1; - return t1.transliterateChar2Char(inChar); + Reference< fullwidthToHalfwidth > t1(new fullwidthToHalfwidth); + return t1->transliterateChar2Char(inChar); } } } } } diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx index c9c41ef773d0..875b4a150d60 100644 --- a/i18npool/source/transliteration/transliteration_body.cxx +++ b/i18npool/source/transliteration/transliteration_body.cxx @@ -269,9 +269,9 @@ static OUString transliterate_titlecase_Impl( if (!aText.isEmpty()) { Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - CharacterClassificationImpl aCharClassImpl( xContext ); + Reference< CharacterClassificationImpl > xCharClassImpl( new CharacterClassificationImpl( xContext ) ); - // because aCharClassImpl.toTitle does not handle ligatures or Beta but will raise + // because xCharClassImpl.toTitle does not handle ligatures or Beta but will raise // an exception we need to handle the first chara manually... // we don't want to change surrogates by accident, thuse we use proper code point iteration @@ -279,16 +279,16 @@ static OUString transliterate_titlecase_Impl( sal_uInt32 cFirstChar = aText.iterateCodePoints( &nPos ); OUString aResolvedLigature( &cFirstChar, 1 ); // toUpper can be used to properly resolve ligatures and characters like Beta - aResolvedLigature = aCharClassImpl.toUpper( aResolvedLigature, 0, aResolvedLigature.getLength(), rLocale ); + aResolvedLigature = xCharClassImpl->toUpper( aResolvedLigature, 0, aResolvedLigature.getLength(), rLocale ); // since toTitle will leave all-uppercase text unchanged we first need to // use toLower to bring possible 2nd and following chars in lowercase - aResolvedLigature = aCharClassImpl.toLower( aResolvedLigature, 0, aResolvedLigature.getLength(), rLocale ); + aResolvedLigature = xCharClassImpl->toLower( aResolvedLigature, 0, aResolvedLigature.getLength(), rLocale ); sal_Int32 nResolvedLen = aResolvedLigature.getLength(); // now we can properly use toTitle to get the expected result for the resolved string. // The rest of the text should just become lowercase. - aRes = aCharClassImpl.toTitle( aResolvedLigature, 0, nResolvedLen, rLocale ); - aRes += aCharClassImpl.toLower( aText, 1, aText.getLength() - 1, rLocale ); + aRes = xCharClassImpl->toTitle( aResolvedLigature, 0, nResolvedLen, rLocale ); + aRes += xCharClassImpl->toLower( aText, 1, aText.getLength() - 1, rLocale ); offset.realloc( aRes.getLength() ); sal_Int32 *pOffset = offset.getArray(); diff --git a/i18npool/source/transliteration/transliteration_caseignore.cxx b/i18npool/source/transliteration/transliteration_caseignore.cxx index dcfefe3f6d5a..9e89c39356b9 100644 --- a/i18npool/source/transliteration/transliteration_caseignore.cxx +++ b/i18npool/source/transliteration/transliteration_caseignore.cxx @@ -59,16 +59,16 @@ Transliteration_caseignore::transliterateRange( const OUString& str1, const OUSt if (str1.getLength() != 1 || str2.getLength() != 1) throw RuntimeException(); - static Transliteration_u2l u2l; - static Transliteration_l2u l2u; + static Reference< Transliteration_u2l > u2l(new Transliteration_u2l); + static Reference< Transliteration_l2u > l2u(new Transliteration_l2u); - u2l.loadModule((TransliterationModules)0, aLocale); - l2u.loadModule((TransliterationModules)0, aLocale); + u2l->loadModule((TransliterationModules)0, aLocale); + l2u->loadModule((TransliterationModules)0, aLocale); - OUString l1 = u2l.transliterateString2String(str1, 0, str1.getLength()); - OUString u1 = l2u.transliterateString2String(str1, 0, str1.getLength()); - OUString l2 = u2l.transliterateString2String(str2, 0, str2.getLength()); - OUString u2 = l2u.transliterateString2String(str2, 0, str2.getLength()); + OUString l1 = u2l->transliterateString2String(str1, 0, str1.getLength()); + OUString u1 = l2u->transliterateString2String(str1, 0, str1.getLength()); + OUString l2 = u2l->transliterateString2String(str2, 0, str2.getLength()); + OUString u2 = l2u->transliterateString2String(str2, 0, str2.getLength()); if ((l1 == u1) && (l2 == u2)) { Sequence< OUString > r(2); diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 535c81147ec0..122ee45d62c6 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -257,8 +257,8 @@ void XmlFilterBase::importDocumentProperties() MediaDescriptor aMediaDesc( getMediaDescriptor() ); Reference< XInputStream > xInputStream; Reference< XComponentContext > xContext = getComponentContext(); - ::oox::core::FilterDetect aDetector( xContext ); - xInputStream = aDetector.extractUnencryptedPackage( aMediaDesc ); + Reference< ::oox::core::FilterDetect > xDetector( new ::oox::core::FilterDetect( xContext ) ); + xInputStream = xDetector->extractUnencryptedPackage( aMediaDesc ); Reference< XComponent > xModel( getModel(), UNO_QUERY ); Reference< XStorage > xDocumentStorage ( ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream( OFOPXML_STORAGE_FORMAT_STRING, xInputStream ) ); @@ -823,8 +823,8 @@ Reference< XInputStream > XmlFilterBase::implGetInputStream( MediaDescriptor& rM /* Get the input stream directly from the media descriptor, or decrypt the package again. The latter is needed e.g. when the document is reloaded. All this is implemented in the detector service. */ - FilterDetect aDetector( getComponentContext() ); - return aDetector.extractUnencryptedPackage( rMediaDesc ); + Reference< FilterDetect > xDetector( new FilterDetect( getComponentContext() ) ); + return xDetector->extractUnencryptedPackage( rMediaDesc ); } Reference XmlFilterBase::implGetOutputStream( MediaDescriptor& rMediaDescriptor ) const diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index c3e8c755adde..6acd0d937d03 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -107,7 +107,7 @@ class OFieldExpressionControl : public ::svt::EditBrowseBox ImplSVEvent * m_nDeleteEvent; VclPtr m_pParent; bool m_bIgnoreEvent; - OFieldExpressionControlContainerListener aContainerListener; + css::uno::Reference aContainerListener; bool SaveModified(bool _bAppend); @@ -205,7 +205,7 @@ OFieldExpressionControl::OFieldExpressionControl(OGroupsSortingDialog* _pParentD ,m_nDeleteEvent(0) ,m_pParent(_pParentDialog) ,m_bIgnoreEvent(false) - ,aContainerListener(this) + ,aContainerListener(new OFieldExpressionControlContainerListener(this)) { SetBorderStyle(WindowBorderStyle::MONO); } @@ -219,9 +219,8 @@ OFieldExpressionControl::~OFieldExpressionControl() void OFieldExpressionControl::dispose() { - aContainerListener.WeakImplHelper1::acquire(); uno::Reference< report::XGroups > xGroups = m_pParent->getGroups(); - xGroups->removeContainerListener(&aContainerListener); + xGroups->removeContainerListener(aContainerListener.get()); // delete events from queue if( m_nPasteEvent ) @@ -408,7 +407,7 @@ void OFieldExpressionControl::lateInit() if( m_pParent->isReadOnly() ) nMode |= BrowserMode::HIDECURSOR; SetMode(nMode); - xGroups->addContainerListener(&aContainerListener); + xGroups->addContainerListener(aContainerListener.get()); } else // not the first call diff --git a/sax/qa/cppunit/attributes.cxx b/sax/qa/cppunit/attributes.cxx index a573f9ddb4b6..c76fd6556bf4 100644 --- a/sax/qa/cppunit/attributes.cxx +++ b/sax/qa/cppunit/attributes.cxx @@ -34,44 +34,44 @@ public: void AttributesTest::test() { - sax_fastparser::FastAttributeList aAttributeList( NULL ); - aAttributeList.add(1, "1"); - aAttributeList.add(2, OString("2")); + uno::Reference xAttributeList( new sax_fastparser::FastAttributeList(NULL) ); + xAttributeList->add(1, "1"); + xAttributeList->add(2, OString("2")); // We can't test getValueToken() and getOptionalValueToken() // without XFastTokenHandler :-( // Uncomment to get segmantation fault: - // aAttributeList.getOptionalValueToken(1, 0); - // aAttributeList.getValueToken(2); + // xAttributeList->getOptionalValueToken(1, 0); + // xAttributeList->getValueToken(2); - CPPUNIT_ASSERT( aAttributeList.hasAttribute(1) ); - CPPUNIT_ASSERT( !aAttributeList.hasAttribute(3) ); + CPPUNIT_ASSERT( xAttributeList->hasAttribute(1) ); + CPPUNIT_ASSERT( !xAttributeList->hasAttribute(3) ); - CPPUNIT_ASSERT_EQUAL( aAttributeList.getOptionalValue(2), OUString("2") ); - CPPUNIT_ASSERT_EQUAL( aAttributeList.getOptionalValue(3), OUString() ); + CPPUNIT_ASSERT_EQUAL( xAttributeList->getOptionalValue(2), OUString("2") ); + CPPUNIT_ASSERT_EQUAL( xAttributeList->getOptionalValue(3), OUString() ); - CPPUNIT_ASSERT_EQUAL( aAttributeList.getValue(1), OUString("1") ); + CPPUNIT_ASSERT_EQUAL( xAttributeList->getValue(1), OUString("1") ); mbException = false; - try { aAttributeList.getValue(3); } + try { xAttributeList->getValue(3); } catch (const sax::SAXException& ) { mbException = true; } CPPUNIT_ASSERT( mbException ); - aAttributeList.addUnknown("a", "a"); - aAttributeList.addUnknown("b", "b", "b"); - aAttributeList.addUnknown("c", "c"); - CPPUNIT_ASSERT_EQUAL( (sal_Int32) 3, aAttributeList.getUnknownAttributes().getLength() ); + xAttributeList->addUnknown("a", "a"); + xAttributeList->addUnknown("b", "b", "b"); + xAttributeList->addUnknown("c", "c"); + CPPUNIT_ASSERT_EQUAL( (sal_Int32) 3, xAttributeList->getUnknownAttributes().getLength() ); - CPPUNIT_ASSERT_EQUAL( (sal_Int32) 2, aAttributeList.getFastAttributes().getLength() ); + CPPUNIT_ASSERT_EQUAL( (sal_Int32) 2, xAttributeList->getFastAttributes().getLength() ); - aAttributeList.clear(); - CPPUNIT_ASSERT( !aAttributeList.hasAttribute(1) ); - CPPUNIT_ASSERT_EQUAL( (sal_Int32) 0, aAttributeList.getFastAttributes().getLength() ); - aAttributeList.addUnknown("c", "c"); - CPPUNIT_ASSERT_EQUAL( (sal_Int32) 1, aAttributeList.getUnknownAttributes().getLength() ); + xAttributeList->clear(); + CPPUNIT_ASSERT( !xAttributeList->hasAttribute(1) ); + CPPUNIT_ASSERT_EQUAL( (sal_Int32) 0, xAttributeList->getFastAttributes().getLength() ); + xAttributeList->addUnknown("c", "c"); + CPPUNIT_ASSERT_EQUAL( (sal_Int32) 1, xAttributeList->getUnknownAttributes().getLength() ); } CPPUNIT_TEST_SUITE_REGISTRATION( AttributesTest ); diff --git a/sax/qa/cppunit/parser.cxx b/sax/qa/cppunit/parser.cxx index 824d5ecd7078..b781d9e1a6e1 100644 --- a/sax/qa/cppunit/parser.cxx +++ b/sax/qa/cppunit/parser.cxx @@ -45,7 +45,7 @@ public: class ParserTest: public test::BootstrapFixture { InputSource maInput; - sax_fastparser::FastSaxParser maParser; + uno::Reference< sax_fastparser::FastSaxParser > mxParser; uno::Reference< XFastDocumentHandler > mxDocumentHandler; uno::Reference< DummyTokenHandler > mxTokenHandler; @@ -67,7 +67,8 @@ void ParserTest::setUp() { test::BootstrapFixture::setUp(); mxTokenHandler.set( new DummyTokenHandler() ); - maParser.setTokenHandler( mxTokenHandler ); + mxParser.set( new sax_fastparser::FastSaxParser() ); + mxParser->setTokenHandler( mxTokenHandler.get() ); } void ParserTest::tearDown() @@ -89,13 +90,13 @@ uno::Reference< io::XInputStream > ParserTest::createStream(const OString& sInpu void ParserTest::parse() { maInput.aInputStream = createStream("....."); - maParser.parseStream( maInput ); + mxParser->parseStream( maInput ); maInput.aInputStream = createStream(""); bool bException = false; try { - maParser.parseStream( maInput ); + mxParser->parseStream( maInput ); } catch (const SAXParseException &) { diff --git a/sc/source/ui/dbgui/csvcontrol.cxx b/sc/source/ui/dbgui/csvcontrol.cxx index b53b5bc5549d..583b5101b9b2 100644 --- a/sc/source/ui/dbgui/csvcontrol.cxx +++ b/sc/source/ui/dbgui/csvcontrol.cxx @@ -300,7 +300,7 @@ ScMoveMode ScCsvControl::GetVertDirection( sal_uInt16 nCode, bool bHomeEnd ) ScCsvControl::XAccessibleRef ScCsvControl::CreateAccessible() { - mxAccessible = ImplCreateAccessible(); + mxAccessible = ImplCreateAccessible().get(); return XAccessibleRef(mxAccessible.get()); } diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx index 069edcf44f5a..71301e0e4b9a 100644 --- a/sc/source/ui/dbgui/csvgrid.cxx +++ b/sc/source/ui/dbgui/csvgrid.cxx @@ -1357,11 +1357,11 @@ void ScCsvGrid::ImplDrawTrackingRect( sal_uInt32 nColIndex ) // accessibility ============================================================== -ScAccessibleCsvControl* ScCsvGrid::ImplCreateAccessible() +rtl::Reference ScCsvGrid::ImplCreateAccessible() { - std::unique_ptr pControl(new ScAccessibleCsvGrid( *this )); + rtl::Reference pControl(new ScAccessibleCsvGrid( *this )); pControl->Init(); - return pControl.release(); + return pControl; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/dbgui/csvruler.cxx b/sc/source/ui/dbgui/csvruler.cxx index d6ad878320b8..abe53759067c 100644 --- a/sc/source/ui/dbgui/csvruler.cxx +++ b/sc/source/ui/dbgui/csvruler.cxx @@ -654,7 +654,7 @@ void ScCsvRuler::ImplSetMousePointer( sal_Int32 nPos ) // accessibility ============================================================== -ScAccessibleCsvControl* ScCsvRuler::ImplCreateAccessible() +rtl::Reference ScCsvRuler::ImplCreateAccessible() { return new ScAccessibleCsvRuler( *this ); } diff --git a/sc/source/ui/dbgui/csvtablebox.cxx b/sc/source/ui/dbgui/csvtablebox.cxx index 785cb91b71d3..9ecbfb06a234 100644 --- a/sc/source/ui/dbgui/csvtablebox.cxx +++ b/sc/source/ui/dbgui/csvtablebox.cxx @@ -22,6 +22,7 @@ #include #include #include "editutil.hxx" +#include "AccessibleCsvControl.hxx" ScCsvTableBox::ScCsvTableBox( vcl::Window* pParent, WinBits nBits ) : ScCsvControl( pParent, maData, nBits ), @@ -426,9 +427,9 @@ ScCsvTableBox::XAccessibleRef ScCsvTableBox::CreateAccessible() return Control::CreateAccessible(); } -ScAccessibleCsvControl* ScCsvTableBox::ImplCreateAccessible() +rtl::Reference ScCsvTableBox::ImplCreateAccessible() { - return NULL; // not used, see CreateAccessible() + return rtl::Reference(); // not used, see CreateAccessible() } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/csvcontrol.hxx b/sc/source/ui/inc/csvcontrol.hxx index 0c9edb80da2c..82cad60856b4 100644 --- a/sc/source/ui/inc/csvcontrol.hxx +++ b/sc/source/ui/inc/csvcontrol.hxx @@ -383,7 +383,7 @@ public: protected: /** Derived classes create a new accessible object here. */ - virtual ScAccessibleCsvControl* ImplCreateAccessible() = 0; + virtual rtl::Reference ImplCreateAccessible() = 0; }; #endif diff --git a/sc/source/ui/inc/csvgrid.hxx b/sc/source/ui/inc/csvgrid.hxx index 85c71c1fcabc..4dc3e0ea8002 100644 --- a/sc/source/ui/inc/csvgrid.hxx +++ b/sc/source/ui/inc/csvgrid.hxx @@ -323,7 +323,7 @@ private: // accessibility ---------------------------------------------------------- protected: /** Creates a new accessible object. */ - virtual ScAccessibleCsvControl* ImplCreateAccessible() SAL_OVERRIDE; + virtual rtl::Reference ImplCreateAccessible() SAL_OVERRIDE; }; #endif diff --git a/sc/source/ui/inc/csvruler.hxx b/sc/source/ui/inc/csvruler.hxx index 44f8a765bddb..ab2fb01c997f 100644 --- a/sc/source/ui/inc/csvruler.hxx +++ b/sc/source/ui/inc/csvruler.hxx @@ -176,7 +176,7 @@ private: // accessibility ---------------------------------------------------------- protected: /** Creates a new accessible object. */ - virtual ScAccessibleCsvControl* ImplCreateAccessible() SAL_OVERRIDE; + virtual rtl::Reference ImplCreateAccessible() SAL_OVERRIDE; }; #endif diff --git a/sc/source/ui/inc/csvtablebox.hxx b/sc/source/ui/inc/csvtablebox.hxx index 4386d78da164..e7bfd347b653 100644 --- a/sc/source/ui/inc/csvtablebox.hxx +++ b/sc/source/ui/inc/csvtablebox.hxx @@ -134,7 +134,7 @@ public: protected: /** Creates a new accessible object. */ - virtual ScAccessibleCsvControl* ImplCreateAccessible() SAL_OVERRIDE; + virtual rtl::Reference ImplCreateAccessible() SAL_OVERRIDE; }; #endif diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 6f0a83569789..f2f8193fd663 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -5660,27 +5660,27 @@ void SAL_CALL ScCellRangeObj::filter( const uno::Reference xImpl(new ScFilterDescriptor(pDocSh)); uno::Reference< sheet::XSheetFilterDescriptor2 > xDescriptor2( xDescriptor, uno::UNO_QUERY ); if ( xDescriptor2.is() ) { - aImpl.setFilterFields2( xDescriptor2->getFilterFields2() ); + xImpl->setFilterFields2( xDescriptor2->getFilterFields2() ); } else { - aImpl.setFilterFields( xDescriptor->getFilterFields() ); + xImpl->setFilterFields( xDescriptor->getFilterFields() ); } // Rest sind jetzt Properties... uno::Reference xPropSet( xDescriptor, uno::UNO_QUERY ); if (xPropSet.is()) - lcl_CopyProperties( aImpl, *xPropSet.get() ); + lcl_CopyProperties( *xImpl.get(), *xPropSet.get() ); // ausfuehren... if (pDocSh) { - ScQueryParam aParam = aImpl.GetParam(); + ScQueryParam aParam = xImpl->GetParam(); // im FilterDescriptor sind die Fields innerhalb des Bereichs gezaehlt SCCOLROW nFieldStart = aParam.bByRow ? static_cast(aRange.aStart.Col()) : diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 755b7aa8477f..bc67a5b5c977 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -3359,9 +3359,9 @@ uno::Reference< util::XCloneable > SAL_CALL ScChart2DataSequence::createClone() } } - unique_ptr p(new ScChart2DataSequence(m_pDocument, m_xDataProvider, pTokensNew.release(), m_bIncludeHiddenCells)); + uno::Reference p(new ScChart2DataSequence(m_pDocument, m_xDataProvider, pTokensNew.release(), m_bIncludeHiddenCells)); p->CopyData(*this); - Reference< util::XCloneable > xClone(p.release()); + Reference< util::XCloneable > xClone(p); return xClone; } diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index fd9cb632d381..979edea06012 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1910,17 +1910,17 @@ void SAL_CALL ScModelObj::consolidate( // die Daten in ein ScConsolidationDescriptor Objekt zu kopieren: //! wenn es schon ein ScConsolidationDescriptor ist, direkt per getImplementation? - ScConsolidationDescriptor aImpl; - aImpl.setFunction( xDescriptor->getFunction() ); - aImpl.setSources( xDescriptor->getSources() ); - aImpl.setStartOutputPosition( xDescriptor->getStartOutputPosition() ); - aImpl.setUseColumnHeaders( xDescriptor->getUseColumnHeaders() ); - aImpl.setUseRowHeaders( xDescriptor->getUseRowHeaders() ); - aImpl.setInsertLinks( xDescriptor->getInsertLinks() ); + uno::Reference< ScConsolidationDescriptor > xImpl(new ScConsolidationDescriptor); + xImpl->setFunction( xDescriptor->getFunction() ); + xImpl->setSources( xDescriptor->getSources() ); + xImpl->setStartOutputPosition( xDescriptor->getStartOutputPosition() ); + xImpl->setUseColumnHeaders( xDescriptor->getUseColumnHeaders() ); + xImpl->setUseRowHeaders( xDescriptor->getUseRowHeaders() ); + xImpl->setInsertLinks( xDescriptor->getInsertLinks() ); if (pDocShell) { - const ScConsolidateParam& rParam = aImpl.GetParam(); + const ScConsolidateParam& rParam = xImpl->GetParam(); pDocShell->DoConsolidate( rParam, true ); pDocShell->GetDocument().SetConsolidateDlgData( &rParam ); } diff --git a/sc/source/ui/vba/vbafont.cxx b/sc/source/ui/vba/vbafont.cxx index 7d3cde109188..eddb2f392611 100644 --- a/sc/source/ui/vba/vbafont.cxx +++ b/sc/source/ui/vba/vbafont.cxx @@ -84,8 +84,8 @@ ScVbaFont::setSuperscript( const uno::Any& aValue ) throw ( uno::RuntimeExceptio for ( sal_Int32 row = 0; row < nRows; ++row ) { uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ) , uno::UNO_QUERY_THROW ); - ScVbaFont aFont( getParent(), mxContext, mPalette, xProps ); - aFont.setSuperscript( aValue ); + uno::Reference< ScVbaFont > aFont( new ScVbaFont( getParent(), mxContext, mPalette, xProps ) ); + aFont->setSuperscript( aValue ); } } return; @@ -124,10 +124,10 @@ ScVbaFont::getSuperscript() throw ( uno::RuntimeException, std::exception ) for ( sal_Int32 row = 0; row < nRows; ++row ) { uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ), uno::UNO_QUERY_THROW ); - ScVbaFont aFont( getParent(), mxContext, mPalette, xProps ); + uno::Reference< ScVbaFont > aFont( new ScVbaFont( getParent(), mxContext, mPalette, xProps ) ); if ( !col && !row ) - aRes = aFont.getSuperscript(); - else if ( aRes != aFont.getSuperscript() ) + aRes = aFont->getSuperscript(); + else if ( aRes != aFont->getSuperscript() ) return aNULL(); } } @@ -156,8 +156,8 @@ ScVbaFont::setSubscript( const uno::Any& aValue ) throw ( uno::RuntimeException, for ( sal_Int32 row = 0; row < nRows; ++row ) { uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ) , uno::UNO_QUERY_THROW ); - ScVbaFont aFont( getParent(), mxContext, mPalette, xProps ); - aFont.setSubscript( aValue ); + uno::Reference< ScVbaFont > aFont( new ScVbaFont( getParent(), mxContext, mPalette, xProps ) ); + aFont->setSubscript( aValue ); } } return; @@ -198,10 +198,10 @@ ScVbaFont::getSubscript() throw ( uno::RuntimeException, std::exception ) for ( sal_Int32 row = 0; row < nRows; ++row ) { uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ), uno::UNO_QUERY_THROW ); - ScVbaFont aFont( getParent(), mxContext, mPalette, xProps ); + uno::Reference< ScVbaFont > aFont( new ScVbaFont( getParent(), mxContext, mPalette, xProps ) ); if ( !col && !row ) - aRes = aFont.getSubscript(); - else if ( aRes != aFont.getSubscript() ) + aRes = aFont->getSubscript(); + else if ( aRes != aFont->getSubscript() ) return aNULL(); } } diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx index 57adf47664e6..6ed0c840c697 100644 --- a/sc/source/ui/vba/vbawindow.cxx +++ b/sc/source/ui/vba/vbawindow.cxx @@ -315,8 +315,8 @@ ScVbaWindow::getCaption() throw (uno::RuntimeException, std::exception) if ( ( nCrudLen + nCrudIndex ) == sTitle.getLength() ) { sTitle = sTitle.copy( 0, nCrudIndex ); - ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); - OUString sName = workbook.getName(); + uno::Reference< ScVbaWorkbook > workbook( new ScVbaWorkbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ) ); + OUString sName = workbook->getName(); // rather bizarre hack to make sure the name behavior // is like XL // if the adjusted title == workbook name, use name @@ -447,16 +447,16 @@ ScVbaWindow::setWindowState( const uno::Any& _windowstate ) throw (uno::RuntimeE void ScVbaWindow::Activate() throw (css::uno::RuntimeException, std::exception) { - ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); + uno::Reference workbook( new ScVbaWorkbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ) ); - workbook.Activate(); + workbook->Activate(); } void ScVbaWindow::Close( const uno::Any& SaveChanges, const uno::Any& FileName, const uno::Any& RouteWorkBook ) throw (uno::RuntimeException, std::exception) { - ScVbaWorkbook workbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); - workbook.Close(SaveChanges, FileName, RouteWorkBook ); + uno::Reference< ScVbaWorkbook > workbook( new ScVbaWorkbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ) ); + workbook->Close(SaveChanges, FileName, RouteWorkBook ); } uno::Reference< excel::XPane > SAL_CALL diff --git a/sc/source/ui/vba/vbawindows.cxx b/sc/source/ui/vba/vbawindows.cxx index e70809a51f88..3d4f573ca786 100644 --- a/sc/source/ui/vba/vbawindows.cxx +++ b/sc/source/ui/vba/vbawindows.cxx @@ -128,9 +128,9 @@ public: // !! TODO !! iterate over all controllers uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW ); uno::Reference< XHelperInterface > xTemp; // temporary needed for g++ 3.3.5 - ScVbaWindow window( xTemp, m_xContext, xModel, xController ); + uno::Reference< ScVbaWindow > window( new ScVbaWindow( xTemp, m_xContext, xModel, xController ) ); OUString sCaption; - window.getCaption() >>= sCaption; + window->getCaption() >>= sCaption; namesToIndices[ sCaption ] = nIndex++; } } diff --git a/sd/source/ui/inc/EventMultiplexer.hxx b/sd/source/ui/inc/EventMultiplexer.hxx index 50ad82333628..fc1a5c9ab46d 100644 --- a/sd/source/ui/inc/EventMultiplexer.hxx +++ b/sd/source/ui/inc/EventMultiplexer.hxx @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -204,7 +205,7 @@ public: private: class Implementation; - ::std::unique_ptr mpImpl; + css::uno::Reference mpImpl; }; } } // end of namespace ::sd::tools diff --git a/sd/source/ui/tools/EventMultiplexer.cxx b/sd/source/ui/tools/EventMultiplexer.cxx index 4ccb5ad49683..2b3d4ef0c3f7 100644 --- a/sd/source/ui/tools/EventMultiplexer.cxx +++ b/sd/source/ui/tools/EventMultiplexer.cxx @@ -174,12 +174,6 @@ EventMultiplexer::~EventMultiplexer() try { mpImpl->dispose(); - // Now we call release twice. One decreases the use count of the - // implementation object (if all goes well to zero and thus deletes - // it.) The other releases the unique_ptr and prevents the - // implementation object from being deleted a second time. - mpImpl->release(); - mpImpl.release(); } catch (const RuntimeException&) { diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx index f0f97198b312..71d60ae94c7c 100644 --- a/sd/source/ui/view/drviews5.cxx +++ b/sd/source/ui/view/drviews5.cxx @@ -579,7 +579,7 @@ void DrawViewShell::SetActiveTabLayerIndex (int nIndex) // Tell the draw view and the tab control of the new active layer. mpDrawView->SetActiveLayer (pBar->GetPageText (pBar->GetPageId ((sal_uInt16)nIndex))); pBar->SetCurPageId (pBar->GetPageId ((sal_uInt16)nIndex)); - boost::scoped_ptr pUnoDrawView(new SdUnoDrawView ( + css::uno::Reference pUnoDrawView(new SdUnoDrawView ( *this, *GetView())); ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer> rLayer = pUnoDrawView->getActiveLayer(); diff --git a/sdext/source/pdfimport/test/pdf2xml.cxx b/sdext/source/pdfimport/test/pdf2xml.cxx index 518b0ef2c938..750fb5102816 100644 --- a/sdext/source/pdfimport/test/pdf2xml.cxx +++ b/sdext/source/pdfimport/test/pdf2xml.cxx @@ -72,9 +72,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) test::BootstrapFixtureBase aEnv; aEnv.setUp(); - pdfi::PDFIRawAdaptor aAdaptor( OUString(), aEnv.getComponentContext() ); - aAdaptor.setTreeVisitorFactory(pTreeFactory); - aAdaptor.odfConvert( aSrcURL, new OutputWrap(aDstURL), NULL ); + uno::Reference xAdaptor( new pdfi::PDFIRawAdaptor(OUString(), aEnv.getComponentContext()) ); + xAdaptor->setTreeVisitorFactory(pTreeFactory); + xAdaptor->odfConvert( aSrcURL, new OutputWrap(aDstURL), NULL ); } catch (const uno::Exception& e) { diff --git a/sdext/source/pdfimport/test/tests.cxx b/sdext/source/pdfimport/test/tests.cxx index 90425f912c36..e8150dd5a6f6 100644 --- a/sdext/source/pdfimport/test/tests.cxx +++ b/sdext/source/pdfimport/test/tests.cxx @@ -468,14 +468,14 @@ namespace void testOdfDrawExport() { - pdfi::PDFIRawAdaptor aAdaptor( OUString(), getComponentContext() ); - aAdaptor.setTreeVisitorFactory( createDrawTreeVisitorFactory() ); + uno::Reference xAdaptor( new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()) ); + xAdaptor->setTreeVisitorFactory( createDrawTreeVisitorFactory() ); OUString tempFileURL; CPPUNIT_ASSERT( osl::File::createTempFile( NULL, NULL, &tempFileURL ) == osl::File::E_None ); osl::File::remove( tempFileURL ); // FIXME the below apparently fails silently if the file already exists CPPUNIT_ASSERT_MESSAGE("Exporting to ODF", - aAdaptor.odfConvert( getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"), + xAdaptor->odfConvert( getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"), new OutputWrap(tempFileURL), NULL )); osl::File::remove( tempFileURL ); @@ -483,14 +483,14 @@ namespace void testOdfWriterExport() { - pdfi::PDFIRawAdaptor aAdaptor( OUString(), getComponentContext() ); - aAdaptor.setTreeVisitorFactory( createWriterTreeVisitorFactory() ); + uno::Reference xAdaptor( new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()) ); + xAdaptor->setTreeVisitorFactory( createWriterTreeVisitorFactory() ); OUString tempFileURL; CPPUNIT_ASSERT( osl::File::createTempFile( NULL, NULL, &tempFileURL ) == osl::File::E_None ); osl::File::remove( tempFileURL ); // FIXME the below apparently fails silently if the file already exists CPPUNIT_ASSERT_MESSAGE("Exporting to ODF", - aAdaptor.odfConvert( getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"), + xAdaptor->odfConvert( getURLFromSrc("/sdext/source/pdfimport/test/testinput.pdf"), new OutputWrap(tempFileURL), NULL )); osl::File::remove( tempFileURL ); diff --git a/svtools/source/edit/svmedit.cxx b/svtools/source/edit/svmedit.cxx index faaab3e87328..86f43efe93f4 100644 --- a/svtools/source/edit/svmedit.cxx +++ b/svtools/source/edit/svmedit.cxx @@ -34,9 +34,9 @@ MultiLineEdit::GetComponentInterface(bool bCreate) VclMultiLineEdit::GetComponentInterface(false)); if (!xPeer.is() && bCreate) { - ::std::unique_ptr< VCLXMultiLineEdit > xVCLMEdit(new VCLXMultiLineEdit()); + css::uno::Reference< VCLXMultiLineEdit > xVCLMEdit(new VCLXMultiLineEdit); xVCLMEdit->SetWindow(this); - xPeer = xVCLMEdit.release(); + xPeer = xVCLMEdit; SetComponentInterface(xPeer); } return xPeer; diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index 4f07fea76ec5..d59308a9b3c3 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -268,7 +268,7 @@ namespace sdr aScale, fShearX, fRotate, aTranslate)); // directly create temp SdrBlockTextPrimitive2D - drawinglayer::primitive2d::SdrBlockTextPrimitive2D aBlockTextPrimitive( + css::uno::Reference< drawinglayer::primitive2d::SdrBlockTextPrimitive2D > xBlockTextPrimitive(new drawinglayer::primitive2d::SdrBlockTextPrimitive2D( pSdrText, *pOPO, aTextRangeTransform, @@ -278,7 +278,7 @@ namespace sdr false, false, false, - false); + false)); // decompose immediately with neutral ViewInformation. This will // layout the text to more simple TextPrimitives from drawinglayer @@ -286,7 +286,7 @@ namespace sdr drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence( xRetval, - aBlockTextPrimitive.get2DDecomposition(aViewInformation2D)); + xBlockTextPrimitive->get2DDecomposition(aViewInformation2D)); } } diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx index 146bb629d7cd..fff348d45c4a 100644 --- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx @@ -86,7 +86,7 @@ namespace drawinglayer Primitive2DSequence SdrMeasurePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const { Primitive2DSequence aRetval; - boost::scoped_ptr pBlockText; + css::uno::Reference xBlockText; basegfx::B2DRange aTextRange; double fTextX((getStart().getX() + getEnd().getX()) * 0.5); double fTextY((getStart().getX() + getEnd().getX()) * 0.5); @@ -125,7 +125,7 @@ namespace drawinglayer } // create primitive and get text range - pBlockText.reset(new SdrBlockTextPrimitive2D( + xBlockText = new SdrBlockTextPrimitive2D( &rTextAttribute.getSdrText(), rTextAttribute.getOutlinerParaObject(), aTextMatrix, @@ -135,9 +135,9 @@ namespace drawinglayer false, false, false, - false)); + false); - aTextRange = pBlockText->getB2DRange(aViewInformation); + aTextRange = xBlockText->getB2DRange(aViewInformation); } // prepare line attribute and result @@ -401,7 +401,7 @@ namespace drawinglayer aRetval = Primitive2DSequence(&xHiddenLines, 1); } - if(pBlockText) + if(xBlockText.is()) { // create transformation to text primitive end position basegfx::B2DHomMatrix aChange; @@ -419,9 +419,9 @@ namespace drawinglayer aChange *= aObjectMatrix; // apply to existing text primitive - SdrTextPrimitive2D* pNewBlockText = pBlockText->createTransformedClone(aChange); + SdrTextPrimitive2D* pNewBlockText = xBlockText->createTransformedClone(aChange); OSL_ENSURE(pNewBlockText, "SdrMeasurePrimitive2D::create2DDecomposition: Could not create transformed clone of text primitive (!)"); - pBlockText.reset(); + xBlockText.clear(); // add to local primitives appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, Primitive2DReference(pNewBlockText)); diff --git a/svx/source/xml/xmlxtexp.cxx b/svx/source/xml/xmlxtexp.cxx index 83239424f13a..3e301f26ab91 100644 --- a/svx/source/xml/xmlxtexp.cxx +++ b/svx/source/xml/xmlxtexp.cxx @@ -299,8 +299,8 @@ bool SvxXMLXTableExportComponent::save( // Finally do the export const OUString aName; - SvxXMLXTableExportComponent aExporter( xContext, aName, xHandler, xTable, xGrfResolver ); - bRet = aExporter.exportTable(); + uno::Reference< SvxXMLXTableExportComponent > xExporter( new SvxXMLXTableExportComponent( xContext, aName, xHandler, xTable, xGrfResolver ) ); + bRet = xExporter->exportTable(); if( pGraphicHelper ) SvXMLGraphicHelper::Destroy( pGraphicHelper ); diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index cd52f44b1707..f6fc59973d26 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -376,9 +376,9 @@ sal_uLong SwXMLTextBlocks::PutBlockText( const OUString& rShort, const OUString& uno::Reference xHandler(xWriter, uno::UNO_QUERY); - SwXMLTextBlockExport aExp( xContext, *this, GetXMLToken ( XML_UNFORMATTED_TEXT ), xHandler); + uno::Reference xExp( new SwXMLTextBlockExport( xContext, *this, GetXMLToken ( XML_UNFORMATTED_TEXT ), xHandler) ); - aExp.exportDoc( rText ); + xExp->exportDoc( rText ); uno::Reference < embed::XTransactedObject > xTrans( xRoot, uno::UNO_QUERY ); if ( xTrans.is() ) @@ -497,9 +497,9 @@ void SwXMLTextBlocks::WriteInfo() uno::Reference xHandler(xWriter, uno::UNO_QUERY); - SwXMLBlockListExport aExp( xContext, *this, OUString(XMLN_BLOCKLIST), xHandler); + uno::Reference xExp(new SwXMLBlockListExport( xContext, *this, OUString(XMLN_BLOCKLIST), xHandler) ); - aExp.exportDoc( XML_BLOCK_LIST ); + xExp->exportDoc( XML_BLOCK_LIST ); uno::Reference < embed::XTransactedObject > xTrans( xBlkRoot, uno::UNO_QUERY ); if ( xTrans.is() ) diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx index 4b8ba9656142..62f83e5a8caa 100644 --- a/sw/source/core/unocore/unorefmk.cxx +++ b/sw/source/core/unocore/unorefmk.cxx @@ -516,9 +516,9 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, #include #include #include +#include -class SwXMetaText - : public SwXText +class SwXMetaText : public cppu::OWeakObject, public SwXText { private: SwXMeta & m_rMeta; @@ -541,10 +541,8 @@ public: void Invalidate() { SwXText::Invalidate(); }; // XInterface - virtual void SAL_CALL acquire() throw() SAL_OVERRIDE - { assert(false); } - virtual void SAL_CALL release() throw() SAL_OVERRIDE - { assert(false); } + virtual void SAL_CALL acquire() throw() SAL_OVERRIDE { cppu::OWeakObject::acquire(); } + virtual void SAL_CALL release() throw() SAL_OVERRIDE { cppu::OWeakObject::release(); } // XTypeProvider virtual uno::Sequence< sal_Int8 > SAL_CALL @@ -649,7 +647,7 @@ public: bool m_bIsDisposed; bool m_bIsDescriptor; uno::Reference m_xParentText; - SwXMetaText m_Text; + uno::Reference m_xText; Impl( SwXMeta & rThis, SwDoc & rDoc, ::sw::Meta * const pMeta, @@ -661,7 +659,7 @@ public: , m_bIsDisposed( false ) , m_bIsDescriptor(0 == pMeta) , m_xParentText(xParentText) - , m_Text(rDoc, rThis) + , m_xText(new SwXMetaText(rDoc, rThis)) { } @@ -692,7 +690,7 @@ void SwXMeta::Impl::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) } m_bIsDisposed = true; - m_Text.Invalidate(); + m_xText->Invalidate(); uno::Reference const xThis(m_wThis); if (!xThis.is()) { // fdo#72695: if UNO object is already dead, don't revive it with event @@ -954,7 +952,7 @@ SwXMeta::dispose() throw (uno::RuntimeException, std::exception) lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this)); m_pImpl->m_EventListeners.disposeAndClear(ev); m_pImpl->m_bIsDisposed = true; - m_pImpl->m_Text.Invalidate(); + m_pImpl->m_xText->Invalidate(); } else if (!m_pImpl->m_bIsDisposed) { @@ -1116,28 +1114,28 @@ uno::Reference< text::XTextRange > SAL_CALL SwXMeta::getStart() throw (uno::RuntimeException, std::exception) { SolarMutexGuard g; - return m_pImpl->m_Text.getStart(); + return m_pImpl->m_xText->getStart(); } uno::Reference< text::XTextRange > SAL_CALL SwXMeta::getEnd() throw (uno::RuntimeException, std::exception) { SolarMutexGuard g; - return m_pImpl->m_Text.getEnd(); + return m_pImpl->m_xText->getEnd(); } OUString SAL_CALL SwXMeta::getString() throw (uno::RuntimeException, std::exception) { SolarMutexGuard g; - return m_pImpl->m_Text.getString(); + return m_pImpl->m_xText->getString(); } void SAL_CALL SwXMeta::setString(const OUString& rString) throw (uno::RuntimeException, std::exception) { SolarMutexGuard g; - return m_pImpl->m_Text.setString(rString); + return m_pImpl->m_xText->setString(rString); } // XSimpleText @@ -1145,7 +1143,7 @@ uno::Reference< text::XTextCursor > SAL_CALL SwXMeta::createTextCursor() throw (uno::RuntimeException, std::exception) { SolarMutexGuard g; - return m_pImpl->m_Text.createTextCursor(); + return m_pImpl->m_xText->createTextCursor(); } uno::Reference< text::XTextCursor > SAL_CALL @@ -1154,7 +1152,7 @@ SwXMeta::createTextCursorByRange( throw (uno::RuntimeException, std::exception) { SolarMutexGuard g; - return m_pImpl->m_Text.createTextCursorByRange(xTextPosition); + return m_pImpl->m_xText->createTextCursorByRange(xTextPosition); } void SAL_CALL @@ -1163,7 +1161,7 @@ SwXMeta::insertString(const uno::Reference & xRange, throw (uno::RuntimeException, std::exception) { SolarMutexGuard g; - return m_pImpl->m_Text.insertString(xRange, rString, bAbsorb); + return m_pImpl->m_xText->insertString(xRange, rString, bAbsorb); } void SAL_CALL @@ -1172,7 +1170,7 @@ SwXMeta::insertControlCharacter(const uno::Reference & xRange, throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) { SolarMutexGuard g; - return m_pImpl->m_Text.insertControlCharacter(xRange, nControlCharacter, + return m_pImpl->m_xText->insertControlCharacter(xRange, nControlCharacter, bAbsorb); } @@ -1183,7 +1181,7 @@ SwXMeta::insertTextContent( const uno::Reference & xRange, throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception) { SolarMutexGuard g; - return m_pImpl->m_Text.insertTextContent(xRange, xContent, bAbsorb); + return m_pImpl->m_xText->insertTextContent(xRange, xContent, bAbsorb); } void SAL_CALL @@ -1192,7 +1190,7 @@ SwXMeta::removeTextContent( throw (container::NoSuchElementException, uno::RuntimeException, std::exception) { SolarMutexGuard g; - return m_pImpl->m_Text.removeTextContent(xContent); + return m_pImpl->m_xText->removeTextContent(xContent); } // XChild diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index e838e44e58df..e480f481af1f 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -336,12 +336,12 @@ void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pText m_bIsFirstParagraph = false; } -static void lcl_deleteAndResetTheLists( std::unique_ptr& pSdtPrTokenChildren, std::unique_ptr& pSdtPrDataBindingAttrs, OUString& rSdtPrAlias) +static void lcl_deleteAndResetTheLists( uno::Reference& pSdtPrTokenChildren, uno::Reference& pSdtPrDataBindingAttrs, OUString& rSdtPrAlias) { - if( pSdtPrTokenChildren ) - pSdtPrTokenChildren.reset(0); - if( pSdtPrDataBindingAttrs ) - pSdtPrDataBindingAttrs.reset(0); + if( pSdtPrTokenChildren.is() ) + pSdtPrTokenChildren.clear(); + if( pSdtPrDataBindingAttrs.is() ) + pSdtPrDataBindingAttrs.clear(); if (!rSdtPrAlias.isEmpty()) rSdtPrAlias.clear(); } @@ -605,13 +605,13 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT } void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken, - std::unique_ptr& pSdtPrTokenChildren, - std::unique_ptr& pSdtPrTokenAttributes, - std::unique_ptr& pSdtPrDataBindingAttrs, + uno::Reference& pSdtPrTokenChildren, + uno::Reference& pSdtPrTokenAttributes, + uno::Reference& pSdtPrDataBindingAttrs, OUString& rSdtPrAlias, bool bPara ) { - if( nSdtPrToken > 0 || pSdtPrDataBindingAttrs ) + if( nSdtPrToken > 0 || pSdtPrDataBindingAttrs.is() ) { // sdt start mark m_pSerializer->mark(Tag_WriteSdtBlock); @@ -621,13 +621,14 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken, // output sdt properties m_pSerializer->startElementNS( XML_w, XML_sdtPr, FSEND ); - if( nSdtPrToken > 0 && pSdtPrTokenChildren ) + if( nSdtPrToken > 0 && pSdtPrTokenChildren.is() ) { - if (!pSdtPrTokenAttributes) + if (!pSdtPrTokenAttributes.is()) m_pSerializer->startElement( nSdtPrToken, FSEND ); else { - XFastAttributeListRef xAttrList(pSdtPrTokenAttributes.release()); + XFastAttributeListRef xAttrList(pSdtPrTokenAttributes); + pSdtPrTokenAttributes.clear(); m_pSerializer->startElement(nSdtPrToken, xAttrList); } @@ -644,11 +645,12 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken, } else if( (nSdtPrToken > 0) && nSdtPrToken != FSNS( XML_w, XML_id ) && !(m_bRunTextIsOn && m_rExport.SdrExporter().IsParagraphHasDrawing())) { - if (!pSdtPrTokenAttributes) + if (!pSdtPrTokenAttributes.is()) m_pSerializer->singleElement( nSdtPrToken, FSEND ); else { - XFastAttributeListRef xAttrList(pSdtPrTokenAttributes.release()); + XFastAttributeListRef xAttrList(pSdtPrTokenAttributes); + pSdtPrTokenAttributes.clear(); m_pSerializer->singleElement(nSdtPrToken, xAttrList); } } @@ -659,9 +661,10 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken, OString::number(comphelper::rng::uniform_int_distribution(0, std::numeric_limits::max())), FSEND); - if(( pSdtPrDataBindingAttrs ) && !m_rExport.SdrExporter().IsParagraphHasDrawing()) + if( pSdtPrDataBindingAttrs.is() && !m_rExport.SdrExporter().IsParagraphHasDrawing()) { - XFastAttributeListRef xAttrList( pSdtPrDataBindingAttrs.release() ); + XFastAttributeListRef xAttrList( pSdtPrDataBindingAttrs ); + pSdtPrDataBindingAttrs.clear(); m_pSerializer->singleElementNS( XML_w, XML_dataBinding, xAttrList ); } @@ -693,9 +696,8 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken, // clear sdt status nSdtPrToken = 0; - pSdtPrTokenChildren.reset(0); - if( pSdtPrDataBindingAttrs ) - pSdtPrDataBindingAttrs.reset(0); + pSdtPrTokenChildren.clear(); + pSdtPrDataBindingAttrs.clear(); rSdtPrAlias.clear(); } } @@ -831,7 +833,7 @@ void DocxAttributeOutput::StartParagraphProperties() void DocxAttributeOutput::InitCollectedParagraphProperties() { - m_pParagraphSpacingAttrList.reset(0); + m_pParagraphSpacingAttrList.clear(); // Write the elements in the spec order static const sal_Int32 aOrder[] = @@ -886,23 +888,26 @@ void DocxAttributeOutput::InitCollectedParagraphProperties() void DocxAttributeOutput::WriteCollectedParagraphProperties() { - if ( m_rExport.SdrExporter().getFlyAttrList() ) + if ( m_rExport.SdrExporter().getFlyAttrList().is() ) { - XFastAttributeListRef xAttrList( m_rExport.SdrExporter().getFlyAttrList().release() ); + XFastAttributeListRef xAttrList( m_rExport.SdrExporter().getFlyAttrList() ); + m_rExport.SdrExporter().getFlyAttrList().clear(); m_pSerializer->singleElementNS( XML_w, XML_framePr, xAttrList ); } - if ( m_pParagraphSpacingAttrList ) + if ( m_pParagraphSpacingAttrList.is() ) { - XFastAttributeListRef xAttrList( m_pParagraphSpacingAttrList.release() ); + XFastAttributeListRef xAttrList( m_pParagraphSpacingAttrList ); + m_pParagraphSpacingAttrList.clear(); m_pSerializer->singleElementNS( XML_w, XML_spacing, xAttrList ); } - if ( m_pBackgroundAttrList ) + if ( m_pBackgroundAttrList.is() ) { - XFastAttributeListRef xAttrList( m_pBackgroundAttrList.release() ); + XFastAttributeListRef xAttrList( m_pBackgroundAttrList ); + m_pBackgroundAttrList.clear(); m_pSerializer->singleElementNS( XML_w, XML_shd, xAttrList ); } @@ -970,9 +975,12 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar // to the DOCX when the function 'WriteCollectedRunProperties' gets called. // So we need to store the current status of these lists, so that we can revert back to them when // we are done exporting the redline attributes. - std::unique_ptr pFontsAttrList_Original(m_pFontsAttrList.release()); - std::unique_ptr pEastAsianLayoutAttrList_Original(m_pEastAsianLayoutAttrList.release()); - std::unique_ptr pCharLangAttrList_Original(m_pCharLangAttrList.release()); + uno::Reference pFontsAttrList_Original(m_pFontsAttrList); + m_pFontsAttrList.clear(); + uno::Reference pEastAsianLayoutAttrList_Original(m_pEastAsianLayoutAttrList); + m_pEastAsianLayoutAttrList.clear(); + uno::Reference pCharLangAttrList_Original(m_pCharLangAttrList); + m_pCharLangAttrList.clear(); lcl_writeParagraphMarkerProperties(*this, rParagraphMarkerProperties); @@ -980,9 +988,9 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar WriteCollectedRunProperties(); // Revert back the original values that were stored in 'm_pFontsAttrList', 'm_pEastAsianLayoutAttrList', 'm_pCharLangAttrList' - m_pFontsAttrList.reset(pFontsAttrList_Original.release()); - m_pEastAsianLayoutAttrList.reset(pEastAsianLayoutAttrList_Original.release()); - m_pCharLangAttrList.reset(pCharLangAttrList_Original.release()); + m_pFontsAttrList = pFontsAttrList_Original; + m_pEastAsianLayoutAttrList = pEastAsianLayoutAttrList_Original; + m_pCharLangAttrList = pCharLangAttrList_Original; if ( pRedlineParagraphMarkerDeleted ) { @@ -1069,7 +1077,7 @@ void DocxAttributeOutput::EndRun() { int nFieldsInPrevHyperlink = m_nFieldsInHyperlink; // Reset m_nFieldsInHyperlink if a new hyperlink is about to start - if ( m_pHyperlinkAttrList ) + if ( m_pHyperlinkAttrList.is() ) { m_nFieldsInHyperlink = 0; } @@ -1093,7 +1101,7 @@ void DocxAttributeOutput::EndRun() if (m_startedHyperlink) ++m_nFieldsInHyperlink; - if ( m_pHyperlinkAttrList ) + if ( m_pHyperlinkAttrList.is() ) { m_nFieldsInHyperlink++; } @@ -1163,9 +1171,10 @@ void DocxAttributeOutput::EndRun() } // Start the hyperlink after the fields separators or we would generate invalid file - if ( m_pHyperlinkAttrList ) + if ( m_pHyperlinkAttrList.is() ) { - XFastAttributeListRef xAttrList ( m_pHyperlinkAttrList.release() ); + XFastAttributeListRef xAttrList ( m_pHyperlinkAttrList ); + m_pHyperlinkAttrList.clear(); m_pSerializer->startElementNS( XML_w, XML_hyperlink, xAttrList ); m_startedHyperlink = true; @@ -1214,7 +1223,7 @@ void DocxAttributeOutput::EndRun() } m_pSerializer->startElementNS( XML_w, XML_r, FSEND ); - if(GetExport().m_bTabInTOC && m_pHyperlinkAttrList) + if(GetExport().m_bTabInTOC && m_pHyperlinkAttrList.is()) { RunText(OUString("\t")) ; } @@ -1232,7 +1241,7 @@ void DocxAttributeOutput::EndRun() // (so on export sdt blocks are never nested ATM) if ( !m_bAnchorLinkedToNode && !m_bStartedCharSdt ) { - std::unique_ptr pRunSdtPrTokenAttributes; + uno::Reference pRunSdtPrTokenAttributes; WriteSdtBlock( m_nRunSdtPrToken, m_pRunSdtPrTokenChildren, pRunSdtPrTokenAttributes, m_pRunSdtPrDataBindingAttrs, m_aRunSdtPrAlias, /*bPara=*/false ); } else @@ -1661,7 +1670,7 @@ void DocxAttributeOutput::StartRunProperties() m_pSerializer->startElementNS( XML_w, XML_rPr, FSEND ); - if(GetExport().m_bHideTabLeaderAndPageNumbers && m_pHyperlinkAttrList ) + if(GetExport().m_bHideTabLeaderAndPageNumbers && m_pHyperlinkAttrList.is() ) { m_pSerializer->singleElementNS( XML_w, XML_webHidden, FSEND ); } @@ -1922,28 +1931,32 @@ void lclProcessRecursiveGrabBag(sal_Int32 aElementId, const css::uno::SequencesingleElementNS( XML_w, XML_rFonts, xAttrList ); } - if ( m_pColorAttrList ) + if ( m_pColorAttrList.is() ) { - XFastAttributeListRef xAttrList( m_pColorAttrList.release() ); + XFastAttributeListRef xAttrList( m_pColorAttrList ); + m_pColorAttrList.clear(); m_pSerializer->singleElementNS( XML_w, XML_color, xAttrList ); } - if ( m_pEastAsianLayoutAttrList ) + if ( m_pEastAsianLayoutAttrList.is() ) { - XFastAttributeListRef xAttrList( m_pEastAsianLayoutAttrList.release() ); + XFastAttributeListRef xAttrList( m_pEastAsianLayoutAttrList ); + m_pEastAsianLayoutAttrList.clear(); m_pSerializer->singleElementNS( XML_w, XML_eastAsianLayout, xAttrList ); } - if ( m_pCharLangAttrList ) + if ( m_pCharLangAttrList.is() ) { - XFastAttributeListRef xAttrList( m_pCharLangAttrList.release() ); + XFastAttributeListRef xAttrList( m_pCharLangAttrList ); + m_pCharLangAttrList.clear(); m_pSerializer->singleElementNS( XML_w, XML_lang, xAttrList ); } @@ -2268,7 +2281,7 @@ bool DocxAttributeOutput::StartURL( const OUString& rUrl, const OUString& rTarge else { // Output a hyperlink XML element - m_pHyperlinkAttrList.reset(FastSerializerHelper::createAttrList()); + m_pHyperlinkAttrList = FastSerializerHelper::createAttrList(); if ( !bBookmarkOnly ) { @@ -2382,9 +2395,12 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData) // to the DOCX when the function 'WriteCollectedRunProperties' gets called. // So we need to store the current status of these lists, so that we can revert back to them when // we are done exporting the redline attributes. - std::unique_ptr pFontsAttrList_Original(m_pFontsAttrList.release()); - std::unique_ptr pEastAsianLayoutAttrList_Original(m_pEastAsianLayoutAttrList.release()); - std::unique_ptr pCharLangAttrList_Original(m_pCharLangAttrList.release()); + uno::Reference pFontsAttrList_Original(m_pFontsAttrList); + m_pFontsAttrList.clear(); + uno::Reference pEastAsianLayoutAttrList_Original(m_pEastAsianLayoutAttrList); + m_pEastAsianLayoutAttrList.clear(); + uno::Reference pCharLangAttrList_Original(m_pCharLangAttrList); + m_pCharLangAttrList.clear(); // Output the redline item set m_rExport.OutputItemSet( *pChangesSet, false, true, i18n::ScriptType::LATIN, m_rExport.m_bExportModeRTF ); @@ -2393,9 +2409,9 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData) WriteCollectedRunProperties(); // Revert back the original values that were stored in 'm_pFontsAttrList', 'm_pEastAsianLayoutAttrList', 'm_pCharLangAttrList' - m_pFontsAttrList.reset(pFontsAttrList_Original.release()); - m_pEastAsianLayoutAttrList.reset(pEastAsianLayoutAttrList_Original.release()); - m_pCharLangAttrList.reset(pCharLangAttrList_Original.release()); + m_pFontsAttrList = pFontsAttrList_Original; + m_pEastAsianLayoutAttrList = pEastAsianLayoutAttrList_Original; + m_pCharLangAttrList = pCharLangAttrList_Original; m_pSerializer->endElementNS( XML_w, XML_rPr ); @@ -2435,8 +2451,10 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData) // to the DOCX when the function 'WriteCollectedParagraphProperties' gets called. // So we need to store the current status of these lists, so that we can revert back to them when // we are done exporting the redline attributes. - std::unique_ptr pFlyAttrList_Original(m_rExport.SdrExporter().getFlyAttrList().release()); - std::unique_ptr pParagraphSpacingAttrList_Original(m_pParagraphSpacingAttrList.release()); + uno::Reference pFlyAttrList_Original(m_rExport.SdrExporter().getFlyAttrList()); + m_rExport.SdrExporter().getFlyAttrList().clear(); + uno::Reference pParagraphSpacingAttrList_Original(m_pParagraphSpacingAttrList); + m_pParagraphSpacingAttrList.clear(); // Output the redline item set m_rExport.OutputItemSet( *pChangesSet, true, false, i18n::ScriptType::LATIN, m_rExport.m_bExportModeRTF ); @@ -2445,8 +2463,8 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData) WriteCollectedParagraphProperties(); // Revert back the original values that were stored in 'm_rExport.SdrExporter().getFlyAttrList()', 'm_pParagraphSpacingAttrList' - m_rExport.SdrExporter().getFlyAttrList().reset(pFlyAttrList_Original.release()); - m_pParagraphSpacingAttrList.reset(pParagraphSpacingAttrList_Original.release()); + m_rExport.SdrExporter().getFlyAttrList() = pFlyAttrList_Original; + m_pParagraphSpacingAttrList = pParagraphSpacingAttrList_Original; m_pSerializer->endElementNS( XML_w, XML_pPr ); @@ -3452,7 +3470,7 @@ void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_ } else { - std::unique_ptr pAttrList; + css::uno::Reference pAttrList; for( aGrabBagElement = aGrabBag.begin(); aGrabBagElement != aGrabBag.end(); ++aGrabBagElement ) { @@ -3479,7 +3497,7 @@ void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_ else if( aGrabBagElement->first == "val") AddToAttrList( pAttrList, FSNS( XML_w, XML_val ), sValue.getStr() ); } - m_pSerializer->singleElementNS( XML_w, XML_shd, XFastAttributeListRef( pAttrList.release() ) ); + m_pSerializer->singleElementNS( XML_w, XML_shd, pAttrList ); } } @@ -5487,9 +5505,10 @@ void DocxAttributeOutput::StartSection() void DocxAttributeOutput::EndSection() { // Write the section properties - if ( m_pSectionSpacingAttrList ) + if ( m_pSectionSpacingAttrList.is() ) { - XFastAttributeListRef xAttrList( m_pSectionSpacingAttrList.release() ); + XFastAttributeListRef xAttrList( m_pSectionSpacingAttrList ); + m_pSectionSpacingAttrList.clear(); m_pSerializer->singleElementNS( XML_w, XML_pgMar, xAttrList ); } @@ -6126,7 +6145,7 @@ void DocxAttributeOutput::CharColor( const SvxColorItem& rColor ) aColorString = msfilter::util::ConvertColor( aColor ); const char* pExistingValue(NULL); - if (m_pColorAttrList && m_pColorAttrList->getAsChar(FSNS(XML_w, XML_val), pExistingValue)) + if (m_pColorAttrList.is() && m_pColorAttrList->getAsChar(FSNS(XML_w, XML_val), pExistingValue)) { assert(aColorString.equalsL(pExistingValue, rtl_str_getLength(pExistingValue))); return; @@ -7630,16 +7649,16 @@ void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush ) OString sOriginalFill = OUStringToOString( m_sOriginalBackgroundColor, RTL_TEXTENCODING_UTF8 ); - if( !m_pBackgroundAttrList ) + if( !m_pBackgroundAttrList.is() ) { - m_pBackgroundAttrList.reset(FastSerializerHelper::createAttrList()); + m_pBackgroundAttrList = FastSerializerHelper::createAttrList(); m_pBackgroundAttrList->add( FSNS( XML_w, XML_fill ), sColor.getStr() ); m_pBackgroundAttrList->add( FSNS( XML_w, XML_val ), "clear" ); } else if ( sOriginalFill != sColor ) { // fill was modified during edition, theme fill attribute must be dropped - m_pBackgroundAttrList.reset(FastSerializerHelper::createAttrList()); + m_pBackgroundAttrList = FastSerializerHelper::createAttrList(); m_pBackgroundAttrList->add( FSNS( XML_w, XML_fill ), sColor.getStr() ); m_pBackgroundAttrList->add( FSNS( XML_w, XML_val ), "clear" ); } @@ -8100,7 +8119,7 @@ void DocxAttributeOutput::ParaGrabBag(const SfxGrabBagItem& rItem) m_nParagraphSdtPrToken = FSNS( XML_w, XML_group ); else if (aPropertyValue.Name == "ooxml:CT_SdtPr_text") m_nParagraphSdtPrToken = FSNS(XML_w, XML_text); - else if (aPropertyValue.Name == "ooxml:CT_SdtPr_dataBinding" && !m_pParagraphSdtPrDataBindingAttrs) + else if (aPropertyValue.Name == "ooxml:CT_SdtPr_dataBinding" && !m_pParagraphSdtPrDataBindingAttrs.is()) { uno::Sequence aGrabBag; aPropertyValue.Value >>= aGrabBag; @@ -8203,25 +8222,25 @@ void DocxAttributeOutput::CharGrabBag( const SfxGrabBagItem& rItem ) OUString sOriginalValue; for ( std::map< OUString, com::sun::star::uno::Any >::const_iterator i = rMap.begin(); i != rMap.end(); ++i ) { - if ( m_pFontsAttrList && i->first == "CharThemeFontNameCs" ) + if ( m_pFontsAttrList.is() && i->first == "CharThemeFontNameCs" ) { if ( i->second >>= sOriginalValue ) bWriteCSTheme = ( m_pFontsAttrList->getOptionalValue( FSNS( XML_w, XML_cs ) ) == sOriginalValue ); } - else if ( m_pFontsAttrList && i->first == "CharThemeFontNameAscii" ) + else if ( m_pFontsAttrList.is() && i->first == "CharThemeFontNameAscii" ) { if ( i->second >>= sOriginalValue ) bWriteAsciiTheme = ( m_pFontsAttrList->getOptionalValue( FSNS( XML_w, XML_ascii ) ) == sOriginalValue ); } - else if ( m_pFontsAttrList && i->first == "CharThemeFontNameEastAsia" ) + else if ( m_pFontsAttrList.is() && i->first == "CharThemeFontNameEastAsia" ) { if ( i->second >>= sOriginalValue ) bWriteEastAsiaTheme = ( m_pFontsAttrList->getOptionalValue( FSNS( XML_w, XML_eastAsia ) ) == sOriginalValue ); } - else if ( m_pColorAttrList && i->first == "CharThemeOriginalColor" ) + else if ( m_pColorAttrList.is() && i->first == "CharThemeOriginalColor" ) { if ( i->second >>= sOriginalValue ) bWriteThemeFontColor = @@ -8335,7 +8354,7 @@ void DocxAttributeOutput::CharGrabBag( const SfxGrabBagItem& rItem ) OUStringToOString( sValue, RTL_TEXTENCODING_UTF8 ).getStr() ); } } - else if (aPropertyValue.Name == "ooxml:CT_SdtPr_dataBinding" && !m_pRunSdtPrDataBindingAttrs) + else if (aPropertyValue.Name == "ooxml:CT_SdtPr_dataBinding" && !m_pRunSdtPrDataBindingAttrs.is()) { uno::Sequence aGrabBag; aPropertyValue.Value >>= aGrabBag; @@ -8362,7 +8381,7 @@ void DocxAttributeOutput::CharGrabBag( const SfxGrabBagItem& rItem ) SAL_WARN("sw.ww8", "DocxAttributeOutput::CharGrabBag: unexpected sdt alias value"); } //do not overwrite the parent node. - else if (aPropertyValue.Name == "ooxml:CT_SdtPr_text" && !m_pRunSdtPrTokenChildren) + else if (aPropertyValue.Name == "ooxml:CT_SdtPr_text" && !m_pRunSdtPrTokenChildren.is()) m_nRunSdtPrToken = FSNS( XML_w, XML_text ); else if (aPropertyValue.Name == "ooxml:CT_SdtPr_id" && m_nRunSdtPrToken == 0) // only write id token as a marker if no other exist @@ -8512,6 +8531,29 @@ void DocxAttributeOutput::AddToAttrList( std::unique_ptr& pAttrList, sal_Int32 nAttrName, const sal_Char* sAttrValue ) +{ + AddToAttrList( pAttrList, 1, nAttrName, sAttrValue ); +} + +void DocxAttributeOutput::AddToAttrList( uno::Reference& pAttrList, sal_Int32 nAttrs, ... ) +{ + if( !pAttrList.is() ) + pAttrList = FastSerializerHelper::createAttrList(); + + va_list args; + va_start( args, nAttrs ); + for( sal_Int32 i = 0; iadd( nName, pValue ); + } + va_end( args ); +} + void DocxAttributeOutput::SetStartedParaSdt(bool bStartedParaSdt) { m_bStartedParaSdt = bStartedParaSdt; diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index b730c9fe375b..da5a263cae12 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -702,9 +702,9 @@ private: void WritePostponedCustomShape(); void WriteSdtBlock(sal_Int32& nSdtPrToken, - std::unique_ptr& pSdtPrTokenChildren, - std::unique_ptr& pSdtPrTokenAttributes, - std::unique_ptr& pSdtPrDataBindingAttrs, + css::uno::Reference& pSdtPrTokenChildren, + css::uno::Reference& pSdtPrTokenAttributes, + css::uno::Reference& pSdtPrDataBindingAttrs, OUString& rSdtPrAlias, bool bPara); /// Closes a currently open SDT block. @@ -717,13 +717,15 @@ private: static void AddToAttrList( std::unique_ptr& pAttrList, sal_Int32 nAttrName, const sal_Char* sAttrValue ); static void AddToAttrList( std::unique_ptr& pAttrList, sal_Int32 nArgs, ... ); - - std::unique_ptr m_pFontsAttrList; - std::unique_ptr m_pEastAsianLayoutAttrList; - std::unique_ptr m_pCharLangAttrList; - std::unique_ptr m_pSectionSpacingAttrList; - std::unique_ptr m_pParagraphSpacingAttrList; - std::unique_ptr m_pHyperlinkAttrList; + static void AddToAttrList( css::uno::Reference& pAttrList, sal_Int32 nAttrName, const sal_Char* sAttrValue ); + static void AddToAttrList( css::uno::Reference& pAttrList, sal_Int32 nArgs, ... ); + + css::uno::Reference m_pFontsAttrList; + css::uno::Reference m_pEastAsianLayoutAttrList; + css::uno::Reference m_pCharLangAttrList; + css::uno::Reference m_pSectionSpacingAttrList; + css::uno::Reference m_pParagraphSpacingAttrList; + css::uno::Reference m_pHyperlinkAttrList; /// If the current SDT around runs should be ended before the current run. bool m_bEndCharSdt; /// If an SDT around runs is currently open. @@ -731,9 +733,9 @@ private: /// If an SDT around paragraphs is currently open. bool m_bStartedParaSdt; /// Attributes of the run color - std::unique_ptr m_pColorAttrList; + css::uno::Reference m_pColorAttrList; /// Attributes of the paragraph background - std::unique_ptr m_pBackgroundAttrList; + css::uno::Reference m_pBackgroundAttrList; OUString m_sOriginalBackgroundColor; OUString m_hyperLinkAnchor; bool m_endPageRef; @@ -908,15 +910,15 @@ private: /// members to control the existence of grabbagged SDT properties in the paragraph sal_Int32 m_nParagraphSdtPrToken; - std::unique_ptr m_pParagraphSdtPrTokenChildren; - std::unique_ptr m_pParagraphSdtPrTokenAttributes; - std::unique_ptr m_pParagraphSdtPrDataBindingAttrs; + css::uno::Reference m_pParagraphSdtPrTokenChildren; + css::uno::Reference m_pParagraphSdtPrTokenAttributes; + css::uno::Reference m_pParagraphSdtPrDataBindingAttrs; /// members to control the existence of grabbagged SDT properties in the text run sal_Int32 m_nRunSdtPrToken; /// State of the Fly at current position FlyProcessingState m_nStateOfFlyFrame; - std::unique_ptr m_pRunSdtPrTokenChildren; - std::unique_ptr m_pRunSdtPrDataBindingAttrs; + css::uno::Reference m_pRunSdtPrTokenChildren; + css::uno::Reference m_pRunSdtPrDataBindingAttrs; /// Value of the paragraph SDT element. OUString m_aParagraphSdtPrAlias; /// Same as m_aParagraphSdtPrAlias, but its content is available till the SDT is closed. diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 824417174b22..3d89f7c9bde4 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -131,18 +131,18 @@ struct DocxSdrExport::Impl const Size* m_pFlyFrameSize; bool m_bTextFrameSyntax; bool m_bDMLTextFrameSyntax; - std::unique_ptr m_pFlyAttrList; - std::unique_ptr m_pTextboxAttrList; + uno::Reference m_pFlyAttrList; + uno::Reference m_pTextboxAttrList; OStringBuffer m_aTextFrameStyle; bool m_bFrameBtLr; bool m_bDrawingOpen; bool m_bParagraphSdtOpen; bool m_bParagraphHasDrawing; ///Flag for checking drawing in a paragraph. bool m_bFlyFrameGraphic; - std::unique_ptr m_pFlyFillAttrList; + css::uno::Reference m_pFlyFillAttrList; sax_fastparser::FastAttributeList* m_pFlyWrapAttrList; sax_fastparser::FastAttributeList* m_pBodyPrAttrList; - std::unique_ptr m_pDashLineStyleAttr; + css::uno::Reference m_pDashLineStyleAttr; bool m_bDMLAndVMLDrawingOpen; /// List of TextBoxes in this document: they are exported as part of their shape, never alone. std::set m_aTextBoxes; @@ -211,12 +211,12 @@ bool DocxSdrExport::getDMLTextFrameSyntax() return m_pImpl->m_bDMLTextFrameSyntax; } -std::unique_ptr& DocxSdrExport::getFlyAttrList() +uno::Reference& DocxSdrExport::getFlyAttrList() { return m_pImpl->m_pFlyAttrList; } -std::unique_ptr& DocxSdrExport::getTextboxAttrList() +uno::Reference& DocxSdrExport::getTextboxAttrList() { return m_pImpl->m_pTextboxAttrList; } @@ -256,7 +256,7 @@ void DocxSdrExport::setParagraphHasDrawing(bool bParagraphHasDrawing) m_pImpl->m_bParagraphHasDrawing = bParagraphHasDrawing; } -std::unique_ptr& DocxSdrExport::getFlyFillAttrList() +uno::Reference& DocxSdrExport::getFlyFillAttrList() { return m_pImpl->m_pFlyFillAttrList; } @@ -271,7 +271,7 @@ sax_fastparser::FastAttributeList* DocxSdrExport::getBodyPrAttrList() return m_pImpl->m_pBodyPrAttrList; } -std::unique_ptr& DocxSdrExport::getDashLineStyle() +uno::Reference& DocxSdrExport::getDashLineStyle() { return m_pImpl->m_pDashLineStyleAttr; } @@ -1640,8 +1640,8 @@ void DocxSdrExport::writeVMLTextFrame(sw::Frame* pParentFrame, bool bTextBoxOnly m_pImpl->m_pFlyFrameSize = &aSize; m_pImpl->m_bTextFrameSyntax = true; - m_pImpl->m_pFlyAttrList.reset(sax_fastparser::FastSerializerHelper::createAttrList()); - m_pImpl->m_pTextboxAttrList.reset(sax_fastparser::FastSerializerHelper::createAttrList()); + m_pImpl->m_pFlyAttrList = sax_fastparser::FastSerializerHelper::createAttrList(); + m_pImpl->m_pTextboxAttrList = sax_fastparser::FastSerializerHelper::createAttrList(); m_pImpl->m_aTextFrameStyle = "position:absolute"; if (!bTextBoxOnly) { @@ -1658,9 +1658,11 @@ void DocxSdrExport::writeVMLTextFrame(sw::Frame* pParentFrame, bool bTextBoxOnly if (!sAnchorId.isEmpty()) m_pImpl->m_pFlyAttrList->addNS(XML_w14, XML_anchorId, OUStringToOString(sAnchorId, RTL_TEXTENCODING_UTF8)); } - sax_fastparser::XFastAttributeListRef xFlyAttrList(m_pImpl->m_pFlyAttrList.release()); + sax_fastparser::XFastAttributeListRef xFlyAttrList(m_pImpl->m_pFlyAttrList.get()); + m_pImpl->m_pFlyAttrList.clear(); m_pImpl->m_bFrameBtLr = m_pImpl->checkFrameBtlr(m_pImpl->m_rExport.m_pDoc->GetNodes()[nStt], /*bDML=*/false); - sax_fastparser::XFastAttributeListRef xTextboxAttrList(m_pImpl->m_pTextboxAttrList.release()); + sax_fastparser::XFastAttributeListRef xTextboxAttrList(m_pImpl->m_pTextboxAttrList.get()); + m_pImpl->m_pTextboxAttrList.clear(); m_pImpl->m_bTextFrameSyntax = false; m_pImpl->m_pFlyFrameSize = 0; m_pImpl->m_rExport.m_pParentFrame = NULL; @@ -1670,14 +1672,16 @@ void DocxSdrExport::writeVMLTextFrame(sw::Frame* pParentFrame, bool bTextBoxOnly pFS->startElementNS(XML_w, XML_pict, FSEND); pFS->startElementNS(XML_v, XML_rect, xFlyAttrList); m_pImpl->textFrameShadow(rFrameFormat); - if (m_pImpl->m_pFlyFillAttrList) + if (m_pImpl->m_pFlyFillAttrList.is()) { - sax_fastparser::XFastAttributeListRef xFlyFillAttrList(m_pImpl->m_pFlyFillAttrList.release()); + sax_fastparser::XFastAttributeListRef xFlyFillAttrList(m_pImpl->m_pFlyFillAttrList.get()); + m_pImpl->m_pFlyFillAttrList.clear(); pFS->singleElementNS(XML_v, XML_fill, xFlyFillAttrList); } - if (m_pImpl->m_pDashLineStyleAttr) + if (m_pImpl->m_pDashLineStyleAttr.is()) { - sax_fastparser::XFastAttributeListRef xDashLineStyleAttr(m_pImpl->m_pDashLineStyleAttr.release()); + sax_fastparser::XFastAttributeListRef xDashLineStyleAttr(m_pImpl->m_pDashLineStyleAttr.get()); + m_pImpl->m_pDashLineStyleAttr.clear(); pFS->singleElementNS(XML_v, XML_stroke, xDashLineStyleAttr); } pFS->startElementNS(XML_v, XML_textbox, xTextboxAttrList); @@ -1717,7 +1721,7 @@ bool DocxSdrExport::Impl::checkFrameBtlr(SwNode* pStartNode, bool bDML) if (bDML) assert(m_pBodyPrAttrList); else - assert(m_pTextboxAttrList); + assert(m_pTextboxAttrList.is()); if (!pStartNode->IsTextNode()) return false; diff --git a/sw/source/filter/ww8/docxsdrexport.hxx b/sw/source/filter/ww8/docxsdrexport.hxx index 0a32f20fb555..a16c3d3c18c2 100644 --- a/sw/source/filter/ww8/docxsdrexport.hxx +++ b/sw/source/filter/ww8/docxsdrexport.hxx @@ -63,9 +63,9 @@ public: const Size* getFlyFrameSize(); bool getTextFrameSyntax(); bool getDMLTextFrameSyntax(); - std::unique_ptr& getFlyAttrList(); + css::uno::Reference& getFlyAttrList(); /// Attributes of the next v:textbox element. - std::unique_ptr& getTextboxAttrList(); + css::uno::Reference& getTextboxAttrList(); OStringBuffer& getTextFrameStyle(); /// Same, as DocxAttributeOutput::m_bBtLr, but for textframe rotation. bool getFrameBtLr(); @@ -77,12 +77,12 @@ public: bool IsDMLAndVMLDrawingOpen(); bool IsParagraphHasDrawing(); void setParagraphHasDrawing(bool bParagraphHasDrawing); - std::unique_ptr& getFlyFillAttrList(); + css::uno::Reference& getFlyFillAttrList(); sax_fastparser::FastAttributeList* getFlyWrapAttrList(); void setFlyWrapAttrList(sax_fastparser::FastAttributeList* pAttrList); /// Attributes of , used during DML export of text frames. sax_fastparser::FastAttributeList* getBodyPrAttrList(); - std::unique_ptr& getDashLineStyle(); + css::uno::Reference& getDashLineStyle(); void startDMLAnchorInline(const SwFrameFormat* pFrameFormat, const Size& rSize); void endDMLAnchorInline(const SwFrameFormat* pFrameFormat); diff --git a/sw/source/ui/vba/vbawindow.cxx b/sw/source/ui/vba/vbawindow.cxx index 54fd8f27eed7..8f2f3ab72680 100644 --- a/sw/source/ui/vba/vbawindow.cxx +++ b/sw/source/ui/vba/vbawindow.cxx @@ -44,18 +44,18 @@ SwVbaWindow::SwVbaWindow( void SwVbaWindow::Activate() throw (css::uno::RuntimeException, std::exception) { - SwVbaDocument document( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); + uno::Reference document( new SwVbaDocument(uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel) ); - document.Activate(); + document->Activate(); } void SwVbaWindow::Close( const uno::Any& SaveChanges, const uno::Any& RouteDocument ) throw (uno::RuntimeException, std::exception) { // FIXME: it is incorrect when there are more than 1 windows - SwVbaDocument document( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ); + uno::Reference document( new SwVbaDocument(uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel) ); uno::Any FileName; - document.Close(SaveChanges, FileName, RouteDocument ); + document->Close(SaveChanges, FileName, RouteDocument ); } uno::Any SAL_CALL @@ -69,8 +69,8 @@ void SAL_CALL SwVbaWindow::setView( const uno::Any& _view ) throw (uno::RuntimeE sal_Int32 nType = 0; if( _view >>= nType ) { - SwVbaView view( this, mxContext, m_xModel ); - view.setType( nType ); + uno::Reference view( new SwVbaView(this, mxContext, m_xModel) ); + view->setType( nType ); } } diff --git a/sw/source/uibase/config/StoredChapterNumbering.cxx b/sw/source/uibase/config/StoredChapterNumbering.cxx index 4fb902dd6503..1995bf3c0d66 100644 --- a/sw/source/uibase/config/StoredChapterNumbering.cxx +++ b/sw/source/uibase/config/StoredChapterNumbering.cxx @@ -426,7 +426,7 @@ void ExportStoredChapterNumberingRules(SwChapterNumRules & rRules, uno::Reference const xHandler( xWriter, uno::UNO_QUERY); - StoredChapterNumberingExport exp(xContext, rFileName, xWriter); + uno::Reference exp(new StoredChapterNumberingExport(xContext, rFileName, xWriter)); // if style name contains a space then name != display-name // ... and the import needs to map from name to display-name then! @@ -452,7 +452,7 @@ void ExportStoredChapterNumberingRules(SwChapterNumRules & rRules, try { - exp.ExportRules(charStyles, numRules); + exp->ExportRules(charStyles, numRules); } catch (uno::Exception const& e) { diff --git a/sw/source/uibase/dbui/dbtree.cxx b/sw/source/uibase/dbui/dbtree.cxx index 829a7afde7c4..9aaf094b3846 100644 --- a/sw/source/uibase/dbui/dbtree.cxx +++ b/sw/source/uibase/dbui/dbtree.cxx @@ -494,14 +494,14 @@ void SwDBTreeList::StartDrag( sal_Int8 /*nAction*/, const Point& /*rPosPixel*/ ) if( !sColumnName.isEmpty() ) { // drag database field - svx::OColumnTransferable aColTransfer( + uno::Reference< svx::OColumnTransferable > xColTransfer( new svx::OColumnTransferable( sDBName, OUString(), sdb::CommandType::TABLE, sTableName, sColumnName, - (ColumnTransferFormatFlags::FIELD_DESCRIPTOR|ColumnTransferFormatFlags::COLUMN_DESCRIPTOR) ); - aColTransfer.addDataToContainer( pContainer ); + (ColumnTransferFormatFlags::FIELD_DESCRIPTOR|ColumnTransferFormatFlags::COLUMN_DESCRIPTOR) ) ); + xColTransfer->addDataToContainer( pContainer ); } sDBName += "." + sTableName; diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index bc77db188351..3ee3518dd599 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -521,8 +521,8 @@ namespace cmis aParentUrl.removeSegment( ); OUString sParentUrl = aParentUrl.GetMainURL( INetURLObject::NO_DECODE ); - Content aParent( m_xContext, m_pProvider, new ucbhelper::ContentIdentifier( sParentUrl ) ); - libcmis::FolderPtr pParentFolder = boost::dynamic_pointer_cast< libcmis::Folder >( aParent.getObject( xEnv ) ); + uno::Reference xParent( new Content(m_xContext, m_pProvider, new ucbhelper::ContentIdentifier( sParentUrl )) ); + libcmis::FolderPtr pParentFolder = boost::dynamic_pointer_cast< libcmis::Folder >( xParent->getObject( xEnv ) ); if ( pParentFolder ) { vector< libcmis::ObjectPtr > children = pParentFolder->getChildren( ); diff --git a/ucb/source/ucp/tdoc/tdoc_storage.cxx b/ucb/source/ucp/tdoc/tdoc_storage.cxx index 31168a08d504..ea5f1e8acfc5 100644 --- a/ucb/source/ucp/tdoc/tdoc_storage.cxx +++ b/ucb/source/ucp/tdoc/tdoc_storage.cxx @@ -181,7 +181,7 @@ StorageElementFactory::createStorage( const OUString & rUri, bool bWritable = ( ( eMode == READ_WRITE_NOCREATE ) || ( eMode == READ_WRITE_CREATE ) ); - std::unique_ptr< Storage > xElement( + uno::Reference< Storage > xElement( new Storage( m_xContext, this, aUriKey, xParentStorage, xStorage ) ); aIt = m_aMap.insert( @@ -190,7 +190,6 @@ StorageElementFactory::createStorage( const OUString & rUri, xElement.get() ) ).first; aIt->second->m_aContainerIt = aIt; - xElement.release(); return aIt->second; } else if ( osl_atomic_increment( &aIt->second->m_refCount ) > 1 ) diff --git a/uui/source/requeststringresolver.hxx b/uui/source/requeststringresolver.hxx index 4a21456b603b..964883b62b9b 100644 --- a/uui/source/requeststringresolver.hxx +++ b/uui/source/requeststringresolver.hxx @@ -50,7 +50,7 @@ private: UUIInteractionHelper * m_pImpl; UUIInteractionRequestStringResolver(UUIInteractionRequestStringResolver &) SAL_DELETED_FUNCTION; - void operator =(UUIInteractionRequestStringResolver) SAL_DELETED_FUNCTION; + void operator =(UUIInteractionRequestStringResolver&) SAL_DELETED_FUNCTION; explicit UUIInteractionRequestStringResolver( com::sun::star::uno::Reference< diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx index 4568cb947145..5ce5e642c0ff 100644 --- a/writerfilter/source/filter/WriterFilter.cxx +++ b/writerfilter/source/filter/WriterFilter.cxx @@ -159,8 +159,8 @@ sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& aDesc try { // use the oox.core.FilterDetect implementation to extract the decrypted ZIP package - ::oox::core::FilterDetect aDetector(m_xContext); - xInputStream = aDetector.extractUnencryptedPackage(aMediaDesc); + uno::Reference<::oox::core::FilterDetect> xDetector(new ::oox::core::FilterDetect(m_xContext)); + xInputStream = xDetector->extractUnencryptedPackage(aMediaDesc); } catch (uno::Exception&) { diff --git a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx index 76c81f01d885..2d7ba7a2f39c 100644 --- a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx @@ -42,7 +42,7 @@ OOXMLFastDocumentHandler::OOXMLFastDocumentHandler( #endif , mpDocument( pDocument ) , mnXNoteId( nXNoteId ) - , mpContextHandler() + , mxContextHandler() { } @@ -119,20 +119,19 @@ throw (uno::RuntimeException, xml::sax::SAXException, std::exception) #endif } -OOXMLFastContextHandler::Pointer_t +uno::Reference< OOXMLFastContextHandler > OOXMLFastDocumentHandler::getContextHandler() const { - if (mpContextHandler == OOXMLFastContextHandler::Pointer_t()) + if (!mxContextHandler.is()) { - mpContextHandler.reset - (new OOXMLFastContextHandler(m_xContext)); - mpContextHandler->setStream(mpStream); - mpContextHandler->setDocument(mpDocument); - mpContextHandler->setXNoteId(mnXNoteId); - mpContextHandler->setForwardEvents(true); + mxContextHandler = new OOXMLFastContextHandler(m_xContext); + mxContextHandler->setStream(mpStream); + mxContextHandler->setDocument(mpDocument); + mxContextHandler->setXNoteId(mnXNoteId); + mxContextHandler->setForwardEvents(true); } - return mpContextHandler; + return mxContextHandler; } uno::Reference< xml::sax::XFastContextHandler > SAL_CALL diff --git a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx index 8678c07c9909..8a49e5d7fa93 100644 --- a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx +++ b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx @@ -97,8 +97,8 @@ private: #endif OOXMLDocumentImpl* mpDocument; sal_Int32 mnXNoteId; - mutable std::shared_ptr mpContextHandler; - std::shared_ptr getContextHandler() const; + mutable css::uno::Reference mxContextHandler; + css::uno::Reference getContextHandler() const; }; }} diff --git a/xmloff/source/meta/xmlversion.cxx b/xmloff/source/meta/xmlversion.cxx index 068449ec8e39..fa316026add5 100644 --- a/xmloff/source/meta/xmlversion.cxx +++ b/xmloff/source/meta/xmlversion.cxx @@ -351,9 +351,9 @@ void SAL_CALL XMLVersionListPersistence::store( const uno::Reference< embed::XSt Reference< XDocumentHandler > xHandler( xWriter, uno::UNO_QUERY ); - XMLVersionListExport aExp( xContext, rVersions, sVerName, xHandler ); + Reference< XMLVersionListExport > xExp( new XMLVersionListExport( xContext, rVersions, sVerName, xHandler ) ); - aExp.exportDoc( ::xmloff::token::XML_VERSION ); + xExp->exportDoc( ::xmloff::token::XML_VERSION ); xVerStream = uno::Reference< io::XStream >(); // use refcounting for now to dispose } -- cgit