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

Aditya (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 4 13:00:40 UTC 2020


 cui/source/dialogs/cuigaldlg.cxx                 |    2 +-
 include/svx/gallery1.hxx                         |    2 ++
 include/svx/gallerybinaryengine.hxx              |    2 +-
 include/svx/gallerybinaryengineentry.hxx         |    2 ++
 include/svx/gallerystoragelocations.hxx          |    2 ++
 include/svx/galtheme.hxx                         |   10 +++-------
 svx/source/gallery2/gallery1.cxx                 |   17 ++++++-----------
 svx/source/gallery2/gallerybinaryengineentry.cxx |   12 ++++++++++++
 svx/source/gallery2/galtheme.cxx                 |    4 ----
 9 files changed, 29 insertions(+), 24 deletions(-)

New commits:
commit fa3f514f33d4beadabf8526278939ed51417918b
Author:     Aditya <adityasahu1511 at gmail.com>
AuthorDate: Thu Aug 27 15:55:46 2020 +0530
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Fri Sep 4 14:59:58 2020 +0200

    svx: Refactor Gallery::RemoveTheme()
    
    Introduce GalleryTheme::removeTheme() and GalleryBinaryEngine::removeTheme()
    
    Change-Id: Ic9c1b4fdb3e173d922635e5fd78d463e1f2c220a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101496
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index de0b0c1663f5..116dac39f0a6 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -534,7 +534,7 @@ void TPGalleryThemeGeneral::SetXChgData( ExchangeData* _pData )
         aType += CuiResId( RID_SVXSTR_GALLERY_READONLY );
 
     m_xFtMSShowType->set_label(aType);
-    m_xFtMSShowPath->set_label(pThm->GetSdgURL().GetMainURL(INetURLObject::DecodeMechanism::Unambiguous));
+    m_xFtMSShowPath->set_label(pThm->getThemeURL().GetMainURL(INetURLObject::DecodeMechanism::Unambiguous));
 
     // singular or plural?
     if ( 1 == pThm->GetObjectCount() )
diff --git a/include/svx/gallery1.hxx b/include/svx/gallery1.hxx
index f74a5b5882fb..3aa89cc4211d 100644
--- a/include/svx/gallery1.hxx
+++ b/include/svx/gallery1.hxx
@@ -78,6 +78,8 @@ public:
 
     sal_uInt32              GetId() const { return nId; }
     void                    SetId( sal_uInt32 nNewId, bool bResetThemeName );
+
+    void removeTheme();
 };
 
 class SfxListener;
diff --git a/include/svx/gallerybinaryengine.hxx b/include/svx/gallerybinaryengine.hxx
index bf13cecc9471..7423b7b29c95 100644
--- a/include/svx/gallerybinaryengine.hxx
+++ b/include/svx/gallerybinaryengine.hxx
@@ -19,7 +19,6 @@
 
 #pragma once
 
-#include <svx/galtheme.hxx>
 #include <svx/galmisc.hxx>
 #include <svx/svxdllapi.h>
 #include <svx/fmmodel.hxx>
@@ -67,6 +66,7 @@ public:
     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);
 
diff --git a/include/svx/gallerybinaryengineentry.hxx b/include/svx/gallerybinaryengineentry.hxx
index cd3023f71150..9b1f25a5b6b4 100644
--- a/include/svx/gallerybinaryengineentry.hxx
+++ b/include/svx/gallerybinaryengineentry.hxx
@@ -45,6 +45,8 @@ public:
     const INetURLObject& GetStrURL() const { return m_rGalleryStorageLocations.GetStrURL(); }
 
     static GalleryThemeEntry* CreateThemeEntry(const INetURLObject& rURL, bool bReadOnly);
+
+    void removeTheme();
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/gallerystoragelocations.hxx b/include/svx/gallerystoragelocations.hxx
index d2f4ab3fda48..dbc96207d11d 100644
--- a/include/svx/gallerystoragelocations.hxx
+++ b/include/svx/gallerystoragelocations.hxx
@@ -44,6 +44,8 @@ public:
     void SetStrExtension(INetURLObject& aURL);
 
     void SetStorageLocations(INetURLObject& aURL);
+
+    const INetURLObject& getThemeURL() const { return maSdgURL; }
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/galtheme.hxx b/include/svx/galtheme.hxx
index 97e8d6b63985..c15d03d14b02 100644
--- a/include/svx/galtheme.hxx
+++ b/include/svx/galtheme.hxx
@@ -22,6 +22,7 @@
 
 #include <svx/svxdllapi.h>
 #include <svx/galleryobjectcollection.hxx>
