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 4e63c742bfc5d99623baa3fd8a8a53ec69cef67e Author: Henry Castro <hcas...@collabora.com> AuthorDate: Fri Mar 17 10:47:31 2023 -0400 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Mar 23 07:11:34 2023 +0000 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/+/149342 Tested-by: Andras Timar <andras.ti...@collabora.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx index 43158e330c83..8ccd7fc12e2c 100644 --- a/sc/source/filter/inc/condformatbuffer.hxx +++ b/sc/source/filter/inc/condformatbuffer.hxx @@ -242,6 +242,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 3e5569ce5b9e..9b2b10956256 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -1411,6 +1411,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 eb470999f40f..f5bdc5ccef66 100644 --- a/sc/source/filter/oox/extlstcontext.cxx +++ b/sc/source/filter/oox/extlstcontext.cxx @@ -80,6 +80,7 @@ void ExtCfRuleContext::onStartElement( const AttributeList& rAttribs ) xRule->importCfvo( rAttribs ); xRule->getModel().mbIsLower = mbFirstEntry; mbFirstEntry = false; + mpRule = xRule; break; } default: @@ -87,6 +88,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) {