Update ooo320-m1
[ooovba.git] / chart2 / source / controller / chartapiwrapper / WrappedAddInProperty.cxx
blob78d2e0f7b5660e24d17044d1b91aac77c219a409
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: WrappedAddInProperty.cxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
34 #include "WrappedAddInProperty.hxx"
35 #include "macros.hxx"
37 using ::com::sun::star::uno::Reference;
38 using ::com::sun::star::uno::Any;
39 using ::rtl::OUString;
40 using namespace ::com::sun::star;
42 //.............................................................................
43 namespace chart
45 //.............................................................................
46 namespace wrapper
49 WrappedAddInProperty::WrappedAddInProperty( ChartDocumentWrapper& rChartDocumentWrapper )
50 : ::chart::WrappedProperty( C2U( "AddIn" ), OUString() )
51 , m_rChartDocumentWrapper( rChartDocumentWrapper )
54 WrappedAddInProperty::~WrappedAddInProperty()
58 void WrappedAddInProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
59 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
61 Reference< util::XRefreshable > xAddIn;
62 if( ! (rOuterValue >>= xAddIn) )
63 throw lang::IllegalArgumentException( C2U("AddIn properties require type XRefreshable"), 0, 0 );
65 m_rChartDocumentWrapper.setAddIn( xAddIn );
68 Any WrappedAddInProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
69 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
71 return uno::makeAny( m_rChartDocumentWrapper.getAddIn() );
74 //.............................................................................
75 //.............................................................................
76 //.............................................................................
78 WrappedBaseDiagramProperty::WrappedBaseDiagramProperty( ChartDocumentWrapper& rChartDocumentWrapper )
79 : ::chart::WrappedProperty( C2U( "BaseDiagram" ), OUString() )
80 , m_rChartDocumentWrapper( rChartDocumentWrapper )
83 WrappedBaseDiagramProperty::~WrappedBaseDiagramProperty()
87 void WrappedBaseDiagramProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
88 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
90 rtl::OUString aBaseDiagram;
91 if( ! (rOuterValue >>= aBaseDiagram) )
92 throw lang::IllegalArgumentException( C2U("BaseDiagram properties require type OUString"), 0, 0 );
94 m_rChartDocumentWrapper.setBaseDiagram( aBaseDiagram );
97 Any WrappedBaseDiagramProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
98 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
100 return uno::makeAny( m_rChartDocumentWrapper.getBaseDiagram() );
103 //.............................................................................
104 //.............................................................................
105 //.............................................................................
107 WrappedAdditionalShapesProperty::WrappedAdditionalShapesProperty( ChartDocumentWrapper& rChartDocumentWrapper )
108 : ::chart::WrappedProperty( C2U( "AdditionalShapes" ), OUString() )
109 , m_rChartDocumentWrapper( rChartDocumentWrapper )
112 WrappedAdditionalShapesProperty::~WrappedAdditionalShapesProperty()
116 void WrappedAdditionalShapesProperty::setPropertyValue( const Any& /*rOuterValue*/, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
117 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
119 throw lang::IllegalArgumentException( C2U("AdditionalShapes is a read only property"), 0, 0 );
122 Any WrappedAdditionalShapesProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
123 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
125 return uno::makeAny( m_rChartDocumentWrapper.getAdditionalShapes() );
128 //.............................................................................
129 //.............................................................................
130 //.............................................................................
132 WrappedRefreshAddInAllowedProperty::WrappedRefreshAddInAllowedProperty( ChartDocumentWrapper& rChartDocumentWrapper )
133 : ::chart::WrappedProperty( C2U( "RefreshAddInAllowed" ), OUString() )
134 , m_rChartDocumentWrapper( rChartDocumentWrapper )
137 WrappedRefreshAddInAllowedProperty::~WrappedRefreshAddInAllowedProperty()
141 void WrappedRefreshAddInAllowedProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
142 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
144 sal_Bool bUpdateAddIn = sal_True;
145 if( ! (rOuterValue >>= bUpdateAddIn) )
146 throw lang::IllegalArgumentException( C2U("The property RefreshAddInAllowed requires type boolean"), 0, 0 );
148 m_rChartDocumentWrapper.setUpdateAddIn( bUpdateAddIn );
151 Any WrappedRefreshAddInAllowedProperty::getPropertyValue( const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
152 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
154 return uno::makeAny( m_rChartDocumentWrapper.getUpdateAddIn() );
159 //.............................................................................
160 } //namespace chart
161 //.............................................................................