Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / chart2 / source / controller / chartapiwrapper / WrappedAddInProperty.cxx
blob7a554a24574549b92d11b7642175edd5ace7bdcf
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "WrappedAddInProperty.hxx"
21 #include <ChartDocumentWrapper.hxx>
22 #include <com/sun/star/util/XRefreshable.hpp>
24 using ::com::sun::star::uno::Reference;
25 using ::com::sun::star::uno::Any;
26 using namespace ::com::sun::star;
28 namespace chart
30 namespace wrapper
33 WrappedAddInProperty::WrappedAddInProperty( ChartDocumentWrapper& rChartDocumentWrapper )
34 : ::chart::WrappedProperty( "AddIn", OUString() )
35 , m_rChartDocumentWrapper( rChartDocumentWrapper )
38 WrappedAddInProperty::~WrappedAddInProperty()
42 void WrappedAddInProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
44 Reference< util::XRefreshable > xAddIn;
45 if( ! (rOuterValue >>= xAddIn) )
46 throw lang::IllegalArgumentException( "AddIn properties require type XRefreshable", nullptr, 0 );
48 m_rChartDocumentWrapper.setAddIn( xAddIn );
51 Any WrappedAddInProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
53 return uno::Any( m_rChartDocumentWrapper.getAddIn() );
56 WrappedBaseDiagramProperty::WrappedBaseDiagramProperty( ChartDocumentWrapper& rChartDocumentWrapper )
57 : ::chart::WrappedProperty( "BaseDiagram" , OUString() )
58 , m_rChartDocumentWrapper( rChartDocumentWrapper )
61 WrappedBaseDiagramProperty::~WrappedBaseDiagramProperty()
65 void WrappedBaseDiagramProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
67 OUString aBaseDiagram;
68 if( ! (rOuterValue >>= aBaseDiagram) )
69 throw lang::IllegalArgumentException( "BaseDiagram properties require type OUString", nullptr, 0 );
71 m_rChartDocumentWrapper.setBaseDiagram( aBaseDiagram );
74 Any WrappedBaseDiagramProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
76 return uno::Any( m_rChartDocumentWrapper.getBaseDiagram() );
79 WrappedAdditionalShapesProperty::WrappedAdditionalShapesProperty( ChartDocumentWrapper& rChartDocumentWrapper )
80 : ::chart::WrappedProperty( "AdditionalShapes" , OUString() )
81 , m_rChartDocumentWrapper( rChartDocumentWrapper )
84 WrappedAdditionalShapesProperty::~WrappedAdditionalShapesProperty()
88 void WrappedAdditionalShapesProperty::setPropertyValue( const Any& /*rOuterValue*/, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
90 throw lang::IllegalArgumentException( "AdditionalShapes is a read only property", nullptr, 0 );
93 Any WrappedAdditionalShapesProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
95 return uno::Any( m_rChartDocumentWrapper.getAdditionalShapes() );
98 WrappedRefreshAddInAllowedProperty::WrappedRefreshAddInAllowedProperty( ChartDocumentWrapper& rChartDocumentWrapper )
99 : ::chart::WrappedProperty( "RefreshAddInAllowed" , OUString() )
100 , m_rChartDocumentWrapper( rChartDocumentWrapper )
103 WrappedRefreshAddInAllowedProperty::~WrappedRefreshAddInAllowedProperty()
107 void WrappedRefreshAddInAllowedProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
109 bool bUpdateAddIn = true;
110 if( ! (rOuterValue >>= bUpdateAddIn) )
111 throw lang::IllegalArgumentException( "The property RefreshAddInAllowed requires type boolean", nullptr, 0 );
113 m_rChartDocumentWrapper.setUpdateAddIn( bUpdateAddIn );
116 Any WrappedRefreshAddInAllowedProperty::getPropertyValue( const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
118 return uno::Any( m_rChartDocumentWrapper.getUpdateAddIn() );
121 } //namespace wrapper
123 } //namespace chart
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */