Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_CONSOLI_HXX
30 : : #define SC_CONSOLI_HXX
31 : :
32 : : #include "global.hxx"
33 : : #include "address.hxx"
34 : :
35 : : class ScDocument;
36 : :
37 : : struct ScReferenceEntry // without constructor !
38 : : {
39 : : SCCOL nCol;
40 : : SCROW nRow;
41 : : SCTAB nTab;
42 : : };
43 : :
44 : :
45 : : //! Use delta value for data?
46 : :
47 : : class ScReferenceList // without constructor !
48 : : {
49 : : private:
50 : : SCSIZE nCount;
51 : : SCSIZE nFullSize; // incl. fill entries
52 : : ScReferenceEntry* pData;
53 : :
54 : : public:
55 : 0 : void Init() { nCount=0; nFullSize=0; pData=NULL; }
56 [ # # ]: 0 : void Clear() { delete[] pData; }
57 : :
58 : 0 : SCSIZE GetCount() { return nCount; }
59 : 0 : const ScReferenceEntry& GetEntry( SCSIZE nPos ) { return pData[nPos]; }
60 : 0 : void SetFullSize( SCSIZE nNew ) { nFullSize = nNew; }
61 : :
62 : : void AddEntry( SCCOL nCol, SCROW nRow, SCTAB nTab );
63 : : };
64 : :
65 : : //
66 : : // Sequence:
67 : : // 1) create ScConsData
68 : : // 2) Parameter (Size/Flags)
69 : : // 3) AddFields for all areas (only needed for bColByName or bRowByName)
70 : : // 4) DoneFields ( " " )
71 : : // 5) AddData for all areas
72 : : // perhaps AddName after each area
73 : : // 6) OutputToDocument
74 : : //
75 : :
76 : : //! Use structure ScDocument if a certain size is exceeded?
77 : :
78 : : class ScConsData
79 : : {
80 : : private:
81 : : ScSubTotalFunc eFunction;
82 : : sal_Bool bReference;
83 : : sal_Bool bColByName;
84 : : sal_Bool bRowByName;
85 : : sal_Bool bSubTitles;
86 : : SCSIZE nColCount;
87 : : SCSIZE nRowCount;
88 : : sal_Bool** ppUsed;
89 : : double** ppSum;
90 : : double** ppCount;
91 : : double** ppSumSqr;
92 : : ScReferenceList** ppRefs;
93 : : String** ppColHeaders;
94 : : String** ppRowHeaders;
95 : : SCSIZE nDataCount;
96 : : SCSIZE nTitleCount;
97 : : String** ppTitles;
98 : : SCSIZE** ppTitlePos;
99 : : sal_Bool bCornerUsed;
100 : : String aCornerText; // only for bColByName && bRowByName
101 : :
102 : : public:
103 : : ScConsData();
104 : : ~ScConsData();
105 : :
106 : : void SetSize( SCCOL nCols, SCROW nRows );
107 : : void SetFlags( ScSubTotalFunc eFunc, sal_Bool bColName, sal_Bool bRowName, sal_Bool bRef );
108 : :
109 : : void InitData(sal_Bool bDelete=sal_True);
110 : : void DeleteData();
111 : :
112 : : void AddFields( ScDocument* pSrcDoc, SCTAB nTab,
113 : : SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
114 : : void DoneFields();
115 : :
116 : : void AddData( ScDocument* pSrcDoc, SCTAB nTab,
117 : : SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
118 : : void AddName( const String& rName );
119 : :
120 : : void OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow, SCTAB nTab );
121 : :
122 : : void GetSize( SCCOL& rCols, SCROW& rRows ) const;
123 : : SCROW GetInsertCount() const;
124 : : };
125 : :
126 : :
127 : : #endif
128 : :
129 : :
130 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|