[Libreoffice-commits] .: Branch 'libreoffice-3-6' - writerfilter/source

Caolán McNamara caolan at kemper.freedesktop.org
Fri Jul 13 12:56:15 PDT 2012


 writerfilter/source/dmapper/DomainMapper.cxx |   24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

New commits:
commit 62a6b49aa78b0d55342e79aad2ebb60d46349b3b
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Wed Jul 11 12:15:40 2012 +0200

    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
    (cherry picked from commit e7ab4bb6b0e83f01148ffff41e8c5eaa0c5ba0a4)
    
    Signed-off-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index ac52d07..8634644 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1533,6 +1533,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( ) )
@@ -2990,17 +2992,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:


More information about the Libreoffice-commits mailing list