Branch data Line data Source code
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 : : #ifndef CHART2_INTERNALDATA_HXX
20 : : #define CHART2_INTERNALDATA_HXX
21 : :
22 : : #include <com/sun/star/uno/Sequence.hxx>
23 : :
24 : : #include <vector>
25 : : #include <valarray>
26 : :
27 : : namespace chart
28 : : {
29 : :
30 [ # # ][ # # ]: 71 : class InternalData
31 : : {
32 : : public:
33 : : InternalData();
34 : :
35 : : void createDefaultData();
36 : : bool isDefaultData();
37 : : void clearDefaultData();
38 : :
39 : : void setData( const ::com::sun::star::uno::Sequence<
40 : : ::com::sun::star::uno::Sequence< double > > & rDataInRows );
41 : : ::com::sun::star::uno::Sequence<
42 : : ::com::sun::star::uno::Sequence< double > > getData() const;
43 : :
44 : : ::com::sun::star::uno::Sequence< double > getColumnValues( sal_Int32 nColumnIndex ) const;
45 : : ::com::sun::star::uno::Sequence< double > getRowValues( sal_Int32 nRowIndex ) const;
46 : :
47 : : void setColumnValues( sal_Int32 nColumnIndex, const ::std::vector< double > & rNewData );
48 : : void setRowValues( sal_Int32 nRowIndex, const ::std::vector< double > & rNewData );
49 : :
50 : : void setComplexColumnLabel( sal_Int32 nColumnIndex, const ::std::vector< ::com::sun::star::uno::Any >& rComplexLabel );
51 : : void setComplexRowLabel( sal_Int32 nRowIndex, const ::std::vector< ::com::sun::star::uno::Any >& rComplexLabel );
52 : :
53 : : ::std::vector< ::com::sun::star::uno::Any > getComplexColumnLabel( sal_Int32 nColumnIndex ) const;
54 : : ::std::vector< ::com::sun::star::uno::Any > getComplexRowLabel( sal_Int32 nRowIndex ) const;
55 : :
56 : : void swapRowWithNext( sal_Int32 nRowIndex );
57 : : void swapColumnWithNext( sal_Int32 nColumnIndex );
58 : :
59 : : void insertColumn( sal_Int32 nAfterIndex );
60 : : void insertRow( sal_Int32 nAfterIndex );
61 : : void deleteColumn( sal_Int32 nAtIndex );
62 : : void deleteRow( sal_Int32 nAtIndex );
63 : :
64 : : /// @return the index of the newly appended column
65 : : sal_Int32 appendColumn();
66 : : /// @return the index of the newly appended row
67 : : sal_Int32 appendRow();
68 : :
69 : : sal_Int32 getRowCount() const;
70 : : sal_Int32 getColumnCount() const;
71 : :
72 : : typedef ::std::valarray< double > tDataType;
73 : : typedef ::std::vector< ::std::vector< ::com::sun::star::uno::Any > > tVecVecAny; //inner index is hierarchical level
74 : :
75 : : void setComplexRowLabels( const tVecVecAny& rNewRowLabels );
76 : : tVecVecAny getComplexRowLabels() const;
77 : : void setComplexColumnLabels( const tVecVecAny& rNewColumnLabels );
78 : : tVecVecAny getComplexColumnLabels() const;
79 : :
80 : : #if OSL_DEBUG_LEVEL > 1
81 : : void traceData() const;
82 : : #endif
83 : :
84 : : private: //methods
85 : : /** resizes the data if at least one of the given dimensions is larger than
86 : : before. The data is never becoming smaller only larger.
87 : :
88 : : @return </sal_True>, if the data was enlarged
89 : : */
90 : : bool enlargeData( sal_Int32 nColumnCount, sal_Int32 nRowCount );
91 : :
92 : : private:
93 : : sal_Int32 m_nColumnCount;
94 : : sal_Int32 m_nRowCount;
95 : :
96 : : tDataType m_aData;
97 : : tVecVecAny m_aRowLabels;//outer index is row index, inner index is category level
98 : : tVecVecAny m_aColumnLabels;//outer index is column index
99 : : };
100 : :
101 : : #endif
102 : :
103 : : } // namespace chart
104 : :
105 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|