Kaydet (Commit) 40a5d22f authored tarafından Jian Fang Zhang's avatar Jian Fang Zhang Kaydeden (comit) Xisco Fauli

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 d6870e14)

Conflicts:
	writerfilter/source/dmapper/DomainMapper.cxx
	writerfilter/source/dmapper/NumberingManager.cxx

Change-Id: I9be0b82d601bf43da31842edb02c4b0d4e50e84f
üst de00b8bb
...@@ -1585,8 +1585,19 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType ...@@ -1585,8 +1585,19 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
rContext->erase( PropertyDefinition( PROP_NUMBERING_STYLE_NAME, true )); rContext->erase( PropertyDefinition( PROP_NUMBERING_STYLE_NAME, true ));
} }
} }
else if ( !m_pImpl->IsStyleSheetImport( ) ) else
rContext->Insert( PROP_NUMBERING_STYLE_NAME, true, uno::makeAny( OUString() ) ); {
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; break;
case NS_sprm::LN_PFNoLineNumb: // sprmPFNoLineNumb case NS_sprm::LN_PFNoLineNumb: // sprmPFNoLineNumb
......
...@@ -1073,6 +1073,13 @@ void ListsManager::lcl_sprm( Sprm& rSprm ) ...@@ -1073,6 +1073,13 @@ void ListsManager::lcl_sprm( Sprm& rSprm )
pProperties->resolve(*this); pProperties->resolve(*this);
} }
break; 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_rFonts: //contains font properties
case NS_ooxml::LN_EG_RPrBase_color: case NS_ooxml::LN_EG_RPrBase_color:
case NS_ooxml::LN_EG_RPrBase_u: case NS_ooxml::LN_EG_RPrBase_u:
...@@ -1133,7 +1140,31 @@ AbstractListDef::Pointer ListsManager::GetAbstractList( sal_Int32 nId ) ...@@ -1133,7 +1140,31 @@ AbstractListDef::Pointer ListsManager::GetAbstractList( sal_Int32 nId )
while ( !pAbstractList.get( ) && i < nLen ) while ( !pAbstractList.get( ) && i < nLen )
{ {
if ( m_aAbstractLists[i]->GetId( ) == nId ) 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++; i++;
} }
......
...@@ -149,6 +149,9 @@ private: ...@@ -149,6 +149,9 @@ private:
// Only used during the numberings import // Only used during the numberings import
ListLevel::Pointer m_pCurrentLevel; ListLevel::Pointer m_pCurrentLevel;
// The style name linked to.
::rtl::OUString m_sNumStyleLink;
public: public:
typedef boost::shared_ptr< AbstractListDef > Pointer; typedef boost::shared_ptr< AbstractListDef > Pointer;
...@@ -172,6 +175,9 @@ public: ...@@ -172,6 +175,9 @@ public:
virtual com::sun::star::uno::Sequence< virtual com::sun::star::uno::Sequence<
com::sun::star::uno::Sequence< com::sun::star::uno::Sequence<
com::sun::star::beans::PropertyValue > > GetPropertyValues( ); com::sun::star::beans::PropertyValue > > GetPropertyValues( );
void SetNumStyleLink(rtl::OUString sValue) { m_sNumStyleLink = sValue; };
::rtl::OUString GetNumStyleLink() { return m_sNumStyleLink; };
}; };
class ListDef : public AbstractListDef class ListDef : public AbstractListDef
......
...@@ -405,6 +405,8 @@ class StyleSheetPropertyMap : public PropertyMap, public ParagraphProperties ...@@ -405,6 +405,8 @@ class StyleSheetPropertyMap : public PropertyMap, public ParagraphProperties
sal_Int16 mnListLevel; sal_Int16 mnListLevel;
sal_Int16 mnOutlineLevel; sal_Int16 mnOutlineLevel;
sal_Int32 mnNumId;
public: public:
explicit StyleSheetPropertyMap(); explicit StyleSheetPropertyMap();
~StyleSheetPropertyMap(); ~StyleSheetPropertyMap();
...@@ -477,6 +479,9 @@ public: ...@@ -477,6 +479,9 @@ public:
if ( nLevel < WW_OUTLINE_MAX ) if ( nLevel < WW_OUTLINE_MAX )
mnOutlineLevel = nLevel; mnOutlineLevel = nLevel;
} }
sal_Int32 GetNumId() const { return mnNumId; }
void SetNumId(sal_Int32 nId) { mnNumId = nId; }
}; };
......
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