merged tag ooo/OOO330_m14
[LibreOffice.git] / sc / inc / dptablecache.hxx
blob953c793093beea8204f16d848198649292f496bf
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright IBM Corporation 2009.
6 * Copyright 2009 by Sun Microsystems, Inc.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * $RCSfile: dptablecache.hxx,v $
11 * $Revision: 1.0 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
31 #ifndef DPTABLECACHE_HXX
32 #define DPTABLECACHE_HXX
33 // Wang Xu Ming -- 12/21/2008
34 // Add Data Cache Support.
35 #ifndef SC_SCGLOB_HXX
36 #include "global.hxx"
37 #endif
38 //Added by PengYunQuan for SODC_16015
39 #include <svl/zforlist.hxx>
40 //end
41 #include <vector>
42 #include "dpglobal.hxx"
44 #include <com/sun/star/sdbc/DataType.hpp>
45 #include <com/sun/star/sdbc/XRow.hpp>
46 #include <com/sun/star/sdbc/XRowSet.hpp>
48 class ScDPTableDataCache;
49 class TypedStrData;
50 struct ScQueryParam;
52 // --------------------------------------------------------------------
54 // base class ScDPTableData to allow implementation with tabular data
55 // by deriving only of this
58 class SC_DLLPUBLIC ScDPTableDataCache
60 long mnID;
61 ScDocument* mpDoc;
63 long mnColumnCount; // Column count
65 std::vector<ScDPItemData*>* mpTableDataValues; //Data Pilot Table's index - value map
66 std::vector<SCROW>* mpSourceData; //Data Pilot Table's Source data
67 std::vector<SCROW>* mpGlobalOrder; //Sorted members index
68 std::vector<SCROW>* mpIndexOrder; //Index the sorted number
69 std::vector<ScDPItemData*> mrLabelNames; //Source Label data
70 std::vector<BOOL> mbEmptyRow; //If empty row?
71 mutable ScDPItemDataPool maAdditionalDatas;
72 public:
73 SCROW GetOrder( long nDim, SCROW nIndex ) const;
74 SCROW GetIdByItemData( long nDim, String sItemData ) const;
75 SCROW GetIdByItemData( long nDim, const ScDPItemData& rData ) const;
77 SCROW GetAdditionalItemID ( String sItemData );
78 SCROW GetAdditionalItemID( const ScDPItemData& rData );
80 SCCOL GetDimensionIndex( String sName) const;
81 const ScDPItemData* GetSortedItemData( SCCOL nDim, SCROW nOrder ) const;
82 ULONG GetNumType ( ULONG nFormat ) const;
83 ULONG GetNumberFormat( long nDim ) const;
84 BOOL IsDateDimension( long nDim ) const ;
85 ULONG GetDimNumType( SCCOL nDim) const;
86 SCROW GetDimMemberCount( SCCOL nDim ) const;
88 SCROW GetSortedItemDataId( SCCOL nDim, SCROW nOrder ) const;
89 const std::vector<ScDPItemData*>& GetDimMemberValues( SCCOL nDim )const;
90 void SetId( long nId ){ mnID = nId;}
91 void AddRow( ScDPItemData* pRow, USHORT nCount );
92 bool InitFromDoc( ScDocument* pDoc, const ScRange& rRange );
93 bool InitFromDataBase (const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& xRowSet, const Date& rNullDate);
95 SCROW GetRowCount() const;
96 SCROW GetItemDataId( USHORT nDim, SCROW nRow, BOOL bRepeatIfEmpty ) const;
97 String GetDimensionName( USHORT nColumn ) const;
98 bool IsEmptyMember( SCROW nRow, USHORT nColumn ) const;
99 bool IsRowEmpty( SCROW nRow ) const;
100 bool IsValid() const;
101 bool ValidQuery( SCROW nRow, const ScQueryParam& rQueryParam, BOOL* pSpecial );
103 ScDocument* GetDoc() const;//ms-cache-core
104 long GetColumnCount() const;
105 long GetId() const;
107 const ScDPItemData* GetItemDataById( long nDim, SCROW nId ) const;
109 BOOL operator== ( const ScDPTableDataCache& r ) const;
111 //construction
112 ScDPTableDataCache( ScDocument* pDoc );
113 //deconstruction
114 virtual ~ScDPTableDataCache();
116 protected:
117 private:
118 void AddLabel( ScDPItemData* pData);
119 BOOL AddData( long nDim, ScDPItemData* itemData );
122 #endif //DPTABLECACHE_HXX