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