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