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_chartcontroller.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 { 53 Reference< util::XRefreshable > xAddIn; 54 if( ! (rOuterValue >>= xAddIn) ) 55 throw lang::IllegalArgumentException( C2U("AddIn properties require type XRefreshable"), 0, 0 ); 56 57 m_rChartDocumentWrapper.setAddIn( xAddIn ); 58 } 59 60 Any WrappedAddInProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 61 { 62 return uno::makeAny( m_rChartDocumentWrapper.getAddIn() ); 63 } 64 65 //............................................................................. 66 //............................................................................. 67 //............................................................................. 68 69 WrappedBaseDiagramProperty::WrappedBaseDiagramProperty( ChartDocumentWrapper& rChartDocumentWrapper ) 70 : ::chart::WrappedProperty( C2U( "BaseDiagram" ), OUString() ) 71 , m_rChartDocumentWrapper( rChartDocumentWrapper ) 72 { 73 } 74 WrappedBaseDiagramProperty::~WrappedBaseDiagramProperty() 75 { 76 } 77 78 void WrappedBaseDiagramProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 79 { 80 rtl::OUString aBaseDiagram; 81 if( ! (rOuterValue >>= aBaseDiagram) ) 82 throw lang::IllegalArgumentException( C2U("BaseDiagram properties require type OUString"), 0, 0 ); 83 84 m_rChartDocumentWrapper.setBaseDiagram( aBaseDiagram ); 85 } 86 87 Any WrappedBaseDiagramProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 88 { 89 return uno::makeAny( m_rChartDocumentWrapper.getBaseDiagram() ); 90 } 91 92 //............................................................................. 93 //............................................................................. 94 //............................................................................. 95 96 WrappedAdditionalShapesProperty::WrappedAdditionalShapesProperty( ChartDocumentWrapper& rChartDocumentWrapper ) 97 : ::chart::WrappedProperty( C2U( "AdditionalShapes" ), OUString() ) 98 , m_rChartDocumentWrapper( rChartDocumentWrapper ) 99 { 100 } 101 WrappedAdditionalShapesProperty::~WrappedAdditionalShapesProperty() 102 { 103 } 104 105 void WrappedAdditionalShapesProperty::setPropertyValue( const Any& /*rOuterValue*/, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 106 { 107 throw lang::IllegalArgumentException( C2U("AdditionalShapes is a read only property"), 0, 0 ); 108 } 109 110 Any WrappedAdditionalShapesProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const 111 { 112 return uno::makeAny( m_rChartDocumentWrapper.getAdditionalShapes() ); 113 } 114 115 //............................................................................. 116 //............................................................................. 117 //............................................................................. 118 119 WrappedRefreshAddInAllowedProperty::WrappedRefreshAddInAllowedProperty( ChartDocumentWrapper& rChartDocumentWrapper ) 120 : ::chart::WrappedProperty( C2U( "RefreshAddInAllowed" ), OUString() ) 121 , m_rChartDocumentWrapper( rChartDocumentWrapper ) 122 { 123 } 124 WrappedRefreshAddInAllowedProperty::~WrappedRefreshAddInAllowedProperty() 125 { 126 } 127 128 void WrappedRefreshAddInAllowedProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const 129 { 130 sal_Bool bUpdateAddIn = sal_True; 131 if( ! (rOuterValue >>= bUpdateAddIn) ) 132 throw lang::IllegalArgumentException( C2U("The property RefreshAddInAllowed requires type boolean"), 0, 0 ); 133 134 m_rChartDocumentWrapper.setUpdateAddIn( bUpdateAddIn ); 135 } 136 137 Any WrappedRefreshAddInAllowedProperty::getPropertyValue( const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const 138 { 139 return uno::makeAny( m_rChartDocumentWrapper.getUpdateAddIn() ); 140 } 141 142 } 143 144 //............................................................................. 145 } //namespace chart 146 //............................................................................. 147