bump product version to 5.0.4.1
[LibreOffice.git] / connectivity / source / inc / calc / CConnection.hxx
blob0171ac4b0098cbb37f9f8365dd51e19ea9ed2f95
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CCONNECTION_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CCONNECTION_HXX
23 #include "file/FConnection.hxx"
24 #include <com/sun/star/uno/DeploymentException.hpp>
26 namespace com { namespace sun { namespace star {
27 namespace sheet { class XSpreadsheetDocument; }
28 } } }
30 namespace utl { class CloseVeto; }
33 namespace connectivity
35 namespace calc
37 class ODriver;
38 class OCalcConnection : public file::OConnection
40 // the spreadsheet document:
41 ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument > m_xDoc;
42 /// close listener that vetoes so nobody disposes m_xDoc
43 ::std::unique_ptr< ::utl::CloseVeto> m_pCloseListener;
44 OUString m_sPassword;
45 OUString m_aFileName;
46 oslInterlockedCount m_nDocCount;
48 public:
49 OCalcConnection(ODriver* _pDriver);
50 virtual ~OCalcConnection();
52 virtual void construct(const OUString& _rUrl,
53 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rInfo )
54 throw( css::sdbc::SQLException,
55 css::uno::RuntimeException,
56 css::uno::DeploymentException) SAL_OVERRIDE;
58 // XServiceInfo
59 DECLARE_SERVICE_INFO();
61 // OComponentHelper
62 virtual void SAL_CALL disposing() SAL_OVERRIDE;
64 // XConnection
65 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, std::exception) SAL_OVERRIDE;
66 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier > createCatalog() SAL_OVERRIDE;
67 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, std::exception) SAL_OVERRIDE;
68 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareStatement( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
69 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XPreparedStatement > SAL_CALL prepareCall( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
71 // no interface methods
72 ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument> acquireDoc();
73 void releaseDoc();
75 class ODocHolder
77 OCalcConnection* m_pConnection;
78 ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument> m_xDoc;
79 public:
80 ODocHolder(OCalcConnection* _pConnection) : m_pConnection(_pConnection)
82 m_xDoc = m_pConnection->acquireDoc();
84 ~ODocHolder()
86 m_xDoc.clear();
87 m_pConnection->releaseDoc();
89 ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument> getDoc() const { return m_xDoc; }
95 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CCONNECTION_HXX
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */