[Libreoffice-commits] .: sc/source

Noel Power noelp at kemper.freedesktop.org
Thu Jun 21 08:25:48 PDT 2012


 sc/source/filter/oox/formulabuffer.cxx    |   14 +++++++++-----
 sc/source/filter/oox/sheetdatacontext.cxx |    1 -
 2 files changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 75c789691b3ed7a10caa4319cf58144cfaace3a7
Author: Noel Power <noel.power at novell.com>
Date:   Thu Jun 21 16:23:09 2012 +0100

    fix core dump setting preload value for some cell formula
    
    this patch is a follow up to 6ea4e42eaa28a773ec66fee3b8f764e0dc365297 & 7fff98724bc7e3f4d3defb005aa1358d743d08ed
    
    Change-Id: Ia286164c369526acb4dfe733b651e65a79d124d8

diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx
index f93a517..7d8ec1a 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -20,6 +20,7 @@
 
 #include "rangelst.hxx"
 #include "autonamecache.hxx"
+#include "tokenuno.hxx"
 
 namespace oox {
 namespace xls {
@@ -134,22 +135,25 @@ void FormulaBuffer::finalizeImport()
 
 void FormulaBuffer::applyCellFormulas( std::vector< TokenAddressItem >& rVector )
 {
+    ScDocument& rDoc = getScDocument();
     for ( std::vector< TokenAddressItem >::iterator it = rVector.begin(), it_end = rVector.end(); it != it_end; ++it )
     {
         ::com::sun::star::table::CellAddress& rAddress = it->maCellAddress;
         ApiTokenSequence rTokens = getFormulaParser().importFormula( rAddress, it->maTokenStr );
-
-        Reference< XFormulaTokens > xTokens( getCell( rAddress ), UNO_QUERY );
-        OSL_ENSURE( xTokens.is(), "WorksheetHelper::putFormulaTokens - missing token interface" );
-        if( xTokens.is() ) xTokens->setTokens( rTokens );
+        ScTokenArray aTokenArray;
+        ScAddress aCellPos;
+        ScUnoConversion::FillScAddress( aCellPos, rAddress );
+        ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens );
+        ScBaseCell* pNewCell = new ScFormulaCell( &rDoc, aCellPos, &aTokenArray );
+        rDoc.PutCell( aCellPos, pNewCell, sal_True );
     }
 }
 
 void FormulaBuffer::applyCellFormulaValues( std::vector< ValueAddressPair >& rVector )
 {
+    ScDocument& rDoc = getScDocument();
     for ( std::vector< ValueAddressPair >::iterator it = rVector.begin(), it_end = rVector.end(); it != it_end; ++it )
     {
-        ScDocument& rDoc = getScDocument();
         ScAddress aCellPos;
         ScUnoConversion::FillScAddress( aCellPos, it->first );
         ScBaseCell* pBaseCell = rDoc.GetCell( aCellPos );
diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx
index 37f882c..7ca86d7 100644
--- a/sc/source/filter/oox/sheetdatacontext.cxx
+++ b/sc/source/filter/oox/sheetdatacontext.cxx
@@ -190,7 +190,6 @@ void SheetDataContext::onEndElement()
                 {
                     if( mbValidRange && maFmlaData.isValidSharedRef( maCellData.maCellAddr ) )
                     {
-                        //mrSheetData.createSharedFormula( maFmlaData.mnSharedId, mrFormulaParser.importFormula( maCellData.maCellAddr, maFormulaStr ) );
                         createSharedFormulaMapEntry( maCellData.maCellAddr, maFmlaData.mnSharedId, maFormulaStr );
                     }
                     setCellFormula( maCellData.maCellAddr, maFmlaData.mnSharedId );


More information about the Libreoffice-commits mailing list