Coverage Report

Created: 2026-04-09 11:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sd/source/ui/animations/STLPropertySet.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 "STLPropertySet.hxx"
21
#include <sal/log.hxx>
22
23
using com::sun::star::uno::Any;
24
25
namespace sd
26
{
27
28
STLPropertySet::STLPropertySet()
29
0
{
30
0
}
31
32
STLPropertySet::~STLPropertySet()
33
0
{
34
0
}
35
36
void STLPropertySet::setPropertyDefaultValue( sal_Int32 nHandle, const Any& rValue )
37
0
{
38
0
    maPropertyMap[nHandle] = STLPropertyMapEntry(rValue);
39
0
}
40
41
void STLPropertySet::setPropertyValue( sal_Int32 nHandle, const Any& rValue )
42
0
{
43
0
    PropertyMapIter aIter;
44
0
    if( findProperty( nHandle, aIter ) )
45
0
    {
46
0
        (*aIter).second.mnState = STLPropertyState::Direct;
47
0
        (*aIter).second.maValue = rValue;
48
0
    }
49
0
    else
50
0
    {
51
0
        SAL_WARN("sd", "sd::STLPropertySet::setPropertyValue(), unknown property!");
52
0
    }
53
0
}
54
55
Any STLPropertySet::getPropertyValue( sal_Int32 nHandle ) const
56
0
{
57
0
    PropertyMapConstIter aIter;
58
0
    if( findProperty( nHandle, aIter ) )
59
0
    {
60
0
        return (*aIter).second.maValue;
61
0
    }
62
0
    else
63
0
    {
64
0
        SAL_WARN("sd", "sd::STLPropertySet::getPropertyValue(), unknown property!");
65
66
0
        Any aAny;
67
0
        return aAny;
68
0
    }
69
0
}
70
71
STLPropertyState STLPropertySet::getPropertyState( sal_Int32 nHandle ) const
72
0
{
73
0
    PropertyMapConstIter aIter;
74
0
    if( findProperty( nHandle, aIter ) )
75
0
    {
76
0
        return (*aIter).second.mnState;
77
0
    }
78
0
    else
79
0
    {
80
0
        SAL_WARN("sd", "sd::STLPropertySet::getPropertyState(), unknown property!");
81
0
        return STLPropertyState::Ambiguous;
82
0
    }
83
0
}
84
85
void STLPropertySet::setPropertyState( sal_Int32 nHandle, STLPropertyState nState )
86
0
{
87
0
    PropertyMapIter aIter;
88
0
    if( findProperty( nHandle, aIter ) )
89
0
    {
90
0
        (*aIter).second.mnState = nState;
91
0
    }
92
0
    else
93
0
    {
94
0
        SAL_WARN("sd","sd::STLPropertySet::setPropertyState(), unknown property!");
95
0
    }
96
0
}
97
98
bool STLPropertySet::findProperty( sal_Int32 nHandle, PropertyMapIter& rIter )
99
0
{
100
0
    rIter = maPropertyMap.find(nHandle);
101
0
    return( rIter != maPropertyMap.end() );
102
0
}
103
104
bool STLPropertySet::findProperty( sal_Int32 nHandle, PropertyMapConstIter& rIter ) const
105
0
{
106
0
    rIter = maPropertyMap.find(nHandle);
107
0
    return( rIter != maPropertyMap.end() );
108
0
}
109
110
}
111
112
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */