2010-10-12 08:59:03 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2001-08-14 06:00:02 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 10:13:28 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2001-08-14 06:00:02 -05:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2001-08-14 06:00:02 -05:00
|
|
|
*
|
2008-04-10 10:13:28 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2001-08-14 06:00:02 -05:00
|
|
|
*
|
2008-04-10 10:13:28 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2001-08-14 06:00:02 -05:00
|
|
|
*
|
2008-04-10 10:13:28 -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.
|
2001-08-14 06:00:02 -05:00
|
|
|
*
|
2008-04-10 10:13:28 -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).
|
2001-08-14 06:00:02 -05:00
|
|
|
*
|
2008-04-10 10:13:28 -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.
|
2001-08-14 06:00:02 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 01:18:38 -05:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_dbaccess.hxx"
|
|
|
|
|
2008-03-06 11:29:31 -06:00
|
|
|
#include "browserids.hxx"
|
|
|
|
#include "commontypes.hxx"
|
|
|
|
#include "dataview.hxx"
|
|
|
|
#include "dbu_misc.hrc"
|
2001-08-14 06:00:02 -05:00
|
|
|
#include "dbustrings.hrc"
|
2008-03-06 11:29:31 -06:00
|
|
|
#include "moduledbu.hxx"
|
|
|
|
#include "singledoccontroller.hxx"
|
2008-04-08 06:46:07 -05:00
|
|
|
#include <com/sun/star/frame/XUntitledNumbers.hpp>
|
2008-04-07 06:32:46 -05:00
|
|
|
|
2008-03-06 11:29:31 -06:00
|
|
|
/** === begin UNO includes === **/
|
2001-08-14 06:00:02 -05:00
|
|
|
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
2008-03-06 11:29:31 -06:00
|
|
|
#include <com/sun/star/container/XChild.hpp>
|
2001-08-14 06:00:02 -05:00
|
|
|
#include <com/sun/star/container/XNameAccess.hpp>
|
2005-03-10 09:52:37 -06:00
|
|
|
#include <com/sun/star/sdb/XDocumentDataSource.hpp>
|
|
|
|
#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
|
2008-03-06 11:29:31 -06:00
|
|
|
#include <com/sun/star/sdbc/XDataSource.hpp>
|
|
|
|
#include <com/sun/star/lang/IllegalArgumentException.hpp>
|
2008-04-08 06:46:07 -05:00
|
|
|
#include <com/sun/star/frame/XUntitledNumbers.hpp>
|
2008-03-06 11:29:31 -06:00
|
|
|
/** === end UNO includes === **/
|
|
|
|
|
|
|
|
#include <comphelper/sequence.hxx>
|
2001-08-14 06:00:02 -05:00
|
|
|
#include <comphelper/types.hxx>
|
2002-05-06 02:50:00 -05:00
|
|
|
#include <connectivity/dbexception.hxx>
|
2007-07-06 02:38:03 -05:00
|
|
|
#include <connectivity/dbtools.hxx>
|
2008-03-06 11:29:31 -06:00
|
|
|
#include <cppuhelper/typeprovider.hxx>
|
2008-04-08 06:46:07 -05:00
|
|
|
#include <rtl/ustrbuf.hxx>
|
2007-07-06 02:38:03 -05:00
|
|
|
#include <toolkit/unohlp.hxx>
|
2008-03-06 11:29:31 -06:00
|
|
|
#include <tools/debug.hxx>
|
2008-05-05 10:03:32 -05:00
|
|
|
#include <tools/diagnose_ex.h>
|
2008-03-06 11:29:31 -06:00
|
|
|
#include <vcl/msgbox.hxx>
|
|
|
|
|
2001-08-14 06:00:02 -05:00
|
|
|
//........................................................................
|
|
|
|
namespace dbaui
|
|
|
|
{
|
|
|
|
//........................................................................
|
2008-03-06 11:29:31 -06:00
|
|
|
|
|
|
|
/** === begin UNO using === **/
|
|
|
|
using ::com::sun::star::uno::Any;
|
|
|
|
using ::com::sun::star::uno::Reference;
|
|
|
|
using ::com::sun::star::beans::XPropertySet;
|
|
|
|
using ::com::sun::star::util::XNumberFormatter;
|
|
|
|
using ::com::sun::star::lang::XMultiServiceFactory;
|
|
|
|
using ::com::sun::star::uno::RuntimeException;
|
|
|
|
using ::com::sun::star::uno::Sequence;
|
|
|
|
using ::com::sun::star::uno::Type;
|
|
|
|
using ::com::sun::star::sdbc::XConnection;
|
|
|
|
using ::com::sun::star::uno::UNO_QUERY;
|
|
|
|
using ::com::sun::star::container::XChild;
|
|
|
|
using ::com::sun::star::sdbc::XDataSource;
|
|
|
|
using ::com::sun::star::util::XNumberFormatter;
|
|
|
|
using ::com::sun::star::util::XNumberFormatsSupplier;
|
|
|
|
using ::com::sun::star::frame::XFrame;
|
|
|
|
using ::com::sun::star::uno::Exception;
|
|
|
|
using ::com::sun::star::sdbc::SQLException;
|
|
|
|
using ::com::sun::star::lang::EventObject;
|
|
|
|
using ::com::sun::star::beans::PropertyValue;
|
|
|
|
using ::com::sun::star::frame::XModel;
|
|
|
|
using ::com::sun::star::sdb::XOfficeDatabaseDocument;
|
|
|
|
using ::com::sun::star::awt::XWindow;
|
|
|
|
using ::com::sun::star::sdbc::XDatabaseMetaData;
|
|
|
|
using ::com::sun::star::sdb::XDocumentDataSource;
|
|
|
|
using ::com::sun::star::document::XEmbeddedScripts;
|
|
|
|
using ::com::sun::star::lang::IllegalArgumentException;
|
|
|
|
using ::com::sun::star::uno::UNO_SET_THROW;
|
|
|
|
using ::com::sun::star::uno::UNO_QUERY_THROW;
|
2008-04-08 06:46:07 -05:00
|
|
|
using ::com::sun::star::frame::XUntitledNumbers;
|
2010-02-10 07:05:19 -06:00
|
|
|
using ::com::sun::star::beans::PropertyVetoException;
|
2008-03-06 11:29:31 -06:00
|
|
|
/** === end UNO using === **/
|
|
|
|
|
|
|
|
class DataSourceHolder
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DataSourceHolder()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
DataSourceHolder( const Reference< XDataSource >& _rxDataSource )
|
|
|
|
{
|
|
|
|
m_xDataSource = _rxDataSource;
|
|
|
|
Reference< XDocumentDataSource > xDocDS( m_xDataSource, UNO_QUERY );
|
|
|
|
if ( xDocDS.is() )
|
|
|
|
m_xDocument = xDocDS->getDatabaseDocument();
|
|
|
|
|
|
|
|
m_xDataSourceProps.set( m_xDataSource, UNO_QUERY );
|
|
|
|
}
|
|
|
|
|
|
|
|
const Reference< XDataSource >& getDataSource() const { return m_xDataSource; }
|
|
|
|
const Reference< XPropertySet >& getDataSourceProps() const { return m_xDataSourceProps; }
|
|
|
|
const Reference< XOfficeDatabaseDocument > getDatabaseDocument() const { return m_xDocument; }
|
|
|
|
|
|
|
|
bool is() const { return m_xDataSource.is(); }
|
|
|
|
|
|
|
|
void clear()
|
|
|
|
{
|
|
|
|
m_xDataSource.clear();
|
|
|
|
m_xDocument.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Reference< XDataSource > m_xDataSource;
|
|
|
|
Reference< XPropertySet > m_xDataSourceProps;
|
|
|
|
Reference< XOfficeDatabaseDocument > m_xDocument;
|
|
|
|
};
|
2007-07-06 02:38:03 -05:00
|
|
|
|
|
|
|
struct OSingleDocumentControllerImpl
|
|
|
|
{
|
2008-03-06 11:29:31 -06:00
|
|
|
private:
|
|
|
|
::boost::optional< bool > m_aDocScriptSupport;
|
|
|
|
|
|
|
|
public:
|
|
|
|
OModuleClient m_aModuleClient;
|
2008-12-01 06:31:27 -06:00
|
|
|
::dbtools::SQLExceptionInfo m_aCurrentError; // contains the current error which can be set through IEnvironment
|
2007-07-06 02:38:03 -05:00
|
|
|
|
2010-02-10 07:05:19 -06:00
|
|
|
::cppu::OInterfaceContainerHelper
|
|
|
|
m_aModifyListeners;
|
|
|
|
|
2007-07-06 02:38:03 -05:00
|
|
|
// <properties>
|
2008-03-06 11:29:31 -06:00
|
|
|
SharedConnection m_xConnection;
|
|
|
|
::dbtools::DatabaseMetaData m_aSdbMetaData;
|
2007-07-06 02:38:03 -05:00
|
|
|
// </properties>
|
2008-03-06 11:29:31 -06:00
|
|
|
::rtl::OUString m_sDataSourceName; // the data source we're working for
|
|
|
|
DataSourceHolder m_aDataSource;
|
|
|
|
Reference< XModel > m_xDocument;
|
|
|
|
Reference< XNumberFormatter > m_xFormatter; // a number formatter working with the connection's NumberFormatsSupplier
|
2008-04-04 09:02:02 -05:00
|
|
|
sal_Int32 m_nDocStartNumber;
|
2008-03-06 11:29:31 -06:00
|
|
|
sal_Bool m_bSuspended; // is true when the controller was already suspended
|
|
|
|
sal_Bool m_bEditable; // is the control readonly or not
|
|
|
|
sal_Bool m_bModified; // is the data modified
|
2008-10-01 07:28:29 -05:00
|
|
|
bool m_bNotAttached;
|
2008-03-06 11:29:31 -06:00
|
|
|
|
2010-02-10 07:05:19 -06:00
|
|
|
OSingleDocumentControllerImpl( ::osl::Mutex& i_rMutex )
|
2010-02-16 01:55:52 -06:00
|
|
|
:m_aDocScriptSupport()
|
|
|
|
,m_aModifyListeners( i_rMutex )
|
2008-10-01 07:28:29 -05:00
|
|
|
,m_nDocStartNumber(0)
|
2008-03-06 11:29:31 -06:00
|
|
|
,m_bSuspended( sal_False )
|
2007-07-06 02:38:03 -05:00
|
|
|
,m_bEditable(sal_True)
|
|
|
|
,m_bModified(sal_False)
|
2008-10-01 07:28:29 -05:00
|
|
|
,m_bNotAttached(true)
|
2007-07-06 02:38:03 -05:00
|
|
|
{
|
|
|
|
}
|
2008-03-06 11:29:31 -06:00
|
|
|
|
|
|
|
bool documentHasScriptSupport() const
|
|
|
|
{
|
2008-10-16 01:57:26 -05:00
|
|
|
OSL_PRECOND( !!m_aDocScriptSupport,
|
|
|
|
"OSingleDocumentControllerImpl::documentHasScriptSupport: not completely initialized, yet - don't know!?" );
|
|
|
|
return !!m_aDocScriptSupport && *m_aDocScriptSupport;
|
2008-03-06 11:29:31 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void setDocumentScriptSupport( const bool _bSupport )
|
|
|
|
{
|
|
|
|
OSL_PRECOND( !m_aDocScriptSupport,
|
|
|
|
"OSingleDocumentControllerImpl::setDocumentScriptSupport: already initialized!" );
|
|
|
|
m_aDocScriptSupport = ::boost::optional< bool >( _bSupport );
|
|
|
|
}
|
2007-07-06 02:38:03 -05:00
|
|
|
};
|
2001-08-14 06:00:02 -05:00
|
|
|
|
|
|
|
//====================================================================
|
|
|
|
//= OSingleDocumentController
|
|
|
|
//====================================================================
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
OSingleDocumentController::OSingleDocumentController(const Reference< XMultiServiceFactory >& _rxORB)
|
2008-03-06 11:29:31 -06:00
|
|
|
:OSingleDocumentController_Base( _rxORB )
|
2010-02-10 07:05:19 -06:00
|
|
|
,m_pImpl( new OSingleDocumentControllerImpl( getMutex() ) )
|
2001-08-14 06:00:02 -05:00
|
|
|
{
|
|
|
|
}
|
2008-03-06 11:29:31 -06:00
|
|
|
|
2007-07-06 02:38:03 -05:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
OSingleDocumentController::~OSingleDocumentController()
|
|
|
|
{
|
|
|
|
}
|
2008-03-06 11:29:31 -06:00
|
|
|
|
2007-07-06 02:38:03 -05:00
|
|
|
//--------------------------------------------------------------------
|
2008-03-06 11:29:31 -06:00
|
|
|
void OSingleDocumentController::impl_initialize()
|
2007-07-06 02:38:03 -05:00
|
|
|
{
|
2008-03-06 11:29:31 -06:00
|
|
|
OGenericUnoController::impl_initialize();
|
|
|
|
|
|
|
|
const ::comphelper::NamedValueCollection& rArguments( getInitParams() );
|
|
|
|
|
|
|
|
Reference< XConnection > xConnection;
|
|
|
|
xConnection = rArguments.getOrDefault( (::rtl::OUString)PROPERTY_ACTIVE_CONNECTION, xConnection );
|
|
|
|
|
|
|
|
if ( !xConnection.is() )
|
|
|
|
::dbtools::isEmbeddedInDatabase( getModel(), xConnection );
|
|
|
|
|
|
|
|
if ( xConnection.is() )
|
|
|
|
initializeConnection( xConnection );
|
|
|
|
|
|
|
|
bool bShowError = true;
|
|
|
|
if ( !isConnected() )
|
2007-07-06 02:38:03 -05:00
|
|
|
{
|
2008-03-06 11:29:31 -06:00
|
|
|
reconnect( sal_False );
|
|
|
|
bShowError = false;
|
|
|
|
}
|
|
|
|
if ( !isConnected() )
|
|
|
|
{
|
|
|
|
if ( bShowError )
|
|
|
|
connectionLostMessage();
|
|
|
|
throw IllegalArgumentException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
Any SAL_CALL OSingleDocumentController::queryInterface(const Type& _rType) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
if ( _rType.equals( XScriptInvocationContext::static_type() ) )
|
|
|
|
{
|
|
|
|
if ( m_pImpl->documentHasScriptSupport() )
|
|
|
|
return makeAny( Reference< XScriptInvocationContext >( this ) );
|
|
|
|
return Any();
|
2007-07-06 02:38:03 -05:00
|
|
|
}
|
2008-03-06 11:29:31 -06:00
|
|
|
|
|
|
|
return OSingleDocumentController_Base::queryInterface( _rType );
|
2007-07-06 02:38:03 -05:00
|
|
|
}
|
2001-08-14 06:00:02 -05:00
|
|
|
|
2007-07-06 02:38:03 -05:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
Sequence< Type > SAL_CALL OSingleDocumentController::getTypes( ) throw (RuntimeException)
|
|
|
|
{
|
2008-03-06 11:29:31 -06:00
|
|
|
Sequence< Type > aTypes( OSingleDocumentController_Base::getTypes() );
|
|
|
|
if ( !m_pImpl->documentHasScriptSupport() )
|
|
|
|
{
|
|
|
|
Sequence< Type > aStrippedTypes( aTypes.getLength() - 1 );
|
|
|
|
::std::remove_copy_if(
|
|
|
|
aTypes.getConstArray(),
|
|
|
|
aTypes.getConstArray() + aTypes.getLength(),
|
|
|
|
aStrippedTypes.getArray(),
|
|
|
|
::std::bind2nd( ::std::equal_to< Type >(), XScriptInvocationContext::static_type() )
|
|
|
|
);
|
|
|
|
aTypes = aStrippedTypes;
|
|
|
|
}
|
|
|
|
return aTypes;
|
2007-07-06 02:38:03 -05:00
|
|
|
}
|
2008-03-06 11:29:31 -06:00
|
|
|
|
2001-08-14 06:00:02 -05:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void OSingleDocumentController::initializeConnection( const Reference< XConnection >& _rxForeignConn )
|
|
|
|
{
|
|
|
|
DBG_ASSERT( !isConnected(), "OSingleDocumentController::initializeConnection: not to be called when already connected!" );
|
|
|
|
// usually this gets called from within initialize of derived classes ...
|
|
|
|
if ( isConnected() )
|
|
|
|
disconnect();
|
|
|
|
|
2007-07-06 02:38:03 -05:00
|
|
|
m_pImpl->m_xConnection.reset( _rxForeignConn, SharedConnection::NoTakeOwnership );
|
|
|
|
m_pImpl->m_aSdbMetaData.reset( m_pImpl->m_xConnection );
|
|
|
|
startConnectionListening( m_pImpl->m_xConnection );
|
2001-08-14 06:00:02 -05:00
|
|
|
|
|
|
|
// get the data source the connection belongs to
|
2007-07-06 02:38:03 -05:00
|
|
|
try
|
2001-08-14 06:00:02 -05:00
|
|
|
{
|
2008-03-06 11:29:31 -06:00
|
|
|
// determine our data source
|
|
|
|
OSL_PRECOND( !m_pImpl->m_aDataSource.is(), "OSingleDocumentController::initializeConnection: already a data source in this phase?" );
|
2001-08-14 06:00:02 -05:00
|
|
|
{
|
2007-07-06 02:38:03 -05:00
|
|
|
Reference< XChild > xConnAsChild( m_pImpl->m_xConnection, UNO_QUERY );
|
2001-08-14 06:00:02 -05:00
|
|
|
Reference< XDataSource > xDS;
|
|
|
|
if ( xConnAsChild.is() )
|
|
|
|
xDS = Reference< XDataSource >( xConnAsChild->getParent(), UNO_QUERY );
|
|
|
|
|
|
|
|
// (take the indirection through XDataSource to ensure we have a correct object ....)
|
2008-03-06 11:29:31 -06:00
|
|
|
m_pImpl->m_aDataSource = xDS;
|
2007-07-06 02:38:03 -05:00
|
|
|
}
|
2008-03-06 11:29:31 -06:00
|
|
|
OSL_POSTCOND( m_pImpl->m_aDataSource.is(), "OSingleDocumentController::initializeConnection: unable to obtain the data source object!" );
|
|
|
|
|
2008-10-01 07:28:29 -05:00
|
|
|
if ( m_pImpl->m_bNotAttached )
|
|
|
|
{
|
|
|
|
Reference< XUntitledNumbers > xUntitledProvider( getDatabaseDocument(), UNO_QUERY );
|
|
|
|
m_pImpl->m_nDocStartNumber = 1;
|
|
|
|
if ( xUntitledProvider.is() )
|
|
|
|
m_pImpl->m_nDocStartNumber = xUntitledProvider->leaseNumber( static_cast< XWeak* >( this ) );
|
|
|
|
}
|
|
|
|
|
2008-03-06 11:29:31 -06:00
|
|
|
// determine the availability of script support in our document. Our own XScriptInvocationContext
|
|
|
|
// interface depends on this
|
|
|
|
m_pImpl->setDocumentScriptSupport( Reference< XEmbeddedScripts >( getDatabaseDocument(), UNO_QUERY ).is() );
|
|
|
|
|
|
|
|
// get a number formatter
|
|
|
|
Reference< XPropertySet > xDataSourceProps( m_pImpl->m_aDataSource.getDataSourceProps(), UNO_SET_THROW );
|
|
|
|
xDataSourceProps->getPropertyValue( PROPERTY_NAME ) >>= m_pImpl->m_sDataSourceName;
|
|
|
|
DBG_ASSERT( m_pImpl->m_sDataSourceName.getLength(), "OSingleDocumentController::initializeConnection: invalid data source name!" );
|
|
|
|
Reference< XNumberFormatsSupplier> xSupplier = ::dbtools::getNumberFormats(m_pImpl->m_xConnection);
|
|
|
|
if(xSupplier.is())
|
2007-07-06 02:38:03 -05:00
|
|
|
{
|
2008-03-06 11:29:31 -06:00
|
|
|
m_pImpl->m_xFormatter = Reference< XNumberFormatter >(getORB()
|
2010-11-11 14:20:24 -06:00
|
|
|
->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatter"))), UNO_QUERY);
|
2008-03-06 11:29:31 -06:00
|
|
|
m_pImpl->m_xFormatter->attachNumberFormatsSupplier(xSupplier);
|
2001-08-14 06:00:02 -05:00
|
|
|
}
|
2008-03-06 11:29:31 -06:00
|
|
|
OSL_ENSURE(m_pImpl->m_xFormatter.is(),"No NumberFormatter!");
|
2001-08-14 06:00:02 -05:00
|
|
|
}
|
2007-07-06 02:38:03 -05:00
|
|
|
catch( const Exception& )
|
|
|
|
{
|
2008-05-05 10:03:32 -05:00
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2007-07-06 02:38:03 -05:00
|
|
|
}
|
2001-08-14 06:00:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void OSingleDocumentController::reconnect( sal_Bool _bUI )
|
|
|
|
{
|
2007-07-06 02:38:03 -05:00
|
|
|
OSL_ENSURE(!m_pImpl->m_bSuspended, "Cannot reconnect while suspended!");
|
2001-08-14 06:00:02 -05:00
|
|
|
|
2007-07-06 02:38:03 -05:00
|
|
|
stopConnectionListening( m_pImpl->m_xConnection );
|
|
|
|
m_pImpl->m_aSdbMetaData.reset( NULL );
|
|
|
|
m_pImpl->m_xConnection.clear();
|
2001-08-14 06:00:02 -05:00
|
|
|
|
|
|
|
// reconnect
|
|
|
|
sal_Bool bReConnect = sal_True;
|
|
|
|
if ( _bUI )
|
|
|
|
{
|
2005-03-10 09:52:37 -06:00
|
|
|
QueryBox aQuery( getView(), ModuleRes(QUERY_CONNECTION_LOST) );
|
2001-08-14 06:00:02 -05:00
|
|
|
bReConnect = ( RET_YES == aQuery.Execute() );
|
|
|
|
}
|
|
|
|
|
|
|
|
// now really reconnect ...
|
|
|
|
if ( bReConnect )
|
|
|
|
{
|
2008-12-01 06:31:27 -06:00
|
|
|
m_pImpl->m_xConnection.reset( connect( m_pImpl->m_aDataSource.getDataSource(), NULL ), SharedConnection::TakeOwnership );
|
2007-07-06 02:38:03 -05:00
|
|
|
m_pImpl->m_aSdbMetaData.reset( m_pImpl->m_xConnection );
|
2001-08-14 06:00:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// invalidate all slots
|
|
|
|
InvalidateAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void OSingleDocumentController::disconnect()
|
|
|
|
{
|
2007-07-06 02:38:03 -05:00
|
|
|
stopConnectionListening(m_pImpl->m_xConnection);
|
|
|
|
m_pImpl->m_aSdbMetaData.reset( NULL );
|
|
|
|
m_pImpl->m_xConnection.clear();
|
2001-08-14 06:00:02 -05:00
|
|
|
|
|
|
|
InvalidateAll();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void OSingleDocumentController::losingConnection()
|
|
|
|
{
|
|
|
|
// our connection was disposed so we need a new one
|
|
|
|
reconnect( sal_True );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void SAL_CALL OSingleDocumentController::disposing()
|
|
|
|
{
|
2008-03-06 11:29:31 -06:00
|
|
|
OSingleDocumentController_Base::disposing();
|
2002-08-19 02:01:32 -05:00
|
|
|
m_aUndoManager.Clear();
|
2001-08-14 06:00:02 -05:00
|
|
|
|
|
|
|
disconnect();
|
2004-08-02 10:11:35 -05:00
|
|
|
|
2005-09-23 06:41:29 -05:00
|
|
|
attachFrame( Reference < XFrame >() );
|
2001-08-14 06:00:02 -05:00
|
|
|
|
2008-03-06 11:29:31 -06:00
|
|
|
m_pImpl->m_aDataSource.clear();
|
2001-08-14 06:00:02 -05:00
|
|
|
}
|
|
|
|
|
2001-08-15 07:36:51 -05:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
sal_Bool OSingleDocumentController::Construct(Window* _pParent)
|
|
|
|
{
|
|
|
|
DBG_ASSERT( getView(), "OSingleDocumentController::Construct: have no view!" );
|
|
|
|
if ( getView() )
|
|
|
|
getView()->enableSeparator( );
|
|
|
|
|
2008-03-06 11:29:31 -06:00
|
|
|
return OSingleDocumentController_Base::Construct( _pParent );
|
2001-08-15 07:36:51 -05:00
|
|
|
}
|
|
|
|
|
2001-08-14 06:00:02 -05:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void SAL_CALL OSingleDocumentController::disposing(const EventObject& _rSource) throw( RuntimeException )
|
|
|
|
{
|
2004-03-19 05:12:26 -06:00
|
|
|
if ( _rSource.Source == getConnection() )
|
2001-08-14 06:00:02 -05:00
|
|
|
{
|
2007-07-06 02:38:03 -05:00
|
|
|
if ( !m_pImpl->m_bSuspended // when already suspended then we don't have to reconnect
|
2004-03-19 05:12:26 -06:00
|
|
|
&& !getBroadcastHelper().bInDispose
|
|
|
|
&& !getBroadcastHelper().bDisposed
|
|
|
|
&& isConnected()
|
|
|
|
)
|
|
|
|
{
|
|
|
|
losingConnection();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-07-06 02:38:03 -05:00
|
|
|
m_pImpl->m_xConnection.reset( m_pImpl->m_xConnection, SharedConnection::NoTakeOwnership );
|
2006-07-10 09:39:14 -05:00
|
|
|
// this prevents the "disposeComponent" call in disconnect
|
2004-03-19 05:12:26 -06:00
|
|
|
disconnect();
|
|
|
|
}
|
2001-08-14 06:00:02 -05:00
|
|
|
}
|
|
|
|
else
|
2008-03-06 11:29:31 -06:00
|
|
|
OSingleDocumentController_Base::disposing( _rSource );
|
2001-08-14 06:00:02 -05:00
|
|
|
}
|
2008-12-01 06:31:27 -06:00
|
|
|
|
2002-05-06 02:50:00 -05:00
|
|
|
//--------------------------------------------------------------------
|
2008-12-01 06:31:27 -06:00
|
|
|
void OSingleDocumentController::appendError( const ::rtl::OUString& _rErrorMessage, const ::dbtools::StandardSQLState _eSQLState,
|
|
|
|
const sal_Int32 _nErrorCode )
|
2002-05-06 02:50:00 -05:00
|
|
|
{
|
2008-12-01 06:31:27 -06:00
|
|
|
m_pImpl->m_aCurrentError.append( ::dbtools::SQLExceptionInfo::SQL_EXCEPTION, _rErrorMessage, getStandardSQLStateAscii( _eSQLState ),
|
|
|
|
_nErrorCode );
|
2002-05-06 02:50:00 -05:00
|
|
|
}
|
|
|
|
//--------------------------------------------------------------------
|
2008-12-01 06:31:27 -06:00
|
|
|
void OSingleDocumentController::clearError()
|
2002-05-06 02:50:00 -05:00
|
|
|
{
|
2008-12-01 06:31:27 -06:00
|
|
|
m_pImpl->m_aCurrentError = ::dbtools::SQLExceptionInfo();
|
2002-05-06 02:50:00 -05:00
|
|
|
}
|
2008-12-01 06:31:27 -06:00
|
|
|
|
2002-05-06 02:50:00 -05:00
|
|
|
//--------------------------------------------------------------------
|
2008-12-01 06:31:27 -06:00
|
|
|
sal_Bool OSingleDocumentController::hasError() const
|
2002-05-06 02:50:00 -05:00
|
|
|
{
|
2008-12-01 06:31:27 -06:00
|
|
|
return m_pImpl->m_aCurrentError.isValid();
|
2002-05-06 02:50:00 -05:00
|
|
|
}
|
2008-12-01 06:31:27 -06:00
|
|
|
|
2002-05-06 02:50:00 -05:00
|
|
|
//--------------------------------------------------------------------
|
2008-12-01 06:31:27 -06:00
|
|
|
const ::dbtools::SQLExceptionInfo& OSingleDocumentController::getError() const
|
2002-05-06 02:50:00 -05:00
|
|
|
{
|
2008-12-01 06:31:27 -06:00
|
|
|
return m_pImpl->m_aCurrentError;
|
2002-05-06 02:50:00 -05:00
|
|
|
}
|
2008-12-01 06:31:27 -06:00
|
|
|
|
2002-05-06 02:50:00 -05:00
|
|
|
//--------------------------------------------------------------------
|
2008-12-01 06:31:27 -06:00
|
|
|
void OSingleDocumentController::displayError()
|
2002-05-06 02:50:00 -05:00
|
|
|
{
|
2008-12-01 06:31:27 -06:00
|
|
|
showError( m_pImpl->m_aCurrentError );
|
2002-05-06 02:50:00 -05:00
|
|
|
}
|
2008-12-01 06:31:27 -06:00
|
|
|
|
2002-05-06 02:50:00 -05:00
|
|
|
//--------------------------------------------------------------------
|
2002-07-08 02:15:44 -05:00
|
|
|
sal_Bool SAL_CALL OSingleDocumentController::suspend(sal_Bool bSuspend) throw( RuntimeException )
|
|
|
|
{
|
2007-07-06 02:38:03 -05:00
|
|
|
m_pImpl->m_bSuspended = bSuspend;
|
2002-07-08 02:15:44 -05:00
|
|
|
if ( !bSuspend && !isConnected() )
|
|
|
|
reconnect(sal_True);
|
|
|
|
|
|
|
|
|
|
|
|
return sal_True;
|
|
|
|
}
|
2008-04-08 06:46:07 -05:00
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL OSingleDocumentController::attachModel( const Reference< XModel > & _rxModel) throw( RuntimeException )
|
|
|
|
{
|
2008-10-01 07:28:29 -05:00
|
|
|
if ( !_rxModel.is() )
|
|
|
|
return sal_False;
|
2008-04-08 06:46:07 -05:00
|
|
|
if ( !OSingleDocumentController_Base::attachModel( _rxModel ) )
|
|
|
|
return sal_False;
|
|
|
|
|
2008-10-01 07:28:29 -05:00
|
|
|
m_pImpl->m_bNotAttached = false;
|
|
|
|
if ( m_pImpl->m_nDocStartNumber == 1 )
|
|
|
|
releaseNumberForComponent();
|
|
|
|
|
2008-04-08 06:46:07 -05:00
|
|
|
Reference< XUntitledNumbers > xUntitledProvider( _rxModel, UNO_QUERY );
|
|
|
|
m_pImpl->m_nDocStartNumber = 1;
|
|
|
|
if ( xUntitledProvider.is() )
|
|
|
|
m_pImpl->m_nDocStartNumber = xUntitledProvider->leaseNumber( static_cast< XWeak* >( this ) );
|
|
|
|
|
|
|
|
return sal_True;
|
|
|
|
}
|
|
|
|
|
2002-07-08 02:15:44 -05:00
|
|
|
// -----------------------------------------------------------------------------
|
2002-08-19 02:01:32 -05:00
|
|
|
FeatureState OSingleDocumentController::GetState(sal_uInt16 _nId) const
|
|
|
|
{
|
|
|
|
FeatureState aReturn;
|
|
|
|
// (disabled automatically)
|
|
|
|
aReturn.bEnabled = sal_True;
|
2002-07-08 02:15:44 -05:00
|
|
|
|
2002-08-19 02:01:32 -05:00
|
|
|
switch (_nId)
|
|
|
|
{
|
|
|
|
case ID_BROWSER_UNDO:
|
2007-07-06 02:38:03 -05:00
|
|
|
aReturn.bEnabled = m_pImpl->m_bEditable && m_aUndoManager.GetUndoActionCount() != 0;
|
2002-08-19 02:01:32 -05:00
|
|
|
if ( aReturn.bEnabled )
|
|
|
|
{
|
|
|
|
String sUndo(ModuleRes(STR_UNDO_COLON));
|
|
|
|
sUndo += String(RTL_CONSTASCII_USTRINGPARAM(" "));
|
|
|
|
sUndo += m_aUndoManager.GetUndoActionComment();
|
2006-07-10 09:39:14 -05:00
|
|
|
aReturn.sTitle = sUndo;
|
2002-08-19 02:01:32 -05:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ID_BROWSER_REDO:
|
2007-07-06 02:38:03 -05:00
|
|
|
aReturn.bEnabled = m_pImpl->m_bEditable && m_aUndoManager.GetRedoActionCount() != 0;
|
2002-08-19 02:01:32 -05:00
|
|
|
if ( aReturn.bEnabled )
|
|
|
|
{
|
|
|
|
String sRedo(ModuleRes(STR_REDO_COLON));
|
|
|
|
sRedo += String(RTL_CONSTASCII_USTRINGPARAM(" "));
|
|
|
|
sRedo += m_aUndoManager.GetRedoActionComment();
|
2006-07-10 09:39:14 -05:00
|
|
|
aReturn.sTitle = sRedo;
|
2002-08-19 02:01:32 -05:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2008-03-06 11:29:31 -06:00
|
|
|
aReturn = OSingleDocumentController_Base::GetState(_nId);
|
2002-08-19 02:01:32 -05:00
|
|
|
}
|
|
|
|
return aReturn;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2008-06-25 06:51:12 -05:00
|
|
|
void OSingleDocumentController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& _rArgs)
|
2002-08-19 02:01:32 -05:00
|
|
|
{
|
|
|
|
switch(_nId)
|
|
|
|
{
|
2002-11-08 06:20:09 -06:00
|
|
|
case ID_BROWSER_CLOSE:
|
2002-08-19 02:01:32 -05:00
|
|
|
closeTask();
|
|
|
|
return;
|
|
|
|
case ID_BROWSER_UNDO:
|
|
|
|
m_aUndoManager.Undo();
|
|
|
|
InvalidateFeature(ID_BROWSER_REDO);
|
|
|
|
break;
|
|
|
|
case ID_BROWSER_REDO:
|
|
|
|
m_aUndoManager.Redo();
|
|
|
|
InvalidateFeature(ID_BROWSER_UNDO);
|
|
|
|
break;
|
2008-06-25 06:51:12 -05:00
|
|
|
default:
|
|
|
|
OSingleDocumentController_Base::Execute( _nId, _rArgs );
|
|
|
|
break;
|
2002-08-19 02:01:32 -05:00
|
|
|
}
|
|
|
|
InvalidateFeature(_nId);
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
SfxUndoManager* OSingleDocumentController::getUndoMgr()
|
|
|
|
{
|
|
|
|
return &m_aUndoManager;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OSingleDocumentController::addUndoActionAndInvalidate(SfxUndoAction *_pAction)
|
|
|
|
{
|
|
|
|
// add undo action
|
|
|
|
m_aUndoManager.AddUndoAction(_pAction);
|
|
|
|
// when we add an undo action the controller was modified
|
|
|
|
setModified(sal_True);
|
|
|
|
// now inform me that or states changed
|
|
|
|
InvalidateFeature(ID_BROWSER_UNDO);
|
|
|
|
InvalidateFeature(ID_BROWSER_REDO);
|
|
|
|
}
|
2005-09-23 06:41:29 -05:00
|
|
|
|
2004-08-02 10:11:35 -05:00
|
|
|
// -----------------------------------------------------------------------------
|
2007-07-06 02:38:03 -05:00
|
|
|
::rtl::OUString OSingleDocumentController::getDataSourceName() const
|
|
|
|
{
|
|
|
|
::rtl::OUString sName;
|
2008-03-06 11:29:31 -06:00
|
|
|
Reference< XPropertySet > xDataSourceProps( m_pImpl->m_aDataSource.getDataSourceProps() );
|
|
|
|
if ( xDataSourceProps.is() )
|
|
|
|
xDataSourceProps->getPropertyValue(PROPERTY_NAME) >>= sName;
|
2007-07-06 02:38:03 -05:00
|
|
|
return sName;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OSingleDocumentController::connectionLostMessage() const
|
|
|
|
{
|
|
|
|
String aMessage(ModuleRes(RID_STR_CONNECTION_LOST));
|
2008-03-06 11:29:31 -06:00
|
|
|
Reference< XWindow > xWindow = getTopMostContainerWindow();
|
2007-07-06 02:38:03 -05:00
|
|
|
Window* pWin = NULL;
|
|
|
|
if ( xWindow.is() )
|
|
|
|
pWin = VCLUnoHelper::GetWindow(xWindow);
|
|
|
|
if ( !pWin )
|
|
|
|
pWin = getView()->Window::GetParent();
|
|
|
|
|
|
|
|
InfoBox(pWin, aMessage).Execute();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2008-03-06 11:29:31 -06:00
|
|
|
const Reference< XConnection >& OSingleDocumentController::getConnection() const
|
2007-07-06 02:38:03 -05:00
|
|
|
{
|
|
|
|
return m_pImpl->m_xConnection;
|
|
|
|
}
|
2008-03-06 11:29:31 -06:00
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
sal_Bool OSingleDocumentController::isReadOnly() const
|
|
|
|
{
|
|
|
|
return !m_pImpl->m_bEditable;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
sal_Bool OSingleDocumentController::isEditable() const
|
|
|
|
{
|
|
|
|
return m_pImpl->m_bEditable;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OSingleDocumentController::setEditable(sal_Bool _bEditable)
|
|
|
|
{
|
|
|
|
m_pImpl->m_bEditable = _bEditable;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
const ::dbtools::DatabaseMetaData& OSingleDocumentController::getSdbMetaData() const
|
|
|
|
{
|
|
|
|
return m_pImpl->m_aSdbMetaData;
|
|
|
|
}
|
|
|
|
|
2007-07-06 02:38:03 -05:00
|
|
|
// -----------------------------------------------------------------------------
|
2008-03-06 11:29:31 -06:00
|
|
|
sal_Bool OSingleDocumentController::isConnected() const
|
|
|
|
{
|
|
|
|
return m_pImpl->m_xConnection.is();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
Reference< XDatabaseMetaData > OSingleDocumentController::getMetaData( ) const
|
|
|
|
{
|
2008-06-06 08:12:17 -05:00
|
|
|
Reference< XDatabaseMetaData > xMeta;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if ( isConnected() )
|
|
|
|
xMeta.set( m_pImpl->m_xConnection->getMetaData(), UNO_SET_THROW );
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
return xMeta;
|
2008-03-06 11:29:31 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
const Reference< XPropertySet >& OSingleDocumentController::getDataSource() const
|
|
|
|
{
|
|
|
|
return m_pImpl->m_aDataSource.getDataSourceProps();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
sal_Bool OSingleDocumentController::haveDataSource() const
|
|
|
|
{
|
|
|
|
return m_pImpl->m_aDataSource.is();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
Reference< XModel > OSingleDocumentController::getDatabaseDocument() const
|
|
|
|
{
|
|
|
|
return Reference< XModel >( m_pImpl->m_aDataSource.getDatabaseDocument(), UNO_QUERY );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
Reference< XNumberFormatter > OSingleDocumentController::getNumberFormatter() const
|
|
|
|
{
|
|
|
|
return m_pImpl->m_xFormatter;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
2008-04-08 06:46:07 -05:00
|
|
|
Reference< XModel > OSingleDocumentController::getPrivateModel() const
|
2008-04-04 09:02:02 -05:00
|
|
|
{
|
2008-04-07 06:32:46 -05:00
|
|
|
return getDatabaseDocument();
|
2008-04-04 09:02:02 -05:00
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
// XTitle
|
|
|
|
::rtl::OUString SAL_CALL OSingleDocumentController::getTitle()
|
2008-04-08 06:46:07 -05:00
|
|
|
throw (RuntimeException)
|
2008-04-04 09:02:02 -05:00
|
|
|
{
|
2008-12-01 06:31:27 -06:00
|
|
|
::osl::MutexGuard aGuard( getMutex() );
|
2008-04-04 09:02:02 -05:00
|
|
|
if ( m_bExternalTitle )
|
|
|
|
return impl_getTitleHelper_throw()->getTitle ();
|
|
|
|
|
|
|
|
::rtl::OUStringBuffer sTitle;
|
2008-04-08 06:46:07 -05:00
|
|
|
Reference< XTitle > xTitle(getPrivateModel(),UNO_QUERY);
|
2008-04-04 09:02:02 -05:00
|
|
|
if ( xTitle.is() )
|
|
|
|
{
|
|
|
|
sTitle.append( xTitle->getTitle() );
|
|
|
|
sTitle.appendAscii(" : ");
|
|
|
|
}
|
|
|
|
sTitle.append( getPrivateTitle() );
|
|
|
|
|
|
|
|
return sTitle.makeStringAndClear();
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
sal_Int32 OSingleDocumentController::getCurrentStartNumber() const
|
|
|
|
{
|
|
|
|
return m_pImpl->m_nDocStartNumber;
|
|
|
|
}
|
2008-04-08 06:46:07 -05:00
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
Reference< XEmbeddedScripts > SAL_CALL OSingleDocumentController::getScriptContainer() throw (RuntimeException)
|
|
|
|
{
|
2008-12-01 06:31:27 -06:00
|
|
|
::osl::MutexGuard aGuard( getMutex() );
|
2008-04-08 06:46:07 -05:00
|
|
|
if ( !m_pImpl->documentHasScriptSupport() )
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return Reference< XEmbeddedScripts >( getDatabaseDocument(), UNO_QUERY_THROW );
|
|
|
|
}
|
|
|
|
|
2010-02-10 07:05:19 -06:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OSingleDocumentController::addModifyListener( const Reference< XModifyListener >& i_Listener ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( getMutex() );
|
|
|
|
m_pImpl->m_aModifyListeners.addInterface( i_Listener );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OSingleDocumentController::removeModifyListener( const Reference< XModifyListener >& i_Listener ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( getMutex() );
|
|
|
|
m_pImpl->m_aModifyListeners.removeInterface( i_Listener );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
::sal_Bool SAL_CALL OSingleDocumentController::isModified( ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( getMutex() );
|
|
|
|
return impl_isModified();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OSingleDocumentController::setModified( ::sal_Bool i_bModified ) throw (PropertyVetoException, RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::ClearableMutexGuard aGuard( getMutex() );
|
|
|
|
|
|
|
|
if ( m_pImpl->m_bModified == i_bModified )
|
|
|
|
return;
|
|
|
|
|
|
|
|
m_pImpl->m_bModified = i_bModified;
|
|
|
|
impl_onModifyChanged();
|
|
|
|
|
|
|
|
EventObject aEvent( *this );
|
|
|
|
aGuard.clear();
|
|
|
|
m_pImpl->m_aModifyListeners.notifyEach( &XModifyListener::modified, aEvent );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
sal_Bool OSingleDocumentController::impl_isModified() const
|
|
|
|
{
|
|
|
|
return m_pImpl->m_bModified;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void OSingleDocumentController::impl_onModifyChanged()
|
|
|
|
{
|
|
|
|
InvalidateFeature( ID_BROWSER_SAVEDOC );
|
|
|
|
if ( isFeatureSupported( ID_BROWSER_SAVEASDOC ) )
|
|
|
|
InvalidateFeature( ID_BROWSER_SAVEASDOC );
|
|
|
|
}
|
|
|
|
|
2001-08-14 06:00:02 -05:00
|
|
|
//........................................................................
|
|
|
|
} // namespace dbaui
|
|
|
|
//........................................................................
|
|
|
|
|
2010-10-12 08:59:03 -05:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|