2010-10-27 12:33:13 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-14 17:39:53 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2004-08-02 14:28:20 +00:00
|
|
|
|
2013-11-05 02:18:53 +01:00
|
|
|
#ifndef INCLUDED_DBACCESS_SOURCE_UI_APP_APPCONTROLLER_HXX
|
|
|
|
#define INCLUDED_DBACCESS_SOURCE_UI_APP_APPCONTROLLER_HXX
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
#include "AppElementType.hxx"
|
2008-03-06 17:09:44 +00:00
|
|
|
#include "callbacks.hxx"
|
|
|
|
#include "commontypes.hxx"
|
|
|
|
#include "dsntypes.hxx"
|
2013-05-06 17:19:41 +02:00
|
|
|
#include <dbaccess/genericcontroller.hxx>
|
2008-03-06 17:09:44 +00:00
|
|
|
#include "linkeddocuments.hxx"
|
|
|
|
#include "moduledbu.hxx"
|
|
|
|
#include "TableCopyHelper.hxx"
|
|
|
|
|
2004-08-02 14:28:20 +00:00
|
|
|
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
|
2008-03-06 17:09:44 +00:00
|
|
|
#include <com/sun/star/container/XContainerListener.hpp>
|
2006-10-05 11:59:20 +00:00
|
|
|
#include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
|
2008-03-06 17:09:44 +00:00
|
|
|
#include <com/sun/star/util/XModifiable.hpp>
|
2008-06-25 11:35:42 +00:00
|
|
|
#include <com/sun/star/ui/XContextMenuInterception.hpp>
|
2008-03-06 17:09:44 +00:00
|
|
|
|
2008-05-05 14:51:28 +00:00
|
|
|
#include <comphelper/namedvaluecollection.hxx>
|
2008-03-06 17:09:44 +00:00
|
|
|
#include <comphelper/uno3.hxx>
|
2008-06-25 11:35:42 +00:00
|
|
|
#include <cppuhelper/implbase5.hxx>
|
2016-01-19 19:45:45 +02:00
|
|
|
#include <comphelper/interfacecontainer2.hxx>
|
2008-03-06 17:09:44 +00:00
|
|
|
#include <sot/storage.hxx>
|
|
|
|
#include <svtools/transfer.hxx>
|
|
|
|
#include <svx/dataaccessdescriptor.hxx>
|
|
|
|
#include <vcl/timer.hxx>
|
2004-11-17 13:45:54 +00:00
|
|
|
|
2004-08-02 14:28:20 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2012-10-18 16:28:20 +02:00
|
|
|
class SvTreeListEntry;
|
2004-08-02 14:28:20 +00:00
|
|
|
class SvTreeListBox;
|
|
|
|
class TransferableHelper;
|
|
|
|
class TransferableClipboardListener;
|
|
|
|
|
2011-08-11 19:53:21 -04:00
|
|
|
namespace com { namespace sun { namespace star {
|
|
|
|
namespace container {
|
|
|
|
class XNameContainer;
|
|
|
|
class XContainer;
|
|
|
|
}
|
|
|
|
namespace ucb {
|
|
|
|
class XContent;
|
|
|
|
}
|
|
|
|
}}}
|
2008-03-06 17:09:44 +00:00
|
|
|
|
2004-08-02 14:28:20 +00:00
|
|
|
namespace dbaui
|
|
|
|
{
|
2008-12-01 12:31:27 +00:00
|
|
|
class SubComponentManager;
|
2004-08-02 14:28:20 +00:00
|
|
|
class OApplicationController;
|
|
|
|
class OApplicationView;
|
|
|
|
class OLinkedDocumentsAccess;
|
2015-10-09 12:08:32 +02:00
|
|
|
class SelectionNotifier;
|
|
|
|
|
2015-06-30 14:35:23 +02:00
|
|
|
typedef ::cppu::ImplHelper5 < css::container::XContainerListener
|
|
|
|
, css::beans::XPropertyChangeListener
|
|
|
|
, css::sdb::application::XDatabaseDocumentUI
|
|
|
|
, css::ui::XContextMenuInterception
|
|
|
|
, css::view::XSelectionSupplier
|
2004-08-02 14:28:20 +00:00
|
|
|
> OApplicationController_Base;
|
|
|
|
|
2008-06-25 11:35:42 +00:00
|
|
|
|
2004-08-02 14:28:20 +00:00
|
|
|
class OApplicationController
|
2015-10-09 12:05:50 +02:00
|
|
|
:public OGenericUnoController
|
2004-08-02 14:28:20 +00:00
|
|
|
,public OApplicationController_Base
|
2015-10-09 12:20:01 +02:00
|
|
|
,public IControlActionListener
|
|
|
|
,public IContextMenuProvider
|
2004-08-02 14:28:20 +00:00
|
|
|
{
|
|
|
|
public:
|
2015-06-30 14:35:23 +02:00
|
|
|
typedef ::std::vector< css::uno::Reference< css::container::XContainer > > TContainerVector;
|
2005-09-23 11:14:43 +00:00
|
|
|
|
2004-08-02 14:28:20 +00:00
|
|
|
private:
|
|
|
|
|
2005-01-21 16:05:23 +00:00
|
|
|
OTableCopyHelper::DropDescriptor m_aAsyncDrop;
|
2005-10-24 07:30:19 +00:00
|
|
|
|
|
|
|
SharedConnection m_xDataSourceConnection;
|
2015-06-30 14:35:23 +02:00
|
|
|
css::uno::Reference< css::sdbc::XDatabaseMetaData >
|
2005-10-24 07:30:19 +00:00
|
|
|
m_xMetaData;
|
|
|
|
|
2008-06-25 11:35:42 +00:00
|
|
|
OModuleClient m_aModuleClient;
|
2004-08-02 14:28:20 +00:00
|
|
|
TransferableDataHelper m_aSystemClipboard; // content of the clipboard
|
2015-06-30 14:35:23 +02:00
|
|
|
css::uno::Reference< css::beans::XPropertySet >
|
2008-06-25 11:35:42 +00:00
|
|
|
m_xDataSource;
|
2015-06-30 14:35:23 +02:00
|
|
|
css::uno::Reference< css::frame::XModel >
|
2005-09-23 11:14:43 +00:00
|
|
|
m_xModel;
|
2016-01-19 19:45:45 +02:00
|
|
|
::comphelper::OInterfaceContainerHelper2
|
2008-06-25 11:35:42 +00:00
|
|
|
m_aContextMenuInterceptors;
|
|
|
|
|
|
|
|
TContainerVector m_aCurrentContainers; // the containers where we are listener on
|
2008-12-01 12:31:27 +00:00
|
|
|
::rtl::Reference< SubComponentManager >
|
|
|
|
m_pSubComponentManager;
|
2008-10-01 12:28:29 +00:00
|
|
|
::dbaccess::ODsnTypeCollection
|
|
|
|
m_aTypeCollection;
|
2005-01-21 16:05:23 +00:00
|
|
|
OTableCopyHelper m_aTableCopyHelper;
|
2004-08-02 14:28:20 +00:00
|
|
|
TransferableClipboardListener*
|
|
|
|
m_pClipbordNotifier; // notifier for changes in the clipboard
|
2014-05-07 11:49:46 +02:00
|
|
|
ImplSVEvent * m_nAsyncDrop;
|
2015-10-09 12:08:32 +02:00
|
|
|
OAsynchronousLink m_aSelectContainerEvent;
|
2004-08-02 14:28:20 +00:00
|
|
|
PreviewMode m_ePreviewMode; // the mode of the preview
|
2008-03-06 17:09:44 +00:00
|
|
|
ElementType m_eCurrentType;
|
2015-10-09 12:08:32 +02:00
|
|
|
bool m_bNeedToReconnect; // true when the settings of the data source were modified and the connection is no longer up to date
|
|
|
|
bool m_bSuspended; // is true when the controller was already suspended
|
2004-08-02 14:28:20 +00:00
|
|
|
|
2014-09-24 18:50:37 +02:00
|
|
|
::std::unique_ptr< SelectionNotifier >
|
2008-06-25 11:35:42 +00:00
|
|
|
m_pSelectionNotifier;
|
2013-02-20 04:33:49 +01:00
|
|
|
typedef ::std::map< ElementType, ::std::vector< OUString > > SelectionByElementType;
|
2008-06-25 11:35:42 +00:00
|
|
|
SelectionByElementType m_aPendingSelection;
|
|
|
|
|
2008-03-06 17:09:44 +00:00
|
|
|
private:
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
OApplicationView* getContainer() const;
|
|
|
|
|
|
|
|
/** returns the database name
|
|
|
|
@return
|
|
|
|
the database name
|
|
|
|
*/
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString getDatabaseName() const;
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
/** returns the stripped database name.
|
|
|
|
@return
|
2015-07-19 01:58:13 +02:00
|
|
|
The stripped database name either the registered name or if it is a file url the last segment.
|
2004-08-02 14:28:20 +00:00
|
|
|
*/
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString getStrippedDatabaseName() const;
|
2004-08-02 14:28:20 +00:00
|
|
|
|
2005-01-21 16:05:23 +00:00
|
|
|
/** return the element type for given container
|
|
|
|
@param _xContainer The container where the element type has to be found
|
2013-12-20 11:25:37 +01:00
|
|
|
@return the element type corresponding to the given container
|
2005-01-21 16:05:23 +00:00
|
|
|
*/
|
2015-06-30 14:35:23 +02:00
|
|
|
static ElementType getElementType(const css::uno::Reference< css::container::XContainer >& _xContainer);
|
2005-01-21 16:05:23 +00:00
|
|
|
|
2004-08-02 14:28:20 +00:00
|
|
|
/** opens a new frame with either the table or the query or report or form or view
|
|
|
|
@param _sName
|
|
|
|
The name of the object to open
|
|
|
|
@param _eType
|
|
|
|
Defines the type to open
|
2006-12-13 15:46:39 +00:00
|
|
|
@param _eOpenMode
|
|
|
|
denotes the mode in which to open the object
|
2005-01-21 16:05:23 +00:00
|
|
|
@return the form or report model will only be returned, otherwise <NULL/>
|
2004-08-02 14:28:20 +00:00
|
|
|
*/
|
2015-06-30 14:35:23 +02:00
|
|
|
css::uno::Reference< css::lang::XComponent > openElement(
|
2013-02-20 04:33:49 +01:00
|
|
|
const OUString& _sName,
|
2006-12-13 15:46:39 +00:00
|
|
|
ElementType _eType,
|
2016-03-02 16:53:51 +02:00
|
|
|
ElementOpenMode _eOpenMode
|
2006-12-13 15:46:39 +00:00
|
|
|
);
|
2004-08-02 14:28:20 +00:00
|
|
|
|
2008-05-05 14:51:28 +00:00
|
|
|
/** opens a new sub frame with a table/query/form/report/view, passing additional arguments
|
|
|
|
*/
|
2015-06-30 14:35:23 +02:00
|
|
|
css::uno::Reference< css::lang::XComponent > openElementWithArguments(
|
2013-02-20 04:33:49 +01:00
|
|
|
const OUString& _sName,
|
2008-05-05 14:51:28 +00:00
|
|
|
ElementType _eType,
|
|
|
|
ElementOpenMode _eOpenMode,
|
|
|
|
sal_uInt16 _nInstigatorCommand,
|
|
|
|
const ::comphelper::NamedValueCollection& _rAdditionalArguments
|
|
|
|
);
|
|
|
|
|
2004-08-02 14:28:20 +00:00
|
|
|
/** opens a new frame for creation or auto pilot
|
|
|
|
@param _eType
|
|
|
|
Defines the type to open
|
2010-01-26 23:25:22 +01:00
|
|
|
@param i_rAdditionalArguments
|
|
|
|
Additional arguments to pass when creating the component
|
2004-08-02 14:28:20 +00:00
|
|
|
*/
|
2015-06-30 14:35:23 +02:00
|
|
|
css::uno::Reference< css::lang::XComponent >
|
2010-01-29 13:06:38 +01:00
|
|
|
newElement(
|
|
|
|
ElementType _eType,
|
|
|
|
const ::comphelper::NamedValueCollection& i_rAdditionalArguments,
|
2015-06-30 14:35:23 +02:00
|
|
|
css::uno::Reference< css::lang::XComponent >& o_rDocumentDefinition
|
2010-01-29 13:06:38 +01:00
|
|
|
);
|
2004-08-02 14:28:20 +00:00
|
|
|
|
2005-01-21 16:05:23 +00:00
|
|
|
/** creates a new database object, using an auto pilot
|
|
|
|
@param _eType
|
|
|
|
Defines the type of the object to create
|
|
|
|
@precond
|
|
|
|
Our mutex must not be locked.
|
|
|
|
@since #i39203#
|
|
|
|
*/
|
|
|
|
void newElementWithPilot( ElementType _eType );
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
/** converts the query to a view
|
|
|
|
@param _sName
|
|
|
|
The name of the query.
|
|
|
|
*/
|
2013-02-20 04:33:49 +01:00
|
|
|
void convertToView(const OUString& _sName);
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
/** checks if the connection for the selected data source is read only. If the connection doesn't exist, <TRUE/> will be returned.
|
|
|
|
@return
|
|
|
|
<TRUE/> if read only or doesn't exist, otherwise <FALSE/>
|
|
|
|
*/
|
2014-04-17 11:16:55 +02:00
|
|
|
bool isConnectionReadOnly() const;
|
2004-08-02 14:28:20 +00:00
|
|
|
|
2008-06-25 11:35:42 +00:00
|
|
|
/// fills the list with the selected entries.
|
2013-02-20 04:33:49 +01:00
|
|
|
void getSelectionElementNames( ::std::vector< OUString>& _rNames ) const;
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
/// deletes the entries selected.
|
|
|
|
void deleteEntries();
|
|
|
|
|
|
|
|
/// renames the selected entry in the detail page
|
|
|
|
void renameEntry();
|
|
|
|
|
2004-10-22 10:59:25 +00:00
|
|
|
/** deletes queries, forms, or reports
|
2004-08-02 14:28:20 +00:00
|
|
|
@param _eType
|
|
|
|
the type of the objects
|
|
|
|
@param _rList
|
2004-10-22 10:59:25 +00:00
|
|
|
The names of the elements to delete
|
|
|
|
@param _bConfirm
|
|
|
|
determines whether the user must confirm the deletion
|
2004-08-02 14:28:20 +00:00
|
|
|
*/
|
2004-10-22 10:59:25 +00:00
|
|
|
void deleteObjects( ElementType _eType,
|
2013-02-20 04:33:49 +01:00
|
|
|
const ::std::vector< OUString>& _rList,
|
2004-10-22 10:59:25 +00:00
|
|
|
bool _bConfirm );
|
|
|
|
|
2004-08-02 14:28:20 +00:00
|
|
|
/** deletes tables.
|
|
|
|
@param _rList
|
|
|
|
The list of tables.
|
|
|
|
*/
|
2013-02-20 04:33:49 +01:00
|
|
|
void deleteTables(const ::std::vector< OUString>& _rList);
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
/// copies the current object into clipboard
|
|
|
|
TransferableHelper* copyObject();
|
|
|
|
|
|
|
|
/// returns the nameaccess
|
2015-06-30 14:35:23 +02:00
|
|
|
css::uno::Reference< css::container::XNameAccess > getElements(ElementType _eType);
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
/** returns the document access for the specific type
|
|
|
|
@param _eType
|
|
|
|
the type
|
2014-09-24 18:50:37 +02:00
|
|
|
@return ::std::unique_ptr<OLinkedDocumentsAccess>
|
2004-08-02 14:28:20 +00:00
|
|
|
*/
|
2014-09-24 18:50:37 +02:00
|
|
|
::std::unique_ptr<OLinkedDocumentsAccess> getDocumentsAccess(ElementType _eType);
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
/// returns the query definitions of the active data source.
|
2015-06-30 14:35:23 +02:00
|
|
|
css::uno::Reference< css::container::XNameContainer> getQueryDefinitions() const;
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
/** pastes a special format from the system clipboard to the currently selected object types
|
|
|
|
@param _nFormatId
|
|
|
|
The format to be copied.
|
|
|
|
*/
|
2015-03-12 14:53:28 +02:00
|
|
|
void pasteFormat(SotClipboardFormatId _nFormatId);
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
/** pastes a query, form or report into the data source
|
|
|
|
@param _eType
|
|
|
|
The type of the object to paste.
|
|
|
|
@param _rPasteData
|
|
|
|
The data descriptor.
|
|
|
|
@param _sParentFolder
|
|
|
|
The name of the parent folder if it exists.
|
|
|
|
@param _bMove
|
|
|
|
if <TRUE/> the name of the content must be inserted without any change, otherwise not.
|
|
|
|
@return
|
2013-04-15 05:34:02 +02:00
|
|
|
<TRUE/> if the paste opertions was successful, otherwise <FALSE/>.
|
2004-08-02 14:28:20 +00:00
|
|
|
*/
|
2015-04-30 07:15:55 +03:00
|
|
|
bool paste( ElementType _eType, const svx::ODataAccessDescriptor& _rPasteData, const OUString& _sParentFolder = OUString(), bool _bMove = false);
|
2004-08-02 14:28:20 +00:00
|
|
|
|
2005-01-21 16:05:23 +00:00
|
|
|
/// returns the system clipboard.
|
|
|
|
const TransferableDataHelper& getViewClipboard() const { return m_aSystemClipboard; }
|
2004-08-02 14:28:20 +00:00
|
|
|
|
2005-01-21 16:05:23 +00:00
|
|
|
/// returns <TRUE/> if the clipboard supports a table format, otherwise <FALSE/>.
|
2014-04-17 11:16:55 +02:00
|
|
|
bool isTableFormat() const;
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
/** fills the vector with all supported formats
|
|
|
|
@param _eType
|
|
|
|
The type for which we need the formats
|
|
|
|
@param _rFormatIds
|
|
|
|
The vector to be filled up.
|
|
|
|
*/
|
2015-04-24 15:29:31 +02:00
|
|
|
static void getSupportedFormats(ElementType _eType,::std::vector<SotClipboardFormatId>& _rFormatIds);
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
/** adds a listener to the current name access.
|
|
|
|
@param _xCollection
|
|
|
|
The collection where we want to listen on.
|
|
|
|
*/
|
2015-06-30 14:35:23 +02:00
|
|
|
void addContainerListener(const css::uno::Reference< css::container::XNameAccess>& _xCollection);
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
/** opens a uno dialog withthe currently selected data source as initialize argument
|
|
|
|
@param _sServiceName
|
|
|
|
The serivce name of the dialog to be executed.
|
|
|
|
*/
|
2013-02-20 04:33:49 +01:00
|
|
|
void openDialog(const OUString& _sServiceName);
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
/** opens the administration dialog for the selected data source
|
|
|
|
*/
|
|
|
|
void openDataSourceAdminDialog();
|
|
|
|
|
|
|
|
/** opens the table filter dialog for the selected data source
|
|
|
|
*/
|
|
|
|
void openTableFilterDialog();
|
|
|
|
|
|
|
|
/** opens the DirectSQLDialog to execute hand made sql statements.
|
|
|
|
*/
|
|
|
|
void openDirectSQLDialog();
|
|
|
|
|
|
|
|
/** when the settings of the data source changed,
|
|
|
|
it opens a dialog which ask to close all depending documents, then recreate the connection.
|
|
|
|
The SolarMutex has to be locked before calling this.
|
|
|
|
*/
|
|
|
|
void askToReconnect();
|
|
|
|
|
2008-12-01 12:31:27 +00:00
|
|
|
/** remember a newly opened sub document for later access
|
2004-08-02 14:28:20 +00:00
|
|
|
*/
|
2008-12-01 12:31:27 +00:00
|
|
|
void onDocumentOpened(
|
2013-02-20 04:33:49 +01:00
|
|
|
const OUString& _rName,
|
2008-12-01 12:31:27 +00:00
|
|
|
const sal_Int32 _nType,
|
|
|
|
const ElementOpenMode _eMode,
|
2015-06-30 14:35:23 +02:00
|
|
|
const css::uno::Reference< css::lang::XComponent >& _xDocument,
|
|
|
|
const css::uno::Reference< css::lang::XComponent >& _xDefinition
|
2008-12-01 12:31:27 +00:00
|
|
|
);
|
2004-08-02 14:28:20 +00:00
|
|
|
|
2014-04-29 19:05:05 +00:00
|
|
|
/** Inserts a new object into the hierarchy given be the type.
|
2004-08-02 14:28:20 +00:00
|
|
|
@param _eType
|
|
|
|
Where to insert the new item.
|
|
|
|
@param _sParentFolder
|
|
|
|
The name of the parent folder if it exists.
|
|
|
|
@param _xContent
|
|
|
|
The content to insert.
|
|
|
|
@param _bMove
|
|
|
|
if <TRUE/> the name of the content must be inserted without any change, otherwise not.
|
|
|
|
@return
|
2013-04-15 05:34:02 +02:00
|
|
|
<TRUE/> if the insert opertions was successful, otherwise <FALSE/>.
|
2004-08-02 14:28:20 +00:00
|
|
|
*/
|
2014-04-17 11:16:55 +02:00
|
|
|
bool insertHierachyElement( ElementType _eType
|
2013-02-22 03:56:22 +01:00
|
|
|
,const OUString& _sParentFolder
|
2014-04-17 11:16:55 +02:00
|
|
|
,bool _bCollection = true
|
2015-06-30 14:35:23 +02:00
|
|
|
,const css::uno::Reference< css::ucb::XContent>& _xContent = css::uno::Reference< css::ucb::XContent>()
|
2014-04-17 11:16:55 +02:00
|
|
|
,bool _bMove = false);
|
2004-09-09 08:38:40 +00:00
|
|
|
/** checks if delete command or rename comamnd is allowed
|
|
|
|
@param _eType
|
|
|
|
The element type.
|
|
|
|
@param _bDelete
|
|
|
|
If <TRUE> then the delete command should be checked.
|
|
|
|
@return
|
|
|
|
<TRUE> if the command is allowed
|
|
|
|
*/
|
2014-04-17 11:16:55 +02:00
|
|
|
bool isRenameDeleteAllowed(ElementType _eType, bool _bDelete) const;
|
2004-09-09 08:38:40 +00:00
|
|
|
/** all selected entries will be opened, or edited, or converted to a view
|
|
|
|
@param _nId
|
|
|
|
The slot which should be executed.
|
2005-01-21 16:05:23 +00:00
|
|
|
@param _eOpenMode
|
2008-05-05 14:51:28 +00:00
|
|
|
Defines the mode of opening. @see ElementOpenMode
|
2004-09-09 08:38:40 +00:00
|
|
|
*/
|
2014-04-17 11:16:55 +02:00
|
|
|
void doAction(sal_uInt16 _nId, ElementOpenMode _eOpenMode);
|
2007-09-26 13:46:38 +00:00
|
|
|
|
2007-11-20 18:23:05 +00:00
|
|
|
/** returns the currently selected table or query name.
|
|
|
|
*
|
|
|
|
* \return the name of the currently table or query. If the tables or query container is selected otherwise an empty string will be returned.
|
|
|
|
*/
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString getCurrentlySelectedName(sal_Int32& _rnCommandType) const;
|
2007-11-20 18:23:05 +00:00
|
|
|
|
2008-12-01 12:31:27 +00:00
|
|
|
/** shows the preview for the given entry
|
2007-09-26 13:46:38 +00:00
|
|
|
*/
|
2013-02-20 04:33:49 +01:00
|
|
|
void showPreviewFor( const ElementType _eType,const OUString& _sName );
|
2008-03-06 17:09:44 +00:00
|
|
|
|
autorecovery: define a new css.document.XDocumentRecovery interface, implement it in both SFX and DBACCESS, and use it in the autorecovery
In this course, the auto recovery learned to restore multiple views of a document. Also, in the course of the change,
the LoadDispatchListener became superfluous, and was removed.
Also, the loader code in dbaccess was slightly adjusted, since now the connectController call is in the responsibility
of the loader, and must not happen inside the XController::attachModel call anymore. This change made the
ModelControllerConnector class superfluous, so it has been removed, too.
2010-01-05 22:32:38 +01:00
|
|
|
/** called we were attached to a frame
|
2008-03-06 17:09:44 +00:00
|
|
|
|
|
|
|
In particular, this is called *after* the controller has been announced to the model
|
|
|
|
(XModel::connectController)
|
2004-08-02 14:28:20 +00:00
|
|
|
*/
|
autorecovery: define a new css.document.XDocumentRecovery interface, implement it in both SFX and DBACCESS, and use it in the autorecovery
In this course, the auto recovery learned to restore multiple views of a document. Also, in the course of the change,
the LoadDispatchListener became superfluous, and was removed.
Also, the loader code in dbaccess was slightly adjusted, since now the connectController call is in the responsibility
of the loader, and must not happen inside the XController::attachModel call anymore. This change made the
ModelControllerConnector class superfluous, so it has been removed, too.
2010-01-05 22:32:38 +01:00
|
|
|
void onAttachedFrame();
|
2004-08-02 14:28:20 +00:00
|
|
|
|
2008-03-06 17:09:44 +00:00
|
|
|
/// determines whether the given table name denotes a view which can be altered
|
2013-02-20 04:33:49 +01:00
|
|
|
bool impl_isAlterableView_nothrow( const OUString& _rTableOrViewName ) const;
|
2008-03-06 17:09:44 +00:00
|
|
|
|
|
|
|
/** does the macro/script migration, where macros/scripts in forms/reports are moved
|
|
|
|
to the database document itself.
|
|
|
|
*/
|
|
|
|
void impl_migrateScripts_nothrow();
|
|
|
|
|
2008-05-05 14:51:28 +00:00
|
|
|
/** verifies the object type denotes a valid DatabaseObject, and the object name denotes an existing
|
|
|
|
object of this type. Throws if not.
|
|
|
|
*/
|
2013-02-20 04:33:49 +01:00
|
|
|
void impl_validateObjectTypeAndName_throw( const sal_Int32 _nObjectType, const ::boost::optional< OUString >& i_rObjectName );
|
2008-05-05 14:51:28 +00:00
|
|
|
|
2008-03-06 17:09:44 +00:00
|
|
|
protected:
|
2016-01-09 22:55:28 +01:00
|
|
|
// initializing members
|
2008-04-04 13:54:23 +00:00
|
|
|
|
2015-06-30 14:35:23 +02:00
|
|
|
// state of a feature. 'feature' may be the handle of a css::util::URL somebody requested a dispatch interface for OR a toolbar slot.
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual FeatureState GetState(sal_uInt16 nId) const override;
|
2004-08-02 14:28:20 +00:00
|
|
|
// execute a feature
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void Execute(sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
// OGenericUnoController
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void onLoadedMenu( const css::uno::Reference< css::frame::XLayoutManager >& _xLayoutManager ) override;
|
2004-08-02 14:28:20 +00:00
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual css::uno::Reference< css::frame::XModel > getPrivateModel() const override
|
2008-04-04 13:54:23 +00:00
|
|
|
{
|
|
|
|
return m_xModel;
|
|
|
|
}
|
|
|
|
|
2004-08-02 14:28:20 +00:00
|
|
|
virtual ~OApplicationController();
|
2006-10-05 11:59:20 +00:00
|
|
|
|
2004-08-02 14:28:20 +00:00
|
|
|
public:
|
2015-07-20 12:28:53 +01:00
|
|
|
explicit OApplicationController(const css::uno::Reference< css::uno::XComponentContext >& _rxORB);
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
DECLARE_XINTERFACE( )
|
|
|
|
DECLARE_XTYPEPROVIDER( )
|
|
|
|
|
|
|
|
// XServiceInfo
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual OUString SAL_CALL getImplementationName() throw(css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() throw(css::uno::RuntimeException, std::exception) override;
|
2004-08-02 14:28:20 +00:00
|
|
|
// need by registration
|
2015-06-30 14:35:23 +02:00
|
|
|
static OUString getImplementationName_Static() throw( css::uno::RuntimeException );
|
|
|
|
static css::uno::Sequence< OUString > getSupportedServiceNames_Static() throw( css::uno::RuntimeException );
|
|
|
|
static css::uno::Reference< css::uno::XInterface >
|
|
|
|
SAL_CALL Create(const css::uno::Reference< css::lang::XMultiServiceFactory >&);
|
|
|
|
|
|
|
|
// css::frame::XController
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void SAL_CALL attachFrame(const css::uno::Reference< css::frame::XFrame > & xFrame) throw( css::uno::RuntimeException, std::exception ) override;
|
|
|
|
virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) throw( css::uno::RuntimeException, std::exception ) override;
|
|
|
|
virtual sal_Bool SAL_CALL attachModel(const css::uno::Reference< css::frame::XModel > & xModel) throw( css::uno::RuntimeException, std::exception ) override;
|
|
|
|
virtual css::uno::Reference< css::frame::XModel > SAL_CALL getModel() throw( css::uno::RuntimeException, std::exception ) override;
|
2015-06-30 14:35:23 +02:00
|
|
|
|
|
|
|
// css::container::XContainerListener
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void SAL_CALL elementInserted(const css::container::ContainerEvent& Event) throw( css::uno::RuntimeException, std::exception ) override;
|
|
|
|
virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent& Event) throw( css::uno::RuntimeException, std::exception ) override;
|
|
|
|
virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent& Event) throw( css::uno::RuntimeException, std::exception ) override;
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
// XPropertyChangeListener
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void SAL_CALL propertyChange( const css::beans::PropertyChangeEvent& evt ) throw (css::uno::RuntimeException, std::exception) override;
|
2004-08-02 14:28:20 +00:00
|
|
|
|
2006-10-05 11:59:20 +00:00
|
|
|
// XDatabaseDocumentUI
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual css::uno::Reference< css::sdbc::XDataSource > SAL_CALL getDataSource() throw (css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getApplicationMainWindow() throw (css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getActiveConnection() throw (css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual css::uno::Sequence< css::uno::Reference< css::lang::XComponent > > SAL_CALL getSubComponents() throw (css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual sal_Bool SAL_CALL isConnected( ) throw (css::uno::RuntimeException, std::exception) override;
|
fdo#63391 deadlock on opening .odb file that auto-connects to the database
Let foo.odb be a database file that has a macro that connects to the
Database on "Open Document" event (and needs to prompt user for
user/password).
There was a race condition between two actions:
1) the asynchronous treatment of "OnFirstControllerConnected" in dbaui::OApplicationController,
which tries to get dbaui::OApplicationController's mutex
2) the StarBasic macro calling dbaui::OApplicationController::connect
which needs to display a dialog (to get username and password),
and thus puts that dialog in the main thread's event queue
and waits for it ... with dbaui::OApplicationController's mutex held
Now, if "1)" is before "2)" in the event queue of the the main thread,
*but* "1)" is executed *after* "2)" has taken the lock, there is a deadlock.
Fix:
1) Make OnFirstControllerConnected synchronous.
Make sure (by taking mutex in dbaui::OApplicationController::attachFrame, its ancestor in the call graph)
that nothing else will happen with the OApplicationController as long as it is not finished.
---> it does not need to take mutex itself anymore
This avoids the "order in the asynchronous events" dependency.
2) Change dbaui::OApplicationController::ensureConnection to do the user prompting
WITHOUT HOLDING the mutex, and use the mutex "only" to protect actually assigning
the connection to m_xDataSourceConnection.
Theoretically, in some race condition, we could connect twice and then discard one connection <shrug>.
ensureConnection will never return the discarded connection, though.
(I think I got that right with respect to http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html)
This keeps it from locking on another condition while holding the mutex.
Change-Id: Iab1bbec5d5df12bb89d027d43e498c78c92ffc32
Reviewed-on: https://gerrit.libreoffice.org/3310
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
2013-04-10 18:56:01 +02:00
|
|
|
// DO NOT CALL with getMutex() held!!
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void SAL_CALL connect( ) throw (css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual css::beans::Pair< ::sal_Int32, OUString > SAL_CALL identifySubComponent( const css::uno::Reference< css::lang::XComponent >& SubComponent ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual sal_Bool SAL_CALL closeSubComponents( ) throw (css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual css::uno::Reference< css::lang::XComponent > SAL_CALL loadComponent( ::sal_Int32 ObjectType, const OUString& ObjectName, sal_Bool ForEditing ) throw (css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual css::uno::Reference< css::lang::XComponent > SAL_CALL loadComponentWithArguments( ::sal_Int32 ObjectType, const OUString& ObjectName, sal_Bool ForEditing, const css::uno::Sequence< css::beans::PropertyValue >& Arguments ) throw (css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual css::uno::Reference< css::lang::XComponent > SAL_CALL createComponent( ::sal_Int32 ObjectType, css::uno::Reference< css::lang::XComponent >& o_DocumentDefinition ) throw (css::lang::IllegalArgumentException, css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual css::uno::Reference< css::lang::XComponent > SAL_CALL createComponentWithArguments( ::sal_Int32 ObjectType, const css::uno::Sequence< css::beans::PropertyValue >& Arguments, css::uno::Reference< css::lang::XComponent >& o_DocumentDefinition ) throw (css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
|
2006-10-05 11:59:20 +00:00
|
|
|
|
2008-06-25 11:35:42 +00:00
|
|
|
// XContextMenuInterception
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void SAL_CALL registerContextMenuInterceptor( const css::uno::Reference< css::ui::XContextMenuInterceptor >& Interceptor ) throw (css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual void SAL_CALL releaseContextMenuInterceptor( const css::uno::Reference< css::ui::XContextMenuInterceptor >& Interceptor ) throw (css::uno::RuntimeException, std::exception) override;
|
2008-06-25 11:35:42 +00:00
|
|
|
|
2007-09-26 13:46:38 +00:00
|
|
|
// XSelectionSupplier
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual sal_Bool SAL_CALL select( const css::uno::Any& xSelection ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual css::uno::Any SAL_CALL getSelection( ) throw (css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual void SAL_CALL addSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) throw (css::uno::RuntimeException, std::exception) override;
|
|
|
|
virtual void SAL_CALL removeSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) throw (css::uno::RuntimeException, std::exception) override;
|
2007-09-26 13:46:38 +00:00
|
|
|
|
2005-10-24 07:30:19 +00:00
|
|
|
/** retrieves the current connection, creates it if necessary
|
2008-12-01 12:31:27 +00:00
|
|
|
|
|
|
|
If an error occurs, then this is either stored in the location pointed to by <arg>_pErrorInfo</arg>,
|
|
|
|
or, if <code>_pErrorInfo</code> is <NULL/>, then the error is displayed to the user.
|
fdo#63391 deadlock on opening .odb file that auto-connects to the database
Let foo.odb be a database file that has a macro that connects to the
Database on "Open Document" event (and needs to prompt user for
user/password).
There was a race condition between two actions:
1) the asynchronous treatment of "OnFirstControllerConnected" in dbaui::OApplicationController,
which tries to get dbaui::OApplicationController's mutex
2) the StarBasic macro calling dbaui::OApplicationController::connect
which needs to display a dialog (to get username and password),
and thus puts that dialog in the main thread's event queue
and waits for it ... with dbaui::OApplicationController's mutex held
Now, if "1)" is before "2)" in the event queue of the the main thread,
*but* "1)" is executed *after* "2)" has taken the lock, there is a deadlock.
Fix:
1) Make OnFirstControllerConnected synchronous.
Make sure (by taking mutex in dbaui::OApplicationController::attachFrame, its ancestor in the call graph)
that nothing else will happen with the OApplicationController as long as it is not finished.
---> it does not need to take mutex itself anymore
This avoids the "order in the asynchronous events" dependency.
2) Change dbaui::OApplicationController::ensureConnection to do the user prompting
WITHOUT HOLDING the mutex, and use the mutex "only" to protect actually assigning
the connection to m_xDataSourceConnection.
Theoretically, in some race condition, we could connect twice and then discard one connection <shrug>.
ensureConnection will never return the discarded connection, though.
(I think I got that right with respect to http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html)
This keeps it from locking on another condition while holding the mutex.
Change-Id: Iab1bbec5d5df12bb89d027d43e498c78c92ffc32
Reviewed-on: https://gerrit.libreoffice.org/3310
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
2013-04-10 18:56:01 +02:00
|
|
|
|
|
|
|
DO NOT CALL with getMutex() held!!
|
2004-08-02 14:28:20 +00:00
|
|
|
*/
|
2015-11-10 10:13:39 +01:00
|
|
|
const SharedConnection& ensureConnection( ::dbtools::SQLExceptionInfo* _pErrorInfo = nullptr );
|
2004-08-02 14:28:20 +00:00
|
|
|
|
2005-10-24 07:30:19 +00:00
|
|
|
/** retrieves the current connection
|
2004-08-02 14:28:20 +00:00
|
|
|
*/
|
2005-10-24 07:30:19 +00:00
|
|
|
const SharedConnection& getConnection() const { return m_xDataSourceConnection; }
|
|
|
|
|
|
|
|
/// determines whether we're currently connected to the database
|
|
|
|
bool isConnected() const { return m_xDataSourceConnection.is(); }
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
/** refreshes the tables
|
|
|
|
*/
|
|
|
|
void refreshTables();
|
|
|
|
|
2015-10-09 12:20:01 +02:00
|
|
|
/** called when an entry in a tree list box has been double-clicked
|
|
|
|
@param _rTree
|
|
|
|
The tree list box.
|
|
|
|
@return
|
|
|
|
<TRUE/> if the double click event has been handled by the called, and should not
|
|
|
|
be processed further.
|
|
|
|
*/
|
|
|
|
bool onEntryDoubleClick(SvTreeListBox& _rTree);
|
|
|
|
/** called when a container (category) in the application view has been selected
|
|
|
|
@param _pTree
|
|
|
|
The tree list box.
|
|
|
|
@return
|
|
|
|
<TRUE/> if the cotainer could be changed otherwise <FALSE/>
|
|
|
|
*/
|
|
|
|
bool onContainerSelect(ElementType _eType);
|
|
|
|
/** called when an entry in a tree view has been selected
|
|
|
|
@param _pEntry
|
|
|
|
the selected entry
|
|
|
|
*/
|
|
|
|
void onSelectionChanged();
|
|
|
|
/** called when a "Copy" command is executed in a tree view
|
|
|
|
*/
|
|
|
|
void onCopyEntry();
|
|
|
|
/** called when a "Paste" command is executed in a tree view
|
|
|
|
*/
|
|
|
|
void onPasteEntry();
|
|
|
|
/** called when a "Delete" command is executed in a tree view
|
|
|
|
*/
|
|
|
|
void onDeleteEntry();
|
|
|
|
/// called when the preview mode was changed
|
|
|
|
void previewChanged( sal_Int32 _nMode);
|
|
|
|
/// called when an object container of any kind was found during enumerating tree view elements
|
|
|
|
void containerFound( const css::uno::Reference< css::container::XContainer >& _xContainer);
|
|
|
|
|
|
|
|
// IController
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void executeUnChecked(const css::util::URL& _rCommand, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
|
|
|
|
virtual void executeChecked(const css::util::URL& _rCommand, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
|
|
|
|
virtual void executeUnChecked(sal_uInt16 _nCommandId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
|
|
|
|
virtual void executeChecked(sal_uInt16 _nCommandId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override;
|
|
|
|
virtual bool isCommandEnabled(sal_uInt16 _nCommandId) const override;
|
|
|
|
virtual bool isCommandEnabled( const OUString& _rCompleteCommandURL ) const override;
|
|
|
|
virtual sal_uInt16 registerCommandURL( const OUString& _rCompleteCommandURL ) override;
|
|
|
|
virtual void notifyHiContrastChanged() override;
|
|
|
|
virtual bool isDataSourceReadOnly() const override;
|
2015-06-30 14:35:23 +02:00
|
|
|
virtual css::uno::Reference< css::frame::XController >
|
2015-10-12 16:04:04 +02:00
|
|
|
getXController() throw( css::uno::RuntimeException ) override;
|
|
|
|
virtual bool interceptUserInput( const NotifyEvent& _rEvent ) override;
|
2008-06-25 11:35:42 +00:00
|
|
|
|
|
|
|
// IControlActionListener overridables
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual bool requestQuickHelp( const SvTreeListEntry* _pEntry, OUString& _rText ) const override;
|
|
|
|
virtual bool requestDrag( sal_Int8 _nAction, const Point& _rPosPixel ) override;
|
|
|
|
virtual sal_Int8 queryDrop( const AcceptDropEvent& _rEvt, const DataFlavorExVector& _rFlavors ) override;
|
|
|
|
virtual sal_Int8 executeDrop( const ExecuteDropEvent& _rEvt ) override;
|
2008-06-25 11:35:42 +00:00
|
|
|
|
2015-10-09 12:20:01 +02:00
|
|
|
// IContextMenuProvider
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual PopupMenu* getContextMenu( Control& _rControl ) const override;
|
|
|
|
virtual IController& getCommandController() override;
|
2016-01-19 19:45:45 +02:00
|
|
|
virtual ::comphelper::OInterfaceContainerHelper2*
|
2015-10-12 16:04:04 +02:00
|
|
|
getContextMenuInterceptors() override;
|
2015-06-30 14:35:23 +02:00
|
|
|
virtual css::uno::Any
|
2015-10-12 16:04:04 +02:00
|
|
|
getCurrentSelection( Control& _rControl ) const override;
|
2004-08-02 14:28:20 +00:00
|
|
|
|
2012-01-12 23:25:35 +00:00
|
|
|
void OnInvalidateClipboard();
|
2015-08-14 16:34:39 +02:00
|
|
|
DECL_LINK_TYPED( OnClipboardChanged, TransferableDataHelper*, void );
|
2015-08-27 13:08:02 +02:00
|
|
|
DECL_LINK_TYPED( OnAsyncDrop, void*, void );
|
|
|
|
DECL_LINK_TYPED( OnCreateWithPilot, void*, void );
|
2015-09-10 10:48:52 +02:00
|
|
|
DECL_LINK_TYPED( OnSelectContainer, void*, void );
|
fdo#63391 deadlock on opening .odb file that auto-connects to the database
Let foo.odb be a database file that has a macro that connects to the
Database on "Open Document" event (and needs to prompt user for
user/password).
There was a race condition between two actions:
1) the asynchronous treatment of "OnFirstControllerConnected" in dbaui::OApplicationController,
which tries to get dbaui::OApplicationController's mutex
2) the StarBasic macro calling dbaui::OApplicationController::connect
which needs to display a dialog (to get username and password),
and thus puts that dialog in the main thread's event queue
and waits for it ... with dbaui::OApplicationController's mutex held
Now, if "1)" is before "2)" in the event queue of the the main thread,
*but* "1)" is executed *after* "2)" has taken the lock, there is a deadlock.
Fix:
1) Make OnFirstControllerConnected synchronous.
Make sure (by taking mutex in dbaui::OApplicationController::attachFrame, its ancestor in the call graph)
that nothing else will happen with the OApplicationController as long as it is not finished.
---> it does not need to take mutex itself anymore
This avoids the "order in the asynchronous events" dependency.
2) Change dbaui::OApplicationController::ensureConnection to do the user prompting
WITHOUT HOLDING the mutex, and use the mutex "only" to protect actually assigning
the connection to m_xDataSourceConnection.
Theoretically, in some race condition, we could connect twice and then discard one connection <shrug>.
ensureConnection will never return the discarded connection, though.
(I think I got that right with respect to http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html)
This keeps it from locking on another condition while holding the mutex.
Change-Id: Iab1bbec5d5df12bb89d027d43e498c78c92ffc32
Reviewed-on: https://gerrit.libreoffice.org/3310
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
2013-04-10 18:56:01 +02:00
|
|
|
void OnFirstControllerConnected();
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
protected:
|
2015-10-09 12:05:50 +02:00
|
|
|
using OGenericUnoController::connect;
|
2004-08-02 14:28:20 +00:00
|
|
|
|
2005-10-24 07:30:19 +00:00
|
|
|
/** disconnects from our XConnection, and cleans up this connection
|
2004-08-02 14:28:20 +00:00
|
|
|
*/
|
2015-01-20 12:38:10 +02:00
|
|
|
void disconnect();
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
// late construction
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual bool Construct(vcl::Window* pParent) override;
|
|
|
|
virtual void describeSupportedFeatures() override;
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// XEventListener
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void SAL_CALL disposing(const css::lang::EventObject& Source) throw( css::uno::RuntimeException, std::exception ) override;
|
2004-08-02 14:28:20 +00:00
|
|
|
|
|
|
|
// OComponentHelper
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void SAL_CALL disposing() override;
|
2004-08-02 14:28:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dbaui
|
|
|
|
|
2013-11-05 02:18:53 +01:00
|
|
|
#endif // INCLUDED_DBACCESS_SOURCE_UI_APP_APPCONTROLLER_HXX
|
2004-08-02 14:28:20 +00:00
|
|
|
|
2010-10-27 12:33:13 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|