diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-08-17 11:38:45 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-08-18 14:04:12 +0000 |
commit | 28771ae622f648a6e424d3d664333e0407df4739 (patch) | |
tree | 0c80acd40cad102fba7a5a01846df0795803260e /writerfilter | |
parent | f5475f4f85bc6cae51cbd4424dcc7a35cc2ef2dc (diff) |
fdo#44715 RTF import: reset styles in tables on RTF_PARD
Commit 4a507f732d82c188ad81b022cbe3037951e58ac3 added an exception to
RTF_PARD (reset paragraph properties) handling: when we're inside a
table, it should not reset the fact that we're inside a table (which is
a paragraph property).
However, instead of just re-adding that property, it disabled resetting
for all properties, and we had a growing list of exceptions since then.
The next thing to add there would be the paragraph attributes, which
contains the style information. Instead of growing that ad-hoc list,
reset everything again and just re-add the "in table" SPRM.
This makes the second and later paragraphs in the A1 cell of the bugdoc
have proper font size.
(cherry picked from commit b9c1a9b9aa41dbbb6bed0c77f4370ab6105c7fb1)
Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx
writerfilter/source/rtftok/rtfdocumentimpl.cxx
Change-Id: I2de80894fcd5da3bf45d221af9a04a307c70a29b
Reviewed-on: https://gerrit.libreoffice.org/5471
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 2383c11cf552..e0a4c2043a30 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2247,22 +2247,18 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) if (m_bHadPicture) dispatchSymbol(RTF_PAR); // \pard is allowed between \cell and \row, but in that case it should not reset the fact that we're inside a table. + m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms; + m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes; if (m_aStates.top().nCells == 0) { - // Reset everything. - m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms; - m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes; + // Reset that we're in a table. if (m_aStates.top().pCurrentBuffer != &m_aShapetextBuffer) m_aStates.top().pCurrentBuffer = 0; } else { - // Reset only margins. - lcl_eraseNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_before); - lcl_eraseNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_after); - m_aStates.top().aParagraphSprms.erase(NS_sprm::LN_PDxaLeft); - m_aStates.top().aParagraphSprms.erase(NS_sprm::LN_PDxaRight); - m_aStates.top().aParagraphSprms.erase(NS_sprm::LN_PJc); + // We are still in a table. + m_aStates.top().aParagraphSprms.set(NS_sprm::LN_PFInTable, RTFValue::Pointer_t(new RTFValue(1))); } m_aStates.top().resetFrame(); break; |