LibreOffice Module oox (master)
1
include
oox
export
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
14
#include <
docmodel/color/ComplexColor.hxx
>
15
16
namespace
oox
17
{
18
static
double
convertColorTransformsToTintOrShade
(
model::ComplexColor
const
& rComplexColor)
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
44
static
sal_Int32
convertThemeColorTypeToExcelThemeNumber
(
model::ThemeColorType
eType)
45
{
46
if
(
eType
==
model::ThemeColorType::Unknown
)
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: */
ComplexColor.hxx
model::ComplexColor
model::ComplexColor::getTransformations
std::vector< Transformation > const & getTransformations() const
config.h
eType
DocumentType eType
model::ThemeColorType
ThemeColorType
model::ThemeColorType::Unknown
@ Unknown
model::TransformationType::LumOff
@ LumOff
model::TransformationType::LumMod
@ LumMod
oox
oox::convertColorTransformsToTintOrShade
static double convertColorTransformsToTintOrShade(model::ComplexColor const &rComplexColor)
Definition:
ColorExportUtils.hxx:18
oox::convertThemeColorTypeToExcelThemeNumber
static sal_Int32 convertThemeColorTypeToExcelThemeNumber(model::ThemeColorType eType)
Definition:
ColorExportUtils.hxx:44
Generated on Sun Jul 30 2023 04:39:44 for LibreOffice Module oox (master) by
1.9.3