[Libreoffice-commits] .: 2 commits - sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Sep 27 16:57:54 PDT 2012


 sc/source/filter/oox/extlstcontext.cxx |    8 +++++++-
 sc/source/filter/oox/formulabuffer.cxx |   17 +++++++++--------
 2 files changed, 16 insertions(+), 9 deletions(-)

New commits:
commit 6ed264ffca065ed2aa36624ba29d9764ff042a72
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Sep 28 01:22:44 2012 +0200

    fix vell value import from ooxml with array formulas, fdo#54559
    
    Change-Id: I3a7e30940caaaa543a178bba3008db2c6056b4d3

diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx
index f2f1d69..70efcaf 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -99,23 +99,23 @@ void FormulaBuffer::finalizeImport()
             applyCellFormulas( cellIt->second );
         }
 
+        ArrayFormulaDataMap::iterator itArray = cellArrayFormulas.find( nTab );
+        if ( itArray != cellArrayFormulas.end() )
+        {
+            applyArrayFormulas( itArray->second );
+        }
+
         FormulaValueMap::iterator itValues = cellFormulaValues.find( nTab );
         if ( itValues != cellFormulaValues.end() )
         {
             std::vector< ValueAddressPair > & rVector = itValues->second;
             applyCellFormulaValues( rVector );
         }
-
-        ArrayFormulaDataMap::iterator itArray = cellArrayFormulas.find( nTab );
-
-        if ( itArray != cellArrayFormulas.end() )
-        {
-            applyArrayFormulas( itArray->second );
-        }
     }
     rDoc.SetAutoNameCache( NULL );
     xFormulaBar->setPosition( 1.0 );
 }
+
 void FormulaBuffer::applyCellFormula( ScDocument& rDoc, const ApiTokenSequence& rTokens, const ::com::sun::star::table::CellAddress& rAddress )
 {
         ScTokenArray aTokenArray;
@@ -145,7 +145,8 @@ void FormulaBuffer::applyCellFormulaValues( const std::vector< ValueAddressPair
         ScAddress aCellPos;
         ScUnoConversion::FillScAddress( aCellPos, it->first );
         ScBaseCell* pBaseCell = rDoc.GetCell( aCellPos );
-        if ( pBaseCell->GetCellType() == CELLTYPE_FORMULA )
+        SAL_WARN_IF( !pBaseCell, "sc", "why is the formula not imported? bug?");
+        if ( pBaseCell && pBaseCell->GetCellType() == CELLTYPE_FORMULA )
         {
             ScFormulaCell* pCell = static_cast< ScFormulaCell* >( pBaseCell );
             pCell->SetHybridDouble( it->second );
commit fcd85be5d5e44b00c6fa5717c7ec13ea657483d4
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Sep 28 01:21:41 2012 +0200

    ooxml spec allow ext ref to non existent entry, fdo#54558
    
    Change-Id: I717917d04a93975472d60248eb61066cd04d1bbe

diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx
index c1949e8..78fd832 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -200,7 +200,13 @@ ContextHandlerRef ExtGlobalContext::onCreateContext( sal_Int32 nElement, const A
         if(nElement == XLS_EXT_TOKEN( cfRule ))
         {
             rtl::OUString aId = rAttribs.getString( XML_id, rtl::OUString() );
-            void* pInfo = getExtLst().find( aId )->second;
+
+            // an ext entrie does not need to have an existing corresponding entry
+            ExtLst::const_iterator aExt = getExtLst().find( aId );
+            if(aExt == getExtLst().end())
+                return NULL;
+
+            void* pInfo = aExt->second;
             if (!pInfo)
             {
                 return NULL;


More information about the Libreoffice-commits mailing list