#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
Notes:
merged as: 40a5d22fd4117f8e3ad6807264fb448f4d9959aa
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 8189022..2262054 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2288,10 +2288,19 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
rContext->Insert( PROP_NUMBERING_RULES, true, aRules );
}
}
else if ( !m_pImpl->IsStyleSheetImport( ) )
else
{
rtl::OUString sNone;
rContext->Insert( PROP_NUMBERING_STYLE_NAME, true, uno::makeAny( sNone ) );
if( m_pImpl->IsStyleSheetImport() )
{
// set the number id for AbstractNum references
StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< StyleSheetPropertyMap* >( rContext.get() );
pStyleSheetPropertyMap->SetNumId( nIntValue );
}
else
{
rtl::OUString sNone;
rContext->Insert( PROP_NUMBERING_STYLE_NAME, true, uno::makeAny( sNone ) );
}
}
}
break;
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index fb79bfe..1bacf27 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -947,6 +947,13 @@ void ListsManager::lcl_sprm( Sprm& rSprm )
pLevel->SetParaStyle( pStyle );
}
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:
@@ -1007,7 +1014,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 ca02595..aafa4f7 100644
--- a/writerfilter/source/dmapper/NumberingManager.hxx
+++ b/writerfilter/source/dmapper/NumberingManager.hxx
@@ -128,6 +128,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;
@@ -151,6 +154,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 3ec63ea..9f995ae 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -417,6 +417,8 @@ class StyleSheetPropertyMap : public PropertyMap, public ParagraphProperties
sal_Int16 mnListLevel;
sal_Int16 mnOutlineLevel;
sal_Int32 mnNumId;
public:
explicit StyleSheetPropertyMap();
~StyleSheetPropertyMap();
@@ -497,6 +499,9 @@ public:
if ( nLevel < WW_OUTLINE_MAX )
mnOutlineLevel = nLevel;
}
sal_Int32 GetNumId() const { return mnNumId; }
void SetNumId(sal_Int32 nId) { mnNumId = nId; }
};
/*-- 27.12.2007 12:38:06---------------------------------------------------