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
10*cde9e8dcSAndrew Rist  *
11*cde9e8dcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*cde9e8dcSAndrew Rist  *
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.
19*cde9e8dcSAndrew Rist  *
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 "MinMaxLineWrapper.hxx"
28cdf0e10cSrcweir #include "macros.hxx"
29cdf0e10cSrcweir #include "Chart2ModelContact.hxx"
30cdf0e10cSrcweir #include "DiagramHelper.hxx"
31cdf0e10cSrcweir #include "servicenames_charttypes.hxx"
32cdf0e10cSrcweir #include "ContainerHelper.hxx"
33cdf0e10cSrcweir #include <com/sun/star/chart2/XChartType.hpp>
34cdf0e10cSrcweir #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
35cdf0e10cSrcweir #include <com/sun/star/drawing/LineJoint.hpp>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include "LineProperties.hxx"
38cdf0e10cSrcweir #include "UserDefinedProperties.hxx"
39cdf0e10cSrcweir 
40cdf0e10cSrcweir using namespace ::com::sun::star;
41cdf0e10cSrcweir using namespace ::com::sun::star::chart2;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir using ::com::sun::star::beans::Property;
44cdf0e10cSrcweir using ::osl::MutexGuard;
45cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
46cdf0e10cSrcweir using ::com::sun::star::uno::Sequence;
47cdf0e10cSrcweir using ::com::sun::star::uno::Any;
48cdf0e10cSrcweir using ::rtl::OUString;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir namespace
51cdf0e10cSrcweir {
52cdf0e10cSrcweir static const OUString lcl_aServiceName(
53cdf0e10cSrcweir     RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.ChartLine" ));
54cdf0e10cSrcweir 
55cdf0e10cSrcweir struct StaticMinMaxLineWrapperDefaults_Initializer
56cdf0e10cSrcweir {
operator ()__anonce4454840111::StaticMinMaxLineWrapperDefaults_Initializer57cdf0e10cSrcweir     ::chart::tPropertyValueMap* operator()()
58cdf0e10cSrcweir     {
59cdf0e10cSrcweir         static ::chart::tPropertyValueMap aStaticDefaults;
60cdf0e10cSrcweir         lcl_AddDefaultsToMap( aStaticDefaults );
61cdf0e10cSrcweir         return &aStaticDefaults;
62cdf0e10cSrcweir     }
63cdf0e10cSrcweir private:
lcl_AddDefaultsToMap__anonce4454840111::StaticMinMaxLineWrapperDefaults_Initializer64cdf0e10cSrcweir     void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
65cdf0e10cSrcweir     {
66cdf0e10cSrcweir         ::chart::LineProperties::AddDefaultsToMap( rOutMap );
67cdf0e10cSrcweir     }
68cdf0e10cSrcweir };
69cdf0e10cSrcweir 
70cdf0e10cSrcweir struct StaticMinMaxLineWrapperDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticMinMaxLineWrapperDefaults_Initializer >
71cdf0e10cSrcweir {
72cdf0e10cSrcweir };
73cdf0e10cSrcweir 
74cdf0e10cSrcweir struct StaticMinMaxLineWrapperPropertyArray_Initializer
75cdf0e10cSrcweir {
operator ()__anonce4454840111::StaticMinMaxLineWrapperPropertyArray_Initializer76cdf0e10cSrcweir     Sequence< Property >* operator()()
77cdf0e10cSrcweir     {
78cdf0e10cSrcweir         static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
79cdf0e10cSrcweir         return &aPropSeq;
80cdf0e10cSrcweir     }
81cdf0e10cSrcweir 
82cdf0e10cSrcweir private:
lcl_GetPropertySequence__anonce4454840111::StaticMinMaxLineWrapperPropertyArray_Initializer83cdf0e10cSrcweir     Sequence< Property > lcl_GetPropertySequence()
84cdf0e10cSrcweir     {
85cdf0e10cSrcweir         ::std::vector< ::com::sun::star::beans::Property > aProperties;
86cdf0e10cSrcweir 
87cdf0e10cSrcweir         ::chart::LineProperties::AddPropertiesToVector( aProperties );
88cdf0e10cSrcweir         //::chart::NamedLineProperties::AddPropertiesToVector( aProperties );
89cdf0e10cSrcweir         ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
90cdf0e10cSrcweir 
91cdf0e10cSrcweir         ::std::sort( aProperties.begin(), aProperties.end(),
92cdf0e10cSrcweir                      ::chart::PropertyNameLess() );
93cdf0e10cSrcweir 
94cdf0e10cSrcweir         return ::chart::ContainerHelper::ContainerToSequence( aProperties );
95cdf0e10cSrcweir     }
96cdf0e10cSrcweir };
97cdf0e10cSrcweir 
98cdf0e10cSrcweir struct StaticMinMaxLineWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticMinMaxLineWrapperPropertyArray_Initializer >
99cdf0e10cSrcweir {
100cdf0e10cSrcweir };
101cdf0e10cSrcweir 
102cdf0e10cSrcweir struct StaticMinMaxLineWrapperInfoHelper_Initializer
103cdf0e10cSrcweir {
operator ()__anonce4454840111::StaticMinMaxLineWrapperInfoHelper_Initializer104cdf0e10cSrcweir     ::cppu::OPropertyArrayHelper* operator()()
105cdf0e10cSrcweir     {
106cdf0e10cSrcweir         static ::cppu::OPropertyArrayHelper aPropHelper( *StaticMinMaxLineWrapperPropertyArray::get() );
107cdf0e10cSrcweir         return &aPropHelper;
108cdf0e10cSrcweir     }
109cdf0e10cSrcweir };
110cdf0e10cSrcweir 
111cdf0e10cSrcweir struct StaticMinMaxLineWrapperInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticMinMaxLineWrapperInfoHelper_Initializer >
112cdf0e10cSrcweir {
113cdf0e10cSrcweir };
114cdf0e10cSrcweir 
115cdf0e10cSrcweir struct StaticMinMaxLineWrapperInfo_Initializer
116cdf0e10cSrcweir {
operator ()__anonce4454840111::StaticMinMaxLineWrapperInfo_Initializer117cdf0e10cSrcweir     uno::Reference< beans::XPropertySetInfo >* operator()()
118cdf0e10cSrcweir     {
119cdf0e10cSrcweir         static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
120cdf0e10cSrcweir             ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticMinMaxLineWrapperInfoHelper::get() ) );
121cdf0e10cSrcweir         return &xPropertySetInfo;
122cdf0e10cSrcweir     }
123cdf0e10cSrcweir };
124cdf0e10cSrcweir 
125cdf0e10cSrcweir struct StaticMinMaxLineWrapperInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticMinMaxLineWrapperInfo_Initializer >
126cdf0e10cSrcweir {
127cdf0e10cSrcweir };
128cdf0e10cSrcweir 
129cdf0e10cSrcweir } // anonymous namespace
130cdf0e10cSrcweir 
131cdf0e10cSrcweir // --------------------------------------------------------------------------------
132cdf0e10cSrcweir 
133cdf0e10cSrcweir namespace chart
134cdf0e10cSrcweir {
135cdf0e10cSrcweir namespace wrapper
136cdf0e10cSrcweir {
137cdf0e10cSrcweir 
MinMaxLineWrapper(::boost::shared_ptr<Chart2ModelContact> spChart2ModelContact)138cdf0e10cSrcweir MinMaxLineWrapper::MinMaxLineWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
139cdf0e10cSrcweir         : m_spChart2ModelContact( spChart2ModelContact )
140cdf0e10cSrcweir         , m_aEventListenerContainer( m_aMutex )
141cdf0e10cSrcweir         , m_aWrappedLineJointProperty( C2U("LineJoint"), uno::makeAny( drawing::LineJoint_NONE ))
142cdf0e10cSrcweir {
143cdf0e10cSrcweir }
144cdf0e10cSrcweir 
~MinMaxLineWrapper()145cdf0e10cSrcweir MinMaxLineWrapper::~MinMaxLineWrapper()
146cdf0e10cSrcweir {
147cdf0e10cSrcweir }
148cdf0e10cSrcweir 
149cdf0e10cSrcweir // ____ XComponent ____
dispose()150cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::dispose()
151cdf0e10cSrcweir     throw (uno::RuntimeException)
152cdf0e10cSrcweir {
153cdf0e10cSrcweir     Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
154cdf0e10cSrcweir     m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
155cdf0e10cSrcweir }
156cdf0e10cSrcweir 
addEventListener(const Reference<lang::XEventListener> & xListener)157cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::addEventListener(
158cdf0e10cSrcweir     const Reference< lang::XEventListener >& xListener )
159cdf0e10cSrcweir     throw (uno::RuntimeException)
160cdf0e10cSrcweir {
161cdf0e10cSrcweir 	m_aEventListenerContainer.addInterface( xListener );
162cdf0e10cSrcweir }
163cdf0e10cSrcweir 
removeEventListener(const Reference<lang::XEventListener> & aListener)164cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::removeEventListener(
165cdf0e10cSrcweir     const Reference< lang::XEventListener >& aListener )
166cdf0e10cSrcweir     throw (uno::RuntimeException)
167cdf0e10cSrcweir {
168cdf0e10cSrcweir 	m_aEventListenerContainer.removeInterface( aListener );
169cdf0e10cSrcweir }
170cdf0e10cSrcweir 
getInfoHelper()171cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& MinMaxLineWrapper::getInfoHelper()
172cdf0e10cSrcweir {
173cdf0e10cSrcweir     return *StaticMinMaxLineWrapperInfoHelper::get();
174cdf0e10cSrcweir }
175cdf0e10cSrcweir 
176cdf0e10cSrcweir //XPropertySet
getPropertySetInfo()177cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > SAL_CALL MinMaxLineWrapper::getPropertySetInfo()
178cdf0e10cSrcweir                     throw (uno::RuntimeException)
179cdf0e10cSrcweir {
180cdf0e10cSrcweir     return *StaticMinMaxLineWrapperInfo::get();
181cdf0e10cSrcweir }
182cdf0e10cSrcweir 
setPropertyValue(const::rtl::OUString & rPropertyName,const uno::Any & rValue)183cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::setPropertyValue( const ::rtl::OUString& rPropertyName, const uno::Any& rValue )
184cdf0e10cSrcweir                     throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
185cdf0e10cSrcweir {
186cdf0e10cSrcweir     Reference< beans::XPropertySet > xPropSet(0);
187cdf0e10cSrcweir 
188cdf0e10cSrcweir     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
189cdf0e10cSrcweir     Sequence< Reference< chart2::XChartType > > aTypes(
190cdf0e10cSrcweir             ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
191cdf0e10cSrcweir     for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ )
192cdf0e10cSrcweir     {
193cdf0e10cSrcweir         Reference< chart2::XChartType > xType( aTypes[nN] );
194cdf0e10cSrcweir         if( xType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
195cdf0e10cSrcweir         {
196cdf0e10cSrcweir             Reference< chart2::XDataSeriesContainer > xSeriesContainer(xType,uno::UNO_QUERY);
197cdf0e10cSrcweir             if( xSeriesContainer.is() )
198cdf0e10cSrcweir             {
199cdf0e10cSrcweir                 Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xSeriesContainer->getDataSeries() );
200cdf0e10cSrcweir                 if(aSeriesSeq.getLength())
201cdf0e10cSrcweir                 {
202cdf0e10cSrcweir                     xPropSet = Reference< beans::XPropertySet >(aSeriesSeq[0],uno::UNO_QUERY);
203cdf0e10cSrcweir                     if(xPropSet.is())
204cdf0e10cSrcweir                     {
205cdf0e10cSrcweir                         if( rPropertyName.equals( C2U("LineColor")) )
206cdf0e10cSrcweir                             xPropSet->setPropertyValue( C2U("Color"), rValue );
207cdf0e10cSrcweir                         else if( rPropertyName.equals( C2U("LineTransparence")) )
208cdf0e10cSrcweir                             xPropSet->setPropertyValue( C2U("Transparency"), rValue );
209cdf0e10cSrcweir                         else if( rPropertyName.equals( m_aWrappedLineJointProperty.getOuterName() ) )
210cdf0e10cSrcweir                             m_aWrappedLineJointProperty.setPropertyValue( rValue, xPropSet );
211cdf0e10cSrcweir                         else
212cdf0e10cSrcweir                             xPropSet->setPropertyValue( rPropertyName, rValue );
213cdf0e10cSrcweir                         return;
214cdf0e10cSrcweir                     }
215cdf0e10cSrcweir                 }
216cdf0e10cSrcweir             }
217cdf0e10cSrcweir         }
218cdf0e10cSrcweir     }
219cdf0e10cSrcweir }
getPropertyValue(const::rtl::OUString & rPropertyName)220cdf0e10cSrcweir uno::Any SAL_CALL MinMaxLineWrapper::getPropertyValue( const ::rtl::OUString& rPropertyName )
221cdf0e10cSrcweir                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
222cdf0e10cSrcweir {
223cdf0e10cSrcweir     Any aRet;
224cdf0e10cSrcweir 
225cdf0e10cSrcweir     Reference< beans::XPropertySet > xPropSet(0);
226cdf0e10cSrcweir 
227cdf0e10cSrcweir     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
228cdf0e10cSrcweir     Sequence< Reference< chart2::XChartType > > aTypes(
229cdf0e10cSrcweir             ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
230cdf0e10cSrcweir     for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ )
231cdf0e10cSrcweir     {
232cdf0e10cSrcweir         Reference< chart2::XChartType > xType( aTypes[nN] );
233cdf0e10cSrcweir         if( xType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
234cdf0e10cSrcweir         {
235cdf0e10cSrcweir             Reference< chart2::XDataSeriesContainer > xSeriesContainer(xType,uno::UNO_QUERY);
236cdf0e10cSrcweir             if( xSeriesContainer.is() )
237cdf0e10cSrcweir             {
238cdf0e10cSrcweir                 Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xSeriesContainer->getDataSeries() );
239cdf0e10cSrcweir                 if(aSeriesSeq.getLength())
240cdf0e10cSrcweir                 {
241cdf0e10cSrcweir                     xPropSet = Reference< beans::XPropertySet >(aSeriesSeq[0],uno::UNO_QUERY);
242cdf0e10cSrcweir                     break;
243cdf0e10cSrcweir                 }
244cdf0e10cSrcweir             }
245cdf0e10cSrcweir         }
246cdf0e10cSrcweir     }
247cdf0e10cSrcweir     if(xPropSet.is())
248cdf0e10cSrcweir     {
249cdf0e10cSrcweir         if( rPropertyName.equals( C2U("LineColor")) )
250cdf0e10cSrcweir             aRet = xPropSet->getPropertyValue( C2U("Color") );
251cdf0e10cSrcweir         else if( rPropertyName.equals( C2U("LineTransparence")) )
252cdf0e10cSrcweir             aRet = xPropSet->getPropertyValue( C2U("Transparency") );
253cdf0e10cSrcweir         else if( rPropertyName.equals( m_aWrappedLineJointProperty.getOuterName() ) )
254cdf0e10cSrcweir             aRet = m_aWrappedLineJointProperty.getPropertyValue( xPropSet );
255cdf0e10cSrcweir         else
256cdf0e10cSrcweir             aRet = xPropSet->getPropertyValue( rPropertyName );
257cdf0e10cSrcweir 
258cdf0e10cSrcweir     }
259cdf0e10cSrcweir     return aRet;
260cdf0e10cSrcweir }
261cdf0e10cSrcweir 
addPropertyChangeListener(const::rtl::OUString &,const uno::Reference<beans::XPropertyChangeListener> &)262cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::addPropertyChangeListener( const ::rtl::OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
263cdf0e10cSrcweir                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
264cdf0e10cSrcweir {
265cdf0e10cSrcweir     OSL_ENSURE(false,"not implemented");
266cdf0e10cSrcweir }
removePropertyChangeListener(const::rtl::OUString &,const uno::Reference<beans::XPropertyChangeListener> &)267cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::removePropertyChangeListener( const ::rtl::OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ )
268cdf0e10cSrcweir                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
269cdf0e10cSrcweir {
270cdf0e10cSrcweir     OSL_ENSURE(false,"not implemented");
271cdf0e10cSrcweir }
addVetoableChangeListener(const::rtl::OUString &,const uno::Reference<beans::XVetoableChangeListener> &)272cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::addVetoableChangeListener( const ::rtl::OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
273cdf0e10cSrcweir                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
274cdf0e10cSrcweir {
275cdf0e10cSrcweir     OSL_ENSURE(false,"not implemented");
276cdf0e10cSrcweir }
removeVetoableChangeListener(const::rtl::OUString &,const uno::Reference<beans::XVetoableChangeListener> &)277cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::removeVetoableChangeListener( const ::rtl::OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
278cdf0e10cSrcweir                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
279cdf0e10cSrcweir {
280cdf0e10cSrcweir     OSL_ENSURE(false,"not implemented");
281cdf0e10cSrcweir }
282cdf0e10cSrcweir 
283cdf0e10cSrcweir //XMultiPropertySet
284cdf0e10cSrcweir //getPropertySetInfo() already declared in XPropertySet
setPropertyValues(const uno::Sequence<::rtl::OUString> & rNameSeq,const uno::Sequence<uno::Any> & rValueSeq)285cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::setPropertyValues( const uno::Sequence< ::rtl::OUString >& rNameSeq, const uno::Sequence< uno::Any >& rValueSeq )
286cdf0e10cSrcweir                     throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
287cdf0e10cSrcweir {
288cdf0e10cSrcweir     bool bUnknownProperty = false;
289cdf0e10cSrcweir     sal_Int32 nMinCount = std::min( rValueSeq.getLength(), rNameSeq.getLength() );
290cdf0e10cSrcweir     for(sal_Int32 nN=0; nN<nMinCount; nN++)
291cdf0e10cSrcweir     {
292cdf0e10cSrcweir         ::rtl::OUString aPropertyName( rNameSeq[nN] );
293cdf0e10cSrcweir         try
294cdf0e10cSrcweir         {
295cdf0e10cSrcweir             this->setPropertyValue( aPropertyName, rValueSeq[nN] );
296cdf0e10cSrcweir         }
297cdf0e10cSrcweir         catch( beans::UnknownPropertyException& ex )
298cdf0e10cSrcweir         {
299cdf0e10cSrcweir             ASSERT_EXCEPTION( ex );
300cdf0e10cSrcweir             bUnknownProperty = true;
301cdf0e10cSrcweir         }
302cdf0e10cSrcweir     }
303cdf0e10cSrcweir     //todo: store unknown properties elsewhere
304cdf0e10cSrcweir //    if( bUnknownProperty )
305cdf0e10cSrcweir //        throw beans::UnknownPropertyException();
306cdf0e10cSrcweir }
getPropertyValues(const uno::Sequence<::rtl::OUString> & rNameSeq)307cdf0e10cSrcweir uno::Sequence< uno::Any > SAL_CALL MinMaxLineWrapper::getPropertyValues( const uno::Sequence< ::rtl::OUString >& rNameSeq )
308cdf0e10cSrcweir                     throw (uno::RuntimeException)
309cdf0e10cSrcweir {
310cdf0e10cSrcweir     Sequence< Any > aRetSeq;
311cdf0e10cSrcweir     if( rNameSeq.getLength() )
312cdf0e10cSrcweir     {
313cdf0e10cSrcweir         aRetSeq.realloc( rNameSeq.getLength() );
314cdf0e10cSrcweir         for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
315cdf0e10cSrcweir         {
316cdf0e10cSrcweir             ::rtl::OUString aPropertyName( rNameSeq[nN] );
317cdf0e10cSrcweir             aRetSeq[nN] = this->getPropertyValue( aPropertyName );
318cdf0e10cSrcweir         }
319cdf0e10cSrcweir     }
320cdf0e10cSrcweir     return aRetSeq;
321cdf0e10cSrcweir }
addPropertiesChangeListener(const uno::Sequence<::rtl::OUString> &,const uno::Reference<beans::XPropertiesChangeListener> &)322cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::addPropertiesChangeListener(
323cdf0e10cSrcweir     const uno::Sequence< ::rtl::OUString >& /* aPropertyNames */,
324cdf0e10cSrcweir     const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
325cdf0e10cSrcweir                     throw (uno::RuntimeException)
326cdf0e10cSrcweir {
327cdf0e10cSrcweir     OSL_ENSURE(false,"not implemented");
328cdf0e10cSrcweir }
removePropertiesChangeListener(const uno::Reference<beans::XPropertiesChangeListener> &)329cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::removePropertiesChangeListener(
330cdf0e10cSrcweir     const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
331cdf0e10cSrcweir                     throw (uno::RuntimeException)
332cdf0e10cSrcweir {
333cdf0e10cSrcweir     OSL_ENSURE(false,"not implemented");
334cdf0e10cSrcweir }
firePropertiesChangeEvent(const uno::Sequence<::rtl::OUString> &,const uno::Reference<beans::XPropertiesChangeListener> &)335cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::firePropertiesChangeEvent(
336cdf0e10cSrcweir     const uno::Sequence< ::rtl::OUString >& /* aPropertyNames */,
337cdf0e10cSrcweir     const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
338cdf0e10cSrcweir                     throw (uno::RuntimeException)
339cdf0e10cSrcweir {
340cdf0e10cSrcweir     OSL_ENSURE(false,"not implemented");
341cdf0e10cSrcweir }
342cdf0e10cSrcweir 
343cdf0e10cSrcweir //XPropertyState
getPropertyState(const::rtl::OUString & rPropertyName)344cdf0e10cSrcweir beans::PropertyState SAL_CALL MinMaxLineWrapper::getPropertyState( const ::rtl::OUString& rPropertyName )
345cdf0e10cSrcweir                     throw (beans::UnknownPropertyException, uno::RuntimeException)
346cdf0e10cSrcweir {
347cdf0e10cSrcweir     if( rPropertyName.equals( m_aWrappedLineJointProperty.getOuterName() ) )
348cdf0e10cSrcweir         return beans::PropertyState_DEFAULT_VALUE;
349cdf0e10cSrcweir 
350cdf0e10cSrcweir     uno::Any aDefault( this->getPropertyDefault( rPropertyName ) );
351cdf0e10cSrcweir     uno::Any aValue( this->getPropertyValue( rPropertyName ) );
352cdf0e10cSrcweir 
353cdf0e10cSrcweir     if( aDefault == aValue )
354cdf0e10cSrcweir         return beans::PropertyState_DEFAULT_VALUE;
355cdf0e10cSrcweir 
356cdf0e10cSrcweir     return beans::PropertyState_DIRECT_VALUE;
357cdf0e10cSrcweir }
getPropertyStates(const uno::Sequence<::rtl::OUString> & rNameSeq)358cdf0e10cSrcweir uno::Sequence< beans::PropertyState > SAL_CALL MinMaxLineWrapper::getPropertyStates( const uno::Sequence< ::rtl::OUString >& rNameSeq )
359cdf0e10cSrcweir                     throw (beans::UnknownPropertyException, uno::RuntimeException)
360cdf0e10cSrcweir {
361cdf0e10cSrcweir     Sequence< beans::PropertyState > aRetSeq;
362cdf0e10cSrcweir     if( rNameSeq.getLength() )
363cdf0e10cSrcweir     {
364cdf0e10cSrcweir         aRetSeq.realloc( rNameSeq.getLength() );
365cdf0e10cSrcweir         for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
366cdf0e10cSrcweir         {
367cdf0e10cSrcweir             ::rtl::OUString aPropertyName( rNameSeq[nN] );
368cdf0e10cSrcweir             aRetSeq[nN] = this->getPropertyState( aPropertyName );
369cdf0e10cSrcweir         }
370cdf0e10cSrcweir     }
371cdf0e10cSrcweir     return aRetSeq;
372cdf0e10cSrcweir }
setPropertyToDefault(const::rtl::OUString & rPropertyName)373cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::setPropertyToDefault( const ::rtl::OUString& rPropertyName )
374cdf0e10cSrcweir                     throw (beans::UnknownPropertyException, uno::RuntimeException)
375cdf0e10cSrcweir {
376cdf0e10cSrcweir     this->setPropertyValue( rPropertyName, this->getPropertyDefault(rPropertyName) );
377cdf0e10cSrcweir }
378cdf0e10cSrcweir 
getPropertyDefault(const::rtl::OUString & rPropertyName)379cdf0e10cSrcweir uno::Any SAL_CALL MinMaxLineWrapper::getPropertyDefault( const ::rtl::OUString& rPropertyName )
380cdf0e10cSrcweir                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
381cdf0e10cSrcweir {
382cdf0e10cSrcweir     const tPropertyValueMap& rStaticDefaults = *StaticMinMaxLineWrapperDefaults::get();
383cdf0e10cSrcweir     tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( getInfoHelper().getHandleByName( rPropertyName ) ) );
384cdf0e10cSrcweir     if( aFound == rStaticDefaults.end() )
385cdf0e10cSrcweir         return uno::Any();
386cdf0e10cSrcweir     return (*aFound).second;
387cdf0e10cSrcweir }
388cdf0e10cSrcweir 
389cdf0e10cSrcweir //XMultiPropertyStates
390cdf0e10cSrcweir //getPropertyStates() already declared in XPropertyState
setAllPropertiesToDefault()391cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::setAllPropertiesToDefault(  )
392cdf0e10cSrcweir                     throw (uno::RuntimeException)
393cdf0e10cSrcweir {
394cdf0e10cSrcweir     const Sequence< beans::Property >& rPropSeq = *StaticMinMaxLineWrapperPropertyArray::get();
395cdf0e10cSrcweir     for(sal_Int32 nN=0; nN<rPropSeq.getLength(); nN++)
396cdf0e10cSrcweir     {
397cdf0e10cSrcweir         ::rtl::OUString aPropertyName( rPropSeq[nN].Name );
398cdf0e10cSrcweir         this->setPropertyToDefault( aPropertyName );
399cdf0e10cSrcweir     }
400cdf0e10cSrcweir }
setPropertiesToDefault(const uno::Sequence<::rtl::OUString> & rNameSeq)401cdf0e10cSrcweir void SAL_CALL MinMaxLineWrapper::setPropertiesToDefault( const uno::Sequence< ::rtl::OUString >& rNameSeq )
402cdf0e10cSrcweir                     throw (beans::UnknownPropertyException, uno::RuntimeException)
403cdf0e10cSrcweir {
404cdf0e10cSrcweir     for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
405cdf0e10cSrcweir     {
406cdf0e10cSrcweir         ::rtl::OUString aPropertyName( rNameSeq[nN] );
407cdf0e10cSrcweir         this->setPropertyToDefault( aPropertyName );
408cdf0e10cSrcweir     }
409cdf0e10cSrcweir }
getPropertyDefaults(const uno::Sequence<::rtl::OUString> & rNameSeq)410cdf0e10cSrcweir uno::Sequence< uno::Any > SAL_CALL MinMaxLineWrapper::getPropertyDefaults( const uno::Sequence< ::rtl::OUString >& rNameSeq )
411cdf0e10cSrcweir                     throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
412cdf0e10cSrcweir {
413cdf0e10cSrcweir     Sequence< Any > aRetSeq;
414cdf0e10cSrcweir     if( rNameSeq.getLength() )
415cdf0e10cSrcweir     {
416cdf0e10cSrcweir         aRetSeq.realloc( rNameSeq.getLength() );
417cdf0e10cSrcweir         for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
418cdf0e10cSrcweir         {
419cdf0e10cSrcweir             ::rtl::OUString aPropertyName( rNameSeq[nN] );
420cdf0e10cSrcweir             aRetSeq[nN] = this->getPropertyDefault( aPropertyName );
421cdf0e10cSrcweir         }
422cdf0e10cSrcweir     }
423cdf0e10cSrcweir     return aRetSeq;
424cdf0e10cSrcweir }
425cdf0e10cSrcweir 
426cdf0e10cSrcweir 
427cdf0e10cSrcweir // ================================================================================
428cdf0e10cSrcweir 
getSupportedServiceNames_Static()429cdf0e10cSrcweir Sequence< OUString > MinMaxLineWrapper::getSupportedServiceNames_Static()
430cdf0e10cSrcweir {
431cdf0e10cSrcweir     Sequence< OUString > aServices( 3 );
432cdf0e10cSrcweir     aServices[ 0 ] = C2U( "com.sun.star.chart.ChartLine" );
433cdf0e10cSrcweir     aServices[ 1 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
434cdf0e10cSrcweir     aServices[ 2 ] = C2U( "com.sun.star.drawing.LineProperties" );
435cdf0e10cSrcweir 
436cdf0e10cSrcweir     return aServices;
437cdf0e10cSrcweir }
438cdf0e10cSrcweir 
439cdf0e10cSrcweir // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
440cdf0e10cSrcweir APPHELPER_XSERVICEINFO_IMPL( MinMaxLineWrapper, lcl_aServiceName );
441cdf0e10cSrcweir 
442cdf0e10cSrcweir } //  namespace wrapper
443cdf0e10cSrcweir } //  namespace chart
444