diff options
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/fields/authfld.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/fields/fldbas.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/utlui/initui.cxx | 19 |
3 files changed, 27 insertions, 6 deletions
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index 934f06f1243b..7a2dea545ab9 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -101,7 +101,7 @@ void SwAuthorityFieldType::RemoveField(const SwAuthEntry* pEntry) return; } } - SAL_WARN("sw.core", "SwAuthorityFieldType::RemoveField: pEntry is not my field"); + assert(false && "SwAuthorityFieldType::RemoveField: pEntry was not added previously"); } SwAuthEntry* SwAuthorityFieldType::AddField(const OUString& rFieldContents) @@ -167,18 +167,18 @@ bool SwAuthorityFieldType::ChangeEntryContent(const SwAuthEntry* pNewEntry) return false; } -/// appends a new entry (if new) and returns the array position -sal_uInt16 SwAuthorityFieldType::AppendField( const SwAuthEntry& rInsert ) +/// appends a new entry (if new) and returns the copied entry +SwAuthEntry* SwAuthorityFieldType::AppendField( const SwAuthEntry& rInsert ) { for( SwAuthDataArr::size_type nRet = 0; nRet < m_DataArr.size(); ++nRet ) { if( *m_DataArr[ nRet ] == rInsert ) - return nRet; + return m_DataArr[ nRet ].get(); } //if it is a new Entry - insert m_DataArr.push_back(new SwAuthEntry(rInsert)); - return m_DataArr.size()-1; + return m_DataArr.back().get(); } std::unique_ptr<SwTOXInternational> SwAuthorityFieldType::CreateTOXInternational() const @@ -770,7 +770,7 @@ SwFieldType* SwAuthorityField::ChgTyp( SwFieldType* pFieldTyp ) if( pSrcTyp != pDstTyp ) { const SwAuthEntry* pSrcEntry = m_xAuthEntry.get(); - pDstTyp->AppendField( *pSrcEntry ); + m_xAuthEntry = pDstTyp->AppendField( *pSrcEntry ); pSrcTyp->RemoveField( pSrcEntry ); SwField::ChgTyp( pFieldTyp ); } diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index 2d824ac52c28..cf3a41460ba3 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -163,6 +163,8 @@ void SwFieldType::dumpAsXml(xmlTextWriterPtr pWriter) const if(!vFields.size()) return; (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwFieldType")); + (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); + (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("symbol"), "%s", BAD_CAST(typeid(*this).name())); for(const auto pFormatField: vFields) pFormatField->dumpAsXml(pWriter); (void)xmlTextWriterEndElement(pWriter); diff --git a/sw/source/uibase/utlui/initui.cxx b/sw/source/uibase/utlui/initui.cxx index f9567ec4ab45..a690b7cfe9df 100644 --- a/sw/source/uibase/utlui/initui.cxx +++ b/sw/source/uibase/utlui/initui.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <libxml/xmlwriter.h> + #include <unotools/localedatawrapper.hxx> #include <viewsh.hxx> #include <initui.hxx> @@ -286,4 +288,21 @@ OUString const & SwAuthorityFieldType::GetAuthTypeName(ToxAuthorityType eType) return (*pAuthFieldTypeList)[static_cast< sal_uInt16 >(eType)]; } +void SwAuthorityFieldType::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwAuthorityFieldType")); + SwFieldType::dumpAsXml(pWriter); + + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("DataArr")); + for (const auto& xAuthEntry : m_DataArr) + { + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("AuthEntry")); + (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", xAuthEntry.get()); + (void)xmlTextWriterEndElement(pWriter); + } + (void)xmlTextWriterEndElement(pWriter); + + (void)xmlTextWriterEndElement(pWriter); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |