sc/source/filter/inc/condformatbuffer.hxx | 1 + sc/source/filter/inc/extlstcontext.hxx | 4 +++- sc/source/filter/oox/condformatbuffer.cxx | 13 +++++++++++++ sc/source/filter/oox/extlstcontext.cxx | 28 ++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 1 deletion(-)
New commits: commit 2fa664476f7ef233e41f6b445aa9a980ad345961 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Fri Mar 17 10:47:31 2023 -0400 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Wed Jun 14 09:32:16 2023 +0200 sc: filter: oox: Add a missing tag child of the parent tag "cfvo" <x14:dataBar maxLength="100" minLength="0" border="1" axisPosition="automatic" direction="context" negativeBarBorderColorSameAsPositive="0"> <x14:cfvo type="num"> <xm:f>0</xm:f> </x14:cfvo> <x14:cfvo type="num"> <xm:f>1</xm:f> </x14:cfvo> <x14:fillColor rgb="FF63C384"/> <x14:borderColor rgb="FF63C384"/> <x14:negativeFillColor indexed="2"/> <x14:negativeBorderColor indexed="2"/> <x14:axisColor indexed="64"/> </x14:dataBar> Signed-off-by: Henry Castro <hcas...@collabora.com> Change-Id: Ie98507e11a5cdeb0d1adc77a44fd79edb2f26d6a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149066 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152998 Tested-by: Jenkins (cherry picked from commit 3d4c4a95c32ad2a96831c3db552b0c389c596aea) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153015 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx index 992f14e041a8..08e9053684e2 100644 --- a/sc/source/filter/inc/condformatbuffer.hxx +++ b/sc/source/filter/inc/condformatbuffer.hxx @@ -241,6 +241,7 @@ struct ExCfRuleModel ::Color mnNegativeColor; OUString maAxisPosition; // DataBar OUString maColorScaleType; // Cfvo + OUString msScaleTypeValue; // Cfvo bool mbGradient; // DataBar bool mbIsLower; // Cfvo }; diff --git a/sc/source/filter/inc/extlstcontext.hxx b/sc/source/filter/inc/extlstcontext.hxx index 8635c6029523..077ebdbebf8e 100644 --- a/sc/source/filter/inc/extlstcontext.hxx +++ b/sc/source/filter/inc/extlstcontext.hxx @@ -32,11 +32,13 @@ public: virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; virtual void onStartElement( const AttributeList& rAttribs ) override; + virtual void onCharacters( const OUString& rChars ) override; + virtual void onEndElement() override; private: ScDataBarFormatData* mpTarget; - bool mbFirstEntry; + ExtCfDataBarRuleRef mpRule; }; struct ExtCondFormatRuleModel diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index 668467f7ccdf..1b397c2db316 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -1428,6 +1428,19 @@ void ExtCfDataBarRule::finalizeImport() pEntry->SetType(COLORSCALE_PERCENT); else if (maModel.maColorScaleType == "formula") pEntry->SetType(COLORSCALE_FORMULA); + else if (maModel.maColorScaleType == "num") + pEntry->SetType(COLORSCALE_VALUE); + + if (!maModel.msScaleTypeValue.isEmpty()) + { + sal_Int32 nSize = 0; + rtl_math_ConversionStatus eStatus = rtl_math_ConversionStatus_Ok; + double fValue = rtl::math::stringToDouble(maModel.msScaleTypeValue, '.', '\0', &eStatus, &nSize); + if (eStatus == rtl_math_ConversionStatus_Ok && nSize == maModel.msScaleTypeValue.getLength()) + { + pEntry->SetValue(fValue); + } + } break; } case UNKNOWN: // nothing to do diff --git a/sc/source/filter/oox/extlstcontext.cxx b/sc/source/filter/oox/extlstcontext.cxx index 45e60e7c6f5e..1ea6b70d8707 100644 --- a/sc/source/filter/oox/extlstcontext.cxx +++ b/sc/source/filter/oox/extlstcontext.cxx @@ -74,6 +74,7 @@ void ExtCfRuleContext::onStartElement( const AttributeList& rAttribs ) xRule->importCfvo( rAttribs ); xRule->getModel().mbIsLower = mbFirstEntry; mbFirstEntry = false; + mpRule = xRule; break; } default: @@ -81,6 +82,33 @@ void ExtCfRuleContext::onStartElement( const AttributeList& rAttribs ) } } +void ExtCfRuleContext::onCharacters( const OUString& rChars ) +{ + switch( getCurrentElement() ) + { + case XM_TOKEN( f ): + { + if (mpRule) + { + mpRule->getModel().msScaleTypeValue = rChars; + } + } + break; + } +} + +void ExtCfRuleContext::onEndElement() +{ + switch( getCurrentElement() ) + { + case XLS14_TOKEN( cfvo ): + { + mpRule.reset(); + break; + } + } +} + namespace { bool IsSpecificTextCondMode(ScConditionMode eMode) {