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