1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 5 * This Source Code Form is subject to the terms of the Mozilla Public 6 * License, v. 2.0. If a copy of the MPL was not distributed with this 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 11 * Licensed to the Apache Software Foundation (ASF) under one or more 12 * contributor license agreements. See the NOTICE file distributed 13 * with this work for additional information regarding copyright 14 * ownership. The ASF licenses this file to you under the Apache 15 * License, Version 2.0 (the "License"); you may not use this file 16 * except in compliance with the License. You may obtain a copy of 17 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 18 */ 19 #pragma once 20 21 #include <com/sun/star/chart2/XDataSeries.hpp> 22 #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp> 23 24 #include <vector> 25 #include <map> 26 #include <optional> 27 28 enum SchXMLCellType 29 { 30 SCH_CELL_TYPE_UNKNOWN, 31 SCH_CELL_TYPE_FLOAT, 32 SCH_CELL_TYPE_STRING, 33 SCH_CELL_TYPE_COMPLEX_STRING 34 }; 35 36 struct SchXMLCell 37 { 38 OUString aString; 39 css::uno::Sequence< OUString > aComplexString; 40 double fValue; 41 SchXMLCellType eType; 42 OUString aRangeId; 43 SchXMLCellSchXMLCell44 SchXMLCell(): fValue( 0.0 ), eType( SCH_CELL_TYPE_UNKNOWN ) 45 {} 46 }; 47 48 struct SchXMLTable 49 { 50 std::vector< std::vector< SchXMLCell > > aData; /// an array of rows containing the table contents 51 52 sal_Int32 nRowIndex; /// reflects the index of the row currently parsed 53 sal_Int32 nColumnIndex; /// reflects the index of the column currently parsed 54 sal_Int32 nMaxColumnIndex; /// the greatest number of columns detected 55 56 sal_Int32 nNumberOfColsEstimate; /// parsing column-elements may yield an estimate 57 58 bool bHasHeaderRow; 59 bool bHasHeaderColumn; 60 61 OUString aTableNameOfFile; /// the table name read at the table:table element 62 63 ::std::vector< sal_Int32 > aHiddenColumns; 64 65 bool bProtected; 66 SchXMLTableSchXMLTable67 SchXMLTable() : nRowIndex( -1 ), 68 nColumnIndex( -1 ), 69 nMaxColumnIndex( -1 ), 70 nNumberOfColsEstimate( 0 ), 71 bHasHeaderRow( false ), 72 bHasHeaderColumn( false ), 73 bProtected( false ) 74 {} 75 }; 76 77 typedef sal_Int32 tSchXMLIndex; 78 #define SCH_XML_CATEGORIES_INDEX (static_cast<tSchXMLIndex>(-1)) 79 enum SchXMLLabeledSequencePart 80 { 81 SCH_XML_PART_LABEL, 82 SCH_XML_PART_VALUES, 83 SCH_XML_PART_ERROR_BARS 84 }; 85 typedef ::std::pair< tSchXMLIndex, SchXMLLabeledSequencePart > tSchXMLIndexWithPart; 86 typedef ::std::multimap< tSchXMLIndexWithPart, 87 css::uno::Reference< css::chart2::data::XLabeledDataSequence > > 88 tSchXMLLSequencesPerIndex; 89 90 bool operator < ( const tSchXMLIndexWithPart & rFirst, const tSchXMLIndexWithPart & rSecond ); 91 92 enum SchXMLAxisDimension 93 { 94 SCH_XML_AXIS_X = 0, 95 SCH_XML_AXIS_Y, 96 SCH_XML_AXIS_Z, 97 SCH_XML_AXIS_UNDEF 98 }; 99 100 struct SchXMLAxis 101 { 102 enum SchXMLAxisDimension eDimension; 103 sal_Int8 nAxisIndex;//0->primary axis; 1->secondary axis 104 OUString aName; 105 OUString aTitle; 106 bool bHasCategories; 107 SchXMLAxisSchXMLAxis108 SchXMLAxis() : eDimension( SCH_XML_AXIS_UNDEF ), nAxisIndex( 0 ), bHasCategories( false ) {} 109 }; 110 111 struct GlobalSeriesImportInfo 112 { GlobalSeriesImportInfoGlobalSeriesImportInfo113 explicit GlobalSeriesImportInfo( bool& rAllRangeAddressesAvailable ) 114 : rbAllRangeAddressesAvailable( rAllRangeAddressesAvailable ) 115 , nCurrentDataIndex( 0 ) 116 , nFirstFirstDomainIndex( -1 ) 117 , nFirstSecondDomainIndex( -1 ) 118 {} 119 120 bool& rbAllRangeAddressesAvailable; 121 122 sal_Int32 nCurrentDataIndex; 123 124 OUString aFirstFirstDomainAddress; 125 sal_Int32 nFirstFirstDomainIndex; 126 127 OUString aFirstSecondDomainAddress; 128 sal_Int32 nFirstSecondDomainIndex; 129 }; 130 131 struct RegressionStyle 132 { 133 css::uno::Reference< 134 css::chart2::XDataSeries > m_xSeries; 135 css::uno::Reference< 136 css::beans::XPropertySet > m_xEquationProperties; 137 138 OUString msStyleName; 139 RegressionStyleRegressionStyle140 RegressionStyle(const css::uno::Reference< 141 css::chart2::XDataSeries >& xSeries, 142 const OUString& sStyleName) : 143 m_xSeries ( xSeries ), 144 msStyleName ( sStyleName ) 145 {} 146 }; 147 148 struct DataRowPointStyle 149 { 150 enum StyleType 151 { 152 DATA_POINT, 153 DATA_SERIES, 154 MEAN_VALUE, 155 ERROR_INDICATOR, 156 DATA_LABEL_POINT, 157 DATA_LABEL_SERIES 158 }; 159 160 StyleType meType; 161 css::uno::Reference< css::chart2::XDataSeries > m_xSeries; 162 163 css::uno::Reference< css::beans::XPropertySet > m_xOldAPISeries; 164 165 css::uno::Reference< css::beans::XPropertySet > m_xErrorXProperties; 166 167 css::uno::Reference< css::beans::XPropertySet > m_xErrorYProperties; 168 169 sal_Int32 m_nPointIndex; 170 sal_Int32 m_nPointRepeat; 171 OUString msStyleName; 172 OUString msStyleNameOfParent; // e.g. target of line and fill styles of data-labels 173 ::std::vector<OUString> mCustomLabels; 174 double mCustomLabelPos[2] = { 0.0, 0.0 }; 175 // for svg:x and svg:y attribute (in core unit), of element <chart:data-label> 176 std::optional<sal_Int32> mo_nLabelAbsolutePosX; 177 std::optional<sal_Int32> mo_nLabelAbsolutePosY; 178 OUString msSeriesStyleNameForDonuts; 179 180 sal_Int32 mnAttachedAxis; 181 bool mbSymbolSizeForSeriesIsMissingInFile; 182 DataRowPointStyleDataRowPointStyle183 DataRowPointStyle( StyleType eType 184 , const css::uno::Reference< css::chart2::XDataSeries >& xSeries 185 , sal_Int32 nPointIndex 186 , sal_Int32 nPointRepeat 187 , const OUString& sStyleName 188 , sal_Int32 nAttachedAxis = 0 ) : 189 meType( eType ), 190 m_xSeries( xSeries ), 191 m_nPointIndex( nPointIndex ), 192 m_nPointRepeat( nPointRepeat ), 193 msStyleName( sStyleName ), 194 mnAttachedAxis( nAttachedAxis ), 195 mbSymbolSizeForSeriesIsMissingInFile( false ) 196 {} 197 198 // ctor for use in import of <chart:data-label> as child of <chart:series> DataRowPointStyleDataRowPointStyle199 DataRowPointStyle(StyleType eType, const OUString& sStyleName, sal_Int32 nAttachedAxis = 0) 200 : meType(eType) 201 , m_nPointIndex(0) 202 , m_nPointRepeat(0) 203 , msStyleName(sStyleName) 204 , mnAttachedAxis(nAttachedAxis) 205 , mbSymbolSizeForSeriesIsMissingInFile(false) 206 { 207 } 208 }; 209 210 typedef ::std::multimap< OUString, css::uno::Reference< 211 css::chart2::data::XDataSequence > > tSchXMLRangeSequenceMap; 212 213 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 214