1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir #ifndef SCH_XML_TOOLS_HXX_ 28*cdf0e10cSrcweir #define SCH_XML_TOOLS_HXX_ 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #include <rtl/ustring.hxx> 31*cdf0e10cSrcweir #include <xmloff/xmltoken.hxx> 32*cdf0e10cSrcweir #include "transporttypes.hxx" 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp> 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir namespace com { namespace sun { namespace star { 37*cdf0e10cSrcweir namespace chart2 { 38*cdf0e10cSrcweir class XChartDocument; 39*cdf0e10cSrcweir class XRegressionCurve; 40*cdf0e10cSrcweir namespace data { 41*cdf0e10cSrcweir class XDataProvider; 42*cdf0e10cSrcweir class XLabeledDataSequence; 43*cdf0e10cSrcweir } 44*cdf0e10cSrcweir } 45*cdf0e10cSrcweir }}} 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir class XMLPropStyleContext; 48*cdf0e10cSrcweir class SvXMLStylesContext; 49*cdf0e10cSrcweir class SvXMLExport; 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir namespace SchXMLTools 52*cdf0e10cSrcweir { 53*cdf0e10cSrcweir bool isDocumentGeneratedWithOpenOfficeOlderThan2_0( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel); 54*cdf0e10cSrcweir bool isDocumentGeneratedWithOpenOfficeOlderThan2_3( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel); 55*cdf0e10cSrcweir bool isDocumentGeneratedWithOpenOfficeOlderThan2_4( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel); 56*cdf0e10cSrcweir bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel); 57*cdf0e10cSrcweir bool isDocumentGeneratedWithOpenOfficeOlderThan3_3( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel); 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir void setBuildIDAtImportInfo( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel 60*cdf0e10cSrcweir , ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xImportInfo ); 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir enum SchXMLChartTypeEnum 63*cdf0e10cSrcweir { 64*cdf0e10cSrcweir XML_CHART_CLASS_LINE, 65*cdf0e10cSrcweir XML_CHART_CLASS_AREA, 66*cdf0e10cSrcweir XML_CHART_CLASS_CIRCLE, 67*cdf0e10cSrcweir XML_CHART_CLASS_RING, 68*cdf0e10cSrcweir XML_CHART_CLASS_SCATTER, 69*cdf0e10cSrcweir XML_CHART_CLASS_RADAR, 70*cdf0e10cSrcweir XML_CHART_CLASS_FILLED_RADAR, 71*cdf0e10cSrcweir XML_CHART_CLASS_BAR, 72*cdf0e10cSrcweir XML_CHART_CLASS_STOCK, 73*cdf0e10cSrcweir XML_CHART_CLASS_BUBBLE, 74*cdf0e10cSrcweir XML_CHART_CLASS_ADDIN, 75*cdf0e10cSrcweir XML_CHART_CLASS_UNKNOWN 76*cdf0e10cSrcweir }; 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir SchXMLChartTypeEnum GetChartTypeEnum( const ::rtl::OUString& rClassName ); 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir ::rtl::OUString GetChartTypeByClassName( 81*cdf0e10cSrcweir const ::rtl::OUString & rClassName, bool bUseOldNames ); 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir ::xmloff::token::XMLTokenEnum getTokenByChartType( 84*cdf0e10cSrcweir const ::rtl::OUString & rChartTypeService, bool bUseOldNames ); 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir ::rtl::OUString GetNewChartTypeName( const ::rtl::OUString & rOldChartTypeName ); 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir ::com::sun::star::uno::Reference< 89*cdf0e10cSrcweir ::com::sun::star::chart2::data::XLabeledDataSequence > GetNewLabeledDataSequence(); 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > CreateDataSequence( 92*cdf0e10cSrcweir const ::rtl::OUString& rRange, 93*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 94*cdf0e10cSrcweir ::com::sun::star::chart2::XChartDocument >& xChartDoc ); 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir void CreateCategories( 97*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > & xDataProvider, 98*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > & xNewDoc, 99*cdf0e10cSrcweir const ::rtl::OUString & rRangeAddress, 100*cdf0e10cSrcweir sal_Int32 nCooSysIndex, 101*cdf0e10cSrcweir sal_Int32 nDimensionIndex, 102*cdf0e10cSrcweir tSchXMLLSequencesPerIndex * pLSequencesPerIndex = 0 ); 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir ::com::sun::star::uno::Any getPropertyFromContext( const ::rtl::OUString& rPropertyName, const XMLPropStyleContext * pPropStyleContext, const SvXMLStylesContext* pStylesCtxt ); 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir void exportText( SvXMLExport& rExport, const ::rtl::OUString& rText, bool bConvertTabsLFs ); 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir void exportRangeToSomewhere( SvXMLExport& rExport, const ::rtl::OUString& rValue ); 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir /** returns the properties of the equation of the first regression curve 111*cdf0e10cSrcweir that is no mean-value line 112*cdf0e10cSrcweir */ 113*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XRegressionCurve > getRegressionCurve( 114*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 115*cdf0e10cSrcweir ::com::sun::star::chart2::XDataSeries > & xDataSeries ); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir /** checks if the data sequence has the property "CachedXMLRange" (true for 118*cdf0e10cSrcweir internal data sequences), and if so sets this property to the range 119*cdf0e10cSrcweir given in rXMLRange 120*cdf0e10cSrcweir */ 121*cdf0e10cSrcweir void setXMLRangePropertyAtDataSequence( 122*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 123*cdf0e10cSrcweir ::com::sun::star::chart2::data::XDataSequence > & xDataSequence, 124*cdf0e10cSrcweir const ::rtl::OUString & rXMLRange ); 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir /** checks if the data sequence has the property "CachedXMLRange" (true for 127*cdf0e10cSrcweir internal data sequences), and if so retrieves this property and applies 128*cdf0e10cSrcweir it to the range given in rOutXMLRange. 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir @param bClearProp If true, the property is reset to its default after it 131*cdf0e10cSrcweir was assigned to rOutXMLRange 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir @return true, if the property was found, assigned and is non-empty 134*cdf0e10cSrcweir */ 135*cdf0e10cSrcweir bool getXMLRangePropertyFromDataSequence( 136*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 137*cdf0e10cSrcweir ::com::sun::star::chart2::data::XDataSequence > & xDataSequence, 138*cdf0e10cSrcweir ::rtl::OUString & rOutXMLRange, 139*cdf0e10cSrcweir bool bClearProp = false ); 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir ::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*cdf0e10cSrcweir 143*cdf0e10cSrcweir bool switchBackToDataProviderFromParent( const ::com::sun::star::uno::Reference< 144*cdf0e10cSrcweir ::com::sun::star::chart2::XChartDocument >& xChartDoc 145*cdf0e10cSrcweir , const tSchXMLLSequencesPerIndex & rLSequencesPerIndex ); 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir void copyProperties( 148*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xSource, 149*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xDestination ); 150*cdf0e10cSrcweir } 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir #endif // SCH_XML_TOOLS_HXX_ 153