[Libreoffice-commits] core.git: 2 commits - writerfilter/source
Jian Fang Zhang
zhangjf at apache.org
Mon May 20 14:05:43 PDT 2013
writerfilter/source/dmapper/DomainMapper.cxx | 15 ++++++++-
writerfilter/source/dmapper/NumberingManager.cxx | 35 ++++++++++++++++++++++-
writerfilter/source/dmapper/NumberingManager.hxx | 6 +++
writerfilter/source/dmapper/PropertyMap.hxx | 5 +++
4 files changed, 58 insertions(+), 3 deletions(-)
New commits:
commit 0063e19b339b58d919a2348de492a3bd8de57280
Author: Jian Fang Zhang <zhangjf at apache.org>
Date: Thu Oct 25 12:57:56 2012 +0000
#i121134#, more fix for i119657, fallback to old logic to use current AbstractNum when the desired one can not find
Found by: Li Lin Yi
Patch by: Jinlong Wu,wujinlong at gmail.com
Review by: zhangjf
(cherry picked from commit aa53b457faaf0fc50a8b38d17bf219de427a1044)
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index de016d2..98dacdf 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -1157,6 +1157,8 @@ AbstractListDef::Pointer ListsManager::GetAbstractList( sal_Int32 nId )
ListDef::Pointer pList = GetList( pStyleSheetProperties->GetNumId() );
if ( pList!=NULL )
return pList->GetAbstractDefinition();
+ else
+ pAbstractList = m_aAbstractLists[i];
}
}
commit 40a5d22fd4117f8e3ad6807264fb448f4d9959aa
Author: Jian Fang Zhang <zhangjf at apache.org>
Date: Fri Sep 14 13:20:57 2012 +0000
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 at gmail.com
Review by: zhangjf
(cherry picked from commit d6870e145cc7373a422b414c31380cc1399e64cc)
Conflicts:
writerfilter/source/dmapper/DomainMapper.cxx
writerfilter/source/dmapper/NumberingManager.cxx
Change-Id: I9be0b82d601bf43da31842edb02c4b0d4e50e84f
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 896a675..9de2fa6 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 2f89593..de016d2 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 eb23f52..d04d0f9 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 75d78c1..cc2821f 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; }
};
More information about the Libreoffice-commits
mailing list