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