[Libreoffice-commits] core.git: Branch 'private/Rosemary/change-tracking' - xmloff/source

Rosemary Sebastian rosemaryseb8 at gmail.com
Wed Jun 15 18:21:18 UTC 2016


 xmloff/source/text/XMLRedlineExport.cxx |   22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

New commits:
commit d24e473475b93f5c512a831570fa9c14f40ec0bf
Author: Rosemary Sebastian <rosemaryseb8 at gmail.com>
Date:   Wed Jun 15 23:32:49 2016 +0530

    WIP Implement more types of changes
    
    Change-Id: I2d7878bc5e328f63b5f1e17a3cb787d6aebdcc8c

diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx
index 70883ec..daa0f0b 100644
--- a/xmloff/source/text/XMLRedlineExport.cxx
+++ b/xmloff/source/text/XMLRedlineExport.cxx
@@ -366,11 +366,25 @@ void XMLRedlineExport::ExportChangedRegion(
 
     // scope for (first) change element
     {
-        rExport.AddAttribute(XML_NAMESPACE_C, XML_START, "2");
-        rExport.AddAttribute(XML_NAMESPACE_DC, XML_TYPE, XML_PARAGRAPH);
         aAny = rPropSet->getPropertyValue(sRedlineType);
         OUString sType;
         aAny >>= sType;
+        XMLTokenEnum eChangeType = XML_PARAGRAPH;
+        OUString sParagraphIdx = "2", sCharStart, sCharEnd;
+        rPropSet->getPropertyValue("Start") >>= sCharStart;
+        rPropSet->getPropertyValue("End") >>= sCharEnd;
+        if(eChangeType == XML_PARAGRAPH)
+        {
+            rExport.AddAttribute(XML_NAMESPACE_C, XML_START, "/" + sParagraphIdx);
+            rExport.AddAttribute(XML_NAMESPACE_DC, XML_TYPE, XML_PARAGRAPH);
+        }
+        else
+        {
+            rExport.AddAttribute(XML_NAMESPACE_C, XML_START, "/" + sParagraphIdx + "/" + sCharStart);
+            if( sType == sInsert )
+                rExport.AddAttribute(XML_NAMESPACE_C, XML_END, "/" + sParagraphIdx + "/" + sCharEnd);
+            rExport.AddAttribute(XML_NAMESPACE_DC, XML_TYPE, eChangeType);
+        }
         SvXMLElementExport aChange(rExport, XML_NAMESPACE_TEXT,
                                    ConvertTypeName(sType), true, true);
 
@@ -418,11 +432,11 @@ const OUString XMLRedlineExport::ConvertTypeName(
 {
     if (sApiName == sDelete)
     {
-        return sDeletion;
+        return sInsertion;
     }
     else if (sApiName == sInsert)
     {
-        return sInsertion;
+        return sDeletion;
     }
     else if (sApiName == sFormat)
     {


More information about the Libreoffice-commits mailing list