LibreOffice Module oox (master) 1
ColorExportUtils.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 */
9
10#pragma once
11
12#include <sal/config.h>
13
15
16namespace oox
17{
19{
20 sal_Int16 nLumMod = 10'000;
21 sal_Int16 nLumOff = 0;
22
23 for (auto const& rTransform : rComplexColor.getTransformations())
24 {
25 if (rTransform.meType == model::TransformationType::LumMod)
26 nLumMod = rTransform.mnValue;
27 if (rTransform.meType == model::TransformationType::LumOff)
28 nLumOff = rTransform.mnValue;
29 }
30
31 if (nLumMod == 10'000 && nLumOff == 0)
32 return 0.0;
33
34 double fTint = 0.0;
35
36 if (nLumOff > 0) // tint
37 fTint = double(nLumOff) / 10'000.0;
38 else
39 fTint = -double(10'000 - nLumMod) / 10'000.0;
40
41 return fTint;
42}
43
45{
47 return -1;
48
49 constexpr std::array<sal_Int32, 12> constMap = { 1, 0, 3, 2, 4, 5, 6, 7, 8, 9, 10, 11 };
50
51 return constMap[sal_Int32(eType)];
52}
53}
54
55/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< Transformation > const & getTransformations() const
DocumentType eType
ThemeColorType
static double convertColorTransformsToTintOrShade(model::ComplexColor const &rComplexColor)
static sal_Int32 convertThemeColorTypeToExcelThemeNumber(model::ThemeColorType eType)