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