diff options
author | Henry Castro <hcastro@collabora.com> | 2023-04-14 14:26:32 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2023-05-03 15:16:25 +0200 |
commit | f92f1d9972d57c7030e0e9548835d1747d5ebbf4 (patch) | |
tree | cb9e16d0153609e447d168b22f96a6e9008c3ca0 | |
parent | cdf604f95c132f0f88ce31b002d47d1abd731d50 (diff) |
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 <hcastro@collabora.com>
Change-Id: Ibb98953f0a50140dbde4d52a79fde968095881d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150436
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r-- | sc/source/filter/inc/condformatbuffer.hxx | 3 | ||||
-rw-r--r-- | sc/source/filter/oox/condformatbuffer.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/condformatcontext.cxx | 5 |
3 files changed, 5 insertions, 5 deletions
diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx index 17ef8e7621be..dfb665befe39 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(); @@ -313,7 +312,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 64180b16d390..568a4197b070 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -1218,7 +1218,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 f2b5fc899813..e298538847e8 100644 --- a/sc/source/filter/oox/condformatcontext.cxx +++ b/sc/source/filter/oox/condformatcontext.cxx @@ -204,8 +204,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; |