diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2017-05-01 14:34:38 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-05-02 08:17:55 +0200 |
commit | 5eaad8eb1d46b6f85605c5ac210e8b1397b18b22 (patch) | |
tree | a4b35695a88108b89eba90d4112be0736f7c94db /sw | |
parent | d02d52887678cd3d518c19a235bc443c292b3041 (diff) |
SwFieldTypes can just be a std::vector typedef
Change-Id: I10b43a71c8cedc6efbb30056d3da7fd431f04791
Reviewed-on: https://gerrit.libreoffice.org/37121
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/IDocumentFieldsAccess.hxx | 3 | ||||
-rw-r--r-- | sw/inc/doc.hxx | 1 | ||||
-rw-r--r-- | sw/inc/docary.hxx | 6 | ||||
-rw-r--r-- | sw/source/core/doc/docfmt.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/fields/dbfld.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/fields/fldbas.cxx | 6 |
6 files changed, 11 insertions, 14 deletions
diff --git a/sw/inc/IDocumentFieldsAccess.hxx b/sw/inc/IDocumentFieldsAccess.hxx index c78e5a249b3b..7d999d955a29 100644 --- a/sw/inc/IDocumentFieldsAccess.hxx +++ b/sw/inc/IDocumentFieldsAccess.hxx @@ -22,9 +22,10 @@ #include <sal/types.h> #include <tools/solar.h> +#include <vector> -class SwFieldTypes; class SwFieldType; +typedef std::vector<SwFieldType*> SwFieldTypes; class SfxPoolItem; struct SwPosition; class SwDocUpdateField; diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 61d57940d2f9..d1e1073cd522 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -88,7 +88,6 @@ class SwEditShell; class SwFieldType; class SwField; class SwTextField; -class SwFieldTypes; class SwFlyFrameFormat; class SwFormatsBase; class SwFormat; diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx index 255bc8127ff7..8e0131516a11 100644 --- a/sw/inc/docary.hxx +++ b/sw/inc/docary.hxx @@ -295,10 +295,8 @@ public: void dumpAsXml(struct _xmlTextWriter* pWriter) const; }; -class SwFieldTypes : public SwVectorModifyBase<SwFieldType*> { -public: - void dumpAsXml(struct _xmlTextWriter* pWriter) const; -}; +typedef std::vector<SwFieldType*> SwFieldTypes; +void dumpAsXml(struct _xmlTextWriter* pWriter, SwFieldTypes const &); typedef std::vector<SwTOXType*> SwTOXTypes; diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 5dff133d929f..0e27f6140fb8 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1940,7 +1940,7 @@ void SwDoc::dumpAsXml(xmlTextWriterPtr pWriter) const maDBData.dumpAsXml(pWriter); mpMarkManager->dumpAsXml(pWriter); m_pUndoManager->dumpAsXml(pWriter); - getIDocumentFieldsAccess().GetFieldTypes()->dumpAsXml(pWriter); + ::dumpAsXml(pWriter, *getIDocumentFieldsAccess().GetFieldTypes()); mpTextFormatCollTable->dumpAsXml(pWriter); mpCharFormatTable->dumpAsXml(pWriter); mpFrameFormatTable->dumpAsXml(pWriter, "frmFormatTable"); diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx index e6724c228c7b..151dfe79c507 100644 --- a/sw/source/core/fields/dbfld.cxx +++ b/sw/source/core/fields/dbfld.cxx @@ -90,11 +90,12 @@ void SwDBFieldType::ReleaseRef() if (--nRefCnt <= 0) { - size_t nPos = GetDoc()->getIDocumentFieldsAccess().GetFieldTypes()->GetPos(this); + auto pFieldTypes = GetDoc()->getIDocumentFieldsAccess().GetFieldTypes(); + auto it = std::find(pFieldTypes->begin(), pFieldTypes->end(), this); - if (nPos != SIZE_MAX) + if (it != pFieldTypes->end()) { - GetDoc()->getIDocumentFieldsAccess().RemoveFieldType(nPos); + GetDoc()->getIDocumentFieldsAccess().RemoveFieldType(it - pFieldTypes->begin()); delete this; } } diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index 4dcb10a43843..27627dddee55 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -155,13 +155,11 @@ bool SwFieldType::PutValue( const uno::Any& , sal_uInt16 ) return false; } -void SwFieldTypes::dumpAsXml(xmlTextWriterPtr pWriter) const +void dumpAsXml(xmlTextWriterPtr pWriter, SwFieldTypes const & rTypes) { xmlTextWriterStartElement(pWriter, BAD_CAST("SwFieldTypes")); - sal_uInt16 nCount = size(); - for (sal_uInt16 nType = 0; nType < nCount; ++nType) + for (auto pCurType : rTypes) { - const SwFieldType *pCurType = (*this)[nType]; SwIterator<SwFormatField, SwFieldType> aIter(*pCurType); for (const SwFormatField* pFormatField = aIter.First(); pFormatField; pFormatField = aIter.Next()) pFormatField->dumpAsXml(pWriter); |