Debian Codegraph @

chart2/source/controller/chartapiwrapper/WrappedAddInProperty.cxx

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