[Libreoffice-commits] core.git: sc/inc sc/qa sc/source

Markus Mohrhard markus.mohrhard at googlemail.com
Tue Jan 5 07:50:44 PST 2016


 sc/inc/conditio.hxx             |    2 -
 sc/qa/unit/ucalc.cxx            |   26 ---------------------
 sc/qa/unit/ucalc.hxx            |    2 -
 sc/source/core/data/validat.cxx |   49 ----------------------------------------
 4 files changed, 1 insertion(+), 78 deletions(-)

New commits:
commit 058dea3b1ac3080dd8a6345d77199eae8487c509
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Jan 5 16:48:15 2016 +0100

    Revert "Time wraparound validation feature"
    
    This reverts commit c01bcbc88522c5f86820105a45e2e5593ae01501.
    
    It still needs to be determined if this really was a good idea or a
    brain fart from me.
    
    There are some serious interop issues around the issue.

diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 69f8ddd..d33ecc6 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -154,12 +154,10 @@ public:
 class SC_DLLPUBLIC ScConditionEntry : public ScFormatEntry
 {
                                         // stored data:
-protected:
     ScConditionMode     eOp;
     sal_uInt16              nOptions;
     double              nVal1;          // input or calculated
     double              nVal2;
-private:
     OUString              aStrVal1;       // input or calculated
     OUString              aStrVal2;
     OUString              aStrNmsp1;      // namespace to be used on (re)compilation, e.g. in XML import
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 7d836b1..ccb3619 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -45,7 +45,6 @@
 #include "interpre.hxx"
 #include "columniterator.hxx"
 #include "types.hxx"
-#include "validat.hxx"
 #include "conditio.hxx"
 #include "colorscale.hxx"
 #include "fillinfo.hxx"
@@ -5691,31 +5690,6 @@ void Test::testCondFormatInsertRow()
     m_pDoc->DeleteTab(0);
 }
 
-void Test::testValidity()
-{
-    m_pDoc->InsertTab(0, "Test");
-
-    m_pDoc->SetValue( 0, 0, 0, 22.0/24.0 );
-    m_pDoc->SetValue( 2, 0, 0, 23.0/24.0 );
-    m_pDoc->SetValue( 4, 0, 0, 24.0/24.0 );
-
-    // invalid between 2300-0100 hrs
-    ScValidationData* pData0 = new ScValidationData( SC_VALID_TIME, SC_COND_NOTBETWEEN,
-        OUString::number(23.0/24.0), OUString::number(1.0/24.0), m_pDoc, ScAddress(0,0,0) );
-    ScValidationData* pData1 = new ScValidationData( SC_VALID_TIME, SC_COND_NOTBETWEEN,
-        OUString::number(23.0/24.0), OUString::number(1.0/24.0), m_pDoc, ScAddress(2,0,0) );
-    ScValidationData* pData2 = new ScValidationData( SC_VALID_TIME, SC_COND_NOTBETWEEN,
-        OUString::number(23.0/24.0), OUString::number(1.0/24.0), m_pDoc, ScAddress(4,0,0) );
-
-    ScRefCellValue aCell;
-    aCell.assign(*m_pDoc, ScAddress(0,0,0));
-    CPPUNIT_ASSERT(  pData0->IsDataValid( aCell, ScAddress(0,0,0) ) );
-    aCell.assign(*m_pDoc, ScAddress(2,0,0));
-    CPPUNIT_ASSERT( !pData1->IsDataValid( aCell, ScAddress(2,0,0) ) );
-    aCell.assign(*m_pDoc, ScAddress(4,0,0));
-    CPPUNIT_ASSERT( !pData2->IsDataValid( aCell, ScAddress(4,0,0) ) );
-}
-
 void Test::testCondFormatInsertDeleteSheets()
 {
     m_pDoc->InsertTab(0, "Test");
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 6085311..b3e5bf3 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -433,7 +433,6 @@ public:
     void testCondFormatINSDEL();
     void testCondFormatInsertRow();
     void testCondFormatInsertCol();
-    void testValidity();
     void testCondFormatInsertDeleteSheets();
     void testCondCopyPaste();
     void testCondCopyPasteSingleCell(); //e.g. fdo#82503
@@ -670,7 +669,6 @@ public:
     CPPUNIT_TEST(testCondFormatINSDEL);
     CPPUNIT_TEST(testCondFormatInsertRow);
     CPPUNIT_TEST(testCondFormatInsertCol);
-    CPPUNIT_TEST(testValidity);
     CPPUNIT_TEST(testCondFormatInsertDeleteSheets);
     CPPUNIT_TEST(testCondCopyPaste);
     CPPUNIT_TEST(testCondCopyPasteSingleCell);
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index e9cff1e..437434a 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -543,54 +543,7 @@ bool ScValidationData::IsDataValid( ScRefCellValue& rCell, const ScAddress& rPos
             OSL_FAIL("not yet done");
             break;
     }
-    if (eDataMode == SC_VALID_TIME) {
-        // consider only time portion (i.e. decimal)
-        double nComp1 = (nVal1 - floor(nVal1));
-        double nComp2 = (nVal2 - floor(nVal2));
-        double nInVal = (nVal  - floor(nVal ));
-        switch (eOp)
-        {
-            case SC_COND_NONE:
-            break;                  // Always sal_False
-            case SC_COND_EQUAL:
-            bOk = ::rtl::math::approxEqual( nInVal, nComp1 );
-            break;
-            case SC_COND_NOTEQUAL:
-            bOk = !::rtl::math::approxEqual( nInVal, nComp1 );
-            break;
-            case SC_COND_GREATER:
-            bOk = ( nInVal > nComp1 ) && !::rtl::math::approxEqual( nInVal, nComp1 );
-            break;
-            case SC_COND_EQGREATER:
-            bOk = ( nInVal >= nComp1 ) || ::rtl::math::approxEqual( nInVal, nComp1 );
-            break;
-            case SC_COND_LESS:
-            bOk = ( nInVal < nComp1 ) && !::rtl::math::approxEqual( nInVal, nComp1 );
-            break;
-            case SC_COND_EQLESS:
-            bOk = ( nInVal <= nComp1 ) || ::rtl::math::approxEqual( nInVal, nComp1 );
-            break;
-            case SC_COND_BETWEEN:
-            if (nComp2 < nComp1) // time wraparound
-                bOk = ( nInVal >= nComp1 || nInVal <= nComp2 ) ||
-                    ::rtl::math::approxEqual( nInVal, nComp1 ) || ::rtl::math::approxEqual( nInVal, nComp2 );
-            else
-                bOk = ( nInVal >= nComp1 && nInVal <= nComp2 ) ||
-                    ::rtl::math::approxEqual( nInVal, nComp1 ) || ::rtl::math::approxEqual( nInVal, nComp2 );
-            break;
-            case SC_COND_NOTBETWEEN:
-            if (nComp2 < nComp1) // time wraparound
-                bOk = ( nInVal < nComp1 && nInVal > nComp2 ) &&
-                    !::rtl::math::approxEqual( nInVal, nComp1 ) && !::rtl::math::approxEqual( nInVal, nComp2 );
-            else
-                bOk = ( nInVal < nComp1 || nInVal > nComp2 ) &&
-                    !::rtl::math::approxEqual( nInVal, nComp1 ) && !::rtl::math::approxEqual( nInVal, nComp2 );
-            break;
-            default:
-            SAL_WARN("sc", "unknown operation at ScValidationData::IsDataValid()");
-            break;
-        }
-    }
+
     return bOk;
 }
 


More information about the Libreoffice-commits mailing list