incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhan...@apache.org
Subject svn commit: r1384796 - in /incubator/ooo/trunk/main/writerfilter/source/dmapper: DomainMapper.cxx NumberingManager.cxx NumberingManager.hxx PropertyMap.hxx
Date Fri, 14 Sep 2012 14:20:57 GMT
Author: zhangjf
Date: Fri Sep 14 14:20:57 2012
New Revision: 1384796

URL: http://svn.apache.org/viewvc?rev=1384796&view=rev
Log:
#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

Modified:
    incubator/ooo/trunk/main/writerfilter/source/dmapper/DomainMapper.cxx
    incubator/ooo/trunk/main/writerfilter/source/dmapper/NumberingManager.cxx
    incubator/ooo/trunk/main/writerfilter/source/dmapper/NumberingManager.hxx
    incubator/ooo/trunk/main/writerfilter/source/dmapper/PropertyMap.hxx

Modified: incubator/ooo/trunk/main/writerfilter/source/dmapper/DomainMapper.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/writerfilter/source/dmapper/DomainMapper.cxx?rev=1384796&r1=1384795&r2=1384796&view=diff
==============================================================================
--- incubator/ooo/trunk/main/writerfilter/source/dmapper/DomainMapper.cxx (original)
+++ incubator/ooo/trunk/main/writerfilter/source/dmapper/DomainMapper.cxx Fri Sep 14 14:20:57
2012
@@ -2288,10 +2288,19 @@ void DomainMapper::sprmWithProps( Sprm& 
                     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;

Modified: incubator/ooo/trunk/main/writerfilter/source/dmapper/NumberingManager.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/writerfilter/source/dmapper/NumberingManager.cxx?rev=1384796&r1=1384795&r2=1384796&view=diff
==============================================================================
--- incubator/ooo/trunk/main/writerfilter/source/dmapper/NumberingManager.cxx (original)
+++ incubator/ooo/trunk/main/writerfilter/source/dmapper/NumberingManager.cxx Fri Sep 14 14:20:57
2012
@@ -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::G
     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++;
     }
 

Modified: incubator/ooo/trunk/main/writerfilter/source/dmapper/NumberingManager.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/writerfilter/source/dmapper/NumberingManager.hxx?rev=1384796&r1=1384795&r2=1384796&view=diff
==============================================================================
--- incubator/ooo/trunk/main/writerfilter/source/dmapper/NumberingManager.hxx (original)
+++ incubator/ooo/trunk/main/writerfilter/source/dmapper/NumberingManager.hxx Fri Sep 14 14:20:57
2012
@@ -127,6 +127,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

Modified: incubator/ooo/trunk/main/writerfilter/source/dmapper/PropertyMap.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/writerfilter/source/dmapper/PropertyMap.hxx?rev=1384796&r1=1384795&r2=1384796&view=diff
==============================================================================
--- incubator/ooo/trunk/main/writerfilter/source/dmapper/PropertyMap.hxx (original)
+++ incubator/ooo/trunk/main/writerfilter/source/dmapper/PropertyMap.hxx Fri Sep 14 14:20:57
2012
@@ -417,6 +417,8 @@ class StyleSheetPropertyMap : public Pro
     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---------------------------------------------------
 



Mime
View raw message