Coverage Report

Created: 2025-11-16 09:57

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/svx/source/items/e3ditem.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/drawing/Direction3D.hpp>
21
#include <libxml/xmlwriter.h>
22
#include <o3tl/hash_combine.hxx>
23
#include <svx/e3ditem.hxx>
24
25
using namespace ::com::sun::star;
26
27
28
SvxB3DVectorItem::~SvxB3DVectorItem()
29
33.3k
{
30
33.3k
}
31
32
33
SvxB3DVectorItem::SvxB3DVectorItem( TypedWhichId<SvxB3DVectorItem> _nWhich, const basegfx::B3DVector& rVal ) :
34
16.7k
    SfxPoolItem( _nWhich ),
35
16.7k
    m_aVal( rVal )
36
16.7k
{
37
16.7k
}
38
39
40
SvxB3DVectorItem::SvxB3DVectorItem( const SvxB3DVectorItem& rItem ) :
41
16.5k
    SfxPoolItem( rItem ),
42
16.5k
    m_aVal( rItem.m_aVal )
43
16.5k
{
44
16.5k
}
45
46
bool SvxB3DVectorItem::operator==( const SfxPoolItem &rItem ) const
47
0
{
48
0
    assert(SfxPoolItem::operator==(rItem));
49
0
    return static_cast<const SvxB3DVectorItem&>(rItem).m_aVal == m_aVal;
50
0
}
51
52
SvxB3DVectorItem* SvxB3DVectorItem::Clone( SfxItemPool* /*pPool*/ ) const
53
16.5k
{
54
16.5k
    return new SvxB3DVectorItem( *this );
55
16.5k
}
56
57
bool SvxB3DVectorItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
58
0
{
59
0
    assert(!std::isnan(m_aVal.getX()) && !std::isnan(m_aVal.getY()) && !std::isnan(m_aVal.getZ()));
60
61
0
    drawing::Direction3D aDirection;
62
63
    // enter values
64
0
    aDirection.DirectionX = m_aVal.getX();
65
0
    aDirection.DirectionY = m_aVal.getY();
66
0
    aDirection.DirectionZ = m_aVal.getZ();
67
68
0
    rVal <<= aDirection;
69
0
    return true;
70
0
}
71
72
73
bool SvxB3DVectorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
74
0
{
75
0
    ASSERT_CHANGE_REFCOUNTED_ITEM;
76
0
    drawing::Direction3D aDirection;
77
0
    if(!(rVal >>= aDirection))
78
0
        return false;
79
80
0
    m_aVal.setX(aDirection.DirectionX);
81
0
    m_aVal.setY(aDirection.DirectionY);
82
0
    m_aVal.setZ(aDirection.DirectionZ);
83
84
0
    assert(!std::isnan(m_aVal.getX()) && !std::isnan(m_aVal.getY()) && !std::isnan(m_aVal.getZ()));
85
86
0
    return true;
87
0
}
88
89
90
void SvxB3DVectorItem::dumpAsXml(xmlTextWriterPtr pWriter) const
91
0
{
92
0
    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxB3DVectorItem"));
93
0
    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
94
0
    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("x"), BAD_CAST(OString::number(m_aVal.getX()).getStr()));
95
0
    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("y"), BAD_CAST(OString::number(m_aVal.getY()).getStr()));
96
0
    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("z"), BAD_CAST(OString::number(m_aVal.getZ()).getStr()));
97
0
    (void)xmlTextWriterEndElement(pWriter);
98
0
}
99
100
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */