[Libreoffice-commits] core.git: sw/inc sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Jan 27 00:10:56 PST 2015
sw/inc/pam.hxx | 1 +
sw/source/core/crsr/pam.cxx | 8 ++++++++
sw/source/core/doc/docbm.cxx | 30 ++++++++++++++++++------------
3 files changed, 27 insertions(+), 12 deletions(-)
New commits:
commit 58a50c3dc74cc9bd298d6b4156e45a8dbbffc116
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Jan 27 09:09:10 2015 +0100
Extract SwPosition::dumpAsXml() from MarkManager
Change-Id: I7832f484861d32b01c8d5edd1adc4a80072cf7e2
diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index 26d847f..616a45a 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -74,6 +74,7 @@ struct SW_DLLPUBLIC SwPosition
bool operator >=(const SwPosition &) const;
bool operator ==(const SwPosition &) const;
bool operator !=(const SwPosition &) const;
+ void dumpAsXml(struct _xmlTextWriter* pWriter) const;
};
std::ostream &operator <<(std::ostream& s, const SwPosition& position);
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 68cbcff..b8dc0a6 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -190,6 +190,14 @@ SwDoc * SwPosition::GetDoc() const
return nNode.GetNode().GetDoc();
}
+void SwPosition::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ xmlTextWriterStartElement(pWriter, BAD_CAST("swPosition"));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nNode"), BAD_CAST(OString::number(nNode.GetIndex()).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nContent"), BAD_CAST(OString::number(nContent.GetIndex()).getStr()));
+ xmlTextWriterEndElement(pWriter);
+}
+
std::ostream &operator <<(std::ostream& s, const SwPosition& position)
{
return s << "SwPosition (node " << position.nNode.GetIndex() << ", offset " << position.nContent.GetIndex() << ")";
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index b3272a5..95e2956 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1149,11 +1149,13 @@ void MarkManager::dumpAsXml(xmlTextWriterPtr pWriter) const
{
pMark_t pMark = *it;
xmlTextWriterStartElement(pWriter, BAD_CAST("bookmark"));
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("startNode"), BAD_CAST(OString::number(pMark->GetMarkStart().nNode.GetIndex()).getStr()));
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("startOffset"), BAD_CAST(OString::number(pMark->GetMarkStart().nContent.GetIndex()).getStr()));
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("endNode"), BAD_CAST(OString::number(pMark->GetMarkEnd().nNode.GetIndex()).getStr()));
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("endOffset"), BAD_CAST(OString::number(pMark->GetMarkEnd().nContent.GetIndex()).getStr()));
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);
}
xmlTextWriterEndElement(pWriter);
@@ -1166,11 +1168,13 @@ void MarkManager::dumpAsXml(xmlTextWriterPtr pWriter) const
{
pMark_t pMark = *it;
xmlTextWriterStartElement(pWriter, BAD_CAST("fieldmark"));
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("startNode"), BAD_CAST(OString::number(pMark->GetMarkStart().nNode.GetIndex()).getStr()));
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("startOffset"), BAD_CAST(OString::number(pMark->GetMarkStart().nContent.GetIndex()).getStr()));
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("endNode"), BAD_CAST(OString::number(pMark->GetMarkEnd().nNode.GetIndex()).getStr()));
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("endOffset"), BAD_CAST(OString::number(pMark->GetMarkEnd().nContent.GetIndex()).getStr()));
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);
if (sw::mark::IFieldmark* pFieldmark = dynamic_cast<sw::mark::IFieldmark*>(pMark.get()))
{
sw::mark::IFieldmark::parameter_map_t* pParameters = pFieldmark->GetParameters();
@@ -1199,11 +1203,13 @@ void MarkManager::dumpAsXml(xmlTextWriterPtr pWriter) const
{
pMark_t pMark = *it;
xmlTextWriterStartElement(pWriter, BAD_CAST("annotationmark"));
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("startNode"), BAD_CAST(OString::number(pMark->GetMarkStart().nNode.GetIndex()).getStr()));
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("startOffset"), BAD_CAST(OString::number(pMark->GetMarkStart().nContent.GetIndex()).getStr()));
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("endNode"), BAD_CAST(OString::number(pMark->GetMarkEnd().nNode.GetIndex()).getStr()));
- xmlTextWriterWriteAttribute(pWriter, BAD_CAST("endOffset"), BAD_CAST(OString::number(pMark->GetMarkEnd().nContent.GetIndex()).getStr()));
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);
}
xmlTextWriterEndElement(pWriter);
More information about the Libreoffice-commits
mailing list