Coverage Report

Created: 2026-03-31 11:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/xmloff/source/text/XMLAutoMarkFileContext.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 "XMLAutoMarkFileContext.hxx"
21
#include <xmloff/xmlimp.hxx>
22
#include <xmloff/xmlnamespace.hxx>
23
#include <xmloff/xmltoken.hxx>
24
#include <com/sun/star/frame/XModel.hpp>
25
#include <com/sun/star/uno/Reference.hxx>
26
#include <com/sun/star/beans/XPropertySet.hpp>
27
#include <sal/log.hxx>
28
29
30
using ::com::sun::star::uno::Any;
31
using ::com::sun::star::uno::Reference;
32
using ::com::sun::star::uno::UNO_QUERY;
33
using ::com::sun::star::beans::XPropertySet;
34
35
using ::xmloff::token::XML_HREF;
36
37
38
XMLAutoMarkFileContext::XMLAutoMarkFileContext(
39
    SvXMLImport& rImport) :
40
1
        SvXMLImportContext(rImport)
41
1
{
42
1
}
43
44
XMLAutoMarkFileContext::~XMLAutoMarkFileContext()
45
1
{
46
1
}
47
48
49
void XMLAutoMarkFileContext::startFastElement(
50
    sal_Int32 /*nElement*/,
51
    const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
52
1
{
53
    // scan for text:alphabetical-index-auto-mark-file attribute, and if
54
    // found set value with the document
55
56
1
    for( auto& aIter : sax_fastparser::castToFastAttributeList(xAttrList) )
57
0
    {
58
0
        switch(aIter.getToken())
59
0
        {
60
0
            case XML_ELEMENT(XLINK, XML_HREF):
61
0
            {
62
0
                Any aAny;
63
0
                aAny <<= GetImport().GetAbsoluteReference( aIter.toString() );
64
0
                Reference<XPropertySet> xPropertySet(
65
0
                    GetImport().GetModel(), UNO_QUERY );
66
0
                if (xPropertySet.is())
67
0
                {
68
0
                    xPropertySet->setPropertyValue( u"IndexAutoMarkFileURL"_ustr, aAny );
69
0
                }
70
0
                break;
71
0
            }
72
0
            default:
73
0
                XMLOFF_WARN_UNKNOWN("xmloff", aIter);
74
0
        }
75
0
    }
76
1
}
77
78
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */