Coverage Report

Created: 2026-02-14 09:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/xmloff/source/text/xmllinebreakcontext.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
10
#include "xmllinebreakcontext.hxx"
11
12
#include <com/sun/star/beans/XPropertySet.hpp>
13
#include <com/sun/star/frame/XModel.hpp>
14
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
15
#include <com/sun/star/text/XTextContent.hpp>
16
17
#include <xmloff/xmlement.hxx>
18
#include <xmloff/xmlimp.hxx>
19
#include <xmloff/xmlnamespace.hxx>
20
#include <xmloff/xmluconv.hxx>
21
22
using namespace com::sun::star;
23
using namespace xmloff::token;
24
25
namespace
26
{
27
const SvXMLEnumMapEntry<sal_Int16> pXML_LineBreakClear_Enum[] = {
28
    { XML_NONE, 0 }, { XML_LEFT, 1 }, { XML_RIGHT, 2 }, { XML_ALL, 3 }, { XML_TOKEN_INVALID, 0 }
29
};
30
}
31
32
SvXMLLineBreakContext::SvXMLLineBreakContext(SvXMLImport& rImport, XMLTextImportHelper& rHelper)
33
0
    : SvXMLImportContext(rImport)
34
0
    , m_rHelper(rHelper)
35
0
{
36
0
}
37
38
void SvXMLLineBreakContext::startFastElement(
39
    sal_Int32 /*nElement*/, const uno::Reference<xml::sax::XFastAttributeList>& xAttrList)
40
0
{
41
0
    const uno::Reference<frame::XModel>& xModel = GetImport().GetModel();
42
0
    uno::Reference<lang::XMultiServiceFactory> xFactory(xModel, uno::UNO_QUERY);
43
0
    if (!xFactory.is())
44
0
        return;
45
46
0
    uno::Reference<text::XTextContent> xLineBreak(
47
0
        xFactory->createInstance(u"com.sun.star.text.LineBreak"_ustr), uno::UNO_QUERY);
48
49
0
    sal_Int16 eClear = 0;
50
0
    OUString aClear = xAttrList->getValue(XML_ELEMENT(LO_EXT, XML_CLEAR));
51
0
    if (SvXMLUnitConverter::convertEnum(eClear, aClear, pXML_LineBreakClear_Enum))
52
0
    {
53
0
        uno::Reference<beans::XPropertySet> xLineBreakProps(xLineBreak, uno::UNO_QUERY);
54
0
        xLineBreakProps->setPropertyValue(u"Clear"_ustr, uno::Any(eClear));
55
0
    }
56
57
0
    m_rHelper.InsertTextContent(xLineBreak);
58
0
}
59
60
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */