1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: CConnection.hxx,v $
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
;
41 namespace connectivity
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
;
52 oslInterlockedCount m_nDocCount
;
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
);
63 DECLARE_SERVICE_INFO();
66 virtual void SAL_CALL
disposing(void);
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();
81 OCalcConnection
* m_pConnection
;
82 ::com::sun::star::uno::Reference
< ::com::sun::star::sheet::XSpreadsheetDocument
> m_xDoc
;
84 ODocHolder(OCalcConnection
* _pConnection
) : m_pConnection(_pConnection
)
86 m_xDoc
= m_pConnection
->acquireDoc();
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_