1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_chart2.hxx"
30 
31 #include "WrappedAddInProperty.hxx"
32 #include "macros.hxx"
33 
34 using ::com::sun::star::uno::Reference;
35 using ::com::sun::star::uno::Any;
36 using ::rtl::OUString;
37 using namespace ::com::sun::star;
38 
39 //.............................................................................
40 namespace chart
41 {
42 //.............................................................................
43 namespace wrapper
44 {
45 
46 WrappedAddInProperty::WrappedAddInProperty( ChartDocumentWrapper& rChartDocumentWrapper )
47     : ::chart::WrappedProperty( C2U( "AddIn" ), OUString() )
48     , m_rChartDocumentWrapper( rChartDocumentWrapper )
49 {
50 }
51 WrappedAddInProperty::~WrappedAddInProperty()
52 {
53 }
54 
55 void WrappedAddInProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
56                         throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
57 {
58     Reference< util::XRefreshable > xAddIn;
59     if( ! (rOuterValue >>= xAddIn) )
60         throw lang::IllegalArgumentException( C2U("AddIn properties require type XRefreshable"), 0, 0 );
61 
62     m_rChartDocumentWrapper.setAddIn( xAddIn );
63 }
64 
65 Any WrappedAddInProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
66                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
67 {
68     return uno::makeAny( m_rChartDocumentWrapper.getAddIn() );
69 }
70 
71 //.............................................................................
72 //.............................................................................
73 //.............................................................................
74 
75 WrappedBaseDiagramProperty::WrappedBaseDiagramProperty( ChartDocumentWrapper& rChartDocumentWrapper )
76     : ::chart::WrappedProperty( C2U( "BaseDiagram" ), OUString() )
77     , m_rChartDocumentWrapper( rChartDocumentWrapper )
78 {
79 }
80 WrappedBaseDiagramProperty::~WrappedBaseDiagramProperty()
81 {
82 }
83 
84 void WrappedBaseDiagramProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
85                         throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
86 {
87     rtl::OUString aBaseDiagram;
88     if( ! (rOuterValue >>= aBaseDiagram) )
89         throw lang::IllegalArgumentException( C2U("BaseDiagram properties require type OUString"), 0, 0 );
90 
91     m_rChartDocumentWrapper.setBaseDiagram( aBaseDiagram );
92 }
93 
94 Any WrappedBaseDiagramProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
95                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
96 {
97     return uno::makeAny( m_rChartDocumentWrapper.getBaseDiagram() );
98 }
99 
100 //.............................................................................
101 //.............................................................................
102 //.............................................................................
103 
104 WrappedAdditionalShapesProperty::WrappedAdditionalShapesProperty( ChartDocumentWrapper& rChartDocumentWrapper )
105     : ::chart::WrappedProperty( C2U( "AdditionalShapes" ), OUString() )
106     , m_rChartDocumentWrapper( rChartDocumentWrapper )
107 {
108 }
109 WrappedAdditionalShapesProperty::~WrappedAdditionalShapesProperty()
110 {
111 }
112 
113 void WrappedAdditionalShapesProperty::setPropertyValue( const Any& /*rOuterValue*/, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
114                         throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
115 {
116     throw lang::IllegalArgumentException( C2U("AdditionalShapes is a read only property"), 0, 0 );
117 }
118 
119 Any WrappedAdditionalShapesProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
120                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
121 {
122     return uno::makeAny( m_rChartDocumentWrapper.getAdditionalShapes() );
123 }
124 
125 //.............................................................................
126 //.............................................................................
127 //.............................................................................
128 
129 WrappedRefreshAddInAllowedProperty::WrappedRefreshAddInAllowedProperty( ChartDocumentWrapper& rChartDocumentWrapper )
130     : ::chart::WrappedProperty( C2U( "RefreshAddInAllowed" ), OUString() )
131     , m_rChartDocumentWrapper( rChartDocumentWrapper )
132 {
133 }
134 WrappedRefreshAddInAllowedProperty::~WrappedRefreshAddInAllowedProperty()
135 {
136 }
137 
138 void WrappedRefreshAddInAllowedProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
139                         throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
140 {
141     sal_Bool bUpdateAddIn = sal_True;
142     if( ! (rOuterValue >>= bUpdateAddIn) )
143         throw lang::IllegalArgumentException( C2U("The property RefreshAddInAllowed requires type boolean"), 0, 0 );
144 
145     m_rChartDocumentWrapper.setUpdateAddIn( bUpdateAddIn );
146 }
147 
148 Any WrappedRefreshAddInAllowedProperty::getPropertyValue( const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
149                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
150 {
151     return uno::makeAny( m_rChartDocumentWrapper.getUpdateAddIn() );
152 }
153 
154 }
155 
156 //.............................................................................
157 } //namespace chart
158 //.............................................................................
159