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