[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [Calligra] 0248800: Handle insert-around-content for <p> and <h>. This
From: Ganesh Paramasivam <ganesh () crystalfab ! com>
Date: 2010-12-08 8:15:43
Message-ID: 20101208081543.CEFADA60AE () git ! kde ! org
[Download RAW message or body]
commit 0248800f05f5e287001dee758ff8439ae2ad7c69
branch words-change_tracking-ganeshp
Author: Ganesh Paramasivam <ganesh@crystalfab.com>
Date: Wed Dec 8 13:43:37 2010 +0530
Handle insert-around-content for <p> and <h>. This was removed earlier but this \
is a valid scenario
diff --git a/libs/kotext/opendocument/KoTextLoader.cpp \
b/libs/kotext/opendocument/KoTextLoader.cpp index a56eb5d..43b1ef8 100644
--- a/libs/kotext/opendocument/KoTextLoader.cpp
+++ b/libs/kotext/opendocument/KoTextLoader.cpp
@@ -445,45 +445,79 @@ void KoTextLoader::loadBody(const KoXmlElement &bodyElem, \
QTextCursor &cursor) loadDeleteChangeOutsidePorH(id, cursor);
usedParagraph = false;
} else if (localName == "p") { // text paragraph
- if (tag.attributeNS(KoXmlNS::split, "split001-idref") != "")
- \
d->splitPositionMap.insert(tag.attributeNS(KoXmlNS::split, \
"split001-idref"),cursor.position());
-
- if (tag.attributeNS(KoXmlNS::delta, "insertion-type") != "") \
{
- QString insertionType = tag.attributeNS(KoXmlNS::delta, \
"insertion-type");
- if (insertionType == "insert-with-content")
- d->openChangeRegion(tag);
- if (insertionType == "split") {
- QString splitId = tag.attributeNS(KoXmlNS::delta, \
"split-id");
- QString changeId = tag.attributeNS(KoXmlNS::delta, \
"insertion-change-idref");
- markBlockSeparators(cursor, \
d->splitPositionMap.value(splitId), changeId);
- d->splitPositionMap.remove(splitId);
+ if (tag.attributeNS(KoXmlNS::delta, "insertion-type") != \
"insert-around-content") { + if \
(tag.attributeNS(KoXmlNS::split, "split001-idref") != "") + \
d->splitPositionMap.insert(tag.attributeNS(KoXmlNS::split, \
"split001-idref"),cursor.position()); +
+ if (tag.attributeNS(KoXmlNS::delta, "insertion-type") != \
"") { + QString insertionType = \
tag.attributeNS(KoXmlNS::delta, "insertion-type"); + \
if (insertionType == "insert-with-content") + \
d->openChangeRegion(tag); + if (insertionType == \
"split") { + QString splitId = \
tag.attributeNS(KoXmlNS::delta, "split-id"); + \
QString changeId = tag.attributeNS(KoXmlNS::delta, "insertion-change-idref"); + \
markBlockSeparators(cursor, d->splitPositionMap.value(splitId), changeId); + \
d->splitPositionMap.remove(splitId); + }
}
- }
- loadParagraph(tag, cursor);
+ loadParagraph(tag, cursor);
- if (tag.attributeNS(KoXmlNS::delta, "insertion-type") != "")
- d->closeChangeRegion(tag);
+ if (tag.attributeNS(KoXmlNS::delta, "insertion-type") != \
"") + d->closeChangeRegion(tag);
+ } else {
+ QString generatedXmlString;
+ _node = loadTagTypeChanges(tag,&generatedXmlString);
+ //Parse and Load the generated xml
+ QString errorMsg;
+ int errorLine, errorColumn;
+ KoXmlDocument doc;
+
+ QXmlStreamReader reader(generatedXmlString);
+ reader.setNamespaceProcessing(true);
+
+ bool ok = doc.setContent(&reader, &errorMsg, &errorLine, \
&errorColumn); + if (ok) {
+ loadBody(doc.documentElement(), cursor);
+ }
+ }
} else if (localName == "h") { // heading
- if (tag.attributeNS(KoXmlNS::split, "split001-idref") != "")
- \
d->splitPositionMap.insert(tag.attributeNS(KoXmlNS::split, \
"split001-idref"),cursor.position());
-
- if (tag.attributeNS(KoXmlNS::delta, "insertion-type") != "") \
{
- QString insertionType = tag.attributeNS(KoXmlNS::delta, \
"insertion-type");
- if (insertionType == "insert-with-content")
- d->openChangeRegion(tag);
- if (insertionType == "split") {
- QString splitId = tag.attributeNS(KoXmlNS::delta, \
"split-id");
- QString changeId = tag.attributeNS(KoXmlNS::delta, \
"insertion-change-idref");
- markBlockSeparators(cursor, \
d->splitPositionMap.value(splitId), changeId);
- d->splitPositionMap.remove(splitId);
+ if (tag.attributeNS(KoXmlNS::delta, "insertion-type") != \
"insert-around-content") { + if \
(tag.attributeNS(KoXmlNS::split, "split001-idref") != "") + \
d->splitPositionMap.insert(tag.attributeNS(KoXmlNS::split, \
"split001-idref"),cursor.position()); +
+ if (tag.attributeNS(KoXmlNS::delta, "insertion-type") != \
"") { + QString insertionType = \
tag.attributeNS(KoXmlNS::delta, "insertion-type"); + \
if (insertionType == "insert-with-content") + \
d->openChangeRegion(tag); + if (insertionType == \
"split") { + QString splitId = \
tag.attributeNS(KoXmlNS::delta, "split-id"); + \
QString changeId = tag.attributeNS(KoXmlNS::delta, "insertion-change-idref"); + \
markBlockSeparators(cursor, d->splitPositionMap.value(splitId), changeId); + \
d->splitPositionMap.remove(splitId); + }
}
- }
- loadHeading(tag, cursor);
+ loadHeading(tag, cursor);
- if (tag.attributeNS(KoXmlNS::delta, "insertion-type") != "")
- d->closeChangeRegion(tag);
+ if (tag.attributeNS(KoXmlNS::delta, "insertion-type") != \
"") + d->closeChangeRegion(tag);
+ } else {
+ QString generatedXmlString;
+ _node = loadTagTypeChanges(tag,&generatedXmlString);
+ //Parse and Load the generated xml
+ QString errorMsg;
+ int errorLine, errorColumn;
+ KoXmlDocument doc;
+
+ QXmlStreamReader reader(generatedXmlString);
+ reader.setNamespaceProcessing(true);
+
+ bool ok = doc.setContent(&reader, &errorMsg, &errorLine, \
&errorColumn); + if (ok) {
+ loadBody(doc.documentElement(), cursor);
+ }
+ }
} else if (localName == "unordered-list" || localName == \
"ordered-list" // OOo-1.1
|| localName == "list" || localName == \
"numbered-paragraph") { // OASIS
if (tag.attributeNS(KoXmlNS::delta, "insertion-type") != "")
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic