[Libreoffice-commits] core.git: include/svx svx/qa svx/source
Aditya (via logerrit)
logerrit at kemper.freedesktop.org
Sun Sep 6 10:45:23 UTC 2020
include/svx/gallery1.hxx | 8 +++----
include/svx/gallerybinaryengineentry.hxx | 20 ++++++++++++------
svx/qa/unit/gallery/test_gallery.cxx | 2 -
svx/source/gallery2/gallery1.cxx | 10 +++------
svx/source/gallery2/gallerybinaryengineentry.cxx | 18 +++++++++++++---
svx/source/gallery2/gallerybinarystoragelocations.cxx | 10 ++++-----
svx/source/gallery2/galtheme.cxx | 2 -
7 files changed, 44 insertions(+), 26 deletions(-)
New commits:
commit 0e3b72ac75d9f9c70fe6e74e83a43ffa2635c777
Author: Aditya <adityasahu1511 at gmail.com>
AuthorDate: Fri Aug 28 20:39:41 2020 +0530
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sun Sep 6 12:44:41 2020 +0200
svx refactoring: Remove GalleryStorageLocations from GalleryThemeEntry
Change-Id: I3955a66b7ec4f463264dbb5db6209bbb667bf2b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101557
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/include/svx/gallery1.hxx b/include/svx/gallery1.hxx
index 81d22ac1e5ae..36f25a292877 100644
--- a/include/svx/gallery1.hxx
+++ b/include/svx/gallery1.hxx
@@ -39,7 +39,6 @@ class GalleryThemeEntry
private:
std::unique_ptr<GalleryBinaryEngineEntry> mpGalleryStorageEngineEntry;
- std::unique_ptr<GalleryStorageLocations> mpGalleryStorageLocations;
OUString aName;
sal_uInt32 nId;
bool bReadOnly;
@@ -53,11 +52,10 @@ public:
bool bReadOnly, bool bNewFile,
sal_uInt32 nId, bool bThemeNameFromResource );
- std::unique_ptr<GalleryBinaryEngineEntry> createGalleryStorageEngineEntry();
+ static std::unique_ptr<GalleryBinaryEngineEntry> createGalleryStorageEngineEntry();
const std::unique_ptr<GalleryBinaryEngineEntry>& getGalleryStorageEngineEntry() const { return mpGalleryStorageEngineEntry; }
- static std::unique_ptr<GalleryStorageLocations> createGalleryStorageLocations();
- const std::unique_ptr<GalleryStorageLocations>& getGalleryStorageLocations() const { return mpGalleryStorageLocations; }
+ GalleryStorageLocations& getGalleryStorageLocations() const { return *mpGalleryStorageEngineEntry->getGalleryStorageLocations(); }
const OUString& GetThemeName() const { return aName; }
@@ -79,6 +77,8 @@ public:
void removeTheme();
std::unique_ptr<GalleryTheme> getCachedTheme(Gallery* pGallery) const;
+
+ void setStorageLocations(INetURLObject& rURL);
};
class SfxListener;
diff --git a/include/svx/gallerybinaryengineentry.hxx b/include/svx/gallerybinaryengineentry.hxx
index 8039661e4dec..b0f8d7a447b3 100644
--- a/include/svx/gallerybinaryengineentry.hxx
+++ b/include/svx/gallerybinaryengineentry.hxx
@@ -32,24 +32,32 @@ class GalleryBinaryStorageLocations;
class GalleryBinaryEngineEntry : public GalleryFileStorageEntry
{
private:
- GalleryBinaryStorageLocations& m_rGalleryStorageLocations;
+ std::unique_ptr<GalleryBinaryStorageLocations> mpGalleryStorageLocations;
public:
- GalleryBinaryEngineEntry(GalleryBinaryStorageLocations& rGalleryStorageLocations);
+ GalleryBinaryEngineEntry();
static void CreateUniqueURL(const INetURLObject& rBaseURL, INetURLObject& aURL);
OUString ReadStrFromIni(const OUString& aKeyName);
- const INetURLObject& GetThmURL() const { return m_rGalleryStorageLocations.GetThmURL(); }
- const INetURLObject& GetSdgURL() const { return m_rGalleryStorageLocations.GetSdgURL(); }
- const INetURLObject& GetSdvURL() const { return m_rGalleryStorageLocations.GetSdvURL(); }
- const INetURLObject& GetStrURL() const { return m_rGalleryStorageLocations.GetStrURL(); }
+ 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(); }
+
+ static std::unique_ptr<GalleryBinaryStorageLocations> createGalleryStorageLocations();
+ const std::unique_ptr<GalleryBinaryStorageLocations>& 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);
};
SvStream& ReadGalleryTheme(SvStream& rIn, GalleryTheme& rTheme);
diff --git a/svx/qa/unit/gallery/test_gallery.cxx b/svx/qa/unit/gallery/test_gallery.cxx
index 83ccf600ed36..d9ae9150ceb1 100644
--- a/svx/qa/unit/gallery/test_gallery.cxx
+++ b/svx/qa/unit/gallery/test_gallery.cxx
@@ -258,7 +258,7 @@ void GalleryObjTest::TestGalleryThemeEntry()
// Check URLs
GalleryBinaryStorageLocations& aGalleryBinaryStorageLocations
- = dynamic_cast<GalleryBinaryStorageLocations&>(*mpThemeEntry->getGalleryStorageLocations());
+ = dynamic_cast<GalleryBinaryStorageLocations&>(mpThemeEntry->getGalleryStorageLocations());
INetURLObject aURL(aGalleryURL);
aURL.Append(myThemeName);
INetURLObject aThemeURL(aURL), aSdvURL(aURL), aSdgURL(aURL), aStrURL(aURL);
diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx
index aaa6b47ed918..d0a2da1836d7 100644
--- a/svx/source/gallery2/gallery1.cxx
+++ b/svx/source/gallery2/gallery1.cxx
@@ -122,9 +122,8 @@ GalleryThemeEntry::GalleryThemeEntry( bool bCreateUniqueURL,
{
GalleryBinaryEngineEntry::CreateUniqueURL(rBaseURL,aURL);
}
- mpGalleryStorageLocations = createGalleryStorageLocations();
mpGalleryStorageEngineEntry = createGalleryStorageEngineEntry();
- mpGalleryStorageLocations->SetStorageLocations(aURL);
+ setStorageLocations(aURL);
SetModified( _bNewFile );
@@ -164,14 +163,13 @@ GalleryThemeEntry::GalleryThemeEntry( bool bCreateUniqueURL,
std::unique_ptr<GalleryBinaryEngineEntry> GalleryThemeEntry::createGalleryStorageEngineEntry()
{
- std::unique_ptr<GalleryBinaryEngineEntry> pGalleryBinaryEngineEntry = std::make_unique<GalleryBinaryEngineEntry>(dynamic_cast<GalleryBinaryStorageLocations&>(*mpGalleryStorageLocations));
+ std::unique_ptr<GalleryBinaryEngineEntry> pGalleryBinaryEngineEntry = std::make_unique<GalleryBinaryEngineEntry>();
return pGalleryBinaryEngineEntry;
}
-std::unique_ptr<GalleryStorageLocations> GalleryThemeEntry::createGalleryStorageLocations()
+void GalleryThemeEntry::setStorageLocations(INetURLObject& rURL)
{
- std::unique_ptr<GalleryStorageLocations> pGalleryStorageLocations = std::make_unique<GalleryBinaryStorageLocations>();
- return pGalleryStorageLocations;
+ mpGalleryStorageEngineEntry->setStorageLocations(rURL);
}
void GalleryTheme::InsertAllThemes(weld::ComboBox& rListBox)
diff --git a/svx/source/gallery2/gallerybinaryengineentry.cxx b/svx/source/gallery2/gallerybinaryengineentry.cxx
index 1d669576dc98..5c7c81fb5790 100644
--- a/svx/source/gallery2/gallerybinaryengineentry.cxx
+++ b/svx/source/gallery2/gallerybinaryengineentry.cxx
@@ -41,10 +41,22 @@ static bool FileExists(const INetURLObject& rURL, const OUString& rExt)
return FileExists(aURL);
}
-GalleryBinaryEngineEntry::GalleryBinaryEngineEntry(
- GalleryBinaryStorageLocations& rGalleryStorageLocations)
- : m_rGalleryStorageLocations(rGalleryStorageLocations)
+GalleryBinaryEngineEntry::GalleryBinaryEngineEntry()
{
+ mpGalleryStorageLocations = createGalleryStorageLocations();
+}
+
+std::unique_ptr<GalleryBinaryStorageLocations>
+GalleryBinaryEngineEntry::createGalleryStorageLocations()
+{
+ std::unique_ptr<GalleryBinaryStorageLocations> pGalleryStorageLocations
+ = std::make_unique<GalleryBinaryStorageLocations>();
+ return pGalleryStorageLocations;
+}
+
+void GalleryBinaryEngineEntry::setStorageLocations(INetURLObject& rURL)
+{
+ mpGalleryStorageLocations->SetStorageLocations(rURL);
}
void GalleryBinaryEngineEntry::CreateUniqueURL(const INetURLObject& rBaseURL, INetURLObject& aURL)
diff --git a/svx/source/gallery2/gallerybinarystoragelocations.cxx b/svx/source/gallery2/gallerybinarystoragelocations.cxx
index cefb79d543a9..e8aaf88b1fee 100644
--- a/svx/source/gallery2/gallerybinarystoragelocations.cxx
+++ b/svx/source/gallery2/gallerybinarystoragelocations.cxx
@@ -64,12 +64,12 @@ void GalleryBinaryStorageLocations::SetStrExtension(INetURLObject& aURL)
maStrURL = ImplGetURLIgnoreCase(aURL);
}
-void GalleryBinaryStorageLocations::SetStorageLocations(INetURLObject& aURL)
+void GalleryBinaryStorageLocations::SetStorageLocations(INetURLObject& rURL)
{
- SetThmExtension(aURL);
- SetSdgExtension(aURL);
- SetSdvExtension(aURL);
- SetStrExtension(aURL);
+ SetThmExtension(rURL);
+ SetSdgExtension(rURL);
+ SetSdvExtension(rURL);
+ SetStrExtension(rURL);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index c0fb25b430ce..69a09b84c2ee 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -96,7 +96,7 @@ void GalleryTheme::SetDestDir(const OUString& rDestDir, bool bRelative)
std::unique_ptr<GalleryBinaryEngine> GalleryTheme::createGalleryStorageEngine(bool bReadOnly)
{
- std::unique_ptr<GalleryBinaryEngine> pGalleryBinaryEngine = std::make_unique<GalleryBinaryEngine>(dynamic_cast<GalleryBinaryStorageLocations&>(*pThm->getGalleryStorageLocations()), maGalleryObjectCollection, bReadOnly);
+ std::unique_ptr<GalleryBinaryEngine> pGalleryBinaryEngine = std::make_unique<GalleryBinaryEngine>(dynamic_cast<GalleryBinaryStorageLocations&>(pThm->getGalleryStorageLocations()), maGalleryObjectCollection, bReadOnly);
return pGalleryBinaryEngine;
}
More information about the Libreoffice-commits
mailing list