2010-10-12 15:59:03 +02: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:11 +00:00
|
|
|
|
|
|
|
#include "AppController.hxx"
|
|
|
|
#include "dbustrings.hrc"
|
2007-11-01 14:03:13 +00:00
|
|
|
#include "advancedsettingsdlg.hxx"
|
2008-12-01 12:31:27 +00:00
|
|
|
#include "subcomponentmanager.hxx"
|
2014-04-13 22:40:55 +02:00
|
|
|
#include "uiservices.hxx"
|
2007-11-01 14:03:13 +00:00
|
|
|
|
2008-03-06 17:09:10 +00:00
|
|
|
#include <com/sun/star/beans/NamedValue.hpp>
|
2004-08-02 14:28:11 +00:00
|
|
|
#include <com/sun/star/container/XChild.hpp>
|
|
|
|
#include <com/sun/star/container/XContainer.hpp>
|
2007-07-06 06:57:53 +00:00
|
|
|
#include <com/sun/star/container/XContentEnumerationAccess.hpp>
|
2008-03-06 17:09:10 +00:00
|
|
|
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
|
|
|
|
#include <com/sun/star/container/XHierarchicalNameContainer.hpp>
|
|
|
|
#include <com/sun/star/container/XNameContainer.hpp>
|
|
|
|
#include <com/sun/star/frame/FrameSearchFlag.hpp>
|
|
|
|
#include <com/sun/star/frame/XStorable.hpp>
|
2004-08-02 14:28:11 +00:00
|
|
|
#include <com/sun/star/sdb/CommandType.hpp>
|
2012-12-06 14:15:55 +02:00
|
|
|
#include <com/sun/star/sdb/ErrorMessageDialog.hpp>
|
2004-08-02 14:28:11 +00:00
|
|
|
#include <com/sun/star/sdb/SQLContext.hpp>
|
2008-03-06 17:09:10 +00:00
|
|
|
#include <com/sun/star/sdb/XBookmarksSupplier.hpp>
|
|
|
|
#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
|
2004-08-02 14:28:11 +00:00
|
|
|
#include <com/sun/star/sdb/XQueryDefinitionsSupplier.hpp>
|
2008-03-06 17:09:10 +00:00
|
|
|
#include <com/sun/star/sdbc/XDataSource.hpp>
|
|
|
|
#include <com/sun/star/sdbcx/XAlterView.hpp>
|
|
|
|
#include <com/sun/star/sdbcx/XAppend.hpp>
|
|
|
|
#include <com/sun/star/sdbcx/XRename.hpp>
|
|
|
|
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
|
|
|
|
#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
|
2013-03-11 17:51:56 +02:00
|
|
|
#include <com/sun/star/sdb/application/MacroMigrationWizard.hpp>
|
2008-03-06 17:09:10 +00:00
|
|
|
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
|
|
|
|
#include <com/sun/star/uno/XNamingService.hpp>
|
2005-10-24 07:30:07 +00:00
|
|
|
#include <com/sun/star/util/XFlushable.hpp>
|
2008-03-06 17:09:10 +00:00
|
|
|
#include <com/sun/star/util/XModifiable.hpp>
|
|
|
|
#include <com/sun/star/util/XModifyBroadcaster.hpp>
|
|
|
|
#include <com/sun/star/util/XNumberFormatter.hpp>
|
|
|
|
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
|
|
|
|
#include <com/sun/star/document/XEmbeddedScripts.hpp>
|
|
|
|
#include <com/sun/star/frame/XModel2.hpp>
|
2008-04-04 13:53:36 +00:00
|
|
|
#include <com/sun/star/awt/XTopWindow.hpp>
|
2008-06-06 13:06:49 +00:00
|
|
|
#include <com/sun/star/task/XInteractionHandler.hpp>
|
2008-06-25 11:35:22 +00:00
|
|
|
#include <com/sun/star/sdb/application/DatabaseObject.hpp>
|
|
|
|
#include <com/sun/star/sdb/application/DatabaseObjectContainer.hpp>
|
2008-10-16 06:57:26 +00:00
|
|
|
#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
|
2010-02-02 23:05:43 +01:00
|
|
|
#include <com/sun/star/container/XHierarchicalName.hpp>
|
2006-06-20 01:53:25 +00:00
|
|
|
#include <tools/diagnose_ex.h>
|
2011-02-03 00:33:36 +01:00
|
|
|
#include <osl/diagnose.h>
|
2009-11-27 10:17:16 +01:00
|
|
|
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/urihelper.hxx>
|
2010-01-27 13:51:16 +01:00
|
|
|
#include <svl/filenotation.hxx>
|
2012-10-11 16:13:12 -04:00
|
|
|
#include <svtools/treelistbox.hxx>
|
2009-11-27 10:17:16 +01:00
|
|
|
#include <svtools/transfer.hxx>
|
|
|
|
#include <svtools/cliplistener.hxx>
|
|
|
|
#include <svtools/svlbitm.hxx>
|
|
|
|
#include <svtools/insdlg.hxx>
|
|
|
|
|
|
|
|
#include <comphelper/sequence.hxx>
|
|
|
|
#include <comphelper/uno3.hxx>
|
2004-08-02 14:28:11 +00:00
|
|
|
#include <comphelper/types.hxx>
|
2008-06-06 13:06:49 +00:00
|
|
|
#include <comphelper/interaction.hxx>
|
2012-12-06 14:15:55 +02:00
|
|
|
#include <comphelper/processfactory.hxx>
|
2009-11-27 10:17:16 +01:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
#include <vcl/msgbox.hxx>
|
2008-03-06 17:09:10 +00:00
|
|
|
#include <vcl/stdtext.hxx>
|
2009-11-27 10:17:16 +01:00
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
#include <vcl/menu.hxx>
|
|
|
|
#include <vcl/lstbox.hxx>
|
|
|
|
|
2011-10-31 21:18:24 +01:00
|
|
|
#include <unotools/closeveto.hxx>
|
2010-01-27 13:51:16 +01:00
|
|
|
#include <unotools/pathoptions.hxx>
|
|
|
|
#include <unotools/tempfile.hxx>
|
|
|
|
#include <unotools/moduleoptions.hxx>
|
|
|
|
#include <unotools/historyoptions.hxx>
|
|
|
|
|
2009-11-27 10:17:16 +01:00
|
|
|
#include <sfx2/mailmodelapi.hxx>
|
2004-08-02 14:28:11 +00:00
|
|
|
#include <sfx2/filedlghelper.hxx>
|
2009-11-27 10:17:16 +01:00
|
|
|
#include <sfx2/docfilt.hxx>
|
|
|
|
#include <sfx2/QuerySaveDocument.hxx>
|
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
#include <cppuhelper/typeprovider.hxx>
|
2008-05-05 14:51:14 +00:00
|
|
|
#include <cppuhelper/exc_hlp.hxx>
|
2009-11-27 10:17:16 +01:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
#include <connectivity/dbtools.hxx>
|
2009-11-27 10:17:16 +01:00
|
|
|
#include <connectivity/dbexception.hxx>
|
|
|
|
|
|
|
|
#include <svx/dbaexchange.hxx>
|
|
|
|
#include <svx/dbaobjectex.hxx>
|
|
|
|
#include <svx/svxdlg.hxx>
|
|
|
|
|
2010-10-16 03:13:32 -05:00
|
|
|
#include <osl/mutex.hxx>
|
2004-08-02 14:28:11 +00:00
|
|
|
#include "AppView.hxx"
|
|
|
|
#include "browserids.hxx"
|
|
|
|
#include "dbu_reghelper.hxx"
|
|
|
|
#include "dbu_app.hrc"
|
2006-07-10 14:22:12 +00:00
|
|
|
#include "defaultobjectnamecheck.hxx"
|
2006-10-05 11:59:07 +00:00
|
|
|
#include "databaseobjectview.hxx"
|
2004-08-02 14:28:11 +00:00
|
|
|
#include "listviewitems.hxx"
|
|
|
|
#include "AppDetailView.hxx"
|
|
|
|
#include "linkeddocuments.hxx"
|
|
|
|
#include "sqlmessage.hxx"
|
|
|
|
#include "UITools.hxx"
|
|
|
|
#include "dsntypes.hxx"
|
|
|
|
#include "dbaccess_helpid.hrc"
|
|
|
|
#include "dlgsave.hxx"
|
2004-10-27 11:55:51 +00:00
|
|
|
#include "dbaccess_slotid.hrc"
|
2008-03-06 17:09:10 +00:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
#include <functional>
|
|
|
|
|
2008-06-25 11:35:22 +00:00
|
|
|
#include <boost/noncopyable.hpp>
|
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
extern "C" void SAL_CALL createRegistryInfo_ODBApplication()
|
|
|
|
{
|
|
|
|
static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OApplicationController > aAutoRegistration;
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
namespace dbaui
|
|
|
|
{
|
|
|
|
using namespace ::dbtools;
|
|
|
|
using namespace ::svx;
|
2008-04-04 13:53:36 +00:00
|
|
|
using namespace ::com::sun::star;
|
2004-08-02 14:28:11 +00:00
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::ucb;
|
2007-09-26 13:46:26 +00:00
|
|
|
using namespace ::com::sun::star::view;
|
2004-08-02 14:28:11 +00:00
|
|
|
using namespace ::com::sun::star::util;
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star::frame;
|
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
using namespace ::com::sun::star::sdb;
|
|
|
|
using namespace ::com::sun::star::sdbc;
|
|
|
|
using namespace ::com::sun::star::sdbcx;
|
|
|
|
using namespace ::com::sun::star::datatransfer;
|
2008-03-06 17:09:10 +00:00
|
|
|
using namespace ::com::sun::star::ui::dialogs;
|
2008-06-06 13:06:49 +00:00
|
|
|
using namespace ::com::sun::star::task;
|
2008-03-06 17:09:10 +00:00
|
|
|
using ::com::sun::star::document::XEmbeddedScripts;
|
2008-10-16 06:57:26 +00:00
|
|
|
using ::com::sun::star::document::XDocumentEventBroadcaster;
|
|
|
|
using ::com::sun::star::document::DocumentEvent;
|
2008-06-25 11:35:22 +00:00
|
|
|
using ::com::sun::star::sdb::application::NamedDatabaseObject;
|
|
|
|
|
|
|
|
namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject;
|
|
|
|
namespace DatabaseObjectContainer = ::com::sun::star::sdb::application::DatabaseObjectContainer;
|
2004-08-02 14:28:11 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
OUString SAL_CALL OApplicationController::getImplementationName() throw( RuntimeException, std::exception )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
return getImplementationName_Static();
|
|
|
|
}
|
|
|
|
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString OApplicationController::getImplementationName_Static() throw( RuntimeException )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
return OUString(SERVICE_SDB_APPLICATIONCONTROLLER);
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2015-04-14 12:44:47 +02:00
|
|
|
Sequence< OUString> OApplicationController::getSupportedServiceNames_Static() throw( RuntimeException )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2015-11-15 12:22:28 +02:00
|
|
|
Sequence<OUString> aSupported { "com.sun.star.sdb.application.DefaultViewController" };
|
2004-08-02 14:28:11 +00:00
|
|
|
return aSupported;
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Sequence< OUString> SAL_CALL OApplicationController::getSupportedServiceNames() throw(RuntimeException, std::exception)
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
return getSupportedServiceNames_Static();
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
Reference< XInterface > SAL_CALL OApplicationController::Create(const Reference<XMultiServiceFactory >& _rxFactory)
|
|
|
|
{
|
2013-01-07 17:46:55 +02:00
|
|
|
return *(new OApplicationController( comphelper::getComponentContext(_rxFactory)));
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
|
2013-08-17 23:43:14 +02:00
|
|
|
// OApplicationController
|
2008-06-25 11:35:22 +00:00
|
|
|
class SelectionNotifier : public ::boost::noncopyable
|
|
|
|
{
|
|
|
|
private:
|
2016-01-19 19:45:45 +02:00
|
|
|
::comphelper::OInterfaceContainerHelper2 m_aSelectionListeners;
|
2008-06-25 11:35:22 +00:00
|
|
|
::cppu::OWeakObject& m_rContext;
|
|
|
|
sal_Int32 m_nSelectionNestingLevel;
|
|
|
|
|
|
|
|
public:
|
|
|
|
SelectionNotifier( ::osl::Mutex& _rMutex, ::cppu::OWeakObject& _rContext )
|
|
|
|
:m_aSelectionListeners( _rMutex )
|
|
|
|
,m_rContext( _rContext )
|
|
|
|
,m_nSelectionNestingLevel( 0 )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void addListener( const Reference< XSelectionChangeListener >& _Listener )
|
|
|
|
{
|
|
|
|
m_aSelectionListeners.addInterface( _Listener );
|
|
|
|
}
|
|
|
|
|
|
|
|
void removeListener( const Reference< XSelectionChangeListener >& _Listener )
|
|
|
|
{
|
|
|
|
m_aSelectionListeners.removeInterface( _Listener );
|
|
|
|
}
|
|
|
|
|
|
|
|
void disposing()
|
|
|
|
{
|
|
|
|
EventObject aEvent( m_rContext );
|
|
|
|
m_aSelectionListeners.disposeAndClear( aEvent );
|
|
|
|
}
|
|
|
|
|
|
|
|
~SelectionNotifier()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
struct SelectionGuardAccess { friend class SelectionGuard; private: SelectionGuardAccess() { } };
|
|
|
|
|
|
|
|
/** enters a block which modifies the selection of our owner.
|
|
|
|
|
|
|
|
Can be called multiple times, the only important thing is to call leaveSelection
|
|
|
|
equally often.
|
|
|
|
*/
|
|
|
|
void enterSelection( SelectionGuardAccess )
|
|
|
|
{
|
|
|
|
++m_nSelectionNestingLevel;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** leaves a block which modifies the selection of our owner
|
|
|
|
|
|
|
|
Must be paired with enterSelection calls.
|
|
|
|
|
|
|
|
When the last block is left, i.e. the last leaveSelection call is made on the current stack,
|
|
|
|
then our SelectionChangeListeners are notified
|
|
|
|
*/
|
|
|
|
void leaveSelection( SelectionGuardAccess )
|
|
|
|
{
|
|
|
|
if ( --m_nSelectionNestingLevel == 0 )
|
|
|
|
{
|
|
|
|
EventObject aEvent( m_rContext );
|
|
|
|
m_aSelectionListeners.notifyEach( &XSelectionChangeListener::selectionChanged, aEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class SelectionGuard : public ::boost::noncopyable
|
|
|
|
{
|
|
|
|
public:
|
2015-07-20 10:07:53 +01:00
|
|
|
explicit SelectionGuard( SelectionNotifier& _rNotifier )
|
2008-06-25 11:35:22 +00:00
|
|
|
:m_rNotifier( _rNotifier )
|
|
|
|
{
|
|
|
|
m_rNotifier.enterSelection( SelectionNotifier::SelectionGuardAccess() );
|
|
|
|
}
|
|
|
|
|
|
|
|
~SelectionGuard()
|
|
|
|
{
|
|
|
|
m_rNotifier.leaveSelection( SelectionNotifier::SelectionGuardAccess() );
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
SelectionNotifier& m_rNotifier;
|
|
|
|
};
|
|
|
|
|
2013-08-17 23:43:14 +02:00
|
|
|
// OApplicationController
|
2013-01-07 17:46:55 +02:00
|
|
|
OApplicationController::OApplicationController(const Reference< XComponentContext >& _rxORB)
|
2015-10-09 12:05:50 +02:00
|
|
|
:OGenericUnoController( _rxORB )
|
2008-12-01 12:31:27 +00:00
|
|
|
,m_aContextMenuInterceptors( getMutex() )
|
2009-02-17 15:39:54 +00:00
|
|
|
,m_pSubComponentManager( new SubComponentManager( *this, getSharedMutex() ) )
|
2013-01-07 17:46:55 +02:00
|
|
|
,m_aTypeCollection( _rxORB )
|
2006-06-20 01:53:25 +00:00
|
|
|
,m_aTableCopyHelper(this)
|
2015-11-10 10:13:39 +01:00
|
|
|
,m_pClipbordNotifier(nullptr)
|
|
|
|
,m_nAsyncDrop(nullptr)
|
2008-06-25 11:35:22 +00:00
|
|
|
,m_aSelectContainerEvent( LINK( this, OApplicationController, OnSelectContainer ) )
|
2004-08-02 14:28:11 +00:00
|
|
|
,m_ePreviewMode(E_PREVIEWNONE)
|
2008-03-06 17:09:10 +00:00
|
|
|
,m_eCurrentType(E_NONE)
|
2014-04-17 11:16:55 +02:00
|
|
|
,m_bNeedToReconnect(false)
|
|
|
|
,m_bSuspended( false )
|
2008-12-01 12:31:27 +00:00
|
|
|
,m_pSelectionNotifier( new SelectionNotifier( getMutex(), *this ) )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
OApplicationController::~OApplicationController()
|
|
|
|
{
|
|
|
|
if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
|
|
|
|
{
|
2011-03-12 12:04:35 +01:00
|
|
|
OSL_FAIL("Please check who doesn't dispose this component!");
|
2004-08-02 14:28:11 +00:00
|
|
|
// increment ref count to prevent double call of Dtor
|
2012-09-22 01:51:12 -05:00
|
|
|
osl_atomic_increment( &m_refCount );
|
2004-08-02 14:28:11 +00:00
|
|
|
dispose();
|
|
|
|
}
|
2010-02-09 17:26:40 +01:00
|
|
|
clearView();
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2015-10-09 12:05:50 +02:00
|
|
|
IMPLEMENT_FORWARD_XTYPEPROVIDER2(OApplicationController,OGenericUnoController,OApplicationController_Base)
|
|
|
|
IMPLEMENT_FORWARD_XINTERFACE2(OApplicationController,OGenericUnoController,OApplicationController_Base)
|
2005-10-24 07:30:07 +00:00
|
|
|
void OApplicationController::disconnect()
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2005-10-24 07:30:07 +00:00
|
|
|
if ( m_xDataSourceConnection.is() )
|
|
|
|
stopConnectionListening( m_xDataSourceConnection );
|
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
try
|
|
|
|
{
|
2005-10-24 07:30:07 +00:00
|
|
|
// temporary (hopefully!) hack for #i55274#
|
|
|
|
Reference< XFlushable > xFlush( m_xDataSourceConnection, UNO_QUERY );
|
2006-01-31 17:40:35 +00:00
|
|
|
if ( xFlush.is() && m_xMetaData.is() && !m_xMetaData->isReadOnly() )
|
2005-10-24 07:30:07 +00:00
|
|
|
xFlush->flush();
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2006-06-20 01:53:25 +00:00
|
|
|
catch( const Exception& )
|
2005-10-24 07:30:07 +00:00
|
|
|
{
|
2006-06-20 01:53:25 +00:00
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2005-10-24 07:30:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_xDataSourceConnection.clear();
|
|
|
|
m_xMetaData.clear();
|
|
|
|
|
|
|
|
InvalidateAll();
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2005-10-24 07:30:07 +00:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
void SAL_CALL OApplicationController::disposing()
|
|
|
|
{
|
2015-09-05 18:35:35 -04:00
|
|
|
for( const auto& rContainerListener : m_aCurrentContainers )
|
|
|
|
{
|
|
|
|
if( rContainerListener.is() )
|
|
|
|
{
|
|
|
|
rContainerListener->removeContainerListener( this );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-01-21 16:05:05 +00:00
|
|
|
m_aCurrentContainers.clear();
|
2008-12-01 12:31:27 +00:00
|
|
|
m_pSubComponentManager->disposing();
|
2008-06-25 11:35:22 +00:00
|
|
|
m_pSelectionNotifier->disposing();
|
2004-08-02 14:28:11 +00:00
|
|
|
|
|
|
|
if ( getView() )
|
|
|
|
{
|
2015-11-10 10:13:39 +01:00
|
|
|
getContainer()->showPreview(nullptr);
|
2004-08-02 14:28:11 +00:00
|
|
|
m_pClipbordNotifier->ClearCallbackLink();
|
2014-03-20 09:26:52 +02:00
|
|
|
m_pClipbordNotifier->AddRemoveListener( getView(), false );
|
2004-08-02 14:28:11 +00:00
|
|
|
m_pClipbordNotifier->release();
|
2015-11-10 10:13:39 +01:00
|
|
|
m_pClipbordNotifier = nullptr;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
|
2005-10-24 07:30:07 +00:00
|
|
|
disconnect();
|
2004-08-02 14:28:11 +00:00
|
|
|
try
|
|
|
|
{
|
2005-03-10 15:43:10 +00:00
|
|
|
Reference < XFrame > xFrame;
|
|
|
|
attachFrame( xFrame );
|
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
if ( m_xDataSource.is() )
|
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
m_xDataSource->removePropertyChangeListener(OUString(), this);
|
2008-01-29 07:51:32 +00:00
|
|
|
m_xDataSource->removePropertyChangeListener(PROPERTY_INFO, this);
|
|
|
|
m_xDataSource->removePropertyChangeListener(PROPERTY_URL, this);
|
|
|
|
m_xDataSource->removePropertyChangeListener(PROPERTY_ISPASSWORDREQUIRED, this);
|
|
|
|
m_xDataSource->removePropertyChangeListener(PROPERTY_LAYOUTINFORMATION, this);
|
|
|
|
m_xDataSource->removePropertyChangeListener(PROPERTY_SUPPRESSVERSIONCL, this);
|
|
|
|
m_xDataSource->removePropertyChangeListener(PROPERTY_TABLEFILTER, this);
|
|
|
|
m_xDataSource->removePropertyChangeListener(PROPERTY_TABLETYPEFILTER, this);
|
|
|
|
m_xDataSource->removePropertyChangeListener(PROPERTY_USER, this);
|
2005-03-10 15:43:10 +00:00
|
|
|
// otherwise we may delete our datasource twice
|
|
|
|
Reference<XPropertySet> xProp = m_xDataSource;
|
2015-11-10 10:13:39 +01:00
|
|
|
m_xDataSource = nullptr;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2005-03-10 15:43:10 +00:00
|
|
|
|
2005-09-23 11:14:21 +00:00
|
|
|
Reference< XModifyBroadcaster > xBroadcaster( m_xModel, UNO_QUERY );
|
2005-03-10 15:43:10 +00:00
|
|
|
if ( xBroadcaster.is() )
|
|
|
|
xBroadcaster->removeModifyListener(static_cast<XModifyListener*>(this));
|
|
|
|
|
|
|
|
if ( m_xModel.is() )
|
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sUrl = m_xModel->getURL();
|
2011-12-19 18:10:37 -02:00
|
|
|
if ( !sUrl.isEmpty() )
|
2005-03-10 15:43:10 +00:00
|
|
|
{
|
2008-10-16 06:57:26 +00:00
|
|
|
::comphelper::NamedValueCollection aArgs( m_xModel->getArgs() );
|
2015-04-27 15:27:03 +02:00
|
|
|
if ( aArgs.getOrDefault( "PickListEntry", true ) )
|
2008-10-16 06:57:26 +00:00
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString aFilter;
|
2008-10-16 06:57:26 +00:00
|
|
|
INetURLObject aURL( m_xModel->getURL() );
|
|
|
|
const SfxFilter* pFilter = getStandardDatabaseFilter();
|
|
|
|
if ( pFilter )
|
|
|
|
aFilter = pFilter->GetFilterName();
|
|
|
|
|
|
|
|
// add to svtool history options
|
|
|
|
SvtHistoryOptions().AppendItem( ePICKLIST,
|
|
|
|
aURL.GetURLNoPass( INetURLObject::NO_DECODE ),
|
|
|
|
aFilter,
|
|
|
|
getStrippedDatabaseName(),
|
2014-02-04 00:33:14 +01:00
|
|
|
OUString(),
|
2015-06-30 20:30:33 +03:00
|
|
|
boost::none);
|
2013-10-04 10:01:51 +02:00
|
|
|
|
|
|
|
// add to recent document list
|
2015-04-02 18:32:36 +02:00
|
|
|
if ( aURL.GetProtocol() == INetProtocol::File )
|
2013-10-04 10:01:51 +02:00
|
|
|
Application::AddToRecentDocumentList( aURL.GetURLNoPass( INetURLObject::NO_DECODE ),
|
|
|
|
(pFilter) ? pFilter->GetMimeType() : OUString(),
|
|
|
|
(pFilter) ? pFilter->GetServiceName() : OUString() );
|
2008-10-16 06:57:26 +00:00
|
|
|
}
|
2005-03-10 15:43:10 +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
|
|
|
m_xModel->disconnectController( this );
|
|
|
|
|
2005-09-23 11:14:21 +00:00
|
|
|
m_xModel.clear();
|
|
|
|
}
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2011-04-13 09:40:26 +01:00
|
|
|
catch(const Exception&)
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2008-10-16 06:57:26 +00:00
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
|
2010-02-09 17:26:40 +01:00
|
|
|
clearView();
|
2015-10-09 12:05:50 +02:00
|
|
|
OGenericUnoController::disposing(); // here the m_refCount must be equal 5
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
|
2014-09-23 11:20:40 +02:00
|
|
|
bool OApplicationController::Construct(vcl::Window* _pParent)
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2015-04-20 14:00:04 +01:00
|
|
|
setView( VclPtr<OApplicationView>::Create( _pParent, getORB(), *this, m_ePreviewMode ) );
|
2010-02-09 17:26:40 +01:00
|
|
|
getView()->SetUniqueId(UID_APP_VIEW);
|
2005-01-05 11:32:18 +00:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
// late construction
|
2014-04-01 09:53:24 +02:00
|
|
|
bool bSuccess = false;
|
2004-08-02 14:28:11 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
getContainer()->Construct();
|
2014-04-01 09:53:24 +02:00
|
|
|
bSuccess = true;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2011-04-13 09:40:26 +01:00
|
|
|
catch(const SQLException&)
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
}
|
2011-04-13 09:40:26 +01:00
|
|
|
catch(const Exception&)
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2011-02-25 17:47:41 +01:00
|
|
|
OSL_FAIL("OApplicationController::Construct : the construction of UnoDataBrowserView failed !");
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( !bSuccess )
|
|
|
|
{
|
2010-02-09 17:26:40 +01:00
|
|
|
clearView();
|
2014-04-01 09:53:24 +02:00
|
|
|
return false;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// now that we have a view we can create the clipboard listener
|
|
|
|
m_aSystemClipboard = TransferableDataHelper::CreateFromSystemClipboard( getView() );
|
|
|
|
m_aSystemClipboard.StartClipboardListening( );
|
|
|
|
|
|
|
|
m_pClipbordNotifier = new TransferableClipboardListener( LINK( this, OApplicationController, OnClipboardChanged ) );
|
|
|
|
m_pClipbordNotifier->acquire();
|
2014-03-20 09:26:52 +02:00
|
|
|
m_pClipbordNotifier->AddRemoveListener( getView(), true );
|
2004-08-02 14:28:11 +00:00
|
|
|
|
2015-10-09 12:05:50 +02:00
|
|
|
OGenericUnoController::Construct( _pParent );
|
2005-01-05 11:32:18 +00:00
|
|
|
getView()->Show();
|
2004-08-02 14:28:11 +00:00
|
|
|
|
2014-04-01 09:53:24 +02:00
|
|
|
return true;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OApplicationController::disposing(const EventObject& _rSource) throw( RuntimeException, std::exception )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2008-12-01 12:31:27 +00:00
|
|
|
::osl::MutexGuard aGuard( getMutex() );
|
2004-08-02 14:28:11 +00:00
|
|
|
Reference<XConnection> xCon(_rSource.Source, UNO_QUERY);
|
|
|
|
if ( xCon.is() )
|
|
|
|
{
|
2011-02-03 00:33:36 +01:00
|
|
|
OSL_ENSURE( m_xDataSourceConnection == xCon,
|
2010-02-09 23:46:32 +01:00
|
|
|
"OApplicationController::disposing: which connection does this come from?" );
|
2005-10-24 07:30:07 +00:00
|
|
|
|
2005-02-16 15:00:49 +00:00
|
|
|
if ( getContainer() && getContainer()->getElementType() == E_TABLE )
|
2008-01-29 13:07:00 +00:00
|
|
|
getContainer()->clearPages();
|
|
|
|
if ( m_xDataSourceConnection == xCon )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2008-01-29 13:07:00 +00:00
|
|
|
m_xMetaData.clear();
|
|
|
|
m_xDataSourceConnection.clear();
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
2005-03-10 15:43:10 +00:00
|
|
|
else if ( _rSource.Source == m_xModel )
|
|
|
|
{
|
2005-09-23 11:14:21 +00:00
|
|
|
m_xModel.clear();
|
2005-03-10 15:43:10 +00:00
|
|
|
}
|
|
|
|
else if ( _rSource.Source == m_xDataSource )
|
|
|
|
{
|
2015-11-10 10:13:39 +01:00
|
|
|
m_xDataSource = nullptr;
|
2005-03-10 15:43:10 +00:00
|
|
|
}
|
2004-08-02 14:28:11 +00:00
|
|
|
else
|
|
|
|
{
|
2008-12-01 12:31:27 +00:00
|
|
|
Reference<XContainer> xContainer( _rSource.Source, UNO_QUERY );
|
2006-04-19 12:19:19 +00:00
|
|
|
if ( xContainer.is() )
|
2005-01-21 16:05:05 +00:00
|
|
|
{
|
|
|
|
TContainerVector::iterator aFind = ::std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer);
|
|
|
|
if ( aFind != m_aCurrentContainers.end() )
|
|
|
|
m_aCurrentContainers.erase(aFind);
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2015-10-09 12:05:50 +02:00
|
|
|
OGenericUnoController::disposing( _rSource );
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL OApplicationController::suspend(sal_Bool bSuspend) throw( RuntimeException, std::exception )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2008-10-16 06:57:26 +00:00
|
|
|
// notify the OnPrepareViewClosing event (before locking any mutex)
|
|
|
|
Reference< XDocumentEventBroadcaster > xBroadcaster( m_xModel, UNO_QUERY );
|
|
|
|
if ( xBroadcaster.is() )
|
|
|
|
{
|
|
|
|
xBroadcaster->notifyDocumentEvent(
|
2015-11-04 08:34:59 +02:00
|
|
|
"OnPrepareViewClosing",
|
2008-10-16 06:57:26 +00:00
|
|
|
this,
|
|
|
|
Any()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2010-10-13 01:38:41 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2008-12-01 12:31:27 +00:00
|
|
|
::osl::MutexGuard aGuard( getMutex() );
|
2006-04-19 12:19:19 +00:00
|
|
|
|
|
|
|
if ( getView() && getView()->IsInModalMode() )
|
|
|
|
return sal_False;
|
|
|
|
|
2014-04-17 11:16:55 +02:00
|
|
|
bool bCanSuspend = true;
|
2005-04-06 08:47:41 +00:00
|
|
|
|
2015-04-27 16:08:24 +02:00
|
|
|
if ( m_bSuspended != bool(bSuspend) )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2008-03-06 17:09:10 +00:00
|
|
|
if ( bSuspend && !closeSubComponents() )
|
2005-02-17 10:05:43 +00:00
|
|
|
return sal_False;
|
|
|
|
|
2005-03-10 15:43:10 +00:00
|
|
|
Reference<XModifiable> xModi(m_xModel,UNO_QUERY);
|
2005-03-18 09:07:07 +00:00
|
|
|
Reference<XStorable> xStor(getModel(),UNO_QUERY);
|
|
|
|
|
2005-04-06 08:47:41 +00:00
|
|
|
if ( bSuspend
|
|
|
|
&& xStor.is()
|
2005-03-18 09:07:07 +00:00
|
|
|
&& !xStor->isReadonly()
|
2008-03-06 17:09:10 +00:00
|
|
|
&& ( xModi.is()
|
|
|
|
&& xModi->isModified()
|
2005-03-18 09:07:07 +00:00
|
|
|
)
|
|
|
|
)
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2005-02-17 10:05:43 +00:00
|
|
|
switch (ExecuteQuerySaveDocument(getView(),getStrippedDatabaseName()))
|
|
|
|
{
|
|
|
|
case RET_YES:
|
|
|
|
Execute(ID_BROWSER_SAVEDOC,Sequence<PropertyValue>());
|
2005-04-06 08:47:41 +00:00
|
|
|
bCanSuspend = !xModi->isModified();
|
|
|
|
// when we save the document this must be false else some press cancel
|
2005-02-17 10:05:43 +00:00
|
|
|
break;
|
|
|
|
case RET_CANCEL:
|
2014-04-17 11:16:55 +02:00
|
|
|
bCanSuspend = false;
|
2005-02-17 10:05:43 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-06 08:47:41 +00:00
|
|
|
if ( bCanSuspend )
|
|
|
|
m_bSuspended = bSuspend;
|
|
|
|
|
|
|
|
return bCanSuspend;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
|
|
|
|
{
|
|
|
|
FeatureState aReturn;
|
2014-04-01 09:53:24 +02:00
|
|
|
aReturn.bEnabled = false;
|
2004-08-02 14:28:11 +00:00
|
|
|
// check this first
|
2005-01-05 11:32:18 +00:00
|
|
|
if ( !getContainer() || m_bReadOnly )
|
2004-08-02 14:28:11 +00:00
|
|
|
return aReturn;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
switch (_nId)
|
|
|
|
{
|
2008-01-30 07:41:07 +00:00
|
|
|
case SID_OPENURL:
|
2014-04-01 09:53:24 +02:00
|
|
|
aReturn.bEnabled = true;
|
2008-01-30 07:41:07 +00:00
|
|
|
if ( m_xModel.is() )
|
|
|
|
aReturn.sTitle = m_xModel->getURL();
|
|
|
|
break;
|
2004-08-02 14:28:11 +00:00
|
|
|
case ID_BROWSER_COPY:
|
|
|
|
{
|
|
|
|
sal_Int32 nCount = getContainer()->getSelectionCount();
|
|
|
|
aReturn.bEnabled = nCount >= 1;
|
|
|
|
if ( aReturn.bEnabled && nCount == 1 && getContainer()->getElementType() == E_TABLE )
|
|
|
|
aReturn.bEnabled = getContainer()->isALeafSelected();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ID_BROWSER_CUT:
|
|
|
|
aReturn.bEnabled = !isDataSourceReadOnly() && getContainer()->getSelectionCount() >= 1;
|
2015-04-24 12:25:26 +02:00
|
|
|
aReturn.bEnabled = aReturn.bEnabled && ( !(ID_BROWSER_CUT == _nId && getContainer()->getElementType() == E_TABLE) || getContainer()->isCutAllowed() );
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case ID_BROWSER_PASTE:
|
|
|
|
switch( getContainer()->getElementType() )
|
|
|
|
{
|
|
|
|
case E_TABLE:
|
|
|
|
aReturn.bEnabled = !isDataSourceReadOnly() && !isConnectionReadOnly() && isTableFormat();
|
|
|
|
break;
|
|
|
|
case E_QUERY:
|
2015-03-12 14:53:28 +02:00
|
|
|
aReturn.bEnabled = !isDataSourceReadOnly() && getViewClipboard().HasFormat(SotClipboardFormatId::DBACCESS_QUERY);
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
default:
|
2005-09-23 11:14:21 +00:00
|
|
|
aReturn.bEnabled = !isDataSourceReadOnly() && OComponentTransferable::canExtractComponentDescriptor(getViewClipboard().GetDataFlavorExVector(),getContainer()->getElementType() == E_FORM);
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_PASTE_SPECIAL:
|
|
|
|
aReturn.bEnabled = getContainer()->getElementType() == E_TABLE && !isDataSourceReadOnly() && !isConnectionReadOnly() && isTableFormat();
|
|
|
|
break;
|
|
|
|
case SID_OPENDOC:
|
2014-04-01 09:53:24 +02:00
|
|
|
aReturn.bEnabled = true;
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case ID_BROWSER_SAVEDOC:
|
2015-12-22 13:12:23 +02:00
|
|
|
aReturn.bEnabled = !isDataSourceReadOnly();
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case ID_BROWSER_SAVEASDOC:
|
2014-04-01 09:53:24 +02:00
|
|
|
aReturn.bEnabled = true;
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case ID_BROWSER_SORTUP:
|
|
|
|
aReturn.bEnabled = getContainer()->isFilled() && getContainer()->getElementCount();
|
2006-07-10 14:22:12 +00:00
|
|
|
aReturn.bChecked = aReturn.bEnabled && getContainer()->isSortUp();
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case ID_BROWSER_SORTDOWN:
|
|
|
|
aReturn.bEnabled = getContainer()->isFilled() && getContainer()->getElementCount();
|
2006-07-10 14:22:12 +00:00
|
|
|
aReturn.bChecked = aReturn.bEnabled && !getContainer()->isSortUp();
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_NEWDOC:
|
2004-09-09 08:38:28 +00:00
|
|
|
case SID_APP_NEW_FORM:
|
2004-08-02 14:28:11 +00:00
|
|
|
case ID_DOCUMENT_CREATE_REPWIZ:
|
2015-04-07 10:59:56 +02:00
|
|
|
aReturn.bEnabled = !isDataSourceReadOnly() && SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::WRITER);
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
2007-07-06 06:57:53 +00:00
|
|
|
case SID_APP_NEW_REPORT:
|
|
|
|
aReturn.bEnabled = !isDataSourceReadOnly()
|
2015-04-07 10:59:56 +02:00
|
|
|
&& SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::WRITER);
|
2007-07-06 06:57:53 +00:00
|
|
|
if ( aReturn.bEnabled )
|
|
|
|
{
|
2013-01-07 17:46:55 +02:00
|
|
|
Reference< XContentEnumerationAccess > xEnumAccess(m_xContext->getServiceManager(), UNO_QUERY);
|
2007-07-06 06:57:53 +00:00
|
|
|
aReturn.bEnabled = xEnumAccess.is();
|
|
|
|
if ( aReturn.bEnabled )
|
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
const OUString sReportEngineServiceName = ::dbtools::getDefaultReportEngineServiceName(m_xContext);
|
2011-12-19 18:10:37 -02:00
|
|
|
aReturn.bEnabled = !sReportEngineServiceName.isEmpty();
|
2008-01-29 13:07:00 +00:00
|
|
|
if ( aReturn.bEnabled )
|
|
|
|
{
|
|
|
|
const Reference< XEnumeration > xEnumDrivers = xEnumAccess->createContentEnumeration(sReportEngineServiceName);
|
|
|
|
aReturn.bEnabled = xEnumDrivers.is() && xEnumDrivers->hasMoreElements();
|
|
|
|
}
|
2007-07-06 06:57:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2004-08-02 14:28:11 +00:00
|
|
|
case SID_DB_APP_VIEW_TABLES:
|
2014-04-01 09:53:24 +02:00
|
|
|
aReturn.bEnabled = true;
|
2006-07-10 14:22:12 +00:00
|
|
|
aReturn.bChecked = getContainer()->getElementType() == E_TABLE;
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case SID_DB_APP_VIEW_QUERIES:
|
2014-04-01 09:53:24 +02:00
|
|
|
aReturn.bEnabled = true;
|
2006-07-10 14:22:12 +00:00
|
|
|
aReturn.bChecked = getContainer()->getElementType() == E_QUERY;
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case SID_DB_APP_VIEW_FORMS:
|
2014-04-01 09:53:24 +02:00
|
|
|
aReturn.bEnabled = true;
|
2006-07-10 14:22:12 +00:00
|
|
|
aReturn.bChecked = getContainer()->getElementType() == E_FORM;
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case SID_DB_APP_VIEW_REPORTS:
|
2014-04-01 09:53:24 +02:00
|
|
|
aReturn.bEnabled = true;
|
2006-07-10 14:22:12 +00:00
|
|
|
aReturn.bChecked = getContainer()->getElementType() == E_REPORT;
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case ID_NEW_QUERY_DESIGN:
|
|
|
|
case ID_NEW_QUERY_SQL:
|
|
|
|
case ID_APP_NEW_QUERY_AUTO_PILOT:
|
2004-11-17 14:25:08 +00:00
|
|
|
case SID_DB_FORM_NEW_PILOT:
|
2004-08-02 14:28:11 +00:00
|
|
|
aReturn.bEnabled = !isDataSourceReadOnly();
|
|
|
|
break;
|
|
|
|
case ID_NEW_VIEW_DESIGN:
|
2004-11-17 14:25:08 +00:00
|
|
|
case SID_DB_NEW_VIEW_SQL:
|
2004-08-02 14:28:11 +00:00
|
|
|
case ID_NEW_VIEW_DESIGN_AUTO_PILOT:
|
2005-01-05 11:32:18 +00:00
|
|
|
aReturn.bEnabled = !isDataSourceReadOnly() && !isConnectionReadOnly();
|
|
|
|
if ( aReturn.bEnabled )
|
|
|
|
{
|
2005-10-24 07:30:07 +00:00
|
|
|
Reference<XViewsSupplier> xViewsSup( getConnection(), UNO_QUERY );
|
2005-01-05 11:32:18 +00:00
|
|
|
aReturn.bEnabled = xViewsSup.is();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ID_NEW_TABLE_DESIGN:
|
|
|
|
case ID_NEW_TABLE_DESIGN_AUTO_PILOT:
|
2004-08-02 14:28:11 +00:00
|
|
|
aReturn.bEnabled = !isDataSourceReadOnly() && !isConnectionReadOnly();
|
|
|
|
break;
|
|
|
|
case ID_DIRECT_SQL:
|
2014-04-01 09:53:24 +02:00
|
|
|
aReturn.bEnabled = true;
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
2008-03-06 17:09:10 +00:00
|
|
|
case ID_MIGRATE_SCRIPTS:
|
|
|
|
{
|
|
|
|
// Our document supports embedding scripts into it, if and only if there are no
|
|
|
|
// forms/reports with macros/scripts into them. So, we need to enable migration
|
|
|
|
// if and only if the database document does *not* support embedding scripts.
|
2008-10-16 06:57:26 +00:00
|
|
|
bool bAvailable =
|
|
|
|
!Reference< XEmbeddedScripts >( m_xModel, UNO_QUERY ).is()
|
|
|
|
&& !Reference< XStorable >( m_xModel, UNO_QUERY_THROW )->isReadonly();
|
2008-03-06 17:09:10 +00:00
|
|
|
aReturn.bEnabled = bAvailable;
|
|
|
|
if ( !bAvailable )
|
|
|
|
aReturn.bInvisible = true;
|
|
|
|
}
|
|
|
|
break;
|
2004-09-09 08:38:28 +00:00
|
|
|
case SID_APP_NEW_FOLDER:
|
2004-08-02 14:28:11 +00:00
|
|
|
aReturn.bEnabled = !isDataSourceReadOnly() && getContainer()->getSelectionCount() <= 1;
|
|
|
|
if ( aReturn.bEnabled )
|
|
|
|
{
|
2007-09-26 13:46:26 +00:00
|
|
|
const ElementType eType = getContainer()->getElementType();
|
2004-08-02 14:28:11 +00:00
|
|
|
aReturn.bEnabled = eType == E_REPORT || eType == E_FORM;
|
|
|
|
}
|
|
|
|
break;
|
2004-11-09 11:26:30 +00:00
|
|
|
case SID_FORM_CREATE_REPWIZ_PRE_SEL:
|
2004-09-09 08:38:28 +00:00
|
|
|
case SID_REPORT_CREATE_REPWIZ_PRE_SEL:
|
2007-11-20 18:22:51 +00:00
|
|
|
case SID_APP_NEW_REPORT_PRE_SEL:
|
2004-08-02 14:28:11 +00:00
|
|
|
aReturn.bEnabled = !isDataSourceReadOnly()
|
2015-04-07 10:59:56 +02:00
|
|
|
&& SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::WRITER)
|
2004-08-02 14:28:11 +00:00
|
|
|
&& getContainer()->isALeafSelected();
|
|
|
|
if ( aReturn.bEnabled )
|
|
|
|
{
|
|
|
|
ElementType eType = getContainer()->getElementType();
|
|
|
|
aReturn.bEnabled = eType == E_QUERY || eType == E_TABLE;
|
2007-11-20 18:22:51 +00:00
|
|
|
if ( aReturn.bEnabled && SID_APP_NEW_REPORT_PRE_SEL == _nId )
|
|
|
|
{
|
2013-01-07 17:46:55 +02:00
|
|
|
Reference< XContentEnumerationAccess > xEnumAccess(m_xContext->getServiceManager(), UNO_QUERY);
|
2007-11-20 18:22:51 +00:00
|
|
|
aReturn.bEnabled = xEnumAccess.is();
|
|
|
|
if ( aReturn.bEnabled )
|
|
|
|
{
|
2014-11-03 14:03:54 +02:00
|
|
|
static const char s_sReportDesign[] = "org.libreoffice.report.pentaho.SOReportJobFactory";
|
2007-11-20 18:22:51 +00:00
|
|
|
Reference< XEnumeration > xEnumDrivers = xEnumAccess->createContentEnumeration(s_sReportDesign);
|
|
|
|
aReturn.bEnabled = xEnumDrivers.is() && xEnumDrivers->hasMoreElements();
|
|
|
|
}
|
|
|
|
}
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_DELETE:
|
|
|
|
case SID_DB_APP_RENAME:
|
2004-09-09 08:38:28 +00:00
|
|
|
aReturn.bEnabled = isRenameDeleteAllowed(getContainer()->getElementType(), _nId == SID_DB_APP_DELETE);
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_TABLE_DELETE:
|
|
|
|
case SID_DB_APP_TABLE_RENAME:
|
|
|
|
aReturn.bEnabled = isRenameDeleteAllowed(E_TABLE, _nId == SID_DB_APP_TABLE_DELETE);
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_QUERY_DELETE:
|
|
|
|
case SID_DB_APP_QUERY_RENAME:
|
|
|
|
aReturn.bEnabled = isRenameDeleteAllowed(E_QUERY, _nId == SID_DB_APP_QUERY_DELETE);
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
2004-09-09 08:38:28 +00:00
|
|
|
case SID_DB_APP_FORM_DELETE:
|
|
|
|
case SID_DB_APP_FORM_RENAME:
|
|
|
|
aReturn.bEnabled = isRenameDeleteAllowed(E_FORM, _nId == SID_DB_APP_FORM_DELETE);
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_REPORT_DELETE:
|
|
|
|
case SID_DB_APP_REPORT_RENAME:
|
|
|
|
aReturn.bEnabled = isRenameDeleteAllowed(E_REPORT, _nId == SID_DB_APP_REPORT_DELETE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_SELECTALL:
|
2004-08-02 14:28:11 +00:00
|
|
|
aReturn.bEnabled = getContainer()->getElementCount() > 0 && getContainer()->getSelectionCount() != getContainer()->getElementCount();
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_EDIT:
|
2004-09-09 08:38:28 +00:00
|
|
|
case SID_DB_APP_TABLE_EDIT:
|
|
|
|
case SID_DB_APP_QUERY_EDIT:
|
|
|
|
case SID_DB_APP_FORM_EDIT:
|
|
|
|
case SID_DB_APP_REPORT_EDIT:
|
2004-08-02 14:28:11 +00:00
|
|
|
aReturn.bEnabled = !isDataSourceReadOnly() && getContainer()->getSelectionCount() > 0
|
|
|
|
&& getContainer()->isALeafSelected();
|
|
|
|
break;
|
2006-12-13 15:46:18 +00:00
|
|
|
case SID_DB_APP_EDIT_SQL_VIEW:
|
2007-11-21 15:57:49 +00:00
|
|
|
if ( isDataSourceReadOnly() )
|
2014-04-01 09:53:24 +02:00
|
|
|
aReturn.bEnabled = false;
|
2007-11-21 15:57:49 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
switch ( getContainer()->getElementType() )
|
|
|
|
{
|
|
|
|
case E_QUERY:
|
|
|
|
aReturn.bEnabled = ( getContainer()->getSelectionCount() > 0 )
|
|
|
|
&& ( getContainer()->isALeafSelected() );
|
|
|
|
break;
|
|
|
|
case E_TABLE:
|
2014-04-01 09:53:24 +02:00
|
|
|
aReturn.bEnabled = false;
|
2007-11-21 15:57:49 +00:00
|
|
|
// there's one exception: views which support altering their underlying
|
|
|
|
// command can be edited in SQL view, too
|
|
|
|
if ( ( getContainer()->getSelectionCount() > 0 )
|
|
|
|
&& ( getContainer()->isALeafSelected() )
|
|
|
|
)
|
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
::std::vector< OUString > aSelected;
|
2007-11-21 15:57:49 +00:00
|
|
|
getSelectionElementNames( aSelected );
|
2008-05-05 14:51:14 +00:00
|
|
|
bool bAlterableViews = true;
|
2013-02-20 04:33:49 +01:00
|
|
|
for ( ::std::vector< OUString >::const_iterator selectedName = aSelected.begin();
|
2008-05-05 14:51:14 +00:00
|
|
|
bAlterableViews && ( selectedName != aSelected.end() ) ;
|
|
|
|
++selectedName
|
|
|
|
)
|
|
|
|
{
|
|
|
|
bAlterableViews &= impl_isAlterableView_nothrow( *selectedName );
|
|
|
|
}
|
|
|
|
aReturn.bEnabled = bAlterableViews;
|
2007-11-21 15:57:49 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-12-13 15:46:18 +00:00
|
|
|
break;
|
2004-08-02 14:28:11 +00:00
|
|
|
case SID_DB_APP_OPEN:
|
2004-09-09 08:38:28 +00:00
|
|
|
case SID_DB_APP_TABLE_OPEN:
|
|
|
|
case SID_DB_APP_QUERY_OPEN:
|
|
|
|
case SID_DB_APP_FORM_OPEN:
|
|
|
|
case SID_DB_APP_REPORT_OPEN:
|
2004-08-02 14:28:11 +00:00
|
|
|
aReturn.bEnabled = getContainer()->getSelectionCount() > 0 && getContainer()->isALeafSelected();
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_DSUSERADMIN:
|
2015-04-24 15:29:31 +02:00
|
|
|
aReturn.bEnabled = !dbaccess::ODsnTypeCollection::isEmbeddedDatabase(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
|
2009-07-03 12:24:35 +00:00
|
|
|
break;
|
2004-11-09 11:26:30 +00:00
|
|
|
case SID_DB_APP_DSRELDESIGN:
|
2014-04-01 09:53:24 +02:00
|
|
|
aReturn.bEnabled = true;
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case SID_DB_APP_TABLEFILTER:
|
|
|
|
aReturn.bEnabled = !isDataSourceReadOnly();
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_REFRESH_TABLES:
|
2005-10-24 07:30:07 +00:00
|
|
|
aReturn.bEnabled = getContainer()->getElementType() == E_TABLE && isConnected();
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case SID_DB_APP_DSPROPS:
|
2015-04-24 15:29:31 +02:00
|
|
|
aReturn.bEnabled = m_xDataSource.is() && dbaccess::ODsnTypeCollection::isShowPropertiesEnabled(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
|
2004-11-09 11:26:30 +00:00
|
|
|
break;
|
|
|
|
case SID_DB_APP_DSCONNECTION_TYPE:
|
2015-04-24 15:29:31 +02:00
|
|
|
aReturn.bEnabled = !isDataSourceReadOnly() && m_xDataSource.is() && !dbaccess::ODsnTypeCollection::isEmbeddedDatabase(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case SID_DB_APP_DSADVANCED_SETTINGS:
|
2009-07-03 12:24:35 +00:00
|
|
|
aReturn.bEnabled = m_xDataSource.is() && AdvancedSettingsDialog::doesHaveAnyAdvancedSettings( m_aTypeCollection.getType(::comphelper::getString( m_xDataSource->getPropertyValue( PROPERTY_URL ) )) );
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case SID_DB_APP_CONVERTTOVIEW:
|
|
|
|
aReturn.bEnabled = !isDataSourceReadOnly();
|
|
|
|
if ( aReturn.bEnabled )
|
|
|
|
{
|
|
|
|
ElementType eType = getContainer()->getElementType();
|
|
|
|
aReturn.bEnabled = eType == E_QUERY && getContainer()->getSelectionCount() > 0;
|
|
|
|
if ( aReturn.bEnabled )
|
|
|
|
{
|
2005-10-24 07:30:07 +00:00
|
|
|
Reference<XViewsSupplier> xViewSup( getConnection(), UNO_QUERY );
|
2004-08-02 14:28:11 +00:00
|
|
|
aReturn.bEnabled = xViewSup.is() && Reference<XAppend>(xViewSup->getViews(),UNO_QUERY).is();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_DISABLE_PREVIEW:
|
2014-04-01 09:53:24 +02:00
|
|
|
aReturn.bEnabled = true;
|
2006-07-10 14:22:12 +00:00
|
|
|
aReturn.bChecked = getContainer()->getPreviewMode() == E_PREVIEWNONE;
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case SID_DB_APP_VIEW_DOCINFO_PREVIEW:
|
|
|
|
{
|
|
|
|
ElementType eType = getContainer()->getElementType();
|
2007-09-26 13:46:26 +00:00
|
|
|
aReturn.bEnabled = (E_REPORT == eType || E_FORM == eType);
|
2006-07-10 14:22:12 +00:00
|
|
|
aReturn.bChecked = getContainer()->getPreviewMode() == E_DOCUMENTINFO;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_VIEW_DOC_PREVIEW:
|
2014-04-01 09:53:24 +02:00
|
|
|
aReturn.bEnabled = true;
|
2006-07-10 14:22:12 +00:00
|
|
|
aReturn.bChecked = getContainer()->getPreviewMode() == E_DOCUMENT;
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
2004-11-16 13:48:43 +00:00
|
|
|
case ID_BROWSER_UNDO:
|
2014-04-01 09:53:24 +02:00
|
|
|
aReturn.bEnabled = false;
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
2005-01-21 16:05:05 +00:00
|
|
|
case SID_MAIL_SENDDOC:
|
2014-04-01 09:53:24 +02:00
|
|
|
aReturn.bEnabled = true;
|
2005-01-21 16:05:05 +00:00
|
|
|
break;
|
2004-11-17 14:25:08 +00:00
|
|
|
case SID_DB_APP_SENDREPORTASMAIL:
|
2005-01-21 16:05:05 +00:00
|
|
|
{
|
|
|
|
ElementType eType = getContainer()->getElementType();
|
|
|
|
aReturn.bEnabled = E_REPORT == eType && getContainer()->getSelectionCount() > 0 && getContainer()->isALeafSelected();
|
|
|
|
}
|
|
|
|
break;
|
2004-11-17 14:25:08 +00:00
|
|
|
case SID_DB_APP_SENDREPORTTOWRITER:
|
|
|
|
case SID_DB_APP_DBADMIN:
|
2014-04-01 09:53:24 +02:00
|
|
|
aReturn.bEnabled = false;
|
2004-11-17 14:25:08 +00:00
|
|
|
break;
|
|
|
|
case SID_DB_APP_STATUS_TYPE:
|
2006-08-28 14:05:18 +00:00
|
|
|
aReturn.bEnabled = m_xDataSource.is();
|
|
|
|
if ( aReturn.bEnabled )
|
2004-11-17 14:25:08 +00:00
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sURL;
|
2009-07-03 12:24:35 +00:00
|
|
|
m_xDataSource->getPropertyValue(PROPERTY_URL) >>= sURL;
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sDSTypeName;
|
2015-04-24 15:29:31 +02:00
|
|
|
if ( dbaccess::ODsnTypeCollection::isEmbeddedDatabase( sURL ) )
|
2008-10-01 12:28:29 +00:00
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
sDSTypeName = OUString( ModuleRes( RID_STR_EMBEDDED_DATABASE ) );
|
2008-10-01 12:28:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-07-03 12:24:35 +00:00
|
|
|
sDSTypeName = m_aTypeCollection.getTypeDisplayName(sURL);
|
2008-10-01 12:28:29 +00:00
|
|
|
}
|
2006-07-10 14:22:12 +00:00
|
|
|
aReturn.sTitle = sDSTypeName;
|
2004-11-17 14:25:08 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_STATUS_DBNAME:
|
2006-08-28 14:05:18 +00:00
|
|
|
aReturn.bEnabled = m_xDataSource.is();
|
|
|
|
if ( aReturn.bEnabled )
|
2004-11-17 14:25:08 +00:00
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sURL;
|
2007-11-01 14:03:13 +00:00
|
|
|
m_xDataSource->getPropertyValue(PROPERTY_URL) >>= sURL;
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sDatabaseName;
|
|
|
|
OUString sHostName;
|
2007-11-01 14:03:13 +00:00
|
|
|
sal_Int32 nPortNumber( -1 );
|
|
|
|
|
|
|
|
m_aTypeCollection.extractHostNamePort( sURL, sDatabaseName, sHostName, nPortNumber );
|
|
|
|
|
2013-03-09 21:47:17 +01:00
|
|
|
if ( sDatabaseName.isEmpty() )
|
2007-11-01 14:03:13 +00:00
|
|
|
sDatabaseName = m_aTypeCollection.cutPrefix( sURL );
|
2009-07-03 12:24:35 +00:00
|
|
|
if ( m_aTypeCollection.isFileSystemBased(sURL) )
|
2004-11-17 14:25:08 +00:00
|
|
|
{
|
2007-11-01 14:03:13 +00:00
|
|
|
sDatabaseName = SvtPathOptions().SubstituteVariable( sDatabaseName );
|
2013-03-09 21:47:17 +01:00
|
|
|
if ( !sDatabaseName.isEmpty() )
|
2004-11-17 14:25:08 +00:00
|
|
|
{
|
2007-11-01 14:03:13 +00:00
|
|
|
::svt::OFileNotation aFileNotation(sDatabaseName);
|
|
|
|
// set this decoded URL as text
|
|
|
|
sDatabaseName = aFileNotation.get(::svt::OFileNotation::N_SYSTEM);
|
2004-11-17 14:25:08 +00:00
|
|
|
}
|
|
|
|
}
|
2007-11-01 14:03:13 +00:00
|
|
|
|
2013-03-09 21:47:17 +01:00
|
|
|
if ( sDatabaseName.isEmpty() )
|
2009-07-03 12:24:35 +00:00
|
|
|
sDatabaseName = m_aTypeCollection.getTypeDisplayName( sURL );
|
2007-11-01 14:03:13 +00:00
|
|
|
|
2006-07-10 14:22:12 +00:00
|
|
|
aReturn.sTitle = sDatabaseName;
|
2004-11-17 14:25:08 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_STATUS_USERNAME:
|
2006-08-28 14:05:18 +00:00
|
|
|
aReturn.bEnabled = m_xDataSource.is();
|
|
|
|
if ( aReturn.bEnabled )
|
2006-07-10 14:22:12 +00:00
|
|
|
m_xDataSource->getPropertyValue( PROPERTY_USER ) >>= aReturn.sTitle;
|
2004-11-17 14:25:08 +00:00
|
|
|
break;
|
|
|
|
case SID_DB_APP_STATUS_HOSTNAME:
|
2006-08-28 14:05:18 +00:00
|
|
|
aReturn.bEnabled = m_xDataSource.is();
|
|
|
|
if ( aReturn.bEnabled )
|
2004-11-17 14:25:08 +00:00
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sURL;
|
2007-11-01 14:03:13 +00:00
|
|
|
m_xDataSource->getPropertyValue( PROPERTY_URL ) >>= sURL;
|
|
|
|
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sHostName, sDatabaseName;
|
2007-11-01 14:03:13 +00:00
|
|
|
sal_Int32 nPortNumber = -1;
|
|
|
|
m_aTypeCollection.extractHostNamePort( sURL, sDatabaseName, sHostName, nPortNumber );
|
|
|
|
aReturn.sTitle = sHostName;
|
2004-11-17 14:25:08 +00:00
|
|
|
}
|
|
|
|
break;
|
2004-08-02 14:28:11 +00:00
|
|
|
default:
|
2015-10-09 12:05:50 +02:00
|
|
|
aReturn = OGenericUnoController::GetState(_nId);
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
2006-06-20 01:53:25 +00:00
|
|
|
catch(const Exception& )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2006-06-20 01:53:25 +00:00
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
return aReturn;
|
|
|
|
}
|
2008-06-06 13:06:49 +00:00
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
bool lcl_handleException_nothrow( const Reference< XModel >& _rxDocument, const Any& _rException )
|
|
|
|
{
|
|
|
|
bool bHandled = false;
|
|
|
|
|
|
|
|
// try handling the error with an interaction handler
|
|
|
|
::comphelper::NamedValueCollection aArgs( _rxDocument->getArgs() );
|
|
|
|
Reference< XInteractionHandler > xHandler( aArgs.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ) );
|
|
|
|
if ( xHandler.is() )
|
|
|
|
{
|
2013-02-23 19:28:39 +01:00
|
|
|
Reference< ::comphelper::OInteractionRequest > pRequest( new ::comphelper::OInteractionRequest( _rException ) );
|
|
|
|
Reference< ::comphelper::OInteractionApprove > pApprove( new ::comphelper::OInteractionApprove );
|
2008-06-06 13:06:49 +00:00
|
|
|
pRequest->addContinuation( pApprove.get() );
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
xHandler->handle( pRequest.get() );
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
|
|
|
|
bHandled = pApprove->wasSelected();
|
|
|
|
}
|
|
|
|
return bHandled;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-09 08:38:28 +00:00
|
|
|
void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& aArgs)
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2010-10-13 01:38:41 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2008-12-01 12:31:27 +00:00
|
|
|
::osl::MutexGuard aGuard( getMutex() );
|
2008-06-25 11:35:22 +00:00
|
|
|
|
|
|
|
if ( isUserDefinedFeature( _nId ) )
|
|
|
|
{
|
2015-10-09 12:05:50 +02:00
|
|
|
OGenericUnoController::Execute( _nId, aArgs );
|
2008-06-25 11:35:22 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-01-05 11:32:18 +00:00
|
|
|
if ( !getContainer() || m_bReadOnly )
|
2004-08-02 14:28:11 +00:00
|
|
|
return; // return without execution
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
switch(_nId)
|
|
|
|
{
|
|
|
|
case ID_BROWSER_CUT:
|
|
|
|
getContainer()->cut();
|
|
|
|
break;
|
|
|
|
case ID_BROWSER_COPY:
|
|
|
|
{
|
|
|
|
TransferableHelper* pTransfer = copyObject( );
|
|
|
|
Reference< XTransferable> aEnsureDelete = pTransfer;
|
|
|
|
|
|
|
|
if ( pTransfer )
|
|
|
|
pTransfer->CopyToClipboard(getView());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ID_BROWSER_PASTE:
|
|
|
|
{
|
2008-01-30 07:41:07 +00:00
|
|
|
const TransferableDataHelper& rTransferData( getViewClipboard() );
|
2004-08-02 14:28:11 +00:00
|
|
|
ElementType eType = getContainer()->getElementType();
|
2007-09-26 13:46:26 +00:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
switch( eType )
|
|
|
|
{
|
|
|
|
case E_TABLE:
|
2007-09-26 13:46:26 +00:00
|
|
|
{
|
2008-01-30 07:41:07 +00:00
|
|
|
// get the selected tablename
|
2013-02-20 04:33:49 +01:00
|
|
|
::std::vector< OUString > aList;
|
2008-01-30 07:41:07 +00:00
|
|
|
getSelectionElementNames( aList );
|
2007-09-26 13:46:26 +00:00
|
|
|
if ( !aList.empty() )
|
2008-01-30 07:41:07 +00:00
|
|
|
m_aTableCopyHelper.SetTableNameForAppend( *aList.begin() );
|
2007-09-26 13:46:26 +00:00
|
|
|
else
|
2008-01-30 07:41:07 +00:00
|
|
|
m_aTableCopyHelper.ResetTableNameForAppend();
|
|
|
|
|
|
|
|
m_aTableCopyHelper.pasteTable( rTransferData , getDatabaseName(), ensureConnection() );
|
2007-09-26 13:46:26 +00:00
|
|
|
}
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
2007-09-26 13:46:26 +00:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
case E_QUERY:
|
2015-03-12 14:53:28 +02:00
|
|
|
if ( rTransferData.HasFormat(SotClipboardFormatId::DBACCESS_QUERY) )
|
2008-01-30 07:41:07 +00:00
|
|
|
paste( E_QUERY, ODataAccessObjectTransferable::extractObjectDescriptor( rTransferData ) );
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
::std::vector< OUString> aList;
|
2004-08-02 14:28:11 +00:00
|
|
|
getSelectionElementNames(aList);
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sFolderNameToInsertInto;
|
2004-08-02 14:28:11 +00:00
|
|
|
if ( !aList.empty() )
|
|
|
|
{
|
|
|
|
Reference< XHierarchicalNameAccess > xContainer(getElements(eType),UNO_QUERY);
|
|
|
|
if ( xContainer.is()
|
|
|
|
&& xContainer->hasByHierarchicalName(*aList.begin())
|
|
|
|
&& (xContainer->getByHierarchicalName(*aList.begin()) >>= xContainer)
|
|
|
|
&& xContainer.is()
|
|
|
|
)
|
|
|
|
sFolderNameToInsertInto = *aList.begin();
|
|
|
|
}
|
2008-05-05 14:51:14 +00:00
|
|
|
paste( eType, OComponentTransferable::extractComponentDescriptor( rTransferData ),
|
|
|
|
sFolderNameToInsertInto );
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_PASTE_SPECIAL:
|
|
|
|
{
|
2004-09-09 08:38:28 +00:00
|
|
|
if ( !aArgs.getLength() )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2007-09-11 09:33:21 +00:00
|
|
|
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
|
2014-09-24 18:50:37 +02:00
|
|
|
::std::unique_ptr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog( getView() ));
|
2015-03-12 14:53:28 +02:00
|
|
|
::std::vector<SotClipboardFormatId> aFormatIds;
|
2004-09-09 08:38:28 +00:00
|
|
|
getSupportedFormats(getContainer()->getElementType(),aFormatIds);
|
2015-03-12 14:53:28 +02:00
|
|
|
const ::std::vector<SotClipboardFormatId>::iterator aEnd = aFormatIds.end();
|
|
|
|
for (::std::vector<SotClipboardFormatId>::iterator aIter = aFormatIds.begin();aIter != aEnd; ++aIter)
|
2015-08-26 22:59:12 +02:00
|
|
|
pDlg->Insert(*aIter,"");
|
2004-08-02 14:28:11 +00:00
|
|
|
|
2004-09-09 08:38:28 +00:00
|
|
|
const TransferableDataHelper& rClipboard = getViewClipboard();
|
2007-09-11 09:33:21 +00:00
|
|
|
pasteFormat(pDlg->GetFormat(rClipboard.GetTransferable()));
|
2004-09-09 08:38:28 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const PropertyValue* pIter = aArgs.getConstArray();
|
|
|
|
const PropertyValue* pEnd = pIter + aArgs.getLength();
|
|
|
|
for( ; pIter != pEnd ; ++pIter)
|
|
|
|
{
|
2012-04-06 15:05:52 +02:00
|
|
|
if ( pIter->Name == "FormatStringId" )
|
2004-09-09 08:38:28 +00:00
|
|
|
{
|
2015-03-12 14:53:28 +02:00
|
|
|
sal_uLong nTmp;
|
|
|
|
if ( pIter->Value >>= nTmp )
|
|
|
|
pasteFormat(static_cast<SotClipboardFormatId>(nTmp));
|
2004-09-09 08:38:28 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_OPENDOC:
|
|
|
|
{
|
|
|
|
Reference < XDispatchProvider > xProv( getFrame(), UNO_QUERY );
|
|
|
|
if ( xProv.is() )
|
|
|
|
{
|
|
|
|
URL aURL;
|
|
|
|
switch(_nId)
|
|
|
|
{
|
|
|
|
case SID_OPENDOC:
|
2013-11-04 13:33:17 +02:00
|
|
|
aURL.Complete = ".uno:Open";
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_xUrlTransformer.is() )
|
|
|
|
m_xUrlTransformer->parseStrict( aURL );
|
2013-02-20 04:33:49 +01:00
|
|
|
Reference < XDispatch > xDisp = xProv->queryDispatch( aURL, OUString(), 0 );
|
2004-08-02 14:28:11 +00:00
|
|
|
if ( xDisp.is() )
|
|
|
|
xDisp->dispatch( aURL, Sequence < PropertyValue >() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ID_BROWSER_SAVEDOC:
|
|
|
|
{
|
2008-06-06 13:06:49 +00:00
|
|
|
Reference< XStorable > xStore( m_xModel, UNO_QUERY_THROW );
|
|
|
|
try
|
|
|
|
{
|
2004-08-02 14:28:11 +00:00
|
|
|
xStore->store();
|
2008-06-06 13:06:49 +00:00
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
lcl_handleException_nothrow( m_xModel, ::cppu::getCaughtException() );
|
|
|
|
}
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-06-06 13:06:49 +00:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
case ID_BROWSER_SAVEASDOC:
|
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sUrl;
|
2005-03-10 15:43:10 +00:00
|
|
|
if ( m_xModel.is() )
|
|
|
|
sUrl = m_xModel->getURL();
|
2011-12-19 18:10:37 -02:00
|
|
|
if ( sUrl.isEmpty() )
|
2005-02-16 15:00:49 +00:00
|
|
|
sUrl = SvtPathOptions().GetWorkPath();
|
2004-08-02 14:28:11 +00:00
|
|
|
|
2011-11-30 16:08:23 +01:00
|
|
|
::sfx2::FileDialogHelper aFileDlg(
|
|
|
|
ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION,
|
|
|
|
0, getView());
|
2005-02-16 15:00:49 +00:00
|
|
|
aFileDlg.SetDisplayDirectory( sUrl );
|
2004-08-02 14:28:11 +00:00
|
|
|
|
2004-10-27 11:55:51 +00:00
|
|
|
const SfxFilter* pFilter = getStandardDatabaseFilter();
|
2004-08-02 14:28:11 +00:00
|
|
|
if ( pFilter )
|
|
|
|
{
|
2004-09-09 08:38:28 +00:00
|
|
|
aFileDlg.AddFilter(pFilter->GetUIName(),pFilter->GetDefaultExtension());
|
|
|
|
aFileDlg.SetCurrentFilter(pFilter->GetUIName());
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
|
2008-06-06 13:06:49 +00:00
|
|
|
if ( aFileDlg.Execute() != ERRCODE_NONE )
|
|
|
|
break;
|
|
|
|
|
|
|
|
Reference<XStorable> xStore( m_xModel, UNO_QUERY_THROW );
|
|
|
|
INetURLObject aURL( aFileDlg.GetPath() );
|
|
|
|
try
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2008-06-06 13:06:49 +00:00
|
|
|
xStore->storeAsURL( aURL.GetMainURL( INetURLObject::NO_DECODE ), Sequence< PropertyValue >() );
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
lcl_handleException_nothrow( m_xModel, ::cppu::getCaughtException() );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*updateTitle();*/
|
2014-04-01 09:53:24 +02:00
|
|
|
m_bCurrentlyModified = false;
|
2008-06-06 13:06:49 +00:00
|
|
|
InvalidateFeature(ID_BROWSER_SAVEDOC);
|
|
|
|
if ( getContainer()->getElementType() == E_NONE )
|
|
|
|
{
|
|
|
|
getContainer()->selectContainer(E_NONE);
|
|
|
|
getContainer()->selectContainer(E_TABLE);
|
2008-12-09 07:25:38 +00:00
|
|
|
// #i95524#
|
|
|
|
getContainer()->Invalidate();
|
|
|
|
refreshTables();
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2008-12-09 07:25:38 +00:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ID_BROWSER_SORTUP:
|
|
|
|
getContainer()->sortUp();
|
|
|
|
InvalidateFeature(ID_BROWSER_SORTDOWN);
|
|
|
|
break;
|
|
|
|
case ID_BROWSER_SORTDOWN:
|
|
|
|
getContainer()->sortDown();
|
|
|
|
InvalidateFeature(ID_BROWSER_SORTUP);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_NEW_TABLE_DESIGN_AUTO_PILOT:
|
|
|
|
case ID_NEW_VIEW_DESIGN_AUTO_PILOT:
|
|
|
|
case ID_APP_NEW_QUERY_AUTO_PILOT:
|
2004-11-17 14:25:08 +00:00
|
|
|
case SID_DB_FORM_NEW_PILOT:
|
2004-09-09 08:38:28 +00:00
|
|
|
case SID_REPORT_CREATE_REPWIZ_PRE_SEL:
|
2007-11-20 18:22:51 +00:00
|
|
|
case SID_APP_NEW_REPORT_PRE_SEL:
|
2004-09-09 08:38:28 +00:00
|
|
|
case SID_FORM_CREATE_REPWIZ_PRE_SEL:
|
2004-08-02 14:28:11 +00:00
|
|
|
case ID_DOCUMENT_CREATE_REPWIZ:
|
2004-09-09 08:38:28 +00:00
|
|
|
case SID_APP_NEW_FORM:
|
2007-07-06 06:57:53 +00:00
|
|
|
case SID_APP_NEW_REPORT:
|
2004-08-02 14:28:11 +00:00
|
|
|
case ID_NEW_QUERY_SQL:
|
|
|
|
case ID_NEW_QUERY_DESIGN:
|
|
|
|
case ID_NEW_TABLE_DESIGN:
|
|
|
|
{
|
|
|
|
ElementType eType = E_TABLE;
|
2014-04-17 11:16:55 +02:00
|
|
|
bool bAutoPilot = false;
|
2010-01-26 23:25:22 +01:00
|
|
|
::comphelper::NamedValueCollection aCreationArgs;
|
2004-08-02 14:28:11 +00:00
|
|
|
|
|
|
|
switch( _nId )
|
|
|
|
{
|
2004-11-17 14:25:08 +00:00
|
|
|
case SID_DB_FORM_NEW_PILOT:
|
2004-09-09 08:38:28 +00:00
|
|
|
case SID_FORM_CREATE_REPWIZ_PRE_SEL:
|
2014-04-17 11:16:55 +02:00
|
|
|
bAutoPilot = true;
|
2004-08-02 14:28:11 +00:00
|
|
|
// run through
|
2004-09-09 08:38:28 +00:00
|
|
|
case SID_APP_NEW_FORM:
|
2004-08-02 14:28:11 +00:00
|
|
|
eType = E_FORM;
|
|
|
|
break;
|
|
|
|
case ID_DOCUMENT_CREATE_REPWIZ:
|
2004-09-09 08:38:28 +00:00
|
|
|
case SID_REPORT_CREATE_REPWIZ_PRE_SEL:
|
2014-04-17 11:16:55 +02:00
|
|
|
bAutoPilot = true;
|
2007-07-06 06:57:53 +00:00
|
|
|
// run through
|
|
|
|
case SID_APP_NEW_REPORT:
|
2007-11-20 18:22:51 +00:00
|
|
|
case SID_APP_NEW_REPORT_PRE_SEL:
|
2004-08-02 14:28:11 +00:00
|
|
|
eType = E_REPORT;
|
|
|
|
break;
|
|
|
|
case ID_APP_NEW_QUERY_AUTO_PILOT:
|
2014-04-17 11:16:55 +02:00
|
|
|
bAutoPilot = true;
|
2004-08-02 14:28:11 +00:00
|
|
|
eType = E_QUERY;
|
|
|
|
break;
|
|
|
|
case ID_NEW_QUERY_DESIGN:
|
2014-10-02 13:37:01 +02:00
|
|
|
aCreationArgs.put( OUString(PROPERTY_GRAPHICAL_DESIGN), sal_True );
|
2010-01-27 11:18:20 +01:00
|
|
|
// run through
|
|
|
|
case ID_NEW_QUERY_SQL:
|
2004-08-02 14:28:11 +00:00
|
|
|
eType = E_QUERY;
|
|
|
|
break;
|
2004-10-27 11:55:51 +00:00
|
|
|
case ID_NEW_TABLE_DESIGN_AUTO_PILOT:
|
2014-04-17 11:16:55 +02:00
|
|
|
bAutoPilot = true;
|
2004-10-27 11:55:51 +00:00
|
|
|
// run through
|
2004-08-02 14:28:11 +00:00
|
|
|
case ID_NEW_TABLE_DESIGN:
|
|
|
|
break;
|
|
|
|
default:
|
2011-03-12 12:04:35 +01:00
|
|
|
OSL_FAIL("illegal switch call!");
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2005-01-21 16:05:05 +00:00
|
|
|
if ( bAutoPilot )
|
|
|
|
getContainer()->PostUserEvent( LINK( this, OApplicationController, OnCreateWithPilot ), reinterpret_cast< void* >( eType ) );
|
|
|
|
else
|
2010-01-29 13:06:38 +01:00
|
|
|
{
|
|
|
|
Reference< XComponent > xDocDefinition;
|
|
|
|
newElement( eType, aCreationArgs, xDocDefinition );
|
|
|
|
}
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
break;
|
2004-09-09 08:38:28 +00:00
|
|
|
case SID_APP_NEW_FOLDER:
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
ElementType eType = getContainer()->getElementType();
|
2015-11-10 10:13:39 +01:00
|
|
|
OUString sName = getContainer()->getQualifiedName( nullptr );
|
2004-08-02 14:28:11 +00:00
|
|
|
insertHierachyElement(eType,sName);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ID_NEW_VIEW_DESIGN:
|
2004-11-17 14:25:08 +00:00
|
|
|
case SID_DB_NEW_VIEW_SQL:
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2005-10-24 07:30:07 +00:00
|
|
|
SharedConnection xConnection( ensureConnection() );
|
2004-08-02 14:28:11 +00:00
|
|
|
if ( xConnection.is() )
|
|
|
|
{
|
2010-01-27 11:18:20 +01:00
|
|
|
QueryDesigner aDesigner( getORB(), this, getFrame(), true );
|
|
|
|
|
2010-01-27 12:11:39 +01:00
|
|
|
::comphelper::NamedValueCollection aCreationArgs;
|
2014-10-02 13:37:01 +02:00
|
|
|
aCreationArgs.put( OUString(PROPERTY_GRAPHICAL_DESIGN), ID_NEW_VIEW_DESIGN == _nId );
|
2006-10-05 11:59:07 +00:00
|
|
|
|
2010-11-26 15:08:17 +01:00
|
|
|
const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
|
|
|
|
const Reference< XComponent > xComponent( aDesigner.createNew( xDataSource, aCreationArgs ), UNO_QUERY );
|
2015-11-10 10:13:39 +01:00
|
|
|
onDocumentOpened( OUString(), E_QUERY, E_OPEN_DESIGN, xComponent, nullptr );
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_DELETE:
|
2004-09-09 08:38:28 +00:00
|
|
|
case SID_DB_APP_TABLE_DELETE:
|
|
|
|
case SID_DB_APP_QUERY_DELETE:
|
|
|
|
case SID_DB_APP_FORM_DELETE:
|
|
|
|
case SID_DB_APP_REPORT_DELETE:
|
2004-08-02 14:28:11 +00:00
|
|
|
deleteEntries();
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_RENAME:
|
2004-09-09 08:38:28 +00:00
|
|
|
case SID_DB_APP_TABLE_RENAME:
|
|
|
|
case SID_DB_APP_QUERY_RENAME:
|
|
|
|
case SID_DB_APP_FORM_RENAME:
|
|
|
|
case SID_DB_APP_REPORT_RENAME:
|
2004-08-02 14:28:11 +00:00
|
|
|
renameEntry();
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_EDIT:
|
2006-12-13 15:46:18 +00:00
|
|
|
case SID_DB_APP_EDIT_SQL_VIEW:
|
2004-09-09 08:38:28 +00:00
|
|
|
case SID_DB_APP_TABLE_EDIT:
|
|
|
|
case SID_DB_APP_QUERY_EDIT:
|
|
|
|
case SID_DB_APP_FORM_EDIT:
|
|
|
|
case SID_DB_APP_REPORT_EDIT:
|
2008-05-05 14:51:14 +00:00
|
|
|
doAction( _nId, E_OPEN_DESIGN );
|
2004-09-09 08:38:28 +00:00
|
|
|
break;
|
2004-08-02 14:28:11 +00:00
|
|
|
case SID_DB_APP_OPEN:
|
2004-09-09 08:38:28 +00:00
|
|
|
case SID_DB_APP_TABLE_OPEN:
|
|
|
|
case SID_DB_APP_QUERY_OPEN:
|
|
|
|
case SID_DB_APP_FORM_OPEN:
|
|
|
|
case SID_DB_APP_REPORT_OPEN:
|
2008-05-05 14:51:14 +00:00
|
|
|
doAction( _nId, E_OPEN_NORMAL );
|
2004-09-09 08:38:28 +00:00
|
|
|
break;
|
2004-08-02 14:28:11 +00:00
|
|
|
case SID_DB_APP_CONVERTTOVIEW:
|
2008-05-05 14:51:14 +00:00
|
|
|
doAction( _nId, E_OPEN_NORMAL );
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
2004-09-09 08:38:28 +00:00
|
|
|
case SID_SELECTALL:
|
2004-08-02 14:28:11 +00:00
|
|
|
getContainer()->selectAll();
|
2005-03-18 09:07:07 +00:00
|
|
|
InvalidateAll();
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case SID_DB_APP_DSRELDESIGN:
|
2010-09-02 07:15:38 +02:00
|
|
|
{
|
|
|
|
Reference< XComponent > xRelationDesigner;
|
2013-02-20 04:33:49 +01:00
|
|
|
if ( !m_pSubComponentManager->activateSubFrame( OUString(), SID_DB_APP_DSRELDESIGN, E_OPEN_DESIGN, xRelationDesigner ) )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2005-10-24 07:30:07 +00:00
|
|
|
SharedConnection xConnection( ensureConnection() );
|
2004-08-02 14:28:11 +00:00
|
|
|
if ( xConnection.is() )
|
|
|
|
{
|
2008-04-08 11:46:07 +00:00
|
|
|
RelationDesigner aDesigner( getORB(), this, m_aCurrentFrame.getFrame() );
|
2008-12-01 12:31:27 +00:00
|
|
|
|
2010-11-26 15:08:17 +01:00
|
|
|
const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
|
|
|
|
const Reference< XComponent > xComponent( aDesigner.createNew( xDataSource ), UNO_QUERY );
|
2015-11-10 10:13:39 +01:00
|
|
|
onDocumentOpened( OUString(), SID_DB_APP_DSRELDESIGN, E_OPEN_DESIGN, xComponent, nullptr );
|
2008-12-01 12:31:27 +00:00
|
|
|
}
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2010-09-02 07:15:38 +02:00
|
|
|
}
|
|
|
|
break;
|
2004-08-02 14:28:11 +00:00
|
|
|
case SID_DB_APP_DSUSERADMIN:
|
2005-03-18 09:07:07 +00:00
|
|
|
{
|
2005-10-24 07:30:07 +00:00
|
|
|
SharedConnection xConnection( ensureConnection() );
|
2005-03-18 09:07:07 +00:00
|
|
|
if ( xConnection.is() )
|
2015-11-06 09:35:25 +01:00
|
|
|
openDialog("com.sun.star.sdb.UserAdministrationDialog");
|
2005-03-18 09:07:07 +00:00
|
|
|
}
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case SID_DB_APP_TABLEFILTER:
|
|
|
|
openTableFilterDialog();
|
|
|
|
askToReconnect();
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_REFRESH_TABLES:
|
|
|
|
refreshTables();
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_DSPROPS:
|
|
|
|
openDataSourceAdminDialog();
|
|
|
|
askToReconnect();
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_DSADVANCED_SETTINGS:
|
2015-11-06 09:35:25 +01:00
|
|
|
openDialog("com.sun.star.sdb.AdvancedDatabaseSettingsDialog");
|
2004-08-02 14:28:11 +00:00
|
|
|
askToReconnect();
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_DSCONNECTION_TYPE:
|
2015-11-06 09:35:25 +01:00
|
|
|
openDialog("com.sun.star.sdb.DataSourceTypeChangeDialog");
|
2004-08-02 14:28:11 +00:00
|
|
|
askToReconnect();
|
|
|
|
break;
|
|
|
|
case ID_DIRECT_SQL:
|
2005-03-18 09:07:07 +00:00
|
|
|
{
|
2005-10-24 07:30:07 +00:00
|
|
|
SharedConnection xConnection( ensureConnection() );
|
2005-03-18 09:07:07 +00:00
|
|
|
if ( xConnection.is() )
|
|
|
|
openDirectSQLDialog();
|
|
|
|
}
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
2008-03-06 17:09:10 +00:00
|
|
|
case ID_MIGRATE_SCRIPTS:
|
|
|
|
impl_migrateScripts_nothrow();
|
|
|
|
break;
|
2004-08-02 14:28:11 +00:00
|
|
|
case SID_DB_APP_VIEW_TABLES:
|
2008-06-25 11:35:22 +00:00
|
|
|
m_aSelectContainerEvent.Call( reinterpret_cast< void* >( E_TABLE ) );
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case SID_DB_APP_VIEW_QUERIES:
|
2008-06-25 11:35:22 +00:00
|
|
|
m_aSelectContainerEvent.Call( reinterpret_cast< void* >( E_QUERY ) );
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case SID_DB_APP_VIEW_FORMS:
|
2008-06-25 11:35:22 +00:00
|
|
|
m_aSelectContainerEvent.Call( reinterpret_cast< void* >( E_FORM ) );
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case SID_DB_APP_VIEW_REPORTS:
|
2008-06-25 11:35:22 +00:00
|
|
|
m_aSelectContainerEvent.Call( reinterpret_cast< void* >( E_REPORT ) );
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case SID_DB_APP_DISABLE_PREVIEW:
|
|
|
|
m_ePreviewMode = E_PREVIEWNONE;
|
|
|
|
getContainer()->switchPreview(m_ePreviewMode);
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_VIEW_DOCINFO_PREVIEW:
|
|
|
|
m_ePreviewMode = E_DOCUMENTINFO;
|
|
|
|
getContainer()->switchPreview(m_ePreviewMode);
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_VIEW_DOC_PREVIEW:
|
|
|
|
m_ePreviewMode = E_DOCUMENT;
|
|
|
|
getContainer()->switchPreview(m_ePreviewMode);
|
|
|
|
break;
|
2005-01-21 16:05:05 +00:00
|
|
|
case SID_MAIL_SENDDOC:
|
|
|
|
{
|
2006-03-27 08:27:26 +00:00
|
|
|
SfxMailModel aSendMail;
|
2013-02-20 04:33:49 +01:00
|
|
|
if ( aSendMail.AttachDocument(OUString(),getModel(), OUString()) == SfxMailModel::SEND_MAIL_OK )
|
2008-03-06 17:09:10 +00:00
|
|
|
aSendMail.Send( getFrame() );
|
2005-01-21 16:05:05 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_DB_APP_SENDREPORTASMAIL:
|
2008-05-05 14:51:14 +00:00
|
|
|
doAction( _nId, E_OPEN_FOR_MAIL );
|
2005-01-21 16:05:05 +00:00
|
|
|
break;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
2006-06-20 01:53:25 +00:00
|
|
|
catch( const Exception& )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2006-06-20 01:53:25 +00:00
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
InvalidateFeature(_nId);
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2004-11-16 13:48:43 +00:00
|
|
|
void OApplicationController::describeSupportedFeatures()
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2015-10-09 12:05:50 +02:00
|
|
|
OGenericUnoController::describeSupportedFeatures();
|
2004-11-16 13:48:43 +00:00
|
|
|
|
|
|
|
implDescribeSupportedFeature( ".uno:Save", ID_BROWSER_SAVEDOC, CommandGroup::DOCUMENT );
|
|
|
|
implDescribeSupportedFeature( ".uno:SaveAs", ID_BROWSER_SAVEASDOC, CommandGroup::DOCUMENT );
|
2005-01-21 16:05:05 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:SendMail", SID_MAIL_SENDDOC, CommandGroup::DOCUMENT );
|
2004-11-17 14:25:08 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DBSendReportAsMail",SID_DB_APP_SENDREPORTASMAIL,
|
|
|
|
CommandGroup::DOCUMENT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBSendReportToWriter",SID_DB_APP_SENDREPORTTOWRITER,
|
|
|
|
CommandGroup::DOCUMENT );
|
2004-11-16 13:48:43 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DBNewForm", SID_APP_NEW_FORM, CommandGroup::INSERT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBNewFolder", SID_APP_NEW_FOLDER, CommandGroup::INSERT );
|
2004-11-17 14:25:08 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DBNewFormAutoPilot", SID_DB_FORM_NEW_PILOT, CommandGroup::INSERT );
|
2004-11-16 13:48:43 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DBNewFormAutoPilotWithPreSelection",
|
|
|
|
SID_FORM_CREATE_REPWIZ_PRE_SEL,
|
|
|
|
CommandGroup::APPLICATION );
|
2004-11-17 14:25:08 +00:00
|
|
|
|
2007-07-06 06:57:53 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DBNewReport", SID_APP_NEW_REPORT, CommandGroup::INSERT );
|
2004-11-16 13:48:43 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DBNewReportAutoPilot",
|
|
|
|
ID_DOCUMENT_CREATE_REPWIZ, CommandGroup::INSERT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBNewReportAutoPilotWithPreSelection",
|
|
|
|
SID_REPORT_CREATE_REPWIZ_PRE_SEL,
|
|
|
|
CommandGroup::APPLICATION );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBNewQuery", ID_NEW_QUERY_DESIGN, CommandGroup::INSERT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBNewQuerySql", ID_NEW_QUERY_SQL, CommandGroup::INSERT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBNewQueryAutoPilot",ID_APP_NEW_QUERY_AUTO_PILOT,
|
|
|
|
CommandGroup::INSERT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBNewTable", ID_NEW_TABLE_DESIGN, CommandGroup::INSERT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBNewTableAutoPilot",ID_NEW_TABLE_DESIGN_AUTO_PILOT,
|
|
|
|
CommandGroup::INSERT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBNewView", ID_NEW_VIEW_DESIGN, CommandGroup::INSERT );
|
2004-11-17 14:25:08 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DBNewViewSQL", SID_DB_NEW_VIEW_SQL, CommandGroup::INSERT );
|
2004-09-09 08:38:28 +00:00
|
|
|
|
2004-11-16 13:48:43 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DBDelete", SID_DB_APP_DELETE, CommandGroup::EDIT );
|
2005-03-18 09:07:07 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:Delete", SID_DB_APP_DELETE, CommandGroup::EDIT );
|
2004-11-16 13:48:43 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DBRename", SID_DB_APP_RENAME, CommandGroup::EDIT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBEdit", SID_DB_APP_EDIT, CommandGroup::EDIT );
|
2006-12-13 15:46:18 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DBEditSqlView", SID_DB_APP_EDIT_SQL_VIEW, CommandGroup::EDIT );
|
2004-11-16 13:48:43 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DBOpen", SID_DB_APP_OPEN, CommandGroup::EDIT );
|
2004-09-09 08:38:28 +00:00
|
|
|
|
2004-11-16 13:48:43 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DBTableDelete", SID_DB_APP_TABLE_DELETE, CommandGroup::EDIT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBTableRename", SID_DB_APP_TABLE_RENAME, CommandGroup::EDIT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBTableEdit", SID_DB_APP_TABLE_EDIT, CommandGroup::EDIT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBTableOpen", SID_DB_APP_TABLE_OPEN, CommandGroup::EDIT );
|
2004-09-09 08:38:28 +00:00
|
|
|
|
2004-11-16 13:48:43 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DBQueryDelete", SID_DB_APP_QUERY_DELETE, CommandGroup::EDIT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBQueryRename", SID_DB_APP_QUERY_RENAME, CommandGroup::EDIT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBQueryEdit", SID_DB_APP_QUERY_EDIT, CommandGroup::EDIT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBQueryOpen", SID_DB_APP_QUERY_OPEN, CommandGroup::EDIT );
|
2004-09-09 08:38:28 +00:00
|
|
|
|
2004-11-16 13:48:43 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DBFormDelete", SID_DB_APP_FORM_DELETE, CommandGroup::EDIT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBFormRename", SID_DB_APP_FORM_RENAME, CommandGroup::EDIT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBFormEdit", SID_DB_APP_FORM_EDIT, CommandGroup::EDIT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBFormOpen", SID_DB_APP_FORM_OPEN, CommandGroup::EDIT );
|
2004-09-09 08:38:28 +00:00
|
|
|
|
2004-11-16 13:48:43 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DBReportDelete", SID_DB_APP_REPORT_DELETE, CommandGroup::EDIT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBReportRename", SID_DB_APP_REPORT_RENAME, CommandGroup::EDIT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBReportEdit", SID_DB_APP_REPORT_EDIT, CommandGroup::EDIT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBReportOpen", SID_DB_APP_REPORT_OPEN, CommandGroup::EDIT );
|
2004-09-09 08:38:28 +00:00
|
|
|
|
2004-11-16 13:48:43 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:SelectAll", SID_SELECTALL, CommandGroup::EDIT );
|
|
|
|
implDescribeSupportedFeature( ".uno:Undo", ID_BROWSER_UNDO, CommandGroup::EDIT );
|
2004-09-09 08:38:28 +00:00
|
|
|
|
2004-11-16 13:48:43 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:Sortup", ID_BROWSER_SORTUP, CommandGroup::VIEW );
|
|
|
|
implDescribeSupportedFeature( ".uno:SortDown", ID_BROWSER_SORTDOWN, CommandGroup::VIEW );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBRelationDesign", SID_DB_APP_DSRELDESIGN, CommandGroup::APPLICATION );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBUserAdmin", SID_DB_APP_DSUSERADMIN, CommandGroup::APPLICATION );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBTableFilter", SID_DB_APP_TABLEFILTER, CommandGroup::APPLICATION );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBDSProperties", SID_DB_APP_DSPROPS, CommandGroup::EDIT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBDSConnectionType", SID_DB_APP_DSCONNECTION_TYPE,
|
|
|
|
CommandGroup::EDIT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBDSAdvancedSettings",
|
|
|
|
SID_DB_APP_DSADVANCED_SETTINGS,
|
|
|
|
CommandGroup::EDIT );
|
|
|
|
implDescribeSupportedFeature( ".uno:PasteSpecial", SID_DB_APP_PASTE_SPECIAL, CommandGroup::EDIT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBConvertToView", SID_DB_APP_CONVERTTOVIEW, CommandGroup::EDIT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBRefreshTables", SID_DB_APP_REFRESH_TABLES, CommandGroup::APPLICATION );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBDirectSQL", ID_DIRECT_SQL, CommandGroup::APPLICATION );
|
2008-03-06 17:09:10 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DBMigrateScripts", ID_MIGRATE_SCRIPTS, CommandGroup::APPLICATION );
|
2004-11-16 13:48:43 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DBViewTables", SID_DB_APP_VIEW_TABLES, CommandGroup::VIEW );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBViewQueries", SID_DB_APP_VIEW_QUERIES, CommandGroup::VIEW );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBViewForms", SID_DB_APP_VIEW_FORMS, CommandGroup::VIEW );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBViewReports", SID_DB_APP_VIEW_REPORTS, CommandGroup::VIEW );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBDisablePreview", SID_DB_APP_DISABLE_PREVIEW,CommandGroup::VIEW );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBShowDocInfoPreview",
|
|
|
|
SID_DB_APP_VIEW_DOCINFO_PREVIEW,
|
|
|
|
CommandGroup::VIEW );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBShowDocPreview", SID_DB_APP_VIEW_DOC_PREVIEW,
|
|
|
|
CommandGroup::VIEW );
|
2004-11-17 14:25:08 +00:00
|
|
|
|
2008-01-30 07:41:07 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:OpenUrl", SID_OPENURL, CommandGroup::APPLICATION );
|
|
|
|
|
2005-09-23 11:14:21 +00:00
|
|
|
// this one should not appear under Tools->Customize->Keyboard
|
2008-06-16 11:32:24 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DBNewReportWithPreSelection",
|
2015-08-12 15:09:51 +02:00
|
|
|
SID_APP_NEW_REPORT_PRE_SEL );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBDSImport", SID_DB_APP_DSIMPORT);
|
|
|
|
implDescribeSupportedFeature( ".uno:DBDSExport", SID_DB_APP_DSEXPORT);
|
|
|
|
implDescribeSupportedFeature( ".uno:DBDBAdmin", SID_DB_APP_DBADMIN);
|
2004-11-17 14:25:08 +00:00
|
|
|
|
|
|
|
// status info
|
2015-08-12 15:09:51 +02:00
|
|
|
implDescribeSupportedFeature( ".uno:DBStatusType", SID_DB_APP_STATUS_TYPE);
|
|
|
|
implDescribeSupportedFeature( ".uno:DBStatusDBName", SID_DB_APP_STATUS_DBNAME);
|
|
|
|
implDescribeSupportedFeature( ".uno:DBStatusUserName", SID_DB_APP_STATUS_USERNAME);
|
|
|
|
implDescribeSupportedFeature( ".uno:DBStatusHostName", SID_DB_APP_STATUS_HOSTNAME);
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
OApplicationView* OApplicationController::getContainer() const
|
|
|
|
{
|
|
|
|
return static_cast< OApplicationView* >( getView() );
|
|
|
|
}
|
2008-06-25 11:35:22 +00:00
|
|
|
|
2015-08-03 09:14:58 +02:00
|
|
|
// css::container::XContainerListener
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OApplicationController::elementInserted( const ContainerEvent& _rEvent ) throw(RuntimeException, std::exception)
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2010-10-13 01:38:41 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2008-12-01 12:31:27 +00:00
|
|
|
::osl::MutexGuard aGuard( getMutex() );
|
2004-08-02 14:28:11 +00:00
|
|
|
|
2005-01-21 16:05:05 +00:00
|
|
|
Reference< XContainer > xContainer(_rEvent.Source, UNO_QUERY);
|
|
|
|
if ( ::std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer) != m_aCurrentContainers.end() )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
|
|
|
|
if ( getContainer() )
|
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sName;
|
2004-08-02 14:28:11 +00:00
|
|
|
_rEvent.Accessor >>= sName;
|
2005-01-21 16:05:05 +00:00
|
|
|
ElementType eType = getElementType(xContainer);
|
2004-08-02 14:28:11 +00:00
|
|
|
|
|
|
|
switch( eType )
|
|
|
|
{
|
|
|
|
case E_TABLE:
|
2005-10-24 07:30:07 +00:00
|
|
|
ensureConnection();
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case E_FORM:
|
|
|
|
case E_REPORT:
|
|
|
|
{
|
2005-01-21 16:05:05 +00:00
|
|
|
Reference< XContainer > xSubContainer(_rEvent.Element,UNO_QUERY);
|
|
|
|
if ( xSubContainer.is() )
|
|
|
|
containerFound(xSubContainer);
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-06-20 01:53:25 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2006-10-05 11:59:07 +00:00
|
|
|
getContainer()->elementAdded(eType,sName,_rEvent.Element);
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OApplicationController::elementRemoved( const ContainerEvent& _rEvent ) throw(RuntimeException, std::exception)
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2010-10-13 01:38:41 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2008-12-01 12:31:27 +00:00
|
|
|
::osl::MutexGuard aGuard( getMutex() );
|
2004-08-02 14:28:11 +00:00
|
|
|
|
2005-01-21 16:05:05 +00:00
|
|
|
Reference< XContainer > xContainer(_rEvent.Source, UNO_QUERY);
|
|
|
|
if ( ::std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer) != m_aCurrentContainers.end() )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sName;
|
2004-08-02 14:28:11 +00:00
|
|
|
_rEvent.Accessor >>= sName;
|
2005-01-21 16:05:05 +00:00
|
|
|
ElementType eType = getElementType(xContainer);
|
2004-08-02 14:28:11 +00:00
|
|
|
switch( eType )
|
|
|
|
{
|
|
|
|
case E_TABLE:
|
2005-10-24 07:30:07 +00:00
|
|
|
ensureConnection();
|
2004-08-02 14:28:11 +00:00
|
|
|
break;
|
|
|
|
case E_FORM:
|
|
|
|
case E_REPORT:
|
|
|
|
{
|
2005-01-21 16:05:05 +00:00
|
|
|
Reference<XContent> xContent(xContainer,UNO_QUERY);
|
2004-08-02 14:28:11 +00:00
|
|
|
if ( xContent.is() )
|
|
|
|
{
|
2013-12-13 09:29:22 +02:00
|
|
|
sName = xContent->getIdentifier()->getContentIdentifier() + "/" + sName;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2006-06-20 01:53:25 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2006-10-05 11:59:07 +00:00
|
|
|
getContainer()->elementRemoved(eType,sName);
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OApplicationController::elementReplaced( const ContainerEvent& _rEvent ) throw(RuntimeException, std::exception)
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2010-10-13 01:38:41 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2008-12-01 12:31:27 +00:00
|
|
|
::osl::MutexGuard aGuard( getMutex() );
|
2004-08-02 14:28:11 +00:00
|
|
|
|
2005-01-21 16:05:05 +00:00
|
|
|
Reference< XContainer > xContainer(_rEvent.Source, UNO_QUERY);
|
|
|
|
if ( ::std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer) != m_aCurrentContainers.end() )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sName;
|
2004-08-02 14:28:11 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
_rEvent.Accessor >>= sName;
|
|
|
|
Reference<XConnection> xConnection;
|
|
|
|
Reference<XPropertySet> xProp(_rEvent.Element,UNO_QUERY);
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sNewName;
|
2004-08-02 14:28:11 +00:00
|
|
|
|
2005-01-21 16:05:05 +00:00
|
|
|
ElementType eType = getElementType(xContainer);
|
2004-08-02 14:28:11 +00:00
|
|
|
switch( eType )
|
|
|
|
{
|
|
|
|
case E_TABLE:
|
2005-10-24 07:30:07 +00:00
|
|
|
{
|
|
|
|
ensureConnection();
|
|
|
|
if ( xProp.is() && m_xMetaData.is() )
|
2016-02-25 09:38:09 +02:00
|
|
|
sNewName = ::dbaui::composeTableName( m_xMetaData, xProp, ::dbtools::EComposeRule::InDataManipulation, false, false, false );
|
2005-10-24 07:30:07 +00:00
|
|
|
}
|
|
|
|
break;
|
2004-08-02 14:28:11 +00:00
|
|
|
case E_FORM:
|
|
|
|
case E_REPORT:
|
|
|
|
{
|
2005-01-21 16:05:05 +00:00
|
|
|
Reference<XContent> xContent(xContainer,UNO_QUERY);
|
2004-08-02 14:28:11 +00:00
|
|
|
if ( xContent.is() )
|
|
|
|
{
|
2013-12-13 09:29:22 +02:00
|
|
|
sName = xContent->getIdentifier()->getContentIdentifier() + "/" + sName;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2006-06-20 01:53:25 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2006-10-05 11:59:07 +00:00
|
|
|
// getContainer()->elementReplaced(getContainer()->getElementType(),sName,sNewName);
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
catch( Exception& )
|
|
|
|
{
|
2008-05-05 14:51:14 +00:00
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2004-09-09 08:38:28 +00:00
|
|
|
namespace
|
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString lcl_getToolBarResource(ElementType _eType)
|
2004-09-09 08:38:28 +00:00
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sToolbar;
|
2004-09-09 08:38:28 +00:00
|
|
|
switch(_eType)
|
|
|
|
{
|
|
|
|
case E_TABLE:
|
2013-11-04 13:33:17 +02:00
|
|
|
sToolbar = "private:resource/toolbar/tableobjectbar";
|
2004-09-09 08:38:28 +00:00
|
|
|
break;
|
|
|
|
case E_QUERY:
|
2013-11-04 13:33:17 +02:00
|
|
|
sToolbar = "private:resource/toolbar/queryobjectbar";
|
2004-09-09 08:38:28 +00:00
|
|
|
break;
|
|
|
|
case E_FORM:
|
2013-11-04 13:33:17 +02:00
|
|
|
sToolbar = "private:resource/toolbar/formobjectbar";
|
2004-09-09 08:38:28 +00:00
|
|
|
break;
|
|
|
|
case E_REPORT:
|
2013-11-04 13:33:17 +02:00
|
|
|
sToolbar = "private:resource/toolbar/reportobjectbar";
|
2004-09-09 08:38:28 +00:00
|
|
|
break;
|
|
|
|
case E_NONE:
|
|
|
|
break;
|
|
|
|
default:
|
2011-03-12 12:04:35 +01:00
|
|
|
OSL_FAIL("Invalid ElementType!");
|
2004-09-09 08:38:28 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return sToolbar;
|
|
|
|
}
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2014-04-17 11:16:55 +02:00
|
|
|
bool OApplicationController::onContainerSelect(ElementType _eType)
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
|
|
|
|
|
2008-03-06 17:09:10 +00:00
|
|
|
if ( m_eCurrentType != _eType && _eType != E_NONE )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2008-06-25 11:35:22 +00:00
|
|
|
SelectionGuard aSelGuard( *m_pSelectionNotifier );
|
|
|
|
|
2008-03-06 17:09:10 +00:00
|
|
|
if ( _eType == E_TABLE )
|
2004-09-09 08:38:28 +00:00
|
|
|
{
|
|
|
|
try
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2005-10-24 07:30:07 +00:00
|
|
|
SharedConnection xConnection( ensureConnection() );
|
2005-01-05 11:32:18 +00:00
|
|
|
if ( xConnection.is() && getContainer()->getDetailView() )
|
2004-09-09 08:38:28 +00:00
|
|
|
{
|
|
|
|
getContainer()->getDetailView()->createTablesPage(xConnection);
|
|
|
|
Reference<XTablesSupplier> xTabSup(xConnection,UNO_QUERY);
|
|
|
|
if ( xTabSup.is() )
|
|
|
|
addContainerListener(xTabSup->getTables());
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2004-09-09 08:38:28 +00:00
|
|
|
else
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2014-04-17 11:16:55 +02:00
|
|
|
return false;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
2008-03-06 17:09:10 +00:00
|
|
|
catch( const Exception& )
|
2004-09-09 08:38:28 +00:00
|
|
|
{
|
2014-04-17 11:16:55 +02:00
|
|
|
return false;
|
2004-09-09 08:38:28 +00:00
|
|
|
}
|
|
|
|
}
|
2008-03-06 17:09:10 +00:00
|
|
|
Reference< XLayoutManager > xLayoutManager = getLayoutManager( getFrame() );
|
|
|
|
if ( xLayoutManager.is() )
|
2004-09-09 08:38:28 +00:00
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sToolbar = lcl_getToolBarResource(_eType);
|
|
|
|
OUString sDestroyToolbar = lcl_getToolBarResource(m_eCurrentType);
|
2008-03-06 17:09:10 +00:00
|
|
|
|
|
|
|
xLayoutManager->lock();
|
|
|
|
xLayoutManager->destroyElement( sDestroyToolbar );
|
2013-03-09 21:47:17 +01:00
|
|
|
if ( !sToolbar.isEmpty() )
|
2008-03-06 17:09:10 +00:00
|
|
|
{
|
|
|
|
xLayoutManager->createElement( sToolbar );
|
|
|
|
xLayoutManager->requestElement( sToolbar );
|
|
|
|
}
|
|
|
|
xLayoutManager->unlock();
|
|
|
|
xLayoutManager->doLayout();
|
2004-09-09 08:38:28 +00:00
|
|
|
}
|
2008-03-06 17:09:10 +00:00
|
|
|
|
|
|
|
if ( _eType != E_TABLE && getContainer()->getDetailView() )
|
2004-09-09 08:38:28 +00:00
|
|
|
{
|
|
|
|
Reference< XNameAccess > xContainer = getElements(_eType);
|
|
|
|
addContainerListener(xContainer);
|
|
|
|
getContainer()->getDetailView()->createPage(_eType,xContainer);
|
|
|
|
}
|
2004-08-02 14:28:11 +00:00
|
|
|
|
2008-06-25 11:35:22 +00:00
|
|
|
SelectionByElementType::iterator pendingSelection = m_aPendingSelection.find( _eType );
|
|
|
|
if ( pendingSelection != m_aPendingSelection.end() )
|
|
|
|
{
|
2015-11-19 09:14:59 +02:00
|
|
|
getContainer()->selectElements( comphelper::containerToSequence(pendingSelection->second) );
|
2008-06-25 11:35:22 +00:00
|
|
|
|
|
|
|
m_aPendingSelection.erase( pendingSelection );
|
|
|
|
}
|
|
|
|
|
2004-09-09 08:38:28 +00:00
|
|
|
InvalidateAll();
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2008-03-06 17:09:10 +00:00
|
|
|
m_eCurrentType = _eType;
|
2004-08-02 14:28:11 +00:00
|
|
|
|
2014-04-17 11:16:55 +02:00
|
|
|
return true;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2008-06-25 11:35:22 +00:00
|
|
|
bool OApplicationController::onEntryDoubleClick( SvTreeListBox& _rTree )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2008-06-25 11:35:22 +00:00
|
|
|
if ( getContainer() && getContainer()->isLeaf( _rTree.GetHdlEntry() ) )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2006-12-13 15:46:18 +00:00
|
|
|
openElement(
|
2008-06-25 11:35:22 +00:00
|
|
|
getContainer()->getQualifiedName( _rTree.GetHdlEntry() ),
|
2006-12-13 15:46:18 +00:00
|
|
|
getContainer()->getElementType(),
|
2008-05-05 14:51:14 +00:00
|
|
|
E_OPEN_NORMAL
|
2006-12-13 15:46:18 +00:00
|
|
|
);
|
2006-12-01 16:29:30 +00:00
|
|
|
return true; // handled
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
catch(const Exception&)
|
|
|
|
{
|
2010-09-20 23:42:56 +02:00
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
2006-12-01 16:29:30 +00:00
|
|
|
return false; // not handled
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2013-02-20 04:33:49 +01:00
|
|
|
bool OApplicationController::impl_isAlterableView_nothrow( const OUString& _rTableOrViewName ) const
|
2007-11-21 15:57:49 +00:00
|
|
|
{
|
|
|
|
OSL_PRECOND( m_xDataSourceConnection.is(), "OApplicationController::impl_isAlterableView_nothrow: no connection!" );
|
|
|
|
|
|
|
|
bool bIsAlterableView( false );
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XViewsSupplier > xViewsSupp( m_xDataSourceConnection, UNO_QUERY );
|
|
|
|
Reference< XNameAccess > xViews;
|
|
|
|
if ( xViewsSupp.is() )
|
|
|
|
xViews = xViewsSupp->getViews();
|
|
|
|
|
|
|
|
Reference< XAlterView > xAsAlterableView;
|
|
|
|
if ( xViews.is() && xViews->hasByName( _rTableOrViewName ) )
|
|
|
|
xAsAlterableView.set( xViews->getByName( _rTableOrViewName ), UNO_QUERY );
|
|
|
|
|
|
|
|
bIsAlterableView = xAsAlterableView.is();
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
return bIsAlterableView;
|
|
|
|
}
|
|
|
|
|
2013-02-20 04:33:49 +01:00
|
|
|
Reference< XComponent > OApplicationController::openElement(const OUString& _sName, ElementType _eType,
|
2016-03-02 16:53:51 +02:00
|
|
|
ElementOpenMode _eOpenMode )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2016-03-02 16:53:51 +02:00
|
|
|
return openElementWithArguments( _sName, _eType, _eOpenMode, 0, ::comphelper::NamedValueCollection() );
|
2008-05-05 14:51:14 +00:00
|
|
|
}
|
|
|
|
|
2013-02-20 04:33:49 +01:00
|
|
|
Reference< XComponent > OApplicationController::openElementWithArguments( const OUString& _sName, ElementType _eType,
|
2008-05-05 14:51:14 +00:00
|
|
|
ElementOpenMode _eOpenMode, sal_uInt16 _nInstigatorCommand, const ::comphelper::NamedValueCollection& _rAdditionalArguments )
|
|
|
|
{
|
|
|
|
OSL_PRECOND( getContainer(), "OApplicationController::openElementWithArguments: no view!" );
|
|
|
|
if ( !getContainer() )
|
2015-11-10 10:13:39 +01:00
|
|
|
return nullptr;
|
2008-05-05 14:51:14 +00:00
|
|
|
|
2005-01-21 16:05:05 +00:00
|
|
|
Reference< XComponent > xRet;
|
2008-05-05 14:51:14 +00:00
|
|
|
if ( _eOpenMode == E_OPEN_DESIGN )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
// OJ: http://www.openoffice.org/issues/show_bug.cgi?id=30382
|
2015-11-10 10:13:39 +01:00
|
|
|
getContainer()->showPreview(nullptr);
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2007-11-21 15:57:49 +00:00
|
|
|
|
2010-09-20 23:42:56 +02:00
|
|
|
bool isStandaloneDocument = false;
|
2004-08-02 14:28:11 +00:00
|
|
|
switch ( _eType )
|
|
|
|
{
|
2007-11-21 15:57:49 +00:00
|
|
|
case E_REPORT:
|
2010-09-20 23:42:56 +02:00
|
|
|
if ( _eOpenMode != E_OPEN_DESIGN )
|
|
|
|
{
|
|
|
|
// reports which are opened in a mode other than design are no sub components of our application
|
|
|
|
// component, but standalone documents.
|
|
|
|
isStandaloneDocument = true;
|
|
|
|
}
|
|
|
|
// NO break!
|
2007-11-21 15:57:49 +00:00
|
|
|
case E_FORM:
|
|
|
|
{
|
2010-09-20 23:42:56 +02:00
|
|
|
if ( isStandaloneDocument || !m_pSubComponentManager->activateSubFrame( _sName, _eType, _eOpenMode, xRet ) )
|
2010-02-02 13:57:03 +01:00
|
|
|
{
|
2014-09-24 18:50:37 +02:00
|
|
|
::std::unique_ptr< OLinkedDocumentsAccess > aHelper = getDocumentsAccess( _eType );
|
2010-02-02 13:57:03 +01:00
|
|
|
if ( !aHelper->isConnected() )
|
|
|
|
break;
|
2008-05-05 14:51:14 +00:00
|
|
|
|
2010-02-02 13:57:03 +01:00
|
|
|
Reference< XComponent > xDefinition;
|
|
|
|
xRet = aHelper->open( _sName, xDefinition, _eOpenMode, _rAdditionalArguments );
|
2008-05-05 14:51:14 +00:00
|
|
|
|
2010-09-20 23:42:56 +02:00
|
|
|
if ( !isStandaloneDocument )
|
|
|
|
onDocumentOpened( _sName, _eType, _eOpenMode, xRet, xDefinition );
|
2010-02-02 13:57:03 +01:00
|
|
|
}
|
2007-11-21 15:57:49 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_QUERY:
|
|
|
|
case E_TABLE:
|
|
|
|
{
|
2010-09-02 07:15:38 +02:00
|
|
|
if ( !m_pSubComponentManager->activateSubFrame( _sName, _eType, _eOpenMode, xRet ) )
|
2007-11-21 15:57:49 +00:00
|
|
|
{
|
2008-04-04 13:53:36 +00:00
|
|
|
SharedConnection xConnection( ensureConnection() );
|
|
|
|
if ( !xConnection.is() )
|
|
|
|
break;
|
|
|
|
|
2014-09-24 18:50:37 +02:00
|
|
|
::std::unique_ptr< DatabaseObjectView > pDesigner;
|
2008-08-19 08:54:27 +00:00
|
|
|
::comphelper::NamedValueCollection aArguments( _rAdditionalArguments );
|
2008-04-04 13:53:36 +00:00
|
|
|
|
2008-08-19 08:54:27 +00:00
|
|
|
Any aDataSource;
|
|
|
|
if ( _eOpenMode == E_OPEN_DESIGN )
|
2008-05-05 14:51:14 +00:00
|
|
|
{
|
2010-01-27 11:18:20 +01:00
|
|
|
bool bAddViewTypeArg = false;
|
2008-08-19 08:54:27 +00:00
|
|
|
|
|
|
|
if ( _eType == E_TABLE )
|
|
|
|
{
|
|
|
|
if ( impl_isAlterableView_nothrow( _sName ) )
|
2010-01-27 11:18:20 +01:00
|
|
|
{
|
|
|
|
pDesigner.reset( new QueryDesigner( getORB(), this, m_aCurrentFrame.getFrame(), true ) );
|
|
|
|
bAddViewTypeArg = true;
|
|
|
|
}
|
2008-08-19 08:54:27 +00:00
|
|
|
else
|
2010-01-27 11:18:20 +01:00
|
|
|
{
|
2008-08-19 08:54:27 +00:00
|
|
|
pDesigner.reset( new TableDesigner( getORB(), this, m_aCurrentFrame.getFrame() ) );
|
2010-01-27 11:18:20 +01:00
|
|
|
}
|
2008-08-19 08:54:27 +00:00
|
|
|
}
|
|
|
|
else if ( _eType == E_QUERY )
|
|
|
|
{
|
2010-01-27 11:18:20 +01:00
|
|
|
pDesigner.reset( new QueryDesigner( getORB(), this, m_aCurrentFrame.getFrame(), false ) );
|
|
|
|
bAddViewTypeArg = true;
|
2008-08-19 08:54:27 +00:00
|
|
|
}
|
|
|
|
aDataSource <<= m_xDataSource;
|
2010-01-27 11:18:20 +01:00
|
|
|
|
|
|
|
if ( bAddViewTypeArg )
|
|
|
|
{
|
|
|
|
const bool bQueryGraphicalMode =( _nInstigatorCommand != SID_DB_APP_EDIT_SQL_VIEW );
|
2014-10-02 13:37:01 +02:00
|
|
|
aArguments.put( OUString(PROPERTY_GRAPHICAL_DESIGN), bQueryGraphicalMode );
|
2010-01-27 11:18:20 +01:00
|
|
|
}
|
|
|
|
|
2007-11-21 15:57:49 +00:00
|
|
|
}
|
2008-08-19 08:54:27 +00:00
|
|
|
else
|
2007-11-21 15:57:49 +00:00
|
|
|
{
|
2008-08-19 08:54:27 +00:00
|
|
|
pDesigner.reset( new ResultSetBrowser( getORB(), this, m_aCurrentFrame.getFrame(), _eType == E_TABLE ) );
|
2004-08-02 14:28:11 +00:00
|
|
|
|
2014-10-02 13:37:01 +02:00
|
|
|
if ( !aArguments.has( OUString(PROPERTY_SHOWMENU) ) )
|
|
|
|
aArguments.put( OUString(PROPERTY_SHOWMENU), makeAny( true ) );
|
2004-08-02 14:28:11 +00:00
|
|
|
|
CWS-TOOLING: integrate CWS dba32a
2009-04-16 13:08:19 +0200 oj r270882 : #i14538# set property at control
2009-04-16 13:04:28 +0200 oj r270881 : #i98557# remove binary string for SRB
2009-04-15 13:19:10 +0200 oj r270838 : #i96782# use type set at view
2009-04-14 14:53:20 +0200 oj r270778 : #i96782# set initialize size for custom shape
2009-04-06 14:19:14 +0200 oj r270546 : #i88432# correct pos when < 0 while resizing
2009-04-06 13:36:13 +0200 oj r270541 : #i96782# handle toolbar and menubar differently
2009-04-06 13:33:54 +0200 oj r270540 : #i96782# handle toolbar and menubar differently
2009-04-06 12:28:23 +0200 oj r270534 : #i96782# handle toolbar and menubar differently
2009-04-06 12:27:44 +0200 oj r270533 : #i96782# handle toolbar and menubar differently
2009-04-06 12:24:32 +0200 oj r270532 : #i96782# handle toolbar and menubar differently
2009-04-06 12:15:15 +0200 oj r270531 : do not initialze when field is empty
2009-04-06 10:06:08 +0200 oj r270528 : #i96782# clean up of menubar and remove duplicates
2009-04-06 09:47:49 +0200 oj r270527 : #i96519# adjust help text dynamic
2009-04-03 13:43:20 +0200 oj r270482 : do not need to remove section from observer they are already disposed
2009-04-03 13:27:28 +0200 fs r270479 : #i97356#
2009-04-02 11:30:39 +0200 fs r270386 : UNX line ends
2009-04-02 10:54:51 +0200 fs r270379 : UNX line ends
2009-04-02 10:39:57 +0200 fs r270378 : UNX line ends
2009-04-02 10:37:24 +0200 fs r270377 : why did this survive the rebase? was removed on trunk ...
2009-03-31 13:31:12 +0200 fs r270277 : component_foo should be public
2009-03-28 00:21:01 +0100 fs r270176 : manuallly merged the changes which happened in CWS before resync to m45, where the directory had been moved from reportdesign/registry to reportbuilder/registry
2009-03-27 23:01:20 +0100 fs r270174 : CWS-TOOLING: rebase CWS dba32a to trunk@270033 (milestone: DEV300:m45)
2009-03-11 12:23:35 +0100 fs r269310 : #i99958# ensure the ControlModelLock doesn't release twice
2009-03-06 09:07:32 +0100 fs r268970 : ignore output paths in SVN's status
2009-03-06 09:07:08 +0100 fs r268969 : ignore output paths in SVN's status
2009-03-04 11:28:02 +0100 oj r268800 : copy and paste error, check correct end now
2009-03-03 15:49:11 +0100 fs r268736 : #i10000# those merges were lost during the rebase (m38->m42)
2009-03-03 13:25:27 +0100 lla r268720 : #i99652# fix wrong refactoring
2009-02-27 11:12:56 +0100 fs r268566 : beautified
2009-02-27 10:53:47 +0100 fs r268561 : doFormListening(false) only when actually isFormListening() (found during complex test case XMLFormSettings with assertions)
2009-02-26 20:55:31 +0100 fs r268546 : #i96530# set the Label property of the bound control, if we didn't create a dedicated label control
2009-02-26 11:53:09 +0100 fs r268494 : #i10000#
2009-02-26 11:27:50 +0100 fs r268493 : #i10000#
2009-02-26 11:17:08 +0100 fs r268490 : reportdesign depends on REPORTBUILDER, not REPORTDESIGN
2009-02-25 11:39:48 +0100 fs r268422 : #i10000# post-resync: INFO_ESCAPE_DATETIME got lost during rebase
2009-02-24 23:24:10 +0100 fs r268411 : CWS-TOOLING: rebase CWS dba32a to trunk@268395 (milestone: DEV300:m42)
2009-02-20 15:09:48 +0100 fs r268324 : respect ImplicitCatalog/SchemaRestriction in all necessary places
2009-02-20 13:48:10 +0100 oj r268318 : order of initialize corrected
2009-02-14 15:07:52 +0100 fs r267759 : #i98975# when an image does not have a bitmap, but a text, draw this (as placeholder)
2009-02-14 15:02:40 +0100 fs r267758 : consolidated and removed some duplicate code
2009-02-14 13:52:23 +0100 fs r267756 : #i10000#
2009-02-13 22:08:34 +0100 fs r267750 : #i100000#
2009-02-13 22:07:25 +0100 fs r267749 : #i10000#
2009-02-13 21:55:36 +0100 fs r267747 : #i10000#
2009-02-13 21:54:27 +0100 fs r267746 : use const_cast
2009-02-13 21:29:10 +0100 fs r267745 : #i10000#
2009-02-13 21:27:39 +0100 fs r267744 : #i10000#
2009-02-13 20:59:13 +0100 fs r267742 : #i10000#
2009-02-13 13:21:30 +0100 fs r267717 : better diagnostics
2009-02-13 13:17:24 +0100 fs r267715 : #i58313# support Catalog/SchemaRestriction settings, which are applied in getTables when 'all catalogs/schemas' are to be retrieved
2009-02-13 13:16:14 +0100 fs r267714 : filter out some more known global settings
2009-02-13 12:39:43 +0100 fs r267713 : #i58313# ImplicitCatalog/SchemaRestriction
2009-02-13 12:36:50 +0100 fs r267712 : when exporting data source settings, allow for properties which have a VOID default value, but are currently not VOID
2009-02-13 12:35:57 +0100 fs r267711 : implement XSet, to allow inserting properties which have a default value of VOID
2009-02-13 12:35:03 +0100 fs r267710 : +addVoidProperty
2009-02-13 10:20:08 +0100 fs r267697 : removed unused variable
2009-02-13 09:46:46 +0100 fs r267695 : refactored the table filtering code, to have a better base for introducing additional low level filters
2009-02-10 09:23:07 +0100 lla r267537 : #i10000# wrong line feed, double named variable
2009-02-09 12:13:08 +0100 oj r267508 : #i98605# notify hanlder
2009-02-09 11:50:34 +0100 oj r267507 : #i98926# solve refcount problem
2009-02-09 11:50:05 +0100 oj r267506 : #i98971# fix for simple html
2009-02-09 11:49:24 +0100 oj r267505 : #i98971# fix for simple html
2009-02-09 11:47:27 +0100 oj r267504 : invoke on copy
2009-02-09 09:51:00 +0100 fs r267500 : #i98316#
2009-02-09 09:46:10 +0100 fs r267499 : setCurrentSelection: don't reset the current form when we de-select everything
2009-02-09 09:43:45 +0100 fs r267498 : #i98316#
2009-02-08 21:25:18 +0100 fs r267496 : #i98272# introduce late ctor for cloning
2009-02-07 21:08:39 +0100 fs r267485 : #i98272# when copy-constructing a FmFormPageImpl, use the XCloneable of the forms collection, instead of XPersistObject (which is incompletely implemented)
2009-02-07 21:07:26 +0100 fs r267484 : removed obsolete include guards
2009-02-07 21:05:22 +0100 fs r267483 : #i98272# implement XCloneable
2009-02-06 15:02:48 +0100 lla r267467 : #i96523# add XImageControl
2009-02-06 14:41:38 +0100 oj r267463 : #i98926# late init when connection disposed but only when asked for
2009-02-06 13:49:57 +0100 lla r267457 : #i92860# bigint in forms doesn't allow input of values > 1, fixed
2009-02-06 13:03:55 +0100 oj r267455 : ImageScaleMode
2009-02-05 14:48:19 +0100 lla r267424 : #i89335# dropdown listboxes are 14 instead of 7 lines high
2009-02-05 13:40:00 +0100 oj r267423 : #i96945# insert new prop Opaque
2009-02-05 13:39:19 +0100 oj r267422 : #i96945# insert layer handling for hell and heaven
2009-02-05 13:29:32 +0100 lla r267420 : #i89335# add is null, is not null, is not like filter condition
2009-02-04 12:23:02 +0100 oj r267364 : #i98821# load table font settings
2009-02-04 10:05:27 +0100 oj r267351 : #i98821# load table font settings
2009-02-04 09:23:22 +0100 fs r267350 : checking persistency of UI settings in database documents - for the moment, capture table formattings (which is issue 98821)
2009-02-04 09:22:15 +0100 fs r267349 : moved some methods which are of wider interest from DatabaseDocument to FileHelper resp. TestCase
2009-02-04 08:56:27 +0100 oj r267347 : #i97586# UcbStreamHelper::CreateStream doesn't check all streamModes use different method
2009-02-04 08:23:26 +0100 oj r267346 : #i98701# check key size is >= 3 and some redesign
2009-02-03 23:29:24 +0100 fs r267345 : return the component (controller), not the frame
2009-02-03 23:28:53 +0100 fs r267344 : openExisting returns a controller now, not the frame (this was a bug)
2009-02-03 23:28:25 +0100 fs r267343 : openElement: properly return the component in the table/query case
2009-02-02 12:48:17 +0100 oj r267261 : #i96013# fix for relative path
2009-02-02 10:33:28 +0100 lla r267253 : #i98557# cleanups and consolidation
2009-02-02 09:37:23 +0100 lla r267250 : #i88432# resize will no longer move components to other sections
2009-02-02 09:08:24 +0100 oj r267245 : #i97475# write 0x1A at the end of the file
2009-01-30 19:39:20 +0100 lla r267230 : #i10000# unused parameters
2009-01-30 09:51:09 +0100 fs r267181 : onsolete
2009-01-30 09:49:27 +0100 fs r267180 : onsolete
2009-01-29 14:28:22 +0100 oj r267139 : #i96825# import cell style
2009-01-29 14:23:12 +0100 oj r267137 : #i98601# export imagescalehandler
2009-01-29 14:19:57 +0100 lla r267135 : #i98601# add ImageScaleMode
2009-01-29 13:21:08 +0100 oj r267124 : #i98601# impl ScaleMode
2009-01-29 13:20:56 +0100 oj r267123 : #i98601# impl ScaleMode
2009-01-29 08:46:40 +0100 oj r267095 : new property: ScaleMode
2009-01-29 08:45:23 +0100 oj r267094 : new ScaleMode from UnControlImageModel
2009-01-29 08:28:12 +0100 oj r267093 : #i87930# close all sub forms/reports when the desktop is going to be terminated and no db frame exists
2009-01-28 19:54:34 +0100 lla r267082 : #i98557# pictures in report wizard
2009-01-28 15:06:25 +0100 oj r267060 : #i87930# close all sub forms/reports when the desktop is going to be terminated and no db frame exists
2009-01-28 11:38:41 +0100 lla r267046 : #i76783# handle binary fields in forms
2009-01-28 09:24:43 +0100 lla r267025 : #i10000#
2009-01-28 08:40:04 +0100 fs r267024 : #i10000#
2009-01-28 08:04:43 +0100 oj r267023 : #i93456# use resource strings for function names
2009-01-27 13:26:05 +0100 oj r266988 : check data field is type field or expression
2009-01-27 13:07:17 +0100 oj r266985 : check data field length
2009-01-27 11:48:19 +0100 oj r266974 : #i96823# return dll string as column name when no alias exists
2009-01-27 09:53:11 +0100 fs r266958 : display the message of a caught exception
2009-01-27 09:44:13 +0100 fs r266957 : #i58313# when retrieving all tables, just set an empty table type filter - the connection will care for translating this, by respecting the TableTypeFilterMode setting
2009-01-27 09:36:09 +0100 fs r266956 : #i58313# getTables: per JDBC spec, is not a valid table type filter. Translate it to 'null'.
2009-01-26 11:24:49 +0100 lla r266912 : #i97865# cleanups (AddField viewable in remote mode)
2009-01-26 07:49:27 +0100 lla r266897 : #i97865# AddField opens in remote case
2009-01-26 07:48:58 +0100 lla r266896 : #i97865# AddField opens in remote case
2009-01-26 07:48:42 +0100 lla r266895 : #i97865# AddField opens in remote case
2009-01-23 15:04:40 +0100 fs r266825 : consolidate the usage of OSQLMessageBox with MessageType==Warning into OSQLWarningBox
2009-01-23 10:47:33 +0100 fs r266787 : +supportsUserAdministration
2009-01-23 10:47:11 +0100 fs r266784 : use DatabaseMetaData.supportsUserAdministration
2009-01-23 07:55:59 +0100 lla r266767 : #i10000# fix gcc compiler failures
2009-01-21 15:08:55 +0100 lla r266673 : #i97265# Labels in HC (IsDark) with other color (viewable)
2009-01-19 14:58:54 +0100 lla r266504 : #i96523# last problems with FormatKey and '0' values fixed
2009-01-19 14:58:00 +0100 lla r266503 : #i96519# AddField help text
2009-01-19 11:59:02 +0100 fs r266485 : #i96523# for formatted field models, init them with TreatAsNumber = false
2009-01-16 10:31:49 +0100 lla r266405 : #i96793# add shrink to popup menu
2009-01-16 09:21:44 +0100 lla r266401 : #i96519# AddField contains a help text
2009-01-15 11:21:49 +0100 lla r266357 : #i96523# problem with XVclWindowPeer not fixed now
2009-01-15 09:19:20 +0100 lla r266335 : #i96523# more crashes fixed.
2009-01-14 13:08:34 +0100 lla r266291 : #i96523# problems with crashes fixed
2009-01-13 10:54:24 +0100 lla r266199 : #i96523# show datasource in formattedfields new files
2009-01-13 10:52:39 +0100 lla r266198 : #i96523# show datasource in formattedfields
2009-01-13 09:41:50 +0100 lla r266197 : #i96526# handling none existance default.otr
2009-01-12 12:55:49 +0100 fs r266151 : don't expect the control model to be a BoundComponent before adding as modify listener
2009-01-12 12:51:33 +0100 fs r266149 : #i88458# let the ImageControl be an XModifyBroadcaster, so the forms runtime can notice when the user changes the control content while it does not have the focus
2009-01-09 13:41:22 +0100 fs r266080 : doc
2009-01-09 13:14:14 +0100 fs r266077 : #i97377# SetModified when order is changed via DnD
2009-01-07 09:55:40 +0100 oj r265951 : merge from master
2009-01-07 09:55:24 +0100 oj r265950 : removed observer
2009-01-07 09:55:06 +0100 oj r265949 : merge from master
2009-01-07 07:29:11 +0100 oj r265945 : shadow var changed
2009-01-06 07:25:57 +0100 oj r265893 : CWS-TOOLING: rebase CWS dba32a to trunk@265758 (milestone: DEV300:m38)
2009-01-05 13:18:22 +0100 oj r265865 : convert to unix le
2009-01-05 09:13:52 +0100 lla r265857 : #i79423# lc_ sc_ permutation fix
2009-01-02 19:40:59 +0100 lla r265847 : #i79423# section shrink icons
2008-12-22 11:37:57 +0100 lla r265749 : #i97484# move component to negative Y-position
2008-12-22 11:37:05 +0100 lla r265748 : #i97484# move component to negative Y-position
2008-12-22 11:35:33 +0100 lla r265747 : #i97484# move component to negative Y-position
2008-12-22 11:25:07 +0100 lla r265745 : #i96757# changes via property browser was not undoable
2008-12-18 15:10:38 +0100 fs r265694 : corrected an condition in doFormListening, which otherwise leads to uncommitable grid columns in documents which are loaded from disc (not in documents which are newly created)
2008-12-18 14:54:39 +0100 fs r265692 : Hide Columns text slightly changed
2008-12-18 13:44:15 +0100 fs r265683 : #i94068# properly display erros happening during a form operation - at least once, and at most once
2008-12-18 11:28:29 +0100 fs r265677 : document the new InputRequired property
2008-12-18 11:04:15 +0100 fs r265676 : #i96530# createControlLabelPair: don't actually create a label for a checkbox
2008-12-18 10:35:53 +0100 fs r265674 : #i95226# when a column is replaced, and it's the selected column, update the selection
2008-12-18 10:34:42 +0100 fs r265673 : #i95226# refactoring of the implReplaced method
2008-12-18 10:34:28 +0100 fs r265672 : #i95226# when replacing a grid column, update the property browser
2008-12-18 10:33:17 +0100 fs r265671 : when an element is removed, remove it from m_aCurrentSelection, too (if necessary)
2008-12-18 10:31:57 +0100 fs r265670 : Hide Columns text slightly changed
2008-12-18 10:15:56 +0100 lla r265669 : #i14538# do not allow to press finish button twice
2008-12-18 08:56:33 +0100 lla r265665 : #i10000# build depend=t problem hacked.
2008-12-17 20:59:10 +0100 fs r265656 : #i89821# don't let a MultiLineEdit select all text when it receives the focus
2008-12-17 12:10:54 +0100 fs r265594 : #i97356#
2008-12-17 12:06:29 +0100 fs r265593 : #i97355# Print -> Printable
2008-12-17 11:59:31 +0100 fs r265591 : #i97350# combo boxes comment on list selection (as list boxes already do)
2008-12-16 09:53:57 +0100 lla r265527 : #i96526# handling none existance default.otr
2008-12-15 14:48:39 +0100 lla r265500 : #i79423# reparing, was wrong implemented
2008-12-12 15:08:33 +0100 lla r265424 : #i10000# remove wrong carridge returns
2008-12-12 15:07:55 +0100 lla r265423 : #i10000# remove wrong carridge returns
2008-12-12 15:06:41 +0100 lla r265422 : #i10000# remove wrong carridge returns
2008-12-12 10:23:13 +0100 lla r265395 : #i95234# reset DragDelta
2008-12-12 10:11:02 +0100 lla r265393 : #i79423# pre versions of shrink buttons
2008-12-11 15:32:13 +0100 fs r265318 : prevent a deadlock during complex.dbaccess.DatabaseDocument test
2008-12-11 15:30:06 +0100 fs r265316 : prevent a deadlock during complex.dbaccess.DatabaseDocument test
2008-12-11 15:07:05 +0100 fs r265307 : removed superfluous text
2008-12-11 12:29:54 +0100 lla r265282 : #i96757# cleanup second try
2008-12-11 12:09:15 +0100 lla r265278 : #i96757# cleanup
2008-12-11 12:07:56 +0100 lla r265277 : #i95234#
2008-12-10 14:04:39 +0100 lla r265183 : #i93472# D&D fixes
2008-12-10 12:29:33 +0100 lla r265168 : #i94067# add (APP|SYS)FONT to XUnitConversion
2008-12-10 12:15:02 +0100 lla r265166 : #i94067# add APPFONT, SYSFONT to MeasureUnit
2008-12-10 11:52:10 +0100 lla r265163 : #i94067# add comments
2008-12-06 20:33:05 +0100 fs r264935 : #i10000# precompiled header
2008-12-05 09:29:26 +0100 fs r264889 : #i10000#
2008-12-05 09:07:31 +0100 fs r264888 : #i10000#
2008-12-04 13:25:46 +0100 fs r264838 : CWS-TOOLING: rebase CWS dba32a to trunk@264807 (milestone: DEV300:m37)
2008-12-03 23:49:13 +0100 fs r264808 : merge changes from trunk, to be able to do a rebase
2008-12-03 17:13:09 +0100 lla r264801 : #i91041# update documentation
2008-12-03 16:57:04 +0100 lla r264799 : #i94067# allow convert(Point|Size)ToLogic as pixel also
2008-12-02 12:36:32 +0100 lla r264687 : #i96782# bring toolbar objects to menu structure
2008-12-02 10:32:44 +0100 lla r264667 : #i86255# make property work
2008-12-02 09:22:47 +0100 lla r264659 : #i79423# add section shrink toolbar
2008-12-02 07:41:22 +0100 lla r264657 : #i86255# add check box for Escape DateTime property
2008-12-02 07:37:17 +0100 lla r264656 : #i79423# new shrink buttons
2008-11-26 11:55:28 +0100 fs r264362 : #i96541#
FillPropertySet: do not only catch UnknownPropertyException when setting the Char/ParaAutoStyleName,
but also care for the other exceptions which can be thrown by XPropertySet::setPropertyValue.
This is actually not the real fix for #i96541#, but only a follow-up. The root cause of the issue
was fixed in CWS dba301b, but this here was another (potential) bug which popped up during investigations.
2008-11-25 09:04:40 +0100 lla r264273 : #i82083# new toolbox in GroupsSorting dialog
2008-11-25 08:56:08 +0100 lla r264272 : #i94729# change token strings into string list, move class out of function
2008-11-24 15:52:22 +0100 fs r264251 : #i96532# do not set AppendTableAlias, NameLengthLimit, etc., if the OXMLDataSourceInstance is used for elements at which those attributes never appear
2008-11-24 15:51:45 +0100 fs r264249 : #i96532# do not set AppendTableAlias, NameLengthLimit, etc., if the OXMLDataSourceInstance is used for elements at which those attributes never appear
2008-11-24 15:45:21 +0100 fs r264244 : #i96532# the API default for ParamNameSubst is false
2008-11-24 15:45:04 +0100 fs r264243 : #i96532# do not set AppendTableAlias, NameLengthLimit, etc., if the OXMLDataSourceInstance is used for elements at which those attributes never appear
2008-11-24 15:44:14 +0100 fs r264241 : #i96532# slight refactoring of exporting properties which have a XML default different from the API default
2008-11-24 10:50:01 +0100 lla r264216 : #i82083# icons for new toolbox
2008-11-24 09:38:45 +0100 lla r264205 : #i82083# new toolbox in GroupsSorting dialog
2008-11-24 09:32:20 +0100 lla r264201 : #i96501# cleanup assertions
2008-11-24 09:12:55 +0100 lla r264198 : #i83082# enhancement for toolboxes, better HC comfort
2008-11-24 08:46:43 +0100 lla r264197 : #i96501# fix problem with negative positions
2008-11-21 11:44:47 +0100 fs r264118 : #i57042# introduce a counter for suspending change notifications of a given property, so recursive calls are possible
2008-11-21 11:02:17 +0100 fs r264116 : #i96388# don't call ExecuteContextMenuAction when no action was chosen by the user
2008-11-21 10:36:53 +0100 fs r264114 : #i47384# assertion was wrong
2008-11-14 12:33:15 +0100 fs r263673 : #i47318# XRowSetChangeBroadcaster/Listener, to be able to listen for changes in an XRowSetSupplier's RowSet
2008-11-14 12:30:29 +0100 fs r263672 : #i47318# more refactoring
- BoundControlModels now listen at the XRowSetSupplier for changes in the supplied
RowSet, to properly revoke/register old/new listeners at the RowSet
- replaced ::osl::Mutex in various places with a ControlModelLock
2008-11-14 12:20:55 +0100 fs r263671 : when BUILD_TYPE includes QADEVOOO, the BUILD_QADEVOOO needs to bet set, too
2008-11-14 12:19:21 +0100 fs r263670 : oops, this was not intended to be committed
2008-11-12 11:08:10 +0100 fs r263579 : #i96096# new ctors taking UNO_QUERY_THROW
2008-11-12 09:15:54 +0100 fs r263576 : no need to load the complete dialog just to get a string which the dialog itself loads from resource
2008-11-10 17:55:45 +0100 fs r263535 : spelling in comment
2008-11-10 15:51:14 +0100 fs r263523 : #i47318# various refactorings
1. don't forward syntetic XLoadListener events from the grid control to
the grid columns. Instead, forward GridColumn::XChild::setParent to
the base class, which then can add itself as load listener
2. removed various occurances of XMultiServiceFactory, instead use the
::comphelper::ComponentContext
3. in O(Bound)ControlModel, have a mechanism to lock the instance (using
ControlModelLock) and fire property changes when the last lock dies.
2008-11-10 12:49:24 +0100 oj r263513 : #i94729# change token strings into string list
2008-11-10 12:13:15 +0100 oj r263512 : #i95222# export chart:title style as well
2008-11-10 08:55:25 +0100 oj r263507 : #i93471# show the correct tabpage when selecting a different object
2008-11-07 23:38:29 +0100 fs r263490 : #i95977# for the event input controls, add a component extending their functionality so they're reset when the users presses DEL
2008-11-07 23:35:39 +0100 fs r263489 : during #i95977#: When a VCL Window is deleted from within VCL code, the respective WindowPeer was never disposed. Corrected this.
2008-11-07 14:57:07 +0100 fs r263420 : #i95963# human-readable display names for event bindings
2008-11-06 10:34:52 +0100 fs r263366 : #i95865# don't use library names containing InvalidZipEntryFileNames - workaround until i95409 is fixed
2008-11-06 10:33:28 +0100 fs r263365 : #i95865#
copied the following change from CWS odfmetadata2 (not yet integrated) into CWS dba31d
- comphelper/inc/comphelper/storagehelper.hxx,
comphelper/source/misc/storagehelper.cxx:
+ add function IsValidZipEntryFileName (moved from module package)
2009-04-22 11:01:27 +00:00
|
|
|
aDataSource <<= getDatabaseName();
|
2008-04-04 13:53:36 +00:00
|
|
|
}
|
2004-08-02 14:28:11 +00:00
|
|
|
|
2010-01-26 23:25:22 +01:00
|
|
|
xRet.set( pDesigner->openExisting( aDataSource, _sName, aArguments ) );
|
2015-11-10 10:13:39 +01:00
|
|
|
onDocumentOpened( _sName, _eType, _eOpenMode, xRet, nullptr );
|
2008-04-04 13:53:36 +00:00
|
|
|
}
|
2007-11-21 15:57:49 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-03-12 11:27:59 +01:00
|
|
|
OSL_FAIL( "OApplicationController::openElement: illegal object type!" );
|
2007-11-21 15:57:49 +00:00
|
|
|
break;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2005-01-21 16:05:05 +00:00
|
|
|
return xRet;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2015-09-10 10:48:52 +02:00
|
|
|
IMPL_LINK_TYPED( OApplicationController, OnSelectContainer, void*, _pType, void )
|
2008-06-25 11:35:22 +00:00
|
|
|
{
|
|
|
|
ElementType eType = (ElementType)reinterpret_cast< sal_IntPtr >( _pType );
|
2011-07-01 11:06:15 +02:00
|
|
|
if (getContainer())
|
|
|
|
getContainer()->selectContainer(eType);
|
2008-06-25 11:35:22 +00:00
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2015-08-27 13:08:02 +02:00
|
|
|
IMPL_LINK_TYPED( OApplicationController, OnCreateWithPilot, void*, _pType, void )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2005-10-05 13:44:23 +00:00
|
|
|
ElementType eType = (ElementType)reinterpret_cast< sal_IntPtr >( _pType );
|
2005-01-21 16:05:05 +00:00
|
|
|
newElementWithPilot( eType );
|
|
|
|
}
|
|
|
|
|
|
|
|
void OApplicationController::newElementWithPilot( ElementType _eType )
|
|
|
|
{
|
2011-10-31 21:18:24 +01:00
|
|
|
utl::CloseVeto aKeepDoc( getFrame() );
|
2010-12-02 11:11:43 +01:00
|
|
|
// prevent the document being closed while the wizard is open
|
|
|
|
|
2005-01-21 16:05:05 +00:00
|
|
|
OSL_ENSURE( getContainer(), "OApplicationController::newElementWithPilot: without a view?" );
|
2004-08-02 14:28:11 +00:00
|
|
|
|
|
|
|
switch ( _eType )
|
|
|
|
{
|
2005-01-21 16:05:05 +00:00
|
|
|
case E_REPORT:
|
2004-08-02 14:28:11 +00:00
|
|
|
case E_FORM:
|
2005-01-21 16:05:05 +00:00
|
|
|
{
|
2014-09-24 18:50:37 +02:00
|
|
|
::std::unique_ptr<OLinkedDocumentsAccess> aHelper = getDocumentsAccess(_eType);
|
2005-03-10 15:43:10 +00:00
|
|
|
if ( aHelper->isConnected() )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2007-11-20 18:22:51 +00:00
|
|
|
sal_Int32 nCommandType = -1;
|
2013-02-20 04:33:49 +01:00
|
|
|
const OUString sCurrentSelected( getCurrentlySelectedName( nCommandType ) );
|
2005-01-21 16:05:05 +00:00
|
|
|
if ( E_REPORT == _eType )
|
2010-02-04 16:04:06 +01:00
|
|
|
aHelper->newReportWithPilot( nCommandType, sCurrentSelected );
|
2005-01-21 16:05:05 +00:00
|
|
|
else
|
2010-02-04 16:04:06 +01:00
|
|
|
aHelper->newFormWithPilot( nCommandType, sCurrentSelected );
|
2005-01-21 16:05:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2004-08-02 14:28:11 +00:00
|
|
|
case E_QUERY:
|
2005-01-21 16:05:05 +00:00
|
|
|
case E_TABLE:
|
|
|
|
{
|
2014-09-24 18:50:37 +02:00
|
|
|
::std::unique_ptr<OLinkedDocumentsAccess> aHelper = getDocumentsAccess(_eType);
|
2005-03-10 15:43:10 +00:00
|
|
|
if ( aHelper->isConnected() )
|
|
|
|
{
|
2008-05-05 14:51:14 +00:00
|
|
|
if ( E_QUERY == _eType )
|
2010-02-04 16:04:06 +01:00
|
|
|
aHelper->newQueryWithPilot();
|
2008-05-05 14:51:14 +00:00
|
|
|
else
|
2010-02-04 16:04:06 +01:00
|
|
|
aHelper->newTableWithPilot();
|
2008-05-05 14:51:14 +00:00
|
|
|
}
|
2005-01-21 16:05:05 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-06-20 01:53:25 +00:00
|
|
|
case E_NONE:
|
|
|
|
break;
|
2005-01-21 16:05:05 +00:00
|
|
|
}
|
2010-02-04 16:04:06 +01:00
|
|
|
|
|
|
|
// no need for onDocumentOpened, the table wizard opens the created table by using
|
|
|
|
// XDatabaseDocumentUI::loadComponent method.
|
2005-01-21 16:05:05 +00:00
|
|
|
}
|
|
|
|
|
2010-01-29 13:06:38 +01:00
|
|
|
Reference< XComponent > OApplicationController::newElement( ElementType _eType, const ::comphelper::NamedValueCollection& i_rAdditionalArguments,
|
|
|
|
Reference< XComponent >& o_rDocumentDefinition )
|
2005-01-21 16:05:05 +00:00
|
|
|
{
|
|
|
|
OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
|
|
|
|
|
2010-01-26 23:25:22 +01:00
|
|
|
Reference< XComponent > xComponent;
|
2010-01-29 13:06:38 +01:00
|
|
|
o_rDocumentDefinition.clear();
|
2010-01-26 23:25:22 +01:00
|
|
|
|
2005-01-21 16:05:05 +00:00
|
|
|
switch ( _eType )
|
|
|
|
{
|
|
|
|
case E_FORM:
|
2007-07-06 06:57:53 +00:00
|
|
|
case E_REPORT:
|
2010-01-26 23:25:22 +01:00
|
|
|
{
|
2014-09-24 18:50:37 +02:00
|
|
|
::std::unique_ptr<OLinkedDocumentsAccess> aHelper = getDocumentsAccess( _eType );
|
2010-01-26 23:25:22 +01:00
|
|
|
if ( !aHelper->isConnected() )
|
|
|
|
break;
|
|
|
|
|
2010-01-29 13:06:38 +01:00
|
|
|
xComponent = aHelper->newDocument( _eType == E_FORM ? ID_FORM_NEW_TEXT : ID_REPORT_NEW_TEXT, i_rAdditionalArguments, o_rDocumentDefinition );
|
2010-01-26 23:25:22 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2005-01-21 16:05:05 +00:00
|
|
|
case E_QUERY:
|
2004-08-02 14:28:11 +00:00
|
|
|
case E_TABLE:
|
2010-01-26 23:25:22 +01:00
|
|
|
{
|
2014-09-24 18:50:37 +02:00
|
|
|
::std::unique_ptr< DatabaseObjectView > pDesigner;
|
2010-01-26 23:25:22 +01:00
|
|
|
SharedConnection xConnection( ensureConnection() );
|
|
|
|
if ( !xConnection.is() )
|
|
|
|
break;
|
2007-07-06 06:57:53 +00:00
|
|
|
|
2010-01-26 23:25:22 +01:00
|
|
|
if ( _eType == E_TABLE )
|
|
|
|
{
|
|
|
|
pDesigner.reset( new TableDesigner( getORB(), this, getFrame() ) );
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2010-01-26 23:25:22 +01:00
|
|
|
else if ( _eType == E_QUERY )
|
|
|
|
{
|
2010-01-27 11:18:20 +01:00
|
|
|
pDesigner.reset( new QueryDesigner( getORB(), this, getFrame(), false ) );
|
2010-01-26 23:25:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
|
2010-01-27 11:18:20 +01:00
|
|
|
xComponent.set( pDesigner->createNew( xDataSource, i_rAdditionalArguments ), UNO_QUERY );
|
2010-01-26 23:25:22 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2006-06-20 01:53:25 +00:00
|
|
|
default:
|
2011-03-12 11:27:59 +01:00
|
|
|
OSL_FAIL( "OApplicationController::newElement: illegal type!" );
|
2006-06-20 01:53:25 +00:00
|
|
|
break;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2010-01-26 23:25:22 +01:00
|
|
|
|
|
|
|
if ( xComponent.is() )
|
2013-02-20 04:33:49 +01:00
|
|
|
onDocumentOpened( OUString(), _eType, E_OPEN_DESIGN, xComponent, o_rDocumentDefinition );
|
2010-01-26 23:25:22 +01:00
|
|
|
|
|
|
|
return xComponent;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2010-01-26 23:25:22 +01:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
void OApplicationController::addContainerListener(const Reference<XNameAccess>& _xCollection)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XContainer > xCont(_xCollection, UNO_QUERY);
|
2005-01-21 16:05:05 +00:00
|
|
|
if ( xCont.is() )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
// add as listener to get notified if elements are inserted or removed
|
2005-01-21 16:05:05 +00:00
|
|
|
TContainerVector::iterator aFind = ::std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xCont);
|
|
|
|
if ( aFind == m_aCurrentContainers.end() )
|
|
|
|
{
|
|
|
|
xCont->addContainerListener(this);
|
|
|
|
m_aCurrentContainers.push_back(xCont);
|
|
|
|
}
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
2008-05-05 14:51:14 +00:00
|
|
|
catch( const Exception& )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2008-05-05 14:51:14 +00:00
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
void OApplicationController::renameEntry()
|
|
|
|
{
|
2010-10-13 01:38:41 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2008-12-01 12:31:27 +00:00
|
|
|
::osl::MutexGuard aGuard( getMutex() );
|
2004-08-02 14:28:11 +00:00
|
|
|
|
|
|
|
OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
|
2013-02-20 04:33:49 +01:00
|
|
|
::std::vector< OUString> aList;
|
2004-08-02 14:28:11 +00:00
|
|
|
getSelectionElementNames(aList);
|
|
|
|
|
|
|
|
Reference< XNameAccess > xContainer = getElements(getContainer()->getElementType());
|
|
|
|
OSL_ENSURE(aList.size() == 1,"Invalid rename call here. More than one element!");
|
2008-05-05 14:51:14 +00:00
|
|
|
if ( aList.empty() )
|
|
|
|
return;
|
2004-08-02 14:28:11 +00:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if ( xContainer.is() )
|
|
|
|
{
|
2014-09-24 18:50:37 +02:00
|
|
|
::std::unique_ptr< IObjectNameCheck > pNameChecker;
|
2015-03-17 15:13:34 +02:00
|
|
|
VclPtr< OSaveAsDlg > aDialog;
|
2006-07-10 14:22:12 +00:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
Reference<XRename> xRename;
|
2006-08-28 14:05:18 +00:00
|
|
|
const ElementType eType = getContainer()->getElementType();
|
2004-08-02 14:28:11 +00:00
|
|
|
switch( eType )
|
|
|
|
{
|
|
|
|
case E_FORM:
|
|
|
|
case E_REPORT:
|
|
|
|
{
|
|
|
|
Reference<XHierarchicalNameContainer> xHNames(xContainer, UNO_QUERY);
|
|
|
|
if ( xHNames.is() )
|
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sLabel;
|
2004-08-02 14:28:11 +00:00
|
|
|
if ( eType == E_FORM )
|
2013-02-20 04:33:49 +01:00
|
|
|
sLabel = OUString(ModuleRes( STR_FRM_LABEL ));
|
2004-08-02 14:28:11 +00:00
|
|
|
else
|
2013-02-20 04:33:49 +01:00
|
|
|
sLabel = OUString(ModuleRes( STR_RPT_LABEL ));
|
2004-08-02 14:28:11 +00:00
|
|
|
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sName = *aList.begin();
|
2004-08-02 14:28:11 +00:00
|
|
|
if ( xHNames->hasByHierarchicalName(sName) )
|
|
|
|
{
|
|
|
|
xRename.set(xHNames->getByHierarchicalName(sName),UNO_QUERY);
|
|
|
|
Reference<XChild> xChild(xRename,UNO_QUERY);
|
|
|
|
if ( xChild.is() )
|
|
|
|
{
|
|
|
|
Reference<XHierarchicalNameContainer> xParent(xChild->getParent(),UNO_QUERY);
|
|
|
|
if ( xParent.is() )
|
|
|
|
{
|
|
|
|
xHNames = xParent;
|
|
|
|
Reference<XPropertySet>(xRename,UNO_QUERY)->getPropertyValue(PROPERTY_NAME) >>= sName;
|
|
|
|
}
|
|
|
|
}
|
2013-02-20 04:33:49 +01:00
|
|
|
pNameChecker.reset( new HierarchicalNameCheck( xHNames.get(), OUString() ) );
|
2015-04-20 14:00:04 +01:00
|
|
|
aDialog.reset( VclPtr<OSaveAsDlg>::Create(
|
|
|
|
|
2013-01-07 17:46:55 +02:00
|
|
|
getView(), getORB(), sName, sLabel, *pNameChecker, SAD_TITLE_RENAME ) );
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case E_TABLE:
|
2005-10-24 07:30:07 +00:00
|
|
|
ensureConnection();
|
|
|
|
if ( !getConnection().is() )
|
2005-04-06 08:47:41 +00:00
|
|
|
break;
|
|
|
|
// NO break
|
|
|
|
case E_QUERY:
|
2004-08-02 14:28:11 +00:00
|
|
|
if ( xContainer->hasByName(*aList.begin()) )
|
|
|
|
{
|
|
|
|
xRename.set(xContainer->getByName(*aList.begin()),UNO_QUERY);
|
2005-04-06 08:47:41 +00:00
|
|
|
sal_Int32 nCommandType = eType == E_QUERY ? CommandType::QUERY : CommandType::TABLE;
|
2005-10-24 07:30:07 +00:00
|
|
|
|
2006-10-18 12:29:46 +00:00
|
|
|
ensureConnection();
|
2006-07-10 14:22:12 +00:00
|
|
|
pNameChecker.reset( new DynamicTableOrQueryNameCheck( getConnection(), nCommandType ) );
|
2015-04-20 14:00:04 +01:00
|
|
|
aDialog.reset( VclPtr<OSaveAsDlg>::Create(
|
|
|
|
|
2013-01-07 17:46:55 +02:00
|
|
|
getView(), nCommandType, getORB(), getConnection(),
|
2006-07-10 14:22:12 +00:00
|
|
|
*aList.begin(), *pNameChecker, SAD_TITLE_RENAME ) );
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-06-20 01:53:25 +00:00
|
|
|
default:
|
|
|
|
break;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
|
2006-07-10 14:22:12 +00:00
|
|
|
if ( xRename.is() && aDialog.get() )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
|
2014-04-17 11:16:55 +02:00
|
|
|
bool bTryAgain = true;
|
2004-08-02 14:28:11 +00:00
|
|
|
while( bTryAgain )
|
|
|
|
{
|
2006-07-10 14:22:12 +00:00
|
|
|
if ( aDialog->Execute() == RET_OK )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sNewName;
|
2004-08-02 14:28:11 +00:00
|
|
|
if ( eType == E_TABLE )
|
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sName = aDialog->getName();
|
|
|
|
OUString sCatalog = aDialog->getCatalog();
|
|
|
|
OUString sSchema = aDialog->getSchema();
|
2004-08-02 14:28:11 +00:00
|
|
|
|
2016-02-25 09:38:09 +02:00
|
|
|
sNewName = ::dbtools::composeTableName( m_xMetaData, sCatalog, sSchema, sName, false, ::dbtools::EComposeRule::InDataManipulation );
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
else
|
2006-07-10 14:22:12 +00:00
|
|
|
sNewName = aDialog->getName();
|
2004-08-02 14:28:11 +00:00
|
|
|
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sOldName = *aList.begin();
|
2004-08-02 14:28:11 +00:00
|
|
|
if ( eType == E_FORM || eType == E_REPORT )
|
|
|
|
{
|
|
|
|
Reference<XContent> xContent(xRename,UNO_QUERY);
|
|
|
|
if ( xContent.is() )
|
|
|
|
{
|
|
|
|
sOldName = xContent->getIdentifier()->getContentIdentifier();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
xRename->rename(sNewName);
|
|
|
|
|
2007-05-09 12:24:34 +00:00
|
|
|
if ( eType == E_TABLE )
|
2006-08-28 14:05:18 +00:00
|
|
|
{
|
2007-05-09 12:24:34 +00:00
|
|
|
Reference<XPropertySet> xProp(xRename,UNO_QUERY);
|
2016-02-25 09:38:09 +02:00
|
|
|
sNewName = ::dbaui::composeTableName( m_xMetaData, xProp, ::dbtools::EComposeRule::InDataManipulation, false, false, false );
|
2006-08-28 14:05:18 +00:00
|
|
|
}
|
2007-05-09 12:24:34 +00:00
|
|
|
getContainer()->elementReplaced( eType , sOldName, sNewName );
|
2004-08-02 14:28:11 +00:00
|
|
|
|
2014-04-17 11:16:55 +02:00
|
|
|
bTryAgain = false;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2008-05-05 14:51:14 +00:00
|
|
|
catch(const SQLException& )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2008-05-05 14:51:14 +00:00
|
|
|
showError( SQLExceptionInfo( ::cppu::getCaughtException() ) );
|
2004-08-02 14:28:11 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
catch(const ElementExistException& e)
|
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sStatus("S1000");
|
|
|
|
OUString sMsg = OUString( ModuleRes( STR_NAME_ALREADY_EXISTS ) );
|
2015-06-25 12:36:31 +02:00
|
|
|
showError(SQLExceptionInfo(SQLException(sMsg.replaceAll("#", e.Message), e.Context, sStatus, 0, Any())));
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
catch(const Exception& )
|
|
|
|
{
|
2008-05-05 14:51:14 +00:00
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2014-04-17 11:16:55 +02:00
|
|
|
bTryAgain = false;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(const Exception& )
|
|
|
|
{
|
2008-05-05 14:51:14 +00:00
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
2008-06-25 11:35:22 +00:00
|
|
|
|
2008-12-01 12:31:27 +00:00
|
|
|
void OApplicationController::onSelectionChanged()
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
InvalidateAll();
|
|
|
|
|
2008-12-01 12:31:27 +00:00
|
|
|
SelectionGuard aSelGuard( *m_pSelectionNotifier );
|
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
OApplicationView* pView = getContainer();
|
2008-12-01 12:31:27 +00:00
|
|
|
if ( !pView )
|
|
|
|
return;
|
2008-06-25 11:35:22 +00:00
|
|
|
|
2008-12-01 12:31:27 +00:00
|
|
|
if ( pView->getSelectionCount() == 1 )
|
|
|
|
{
|
2007-09-26 13:46:26 +00:00
|
|
|
const ElementType eType = pView->getElementType();
|
2008-12-01 12:31:27 +00:00
|
|
|
if ( pView->isALeafSelected() )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2015-11-10 10:13:39 +01:00
|
|
|
const OUString sName = pView->getQualifiedName( nullptr /* means 'first selected' */ );
|
2008-12-01 12:31:27 +00:00
|
|
|
showPreviewFor( eType, sName );
|
2007-09-26 13:46:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2013-02-20 04:33:49 +01:00
|
|
|
void OApplicationController::showPreviewFor(const ElementType _eType,const OUString& _sName)
|
2007-09-26 13:46:26 +00:00
|
|
|
{
|
2009-02-17 15:39:54 +00:00
|
|
|
if ( m_ePreviewMode == E_PREVIEWNONE )
|
|
|
|
return;
|
|
|
|
|
2007-09-26 13:46:26 +00:00
|
|
|
OApplicationView* pView = getContainer();
|
2008-12-01 12:31:27 +00:00
|
|
|
if ( !pView )
|
|
|
|
return;
|
|
|
|
|
2007-09-26 13:46:26 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
switch( _eType )
|
|
|
|
{
|
|
|
|
case E_FORM:
|
|
|
|
case E_REPORT:
|
2008-12-01 12:31:27 +00:00
|
|
|
{
|
|
|
|
Reference< XHierarchicalNameAccess > xContainer( getElements( _eType ), UNO_QUERY_THROW );
|
|
|
|
Reference< XContent> xContent( xContainer->getByHierarchicalName( _sName ), UNO_QUERY_THROW );
|
|
|
|
pView->showPreview( xContent );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_TABLE:
|
2007-09-26 13:46:26 +00:00
|
|
|
case E_QUERY:
|
|
|
|
{
|
|
|
|
SharedConnection xConnection( ensureConnection() );
|
|
|
|
if ( xConnection.is() )
|
2008-12-01 12:31:27 +00:00
|
|
|
pView->showPreview( getDatabaseName(), xConnection, _sName, _eType == E_TABLE );
|
2007-09-26 13:46:26 +00:00
|
|
|
}
|
|
|
|
return;
|
2008-12-01 12:31:27 +00:00
|
|
|
|
2007-09-26 13:46:26 +00:00
|
|
|
default:
|
2011-03-12 11:27:59 +01:00
|
|
|
OSL_FAIL( "OApplicationController::showPreviewFor: unexpected element type!" );
|
2007-09-26 13:46:26 +00:00
|
|
|
break;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
2008-05-05 14:51:14 +00:00
|
|
|
catch( const SQLException& )
|
2007-09-26 13:46:26 +00:00
|
|
|
{
|
2008-05-05 14:51:14 +00:00
|
|
|
showError( SQLExceptionInfo( ::cppu::getCaughtException() ) );
|
2007-09-26 13:46:26 +00:00
|
|
|
}
|
2008-05-05 14:51:14 +00:00
|
|
|
catch(const Exception& )
|
2007-09-26 13:46:26 +00:00
|
|
|
{
|
2008-05-05 14:51:14 +00:00
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2007-09-26 13:46:26 +00:00
|
|
|
}
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2008-03-06 17:09:10 +00:00
|
|
|
|
2015-08-14 16:34:39 +02:00
|
|
|
IMPL_LINK_NOARG_TYPED(OApplicationController, OnClipboardChanged, TransferableDataHelper*, void)
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2012-01-12 23:25:35 +00:00
|
|
|
OnInvalidateClipboard();
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2012-01-12 23:25:35 +00:00
|
|
|
void OApplicationController::OnInvalidateClipboard()
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
InvalidateFeature(ID_BROWSER_CUT);
|
|
|
|
InvalidateFeature(ID_BROWSER_COPY);
|
|
|
|
InvalidateFeature(ID_BROWSER_PASTE);
|
|
|
|
InvalidateFeature(SID_DB_APP_PASTE_SPECIAL);
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2008-12-01 12:31:27 +00:00
|
|
|
void OApplicationController::onCopyEntry()
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2004-09-09 08:38:28 +00:00
|
|
|
Execute(ID_BROWSER_COPY,Sequence<PropertyValue>());
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2008-12-01 12:31:27 +00:00
|
|
|
void OApplicationController::onPasteEntry()
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2004-09-09 08:38:28 +00:00
|
|
|
Execute(ID_BROWSER_PASTE,Sequence<PropertyValue>());
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2008-12-01 12:31:27 +00:00
|
|
|
void OApplicationController::onDeleteEntry()
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2004-09-09 08:38:28 +00:00
|
|
|
ElementType eType = getContainer()->getElementType();
|
|
|
|
sal_uInt16 nId = 0;
|
|
|
|
switch(eType)
|
|
|
|
{
|
|
|
|
case E_TABLE:
|
|
|
|
nId = SID_DB_APP_TABLE_DELETE;
|
|
|
|
break;
|
|
|
|
case E_QUERY:
|
|
|
|
nId = SID_DB_APP_QUERY_DELETE;
|
|
|
|
break;
|
|
|
|
case E_FORM:
|
|
|
|
nId = SID_DB_APP_FORM_DELETE;
|
|
|
|
break;
|
|
|
|
case E_REPORT:
|
|
|
|
nId = SID_DB_APP_REPORT_DELETE;
|
|
|
|
break;
|
|
|
|
default:
|
2011-03-12 12:04:35 +01:00
|
|
|
OSL_FAIL("Invalid ElementType!");
|
2004-09-09 08:38:28 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
executeChecked(nId,Sequence<PropertyValue>());
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2008-06-25 11:35:22 +00:00
|
|
|
|
|
|
|
void OApplicationController::executeUnChecked(const URL& _rCommand, const Sequence< PropertyValue>& aArgs)
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2015-10-09 12:05:50 +02:00
|
|
|
OGenericUnoController::executeUnChecked( _rCommand, aArgs );
|
2008-06-25 11:35:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OApplicationController::executeChecked(const URL& _rCommand, const Sequence< PropertyValue>& aArgs)
|
|
|
|
{
|
2015-10-09 12:05:50 +02:00
|
|
|
OGenericUnoController::executeChecked( _rCommand, aArgs );
|
2008-06-25 11:35:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OApplicationController::executeUnChecked(sal_uInt16 _nCommandId, const Sequence< PropertyValue>& aArgs)
|
|
|
|
{
|
2015-10-09 12:05:50 +02:00
|
|
|
OGenericUnoController::executeUnChecked( _nCommandId, aArgs );
|
2008-06-25 11:35:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OApplicationController::executeChecked(sal_uInt16 _nCommandId, const Sequence< PropertyValue>& aArgs)
|
|
|
|
{
|
2015-10-09 12:05:50 +02:00
|
|
|
OGenericUnoController::executeChecked( _nCommandId, aArgs );
|
2008-06-25 11:35:22 +00:00
|
|
|
}
|
|
|
|
|
2014-04-01 09:53:24 +02:00
|
|
|
bool OApplicationController::isCommandEnabled(sal_uInt16 _nCommandId) const
|
2008-06-25 11:35:22 +00:00
|
|
|
{
|
2015-10-09 12:05:50 +02:00
|
|
|
return OGenericUnoController::isCommandEnabled( _nCommandId );
|
2008-06-25 11:35:22 +00:00
|
|
|
}
|
|
|
|
|
2014-04-01 09:53:24 +02:00
|
|
|
bool OApplicationController::isCommandEnabled( const OUString& _rCompleteCommandURL ) const
|
2008-06-25 11:35:22 +00:00
|
|
|
{
|
2015-10-09 12:05:50 +02:00
|
|
|
return OGenericUnoController::isCommandEnabled( _rCompleteCommandURL );
|
2008-06-25 11:35:22 +00:00
|
|
|
}
|
|
|
|
|
2013-02-20 04:33:49 +01:00
|
|
|
sal_uInt16 OApplicationController::registerCommandURL( const OUString& _rCompleteCommandURL )
|
2008-06-25 11:35:22 +00:00
|
|
|
{
|
2015-10-09 12:05:50 +02:00
|
|
|
return OGenericUnoController::registerCommandURL( _rCompleteCommandURL );
|
2008-06-25 11:35:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OApplicationController::notifyHiContrastChanged()
|
|
|
|
{
|
2015-10-09 12:05:50 +02:00
|
|
|
OGenericUnoController::notifyHiContrastChanged();
|
2008-06-25 11:35:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Reference< XController > OApplicationController::getXController() throw( RuntimeException )
|
|
|
|
{
|
2015-10-09 12:05:50 +02:00
|
|
|
return OGenericUnoController::getXController();
|
2008-06-25 11:35:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool OApplicationController::interceptUserInput( const NotifyEvent& _rEvent )
|
|
|
|
{
|
2015-10-09 12:05:50 +02:00
|
|
|
return OGenericUnoController::interceptUserInput( _rEvent );
|
2008-06-25 11:35:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PopupMenu* OApplicationController::getContextMenu( Control& /*_rControl*/ ) const
|
|
|
|
{
|
|
|
|
return new PopupMenu( ModuleRes( RID_MENU_APP_EDIT ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
IController& OApplicationController::getCommandController()
|
|
|
|
{
|
2015-10-09 12:20:01 +02:00
|
|
|
return *this;
|
2008-06-25 11:35:22 +00:00
|
|
|
}
|
|
|
|
|
2016-01-19 19:45:45 +02:00
|
|
|
::comphelper::OInterfaceContainerHelper2* OApplicationController::getContextMenuInterceptors()
|
2008-06-25 11:35:22 +00:00
|
|
|
{
|
|
|
|
return &m_aContextMenuInterceptors;
|
|
|
|
}
|
|
|
|
|
|
|
|
Any OApplicationController::getCurrentSelection( Control& _rControl ) const
|
|
|
|
{
|
|
|
|
Sequence< NamedDatabaseObject > aSelection;
|
|
|
|
getContainer()->describeCurrentSelectionForControl( _rControl, aSelection );
|
|
|
|
return makeAny( aSelection );
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2004-10-22 10:59:12 +00:00
|
|
|
|
2014-04-17 11:16:55 +02:00
|
|
|
bool OApplicationController::requestQuickHelp( const SvTreeListEntry* /*_pEntry*/, OUString& /*_rText*/ ) const
|
2004-10-22 10:59:12 +00:00
|
|
|
{
|
2014-04-17 11:16:55 +02:00
|
|
|
return false;
|
2004-10-22 10:59:12 +00:00
|
|
|
}
|
|
|
|
|
2014-04-17 11:16:55 +02:00
|
|
|
bool OApplicationController::requestDrag( sal_Int8 /*_nAction*/, const Point& /*_rPosPixel*/ )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2015-11-10 10:13:39 +01:00
|
|
|
TransferableHelper* pTransfer = nullptr;
|
2004-08-02 14:28:11 +00:00
|
|
|
if ( getContainer() && getContainer()->getSelectionCount() )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
pTransfer = copyObject( );
|
|
|
|
Reference< XTransferable> xEnsureDelete = pTransfer;
|
|
|
|
|
2005-01-05 11:32:18 +00:00
|
|
|
if ( pTransfer && getContainer()->getDetailView() )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
ElementType eType = getContainer()->getElementType();
|
2008-01-30 07:41:07 +00:00
|
|
|
pTransfer->StartDrag( getContainer()->getDetailView()->getTreeWindow(), ((eType == E_FORM || eType == E_REPORT) ? DND_ACTION_COPYMOVE : DND_ACTION_COPY) );
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(const Exception& )
|
|
|
|
{
|
2008-05-05 14:51:14 +00:00
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-10 10:13:39 +01:00
|
|
|
return nullptr != pTransfer;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
sal_Int8 OApplicationController::queryDrop( const AcceptDropEvent& _rEvt, const DataFlavorExVector& _rFlavors )
|
|
|
|
{
|
2004-09-09 08:38:28 +00:00
|
|
|
sal_Int8 nActionAskedFor = _rEvt.mnAction;
|
2004-08-02 14:28:11 +00:00
|
|
|
// check if we're a table or query container
|
|
|
|
OApplicationView* pView = getContainer();
|
|
|
|
if ( pView && !isDataSourceReadOnly() )
|
|
|
|
{
|
|
|
|
ElementType eType = pView->getElementType();
|
|
|
|
if ( eType != E_NONE && (eType != E_TABLE || !isConnectionReadOnly()) )
|
|
|
|
{
|
|
|
|
// check for the concrete type
|
2015-05-04 10:47:12 +09:00
|
|
|
if(::std::any_of(_rFlavors.begin(),_rFlavors.end(),TAppSupportedSotFunctor(eType,true)))
|
2004-08-02 14:28:11 +00:00
|
|
|
return DND_ACTION_COPY;
|
|
|
|
if ( eType == E_FORM || eType == E_REPORT )
|
|
|
|
{
|
2005-09-23 11:14:21 +00:00
|
|
|
sal_Int8 nAction = OComponentTransferable::canExtractComponentDescriptor(_rFlavors,eType == E_FORM) ? DND_ACTION_COPY : DND_ACTION_NONE;
|
2004-08-02 14:28:11 +00:00
|
|
|
if ( nAction != DND_ACTION_NONE )
|
|
|
|
{
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pHitEntry = pView->getEntry(_rEvt.maPosPixel);
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sName;
|
2004-08-02 14:28:11 +00:00
|
|
|
if ( pHitEntry )
|
|
|
|
{
|
2006-10-05 11:59:07 +00:00
|
|
|
sName = pView->getQualifiedName( pHitEntry );
|
2011-12-19 18:10:37 -02:00
|
|
|
if ( !sName.isEmpty() )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
Reference< XHierarchicalNameAccess > xContainer(getElements(pView->getElementType()),UNO_QUERY);
|
|
|
|
if ( xContainer.is() && xContainer->hasByHierarchicalName(sName) )
|
|
|
|
{
|
|
|
|
Reference< XHierarchicalNameAccess > xHitObject(xContainer->getByHierarchicalName(sName),UNO_QUERY);
|
|
|
|
if ( xHitObject.is() )
|
2004-09-09 08:38:28 +00:00
|
|
|
nAction = nActionAskedFor & DND_ACTION_COPYMOVE;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
nAction = DND_ACTION_NONE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nAction;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return DND_ACTION_NONE;
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
sal_Int8 OApplicationController::executeDrop( const ExecuteDropEvent& _rEvt )
|
|
|
|
{
|
|
|
|
OApplicationView* pView = getContainer();
|
|
|
|
if ( !pView || pView->getElementType() == E_NONE )
|
|
|
|
{
|
2011-02-25 17:47:41 +01:00
|
|
|
OSL_FAIL("OApplicationController::executeDrop: what the hell did queryDrop do?");
|
2014-05-13 23:26:20 +02:00
|
|
|
// queryDrop should not have allowed us to reach this situation ....
|
2004-08-02 14:28:11 +00:00
|
|
|
return DND_ACTION_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// a TransferableDataHelper for accessing the dropped data
|
|
|
|
TransferableDataHelper aDroppedData(_rEvt.maDropEvent.Transferable);
|
|
|
|
|
|
|
|
// reset the data of the previous async drop (if any)
|
|
|
|
if ( m_nAsyncDrop )
|
|
|
|
Application::RemoveUserEvent(m_nAsyncDrop);
|
|
|
|
|
2015-11-10 10:13:39 +01:00
|
|
|
m_nAsyncDrop = nullptr;
|
2004-08-02 14:28:11 +00:00
|
|
|
m_aAsyncDrop.aDroppedData.clear();
|
|
|
|
m_aAsyncDrop.nType = pView->getElementType();
|
|
|
|
m_aAsyncDrop.nAction = _rEvt.mnAction;
|
2014-04-17 11:16:55 +02:00
|
|
|
m_aAsyncDrop.bError = false;
|
|
|
|
m_aAsyncDrop.bHtml = false;
|
2014-12-18 13:22:10 +01:00
|
|
|
m_aAsyncDrop.aUrl.clear();
|
2004-08-02 14:28:11 +00:00
|
|
|
|
|
|
|
// loop through the available formats and see what we can do ...
|
|
|
|
// first we have to check if it is our own format, if not we have to copy the stream :-(
|
|
|
|
if ( ODataAccessObjectTransferable::canExtractObjectDescriptor(aDroppedData.GetDataFlavorExVector()) )
|
|
|
|
{
|
|
|
|
m_aAsyncDrop.aDroppedData = ODataAccessObjectTransferable::extractObjectDescriptor(aDroppedData);
|
|
|
|
|
2015-01-24 18:47:48 +01:00
|
|
|
// asynchron because we some dialogs and we aren't allowed to show them while in D&D
|
2004-08-02 14:28:11 +00:00
|
|
|
m_nAsyncDrop = Application::PostUserEvent(LINK(this, OApplicationController, OnAsyncDrop));
|
|
|
|
return DND_ACTION_COPY;
|
|
|
|
}
|
2005-09-23 11:14:21 +00:00
|
|
|
else if ( OComponentTransferable::canExtractComponentDescriptor(aDroppedData.GetDataFlavorExVector(),m_aAsyncDrop.nType == E_FORM) )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
m_aAsyncDrop.aDroppedData = OComponentTransferable::extractComponentDescriptor(aDroppedData);
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* pHitEntry = pView->getEntry(_rEvt.maPosPixel);
|
2004-08-02 14:28:11 +00:00
|
|
|
if ( pHitEntry )
|
2006-10-05 11:59:07 +00:00
|
|
|
m_aAsyncDrop.aUrl = pView->getQualifiedName( pHitEntry );
|
2004-08-02 14:28:11 +00:00
|
|
|
|
|
|
|
sal_Int8 nAction = _rEvt.mnAction;
|
|
|
|
Reference<XContent> xContent;
|
|
|
|
m_aAsyncDrop.aDroppedData[daComponent] >>= xContent;
|
|
|
|
if ( xContent.is() )
|
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sName = xContent->getIdentifier()->getContentIdentifier();
|
2004-08-02 14:28:11 +00:00
|
|
|
sal_Int32 nIndex = 0;
|
|
|
|
sName = sName.copy(sName.getToken(0,'/',nIndex).getLength() + 1);
|
2013-09-02 09:03:31 +01:00
|
|
|
if ( m_aAsyncDrop.aUrl.getLength() >= sName.getLength() && m_aAsyncDrop.aUrl.startsWith(sName) )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
m_aAsyncDrop.aDroppedData.clear();
|
|
|
|
return DND_ACTION_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// check if move is allowed, if another object with the same name exists only copy is allowed
|
|
|
|
Reference< XHierarchicalNameAccess > xContainer(getElements(m_aAsyncDrop.nType),UNO_QUERY);
|
|
|
|
Reference<XNameAccess> xNameAccess(xContainer,UNO_QUERY);
|
|
|
|
|
2013-09-02 09:03:31 +01:00
|
|
|
if ( !m_aAsyncDrop.aUrl.isEmpty() && xContainer.is() && xContainer->hasByHierarchicalName(m_aAsyncDrop.aUrl) )
|
2004-08-02 14:28:11 +00:00
|
|
|
xNameAccess.set(xContainer->getByHierarchicalName(m_aAsyncDrop.aUrl),UNO_QUERY);
|
|
|
|
|
|
|
|
if ( xNameAccess.is() )
|
|
|
|
{
|
|
|
|
Reference<XPropertySet> xProp(xContent,UNO_QUERY);
|
|
|
|
if ( xProp.is() )
|
|
|
|
{
|
|
|
|
xProp->getPropertyValue(PROPERTY_NAME) >>= sName;
|
|
|
|
if ( xNameAccess.is() && xNameAccess->hasByName(sName) )
|
|
|
|
nAction &= ~DND_ACTION_MOVE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
nAction &= ~DND_ACTION_MOVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( nAction != DND_ACTION_NONE )
|
|
|
|
{
|
|
|
|
m_aAsyncDrop.nAction = nAction;
|
2015-01-24 18:47:48 +01:00
|
|
|
// asynchron because we some dialogs and we aren't allowed to show them while in D&D
|
2004-08-02 14:28:11 +00:00
|
|
|
m_nAsyncDrop = Application::PostUserEvent(LINK(this, OApplicationController, OnAsyncDrop));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
m_aAsyncDrop.aDroppedData.clear();
|
|
|
|
return nAction;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-10-24 07:30:07 +00:00
|
|
|
SharedConnection xConnection( ensureConnection() );
|
|
|
|
if ( xConnection.is() && m_aTableCopyHelper.copyTagTable( aDroppedData, m_aAsyncDrop, xConnection ) )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2015-01-24 18:47:48 +01:00
|
|
|
// asynchron because we some dialogs and we aren't allowed to show them while in D&D
|
2004-08-02 14:28:11 +00:00
|
|
|
m_nAsyncDrop = Application::PostUserEvent(LINK(this, OApplicationController, OnAsyncDrop));
|
|
|
|
return DND_ACTION_COPY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return DND_ACTION_NONE;
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2015-04-14 12:44:47 +02:00
|
|
|
Reference< XModel > SAL_CALL OApplicationController::getModel() throw( RuntimeException, std::exception )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2005-03-10 15:43:10 +00:00
|
|
|
return m_xModel;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2008-03-06 17:09:10 +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 OApplicationController::onAttachedFrame()
|
2008-03-06 17:09:10 +00:00
|
|
|
{
|
|
|
|
sal_Int32 nConnectedControllers( 0 );
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XModel2 > xModel( m_xModel, UNO_QUERY_THROW );
|
|
|
|
Reference< XEnumeration > xEnumControllers( xModel->getControllers(), UNO_SET_THROW );
|
|
|
|
while ( xEnumControllers->hasMoreElements() )
|
|
|
|
{
|
|
|
|
Reference< XController > xController( xEnumControllers->nextElement(), UNO_QUERY_THROW );
|
|
|
|
++nConnectedControllers;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( nConnectedControllers > 1 )
|
|
|
|
{ // we are not the first connected controller, there were already others
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
OnFirstControllerConnected();
|
2008-03-06 17:09:10 +00:00
|
|
|
}
|
|
|
|
|
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 OApplicationController::OnFirstControllerConnected()
|
2008-03-06 17:09:10 +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
|
|
|
if ( !m_xModel.is() )
|
|
|
|
{
|
2011-03-12 11:27:59 +01:00
|
|
|
OSL_FAIL( "OApplicationController::OnFirstControllerConnected: too late!" );
|
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
|
|
|
}
|
|
|
|
|
2008-03-06 17:09:10 +00:00
|
|
|
// if we have forms or reports which contain macros/scripts, then show a warning
|
|
|
|
// which suggests the user to migrate them to the database document
|
|
|
|
Reference< XEmbeddedScripts > xDocumentScripts( m_xModel, UNO_QUERY );
|
|
|
|
if ( xDocumentScripts.is() )
|
|
|
|
{
|
|
|
|
// no need to show this warning, obviously the document supports embedding scripts
|
|
|
|
// into itself, so there are no "old-style" forms/reports which have macros/scripts
|
|
|
|
// themselves
|
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
|
|
|
return;
|
2008-03-06 17:09:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2008-06-06 13:06:49 +00:00
|
|
|
// If the migration just happened, but was not successful, the document is reloaded.
|
|
|
|
// In this case, we should not show the warning, again.
|
|
|
|
::comphelper::NamedValueCollection aModelArgs( m_xModel->getArgs() );
|
|
|
|
if ( aModelArgs.getOrDefault( "SuppressMigrationWarning", sal_False ) )
|
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
|
|
|
return;
|
2008-06-06 13:06:49 +00:00
|
|
|
|
|
|
|
// also, if the document is read-only, then no migration is possible, and the
|
|
|
|
// respective menu entry is hidden. So, don't show the warning in this case, too.
|
|
|
|
if ( Reference< XStorable >( m_xModel, UNO_QUERY_THROW )->isReadonly() )
|
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
|
|
|
return;
|
2008-06-06 13:06:49 +00:00
|
|
|
|
|
|
|
SQLWarning aWarning;
|
2013-02-20 04:33:49 +01:00
|
|
|
aWarning.Message = OUString( ModuleRes( STR_SUB_DOCS_WITH_SCRIPTS ) );
|
2008-06-06 13:06:49 +00:00
|
|
|
SQLException aDetail;
|
2013-02-20 04:33:49 +01:00
|
|
|
aDetail.Message = OUString( ModuleRes( STR_SUB_DOCS_WITH_SCRIPTS_DETAIL ) );
|
2008-06-06 13:06:49 +00:00
|
|
|
aWarning.NextException <<= aDetail;
|
|
|
|
|
2015-11-10 10:13:39 +01:00
|
|
|
Reference< XExecutableDialog > xDialog = ErrorMessageDialog::create( getORB(), "", nullptr, makeAny( aWarning ) );
|
2008-03-06 17:09:10 +00:00
|
|
|
xDialog->execute();
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
return;
|
2008-03-06 17:09:10 +00:00
|
|
|
}
|
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OApplicationController::attachFrame( const Reference< XFrame > & i_rxFrame ) throw( RuntimeException, std::exception )
|
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
|
|
|
{
|
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
|
|
|
::osl::MutexGuard aGuard( getMutex() );
|
|
|
|
|
2015-10-09 12:05:50 +02:00
|
|
|
OGenericUnoController::attachFrame( i_rxFrame );
|
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
|
|
|
if ( getFrame().is() )
|
|
|
|
onAttachedFrame();
|
|
|
|
}
|
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > & _rxModel) throw( RuntimeException, std::exception )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2008-12-01 12:31:27 +00:00
|
|
|
::osl::MutexGuard aGuard( getMutex() );
|
2010-12-02 11:11:43 +01:00
|
|
|
const Reference< XOfficeDatabaseDocument > xOfficeDoc( _rxModel, UNO_QUERY );
|
|
|
|
const Reference< XModifiable > xDocModify( _rxModel, UNO_QUERY );
|
|
|
|
if ( ( !xOfficeDoc.is() || !xDocModify.is() ) && _rxModel.is() )
|
2005-09-23 11:14:21 +00:00
|
|
|
{
|
2011-02-25 17:47:41 +01:00
|
|
|
OSL_FAIL( "OApplicationController::attachModel: invalid model!" );
|
2005-09-23 11:14:21 +00:00
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
|
2010-12-02 11:11:43 +01:00
|
|
|
if ( m_xModel.is() && ( m_xModel != _rxModel ) && ( _rxModel.is() ) )
|
|
|
|
{
|
|
|
|
OSL_ENSURE( false, "OApplicationController::attachModel: missing implementation: setting a new model while we have another one!" );
|
|
|
|
// we'd need to completely update our view here, close sub components, and the like
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
|
2013-02-20 04:33:49 +01:00
|
|
|
const OUString aPropertyNames[] =
|
2010-12-02 11:11:43 +01:00
|
|
|
{
|
2013-04-25 10:56:02 +02:00
|
|
|
OUString(PROPERTY_URL), OUString(PROPERTY_USER)
|
2010-12-02 11:11:43 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
// disconnect from old model
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if ( m_xDataSource.is() )
|
|
|
|
{
|
|
|
|
for ( size_t i=0; i < sizeof( aPropertyNames ) / sizeof( aPropertyNames[0] ); ++i )
|
|
|
|
{
|
|
|
|
m_xDataSource->removePropertyChangeListener( aPropertyNames[i], this );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Reference< XModifyBroadcaster > xBroadcaster( m_xModel, UNO_QUERY );
|
|
|
|
if ( xBroadcaster.is() )
|
|
|
|
xBroadcaster->removeModifyListener( this );
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
2005-09-23 11:14:21 +00:00
|
|
|
|
|
|
|
m_xModel = _rxModel;
|
2010-12-02 11:11:43 +01:00
|
|
|
m_xDataSource.set( xOfficeDoc.is() ? xOfficeDoc->getDataSource() : Reference< XDataSource >(), UNO_QUERY );
|
|
|
|
|
|
|
|
// connect to new model
|
|
|
|
try
|
2008-03-06 17:09:10 +00:00
|
|
|
{
|
2010-12-02 11:11:43 +01:00
|
|
|
if ( m_xDataSource.is() )
|
|
|
|
{
|
|
|
|
for ( size_t i=0; i < sizeof( aPropertyNames ) / sizeof( aPropertyNames[0] ); ++i )
|
|
|
|
{
|
|
|
|
m_xDataSource->addPropertyChangeListener( aPropertyNames[i], this );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Reference< XModifyBroadcaster > xBroadcaster( m_xModel, UNO_QUERY_THROW );
|
|
|
|
xBroadcaster->addModifyListener( this );
|
|
|
|
|
2008-03-06 17:09:10 +00:00
|
|
|
}
|
2010-12-02 11:11:43 +01:00
|
|
|
catch( const Exception& )
|
2008-03-06 17:09:10 +00:00
|
|
|
{
|
2010-12-02 11:11:43 +01:00
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2008-03-06 17:09:10 +00:00
|
|
|
}
|
2005-09-23 11:14:21 +00:00
|
|
|
|
2010-12-02 11:11:43 +01:00
|
|
|
// initial preview mode
|
2008-12-01 12:31:27 +00:00
|
|
|
if ( m_xDataSource.is() )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
// to get the 'modified' for the data source
|
2010-12-02 11:11:43 +01:00
|
|
|
::comphelper::NamedValueCollection aLayoutInfo( m_xDataSource->getPropertyValue( PROPERTY_LAYOUTINFORMATION ) );
|
2014-10-02 13:37:01 +02:00
|
|
|
if ( aLayoutInfo.has( OUString(INFO_PREVIEW) ) )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2015-11-06 09:35:25 +01:00
|
|
|
const sal_Int32 nPreviewMode( aLayoutInfo.getOrDefault( INFO_PREVIEW, (sal_Int32)0 ) );
|
2010-12-02 11:11:43 +01:00
|
|
|
m_ePreviewMode = static_cast< PreviewMode >( nPreviewMode );
|
2008-12-09 07:25:38 +00:00
|
|
|
if ( getView() )
|
2010-12-02 11:11:43 +01:00
|
|
|
getContainer()->switchPreview( m_ePreviewMode );
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
2008-05-05 14:51:14 +00:00
|
|
|
catch( const Exception& )
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2008-05-05 14:51:14 +00:00
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
2005-09-23 11:14:21 +00:00
|
|
|
|
|
|
|
return sal_True;
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
void OApplicationController::containerFound( const Reference< XContainer >& _xContainer)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if ( _xContainer.is() )
|
|
|
|
{
|
2005-01-21 16:05:05 +00:00
|
|
|
m_aCurrentContainers.push_back(_xContainer);
|
2004-08-02 14:28:11 +00:00
|
|
|
_xContainer->addContainerListener(this);
|
|
|
|
}
|
|
|
|
}
|
2010-09-20 23:42:56 +02:00
|
|
|
catch(const Exception&)
|
2004-08-02 14:28:11 +00:00
|
|
|
{
|
2010-09-20 23:42:56 +02:00
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2004-08-02 14:28:11 +00:00
|
|
|
}
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString OApplicationController::getCurrentlySelectedName(sal_Int32& _rnCommandType) const
|
2007-11-20 18:22:51 +00:00
|
|
|
{
|
|
|
|
_rnCommandType = ( (getContainer()->getElementType() == E_QUERY)
|
|
|
|
? CommandType::QUERY : ( (getContainer()->getElementType() == E_TABLE) ? CommandType::TABLE : -1 ));
|
|
|
|
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sName;
|
2007-11-20 18:22:51 +00:00
|
|
|
if ( _rnCommandType != -1 )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2015-11-10 10:13:39 +01:00
|
|
|
sName = getContainer()->getQualifiedName( nullptr );
|
2011-12-19 18:10:37 -02:00
|
|
|
OSL_ENSURE( !sName.isEmpty(), "OApplicationController::getCurrentlySelectedName: no name given!" );
|
2007-11-20 18:22:51 +00:00
|
|
|
}
|
2008-05-05 14:51:14 +00:00
|
|
|
catch( const Exception& )
|
2007-11-20 18:22:51 +00:00
|
|
|
{
|
2008-05-05 14:51:14 +00:00
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2007-11-20 18:22:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return sName;
|
|
|
|
}
|
2008-06-25 11:35:22 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OApplicationController::addSelectionChangeListener( const Reference< view::XSelectionChangeListener >& _Listener ) throw (RuntimeException, std::exception)
|
2008-06-25 11:35:22 +00:00
|
|
|
{
|
|
|
|
m_pSelectionNotifier->addListener( _Listener );
|
|
|
|
}
|
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL OApplicationController::removeSelectionChangeListener( const Reference< view::XSelectionChangeListener >& _Listener ) throw (RuntimeException, std::exception)
|
2008-06-25 11:35:22 +00:00
|
|
|
{
|
|
|
|
m_pSelectionNotifier->removeListener( _Listener );
|
|
|
|
}
|
|
|
|
|
2014-04-03 13:52:06 +02:00
|
|
|
sal_Bool SAL_CALL OApplicationController::select( const Any& _aSelection ) throw (IllegalArgumentException, RuntimeException, std::exception)
|
2007-09-26 13:46:26 +00:00
|
|
|
{
|
2010-10-13 01:38:41 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2008-12-01 12:31:27 +00:00
|
|
|
::osl::MutexGuard aGuard( getMutex() );
|
2013-02-20 04:33:49 +01:00
|
|
|
Sequence< OUString> aSelection;
|
2007-09-26 13:46:26 +00:00
|
|
|
if ( !_aSelection.hasValue() || !getView() )
|
|
|
|
{
|
|
|
|
getContainer()->selectElements(aSelection);
|
|
|
|
return sal_True;
|
|
|
|
}
|
2008-06-25 11:35:22 +00:00
|
|
|
|
|
|
|
// BEGIN compatibility
|
2007-09-26 13:46:26 +00:00
|
|
|
Sequence< NamedValue > aCurrentSelection;
|
|
|
|
if ( (_aSelection >>= aCurrentSelection) && aCurrentSelection.getLength() )
|
|
|
|
{
|
|
|
|
ElementType eType = E_NONE;
|
|
|
|
const NamedValue* pIter = aCurrentSelection.getConstArray();
|
|
|
|
const NamedValue* pEnd = pIter + aCurrentSelection.getLength();
|
|
|
|
for(;pIter != pEnd;++pIter)
|
|
|
|
{
|
2012-04-06 15:05:52 +02:00
|
|
|
if ( pIter->Name == "Type" )
|
2007-09-26 13:46:26 +00:00
|
|
|
{
|
|
|
|
sal_Int32 nType = 0;
|
|
|
|
pIter->Value >>= nType;
|
2008-06-25 11:35:22 +00:00
|
|
|
if ( nType < DatabaseObject::TABLE || nType > DatabaseObject::REPORT )
|
2007-09-26 13:46:26 +00:00
|
|
|
throw IllegalArgumentException();
|
2008-06-25 11:35:22 +00:00
|
|
|
eType = static_cast< ElementType >( nType );
|
2007-09-26 13:46:26 +00:00
|
|
|
}
|
2012-04-06 15:05:52 +02:00
|
|
|
else if ( pIter->Name == "Selection" )
|
2007-09-26 13:46:26 +00:00
|
|
|
pIter->Value >>= aSelection;
|
|
|
|
}
|
|
|
|
|
2008-06-25 11:35:22 +00:00
|
|
|
m_aSelectContainerEvent.CancelCall(); // just in case the async select request was running
|
2008-03-06 17:09:10 +00:00
|
|
|
getContainer()->selectContainer(eType);
|
2007-09-26 13:46:26 +00:00
|
|
|
getContainer()->selectElements(aSelection);
|
|
|
|
return sal_True;
|
|
|
|
}
|
2008-06-25 11:35:22 +00:00
|
|
|
// END compatibility
|
|
|
|
|
|
|
|
Sequence< NamedDatabaseObject > aSelectedObjects;
|
|
|
|
if ( !( _aSelection >>= aSelectedObjects ) )
|
|
|
|
{
|
|
|
|
aSelectedObjects.realloc( 1 );
|
|
|
|
if ( !( _aSelection >>= aSelectedObjects[0] ) )
|
|
|
|
throw IllegalArgumentException();
|
|
|
|
}
|
|
|
|
|
|
|
|
SelectionByElementType aSelectedElements;
|
|
|
|
ElementType eSelectedCategory = E_NONE;
|
|
|
|
for ( const NamedDatabaseObject* pObject = aSelectedObjects.getConstArray();
|
|
|
|
pObject != aSelectedObjects.getConstArray() + aSelectedObjects.getLength();
|
|
|
|
++pObject
|
|
|
|
)
|
|
|
|
{
|
|
|
|
switch ( pObject->Type )
|
|
|
|
{
|
|
|
|
case DatabaseObject::TABLE:
|
|
|
|
case DatabaseObjectContainer::SCHEMA:
|
|
|
|
case DatabaseObjectContainer::CATALOG:
|
|
|
|
aSelectedElements[ E_TABLE ].push_back( pObject->Name );
|
|
|
|
break;
|
|
|
|
case DatabaseObject::QUERY:
|
|
|
|
aSelectedElements[ E_QUERY ].push_back( pObject->Name );
|
|
|
|
break;
|
|
|
|
case DatabaseObject::FORM:
|
|
|
|
case DatabaseObjectContainer::FORMS_FOLDER:
|
|
|
|
aSelectedElements[ E_FORM ].push_back( pObject->Name );
|
|
|
|
break;
|
|
|
|
case DatabaseObject::REPORT:
|
|
|
|
case DatabaseObjectContainer::REPORTS_FOLDER:
|
|
|
|
aSelectedElements[ E_REPORT ].push_back( pObject->Name );
|
|
|
|
break;
|
|
|
|
case DatabaseObjectContainer::TABLES:
|
|
|
|
case DatabaseObjectContainer::QUERIES:
|
|
|
|
case DatabaseObjectContainer::FORMS:
|
|
|
|
case DatabaseObjectContainer::REPORTS:
|
|
|
|
if ( eSelectedCategory != E_NONE )
|
|
|
|
throw IllegalArgumentException(
|
2013-02-22 03:56:22 +01:00
|
|
|
OUString(ModuleRes(RID_STR_NO_DIFF_CAT)),
|
2008-06-25 11:35:22 +00:00
|
|
|
*this, sal_Int16( pObject - aSelectedObjects.getConstArray() ) );
|
|
|
|
eSelectedCategory =
|
|
|
|
( pObject->Type == DatabaseObjectContainer::TABLES ) ? E_TABLE
|
|
|
|
: ( pObject->Type == DatabaseObjectContainer::QUERIES ) ? E_QUERY
|
|
|
|
: ( pObject->Type == DatabaseObjectContainer::FORMS ) ? E_FORM
|
|
|
|
: ( pObject->Type == DatabaseObjectContainer::REPORTS ) ? E_REPORT
|
|
|
|
: E_NONE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
case DatabaseObjectContainer::DATA_SOURCE:
|
|
|
|
{
|
2013-02-20 04:33:49 +01:00
|
|
|
OUString sMessage(
|
2014-01-29 09:23:02 +00:00
|
|
|
OUString(ModuleRes(RID_STR_UNSUPPORTED_OBJECT_TYPE)).
|
2013-08-21 15:07:31 +02:00
|
|
|
replaceFirst("$type$", OUString::number(pObject->Type)));
|
2009-11-27 10:17:16 +01:00
|
|
|
throw IllegalArgumentException(sMessage, *this, sal_Int16( pObject - aSelectedObjects.getConstArray() ));
|
2008-06-25 11:35:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( SelectionByElementType::const_iterator sel = aSelectedElements.begin();
|
|
|
|
sel != aSelectedElements.end();
|
|
|
|
++sel
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if ( sel->first == m_eCurrentType )
|
|
|
|
{
|
2015-11-19 09:14:59 +02:00
|
|
|
getContainer()->selectElements( comphelper::containerToSequence(sel->second) );
|
2008-06-25 11:35:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_aPendingSelection[ sel->first ] = sel->second;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_aSelectContainerEvent.CancelCall(); // just in case the async select request was running
|
|
|
|
getContainer()->selectContainer( eSelectedCategory );
|
|
|
|
|
|
|
|
return sal_True;
|
2007-09-26 13:46:26 +00:00
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Any SAL_CALL OApplicationController::getSelection( ) throw (RuntimeException, std::exception)
|
2007-09-26 13:46:26 +00:00
|
|
|
{
|
2010-10-13 01:38:41 -05:00
|
|
|
SolarMutexGuard aSolarGuard;
|
2008-12-01 12:31:27 +00:00
|
|
|
::osl::MutexGuard aGuard( getMutex() );
|
2007-09-26 13:46:26 +00:00
|
|
|
|
2008-06-25 11:35:22 +00:00
|
|
|
Sequence< NamedDatabaseObject > aCurrentSelection;
|
2008-10-01 12:28:29 +00:00
|
|
|
const ElementType eType( getContainer()->getElementType() );
|
|
|
|
if ( eType != E_NONE )
|
2008-12-01 12:31:27 +00:00
|
|
|
{
|
2008-10-01 12:28:29 +00:00
|
|
|
getContainer()->describeCurrentSelectionForType( eType, aCurrentSelection );
|
2008-12-01 12:31:27 +00:00
|
|
|
if ( aCurrentSelection.getLength() == 0 )
|
|
|
|
{ // if no objects are selected, add an entry to the sequence which describes the overall category
|
|
|
|
// which is selected currently
|
|
|
|
aCurrentSelection.realloc(1);
|
|
|
|
aCurrentSelection[0].Name = getDatabaseName();
|
|
|
|
switch ( eType )
|
|
|
|
{
|
|
|
|
case E_TABLE: aCurrentSelection[0].Type = DatabaseObjectContainer::TABLES; break;
|
|
|
|
case E_QUERY: aCurrentSelection[0].Type = DatabaseObjectContainer::QUERIES; break;
|
|
|
|
case E_FORM: aCurrentSelection[0].Type = DatabaseObjectContainer::FORMS; break;
|
|
|
|
case E_REPORT: aCurrentSelection[0].Type = DatabaseObjectContainer::REPORTS; break;
|
|
|
|
default:
|
2011-03-12 11:27:59 +01:00
|
|
|
OSL_FAIL( "OApplicationController::getSelection: unexpected current element type!" );
|
2008-12-01 12:31:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-06-25 11:35:22 +00:00
|
|
|
return makeAny( aCurrentSelection );
|
2007-09-26 13:46:26 +00:00
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2008-03-06 17:09:10 +00:00
|
|
|
void OApplicationController::impl_migrateScripts_nothrow()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2013-03-11 17:51:56 +02:00
|
|
|
Reference< XExecutableDialog > xDialog = css::sdb::application::MacroMigrationWizard::createWithDocument( getORB(), Reference< XOfficeDatabaseDocument >( m_xModel, UNO_QUERY_THROW ) );
|
2008-03-06 17:09:10 +00:00
|
|
|
xDialog->execute();
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-02 14:28:11 +00:00
|
|
|
} // namespace dbaui
|
|
|
|
|
2010-10-12 15:59:03 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|