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 #ifndef CHART_DATAPOINTITEMCONVERTER_HXX
24 #define CHART_DATAPOINTITEMCONVERTER_HXX
25 
26 #include "ItemConverter.hxx"
27 #include "GraphicPropertyItemConverter.hxx"
28 #include "NumberFormatterWrapper.hxx"
29 
30 #include <com/sun/star/chart2/XDataSeries.hpp>
31 #include <com/sun/star/awt/Size.hpp>
32 #include <com/sun/star/frame/XModel.hpp>
33 #include <com/sun/star/uno/XComponentContext.hpp>
34 
35 #include <memory>
36 #include <vector>
37 
38 class SdrModel;
39 
40 namespace chart
41 {
42 namespace wrapper
43 {
44 
45 class DataPointItemConverter :
46         public ::comphelper::ItemConverter
47 {
48 public:
49     DataPointItemConverter(
50         const ::com::sun::star::uno::Reference<
51             ::com::sun::star::frame::XModel > & xChartModel,
52         const ::com::sun::star::uno::Reference<
53             ::com::sun::star::uno::XComponentContext > & xContext,
54         const ::com::sun::star::uno::Reference<
55             ::com::sun::star::beans::XPropertySet > & rPropertySet,
56         const ::com::sun::star::uno::Reference<
57             ::com::sun::star::chart2::XDataSeries > & xSeries,
58         SfxItemPool& rItemPool,
59         SdrModel& rDrawModel,
60         NumberFormatterWrapper * pNumFormatter,
61         const ::com::sun::star::uno::Reference<
62             ::com::sun::star::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
63         GraphicPropertyItemConverter::eGraphicObjectType eMapTo =
64             GraphicPropertyItemConverter::FILLED_DATA_POINT,
65         ::std::auto_ptr< ::com::sun::star::awt::Size > pRefSize =
66             ::std::auto_ptr< ::com::sun::star::awt::Size >(),
67         bool bDataSeries = false,
68         bool bUseSpecialFillColor = false,
69         sal_Int32 nSpecialFillColor = 0,
70         bool bOverwriteLabelsForAttributedDataPointsAlso=false,
71         sal_Int32 nNumberFormat=0,
72         sal_Int32 nPercentNumberFormat=0);
73 
74     virtual ~DataPointItemConverter();
75 
76     virtual void FillItemSet( SfxItemSet & rOutItemSet ) const;
77     virtual bool ApplyItemSet( const SfxItemSet & rItemSet );
78 
79 protected:
80     virtual const sal_uInt16 * GetWhichPairs() const;
81     virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
82 
83     virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
84         throw( ::com::sun::star::uno::Exception );
85     virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
86         throw( ::com::sun::star::uno::Exception );
87 
88 private:
89     ::std::vector< ItemConverter * >    m_aConverters;
90     NumberFormatterWrapper *            m_pNumberFormatterWrapper;
91     bool                                m_bDataSeries;
92     bool                                m_bOverwriteLabelsForAttributedDataPointsAlso;
93     bool                                m_bColorPerPoint;
94     bool                                m_bUseSpecialFillColor;
95     sal_Int32                           m_nSpecialFillColor;
96     sal_Int32                           m_nNumberFormat;
97     sal_Int32                           m_nPercentNumberFormat;
98     ::com::sun::star::uno::Sequence< sal_Int32 > m_aAvailableLabelPlacements;
99     bool                                m_bForbidPercentValue;
100 };
101 
102 } //  namespace wrapper
103 } //  namespace chart
104 
105 // CHART_DATAPOINTITEMCONVERTER_HXX
106 #endif
107