sw/source/core/docnode/nodedump.cxx |   31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

New commits:
commit 0aab035de49f4bc061a6a71d0500c8b8a79c1248
Author: Adam Co <rattles2...@gmail.com>
Date:   Sun Dec 8 15:54:33 2013 +0200

    Add 'redline - paragraph index' to XML node dump
    
    This change adds an output of the 'redline paragraph index' when dumping the
    data model to an XML. It also changes the way the paragraph text is dumped
    to the XML (it is better viewed in the XML this way).
    
    Conflicts:
        sw/source/core/docnode/nodedump.cxx
    Reviewed on:
        https://gerrit.libreoffice.org/6990
    
    Change-Id: I176270047bb4be838972117add5f3588b5573cfe

diff --git a/sw/source/core/docnode/nodedump.cxx 
b/sw/source/core/docnode/nodedump.cxx
index 76f2217..6696c1d 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -381,7 +381,9 @@ void SwTxtNode::dumpAsXml( xmlTextWriterPtr w )
     for( int i = 0; i < 32; ++i )
         txt = txt.replace( i, '*' );
     OString txt8 = OUStringToOString( txt, RTL_TEXTENCODING_UTF8 );
+    writer.startElement("inner_text");
     xmlTextWriterWriteString( writer, BAD_CAST( txt8.getStr()));
+    writer.endElement( );
 
     if (GetFmtColl())
     {
@@ -485,7 +487,7 @@ void SwRedlineTbl::dumpAsXml( xmlTextWriterPtr w )
         {
             const SwPosition* pStart = pRedline->Start();
 
-            writer.startElement( "start_swposition" );
+            writer.startElement( "swposition_start" );
             //writer.writeFormatAttribute( "ptr", "%p", pStart );
             {
                 const SwNodeIndex pStartNodeIndex = pStart->nNode;
@@ -499,16 +501,18 @@ void SwRedlineTbl::dumpAsXml( xmlTextWriterPtr w )
                     //writer.endElement( );    // swnode
                     writer.writeFormatAttribute( "swnode_type", TMP_FORMAT, 
pStartSwNode.GetNodeType() );
 
+                    writer.writeFormatAttribute( "paragraph_index", "%d", 
(int)pStartNodeIndex.GetIndex() );
+
                     const SwIndex&    pStartContent   = pStart->nContent;
                     //writer.startElement( "swindex" );
                     //writer.writeFormatAttribute( "ptr", "%p", &pStartContent 
);
                     //writer.writeFormatAttribute( "content_index", "%d", 
pStartContent.GetIndex() );
                     //writer.endElement( );    // swindex
-                    writer.writeFormatAttribute( "swindex_content_index", 
TMP_FORMAT_I32, pStartContent.GetIndex() );
+                    writer.writeFormatAttribute( "character_index", 
TMP_FORMAT_I32, pStartContent.GetIndex() );
                 }
                 //writer.endElement( );    // swnodeindex
             }
-            writer.endElement( );    // start_swposition
+            writer.endElement( );    // swposition_start
 
 
             const SwPosition* pEnd;
@@ -525,7 +529,7 @@ void SwRedlineTbl::dumpAsXml( xmlTextWriterPtr w )
                 pEnd = pRedline->GetPoint();
             }
 
-            writer.startElement( "end___swposition" );
+            writer.startElement( "swposition_end" );
             //writer.writeFormatAttribute( "ptr", "%p", pStart );
             {
                 const SwNodeIndex pEndNodeIndex = pEnd->nNode;
@@ -539,26 +543,35 @@ void SwRedlineTbl::dumpAsXml( xmlTextWriterPtr w )
                     //writer.endElement( );    // swnode
                     writer.writeFormatAttribute( "swnode_type", TMP_FORMAT, 
pEndSwNode.GetNodeType() );
 
+                    writer.writeFormatAttribute( "paragraph_index", "%d", 
(int)pEndNodeIndex.GetIndex() );
+
                     const SwIndex&    pEndContent   = pEnd->nContent;
                     //writer.startElement( "swindex" );
                     //writer.writeFormatAttribute( "ptr", "%p", &pEndContent );
                     //writer.writeFormatAttribute( "content_index", "%d", 
pEndContent.GetIndex() );
                     //writer.endElement( );    // swindex
-                    writer.writeFormatAttribute( "swindex_content_index", 
TMP_FORMAT_I32, pEndContent.GetIndex() );
+                    writer.writeFormatAttribute( "character_index", 
TMP_FORMAT_I32, pEndContent.GetIndex() );
                 }
                 //writer.endElement( );    // swnodeindex
             }
             writer.writeFormatAttribute( "end_is", "%s", BAD_CAST(bEndIsMark ? 
"mark" : "point"));
-            writer.endElement( );    // end_swposition
+            writer.endElement( );    // swposition_end
 
             //const SwRedlineData& aRedlineData = pRedline->GetRedlineData();
             const SwRedlineExtraData* pExtraRedlineData = 
pRedline->GetExtraData();
             writer.startElement( "extra_redline_data" );
             {
-                if (pExtraRedlineData == NULL)
-                    writer.writeFormatAttribute( "data", "%s", BAD_CAST( 
"none" ) );
+                const SwRedlineExtraData_FmtColl*           pExtraData_FmtColl 
          = dynamic_cast<const SwRedlineExtraData_FmtColl*>(pExtraRedlineData);
+                const SwRedlineExtraData_Format*            pExtraData_Format  
          = dynamic_cast<const SwRedlineExtraData_Format*>(pExtraRedlineData);
+                const SwRedlineExtraData_FormattingChanges* 
pExtraData_FormattingChanges = dynamic_cast<const 
SwRedlineExtraData_FormattingChanges*>(pExtraRedlineData);
+                if (pExtraData_FmtColl)
+                    writer.writeFormatAttribute( "extra_data_type", "%s", 
BAD_CAST( "fmt coll" ) );
+                else if (pExtraData_Format)
+                    writer.writeFormatAttribute( "extra_data_type", "%s", 
BAD_CAST( "format" ) );
+                else if (pExtraData_FormattingChanges)
+                    writer.writeFormatAttribute( "extra_data_type", "%s", 
BAD_CAST( "formatting changes" ) );
                 else
-                    writer.writeFormatAttribute( "data", "%s", BAD_CAST( 
"exists" ) );
+                    writer.writeFormatAttribute( "extra_data_type", "%s", 
BAD_CAST( "UNKNOWN" ) );
             }
             writer.endElement( );    // end_swposition
         }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to