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