[Libreoffice-commits] core.git: include/svx scripting/source svx/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sat May 29 15:51:59 UTC 2021
include/svx/svdpage.hxx | 3 ++-
include/svx/xmleohlp.hxx | 5 +++--
scripting/source/provider/BrowseNodeFactoryImpl.cxx | 7 ++++---
svx/source/svdraw/svdpage.cxx | 17 ++++++++---------
svx/source/xml/xmleohlp.cxx | 20 ++++++++++----------
5 files changed, 27 insertions(+), 25 deletions(-)
New commits:
commit 3823e81c25ba6f0f9b6a67d77e585426905e1b19
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri May 28 14:53:19 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat May 29 17:51:17 2021 +0200
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 at collabora.co.uk>
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index ff936bd3a0a2..11d49191a017 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -32,6 +32,7 @@
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <svx/svdobj.hxx>
#include <memory>
+#include <optional>
#include <vector>
@@ -228,7 +229,7 @@ public:
private:
/// This list, if it exists, defines the navigation order. If it does
/// not exist then maList defines the navigation order.
- std::unique_ptr<std::vector<tools::WeakReference<SdrObject>>> mxNavigationOrder;
+ std::optional<std::vector<tools::WeakReference<SdrObject>>> mxNavigationOrder;
/// This flag is <TRUE/> when the mpNavigation list has been changed but
/// the indices of the referenced SdrObjects still have their old values.
diff --git a/include/svx/xmleohlp.hxx b/include/svx/xmleohlp.hxx
index ed64bd71522b..d252ee8e2d0f 100644
--- a/include/svx/xmleohlp.hxx
+++ b/include/svx/xmleohlp.hxx
@@ -31,6 +31,7 @@
#include <tools/stream.hxx>
#include <map>
#include <memory>
+#include <optional>
enum class SvXMLEmbeddedObjectHelperMode
{
@@ -57,8 +58,8 @@ class SVXCORE_DLLPUBLIC SvXMLEmbeddedObjectHelper final :
css::uno::Reference < css::embed::XStorage > mxTempStorage; // package
// objects
SvXMLEmbeddedObjectHelperMode meCreateMode;
- std::unique_ptr<std::map< OUString, rtl::Reference<OutputStorageWrapper_Impl> >>
- mpStreamMap;
+ std::optional<std::map< OUString, rtl::Reference<OutputStorageWrapper_Impl> >>
+ mxStreamMap;
SVX_DLLPRIVATE bool ImplGetStorageNames(
const OUString& rURLStr,
diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index 854dd312bd86..d3c1c1f0b394 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -38,6 +38,7 @@
#include <vector>
#include <algorithm>
#include <memory>
+#include <optional>
#include <string_view>
using namespace ::com::sun::star;
@@ -151,7 +152,7 @@ class LocationBrowseNode :
public ::cppu::WeakImplHelper< browse::XBrowseNode >
{
private:
- std::unique_ptr<std::unordered_map< OUString, Reference< browse::XBrowseNode > >> m_hBNA;
+ std::optional<std::unordered_map< OUString, Reference< browse::XBrowseNode > >> m_hBNA;
std::vector< OUString > m_vStr;
OUString m_sNodeName;
Reference< browse::XBrowseNode > m_origNode;
@@ -175,7 +176,7 @@ public:
virtual Sequence< Reference< browse::XBrowseNode > > SAL_CALL
getChildNodes() override
{
- if ( m_hBNA == nullptr )
+ if ( !m_hBNA )
{
loadChildNodes();
}
@@ -206,7 +207,7 @@ private:
void loadChildNodes()
{
- m_hBNA.reset( new std::unordered_map< OUString, Reference< browse::XBrowseNode > > );
+ m_hBNA.emplace();
const Sequence< Reference< browse::XBrowseNode > > langNodes =
m_origNode->getChildNodes();
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();
}
More information about the Libreoffice-commits
mailing list