summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-28 14:53:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-29 17:51:17 +0200
commit3823e81c25ba6f0f9b6a67d77e585426905e1b19 (patch)
treefa61ee28fb91300555b34475379cebc1cff054b8 /svx
parentee50d4152cc4a06367d66808ceba1e74e62f3ed8 (diff)
std::unique_ptr -> std::optional
Change-Id: I15779eca607f27a758575f4f095910277aa85eda Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116377 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdpage.cxx17
-rw-r--r--svx/source/xml/xmleohlp.cxx20
2 files changed, 18 insertions, 19 deletions
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index c1d412a7c207..dde75e15c28e 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -836,7 +836,7 @@ void SdrObjList::UnGroupObj( size_t nObjNum )
#endif
}
-bool SdrObjList::HasObjectNavigationOrder() const { return mxNavigationOrder != nullptr; }
+bool SdrObjList::HasObjectNavigationOrder() const { return bool(mxNavigationOrder); }
void SdrObjList::SetObjectNavigationPosition (
SdrObject& rObject,
@@ -845,12 +845,11 @@ void SdrObjList::SetObjectNavigationPosition (
// When the navigation order container has not yet been created then
// create one now. It is initialized with the z-order taken from
// maList.
- if (mxNavigationOrder == nullptr)
+ if (!mxNavigationOrder)
{
- mxNavigationOrder.reset(new std::vector<tools::WeakReference<SdrObject>>(maList.begin(),
- maList.end()));
+ mxNavigationOrder.emplace(maList.begin(), maList.end());
}
- OSL_ASSERT(mxNavigationOrder != nullptr);
+ OSL_ASSERT(bool(mxNavigationOrder));
OSL_ASSERT( mxNavigationOrder->size() == maList.size());
tools::WeakReference<SdrObject> aReference (&rObject);
@@ -927,7 +926,7 @@ bool SdrObjList::RecalcNavigationPositions()
{
if (mbIsNavigationOrderDirty)
{
- if (mxNavigationOrder != nullptr)
+ if (mxNavigationOrder)
{
mbIsNavigationOrderDirty = false;
@@ -940,7 +939,7 @@ bool SdrObjList::RecalcNavigationPositions()
}
}
- return mxNavigationOrder != nullptr;
+ return bool(mxNavigationOrder);
}
@@ -952,8 +951,8 @@ void SdrObjList::SetNavigationOrder (const uno::Reference<container::XIndexAcces
if (static_cast<sal_uInt32>(nCount) != maList.size())
return;
- if (mxNavigationOrder == nullptr)
- mxNavigationOrder.reset(new std::vector<tools::WeakReference<SdrObject>>(nCount));
+ if (!mxNavigationOrder)
+ mxNavigationOrder = std::vector<tools::WeakReference<SdrObject>>(nCount);
for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex)
{
diff --git a/svx/source/xml/xmleohlp.cxx b/svx/source/xml/xmleohlp.cxx
index 29192afe8fda..c63be9f109e0 100644
--- a/svx/source/xml/xmleohlp.cxx
+++ b/svx/source/xml/xmleohlp.cxx
@@ -430,10 +430,10 @@ OUString SvXMLEmbeddedObjectHelper::ImplInsertEmbeddedObjectURL(
OutputStorageWrapper_Impl *pOut = nullptr;
std::map< OUString, rtl::Reference<OutputStorageWrapper_Impl> >::iterator aIter;
- if( mpStreamMap )
+ if( mxStreamMap )
{
- aIter = mpStreamMap->find( rURLStr );
- if( aIter != mpStreamMap->end() && aIter->second.is() )
+ aIter = mxStreamMap->find( rURLStr );
+ if( aIter != mxStreamMap->end() && aIter->second.is() )
pOut = aIter->second.get();
}
@@ -450,7 +450,7 @@ OUString SvXMLEmbeddedObjectHelper::ImplInsertEmbeddedObjectURL(
if( pOut )
{
- mpStreamMap->erase( aIter );
+ mxStreamMap->erase( aIter );
}
}
else
@@ -576,18 +576,18 @@ Any SAL_CALL SvXMLEmbeddedObjectHelper::getByName(
if( SvXMLEmbeddedObjectHelperMode::Read == meCreateMode )
{
Reference < XOutputStream > xStrm;
- if( mpStreamMap )
+ if( mxStreamMap )
{
- auto aIter = mpStreamMap->find( rURLStr );
- if( aIter != mpStreamMap->end() && aIter->second.is() )
+ auto aIter = mxStreamMap->find( rURLStr );
+ if( aIter != mxStreamMap->end() && aIter->second.is() )
xStrm = aIter->second.get();
}
if( !xStrm.is() )
{
rtl::Reference<OutputStorageWrapper_Impl> xOut = new OutputStorageWrapper_Impl;
- if( !mpStreamMap )
- mpStreamMap.reset( new std::map< OUString, rtl::Reference<OutputStorageWrapper_Impl> > );
- (*mpStreamMap)[rURLStr] = xOut;
+ if( !mxStreamMap )
+ mxStreamMap.emplace();
+ (*mxStreamMap)[rURLStr] = xOut;
xStrm = xOut.get();
}