1*de7b3f82SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*de7b3f82SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*de7b3f82SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*de7b3f82SAndrew Rist * distributed with this work for additional information 6*de7b3f82SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*de7b3f82SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*de7b3f82SAndrew Rist * "License"); you may not use this file except in compliance 9*de7b3f82SAndrew Rist * with the License. You may obtain a copy of the License at 10*de7b3f82SAndrew Rist * 11*de7b3f82SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*de7b3f82SAndrew Rist * 13*de7b3f82SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*de7b3f82SAndrew Rist * software distributed under the License is distributed on an 15*de7b3f82SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*de7b3f82SAndrew Rist * KIND, either express or implied. See the License for the 17*de7b3f82SAndrew Rist * specific language governing permissions and limitations 18*de7b3f82SAndrew Rist * under the License. 19*de7b3f82SAndrew Rist * 20*de7b3f82SAndrew Rist *************************************************************/ 21*de7b3f82SAndrew Rist 22*de7b3f82SAndrew Rist 23cdf0e10cSrcweir #ifndef CHART2_INTERNALDATA_HXX 24cdf0e10cSrcweir #define CHART2_INTERNALDATA_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <vector> 29cdf0e10cSrcweir #include <valarray> 30cdf0e10cSrcweir 31cdf0e10cSrcweir namespace chart 32cdf0e10cSrcweir { 33cdf0e10cSrcweir 34cdf0e10cSrcweir class InternalData 35cdf0e10cSrcweir { 36cdf0e10cSrcweir public: 37cdf0e10cSrcweir InternalData(); 38cdf0e10cSrcweir 39cdf0e10cSrcweir void createDefaultData(); 40cdf0e10cSrcweir 41cdf0e10cSrcweir void setData( const ::com::sun::star::uno::Sequence< 42cdf0e10cSrcweir ::com::sun::star::uno::Sequence< double > > & rDataInRows ); 43cdf0e10cSrcweir ::com::sun::star::uno::Sequence< 44cdf0e10cSrcweir ::com::sun::star::uno::Sequence< double > > getData() const; 45cdf0e10cSrcweir 46cdf0e10cSrcweir ::com::sun::star::uno::Sequence< double > getColumnValues( sal_Int32 nColumnIndex ) const; 47cdf0e10cSrcweir ::com::sun::star::uno::Sequence< double > getRowValues( sal_Int32 nRowIndex ) const; 48cdf0e10cSrcweir 49cdf0e10cSrcweir void setColumnValues( sal_Int32 nColumnIndex, const ::std::vector< double > & rNewData ); 50cdf0e10cSrcweir void setRowValues( sal_Int32 nRowIndex, const ::std::vector< double > & rNewData ); 51cdf0e10cSrcweir 52cdf0e10cSrcweir void setComplexColumnLabel( sal_Int32 nColumnIndex, const ::std::vector< ::com::sun::star::uno::Any >& rComplexLabel ); 53cdf0e10cSrcweir void setComplexRowLabel( sal_Int32 nRowIndex, const ::std::vector< ::com::sun::star::uno::Any >& rComplexLabel ); 54cdf0e10cSrcweir 55cdf0e10cSrcweir ::std::vector< ::com::sun::star::uno::Any > getComplexColumnLabel( sal_Int32 nColumnIndex ) const; 56cdf0e10cSrcweir ::std::vector< ::com::sun::star::uno::Any > getComplexRowLabel( sal_Int32 nRowIndex ) const; 57cdf0e10cSrcweir 58cdf0e10cSrcweir void swapRowWithNext( sal_Int32 nRowIndex ); 59cdf0e10cSrcweir void swapColumnWithNext( sal_Int32 nColumnIndex ); 60cdf0e10cSrcweir 61cdf0e10cSrcweir void insertColumn( sal_Int32 nAfterIndex ); 62cdf0e10cSrcweir void insertRow( sal_Int32 nAfterIndex ); 63cdf0e10cSrcweir void deleteColumn( sal_Int32 nAtIndex ); 64cdf0e10cSrcweir void deleteRow( sal_Int32 nAtIndex ); 65cdf0e10cSrcweir 66cdf0e10cSrcweir /// @return the index of the newly appended column 67cdf0e10cSrcweir sal_Int32 appendColumn(); 68cdf0e10cSrcweir /// @return the index of the newly appended row 69cdf0e10cSrcweir sal_Int32 appendRow(); 70cdf0e10cSrcweir 71cdf0e10cSrcweir sal_Int32 getRowCount() const; 72cdf0e10cSrcweir sal_Int32 getColumnCount() const; 73cdf0e10cSrcweir 74cdf0e10cSrcweir typedef ::std::valarray< double > tDataType; 75cdf0e10cSrcweir typedef ::std::vector< ::std::vector< ::com::sun::star::uno::Any > > tVecVecAny; //inner index is hierarchical level 76cdf0e10cSrcweir 77cdf0e10cSrcweir void setComplexRowLabels( const tVecVecAny& rNewRowLabels ); 78cdf0e10cSrcweir tVecVecAny getComplexRowLabels() const; 79cdf0e10cSrcweir void setComplexColumnLabels( const tVecVecAny& rNewColumnLabels ); 80cdf0e10cSrcweir tVecVecAny getComplexColumnLabels() const; 81cdf0e10cSrcweir 82cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 2 83cdf0e10cSrcweir void traceData() const; 84cdf0e10cSrcweir #endif 85cdf0e10cSrcweir 86cdf0e10cSrcweir private: //methods 87cdf0e10cSrcweir /** resizes the data if at least one of the given dimensions is larger than 88cdf0e10cSrcweir before. The data is never becoming smaller only larger. 89cdf0e10cSrcweir 90cdf0e10cSrcweir @return </sal_True>, if the data was enlarged 91cdf0e10cSrcweir */ 92cdf0e10cSrcweir bool enlargeData( sal_Int32 nColumnCount, sal_Int32 nRowCount ); 93cdf0e10cSrcweir 94cdf0e10cSrcweir private: 95cdf0e10cSrcweir sal_Int32 m_nColumnCount; 96cdf0e10cSrcweir sal_Int32 m_nRowCount; 97cdf0e10cSrcweir 98cdf0e10cSrcweir tDataType m_aData; 99cdf0e10cSrcweir tVecVecAny m_aRowLabels;//outer index is row index, inner index is category level 100cdf0e10cSrcweir tVecVecAny m_aColumnLabels;//outer index is column index 101cdf0e10cSrcweir }; 102cdf0e10cSrcweir 103cdf0e10cSrcweir #endif 104cdf0e10cSrcweir 105cdf0e10cSrcweir } // namespace chart 106