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