Kaydet (Commit) 29dcdf6b authored tarafından Luboš Luňák's avatar Luboš Luňák

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
üst f853a208
...@@ -63,9 +63,6 @@ StyleSheetEntry::StyleSheetEntry() : ...@@ -63,9 +63,6 @@ StyleSheetEntry::StyleSheetEntry() :
,sNextStyleIdentifier() ,sNextStyleIdentifier()
,pProperties(new StyleSheetPropertyMap) ,pProperties(new StyleSheetPropertyMap)
{ {
#if OSL_DEBUG_LEVEL > 1
nStyleTypeCode = STYLE_TYPE_PARA;
#endif
} }
StyleSheetEntry::~StyleSheetEntry() StyleSheetEntry::~StyleSheetEntry()
...@@ -370,6 +367,14 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val) ...@@ -370,6 +367,14 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val)
(void)nIntValue; (void)nIntValue;
OUString sValue = val.getString(); 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) switch(Name)
{ {
case NS_rtf::LN_ISTD: case NS_rtf::LN_ISTD:
...@@ -385,6 +390,8 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val) ...@@ -385,6 +390,8 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val)
} }
break; break;
case NS_rtf::LN_SGC: 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; m_pImpl->m_pCurrentEntry->nStyleTypeCode = (StyleType)nIntValue;
break; break;
case NS_rtf::LN_ISTDBASE: case NS_rtf::LN_ISTDBASE:
...@@ -421,6 +428,8 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val) ...@@ -421,6 +428,8 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val)
break; break;
case NS_ooxml::LN_CT_Style_type: 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; StyleType nType = ( StyleType ) nIntValue;
if ( nType == STYLE_TYPE_TABLE ) if ( nType == STYLE_TYPE_TABLE )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment