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

Rosemary Sebastian rosemaryseb8 at gmail.com
Sat Jun 18 18:02:25 UTC 2016


 include/xmloff/xmltoken.hxx             |    1 +
 sw/inc/redline.hxx                      |    8 ++++++++
 sw/inc/unoprnms.hxx                     |    2 +-
 sw/source/core/doc/docredln.cxx         |   10 ++++++++++
 sw/source/core/text/redlnitr.cxx        |    2 ++
 sw/source/core/unocore/unoredline.cxx   |   14 +++++++++-----
 xmloff/source/core/xmltoken.cxx         |    1 +
 xmloff/source/text/XMLRedlineExport.cxx |   26 ++++++++++++++------------
 xmloff/source/text/XMLRedlineExport.hxx |    1 -
 9 files changed, 46 insertions(+), 19 deletions(-)

New commits:
commit 0e2e4319c5fd3232dbe09bb8fc18e2e48263643b
Author: Rosemary Sebastian <rosemaryseb8 at gmail.com>
Date:   Sat Jun 18 23:30:17 2016 +0530

    Get the correct start and end positions
    
    Change-Id: I01db8d1556f8518e430e782d56a7310b1475dcb9

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 425580d..af2e5dd 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -863,6 +863,7 @@ namespace xmloff { namespace token {
         XML_FORCE_MANUAL,
         XML_FOREGROUND,
         XML_FOREIGN_OBJECT,
+        XML_FORMAT,
         XML_FORMAT_CHANGE,
         XML_FORMAT_SOURCE,
         XML_FORMATTING_ENTRY,
diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index 1033a56..5588b94 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -109,6 +109,8 @@ class SW_DLLPUBLIC SwRedlineData
     SwRedlineExtraData* pExtraData;
 
     OUString sComment;
+    sal_uInt32 nUndoStart;
+    sal_uInt32 nUndoEnd;
     DateTime aStamp;
     RedlineType_t eType;
     sal_uInt16 nAuthor, nSeqNo;
@@ -147,6 +149,8 @@ public:
     inline const SwRedlineData* Next() const{ return pNext; }
 
     void SetComment( const OUString& rS )     { sComment = rS; }
+    void SetUndoStart( const sal_uInt32& rUndoStart )     { nUndoStart = rUndoStart; }
+    void SetUndoEnd( const sal_uInt32& rUndoEnd )     { nUndoEnd = rUndoEnd; }
     void SetTimeStamp( const DateTime& rDT ) { aStamp = rDT; }
 
     void SetAutoFormatFlag()
@@ -237,8 +241,12 @@ public:
     RedlineType_t GetRealType( sal_uInt16 nPos = 0 ) const;
     RedlineType_t GetType( sal_uInt16 nPos = 0) const
         { return ( (RedlineType_t)(GetRealType( nPos ) & nsRedlineType_t::REDLINE_NO_FLAG_MASK)); }
+    const sal_uInt32& GetUndoStart( sal_uInt16 nPos = 0 ) const;
+    const sal_uInt32& GetUndoEnd( sal_uInt16 nPos = 0 ) const;
     const OUString& GetComment( sal_uInt16 nPos = 0 ) const;
 
+    void SetUndoStart( const sal_uInt32& rUndoStart ) { pRedlineData->SetUndoStart( rUndoStart ); }
+    void SetUndoEnd( const sal_uInt32& rUndoEnd ) { pRedlineData->SetUndoEnd( rUndoEnd ); }
     void SetComment( const OUString& rS ) { pRedlineData->SetComment( rS ); }
 
     /** ExtraData gets copied, the pointer is therefore not taken over by
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 83b0a7a..7ada27e 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -542,7 +542,7 @@
 #define UNO_NAME_IS_IN_HEADER_FOOTER "IsInHeaderFooter"
 #define UNO_NAME_REDLINE_UNDO_START "RedlineUndoStart"
 #define UNO_NAME_REDLINE_UNDO_END "RedlineUndoEnd"
-#define UNO_NAME_REDLINE_ELEMENT_TYPE "RedlineElementType"
+#define UNO_NAME_REDLINE_UNDO_TYPE "RedlineUndoType"
 #define UNO_NAME_START_REDLINE "StartRedline"
 #define UNO_NAME_END_REDLINE "EndRedline"
 #define UNO_NAME_REDLINE_START "RedlineStart"
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 1f9e8ef..eee8ec6 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1546,6 +1546,16 @@ const OUString& SwRangeRedline::GetComment( sal_uInt16 nPos ) const
     return GetRedlineData(nPos).sComment;
 }
 
+const sal_uInt32& SwRangeRedline::GetUndoStart( sal_uInt16 nPos ) const
+{
+    return GetRedlineData(nPos).nUndoStart;
+}
+
+const sal_uInt32& SwRangeRedline::GetUndoEnd( sal_uInt16 nPos ) const
+{
+    return GetRedlineData(nPos).nUndoEnd;
+}
+
 bool SwRangeRedline::operator<( const SwRangeRedline& rCmp ) const
 {
     if (*Start() < *rCmp.Start())
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index cb4df81..f5609d3 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -228,6 +228,8 @@ short SwRedlineItr::Seek_(SwFont& rFnt, sal_Int32 nNew, sal_Int32 nOld)
         for( ; nAct < (sal_Int32)rDoc.getIDocumentRedlineAccess().GetRedlineTable().size() ; ++nAct )
         {
             rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nAct ]->CalcStartEnd( nNdIdx, nStart, nEnd );
+            rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nAct ]->SetUndoStart(nStart + 1);
+            rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nAct ]->SetUndoEnd(nEnd);
 
             if( nNew < nEnd )
             {
diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx
index b83a3ee..f76f395 100644
--- a/sw/source/core/unocore/unoredline.cxx
+++ b/sw/source/core/unocore/unoredline.cxx
@@ -309,17 +309,21 @@ uno::Any  SwXRedlinePortion::GetPropertyValue( const OUString& rPropertyName, co
     {
         aRet <<= !rRedline.IsDelLastPara();
     }
-    else if (rPropertyName == UNO_NAME_REDLINE_ELEMENT_TYPE)
+    else if (rPropertyName == UNO_NAME_REDLINE_UNDO_TYPE)
     {
-        aRet <<= OUString("text");
+        if( rRedline.GetUndoEnd() == COMPLETE_STRING || rRedline.GetUndoStart() == rRedline.GetUndoEnd()
+            || rRedline.GetUndoEnd() == 0 )
+            aRet <<= OUString("paragraph");
+        else
+            aRet <<= OUString("text");
     }
     else if (rPropertyName == UNO_NAME_REDLINE_UNDO_START)
     {
-        aRet <<= rRedline.GetPoint()->nContent.GetIndex() + 1;
+        aRet <<= rRedline.GetUndoStart();
     }
     else if (rPropertyName == UNO_NAME_REDLINE_UNDO_END)
     {
-        aRet <<= rRedline.GetPoint()->nContent.GetIndex();
+        aRet <<= rRedline.GetUndoEnd();
     }
     return aRet;
 }
@@ -352,7 +356,7 @@ uno::Sequence< beans::PropertyValue > SwXRedlinePortion::CreateRedlineProperties
     pRet[nPropIdx].Name = UNO_NAME_MERGE_LAST_PARA;
     pRet[nPropIdx++].Value <<= !rRedline.IsDelLastPara();
 
-    pRet[nPropIdx].Name = UNO_NAME_REDLINE_ELEMENT_TYPE;
+    pRet[nPropIdx].Name = UNO_NAME_REDLINE_UNDO_TYPE;
     pRet[nPropIdx++].Value <<= OUString("text");
 
     pRet[nPropIdx].Name = UNO_NAME_REDLINE_UNDO_START;
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 1d30c0f..b81d544 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -865,6 +865,7 @@ namespace xmloff { namespace token {
         TOKEN( "force-manual",                    XML_FORCE_MANUAL ),
         TOKEN( "foreground",                      XML_FOREGROUND ),
         TOKEN( "foreign-object",                  XML_FOREIGN_OBJECT ),
+        TOKEN( "format",                          XML_FORMAT ),
         TOKEN( "format-change",                   XML_FORMAT_CHANGE ),
         TOKEN( "format-source",                   XML_FORMAT_SOURCE ),
         TOKEN( "formatting-entry",                XML_FORMATTING_ENTRY ),
diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx
index 6d44992..1ed7bde 100644
--- a/xmloff/source/text/XMLRedlineExport.cxx
+++ b/xmloff/source/text/XMLRedlineExport.cxx
@@ -73,7 +73,9 @@ XMLRedlineExport::XMLRedlineExport(SvXMLExport& rExp)
 ,   sRedlineSuccessorData("RedlineSuccessorData")
 ,   sRedlineText("RedlineText")
 ,   sRedlineType("RedlineType")
-,   sRedlineElementType("RedlineElementType")
+,   sRedlineUndoType("RedlineUndoType")
+,   sRedlineUndoStart("RedlineUndoStart")
+,   sRedlineUndoEnd("RedlineUndoEnd")
 ,   sUnknownChange("UnknownChange")
 ,   sStartRedline("StartRedline")
 ,   sEndRedline("EndRedline")
@@ -338,19 +340,19 @@ void XMLRedlineExport::ExportChangedRegion(
         aAny >>= sType;
 
         sal_uInt32 nParagraphIdx = 2, nCharStart, nCharEnd;
-        rPropSet->getPropertyValue("RedlineUndoStart") >>= nCharStart;
-        rPropSet->getPropertyValue("RedlineUndoEnd") >>= nCharEnd;
+        rPropSet->getPropertyValue(sRedlineUndoStart) >>= nCharStart;
+        rPropSet->getPropertyValue(sRedlineUndoEnd) >>= nCharEnd;
 
-        XMLTokenEnum eElementType = XML_TEXT;
-        OUString sElementType;
-        aAny = rPropSet->getPropertyValue(sRedlineElementType);
-        aAny >>= sElementType;
+        XMLTokenEnum eUndoType = XML_PARAGRAPH;
+        OUString sUndoType;
+        aAny = rPropSet->getPropertyValue(sRedlineUndoType);
+        aAny >>= sUndoType;
 
         if( sType == sFormat )
-            eElementType = XML_FORMAT_CHANGE;
-        else if( sElementType == "text" )
-            eElementType = XML_TEXT;
-        if(eElementType == XML_PARAGRAPH)
+            eUndoType = XML_FORMAT;
+        else 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);
@@ -360,7 +362,7 @@ void XMLRedlineExport::ExportChangedRegion(
             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, eElementType);
+            rExport.AddAttribute(XML_NAMESPACE_DC, XML_TYPE, eUndoType);
         }
         SvXMLElementExport aChange(rExport, XML_NAMESPACE_TEXT,
                                    ConvertTypeName(sType), true, true);
diff --git a/xmloff/source/text/XMLRedlineExport.hxx b/xmloff/source/text/XMLRedlineExport.hxx
index bdb5719..1ece917 100644
--- a/xmloff/source/text/XMLRedlineExport.hxx
+++ b/xmloff/source/text/XMLRedlineExport.hxx
@@ -66,7 +66,6 @@ class XMLRedlineExport
     const OUString sRedlineSuccessorData;
     const OUString sRedlineText;
     const OUString sRedlineType;
-    const OUString sRedlineElementType;
     const OUString sRedlineUndoType;
     const OUString sRedlineUndoName;
     const OUString sRedlineUndoStart;


More information about the Libreoffice-commits mailing list