diff options
author | Jian Fang Zhang <zhangjf@apache.org> | 2012-09-14 13:20:57 +0000 |
---|---|---|
committer | Xisco Fauli <anistenis@gmail.com> | 2013-05-20 23:04:45 +0200 |
commit | 40a5d22fd4117f8e3ad6807264fb448f4d9959aa (patch) | |
tree | ddb4d9e746b7518bb0809f407f7cb6600aa0789d /writerfilter | |
parent | de00b8bb67b7453b45e081fe602782803eab1349 (diff) |
Related: #i119657#, importing docx, add code to handle the problem...
that an AbstracNum references to a style, which references to another Num
Found by: xiao ting xiao
Patch by: Jinlong Wu,wujinlong@gmail.com
Review by: zhangjf
(cherry picked from commit d6870e145cc7373a422b414c31380cc1399e64cc)
Conflicts:
writerfilter/source/dmapper/DomainMapper.cxx
writerfilter/source/dmapper/NumberingManager.cxx
Change-Id: I9be0b82d601bf43da31842edb02c4b0d4e50e84f
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 15 | ||||
-rw-r--r-- | writerfilter/source/dmapper/NumberingManager.cxx | 33 | ||||
-rw-r--r-- | writerfilter/source/dmapper/NumberingManager.hxx | 6 | ||||
-rw-r--r-- | writerfilter/source/dmapper/PropertyMap.hxx | 5 |
4 files changed, 56 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 896a675b28a7..9de2fa68c9b6 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1585,8 +1585,19 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType rContext->erase( PropertyDefinition( PROP_NUMBERING_STYLE_NAME, true )); } } - else if ( !m_pImpl->IsStyleSheetImport( ) ) - rContext->Insert( PROP_NUMBERING_STYLE_NAME, true, uno::makeAny( OUString() ) ); + else + { + if( m_pImpl->IsStyleSheetImport() ) + { + // set the number id for AbstractNum references + StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< StyleSheetPropertyMap* >( rContext.get() ); + pStyleSheetPropertyMap->SetNumId( nIntValue ); + } + else + { + rContext->Insert( PROP_NUMBERING_STYLE_NAME, true, uno::makeAny( OUString() ) ); + } + } } break; case NS_sprm::LN_PFNoLineNumb: // sprmPFNoLineNumb diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index 2f895934ba19..de016d2aef7a 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -1073,6 +1073,13 @@ void ListsManager::lcl_sprm( Sprm& rSprm ) pProperties->resolve(*this); } break; + case NS_ooxml::LN_CT_AbstractNum_numStyleLink: + { + OUString sStyleName = rSprm.getValue( )->getString( ); + AbstractListDef* pAbstractListDef = dynamic_cast< AbstractListDef* >( m_pCurrentDefinition.get( ) ); + pAbstractListDef->SetNumStyleLink(sStyleName); + } + break; case NS_ooxml::LN_EG_RPrBase_rFonts: //contains font properties case NS_ooxml::LN_EG_RPrBase_color: case NS_ooxml::LN_EG_RPrBase_u: @@ -1133,7 +1140,31 @@ AbstractListDef::Pointer ListsManager::GetAbstractList( sal_Int32 nId ) while ( !pAbstractList.get( ) && i < nLen ) { if ( m_aAbstractLists[i]->GetId( ) == nId ) - pAbstractList = m_aAbstractLists[i]; + { + if ( m_aAbstractLists[i]->GetNumStyleLink().getLength() > 0 ) + { + // If the abstract num has a style linked, check the linked style's number id. + StyleSheetTablePtr pStylesTable = m_rDMapper.GetStyleSheetTable( ); + + const StyleSheetEntryPtr pStyleSheetEntry = + pStylesTable->FindStyleSheetByISTD( m_aAbstractLists[i]->GetNumStyleLink() ); + + const StyleSheetPropertyMap* pStyleSheetProperties = + dynamic_cast<const StyleSheetPropertyMap*>(pStyleSheetEntry ? pStyleSheetEntry->pProperties.get() : 0); + + if( pStyleSheetProperties && pStyleSheetProperties->GetNumId() >= 0 ) + { + ListDef::Pointer pList = GetList( pStyleSheetProperties->GetNumId() ); + if ( pList!=NULL ) + return pList->GetAbstractDefinition(); + } + + } + else + { + pAbstractList = m_aAbstractLists[i]; + } + } i++; } diff --git a/writerfilter/source/dmapper/NumberingManager.hxx b/writerfilter/source/dmapper/NumberingManager.hxx index eb23f528786a..d04d0f96ed41 100644 --- a/writerfilter/source/dmapper/NumberingManager.hxx +++ b/writerfilter/source/dmapper/NumberingManager.hxx @@ -149,6 +149,9 @@ private: // Only used during the numberings import ListLevel::Pointer m_pCurrentLevel; + // The style name linked to. + ::rtl::OUString m_sNumStyleLink; + public: typedef boost::shared_ptr< AbstractListDef > Pointer; @@ -172,6 +175,9 @@ public: virtual com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > GetPropertyValues( ); + + void SetNumStyleLink(rtl::OUString sValue) { m_sNumStyleLink = sValue; }; + ::rtl::OUString GetNumStyleLink() { return m_sNumStyleLink; }; }; class ListDef : public AbstractListDef diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx index 75d78c190e1a..cc2821fa5862 100644 --- a/writerfilter/source/dmapper/PropertyMap.hxx +++ b/writerfilter/source/dmapper/PropertyMap.hxx @@ -405,6 +405,8 @@ class StyleSheetPropertyMap : public PropertyMap, public ParagraphProperties sal_Int16 mnListLevel; sal_Int16 mnOutlineLevel; + + sal_Int32 mnNumId; public: explicit StyleSheetPropertyMap(); ~StyleSheetPropertyMap(); @@ -477,6 +479,9 @@ public: if ( nLevel < WW_OUTLINE_MAX ) mnOutlineLevel = nLevel; } + + sal_Int32 GetNumId() const { return mnNumId; } + void SetNumId(sal_Int32 nId) { mnNumId = nId; } }; |