[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/source

Markus Mohrhard (via logerrit) logerrit at kemper.freedesktop.org
Fri May 10 06:26:18 UTC 2019


 sc/source/filter/excel/xecontent.cxx |   27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

New commits:
commit 569c2229dd890aad07035d81b1ce3b1b3d7bc244
Author:     Markus Mohrhard <markus.mohrhard at googlemail.com>
AuthorDate: Sun Jul 15 00:18:58 2018 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Fri May 10 08:25:43 2019 +0200

    related tdf#117816, only export cond format formula to xlsx when required
    
    Change-Id: I7523d17e9945dfbdf0c346fff8eddd40593f946a
    Reviewed-on: https://gerrit.libreoffice.org/57444
    Tested-by: Jenkins
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    (cherry picked from commit 16048ebc230880148346f02403820b7646b2649c)
    Reviewed-on: https://gerrit.libreoffice.org/72007
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 9c90d2d1c1bb..557ef69f3d93 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -939,6 +939,27 @@ bool IsTextRule(ScConditionMode eMode)
     return false;
 }
 
+bool RequiresFormula(ScConditionMode eMode)
+{
+    if (IsTopBottomRule(eMode))
+        return false;
+    else if (IsTextRule(eMode))
+        return false;
+
+    switch (eMode)
+    {
+        case ScConditionMode::NoError:
+        case ScConditionMode::Error:
+        case ScConditionMode::Duplicate:
+        case ScConditionMode::NotDuplicate:
+            return false;
+        default:
+        break;
+    }
+
+    return true;
+}
+
 bool RequiresFixedFormula(ScConditionMode eMode)
 {
     switch(eMode)
@@ -965,9 +986,9 @@ OString GetFixedFormula(ScConditionMode eMode, const ScAddress& rAddress, const
     switch (eMode)
     {
         case ScConditionMode::Error:
-            return "";
+            return OString("ISERROR(" + aPos + ")") ;
         case ScConditionMode::NoError:
-            return "";
+            return OString("NOT(ISERROR(" + aPos + "))") ;
         case ScConditionMode::BeginsWith:
             return OString("LEFT(" + aPos + ",LEN(\"" + rText + "\"))=\"" + rText + "\"");
         case ScConditionMode::EndsWith:
@@ -1036,7 +1057,7 @@ void XclExpCFImpl::SaveXml( XclExpXmlStream& rStrm )
         rWorksheet->writeEscaped(aFormula.getStr());
         rWorksheet->endElement( XML_formula );
     }
-    else if(!IsTextRule(eOperation) && !IsTopBottomRule(eOperation))
+    else if(RequiresFormula(eOperation))
     {
         rWorksheet->startElement( XML_formula, FSEND );
         std::unique_ptr<ScTokenArray> pTokenArray(mrFormatEntry.CreateFlatCopiedTokenArray(0));


More information about the Libreoffice-commits mailing list