Coverage Report

Created: 2026-04-09 11:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/chart2/source/controller/chartapiwrapper/WrappedAddInProperty.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 "WrappedAddInProperty.hxx"
21
#include <ChartDocumentWrapper.hxx>
22
#include <com/sun/star/util/XRefreshable.hpp>
23
24
using ::com::sun::star::uno::Reference;
25
using ::com::sun::star::uno::Any;
26
using namespace ::com::sun::star;
27
28
namespace chart::wrapper
29
{
30
31
WrappedAddInProperty::WrappedAddInProperty( ChartDocumentWrapper& rChartDocumentWrapper )
32
0
    : ::chart::WrappedProperty( u"AddIn"_ustr, OUString() )
33
0
    , m_rChartDocumentWrapper( rChartDocumentWrapper )
34
0
{
35
0
}
36
WrappedAddInProperty::~WrappedAddInProperty()
37
0
{
38
0
}
39
40
void WrappedAddInProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
41
0
{
42
0
    Reference< util::XRefreshable > xAddIn;
43
0
    if( ! (rOuterValue >>= xAddIn) )
44
0
        throw lang::IllegalArgumentException( u"AddIn properties require type XRefreshable"_ustr, nullptr, 0 );
45
46
0
    m_rChartDocumentWrapper.setAddIn( xAddIn );
47
0
}
48
49
Any WrappedAddInProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
50
0
{
51
0
    return uno::Any( m_rChartDocumentWrapper.getAddIn() );
52
0
}
53
54
WrappedBaseDiagramProperty::WrappedBaseDiagramProperty( ChartDocumentWrapper& rChartDocumentWrapper )
55
0
    : ::chart::WrappedProperty( u"BaseDiagram"_ustr , OUString() )
56
0
    , m_rChartDocumentWrapper( rChartDocumentWrapper )
57
0
{
58
0
}
59
WrappedBaseDiagramProperty::~WrappedBaseDiagramProperty()
60
0
{
61
0
}
62
63
void WrappedBaseDiagramProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
64
0
{
65
0
    OUString aBaseDiagram;
66
0
    if( ! (rOuterValue >>= aBaseDiagram) )
67
0
        throw lang::IllegalArgumentException( u"BaseDiagram properties require type OUString"_ustr, nullptr, 0 );
68
69
0
    m_rChartDocumentWrapper.setBaseDiagram( aBaseDiagram );
70
0
}
71
72
Any WrappedBaseDiagramProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
73
0
{
74
0
    return uno::Any( m_rChartDocumentWrapper.getBaseDiagram() );
75
0
}
76
77
WrappedAdditionalShapesProperty::WrappedAdditionalShapesProperty( ChartDocumentWrapper& rChartDocumentWrapper )
78
0
    : ::chart::WrappedProperty( u"AdditionalShapes"_ustr , OUString() )
79
0
    , m_rChartDocumentWrapper( rChartDocumentWrapper )
80
0
{
81
0
}
82
WrappedAdditionalShapesProperty::~WrappedAdditionalShapesProperty()
83
0
{
84
0
}
85
86
void WrappedAdditionalShapesProperty::setPropertyValue( const Any& /*rOuterValue*/, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
87
0
{
88
0
    throw lang::IllegalArgumentException( u"AdditionalShapes is a read only property"_ustr, nullptr, 0 );
89
0
}
90
91
Any WrappedAdditionalShapesProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
92
0
{
93
0
    return uno::Any( m_rChartDocumentWrapper.getAdditionalShapes() );
94
0
}
95
96
WrappedRefreshAddInAllowedProperty::WrappedRefreshAddInAllowedProperty( ChartDocumentWrapper& rChartDocumentWrapper )
97
0
    : ::chart::WrappedProperty( u"RefreshAddInAllowed"_ustr , OUString() )
98
0
    , m_rChartDocumentWrapper( rChartDocumentWrapper )
99
0
{
100
0
}
101
WrappedRefreshAddInAllowedProperty::~WrappedRefreshAddInAllowedProperty()
102
0
{
103
0
}
104
105
void WrappedRefreshAddInAllowedProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
106
0
{
107
0
    bool bUpdateAddIn = true;
108
0
    if( ! (rOuterValue >>= bUpdateAddIn) )
109
0
        throw lang::IllegalArgumentException( u"The property RefreshAddInAllowed requires type boolean"_ustr, nullptr, 0 );
110
111
0
    m_rChartDocumentWrapper.setUpdateAddIn( bUpdateAddIn );
112
0
}
113
114
Any WrappedRefreshAddInAllowedProperty::getPropertyValue( const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
115
0
{
116
0
    return uno::Any( m_rChartDocumentWrapper.getUpdateAddIn() );
117
0
}
118
119
} //namespace chart::wrapper
120
121
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */