diff options
author | Adam Co <rattles2013@gmail.com> | 2014-02-03 18:33:15 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-02-12 08:55:43 +0000 |
commit | b62f5c2a22d968d06ea9e638126278bbd1158bf6 (patch) | |
tree | 8812113760cb5ca8e0e8454ed7e8acd43769f13b /sw/source/filter/ww8 | |
parent | 198733f7efbd552e6c0b7fde480474cd1020c250 (diff) |
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@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw/source/filter/ww8')
-rw-r--r-- | sw/source/filter/ww8/attributeoutputbase.hxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 48 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.hxx | 1 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.hxx | 1 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8attributeoutput.hxx | 1 |
7 files changed, 61 insertions, 0 deletions
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx index e5b461abfc3e..b4b8764f8da7 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 7066d9bf6077..f46997f8130d 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 1394906d48c0..9c4728a00396 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 a09625bda1dc..1141aa3afd1c 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 016d00d2ed8a..652f34c9dbc1 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 db97528b36d1..743c0fa5dc20 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 4a2e987be692..21c116089adb 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 ); |