1cde9e8dcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3cde9e8dcSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4cde9e8dcSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5cde9e8dcSAndrew Rist  * distributed with this work for additional information
6cde9e8dcSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7cde9e8dcSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8cde9e8dcSAndrew Rist  * "License"); you may not use this file except in compliance
9cde9e8dcSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cde9e8dcSAndrew Rist  *
11cde9e8dcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cde9e8dcSAndrew Rist  *
13cde9e8dcSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14cde9e8dcSAndrew Rist  * software distributed under the License is distributed on an
15cde9e8dcSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16cde9e8dcSAndrew Rist  * KIND, either express or implied.  See the License for the
17cde9e8dcSAndrew Rist  * specific language governing permissions and limitations
18cde9e8dcSAndrew Rist  * under the License.
19cde9e8dcSAndrew Rist  *
20cde9e8dcSAndrew Rist  *************************************************************/
21cde9e8dcSAndrew Rist 
22cde9e8dcSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_chart2.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "WrappedStockProperties.hxx"
28cdf0e10cSrcweir #include "macros.hxx"
29cdf0e10cSrcweir #include "FastPropertyIdRanges.hxx"
30cdf0e10cSrcweir #include "DiagramHelper.hxx"
31cdf0e10cSrcweir #include "ChartModelHelper.hxx"
32cdf0e10cSrcweir #include "ControllerLockGuard.hxx"
33cdf0e10cSrcweir #include <com/sun/star/chart2/XChartDocument.hpp>
34cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir using namespace ::com::sun::star;
37cdf0e10cSrcweir using ::com::sun::star::uno::Any;
38cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
39cdf0e10cSrcweir using ::com::sun::star::uno::Sequence;
40cdf0e10cSrcweir using ::com::sun::star::beans::Property;
41cdf0e10cSrcweir using ::rtl::OUString;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir //.............................................................................
44cdf0e10cSrcweir namespace chart
45cdf0e10cSrcweir {
46cdf0e10cSrcweir namespace wrapper
47cdf0e10cSrcweir {
48cdf0e10cSrcweir 
49cdf0e10cSrcweir 
50cdf0e10cSrcweir //-----------------------------------------------------------------------------
51cdf0e10cSrcweir //-----------------------------------------------------------------------------
52cdf0e10cSrcweir //-----------------------------------------------------------------------------
53cdf0e10cSrcweir 
54cdf0e10cSrcweir class WrappedStockProperty : public WrappedProperty
55cdf0e10cSrcweir {
56cdf0e10cSrcweir public:
57cdf0e10cSrcweir     explicit WrappedStockProperty( const ::rtl::OUString& rOuterName
58cdf0e10cSrcweir         , const ::com::sun::star::uno::Any& rDefaulValue
59cdf0e10cSrcweir         , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
60cdf0e10cSrcweir     virtual ~WrappedStockProperty();
61cdf0e10cSrcweir 
62cdf0e10cSrcweir     void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
63cdf0e10cSrcweir                     throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
64cdf0e10cSrcweir 
65cdf0e10cSrcweir     ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
66cdf0e10cSrcweir                             throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     virtual uno::Reference< chart2::XChartTypeTemplate > getNewTemplate( sal_Bool bNewValue, const rtl::OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const = 0;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir protected:
71cdf0e10cSrcweir     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
72cdf0e10cSrcweir     mutable ::com::sun::star::uno::Any     m_aOuterValue;
73cdf0e10cSrcweir     ::com::sun::star::uno::Any             m_aDefaultValue;
74cdf0e10cSrcweir };
75cdf0e10cSrcweir 
WrappedStockProperty(const::rtl::OUString & rOuterName,const::com::sun::star::uno::Any & rDefaulValue,::boost::shared_ptr<Chart2ModelContact> spChart2ModelContact)76cdf0e10cSrcweir WrappedStockProperty::WrappedStockProperty( const ::rtl::OUString& rOuterName
77cdf0e10cSrcweir     , const ::com::sun::star::uno::Any& rDefaulValue
78cdf0e10cSrcweir     , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
79cdf0e10cSrcweir     : WrappedProperty(rOuterName,rtl::OUString())
80cdf0e10cSrcweir         , m_spChart2ModelContact(spChart2ModelContact)
81cdf0e10cSrcweir         , m_aOuterValue()
82cdf0e10cSrcweir         , m_aDefaultValue(rDefaulValue)
83cdf0e10cSrcweir {
84cdf0e10cSrcweir }
~WrappedStockProperty()85cdf0e10cSrcweir WrappedStockProperty::~WrappedStockProperty()
86cdf0e10cSrcweir {
87cdf0e10cSrcweir }
88cdf0e10cSrcweir 
setPropertyValue(const::com::sun::star::uno::Any & rOuterValue,const::com::sun::star::uno::Reference<::com::sun::star::beans::XPropertySet> &) const89cdf0e10cSrcweir void WrappedStockProperty::setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& /*xInnerPropertySet*/ ) const
90cdf0e10cSrcweir                 throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
91cdf0e10cSrcweir {
92cdf0e10cSrcweir     sal_Bool bNewValue = false;
93cdf0e10cSrcweir     if( ! (rOuterValue >>= bNewValue) )
94cdf0e10cSrcweir         throw lang::IllegalArgumentException( C2U("stock properties require type sal_Bool"), 0, 0 );
95cdf0e10cSrcweir 
96cdf0e10cSrcweir     m_aOuterValue = rOuterValue;
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
99cdf0e10cSrcweir     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
100cdf0e10cSrcweir     sal_Int32 nDimension = ::chart::DiagramHelper::getDimension( xDiagram );
101cdf0e10cSrcweir     if( xChartDoc.is() && xDiagram.is() && nDimension==2 )
102cdf0e10cSrcweir     {
103cdf0e10cSrcweir         Reference< lang::XMultiServiceFactory > xFactory( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
104cdf0e10cSrcweir         DiagramHelper::tTemplateWithServiceName aTemplateAndService =
105cdf0e10cSrcweir                 DiagramHelper::getTemplateForDiagram( xDiagram, xFactory );
106cdf0e10cSrcweir 
107cdf0e10cSrcweir         uno::Reference< chart2::XChartTypeTemplate > xTemplate =
108cdf0e10cSrcweir                 getNewTemplate( bNewValue, aTemplateAndService.second, xFactory );
109cdf0e10cSrcweir 
110cdf0e10cSrcweir         if(xTemplate.is())
111cdf0e10cSrcweir         {
112cdf0e10cSrcweir             try
113cdf0e10cSrcweir             {
114cdf0e10cSrcweir                 // /-- locked controllers
115cdf0e10cSrcweir                 ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
116cdf0e10cSrcweir                 xTemplate->changeDiagram( xDiagram );
117cdf0e10cSrcweir                 // \-- locked controllers
118cdf0e10cSrcweir             }
119cdf0e10cSrcweir             catch( uno::Exception & ex )
120cdf0e10cSrcweir             {
121cdf0e10cSrcweir                 ASSERT_EXCEPTION( ex );
122cdf0e10cSrcweir             }
123cdf0e10cSrcweir         }
124cdf0e10cSrcweir     }
125cdf0e10cSrcweir }
126cdf0e10cSrcweir 
getPropertyDefault(const::com::sun::star::uno::Reference<::com::sun::star::beans::XPropertyState> &) const127cdf0e10cSrcweir ::com::sun::star::uno::Any WrappedStockProperty::getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& /*xInnerPropertyState*/ ) const
128cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
129cdf0e10cSrcweir {
130cdf0e10cSrcweir     return m_aDefaultValue;
131cdf0e10cSrcweir }
132cdf0e10cSrcweir 
133cdf0e10cSrcweir //-------------------------------------------------------------------------------------
134cdf0e10cSrcweir //-------------------------------------------------------------------------------------
135cdf0e10cSrcweir //-------------------------------------------------------------------------------------
136cdf0e10cSrcweir 
137cdf0e10cSrcweir class WrappedVolumeProperty : public WrappedStockProperty
138cdf0e10cSrcweir {
139cdf0e10cSrcweir public:
140cdf0e10cSrcweir     explicit WrappedVolumeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
141cdf0e10cSrcweir     virtual ~WrappedVolumeProperty();
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
144cdf0e10cSrcweir                             throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
145cdf0e10cSrcweir 
146cdf0e10cSrcweir     uno::Reference< chart2::XChartTypeTemplate > getNewTemplate( sal_Bool bNewValue, const rtl::OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const;
147cdf0e10cSrcweir };
148cdf0e10cSrcweir 
WrappedVolumeProperty(::boost::shared_ptr<Chart2ModelContact> spChart2ModelContact)149cdf0e10cSrcweir WrappedVolumeProperty::WrappedVolumeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
150cdf0e10cSrcweir         : WrappedStockProperty( C2U("Volume"), uno::makeAny(sal_False) , spChart2ModelContact )
151cdf0e10cSrcweir {
152cdf0e10cSrcweir }
~WrappedVolumeProperty()153cdf0e10cSrcweir WrappedVolumeProperty::~WrappedVolumeProperty()
154cdf0e10cSrcweir {
155cdf0e10cSrcweir }
156cdf0e10cSrcweir 
getPropertyValue(const::com::sun::star::uno::Reference<::com::sun::star::beans::XPropertySet> &) const157cdf0e10cSrcweir ::com::sun::star::uno::Any WrappedVolumeProperty::getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& /*xInnerPropertySet*/ ) const
158cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
159cdf0e10cSrcweir {
160cdf0e10cSrcweir     Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
161cdf0e10cSrcweir     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
162cdf0e10cSrcweir     if( xDiagram.is() && xChartDoc.is() )
163cdf0e10cSrcweir     {
164cdf0e10cSrcweir         ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesVector(
165cdf0e10cSrcweir             DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
166cdf0e10cSrcweir         if( aSeriesVector.size() > 0 )
167cdf0e10cSrcweir         {
168cdf0e10cSrcweir             Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
169cdf0e10cSrcweir             DiagramHelper::tTemplateWithServiceName aTemplateAndService =
170cdf0e10cSrcweir                     DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
171cdf0e10cSrcweir 
172cdf0e10cSrcweir             if(    aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ) )
173cdf0e10cSrcweir                 || aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ) ) )
174cdf0e10cSrcweir                 m_aOuterValue <<= sal_Bool(sal_True);
175*9ec58d04SHerbert Dürr             else if( !aTemplateAndService.second.isEmpty() || !m_aOuterValue.hasValue() )
176cdf0e10cSrcweir                 m_aOuterValue <<= sal_Bool(sal_False);
177cdf0e10cSrcweir         }
178cdf0e10cSrcweir         else if(!m_aOuterValue.hasValue())
179cdf0e10cSrcweir             m_aOuterValue <<= sal_Bool(sal_False);
180cdf0e10cSrcweir     }
181cdf0e10cSrcweir     return m_aOuterValue;
182cdf0e10cSrcweir }
183cdf0e10cSrcweir 
getNewTemplate(sal_Bool bNewValue,const rtl::OUString & rCurrentTemplate,const Reference<lang::XMultiServiceFactory> & xFactory) const184cdf0e10cSrcweir uno::Reference< chart2::XChartTypeTemplate > WrappedVolumeProperty::getNewTemplate( sal_Bool bNewValue, const rtl::OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const
185cdf0e10cSrcweir {
186cdf0e10cSrcweir     uno::Reference< chart2::XChartTypeTemplate > xTemplate(0);
187cdf0e10cSrcweir 
188cdf0e10cSrcweir     if(!xFactory.is())
189cdf0e10cSrcweir         return xTemplate;
190cdf0e10cSrcweir 
191cdf0e10cSrcweir     if( bNewValue ) //add volume
192cdf0e10cSrcweir     {
193cdf0e10cSrcweir         if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockLowHighClose" ) ) )
194cdf0e10cSrcweir             xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ) ), uno::UNO_QUERY );
195cdf0e10cSrcweir         else if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ) ) )
196cdf0e10cSrcweir             xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ) ), uno::UNO_QUERY );
197cdf0e10cSrcweir     }
198cdf0e10cSrcweir     else //remove volume
199cdf0e10cSrcweir     {
200cdf0e10cSrcweir         if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ) ) )
201cdf0e10cSrcweir             xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockLowHighClose" ) ), uno::UNO_QUERY );
202cdf0e10cSrcweir         else if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ) ) )
203cdf0e10cSrcweir             xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ) ), uno::UNO_QUERY );
204cdf0e10cSrcweir     }
205cdf0e10cSrcweir     return xTemplate;
206cdf0e10cSrcweir }
207cdf0e10cSrcweir 
208cdf0e10cSrcweir //-------------------------------------------------------------------------------------
209cdf0e10cSrcweir //-------------------------------------------------------------------------------------
210cdf0e10cSrcweir 
211cdf0e10cSrcweir 
212cdf0e10cSrcweir class WrappedUpDownProperty : public WrappedStockProperty
213cdf0e10cSrcweir {
214cdf0e10cSrcweir public:
215cdf0e10cSrcweir     explicit WrappedUpDownProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
216cdf0e10cSrcweir     virtual ~WrappedUpDownProperty();
217cdf0e10cSrcweir 
218cdf0e10cSrcweir     ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
219cdf0e10cSrcweir                             throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
220cdf0e10cSrcweir 
221cdf0e10cSrcweir     uno::Reference< chart2::XChartTypeTemplate > getNewTemplate( sal_Bool bNewValue, const rtl::OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const;
222cdf0e10cSrcweir };
WrappedUpDownProperty(::boost::shared_ptr<Chart2ModelContact> spChart2ModelContact)223cdf0e10cSrcweir WrappedUpDownProperty::WrappedUpDownProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
224cdf0e10cSrcweir         : WrappedStockProperty( C2U("UpDown"), uno::makeAny(sal_False) , spChart2ModelContact )
225cdf0e10cSrcweir {
226cdf0e10cSrcweir }
~WrappedUpDownProperty()227cdf0e10cSrcweir WrappedUpDownProperty::~WrappedUpDownProperty()
228cdf0e10cSrcweir {
229cdf0e10cSrcweir }
getPropertyValue(const::com::sun::star::uno::Reference<::com::sun::star::beans::XPropertySet> &) const230cdf0e10cSrcweir ::com::sun::star::uno::Any WrappedUpDownProperty::getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& /*xInnerPropertySet*/ ) const
231cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
232cdf0e10cSrcweir {
233cdf0e10cSrcweir     Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
234cdf0e10cSrcweir     Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
235cdf0e10cSrcweir     if( xDiagram.is() && xChartDoc.is() )
236cdf0e10cSrcweir     {
237cdf0e10cSrcweir         ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesVector(
238cdf0e10cSrcweir             DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
239cdf0e10cSrcweir         if( aSeriesVector.size() > 0 )
240cdf0e10cSrcweir         {
241cdf0e10cSrcweir             Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
242cdf0e10cSrcweir             DiagramHelper::tTemplateWithServiceName aTemplateAndService =
243cdf0e10cSrcweir                     DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
244cdf0e10cSrcweir 
245cdf0e10cSrcweir             if(    aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ) )
246cdf0e10cSrcweir                 || aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ) ) )
247cdf0e10cSrcweir                 m_aOuterValue <<= sal_Bool(sal_True);
248*9ec58d04SHerbert Dürr             else if( !aTemplateAndService.second.isEmpty() || !m_aOuterValue.hasValue() )
249cdf0e10cSrcweir                 m_aOuterValue <<= sal_Bool(sal_False);
250cdf0e10cSrcweir         }
251cdf0e10cSrcweir         else if(!m_aOuterValue.hasValue())
252cdf0e10cSrcweir             m_aOuterValue <<= sal_Bool(sal_False);
253cdf0e10cSrcweir     }
254cdf0e10cSrcweir     return m_aOuterValue;
255cdf0e10cSrcweir }
getNewTemplate(sal_Bool bNewValue,const rtl::OUString & rCurrentTemplate,const Reference<lang::XMultiServiceFactory> & xFactory) const256cdf0e10cSrcweir uno::Reference< chart2::XChartTypeTemplate > WrappedUpDownProperty::getNewTemplate( sal_Bool bNewValue, const rtl::OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const
257cdf0e10cSrcweir {
258cdf0e10cSrcweir     uno::Reference< chart2::XChartTypeTemplate > xTemplate(0);
259cdf0e10cSrcweir     if( bNewValue ) //add open series
260cdf0e10cSrcweir     {
261cdf0e10cSrcweir         if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockLowHighClose" ) ) )
262cdf0e10cSrcweir             xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ) ), uno::UNO_QUERY );
263cdf0e10cSrcweir         else if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ) ) )
264cdf0e10cSrcweir             xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ) ), uno::UNO_QUERY );
265cdf0e10cSrcweir     }
266cdf0e10cSrcweir     else //remove open series
267cdf0e10cSrcweir     {
268cdf0e10cSrcweir         if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ) ) )
269cdf0e10cSrcweir             xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockLowHighClose" ) ), uno::UNO_QUERY );
270cdf0e10cSrcweir         else if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ) ) )
271cdf0e10cSrcweir             xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ) ), uno::UNO_QUERY );
272cdf0e10cSrcweir     }
273cdf0e10cSrcweir     return xTemplate;
274cdf0e10cSrcweir }
275cdf0e10cSrcweir 
276cdf0e10cSrcweir namespace
277cdf0e10cSrcweir {
278cdf0e10cSrcweir enum
279cdf0e10cSrcweir {
280cdf0e10cSrcweir     //spline properties
281cdf0e10cSrcweir       PROP_CHART_STOCK_VOLUME = FAST_PROPERTY_ID_START_CHART_STOCK_PROP
282cdf0e10cSrcweir     , PROP_CHART_STOCK_UPDOWN
283cdf0e10cSrcweir };
284cdf0e10cSrcweir 
285cdf0e10cSrcweir }//anonymous namespace
286cdf0e10cSrcweir 
287cdf0e10cSrcweir //-----------------------------------------------------------------------------
288cdf0e10cSrcweir //-----------------------------------------------------------------------------
289cdf0e10cSrcweir //-----------------------------------------------------------------------------
addProperties(::std::vector<Property> & rOutProperties)290cdf0e10cSrcweir void WrappedStockProperties::addProperties( ::std::vector< Property > & rOutProperties )
291cdf0e10cSrcweir {
292cdf0e10cSrcweir     rOutProperties.push_back(
293cdf0e10cSrcweir         Property( C2U( "Volume" ),
294cdf0e10cSrcweir                   PROP_CHART_STOCK_VOLUME,
295cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< sal_Bool * >(0)),
296cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
297cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT
298cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEVOID ));
299cdf0e10cSrcweir     rOutProperties.push_back(
300cdf0e10cSrcweir         Property( C2U( "UpDown" ),
301cdf0e10cSrcweir                   PROP_CHART_STOCK_UPDOWN,
302cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< sal_Bool * >(0)),
303cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
304cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT
305cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEVOID ));
306cdf0e10cSrcweir }
307cdf0e10cSrcweir 
308cdf0e10cSrcweir //-----------------------------------------------------------------------------
309cdf0e10cSrcweir //-----------------------------------------------------------------------------
310cdf0e10cSrcweir 
addWrappedProperties(std::vector<WrappedProperty * > & rList,::boost::shared_ptr<Chart2ModelContact> spChart2ModelContact)311cdf0e10cSrcweir void WrappedStockProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList
312cdf0e10cSrcweir                                     , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
313cdf0e10cSrcweir {
314cdf0e10cSrcweir     rList.push_back( new WrappedVolumeProperty( spChart2ModelContact ) );
315cdf0e10cSrcweir     rList.push_back( new WrappedUpDownProperty( spChart2ModelContact ) );
316cdf0e10cSrcweir }
317cdf0e10cSrcweir 
318cdf0e10cSrcweir //-----------------------------------------------------------------------------
319cdf0e10cSrcweir //-----------------------------------------------------------------------------
320cdf0e10cSrcweir //-----------------------------------------------------------------------------
321cdf0e10cSrcweir 
322cdf0e10cSrcweir } //namespace wrapper
323cdf0e10cSrcweir } //namespace chart
324cdf0e10cSrcweir //.............................................................................
325