Files
libreoffice/dbaccess/source/core/dataaccess/databasedocument.hxx

684 lines
39 KiB
C++
Raw Normal View History

/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: databasedocument.hxx,v $
2008-10-16 06:57:26 +00:00
* $Revision: 1.20.2.13 $
*
* This file is part of OpenOffice.org.
*
* 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.
*
* 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).
*
* 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.
*
************************************************************************/
#ifndef _DBA_COREDATAACCESS_DATABASEDOCUMENT_HXX_
#define _DBA_COREDATAACCESS_DATABASEDOCUMENT_HXX_
#include "ModelImpl.hxx"
2008-10-16 06:57:26 +00:00
#include "documenteventnotifier.hxx"
/** === begin UNO includes === **/
#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
#include <com/sun/star/frame/XModel2.hpp>
#include <com/sun/star/frame/XTitle.hpp>
#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
#include <com/sun/star/frame/XUntitledNumbers.hpp>
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/sdb/XReportDocumentsSupplier.hpp>
#include <com/sun/star/sdb/XFormDocumentsSupplier.hpp>
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/view/XPrintable.hpp>
#include <com/sun/star/frame/XModuleManager.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
#include <com/sun/star/embed/XTransactionListener.hpp>
#include <com/sun/star/document/XStorageBasedDocument.hpp>
#include <com/sun/star/document/XEmbeddedScripts.hpp>
2008-10-16 06:57:26 +00:00
#include <com/sun/star/document/XEventsSupplier.hpp>
#include <com/sun/star/document/XScriptInvocationContext.hpp>
#include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
2008-10-16 06:57:26 +00:00
#include <com/sun/star/frame/XLoadable.hpp>
#include <com/sun/star/document/XEventBroadcaster.hpp>
#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
#include <com/sun/star/document/XDocumentRecovery.hpp>
/** === end UNO includes === **/
#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_17)
#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_17
#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 17
#include <comphelper/implbase_var.hxx>
#endif
2008-10-16 06:57:26 +00:00
#include <cppuhelper/compbase10.hxx>
#include <cppuhelper/implbase3.hxx>
#include <rtl/ref.hxx>
#include <boost/shared_ptr.hpp>
2008-10-16 06:57:26 +00:00
#include <boost/noncopyable.hpp>
namespace comphelper {
class NamedValueCollection;
}
//........................................................................
namespace dbaccess
{
//........................................................................
2008-10-16 06:57:26 +00:00
class DocumentEvents;
class DocumentEventExecutor;
class DocumentGuard;
typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > > Controllers;
2008-10-16 06:57:26 +00:00
//============================================================
//= ViewMonitor
//============================================================
/** helper class monitoring the views of a document, and firing appropriate events
when views are attached / detached
*/
class ViewMonitor : public boost::noncopyable
{
public:
ViewMonitor( DocumentEventNotifier& _rEventNotifier )
:m_rEventNotifier( _rEventNotifier )
,m_bIsNewDocument( true )
,m_bEverHadController( false )
,m_bLastIsFirstEverController( false )
,m_xLastConnectedController()
{
}
void reset()
{
m_bEverHadController = false;
m_bLastIsFirstEverController = false;
m_xLastConnectedController.clear();
}
/** to be called when a view (aka controller) has been connected to the document
@return
<TRUE/> if and only if this was the first-ever controller connected to the document
*/
bool onControllerConnected(
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& _rxController
);
/** to be called when a controller is set as current controller
*/
void onSetCurrentController(
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& _rxController
);
void onLoadedDocument() { m_bIsNewDocument = false; }
private:
DocumentEventNotifier& m_rEventNotifier;
bool m_bIsNewDocument;
bool m_bEverHadController;
bool m_bLastIsFirstEverController;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
m_xLastConnectedController;
};
//============================================================
//= ODatabaseDocument
//============================================================
typedef ::comphelper::WeakComponentImplHelper17 < ::com::sun::star::frame::XModel2
, ::com::sun::star::util::XModifiable
, ::com::sun::star::frame::XStorable
, ::com::sun::star::document::XEventBroadcaster
2008-10-16 06:57:26 +00:00
, ::com::sun::star::document::XDocumentEventBroadcaster
, ::com::sun::star::view::XPrintable
, ::com::sun::star::util::XCloseable
, ::com::sun::star::lang::XServiceInfo
, ::com::sun::star::sdb::XOfficeDatabaseDocument
, ::com::sun::star::ui::XUIConfigurationManagerSupplier
, ::com::sun::star::document::XStorageBasedDocument
, ::com::sun::star::document::XEmbeddedScripts
, ::com::sun::star::document::XScriptInvocationContext
, ::com::sun::star::script::provider::XScriptProviderSupplier
2008-10-16 06:57:26 +00:00
, ::com::sun::star::document::XEventsSupplier
, ::com::sun::star::frame::XLoadable
, ::com::sun::star::document::XDocumentRecovery
> ODatabaseDocument_OfficeDocument;
typedef ::cppu::ImplHelper3< ::com::sun::star::frame::XTitle
, ::com::sun::star::frame::XTitleChangeBroadcaster
, ::com::sun::star::frame::XUntitledNumbers
> ODatabaseDocument_Title;
class ODatabaseDocument :public ModelDependentComponent // ModelDependentComponent must be first!
,public ODatabaseDocument_OfficeDocument
,public ODatabaseDocument_Title
{
2008-10-16 06:57:26 +00:00
enum InitState
{
NotInitialized,
Initializing,
Initialized
};
DECLARE_STL_USTRINGACCESS_MAP(::com::sun::star::uno::Reference< ::com::sun::star::frame::XUntitledNumbers >,TNumberedController);
::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager> m_xUIConfigurationManager;
::cppu::OInterfaceContainerHelper m_aModifyListeners;
::cppu::OInterfaceContainerHelper m_aCloseListener;
::cppu::OInterfaceContainerHelper m_aStorageListeners;
2008-10-16 06:57:26 +00:00
DocumentEvents* m_pEventContainer;
::rtl::Reference< DocumentEventExecutor > m_pEventExecutor;
DocumentEventNotifier m_aEventNotifier;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > m_xCurrentController;
Controllers m_aControllers;
2008-10-16 06:57:26 +00:00
ViewMonitor m_aViewMonitor;
::com::sun::star::uno::WeakReference< ::com::sun::star::container::XNameAccess > m_xForms;
::com::sun::star::uno::WeakReference< ::com::sun::star::container::XNameAccess > m_xReports;
::com::sun::star::uno::WeakReference< ::com::sun::star::script::provider::XScriptProvider > m_xScriptProvider;
2008-10-16 06:57:26 +00:00
/** @short such module manager is used to classify new opened documents. */
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XTitle > m_xTitleHelper;
TNumberedController m_aNumberedControllers;
/** true if and only if the DatabaseDocument's "initNew" or "load" have been called (or, well,
the document has be initialized implicitly - see storeAsURL
*/
InitState m_eInitState;
bool m_bClosing;
bool m_bAllowDocumentScripting;
bool m_bHasBeenRecovered;
2008-10-16 06:57:26 +00:00
enum StoreType { SAVE, SAVE_AS };
/** stores the document to the given URL, rebases it to the respective new storage, if necessary, resets
the modified flag, and notifies any listeners as required
2008-10-16 06:57:26 +00:00
@param _rURL
the URL to store the document to
@param _rArguments
arguments for storing the document (MediaDescriptor)
@param _eType
the type of the store process (Save or SaveAs). The method will automatically
notify the proper events for this type.
@param _rGuard
the instance lock to be released before doing synchronous notifications
*/
void impl_storeAs_throw(
const ::rtl::OUString& _rURL,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _rArguments,
2008-10-16 06:57:26 +00:00
const StoreType _eType,
DocumentGuard& _rGuard
CWS-TOOLING: integrate CWS dba32g 2009-09-09 07:53:55 +0200 oj r275964 : replace strlen with rtl_str_getLength 2009-09-07 20:59:10 +0200 fs r275913 : disable the CopyTableWizard test until issue 104869 is fixed 2009-09-07 12:17:31 +0200 oj r275885 : #i104810# remove de as lang 2009-09-05 22:26:21 +0200 fs r275857 : protect StateChanged against re-entrance 2009-09-05 22:25:52 +0200 fs r275856 : don't attempt to classify the parent of a form as control 2009-09-05 22:25:29 +0200 fs r275855 : protect against re-entrance 2009-09-05 00:11:40 +0200 fs r275835 : #i10000# 2009-09-04 23:25:50 +0200 fs r275834 : #i10000# 2009-09-04 23:23:47 +0200 fs r275833 : #i10000# 2009-09-04 21:49:37 +0200 fs r275830 : #i10000# correct wrong conflict resolution 2009-09-04 20:59:51 +0200 fs r275829 : CWS-TOOLING: rebase CWS dba32g to trunk@275801 (milestone: DEV300:m57) 2009-09-04 11:08:32 +0200 oj r275791 : #i104780# new version 1.2.0 2009-09-03 22:29:21 +0200 fs r275775 : OSL_TRACE doesn't need \n anymore 2009-09-03 08:33:21 +0200 fs r275743 : CWS-TOOLING: rebase CWS dba32g to trunk@275331 (milestone: DEV300:m56) 2009-09-02 13:48:12 +0200 fs r275708 : removed useless include 2009-09-02 13:45:43 +0200 fs r275707 : more since tags, which are used across offapi/udkapi 2009-09-02 13:23:04 +0200 fs r275705 : should *not* have the dtor, copy ctor, and assignment operator compiler-generated, else we run into trouble as soon as the compiler creates different versions of our singleton member's static data in different libraries 2009-09-02 12:32:45 +0200 fs r275704 : AutoIncrementIsPrimaryKey is a driver setting, not a data source setting 2009-09-02 11:42:49 +0200 fs r275701 : URL meta data are meta data which are valid for all connections of this type, not per-data-source properties. Settings them as data source properties is a hack. 2009-09-02 08:43:34 +0200 fs r275696 : 3.x.x is not a valid 'since' tag 2009-09-01 16:05:24 +0200 fs r275665 : #i104686# don't treat controls bound to read-only columns as required 2009-09-01 13:10:22 +0200 fs r275657 : #i104574# use PageUp/Down to scroll through the complete page 2009-09-01 07:04:48 +0200 oj r275641 : #i104104# correct line ends 2009-08-31 15:52:34 +0200 fs r275612 : #i104410# 2009-08-31 12:29:05 +0200 fs r275596 : #i104364# 2009-08-31 12:28:56 +0200 fs r275595 : #i104364# 2009-08-31 11:43:09 +0200 fs r275593 : #i104649# JavaDriverClassPath is also a known JDBC-bridge setting 2009-08-31 11:41:37 +0200 fs r275592 : #i104649# 2009-08-28 21:48:27 +0200 fs r275552 : during #i96862#: renamed the configuration data which controls availability of certain DBA-related UI 2009-08-28 21:48:17 +0200 fs r275551 : #i96862# do not show the 'Create a new database' option when a) no embedded/dBase driver is installed or b) the configuration requests to hide the option 2009-08-28 21:47:19 +0200 fs r275550 : during #i96862#: renamed the configuration data which controls availability of certain DBA-related UI 2009-08-28 21:46:41 +0200 fs r275549 : #i96862# renamed and extended the configuration data which controls availability of certain DBA-related UI 2009-08-28 15:10:19 +0200 fs r275535 : #i96862# if no embedded driver is installed, use dBase for creating new DBs. If no dBase driver is installed, too, do not offer the 'Create new database' option 2009-08-28 14:03:04 +0200 fs r275532 : #i104454# allow multiple fields to display the same column 2009-08-28 13:14:00 +0200 fs r275528 : #i104584# driver meta data do not belong into a data source's settings 2009-08-28 13:09:57 +0200 fs r275527 : properly chech the MySQL type buttons (else next/back in the wizard leads to state with two buttons checked) 2009-08-28 13:09:17 +0200 fs r275526 : #i104584# driver meta data do not belong into a data source's settings 2009-08-28 13:07:18 +0200 fs r275525 : BooleanComparisonMode is a property, or a feature - but not a driver meta data 2009-08-28 11:00:31 +0200 fs r275521 : #i104580# 2009-08-28 10:40:05 +0200 fs r275519 : #i104577# correct assertion: If the template node type is ANY, then any value type is allowed 2009-08-28 10:09:30 +0200 fs r275518 : #i104575# implement Named Pipe UI 2009-08-28 10:09:07 +0200 fs r275517 : pass the trigger-event to IWindowOperator::operateOn / work with VclWindowEvents, not VclSimpleEvents 2009-08-27 14:27:36 +0200 fs r275484 : ImplPosTabPage: respect mbEmptyViewMargin for WINDOWALIGN_LEFT 2009-08-27 13:43:56 +0200 fs r275480 : merging latest changes from CWS dba32f herein 2009-08-27 13:23:07 +0200 fs r275475 : #i103882# 2009-08-27 11:56:55 +0200 fs r275466 : #i104544# SetState: Do not call Update at the window which we just set text for. It should (sic\!) not be needed, but causes trouble 2009-08-27 11:55:34 +0200 fs r275465 : #i104544# do not allow re-entrance for impl_ensureControl_nothrow Actually, this is part of the fix only. I also removed the code which triggered this re-entrance (from the grid control implementation), but to ensure it won't happen, again, I added some safety herein. 2009-08-27 10:14:11 +0200 fs r275459 : preparations for supporting a 'NamedPipe' parameter for the MySQL Connector/OOo 2009-08-27 10:13:21 +0200 fs r275458 : preparations for supporting a 'NamedPipe' setting for the MySQL Connector/OOo 2009-08-27 10:11:14 +0200 fs r275456 : outsourced the MySQLNative settings into a dedicated class, to not duplicate all the code in two tab page implementations 2009-08-26 14:18:13 +0200 fs r275422 : #i10000# 2009-08-26 13:26:36 +0200 fs r275419 : ignore output paths 2009-08-26 13:23:38 +0200 fs r275417 : support the LocalSocket property for the MySQL native driver 2009-08-26 13:17:05 +0200 fs r275416 : some re-factoring, to outsource the tab page for setting up the MySQLNative connection, into a dedicated class (needed later) 2009-08-26 13:15:15 +0200 fs r275415 : support a NoThousandSep property for NumericFormatters - I'm tired of correcting this at runtime, instead of controlling it in the resource 2009-08-26 11:45:08 +0200 fs r275410 : oops, 'flat' shouldn't have got lost 2009-08-26 09:38:57 +0200 fs r275398 : #i102631# when saving the document fails, ensure that the interaction handler really can handle/display the error 2009-08-26 09:37:05 +0200 fs r275397 : #i102631# don't let non-IO/RuntimeExceptions escape from DatabaseDocument::store*, wrap them into an IOException 2009-08-26 09:35:39 +0200 fs r275395 : let the default interaction handler implement XInteractionHandler2 2009-08-25 13:51:34 +0200 fs r275352 : #i102631# createTempFile: pass URL through FileHelper.getOOoCompatibleFileURL 2009-08-25 13:49:23 +0200 fs r275351 : #i102631# createTempFileURL: immediately delete the file implicitly created by createTempFile, we really only need the URL 2009-08-24 14:49:07 +0200 fs r275318 : #i10000# 2009-08-24 14:36:03 +0200 fs r275315 : properly terminate message with 0 character 2009-08-24 14:35:45 +0200 fs r275314 : trace method concepts in non-pro, if special flag is enabled 2009-08-24 14:24:17 +0200 fs r275312 : #i98973# filter some more events for grid control columns 2009-08-24 14:15:23 +0200 fs r275311 : #i98973# implement XComboBox for combo box cells 2009-08-24 13:39:24 +0200 fs r275308 : #i98973# do not display the 'actionPerformed' event for grid combo box columns 2009-08-24 12:52:03 +0200 fs r275303 : #i98973# implement XCheckBox and XButton for check box cells 2009-08-24 11:56:05 +0200 oj r275300 : #i104447# wrong default for orientation 2009-08-24 10:51:21 +0200 fs r275296 : in the script selector dialog, interpret a double click onto a function as OK 2009-08-24 10:50:56 +0200 fs r275295 : localize some to-be-displayed names, consolidate some code regarding form/control naming 2009-08-21 14:28:05 +0200 fs r275255 : #i98973# implement KeyListeners 2009-08-21 14:27:20 +0200 fs r275254 : #i98973# move the conversion VCL[Mouse|Key]Event->Awt[Mouse|Key]Event from vclxwindow.cxx to VCLUnoHelper 2009-08-21 14:08:50 +0200 fs r275248 : #i98973# implement Mouse- and MouseMotion-broadcasting 2009-08-21 13:31:08 +0200 fs r275244 : #i98973# implement text and change listeners at text cells 2009-08-21 12:47:38 +0200 fs r275234 : #i104399# some refactoring: If the MySQL Connector/OOo is installed, it registers for the sdbc:mysqlc: protocol (now known as DST_MYSQL_NATIVE_DIRECT). However, we do not want to display this in the UI, instead we display "MySQL" only, which collects DST_MYSQL_ODBC, DST_MYSQL_JDBC, and DST_MYSQL_NATIVE. 2009-08-21 12:45:18 +0200 fs r275232 : #i104399# also register for the sdbc:mysql:mysqlc protocol, decide at runtime (depending on the availability of sdbc:mysqlc:), whether it is really accepted. This prevents that the C/OOo extension needs to register *our* implementation name for the sdbc:mysql:mysqlc: protocol, which would be somewhat weird 2009-08-20 16:18:48 +0200 fs r275190 : merging the latest changes from CWS dba32f (which this CWS was created from) 2009-08-19 20:19:59 +0200 fs r275160 : add some spacing between the radios 2009-08-19 14:50:15 +0200 fs r275150 : #i98973# slightly refactoring the grid cell implementations, to prepare for proper events being fired. Implement focus events for the moment, more to come. 2009-08-19 10:53:38 +0200 fs r275142 : #i99936# initialize newly created models 2009-08-18 23:03:48 +0200 fs r275132 : merging latest changes from CWS dba32f 2009-08-18 15:14:08 +0200 fs r275110 : #i102819# SetColumnPos: SCROLL_CLIP is deadly here
2009-09-14 11:18:01 +00:00
)
throw ( ::com::sun::star::io::IOException
, ::com::sun::star::uno::RuntimeException );
/** notifies our storage change listeners that our underlying storage changed
@param _rxNewRootStorage
the new root storage to be notified. If <NULL/>, it is assumed that no storage change actually
happened, and the listeners are not notified.
*/
void impl_notifyStorageChange_nolck_nothrow(
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxNewRootStorage
);
/// write a single XML stream into the package
void WriteThroughComponent(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > & xComponent, /// the component we export
const sal_Char* pStreamName, /// the stream name
const sal_Char* pServiceName, /// service name of the component
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> & rArguments, /// the argument (XInitialization)
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> & rMediaDesc,/// output descriptor
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _xStorageToSaveTo
) const;
/// write a single output stream
/// (to be called either directly or by WriteThroughComponent(...))
void WriteThroughComponent(
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutputStream,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xComponent,
const sal_Char* pServiceName,
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rArguments,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> & rMediaDesc
) const;
/** writes the content and settings
@param sURL
The URL
@param lArguments
The media descriptor
@param _xStorageToSaveTo
The storage which should be used for saving
*/
void impl_writeStorage_throw(
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxTargetStorage,
const ::comphelper::NamedValueCollection& _rMediaDescriptor
) const;
// ModelDependentComponent overridables
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getThis() const;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XTitle > impl_getTitleHelper_throw();
::com::sun::star::uno::Reference< ::com::sun::star::frame::XUntitledNumbers > impl_getUntitledHelper_throw(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xComponent = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >());
private:
ODatabaseDocument(const ::rtl::Reference<ODatabaseModelImpl>& _pImpl);
// Do NOT create those documents directly, always use ODatabaseModelImpl::getModel. Reason is that
// ODatabaseDocument requires clear ownership, and in turn lifetime synchronisation with the ModelImpl.
// If you create a ODatabaseDocument directly, you might easily create a leak.
// #i50905# / 2005-06-20 / frank.schonheit@sun.com
protected:
virtual void SAL_CALL disposing();
virtual ~ODatabaseDocument();
public:
struct FactoryAccess { friend class ODatabaseModelImpl; private: FactoryAccess() { } };
static ODatabaseDocument* createDatabaseDocument( const ::rtl::Reference<ODatabaseModelImpl>& _pImpl, FactoryAccess /*accessControl*/ )
{
return new ODatabaseDocument( _pImpl );
}
// XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
// ::com::sun::star::lang::XServiceInfo - static methods
static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static(void) throw( ::com::sun::star::uno::RuntimeException );
static ::rtl::OUString getImplementationName_static(void) throw( ::com::sun::star::uno::RuntimeException );
static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
// XInterface
virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL acquire( ) throw ();
virtual void SAL_CALL release( ) throw ();
// XTypeProvider
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException);
// XEventListener
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
// XComponent
virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
// XModel
virtual sal_Bool SAL_CALL attachResource( const ::rtl::OUString& URL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments ) throw (::com::sun::star::uno::RuntimeException) ;
virtual ::rtl::OUString SAL_CALL getURL( ) throw (::com::sun::star::uno::RuntimeException) ;
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getArgs( ) throw (::com::sun::star::uno::RuntimeException) ;
virtual void SAL_CALL connectController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& Controller ) throw (::com::sun::star::uno::RuntimeException) ;
virtual void SAL_CALL disconnectController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& Controller ) throw (::com::sun::star::uno::RuntimeException) ;
virtual void SAL_CALL lockControllers( ) throw (::com::sun::star::uno::RuntimeException) ;
virtual void SAL_CALL unlockControllers( ) throw (::com::sun::star::uno::RuntimeException) ;
virtual sal_Bool SAL_CALL hasControllersLocked( ) throw (::com::sun::star::uno::RuntimeException) ;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > SAL_CALL getCurrentController( ) throw (::com::sun::star::uno::RuntimeException) ;
virtual void SAL_CALL setCurrentController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& Controller ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) ;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getCurrentSelection( ) throw (::com::sun::star::uno::RuntimeException) ;
2008-10-16 06:57:26 +00:00
// XModel2
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL getControllers( ) throw (::com::sun::star::uno::RuntimeException) ;
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableViewControllerNames( ) throw (::com::sun::star::uno::RuntimeException) ;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 > SAL_CALL createDefaultViewController( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& Frame ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) ;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 > SAL_CALL createViewController( const ::rtl::OUString& ViewName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& Frame ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) ;
2008-10-16 06:57:26 +00:00
// XStorable
virtual sal_Bool SAL_CALL hasLocation( ) throw (::com::sun::star::uno::RuntimeException) ;
virtual ::rtl::OUString SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException) ;
virtual sal_Bool SAL_CALL isReadonly( ) throw (::com::sun::star::uno::RuntimeException) ;
virtual void SAL_CALL store( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) ;
virtual void SAL_CALL storeAsURL( const ::rtl::OUString& sURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) ;
virtual void SAL_CALL storeToURL( const ::rtl::OUString& sURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) ;
2008-10-16 06:57:26 +00:00
// 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-10-16 06:57:26 +00:00
// ::com::sun::star::util::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) ;
2008-10-16 06:57:26 +00:00
// XEventBroadcaster
virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
2008-10-16 06:57:26 +00:00
// XDocumentEventBroadcaster
virtual void SAL_CALL addDocumentEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentEventListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeDocumentEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentEventListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL notifyDocumentEvent( const ::rtl::OUString& _EventName, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 >& _ViewController, const ::com::sun::star::uno::Any& _Supplement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
2008-10-16 06:57:26 +00:00
// XPrintable
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getPrinter( ) throw (::com::sun::star::uno::RuntimeException) ;
virtual void SAL_CALL setPrinter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aPrinter ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) ;
virtual void SAL_CALL print( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& xOptions ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) ;
2008-10-16 06:57:26 +00:00
// XFormDocumentsSupplier
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getFormDocuments( ) throw (::com::sun::star::uno::RuntimeException);
2008-10-16 06:57:26 +00:00
// XReportDocumentsSupplier
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getReportDocuments( ) throw (::com::sun::star::uno::RuntimeException);
2008-10-16 06:57:26 +00:00
// XCloseable
virtual void SAL_CALL close( sal_Bool DeliverOwnership ) throw (::com::sun::star::util::CloseVetoException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addCloseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeCloseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
2008-10-16 06:57:26 +00:00
// XUIConfigurationManagerSupplier
virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > SAL_CALL getUIConfigurationManager( ) throw (::com::sun::star::uno::RuntimeException);
2008-10-16 06:57:26 +00:00
// XDocumentSubStorageSupplier
virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > SAL_CALL getDocumentSubStorage( const ::rtl::OUString& aStorageName, sal_Int32 nMode ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getDocumentSubStoragesNames( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
// XOfficeDatabaseDocument
virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > SAL_CALL getDataSource() throw (::com::sun::star::uno::RuntimeException);
// XStorageBasedDocument
virtual void SAL_CALL loadFromStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescriptor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::frame::DoubleInitializationException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL storeToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescriptor ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL switchToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > SAL_CALL getDocumentStorage( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL addStorageChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XStorageChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeStorageChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XStorageChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
// XEmbeddedScripts
virtual ::com::sun::star::uno::Reference< ::com::sun::star::script::XStorageBasedLibraryContainer > SAL_CALL getBasicLibraries() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::script::XStorageBasedLibraryContainer > SAL_CALL getDialogLibraries() throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL getAllowMacroExecution() throw (::com::sun::star::uno::RuntimeException);
// XScriptInvocationContext
virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedScripts > SAL_CALL getScriptContainer() throw (::com::sun::star::uno::RuntimeException);
// XScriptProviderSupplier
virtual ::com::sun::star::uno::Reference< ::com::sun::star::script::provider::XScriptProvider > SAL_CALL getScriptProvider( ) throw (::com::sun::star::uno::RuntimeException);
2008-10-16 06:57:26 +00:00
// XEventsSupplier
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents( ) throw (::com::sun::star::uno::RuntimeException);
// XLoadable
virtual void SAL_CALL initNew( ) throw (::com::sun::star::frame::DoubleInitializationException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL load( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments ) throw (::com::sun::star::frame::DoubleInitializationException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
// css.document.XDocumentRecovery
virtual ::sal_Bool SAL_CALL wasModifiedSinceLastSave() throw ( ::com::sun::star::uno::RuntimeException );
virtual void SAL_CALL saveToRecoveryFile( const ::rtl::OUString& i_TargetLocation, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException );
virtual void SAL_CALL recoverFromFile( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor ) throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException );
// XTitle
virtual ::rtl::OUString SAL_CALL getTitle( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setTitle( const ::rtl::OUString& sTitle ) throw (::com::sun::star::uno::RuntimeException);
// XTitleChangeBroadcaster
virtual void SAL_CALL addTitleChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTitleChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL removeTitleChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTitleChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
// XUntitledNumbers
virtual ::sal_Int32 SAL_CALL leaseNumber( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xComponent ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL releaseNumber( ::sal_Int32 nNumber ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL releaseNumberForComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xComponent ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getUntitledPrefix( ) throw (::com::sun::star::uno::RuntimeException);
/** clears the given object container
Clearing is done via disposal - the method calls XComponent::dispose at the given object,
which must be one of our impl's or our object containers (m_xForms, m_xReports,
m_xTableDefinitions, m_xCommandDefinitions)
@param _rxContainer
the container to clear
*/
static void clearObjectContainer(
::com::sun::star::uno::WeakReference< ::com::sun::star::container::XNameAccess >& _rxContainer);
2008-10-16 06:57:26 +00:00
/** checks whether the component is already initialized, throws a NotInitializedException if not
*/
inline void checkInitialized() const
{
if ( !impl_isInitialized() )
throw ::com::sun::star::lang::NotInitializedException( ::rtl::OUString(), getThis() );
}
/** checks the document is currently in the initialization phase, or already initialized.
Throws NotInitializedException if not so.
*/
inline void checkNotUninitilized() const
{
if ( impl_isInitialized() || impl_isInitializing() )
// fine
return;
throw ::com::sun::star::lang::NotInitializedException( ::rtl::OUString(), getThis() );
}
/** checks whether the document is currently being initialized, or already initialized,
throws a DoubleInitializationException if so
*/
inline void checkNotInitialized() const
{
if ( impl_isInitializing() || impl_isInitialized() )
throw ::com::sun::star::frame::DoubleInitializationException( ::rtl::OUString(), getThis() );
}
private:
2008-10-16 06:57:26 +00:00
/** returns whether the model is currently being initialized
*/
bool impl_isInitializing() const { return m_eInitState == Initializing; }
/** returns whether the model is already initialized, i.e. the XModel's "initNew" or "load" methods have been called
*/
bool impl_isInitialized() const { return m_eInitState == Initialized; }
/// tells the model it is being initialized now
void impl_setInitializing() { m_eInitState = Initializing; }
/// tells the model its initialization is done
void impl_setInitialized();
/** closes the frames of all connected controllers
@param _bDeliverOwnership
determines if the ownership should be transfered to the component which
possibly vetos the closing
@raises ::com::sun::star::util::CloseVetoException
if the closing was vetoed by any instance
*/
void impl_closeControllerFrames_nolck_throw( sal_Bool _bDeliverOwnership );
/** disposes the frames of all controllers which are still left in m_aControllers.
*/
void impl_disposeControllerFrames_nothrow();
/** does a reparenting at the given object container to ourself
Calls XChild::setParent at the given object, which must be one of our impl's or our
object containers (m_xForms, m_xReports, m_xTableDefinitions, m_xCommandDefinitions)
*/
void impl_reparent_nothrow( const ::com::sun::star::uno::WeakReference< ::com::sun::star::container::XNameAccess >& _rxContainer );
/** retrieves the forms or reports contained, creates and initializes it, if necessary
@raises DisposedException
if the instance is already disposed
@raises IllegalArgumentException
if <arg>_eType</arg> is not ODatabaseModelImpl::E_FORM and not ODatabaseModelImpl::E_REPORT
*/
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
impl_getDocumentContainer_throw( ODatabaseModelImpl::ObjectType _eType );
/** resets everything
@precond
m_pImpl is not <NULLL/>
*/
void
impl_reset_nothrow();
/** imports the document from the given resource.
*/
static void
impl_import_nolck_throw(
const ::comphelper::ComponentContext _rContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxTargetComponent,
const ::comphelper::NamedValueCollection& _rResource
);
/** creates a storage for the given URL, truncating it if a file with this name already exists
@throws Exception
if creating the storage failed
@return
the newly created storage for the file at the given URL
*/
::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
impl_createStorageFor_throw(
const ::rtl::OUString& _rURL
) const;
2008-10-16 06:57:26 +00:00
/** sets our "modified" flag
will notify all our respective listeners, if the "modified" state actually changed
@param _bModified
the (new) flag indicating whether the document is currently modified or not
@param _rGuard
the guard for our instance. At method entry, the guard must hold the lock. At the moment
of method leave, the lock will be released.
@precond
our mutex is locked
@postcond
our mutex is not locked
*/
2008-10-16 06:57:26 +00:00
void impl_setModified_nothrow( sal_Bool _bModified, DocumentGuard& _rGuard );
/** stores the document to the given storage
Note that the document is actually not rebased to this storage, it just stores a copy of itself
to the given target storage.
@param _rxTargetStorage
denotes the storage to store the document into
@param _rMediaDescriptor
contains additional parameters for storing the document
@param _rDocGuard
a guard which holds the (only) lock to the document, and which will be temporarily
released where necessary (e.g. for notifications, or calling into other components)
@throws ::com::sun::star::uno::IllegalArgumentException
if the given storage is <NULL/>.
@throws ::com::sun::star::uno::RuntimeException
when any of the used operations throws it
@throws ::com::sun::star::io::IOException
when any of the used operations throws it, or any other exception occurs which is no
RuntimeException and no IOException
*/
void impl_storeToStorage_throw(
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxTargetStorage,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rMediaDescriptor,
DocumentGuard& _rDocGuard
) const;
2008-10-16 06:57:26 +00:00
};
/** an extended version of the ModelMethodGuard, which also cares for the initialization state
of the document
*/
class DocumentGuard : private ModelMethodGuard
2008-10-16 06:57:26 +00:00
{
public:
enum MethodType
{
// a method which is to initialize the document
InitMethod,
// a default method
DefaultMethod,
// a method which is used (externally) during the initialization phase
MethodUsedDuringInit,
// a method which does not need initialization - use with care!
MethodWithoutInit
};
/** constructs the guard
@param _document
the ODatabaseDocument instance
@throws ::com::sun::star::lang::DisposedException
If the given component is already disposed
@throws ::com::sun::star::frame::DoubleInitializationException
if _eType is InitMethod, and the given component is already initialized, or currently being initialized.
@throws ::com::sun::star::lang::NotInitializedException
if _eType is DefaultMethod, and the given component is not yet initialized; or if _eType
is MethodUsedDuringInit, and the component is still uninitialized, and not in the initialization
phase currently.
*/
DocumentGuard( const ODatabaseDocument& _document, MethodType _eType = DefaultMethod )
:ModelMethodGuard( _document )
,m_document( _document )
2008-10-16 06:57:26 +00:00
{
switch ( _eType )
{
case InitMethod: m_document.checkNotInitialized(); break;
case DefaultMethod: m_document.checkInitialized(); break;
case MethodUsedDuringInit: m_document.checkNotUninitilized(); break;
2008-10-16 06:57:26 +00:00
case MethodWithoutInit: break;
}
}
~DocumentGuard()
{
}
void clear()
{
ModelMethodGuard::clear();
}
void reset()
{
ModelMethodGuard::reset();
m_document.checkDisposed();
}
private:
const ODatabaseDocument& m_document;
};
//........................................................................
} // namespace dbaccess
//........................................................................
#endif // _DBA_COREDATAACCESS_DATABASEDOCUMENT_HXX_