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

Aditya (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 2 07:26:00 UTC 2020


 include/svx/gallery1.hxx                           |    1 
 include/svx/galleryobjectbinarystorage.hxx         |   35 ++++++++++++++++++++
 include/svx/galleryobjectcollection.hxx            |   21 +++++++++++-
 include/svx/galleryobjectstorage.hxx               |   32 ++++++++++++++++++
 include/svx/galleryobjectxmlstorage.hxx            |   35 ++++++++++++++++++++
 include/svx/galtheme.hxx                           |   24 ++------------
 svx/Library_svxcore.mk                             |    3 +
 svx/source/gallery2/gallerybinaryengine.cxx        |   36 ++++++++++++---------
 svx/source/gallery2/galleryobjectbinarystorage.cxx |   25 ++++++++++++++
 svx/source/gallery2/galleryobjectcollection.cxx    |   16 +++++++--
 svx/source/gallery2/galleryobjectstorage.cxx       |   24 ++++++++++++++
 svx/source/gallery2/galleryobjectxmlstorage.cxx    |   25 ++++++++++++++
 svx/source/gallery2/galmisc.cxx                    |    2 -
 svx/source/gallery2/galtheme.cxx                   |   21 +++++++-----
 svx/source/unogallery/unogalitem.cxx               |    2 -
 15 files changed, 251 insertions(+), 51 deletions(-)

New commits:
commit c640f745e8023660e89bca3e97308c0d53834b77
Author:     Aditya <adityasahu1511 at gmail.com>
AuthorDate: Tue Sep 1 14:56:51 2020 +0200
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Wed Sep 2 09:25:21 2020 +0200

    svx: Refactor GalleryObject member aURL
    
    The member aURL does not belong here and needs to be refactored,
    the reason is that there can be two type of URLs - XML and binary
    URL.
    
    Change-Id: Ieb4e57a6f144070f95282a7fd02d08bda6d11f3a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101084
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/include/svx/gallery1.hxx b/include/svx/gallery1.hxx
index 28ba3fe72eb4..9fa13929f4dd 100644
--- a/include/svx/gallery1.hxx
+++ b/include/svx/gallery1.hxx
@@ -31,7 +31,6 @@
 #include <memory>
 #include <vector>
 
-struct GalleryObject;
 class GalleryBinaryEngineEntry;
 class GalleryStorageLocations;
 
diff --git a/include/svx/galleryobjectbinarystorage.hxx b/include/svx/galleryobjectbinarystorage.hxx
new file mode 100644
index 000000000000..85dd9e22836c
--- /dev/null
+++ b/include/svx/galleryobjectbinarystorage.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <tools/urlobj.hxx>
+#include <svx/galleryobjectstorage.hxx>
+
+class GalleryObjectBinaryStorage : public GalleryObjectStorage
+{
+private:
+    INetURLObject m_aURL;
+
+public:
+    void setURL(INetURLObject aURL);
+    const INetURLObject& getURL() const { return m_aURL; }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/galleryobjectcollection.hxx b/include/svx/galleryobjectcollection.hxx
index 311434ec0352..8e322549b5eb 100644
--- a/include/svx/galleryobjectcollection.hxx
+++ b/include/svx/galleryobjectcollection.hxx
@@ -20,12 +20,30 @@
 #pragma once
 
 #include <svx/svxdllapi.h>
+#include <svx/galmisc.hxx>
+#include <svx/galleryobjectxmlstorage.hxx>
+#include <svx/galleryobjectbinarystorage.hxx>
 
+#include <vcl/bitmapex.hxx>
 #include <tools/urlobj.hxx>
 #include <memory>
 #include <vector>
 
-struct GalleryObject;
+struct GalleryObject
+{
+    std::unique_ptr<GalleryObjectStorage> m_pGalleryObjectStorage;
+    sal_uInt32 nOffset;
+    SgaObjKind eObjKind;
+    bool mbDelete;
+
+    //UI visualization buffering
+    BitmapEx maPreviewBitmapEx;
+    Size maPreparedSize;
+    OUString maTitle;
+    OUString maPath;
+
+    const INetURLObject& getURL() const { return m_pGalleryObjectStorage->getURL(); }
+};
 
 class SVXCORE_DLLPUBLIC GalleryObjectCollection
 {
@@ -42,6 +60,7 @@ public:
     const GalleryObject* searchObjectWithURL(const INetURLObject& rURL);
     const GalleryObject* getForPosition(sal_uInt32 nPos) const;
     sal_uInt32 searchPosWithObject(const GalleryObject* pObj);
+    const INetURLObject& getURLForPosition(sal_uInt32 nPos) const;
 
     void clear();
 
diff --git a/include/svx/galleryobjectstorage.hxx b/include/svx/galleryobjectstorage.hxx
new file mode 100644
index 000000000000..cdca68b14a8f
--- /dev/null
+++ b/include/svx/galleryobjectstorage.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <tools/urlobj.hxx>
+
+class GalleryObjectStorage
+{
+public:
+    virtual ~GalleryObjectStorage() = 0;
+    virtual const INetURLObject& getURL() const = 0;
+    virtual void setURL(INetURLObject aURL) = 0;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/galleryobjectxmlstorage.hxx b/include/svx/galleryobjectxmlstorage.hxx
new file mode 100644
index 000000000000..35a9384524f9
--- /dev/null
+++ b/include/svx/galleryobjectxmlstorage.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <tools/urlobj.hxx>
+#include <svx/galleryobjectstorage.hxx>
+
+class GalleryObjectXMLStorage : public GalleryObjectStorage
+{
+private:
+    INetURLObject m_aURL;
+
+public:
+    void setURL(INetURLObject aURL);
+    const INetURLObject& getURL() const { return m_aURL; }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/galtheme.hxx b/include/svx/galtheme.hxx
index 97da3322044f..cb8e7c1e1869 100644
--- a/include/svx/galtheme.hxx
+++ b/include/svx/galtheme.hxx
@@ -35,25 +35,9 @@ namespace weld { class ComboBox; }
 
 class SotStorageStream;
 
-struct GalleryObject
-{
-    INetURLObject   aURL;
-    sal_uInt32      nOffset;
-    SgaObjKind      eObjKind;
-    bool            mbDelete;
-
-    //UI visualization buffering
-    BitmapEx        maPreviewBitmapEx;
-    Size            maPreparedSize;
-    OUString        maTitle;
-    OUString        maPath;
-};
-
-
 class GalleryThemeEntry;
 class SgaObject;
 class FmFormModel;
-
 class Gallery;
 
 namespace unogallery
@@ -150,10 +134,10 @@ public:
     }
 
     SAL_DLLPRIVATE const INetURLObject& GetObjectURL(sal_uInt32 nPos) const
-                                {
-                                    DBG_ASSERT( nPos < GetObjectCount(), "Position out of range" );
-                                    return maGalleryObjectCollection.getForPosition( nPos )->aURL;
-                                }
+    {
+        DBG_ASSERT(nPos < GetObjectCount(), "Position out of range");
+        return maGalleryObjectCollection.getURLForPosition(nPos);
+    }
 
     SAL_DLLPRIVATE bool         GetThumb(sal_uInt32 nPos, BitmapEx& rBmp);
 
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 208effe3bef2..367aeea7dcb8 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -157,6 +157,9 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
     svx/source/gallery2/gallerystoragelocations \
     svx/source/gallery2/galleryobjectcollection \
     svx/source/gallery2/galleryfilestorage \
+    svx/source/gallery2/galleryobjectstorage \
+    svx/source/gallery2/galleryobjectbinarystorage \
+    svx/source/gallery2/galleryobjectxmlstorage \
     svx/source/items/chrtitem \
     svx/source/items/clipfmtitem \
     svx/source/items/customshapeitem \
diff --git a/svx/source/gallery2/gallerybinaryengine.cxx b/svx/source/gallery2/gallerybinaryengine.cxx
index 64e23a480781..07cd79150eb8 100644
--- a/svx/source/gallery2/gallerybinaryengine.cxx
+++ b/svx/source/gallery2/gallerybinaryengine.cxx
@@ -23,6 +23,7 @@
 #include <svx/gallerybinaryengine.hxx>
 #include <svx/galleryobjectcollection.hxx>
 #include <svx/gallery1.hxx>
+#include <svx/galleryobjectbinarystorage.hxx>
 #include <osl/thread.hxx>
 #include "codec.hxx"
 #include "gallerydrawmodel.hxx"
@@ -160,7 +161,8 @@ void GalleryBinaryEngine::removeObject(std::unique_ptr<GalleryObject>& pEntry)
         KillFile(GetSdgURL());
 
     if (SgaObjKind::SvDraw == pEntry->eObjKind)
-        GetSvDrawStorage()->Remove(pEntry->aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE));
+        GetSvDrawStorage()->Remove(
+            pEntry->getURL().GetMainURL(INetURLObject::DecodeMechanism::NONE));
 }
 
 std::unique_ptr<SgaObject> GalleryBinaryEngine::implReadSgaObject(GalleryObject const* pEntry)
@@ -209,7 +211,7 @@ std::unique_ptr<SgaObject> GalleryBinaryEngine::implReadSgaObject(GalleryObject
                 if (pSgaObj)
                 {
                     ReadSgaObject(*pIStm, *pSgaObj);
-                    pSgaObj->ImplUpdateURL(pEntry->aURL);
+                    pSgaObj->ImplUpdateURL(pEntry->getURL());
                 }
             }
         }
@@ -249,7 +251,9 @@ bool GalleryBinaryEngine::implWriteSgaObject(const SgaObject& rObj, sal_uInt32 n
             else
                 pEntry = pExistentEntry;
 
-            pEntry->aURL = rObj.GetURL();
+            pEntry->m_pGalleryObjectStorage = std::make_unique<GalleryObjectBinaryStorage>();
+            pEntry->m_pGalleryObjectStorage->setURL(rObj.GetURL());
+
             pEntry->nOffset = nOffset;
             pEntry->eObjKind = rObj.GetObjKind();
             bRet = true;
@@ -447,12 +451,14 @@ INetURLObject GalleryBinaryEngine::implCreateUniqueURL(SgaObjKind eObjKind,
 
             bExists = false;
 
-            for (auto const& p : mrGalleryObjectCollection.getObjectList())
-                if (p->aURL == aNewURL)
+            for (auto const& pObject : mrGalleryObjectCollection.getObjectList())
+            {
+                if (pObject->getURL() == aNewURL)
                 {
                     bExists = true;
                     break;
                 }
+            }
         }
         else
         {
@@ -526,7 +532,7 @@ SgaObjectSvDraw GalleryBinaryEngine::updateSvDrawObject(GalleryObject* pEntry)
 {
     if (GetSvDrawStorage().is())
     {
-        const OUString aStmName(GetSvDrawStreamNameFromURL(pEntry->aURL));
+        const OUString aStmName(GetSvDrawStreamNameFromURL(pEntry->getURL()));
         tools::SvRef<SotStorageStream> pIStm
             = GetSvDrawStorage()->OpenSotStream(aStmName, StreamMode::READ);
 
@@ -534,7 +540,7 @@ SgaObjectSvDraw GalleryBinaryEngine::updateSvDrawObject(GalleryObject* pEntry)
         {
             pIStm->SetBufferSize(16384);
 
-            SgaObjectSvDraw aNewObj(*pIStm, pEntry->aURL);
+            SgaObjectSvDraw aNewObj(*pIStm, pEntry->getURL());
 
             pIStm->SetBufferSize(0);
 
@@ -699,29 +705,29 @@ SvStream& GalleryBinaryEngine::writeGalleryTheme(SvStream& rOStm, const GalleryT
 
         if (SgaObjKind::SvDraw == pObj->eObjKind)
         {
-            aPath = GetSvDrawStreamNameFromURL(pObj->aURL);
+            aPath = GetSvDrawStreamNameFromURL(pObj->getURL());
             bRel = false;
         }
         else
         {
-            aPath = pObj->aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+            aPath = pObj->getURL().GetMainURL(INetURLObject::DecodeMechanism::NONE);
             aPath = aPath.copy(
                 0, std::min(rRelURL1.GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength(),
                             aPath.getLength()));
             bRel = aPath == rRelURL1.GetMainURL(INetURLObject::DecodeMechanism::NONE);
 
             if (bRel
-                && (pObj->aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength()
+                && (pObj->getURL().GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength()
                     > (rRelURL1.GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength() + 1)))
             {
-                aPath = pObj->aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+                aPath = pObj->getURL().GetMainURL(INetURLObject::DecodeMechanism::NONE);
                 aPath = aPath.copy(
                     std::min(rRelURL1.GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength(),
                              aPath.getLength()));
             }
             else
             {
-                aPath = pObj->aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+                aPath = pObj->getURL().GetMainURL(INetURLObject::DecodeMechanism::NONE);
                 aPath = aPath.copy(
                     0,
                     std::min(rRelURL2.GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength(),
@@ -729,17 +735,17 @@ SvStream& GalleryBinaryEngine::writeGalleryTheme(SvStream& rOStm, const GalleryT
                 bRel = aPath == rRelURL2.GetMainURL(INetURLObject::DecodeMechanism::NONE);
 
                 if (bRel
-                    && (pObj->aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength()
+                    && (pObj->getURL().GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength()
                         > (rRelURL2.GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength()
                            + 1)))
                 {
-                    aPath = pObj->aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+                    aPath = pObj->getURL().GetMainURL(INetURLObject::DecodeMechanism::NONE);
                     aPath = aPath.copy(std::min(
                         rRelURL2.GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength(),
                         aPath.getLength()));
                 }
                 else
-                    aPath = pObj->aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+                    aPath = pObj->getURL().GetMainURL(INetURLObject::DecodeMechanism::NONE);
             }
         }
 
diff --git a/svx/source/gallery2/galleryobjectbinarystorage.cxx b/svx/source/gallery2/galleryobjectbinarystorage.cxx
new file mode 100644
index 000000000000..c18ed6441df1
--- /dev/null
+++ b/svx/source/gallery2/galleryobjectbinarystorage.cxx
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <svx/galleryobjectbinarystorage.hxx>
+#include <tools/urlobj.hxx>
+
+void GalleryObjectBinaryStorage::setURL(INetURLObject aURL) { m_aURL = aURL; }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/gallery2/galleryobjectcollection.cxx b/svx/source/gallery2/galleryobjectcollection.cxx
index 5080ed334916..c5667eea2dca 100644
--- a/svx/source/gallery2/galleryobjectcollection.cxx
+++ b/svx/source/gallery2/galleryobjectcollection.cxx
@@ -26,9 +26,11 @@ void GalleryObjectCollection::clear() { m_aObjectList.clear(); }
 
 const GalleryObject* GalleryObjectCollection::searchObjectWithURL(const INetURLObject& rURL)
 {
-    for (auto const& i : m_aObjectList)
-        if (i->aURL == rURL)
-            return i.get();
+    for (auto const& pObject : m_aObjectList)
+    {
+        if (pObject->getURL() == rURL)
+            return pObject.get();
+    }
     return nullptr;
 }
 
@@ -47,4 +49,12 @@ const GalleryObject* GalleryObjectCollection::getForPosition(sal_uInt32 nPos) co
     return nullptr;
 }
 
+const INetURLObject& GalleryObjectCollection::getURLForPosition(sal_uInt32 nPos) const
+{
+    if (nPos < size())
+        return get(nPos)->getURL();
+    INetURLObject* aInvalidURL = new INetURLObject();
+    return *aInvalidURL;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/gallery2/galleryobjectstorage.cxx b/svx/source/gallery2/galleryobjectstorage.cxx
new file mode 100644
index 000000000000..2d324b3d0eb2
--- /dev/null
+++ b/svx/source/gallery2/galleryobjectstorage.cxx
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <svx/galleryobjectstorage.hxx>
+
+GalleryObjectStorage::~GalleryObjectStorage() = default;
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/gallery2/galleryobjectxmlstorage.cxx b/svx/source/gallery2/galleryobjectxmlstorage.cxx
new file mode 100644
index 000000000000..cadd94c03439
--- /dev/null
+++ b/svx/source/gallery2/galleryobjectxmlstorage.cxx
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <svx/galleryobjectxmlstorage.hxx>
+#include <tools/urlobj.hxx>
+
+void GalleryObjectXMLStorage::setURL(INetURLObject aURL) { m_aURL = aURL; }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx
index 8a5c7ac50ebf..946543e9082d 100644
--- a/svx/source/gallery2/galmisc.cxx
+++ b/svx/source/gallery2/galmisc.cxx
@@ -556,7 +556,7 @@ INetURLObject ImplGetURL(const GalleryObject* pObject)
     INetURLObject aURL;
 
     if (pObject)
-        aURL = pObject->aURL;
+        aURL = pObject->getURL();
 
     return aURL;
 }
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index c10041ee8471..476ad79f27e6 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -141,7 +141,7 @@ bool GalleryTheme::InsertObject(const SgaObject& rObj, sal_uInt32 nInsertPos)
     sal_uInt32 iFoundPos = 0;
     for (sal_uInt32 n = maGalleryObjectCollection.size(); iFoundPos < n; ++iFoundPos)
     {
-        if (maGalleryObjectCollection.get(iFoundPos)->aURL == rObj.GetURL())
+        if (maGalleryObjectCollection.get(iFoundPos)->getURL() == rObj.GetURL())
         {
             pFoundEntry = maGalleryObjectCollection.get(iFoundPos).get();
             break;
@@ -240,7 +240,7 @@ void GalleryTheme::Actualize( const Link<const INetURLObject&, void>& rActualize
 
         GalleryObject* pEntry = maGalleryObjectCollection.get(i).get();
 
-        const INetURLObject aURL( pEntry->aURL );
+        const INetURLObject aURL( pEntry->getURL());
 
         rActualizeLink.Call( aURL );
 
@@ -695,6 +695,9 @@ SvStream& GalleryTheme::ReadData( SvStream& rIStm )
 
             aFileName = OStringToOUString(aTempFileName, osl_getThreadTextEncoding());
 
+            pObj->m_pGalleryObjectStorage.reset();
+            pObj->m_pGalleryObjectStorage = std::make_unique<GalleryObjectBinaryStorage>();
+
             if( bRel )
             {
                 aFileName = aFileName.replaceAll( "\\", "/" );
@@ -705,9 +708,9 @@ SvStream& GalleryTheme::ReadData( SvStream& rIStm )
 
                 aPath += aFileName;
 
-                pObj->aURL = INetURLObject( aPath );
+                pObj->m_pGalleryObjectStorage->setURL(INetURLObject(aPath));
 
-                if( !FileExists( pObj->aURL ) )
+                if (!FileExists(pObj->getURL()))
                 {
                     aPath = aRelURL2.GetMainURL( INetURLObject::DecodeMechanism::NONE );
 
@@ -717,7 +720,7 @@ SvStream& GalleryTheme::ReadData( SvStream& rIStm )
                     aPath += aFileName;
 
                     // assign this URL, even in the case it is not valid (#94482)
-                    pObj->aURL = INetURLObject( aPath );
+                    pObj->m_pGalleryObjectStorage->setURL(INetURLObject(aPath));
                 }
             }
             else
@@ -725,18 +728,18 @@ SvStream& GalleryTheme::ReadData( SvStream& rIStm )
                 if( SgaObjKind::SvDraw == pObj->eObjKind )
                 {
                     OUString aDummyURL = "gallery/svdraw/" + aFileName;
-                    pObj->aURL = INetURLObject( aDummyURL, INetProtocol::PrivSoffice );
+                    pObj->m_pGalleryObjectStorage->setURL(INetURLObject(aDummyURL, INetProtocol::PrivSoffice));
                 }
                 else
                 {
                     OUString aLocalURL;
 
-                    pObj->aURL = INetURLObject( aFileName );
+                    pObj->m_pGalleryObjectStorage->setURL(INetURLObject(aFileName));
 
-                    if( ( pObj->aURL.GetProtocol() == INetProtocol::NotValid ) &&
+                    if( ( pObj->getURL().GetProtocol() == INetProtocol::NotValid ) &&
                         osl::FileBase::getFileURLFromSystemPath( aFileName, aLocalURL ) == osl::FileBase::E_None )
                     {
-                        pObj->aURL = INetURLObject( aLocalURL );
+                        pObj->m_pGalleryObjectStorage->setURL(INetURLObject(aLocalURL));
                     }
                 }
             }
diff --git a/svx/source/unogallery/unogalitem.cxx b/svx/source/unogallery/unogalitem.cxx
index 0749dfdd2f44..5c04c26cedb9 100644
--- a/svx/source/unogallery/unogalitem.cxx
+++ b/svx/source/unogallery/unogalitem.cxx
@@ -258,7 +258,7 @@ void GalleryItem::_getPropertyValues( const comphelper::PropertyMapEntry** ppEnt
                 ::GalleryTheme* pGalTheme = ( isValid() ? mpTheme->implGetTheme() : nullptr );
 
                 if( pGalTheme )
-                    *pValue <<= implGetObject()->aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );
+                    *pValue <<= implGetObject()->getURL().GetMainURL( INetURLObject::DecodeMechanism::NONE );
             }
             break;
 


More information about the Libreoffice-commits mailing list