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 XMLOFF_SCHXMLSERIES2CONTEXT_HXX
28 #define XMLOFF_SCHXMLSERIES2CONTEXT_HXX
29 
30 #include "transporttypes.hxx"
31 #include "SchXMLChartContext.hxx"
32 #include <xmloff/xmlictxt.hxx>
33 #include <xmloff/SchXMLImportHelper.hxx>
34 // header for class SvXMLStyleContext
35 #include <xmloff/xmlstyle.hxx>
36 
37 #include <vector>
38 #include <list>
39 
40 namespace com { namespace sun { namespace star {
41     namespace chart2 {
42         class XChartDocument;
43         class XDataSeries;
44     }
45     namespace awt {
46         struct Size;
47     }
48 }}}
49 
50 // class for child contexts: series, data point and statistics objects
51 class SchXMLSeries2Context : public SvXMLImportContext
52 {
53 private:
54 	SchXMLImportHelper& mrImportHelper;
55     ::com::sun::star::uno::Reference<
56             ::com::sun::star::chart2::XChartDocument > mxNewDoc;
57 	::std::vector< SchXMLAxis >& mrAxes;
58 	::std::list< DataRowPointStyle >& mrStyleList;
59     ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > m_xSeries;
60     sal_Int32 mnSeriesIndex;
61     sal_Int32 mnDataPointIndex;
62 	sal_Bool m_bStockHasVolume;
63 
64     GlobalSeriesImportInfo& m_rGlobalSeriesImportInfo;
65 
66     SchXMLAxis* mpAttachedAxis;
67     sal_Int32 mnAttachedAxis;
68     ::rtl::OUString msAutoStyleName;
69     ::std::vector< ::rtl::OUString > maDomainAddresses;
70     ::rtl::OUString maGlobalChartTypeName;
71     ::rtl::OUString maSeriesChartTypeName;
72     ::rtl::OUString m_aSeriesRange;
73     ::rtl::OUString m_aSeriesLabelRange;
74     bool            m_bHasDomainContext;
75     tSchXMLLSequencesPerIndex & mrLSequencesPerIndex;
76     tSchXMLLSequencesPerIndex maPostponedSequences;
77     bool& mrGlobalChartTypeUsedBySeries;
78     bool mbSymbolSizeIsMissingInFile;
79     ::com::sun::star::awt::Size maChartSize;
80 
81 public:
82 	SchXMLSeries2Context( SchXMLImportHelper& rImpHelper,
83                           SvXMLImport& rImport, const rtl::OUString& rLocalName,
84                           const ::com::sun::star::uno::Reference<
85                               ::com::sun::star::chart2::XChartDocument > & xNewDoc,
86                           std::vector< SchXMLAxis >& rAxes,
87                           ::std::list< DataRowPointStyle >& rStyleList,
88                           sal_Int32 nSeriesIndex,
89                           sal_Bool bStockHasVolume,
90                           GlobalSeriesImportInfo& rGlobalSeriesImportInfo,
91                           const ::rtl::OUString & aGlobalChartTypeName,
92                           tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
93                           bool& rGlobalChartTypeUsedBySeries,
94                           const ::com::sun::star::awt::Size & rChartSize );
95 	virtual ~SchXMLSeries2Context();
96 
97 	virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
98 	virtual SvXMLImportContext* CreateChildContext(
99 		sal_uInt16 nPrefix,
100 		const rtl::OUString& rLocalName,
101 		const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
102 	virtual void EndElement();
103 
104     static void initSeriesPropertySets( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
105         , const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel );
106 
107     static void setDefaultsToSeries( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles );
108 
109     static void setStylesToSeries( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
110         , const SvXMLStylesContext* pStylesCtxt
111         , const SvXMLStyleContext*& rpStyle
112         , ::rtl::OUString& rCurrStyleName
113         , SchXMLImportHelper& rImportHelper
114         , const SvXMLImport& rImport
115         , bool bIsStockChart
116         , tSchXMLLSequencesPerIndex & rInOutLSequencesPerIndex );
117 
118     static void setStylesToStatisticsObjects( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
119         , const SvXMLStylesContext* pStylesCtxt
120         , const SvXMLStyleContext*& rpStyle
121         , ::rtl::OUString& rCurrStyleName );
122 
123     static void setStylesToDataPoints( SeriesDefaultsAndStyles& rSeriesDefaultsAndStyles
124         , const SvXMLStylesContext* pStylesCtxt
125         , const SvXMLStyleContext*& rpStyle
126         , ::rtl::OUString& rCurrStyleName
127         , SchXMLImportHelper& rImportHelper
128         , const SvXMLImport& rImport
129         , bool bIsStockChart, bool bIsDonutChart, bool bSwitchOffLinesForScatter );
130 
131     static void switchSeriesLinesOff( ::std::list< DataRowPointStyle >& rSeriesStyleList );
132 };
133 
134 // XMLOFF_SCHXMLSERIES2CONTEXT_HXX
135 #endif
136