oox/source/export/drawingml.cxx | 12 +++- sc/source/filter/oox/condformatbuffer.cxx | 76 ++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 3 deletions(-)
New commits: commit f1fcea55e8653e75a24d1c1a574c6a4576b924d1 Author: Caolán McNamara <[email protected]> AuthorDate: Tue Jun 13 14:37:56 2023 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Wed Jun 14 08:55:21 2023 +0200 cid#1532377 Dereference before null check Change-Id: Ie85e81cea63578413db2c69020dae6a105466cb4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152963 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> (cherry picked from commit f412c1e448b0268294ccbccee4f3a6a9e76a7b98) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153010 Reviewed-by: Xisco Fauli <[email protected]> diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 5b0772550471..dca260895af8 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -761,6 +761,14 @@ void DrawingML::WriteGradientFill( basegfx::utils::prepareColorStops(*pTransparenceGradient, aAlphaStops, aSingleAlpha); } + if (nullptr == pGradient) + { + // an error - see comment in header - is to give neither pColorGradient + // nor pTransparenceGradient + assert(false && "pColorGradient or pTransparenceGradient should be set"); + return; + } + // apply steps if used. Need to do that before synchronizeColorStops // since that may add e.g. for AlphaStops all-the-same no-data entries, // so the number of entries might change @@ -775,12 +783,10 @@ void DrawingML::WriteGradientFill( // method (at import time) will be exported again basegfx::utils::synchronizeColorStops(aColorStops, aAlphaStops, aSingleColor, aSingleAlpha); - if (aColorStops.size() != aAlphaStops.size() || nullptr == pGradient) + if (aColorStops.size() != aAlphaStops.size()) { // this is an error - synchronizeColorStops above *has* to create that // state, see description there (!) - // also an error - see comment in header - is to give neither pColorGradient - // nor pTransparenceGradient assert(false && "oox::WriteGradientFill: non-synchronized gradients (!)"); return; } commit 1b282eac598d832e7d0af161541b8a3fcf4767c8 Author: Henry Castro <[email protected]> AuthorDate: Fri Mar 17 10:40:23 2023 -0400 Commit: Xisco Fauli <[email protected]> CommitDate: Wed Jun 14 08:55:09 2023 +0200 sc: filter: oox: add missing attribute "indexed" <x14:dataBar maxLength="100" minLength="0" axisPosition="automatic" direction="context" gradient="0" negativeBarBorderColorSameAsPositive="0"> <x14:cfvo type="autoMin"/> <x14:cfvo type="autoMax"/> <x14:fillColor rgb="FF638EC6"/> <x14:negativeFillColor indexed="2"/> <x14:axisColor indexed="64"/> </x14:dataBar> Signed-off-by: Henry Castro <[email protected]> Change-Id: If7f6c8c902e4cd0d775f1014acad3dcd19f13f28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149065 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152968 Tested-by: Jenkins (cherry picked from commit 77a1441aaaa0c3faffb2e2b78c039a989987b0a8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153014 Reviewed-by: Xisco Fauli <[email protected]> diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index ac5c2738aa47..668467f7ccdf 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -168,6 +168,76 @@ void ColorScaleRule::importCfvo( const AttributeList& rAttribs ) ++mnCfvo; } +// https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.indexedcolors?view=openxml-2.8.1 +static ::Color IndexedColors[] = { + 0x00000000, + 0x00FFFFFF, + 0x00FF0000, + 0x0000FF00, + 0x000000FF, + 0x00FFFF00, + 0x00FF00FF, + 0x0000FFFF, + 0x00000000, + 0x00FFFFFF, + 0x00FF0000, + 0x0000FF00, + 0x000000FF, + 0x00FFFF00, + 0x00FF00FF, + 0x0000FFFF, + 0x00800000, + 0x00008000, + 0x00000080, + 0x00808000, + 0x00800080, + 0x00008080, + 0x00C0C0C0, + 0x00808080, + 0x009999FF, + 0x00993366, + 0x00FFFFCC, + 0x00CCFFFF, + 0x00660066, + 0x00FF8080, + 0x000066CC, + 0x00CCCCFF, + 0x00000080, + 0x00FF00FF, + 0x00FFFF00, + 0x0000FFFF, + 0x00800080, + 0x00800000, + 0x00008080, + 0x000000FF, + 0x0000CCFF, + 0x00CCFFFF, + 0x00CCFFCC, + 0x00FFFF99, + 0x0099CCFF, + 0x00FF99CC, + 0x00CC99FF, + 0x00FFCC99, + 0x003366FF, + 0x0033CCCC, + 0x0099CC00, + 0x00FFCC00, + 0x00FF9900, + 0x00FF6600, + 0x00666699, + 0x00969696, + 0x00003366, + 0x00339966, + 0x00003300, + 0x00333300, + 0x00993300, + 0x00993366, + 0x00333399, + 0x00333333, + 0x00000000, // System Foreground ? + 0x00000000, // System Background ? +}; + namespace { ::Color importOOXColor(const AttributeList& rAttribs, const ThemeBuffer& rThemeBuffer, const GraphicHelper& rGraphicHelper) @@ -191,6 +261,12 @@ namespace { nColor = rThemeBuffer.getColorByIndex( nThemeIndex ); } + else if (rAttribs.hasAttribute(XML_indexed)) + { + sal_uInt32 nIndexed = rAttribs.getUnsigned(XML_indexed, 0); + if (nIndexed < sizeof(IndexedColors)) + nColor = IndexedColors[nIndexed]; + } ::Color aColor; double nTint = rAttribs.getDouble(XML_tint, 0.0);
