Follow-up to 92d78c3fa385f794b63cf6b328b41222f9e4c8b2 (Table Styles: Move Calc table style generation from OOXML filter to core). ComplexColor::applyTransformations() applies LumMod and LumOff as two separate RGB-HSL-RGB round-trips, which can produce off-by-one color values due to intermediate uint8 rounding. The OOXML filter's Color::getColor() avoided this by staying in HSL between the two transforms. Add ColorSet::resolveOOXMLColor() which collects LumMod and LumOff from the ComplexColor transforms and applies them in a single ApplyLumModOff() call. Also fixes the ComplexColor transform scale in TableStyleGenerator from 100'000 (OOXML scale) to 10'000 (ComplexColor convention), matching what the oox filter's createComplexColor() produces. Change-Id: Id0173f44ffa3663893e3012d7aefbeabbe264241 Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/232 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> (cherry picked from commit b44399314130a10698a18ffdab482a68bfdcff1a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204568 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
54 lines
1.5 KiB
C++
54 lines
1.5 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/*
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <array>
|
|
#include <docmodel/dllapi.h>
|
|
#include <rtl/ustring.hxx>
|
|
#include <docmodel/theme/ThemeColorType.hxx>
|
|
#include <docmodel/color/ComplexColor.hxx>
|
|
#include <tools/color.hxx>
|
|
|
|
typedef struct _xmlTextWriter* xmlTextWriterPtr;
|
|
|
|
namespace model
|
|
{
|
|
class DOCMODEL_DLLPUBLIC ColorSet
|
|
{
|
|
OUString maName;
|
|
std::array<Color, 12> maColors;
|
|
|
|
public:
|
|
ColorSet(OUString const& rName);
|
|
|
|
void setName(OUString const& rName) { maName = rName; }
|
|
|
|
void add(model::ThemeColorType Type, Color aColorData);
|
|
|
|
const OUString& getName() const { return maName; }
|
|
|
|
Color resolveColor(model::ComplexColor const& rComplexColor) const;
|
|
|
|
/// Resolve a themed ComplexColor by applying LumMod and LumOff together
|
|
/// in a single HSL round-trip. Use this instead of resolveColor() for
|
|
/// OOXML-originated colors, where the two transforms must be combined
|
|
/// to produce correct results.
|
|
Color resolveOOXMLColor(model::ComplexColor const& rComplexColor) const;
|
|
|
|
Color getColor(model::ThemeColorType eType) const;
|
|
|
|
void dumpAsXml(xmlTextWriterPtr pWriter) const;
|
|
};
|
|
|
|
} // end of namespace model
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|