Coverage Report

Created: 2026-09-28 10:59

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/oox/drawingml/theme.hxx
Line
Count
Source
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
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
20
#pragma once
21
22
#include <com/sun/star/uno/Reference.hxx>
23
#include <oox/drawingml/clrscheme.hxx>
24
#include <oox/drawingml/shape.hxx>
25
#include <oox/dllapi.h>
26
#include <oox/helper/refmap.hxx>
27
#include <oox/helper/refvector.hxx>
28
#include <rtl/ustring.hxx>
29
#include <sal/types.h>
30
#include <docmodel/theme/Theme.hxx>
31
32
namespace com::sun::star {
33
    namespace drawing { class XDrawPage; }
34
    namespace xml::dom { class XDocument; }
35
}
36
namespace model {
37
    class Theme;
38
}
39
40
namespace oox::drawingml
41
{
42
43
struct EffectProperties;
44
struct FillProperties;
45
struct LineProperties;
46
struct TextCharacterProperties;
47
48
const sal_Int32 THEMED_STYLE_SUBTLE     = 1;
49
const sal_Int32 THEMED_STYLE_MODERATE   = 2;
50
const sal_Int32 THEMED_STYLE_INTENSE    = 3;
51
52
typedef RefVector< FillProperties >                     FillStyleList;
53
typedef RefVector< LineProperties >                     LineStyleList;
54
typedef RefVector< EffectProperties >                   EffectStyleList;
55
typedef RefMap< sal_Int32, TextCharacterProperties >    FontScheme;
56
57
class TextFont;
58
59
class OOX_DLLPUBLIC Theme
60
{
61
public:
62
4.20k
    void setThemeName(OUString const& rName) { maThemeName = rName; }
63
4.20k
    void setFormatSchemeName(OUString const& rName) { maFormatSchemeName = rName; }
64
4.20k
    void setFontSchemeName(OUString const& rName) { maFontSchemeName = rName; }
65
66
224k
    ClrScheme&               getClrScheme() { return maClrScheme; }
67
12.3k
    const ClrScheme&         getClrScheme() const { return maClrScheme; }
68
69
4.20k
    FillStyleList&           getFillStyleList() { return maFillStyleList; }
70
0
    const FillStyleList&     getFillStyleList() const { return maFillStyleList; }
71
4.20k
    FillStyleList&           getBgFillStyleList() { return maBgFillStyleList; }
72
0
    const FillStyleList&     getBgFillStyleList() const { return maBgFillStyleList; }
73
    /** Returns the fill properties of the passed one-based themed style index. */
74
    const FillProperties*           getFillStyle( sal_Int32 nIndex ) const;
75
76
4.20k
    LineStyleList&           getLineStyleList() { return maLineStyleList; }
77
0
    const LineStyleList&     getLineStyleList() const { return maLineStyleList; }
78
    /** Returns the line properties of the passed one-based themed style index. */
79
    const LineProperties*           getLineStyle( sal_Int32 nIndex ) const;
80
81
4.20k
    EffectStyleList&         getEffectStyleList() { return maEffectStyleList; }
82
0
    const EffectStyleList&   getEffectStyleList() const { return maEffectStyleList; }
83
    const EffectProperties*         getEffectStyle( sal_Int32 nIndex ) const;
84
85
4.20k
    FontScheme&              getFontScheme() { return maFontScheme; }
86
0
    const FontScheme&        getFontScheme() const { return maFontScheme; }
87
88
4.20k
    std::map<sal_Int32, std::vector<std::pair<OUString, OUString>>>& getSupplementalFontMap() { return maSupplementalFontMap; }
89
0
    std::map<sal_Int32, std::vector<std::pair<OUString, OUString>>> const& getSupplementalFontMap() const { return maSupplementalFontMap; }
90
91
    /** Returns theme font properties by scheme type (major/minor). */
92
    const TextCharacterProperties*  getFontStyle( sal_Int32 nSchemeType ) const;
93
    /** Returns theme font by placeholder name, e.g. the major latin theme font for the font name '+mj-lt'. */
94
    const TextFont*                 resolveFont( std::u16string_view rName ) const;
95
96
220
    Shape&                   getSpDef() { return maSpDef; }
97
0
    const Shape&             getSpDef() const { return maSpDef; }
98
99
215
    Shape&                   getLnDef() { return maLnDef; }
100
0
    const Shape&             getLnDef() const { return maLnDef; }
101
102
3
    Shape&                   getTxDef() { return maTxDef; }
103
0
    const Shape&             getTxDef() const { return maTxDef; }
104
105
2.00k
    const css::uno::Reference<css::xml::dom::XDocument>& getFragment() const { return mxFragment; }
106
1.98k
    void                     setFragment( const css::uno::Reference< css::xml::dom::XDocument>& xRef ) { mxFragment=xRef; }
107
108
    void addTheme(const css::uno::Reference<css::drawing::XDrawPage>& xDrawPage) const;
109
110
    void setTheme(std::shared_ptr<model::Theme> const& pTheme)
111
7.26k
    {
112
7.26k
        mpTheme = pTheme;
113
7.26k
    }
114
115
    std::shared_ptr<model::Theme> const& getTheme() const
116
29.2k
    {
117
29.2k
        return mpTheme;
118
29.2k
    }
119
private:
120
    OUString            maThemeName;
121
    OUString            maFontSchemeName;
122
    OUString            maFormatSchemeName;
123
    ClrScheme           maClrScheme;
124
    FillStyleList       maFillStyleList;
125
    FillStyleList       maBgFillStyleList;
126
    LineStyleList       maLineStyleList;
127
    EffectStyleList     maEffectStyleList;
128
    FontScheme          maFontScheme;
129
    std::map<sal_Int32, std::vector<std::pair<OUString, OUString>>> maSupplementalFontMap;
130
    Shape               maSpDef;
131
    Shape               maLnDef;
132
    Shape               maTxDef;
133
    css::uno::Reference< css::xml::dom::XDocument> mxFragment;
134
135
    std::shared_ptr<model::Theme> mpTheme;
136
};
137
138
139
} // namespace oox::drawingml
140
141
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */