[Libreoffice-commits] core.git: sw/source

Adam Co rattles2013 at gmail.com
Wed Feb 12 00:56:05 PST 2014


 sw/source/filter/ww8/attributeoutputbase.hxx |    2 +
 sw/source/filter/ww8/docxattributeoutput.cxx |   48 +++++++++++++++++++++++++++
 sw/source/filter/ww8/docxattributeoutput.hxx |    1 
 sw/source/filter/ww8/rtfattributeoutput.cxx  |    4 ++
 sw/source/filter/ww8/rtfattributeoutput.hxx  |    1 
 sw/source/filter/ww8/wrtww8.cxx              |    4 ++
 sw/source/filter/ww8/ww8attributeoutput.hxx  |    1 
 7 files changed, 61 insertions(+)

New commits:
commit b62f5c2a22d968d06ea9e638126278bbd1158bf6
Author: Adam Co <rattles2013 at gmail.com>
Date:   Mon Feb 3 18:33:15 2014 +0200

    DOCX Export of 'Table Row Redline' (like insert row or delete row)
    
    This patch adds support in the DOCX exporter for exporting the
    'table row redlines', such as 'inserted a table row',
    or 'removed a table row'.
    
    Change-Id: If07e3496d8cab8b93b10c6ae3bcaec49369a8c2d
    Reviewed-on: https://gerrit.libreoffice.org/7825
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index e5b461a..b4b8764 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -238,6 +238,8 @@ public:
 
     virtual void TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ) = 0;
 
+    virtual void TableRowRedline( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ) = 0;
+
     virtual void TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ) = 0;
 
     virtual void TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ) = 0;
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 7066d9b..f46997f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -106,6 +106,7 @@
 #include <txtinet.hxx>
 #include <fmtautofmt.hxx>
 #include <docsh.hxx>
+#include <docary.hxx>
 
 #include <osl/file.hxx>
 #include <vcl/embeddedfontshelper.hxx>
@@ -2152,6 +2153,7 @@ void DocxAttributeOutput::StartTableRow( ww8::WW8TableNodeInfoInner::Pointer_t p
                FSNS( XML_w, XML_val ), "true",
                FSEND );
 
+    TableRowRedline( pTableTextNodeInfoInner );
     TableHeight( pTableTextNodeInfoInner );
     TableCanSplit( pTableTextNodeInfoInner );
 
@@ -2358,6 +2360,52 @@ void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_
             FSEND );
 }
 
+void DocxAttributeOutput::TableRowRedline( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
+{
+    const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
+    const SwTableLine * pTabLine = pTabBox->GetUpper();
+
+    // search next Redline
+    const SwExtraRedlineTbl& aExtraRedlineTbl = m_rExport.pDoc->GetExtraRedlineTbl();
+    for(sal_uInt16 nCurRedlinePos = 0; nCurRedlinePos < aExtraRedlineTbl.GetSize(); ++nCurRedlinePos )
+    {
+        SwExtraRedline* pExtraRedline = aExtraRedlineTbl.GetRedline(nCurRedlinePos);
+        const SwTableRowRedline* pTableRowRedline = dynamic_cast<const SwTableRowRedline*>(pExtraRedline);
+        if (pTableRowRedline && pTableRowRedline->GetTableLine() == pTabLine)
+        {
+            // Redline for this table row
+            const SwRedlineData& aRedlineData = pTableRowRedline->GetRedlineData();
+            sal_uInt16 nRedlineType = aRedlineData.GetType();
+            switch (nRedlineType)
+            {
+                case nsRedlineType_t::REDLINE_TABLE_ROW_INSERT:
+                case nsRedlineType_t::REDLINE_TABLE_ROW_DELETE:
+                {
+                    OString aId( OString::number( m_nRedlineId++ ) );
+                    const OUString &rAuthor( SW_MOD()->GetRedlineAuthor( aRedlineData.GetAuthor() ) );
+                    OString aAuthor( OUStringToOString( rAuthor, RTL_TEXTENCODING_UTF8 ) );
+
+                    OString aDate( DateTimeToOString( aRedlineData.GetTimeStamp() ) );
+
+                    if (nRedlineType == nsRedlineType_t::REDLINE_TABLE_ROW_INSERT)
+                        m_pSerializer->singleElementNS( XML_w, XML_ins,
+                            FSNS( XML_w, XML_id ), aId.getStr(),
+                            FSNS( XML_w, XML_author ), aAuthor.getStr(),
+                            FSNS( XML_w, XML_date ), aDate.getStr(),
+                            FSEND );
+                    else if (nRedlineType == nsRedlineType_t::REDLINE_TABLE_ROW_DELETE)
+                        m_pSerializer->singleElementNS( XML_w, XML_del,
+                            FSNS( XML_w, XML_id ), aId.getStr(),
+                            FSNS( XML_w, XML_author ), aAuthor.getStr(),
+                            FSNS( XML_w, XML_date ), aDate.getStr(),
+                            FSEND );
+                }
+                break;
+            };
+        }
+    }
+}
+
 void DocxAttributeOutput::TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
 {
     const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 1394906..9c4728a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -217,6 +217,7 @@ public:
     virtual void TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
     virtual void TableDefaultCellMargins( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
     virtual void TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+    virtual void TableRowRedline( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
     virtual void TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
     virtual void TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
     virtual void TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index a09625b..1141aa3 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -738,6 +738,10 @@ void RtfAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t
     }
 }
 
+void RtfAttributeOutput::TableRowRedline( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/ )
+{
+}
+
 void RtfAttributeOutput::TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
 {
     SAL_INFO("sw.rtf", OSL_THIS_FUNC);
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index 016d00d..652f34c 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -110,6 +110,7 @@ public:
     virtual void TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
     virtual void TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
     virtual void TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
+    virtual void TableRowRedline( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
     virtual void TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
     virtual void TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
     virtual void TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index db97528..743c0fa 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -2088,6 +2088,10 @@ void WW8AttributeOutput::TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTable
     }
 }
 
+void WW8AttributeOutput::TableRowRedline( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/ )
+{
+}
+
 void WW8AttributeOutput::TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
 {
     const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx
index 4a2e987..21c1160 100644
--- a/sw/source/filter/ww8/ww8attributeoutput.hxx
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -102,6 +102,7 @@ public:
     virtual void TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
     virtual void TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
     virtual void TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
+    virtual void TableRowRedline( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
     virtual void TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
     virtual void TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
     virtual void TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );


More information about the Libreoffice-commits mailing list