diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-06-13 23:49:59 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-06-17 18:44:31 +0200 |
commit | 051e6fefda2411d93cb4bbe4cb3bbbd60861d8fc (patch) | |
tree | 77d12f2bf458bcfb87c963ced600a132a85f7371 /writerfilter | |
parent | c8921d9ef99b46761a630711ab17b3022d018db5 (diff) |
fdo#70578: writerfilter RTF import: by default style is para style 0
quoth the spec:
"For <style>, both <styledef> and <stylename> are optional; the default
is paragraph style 0."
Of course in order to do that we need to add support for at least
recognizing the \dsN and \tsN keywords to override the default, so that
table styles don't become paragraph styles.
Change-Id: Ic100768581f9e8c327063ff776fbd61ac4242483
(cherry picked from commit 6c0e1270889deb513f961f864dfc1c02ee8705f4)
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index aafc9726bed5..d8ad8d0f718b 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -3624,6 +3624,23 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_rStyle, RTFValue::Pointer_t(new RTFValue(aName))); } break; + case RTF_DS: + if (m_aStates.top().nDestinationState == DESTINATION_STYLESHEET || m_aStates.top().nDestinationState == DESTINATION_STYLEENTRY) + { + m_nCurrentStyleIndex = nParam; + RTFValue::Pointer_t pValue(new RTFValue(-42)); // TODO no value in enum StyleType? + m_aStates.top().aTableAttributes.set( + NS_ooxml::LN_CT_Style_type, pValue); // section style + } + break; + case RTF_TS: + if (m_aStates.top().nDestinationState == DESTINATION_STYLESHEET || m_aStates.top().nDestinationState == DESTINATION_STYLEENTRY) + { + m_nCurrentStyleIndex = nParam; + RTFValue::Pointer_t pValue(new RTFValue(-43)); // FIXME the correct value would be 3 but maybe table styles mess things up in dmapper, be cautious and disable them for now + m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); // table style + } + break; case RTF_DEFF: m_nDefaultFontIndex = nParam; break; @@ -4666,6 +4683,13 @@ int RTFDocumentImpl::pushState() break; case DESTINATION_STYLESHEET: m_aStates.top().nDestinationState = DESTINATION_STYLEENTRY; + { + // the *default* is \s0 i.e. paragraph style default + // this will be overwritten by \sN \csN \dsN \tsN + m_nCurrentStyleIndex = 0; + RTFValue::Pointer_t pValue(new RTFValue(1)); + m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); + } break; case DESTINATION_FIELDRESULT: case DESTINATION_SHAPETEXT: |