[Libreoffice-commits] core.git: sw/inc sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Wed Jan 28 00:07:39 PST 2015
sw/inc/IMark.hxx | 1 +
sw/source/core/crsr/bookmrk.cxx | 14 ++++++++++++++
sw/source/core/doc/docbm.cxx | 34 +++-------------------------------
sw/source/core/inc/bookmrk.hxx | 1 +
4 files changed, 19 insertions(+), 31 deletions(-)
New commits:
commit 607ad59737919167047eb2ed713a5999a22c18e0
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Jan 28 09:05:56 2015 +0100
Extract MarkBase::dumpAsXml() from MarkManager
Change-Id: I85589d304dad05581bb2013166bb22f6b46cc793
diff --git a/sw/inc/IMark.hxx b/sw/inc/IMark.hxx
index 255a5bd..ad2b75c 100644
--- a/sw/inc/IMark.hxx
+++ b/sw/inc/IMark.hxx
@@ -68,6 +68,7 @@ namespace sw { namespace mark
{ return GetMarkEnd() > rPos; }
virtual OUString ToString( ) const =0;
+ virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const = 0;
};
class SW_DLLPUBLIC IBookmark
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 666a118..994aefc 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -32,6 +32,7 @@
#include <unobookmark.hxx>
#include <rtl/random.h>
#include <xmloff/odffields.hxx>
+#include <libxml/xmlwriter.h>
using namespace ::sw::mark;
using namespace ::com::sun::star;
@@ -173,6 +174,19 @@ namespace sw { namespace mark
+ OUString::number( GetMarkPos().nContent.GetIndex( ) ) + " ] )";
}
+ void MarkBase::dumpAsXml(xmlTextWriterPtr pWriter) const
+ {
+ xmlTextWriterStartElement(pWriter, BAD_CAST("markBase"));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(m_aName.toUtf8().getStr()));
+ xmlTextWriterStartElement(pWriter, BAD_CAST("markPos"));
+ GetMarkPos().dumpAsXml(pWriter);
+ xmlTextWriterEndElement(pWriter);
+ xmlTextWriterStartElement(pWriter, BAD_CAST("otherMarkPos"));
+ GetOtherMarkPos().dumpAsXml(pWriter);
+ xmlTextWriterEndElement(pWriter);
+ xmlTextWriterEndElement(pWriter);
+ }
+
MarkBase::~MarkBase()
{ }
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 95e2956..024fbd5 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1146,18 +1146,7 @@ void MarkManager::dumpAsXml(xmlTextWriterPtr pWriter) const
{
xmlTextWriterStartElement(pWriter, BAD_CAST("bookmarks"));
for (const_iterator_t it = m_vBookmarks.begin(); it != m_vBookmarks.end(); ++it)
- {
- pMark_t pMark = *it;
- xmlTextWriterStartElement(pWriter, BAD_CAST("bookmark"));
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(pMark->GetName().toUtf8().getStr()));
- xmlTextWriterStartElement(pWriter, BAD_CAST("markPos"));
- pMark->GetMarkPos().dumpAsXml(pWriter);
- xmlTextWriterEndElement(pWriter);
- xmlTextWriterStartElement(pWriter, BAD_CAST("otherMarkPos"));
- pMark->GetOtherMarkPos().dumpAsXml(pWriter);
- xmlTextWriterEndElement(pWriter);
- xmlTextWriterEndElement(pWriter);
- }
+ (*it)->dumpAsXml(pWriter);
xmlTextWriterEndElement(pWriter);
}
@@ -1168,13 +1157,7 @@ void MarkManager::dumpAsXml(xmlTextWriterPtr pWriter) const
{
pMark_t pMark = *it;
xmlTextWriterStartElement(pWriter, BAD_CAST("fieldmark"));
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(pMark->GetName().toUtf8().getStr()));
- xmlTextWriterStartElement(pWriter, BAD_CAST("markPos"));
- pMark->GetMarkPos().dumpAsXml(pWriter);
- xmlTextWriterEndElement(pWriter);
- xmlTextWriterStartElement(pWriter, BAD_CAST("otherMarkPos"));
- pMark->GetOtherMarkPos().dumpAsXml(pWriter);
- xmlTextWriterEndElement(pWriter);
+ pMark->dumpAsXml(pWriter);
if (sw::mark::IFieldmark* pFieldmark = dynamic_cast<sw::mark::IFieldmark*>(pMark.get()))
{
sw::mark::IFieldmark::parameter_map_t* pParameters = pFieldmark->GetParameters();
@@ -1200,18 +1183,7 @@ void MarkManager::dumpAsXml(xmlTextWriterPtr pWriter) const
{
xmlTextWriterStartElement(pWriter, BAD_CAST("annotationmarks"));
for (const_iterator_t it = m_vAnnotationMarks.begin(); it != m_vAnnotationMarks.end(); ++it)
- {
- pMark_t pMark = *it;
- xmlTextWriterStartElement(pWriter, BAD_CAST("annotationmark"));
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(pMark->GetName().toUtf8().getStr()));
- xmlTextWriterStartElement(pWriter, BAD_CAST("markPos"));
- pMark->GetMarkPos().dumpAsXml(pWriter);
- xmlTextWriterEndElement(pWriter);
- xmlTextWriterStartElement(pWriter, BAD_CAST("otherMarkPos"));
- pMark->GetOtherMarkPos().dumpAsXml(pWriter);
- xmlTextWriterEndElement(pWriter);
- xmlTextWriterEndElement(pWriter);
- }
+ (*it)->dumpAsXml(pWriter);
xmlTextWriterEndElement(pWriter);
}
xmlTextWriterEndElement(pWriter);
diff --git a/sw/source/core/inc/bookmrk.hxx b/sw/source/core/inc/bookmrk.hxx
index f2891f4..676bf81 100644
--- a/sw/source/core/inc/bookmrk.hxx
+++ b/sw/source/core/inc/bookmrk.hxx
@@ -88,6 +88,7 @@ namespace sw {
{ m_pPos2.reset(); }
virtual OUString ToString( ) const SAL_OVERRIDE;
+ virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const SAL_OVERRIDE;
void Swap()
{
More information about the Libreoffice-commits
mailing list