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

Gülşah Köse (via logerrit) logerrit at kemper.freedesktop.org
Sun Sep 22 06:12:33 UTC 2019


 sc/inc/conditio.hxx                          |   18 ++-
 sc/qa/unit/data/xlsx/condFormat_cellis.xlsx  |binary
 sc/qa/unit/subsequent_export-test.cxx        |   38 +++++++
 sc/qa/unit/subsequent_filters-test.cxx       |   36 +++++++
 sc/source/core/data/conditio.cxx             |   39 +++++--
 sc/source/core/data/table2.cxx               |    6 -
 sc/source/filter/excel/xecontent.cxx         |    9 +
 sc/source/filter/excel/xeextlst.cxx          |  138 ++++++++++++++++++++++++++-
 sc/source/filter/excel/xestyle.cxx           |   21 ++++
 sc/source/filter/inc/extlstcontext.hxx       |   13 ++
 sc/source/filter/inc/stylesbuffer.hxx        |    4 
 sc/source/filter/inc/stylesfragment.hxx      |    3 
 sc/source/filter/inc/xeextlst.hxx            |   14 ++
 sc/source/filter/inc/xestyle.hxx             |    5 
 sc/source/filter/oox/condformatbuffer.cxx    |    3 
 sc/source/filter/oox/extlstcontext.cxx       |   62 ++++++++++--
 sc/source/filter/oox/stylesbuffer.cxx        |   35 ++++++
 sc/source/filter/oox/stylesfragment.cxx      |   13 ++
 sc/source/ui/condformat/condformatdlg.cxx    |    1 
 sc/source/ui/condformat/condformathelper.cxx |    1 
 sc/source/ui/unoobj/condformatuno.cxx        |    1 
 sc/source/ui/unoobj/fmtuno.cxx               |    3 
 22 files changed, 431 insertions(+), 32 deletions(-)

New commits:
commit 85647eb3a631382ba8129f1bb5260c95098f38da
Author:     Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Mon Mar 25 21:08:22 2019 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Sun Sep 22 08:11:54 2019 +0200

    tdf#122590 Import and export xlsx x14:cfRule element for type = cellis.
    
    Reviewed-on: https://gerrit.libreoffice.org/69713
    Tested-by: Jenkins
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    (cherry picked from commit 8c637b47d9de4b3a64c33a9c2ffe7ed220be2467)
    
    Change-Id: I3d940269ec25657b64c714400a2828781dd9dd3e
    Reviewed-on: https://gerrit.libreoffice.org/72002
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/79220
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>

diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 3b0480e64d6d..35db77fd6083 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -27,6 +27,7 @@
 #include <formula/grammar.hxx>
 #include "scdllapi.h"
 #include "rangelst.hxx"
+#include "tokenarray.hxx"
 
 #include <svl/listener.hxx>
 
