cid#1634585 Use of auto that causes a copy
[libreoffice.git] / chart2 / source / inc / InternalData.hxx
blob9d9abeb3a7c047170e474bf8e66ebac0b73a15fe
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #pragma once
21 #include <com/sun/star/uno/Sequence.hxx>
23 #include <vector>
24 #include <valarray>
26 namespace chart
29 class InternalData
31 public:
32 InternalData();
34 void createDefaultData();
36 void setData( const css::uno::Sequence< css::uno::Sequence< double > > & rDataInRows );
37 css::uno::Sequence< css::uno::Sequence< double > > getData() const;
39 css::uno::Sequence< double > getColumnValues( sal_Int32 nColumnIndex ) const;
40 css::uno::Sequence< double > getRowValues( sal_Int32 nRowIndex ) const;
42 void setColumnValues( sal_Int32 nColumnIndex, const std::vector< double > & rNewData );
43 void setRowValues( sal_Int32 nRowIndex, const std::vector< double > & rNewData );
45 void setComplexColumnLabel( sal_Int32 nColumnIndex, std::vector< css::uno::Any >&& rComplexLabel );
46 void setComplexRowLabel( sal_Int32 nRowIndex, std::vector< css::uno::Any >&& rComplexLabel );
48 std::vector< css::uno::Any > getComplexColumnLabel( sal_Int32 nColumnIndex ) const;
49 std::vector< css::uno::Any > getComplexRowLabel( sal_Int32 nRowIndex ) const;
51 void swapRowWithNext( sal_Int32 nRowIndex );
52 void swapColumnWithNext( sal_Int32 nColumnIndex );
54 void insertColumn( sal_Int32 nAfterIndex );
55 void insertRow( sal_Int32 nAfterIndex );
56 void deleteColumn( sal_Int32 nAtIndex );
57 void deleteRow( sal_Int32 nAtIndex );
59 /// @return the index of the newly appended column
60 sal_Int32 appendColumn();
61 /// @return the index of the newly appended row
62 sal_Int32 appendRow();
64 sal_Int32 getRowCount() const;
65 sal_Int32 getColumnCount() const;
67 typedef std::vector< std::vector< css::uno::Any > > tVecVecAny; //inner index is hierarchical level
69 void setComplexRowLabels( tVecVecAny&& rNewRowLabels );
70 const tVecVecAny& getComplexRowLabels() const;
71 void setComplexColumnLabels( tVecVecAny&& rNewColumnLabels );
72 const tVecVecAny& getComplexColumnLabels() const;
74 void dump() const;
76 private: //methods
77 /** resizes the data if at least one of the given dimensions is larger than
78 before. The data is never becoming smaller only larger.
80 @return </true>, if the data was enlarged
82 bool enlargeData( sal_Int32 nColumnCount, sal_Int32 nRowCount );
84 private:
85 sal_Int32 m_nColumnCount;
86 sal_Int32 m_nRowCount;
88 typedef std::valarray< double > tDataType;
89 tDataType m_aData;
90 tVecVecAny m_aRowLabels;//outer index is row index, inner index is category level
91 tVecVecAny m_aColumnLabels;//outer index is column index
94 } // namespace chart
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */