include/svx/gallerybinaryengine.hxx | 1 + svx/source/gallery2/gallerybinaryengine.cxx | 9 +++++++++ svx/source/gallery2/galtheme.cxx | 6 +----- 3 files changed, 11 insertions(+), 5 deletions(-)
New commits: commit 20369e9b4bc1b1b312113f04b0420d2ae1c7fc03 Author: Aditya <adityasahu1...@gmail.com> AuthorDate: Sat Aug 1 20:38:24 2020 +0530 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Tue Sep 1 09:29:19 2020 +0200 svx:GalleryTheme Refactoring -implement removeObject() in GalleryBinaryEngine Change-Id: I90d380efecbd5ed88e16b5f20603ff0183144302 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99945 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/include/svx/gallerybinaryengine.hxx b/include/svx/gallerybinaryengine.hxx index e8353d11af5a..bf13cecc9471 100644 --- a/include/svx/gallerybinaryengine.hxx +++ b/include/svx/gallerybinaryengine.hxx @@ -71,6 +71,7 @@ public: SAL_DLLPRIVATE bool implWrite(const GalleryTheme& rTheme, const GalleryThemeEntry* pThm); void insertObject(const SgaObject& rObj, GalleryObject* pFoundEntry, sal_uInt32& rInsertPos); + void removeObject(std::unique_ptr<GalleryObject>& pEntry); std::unique_ptr<SgaObject> implReadSgaObject(GalleryObject const* pEntry); bool implWriteSgaObject(const SgaObject& rObj, sal_uInt32 nPos, GalleryObject* pExistentEntry); diff --git a/svx/source/gallery2/gallerybinaryengine.cxx b/svx/source/gallery2/gallerybinaryengine.cxx index 6831608d9506..64e23a480781 100644 --- a/svx/source/gallery2/gallerybinaryengine.cxx +++ b/svx/source/gallery2/gallerybinaryengine.cxx @@ -154,6 +154,15 @@ void GalleryBinaryEngine::insertObject(const SgaObject& rObj, GalleryObject* pFo implWriteSgaObject(rObj, rInsertPos, nullptr); } +void GalleryBinaryEngine::removeObject(std::unique_ptr<GalleryObject>& pEntry) +{ + if (mrGalleryObjectCollection.getObjectList().empty()) + KillFile(GetSdgURL()); + + if (SgaObjKind::SvDraw == pEntry->eObjKind) + GetSvDrawStorage()->Remove(pEntry->aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE)); +} + std::unique_ptr<SgaObject> GalleryBinaryEngine::implReadSgaObject(GalleryObject const* pEntry) { std::unique_ptr<SgaObject> pSgaObj; diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 1de5ff849b8e..c10041ee8471 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -187,11 +187,7 @@ void GalleryTheme::RemoveObject(sal_uInt32 nPos) std::unique_ptr<GalleryObject> pEntry = std::move(*it); maGalleryObjectCollection.getObjectList().erase( it ); - if( maGalleryObjectCollection.getObjectList().empty() ) - KillFile( GetSdgURL() ); - - if( SgaObjKind::SvDraw == pEntry->eObjKind ) - mpGalleryBinaryEngine->GetSvDrawStorage()->Remove( pEntry->aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); + mpGalleryBinaryEngine->removeObject(pEntry); Broadcast( GalleryHint( GalleryHintType::CLOSE_OBJECT, GetName(), pEntry.get() ) ); pEntry.reset(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits