diff options
author | Adam Co <rattles2013@gmail.com> | 2013-12-03 12:40:34 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-12-16 09:22:34 +0000 |
commit | 4b53d798394f56b99950d280d6cfd93e65d09ee1 (patch) | |
tree | df7bcbcf94f02f0b1bf84e651b1a964d8a0ddea4 /sw | |
parent | 75236ba0aa6089dd6bad42cfee627a997a0a4238 (diff) |
Export redline 'formatting changes' back to DOCX
This patch adds support for the export of any redline 'formatting changes'
properties that were imported from a DOCX file under the
'rPrChange'->'rPr' XML node.
Change-Id: Iffb4ce9f6606013a1f6f937d2e62ef0cf9e015b5
Reviewed-on: https://gerrit.libreoffice.org/6909
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 41aa1a8b014e..b7f06a0d50bd 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -30,6 +30,7 @@ #include "tgrditem.hxx" #include "fmtruby.hxx" #include "breakit.hxx" +#include "redline.hxx" #include <comphelper/string.hxx> #include <oox/token/tokens.hxx> @@ -1571,6 +1572,53 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedline) FSNS( XML_w, XML_date ), aDate.getStr(), FSEND ); + // Check if there is any extra data stored in the redline object + if (pRedline->GetExtraData()) + { + const SwRedlineExtraData* pExtraData = pRedline->GetExtraData(); + const SwRedlineExtraData_FormattingChanges* pFormattingChanges = dynamic_cast<const SwRedlineExtraData_FormattingChanges*>(pExtraData); + + // Check if the extra data is of type 'formatting changes' + if (pFormattingChanges) + { + // Get the item set that holds all the changes properties + const SfxItemSet *pChangesSet = pFormattingChanges->GetItemSet(); + if (pChangesSet) + { + m_pSerializer->mark(); + + m_pSerializer->startElementNS( XML_w, XML_rPr, FSEND ); + + // The 'm_pFontsAttrList', 'm_pEastAsianLayoutAttrList', 'm_pCharLangAttrList' are used to hold information + // that should be collected by different properties in the core, and are all flushed together + // to the DOCX when the function 'WriteCollectedRunProperties' gets called. + // So we need to store the current status of these lists, so that we can revert back to them when + // we are done exporting the redline attributes. + ::sax_fastparser::FastAttributeList *pFontsAttrList_Original = m_pFontsAttrList; + ::sax_fastparser::FastAttributeList *pEastAsianLayoutAttrList_Original = m_pEastAsianLayoutAttrList; + ::sax_fastparser::FastAttributeList *pCharLangAttrList_Original = m_pCharLangAttrList; + m_pFontsAttrList = NULL; + m_pEastAsianLayoutAttrList = NULL; + m_pCharLangAttrList = NULL; + + // Output the redline item set + m_rExport.OutputItemSet( *pChangesSet, false, true, i18n::ScriptType::LATIN, m_rExport.mbExportModeRTF ); + + // Write the collected run properties that are stored in 'm_pFontsAttrList', 'm_pEastAsianLayoutAttrList', 'm_pCharLangAttrList' + WriteCollectedRunProperties(); + + // Revert back the original values that were stored in 'm_pFontsAttrList', 'm_pEastAsianLayoutAttrList', 'm_pCharLangAttrList' + m_pFontsAttrList = pFontsAttrList_Original; + m_pEastAsianLayoutAttrList = pEastAsianLayoutAttrList_Original; + m_pCharLangAttrList = pCharLangAttrList_Original; + + m_pSerializer->endElementNS( XML_w, XML_rPr ); + + m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND ); + } + } + } + m_pSerializer->endElementNS( XML_w, XML_rPrChange ); break; |