[PATCH] fdo#65265 : fix for DOCX export of formatting data

Adam CloudOn (via Code Review) gerrit at gerrit.libreoffice.org
Sun Jun 9 09:09:36 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/4215

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/15/4215/1

fdo#65265 : fix for DOCX export of formatting data

Change-Id: Iab3c56e5c3e3cf359e42cf7080883d1408cc3304
---
M sw/source/filter/ww8/docxattributeoutput.cxx
M sw/source/filter/ww8/wrtw8nds.cxx
2 files changed, 52 insertions(+), 2 deletions(-)



diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index a062499..3fb5668 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1323,9 +1323,57 @@
     WriteField_Impl( NULL, eType, rTxt, WRITEFIELD_ALL );
 }
 
-void DocxAttributeOutput::Redline( const SwRedlineData* /*pRedline*/ )
+void DocxAttributeOutput::Redline( const SwRedlineData* pRedline)
 {
-    OSL_TRACE( "TODO DocxAttributeOutput::Redline( const SwRedlineData* pRedline )" );
+    if ( !pRedline )
+        return;
+
+    OString aId( OString::valueOf( sal_Int32(pRedline->GetSeqNo()) ) );
+    const String &rAuthor( SW_MOD()->GetRedlineAuthor( pRedline->GetAuthor() ) );
+    OString aAuthor( OUStringToOString( rAuthor, RTL_TEXTENCODING_UTF8 ) );
+    OString aDate( msfilter::util::DateTimeToOString( pRedline->GetTimeStamp() ) );
+
+    OUString strVal;
+    OString strOVal;
+
+    switch( pRedline->GetType() )
+    {
+    case nsRedlineType_t::REDLINE_INSERT:
+        break;
+
+    case nsRedlineType_t::REDLINE_DELETE:
+        break;
+
+    case nsRedlineType_t::REDLINE_FORMAT:
+        m_pSerializer->startElementNS( XML_w, XML_rPrChange,
+                FSNS( XML_w, XML_id ), aId.getStr(),
+                FSNS( XML_w, XML_author ), aAuthor.getStr(),
+                FSNS( XML_w, XML_date ), aDate.getStr(),
+                FSEND );
+
+        if ( m_pCharLangAttrList )
+        {
+            if (m_pCharLangAttrList->hasAttribute(FSNS(XML_w, XML_val)))
+            {
+                m_pSerializer->mark();
+                m_pSerializer->startElementNS( XML_w, XML_rPr, FSEND );
+                strVal = m_pCharLangAttrList->getValue(FSNS(XML_w, XML_val));
+                strOVal = OUStringToOString(strVal, RTL_TEXTENCODING_UTF8);
+                m_pSerializer->startElementNS(XML_w, XML_lang,
+                    FSNS(XML_w, XML_val), strOVal.getStr(),
+                    FSEND);
+                m_pSerializer->endElementNS(XML_w, XML_lang);
+                m_pSerializer->endElementNS( XML_w, XML_rPr );
+                m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND );
+            }
+        }
+
+        m_pSerializer->endElementNS( XML_w, XML_rPrChange );
+        break;
+    default:
+        OSL_ENSURE(!this, "Unhandled redline type for export");
+        break;
+    }
 }
 
 void DocxAttributeOutput::StartRedline()
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 83bd794..9d818da 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1957,6 +1957,8 @@
             // #i51277# do this before writing flys at end of paragraph
             AttrOutput().StartRunProperties();
             aAttrIter.OutAttr( nAktPos );
+            if (pRedlineData)
+                AttrOutput().Redline(pRedlineData);
             AttrOutput().EndRunProperties( pRedlineData );
         }
 

-- 
To view, visit https://gerrit.libreoffice.org/4215
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab3c56e5c3e3cf359e42cf7080883d1408cc3304
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Adam CloudOn <rattles2013 at gmail.com>



More information about the LibreOffice mailing list