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

New commits:
commit d695f76f23bbdf072fffa48b3a49604287109d47
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Fri Apr 14 14:26:32 2023 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Mon May 22 15:53:46 2023 +0200

    sc: filter: oxx: insert more rules same range
    
    If there are rules with the same range to preserve
    priority order.
    
    <conditionalFormatting sqref="I4:I5">
     <cfRule type="cellIs" dxfId="5587" priority="1500" operator="equal">
      <formula>"GO"</formula>
     </cfRule>
    </conditionalFormatting>
    <conditionalFormatting sqref="E11:I12 E15:I16">
     <cfRule type="containsText" dxfId="5586" priority="1457" 
operator="containsText" text="R">
      <formula>NOT(ISERROR(SEARCH("R",E11)))</formula>
     </cfRule>
    </conditionalFormatting>
    <conditionalFormatting sqref="I4:I5">
     <cfRule type="containsText" dxfId="5585" priority="1501" 
operator="containsText" text="R">
      <formula>NOT(ISERROR(SEARCH("R",E11)))</formula>
     </cfRule>
    </conditionalFormatting>
    
    Signed-off-by: Henry Castro <hcas...@collabora.com>
    Change-Id: Ibb98953f0a50140dbde4d52a79fde968095881d1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150436
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151980

diff --git a/sc/source/filter/inc/condformatbuffer.hxx 
b/sc/source/filter/inc/condformatbuffer.hxx
index 81961151beb8..9d3cc83fc953 100644
--- a/sc/source/filter/inc/condformatbuffer.hxx
+++ b/sc/source/filter/inc/condformatbuffer.hxx
@@ -168,7 +168,6 @@ public:
 
     /** Returns the priority of this rule. */
     sal_Int32    getPriority() const { return maModel.mnPriority; }
-    ColorScaleRule*     getCurColorScale() const { return mpColor.get(); }
 
     ColorScaleRule*     getColorScale();
     DataBarRule*        getDataBar();
@@ -312,7 +311,7 @@ public:
     static sal_Int32    convertToApiOperator( sal_Int32 nToken );
     static ScConditionMode convertToInternalOperator( sal_Int32 nToken );
     void                finalizeImport();
-    bool                insertColorScale(CondFormatRef const & xCondFmt, 
CondFormatRuleRef const & xRule);
+    bool                insertRule(CondFormatRef const & xCondFmt, 
CondFormatRuleRef const & xRule);
 
 private:
     CondFormatRef       createCondFormat();
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 4b5ad187daa6..1d5e55fdbc1b 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -1208,7 +1208,7 @@ void CondFormatBuffer::updateImport(const 
ScDataBarFormatData* pTarget)
     }
 }
 
-bool CondFormatBuffer::insertColorScale(CondFormatRef const & xCondFmt, 
CondFormatRuleRef const & xRule)
+bool CondFormatBuffer::insertRule(CondFormatRef const & xCondFmt, 
CondFormatRuleRef const & xRule)
 {
     CondFormatRef xFoundFmt;
     ScRangeList aRanges = xCondFmt->getRanges();
diff --git a/sc/source/filter/oox/condformatcontext.cxx 
b/sc/source/filter/oox/condformatcontext.cxx
index a28b7b12453d..5da1f721ffc6 100644
--- a/sc/source/filter/oox/condformatcontext.cxx
+++ b/sc/source/filter/oox/condformatcontext.cxx
@@ -205,8 +205,9 @@ void CondFormatContext::onEndElement()
         case XLS_TOKEN( cfRule ):
             if (mxCondFmt && mxRule)
             {
-                if (!mxRule->getCurColorScale() ||
-                    !getCondFormats().insertColorScale(mxCondFmt, mxRule))
+                ScRangeList aRanges = mxCondFmt->getRanges();
+                if ((aRanges.size() == 1 && aRanges.GetCellCount() == 1) ||
+                    !getCondFormats().insertRule(mxCondFmt, mxRule))
                     mxCondFmt->insertRule(mxRule);
             }
         break;

Reply via email to