Coverage Report

Created: 2026-06-30 11:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/xmloff/source/transform/PersMixedContentTContext.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
#include "TransformerBase.hxx"
21
#include "PersMixedContentTContext.hxx"
22
23
#include <osl/diagnose.h>
24
25
#include <utility>
26
27
using namespace ::com::sun::star::uno;
28
using namespace ::com::sun::star::xml::sax;
29
30
namespace {
31
32
class XMLPersTextTContext_Impl : public XMLTransformerContext
33
{
34
    OUString m_aCharacters;
35
36
public:
37
    XMLPersTextTContext_Impl( XMLTransformerBase& rTransformer,
38
                           OUString aChars );
39
40
    virtual rtl::Reference<XMLTransformerContext> CreateChildContext( sal_uInt16 nPrefix,
41
                                   const OUString& rLocalName,
42
                                   const OUString& rQName,
43
                                   const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
44
    virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override;
45
    virtual void EndElement() override;
46
    virtual void Characters( const OUString& rChars ) override;
47
48
    virtual bool IsPersistent() const override;
49
    virtual void Export() override;
50
};
51
52
}
53
54
XMLPersTextTContext_Impl::XMLPersTextTContext_Impl(
55
        XMLTransformerBase& rImp,
56
        OUString aChars ) :
57
0
    XMLTransformerContext( rImp, OUString() ),
58
0
    m_aCharacters(std::move( aChars ))
59
0
{
60
0
}
61
62
rtl::Reference<XMLTransformerContext> XMLPersTextTContext_Impl::CreateChildContext(
63
        sal_uInt16,
64
        const OUString&,
65
        const OUString&,
66
        const Reference< XAttributeList >& )
67
0
{
68
0
    OSL_ENSURE( false, "illegal call to CreateChildContext" );
69
0
    return {};
70
0
}
71
72
void XMLPersTextTContext_Impl::StartElement(
73
    const Reference< XAttributeList >& )
74
0
{
75
0
    OSL_ENSURE( false, "illegal call to StartElement" );
76
0
}
77
78
void XMLPersTextTContext_Impl::EndElement()
79
0
{
80
0
    OSL_ENSURE( false, "illegal call to EndElement" );
81
0
}
82
83
bool XMLPersTextTContext_Impl::IsPersistent() const
84
0
{
85
0
    return true;
86
0
}
87
88
void XMLPersTextTContext_Impl::Characters( const OUString& rChars )
89
0
{
90
0
    m_aCharacters += rChars;
91
0
}
92
93
void XMLPersTextTContext_Impl::Export()
94
0
{
95
0
    GetTransformer().GetDocHandler()->characters( m_aCharacters );
96
0
}
97
98
XMLPersMixedContentTContext::XMLPersMixedContentTContext(
99
        XMLTransformerBase& rImp,
100
        const OUString& rQName ) :
101
0
    XMLPersElemContentTContext( rImp, rQName )
102
0
{
103
0
}
104
105
XMLPersMixedContentTContext::XMLPersMixedContentTContext(
106
        XMLTransformerBase& rImp,
107
        const OUString& rQName,
108
       sal_uInt16 nActionMap ) :
109
0
    XMLPersElemContentTContext( rImp, rQName, nActionMap )
110
0
{
111
0
}
112
113
XMLPersMixedContentTContext::XMLPersMixedContentTContext(
114
        XMLTransformerBase& rImp,
115
        const OUString& rQName,
116
        sal_uInt16 nPrefix,
117
        ::xmloff::token::XMLTokenEnum eToken ) :
118
0
    XMLPersElemContentTContext( rImp, rQName, nPrefix, eToken )
119
0
{
120
0
}
121
122
XMLPersMixedContentTContext::XMLPersMixedContentTContext(
123
        XMLTransformerBase& rImp,
124
        const OUString& rQName,
125
        sal_uInt16 nPrefix,
126
        ::xmloff::token::XMLTokenEnum eToken,
127
       sal_uInt16 nActionMap ) :
128
0
    XMLPersElemContentTContext( rImp, rQName, nPrefix, eToken, nActionMap )
129
0
{
130
0
}
131
132
XMLPersMixedContentTContext::~XMLPersMixedContentTContext()
133
0
{
134
0
}
135
136
void XMLPersMixedContentTContext::Characters( const OUString& rChars )
137
0
{
138
0
    AddContent( new XMLPersTextTContext_Impl( GetTransformer(), rChars ) );
139
0
}
140
141
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */