xref: /AOO41X/main/sc/inc/consoli.hxx (revision 38d50f7b14e1cf975d8c6468d9633894cd59b523)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_CONSOLI_HXX
25 #define SC_CONSOLI_HXX
26 
27 #include "global.hxx"
28 #include "address.hxx"
29 
30 class ScDocument;
31 
32 // -----------------------------------------------------------------------
33 
34 struct ScReferenceEntry             // ohne Constructor !
35 {
36     SCCOL   nCol;
37     SCROW   nRow;
38     SCTAB   nTab;
39 };
40 
41 
42 //!     Delta-Wert fuer Daten benutzen?
43 
44 class ScReferenceList           // ohne Constructor !
45 {
46 private:
47     SCSIZE              nCount;
48     SCSIZE              nFullSize;          // inkl. Fuell-Eintraege
49     ScReferenceEntry*   pData;
50 
51 public:
Init()52     void                    Init()                      { nCount=0; nFullSize=0; pData=NULL; }
Clear()53     void                    Clear()                     { delete[] pData; }
54 
GetCount()55     SCSIZE                  GetCount()                  { return nCount; }
GetEntry(SCSIZE nPos)56     const ScReferenceEntry& GetEntry( SCSIZE nPos )     { return pData[nPos]; }
SetFullSize(SCSIZE nNew)57     void                    SetFullSize( SCSIZE nNew )  { nFullSize = nNew; }
58 
59     void                    AddEntry( SCCOL nCol, SCROW nRow, SCTAB nTab );
60 };
61 
62 // -----------------------------------------------------------------------
63 
64 
65 //
66 //  Reihenfolge:
67 //      1)  ScConsData anlegen
68 //      2)  Parameter (Size/Flags)
69 //      3)  AddFields fuer alle Bereiche (nur noetig bei bColByName oder bRowByName)
70 //      4)  DoneFields                   (      "                       "          )
71 //      5)  AddData fuer alle Bereiche
72 //          evtl. AddName nach jedem Bereich
73 //      6)  OutputToDocument
74 //
75 
76 //! ab bestimmter Groesse ScDocument Struktur benutzen?
77 
78 
79 class ScConsData
80 {
81 private:
82     ScSubTotalFunc      eFunction;
83     sal_Bool                bReference;
84     sal_Bool                bColByName;
85     sal_Bool                bRowByName;
86     sal_Bool                bSubTitles;
87     SCSIZE              nColCount;
88     SCSIZE              nRowCount;
89     sal_Bool**              ppUsed;
90     double**            ppSum;
91     double**            ppCount;
92     double**            ppSumSqr;
93     ScReferenceList**   ppRefs;
94     String**            ppColHeaders;
95     String**            ppRowHeaders;
96     SCSIZE              nDataCount;
97     SCSIZE              nTitleCount;
98     String**            ppTitles;
99     SCSIZE**            ppTitlePos;
100     sal_Bool                bCornerUsed;
101     String              aCornerText;        // nur bei bColByName && bRowByName
102 
103 public:
104                 ScConsData();
105                 ~ScConsData();
106 
107     void        SetSize( SCCOL nCols, SCROW nRows );
108     void        SetFlags( ScSubTotalFunc eFunc, sal_Bool bColName, sal_Bool bRowName, sal_Bool bRef );
109 
110     void        InitData(sal_Bool bDelete=sal_True);
111     void        DeleteData();
112 
113     void        AddFields( ScDocument* pSrcDoc, SCTAB nTab,
114                             SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
115     void        DoneFields();
116 
117     void        AddData( ScDocument* pSrcDoc, SCTAB nTab,
118                             SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
119     void        AddName( const String& rName );
120 
121     void        OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow, SCTAB nTab );
122 
123     void        GetSize( SCCOL& rCols, SCROW& rRows ) const;
124     SCROW       GetInsertCount() const;
125 };
126 
127 
128 #endif
129 
130 
131