1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef CHART_DATAPOINTITEMCONVERTER_HXX
28 #define CHART_DATAPOINTITEMCONVERTER_HXX
29 
30 #include "ItemConverter.hxx"
31 #include "GraphicPropertyItemConverter.hxx"
32 #include "NumberFormatterWrapper.hxx"
33 
34 #include <com/sun/star/chart2/XDataSeries.hpp>
35 #include <com/sun/star/awt/Size.hpp>
36 #include <com/sun/star/frame/XModel.hpp>
37 #include <com/sun/star/uno/XComponentContext.hpp>
38 
39 #include <memory>
40 #include <vector>
41 
42 class SdrModel;
43 
44 namespace chart
45 {
46 namespace wrapper
47 {
48 
49 class DataPointItemConverter :
50         public ::comphelper::ItemConverter
51 {
52 public:
53     DataPointItemConverter(
54         const ::com::sun::star::uno::Reference<
55             ::com::sun::star::frame::XModel > & xChartModel,
56         const ::com::sun::star::uno::Reference<
57             ::com::sun::star::uno::XComponentContext > & xContext,
58         const ::com::sun::star::uno::Reference<
59             ::com::sun::star::beans::XPropertySet > & rPropertySet,
60         const ::com::sun::star::uno::Reference<
61             ::com::sun::star::chart2::XDataSeries > & xSeries,
62         SfxItemPool& rItemPool,
63         SdrModel& rDrawModel,
64         NumberFormatterWrapper * pNumFormatter,
65         const ::com::sun::star::uno::Reference<
66             ::com::sun::star::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
67         GraphicPropertyItemConverter::eGraphicObjectType eMapTo =
68             GraphicPropertyItemConverter::FILLED_DATA_POINT,
69         ::std::auto_ptr< ::com::sun::star::awt::Size > pRefSize =
70             ::std::auto_ptr< ::com::sun::star::awt::Size >(),
71         bool bDataSeries = false,
72         bool bUseSpecialFillColor = false,
73         sal_Int32 nSpecialFillColor = 0,
74         bool bOverwriteLabelsForAttributedDataPointsAlso=false,
75         sal_Int32 nNumberFormat=0,
76         sal_Int32 nPercentNumberFormat=0);
77 
78     virtual ~DataPointItemConverter();
79 
80     virtual void FillItemSet( SfxItemSet & rOutItemSet ) const;
81     virtual bool ApplyItemSet( const SfxItemSet & rItemSet );
82 
83 protected:
84     virtual const sal_uInt16 * GetWhichPairs() const;
85     virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const;
86 
87     virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
88         throw( ::com::sun::star::uno::Exception );
89     virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
90         throw( ::com::sun::star::uno::Exception );
91 
92 private:
93     ::std::vector< ItemConverter * >    m_aConverters;
94     NumberFormatterWrapper *            m_pNumberFormatterWrapper;
95     bool                                m_bDataSeries;
96     bool                                m_bOverwriteLabelsForAttributedDataPointsAlso;
97     bool                                m_bColorPerPoint;
98     bool                                m_bUseSpecialFillColor;
99     sal_Int32                           m_nSpecialFillColor;
100     sal_Int32                           m_nNumberFormat;
101     sal_Int32                           m_nPercentNumberFormat;
102     ::com::sun::star::uno::Sequence< sal_Int32 > m_aAvailableLabelPlacements;
103     bool                                m_bForbidPercentValue;
104 };
105 
106 } //  namespace wrapper
107 } //  namespace chart
108 
109 // CHART_DATAPOINTITEMCONVERTER_HXX
110 #endif
111