Coverage Report

Created: 2026-06-30 11:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/xmloff/source/chart/SchXMLTextListContext.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 "SchXMLTextListContext.hxx"
21
#include "SchXMLParagraphContext.hxx"
22
23
#include <xmloff/xmlnamespace.hxx>
24
#include <xmloff/xmltoken.hxx>
25
#include <xmloff/xmlimp.hxx>
26
#include <xmloff/xmlictxt.hxx>
27
#include <sal/log.hxx>
28
29
using ::com::sun::star::uno::Sequence;
30
using ::com::sun::star::uno::Reference;
31
using namespace com::sun::star;
32
using namespace ::xmloff::token;
33
34
namespace {
35
36
class SchXMLListItemContext : public SvXMLImportContext
37
{
38
public:
39
    SchXMLListItemContext( SvXMLImport& rImport, OUString& rText );
40
41
    virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
42
        sal_Int32 nElement,
43
        const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
44
45
private:
46
    OUString& m_rText;
47
};
48
49
}
50
51
SchXMLListItemContext::SchXMLListItemContext(
52
        SvXMLImport& rImport
53
        , OUString& rText )
54
0
        : SvXMLImportContext( rImport )
55
0
        , m_rText( rText )
56
0
{
57
0
}
58
59
css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLListItemContext::createFastChildContext(
60
    sal_Int32 nElement,
61
    const css::uno::Reference< css::xml::sax::XFastAttributeList >&  )
62
0
{
63
0
    SvXMLImportContext* pContext = nullptr;
64
0
    if( nElement == XML_ELEMENT(TEXT, XML_P) ||
65
0
        nElement == XML_ELEMENT(LO_EXT, XML_P) )
66
0
        pContext = new SchXMLParagraphContext( GetImport(), m_rText );
67
0
    else
68
0
        XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
69
0
    return pContext;
70
0
}
71
72
SchXMLTextListContext::SchXMLTextListContext(
73
        SvXMLImport& rImport
74
        , Sequence< OUString>& rTextList )
75
0
        : SvXMLImportContext( rImport )
76
0
        , m_rTextList( rTextList )
77
0
{
78
0
}
79
80
SchXMLTextListContext::~SchXMLTextListContext()
81
0
{
82
0
}
83
84
void SchXMLTextListContext::endFastElement(sal_Int32 )
85
0
{
86
0
    sal_Int32 nCount = m_aTextVector.size();
87
0
    m_rTextList.realloc(nCount);
88
0
    auto pTextList = m_rTextList.getArray();
89
0
    for( sal_Int32 nN=0; nN<nCount; nN++ )
90
0
        pTextList[nN]=m_aTextVector[nN];
91
0
}
92
93
css::uno::Reference< css::xml::sax::XFastContextHandler > SchXMLTextListContext::createFastChildContext(
94
    sal_Int32 nElement,
95
    const css::uno::Reference< css::xml::sax::XFastAttributeList >&  )
96
0
{
97
0
    SvXMLImportContext* pContext = nullptr;
98
0
    if( nElement == XML_ELEMENT(TEXT, XML_LIST_ITEM) )
99
0
    {
100
0
        m_aTextVector.emplace_back( );
101
0
        pContext = new SchXMLListItemContext( GetImport(), m_aTextVector.back() );
102
0
    }
103
0
    else
104
0
        XMLOFF_WARN_UNKNOWN_ELEMENT("xmloff", nElement);
105
0
    return pContext;
106
0
}
107
108
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */