diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-03-22 08:09:01 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2016-04-07 09:34:43 +0000 |
commit | 8aa9fac23bc8f29de5e91293352f96c99418ddfc (patch) | |
tree | 27b798b3cd0e10aa9411ee69b6384e95c2acf181 /writerfilter | |
parent | c945d4166087e09798d812a466a85d424482e08b (diff) |
tdf#65642 RTF filter: import \pgnrestart and \pgnucltr
This implicitly adds support for DOCX import of <w:pgNumType
w:fmt="upperLetter"> as well.
(cherry picked from commits abaf6bde4ee91c628bd55a7ec2e876a5d0ecff6e and
d29b75c402ea635b3865501e43c9f349885913af)
Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx
Change-Id: Ib19ecb8f7ca0c867ae3be2b41e49ac4cacfd5bb6
Reviewed-on: https://gerrit.libreoffice.org/23730
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 12 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.cxx | 4 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.hxx | 3 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 10 |
4 files changed, 28 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index e350e2dd3ed0..840e0e40f3f2 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -964,6 +964,18 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) if (pSectionContext != nullptr) pSectionContext->SetPageNumber(nIntValue); break; + case NS_ooxml::LN_CT_PageNumber_fmt: + if (pSectionContext) + { + switch (nIntValue) + { + case NS_ooxml::LN_Value_ST_NumberFormat_upperLetter: + // A, B, ... + pSectionContext->SetPageNumberType(style::NumberingType::CHARS_UPPER_LETTER_N); + break; + } + } + break; case NS_ooxml::LN_CT_FtnEdn_type: // This is the "separator" footnote, ignore its linebreak. if (static_cast<sal_uInt32>(nIntValue) == NS_ooxml::LN_Value_doc_ST_FtnEdn_separator) diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 90c4da3e912e..3d712ba1df78 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -404,6 +404,7 @@ SectionPropertyMap::SectionPropertyMap(bool bIsFirstSection) : ,m_bIsLandscape( false ) ,m_bPageNoRestart( false ) ,m_nPageNumber( -1 ) + ,m_nPageNumberType(-1) ,m_nBreakType( -1 ) ,m_nPaperBin( -1 ) ,m_nFirstPaperBin( -1 ) @@ -1192,6 +1193,9 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) nRubyHeight = 0; Insert(PROP_GRID_RUBY_HEIGHT, uno::makeAny( nRubyHeight )); + if (m_nPageNumberType >= 0) + Insert(PROP_NUMBERING_TYPE, uno::makeAny(m_nPageNumberType)); + // #i119558#, force to set document as standard page mode, // refer to ww8 import process function "SwWW8ImplReader::SetDocumentGrid" try diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx index cb6b94d17de4..649ad1bd6cca 100644 --- a/writerfilter/source/dmapper/PropertyMap.hxx +++ b/writerfilter/source/dmapper/PropertyMap.hxx @@ -208,6 +208,8 @@ class SectionPropertyMap : public PropertyMap bool m_bPageNoRestart; sal_Int32 m_nPageNumber; + /// Page number type is a value from css::style::NumberingType. + sal_Int16 m_nPageNumberType; sal_Int32 m_nBreakType; sal_Int32 m_nPaperBin; sal_Int32 m_nFirstPaperBin; @@ -286,6 +288,7 @@ public: void SetEvenlySpaced( bool bSet ) { m_bEvenlySpaced = bSet; } void SetLandscape( bool bSet ) { m_bIsLandscape = bSet; } void SetPageNumber( sal_Int32 nSet ) { m_nPageNumber = nSet; } + void SetPageNumberType(sal_Int32 nSet) { m_nPageNumberType = nSet; } void SetBreakType( sal_Int32 nSet ) { m_nBreakType = nSet; } sal_Int32 GetBreakType( ) { return m_nBreakType; } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 36cb970d79af..c3013f4bf297 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -3253,7 +3253,6 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) case RTF_PGNDEC: case RTF_PGNUCRM: case RTF_PGNLCRM: - case RTF_PGNUCLTR: case RTF_PGNLCLTR: case RTF_PGNBIDIA: case RTF_PGNBIDIB: @@ -3569,6 +3568,15 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) case RTF_LINEBETCOL: lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_cols, NS_ooxml::LN_CT_Columns_sep, std::make_shared<RTFValue>(1)); break; + case RTF_PGNRESTART: + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_start, std::make_shared<RTFValue>(1)); + break; + case RTF_PGNUCLTR: + { + auto pIntValue = std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_NumberFormat_upperLetter); + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgNumType, NS_ooxml::LN_CT_PageNumber_fmt, pIntValue); + } + break; default: { SAL_INFO("writerfilter", "TODO handle flag '" << lcl_RtfToString(nKeyword) << "'"); |