xref: /trunk/main/xmloff/source/chart/SchXMLTools.hxx (revision ecfe53c5)
1*ecfe53c5SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ecfe53c5SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ecfe53c5SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ecfe53c5SAndrew Rist  * distributed with this work for additional information
6*ecfe53c5SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ecfe53c5SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ecfe53c5SAndrew Rist  * "License"); you may not use this file except in compliance
9*ecfe53c5SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ecfe53c5SAndrew Rist  *
11*ecfe53c5SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ecfe53c5SAndrew Rist  *
13*ecfe53c5SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ecfe53c5SAndrew Rist  * software distributed under the License is distributed on an
15*ecfe53c5SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ecfe53c5SAndrew Rist  * KIND, either express or implied.  See the License for the
17*ecfe53c5SAndrew Rist  * specific language governing permissions and limitations
18*ecfe53c5SAndrew Rist  * under the License.
19*ecfe53c5SAndrew Rist  *
20*ecfe53c5SAndrew Rist  *************************************************************/
21*ecfe53c5SAndrew Rist 
22*ecfe53c5SAndrew Rist 
23cdf0e10cSrcweir #ifndef SCH_XML_TOOLS_HXX_
24cdf0e10cSrcweir #define SCH_XML_TOOLS_HXX_
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <rtl/ustring.hxx>
27cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
28cdf0e10cSrcweir #include "transporttypes.hxx"
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir namespace com { namespace sun { namespace star {
33cdf0e10cSrcweir     namespace chart2 {
34cdf0e10cSrcweir         class XChartDocument;
35cdf0e10cSrcweir         class XRegressionCurve;
36cdf0e10cSrcweir         namespace data {
37cdf0e10cSrcweir             class XDataProvider;
38cdf0e10cSrcweir             class XLabeledDataSequence;
39cdf0e10cSrcweir         }
40cdf0e10cSrcweir     }
41cdf0e10cSrcweir }}}
42cdf0e10cSrcweir 
43cdf0e10cSrcweir class XMLPropStyleContext;
44cdf0e10cSrcweir class SvXMLStylesContext;
45cdf0e10cSrcweir class SvXMLExport;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir namespace SchXMLTools
48cdf0e10cSrcweir {
49cdf0e10cSrcweir     bool isDocumentGeneratedWithOpenOfficeOlderThan2_0( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
50cdf0e10cSrcweir     bool isDocumentGeneratedWithOpenOfficeOlderThan2_3( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
51cdf0e10cSrcweir     bool isDocumentGeneratedWithOpenOfficeOlderThan2_4( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
52cdf0e10cSrcweir     bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
53cdf0e10cSrcweir     bool isDocumentGeneratedWithOpenOfficeOlderThan3_3( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
54cdf0e10cSrcweir 
55cdf0e10cSrcweir     void setBuildIDAtImportInfo( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel
56cdf0e10cSrcweir         , ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xImportInfo );
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     enum SchXMLChartTypeEnum
59cdf0e10cSrcweir     {
60cdf0e10cSrcweir         XML_CHART_CLASS_LINE,
61cdf0e10cSrcweir         XML_CHART_CLASS_AREA,
62cdf0e10cSrcweir         XML_CHART_CLASS_CIRCLE,
63cdf0e10cSrcweir         XML_CHART_CLASS_RING,
64cdf0e10cSrcweir         XML_CHART_CLASS_SCATTER,
65cdf0e10cSrcweir         XML_CHART_CLASS_RADAR,
66cdf0e10cSrcweir         XML_CHART_CLASS_FILLED_RADAR,
67cdf0e10cSrcweir         XML_CHART_CLASS_BAR,
68cdf0e10cSrcweir         XML_CHART_CLASS_STOCK,
69cdf0e10cSrcweir         XML_CHART_CLASS_BUBBLE,
70cdf0e10cSrcweir         XML_CHART_CLASS_ADDIN,
71cdf0e10cSrcweir         XML_CHART_CLASS_UNKNOWN
72cdf0e10cSrcweir     };
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     SchXMLChartTypeEnum GetChartTypeEnum( const ::rtl::OUString& rClassName );
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     ::rtl::OUString GetChartTypeByClassName(
77cdf0e10cSrcweir         const ::rtl::OUString & rClassName, bool bUseOldNames );
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     ::xmloff::token::XMLTokenEnum getTokenByChartType(
80cdf0e10cSrcweir         const ::rtl::OUString & rChartTypeService, bool bUseOldNames );
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     ::rtl::OUString GetNewChartTypeName( const ::rtl::OUString & rOldChartTypeName );
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
85cdf0e10cSrcweir         ::com::sun::star::chart2::data::XLabeledDataSequence > GetNewLabeledDataSequence();
86cdf0e10cSrcweir 
87cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > CreateDataSequence(
88cdf0e10cSrcweir         const ::rtl::OUString& rRange,
89cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
90cdf0e10cSrcweir             ::com::sun::star::chart2::XChartDocument >& xChartDoc );
91cdf0e10cSrcweir 
92cdf0e10cSrcweir     void CreateCategories(
93cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > & xDataProvider,
94cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > & xNewDoc,
95cdf0e10cSrcweir         const ::rtl::OUString & rRangeAddress,
96cdf0e10cSrcweir         sal_Int32 nCooSysIndex,
97cdf0e10cSrcweir         sal_Int32 nDimensionIndex,
98cdf0e10cSrcweir         tSchXMLLSequencesPerIndex * pLSequencesPerIndex = 0 );
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     ::com::sun::star::uno::Any getPropertyFromContext( const ::rtl::OUString& rPropertyName, const XMLPropStyleContext * pPropStyleContext, const SvXMLStylesContext* pStylesCtxt );
101cdf0e10cSrcweir 
102cdf0e10cSrcweir     void exportText( SvXMLExport& rExport, const ::rtl::OUString& rText, bool bConvertTabsLFs );
103cdf0e10cSrcweir 
104cdf0e10cSrcweir     void exportRangeToSomewhere( SvXMLExport& rExport, const ::rtl::OUString& rValue );
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     /** returns the properties of the equation of the first regression curve
107cdf0e10cSrcweir         that is no mean-value line
108cdf0e10cSrcweir      */
109cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XRegressionCurve > getRegressionCurve(
110cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
111cdf0e10cSrcweir             ::com::sun::star::chart2::XDataSeries > & xDataSeries );
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     /** checks if the data sequence has the property "CachedXMLRange" (true for
114cdf0e10cSrcweir         internal data sequences), and if so sets this property to the range
115cdf0e10cSrcweir         given in rXMLRange
116cdf0e10cSrcweir      */
117cdf0e10cSrcweir     void setXMLRangePropertyAtDataSequence(
118cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
119cdf0e10cSrcweir             ::com::sun::star::chart2::data::XDataSequence > & xDataSequence,
120cdf0e10cSrcweir         const ::rtl::OUString & rXMLRange );
121cdf0e10cSrcweir 
122cdf0e10cSrcweir     /** checks if the data sequence has the property "CachedXMLRange" (true for
123cdf0e10cSrcweir         internal data sequences), and if so retrieves this property and applies
124cdf0e10cSrcweir         it to the range given in rOutXMLRange.
125cdf0e10cSrcweir 
126cdf0e10cSrcweir         @param bClearProp If true, the property is reset to its default after it
127cdf0e10cSrcweir                           was assigned to rOutXMLRange
128cdf0e10cSrcweir 
129cdf0e10cSrcweir         @return true, if the property was found, assigned and is non-empty
130cdf0e10cSrcweir      */
131cdf0e10cSrcweir     bool getXMLRangePropertyFromDataSequence(
132cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
133cdf0e10cSrcweir             ::com::sun::star::chart2::data::XDataSequence > & xDataSequence,
134cdf0e10cSrcweir         ::rtl::OUString & rOutXMLRange,
135cdf0e10cSrcweir         bool bClearProp = false );
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > getDataProviderFromParent( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc );
138cdf0e10cSrcweir 
139cdf0e10cSrcweir     bool switchBackToDataProviderFromParent( const ::com::sun::star::uno::Reference<
140cdf0e10cSrcweir         ::com::sun::star::chart2::XChartDocument >& xChartDoc
141cdf0e10cSrcweir         , const tSchXMLLSequencesPerIndex & rLSequencesPerIndex );
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     void copyProperties(
144cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xSource,
145cdf0e10cSrcweir         const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xDestination );
146cdf0e10cSrcweir }
147cdf0e10cSrcweir 
148cdf0e10cSrcweir #endif	// SCH_XML_TOOLS_HXX_
149