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

Adam Co rattles2013 at gmail.com
Wed Feb 12 02:07:27 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 795e71626e2feeadef64e0535a14acf60ccb3b89
Author: Adam Co <rattles2013 at gmail.com>
Date:   Wed Feb 5 13:50:22 2014 +0200

    DOCX Export of 'Table Cell Redline' (like insert cell or delete cell)
    
    This patch adds support in the DOCX exporter for exporting the
    'table cell redlines', such as 'inserted a table cell',
    or 'removed a table cell'.
    
    Change-Id: Ic37d2550691f1090a580dae57d597c8fd09c7ad9
    Reviewed-on: https://gerrit.libreoffice.org/7877
    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 b4b8764..2557d21 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -240,6 +240,8 @@ public:
 
     virtual void TableRowRedline( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo ) = 0;
 
+    virtual void TableCellRedline( 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 f46997f..78b01dc 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2006,6 +2006,9 @@ void DocxAttributeOutput::TableCellProperties( ww8::WW8TableNodeInfoInner::Point
 
     bool bEcma = GetExport().GetFilter().getVersion( ) == oox::core::ECMA_DIALECT;
 
+    // Output any table cell redlines if there are any attached to this specific cell
+    TableCellRedline( pTableTextNodeInfoInner );
+
     // Cell preferred width
     SwTwips nWidth = GetGridCols( pTableTextNodeInfoInner )->at( pTableTextNodeInfoInner->getCell() );
     if ( pTableTextNodeInfoInner->getCell() )
@@ -2406,6 +2409,51 @@ void DocxAttributeOutput::TableRowRedline( ww8::WW8TableNodeInfoInner::Pointer_t
     }
 }
 
+void DocxAttributeOutput::TableCellRedline( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner )
+{
+    const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox();
+
+    // 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 SwTableCellRedline* pTableCellRedline = dynamic_cast<const SwTableCellRedline*>(pExtraRedline);
+        if (pTableCellRedline && pTableCellRedline->GetTableBox() == pTabBox)
+        {
+            // Redline for this table cell
+            const SwRedlineData& aRedlineData = pTableCellRedline->GetRedlineData();
+            sal_uInt16 nRedlineType = aRedlineData.GetType();
+            switch (nRedlineType)
+            {
+                case nsRedlineType_t::REDLINE_TABLE_CELL_INSERT:
+                case nsRedlineType_t::REDLINE_TABLE_CELL_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_CELL_INSERT)
+                        m_pSerializer->singleElementNS( XML_w, XML_cellIns,
+                            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_CELL_DELETE)
+                        m_pSerializer->singleElementNS( XML_w, XML_cellDel,
+                            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 9c4728a..c7965c8 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -218,6 +218,7 @@ public:
     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 TableCellRedline( 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 1141aa3..be583d6 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -742,6 +742,10 @@ void RtfAttributeOutput::TableRowRedline( ww8::WW8TableNodeInfoInner::Pointer_t
 {
 }
 
+void RtfAttributeOutput::TableCellRedline( 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 652f34c..24fefa2 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -111,6 +111,7 @@ public:
     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 TableCellRedline( 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 743c0fa..9fd02e1 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -2092,6 +2092,10 @@ void WW8AttributeOutput::TableRowRedline( ww8::WW8TableNodeInfoInner::Pointer_t
 {
 }
 
+void WW8AttributeOutput::TableCellRedline( 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 21c1160..bca05b7 100644
--- a/sw/source/filter/ww8/ww8attributeoutput.hxx
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -103,6 +103,7 @@ public:
     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 TableCellRedline( 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