compilerplugins/clang/mergeclasses.results       |    1 
 include/svx/gallery1.hxx                         |    6 
 svx/Library_svxcore.mk                           |    1 
 svx/inc/gallerybinaryengineentry.hxx             |   66 --------
 svx/inc/galleryfilestorageentry.hxx              |   42 +++++
 svx/source/gallery2/galini.cxx                   |    4 
 svx/source/gallery2/gallery1.cxx                 |    8 -
 svx/source/gallery2/gallerybinaryengineentry.cxx |  181 -----------------------
 svx/source/gallery2/galleryfilestorageentry.cxx  |  159 ++++++++++++++++++++
 9 files changed, 207 insertions(+), 261 deletions(-)

New commits:
commit afccbe23cecc04a08281a91e02bb25dd7b0ffdcf
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon May 8 12:30:36 2023 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Tue May 9 12:31:56 2023 +0200

    merge GalleryFileStorageEntry with GalleryBinaryEngineEntry
    
    Change-Id: I21b3f49cdf04b021931ab9e1171bfffa5cd76e1f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151552
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/compilerplugins/clang/mergeclasses.results 
b/compilerplugins/clang/mergeclasses.results
index e92d1bfc19b7..a1e8c6be6e3d 100644
--- a/compilerplugins/clang/mergeclasses.results
+++ b/compilerplugins/clang/mergeclasses.results
@@ -55,7 +55,6 @@ merge FmXDisposeListener with DisposeListenerGridBridge
 merge FmXFormShell_Base_Disambiguation with FmXFormShell
 merge GLWindow with GLX11Window
 merge GalleryFileStorage with GalleryBinaryEngine
-merge GalleryFileStorageEntry with GalleryBinaryEngineEntry
 merge GroupTable with PPTWriterBase
 merge HostDetailsContainer with DavDetailsContainer
 merge IDocumentChartDataProviderAccess with 
sw::DocumentChartDataProviderManager
diff --git a/include/svx/gallery1.hxx b/include/svx/gallery1.hxx
index 7b6fe2b23dc5..49427be4d723 100644
--- a/include/svx/gallery1.hxx
+++ b/include/svx/gallery1.hxx
@@ -31,7 +31,7 @@
 
 class Gallery;
 class GalleryBinaryEngine;
-class GalleryBinaryEngineEntry;
+class GalleryFileStorageEntry;
 class GalleryObjectCollection;
 class GalleryStorageLocations;
 class GalleryTheme;
@@ -40,7 +40,7 @@ class SVXCORE_DLLPUBLIC GalleryThemeEntry
 {
 private:
 
-    std::unique_ptr<GalleryBinaryEngineEntry>     mpGalleryStorageEngineEntry;
+    std::unique_ptr<GalleryFileStorageEntry> mpGalleryStorageEngineEntry;
     OUString                aName;
     sal_uInt32              nId;
     bool                    bReadOnly;
@@ -55,7 +55,7 @@ public:
                                                sal_uInt32 nId, bool 
bThemeNameFromResource );
     ~GalleryThemeEntry();
     
-    const std::unique_ptr<GalleryBinaryEngineEntry>& 
getGalleryStorageEngineEntry() const { return mpGalleryStorageEngineEntry; }
+    const std::unique_ptr<GalleryFileStorageEntry>& 
getGalleryStorageEngineEntry() const { return mpGalleryStorageEngineEntry; }
 
     GalleryStorageLocations& getGalleryStorageLocations() const;
 
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 757244f5f6d0..8dd99ef5484b 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -205,7 +205,6 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
     svx/source/gallery2/galtheme \
     svx/source/gallery2/GalleryControl \
     svx/source/gallery2/gallerybinaryengine \
-    svx/source/gallery2/gallerybinaryengineentry \
     svx/source/gallery2/galleryobjectcollection \
     svx/source/gallery2/galleryfilestorage \
     svx/source/gallery2/galleryfilestorageentry \
