summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2017-05-01 14:34:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-05-02 08:17:55 +0200
commit5eaad8eb1d46b6f85605c5ac210e8b1397b18b22 (patch)
treea4b35695a88108b89eba90d4112be0736f7c94db /sw/source/core
parentd02d52887678cd3d518c19a235bc443c292b3041 (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/source/core')
-rw-r--r--sw/source/core/doc/docfmt.cxx2
-rw-r--r--sw/source/core/fields/dbfld.cxx7
-rw-r--r--sw/source/core/fields/fldbas.cxx6
3 files changed, 7 insertions, 8 deletions
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);