1*caf5cd79SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*caf5cd79SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*caf5cd79SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*caf5cd79SAndrew Rist  * distributed with this work for additional information
6*caf5cd79SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*caf5cd79SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*caf5cd79SAndrew Rist  * "License"); you may not use this file except in compliance
9*caf5cd79SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*caf5cd79SAndrew Rist  *
11*caf5cd79SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*caf5cd79SAndrew Rist  *
13*caf5cd79SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*caf5cd79SAndrew Rist  * software distributed under the License is distributed on an
15*caf5cd79SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*caf5cd79SAndrew Rist  * KIND, either express or implied.  See the License for the
17*caf5cd79SAndrew Rist  * specific language governing permissions and limitations
18*caf5cd79SAndrew Rist  * under the License.
19*caf5cd79SAndrew Rist  *
20*caf5cd79SAndrew Rist  *************************************************************/
21*caf5cd79SAndrew Rist 
22*caf5cd79SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _CONNECTIVITY_CALC_TABLE_HXX_
25cdf0e10cSrcweir #define _CONNECTIVITY_CALC_TABLE_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "file/FTable.hxx"
28cdf0e10cSrcweir #include <tools/date.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace sheet {
31cdf0e10cSrcweir 	class XSpreadsheet;
32cdf0e10cSrcweir     class XSpreadsheetDocument;
33cdf0e10cSrcweir } } } }
34cdf0e10cSrcweir 
35cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace util {
36cdf0e10cSrcweir 	class XNumberFormats;
37cdf0e10cSrcweir } } } }
38cdf0e10cSrcweir 
39cdf0e10cSrcweir 
40cdf0e10cSrcweir namespace connectivity
41cdf0e10cSrcweir {
42cdf0e10cSrcweir 	namespace calc
43cdf0e10cSrcweir 	{
44cdf0e10cSrcweir 		typedef file::OFileTable OCalcTable_BASE;
45cdf0e10cSrcweir 		class OCalcConnection;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir 		typedef ::std::map< ::rtl::OUString,
48cdf0e10cSrcweir 						::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed>,
49cdf0e10cSrcweir 						comphelper::UStringMixLess > OContainer;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 		class OCalcTable :	public OCalcTable_BASE
52cdf0e10cSrcweir 		{
53cdf0e10cSrcweir 		private:
54cdf0e10cSrcweir 			::std::vector<sal_Int32> m_aTypes;		// holds all type for columns just to avoid to ask the propertyset
55cdf0e10cSrcweir 			::std::vector<sal_Int32> m_aPrecisions;	// same as aboth
56cdf0e10cSrcweir 			::std::vector<sal_Int32> m_aScales;
57cdf0e10cSrcweir 			::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet >           m_xSheet;
58cdf0e10cSrcweir             OCalcConnection* m_pConnection;
59cdf0e10cSrcweir 			sal_Int32 m_nStartCol;
60cdf0e10cSrcweir 			sal_Int32 m_nStartRow;
61cdf0e10cSrcweir 			sal_Int32 m_nDataCols;
62cdf0e10cSrcweir 			sal_Int32 m_nDataRows;
63cdf0e10cSrcweir 			sal_Bool m_bHasHeaders;
64cdf0e10cSrcweir 			::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats > m_xFormats;
65cdf0e10cSrcweir 			::Date m_aNullDate;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 			void fillColumns();
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 		protected:
70cdf0e10cSrcweir 			virtual void FileClose();
71cdf0e10cSrcweir 		public:
72cdf0e10cSrcweir 			virtual void refreshColumns();
73cdf0e10cSrcweir 			virtual void refreshIndexes();
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 		public:
76cdf0e10cSrcweir 			OCalcTable( sdbcx::OCollection* _pTables,OCalcConnection* _pConnection,
77cdf0e10cSrcweir 					const ::rtl::OUString& _Name,
78cdf0e10cSrcweir 					const ::rtl::OUString& _Type,
79cdf0e10cSrcweir 					const ::rtl::OUString& _Description = ::rtl::OUString(),
80cdf0e10cSrcweir 					const ::rtl::OUString& _SchemaName = ::rtl::OUString(),
81cdf0e10cSrcweir 					const ::rtl::OUString& _CatalogName = ::rtl::OUString()
82cdf0e10cSrcweir 				);
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 			virtual sal_Int32 getCurrentLastPos() const;
85cdf0e10cSrcweir 			virtual sal_Bool seekRow(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, sal_Int32& nCurPos);
86cdf0e10cSrcweir 			virtual sal_Bool fetchRow(OValueRefRow& _rRow,const OSQLColumns& _rCols, sal_Bool _bUseTableDefs,sal_Bool bRetrieveData);
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 			virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
89cdf0e10cSrcweir 			//XTypeProvider
90cdf0e10cSrcweir 			virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
91cdf0e10cSrcweir 			virtual void SAL_CALL disposing(void);
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 			// com::sun::star::lang::XUnoTunnel
94cdf0e10cSrcweir 			virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
95cdf0e10cSrcweir 			static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
96cdf0e10cSrcweir 
97cdf0e10cSrcweir             void construct();
98cdf0e10cSrcweir 		};
99cdf0e10cSrcweir 	}
100cdf0e10cSrcweir }
101cdf0e10cSrcweir 
102cdf0e10cSrcweir #endif // _CONNECTIVITY_CALC_TABLE_HXX_
103cdf0e10cSrcweir 
104