Coverage Report

Created: 2026-04-09 11:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/svl/source/items/intitem.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 <svl/intitem.hxx>
21
#include <com/sun/star/uno/Any.hxx>
22
#include <osl/diagnose.h>
23
#include <tools/bigint.hxx>
24
#include <svl/metitem.hxx>
25
#include <libxml/xmlwriter.h>
26
#include <tools/XmlWriter.hxx>
27
#include <boost/property_tree/ptree.hpp>
28
29
30
SfxPoolItem* SfxByteItem::CreateDefault()
31
0
{
32
0
    return new SfxByteItem();
33
0
};
34
35
SfxPoolItem* SfxInt16Item::CreateDefault()
36
220k
{
37
220k
    return new SfxInt16Item();
38
220k
};
39
40
// virtual
41
bool SfxInt16Item::operator ==(const SfxPoolItem & rItem) const
42
52.9M
{
43
52.9M
    assert(SfxPoolItem::operator==(rItem));
44
52.9M
    return m_nValue == static_cast< const SfxInt16Item * >(&rItem)->
45
52.9M
                        m_nValue;
46
52.9M
}
47
48
// virtual
49
bool SfxInt16Item::GetPresentation(SfxItemPresentation,
50
                                                  MapUnit, MapUnit,
51
                                                  OUString & rText,
52
                                                  const IntlWrapper&) const
53
0
{
54
0
    rText = OUString::number(m_nValue);
55
0
    return true;
56
0
}
57
58
59
boost::property_tree::ptree SfxInt16Item::dumpAsJSON() const
60
0
{
61
0
    boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
62
0
    aTree.put("state", GetValue());
63
0
    return aTree;
64
0
}
65
66
67
// virtual
68
bool SfxInt16Item::QueryValue(css::uno::Any& rVal, sal_uInt8) const
69
2.57k
{
70
2.57k
    sal_Int16 nValue = m_nValue;
71
2.57k
    rVal <<= nValue;
72
2.57k
    return true;
73
2.57k
}
74
75
// virtual
76
bool SfxInt16Item::PutValue(const css::uno::Any& rVal, sal_uInt8 )
77
167k
{
78
167k
    sal_Int16 nValue = sal_Int16();
79
167k
    if (rVal >>= nValue)
80
167k
    {
81
167k
        m_nValue = nValue;
82
167k
        return true;
83
167k
    }
84
85
0
    OSL_FAIL( "SfxInt16Item::PutValue - Wrong type!" );
86
0
    return false;
87
167k
}
88
89
SfxInt16Item* SfxInt16Item::Clone(SfxItemPool *) const
90
3.03M
{
91
3.03M
    return new SfxInt16Item(*this);
92
3.03M
}
93
94
SfxPoolItem* SfxUInt16Item::CreateDefault()
95
0
{
96
0
    return new SfxUInt16Item();
97
0
};
98
99
void SfxUInt16Item::dumpAsXml(xmlTextWriterPtr pWriter) const
100
0
{
101
0
    tools::XmlWriter aWriter(pWriter);
102
0
    aWriter.startElement("SfxUInt16Item");
103
0
    aWriter.attribute("whichId", Which());
104
0
    aWriter.attribute("value", GetValue());
105
0
    aWriter.endElement();
106
0
}
107
108
boost::property_tree::ptree SfxUInt16Item::dumpAsJSON() const
109
0
{
110
0
    boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
111
0
    aTree.put("state", GetValue());
112
0
    return aTree;
113
0
}
114
115
116
117
118
SfxPoolItem* SfxInt32Item::CreateDefault()
119
0
{
120
0
    return new SfxInt32Item();
121
0
};
122
123
void SfxInt32Item::dumpAsXml(xmlTextWriterPtr pWriter) const
124
0
{
125
0
    tools::XmlWriter aWriter(pWriter);
126
0
    aWriter.startElement("SfxInt32Item");
127
0
    aWriter.attribute("whichId", Which());
128
0
    aWriter.attribute("value", GetValue());
129
0
    aWriter.endElement();
130
0
}
131
132
boost::property_tree::ptree SfxInt32Item::dumpAsJSON() const
133
0
{
134
0
    boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
135
0
    aTree.put("state", GetValue());
136
0
    return aTree;
137
0
}
138
139
140
141
142
SfxPoolItem* SfxUInt32Item::CreateDefault()
143
0
{
144
0
    return new SfxUInt32Item();
145
0
};
146
147
void SfxUInt32Item::dumpAsXml(xmlTextWriterPtr pWriter) const
148
0
{
149
0
    tools::XmlWriter aWriter(pWriter);
150
0
    aWriter.startElement("SfxUInt32Item");
151
0
    aWriter.attribute("whichId", Which());
152
0
    aWriter.attribute("value", GetValue());
153
0
    aWriter.endElement();
154
0
}
155
156
boost::property_tree::ptree SfxUInt32Item::dumpAsJSON() const
157
0
{
158
0
    boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
159
0
    aTree.put("state", GetValue());
160
0
    return aTree;
161
0
}
162
163
SfxMetricItem::SfxMetricItem(sal_uInt16 which, sal_Int32 nValue):
164
349k
    SfxInt32Item(which, nValue)
165
349k
{
166
349k
}
167
168
// virtual
169
void SfxMetricItem::ScaleMetrics(double fScale)
170
0
{
171
0
    BigInt aTheValue(GetValue());
172
0
    aTheValue *= fScale;
173
0
    SetValue(aTheValue);
174
0
}
175
176
// virtual
177
bool SfxMetricItem::HasMetrics() const
178
0
{
179
0
    return true;
180
0
}
181
182
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */