merge the formfield patch from ooo-build
[ooovba.git] / connectivity / source / inc / calc / CConnection.hxx
bloba6e2d71ed91887513c8a1abb7e4a97ff233840a4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: CConnection.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _CONNECTIVITY_CALC_CONNECTION_HXX_
32 #define _CONNECTIVITY_CALC_CONNECTION_HXX_
34 #include "file/FConnection.hxx"
36 namespace com { namespace sun { namespace star { namespace sheet {
37 class XSpreadsheetDocument;
38 } } } }
41 namespace connectivity
43 namespace calc
45 class ODriver;
46 class OCalcConnection : public file::OConnection
48 // the spreadsheet document:
49 ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument > m_xDoc;
50 ::rtl::OUString m_sPassword;
51 String m_aFileName;
52 oslInterlockedCount m_nDocCount;
54 public:
55 OCalcConnection(ODriver* _pDriver);
56 virtual ~OCalcConnection();
58 virtual void construct(const ::rtl::OUString& _rUrl,
59 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rInfo )
60 throw( ::com::sun::star::sdbc::SQLException);
62 // XServiceInfo
63 DECLARE_SERVICE_INFO();
65 // OComponentHelper
66 virtual void SAL_CALL disposing(void);
68 // XConnection
69 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > SAL_CALL getMetaData( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
70 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > createCatalog();
71 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XStatement > SAL_CALL createStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
72 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
73 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const ::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
75 // no interface methods
76 ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument> acquireDoc();
77 void releaseDoc();
79 class ODocHolder
81 OCalcConnection* m_pConnection;
82 ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument> m_xDoc;
83 public:
84 ODocHolder(OCalcConnection* _pConnection) : m_pConnection(_pConnection)
86 m_xDoc = m_pConnection->acquireDoc();
88 ~ODocHolder()
90 m_xDoc.clear();
91 m_pConnection->releaseDoc();
93 ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument> getDoc() const { return m_xDoc; }
99 #endif // _CONNECTIVITY_CALC_CONNECTION_HXX_