diff --git a/svx/inc/gallerybinaryengineentry.hxx 
b/svx/inc/gallerybinaryengineentry.hxx
deleted file mode 100644
index e21d6a64fea7..000000000000
--- a/svx/inc/gallerybinaryengineentry.hxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- 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/galtheme.hxx>
-#include "gallerybinaryengine.hxx"
-#include "gallerystoragelocations.hxx"
-#include "galleryfilestorageentry.hxx"
-
-class GalleryObjectCollection;
-class GalleryBinaryEngine;
-
-class GalleryBinaryEngineEntry final : public GalleryFileStorageEntry
-{
-private:
-    std::unique_ptr<GalleryStorageLocations> mpGalleryStorageLocations;
-
-public:
-    GalleryBinaryEngineEntry();
-    static void CreateUniqueURL(const INetURLObject& rBaseURL, INetURLObject& 
aURL);
-
-    OUString ReadStrFromIni(std::u16string_view aKeyName) const;
-
-    const INetURLObject& GetThmURL() const { return 
mpGalleryStorageLocations->GetThmURL(); }
-    const INetURLObject& GetSdgURL() const { return 
mpGalleryStorageLocations->GetSdgURL(); }
-    const INetURLObject& GetSdvURL() const { return 
mpGalleryStorageLocations->GetSdvURL(); }
-    const INetURLObject& GetStrURL() const { return 
mpGalleryStorageLocations->GetStrURL(); }
-
-    const std::unique_ptr<GalleryStorageLocations>& 
getGalleryStorageLocations() const
-    {
-        return mpGalleryStorageLocations;
-    }
-
-    static GalleryThemeEntry* CreateThemeEntry(const INetURLObject& rURL, bool 
bReadOnly);
-
-    void removeTheme();
-
-    std::unique_ptr<GalleryTheme>& 
getCachedTheme(std::unique_ptr<GalleryTheme>& pNewTheme);
-
-    void setStorageLocations(INetURLObject& rURL);
-
-    std::unique_ptr<GalleryBinaryEngine>
-    createGalleryStorageEngine(GalleryObjectCollection& 
mrGalleryObjectCollection, bool& bReadOnly);
-};
-
-SvStream& ReadGalleryTheme(SvStream& rIn, GalleryTheme& rTheme);
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/inc/galleryfilestorageentry.hxx 
b/svx/inc/galleryfilestorageentry.hxx
index 0f00cfb5a6ee..15f3a2f6faa4 100644
--- a/svx/inc/galleryfilestorageentry.hxx
+++ b/svx/inc/galleryfilestorageentry.hxx
@@ -19,10 +19,48 @@
 
 #pragma once
 
-class GalleryFileStorageEntry
+#include <tools/urlobj.hxx>
+#include <svx/galtheme.hxx>
+#include "gallerybinaryengine.hxx"
+#include "gallerystoragelocations.hxx"
+#include "galleryfilestorageentry.hxx"
+
+class GalleryObjectCollection;
+class GalleryBinaryEngine;
+
+class GalleryFileStorageEntry final
 {
+private:
+    std::unique_ptr<GalleryStorageLocations> mpGalleryStorageLocations;
+
 public:
-    virtual ~GalleryFileStorageEntry() = 0;
+    GalleryFileStorageEntry();
+    static void CreateUniqueURL(const INetURLObject& rBaseURL, INetURLObject& 
aURL);
+
+    OUString ReadStrFromIni(std::u16string_view aKeyName) const;
+
+    const INetURLObject& GetThmURL() const { return 
mpGalleryStorageLocations->GetThmURL(); }
+    const INetURLObject& GetSdgURL() const { return 
mpGalleryStorageLocations->GetSdgURL(); }
+    const INetURLObject& GetSdvURL() const { return 
mpGalleryStorageLocations->GetSdvURL(); }
+    const INetURLObject& GetStrURL() const { return 
mpGalleryStorageLocations->GetStrURL(); }
+
+    const std::unique_ptr<GalleryStorageLocations>& 
getGalleryStorageLocations() const
+    {
+        return mpGalleryStorageLocations;
+    }
+
+    static GalleryThemeEntry* CreateThemeEntry(const INetURLObject& rURL, bool 
bReadOnly);
+
+    void removeTheme();
+
+    std::unique_ptr<GalleryTheme>& 
getCachedTheme(std::unique_ptr<GalleryTheme>& pNewTheme);
+
+    void setStorageLocations(INetURLObject& rURL);
+
+    std::unique_ptr<GalleryBinaryEngine>
+    createGalleryStorageEngine(GalleryObjectCollection& 
mrGalleryObjectCollection, bool& bReadOnly);
 };
 
