sw/source/filter/ww8/docxattributeoutput.cxx | 48 +++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
New commits: commit 4b53d798394f56b99950d280d6cfd93e65d09ee1 Author: Adam Co <rattles2...@gmail.com> Date: Tue Dec 3 12:40:34 2013 +0200 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 <vmik...@collabora.co.uk> Tested-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 41aa1a8..b7f06a0 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits