Coverage Report

Created: 2026-04-09 11:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/oox/source/drawingml/table/tablestyletextstylecontext.cxx
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
21
#include <drawingml/table/tablestyletextstylecontext.hxx>
22
#include <drawingml/colorchoicecontext.hxx>
23
#include <oox/helper/attributelist.hxx>
24
#include <oox/token/namespaces.hxx>
25
#include <oox/token/tokens.hxx>
26
27
using namespace ::oox::core;
28
using namespace ::com::sun::star;
29
30
namespace oox::drawingml::table {
31
32
TableStyleTextStyleContext::TableStyleTextStyleContext( ContextHandler2Helper const & rParent,
33
    const AttributeList& rAttribs, TableStylePart& rTableStylePart )
34
177
: ContextHandler2( rParent )
35
177
, mrTableStylePart( rTableStylePart )
36
177
{
37
177
    if( rAttribs.hasAttribute( XML_b ) ) {
38
140
        sal_Int32 nB = rAttribs.getToken( XML_b, XML_def );
39
140
        if ( nB == XML_on )
40
140
            mrTableStylePart.getTextBoldStyle() = true;
41
0
        else if ( nB == XML_off )
42
0
            mrTableStylePart.getTextBoldStyle() = false;
43
140
    }
44
45
177
    if( rAttribs.hasAttribute( XML_i ) ) {
46
0
        sal_Int32 nI = rAttribs.getToken( XML_i, XML_def );
47
0
        if ( nI == XML_on )
48
0
            mrTableStylePart.getTextItalicStyle() = true;
49
0
        else if ( nI == XML_off )
50
0
            mrTableStylePart.getTextItalicStyle() = false;
51
0
    }
52
177
}
53
54
TableStyleTextStyleContext::~TableStyleTextStyleContext()
55
177
{
56
177
}
57
58
// CT_TableStyleTextStyle
59
ContextHandlerRef
60
TableStyleTextStyleContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& rAttribs )
61
354
{
62
354
    switch( aElementToken )
63
354
    {
64
        // EG_ThemeableFontStyles (choice)
65
0
        case A_TOKEN( font ):       // CT_FontCollection
66
0
            return this;
67
0
        case A_TOKEN( ea ):             // CT_TextFont
68
0
            mrTableStylePart.getAsianFont().setAttributes( rAttribs );
69
0
            return nullptr;
70
0
        case A_TOKEN( cs ):             // CT_TextFont
71
0
            mrTableStylePart.getComplexFont().setAttributes( rAttribs );
72
0
            return nullptr;
73
0
        case A_TOKEN( sym ):            // CT_TextFont
74
0
            mrTableStylePart.getSymbolFont().setAttributes( rAttribs );
75
0
            return nullptr;
76
0
        case A_TOKEN( latin ):          // CT_TextFont
77
0
            mrTableStylePart.getLatinFont().setAttributes( rAttribs );
78
0
            return nullptr;
79
80
177
        case A_TOKEN( fontRef ):    // CT_FontReference
81
177
            {
82
177
                ShapeStyleRef& rFontStyle = mrTableStylePart.getStyleRefs()[ XML_fontRef ];
83
177
                rFontStyle.mnThemedIdx = rAttribs.getToken( XML_idx, XML_none );
84
177
                return new ColorContext(*this, &rFontStyle.maPhClr);
85
0
            }
86
87
0
        case A_TOKEN( extLst ):     // CT_OfficeArtExtensionList
88
0
            break;
89
354
    }
90
91
177
    return new ColorValueContext(*this, &mrTableStylePart.getTextColor());
92
354
}
93
94
}
95
96
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */