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 :
20 : #ifndef INCLUDED_SC_INC_CONSOLI_HXX
21 : #define INCLUDED_SC_INC_CONSOLI_HXX
22 :
23 : #include "global.hxx"
24 : #include "address.hxx"
25 :
26 : class ScDocument;
27 :
28 : struct ScReferenceEntry // without constructor !
29 : {
30 : SCCOL nCol;
31 : SCROW nRow;
32 : SCTAB nTab;
33 : };
34 :
35 : //! Use delta value for data?
36 :
37 : class ScReferenceList // without constructor !
38 : {
39 : private:
40 : SCSIZE nCount;
41 : SCSIZE nFullSize; // incl. fill entries
42 : ScReferenceEntry* pData;
43 :
44 : public:
45 0 : void Init() { nCount=0; nFullSize=0; pData=NULL; }
46 0 : void Clear() { delete[] pData; }
47 :
48 0 : SCSIZE GetCount() { return nCount; }
49 0 : const ScReferenceEntry& GetEntry( SCSIZE nPos ) { return pData[nPos]; }
50 0 : void SetFullSize( SCSIZE nNew ) { nFullSize = nNew; }
51 :
52 : void AddEntry( SCCOL nCol, SCROW nRow, SCTAB nTab );
53 : };
54 :
55 : // Sequence:
56 : // 1) create ScConsData
57 : // 2) Parameter (Size/Flags)
58 : // 3) AddFields for all areas (only needed for bColByName or bRowByName)
59 : // 4) DoneFields ( " " )
60 : // 5) AddData for all areas
61 : // perhaps AddName after each area
62 : // 6) OutputToDocument
63 :
64 : //! Use structure ScDocument if a certain size is exceeded?
65 :
66 : class ScConsData
67 : {
68 : private:
69 : ScSubTotalFunc eFunction;
70 : bool bReference;
71 : bool bColByName;
72 : bool bRowByName;
73 : SCSIZE nColCount;
74 : SCSIZE nRowCount;
75 : bool** ppUsed;
76 : double** ppSum;
77 : double** ppCount;
78 : double** ppSumSqr;
79 : ScReferenceList** ppRefs;
80 : ::std::vector<OUString> maColHeaders;
81 : ::std::vector<OUString> maRowHeaders;
82 : ::std::vector<OUString> maTitles;
83 : SCSIZE nDataCount;
84 : SCSIZE** ppTitlePos;
85 : bool bCornerUsed;
86 : OUString aCornerText; // only for bColByName && bRowByName
87 :
88 : public:
89 : ScConsData();
90 : ~ScConsData();
91 :
92 : void SetSize( SCCOL nCols, SCROW nRows );
93 : void SetFlags( ScSubTotalFunc eFunc, bool bColName, bool bRowName, bool bRef );
94 :
95 : void InitData();
96 : void DeleteData();
97 :
98 : void AddFields( ScDocument* pSrcDoc, SCTAB nTab,
99 : SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
100 : void DoneFields();
101 :
102 : void AddData( ScDocument* pSrcDoc, SCTAB nTab,
103 : SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
104 : void AddName( const OUString& rName );
105 :
106 : void OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow, SCTAB nTab );
107 :
108 : void GetSize( SCCOL& rCols, SCROW& rRows ) const;
109 : SCROW GetInsertCount() const;
110 : };
111 :
112 : #endif
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|