summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAditya <adityasahu1511@gmail.com>2020-07-30 15:04:27 +0530
committerTomaž Vajngerl <quikee@gmail.com>2020-07-31 19:02:41 +0200
commit6e717f4552aa937cd2609a79199a5b40b38789a4 (patch)
tree8ad965abe938efa688996fae062a28116ac491ff /include
parent3295afc91226ef1c395fd1eb289fa588a9a8c6d5 (diff)
svx:Move functions from GalleryTheme that belong to GalleryObjectCollection
Move 3 functions from ImplGetObjectURL(sal_uInt32 nPos), ImplGetObjectURL(const INetURLObject& rURL) and ImplGetObjectPos(const GalleryObject* pObj) to GalleryObjectCollection as they deal with the m_aObjectList directly, and rename them respectively. Change-Id: I1e02b345d706c57db8801441fc955af9157cf565 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99789 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/svx/galleryobjectcollection.hxx13
-rw-r--r--include/svx/galtheme.hxx19
2 files changed, 14 insertions, 18 deletions
diff --git a/include/svx/galleryobjectcollection.hxx b/include/svx/galleryobjectcollection.hxx
index 266d263e8b14..311434ec0352 100644
--- a/include/svx/galleryobjectcollection.hxx
+++ b/include/svx/galleryobjectcollection.hxx
@@ -19,23 +19,34 @@
#pragma once
+#include <svx/svxdllapi.h>
+
+#include <tools/urlobj.hxx>
#include <memory>
#include <vector>
struct GalleryObject;
-class GalleryObjectCollection
+class SVXCORE_DLLPUBLIC GalleryObjectCollection
{
private:
std::vector<std::unique_ptr<GalleryObject>> m_aObjectList;
public:
+ GalleryObjectCollection();
std::vector<std::unique_ptr<GalleryObject>>& getObjectList() { return m_aObjectList; }
std::unique_ptr<GalleryObject>& get(sal_uInt32 nPos) { return m_aObjectList[nPos]; }
const std::unique_ptr<GalleryObject>& get(sal_uInt32 nPos) const { return m_aObjectList[nPos]; }
sal_uInt32 size() const { return m_aObjectList.size(); }
+ const GalleryObject* searchObjectWithURL(const INetURLObject& rURL);
+ const GalleryObject* getForPosition(sal_uInt32 nPos) const;
+ sal_uInt32 searchPosWithObject(const GalleryObject* pObj);
+
void clear();
+
+ GalleryObjectCollection(GalleryObjectCollection const&) = delete;
+ void operator=(GalleryObjectCollection const&) = delete;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/galtheme.hxx b/include/svx/galtheme.hxx
index 5c3f537c2107..c0c1bf260670 100644
--- a/include/svx/galtheme.hxx
+++ b/include/svx/galtheme.hxx
@@ -89,21 +89,6 @@ private:
std::unique_ptr<GalleryBinaryEngine> createGalleryBinaryEngine(bool bReadOnly);
const std::unique_ptr<GalleryBinaryEngine>& getGalleryBinaryEngine() const { return mpGalleryBinaryEngine; }
- SAL_DLLPRIVATE const GalleryObject* ImplGetGalleryObject(sal_uInt32 nPos) const
- {
- if (nPos < maGalleryObjectCollection.size())
- return maGalleryObjectCollection.get(nPos).get();
- return nullptr;
- }
- const GalleryObject* ImplGetGalleryObject(const INetURLObject& rURL);
-
- SAL_DLLPRIVATE sal_uInt32 ImplGetGalleryObjectPos( const GalleryObject* pObj )
- {
- for (sal_uInt32 i = 0, n = maGalleryObjectCollection.size(); i < n; ++i)
- if ( pObj == maGalleryObjectCollection.get(i).get() )
- return i;
- return SAL_MAX_UINT32;
- }
SAL_DLLPRIVATE void ImplSetModified( bool bModified );
SAL_DLLPRIVATE void ImplBroadcast(sal_uInt32 nUpdatePos);
@@ -164,14 +149,14 @@ public:
SAL_DLLPRIVATE SgaObjKind GetObjectKind(sal_uInt32 nPos) const
{
if (nPos < GetObjectCount())
- return ImplGetGalleryObject( nPos )->eObjKind;
+ return maGalleryObjectCollection.getForPosition( nPos )->eObjKind;
return SgaObjKind::NONE;
}
SAL_DLLPRIVATE const INetURLObject& GetObjectURL(sal_uInt32 nPos) const
{
DBG_ASSERT( nPos < GetObjectCount(), "Position out of range" );
- return ImplGetGalleryObject( nPos )->aURL;
+ return maGalleryObjectCollection.getForPosition( nPos )->aURL;
}
SAL_DLLPRIVATE bool GetThumb(sal_uInt32 nPos, BitmapEx& rBmp);