2010-10-27 06:33:13 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2007-07-06 01:50:28 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 06:14:50 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2007-07-06 01:50:28 -05:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2007-07-06 01:50:28 -05:00
|
|
|
*
|
2008-04-10 06:14:50 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2007-07-06 01:50:28 -05:00
|
|
|
*
|
2008-04-10 06:14:50 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2007-07-06 01:50:28 -05:00
|
|
|
*
|
2008-04-10 06:14:50 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2007-07-06 01:50:28 -05:00
|
|
|
*
|
2008-04-10 06:14:50 -05:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2007-07-06 01:50:28 -05:00
|
|
|
*
|
2008-04-10 06:14:50 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2007-07-06 01:50:28 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2010-11-25 07:28:03 -06:00
|
|
|
#ifndef DBAUI_SUBCOMPONENTCONTROLLER_HXX
|
|
|
|
#define DBAUI_SUBCOMPONENTCONTROLLER_HXX
|
2007-07-06 01:50:28 -05:00
|
|
|
|
|
|
|
#include "genericcontroller.hxx"
|
2008-03-06 10:56:18 -06:00
|
|
|
|
|
|
|
/** === begin UNO includes === **/
|
|
|
|
#include <com/sun/star/document/XScriptInvocationContext.hpp>
|
2007-07-06 01:50:28 -05:00
|
|
|
#include <com/sun/star/sdbc/XConnection.hpp>
|
|
|
|
#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
|
2008-03-06 10:56:18 -06:00
|
|
|
#include <com/sun/star/sdbc/XDataSource.hpp>
|
|
|
|
#include <com/sun/star/util/XNumberFormatter.hpp>
|
2010-02-10 07:05:19 -06:00
|
|
|
#include <com/sun/star/util/XModifiable.hpp>
|
2008-03-06 10:56:18 -06:00
|
|
|
/** === end UNO includes === **/
|
|
|
|
|
|
|
|
#include <comphelper/broadcasthelper.hxx>
|
|
|
|
#include <comphelper/proparrhlp.hxx>
|
|
|
|
#include <comphelper/propertycontainer.hxx>
|
2007-07-06 01:50:28 -05:00
|
|
|
#include <connectivity/dbmetadata.hxx>
|
2010-02-10 07:05:19 -06:00
|
|
|
#include <cppuhelper/implbase2.hxx>
|
2007-07-06 01:50:28 -05:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
//........................................................................
|
|
|
|
namespace dbaui
|
|
|
|
{
|
|
|
|
//........................................................................
|
|
|
|
|
|
|
|
//====================================================================
|
2010-11-25 07:28:03 -06:00
|
|
|
//= DBSubComponentController
|
2007-07-06 01:50:28 -05:00
|
|
|
//====================================================================
|
2010-11-25 07:28:03 -06:00
|
|
|
class DBSubComponentController;
|
2008-03-06 10:56:18 -06:00
|
|
|
|
2010-02-10 07:05:19 -06:00
|
|
|
typedef ::cppu::ImplInheritanceHelper2 < OGenericUnoController
|
2008-03-06 10:56:18 -06:00
|
|
|
, ::com::sun::star::document::XScriptInvocationContext
|
2010-02-10 07:05:19 -06:00
|
|
|
, ::com::sun::star::util::XModifiable
|
2010-11-25 07:28:03 -06:00
|
|
|
> DBSubComponentController_Base;
|
2007-07-06 01:50:28 -05:00
|
|
|
|
2010-11-25 07:28:03 -06:00
|
|
|
struct DBSubComponentController_Impl;
|
|
|
|
class DBACCESS_DLLPUBLIC DBSubComponentController : public DBSubComponentController_Base
|
2007-07-06 01:50:28 -05:00
|
|
|
{
|
|
|
|
private:
|
2010-11-25 07:28:03 -06:00
|
|
|
::std::auto_ptr<DBSubComponentController_Impl> m_pImpl;
|
2007-07-06 01:50:28 -05:00
|
|
|
|
2008-03-06 10:56:18 -06:00
|
|
|
private:
|
2007-07-06 01:50:28 -05:00
|
|
|
/** forces usage of a connection which we do not own
|
2008-03-06 10:56:18 -06:00
|
|
|
<p>To be used from within XInitialization::initialize, resp. impl_initialize, only.</p>
|
2007-07-06 01:50:28 -05:00
|
|
|
*/
|
|
|
|
void initializeConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxForeignConn );
|
|
|
|
|
2008-03-06 10:56:18 -06:00
|
|
|
protected:
|
|
|
|
// OGenericUnoController - initialization
|
|
|
|
virtual void impl_initialize();
|
|
|
|
|
2010-11-25 07:28:03 -06:00
|
|
|
// OGenericUnoController
|
2007-07-06 01:50:28 -05:00
|
|
|
virtual void Execute(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs);
|
|
|
|
|
2008-04-04 08:29:15 -05:00
|
|
|
virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getPrivateModel() const;
|
|
|
|
|
2010-02-10 07:05:19 -06:00
|
|
|
sal_Bool impl_isModified() const;
|
|
|
|
virtual void impl_onModifyChanged();
|
|
|
|
|
2007-07-06 01:50:28 -05:00
|
|
|
public:
|
|
|
|
|
|
|
|
sal_Bool isReadOnly() const;
|
|
|
|
sal_Bool isEditable() const;
|
|
|
|
void setEditable(sal_Bool _bEditable);
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------
|
|
|
|
// asking for connection-related stuff
|
|
|
|
|
|
|
|
sal_Bool isConnected() const;
|
|
|
|
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >
|
|
|
|
getMetaData( ) const;
|
2008-03-06 10:56:18 -06:00
|
|
|
|
2007-07-06 01:50:28 -05:00
|
|
|
// ----------------------------------------------------------------
|
2008-03-06 10:56:18 -06:00
|
|
|
// access to the data source / document
|
2007-07-06 01:50:28 -05:00
|
|
|
::rtl::OUString getDataSourceName() const;
|
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >&
|
|
|
|
getDataSource() const;
|
|
|
|
sal_Bool haveDataSource() const;
|
|
|
|
|
2008-03-06 10:56:18 -06:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
|
|
|
|
getDatabaseDocument() const;
|
2007-07-06 01:50:28 -05:00
|
|
|
|
2008-03-06 10:56:18 -06:00
|
|
|
/** provides access to the SDB-level database meta data of the current connection
|
2007-07-06 01:50:28 -05:00
|
|
|
*/
|
|
|
|
const ::dbtools::DatabaseMetaData& getSdbMetaData() const;
|
|
|
|
|
|
|
|
/** appends an error in the current environment.
|
|
|
|
*/
|
2010-11-24 06:53:52 -06:00
|
|
|
void appendError(
|
2008-12-01 06:31:27 -06:00
|
|
|
const ::rtl::OUString& _rErrorMessage,
|
|
|
|
const ::dbtools::StandardSQLState _eSQLState = ::dbtools::SQL_GENERAL_ERROR,
|
|
|
|
const sal_Int32 _nErrorCode = 1000
|
|
|
|
);
|
2007-07-06 01:50:28 -05:00
|
|
|
|
|
|
|
/** clears the error state.
|
|
|
|
*/
|
2010-11-24 06:53:52 -06:00
|
|
|
void clearError();
|
2007-07-06 01:50:28 -05:00
|
|
|
|
2008-03-06 10:56:18 -06:00
|
|
|
/** @return
|
|
|
|
<TRUE/> when an error was set otherwise <FALSE/>
|
2007-07-06 01:50:28 -05:00
|
|
|
*/
|
2010-11-24 06:53:52 -06:00
|
|
|
sal_Bool hasError() const;
|
2007-07-06 01:50:28 -05:00
|
|
|
|
2008-12-01 06:31:27 -06:00
|
|
|
/** returns the current error
|
|
|
|
*/
|
2010-11-24 06:53:52 -06:00
|
|
|
const ::dbtools::SQLExceptionInfo& getError() const;
|
2008-12-01 06:31:27 -06:00
|
|
|
|
|
|
|
/** displays the current error, or does nothing if there is no current error
|
|
|
|
*/
|
2010-11-24 06:53:52 -06:00
|
|
|
void displayError();
|
2008-12-01 06:31:27 -06:00
|
|
|
|
2007-07-06 01:50:28 -05:00
|
|
|
/** shows an info box with the string conntection lost.
|
|
|
|
*/
|
|
|
|
void connectionLostMessage() const;
|
|
|
|
|
|
|
|
/** gives access to the currently used connection
|
|
|
|
@return
|
|
|
|
the currently used connection.
|
|
|
|
*/
|
2010-11-24 06:53:52 -06:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >&
|
2007-07-06 01:50:28 -05:00
|
|
|
getConnection() const;
|
|
|
|
|
|
|
|
/** returns the number formatter
|
|
|
|
*/
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > getNumberFormatter() const;
|
|
|
|
|
|
|
|
// ::com::sun::star::frame::XController
|
|
|
|
virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) throw( ::com::sun::star::uno::RuntimeException );
|
2008-04-08 06:46:07 -05:00
|
|
|
virtual sal_Bool SAL_CALL attachModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel) throw( ::com::sun::star::uno::RuntimeException );
|
2008-03-06 10:56:18 -06:00
|
|
|
|
|
|
|
// XScriptInvocationContext
|
|
|
|
virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedScripts > SAL_CALL getScriptContainer() throw (::com::sun::star::uno::RuntimeException);
|
2007-07-06 01:50:28 -05:00
|
|
|
|
2010-02-10 07:05:19 -06:00
|
|
|
// XModifiable
|
|
|
|
virtual ::sal_Bool SAL_CALL isModified( ) throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual void SAL_CALL setModified( ::sal_Bool bModified ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
|
|
|
|
|
|
|
|
// XModifyBroadcaster
|
|
|
|
virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
|
2008-04-04 08:29:15 -05:00
|
|
|
// XTitle
|
|
|
|
virtual ::rtl::OUString SAL_CALL getTitle( ) throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
|
2007-07-06 01:50:28 -05:00
|
|
|
protected:
|
2010-11-25 07:28:03 -06:00
|
|
|
DBSubComponentController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxORB);
|
|
|
|
virtual ~DBSubComponentController();
|
2007-07-06 01:50:28 -05:00
|
|
|
|
|
|
|
virtual void disconnect();
|
|
|
|
virtual void reconnect( sal_Bool _bUI );
|
|
|
|
sal_Bool ensureConnected( sal_Bool _bUI ) { if ( !isConnected() ) reconnect( _bUI ); return isConnected(); }
|
|
|
|
|
|
|
|
/** called when our connection is beeing disposed
|
|
|
|
<p>The default implementation does a reconnect</p>
|
|
|
|
*/
|
|
|
|
virtual void losingConnection( );
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// XEventListener
|
|
|
|
virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
|
|
|
|
|
|
|
|
// OComponentHelper
|
|
|
|
virtual void SAL_CALL disposing();
|
2008-03-06 10:56:18 -06:00
|
|
|
|
|
|
|
// XInterface
|
|
|
|
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
|
|
|
|
// XTypeProvider
|
|
|
|
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
|
2008-04-08 06:46:07 -05:00
|
|
|
protected:
|
|
|
|
sal_Int32 getCurrentStartNumber() const;
|
|
|
|
|
2008-03-06 10:56:18 -06:00
|
|
|
private:
|
2010-11-25 07:28:03 -06:00
|
|
|
DBSubComponentController(); // never implemented
|
2007-07-06 01:50:28 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
//........................................................................
|
|
|
|
} // namespace dbaui
|
|
|
|
//........................................................................
|
|
|
|
|
2010-11-25 07:28:03 -06:00
|
|
|
#endif // DBAUI_SUBCOMPONENTCONTROLLER_HXX
|
2007-07-06 01:50:28 -05:00
|
|
|
|
2010-10-27 06:33:13 -05:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|