+SvStream& ReadGalleryTheme(SvStream& rIn, GalleryTheme& rTheme);
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/gallery2/galini.cxx b/svx/source/gallery2/galini.cxx
index 4eaf301d8edc..c88a7f4f2f8d 100644
--- a/svx/source/gallery2/galini.cxx
+++ b/svx/source/gallery2/galini.cxx
@@ -17,14 +17,14 @@
 #include <sal/log.hxx>
 
 #include <unotools/ucbstreamhelper.hxx>
-#include <gallerybinaryengineentry.hxx>
+#include <galleryfilestorageentry.hxx>
 #include <i18nlangtag/languagetag.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
 #include <o3tl/string_view.hxx>
 #include <memory>
 
-OUString GalleryBinaryEngineEntry::ReadStrFromIni(std::u16string_view aKeyName 
) const
+OUString GalleryFileStorageEntry::ReadStrFromIni(std::u16string_view aKeyName 
) const
 {
     std::unique_ptr<SvStream> pStrm(::utl::UcbStreamHelper::CreateStream(
         GetStrURL().GetMainURL( INetURLObject::DecodeMechanism::NONE ),
diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx
index 52fd3dd9b8bd..fbdf46acd6fd 100644
--- a/svx/source/gallery2/gallery1.cxx
+++ b/svx/source/gallery2/gallery1.cxx
@@ -43,7 +43,7 @@
 #include <svx/galmisc.hxx>
 #include <svx/galtheme.hxx>
 #include <svx/gallery1.hxx>
-#include <gallerybinaryengineentry.hxx>
+#include <galleryfilestorageentry.hxx>
 #include <vcl/weld.hxx>
 #include <com/sun/star/sdbc/XResultSet.hpp>
 #include <com/sun/star/ucb/XContentAccess.hpp>
@@ -121,10 +121,10 @@ GalleryThemeEntry::GalleryThemeEntry( bool 
bCreateUniqueURL,
 
     if (bCreateUniqueURL)
     {
-        GalleryBinaryEngineEntry::CreateUniqueURL(rBaseURL,aURL);
+        GalleryFileStorageEntry::CreateUniqueURL(rBaseURL,aURL);
     }
 
-    mpGalleryStorageEngineEntry = std::make_unique<GalleryBinaryEngineEntry>();
+    mpGalleryStorageEngineEntry = std::make_unique<GalleryFileStorageEntry>();
     setStorageLocations(aURL);
 
     SetModified( _bNewFile );
@@ -448,7 +448,7 @@ void Gallery::ImplLoadSubDirs( const INetURLObject& 
rBaseURL, bool& rbDirIsReadO
                                     }
                                 }
 
-                                GalleryThemeEntry* pEntry = 
GalleryBinaryEngineEntry::CreateThemeEntry( aThmURL, rbDirIsReadOnly || 
bReadOnly );
+                                GalleryThemeEntry* pEntry = 
GalleryFileStorageEntry::CreateThemeEntry( aThmURL, rbDirIsReadOnly || 
bReadOnly );
 
                                 if( pEntry )
                                     aThemeList.emplace_back( pEntry );
diff --git a/svx/source/gallery2/gallerybinaryengineentry.cxx 
b/svx/source/gallery2/gallerybinaryengineentry.cxx
deleted file mode 100644
index 9c222b1c15fe..000000000000
--- a/svx/source/gallery2/gallerybinaryengineentry.cxx
+++ /dev/null
@@ -1,181 +0,0 @@
-/* -*- 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 <gallerybinaryengineentry.hxx>
-#include <gallerystoragelocations.hxx>
-#include <svx/galmisc.hxx>
-#include <svx/gallery1.hxx>
-
-#include <unotools/ucbstreamhelper.hxx>
-#include <tools/urlobj.hxx>
-#include <tools/vcompat.hxx>
-
-#include <com/sun/star/ucb/ContentCreationException.hpp>
-
-static bool FileExists(const INetURLObject& rURL, std::u16string_view rExt)
-{
-    INetURLObject aURL(rURL);
-    aURL.setExtension(rExt);
-    return FileExists(aURL);
-}
-
-GalleryBinaryEngineEntry::GalleryBinaryEngineEntry()
-{
-    mpGalleryStorageLocations = std::make_unique<GalleryStorageLocations>();
-}
-
-void GalleryBinaryEngineEntry::setStorageLocations(INetURLObject& rURL)
-{
-    mpGalleryStorageLocations->SetStorageLocations(rURL);
-}
-
-std::unique_ptr<GalleryBinaryEngine> 
GalleryBinaryEngineEntry::createGalleryStorageEngine(
-    GalleryObjectCollection& mrGalleryObjectCollection, bool& bReadOnly)
-{
-    return std::make_unique<GalleryBinaryEngine>(*mpGalleryStorageLocations,
-                                                 mrGalleryObjectCollection, 
bReadOnly);
-}
-
-void GalleryBinaryEngineEntry::CreateUniqueURL(const INetURLObject& rBaseURL, 
INetURLObject& aURL)
-{
-    INetURLObject 
aBaseNoCase(GalleryStorageLocations::ImplGetURLIgnoreCase(rBaseURL));
-    aURL = aBaseNoCase;
-    static sal_Int32 nIdx = 0;
-    while (FileExists(aURL, u"thm"))
-    { // create new URLs
-        nIdx++;
-        aURL = aBaseNoCase;
-        aURL.setName(Concat2View(aURL.getName() + OUString::number(nIdx)));
-    }
-}
-
-GalleryThemeEntry* GalleryBinaryEngineEntry::CreateThemeEntry(const 
INetURLObject& rURL,
-                                                              bool bReadOnly)
-{
-    DBG_ASSERT(rURL.GetProtocol() != INetProtocol::NotValid, "invalid URL");
-
-    GalleryThemeEntry* pRet = nullptr;
-
-    if (FileExists(rURL))
-    {
-        std::unique_ptr<SvStream> pIStm(::utl::UcbStreamHelper::CreateStream(
-            rURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), 
StreamMode::READ));
-
-        if (pIStm)
-        {
-            sal_uInt16 nVersion;
-
-            pIStm->ReadUInt16(nVersion);
-
-            if (nVersion <= 0x00ff)
-            {
-                bool bThemeNameFromResource = false;
-                sal_uInt32 nThemeId = 0;
-
-                OString aTmpStr = 
read_uInt16_lenPrefixed_uInt8s_ToOString(*pIStm);
-                OUString aThemeName = OStringToOUString(aTmpStr, 
RTL_TEXTENCODING_UTF8);
-
-                // execute a character conversion
-                if (nVersion >= 0x0004)
-                {
-                    sal_uInt32 nCount;
-                    sal_uInt16 nTemp16;
-
-                    pIStm->ReadUInt32(nCount).ReadUInt16(nTemp16);
-                    pIStm->Seek(STREAM_SEEK_TO_END);
-
-                    // check whether there is a newer version;
-                    // therefore jump back by 520Bytes (8 bytes ID + 512Bytes 
reserve buffer)
-                    // if this is at all possible.
-                    if (pIStm->Tell() >= 520)
-                    {
-                        sal_uInt32 nId1, nId2;
-
-                        pIStm->SeekRel(-520);
-                        pIStm->ReadUInt32(nId1).ReadUInt32(nId2);
-
-                        if (nId1 == COMPAT_FORMAT('G', 'A', 'L', 'R')
-                            && nId2 == COMPAT_FORMAT('E', 'S', 'R', 'V'))
-                        {
-                            VersionCompatRead aCompat(*pIStm);
-
-                            pIStm->ReadUInt32(nThemeId);
-
-                            if (aCompat.GetVersion() >= 2)
-                            {
-                                pIStm->ReadCharAsBool(bThemeNameFromResource);
-                            }
-                        }
-                    }
-                }
-
-                pRet = new GalleryThemeEntry(false, rURL, aThemeName, 
bReadOnly, false, nThemeId,
-                                             bThemeNameFromResource);
-            }
-        }
-    }
-
-    return pRet;
-}
-
-void GalleryBinaryEngineEntry::removeTheme()
-{
-    INetURLObject aThmURL(GetThmURL());
-    INetURLObject aSdgURL(GetSdgURL());
-    INetURLObject aSdvURL(GetSdvURL());
-    INetURLObject aStrURL(GetStrURL());
-
-    KillFile(aThmURL);
-    KillFile(aSdgURL);
-    KillFile(aSdvURL);
-    KillFile(aStrURL);
-}
-
-std::unique_ptr<GalleryTheme>&
-GalleryBinaryEngineEntry::getCachedTheme(std::unique_ptr<GalleryTheme>& 
pNewTheme)
-{
-    INetURLObject aURL = GetThmURL();
-
-    DBG_ASSERT(aURL.GetProtocol() != INetProtocol::NotValid, "invalid URL");
-
-    if (FileExists(aURL))
-    {
-        std::unique_ptr<SvStream> pIStm(::utl::UcbStreamHelper::CreateStream(
-            aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), 
StreamMode::READ));
-
-        if (pIStm)
-        {
-            try
-            {
-                ReadGalleryTheme(*pIStm, *pNewTheme);
-
-                if (pIStm->GetError())
-                    pNewTheme.reset();
-            }
-            catch (const css::ucb::ContentCreationException&)
-            {
-            }
-        }
-    }
-    return pNewTheme;
-}
-
-SvStream& ReadGalleryTheme(SvStream& rIn, GalleryTheme& rTheme) { return 
rTheme.ReadData(rIn); }
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/gallery2/galleryfilestorageentry.cxx 
b/svx/source/gallery2/galleryfilestorageentry.cxx
index c0642145b2d8..abbc6efcaea1 100644
--- a/svx/source/gallery2/galleryfilestorageentry.cxx
+++ b/svx/source/gallery2/galleryfilestorageentry.cxx
@@ -18,7 +18,164 @@
  */
 
 #include <galleryfilestorageentry.hxx>
+#include <gallerystoragelocations.hxx>
+#include <svx/galmisc.hxx>
+#include <svx/gallery1.hxx>
 
-GalleryFileStorageEntry::~GalleryFileStorageEntry(){};
+#include <unotools/ucbstreamhelper.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/vcompat.hxx>
+
+#include <com/sun/star/ucb/ContentCreationException.hpp>
+
+static bool FileExists(const INetURLObject& rURL, std::u16string_view rExt)
+{
+    INetURLObject aURL(rURL);
+    aURL.setExtension(rExt);
+    return FileExists(aURL);
+}
+
+GalleryFileStorageEntry::GalleryFileStorageEntry()
+{
+    mpGalleryStorageLocations = std::make_unique<GalleryStorageLocations>();
+}
+
+void GalleryFileStorageEntry::setStorageLocations(INetURLObject& rURL)
+{
+    mpGalleryStorageLocations->SetStorageLocations(rURL);
+}
+
+std::unique_ptr<GalleryBinaryEngine> 
GalleryFileStorageEntry::createGalleryStorageEngine(
+    GalleryObjectCollection& mrGalleryObjectCollection, bool& bReadOnly)
+{
+    return std::make_unique<GalleryBinaryEngine>(*mpGalleryStorageLocations,
+                                                 mrGalleryObjectCollection, 
bReadOnly);
+}
+
+void GalleryFileStorageEntry::CreateUniqueURL(const INetURLObject& rBaseURL, 
INetURLObject& aURL)
+{
+    INetURLObject 
aBaseNoCase(GalleryStorageLocations::ImplGetURLIgnoreCase(rBaseURL));
+    aURL = aBaseNoCase;
+    static sal_Int32 nIdx = 0;
+    while (FileExists(aURL, u"thm"))
+    { // create new URLs
+        nIdx++;
+        aURL = aBaseNoCase;
+        aURL.setName(Concat2View(aURL.getName() + OUString::number(nIdx)));
+    }
+}
+
+GalleryThemeEntry* GalleryFileStorageEntry::CreateThemeEntry(const 
INetURLObject& rURL,
+                                                             bool bReadOnly)
+{
+    DBG_ASSERT(rURL.GetProtocol() != INetProtocol::NotValid, "invalid URL");
+
+    GalleryThemeEntry* pRet = nullptr;
+
+    if (FileExists(rURL))
+    {
+        std::unique_ptr<SvStream> pIStm(::utl::UcbStreamHelper::CreateStream(
+            rURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), 
StreamMode::READ));
+
+        if (pIStm)
+        {
+            sal_uInt16 nVersion;
+
+            pIStm->ReadUInt16(nVersion);
+
+            if (nVersion <= 0x00ff)
+            {
+                bool bThemeNameFromResource = false;
+                sal_uInt32 nThemeId = 0;
+
+                OString aTmpStr = 
read_uInt16_lenPrefixed_uInt8s_ToOString(*pIStm);
+                OUString aThemeName = OStringToOUString(aTmpStr, 
RTL_TEXTENCODING_UTF8);
+
+                // execute a character conversion
+                if (nVersion >= 0x0004)
+                {
+                    sal_uInt32 nCount;
+                    sal_uInt16 nTemp16;
+
+                    pIStm->ReadUInt32(nCount).ReadUInt16(nTemp16);
+                    pIStm->Seek(STREAM_SEEK_TO_END);
+
+                    // check whether there is a newer version;
+                    // therefore jump back by 520Bytes (8 bytes ID + 512Bytes 
reserve buffer)
+                    // if this is at all possible.
+                    if (pIStm->Tell() >= 520)
+                    {
+                        sal_uInt32 nId1, nId2;
+
+                        pIStm->SeekRel(-520);
+                        pIStm->ReadUInt32(nId1).ReadUInt32(nId2);
+
+                        if (nId1 == COMPAT_FORMAT('G', 'A', 'L', 'R')
+                            && nId2 == COMPAT_FORMAT('E', 'S', 'R', 'V'))
+                        {
+                            VersionCompatRead aCompat(*pIStm);
+
+                            pIStm->ReadUInt32(nThemeId);
+
+                            if (aCompat.GetVersion() >= 2)
+                            {
+                                pIStm->ReadCharAsBool(bThemeNameFromResource);
+                            }
+                        }
+                    }
+                }
+
+                pRet = new GalleryThemeEntry(false, rURL, aThemeName, 
bReadOnly, false, nThemeId,
+                                             bThemeNameFromResource);
+            }
+        }
+    }
+
+    return pRet;
+}
+
+void GalleryFileStorageEntry::removeTheme()
+{
+    INetURLObject aThmURL(GetThmURL());
+    INetURLObject aSdgURL(GetSdgURL());
+    INetURLObject aSdvURL(GetSdvURL());
+    INetURLObject aStrURL(GetStrURL());
+
+    KillFile(aThmURL);
+    KillFile(aSdgURL);
+    KillFile(aSdvURL);
+    KillFile(aStrURL);
+}
+
+std::unique_ptr<GalleryTheme>&
+GalleryFileStorageEntry::getCachedTheme(std::unique_ptr<GalleryTheme>& 
pNewTheme)
+{
+    INetURLObject aURL = GetThmURL();
+
+    DBG_ASSERT(aURL.GetProtocol() != INetProtocol::NotValid, "invalid URL");
+
+    if (FileExists(aURL))
+    {
+        std::unique_ptr<SvStream> pIStm(::utl::UcbStreamHelper::CreateStream(
+            aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), 
StreamMode::READ));
+
+        if (pIStm)
+        {
+            try
+            {
+                ReadGalleryTheme(*pIStm, *pNewTheme);
+
+                if (pIStm->GetError())
+                    pNewTheme.reset();
+            }
+            catch (const css::ucb::ContentCreationException&)
+            {
+            }
+        }
+    }
+    return pNewTheme;
+}
+
+SvStream& ReadGalleryTheme(SvStream& rIn, GalleryTheme& rTheme) { return 
rTheme.ReadData(rIn); }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to