xref: /AOO41X/main/chart2/source/controller/chartapiwrapper/WrappedAddInProperty.cxx (revision cde9e8dc2218e857da4894ecba5c903312256674)
1*cde9e8dcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*cde9e8dcSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*cde9e8dcSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*cde9e8dcSAndrew Rist  * distributed with this work for additional information
6*cde9e8dcSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*cde9e8dcSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*cde9e8dcSAndrew Rist  * "License"); you may not use this file except in compliance
9*cde9e8dcSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*cde9e8dcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*cde9e8dcSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*cde9e8dcSAndrew Rist  * software distributed under the License is distributed on an
15*cde9e8dcSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*cde9e8dcSAndrew Rist  * KIND, either express or implied.  See the License for the
17*cde9e8dcSAndrew Rist  * specific language governing permissions and limitations
18*cde9e8dcSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*cde9e8dcSAndrew Rist  *************************************************************/
21*cde9e8dcSAndrew Rist 
22*cde9e8dcSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_chart2.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "WrappedAddInProperty.hxx"
28cdf0e10cSrcweir #include "macros.hxx"
29cdf0e10cSrcweir 
30cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
31cdf0e10cSrcweir using ::com::sun::star::uno::Any;
32cdf0e10cSrcweir using ::rtl::OUString;
33cdf0e10cSrcweir using namespace ::com::sun::star;
34cdf0e10cSrcweir 
35cdf0e10cSrcweir //.............................................................................
36cdf0e10cSrcweir namespace chart
37cdf0e10cSrcweir {
38cdf0e10cSrcweir //.............................................................................
39cdf0e10cSrcweir namespace wrapper
40cdf0e10cSrcweir {
41cdf0e10cSrcweir 
WrappedAddInProperty(ChartDocumentWrapper & rChartDocumentWrapper)42cdf0e10cSrcweir WrappedAddInProperty::WrappedAddInProperty( ChartDocumentWrapper& rChartDocumentWrapper )
43cdf0e10cSrcweir     : ::chart::WrappedProperty( C2U( "AddIn" ), OUString() )
44cdf0e10cSrcweir     , m_rChartDocumentWrapper( rChartDocumentWrapper )
45cdf0e10cSrcweir {
46cdf0e10cSrcweir }
~WrappedAddInProperty()47cdf0e10cSrcweir WrappedAddInProperty::~WrappedAddInProperty()
48cdf0e10cSrcweir {
49cdf0e10cSrcweir }
50cdf0e10cSrcweir 
setPropertyValue(const Any & rOuterValue,const Reference<beans::XPropertySet> &) const51cdf0e10cSrcweir void WrappedAddInProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
52cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
53cdf0e10cSrcweir {
54cdf0e10cSrcweir     Reference< util::XRefreshable > xAddIn;
55cdf0e10cSrcweir     if( ! (rOuterValue >>= xAddIn) )
56cdf0e10cSrcweir         throw lang::IllegalArgumentException( C2U("AddIn properties require type XRefreshable"), 0, 0 );
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     m_rChartDocumentWrapper.setAddIn( xAddIn );
59cdf0e10cSrcweir }
60cdf0e10cSrcweir 
getPropertyValue(const Reference<beans::XPropertySet> &) const61cdf0e10cSrcweir Any WrappedAddInProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
62cdf0e10cSrcweir                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
63cdf0e10cSrcweir {
64cdf0e10cSrcweir     return uno::makeAny( m_rChartDocumentWrapper.getAddIn() );
65cdf0e10cSrcweir }
66cdf0e10cSrcweir 
67cdf0e10cSrcweir //.............................................................................
68cdf0e10cSrcweir //.............................................................................
69cdf0e10cSrcweir //.............................................................................
70cdf0e10cSrcweir 
WrappedBaseDiagramProperty(ChartDocumentWrapper & rChartDocumentWrapper)71cdf0e10cSrcweir WrappedBaseDiagramProperty::WrappedBaseDiagramProperty( ChartDocumentWrapper& rChartDocumentWrapper )
72cdf0e10cSrcweir     : ::chart::WrappedProperty( C2U( "BaseDiagram" ), OUString() )
73cdf0e10cSrcweir     , m_rChartDocumentWrapper( rChartDocumentWrapper )
74cdf0e10cSrcweir {
75cdf0e10cSrcweir }
~WrappedBaseDiagramProperty()76cdf0e10cSrcweir WrappedBaseDiagramProperty::~WrappedBaseDiagramProperty()
77cdf0e10cSrcweir {
78cdf0e10cSrcweir }
79cdf0e10cSrcweir 
setPropertyValue(const Any & rOuterValue,const Reference<beans::XPropertySet> &) const80cdf0e10cSrcweir void WrappedBaseDiagramProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
81cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
82cdf0e10cSrcweir {
83cdf0e10cSrcweir     rtl::OUString aBaseDiagram;
84cdf0e10cSrcweir     if( ! (rOuterValue >>= aBaseDiagram) )
85cdf0e10cSrcweir         throw lang::IllegalArgumentException( C2U("BaseDiagram properties require type OUString"), 0, 0 );
86cdf0e10cSrcweir 
87cdf0e10cSrcweir     m_rChartDocumentWrapper.setBaseDiagram( aBaseDiagram );
88cdf0e10cSrcweir }
89cdf0e10cSrcweir 
getPropertyValue(const Reference<beans::XPropertySet> &) const90cdf0e10cSrcweir Any WrappedBaseDiagramProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
91cdf0e10cSrcweir                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
92cdf0e10cSrcweir {
93cdf0e10cSrcweir     return uno::makeAny( m_rChartDocumentWrapper.getBaseDiagram() );
94cdf0e10cSrcweir }
95cdf0e10cSrcweir 
96cdf0e10cSrcweir //.............................................................................
97cdf0e10cSrcweir //.............................................................................
98cdf0e10cSrcweir //.............................................................................
99cdf0e10cSrcweir 
WrappedAdditionalShapesProperty(ChartDocumentWrapper & rChartDocumentWrapper)100cdf0e10cSrcweir WrappedAdditionalShapesProperty::WrappedAdditionalShapesProperty( ChartDocumentWrapper& rChartDocumentWrapper )
101cdf0e10cSrcweir     : ::chart::WrappedProperty( C2U( "AdditionalShapes" ), OUString() )
102cdf0e10cSrcweir     , m_rChartDocumentWrapper( rChartDocumentWrapper )
103cdf0e10cSrcweir {
104cdf0e10cSrcweir }
~WrappedAdditionalShapesProperty()105cdf0e10cSrcweir WrappedAdditionalShapesProperty::~WrappedAdditionalShapesProperty()
106cdf0e10cSrcweir {
107cdf0e10cSrcweir }
108cdf0e10cSrcweir 
setPropertyValue(const Any &,const Reference<beans::XPropertySet> &) const109cdf0e10cSrcweir void WrappedAdditionalShapesProperty::setPropertyValue( const Any& /*rOuterValue*/, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
110cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
111cdf0e10cSrcweir {
112cdf0e10cSrcweir     throw lang::IllegalArgumentException( C2U("AdditionalShapes is a read only property"), 0, 0 );
113cdf0e10cSrcweir }
114cdf0e10cSrcweir 
getPropertyValue(const Reference<beans::XPropertySet> &) const115cdf0e10cSrcweir Any WrappedAdditionalShapesProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
116cdf0e10cSrcweir                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
117cdf0e10cSrcweir {
118cdf0e10cSrcweir     return uno::makeAny( m_rChartDocumentWrapper.getAdditionalShapes() );
119cdf0e10cSrcweir }
120cdf0e10cSrcweir 
121cdf0e10cSrcweir //.............................................................................
122cdf0e10cSrcweir //.............................................................................
123cdf0e10cSrcweir //.............................................................................
124cdf0e10cSrcweir 
WrappedRefreshAddInAllowedProperty(ChartDocumentWrapper & rChartDocumentWrapper)125cdf0e10cSrcweir WrappedRefreshAddInAllowedProperty::WrappedRefreshAddInAllowedProperty( ChartDocumentWrapper& rChartDocumentWrapper )
126cdf0e10cSrcweir     : ::chart::WrappedProperty( C2U( "RefreshAddInAllowed" ), OUString() )
127cdf0e10cSrcweir     , m_rChartDocumentWrapper( rChartDocumentWrapper )
128cdf0e10cSrcweir {
129cdf0e10cSrcweir }
~WrappedRefreshAddInAllowedProperty()130cdf0e10cSrcweir WrappedRefreshAddInAllowedProperty::~WrappedRefreshAddInAllowedProperty()
131cdf0e10cSrcweir {
132cdf0e10cSrcweir }
133cdf0e10cSrcweir 
setPropertyValue(const Any & rOuterValue,const Reference<beans::XPropertySet> &) const134cdf0e10cSrcweir void WrappedRefreshAddInAllowedProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
135cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
136cdf0e10cSrcweir {
137cdf0e10cSrcweir     sal_Bool bUpdateAddIn = sal_True;
138cdf0e10cSrcweir     if( ! (rOuterValue >>= bUpdateAddIn) )
139cdf0e10cSrcweir         throw lang::IllegalArgumentException( C2U("The property RefreshAddInAllowed requires type boolean"), 0, 0 );
140cdf0e10cSrcweir 
141cdf0e10cSrcweir     m_rChartDocumentWrapper.setUpdateAddIn( bUpdateAddIn );
142cdf0e10cSrcweir }
143cdf0e10cSrcweir 
getPropertyValue(const Reference<beans::XPropertySet> &) const144cdf0e10cSrcweir Any WrappedRefreshAddInAllowedProperty::getPropertyValue( const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
145cdf0e10cSrcweir                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
146cdf0e10cSrcweir {
147cdf0e10cSrcweir     return uno::makeAny( m_rChartDocumentWrapper.getUpdateAddIn() );
148cdf0e10cSrcweir }
149cdf0e10cSrcweir 
150cdf0e10cSrcweir }
151cdf0e10cSrcweir 
152cdf0e10cSrcweir //.............................................................................
153cdf0e10cSrcweir } //namespace chart
154cdf0e10cSrcweir //.............................................................................
155