+#include <svx/gallerybinaryengine.hxx>
 
 #include <tools/debug.hxx>
 #include <tools/urlobj.hxx>
@@ -48,8 +49,6 @@ namespace unogallery
     class GalleryItem;
 }
 
-class GalleryBinaryEngine;
-
 class SVXCORE_DLLPUBLIC GalleryTheme : public SfxBroadcaster
 {
     friend class Gallery;
@@ -97,11 +96,6 @@ public:
     // used for building gallery themes during compilation:
     void                        SetDestDir(const OUString& rDestDir, bool bRelative);
 
-    SAL_DLLPRIVATE const INetURLObject& GetThmURL() const;
-    const INetURLObject&        GetSdgURL() const;
-    SAL_DLLPRIVATE const INetURLObject& GetSdvURL() const;
-    SAL_DLLPRIVATE const INetURLObject& GetStrURL() const;
-
     sal_uInt32                  GetId() const;
     SAL_DLLPRIVATE void         SetId( sal_uInt32 nNewId, bool bResetThemeName );
 
@@ -162,6 +156,8 @@ public:
 
     DateTime getModificationDate() const;
 
+    const INetURLObject& getThemeURL() const { return mpGalleryStorageEngine->getThemeURL(); }
+
 public:
 
     SAL_DLLPRIVATE SvStream&    ReadData( SvStream& rIn );
diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx
index 188abd2d995d..5e1182c46a4d 100644
--- a/svx/source/gallery2/gallery1.cxx
+++ b/svx/source/gallery2/gallery1.cxx
@@ -193,6 +193,10 @@ void GalleryThemeEntry::SetId( sal_uInt32 nNewId, bool bResetThemeName )
     bThemeNameFromResource = ( nId && bResetThemeName );
 }
 
+void GalleryThemeEntry::removeTheme()
+{
+    mpGalleryStorageEngineEntry->removeTheme();
+}
 
 class GalleryThemeCacheEntry
 {
@@ -615,17 +619,8 @@ bool Gallery::RemoveTheme( const OUString& rThemeName )
 
         if( pThm )
         {
-            INetURLObject   aThmURL( pThm->GetThmURL() );
-            INetURLObject   aSdgURL( pThm->GetSdgURL() );
-            INetURLObject   aSdvURL( pThm->GetSdvURL() );
-            INetURLObject   aStrURL( pThm->GetStrURL() );
-
-            ReleaseTheme( pThm, aListener );
-
-            KillFile( aThmURL );
-            KillFile( aSdgURL );
-            KillFile( aSdvURL );
-            KillFile( aStrURL );
+            ReleaseTheme(pThm, aListener);
+            pThemeEntry->removeTheme();
         }
 
         auto it = std::find_if(aThemeList.begin(), aThemeList.end(),
diff --git a/svx/source/gallery2/gallerybinaryengineentry.cxx b/svx/source/gallery2/gallerybinaryengineentry.cxx
index ee67b2a255b7..56c836677c3a 100644
--- a/svx/source/gallery2/gallerybinaryengineentry.cxx
+++ b/svx/source/gallery2/gallerybinaryengineentry.cxx
@@ -128,4 +128,16 @@ GalleryThemeEntry* GalleryBinaryEngineEntry::CreateThemeEntry(const INetURLObjec
     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);
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index 69f8f4f7557c..8486d6d4ad14 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -801,10 +801,6 @@ void GalleryTheme::ImplSetModified( bool bModified )
     pThm->SetModified(bModified);
 }
 
-const INetURLObject& GalleryTheme::GetThmURL() const { return pThm->GetThmURL(); }
-const INetURLObject& GalleryTheme::GetSdgURL() const { return pThm->GetSdgURL(); }
-const INetURLObject& GalleryTheme::GetSdvURL() const { return pThm->GetSdvURL(); }
-const INetURLObject& GalleryTheme::GetStrURL() const { return pThm->GetStrURL(); }
 sal_uInt32 GalleryTheme::GetId() const { return pThm->GetId(); }
 void GalleryTheme::SetId( sal_uInt32 nNewId, bool bResetThemeName ) { pThm->SetId( nNewId, bResetThemeName ); }
 bool GalleryTheme::IsReadOnly() const { return pThm->IsReadOnly(); }


More information about the Libreoffice-commits mailing list