1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
23 using ::com::sun::star::uno::Reference
;
24 using ::com::sun::star::uno::Any
;
25 using namespace ::com::sun::star
;
32 WrappedAddInProperty::WrappedAddInProperty( ChartDocumentWrapper
& rChartDocumentWrapper
)
33 : ::chart::WrappedProperty( "AddIn", OUString() )
34 , m_rChartDocumentWrapper( rChartDocumentWrapper
)
37 WrappedAddInProperty::~WrappedAddInProperty()
41 void WrappedAddInProperty::setPropertyValue( const Any
& rOuterValue
, const Reference
< beans::XPropertySet
>& /*xInnerPropertySet*/ ) const
42 throw (beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
44 Reference
< util::XRefreshable
> xAddIn
;
45 if( ! (rOuterValue
>>= xAddIn
) )
46 throw lang::IllegalArgumentException( "AddIn properties require type XRefreshable", 0, 0 );
48 m_rChartDocumentWrapper
.setAddIn( xAddIn
);
51 Any
WrappedAddInProperty::getPropertyValue( const Reference
< beans::XPropertySet
>& /*xInnerPropertySet*/ ) const
52 throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
54 return uno::makeAny( m_rChartDocumentWrapper
.getAddIn() );
57 WrappedBaseDiagramProperty::WrappedBaseDiagramProperty( ChartDocumentWrapper
& rChartDocumentWrapper
)
58 : ::chart::WrappedProperty( "BaseDiagram" , OUString() )
59 , m_rChartDocumentWrapper( rChartDocumentWrapper
)
62 WrappedBaseDiagramProperty::~WrappedBaseDiagramProperty()
66 void WrappedBaseDiagramProperty::setPropertyValue( const Any
& rOuterValue
, const Reference
< beans::XPropertySet
>& /*xInnerPropertySet*/ ) const
67 throw (beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
69 OUString aBaseDiagram
;
70 if( ! (rOuterValue
>>= aBaseDiagram
) )
71 throw lang::IllegalArgumentException( "BaseDiagram properties require type OUString", 0, 0 );
73 m_rChartDocumentWrapper
.setBaseDiagram( aBaseDiagram
);
76 Any
WrappedBaseDiagramProperty::getPropertyValue( const Reference
< beans::XPropertySet
>& /*xInnerPropertySet*/ ) const
77 throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
79 return uno::makeAny( m_rChartDocumentWrapper
.getBaseDiagram() );
82 WrappedAdditionalShapesProperty::WrappedAdditionalShapesProperty( ChartDocumentWrapper
& rChartDocumentWrapper
)
83 : ::chart::WrappedProperty( "AdditionalShapes" , OUString() )
84 , m_rChartDocumentWrapper( rChartDocumentWrapper
)
87 WrappedAdditionalShapesProperty::~WrappedAdditionalShapesProperty()
91 void WrappedAdditionalShapesProperty::setPropertyValue( const Any
& /*rOuterValue*/, const Reference
< beans::XPropertySet
>& /*xInnerPropertySet*/ ) const
92 throw (beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
94 throw lang::IllegalArgumentException( "AdditionalShapes is a read only property", 0, 0 );
97 Any
WrappedAdditionalShapesProperty::getPropertyValue( const Reference
< beans::XPropertySet
>& /*xInnerPropertySet*/ ) const
98 throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
100 return uno::makeAny( m_rChartDocumentWrapper
.getAdditionalShapes() );
103 WrappedRefreshAddInAllowedProperty::WrappedRefreshAddInAllowedProperty( ChartDocumentWrapper
& rChartDocumentWrapper
)
104 : ::chart::WrappedProperty( "RefreshAddInAllowed" , OUString() )
105 , m_rChartDocumentWrapper( rChartDocumentWrapper
)
108 WrappedRefreshAddInAllowedProperty::~WrappedRefreshAddInAllowedProperty()
112 void WrappedRefreshAddInAllowedProperty::setPropertyValue( const Any
& rOuterValue
, const Reference
< beans::XPropertySet
>& /* xInnerPropertySet */ ) const
113 throw (beans::UnknownPropertyException
, beans::PropertyVetoException
, lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
115 bool bUpdateAddIn
= true;
116 if( ! (rOuterValue
>>= bUpdateAddIn
) )
117 throw lang::IllegalArgumentException( "The property RefreshAddInAllowed requires type boolean", 0, 0 );
119 m_rChartDocumentWrapper
.setUpdateAddIn( bUpdateAddIn
);
122 Any
WrappedRefreshAddInAllowedProperty::getPropertyValue( const Reference
< beans::XPropertySet
>& /* xInnerPropertySet */ ) const
123 throw (beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
125 return uno::makeAny( m_rChartDocumentWrapper
.getUpdateAddIn() );
128 } //namespace wrapper
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */