include/svx/gallerybinaryengine.hxx         |   14 ++++++++++----
 svx/source/gallery2/gallerybinaryengine.cxx |   16 ++++++++++++++++
 svx/source/gallery2/galtheme.cxx            |    9 +--------
 3 files changed, 27 insertions(+), 12 deletions(-)

New commits:
commit 7429369678fdcf17c286b8c7238747b4a6b12866
Author:     Aditya <adityasahu1...@gmail.com>
AuthorDate: Thu Aug 27 16:29:09 2020 +0530
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Fri Sep 4 15:04:01 2020 +0200

    svx: Introduce GalleryBinaryEngine::getModificationDate()
    
    Also make GalleryBinaryEngine's functions GetSdgURL(), GetThmURL(), 
GetStrURL(),
     GetSdvURL() private to the class.
    Introduce getModificationDate() to GalleryBinaryEngine because that it 
where it
     belongs - it deals with URL
    
    Change-Id: Idd3c42e779652df030ae104e40581d9de1a07863
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101505
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/include/svx/gallerybinaryengine.hxx 
b/include/svx/gallerybinaryengine.hxx
index 7423b7b29c95..46322f5b99bf 100644
--- a/include/svx/gallerybinaryengine.hxx
+++ b/include/svx/gallerybinaryengine.hxx
@@ -27,6 +27,9 @@
 #include <tools/urlobj.hxx>
 #include <sot/storage.hxx>
 
+#include <tools/datetime.hxx>
+#include <unotools/datetime.hxx>
+
 #include <memory>
 
 class GalleryStorageLocations;
@@ -50,6 +53,11 @@ private:
     OUString m_aDestDir;
     bool m_bDestDirRelative;
 
+    const INetURLObject& GetSdgURL() const { return 
maGalleryStorageLocations.GetSdgURL(); }
+    const INetURLObject& GetSdvURL() const { return 
maGalleryStorageLocations.GetSdvURL(); }
+    const INetURLObject& GetStrURL() const { return 
maGalleryStorageLocations.GetStrURL(); }
+    const INetURLObject& GetThmURL() const { return 
maGalleryStorageLocations.GetThmURL(); }
+
 public:
     GalleryBinaryEngine(const GalleryStorageLocations& 
rGalleryStorageLocations,
                         GalleryObjectCollection& rGalleryObjectCollection, 
bool bReadOnly);
@@ -62,10 +70,6 @@ public:
     SAL_DLLPRIVATE void ImplCreateSvDrawStorage();
     SAL_DLLPRIVATE const tools::SvRef<SotStorage>& GetSvDrawStorage() const;
 
-    const INetURLObject& GetThmURL() const { return 
maGalleryStorageLocations.GetThmURL(); }
-    const INetURLObject& GetSdgURL() const { return 
maGalleryStorageLocations.GetSdgURL(); }
-    const INetURLObject& GetSdvURL() const { return 
maGalleryStorageLocations.GetSdvURL(); }
-    const INetURLObject& GetStrURL() const { return 
maGalleryStorageLocations.GetStrURL(); }
     const INetURLObject& getThemeURL() const { return 
maGalleryStorageLocations.getThemeURL(); }
 
     SAL_DLLPRIVATE bool implWrite(const GalleryTheme& rTheme, const 
GalleryThemeEntry* pThm);
@@ -98,6 +102,8 @@ public:
 
     SvStream& writeGalleryTheme(SvStream& rOStm, const GalleryTheme& rTheme,
                                 const GalleryThemeEntry* pThm);
+
+    DateTime getModificationDate() const;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/gallery2/gallerybinaryengine.cxx 
b/svx/source/gallery2/gallerybinaryengine.cxx
index 07cd79150eb8..298edd596001 100644
--- a/svx/source/gallery2/gallerybinaryengine.cxx
+++ b/svx/source/gallery2/gallerybinaryengine.cxx
@@ -40,6 +40,8 @@
 #include <comphelper/processfactory.hxx>
 #include <tools/urlobj.hxx>
 #include <tools/diagnose_ex.h>
+#include <tools/datetime.hxx>
+#include <unotools/datetime.hxx>
 #include <unotools/ucbstreamhelper.hxx>
 #include <unotools/streamwrap.hxx>
 #include <unotools/tempfile.hxx>
@@ -790,4 +792,18 @@ SvStream& GalleryBinaryEngine::writeGalleryTheme(SvStream& 
rOStm, const GalleryT
     return rOStm;
 }
 
+DateTime GalleryBinaryEngine::getModificationDate() const
+{
+    ::ucbhelper::Content 
aCnt(GetThmURL().GetMainURL(INetURLObject::DecodeMechanism::NONE),
+                              uno::Reference<ucb::XCommandEnvironment>(),
+                              comphelper::getProcessComponentContext());
+    util::DateTime aDateTimeModified;
+    DateTime aDateTime(DateTime::EMPTY);
+
+    aCnt.getPropertyValue("DateModified") >>= aDateTimeModified;
+    ::utl::typeConvert(aDateTimeModified, aDateTime);
+
+    return aDateTime;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index 8486d6d4ad14..fd395eeb0601 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -654,14 +654,7 @@ void GalleryTheme::CopyToClipboard(sal_uInt32 nPos)
 
 DateTime GalleryTheme::getModificationDate() const
 {
-    ::ucbhelper::Content 
aCnt(mpGalleryStorageEngine->GetThmURL().GetMainURL(INetURLObject::DecodeMechanism::NONE),
 uno::Reference< ucb::XCommandEnvironment >(), 
comphelper::getProcessComponentContext());
-    util::DateTime  aDateTimeModified;
-    DateTime        aDateTime(DateTime::EMPTY);
-
-    aCnt.getPropertyValue("DateModified") >>= aDateTimeModified;
-    ::utl::typeConvert(aDateTimeModified, aDateTime);
-
-    return aDateTime;
+    return mpGalleryStorageEngine->getModificationDate();
 }
 
 SvStream& GalleryTheme::ReadData( SvStream& rIStm )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to