[Libreoffice-commits] core.git: include/svx svx/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 23 14:29:24 UTC 2020


 include/svx/svdpage.hxx       |    3 +--
 svx/source/svdraw/svdpage.cxx |   29 +++++++++--------------------
 2 files changed, 10 insertions(+), 22 deletions(-)

New commits:
commit 4c7a3286fd05b1939acb45b2333c1ee927b0d4db
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Jun 23 14:01:00 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jun 23 16:28:43 2020 +0200

    inline typedef WeakSdrObjectContainerType
    
    Change-Id: Icdbdc73552b81a71d2551c36f54218deba6149bb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96949
    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 7d55b0fab697..d2fd71482476 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -226,10 +226,9 @@ public:
     virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
 
 private:
-    class WeakSdrObjectContainerType;
     /// This list, if it exists, defines the navigation order. If it does
     /// not exist then maList defines the navigation order.
-    std::unique_ptr<WeakSdrObjectContainerType> mxNavigationOrder;
+    std::unique_ptr<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/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 734becaf3c7d..489e20653fad 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -55,14 +55,6 @@
 
 using namespace ::com::sun::star;
 
-class SdrObjList::WeakSdrObjectContainerType
-    : public ::std::vector<tools::WeakReference<SdrObject>>
-{
-public:
-    explicit WeakSdrObjectContainerType (const sal_Int32 nInitialSize)
-        : ::std::vector<tools::WeakReference<SdrObject>>(nInitialSize) {};
-};
-
 static const sal_Int32 InitialObjectContainerCapacity (64);
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -841,11 +833,8 @@ void SdrObjList::SetObjectNavigationPosition (
     // maList.
     if (mxNavigationOrder == nullptr)
     {
-        mxNavigationOrder.reset(new WeakSdrObjectContainerType(maList.size()));
-        ::std::copy(
-            maList.begin(),
-            maList.end(),
-            mxNavigationOrder->begin());
+        mxNavigationOrder.reset(new std::vector<tools::WeakReference<SdrObject>>(maList.begin(),
+            maList.end()));
     }
     OSL_ASSERT(mxNavigationOrder != nullptr);
     OSL_ASSERT( mxNavigationOrder->size() == maList.size());
@@ -853,10 +842,10 @@ void SdrObjList::SetObjectNavigationPosition (
     tools::WeakReference<SdrObject> aReference (&rObject);
 
     // Look up the object whose navigation position is to be changed.
-    WeakSdrObjectContainerType::iterator iObject (::std::find(
+    auto iObject = ::std::find(
         mxNavigationOrder->begin(),
         mxNavigationOrder->end(),
-        aReference));
+        aReference);
     if (iObject == mxNavigationOrder->end())
     {
         // The given object is not a member of the navigation order.
@@ -950,7 +939,7 @@ void SdrObjList::SetNavigationOrder (const uno::Reference<container::XIndexAcces
             return;
 
         if (mxNavigationOrder == nullptr)
-            mxNavigationOrder.reset(new WeakSdrObjectContainerType(nCount));
+            mxNavigationOrder.reset(new std::vector<tools::WeakReference<SdrObject>>(nCount));
 
         for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex)
         {
@@ -1014,10 +1003,10 @@ void SdrObjList::ReplaceObjectInContainer (
         // the later object from/to the navigation order.
         OSL_ASSERT(nObjectPosition < maList.size());
         tools::WeakReference<SdrObject> aReference (maList[nObjectPosition]);
-        WeakSdrObjectContainerType::iterator iObject (::std::find(
+        auto iObject = ::std::find(
             mxNavigationOrder->begin(),
             mxNavigationOrder->end(),
-            aReference));
+            aReference);
         if (iObject != mxNavigationOrder->end())
             mxNavigationOrder->erase(iObject);
 
@@ -1044,10 +1033,10 @@ void SdrObjList::RemoveObjectFromContainer (
     if (HasObjectNavigationOrder())
     {
         tools::WeakReference<SdrObject> aReference (maList[nObjectPosition]);
-        WeakSdrObjectContainerType::iterator iObject (::std::find(
+        auto iObject = ::std::find(
             mxNavigationOrder->begin(),
             mxNavigationOrder->end(),
-            aReference));
+            aReference);
         if (iObject != mxNavigationOrder->end())
             mxNavigationOrder->erase(iObject);
         mbIsNavigationOrderDirty = true;


More information about the Libreoffice-commits mailing list