@@ -231,6 +232,7 @@ public:
     enum class Type
     {
         Condition,
+        ExtCondition,
         Colorscale,
         Databar,
         Iconset,
@@ -265,6 +267,9 @@ inline std::basic_ostream<charT, traits> & operator <<(std::basic_ostream<charT,
     case ScFormatEntry::Type::Condition:
         stream << "Condition";
         break;
+    case ScFormatEntry::Type::ExtCondition:
+        stream << "ExtCondition";
+        break;
     case ScFormatEntry::Type::Colorscale:
         stream << "Colorscale";
         break;
@@ -322,6 +327,7 @@ class SC_DLLPUBLIC ScConditionEntry : public ScFormatEntry
     bool                bRelRef2;
     bool                bFirstRun;
     std::unique_ptr<ScFormulaListener> mpListener;
+    Type eConditionType;                //It can be Condition or ExtCondition
 
     static void SimplifyCompiledFormula( std::unique_ptr<ScTokenArray>& rFormula,
                                      double& rVal,
@@ -346,7 +352,8 @@ public:
                                 ScDocument* pDocument, const ScAddress& rPos,
                                 const OUString& rExprNmsp1, const OUString& rExprNmsp2,
                                 formula::FormulaGrammar::Grammar eGrammar1,
-                                formula::FormulaGrammar::Grammar eGrammar2 );
+                                formula::FormulaGrammar::Grammar eGrammar2,
+                                Type eType = Type::Condition );
             ScConditionEntry( ScConditionMode eOper,
                                 const ScTokenArray* pArr1, const ScTokenArray* pArr2,
                                 ScDocument* pDocument, const ScAddress& rPos );
@@ -391,7 +398,7 @@ public:
 
     bool            MarkUsedExternalReferences() const;
 
-    virtual Type GetType() const override { return Type::Condition; }
+    virtual Type GetType() const override { return eConditionType; }
 
     virtual ScFormatEntry* Clone(ScDocument* pDoc) const override;
 
@@ -442,7 +449,8 @@ private:
 //  single condition entry for conditional formatting
 class SC_DLLPUBLIC ScCondFormatEntry : public ScConditionEntry
 {
-    OUString                  aStyleName;
+    OUString aStyleName;
+    Type eCondFormatType = Type::Condition;
 
 public:
             ScCondFormatEntry( ScConditionMode eOper,
@@ -452,7 +460,8 @@ public:
                                 const OUString& rExprNmsp1 = EMPTY_OUSTRING,
                                 const OUString& rExprNmsp2 = EMPTY_OUSTRING,
                                 formula::FormulaGrammar::Grammar eGrammar1 = formula::FormulaGrammar::GRAM_DEFAULT,
-                                formula::FormulaGrammar::Grammar eGrammar2 = formula::FormulaGrammar::GRAM_DEFAULT );
+                                formula::FormulaGrammar::Grammar eGrammar2 = formula::FormulaGrammar::GRAM_DEFAULT,
+                                Type eType = Type::Condition);
             ScCondFormatEntry( ScConditionMode eOper,
                                 const ScTokenArray* pArr1, const ScTokenArray* pArr2,
                                 ScDocument* pDocument, const ScAddress& rPos,
@@ -466,6 +475,7 @@ public:
     const OUString&   GetStyle() const        { return aStyleName; }
     void            UpdateStyleName(const OUString& rNew)  { aStyleName=rNew; }
     virtual ScFormatEntry* Clone(ScDocument* pDoc) const override;
+    virtual Type GetType() const override { return eCondFormatType; }
 
 protected:
     virtual void    DataChanged() const override;
diff --git a/sc/qa/unit/data/xlsx/condFormat_cellis.xlsx b/sc/qa/unit/data/xlsx/condFormat_cellis.xlsx
new file mode 100644
index 000000000000..6bbd0b5e33f5
Binary files /dev/null and b/sc/qa/unit/data/xlsx/condFormat_cellis.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 305fbced21e0..f3f0bd291f4a 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -99,6 +99,7 @@ public:
     void testPasswordExportODS();
     void testConditionalFormatExportODS();
     void testConditionalFormatExportXLSX();
+    void testCondFormatExportCellIs();
     void testTdf99856_dataValidationTest();
     void testProtectionKeyODS_UTF16LErtlSHA1();
     void testProtectionKeyODS_UTF8SHA1();
@@ -227,6 +228,7 @@ public:
     CPPUNIT_TEST(testTdf111876);
     CPPUNIT_TEST(testPasswordExportODS);
     CPPUNIT_TEST(testConditionalFormatExportODS);
+    CPPUNIT_TEST(testCondFormatExportCellIs);
     CPPUNIT_TEST(testConditionalFormatExportXLSX);
     CPPUNIT_TEST(testTdf99856_dataValidationTest);
     CPPUNIT_TEST(testProtectionKeyODS_UTF16LErtlSHA1);
@@ -494,6 +496,42 @@ void ScExportTest::testConditionalFormatExportODS()
     xDocSh->DoClose();
 }
 
+void ScExportTest::testCondFormatExportCellIs()
+{
+    ScDocShellRef xShell = loadDoc("condFormat_cellis.", FORMAT_XLSX);
+    CPPUNIT_ASSERT(xShell.is());
+    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    CPPUNIT_ASSERT(xDocSh.is());
+
+    ScDocument& rDoc = xDocSh->GetDocument();
+    CPPUNIT_ASSERT_EQUAL(size_t(1), rDoc.GetCondFormList(0)->size());
+
+    ScConditionalFormat* pFormat = rDoc.GetCondFormat(0, 0, 0);
+    CPPUNIT_ASSERT(pFormat);
+
+    const ScFormatEntry* pEntry = pFormat->GetEntry(0);
+    CPPUNIT_ASSERT(pEntry);
+    CPPUNIT_ASSERT_EQUAL(ScFormatEntry::Type::ExtCondition, pEntry->GetType());
+
+    const ScCondFormatEntry* pCondition = static_cast<const ScCondFormatEntry*>(pEntry);
+    CPPUNIT_ASSERT_EQUAL( ScConditionMode::Equal,  pCondition->GetOperation());
+
+    OUString aStr = pCondition->GetExpression(ScAddress(0, 0, 0), 0);
+    CPPUNIT_ASSERT_EQUAL( OUString("$Sheet2.$A$1"), aStr );
+
+    pEntry = pFormat->GetEntry(1);
+    CPPUNIT_ASSERT(pEntry);
+    CPPUNIT_ASSERT_EQUAL(ScFormatEntry::Type::ExtCondition, pEntry->GetType());
+
+    pCondition = static_cast<const ScCondFormatEntry*>(pEntry);
+    CPPUNIT_ASSERT_EQUAL( ScConditionMode::Equal,  pCondition->GetOperation());
+
+    aStr = pCondition->GetExpression(ScAddress(0, 0, 0), 0);
+    CPPUNIT_ASSERT_EQUAL( OUString("$Sheet2.$A$2"), aStr );
+
+    xDocSh->DoClose();
+}
+
 void ScExportTest::testConditionalFormatExportXLSX()
 {
     ScDocShellRef xShell = loadDoc("new_cond_format_test_export.", FORMAT_XLSX);
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index c6d3bc4f644e..7575a124ab90 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -150,6 +150,7 @@ public:
     void testNewCondFormatODS();
     void testNewCondFormatXLSX();
     void testCondFormatThemeColorXLSX();
+    void testCondFormatImportCellIs();
     void testCondFormatThemeColor2XLSX(); // negative bar color and axis color
     void testCondFormatThemeColor3XLSX(); // theme index 2 and 3 are switched
     void testComplexIconSetsXLSX();
@@ -307,6 +308,7 @@ public:
     CPPUNIT_TEST(testNewCondFormatODS);
     CPPUNIT_TEST(testNewCondFormatXLSX);
     CPPUNIT_TEST(testCondFormatThemeColorXLSX);
+    CPPUNIT_TEST(testCondFormatImportCellIs);
     CPPUNIT_TEST(testCondFormatThemeColor2XLSX);
     CPPUNIT_TEST(testCondFormatThemeColor3XLSX);
     CPPUNIT_TEST(testComplexIconSetsXLSX);
@@ -2292,6 +2294,40 @@ void ScFiltersTest::testNewCondFormatXLSX()
     xDocSh->DoClose();
 }
 
+void ScFiltersTest::testCondFormatImportCellIs()
+{
+    ScDocShellRef xDocSh = ScBootstrapFixture::loadDoc("condFormat_cellis.", FORMAT_XLSX);
+    CPPUNIT_ASSERT_MESSAGE("Failed to load condFormat_cellis.xlsx", xDocSh.is());
+
+    ScDocument& rDoc = xDocSh->GetDocument();
+    CPPUNIT_ASSERT_EQUAL(size_t(1), rDoc.GetCondFormList(0)->size());
+
+    ScConditionalFormat* pFormat = rDoc.GetCondFormat(0, 0, 0);
+    CPPUNIT_ASSERT(pFormat);
+
+    const ScFormatEntry* pEntry = pFormat->GetEntry(0);
+    CPPUNIT_ASSERT(pEntry);
+    CPPUNIT_ASSERT_EQUAL(ScFormatEntry::Type::ExtCondition, pEntry->GetType());
+
+    const ScCondFormatEntry* pCondition = static_cast<const ScCondFormatEntry*>(pEntry);
+    CPPUNIT_ASSERT_EQUAL( ScConditionMode::Equal,  pCondition->GetOperation());
+
+    OUString aStr = pCondition->GetExpression(ScAddress(0, 0, 0), 0);
+    CPPUNIT_ASSERT_EQUAL( OUString("$Sheet2.$A$1"), aStr );
+
+    pEntry = pFormat->GetEntry(1);
+    CPPUNIT_ASSERT(pEntry);
+    CPPUNIT_ASSERT_EQUAL(ScFormatEntry::Type::ExtCondition, pEntry->GetType());
+
+    pCondition = static_cast<const ScCondFormatEntry*>(pEntry);
+    CPPUNIT_ASSERT_EQUAL( ScConditionMode::Equal,  pCondition->GetOperation());
+
+    aStr = pCondition->GetExpression(ScAddress(0, 0, 0), 0);
+    CPPUNIT_ASSERT_EQUAL( OUString("$Sheet2.$A$2"), aStr );
+
+    xDocSh->DoClose();
+}
+
 void ScFiltersTest::testCondFormatThemeColorXLSX()
 {
     ScDocShellRef xDocSh = ScBootstrapFixture::loadDoc("condformat_theme_color.", FORMAT_XLSX);
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index aa05207daff0..b7dfffe90778 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -188,6 +188,7 @@ ScConditionEntry::ScConditionEntry( const ScConditionEntry& r ) :
     bRelRef2(r.bRelRef2),
     bFirstRun(true),
     mpListener(new ScFormulaListener(r.mpDoc)),
+    eConditionType( r.eConditionType ),
     pCondFormat(r.pCondFormat)
 {
     // ScTokenArray copy ctor creates a flat copy
@@ -220,6 +221,7 @@ ScConditionEntry::ScConditionEntry( ScDocument* pDocument, const ScConditionEntr
     bRelRef2(r.bRelRef2),
     bFirstRun(true),
     mpListener(new ScFormulaListener(pDocument)),
+    eConditionType( r.eConditionType),
     pCondFormat(r.pCondFormat)
 {
     // Real copy of the formulas (for Ref Undo)
@@ -235,7 +237,8 @@ ScConditionEntry::ScConditionEntry( ScDocument* pDocument, const ScConditionEntr
 ScConditionEntry::ScConditionEntry( ScConditionMode eOper,
         const OUString& rExpr1, const OUString& rExpr2, ScDocument* pDocument, const ScAddress& rPos,
         const OUString& rExprNmsp1, const OUString& rExprNmsp2,
-        FormulaGrammar::Grammar eGrammar1, FormulaGrammar::Grammar eGrammar2 ) :
+        FormulaGrammar::Grammar eGrammar1, FormulaGrammar::Grammar eGrammar2,
+        Type eType ) :
     ScFormatEntry(pDocument),
     eOp(eOper),
     nOptions(0),
@@ -252,6 +255,7 @@ ScConditionEntry::ScConditionEntry( ScConditionMode eOper,
     bRelRef2(false),
     bFirstRun(true),
     mpListener(new ScFormulaListener(pDocument)),
+    eConditionType(eType),
     pCondFormat(nullptr)
 {
     Compile( rExpr1, rExpr2, rExprNmsp1, rExprNmsp2, eGrammar1, eGrammar2, false );
@@ -1464,9 +1468,11 @@ ScCondFormatEntry::ScCondFormatEntry( ScConditionMode eOper,
                                         const OUString& rStyle,
                                         const OUString& rExprNmsp1, const OUString& rExprNmsp2,
                                         FormulaGrammar::Grammar eGrammar1,
-                                        FormulaGrammar::Grammar eGrammar2 ) :
-    ScConditionEntry( eOper, rExpr1, rExpr2, pDocument, rPos, rExprNmsp1, rExprNmsp2, eGrammar1, eGrammar2 ),
-    aStyleName( rStyle )
+                                        FormulaGrammar::Grammar eGrammar2,
+                                        ScFormatEntry::Type eType ) :
+    ScConditionEntry( eOper, rExpr1, rExpr2, pDocument, rPos, rExprNmsp1, rExprNmsp2, eGrammar1, eGrammar2, eType ),
+    aStyleName( rStyle ),
+    eCondFormatType( eType )
 {
 }
 
@@ -1481,13 +1487,15 @@ ScCondFormatEntry::ScCondFormatEntry( ScConditionMode eOper,
 
 ScCondFormatEntry::ScCondFormatEntry( const ScCondFormatEntry& r ) :
     ScConditionEntry( r ),
-    aStyleName( r.aStyleName )
+    aStyleName( r.aStyleName ),
+    eCondFormatType( r.eCondFormatType)
 {
 }
 
 ScCondFormatEntry::ScCondFormatEntry( ScDocument* pDocument, const ScCondFormatEntry& r ) :
     ScConditionEntry( pDocument, r ),
-    aStyleName( r.aStyleName )
+    aStyleName( r.aStyleName ),
+    eCondFormatType( r.eCondFormatType)
 {
 }
 
@@ -1792,7 +1800,8 @@ const OUString& ScConditionalFormat::GetCellStyle( ScRefCellValue& rCell, const
 {
     for (auto itr = maEntries.cbegin(); itr != maEntries.cend(); ++itr)
     {
-        if((*itr)->GetType() == ScFormatEntry::Type::Condition)
+        if((*itr)->GetType() == ScFormatEntry::Type::Condition ||
+           (*itr)->GetType() == ScFormatEntry::Type::ExtCondition)
         {
             const ScCondFormatEntry& rEntry = static_cast<const ScCondFormatEntry&>(**itr);
             if (rEntry.IsCellValid(rCell, rPos))
@@ -1814,7 +1823,9 @@ ScCondFormatData ScConditionalFormat::GetData( ScRefCellValue& rCell, const ScAd
     ScCondFormatData aData;
     for(auto itr = maEntries.cbegin(); itr != maEntries.cend(); ++itr)
     {
-        if((*itr)->GetType() == ScFormatEntry::Type::Condition && aData.aStyleName.isEmpty())
+        if( ((*itr)->GetType() == ScFormatEntry::Type::Condition ||
+             (*itr)->GetType() == ScFormatEntry::Type::ExtCondition) &&
+            aData.aStyleName.isEmpty())
         {
             const ScCondFormatEntry& rEntry = static_cast<const ScCondFormatEntry&>(**itr);
             if (rEntry.IsCellValid(rCell, rPos))
@@ -1854,14 +1865,16 @@ void ScConditionalFormat::DoRepaint()
 void ScConditionalFormat::CompileAll()
 {
     for(auto itr = maEntries.cbegin(); itr != maEntries.cend(); ++itr)
-        if((*itr)->GetType() == ScFormatEntry::Type::Condition)
+        if((*itr)->GetType() == ScFormatEntry::Type::Condition ||
+           (*itr)->GetType() == ScFormatEntry::Type::ExtCondition)
             static_cast<ScCondFormatEntry&>(**itr).CompileAll();
 }
 
 void ScConditionalFormat::CompileXML()
 {
     for(auto itr = maEntries.cbegin(); itr != maEntries.cend(); ++itr)
-        if((*itr)->GetType() == ScFormatEntry::Type::Condition)
+        if((*itr)->GetType() == ScFormatEntry::Type::Condition ||
+           (*itr)->GetType() == ScFormatEntry::Type::ExtCondition)
             static_cast<ScCondFormatEntry&>(**itr).CompileXML();
 }
 
@@ -1992,7 +2005,8 @@ void ScConditionalFormat::DeleteArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCR
 void ScConditionalFormat::RenameCellStyle(const OUString& rOld, const OUString& rNew)
 {
     for(auto itr = maEntries.cbegin(); itr != maEntries.cend(); ++itr)
-        if((*itr)->GetType() == ScFormatEntry::Type::Condition)
+        if((*itr)->GetType() == ScFormatEntry::Type::Condition ||
+           (*itr)->GetType() == ScFormatEntry::Type::ExtCondition)
         {
             ScCondFormatEntry& rFormat = static_cast<ScCondFormatEntry&>(**itr);
             if(rFormat.GetStyle() == rOld)
@@ -2004,7 +2018,8 @@ bool ScConditionalFormat::MarkUsedExternalReferences() const
 {
     bool bAllMarked = false;
     for(auto itr = maEntries.cbegin(); itr != maEntries.cend() && !bAllMarked; ++itr)
-        if((*itr)->GetType() == ScFormatEntry::Type::Condition)
+        if((*itr)->GetType() == ScFormatEntry::Type::Condition ||
+           (*itr)->GetType() == ScFormatEntry::Type::ExtCondition)
         {
             const ScCondFormatEntry& rFormat = static_cast<const ScCondFormatEntry&>(**itr);
             bAllMarked = rFormat.MarkUsedExternalReferences();
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 37fd41890250..f7ff62260b05 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -643,7 +643,8 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO
             {
                 OUString aStyleName;
                 const ScFormatEntry* pEntry = pNewFormat->GetEntry(i);
-                if(pEntry->GetType() == ScFormatEntry::Type::Condition)
+                if(pEntry->GetType() == ScFormatEntry::Type::Condition ||
+                   pEntry->GetType() == ScFormatEntry::Type::ExtCondition)
                     aStyleName = static_cast<const ScCondFormatEntry*>(pEntry)->GetStyle();
                 else if(pEntry->GetType() == ScFormatEntry::Type::Date)
                     aStyleName = static_cast<const ScCondDateFormatEntry*>(pEntry)->GetStyleName();
@@ -2184,7 +2185,8 @@ void ScTable::FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCC
                                 for (size_t nEntry=0; nEntry<nEntryCount; nEntry++)
                                 {
                                     const ScFormatEntry* pEntry = pFormat->GetEntry(nEntry);
-                                    if(pEntry->GetType() != ScFormatEntry::Type::Condition)
+                                    if(pEntry->GetType() != ScFormatEntry::Type::Condition ||
+                                       pEntry->GetType() != ScFormatEntry::Type::ExtCondition)
                                         continue;
 
                                     OUString  aStyleName = static_cast<const ScCondFormatEntry*>(pEntry)->GetStyle();
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 9023a524b786..af9030db58aa 100755
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -1299,6 +1299,15 @@ XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat
             {
                 if(pFormatEntry->GetType() == ScFormatEntry::Type::Condition)
                     maCFList.AppendNewRecord( new XclExpCF( GetRoot(), static_cast<const ScCondFormatEntry&>(*pFormatEntry), ++rIndex ) );
+                else if(pFormatEntry->GetType() == ScFormatEntry::Type::ExtCondition)
+                {
+                    const ScCondFormatEntry& rFormat = static_cast<const ScCondFormatEntry&>(*pFormatEntry);
+                    XclExpExtCondFormatData aExtEntry;
+                    aExtEntry.nPriority = ++rIndex;
+                    aExtEntry.aGUID = generateGUIDString();
+                    aExtEntry.pEntry = &rFormat;
+                    aExtEntries.push_back(aExtEntry);
+                }
                 else if(pFormatEntry->GetType() == ScFormatEntry::Type::Colorscale)
                     maCFList.AppendNewRecord( new XclExpColorScale( GetRoot(), static_cast<const ScColorScaleFormat&>(*pFormatEntry), ++rIndex ) );
                 else if(pFormatEntry->GetType() == ScFormatEntry::Type::Databar)
diff --git a/sc/source/filter/excel/xeextlst.cxx b/sc/source/filter/excel/xeextlst.cxx
index f2c61bd158da..dc7902065df1 100644
--- a/sc/source/filter/excel/xeextlst.cxx
+++ b/sc/source/filter/excel/xeextlst.cxx
@@ -10,13 +10,20 @@
 #include <xeextlst.hxx>
 #include <xeroot.hxx>
 #include <xehelper.hxx>
+#include <stlsheet.hxx>
+#include <ftools.hxx>
 #include <xestyle.hxx>
+#include <stlpool.hxx>
+#include <scitems.hxx>
+#include <svl/itemset.hxx>
+#include <svl/intitem.hxx>
 #include <xename.hxx>
 #include <xecontent.hxx>
 #include <tokenarray.hxx>
 
 #include <oox/export/utils.hxx>
 #include <oox/token/namespaces.hxx>
+#include <comphelper/processfactory.hxx>
 
 using namespace ::oox;
 
@@ -145,6 +152,65 @@ void XclExpExtCfvo::SaveXml( XclExpXmlStream& rStrm )
     rWorksheet->endElementNS(XML_x14, XML_cfvo);
 }
 
+XclExpExtCF::XclExpExtCF( const XclExpRoot& rRoot, const ScCondFormatEntry& rFormat ):
+    XclExpRoot(rRoot),
+    mrFormat(rFormat)
+{
+}
+
+void XclExpExtCF::SaveXml( XclExpXmlStream& rStrm )
+{
+    OUString aStyleName = mrFormat.GetStyle();
+    SfxStyleSheetBase* pStyle = GetDoc().GetStyleSheetPool()->Find(aStyleName);
+    SfxItemSet& rSet = pStyle->GetItemSet();
+
+    std::unique_ptr<ScTokenArray> pTokenArray(mrFormat.CreateFlatCopiedTokenArray(0));
+    aFormula = XclXmlUtils::ToOUString( GetCompileFormulaContext(), mrFormat.GetValidSrcPos(), pTokenArray.get());
+
+    std::unique_ptr<XclExpColor> pColor(new XclExpColor);
+    if(!pColor->FillFromItemSet( rSet ))
+        pColor.reset();
+
+    std::unique_ptr<XclExpCellBorder> pBorder(new XclExpCellBorder);
+    if (!pBorder->FillFromItemSet( rSet, GetPalette(), GetBiff()) )
+        pBorder.reset();
+
+    std::unique_ptr<XclExpCellAlign> pAlign(new XclExpCellAlign);
+    if (!pAlign->FillFromItemSet( rSet, false, GetBiff()))
+        pAlign.reset();
+
+    std::unique_ptr<XclExpCellProt> pCellProt(new XclExpCellProt);
+    if (!pCellProt->FillFromItemSet( rSet ))
+        pCellProt.reset();
+
+    std::unique_ptr<XclExpDxfFont> pFont(new XclExpDxfFont(GetRoot(), rSet));
+
+    std::unique_ptr<XclExpNumFmt> pNumFormat;
+    const SfxPoolItem *pPoolItem = nullptr;
+    if( rSet.GetItemState( ATTR_VALUE_FORMAT, true, &pPoolItem ) == SfxItemState::SET )
+    {
+        sal_uInt32 nScNumFmt = static_cast< const SfxUInt32Item* >(pPoolItem)->GetValue();
+        XclExpNumFmtBuffer& rNumFmtBuffer = GetRoot().GetNumFmtBuffer();
+        sal_uInt32 nXclNumFmt = rNumFmtBuffer.Insert(nScNumFmt);
+        pNumFormat.reset(new XclExpNumFmt(nScNumFmt, nXclNumFmt, rNumFmtBuffer.GetFormatCode(nScNumFmt)));
+    }
+
+    XclExpDxf rDxf( GetRoot(),
+                    std::move(pAlign),
+                    std::move(pBorder),
+                    std::move(pFont),
+                    std::move(pNumFormat),
+                    std::move(pCellProt),
+                    std::move(pColor) );
+
+    sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
+
+    rWorksheet->startElementNS( XML_xm, XML_f, FSEND );
+    rWorksheet->writeEscaped( aFormula );
+    rWorksheet->endElementNS( XML_xm, XML_f );
+    rDxf.SaveXmlExt( rStrm );
+}
+
 XclExpExtDataBar::XclExpExtDataBar( const XclExpRoot& rRoot, const ScDataBarFormat& rFormat, const ScAddress& rPos ):
     XclExpRoot(rRoot)
 {
@@ -179,6 +245,62 @@ const char* getAxisPosition(databar::ScAxisPosition eAxisPosition)
     return "";
 }
 
+const char* GetOperatorString(ScConditionMode eMode)
+{
+    const char* pRet = nullptr;
+    switch(eMode)
+    {
+        case ScConditionMode::Equal:
+            pRet = "equal";
+            break;
+        case ScConditionMode::Less:
+            pRet = "lessThan";
+            break;
+        case ScConditionMode::Greater:
+            pRet = "greaterThan";
+            break;
+        case ScConditionMode::EqLess:
+            pRet = "lessThanOrEqual";
+            break;
+        case ScConditionMode::EqGreater:
+            pRet = "greaterThanOrEqual";
+            break;
+        case ScConditionMode::NotEqual:
+            pRet = "notEqual";
+            break;
+        case ScConditionMode::Between:
+            pRet = "between";
+            break;
+        case ScConditionMode::NotBetween:
+            pRet = "notBetween";
+            break;
+        case ScConditionMode::Duplicate:
+            pRet = nullptr;
+            break;
+        case ScConditionMode::NotDuplicate:
+            pRet = nullptr;
+            break;
+        case ScConditionMode::BeginsWith:
+            pRet = "beginsWith";
+        break;
+        case ScConditionMode::EndsWith:
+            pRet = "endsWith";
+        break;
+        case ScConditionMode::ContainsText:
+            pRet = "containsText";
+        break;
+        case ScConditionMode::NotContainsText:
+            pRet = "notContains";
+        break;
+        case ScConditionMode::Direct:
+            break;
+        case ScConditionMode::NONE:
+        default:
+            break;
+    }
+    return pRet;
+}
+
 }
 
 void XclExpExtDataBar::SaveXml( XclExpXmlStream& rStrm )
@@ -246,7 +368,8 @@ XclExpExtCfRule::XclExpExtCfRule( const XclExpRoot& rRoot, const ScFormatEntry&
     XclExpRoot(rRoot),
     maId(rId),
     pType(nullptr),
-    mnPriority(nPriority)
+    mnPriority(nPriority),
+    mOperator(nullptr)
 {
     switch (rFormat.GetType())
     {
@@ -264,6 +387,14 @@ XclExpExtCfRule::XclExpExtCfRule( const XclExpRoot& rRoot, const ScFormatEntry&
             pType = "iconSet";
         }
         break;
+        case ScFormatEntry::Type::ExtCondition:
+        {
+            const ScCondFormatEntry& rCondFormat = static_cast<const ScCondFormatEntry&>(rFormat);
+            mxEntry.reset(new XclExpExtCF(*this, rCondFormat));
+            pType = "cellIs";
+            mOperator = GetOperatorString( rCondFormat.GetOperation() );
+        }
+        break;
         default:
         break;
     }
@@ -278,6 +409,7 @@ void XclExpExtCfRule::SaveXml( XclExpXmlStream& rStrm )
     rWorksheet->startElementNS( XML_x14, XML_cfRule,
                                 XML_type, pType,
                                 XML_priority, mnPriority == -1 ? nullptr : OString::number(mnPriority).getStr(),
+                                XML_operator, mOperator,
                                 XML_id, maId.getStr(),
                                 FSEND );
 
@@ -327,6 +459,9 @@ XclExpExtConditionalFormatting::XclExpExtConditionalFormatting( const XclExpRoot
             case ScFormatEntry::Type::Databar:
                 maCfRules.AppendNewRecord(new XclExpExtCfRule( *this, *pEntry, aAddr, itr->aGUID, itr->nPriority));
             break;
+            case ScFormatEntry::Type::ExtCondition:
+                maCfRules.AppendNewRecord(new XclExpExtCfRule( *this, *pEntry, aAddr, itr->aGUID, itr->nPriority));
+            break;
             default:
             break;
         }
@@ -452,4 +587,5 @@ XclExpExtRef XclExtLst::GetItem( XclExpExtType eType )
     return XclExpExtRef();
 }
 
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index 3002523be642..a9f31e0ac953 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -3150,6 +3150,27 @@ void XclExpDxf::SaveXml( XclExpXmlStream& rStrm )
     rStyleSheet->endElement( XML_dxf );
 }
 
+void XclExpDxf::SaveXmlExt( XclExpXmlStream& rStrm )
+{
+    sax_fastparser::FSHelperPtr& rStyleSheet = rStrm.GetCurrentStream();
+    rStyleSheet->startElementNS( XML_x14, XML_dxf, FSEND );
+
+    if (mpFont)
+        mpFont->SaveXml(rStrm);
+    if (mpNumberFmt)
+        mpNumberFmt->SaveXml(rStrm);
+    if (mpColor)
+        mpColor->SaveXml(rStrm);
+    if (mpAlign)
+        mpAlign->SaveXml(rStrm);
+    if (mpBorder)
+        mpBorder->SaveXml(rStrm);
+    if (mpProt)
+        mpProt->SaveXml(rStrm);
+    rStyleSheet->endElementNS( XML_x14, XML_dxf );;
+}
+
+
 XclExpXmlStyleSheet::XclExpXmlStyleSheet( const XclExpRoot& rRoot )
     : XclExpRoot( rRoot )
 {
diff --git a/sc/source/filter/inc/extlstcontext.hxx b/sc/source/filter/inc/extlstcontext.hxx
index 567ab3c93b5b..85aafd1604d1 100644
--- a/sc/source/filter/inc/extlstcontext.hxx
+++ b/sc/source/filter/inc/extlstcontext.hxx
@@ -11,12 +11,17 @@
 #define INCLUDED_SC_SOURCE_FILTER_INC_EXTLSTCONTEXT_HXX
 
 #include "excelhandlers.hxx"
-#include <oox/core/contexthandler.hxx>
+#include "worksheetfragment.hxx"
+#include "workbookfragment.hxx"
+#include "conditio.hxx"
 #include "condformatbuffer.hxx"
+#include "stylesfragment.hxx"
 
 #include <vector>
 #include <memory>
 
+extern sal_Int32 rStyleIdx; // Holds index of the <extlst> <cfRule> style (Will be reseted finalize import)
+
 struct ScDataBarFormatData;
 namespace oox { class AttributeList; }
 namespace oox { namespace xls { class WorkbookFragment; } }
@@ -50,9 +55,13 @@ public:
     virtual void onEndElement() override;
 
 private:
-    OUString aChars;
+    OUString aChars; // Characters of between xml elements.
+    OUString rStyle; // Style of the corresponding condition
+    ScConditionMode eOperator; // Used only when cfRule type is "cellIs"
+    bool isPreviousElementF;   // Used to distinguish alone <sqref> from <f> and <sqref>
     std::vector<std::unique_ptr<ScFormatEntry> > maEntries;
     std::unique_ptr<IconSetRule> mpCurrentRule;
+    std::vector< OUString > rFormulas; // It holds formulas for a range, there can be more formula for same range.
 };
 
 /**
diff --git a/sc/source/filter/inc/stylesbuffer.hxx b/sc/source/filter/inc/stylesbuffer.hxx
index aa0a4557bd5f..c3bd431b3f83 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -803,6 +803,7 @@ public:
     XfRef               createStyleXf();
     /** Creates a new empty differential formatting object. */
     DxfRef              createDxf();
+    DxfRef              createExtDxf();
 
     /** Appends a new color to the color palette. */
     void                importPaletteColor( const AttributeList& rAttribs );
@@ -851,6 +852,7 @@ public:
     ::ScStyleSheet*     getCellStyleSheet( sal_Int32 nXfId ) const;
     /** Creates the style sheet described by the DXF with the passed identifier. */
     OUString     createDxfStyle( sal_Int32 nDxfId ) const;
+    OUString     createExtDxfStyle( sal_Int32 nDxfId ) const;
 
     void                writeFontToItemSet( SfxItemSet& rItemSet, sal_Int32 nFontId, bool bSkipPoolDefs ) const;
     sal_uInt32          writeNumFmtToItemSet( SfxItemSet& rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs ) const;
@@ -861,6 +863,7 @@ public:
 
     /** Writes the cell formatting attributes of the specified XF to the passed property set. */
     void                writeCellXfToDoc( ScDocumentImport& rDoc, const ScRange& rRange, sal_Int32 nXfId ) const;
+    RefVector< Dxf >    getExtDxfs() { return maExtDxfs; }
 
 private:
     typedef RefVector< Font >                           FontVector;
@@ -879,6 +882,7 @@ private:
     XfVector            maStyleXfs;         /// List of cell styles.
     CellStyleBuffer     maCellStyles;       /// All built-in and user defined cell styles.
     DxfVector           maDxfs;             /// List of differential cell styles.
+    DxfVector           maExtDxfs;          /// List of differential extlst cell styles.
     mutable DxfStyleMap maDxfStyles;        /// Maps DXF identifiers to Calc style sheet names.
 };
 
diff --git a/sc/source/filter/inc/stylesfragment.hxx b/sc/source/filter/inc/stylesfragment.hxx
index 9d342f59c50a..a102303c5871 100644
--- a/sc/source/filter/inc/stylesfragment.hxx
+++ b/sc/source/filter/inc/stylesfragment.hxx
@@ -101,13 +101,14 @@ class DxfContext : public WorkbookContextBase
 public:
     template< typename ParentType >
     explicit     DxfContext( ParentType& rParent, const DxfRef& rxDxf ) :
-                            WorkbookContextBase( rParent ), mxDxf( rxDxf ) {}
+                            WorkbookContextBase( rParent ), mxDxf( rxDxf ), mxExtDxf( rxDxf ) {}
 
 protected:
     virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
 
 private:
     DxfRef              mxDxf;
+    DxfRef              mxExtDxf;
 };
 
 class StylesFragment : public WorkbookFragmentBase
diff --git a/sc/source/filter/inc/xeextlst.hxx b/sc/source/filter/inc/xeextlst.hxx
index 8b9354b9ebe7..36b75f6458de 100644
--- a/sc/source/filter/inc/xeextlst.hxx
+++ b/sc/source/filter/inc/xeextlst.hxx
@@ -87,6 +87,17 @@ private:
     sal_Int32 nIndex;
 };
 
+class XclExpExtCF : public XclExpRecordBase, protected XclExpRoot
+{
+public:
+    explicit XclExpExtCF( const XclExpRoot& rRoot, const ScCondFormatEntry& rFormat );
+    virtual void SaveXml( XclExpXmlStream& rStrm ) override;
+
+private:
+    OUString aFormula;
+    const ScCondFormatEntry mrFormat;
+};
+
 class XclExpExtDataBar : public XclExpRecordBase, protected XclExpRoot
 {
 public:
@@ -132,7 +143,8 @@ private:
     XclExpRecordRef mxEntry;
     OString const maId;
     const char* pType;
-    sal_Int32 const mnPriority;
+    sal_Int32 mnPriority;
+    const char* mOperator;
 };
 
 typedef std::shared_ptr<XclExpExt> XclExpExtRef;
diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx
index 994108939fb8..e5dfb8f2939b 100644
--- a/sc/source/filter/inc/xestyle.hxx
+++ b/sc/source/filter/inc/xestyle.hxx
@@ -284,14 +284,14 @@ public:
     virtual void        Save( XclExpStream& rStrm ) override;
     virtual void        SaveXml( XclExpXmlStream& rStrm ) override;
 
+    OUString            GetFormatCode ( sal_uInt32 nScNumFmt );
+
 private:
     /** Writes the FORMAT record with index nXclIx and format string rFormatStr. */
     void                WriteFormatRecord( XclExpStream& rStrm, sal_uInt16 nXclNumFmt, const OUString& rFormatStr );
     /** Writes the FORMAT record represented by rFormat. */
     void                WriteFormatRecord( XclExpStream& rStrm, const XclExpNumFmt& rFormat );
 
-    OUString            GetFormatCode ( sal_uInt32 nScNumFmt );
-
 private:
     typedef ::std::vector< XclExpNumFmt >           XclExpNumFmtVec;
 
@@ -700,6 +700,7 @@ public:
     virtual ~XclExpDxf() override;
 
     virtual void SaveXml( XclExpXmlStream& rStrm ) override;
+    virtual void SaveXmlExt( XclExpXmlStream& rStrm);
 
 private:
     std::unique_ptr<XclExpCellAlign> mpAlign;
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 82c920203b61..088e33a7c061 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -45,6 +45,7 @@
 #include <docfunc.hxx>
 #include <tokenarray.hxx>
 #include <tokenuno.hxx>
+#include <extlstcontext.hxx>
 
 namespace oox { class AttributeList; }
 
@@ -1139,6 +1140,8 @@ void CondFormatBuffer::finalizeImport()
             pFormat->AddEntry((*i)->Clone(pDoc));
         }
     }
+
+    rStyleIdx = 0; // Resets <extlst> <cfRule> style index.
 }
 
 CondFormatRef CondFormatBuffer::importCondFormatting( SequenceInputStream& rStrm )
diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx
index a4c779087c75..f30e01a0ad08 100644
--- a/sc/source/filter/oox/extlstcontext.cxx
+++ b/sc/source/filter/oox/extlstcontext.cxx
@@ -26,6 +26,9 @@
 #include <sal/log.hxx>
 
 using ::oox::core::ContextHandlerRef;
+using ::oox::xls::CondFormatBuffer;
+
+sal_Int32 rStyleIdx = 0;
 
 namespace oox {
 namespace xls {
@@ -80,6 +83,7 @@ void ExtCfRuleContext::onStartElement( const AttributeList& rAttribs )
 ExtConditionalFormattingContext::ExtConditionalFormattingContext(WorksheetContextBase& rFragment):
     WorksheetContextBase(rFragment)
 {
+    isPreviousElementF = false;
 }
 
 ContextHandlerRef ExtConditionalFormattingContext::onCreateContext(sal_Int32 nElement, const AttributeList& rAttribs)
@@ -99,6 +103,7 @@ ContextHandlerRef ExtConditionalFormattingContext::onCreateContext(sal_Int32 nEl
     {
         OUString aType = rAttribs.getString(XML_type, OUString());
         OUString aId = rAttribs.getString(XML_id, OUString());
+
         if (aType == "dataBar")
         {
             // an ext entry does not need to have an existing corresponding entry
@@ -120,12 +125,22 @@ ContextHandlerRef ExtConditionalFormattingContext::onCreateContext(sal_Int32 nEl
             maEntries.push_back(o3tl::make_unique<ScIconSetFormat>(pDoc));
             return new IconSetContext(*this, mpCurrentRule.get());
         }
+        else if (aType == "cellIs")
+        {
+            sal_Int32 aToken = rAttribs.getToken( XML_operator, XML_TOKEN_INVALID );
+            eOperator =  CondFormatBuffer::convertToInternalOperator(aToken);
+            return this;
+        }
         else
         {
             SAL_WARN("sc", "unhandled XLS14_TOKEN(cfRule) with type: " << aType);
         }
     }
-    else if (nElement == XM_TOKEN(sqref))
+    else if (nElement == XLS14_TOKEN( dxf ))
+    {
+        return new DxfContext( *this, getStyles().createExtDxf() );
+    }
+    else if (nElement == XM_TOKEN( sqref ) || nElement == XM_TOKEN( f ))
     {
         return this;
     }
@@ -133,26 +148,43 @@ ContextHandlerRef ExtConditionalFormattingContext::onCreateContext(sal_Int32 nEl
     return nullptr;
 }
 
-void ExtConditionalFormattingContext::onStartElement(const AttributeList& /*rAttribs*/)
+void ExtConditionalFormattingContext::onStartElement(const AttributeList& /*Attribs*/)
+{
+}
+
+void ExtConditionalFormattingContext::onCharacters(const OUString& rCharacters)
 {
     switch (getCurrentElement())
     {
+        case XM_TOKEN(f):
+        {
+            aChars = rCharacters;
+            isPreviousElementF = true;
+        }
+        break;
         case XM_TOKEN(sqref):
         {
+            aChars = rCharacters;
         }
         break;
     }
-}
 
-void ExtConditionalFormattingContext::onCharacters(const OUString& rCharacters)
-{
-    aChars = rCharacters;
 }
 
 void ExtConditionalFormattingContext::onEndElement()
 {
     switch (getCurrentElement())
     {
+        case XM_TOKEN(f):
+        {
+            rFormulas.push_back(aChars);
+        }
+        break;
+        case XLS14_TOKEN( cfRule ):
+        {
+            getStyles().getExtDxfs().forEachMem( &Dxf::finalizeImport );
+        }
+        break;
         case XM_TOKEN(sqref):
         {
             ScRangeList aRange;
@@ -168,8 +200,26 @@ void ExtConditionalFormattingContext::onEndElement()
                 aRange[i].aEnd.SetTab(nTab);
             }
 
+            if(isPreviousElementF) // sqref can be alone in some cases.
+            {
+                for(const OUString& rFormula : rFormulas)
+                {
+                    ScAddress rPos = aRange.GetTopLeftCorner();
+                    rStyle = getStyles().createExtDxfStyle(rStyleIdx);
+                    ScCondFormatEntry* pEntry = new ScCondFormatEntry(eOperator, rFormula, "", pDoc,
+                                                                      rPos, rStyle, "", "",
+                                                                      formula::FormulaGrammar::GRAM_OOXML ,
+                                                                      formula::FormulaGrammar::GRAM_OOXML,
+                                                                      ScFormatEntry::Type::ExtCondition );
+                    maEntries.push_back(std::unique_ptr<ScFormatEntry>(pEntry));
+                    rStyleIdx++;
+                }
+                rFormulas.clear();
+            }
+
             std::vector< std::unique_ptr<ExtCfCondFormat> >& rExtFormats =  getCondFormats().importExtCondFormat();
             rExtFormats.push_back(o3tl::make_unique<ExtCfCondFormat>(aRange, maEntries));
+            isPreviousElementF = false;
         }
         break;
         default:
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index 6d39a82d0bcd..26929bad6937 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -2754,6 +2754,13 @@ DxfRef StylesBuffer::createDxf()
     return xDxf;
 }
 
+DxfRef StylesBuffer::createExtDxf()
+{
+    DxfRef xDxf( new Dxf( *this ) );
+    maExtDxfs.push_back( xDxf );
+    return xDxf;
+}
+
 void StylesBuffer::importPaletteColor( const AttributeList& rAttribs )
 {
     maPalette.importPaletteColor( rAttribs );
@@ -2904,6 +2911,34 @@ OUString StylesBuffer::createDxfStyle( sal_Int32 nDxfId ) const
             rStyleSheet.GetItemSet();
 
         pDxf->fillToItemSet(rStyleItemSet);
+
+    }
+
+    // on error: fallback to default style
+    if (rStyleName.isEmpty())
+        rStyleName = maCellStyles.getDefaultStyleName();
+
+    return rStyleName;
+}
+
+OUString StylesBuffer::createExtDxfStyle( sal_Int32 nDxfId ) const
+{
+    OUString rStyleName;
+
+    if (Dxf* pDxf = maExtDxfs.get(nDxfId).get())
+    {
+        rStyleName = "ExtConditionalStyle_" + OUString::number(nDxfId + 1);
+
+        // Create a cell style. This may overwrite an existing style if
+        // one with the same name exists.
+        ScStyleSheet& rStyleSheet = ScfTools::MakeCellStyleSheet(
+                *getScDocument().GetStyleSheetPool(), rStyleName, true);
+
+        rStyleSheet.ResetParent();
+        SfxItemSet& rStyleItemSet =
+            rStyleSheet.GetItemSet();
+
+        pDxf->fillToItemSet(rStyleItemSet);
     }
 
     // on error: fallback to default style
diff --git a/sc/source/filter/oox/stylesfragment.cxx b/sc/source/filter/oox/stylesfragment.cxx
index 9efcbc45e703..2c2c9968703d 100644
--- a/sc/source/filter/oox/stylesfragment.cxx
+++ b/sc/source/filter/oox/stylesfragment.cxx
@@ -157,6 +157,19 @@ ContextHandlerRef DxfContext::onCreateContext( sal_Int32 nElement, const Attribu
             }
         break;
     }
+
+    if( mxExtDxf.get() ) switch( getCurrentElement() )
+    {
+        case XLS14_TOKEN( dxf ):
+            switch( nElement )
+            {
+                case XLS_TOKEN( font ):         return new FontContext( *this, mxExtDxf->createFont() );
+                case XLS_TOKEN( border ):       return new BorderContext( *this, mxExtDxf->createBorder() );
+                case XLS_TOKEN( fill ):         return new FillContext( *this, mxExtDxf->createFill() );
+                case XLS_TOKEN( numFmt ):       mxExtDxf->importNumFmt( rAttribs );     break;
+            }
+        break;
+    }
     return nullptr;
 }
 
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index ac066450531c..4cf3fd1fc951 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -87,6 +87,7 @@ void ScCondFormatList::init(ScDocument* pDoc, ScCondFormatDlg* pDialogParent,
             switch(pEntry->GetType())
             {
                 case ScFormatEntry::Type::Condition:
+                case ScFormatEntry::Type::ExtCondition:
                     {
                         const ScCondFormatEntry* pConditionEntry = static_cast<const ScCondFormatEntry*>( pEntry );
                         if(pConditionEntry->GetOperation() != ScConditionMode::Direct)
diff --git a/sc/source/ui/condformat/condformathelper.cxx b/sc/source/ui/condformat/condformathelper.cxx
index 0699acf476ba..2ab5d955db15 100644
--- a/sc/source/ui/condformat/condformathelper.cxx
+++ b/sc/source/ui/condformat/condformathelper.cxx
@@ -133,6 +133,7 @@ OUString ScCondFormatHelper::GetExpression(const ScConditionalFormat& rFormat, c
         switch(rFormat.GetEntry(0)->GetType())
         {
             case ScFormatEntry::Type::Condition:
+            case ScFormatEntry::Type::ExtCondition:
                 {
                     const ScConditionEntry* pEntry = static_cast<const ScConditionEntry*>(rFormat.GetEntry(0));
                     ScConditionMode eMode = pEntry->GetOperation();
diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx
index 9dd0cd45a6d9..0269e7f8803f 100644
--- a/sc/source/ui/unoobj/condformatuno.cxx
+++ b/sc/source/ui/unoobj/condformatuno.cxx
@@ -411,6 +411,7 @@ uno::Reference<beans::XPropertySet> createConditionEntry(const ScFormatEntry* pE
     switch (pEntry->GetType())
     {
         case ScFormatEntry::Type::Condition:
+        case ScFormatEntry::Type::ExtCondition:
             return new ScConditionEntryObj(xParent,
                     static_cast<const ScCondFormatEntry*>(pEntry));
         break;
diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx
index 7a473cc58c67..40af3ba2d59b 100644
--- a/sc/source/ui/unoobj/fmtuno.cxx
+++ b/sc/source/ui/unoobj/fmtuno.cxx
@@ -162,7 +162,8 @@ ScTableConditionalFormat::ScTableConditionalFormat(
                 {
                     ScCondFormatEntryItem aItem;
                     const ScFormatEntry* pFrmtEntry = pFormat->GetEntry(i);
-                    if(pFrmtEntry->GetType() != ScFormatEntry::Type::Condition)
+                    if(pFrmtEntry->GetType() != ScFormatEntry::Type::Condition ||
+                       pFrmtEntry->GetType() != ScFormatEntry::Type::ExtCondition)
                         continue;
 
                     const ScCondFormatEntry* pFormatEntry = static_cast<const ScCondFormatEntry*>(pFrmtEntry);


More information about the Libreoffice-commits mailing list