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 _CONNECTIVITY_CALC_TABLE_HXX_
29 #define _CONNECTIVITY_CALC_TABLE_HXX_
30 
31 #include "file/FTable.hxx"
32 #include <tools/date.hxx>
33 
34 namespace com { namespace sun { namespace star { namespace sheet {
35 	class XSpreadsheet;
36     class XSpreadsheetDocument;
37 } } } }
38 
39 namespace com { namespace sun { namespace star { namespace util {
40 	class XNumberFormats;
41 } } } }
42 
43 
44 namespace connectivity
45 {
46 	namespace calc
47 	{
48 		typedef file::OFileTable OCalcTable_BASE;
49 		class OCalcConnection;
50 
51 		typedef ::std::map< ::rtl::OUString,
52 						::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed>,
53 						comphelper::UStringMixLess > OContainer;
54 
55 		class OCalcTable :	public OCalcTable_BASE
56 		{
57 		private:
58 			::std::vector<sal_Int32> m_aTypes;		// holds all type for columns just to avoid to ask the propertyset
59 			::std::vector<sal_Int32> m_aPrecisions;	// same as aboth
60 			::std::vector<sal_Int32> m_aScales;
61 			::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet >           m_xSheet;
62             OCalcConnection* m_pConnection;
63 			sal_Int32 m_nStartCol;
64 			sal_Int32 m_nStartRow;
65 			sal_Int32 m_nDataCols;
66 			sal_Int32 m_nDataRows;
67 			sal_Bool m_bHasHeaders;
68 			::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats > m_xFormats;
69 			::Date m_aNullDate;
70 
71 			void fillColumns();
72 
73 		protected:
74 			virtual void FileClose();
75 		public:
76 			virtual void refreshColumns();
77 			virtual void refreshIndexes();
78 
79 		public:
80 			OCalcTable( sdbcx::OCollection* _pTables,OCalcConnection* _pConnection,
81 					const ::rtl::OUString& _Name,
82 					const ::rtl::OUString& _Type,
83 					const ::rtl::OUString& _Description = ::rtl::OUString(),
84 					const ::rtl::OUString& _SchemaName = ::rtl::OUString(),
85 					const ::rtl::OUString& _CatalogName = ::rtl::OUString()
86 				);
87 
88 			virtual sal_Int32 getCurrentLastPos() const;
89 			virtual sal_Bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos);
90 			virtual sal_Bool fetchRow(OValueRefRow& _rRow,const OSQLColumns& _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData);
91 
92 			virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
93 			//XTypeProvider
94 			virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
95 			virtual void SAL_CALL disposing(void);
96 
97 			// com::sun::star::lang::XUnoTunnel
98 			virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
99 			static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
100 
101             void construct();
102 		};
103 	}
104 }
105 
106 #endif // _CONNECTIVITY_CALC_TABLE_HXX_
107 
108