xref: /aoo41x/main/sc/inc/dpsdbtab.hxx (revision cdf0e10c)
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_DPSDBTAB_HXX
29 #define SC_DPSDBTAB_HXX
30 
31 #include <com/sun/star/uno/Reference.hxx>
32 
33 #include "dptabdat.hxx"
34 
35 #include <vector>
36 #include <set>
37 
38 class ScDPCacheTable;
39 class ScDocument;
40 
41 // --------------------------------------------------------------------
42 //
43 //	implementation of ScDPTableData with database data
44 //
45 
46 struct ScImportSourceDesc
47 {
48 	String	aDBName;
49 	String	aObject;
50 	sal_uInt16	nType;			// enum DataImportMode
51 	sal_Bool	bNative;
52 
53     ScImportSourceDesc() : nType(0), bNative(sal_False) {}
54 
55 	sal_Bool operator==	( const ScImportSourceDesc& rOther ) const
56 		{ return aDBName == rOther.aDBName &&
57 				 aObject == rOther.aObject &&
58 				 nType   == rOther.nType &&
59 				 bNative == rOther.bNative; }
60 
61         // Wang Xu Ming -- 2009-9-15
62         // DataPilot Migration - Cache&&Performance
63 	ScDPTableDataCache* GetExistDPObjectCache( ScDocument* pDoc ) const;
64 	ScDPTableDataCache* CreateCache(  ScDocument* pDoc , long nID  ) const;
65 	ScDPTableDataCache* GetCache( ScDocument* pDoc, long nID ) const;
66 	long	GetCacheId( ScDocument* pDoc, long nID ) const;
67         // End Comments
68 };
69 
70 class ScDatabaseDPData : public ScDPTableData
71 {
72 private:
73 	 ScDPCacheTable      aCacheTable;
74 public:
75                     ScDatabaseDPData(ScDocument* pDoc, const ScImportSourceDesc& rImport, long nCacheId = -1);
76 	virtual			~ScDatabaseDPData();
77 
78 	virtual long					GetColumnCount();
79 	virtual String					getDimensionName(long nColumn);
80 	virtual sal_Bool					getIsDataLayoutDimension(long nColumn);
81 	virtual sal_Bool					IsDateDimension(long nDim);
82 	virtual void					DisposeData();
83 	virtual void					SetEmptyFlags( sal_Bool bIgnoreEmptyRows, sal_Bool bRepeatIfEmpty );
84 
85     virtual void                    CreateCacheTable();
86     virtual void                    FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, const ::std::hash_set<sal_Int32>& rDataDims);
87     virtual void                    GetDrillDownData(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria,
88                                                      const ::std::hash_set<sal_Int32>& rCatDims,
89                                                      ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& rData);
90     virtual void                    CalcResults(CalcInfo& rInfo, bool bAutoShow);
91     virtual const ScDPCacheTable&   GetCacheTable() const;
92 };
93 
94 
95 
96 #endif
97 
98