summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorAditya <adityasahu1511@gmail.com>2020-08-30 02:27:32 +0530
committerTomaž Vajngerl <quikee@gmail.com>2020-09-06 22:41:52 +0200
commit8c5c8d42d5cee83e00e3ecf00a55c8f42e0b169e (patch)
tree352ac074ac01fa5fcd8f8f31c2f0c6a950226a65 /svx
parent7b4b1cb7c753fadbc20892ef8cc961b7a61e8d19 (diff)
svx: Introduce createGalleryTheme() to GalleryThemeEntry
Let GalleryThemeEntry initialize GalleryTheme. Change-Id: Ib81d95faf6561604a30a7d0a3d9dae808c83a398 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101655 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/gallery2/gallery1.cxx21
-rw-r--r--svx/source/gallery2/gallerybinaryengineentry.cxx7
-rw-r--r--svx/source/gallery2/galtheme.cxx8
3 files changed, 24 insertions, 12 deletions
diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx
index 7eee341227eb..750fd1491220 100644
--- a/svx/source/gallery2/gallery1.cxx
+++ b/svx/source/gallery2/gallery1.cxx
@@ -36,6 +36,7 @@
#include <unotools/pathoptions.hxx>
#include <svx/dialmgr.hxx>
#include <svx/gallery.hxx>
+#include <svx/galleryobjectcollection.hxx>
#include <svx/strings.hrc>
#include <strings.hxx>
#include <svx/galmisc.hxx>
@@ -162,11 +163,21 @@ GalleryThemeEntry::GalleryThemeEntry( bool bCreateUniqueURL,
aName = rName;
}
-void GalleryThemeEntry::setStorageLocations(INetURLObject& rURL)
+void GalleryThemeEntry::setStorageLocations(INetURLObject & rURL)
{
mpGalleryStorageEngineEntry->setStorageLocations(rURL);
}
+GalleryTheme* GalleryThemeEntry::createGalleryTheme(Gallery* pGallery)
+{
+ return new GalleryTheme(pGallery,this);
+}
+
+std::unique_ptr<GalleryBinaryEngine> GalleryThemeEntry::createGalleryStorageEngine(GalleryObjectCollection& mrGalleryObjectCollection)
+{
+ return mpGalleryStorageEngineEntry->createGalleryStorageEngine(mrGalleryObjectCollection, bReadOnly);
+}
+
void GalleryTheme::InsertAllThemes(weld::ComboBox& rListBox)
{
for (size_t i = 0; i < SAL_N_ELEMENTS(aUnlocalized); ++i)
@@ -574,7 +585,7 @@ bool Gallery::CreateTheme( const OUString& rThemeName )
false, true, 0, false );
aThemeList.emplace_back( pNewEntry );
- delete new GalleryTheme( this, pNewEntry );
+ delete pNewEntry->createGalleryTheme( this );
Broadcast( GalleryHint( GalleryHintType::THEME_CREATED, rThemeName ) );
bRet = true;
}
@@ -636,15 +647,15 @@ bool Gallery::RemoveTheme( const OUString& rThemeName )
return bRet;
}
-std::unique_ptr<GalleryTheme> GalleryThemeEntry::getCachedTheme(Gallery* pGallery) const
+std::unique_ptr<GalleryTheme> GalleryThemeEntry::getCachedTheme(Gallery* pGallery)
{
std::unique_ptr<GalleryTheme> pNewTheme;
- pNewTheme.reset(new GalleryTheme(pGallery, const_cast<GalleryThemeEntry*>(this)));
+ pNewTheme.reset(createGalleryTheme(pGallery));
mpGalleryStorageEngineEntry->getCachedTheme(pNewTheme);
return pNewTheme;
}
-GalleryTheme* Gallery::ImplGetCachedTheme(const GalleryThemeEntry* pThemeEntry)
+GalleryTheme* Gallery::ImplGetCachedTheme(GalleryThemeEntry* pThemeEntry)
{
GalleryTheme* pTheme = nullptr;
diff --git a/svx/source/gallery2/gallerybinaryengineentry.cxx b/svx/source/gallery2/gallerybinaryengineentry.cxx
index 7750c9ae9bc0..0b0831169a4d 100644
--- a/svx/source/gallery2/gallerybinaryengineentry.cxx
+++ b/svx/source/gallery2/gallerybinaryengineentry.cxx
@@ -51,6 +51,13 @@ 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(GalleryBinaryStorageLocations::ImplGetURLIgnoreCase(rBaseURL));
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index 69a09b84c2ee..e6dcf1acf75c 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -71,7 +71,7 @@ GalleryTheme::GalleryTheme( Gallery* pGallery, GalleryThemeEntry* pThemeEntry )
, bDragging(false)
, bAbortActualize(false)
{
- mpGalleryStorageEngine = createGalleryStorageEngine(IsReadOnly());
+ mpGalleryStorageEngine = pThm->createGalleryStorageEngine(maGalleryObjectCollection);
}
GalleryTheme::~GalleryTheme()
@@ -94,12 +94,6 @@ void GalleryTheme::SetDestDir(const OUString& rDestDir, bool bRelative)
mpGalleryStorageEngine->setDestDir(rDestDir, 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);
- return pGalleryBinaryEngine;
-}
-
void GalleryTheme::ImplBroadcast(sal_uInt32 nUpdatePos)
{
if( !IsBroadcasterLocked() )