summaryrefslogtreecommitdiff
path: root/sw/inc/docary.hxx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-06-20 16:36:51 +0200
committerFridrich Štrba <fridrich.strba@bluewin.ch>2012-06-20 16:48:03 +0200
commit1015cd4ff73ee25e55b4da8c8bc55a41e652da87 (patch)
tree0b91a6dd5e278cda1c582ba122e40d4877920d0d /sw/inc/docary.hxx
parentccfc7bd12dd89f2ec4fd4e9339710ccb4c6532da (diff)
Convert SV_DECL_PTRARR_DEL of Sw*Fmts to std::vector
- I had to convert SwFrmFmts, SwSpzFrmFmts, SwCharFmts, SwSectionsFmts, SwTextFormatColl, SwGrfFmtColl all together because of the code that wants to work with any of them. - Introduce a pure virtual base class SwFmtsBase, since there are a handful of methods that want to work with any of the std::vector<Sw*Fmt> types. - the class SwSpzFrmFmts was dropped, and the code changed to use SwFrmFmts instead, since the 2 types are identical. Change-Id: I8c4056b5aedd574a33666e2d649a8b849958441c Signed-off-by: Fridrich Štrba <fridrich.strba@bluewin.ch>
Diffstat (limited to 'sw/inc/docary.hxx')
-rw-r--r--sw/inc/docary.hxx75
1 files changed, 63 insertions, 12 deletions
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 2a8642229da0..6c7f99402d03 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -33,6 +33,7 @@
#include <algorithm>
class SwFieldType;
+class SwFmt;
class SwFrmFmt;
class SwCharFmt;
class SwTOXType;
@@ -42,6 +43,8 @@ class SwNumRule;
class SwRedline;
class SwUnoCrsr;
class SwOLENode;
+class SwTxtFmtColl;
+class SwGrfFmtColl;
namespace com { namespace sun { namespace star { namespace i18n {
struct ForbiddenCharacters; // comes from the I18N UNO interface
@@ -50,18 +53,70 @@ namespace com { namespace sun { namespace star { namespace i18n {
#include <swtypes.hxx>
#include <svl/svarray.hxx>
-// PageDescriptor-interface
-// typedef SwPageDesc * SwPageDescPtr;
-// SV_DECL_PTRARR_DEL(SwPageDescs, SwPageDescPtr,1);
+// provides some methods for generic operations on lists that contain
+// SwFmt* subclasses.
+class SwFmtsBase
+{
+public:
+ virtual size_t GetFmtCount() const = 0;
+ virtual SwFmt* GetFmt(size_t idx) const = 0;
+ virtual ~SwFmtsBase() = 0;
+};
-typedef SwFrmFmt* SwFrmFmtPtr;
-SV_DECL_PTRARR_DEL(SwFrmFmts,SwFrmFmtPtr,4)
+class SwGrfFmtColls : public std::vector<SwGrfFmtColl*>, public SwFmtsBase
+{
+public:
+ virtual size_t GetFmtCount() const { return size(); }
+ virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
+ sal_uInt16 GetPos(const SwGrfFmtColl* pFmt) const;
+ // free's any remaining child objects
+ virtual ~SwGrfFmtColls() {}
+};
// Specific frame formats (frames, DrawObjects).
-SV_DECL_PTRARR_DEL(SwSpzFrmFmts,SwFrmFmtPtr,0)
+class SW_DLLPUBLIC SwFrmFmts : public std::vector<SwFrmFmt*>, public SwFmtsBase
+{
+public:
+ virtual size_t GetFmtCount() const { return size(); }
+ virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
+ sal_uInt16 GetPos(const SwFrmFmt* pFmt) const;
+ bool Contains(const SwFrmFmt* pFmt) const;
+ // free's any remaining child objects
+ virtual ~SwFrmFmts();
+};
-typedef SwCharFmt* SwCharFmtPtr;
-SV_DECL_PTRARR_DEL(SwCharFmts,SwCharFmtPtr,4)
+class SwCharFmts : public std::vector<SwCharFmt*>, public SwFmtsBase
+{
+public:
+ virtual size_t GetFmtCount() const { return size(); }
+ virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
+ sal_uInt16 GetPos(const SwCharFmt* pFmt) const;
+ bool Contains(const SwCharFmt* pFmt) const;
+ // free's any remaining child objects
+ virtual ~SwCharFmts();
+};
+
+class SwTxtFmtColls : public std::vector<SwTxtFmtColl*>, public SwFmtsBase
+{
+public:
+ virtual size_t GetFmtCount() const { return size(); }
+ virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
+ sal_uInt16 GetPos(const SwTxtFmtColl* pFmt) const;
+ bool Contains(const SwTxtFmtColl* pFmt) const;
+ virtual ~SwTxtFmtColls() {}
+};
+
+// Array of Undo-history.
+class SW_DLLPUBLIC SwSectionFmts : public std::vector<SwSectionFmt*>, public SwFmtsBase
+{
+public:
+ virtual size_t GetFmtCount() const { return size(); }
+ virtual SwFmt* GetFmt(size_t idx) const { return (SwFmt*)operator[](idx); }
+ sal_uInt16 GetPos(const SwSectionFmt* pFmt) const;
+ bool Contains(const SwSectionFmt* pFmt) const;
+ // free's any remaining child objects
+ virtual ~SwSectionFmts();
+};
class SwFldTypes : public std::vector<SwFieldType*> {
public:
@@ -77,10 +132,6 @@ public:
sal_uInt16 GetPos(const SwTOXType* pTOXType) const;
};
-// Array of Undo-history.
-typedef SwSectionFmt* SwSectionFmtPtr;
-SV_DECL_PTRARR_DEL(SwSectionFmts,SwSectionFmtPtr,0)
-
class SW_DLLPUBLIC SwNumRuleTbl : public std::vector<SwNumRule*> {
public:
// the destructor will free all objects still in the vector