diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2013-04-24 20:48:53 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2013-04-24 20:51:15 +0200 |
commit | 29dcdf6b56f8dbc1b7de0478afb04122f8dbf0f9 (patch) | |
tree | d1899ec70a231a67af20a2fb9eb48d272f399bcc /writerfilter | |
parent | f853a20839ab08244dc1b3b1c881822bd593bc04 (diff) |
check for NS_ooxml::LN_CT_Style_type being processed first
The code relies on NS_ooxml::LN_CT_Style_type being handled first
(because of m_pImpl->m_pCurrentEntry being reset there), so
at least check for it. Still no idea how to actually ensure
the correct ordering in this overdesigned $#%@! writerfilter thing.
Change-Id: Ib6a2129a078728e162257275ac2a1243dbaf4017
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/StyleSheetTable.cxx | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 8766d73fcbda..f0569fa5a100 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -63,9 +63,6 @@ StyleSheetEntry::StyleSheetEntry() : ,sNextStyleIdentifier() ,pProperties(new StyleSheetPropertyMap) { -#if OSL_DEBUG_LEVEL > 1 - nStyleTypeCode = STYLE_TYPE_PARA; -#endif } StyleSheetEntry::~StyleSheetEntry() @@ -370,6 +367,14 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val) (void)nIntValue; OUString sValue = val.getString(); + // The default type is paragraph, and it needs to be processed first, + // because the NS_ooxml::LN_CT_Style_type handling may set m_pImpl->m_pCurrentEntry + // to point to a different object. + if( m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_UNKNOWN ) + { + if( Name != NS_rtf::LN_SGC && Name != NS_ooxml::LN_CT_Style_type ) + m_pImpl->m_pCurrentEntry->nStyleTypeCode = STYLE_TYPE_PARA; + } switch(Name) { case NS_rtf::LN_ISTD: @@ -385,6 +390,8 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val) } break; case NS_rtf::LN_SGC: + SAL_WARN_IF( m_pImpl->m_pCurrentEntry->nStyleTypeCode != STYLE_TYPE_UNKNOWN, + "writerfilter", "Style type needs to be processed first" ); m_pImpl->m_pCurrentEntry->nStyleTypeCode = (StyleType)nIntValue; break; case NS_rtf::LN_ISTDBASE: @@ -421,6 +428,8 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val) break; case NS_ooxml::LN_CT_Style_type: { + SAL_WARN_IF( m_pImpl->m_pCurrentEntry->nStyleTypeCode != STYLE_TYPE_UNKNOWN, + "writerfilter", "Style type needs to be processed first" ); StyleType nType = ( StyleType ) nIntValue; if ( nType == STYLE_TYPE_TABLE ) { |