diff options
author | Henry Castro <hcastro@collabora.com> | 2023-03-17 10:47:31 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2023-05-16 18:08:14 +0200 |
commit | 147527b53f414e2583ecc4d524681351fab2f696 (patch) | |
tree | 9700844b0e7fc1fee9bab008b3c587792352b3bf /sc | |
parent | daa451e14b808a8388cc628082f30cbdc080573f (diff) |
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 <hcastro@collabora.com>
Change-Id: Ie98507e11a5cdeb0d1adc77a44fd79edb2f26d6a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149066
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/inc/condformatbuffer.hxx | 1 | ||||
-rw-r--r-- | sc/source/filter/inc/extlstcontext.hxx | 4 | ||||
-rw-r--r-- | sc/source/filter/oox/condformatbuffer.cxx | 13 | ||||
-rw-r--r-- | sc/source/filter/oox/extlstcontext.cxx | 28 |
4 files changed, 45 insertions, 1 deletions
diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx index 1180b1e0aa74..cdc8d4727baf 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 da99d8ab645e..5e3e0d4a18b5 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -1434,6 +1434,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 760ba26c1727..2646f0969958 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) { |