[Libreoffice-commits] core.git: 2 commits - basic/source editeng/source include/editeng
Noel (via logerrit)
logerrit at kemper.freedesktop.org
Mon Feb 22 16:35:06 UTC 2021
basic/source/basmgr/basicmanagerrepository.cxx | 8 ++----
basic/source/classes/sbunoobj.cxx | 9 +++----
basic/source/inc/dlgcont.hxx | 4 +--
basic/source/inc/namecont.hxx | 4 +--
basic/source/inc/scriptcont.hxx | 4 +--
basic/source/uno/dlgcont.cxx | 10 +++-----
basic/source/uno/namecont.cxx | 12 ++++-----
basic/source/uno/scriptcont.cxx | 15 ++++--------
editeng/source/accessibility/AccessibleContextBase.cxx | 10 ++++----
editeng/source/accessibility/AccessibleEditableTextPara.cxx | 4 +--
editeng/source/accessibility/AccessibleHyperlink.cxx | 2 -
editeng/source/accessibility/AccessibleImageBullet.cxx | 2 -
editeng/source/editeng/impedit.cxx | 3 --
editeng/source/editeng/impedit2.cxx | 5 +---
editeng/source/misc/unolingu.cxx | 2 -
editeng/source/uno/unotext.cxx | 13 ++++------
editeng/source/uno/unotext2.cxx | 4 +--
editeng/source/xml/xmltxtexp.cxx | 2 -
editeng/source/xml/xmltxtimp.cxx | 5 +---
include/editeng/unolingu.hxx | 3 +-
20 files changed, 55 insertions(+), 66 deletions(-)
New commits:
commit 1571fd8bfdb1deb07b4d6a4abde4919d24550cea
Author: Noel <noel.grandin at collabora.co.uk>
AuthorDate: Mon Feb 22 12:12:37 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Feb 22 17:32:28 2021 +0100
loplugin:refcounting in basic
Change-Id: I0c1e41436ddae176695a90c120303727aa3bc2ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111306
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx
index 01ca8759e145..a70c49eb1149 100644
--- a/basic/source/basmgr/basicmanagerrepository.cxx
+++ b/basic/source/basmgr/basicmanagerrepository.cxx
@@ -292,15 +292,13 @@ namespace basic
pBasicManager->SetStorageName( aAppBasic.PathToFileName() );
// Basic container
- SfxScriptLibraryContainer* pBasicCont = new SfxScriptLibraryContainer( Reference< XStorage >() );
- Reference< XPersistentLibraryContainer > xBasicCont( pBasicCont );
+ rtl::Reference<SfxScriptLibraryContainer> pBasicCont = new SfxScriptLibraryContainer( Reference< XStorage >() );
pBasicCont->setBasicManager( pBasicManager );
// Dialog container
- SfxDialogLibraryContainer* pDialogCont = new SfxDialogLibraryContainer( Reference< XStorage >() );
- Reference< XPersistentLibraryContainer > xDialogCont( pDialogCont );
+ rtl::Reference<SfxDialogLibraryContainer> pDialogCont = new SfxDialogLibraryContainer( Reference< XStorage >() );
- LibraryContainerInfo aInfo( xBasicCont, xDialogCont, static_cast< OldBasicPassword* >( pBasicCont ) );
+ LibraryContainerInfo aInfo( pBasicCont, pDialogCont, static_cast< OldBasicPassword* >( pBasicCont.get() ) );
pBasicManager->SetLibraryContainerInfo( aInfo );
// global constants
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 2afc7ed52604..259cd5ae88f4 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -4048,8 +4048,7 @@ void SbRtl_CreateUnoListener(StarBASIC * pBasic, SbxArray & rPar, bool)
Reference< XInvocationAdapterFactory2 > xInvocationAdapterFactory =
InvocationAdapterFactory::create( xContext );
- BasicAllListener_Impl * p;
- Reference< XAllListener > xAllLst = p = new BasicAllListener_Impl( aPrefixName );
+ rtl::Reference<BasicAllListener_Impl> xAllLst = new BasicAllListener_Impl( aPrefixName );
Any aTmp;
Reference< XInterface > xLst = createAllListenerAdapter( xInvocationAdapterFactory, xClass, xAllLst, aTmp );
if( !xLst.is() )
@@ -4062,8 +4061,8 @@ void SbRtl_CreateUnoListener(StarBASIC * pBasic, SbxArray & rPar, bool)
return;
SbUnoObject* pUnoObj = new SbUnoObject( aListenerClassName, aTmp );
- p->xSbxObj = pUnoObj;
- p->xSbxObj->SetParent( pBasic );
+ xAllLst->xSbxObj = pUnoObj;
+ xAllLst->xSbxObj->SetParent( pBasic );
// #100326 Register listener object to set Parent NULL in Dtor
SbxArrayRef xBasicUnoListeners = pBasic->getUnoListeners();
@@ -4071,7 +4070,7 @@ void SbRtl_CreateUnoListener(StarBASIC * pBasic, SbxArray & rPar, bool)
// return the object
SbxVariableRef refVar = rPar.Get32(0);
- refVar->PutObject( p->xSbxObj.get() );
+ refVar->PutObject( xAllLst->xSbxObj.get() );
}
diff --git a/basic/source/inc/dlgcont.hxx b/basic/source/inc/dlgcont.hxx
index f9dbe2745c25..1152dd82b2b3 100644
--- a/basic/source/inc/dlgcont.hxx
+++ b/basic/source/inc/dlgcont.hxx
@@ -34,8 +34,8 @@ namespace basic
class SfxDialogLibraryContainer : public SfxLibraryContainer
{
// Methods to distinguish between different library types
- virtual SfxLibrary* implCreateLibrary( const OUString& aName ) override;
- virtual SfxLibrary* implCreateLibraryLink
+ virtual rtl::Reference<SfxLibrary> implCreateLibrary( const OUString& aName ) override;
+ virtual rtl::Reference<SfxLibrary> implCreateLibraryLink
( const OUString& aName, const OUString& aLibInfoFileURL,
const OUString& StorageURL, bool ReadOnly ) override;
virtual css::uno::Any createEmptyLibraryElement() override;
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index 56b688dd1271..5a3ce4afd09e 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -255,8 +255,8 @@ protected:
void implImportLibDescriptor( SfxLibrary* pLib, ::xmlscript::LibDescriptor const & rLib );
// Methods to distinguish between different library types
- virtual SfxLibrary* implCreateLibrary( const OUString& aName ) = 0;
- virtual SfxLibrary* implCreateLibraryLink
+ virtual rtl::Reference<SfxLibrary> implCreateLibrary( const OUString& aName ) = 0;
+ virtual rtl::Reference<SfxLibrary> implCreateLibraryLink
( const OUString& aName, const OUString& aLibInfoFileURL,
const OUString& StorageURL, bool ReadOnly ) = 0;
virtual css::uno::Any createEmptyLibraryElement() = 0;
diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx
index bc82a42ca915..17f3089f1092 100644
--- a/basic/source/inc/scriptcont.hxx
+++ b/basic/source/inc/scriptcont.hxx
@@ -34,8 +34,8 @@ class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPas
css::uno::Reference< css::container::XNameAccess > mxCodeNameAccess;
// Methods to distinguish between different library types
- virtual SfxLibrary* implCreateLibrary( const OUString& aName ) override;
- virtual SfxLibrary* implCreateLibraryLink
+ virtual rtl::Reference<SfxLibrary> implCreateLibrary( const OUString& aName ) override;
+ virtual rtl::Reference<SfxLibrary> implCreateLibraryLink
( const OUString& aName, const OUString& aLibInfoFileURL,
const OUString& StorageURL, bool ReadOnly ) override;
virtual css::uno::Any createEmptyLibraryElement() override;
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index 13055cb130e1..ff89a780c2f5 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -80,19 +80,17 @@ SfxDialogLibraryContainer::SfxDialogLibraryContainer( const uno::Reference< embe
}
// Methods to get library instances of the correct type
-SfxLibrary* SfxDialogLibraryContainer::implCreateLibrary( const OUString& aName )
+rtl::Reference<SfxLibrary> SfxDialogLibraryContainer::implCreateLibrary( const OUString& aName )
{
- SfxLibrary* pRet = new SfxDialogLibrary( maModifiable, aName, mxSFI, this );
- return pRet;
+ return new SfxDialogLibrary( maModifiable, aName, mxSFI, this );
}
-SfxLibrary* SfxDialogLibraryContainer::implCreateLibraryLink
+rtl::Reference<SfxLibrary> SfxDialogLibraryContainer::implCreateLibraryLink
( const OUString& aName, const OUString& aLibInfoFileURL,
const OUString& StorageURL, bool ReadOnly )
{
- SfxLibrary* pRet = new SfxDialogLibrary
+ return new SfxDialogLibrary
( maModifiable, aName, mxSFI, aLibInfoFileURL, StorageURL, ReadOnly, this );
- return pRet;
}
Any SfxDialogLibraryContainer::createEmptyLibraryElement()
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 806fbcf1a22d..28bdab04a298 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -2152,12 +2152,12 @@ sal_Bool SfxLibraryContainer::hasByName( const OUString& aName )
Reference< XNameContainer > SAL_CALL SfxLibraryContainer::createLibrary( const OUString& Name )
{
LibraryContainerMethodGuard aGuard( *this );
- SfxLibrary* pNewLib = implCreateLibrary( Name );
+ rtl::Reference<SfxLibrary> pNewLib = implCreateLibrary( Name );
pNewLib->maLibElementFileExtension = maLibElementFileExtension;
createVariableURL( pNewLib->maUnexpandedStorageURL, Name, maInfoFileName, true );
- Reference< XNameAccess > xNameAccess = static_cast< XNameAccess* >( pNewLib );
+ Reference< XNameAccess > xNameAccess( pNewLib );
Any aElement;
aElement <<= xNameAccess;
maNameContainer->insertByName( Name, aElement );
@@ -2181,17 +2181,17 @@ Reference< XNameAccess > SAL_CALL SfxLibraryContainer::createLibraryLink
checkStorageURL( StorageURL, aLibInfoFileURL, aLibDirURL, aUnexpandedStorageURL );
- SfxLibrary* pNewLib = implCreateLibraryLink( Name, aLibInfoFileURL, aLibDirURL, ReadOnly );
+ rtl::Reference<SfxLibrary> pNewLib = implCreateLibraryLink( Name, aLibInfoFileURL, aLibDirURL, ReadOnly );
pNewLib->maLibElementFileExtension = maLibElementFileExtension;
pNewLib->maUnexpandedStorageURL = aUnexpandedStorageURL;
pNewLib->maOriginalStorageURL = StorageURL;
uno::Reference< embed::XStorage > xDummyStor;
::xmlscript::LibDescriptor aLibDesc;
- implLoadLibraryIndexFile( pNewLib, aLibDesc, xDummyStor, OUString() );
- implImportLibDescriptor( pNewLib, aLibDesc );
+ implLoadLibraryIndexFile( pNewLib.get(), aLibDesc, xDummyStor, OUString() );
+ implImportLibDescriptor( pNewLib.get(), aLibDesc );
- Reference< XNameAccess > xRet = static_cast< XNameAccess* >( pNewLib );
+ Reference< XNameAccess > xRet( pNewLib );
Any aElement;
aElement <<= xRet;
maNameContainer->insertByName( Name, aElement );
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index 40c9c40ce6bc..eab8faf71735 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -105,20 +105,18 @@ SfxScriptLibraryContainer::SfxScriptLibraryContainer( const uno::Reference< embe
}
// Methods to get library instances of the correct type
-SfxLibrary* SfxScriptLibraryContainer::implCreateLibrary( const OUString& )
+rtl::Reference<SfxLibrary> SfxScriptLibraryContainer::implCreateLibrary( const OUString& )
{
- SfxLibrary* pRet = new SfxScriptLibrary( maModifiable, mxSFI );
- return pRet;
+ return new SfxScriptLibrary( maModifiable, mxSFI );
}
-SfxLibrary* SfxScriptLibraryContainer::implCreateLibraryLink( const OUString&,
+rtl::Reference<SfxLibrary> SfxScriptLibraryContainer::implCreateLibraryLink( const OUString&,
const OUString& aLibInfoFileURL,
const OUString& StorageURL,
bool ReadOnly )
{
- SfxLibrary* pRet = new SfxScriptLibrary( maModifiable, mxSFI,
+ return new SfxScriptLibrary( maModifiable, mxSFI,
aLibInfoFileURL, StorageURL, ReadOnly );
- return pRet;
}
Any SfxScriptLibraryContainer::createEmptyLibraryElement()
@@ -563,9 +561,8 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons
{
if ( xHandler.is() )
{
- ModuleSizeExceeded* pReq = new ModuleSizeExceeded( aNames );
- uno::Reference< task::XInteractionRequest > xReq( pReq );
- xHandler->handle( xReq );
+ rtl::Reference<ModuleSizeExceeded> pReq = new ModuleSizeExceeded( aNames );
+ xHandler->handle( pReq );
if ( pReq->isAbort() )
{
throw util::VetoException();
commit dc37866f3266f92c71bb4b3cec2b869069230c28
Author: Noel <noel.grandin at collabora.co.uk>
AuthorDate: Sun Feb 21 20:02:57 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Feb 22 17:30:15 2021 +0100
loplugin:refcounting in editeng
Change-Id: I7d00bede5dbf216e5d3d179a03b101322ae23e11
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111287
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx b/editeng/source/accessibility/AccessibleContextBase.cxx
index 72ac002c9940..6683d7eec29d 100644
--- a/editeng/source/accessibility/AccessibleContextBase.cxx
+++ b/editeng/source/accessibility/AccessibleContextBase.cxx
@@ -31,6 +31,7 @@
#include <comphelper/accessibleeventnotifier.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <osl/mutex.hxx>
+#include <rtl/ref.hxx>
#include <utility>
@@ -54,7 +55,7 @@ AccessibleContextBase::AccessibleContextBase (
maRole(aRole)
{
// Create the state set.
- ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper ();
+ rtl::Reference<::utl::AccessibleStateSetHelper> pStateSet = new ::utl::AccessibleStateSetHelper ();
mxStateSet = pStateSet;
// Set some states. Don't use the SetState method because no events
@@ -67,8 +68,7 @@ AccessibleContextBase::AccessibleContextBase (
pStateSet->AddState (AccessibleStateType::SELECTABLE);
// Create the relation set.
- ::utl::AccessibleRelationSetHelper* pRelationSet = new ::utl::AccessibleRelationSetHelper ();
- mxRelationSet = pRelationSet;
+ mxRelationSet = new ::utl::AccessibleRelationSetHelper ();
}
AccessibleContextBase::~AccessibleContextBase()
@@ -301,7 +301,7 @@ uno::Reference<XAccessibleRelationSet> SAL_CALL
uno::Reference<XAccessibleStateSet> SAL_CALL
AccessibleContextBase::getAccessibleStateSet()
{
- ::utl::AccessibleStateSetHelper* pStateSet = nullptr;
+ rtl::Reference<::utl::AccessibleStateSetHelper> pStateSet;
if (rBHelper.bDisposed)
{
@@ -319,7 +319,7 @@ uno::Reference<XAccessibleStateSet> SAL_CALL
pStateSet = new ::utl::AccessibleStateSetHelper (*pStateSet);
}
- return uno::Reference<XAccessibleStateSet>(pStateSet);
+ return pStateSet;
}
diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index a12bfe7232de..fa7c00b85a99 100644
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -125,7 +125,7 @@ namespace accessibility
try
{
// Create the state set.
- ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper ();
+ rtl::Reference<::utl::AccessibleStateSetHelper> pStateSet = new ::utl::AccessibleStateSetHelper ();
mxStateSet = pStateSet;
// these are always on
@@ -770,7 +770,7 @@ namespace accessibility
// and CONTENT_FLOWS_TO
if ( mpParaManager )
{
- utl::AccessibleRelationSetHelper* pAccRelSetHelper =
+ rtl::Reference<utl::AccessibleRelationSetHelper> pAccRelSetHelper =
new utl::AccessibleRelationSetHelper();
sal_Int32 nMyParaIndex( GetParagraphIndex() );
// relation CONTENT_FLOWS_FROM
diff --git a/editeng/source/accessibility/AccessibleHyperlink.cxx b/editeng/source/accessibility/AccessibleHyperlink.cxx
index a1c48f9693fb..25d9683fceff 100644
--- a/editeng/source/accessibility/AccessibleHyperlink.cxx
+++ b/editeng/source/accessibility/AccessibleHyperlink.cxx
@@ -82,7 +82,7 @@ namespace accessibility
if( isValid() && ( nIndex == 0 ) )
{
- ::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper = new ::comphelper::OAccessibleKeyBindingHelper();
+ rtl::Reference<::comphelper::OAccessibleKeyBindingHelper> pKeyBindingHelper = new ::comphelper::OAccessibleKeyBindingHelper();
xKeyBinding = pKeyBindingHelper;
awt::KeyStroke aKeyStroke;
diff --git a/editeng/source/accessibility/AccessibleImageBullet.cxx b/editeng/source/accessibility/AccessibleImageBullet.cxx
index b75d3f32194d..a5dc2b66bd92 100644
--- a/editeng/source/accessibility/AccessibleImageBullet.cxx
+++ b/editeng/source/accessibility/AccessibleImageBullet.cxx
@@ -65,7 +65,7 @@ namespace accessibility
try
{
// Create the state set.
- ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper ();
+ rtl::Reference<::utl::AccessibleStateSetHelper> pStateSet = new ::utl::AccessibleStateSetHelper ();
mxStateSet = pStateSet;
// these are always on
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index ac51af7597ab..216914946734 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -2619,8 +2619,7 @@ void ImpEditView::AddDragAndDropListeners()
if (!xDropTarget.is())
return;
- vcl::unohelper::DragAndDropWrapper* pDnDWrapper = new vcl::unohelper::DragAndDropWrapper(this);
- mxDnDListener = pDnDWrapper;
+ mxDnDListener = new vcl::unohelper::DragAndDropWrapper(this);
css::uno::Reference<css::datatransfer::dnd::XDragGestureRecognizer> xDragGestureRecognizer(xDropTarget, uno::UNO_QUERY);
if (xDragGestureRecognizer.is())
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 8ea35eb3e91f..2ea63b8d3cf5 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -3473,8 +3473,7 @@ uno::Reference< datatransfer::XTransferable > ImpEditEngine::CreateTransferable(
EditSelection aSelection( rSelection );
aSelection.Adjust( GetEditDoc() );
- EditDataObject* pDataObj = new EditDataObject;
- uno::Reference< datatransfer::XTransferable > xDataObj = pDataObj;
+ rtl::Reference<EditDataObject> pDataObj = new EditDataObject;
pDataObj->GetString() = convertLineEnd(GetSelected(aSelection), GetSystemLineEnd()); // System specific
@@ -3513,7 +3512,7 @@ uno::Reference< datatransfer::XTransferable > ImpEditEngine::CreateTransferable(
}
}
- return xDataObj;
+ return pDataObj;
}
EditSelection ImpEditEngine::PasteText( uno::Reference< datatransfer::XTransferable > const & rxDataObj, const OUString& rBaseURL, const EditPaM& rPaM, bool bUseSpecial )
diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx
index af32538f9702..a65af50b37e1 100644
--- a/editeng/source/misc/unolingu.cxx
+++ b/editeng/source/misc/unolingu.cxx
@@ -447,7 +447,7 @@ void LinguMgrExitLstnr::AtExit()
}
-LinguMgrExitLstnr * LinguMgr::pExitLstnr = nullptr;
+rtl::Reference<LinguMgrExitLstnr> LinguMgr::pExitLstnr;
bool LinguMgr::bExiting = false;
uno::Reference< XLinguServiceManager2 > LinguMgr::xLngSvcMgr;
uno::Reference< XSpellChecker1 > LinguMgr::xSpell;
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 9476ba7659c7..851efc127671 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -318,7 +318,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getStart()
if(pText == nullptr)
throw uno::RuntimeException();
- SvxUnoTextRange* pRange = new SvxUnoTextRange( *pText );
+ rtl::Reference<SvxUnoTextRange> pRange = new SvxUnoTextRange( *pText );
xRange = pRange;
ESelection aNewSel = maSelection;
@@ -346,7 +346,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getEnd()
if(pText == nullptr)
throw uno::RuntimeException();
- SvxUnoTextRange* pNew = new SvxUnoTextRange( *pText );
+ rtl::Reference<SvxUnoTextRange> pNew = new SvxUnoTextRange( *pText );
xRet = pNew;
ESelection aNewSel = maSelection;
@@ -1695,10 +1695,9 @@ uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextBase::getImplementationId()
uno::Reference< text::XTextCursor > SvxUnoTextBase::createTextCursorBySelection( const ESelection& rSel )
{
- SvxUnoTextCursor* pCursor = new SvxUnoTextCursor( *this );
- uno::Reference< text::XTextCursor > xCursor( pCursor );
+ rtl::Reference<SvxUnoTextCursor> pCursor = new SvxUnoTextCursor( *this );
pCursor->SetSelection( rSel );
- return xCursor;
+ return pCursor;
}
// XSimpleText
@@ -2059,7 +2058,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::finishParagraph(
ImplGetSvxUnoOutlinerTextCursorSfxPropertySet(), pTextForwarder, nPara );
pTextForwarder->QuickSetAttribs( aItemSet, aSel );
pEditSource->UpdateData();
- SvxUnoTextRange* pRange = new SvxUnoTextRange( *this );
+ rtl::Reference<SvxUnoTextRange> pRange = new SvxUnoTextRange( *this );
xRet = pRange;
pRange->SetSelection( aSel );
}
@@ -2104,7 +2103,7 @@ uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::appendTextPortion(
SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
ImplGetSvxTextPortionSfxPropertySet(), pTextForwarder, nPara );
pTextForwarder->QuickSetAttribs( aItemSet, aSel );
- SvxUnoTextRange* pRange = new SvxUnoTextRange( *this );
+ rtl::Reference<SvxUnoTextRange> pRange = new SvxUnoTextRange( *this );
xRet = pRange;
pRange->SetSelection( aSel );
for( const beans::PropertyValue& rProp : rCharAndParaProps )
diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx
index 04d63ea6b839..d88bb55daa9d 100644
--- a/editeng/source/uno/unotext2.cxx
+++ b/editeng/source/uno/unotext2.cxx
@@ -54,7 +54,7 @@ SvxUnoTextContentEnumeration::SvxUnoTextContentEnumeration( const SvxUnoTextBase
for( sal_Int32 currentPara = rSel.nStartPara; currentPara < maxParaIndex; currentPara++ )
{
const SvxUnoTextRangeBaseVec& rRanges( mpEditSource->getRanges() );
- SvxUnoTextContent* pContent = nullptr;
+ rtl::Reference<SvxUnoTextContent> pContent;
sal_Int32 nStartPos = 0;
sal_Int32 nEndPos = pTextForwarder->GetTextLen( currentPara );
if( currentPara == rSel.nStartPara )
@@ -404,7 +404,7 @@ SvxUnoTextRangeEnumeration::SvxUnoTextRangeEnumeration(const SvxUnoTextBase& rPa
ESelection aSel( nParagraph, nStartPos, nParagraph, nEndPos );
const SvxUnoTextRangeBaseVec& rRanges( mpEditSource->getRanges() );
- SvxUnoTextRange* pRange = nullptr;
+ rtl::Reference<SvxUnoTextRange> pRange;
for (auto const& elemRange : rRanges)
{
if (pRange)
diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx
index af20aeb2ffb0..4ad23b10abae 100644
--- a/editeng/source/xml/xmltxtexp.cxx
+++ b/editeng/source/xml/xmltxtexp.cxx
@@ -283,7 +283,7 @@ SvxXMLTextExportComponent::SvxXMLTextExportComponent(
};
static SvxItemPropertySet aSvxXMLTextExportComponentPropertySet( SvxXMLTextExportComponentPropertyMap, EditEngine::GetGlobalItemPool() );
- SvxUnoText* pUnoText = new SvxUnoText( &aEditSource, &aSvxXMLTextExportComponentPropertySet, mxText );
+ rtl::Reference<SvxUnoText> pUnoText = new SvxUnoText( &aEditSource, &aSvxXMLTextExportComponentPropertySet, mxText );
pUnoText->SetSelection( rSel );
mxText = pUnoText;
diff --git a/editeng/source/xml/xmltxtimp.cxx b/editeng/source/xml/xmltxtimp.cxx
index ff5a1e9b6131..f5532f009196 100644
--- a/editeng/source/xml/xmltxtimp.cxx
+++ b/editeng/source/xml/xmltxtimp.cxx
@@ -157,9 +157,8 @@ EditPaM SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection
ESelection aSel(rSel.nStartPara+1, 0, rSel.nEndPara+1, 0);
uno::Reference<text::XText > xParent;
- SvxUnoText* pUnoText = new SvxUnoText( &aEditSource, &aSvxXMLTextImportComponentPropertySet, xParent );
+ rtl::Reference<SvxUnoText> pUnoText = new SvxUnoText( &aEditSource, &aSvxXMLTextImportComponentPropertySet, xParent );
pUnoText->SetSelection( aSel );
- uno::Reference<text::XText > xText( pUnoText );
try
{
@@ -202,7 +201,7 @@ EditPaM SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection
*/
// uno::Reference< XDocumentHandler > xHandler( new SvxXMLXTextImportComponent( xText ) );
- rtl::Reference< SvxXMLXTextImportComponent > xImport( new SvxXMLXTextImportComponent( xContext, xText ) );
+ rtl::Reference< SvxXMLXTextImportComponent > xImport( new SvxXMLXTextImportComponent( xContext, pUnoText ) );
xml::sax::InputSource aParserInput;
aParserInput.aInputStream = xInputStream;
diff --git a/include/editeng/unolingu.hxx b/include/editeng/unolingu.hxx
index 3032b7b7dc74..3158af872e77 100644
--- a/include/editeng/unolingu.hxx
+++ b/include/editeng/unolingu.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_EDITENG_UNOLINGU_HXX
#include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <editeng/editengdllapi.h>
@@ -52,7 +53,7 @@ class EDITENG_DLLPUBLIC LinguMgr
static css::uno::Reference< css::linguistic2::XDictionary > xIgnoreAll;
static css::uno::Reference< css::linguistic2::XDictionary > xChangeAll;
- static LinguMgrExitLstnr *pExitLstnr;
+ static rtl::Reference<LinguMgrExitLstnr> pExitLstnr;
static bool bExiting;
static css::uno::Reference< css::linguistic2::XSpellChecker1 > GetSpell();
More information about the Libreoffice-commits
mailing list