[Libreoffice-commits] core.git: 2 commits - sw/inc sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Sep 18 07:07:56 UTC 2018
sw/inc/unotxdoc.hxx | 2 +-
sw/source/filter/ww8/ww8par4.cxx | 18 ++++++++----------
sw/source/uibase/uno/unotxdoc.cxx | 11 ++++-------
3 files changed, 13 insertions(+), 18 deletions(-)
New commits:
commit 83b840e6a08d7d990a4703b6ef67c3829c75aad4
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat Sep 15 17:16:42 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Sep 18 09:07:45 2018 +0200
loplugin:useuniqueptr in SwXTextDocument
Change-Id: I095e0b35d62fa0c82e7e171b2923431e06175558
Reviewed-on: https://gerrit.libreoffice.org/60614
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index d0ead1913fc1..0636dbfd5007 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -133,7 +133,7 @@ private:
class Impl;
::sw::UnoImplPtr<Impl> m_pImpl;
- std::deque<UnoActionContext*> aActionArr;
+ std::deque<std::unique_ptr<UnoActionContext>> maActionArr;
const SfxItemPropertySet* pPropSet;
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 369df2b014ed..0446bf4bac7c 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -545,25 +545,22 @@ void SwXTextDocument::lockControllers()
if(!IsValid())
throw DisposedException("", static_cast< XTextDocument* >(this));
- UnoActionContext* pContext = new UnoActionContext(pDocShell->GetDoc());
- aActionArr.push_front(pContext);
+ maActionArr.emplace_front(new UnoActionContext(pDocShell->GetDoc()));
}
void SwXTextDocument::unlockControllers()
{
SolarMutexGuard aGuard;
- if(aActionArr.empty())
+ if(maActionArr.empty())
throw RuntimeException("Nothing to unlock");
- UnoActionContext* pContext = aActionArr.front();
- aActionArr.pop_front();
- delete pContext;
+ maActionArr.pop_front();
}
sal_Bool SwXTextDocument::hasControllersLocked()
{
SolarMutexGuard aGuard;
- return !aActionArr.empty();
+ return !maActionArr.empty();
}
Reference< frame::XController > SwXTextDocument::getCurrentController()
commit 7e4e715ea3a05bbcbba78c8deaa0b339dfa42926
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sat Sep 15 17:08:36 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Sep 18 09:07:34 2018 +0200
loplugin:useuniqueptr in SwWW8ImplReader::InsertOle
Change-Id: Ibf84535dd24292e7c6f67b813224bfd4e02945cd
Reviewed-on: https://gerrit.libreoffice.org/60612
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx
index 1a7370f03da9..4732c0c16081 100644
--- a/sw/source/filter/ww8/ww8par4.cxx
+++ b/sw/source/filter/ww8/ww8par4.cxx
@@ -208,7 +208,7 @@ SwFlyFrameFormat* SwWW8ImplReader::InsertOle(SdrOle2Obj &rObject,
SwFlyFrameFormat *pRet = nullptr;
- SfxItemSet *pMathFlySet = nullptr;
+ std::unique_ptr<SfxItemSet> pMathFlySet;
uno::Reference < embed::XClassifiedObject > xClass( rObject.GetObjRef(), uno::UNO_QUERY );
if( xClass.is() )
{
@@ -216,8 +216,8 @@ SwFlyFrameFormat* SwWW8ImplReader::InsertOle(SdrOle2Obj &rObject,
if (SotExchange::IsMath(aClassName))
{
// StarMath sets it own fixed size, so its counter productive to use
- // the size word says it is. i.e. Don't attempt to override its size.
- pMathFlySet = new SfxItemSet(rFlySet);
+ // the size Word says it is. i.e. Don't attempt to override its size.
+ pMathFlySet.reset(new SfxItemSet(rFlySet));
pMathFlySet->ClearItem(RES_FRM_SIZE);
}
}
@@ -236,10 +236,9 @@ SwFlyFrameFormat* SwWW8ImplReader::InsertOle(SdrOle2Obj &rObject,
OSL_ENSURE(bSuccess, "Insert OLE failed");
if (bSuccess)
{
- const SfxItemSet *pFlySet = pMathFlySet ? pMathFlySet : &rFlySet;
+ const SfxItemSet *pFlySet = pMathFlySet ? pMathFlySet.get() : &rFlySet;
pRet = m_rDoc.getIDocumentContentOperations().InsertOLE(*m_pPaM, sNewName, rObject.GetAspect(), pFlySet, rGrfSet);
}
- delete pMathFlySet;
return pRet;
}
@@ -255,13 +254,13 @@ SwFrameFormat* SwWW8ImplReader::ImportOle(const Graphic* pGrf,
SdrObject* pRet = ImportOleBase(aGraph, pGrf, pFlySet, aVisArea );
// create flyset
- SfxItemSet* pTempSet = nullptr;
+ std::unique_ptr<SfxItemSet> pTempSet;
if( !pFlySet )
{
- pTempSet = new SfxItemSet( m_rDoc.GetAttrPool(), svl::Items<RES_FRMATR_BEGIN,
- RES_FRMATR_END-1>{});
+ pTempSet.reset( new SfxItemSet( m_rDoc.GetAttrPool(), svl::Items<RES_FRMATR_BEGIN,
+ RES_FRMATR_END-1>{}) );
- pFlySet = pTempSet;
+ pFlySet = pTempSet.get();
// Remove distance/borders
if (!m_bNewDoc)
@@ -305,7 +304,6 @@ SwFrameFormat* SwWW8ImplReader::ImportOle(const Graphic* pGrf,
*m_pPaM, OUString(), OUString(), &aGraph, pFlySet,
pGrfSet, nullptr);
}
- delete pTempSet;
return pFormat;
}
More information about the Libreoffice-commits
mailing list