Coverage Report

Created: 2026-06-30 11:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/xmloff/source/style/XMLFontStylesContext_impl.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 <xmloff/xmlstyle.hxx>
23
#include <xmloff/XMLFontStylesContext.hxx>
24
25
namespace com::sun::star::io {
26
    class XOutputStream;
27
}
28
29
/// Handles <style:font-face>
30
class XMLFontStyleContextFontFace : public SvXMLStyleContext
31
{
32
    css::uno::Any aFamilyName;
33
    css::uno::Any aStyleName;
34
    css::uno::Any aFamily;
35
    css::uno::Any aPitch;
36
    css::uno::Any aEnc;
37
38
    rtl::Reference<XMLFontStylesContext> xStyles;
39
40
    XMLFontStylesContext *GetStyles()
41
59.0k
    {
42
59.0k
        return xStyles.get();
43
59.0k
    }
44
45
public:
46
47
48
    XMLFontStyleContextFontFace( SvXMLImport& rImport,
49
            XMLFontStylesContext& rStyles );
50
    virtual ~XMLFontStyleContextFontFace() override;
51
52
    void SetAttribute( sal_Int32 nElement,
53
                       const OUString& rValue ) override;
54
55
    void FillProperties( ::std::vector< XMLPropertyState > &rProps,
56
                         sal_Int32 nFamilyNameIdx,
57
                         sal_Int32 nStyleNameIdx,
58
                         sal_Int32 nFamilyIdx,
59
                         sal_Int32 nPitchIdx,
60
                         sal_Int32 nCharsetIdx ) const;
61
62
    OUString familyName() const;
63
    OUString styleName() const;
64
65
    virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
66
        sal_Int32 nElement,
67
        const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
68
};
69
70
/// Handles <style:font-face-src>
71
class XMLFontStyleContextFontFaceSrc : public SvXMLImportContext
72
{
73
    const XMLFontStyleContextFontFace& font;
74
public:
75
76
77
    XMLFontStyleContextFontFaceSrc( SvXMLImport& rImport,
78
            const XMLFontStyleContextFontFace& font );
79
80
    virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
81
        sal_Int32 nElement,
82
        const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
83
};
84
85
/// Handles <style:font-face-uri>
86
class XMLFontStyleContextFontFaceUri : public SvXMLStyleContext
87
{
88
    const XMLFontStyleContextFontFace& font;
89
    OUString format;
90
    OUString linkPath;
91
    ::css::uno::Sequence< sal_Int8 > maFontData;
92
    ::css::uno::Reference< ::css::io::XOutputStream > mxBase64Stream;
93
94
    void handleEmbeddedFont( const OUString& url, bool eot );
95
    void handleEmbeddedFont( const ::css::uno::Sequence< sal_Int8 >& rData, bool eot );
96
public:
97
98
99
    XMLFontStyleContextFontFaceUri( SvXMLImport& rImport,
100
            const XMLFontStyleContextFontFace& font );
101
102
    virtual void SetAttribute( sal_Int32 nElement,
103
        const OUString& rValue ) override;
104
    void SetFormat( const OUString& rFormat );
105
    void SAL_CALL endFastElement(sal_Int32 nElement) override;
106
    virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
107
        sal_Int32 nElement,
108
        const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override;
109
};
110
111
/// Handles <svg:font-face-format>
112
class XMLFontStyleContextFontFaceFormat : public SvXMLStyleContext
113
{
114
    XMLFontStyleContextFontFaceUri& uri;
115
public:
116
117
    XMLFontStyleContextFontFaceFormat( SvXMLImport& rImport,
118
            XMLFontStyleContextFontFaceUri& uri );
119
120
    void SetAttribute( sal_Int32 nElement,
121
        const OUString& rValue ) override;
122
};
123
124
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */