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

Rosemary Sebastian rosemaryseb8 at gmail.com
Wed Jun 22 15:54:59 UTC 2016


 xmloff/source/text/XMLRedlineExport.cxx |   90 ++++++++++++++++----------------
 xmloff/source/text/txtparae.cxx         |    3 -
 2 files changed, 46 insertions(+), 47 deletions(-)

New commits:
commit b4d0ec6e524cd9024d24c398cd911e1565e7495e
Author: Rosemary Sebastian <rosemaryseb8 at gmail.com>
Date:   Wed Jun 22 21:17:59 2016 +0530

    Fix insertion of text and paragraph
    
    Change-Id: I19488bf89e119fbdd5124e14cbc7aa27990321fc

diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx
index aaf776b..f4f270b 100644
--- a/xmloff/source/text/XMLRedlineExport.cxx
+++ b/xmloff/source/text/XMLRedlineExport.cxx
@@ -342,51 +342,48 @@ void XMLRedlineExport::ExportChangesListAutoStyles()
 void XMLRedlineExport::ExportUndoChangeInline(
     const Reference<XPropertySet> & rPropSet, const sal_uInt32& rParaIdx)
 {
-    // determine element name (depending on collapsed, start/end)
     {
+        Any aAny = rPropSet->getPropertyValue(sRedlineType);
+        OUString sType;
+        aAny >>= sType;
+
+        sal_uInt32 nParagraphIdx = rParaIdx, nCharStart, nCharEnd;
+        rPropSet->getPropertyValue(sRedlineUndoStart) >>= nCharStart;
+        rPropSet->getPropertyValue(sRedlineUndoEnd) >>= nCharEnd;
+
+        XMLTokenEnum eUndoType = XML_TEXT;
+        OUString sUndoType;
+        aAny = rPropSet->getPropertyValue(sRedlineUndoType);
+        aAny >>= sUndoType;
+
+        if( sUndoType == "paragraph" )
         {
-            Any aAny;
-            aAny = rPropSet->getPropertyValue(sRedlineType);
-            OUString sType;
-            aAny >>= sType;
-
-            sal_uInt32 nParagraphIdx = rParaIdx, nCharStart, nCharEnd;
-            rPropSet->getPropertyValue(sRedlineUndoStart) >>= nCharStart;
-            rPropSet->getPropertyValue(sRedlineUndoEnd) >>= nCharEnd;
-            if(sType == sDelete)
-                nParagraphIdx++;
-
-            XMLTokenEnum eUndoType = XML_PARAGRAPH;
-            OUString sUndoType;
-            aAny = rPropSet->getPropertyValue(sRedlineUndoType);
-            aAny >>= sUndoType;
-
-            if( sUndoType == "text" )
-                eUndoType = XML_TEXT;
-            if(eUndoType == XML_PARAGRAPH)
-            {
-                rExport.AddAttribute(XML_NAMESPACE_C, XML_START, "/" + rtl::OUString::number(nParagraphIdx));
-                rExport.AddAttribute(XML_NAMESPACE_DC, XML_TYPE, XML_PARAGRAPH);
-            }
-            else
-            {
-                rExport.AddAttribute(XML_NAMESPACE_C, XML_START, "/" + rtl::OUString::number(nParagraphIdx) + "/" + rtl::OUString::number(nCharStart));
-                if( sType == sInsert || sType == sFormat )
-                    rExport.AddAttribute(XML_NAMESPACE_C, XML_END, "/" + rtl::OUString::number(nParagraphIdx) + "/" + rtl::OUString::number(nCharEnd));
-                rExport.AddAttribute(XML_NAMESPACE_DC, XML_TYPE, eUndoType);
-            }
-            SvXMLElementExport aChange(rExport, XML_NAMESPACE_TEXT,
-                                    ConvertTypeName(sType), true, true);
-
-            // get XText from the redline and export (if the XText exists)
-            aAny = rPropSet->getPropertyValue(sRedlineText);
-            Reference<XText> xText;
-            aAny >>= xText;
-            if (xText.is())
-            {
-                rExport.GetTextParagraphExport()->exportText(xText);
-                // default parameters: bProgress, bExportParagraph ???
-            }
+            eUndoType = XML_PARAGRAPH;
+            nParagraphIdx++;
+        }
+        if(eUndoType == XML_PARAGRAPH)
+        {
+            rExport.AddAttribute(XML_NAMESPACE_C, XML_START, "/" + rtl::OUString::number(nParagraphIdx));
+            rExport.AddAttribute(XML_NAMESPACE_DC, XML_TYPE, XML_PARAGRAPH);
+        }
+        else
+        {
+            rExport.AddAttribute(XML_NAMESPACE_C, XML_START, "/" + rtl::OUString::number(nParagraphIdx) + "/" + rtl::OUString::number(nCharStart));
+            if( sType == sInsert || sType == sFormat )
+                rExport.AddAttribute(XML_NAMESPACE_C, XML_END, "/" + rtl::OUString::number(nParagraphIdx) + "/" + rtl::OUString::number(nCharEnd));
+            rExport.AddAttribute(XML_NAMESPACE_DC, XML_TYPE, eUndoType);
+        }
+        SvXMLElementExport aChange(rExport, XML_NAMESPACE_TEXT,
+                                ConvertTypeName(sType), true, true);
+
+        // get XText from the redline and export (if the XText exists)
+        aAny = rPropSet->getPropertyValue(sRedlineText);
+        Reference<XText> xText;
+        aAny >>= xText;
+        if (xText.is())
+        {
+            rExport.GetTextParagraphExport()->exportText(xText);
+            // default parameters: bProgress, bExportParagraph ???
         }
     }
 }
@@ -550,8 +547,13 @@ const OUString XMLRedlineExport::GetRedlineID(
 void XMLRedlineExport::ExportUndoChangeInfo(
     const Reference<XPropertySet> & rPropSet, const sal_uInt32& rParaIdx)
 {
+    Any aAny = rPropSet->getPropertyValue(sIsCollapsed);
+    bool bCollapsed = *static_cast<sal_Bool const *>(aAny.getValue());
+    aAny = rPropSet->getPropertyValue(sIsStart);
+    bool bStart = *static_cast<sal_Bool const *>(aAny.getValue());
+    if( bCollapsed || bStart )
     {
-        Any aAny = rPropSet->getPropertyValue(sRedlineAuthor);
+        aAny = rPropSet->getPropertyValue(sRedlineAuthor);
         OUString sAuthor;
         aAny >>= sAuthor;
         if (!sAuthor.isEmpty())
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 73bc313..6687c73 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -2671,9 +2671,6 @@ void XMLTextParagraphExport::exportUndoTextRangeEnumeration(
                 if (nullptr != pRedlineExport)
                     pRedlineExport->ExportUndoChange(xPropSet, rParaIdx, bAutoStyles);
             }
-            else {
-                OSL_FAIL("unknown text portion type");
-            }
         }
     }
 


More information about the Libreoffice-commits mailing list