Coverage Report

Created: 2026-02-14 09:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/svl/source/misc/ownlist.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 <com/sun/star/uno/Sequence.hxx>
21
#include <com/sun/star/beans/PropertyValue.hpp>
22
#include <com/sun/star/beans/PropertyState.hpp>
23
24
#include <svl/ownlist.hxx>
25
26
using namespace com::sun::star;
27
28
29
/**
30
 * An object of the type SvCommand is created and the list is
31
 * attached.
32
*/
33
void SvCommandList::Append
34
(
35
 const OUString & rCommand,    /* The command */
36
 const OUString & rArg         /* The command's argument */
37
)
38
20.9k
{
39
20.9k
    aCommandList.emplace_back( rCommand, rArg );
40
20.9k
}
41
42
void SvCommandList::FillFromSequence( const css::uno::Sequence < css::beans::PropertyValue >& aCommandSequence )
43
0
{
44
0
    OUString aCommand, aArg;
45
0
    OUString aApiArg;
46
0
    for( const auto& rCommand : aCommandSequence )
47
0
    {
48
0
        aCommand = rCommand.Name;
49
0
        if( !( rCommand.Value >>= aApiArg ) )
50
0
            return;
51
0
        aArg = aApiArg;
52
0
        Append( aCommand, aArg );
53
0
    }
54
0
}
55
56
void SvCommandList::FillSequence( css::uno::Sequence < css::beans::PropertyValue >& aCommandSequence ) const
57
0
{
58
0
    const sal_Int32 nCount = aCommandList.size();
59
0
    aCommandSequence.realloc( nCount );
60
0
    auto pCommandSequence = aCommandSequence.getArray();
61
0
    for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
62
0
    {
63
0
        pCommandSequence[nIndex].Name = aCommandList[ nIndex ].GetCommand();
64
0
        pCommandSequence[nIndex].Handle = -1;
65
0
        pCommandSequence[nIndex].Value <<= aCommandList[ nIndex ].GetArgument();
66
0
        pCommandSequence[nIndex].State = beans::PropertyState_DIRECT_VALUE;
67
0
    }
68
0
}
69
70
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */