summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-07-11 12:15:40 +0200
committerLuboš Luňák <l.lunak@suse.cz>2012-07-11 15:18:56 +0200
commite7ab4bb6b0e83f01148ffff41e8c5eaa0c5ba0a4 (patch)
treec139d0e9c159c0f8b575131cd8d51b143c67bf5f /writerfilter
parentb1cab9fe4531ea552fe20ab3c896ba5fbf385bc9 (diff)
do not let a style override paragraph's numbering
If a paragraph has its own <w:numPr>, do not let <w:pStyle> override that. Change-Id: I7cea0d1c8bf59804f8c56382ee68c7fad5ed3ef6
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx24
1 files changed, 15 insertions, 9 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 03ef24d9d231..0d9ffd078b50 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1524,6 +1524,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
{
uno::Any aRules = uno::makeAny( pList->GetNumberingRules( ) );
rContext->Insert( PROP_NUMBERING_RULES, true, aRules );
+ // erase numbering from pStyle if already set
+ rContext->erase( PropertyDefinition( PROP_NUMBERING_STYLE_NAME, true ));
}
}
else if ( !m_pImpl->IsStyleSheetImport( ) )
@@ -2981,17 +2983,21 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
const ::rtl::OUString sConvertedStyleName = pStyleTable->ConvertStyleName( sStringValue, true );
if (m_pImpl->GetTopContext() && m_pImpl->GetTopContextType() != CONTEXT_SECTION)
m_pImpl->GetTopContext()->Insert( PROP_PARA_STYLE_NAME, true, uno::makeAny( sConvertedStyleName ));
- const StyleSheetEntryPtr pEntry = pStyleTable->FindStyleSheetByISTD(sStringValue);
- //apply numbering to paragraph if it was set at the style
- OSL_ENSURE( pEntry.get(), "no style sheet found" );
- const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_cast<const StyleSheetPropertyMap*>(pEntry ? pEntry->pProperties.get() : 0);
+ //apply numbering to paragraph if it was set at the style, but only if the paragraph itself
+ //does not specify the numbering
+ if( rContext->find( PropertyDefinition( PROP_NUMBERING_RULES, true )) == rContext->end()) // !contains
+ {
+ const StyleSheetEntryPtr pEntry = pStyleTable->FindStyleSheetByISTD(sStringValue);
+ OSL_ENSURE( pEntry.get(), "no style sheet found" );
+ const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_cast<const StyleSheetPropertyMap*>(pEntry ? pEntry->pProperties.get() : 0);
- if( pStyleSheetProperties && pStyleSheetProperties->GetListId() >= 0 )
- rContext->Insert( PROP_NUMBERING_STYLE_NAME, true, uno::makeAny(
- ListDef::GetStyleName( pStyleSheetProperties->GetListId( ) ) ), false);
+ if( pStyleSheetProperties && pStyleSheetProperties->GetListId() >= 0 )
+ rContext->Insert( PROP_NUMBERING_STYLE_NAME, true, uno::makeAny(
+ ListDef::GetStyleName( pStyleSheetProperties->GetListId( ) ) ), false);
- if( pStyleSheetProperties && pStyleSheetProperties->GetListLevel() >= 0 )
- rContext->Insert( PROP_NUMBERING_LEVEL, true, uno::makeAny(pStyleSheetProperties->GetListLevel()), false);
+ if( pStyleSheetProperties && pStyleSheetProperties->GetListLevel() >= 0 )
+ rContext->Insert( PROP_NUMBERING_LEVEL, true, uno::makeAny(pStyleSheetProperties->GetListLevel()), false);
+ }
}
break;
case NS_ooxml::LN_EG_RPrBase_rStyle: