diff options
author | Adam Co <rattles2013@gmail.com> | 2014-02-03 14:13:37 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-02-11 13:51:46 +0000 |
commit | af84f04c10724fdeecfc25de46fa1d54cf905bd2 (patch) | |
tree | 38b455b882cb3096c8e51b7d723ea644ed6d9196 /writerfilter | |
parent | 88fbcba044878173f2458eede798f03de25f9cb9 (diff) |
Refactor some code for handling redline in DOCX importer
Change-Id: Id5d0814c1ebbcd85507d11cf562d394a748773a6
Reviewed-on: https://gerrit.libreoffice.org/7807
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/inc/dmapper/DomainMapper.hxx | 2 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 57 |
2 files changed, 39 insertions, 20 deletions
diff --git a/writerfilter/inc/dmapper/DomainMapper.hxx b/writerfilter/inc/dmapper/DomainMapper.hxx index f7d6fcb94d3b..ce30d69b5de2 100644 --- a/writerfilter/inc/dmapper/DomainMapper.hxx +++ b/writerfilter/inc/dmapper/DomainMapper.hxx @@ -129,6 +129,8 @@ public: uno::Sequence<beans::PropertyValue> GetThemeFontLangProperties() const; + void HandleRedline( Sprm& rSprm ); + private: // Stream virtual void lcl_startSectionGroup(); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index bd8e6fd60a99..5751e33ffd0d 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -2224,26 +2224,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType case NS_ooxml::LN_trackchange: case NS_ooxml::LN_EG_RPrContent_rPrChange: { - m_pImpl->AddNewRedline( ); - - if (nSprmId == NS_ooxml::LN_CT_PPr_pPrChange) - { - m_pImpl->SetCurrentRedlineToken( ooxml::OOXML_ParagraphFormat ); - } - - resolveSprmProps(*this, rSprm ); - // now the properties author, date and id should be available - sal_Int32 nToken = m_pImpl->GetCurrentRedlineToken(); - switch( nToken & 0xffff ) - { - case ooxml::OOXML_mod : - case ooxml::OOXML_ins : - case ooxml::OOXML_del : - case ooxml::OOXML_ParagraphFormat : - break; - default: OSL_FAIL( "redline token other than mod, ins or del" ); - } - m_pImpl->EndParaMarkerChange( ); + HandleRedline( rSprm ); } break; case NS_ooxml::LN_endtrackchange: @@ -3190,6 +3171,42 @@ uno::Sequence<beans::PropertyValue> DomainMapper::GetThemeFontLangProperties() c return m_pImpl->GetSettingsTable()->GetThemeFontLangProperties(); } +void DomainMapper::HandleRedline( Sprm& rSprm ) +{ + sal_uInt32 nSprmId = rSprm.getId(); + + m_pImpl->AddNewRedline( ); + + if (nSprmId == NS_ooxml::LN_CT_PPr_pPrChange) + { + m_pImpl->SetCurrentRedlineToken( ooxml::OOXML_ParagraphFormat ); + } + else if (nSprmId == NS_ooxml::LN_CT_TrPr_ins) + { + m_pImpl->SetCurrentRedlineToken( ooxml::OOXML_tableRowInsert ); + } + else if (nSprmId == NS_ooxml::LN_CT_TrPr_del) + { + m_pImpl->SetCurrentRedlineToken( ooxml::OOXML_tableRowDelete ); + } + + resolveSprmProps(*this, rSprm ); + // now the properties author, date and id should be available + sal_Int32 nToken = m_pImpl->GetCurrentRedlineToken(); + switch( nToken & 0xffff ) + { + case ooxml::OOXML_mod : + case ooxml::OOXML_ins : + case ooxml::OOXML_del : + case ooxml::OOXML_ParagraphFormat : + case ooxml::OOXML_tableRowInsert: + case ooxml::OOXML_tableRowDelete: + break; + default: OSL_FAIL( "redline token other than mod, ins, del or table row" ); break; + } + m_pImpl->EndParaMarkerChange( ); +} + } //namespace dmapper } //namespace writerfilter |