xref: /trunk/main/xmloff/source/chart/SchXMLTools.hxx (revision cdf0e10c)
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_XML_TOOLS_HXX_
28 #define SCH_XML_TOOLS_HXX_
29 
30 #include <rtl/ustring.hxx>
31 #include <xmloff/xmltoken.hxx>
32 #include "transporttypes.hxx"
33 
34 #include <com/sun/star/frame/XModel.hpp>
35 
36 namespace com { namespace sun { namespace star {
37     namespace chart2 {
38         class XChartDocument;
39         class XRegressionCurve;
40         namespace data {
41             class XDataProvider;
42             class XLabeledDataSequence;
43         }
44     }
45 }}}
46 
47 class XMLPropStyleContext;
48 class SvXMLStylesContext;
49 class SvXMLExport;
50 
51 namespace SchXMLTools
52 {
53     bool isDocumentGeneratedWithOpenOfficeOlderThan2_0( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
54     bool isDocumentGeneratedWithOpenOfficeOlderThan2_3( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
55     bool isDocumentGeneratedWithOpenOfficeOlderThan2_4( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
56     bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
57     bool isDocumentGeneratedWithOpenOfficeOlderThan3_3( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
58 
59     void setBuildIDAtImportInfo( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel
60         , ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xImportInfo );
61 
62     enum SchXMLChartTypeEnum
63     {
64         XML_CHART_CLASS_LINE,
65         XML_CHART_CLASS_AREA,
66         XML_CHART_CLASS_CIRCLE,
67         XML_CHART_CLASS_RING,
68         XML_CHART_CLASS_SCATTER,
69         XML_CHART_CLASS_RADAR,
70         XML_CHART_CLASS_FILLED_RADAR,
71         XML_CHART_CLASS_BAR,
72         XML_CHART_CLASS_STOCK,
73         XML_CHART_CLASS_BUBBLE,
74         XML_CHART_CLASS_ADDIN,
75         XML_CHART_CLASS_UNKNOWN
76     };
77 
78     SchXMLChartTypeEnum GetChartTypeEnum( const ::rtl::OUString& rClassName );
79 
80     ::rtl::OUString GetChartTypeByClassName(
81         const ::rtl::OUString & rClassName, bool bUseOldNames );
82 
83     ::xmloff::token::XMLTokenEnum getTokenByChartType(
84         const ::rtl::OUString & rChartTypeService, bool bUseOldNames );
85 
86     ::rtl::OUString GetNewChartTypeName( const ::rtl::OUString & rOldChartTypeName );
87 
88     ::com::sun::star::uno::Reference<
89         ::com::sun::star::chart2::data::XLabeledDataSequence > GetNewLabeledDataSequence();
90 
91     ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > CreateDataSequence(
92         const ::rtl::OUString& rRange,
93         const ::com::sun::star::uno::Reference<
94             ::com::sun::star::chart2::XChartDocument >& xChartDoc );
95 
96     void CreateCategories(
97         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > & xDataProvider,
98         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > & xNewDoc,
99         const ::rtl::OUString & rRangeAddress,
100         sal_Int32 nCooSysIndex,
101         sal_Int32 nDimensionIndex,
102         tSchXMLLSequencesPerIndex * pLSequencesPerIndex = 0 );
103 
104     ::com::sun::star::uno::Any getPropertyFromContext( const ::rtl::OUString& rPropertyName, const XMLPropStyleContext * pPropStyleContext, const SvXMLStylesContext* pStylesCtxt );
105 
106     void exportText( SvXMLExport& rExport, const ::rtl::OUString& rText, bool bConvertTabsLFs );
107 
108     void exportRangeToSomewhere( SvXMLExport& rExport, const ::rtl::OUString& rValue );
109 
110     /** returns the properties of the equation of the first regression curve
111         that is no mean-value line
112      */
113     ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XRegressionCurve > getRegressionCurve(
114         const ::com::sun::star::uno::Reference<
115             ::com::sun::star::chart2::XDataSeries > & xDataSeries );
116 
117     /** checks if the data sequence has the property "CachedXMLRange" (true for
118         internal data sequences), and if so sets this property to the range
119         given in rXMLRange
120      */
121     void setXMLRangePropertyAtDataSequence(
122         const ::com::sun::star::uno::Reference<
123             ::com::sun::star::chart2::data::XDataSequence > & xDataSequence,
124         const ::rtl::OUString & rXMLRange );
125 
126     /** checks if the data sequence has the property "CachedXMLRange" (true for
127         internal data sequences), and if so retrieves this property and applies
128         it to the range given in rOutXMLRange.
129 
130         @param bClearProp If true, the property is reset to its default after it
131                           was assigned to rOutXMLRange
132 
133         @return true, if the property was found, assigned and is non-empty
134      */
135     bool getXMLRangePropertyFromDataSequence(
136         const ::com::sun::star::uno::Reference<
137             ::com::sun::star::chart2::data::XDataSequence > & xDataSequence,
138         ::rtl::OUString & rOutXMLRange,
139         bool bClearProp = false );
140 
141     ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > getDataProviderFromParent( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc );
142 
143     bool switchBackToDataProviderFromParent( const ::com::sun::star::uno::Reference<
144         ::com::sun::star::chart2::XChartDocument >& xChartDoc
145         , const tSchXMLLSequencesPerIndex & rLSequencesPerIndex );
146 
147     void copyProperties(
148         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xSource,
149         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xDestination );
150 }
151 
152 #endif	// SCH_XML_TOOLS_HXX_
153