1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <sal/config.h>
12 #include <oox/export/ColorExportUtils.hxx>
13 #include <docmodel/color/ComplexColor.hxx>
17 double convertColorTransformsToTintOrShade(model::ComplexColor
const& rComplexColor
)
19 sal_Int16 nLumMod
= 10'000;
20 sal_Int16 nLumOff
= 0;
22 for (auto const& rTransform
: rComplexColor
.getTransformations())
24 if (rTransform
.meType
== model::TransformationType::LumMod
)
25 nLumMod
= rTransform
.mnValue
;
26 if (rTransform
.meType
== model::TransformationType::LumOff
)
27 nLumOff
= rTransform
.mnValue
;
30 if (nLumMod
== 10'000 && nLumOff
== 0)
35 if (nLumOff
> 0) // tint
36 fTint
= double(nLumOff
) / 10'000.0;
38 fTint
= -double(10'000 - nLumMod
) / 10'000.0;
43 sal_Int32
convertThemeColorTypeToExcelThemeNumber(model::ThemeColorType eType
)
45 if (eType
== model::ThemeColorType::Unknown
)
48 // Change position of text1 and text2 and background1 and background2 - needed because of an bug in excel, where
49 // the text and background index positions are switched.
52 // everything else stays the same
53 static constexpr std::array
<sal_Int32
, 12> constThemeColorMapToXmlMap
54 = { 1, 0, 3, 2, 4, 5, 6, 7, 8, 9, 10, 11 };
56 return constThemeColorMapToXmlMap
[sal_Int32(eType
)];
60 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */