diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-02-28 14:20:00 +0100 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-03-07 08:29:54 +0000 |
commit | 202d4d32d481ce7e2d1f9933186b30f9ae77497a (patch) | |
tree | 1dd0b6cbe6731e40e96116f9bb6f40a16f7ab5f3 /writerfilter | |
parent | 86da16bb0ce4c4f2d0102198159d420bf376aea6 (diff) |
fdo#59638 import of DOCX w:lvlOverride / RTF_LFOLEVEL
Also handle RTF_F inside RTF_LISTLEVEL. Word typically uses the Symbol
font to describe bullet characters instead of using a sane Unicode
value, the previous can only be handled if we parse the custom font set
for the list.
(cherry picked from commits 521586b328305c4466603438a9931993b92873c6,
2f82a08d3565239c2bfe8d21fbebd89bd4657708 and
58c30a3545a5725d704eabd79071db02f1f2cb23)
Change-Id: I1491f07c40953949e381a035c1596c207cdc4c35
Reviewed-on: https://gerrit.libreoffice.org/2503
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/NumberingManager.cxx | 9 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 25 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.hxx | 1 |
3 files changed, 33 insertions, 2 deletions
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index 529a7940c806..470cb0cc485f 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -495,7 +495,7 @@ uno::Sequence< uno::Sequence< beans::PropertyValue > > ListDef::GetPropertyValue for ( sal_Int32 i = 0; i < nThisCount; i++ ) { uno::Sequence< beans::PropertyValue > level = aThis[i]; - if ( level.getLength( ) == 0 ) + if ( level.hasElements() ) { // If the the element contains something, merge it lcl_mergeProperties( level, aAbstract[i] ); @@ -953,6 +953,13 @@ void ListsManager::lcl_sprm( Sprm& rSprm ) pLevel->SetParaStyle( pStyle ); } break; + case NS_ooxml::LN_CT_Num_lvlOverride: + { + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); + if (pProperties.get()) + pProperties->resolve(*this); + } + break; case NS_ooxml::LN_EG_RPrBase_rFonts: //contains font properties case NS_ooxml::LN_EG_RPrBase_color: case NS_ooxml::LN_EG_RPrBase_u: diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index d966275dd93b..c35b0d90e185 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -1238,6 +1238,10 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) case RTF_LIST: m_aStates.top().nDestinationState = DESTINATION_LISTENTRY; break; + case RTF_LFOLEVEL: + m_aStates.top().nDestinationState = DESTINATION_LFOLEVEL; + m_aStates.top().aTableSprms.clear(); + break; case RTF_LISTOVERRIDETABLE: m_aStates.top().nDestinationState = DESTINATION_LISTOVERRIDETABLE; break; @@ -2716,6 +2720,14 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) m_aFontIndexes.push_back(nParam); m_nCurrentFontIndex = getFontIndex(nParam); } + else if (m_aStates.top().nDestinationState == DESTINATION_LISTLEVEL) + { + RTFSprms aFontSprms; + aFontSprms.set(NS_sprm::LN_CRgFtc0, RTFValue::Pointer_t(new RTFValue(getFontIndex(nParam)))); + RTFSprms aRunPropsSprms; + aRunPropsSprms.set(NS_ooxml::LN_EG_RPrBase_rFonts, RTFValue::Pointer_t(new RTFValue(RTFSprms(), aFontSprms))); + m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_rPr, RTFValue::Pointer_t(new RTFValue(RTFSprms(), aRunPropsSprms))); + } else { int nFontIndex = getFontIndex(nParam); @@ -4195,7 +4207,18 @@ int RTFDocumentImpl::popState() aState.aTableAttributes.set(NS_ooxml::LN_CT_Lvl_ilvl, pInnerValue); RTFValue::Pointer_t pValue(new RTFValue(aState.aTableAttributes, aState.aTableSprms)); - m_aStates.top().aListLevelEntries.set(NS_ooxml::LN_CT_AbstractNum_lvl, pValue, false); + if (m_aStates.top().nDestinationState != DESTINATION_LFOLEVEL) + m_aStates.top().aListLevelEntries.set(NS_ooxml::LN_CT_AbstractNum_lvl, pValue, false); + else + m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_NumLvl_lvl, pValue); + } + else if (aState.nDestinationState == DESTINATION_LFOLEVEL) + { + RTFValue::Pointer_t pInnerValue(new RTFValue(m_aStates.top().nListLevelNum++)); + aState.aTableAttributes.set(NS_ooxml::LN_CT_NumLvl_ilvl, pInnerValue); + + RTFValue::Pointer_t pValue(new RTFValue(aState.aTableAttributes, aState.aTableSprms)); + m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Num_lvlOverride, pValue); } // list override table else if (aState.nDestinationState == DESTINATION_LISTOVERRIDEENTRY) diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index a26d3ff7679e..c7affd7fe032 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -179,6 +179,7 @@ namespace writerfilter { DESTINATION_MBOX, DESTINATION_MEQARR, DESTINATION_UPR, + DESTINATION_LFOLEVEL, }; enum RTFBorderState |