sc/source/filter/inc/condformatbuffer.hxx  |    2 +-
 sc/source/filter/oox/condformatbuffer.cxx  |    1 -
 sc/source/filter/oox/condformatcontext.cxx |    6 ++++++
 3 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit cc483a88a03f9ee847f3cb5fac83fb5dd49d0ba1
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Tue Mar 28 17:48:19 2023 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Fri Jun 16 00:43:42 2023 +0200

    sc: filter: oox: do not insert rule too early
    
    The </cfRule> tag is a good place to do a post check
    the conditional format sanity.
    
    Signed-off-by: Henry Castro <hcas...@collabora.com>
    Change-Id: Id6e99c81011040ec47034e993490fae5c71d7e04
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149719
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    Tested-by: Andras Timar <andras.ti...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151977
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153159
    Tested-by: Jenkins

diff --git a/sc/source/filter/inc/condformatbuffer.hxx 
b/sc/source/filter/inc/condformatbuffer.hxx
index d5d5ebac2ab5..a1cc7bb81381 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -219,9 +219,9 @@ public:
     const ScRangeList& getRanges() const { return maModel.maRanges; }
 
     void                setReadyForFinalize() { mbReadyForFinalize = true; }
+    void                insertRule( CondFormatRuleRef const & xRule );
 private:
     CondFormatRuleRef   createRule();
-    void                insertRule( CondFormatRuleRef const & xRule );
 
 private:
     typedef RefMap< sal_Int32, CondFormatRule > CondFormatRuleMap;
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 4c55792779af..80891c2e9abf 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1107,7 +1107,6 @@ CondFormatRuleRef CondFormat::importCfRule( const 
AttributeList& rAttribs )
 {
     CondFormatRuleRef xRule = createRule();
     xRule->importCfRule( rAttribs );
-    insertRule( xRule );
     return xRule;
 }
 
diff --git a/sc/source/filter/oox/condformatcontext.cxx 
b/sc/source/filter/oox/condformatcontext.cxx
index 2f3ae391ab71..845d105b7605 100644
--- a/sc/source/filter/oox/condformatcontext.cxx
+++ b/sc/source/filter/oox/condformatcontext.cxx
@@ -202,6 +202,12 @@ void CondFormatContext::onEndElement()
             if(mxCondFmt)
                 mxCondFmt->setReadyForFinalize();
             break;
+        case XLS_TOKEN( cfRule ):
+            if (mxCondFmt && mxRule)
+            {
+                mxCondFmt->insertRule(mxRule);
+            }
+        break;
     }
 }
 

Reply via email to