configure.ac                             |    2 
 sc/inc/scmatrix.hxx                      |    2 
 sc/source/core/data/document.cxx         |   15 +++-
 sc/source/core/data/formulacell.cxx      |    2 
 sc/source/core/tool/scmatrix.cxx         |   96 ++++++++++++++++---------------
 sc/source/filter/oox/sheetdatabuffer.cxx |    7 +-
 sc/source/filter/oox/unitconverter.cxx   |    2 
 7 files changed, 72 insertions(+), 54 deletions(-)

New commits:
commit d3e346ef2b0c13d257afb68b7fe581ac29235b34
Author: Andras Timar <andras.ti...@collabora.com>
Date:   Thu Dec 18 22:53:19 2014 +0100

    Bump version to 4.2-21
    
    Change-Id: Id9a052e61b0c098ff9e843b04e738fc1daa3a7c7

diff --git a/configure.ac b/configure.ac
index 5ef7055..35c7af1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ dnl in order to create a configure script.
 # several non-alphanumeric characters, those are split off and used only for 
the
 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no 
idea.
 
-AC_INIT([LibreOffice],[4.2.10.20],[],[],[https://libreoffice-from-collabora.com/])
+AC_INIT([LibreOffice],[4.2.10.21],[],[],[https://libreoffice-from-collabora.com/])
 
 AC_PREREQ([2.59])
 
commit d96e5eb9d316117f3f560d77c9858737d7e58c9d
Author: Eike Rathke <er...@redhat.com>
Date:   Thu Dec 18 20:07:55 2014 +0100

    fdo#68385 update references only if cut originates from the same document
    
    Change-Id: Ia7b27309251cf9e47505c58d8ed0172d134280f4
    (cherry picked from commit f2ac9fab2677a6a718f251baef75d3cae96d1f01)

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index e7963b9..751204d 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2551,11 +2551,16 @@ void ScDocument::CopyBlockFromClip(
                 aRefCxt.mnTabDelta = nDz;
                 if (rCxt.getClipDoc()->GetClipParam().mbCutMode)
                 {
-                    bool bOldInserting = IsInsertingFromOtherDoc();
-                    SetInsertingFromOtherDoc( true);
-                    aRefCxt.meMode = URM_MOVE;
-                    UpdateReference(aRefCxt, rCxt.getUndoDoc(), false);
-                    SetInsertingFromOtherDoc( bOldInserting);
+                    // Update references only if cut originates from the same
+                    // document we are pasting into.
+                    if (rCxt.getClipDoc()->GetPool() == GetPool())
+                    {
+                        bool bOldInserting = IsInsertingFromOtherDoc();
+                        SetInsertingFromOtherDoc( true);
+                        aRefCxt.meMode = URM_MOVE;
+                        UpdateReference(aRefCxt, rCxt.getUndoDoc(), false);
+                        SetInsertingFromOtherDoc( bOldInserting);
+                    }
                 }
                 else
                 {
commit 04a9c1c90cc2e2d969b712b3b7a255d286d19b84
Author: Eike Rathke <er...@redhat.com>
Date:   Tue Dec 16 01:37:31 2014 +0100

    fdo#79249 call formula compiler with error string
    
    ... instead of attempting to stringize a NaN coded error value.
    
    Regression introduced with 30a20743ae17e6e02183a65603d38968253b3ffb
    
    (cherry picked from commit 994607b55104b9ae4554554c13b001b8d5d513b6)
    
    construct grouped ScFormulaCell with bDirty=true, fdo#79249 related
    
    Noticed when loading
    https://bugs.freedesktop.org/attachment.cgi?id=99844
    with fdo#79249 fix where oox::xls::applyCellFormulas() groups the
    consecutive =#N/A formulas. Only A1 result was displayed, other cells
    were displayed empty.
    
    (cherry picked from commit a1dc5e97da273bf35d58d54e625149022569a993)
    
    correct error string, #N/A instead of #NA
    
    (cherry picked from commit 758755e31b3d9e1ed2eab522d4794282178346ac)
    
    Change-Id: Ia7a8ca39938820ac75db169404446fa696c6ee1b
    3a541f74d3d25e1515a1c6d47f02ec6a8e817c93
    15019072b6e812b9ffe29d3ee6afacd9ab526948

diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index a1ab35a..d64ed2d 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -683,7 +683,7 @@ ScFormulaCell::ScFormulaCell(
     nSeenInIteration(0),
     cMatrixFlag ( cInd ),
     nFormatType(xGroup->mnFormatType),
-    bDirty(false),
+    bDirty(true),
     bChanged( false ),
     bRunning( false ),
     bCompile( false ),
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx 
b/sc/source/filter/oox/sheetdatabuffer.cxx
index b3963df..60987c9 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -209,11 +209,16 @@ void SheetDataBuffer::setBooleanCell( const CellModel& 
rModel, bool bValue )
 
 void SheetDataBuffer::setErrorCell( const CellModel& rModel, const OUString& 
rErrorCode )
 {
-    setErrorCell( rModel, getUnitConverter().calcBiffErrorCode( rErrorCode ) );
+    // Using the formula compiler now we can simply pass on the error string.
+    getFormulaBuffer().setCellFormula( rModel.maCellAddr, rErrorCode);
+    setCellFormat( rModel );
 }
 
 void SheetDataBuffer::setErrorCell( const CellModel& rModel, sal_uInt8 
nErrorCode )
 {
+    assert(!"stringizing any NaN will only give 'nan'");
+    /* FIXME: map nErrorCode to error string and call setErrorCell() above. */
+
     OUStringBuffer aBuf;
     aBuf.append('{');
     aBuf.append(BiffHelper::calcDoubleFromError(nErrorCode));
diff --git a/sc/source/filter/oox/unitconverter.cxx 
b/sc/source/filter/oox/unitconverter.cxx
index 55ba77f..108b248 100644
--- a/sc/source/filter/oox/unitconverter.cxx
+++ b/sc/source/filter/oox/unitconverter.cxx
@@ -120,7 +120,7 @@ UnitConverter::UnitConverter( const WorkbookHelper& rHelper 
) :
     addErrorCode( BIFF_ERR_REF,   "#REF!" );
     addErrorCode( BIFF_ERR_NAME,  "#NAME?" );
     addErrorCode( BIFF_ERR_NUM,   "#NUM!" );
-    addErrorCode( BIFF_ERR_NA,    "#NA" );
+    addErrorCode( BIFF_ERR_NA,    "#N/A" );
 }
 
 void UnitConverter::finalizeImport()
commit 0fbcd7b60d87924660369fcdb0569ee9670736ac
Author: Eike Rathke <er...@redhat.com>
Date:   Thu Dec 11 16:39:58 2014 +0100

    resolved fdo#87237 propagate error values through matrix comparisons
    
    Apparently introduced with 8e8b43a03e77dd251876c1de0ac06eeeb09192cd the
    comparison results were stored as boolean values, effectively discarding
    any infinite double values and error values encoded as NaN values.
    
    (cherry picked from commit 3c405ff82fcc9f8f044833420485c54658064636)
    
    Change-Id: I1fb6f46894a0bee02a37e28b7e6cc84f8c051f28

diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx
index 1db1641..0833c4d 100644
--- a/sc/inc/scmatrix.hxx
+++ b/sc/inc/scmatrix.hxx
@@ -202,7 +202,7 @@ public:
     ScMatrix(SCSIZE nC, SCSIZE nR);
     ScMatrix(SCSIZE nC, SCSIZE nR, double fInitVal);
 
-    ScMatrix( size_t nC, size_t nR, const std::vector<bool>& rInitVals );
+    ScMatrix( size_t nC, size_t nR, const std::vector<double>& rInitVals );
 
     /** Clone the matrix. */
     ScMatrix* Clone() const;
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 4f210a8..2e31ec8 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -69,51 +69,63 @@ typedef mdds::multi_type_matrix<custom_string_trait> 
MatrixImplType;
 
 namespace {
 
-struct ElemEqualZero : public unary_function<double, bool>
+struct ElemEqualZero : public unary_function<double, double>
 {
-    bool operator() (double val) const
+    double operator() (double val) const
     {
-        return val == 0.0;
+        if (!::rtl::math::isFinite(val))
+            return val;
+        return val == 0.0 ? 1.0 : 0.0;
     }
 };
 
-struct ElemNotEqualZero : public unary_function<double, bool>
+struct ElemNotEqualZero : public unary_function<double, double>
 {
-    bool operator() (double val) const
+    double operator() (double val) const
     {
-        return val != 0.0;
+        if (!::rtl::math::isFinite(val))
+            return val;
+        return val != 0.0 ? 1.0 : 0.0;
     }
 };
 
-struct ElemGreaterZero : public unary_function<double, bool>
+struct ElemGreaterZero : public unary_function<double, double>
 {
-    bool operator() (double val) const
+    double operator() (double val) const
     {
-        return val > 0.0;
+        if (!::rtl::math::isFinite(val))
+            return val;
+        return val > 0.0 ? 1.0 : 0.0;
     }
 };
 
-struct ElemLessZero : public unary_function<double, bool>
+struct ElemLessZero : public unary_function<double, double>
 {
-    bool operator() (double val) const
+    double operator() (double val) const
     {
-        return val < 0.0;
+        if (!::rtl::math::isFinite(val))
+            return val;
+        return val < 0.0 ? 1.0 : 0.0;
     }
 };
 
-struct ElemGreaterEqualZero : public unary_function<double, bool>
+struct ElemGreaterEqualZero : public unary_function<double, double>
 {
-    bool operator() (double val) const
+    double operator() (double val) const
     {
-        return val >= 0.0;
+        if (!::rtl::math::isFinite(val))
+            return val;
+        return val >= 0.0 ? 1.0 : 0.0;
     }
 };
 
-struct ElemLessEqualZero : public unary_function<double, bool>
+struct ElemLessEqualZero : public unary_function<double, double>
 {
-    bool operator() (double val) const
+    double operator() (double val) const
     {
-        return val <= 0.0;
+        if (!::rtl::math::isFinite(val))
+            return val;
+        return val <= 0.0 ? 1.0 : 0.0;
     }
 };
 
@@ -122,7 +134,7 @@ class CompareMatrixElemFunc : 
std::unary_function<MatrixImplType::element_block_
 {
     static _Comp maComp;
 
-    std::vector<bool> maNewMatValues;
+    std::vector<double> maNewMatValues;     // double instead of bool to 
transport error values
     size_t mnRow;
     size_t mnCol;
 public:
@@ -144,13 +156,6 @@ public:
                 for (; it != itEnd; ++it)
                 {
                     double fVal = *it;
-                    if (!rtl::math::isFinite(fVal))
-                    {
-                        /* FIXME: this silently skips an error instead of 
propagating it! */
-                        maNewMatValues.push_back(false);
-                        continue;
-                    }
-
                     maNewMatValues.push_back(maComp(fVal));
                 }
             }
@@ -172,7 +177,7 @@ public:
             case mdds::mtm::element_empty:
             default:
                 // Fill it with false.
-                maNewMatValues.resize(maNewMatValues.size() + node.size, 
false);
+                maNewMatValues.resize(maNewMatValues.size() + node.size, 0.0);
         }
     }
 
@@ -201,7 +206,7 @@ public:
     ScMatrixImpl(SCSIZE nC, SCSIZE nR);
     ScMatrixImpl(SCSIZE nC, SCSIZE nR, double fInitVal);
 
-    ScMatrixImpl( size_t nC, size_t nR, const std::vector<bool>& rInitVals );
+    ScMatrixImpl( size_t nC, size_t nR, const std::vector<double>& rInitVals );
 
     ~ScMatrixImpl();
 
@@ -296,7 +301,7 @@ ScMatrixImpl::ScMatrixImpl(SCSIZE nC, SCSIZE nR) :
 ScMatrixImpl::ScMatrixImpl(SCSIZE nC, SCSIZE nR, double fInitVal) :
     maMat(nR, nC, fInitVal), maMatFlag(nR, nC), pErrorInterpreter(NULL), 
mbCloneIfConst(true) {}
 
-ScMatrixImpl::ScMatrixImpl( size_t nC, size_t nR, const std::vector<bool>& 
rInitVals ) :
+ScMatrixImpl::ScMatrixImpl( size_t nC, size_t nR, const std::vector<double>& 
rInitVals ) :
     maMat(nR, nC, rInitVals.begin(), rInitVals.end()), maMatFlag(nR, nC), 
pErrorInterpreter(NULL), mbCloneIfConst(true) {}
 
 ScMatrixImpl::~ScMatrixImpl()
@@ -1290,32 +1295,35 @@ public:
     }
 };
 
-inline bool evaluate( double fVal, ScQueryOp eOp )
+inline double evaluate( double fVal, ScQueryOp eOp )
 {
+    if (!rtl::math::isFinite(fVal))
+        return fVal;
+
     switch (eOp)
     {
         case SC_EQUAL:
-            return fVal == 0.0;
+            return fVal == 0.0 ? 1.0 : 0.0;
         case SC_LESS:
-            return fVal < 0.0;
+            return fVal < 0.0 ? 1.0 : 0.0;
         case SC_GREATER:
-            return fVal > 0.0;
+            return fVal > 0.0 ? 1.0 : 0.0;
         break;
         case SC_LESS_EQUAL:
-            return fVal <= 0.0;
+            return fVal <= 0.0 ? 1.0 : 0.0;
         break;
         case SC_GREATER_EQUAL:
-            return fVal >= 0.0;
+            return fVal >= 0.0 ? 1.0 : 0.0;
         break;
         case SC_NOT_EQUAL:
-            return fVal != 0.0;
+            return fVal != 0.0 ? 1.0 : 0.0;
         break;
         default:
             ;
     }
 
     OSL_TRACE( "evaluate: unhandled comparison operator: %d", (int)eOp);
-    return false;
+    return CreateDoubleError( errUnknownState);
 }
 
 class CompareMatrixFunc : 
std::unary_function<MatrixImplType::element_block_type, void>
@@ -1323,7 +1331,7 @@ class CompareMatrixFunc : 
std::unary_function<MatrixImplType::element_block_type
     sc::Compare& mrComp;
     size_t mnMatPos;
     sc::CompareOptions* mpOptions;
-    std::vector<bool> maResValues;
+    std::vector<double> maResValues;    // double instead of bool to transport 
error values
 
     void compare()
     {
@@ -1403,7 +1411,7 @@ public:
         }
     }
 
-    const std::vector<bool>& getValues() const
+    const std::vector<double>& getValues() const
     {
         return maResValues;
     }
@@ -1417,7 +1425,7 @@ class CompareMatrixToNumericFunc : 
std::unary_function<MatrixImplType::element_b
     sc::Compare& mrComp;
     double mfRightValue;
     sc::CompareOptions* mpOptions;
-    std::vector<bool> maResValues;
+    std::vector<double> maResValues;    // double instead of bool to transport 
error values
 
     void compare()
     {
@@ -1495,7 +1503,7 @@ public:
         }
     }
 
-    const std::vector<bool>& getValues() const
+    const std::vector<double>& getValues() const
     {
         return maResValues;
     }
@@ -1717,7 +1725,7 @@ ScMatrixRef ScMatrixImpl::CompareMatrix(
             maMat.walk(aFunc);
 
             // We assume the result matrix has the same dimension as this 
matrix.
-            const std::vector<bool>& rResVal = aFunc.getValues();
+            const std::vector<double>& rResVal = aFunc.getValues();
             if (nSize != rResVal.size())
                 ScMatrixRef();
 
@@ -1729,7 +1737,7 @@ ScMatrixRef ScMatrixImpl::CompareMatrix(
     maMat.walk(aFunc);
 
     // We assume the result matrix has the same dimension as this matrix.
-    const std::vector<bool>& rResVal = aFunc.getValues();
+    const std::vector<double>& rResVal = aFunc.getValues();
     if (nSize != rResVal.size())
         ScMatrixRef();
 
@@ -1888,7 +1896,7 @@ ScMatrix::ScMatrix(SCSIZE nC, SCSIZE nR, double fInitVal) 
:
     SAL_WARN_IF( !nR, "sc", "ScMatrix with 0 rows!");
 }
 
-ScMatrix::ScMatrix( size_t nC, size_t nR, const std::vector<bool>& rInitVals ) 
:
+ScMatrix::ScMatrix( size_t nC, size_t nR, const std::vector<double>& rInitVals 
) :
     pImpl(new ScMatrixImpl(nC, nR, rInitVals)), nRefCnt(0)
 {
     SAL_WARN_IF( !nC, "sc", "ScMatrix with 0 columns!");
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to