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 24 #ifndef OOX_DRAWINGML_CHART_SERIESCONVERTER_HXX 25 #define OOX_DRAWINGML_CHART_SERIESCONVERTER_HXX 26 27 #include "oox/drawingml/chart/converterbase.hxx" 28 #include "oox/drawingml/chart/seriesmodel.hxx" 29 30 namespace com { namespace sun { namespace star { 31 namespace chart2 { class XDataSeries; } 32 namespace chart2 { namespace data { class XLabeledDataSequence; } } 33 } } } 34 35 namespace oox { 36 namespace drawingml { 37 namespace chart { 38 39 class TypeGroupConverter; 40 41 // #i66858# enable this when Chart2 supports smoothed lines per data series 42 #define OOX_CHART_SMOOTHED_PER_SERIES 0 43 44 // ============================================================================ 45 46 class DataLabelConverter : public ConverterBase< DataLabelModel > 47 { 48 public: 49 explicit DataLabelConverter( const ConverterRoot& rParent, DataLabelModel& rModel ); 50 virtual ~DataLabelConverter(); 51 52 /** Converts OOXML data label settings for the passed data point. */ 53 void convertFromModel( 54 const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries, 55 const TypeGroupConverter& rTypeGroup ); 56 57 /** Conversion helper for data series and data points. */ 58 static void convertLabelFormatting( 59 PropertySet& rPropSet, 60 ObjectFormatter& rFormatter, 61 const DataLabelModelBase& rDataLabel, 62 const TypeGroupConverter& rTypeGroup, 63 bool bDataSeriesLabel ); 64 }; 65 66 // ============================================================================ 67 68 class DataLabelsConverter : public ConverterBase< DataLabelsModel > 69 { 70 public: 71 explicit DataLabelsConverter( const ConverterRoot& rParent, DataLabelsModel& rModel ); 72 virtual ~DataLabelsConverter(); 73 74 /** Converts OOXML data label settings for the passed data series. */ 75 void convertFromModel( 76 const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries, 77 const TypeGroupConverter& rTypeGroup ); 78 }; 79 80 // ============================================================================ 81 82 class ErrorBarConverter : public ConverterBase< ErrorBarModel > 83 { 84 public: 85 explicit ErrorBarConverter( const ConverterRoot& rParent, ErrorBarModel& rModel ); 86 virtual ~ErrorBarConverter(); 87 88 /** Converts an OOXML errorbar and inserts it into the passed data series. */ 89 void convertFromModel( 90 const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries ); 91 92 private: 93 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > 94 createLabeledDataSequence( ErrorBarModel::SourceType eSourceType ); 95 }; 96 97 // ============================================================================ 98 99 class TrendlineLabelConverter : public ConverterBase< TrendlineLabelModel > 100 { 101 public: 102 explicit TrendlineLabelConverter( const ConverterRoot& rParent, TrendlineLabelModel& rModel ); 103 virtual ~TrendlineLabelConverter(); 104 105 /** Converts the OOXML trendline label. */ 106 void convertFromModel( PropertySet& rPropSet ); 107 }; 108 109 // ============================================================================ 110 111 class TrendlineConverter : public ConverterBase< TrendlineModel > 112 { 113 public: 114 explicit TrendlineConverter( const ConverterRoot& rParent, TrendlineModel& rModel ); 115 virtual ~TrendlineConverter(); 116 117 /** Converts an OOXML trendline and inserts it into the passed data series. */ 118 void convertFromModel( 119 const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries ); 120 }; 121 122 // ============================================================================ 123 124 class DataPointConverter : public ConverterBase< DataPointModel > 125 { 126 public: 127 explicit DataPointConverter( const ConverterRoot& rParent, DataPointModel& rModel ); 128 virtual ~DataPointConverter(); 129 130 /** Converts settings for a data point in the passed series. */ 131 void convertFromModel( 132 const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries, 133 const TypeGroupConverter& rTypeGroup, 134 const SeriesModel& rSeries ); 135 }; 136 137 // ============================================================================ 138 139 class SeriesConverter : public ConverterBase< SeriesModel > 140 { 141 public: 142 explicit SeriesConverter( const ConverterRoot& rParent, SeriesModel& rModel ); 143 virtual ~SeriesConverter(); 144 145 /** Creates a labeled data sequence object from category data link. */ 146 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > 147 createCategorySequence( const ::rtl::OUString& rRole ); 148 /** Creates a labeled data sequence object from value data link. */ 149 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > 150 createValueSequence( const ::rtl::OUString& rRole ); 151 /** Creates a data series object with initialized source links. */ 152 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > 153 createDataSeries( const TypeGroupConverter& rTypeGroup, bool bVaryColorsByPoint ); 154 155 private: 156 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > 157 createLabeledDataSequence( 158 SeriesModel::SourceType eSourceType, 159 const ::rtl::OUString& rRole, 160 bool bUseTextLabel ); 161 }; 162 163 // ============================================================================ 164 165 } // namespace chart 166 } // namespace drawingml 167 } // namespace oox 168 169 #endif 170