sc/inc/scopetools.hxx                         |    6 +++--
 sc/qa/unit/data/ods/formula-across-sheets.ods |binary
 sc/qa/unit/subsequent_filters-test.cxx        |   27 ++++++++++++++++++++++++++
 sc/source/core/data/column.cxx                |    2 -
 4 files changed, 32 insertions(+), 3 deletions(-)

New commits:
commit f571104ef38ba9f7f6073e22c2374add7aa73887
Author: Kohei Yoshida <kohei.yosh...@collabora.com>
Date:   Mon Jan 27 19:08:30 2014 -0500

    fdo#69244: Avoid putting these cells in formula tree prematurely.
    
    Marking the cell dirty alone appears to be sufficient to trigger resetting
    of number format.  SetDirty() would mark it dirty *and* put the cell into
    formula tree, which would prevent proper value propagation as seen in the
    bug report.
    
    Change-Id: Ie68f996112938fe286a9bd50c38404f9df6f4ca1

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 007e9e3..8c6102f 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2863,7 +2863,7 @@ public:
         if( (nFormat % SV_COUNTRY_LANGUAGE_OFFSET) != 0)
             pCell->SetNeedNumberFormat(false);
         else
-            pCell->SetDirty(true);
+            pCell->SetDirtyVar();
 
         pCell->CompileXML(mrProgress);
     }
commit 83f69e697a9bfa90671df6e1d5d25ae11b7b568a
Author: Kohei Yoshida <kohei.yosh...@collabora.com>
Date:   Mon Jan 27 19:08:01 2014 -0500

    fdo#69244: Write unit test for this.
    
    Change-Id: I5bfc8ad1566dbfc2813aadc8f08ba1eccca608ca

diff --git a/sc/inc/scopetools.hxx b/sc/inc/scopetools.hxx
index 3544b79..a7983e0 100644
--- a/sc/inc/scopetools.hxx
+++ b/sc/inc/scopetools.hxx
@@ -10,6 +10,8 @@
 #ifndef SC_SCOPETOOLS_HXX
 #define SC_SCOPETOOLS_HXX
 
+#include <scdllapi.h>
+
 class ScDocument;
 
 namespace sc {
@@ -17,7 +19,7 @@ namespace sc {
 /**
  * Temporarily switch on/off auto calculation mode.
  */
-class AutoCalcSwitch
+class SC_DLLPUBLIC AutoCalcSwitch
 {
     ScDocument& mrDoc;
     bool mbOldValue;
@@ -26,7 +28,7 @@ public:
     ~AutoCalcSwitch();
 };
 
-class ExpandRefsSwitch
+class SC_DLLPUBLIC ExpandRefsSwitch
 {
     ScDocument& mrDoc;
     bool mbOldValue;
diff --git a/sc/qa/unit/data/ods/formula-across-sheets.ods 
b/sc/qa/unit/data/ods/formula-across-sheets.ods
new file mode 100644
index 0000000..50f4faa
Binary files /dev/null and b/sc/qa/unit/data/ods/formula-across-sheets.ods 
differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index 8f1d4c9..3fae9e0 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -47,6 +47,7 @@
 #include "attrib.hxx"
 #include "dpsave.hxx"
 #include "dpshttab.hxx"
+#include <scopetools.hxx>
 
 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
 #include <com/sun/star/drawing/XControlShape.hpp>
@@ -93,6 +94,7 @@ public:
     void testFunctionsExcel2010();
     void testCachedFormulaResultsODS();
     void testCachedMatrixFormulaResultsODS();
+    void testFormulaDepAcrossSheetsODS();
     void testDatabaseRangesODS();
     void testDatabaseRangesXLS();
     void testDatabaseRangesXLSX();
@@ -164,6 +166,7 @@ public:
     CPPUNIT_TEST(testFunctionsODS);
     CPPUNIT_TEST(testFunctionsExcel2010);
     CPPUNIT_TEST(testCachedFormulaResultsODS);
+    CPPUNIT_TEST(testFormulaDepAcrossSheetsODS);
     CPPUNIT_TEST(testCachedMatrixFormulaResultsODS);
     CPPUNIT_TEST(testDatabaseRangesODS);
     CPPUNIT_TEST(testDatabaseRangesXLS);
@@ -597,6 +600,30 @@ void ScFiltersTest::testCachedMatrixFormulaResultsODS()
     xDocSh->DoClose();
 }
 
+void ScFiltersTest::testFormulaDepAcrossSheetsODS()
+{
+    ScDocShellRef xDocSh = loadDoc("formula-across-sheets.", ODS);
+    CPPUNIT_ASSERT_MESSAGE("Failed to load the file.", xDocSh.Is());
+    ScDocument* pDoc = xDocSh->GetDocument();
+
+    sc::AutoCalcSwitch aACSwitch(*pDoc, true); // Make sure auto calc is 
turned on.
+
+    // Save the original values of A4:C4.
+    double fA4 = pDoc->GetValue(ScAddress(0,3,2));
+    double fB4 = pDoc->GetValue(ScAddress(1,3,2));
+    double fC4 = pDoc->GetValue(ScAddress(2,3,2));
+
+    // Change the value of D4. This should trigger A4:C4 to be recalculated.
+    double fD4 = pDoc->GetValue(ScAddress(3,3,2));
+    pDoc->SetValue(ScAddress(3,3,2), fD4+1.0);
+
+    CPPUNIT_ASSERT_MESSAGE("The value must differ from the original.", fA4 != 
pDoc->GetValue(ScAddress(0,3,2)));
+    CPPUNIT_ASSERT_MESSAGE("The value must differ from the original.", fB4 != 
pDoc->GetValue(ScAddress(1,3,2)));
+    CPPUNIT_ASSERT_MESSAGE("The value must differ from the original.", fC4 != 
pDoc->GetValue(ScAddress(2,3,2)));
+
+    xDocSh->DoClose();
+}
+
 namespace {
 
 void testDBRanges_Impl(ScDocument* pDoc, sal_Int32 nFormat)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to