diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2022-06-17 16:51:22 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-06-27 19:26:46 +0200 |
commit | 74ab282da2b020f71c24fb6006cd3c3d63c3f21f (patch) | |
tree | 91ad6eac02611e5919b2356513b3ead2e2792b50 /sc/source/filter | |
parent | ad2a818c1d91c89ed3dedab5005f278ac9d6792c (diff) |
tdf#148820 sc: fix conditional formatted cell color
Store foreground color for color filtering, because in OOXML
the foreground color is used for color filtering and we overwrote
it with the background color which is used for conditional formatted cells too.
Regression from commit: 6f908b48373b71d45c8119b296b0504fb586f6f8
(tdf#143104 Fix xlsx import/export of color filter colors)
Change-Id: I737e6f1170851822a2689fa477db59e62f0d47fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136055
Tested-by: Jenkins
Tested-by: Gabor Kelemen <kelemeng@ubuntu.com>
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
(cherry picked from commit 415dc3bb1c03dbdbc3cbca274bc435ac7557ba2d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136457
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136479
Diffstat (limited to 'sc/source/filter')
-rw-r--r-- | sc/source/filter/inc/stylesbuffer.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/autofilterbuffer.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/stylesbuffer.cxx | 17 |
3 files changed, 17 insertions, 4 deletions
diff --git a/sc/source/filter/inc/stylesbuffer.hxx b/sc/source/filter/inc/stylesbuffer.hxx index d0a32d599db1..4d9e7aeed33d 100644 --- a/sc/source/filter/inc/stylesbuffer.hxx +++ b/sc/source/filter/inc/stylesbuffer.hxx @@ -466,6 +466,7 @@ typedef std::shared_ptr< Border > BorderRef; struct PatternFillModel { Color maPatternColor; /// Pattern foreground color. + Color maFilterPatternColor; /// Pattern foreground for color filter. Color maFillColor; /// Background fill color. sal_Int32 mnPattern; /// Pattern identifier (e.g. solid). bool mbPattColorUsed; /// True = pattern foreground color used. @@ -503,6 +504,7 @@ struct GradientFillModel struct ApiSolidFillData { ::Color mnColor; /// Fill color. + ::Color mnFilterColor; /// Fill color filtering. bool mbTransparent; /// True = transparent area. bool mbUsed; /// True = fill data is valid. diff --git a/sc/source/filter/oox/autofilterbuffer.cxx b/sc/source/filter/oox/autofilterbuffer.cxx index 6bffe8e53b25..fc2ecb22030e 100644 --- a/sc/source/filter/oox/autofilterbuffer.cxx +++ b/sc/source/filter/oox/autofilterbuffer.cxx @@ -443,7 +443,7 @@ ApiFilterSettings ColorFilter::finalizeImport() const SfxItemSet& rItemSet = pStyleSheet->GetItemSet(); // Color (whether text or background color) is always stored in ATTR_BACKGROUND const SvxBrushItem* pItem = rItemSet.GetItem<SvxBrushItem>(ATTR_BACKGROUND); - ::Color aColor = pItem->GetColor(); + ::Color aColor = pItem->GetFiltColor(); util::Color nColor(aColor); aSettings.appendField(true, nColor, mbIsBackgroundColor); return aSettings; diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index d40fcdc3d395..9edfb0081b29 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -1618,6 +1618,7 @@ PatternFillModel::PatternFillModel( bool bDxf ) : mbPatternUsed( !bDxf ) { maPatternColor.setIndexed( OOX_COLOR_WINDOWTEXT ); + maFilterPatternColor.setIndexed( OOX_COLOR_WINDOWTEXT ); maFillColor.setIndexed( OOX_COLOR_WINDOWBACK ); } @@ -1676,6 +1677,7 @@ void GradientFillModel::readGradientStop( SequenceInputStream& rStrm, bool bDxf ApiSolidFillData::ApiSolidFillData() : mnColor( API_RGB_TRANSPARENT ), + mnFilterColor( API_RGB_TRANSPARENT ), mbTransparent( true ), mbUsed( false ) { @@ -1827,8 +1829,8 @@ void Fill::finalizeImport() { if( rModel.mbFillColorUsed && (!rModel.mbPatternUsed || (rModel.mnPattern == XML_solid)) ) { - if (!rModel.mbPatternUsed) - rModel.maPatternColor = rModel.maFillColor; + rModel.maFilterPatternColor = rModel.maPatternColor; + rModel.maPatternColor = rModel.maFillColor; rModel.mnPattern = XML_solid; rModel.mbPattColorUsed = rModel.mbPatternUsed = true; } @@ -1838,6 +1840,8 @@ void Fill::finalizeImport() { rModel.mbPatternUsed = false; } + else + rModel.maFilterPatternColor = rModel.maPatternColor; } // convert to API fill settings @@ -1875,15 +1879,20 @@ void Fill::finalizeImport() ::Color nWinTextColor = rGraphicHelper.getSystemColor( XML_windowText ); ::Color nWinColor = rGraphicHelper.getSystemColor( XML_window ); - if( !rModel.mbPattColorUsed ) + if (!rModel.mbPattColorUsed) + { rModel.maPatternColor.setAuto(); + rModel.maFilterPatternColor.setAuto(); + } ::Color nPattColor = rModel.maPatternColor.getColor( rGraphicHelper, nWinTextColor ); + ::Color nFiltPattColor = rModel.maFilterPatternColor.getColor( rGraphicHelper, nWinTextColor ); if( !rModel.mbFillColorUsed ) rModel.maFillColor.setAuto(); ::Color nFillColor = rModel.maFillColor.getColor( rGraphicHelper, nWinColor ); maApiData.mnColor = lclGetMixedColor( nPattColor, nFillColor, nAlpha ); + maApiData.mnFilterColor = lclGetMixedColor( nFiltPattColor, nFillColor, nAlpha ); maApiData.mbTransparent = false; } } @@ -1913,10 +1922,12 @@ void Fill::fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs ) const if ( maApiData.mbTransparent ) { aBrushItem.SetColor( COL_TRANSPARENT ); + aBrushItem.SetFiltColor( COL_TRANSPARENT ); } else { aBrushItem.SetColor( maApiData.mnColor ); + aBrushItem.SetFiltColor( maApiData.mnFilterColor ); } ScfTools::PutItem( rItemSet, aBrushItem, bSkipPoolDefs ); } |