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 _SCH_XMLAXISCONTEXT_HXX_
24 #define _SCH_XMLAXISCONTEXT_HXX_
25 
26 #include "SchXMLImport.hxx"
27 #include "transporttypes.hxx"
28 
29 // ----------------------------------------
30 
31 class SchXMLAxisContext : public SvXMLImportContext
32 {
33 public:
34 	SchXMLAxisContext( SchXMLImportHelper& rImpHelper,
35 					   SvXMLImport& rImport, const rtl::OUString& rLocalName,
36 					   ::com::sun::star::uno::Reference< ::com::sun::star::chart::XDiagram > xDiagram,
37 					   std::vector< SchXMLAxis >& aAxes,
38                        ::rtl::OUString& rCategoriesAddress,
39                        bool bAddMissingXAxisForNetCharts,
40                        bool bAdaptWrongPercentScaleValues,
41                        bool bAdaptXAxisOrientationForOld2DBarCharts,
42                        bool& rbAxisPositionAttributeImported );
43 	virtual ~SchXMLAxisContext();
44 
45 	virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
46 	virtual void EndElement();
47 	virtual SvXMLImportContext* CreateChildContext(
48 		sal_uInt16 nPrefix,
49 		const rtl::OUString& rLocalName,
50 		const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
51 
52     static void CorrectAxisPositions( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xNewDoc,
53                           const ::rtl::OUString& rChartTypeServiceName,
54                           const ::rtl::OUString& rODFVersionOfFile,
55                           bool bAxisPositionAttributeImported );
56 
57 private:
58 	SchXMLImportHelper& m_rImportHelper;
59 	::com::sun::star::uno::Reference< ::com::sun::star::chart::XDiagram > m_xDiagram;
60 	SchXMLAxis m_aCurrentAxis;
61 	std::vector< SchXMLAxis >& m_rAxes;
62     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xAxisProps;
63 	rtl::OUString m_aAutoStyleName;
64 	rtl::OUString& m_rCategoriesAddress;
65     sal_Int32 m_nAxisType;//::com::sun::star::chart::ChartAxisType
66     bool m_bAxisTypeImported;
67     bool m_bDateScaleImported;
68     bool m_bAddMissingXAxisForNetCharts; //to correct errors from older versions
69     bool m_bAdaptWrongPercentScaleValues; //to correct errors from older versions
70     bool m_bAdaptXAxisOrientationForOld2DBarCharts; //to correct different behaviour from older versions
71     bool& m_rbAxisPositionAttributeImported;
72 
73 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > getTitleShape();
74 	void CreateGrid( ::rtl::OUString sAutoStyleName, bool bIsMajor );
75     void CreateAxis();
76     void SetAxisTitle();
77 };
78 
79 #endif	// _SCH_XMLAXISCONTEXT_HXX_
80