summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/app
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/ui/app')
-rw-r--r--dbaccess/source/ui/app/AppController.cxx3038
-rw-r--r--dbaccess/source/ui/app/AppController.hxx578
-rw-r--r--dbaccess/source/ui/app/AppControllerDnD.cxx818
-rw-r--r--dbaccess/source/ui/app/AppControllerGen.cxx845
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.cxx1407
-rw-r--r--dbaccess/source/ui/app/AppDetailPageHelper.hxx374
-rw-r--r--dbaccess/source/ui/app/AppDetailView.cxx963
-rw-r--r--dbaccess/source/ui/app/AppDetailView.hxx380
-rw-r--r--dbaccess/source/ui/app/AppIconControl.cxx120
-rw-r--r--dbaccess/source/ui/app/AppIconControl.hxx60
-rw-r--r--dbaccess/source/ui/app/AppSwapWindow.cxx215
-rw-r--r--dbaccess/source/ui/app/AppSwapWindow.hxx106
-rw-r--r--dbaccess/source/ui/app/AppTitleWindow.cxx182
-rw-r--r--dbaccess/source/ui/app/AppTitleWindow.hxx85
-rw-r--r--dbaccess/source/ui/app/AppView.cxx601
-rw-r--r--dbaccess/source/ui/app/AppView.hxx316
-rw-r--r--dbaccess/source/ui/app/IApplicationController.hxx103
-rw-r--r--dbaccess/source/ui/app/app.src478
-rw-r--r--dbaccess/source/ui/app/closeveto.cxx180
-rw-r--r--dbaccess/source/ui/app/closeveto.hxx67
-rw-r--r--dbaccess/source/ui/app/dbu_app.hrc78
-rw-r--r--dbaccess/source/ui/app/subcomponentmanager.cxx614
-rw-r--r--dbaccess/source/ui/app/subcomponentmanager.hxx139
-rw-r--r--dbaccess/source/ui/app/window_layout.txt31
24 files changed, 0 insertions, 11778 deletions
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
deleted file mode 100644
index 9f225d0ce..000000000
--- a/dbaccess/source/ui/app/AppController.cxx
+++ /dev/null
@@ -1,3038 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_dbaccess.hxx"
-
-#include "AppController.hxx"
-#include "dbustrings.hrc"
-#include "advancedsettingsdlg.hxx"
-#include "subcomponentmanager.hxx"
-#include "closeveto.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/beans/NamedValue.hpp>
-#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/container/XContainer.hpp>
-#include <com/sun/star/container/XContentEnumerationAccess.hpp>
-#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>
-#include <com/sun/star/sdb/CommandType.hpp>
-#include <com/sun/star/sdb/SQLContext.hpp>
-#include <com/sun/star/sdb/XBookmarksSupplier.hpp>
-#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
-#include <com/sun/star/sdb/XQueryDefinitionsSupplier.hpp>
-#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>
-#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-#include <com/sun/star/uno/XNamingService.hpp>
-#include <com/sun/star/util/XFlushable.hpp>
-#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>
-#include <com/sun/star/container/XHierarchicalNameContainer.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <com/sun/star/util/XModifiable.hpp>
-#include <com/sun/star/frame/FrameSearchFlag.hpp>
-#include <com/sun/star/util/XFlushable.hpp>
-#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
-#include "com/sun/star/beans/NamedValue.hpp"
-#include <com/sun/star/awt/XTopWindow.hpp>
-#include <com/sun/star/task/XInteractionHandler.hpp>
-#include <com/sun/star/sdb/application/DatabaseObject.hpp>
-#include <com/sun/star/sdb/application/DatabaseObjectContainer.hpp>
-#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
-#include <com/sun/star/container/XHierarchicalName.hpp>
-/** === end UNO includes === **/
-#include <tools/diagnose_ex.h>
-#include <osl/diagnose.h>
-#include <tools/string.hxx>
-
-#include <svl/urihelper.hxx>
-#include <svl/filenotation.hxx>
-#include <svtools/svtreebx.hxx>
-#include <svtools/transfer.hxx>
-#include <svtools/cliplistener.hxx>
-#include <svtools/svlbitm.hxx>
-#include <svtools/insdlg.hxx>
-
-#include <comphelper/sequence.hxx>
-#include <comphelper/uno3.hxx>
-#include <comphelper/string.hxx>
-#include <comphelper/types.hxx>
-#include <comphelper/interaction.hxx>
-#include <comphelper/componentcontext.hxx>
-
-#include <vcl/msgbox.hxx>
-#include <vcl/stdtext.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/menu.hxx>
-#include <vcl/lstbox.hxx>
-
-#include <unotools/pathoptions.hxx>
-#include <unotools/tempfile.hxx>
-#include <unotools/internaloptions.hxx>
-#include <unotools/moduleoptions.hxx>
-#include <unotools/historyoptions.hxx>
-
-#include <sfx2/mailmodelapi.hxx>
-#include <sfx2/filedlghelper.hxx>
-#include <sfx2/docfilt.hxx>
-#include <sfx2/QuerySaveDocument.hxx>
-
-#include <cppuhelper/typeprovider.hxx>
-#include <cppuhelper/exc_hlp.hxx>
-
-#include <connectivity/dbtools.hxx>
-#include <connectivity/dbexception.hxx>
-
-#include <svx/dbaexchange.hxx>
-#include <svx/dbaobjectex.hxx>
-#include <svx/svxdlg.hxx>
-
-#include <osl/mutex.hxx>
-#include "AppView.hxx"
-#include "browserids.hxx"
-#include "dbu_reghelper.hxx"
-#include "dbu_app.hrc"
-#include "defaultobjectnamecheck.hxx"
-#include "databaseobjectview.hxx"
-#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"
-#include "dbaccess_slotid.hrc"
-
-#include <algorithm>
-#include <functional>
-
-#include <boost/noncopyable.hpp>
-
-extern "C" void SAL_CALL createRegistryInfo_ODBApplication()
-{
- static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::OApplicationController > aAutoRegistration;
-}
-//........................................................................
-namespace dbaui
-{
-//........................................................................
-using namespace ::dbtools;
-using namespace ::svx;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::ucb;
-using namespace ::com::sun::star::view;
-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;
-using namespace ::com::sun::star::ui::dialogs;
-using namespace ::com::sun::star::task;
-using ::com::sun::star::document::XEmbeddedScripts;
-using ::com::sun::star::document::XDocumentEventBroadcaster;
-using ::com::sun::star::document::DocumentEvent;
-using ::com::sun::star::sdb::application::NamedDatabaseObject;
-
-namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject;
-namespace DatabaseObjectContainer = ::com::sun::star::sdb::application::DatabaseObjectContainer;
-
-//------------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OApplicationController::getImplementationName() throw( RuntimeException )
-{
- return getImplementationName_Static();
-}
-
-//------------------------------------------------------------------------------
-::rtl::OUString OApplicationController::getImplementationName_Static() throw( RuntimeException )
-{
- return ::rtl::OUString(SERVICE_SDB_APPLICATIONCONTROLLER);
-}
-//------------------------------------------------------------------------------
-Sequence< ::rtl::OUString> OApplicationController::getSupportedServiceNames_Static(void) throw( RuntimeException )
-{
- Sequence< ::rtl::OUString> aSupported(1);
- aSupported.getArray()[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.application.DefaultViewController"));
- return aSupported;
-}
-//-------------------------------------------------------------------------
-Sequence< ::rtl::OUString> SAL_CALL OApplicationController::getSupportedServiceNames() throw(RuntimeException)
-{
- return getSupportedServiceNames_Static();
-}
-// -------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL OApplicationController::Create(const Reference<XMultiServiceFactory >& _rxFactory)
-{
- return *(new OApplicationController(_rxFactory));
-}
-// -----------------------------------------------------------------------------
-
-struct XContainerFunctor : public ::std::unary_function< OApplicationController::TContainerVector::value_type , bool>
-{
- Reference<XContainerListener> m_xContainerListener;
- XContainerFunctor( const Reference<XContainerListener>& _xContainerListener)
- : m_xContainerListener(_xContainerListener){}
-
- bool operator() (const OApplicationController::TContainerVector::value_type& lhs) const
- {
- if ( lhs.is() )
- lhs->removeContainerListener(m_xContainerListener);
- return true;
- }
-};
-
-//====================================================================
-//= OApplicationController
-//====================================================================
-class SelectionNotifier : public ::boost::noncopyable
-{
-private:
- ::cppu::OInterfaceContainerHelper m_aSelectionListeners;
- ::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:
- SelectionGuard( SelectionNotifier& _rNotifier )
- :m_rNotifier( _rNotifier )
- {
- m_rNotifier.enterSelection( SelectionNotifier::SelectionGuardAccess() );
- }
-
- ~SelectionGuard()
- {
- m_rNotifier.leaveSelection( SelectionNotifier::SelectionGuardAccess() );
- }
-
-private:
- SelectionNotifier& m_rNotifier;
-};
-
-//====================================================================
-//= OApplicationController
-//====================================================================
-DBG_NAME(OApplicationController)
-//--------------------------------------------------------------------
-OApplicationController::OApplicationController(const Reference< XMultiServiceFactory >& _rxORB)
- :OApplicationController_CBASE( _rxORB )
- ,m_aContextMenuInterceptors( getMutex() )
- ,m_pSubComponentManager( new SubComponentManager( *this, getSharedMutex() ) )
- ,m_aTypeCollection(_rxORB)
- ,m_aTableCopyHelper(this)
- ,m_pClipbordNotifier(NULL)
- ,m_nAsyncDrop(0)
- ,m_aControllerConnectedEvent( LINK( this, OApplicationController, OnFirstControllerConnected ) )
- ,m_aSelectContainerEvent( LINK( this, OApplicationController, OnSelectContainer ) )
- ,m_ePreviewMode(E_PREVIEWNONE)
- ,m_eCurrentType(E_NONE)
- ,m_bNeedToReconnect(sal_False)
- ,m_bSuspended( sal_False )
- ,m_pSelectionNotifier( new SelectionNotifier( getMutex(), *this ) )
-{
- DBG_CTOR(OApplicationController,NULL);
-}
-//------------------------------------------------------------------------------
-OApplicationController::~OApplicationController()
-{
- if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
- {
- OSL_FAIL("Please check who doesn't dispose this component!");
- // increment ref count to prevent double call of Dtor
- osl_incrementInterlockedCount( &m_refCount );
- dispose();
- }
- ::std::auto_ptr< Window> aTemp( getView() );
- clearView();
-
- DBG_DTOR(OApplicationController,NULL);
-}
-//--------------------------------------------------------------------
-IMPLEMENT_FORWARD_XTYPEPROVIDER2(OApplicationController,OApplicationController_CBASE,OApplicationController_Base)
-IMPLEMENT_FORWARD_XINTERFACE2(OApplicationController,OApplicationController_CBASE,OApplicationController_Base)
-// -----------------------------------------------------------------------------
-void OApplicationController::disconnect()
-{
- if ( m_xDataSourceConnection.is() )
- stopConnectionListening( m_xDataSourceConnection );
-
- try
- {
- // temporary (hopefully!) hack for #i55274#
- Reference< XFlushable > xFlush( m_xDataSourceConnection, UNO_QUERY );
- if ( xFlush.is() && m_xMetaData.is() && !m_xMetaData->isReadOnly() )
- xFlush->flush();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- m_xDataSourceConnection.clear();
- m_xMetaData.clear();
-
- InvalidateAll();
-}
-
-//--------------------------------------------------------------------
-void SAL_CALL OApplicationController::disposing()
-{
- m_aControllerConnectedEvent.CancelCall();
-
- ::std::for_each(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),XContainerFunctor(this));
- m_aCurrentContainers.clear();
- m_pSubComponentManager->disposing();
- m_pSelectionNotifier->disposing();
-
- if ( getView() )
- {
- getContainer()->showPreview(NULL);
- m_pClipbordNotifier->ClearCallbackLink();
- m_pClipbordNotifier->AddRemoveListener( getView(), sal_False );
- m_pClipbordNotifier->release();
- m_pClipbordNotifier = NULL;
- }
-
- disconnect();
- try
- {
- Reference < XFrame > xFrame;
- attachFrame( xFrame );
-
- if ( m_xDataSource.is() )
- {
- m_xDataSource->removePropertyChangeListener(::rtl::OUString(), this);
- 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);
- // otherwise we may delete our datasource twice
- Reference<XPropertySet> xProp = m_xDataSource;
- m_xDataSource = NULL;
- }
-
- Reference< XModifyBroadcaster > xBroadcaster( m_xModel, UNO_QUERY );
- if ( xBroadcaster.is() )
- xBroadcaster->removeModifyListener(static_cast<XModifyListener*>(this));
-
- if ( m_xModel.is() )
- {
- ::rtl::OUString sUrl = m_xModel->getURL();
- if ( sUrl.getLength() )
- {
- ::comphelper::NamedValueCollection aArgs( m_xModel->getArgs() );
- if ( true == aArgs.getOrDefault( "PickListEntry", true ) )
- {
- ::rtl::OUString aFilter;
- 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(),
- ::rtl::OUString() );
- }
- }
-
- m_xModel->disconnectController( this );
-
- m_xModel.clear();
- }
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- clearView();
- OApplicationController_CBASE::disposing(); // here the m_refCount must be equal 5
-}
-
-//--------------------------------------------------------------------
-sal_Bool OApplicationController::Construct(Window* _pParent)
-{
- setView( * new OApplicationView( _pParent, getORB(), *this, m_ePreviewMode ) );
- getView()->SetUniqueId(UID_APP_VIEW);
-
- // late construction
- sal_Bool bSuccess = sal_False;
- try
- {
- getContainer()->Construct();
- bSuccess = sal_True;
- }
- catch(const SQLException&)
- {
- }
- catch(const Exception&)
- {
- OSL_FAIL("OApplicationController::Construct : the construction of UnoDataBrowserView failed !");
- }
-
- if ( !bSuccess )
- {
- ::std::auto_ptr< Window> aTemp( getView() );
- clearView();
- return sal_False;
- }
-
- // 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();
- m_pClipbordNotifier->AddRemoveListener( getView(), sal_True );
-
- OApplicationController_CBASE::Construct( _pParent );
- getView()->Show();
-
- return sal_True;
-}
-
-//--------------------------------------------------------------------
-void SAL_CALL OApplicationController::disposing(const EventObject& _rSource) throw( RuntimeException )
-{
- ::osl::MutexGuard aGuard( getMutex() );
- Reference<XConnection> xCon(_rSource.Source, UNO_QUERY);
- if ( xCon.is() )
- {
- OSL_ENSURE( m_xDataSourceConnection == xCon,
- "OApplicationController::disposing: which connection does this come from?" );
-
- if ( getContainer() && getContainer()->getElementType() == E_TABLE )
- getContainer()->clearPages();
- if ( m_xDataSourceConnection == xCon )
- {
- m_xMetaData.clear();
- m_xDataSourceConnection.clear();
- }
- }
- else if ( _rSource.Source == m_xModel )
- {
- m_xModel.clear();
- }
- else if ( _rSource.Source == m_xDataSource )
- {
- m_xDataSource = NULL;
- }
- else
- {
- Reference<XContainer> xContainer( _rSource.Source, UNO_QUERY );
- if ( xContainer.is() )
- {
- TContainerVector::iterator aFind = ::std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer);
- if ( aFind != m_aCurrentContainers.end() )
- m_aCurrentContainers.erase(aFind);
- }
- OApplicationController_CBASE::disposing( _rSource );
- }
-}
-//--------------------------------------------------------------------
-sal_Bool SAL_CALL OApplicationController::suspend(sal_Bool bSuspend) throw( RuntimeException )
-{
- // notify the OnPrepareViewClosing event (before locking any mutex)
- Reference< XDocumentEventBroadcaster > xBroadcaster( m_xModel, UNO_QUERY );
- if ( xBroadcaster.is() )
- {
- xBroadcaster->notifyDocumentEvent(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnPrepareViewClosing" ) ),
- this,
- Any()
- );
- }
-
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
-
- if ( getView() && getView()->IsInModalMode() )
- return sal_False;
-
- sal_Bool bCanSuspend = sal_True;
-
- if ( m_bSuspended != bSuspend )
- {
- if ( bSuspend && !closeSubComponents() )
- return sal_False;
-
- Reference<XModifiable> xModi(m_xModel,UNO_QUERY);
- Reference<XStorable> xStor(getModel(),UNO_QUERY);
-
- if ( bSuspend
- && xStor.is()
- && !xStor->isReadonly()
- && ( xModi.is()
- && xModi->isModified()
- )
- )
- {
- switch (ExecuteQuerySaveDocument(getView(),getStrippedDatabaseName()))
- {
- case RET_YES:
- Execute(ID_BROWSER_SAVEDOC,Sequence<PropertyValue>());
- bCanSuspend = !xModi->isModified();
- // when we save the document this must be false else some press cancel
- break;
- case RET_CANCEL:
- bCanSuspend = sal_False;
- default:
- break;
- }
- }
- }
-
- if ( bCanSuspend )
- m_bSuspended = bSuspend;
-
- return bCanSuspend;
-}
-// -----------------------------------------------------------------------------
-FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
-{
- FeatureState aReturn;
- aReturn.bEnabled = sal_False;
- // check this first
- if ( !getContainer() || m_bReadOnly )
- return aReturn;
-
- try
- {
- switch (_nId)
- {
- case SID_OPENURL:
- aReturn.bEnabled = sal_True;
- if ( m_xModel.is() )
- aReturn.sTitle = m_xModel->getURL();
- break;
- 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;
- aReturn.bEnabled = aReturn.bEnabled && ( (ID_BROWSER_CUT == _nId && getContainer()->getElementType() == E_TABLE) ? getContainer()->isCutAllowed() : sal_True);
- break;
- case ID_BROWSER_PASTE:
- switch( getContainer()->getElementType() )
- {
- case E_TABLE:
- aReturn.bEnabled = !isDataSourceReadOnly() && !isConnectionReadOnly() && isTableFormat();
- break;
- case E_QUERY:
- aReturn.bEnabled = !isDataSourceReadOnly() && getViewClipboard().HasFormat(SOT_FORMATSTR_ID_DBACCESS_QUERY);
- break;
- default:
- aReturn.bEnabled = !isDataSourceReadOnly() && OComponentTransferable::canExtractComponentDescriptor(getViewClipboard().GetDataFlavorExVector(),getContainer()->getElementType() == E_FORM);
- }
- break;
- case SID_DB_APP_PASTE_SPECIAL:
- aReturn.bEnabled = getContainer()->getElementType() == E_TABLE && !isDataSourceReadOnly() && !isConnectionReadOnly() && isTableFormat();
- break;
- case SID_OPENDOC:
- case SID_HELP_INDEX:
- aReturn.bEnabled = sal_True;
- break;
- case ID_BROWSER_SAVEDOC:
- aReturn.bEnabled = !isDataSourceReadOnly() && m_xDocumentModify.is() && m_xDocumentModify->isModified();
- break;
- case ID_BROWSER_SAVEASDOC:
- aReturn.bEnabled = sal_True;
- break;
- case ID_BROWSER_SORTUP:
- aReturn.bEnabled = getContainer()->isFilled() && getContainer()->getElementCount();
- aReturn.bChecked = aReturn.bEnabled && getContainer()->isSortUp();
- break;
- case ID_BROWSER_SORTDOWN:
- aReturn.bEnabled = getContainer()->isFilled() && getContainer()->getElementCount();
- aReturn.bChecked = aReturn.bEnabled && !getContainer()->isSortUp();
- break;
-
- case SID_NEWDOC:
- case SID_APP_NEW_FORM:
- case ID_DOCUMENT_CREATE_REPWIZ:
- aReturn.bEnabled = !isDataSourceReadOnly() && SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SWRITER);
- break;
- case SID_APP_NEW_REPORT:
- aReturn.bEnabled = !isDataSourceReadOnly()
- && SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SWRITER);
- if ( aReturn.bEnabled )
- {
- Reference< XContentEnumerationAccess > xEnumAccess(m_xServiceFactory, UNO_QUERY);
- aReturn.bEnabled = xEnumAccess.is();
- if ( aReturn.bEnabled )
- {
- const ::rtl::OUString sReportEngineServiceName = ::dbtools::getDefaultReportEngineServiceName(m_xServiceFactory);
- aReturn.bEnabled = sReportEngineServiceName.getLength() != 0;
- if ( aReturn.bEnabled )
- {
- const Reference< XEnumeration > xEnumDrivers = xEnumAccess->createContentEnumeration(sReportEngineServiceName);
- aReturn.bEnabled = xEnumDrivers.is() && xEnumDrivers->hasMoreElements();
- }
- }
- }
- break;
- case SID_DB_APP_VIEW_TABLES:
- aReturn.bEnabled = sal_True;
- aReturn.bChecked = getContainer()->getElementType() == E_TABLE;
- break;
- case SID_DB_APP_VIEW_QUERIES:
- aReturn.bEnabled = sal_True;
- aReturn.bChecked = getContainer()->getElementType() == E_QUERY;
- break;
- case SID_DB_APP_VIEW_FORMS:
- aReturn.bEnabled = sal_True;
- aReturn.bChecked = getContainer()->getElementType() == E_FORM;
- break;
- case SID_DB_APP_VIEW_REPORTS:
- aReturn.bEnabled = sal_True;
- aReturn.bChecked = getContainer()->getElementType() == E_REPORT;
- break;
- case ID_NEW_QUERY_DESIGN:
- case ID_NEW_QUERY_SQL:
- case ID_APP_NEW_QUERY_AUTO_PILOT:
- case SID_DB_FORM_NEW_PILOT:
- aReturn.bEnabled = !isDataSourceReadOnly();
- break;
- case ID_NEW_VIEW_DESIGN:
- case SID_DB_NEW_VIEW_SQL:
- case ID_NEW_VIEW_DESIGN_AUTO_PILOT:
- aReturn.bEnabled = !isDataSourceReadOnly() && !isConnectionReadOnly();
- if ( aReturn.bEnabled )
- {
- Reference<XViewsSupplier> xViewsSup( getConnection(), UNO_QUERY );
- aReturn.bEnabled = xViewsSup.is();
- }
- break;
- case ID_NEW_TABLE_DESIGN:
- case ID_NEW_TABLE_DESIGN_AUTO_PILOT:
- aReturn.bEnabled = !isDataSourceReadOnly() && !isConnectionReadOnly();
- break;
- case ID_DIRECT_SQL:
- aReturn.bEnabled = sal_True;
- break;
- 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.
- bool bAvailable =
- !Reference< XEmbeddedScripts >( m_xModel, UNO_QUERY ).is()
- && !Reference< XStorable >( m_xModel, UNO_QUERY_THROW )->isReadonly();
- aReturn.bEnabled = bAvailable;
- if ( !bAvailable )
- aReturn.bInvisible = true;
- }
- break;
- case SID_APP_NEW_FOLDER:
- aReturn.bEnabled = !isDataSourceReadOnly() && getContainer()->getSelectionCount() <= 1;
- if ( aReturn.bEnabled )
- {
- const ElementType eType = getContainer()->getElementType();
- aReturn.bEnabled = eType == E_REPORT || eType == E_FORM;
- }
- break;
- case SID_FORM_CREATE_REPWIZ_PRE_SEL:
- case SID_REPORT_CREATE_REPWIZ_PRE_SEL:
- case SID_APP_NEW_REPORT_PRE_SEL:
- aReturn.bEnabled = !isDataSourceReadOnly()
- && SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SWRITER)
- && getContainer()->isALeafSelected();
- if ( aReturn.bEnabled )
- {
- ElementType eType = getContainer()->getElementType();
- aReturn.bEnabled = eType == E_QUERY || eType == E_TABLE;
- if ( aReturn.bEnabled && SID_APP_NEW_REPORT_PRE_SEL == _nId )
- {
- Reference< XContentEnumerationAccess > xEnumAccess(m_xServiceFactory, UNO_QUERY);
- aReturn.bEnabled = xEnumAccess.is();
- if ( aReturn.bEnabled )
- {
- static ::rtl::OUString s_sReportDesign(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.pentaho.SOReportJobFactory"));
- Reference< XEnumeration > xEnumDrivers = xEnumAccess->createContentEnumeration(s_sReportDesign);
- aReturn.bEnabled = xEnumDrivers.is() && xEnumDrivers->hasMoreElements();
- }
- }
- }
- break;
- case SID_DB_APP_DELETE:
- case SID_DB_APP_RENAME:
- 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);
- break;
- 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:
- aReturn.bEnabled = getContainer()->getElementCount() > 0 && getContainer()->getSelectionCount() != getContainer()->getElementCount();
- break;
- case SID_DB_APP_EDIT:
- case SID_DB_APP_TABLE_EDIT:
- case SID_DB_APP_QUERY_EDIT:
- case SID_DB_APP_FORM_EDIT:
- case SID_DB_APP_REPORT_EDIT:
- aReturn.bEnabled = !isDataSourceReadOnly() && getContainer()->getSelectionCount() > 0
- && getContainer()->isALeafSelected();
- break;
- case SID_DB_APP_EDIT_SQL_VIEW:
- if ( isDataSourceReadOnly() )
- aReturn.bEnabled = sal_False;
- else
- {
- switch ( getContainer()->getElementType() )
- {
- case E_QUERY:
- aReturn.bEnabled = ( getContainer()->getSelectionCount() > 0 )
- && ( getContainer()->isALeafSelected() );
- break;
- case E_TABLE:
- aReturn.bEnabled = sal_False;
- // there's one exception: views which support altering their underlying
- // command can be edited in SQL view, too
- if ( ( getContainer()->getSelectionCount() > 0 )
- && ( getContainer()->isALeafSelected() )
- )
- {
- ::std::vector< ::rtl::OUString > aSelected;
- getSelectionElementNames( aSelected );
- bool bAlterableViews = true;
- for ( ::std::vector< ::rtl::OUString >::const_iterator selectedName = aSelected.begin();
- bAlterableViews && ( selectedName != aSelected.end() ) ;
- ++selectedName
- )
- {
- bAlterableViews &= impl_isAlterableView_nothrow( *selectedName );
- }
- aReturn.bEnabled = bAlterableViews;
- }
- break;
- default:
- break;
- }
- }
- break;
- case SID_DB_APP_OPEN:
- case SID_DB_APP_TABLE_OPEN:
- case SID_DB_APP_QUERY_OPEN:
- case SID_DB_APP_FORM_OPEN:
- case SID_DB_APP_REPORT_OPEN:
- aReturn.bEnabled = getContainer()->getSelectionCount() > 0 && getContainer()->isALeafSelected();
- break;
- case SID_DB_APP_DSUSERADMIN:
- aReturn.bEnabled = !m_aTypeCollection.isEmbeddedDatabase(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
- break;
- case SID_DB_APP_DSRELDESIGN:
- aReturn.bEnabled = sal_True;
- break;
- case SID_DB_APP_TABLEFILTER:
- aReturn.bEnabled = !isDataSourceReadOnly();
- break;
- case SID_DB_APP_REFRESH_TABLES:
- aReturn.bEnabled = getContainer()->getElementType() == E_TABLE && isConnected();
- break;
- case SID_DB_APP_DSPROPS:
- aReturn.bEnabled = m_xDataSource.is() && m_aTypeCollection.isShowPropertiesEnabled(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
- break;
- case SID_DB_APP_DSCONNECTION_TYPE:
- aReturn.bEnabled = !isDataSourceReadOnly() && m_xDataSource.is() && !m_aTypeCollection.isEmbeddedDatabase(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
- break;
- case SID_DB_APP_DSADVANCED_SETTINGS:
- aReturn.bEnabled = m_xDataSource.is() && AdvancedSettingsDialog::doesHaveAnyAdvancedSettings( m_aTypeCollection.getType(::comphelper::getString( m_xDataSource->getPropertyValue( PROPERTY_URL ) )) );
- 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 )
- {
- Reference<XViewsSupplier> xViewSup( getConnection(), UNO_QUERY );
- aReturn.bEnabled = xViewSup.is() && Reference<XAppend>(xViewSup->getViews(),UNO_QUERY).is();
- }
- }
- break;
- case SID_DB_APP_DISABLE_PREVIEW:
- aReturn.bEnabled = sal_True;
- aReturn.bChecked = getContainer()->getPreviewMode() == E_PREVIEWNONE;
- break;
- case SID_DB_APP_VIEW_DOCINFO_PREVIEW:
- {
- ElementType eType = getContainer()->getElementType();
- aReturn.bEnabled = (E_REPORT == eType || E_FORM == eType);
- aReturn.bChecked = getContainer()->getPreviewMode() == E_DOCUMENTINFO;
- }
- break;
- case SID_DB_APP_VIEW_DOC_PREVIEW:
- aReturn.bEnabled = sal_True;
- aReturn.bChecked = getContainer()->getPreviewMode() == E_DOCUMENT;
- break;
- case ID_BROWSER_UNDO:
- aReturn.bEnabled = sal_False;
- break;
- case SID_MAIL_SENDDOC:
- aReturn.bEnabled = sal_True;
- break;
- case SID_DB_APP_SENDREPORTASMAIL:
- {
- ElementType eType = getContainer()->getElementType();
- aReturn.bEnabled = E_REPORT == eType && getContainer()->getSelectionCount() > 0 && getContainer()->isALeafSelected();
- }
- break;
- case SID_DB_APP_SENDREPORTTOWRITER:
- case SID_DB_APP_DBADMIN:
- aReturn.bEnabled = sal_False;
- break;
- case SID_DB_APP_STATUS_TYPE:
- aReturn.bEnabled = m_xDataSource.is();
- if ( aReturn.bEnabled )
- {
- ::rtl::OUString sURL;
- m_xDataSource->getPropertyValue(PROPERTY_URL) >>= sURL;
- ::rtl::OUString sDSTypeName;
- if ( m_aTypeCollection.isEmbeddedDatabase( sURL ) )
- {
- sDSTypeName = String( ModuleRes( RID_STR_EMBEDDED_DATABASE ) );
- }
- else
- {
- sDSTypeName = m_aTypeCollection.getTypeDisplayName(sURL);
- }
- aReturn.sTitle = sDSTypeName;
- }
- break;
- case SID_DB_APP_STATUS_DBNAME:
- aReturn.bEnabled = m_xDataSource.is();
- if ( aReturn.bEnabled )
- {
- ::rtl::OUString sURL;
- m_xDataSource->getPropertyValue(PROPERTY_URL) >>= sURL;
- String sDatabaseName;
- String sHostName;
- sal_Int32 nPortNumber( -1 );
-
- m_aTypeCollection.extractHostNamePort( sURL, sDatabaseName, sHostName, nPortNumber );
-
- if ( !sDatabaseName.Len() )
- sDatabaseName = m_aTypeCollection.cutPrefix( sURL );
- if ( m_aTypeCollection.isFileSystemBased(sURL) )
- {
- sDatabaseName = SvtPathOptions().SubstituteVariable( sDatabaseName );
- if ( sDatabaseName.Len() )
- {
- ::svt::OFileNotation aFileNotation(sDatabaseName);
- // set this decoded URL as text
- sDatabaseName = aFileNotation.get(::svt::OFileNotation::N_SYSTEM);
- }
- }
-
- if ( sDatabaseName.Len() == 0 )
- sDatabaseName = m_aTypeCollection.getTypeDisplayName( sURL );
-
- aReturn.sTitle = sDatabaseName;
- }
- break;
- case SID_DB_APP_STATUS_USERNAME:
- aReturn.bEnabled = m_xDataSource.is();
- if ( aReturn.bEnabled )
- m_xDataSource->getPropertyValue( PROPERTY_USER ) >>= aReturn.sTitle;
- break;
- case SID_DB_APP_STATUS_HOSTNAME:
- aReturn.bEnabled = m_xDataSource.is();
- if ( aReturn.bEnabled )
- {
- ::rtl::OUString sURL;
- m_xDataSource->getPropertyValue( PROPERTY_URL ) >>= sURL;
-
- String sHostName, sDatabaseName;
- sal_Int32 nPortNumber = -1;
- m_aTypeCollection.extractHostNamePort( sURL, sDatabaseName, sHostName, nPortNumber );
- aReturn.sTitle = sHostName;
- }
- break;
- default:
- aReturn = OApplicationController_CBASE::GetState(_nId);
- }
- }
- catch(const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return aReturn;
-}
-
-// -----------------------------------------------------------------------------
-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() )
- {
- ::rtl::Reference< ::comphelper::OInteractionRequest > pRequest( new ::comphelper::OInteractionRequest( _rException ) );
- ::rtl::Reference< ::comphelper::OInteractionApprove > pApprove( new ::comphelper::OInteractionApprove );
- pRequest->addContinuation( pApprove.get() );
-
- try
- {
- xHandler->handle( pRequest.get() );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- bHandled = pApprove->wasSelected();
- }
- return bHandled;
- }
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& aArgs)
-{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
-
- if ( isUserDefinedFeature( _nId ) )
- {
- OApplicationController_CBASE::Execute( _nId, aArgs );
- return;
- }
-
- if ( !getContainer() || m_bReadOnly )
- 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:
- {
- const TransferableDataHelper& rTransferData( getViewClipboard() );
- ElementType eType = getContainer()->getElementType();
-
- switch( eType )
- {
- case E_TABLE:
- {
- // get the selected tablename
- ::std::vector< ::rtl::OUString > aList;
- getSelectionElementNames( aList );
- if ( !aList.empty() )
- m_aTableCopyHelper.SetTableNameForAppend( *aList.begin() );
- else
- m_aTableCopyHelper.ResetTableNameForAppend();
-
- m_aTableCopyHelper.pasteTable( rTransferData , getDatabaseName(), ensureConnection() );
- }
- break;
-
- case E_QUERY:
- if ( rTransferData.HasFormat(SOT_FORMATSTR_ID_DBACCESS_QUERY) )
- paste( E_QUERY, ODataAccessObjectTransferable::extractObjectDescriptor( rTransferData ) );
- break;
- default:
- {
- ::std::vector< ::rtl::OUString> aList;
- getSelectionElementNames(aList);
- ::rtl::OUString sFolderNameToInsertInto;
- 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();
- }
- paste( eType, OComponentTransferable::extractComponentDescriptor( rTransferData ),
- sFolderNameToInsertInto );
- }
- break;
- }
- }
- break;
- case SID_DB_APP_PASTE_SPECIAL:
- {
- if ( !aArgs.getLength() )
- {
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- ::std::auto_ptr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog( getView() ));
- ::std::vector<SotFormatStringId> aFormatIds;
- getSupportedFormats(getContainer()->getElementType(),aFormatIds);
- const ::std::vector<SotFormatStringId>::iterator aEnd = aFormatIds.end();
- ::rtl::OUString sEmpty;
- for (::std::vector<SotFormatStringId>::iterator aIter = aFormatIds.begin();aIter != aEnd; ++aIter)
- pDlg->Insert(*aIter,sEmpty);
-
- const TransferableDataHelper& rClipboard = getViewClipboard();
- pasteFormat(pDlg->GetFormat(rClipboard.GetTransferable()));
- }
- else
- {
- const PropertyValue* pIter = aArgs.getConstArray();
- const PropertyValue* pEnd = pIter + aArgs.getLength();
- for( ; pIter != pEnd ; ++pIter)
- {
- if ( pIter->Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("FormatStringId")) )
- {
- SotFormatStringId nFormatId = 0;
- if ( pIter->Value >>= nFormatId )
- pasteFormat(nFormatId);
- break;
- }
- }
- }
- }
- break;
- case SID_OPENDOC:
- case SID_HELP_INDEX:
- {
- Reference < XDispatchProvider > xProv( getFrame(), UNO_QUERY );
- if ( xProv.is() )
- {
- URL aURL;
- switch(_nId)
- {
- case SID_HELP_INDEX:
- aURL.Complete = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:HelpIndex"));
- break;
- case SID_OPENDOC:
- aURL.Complete = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Open"));
- break;
- }
-
- if ( m_xUrlTransformer.is() )
- m_xUrlTransformer->parseStrict( aURL );
- Reference < XDispatch > xDisp = xProv->queryDispatch( aURL, String(), 0 );
- if ( xDisp.is() )
- xDisp->dispatch( aURL, Sequence < PropertyValue >() );
- }
- }
- break;
- case ID_BROWSER_SAVEDOC:
- {
- Reference< XStorable > xStore( m_xModel, UNO_QUERY_THROW );
- try
- {
- xStore->store();
- }
- catch( const Exception& )
- {
- lcl_handleException_nothrow( m_xModel, ::cppu::getCaughtException() );
- }
- }
- break;
-
- case ID_BROWSER_SAVEASDOC:
- {
- WinBits nBits(WB_STDMODAL|WB_SAVEAS);
- ::rtl::OUString sUrl;
- if ( m_xModel.is() )
- sUrl = m_xModel->getURL();
- if ( !sUrl.getLength() )
- sUrl = SvtPathOptions().GetWorkPath();
-
- ::sfx2::FileDialogHelper aFileDlg( com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION,static_cast<sal_uInt32>(nBits) ,getView());
- aFileDlg.SetDisplayDirectory( sUrl );
-
- const SfxFilter* pFilter = getStandardDatabaseFilter();
- if ( pFilter )
- {
- aFileDlg.AddFilter(pFilter->GetUIName(),pFilter->GetDefaultExtension());
- aFileDlg.SetCurrentFilter(pFilter->GetUIName());
- }
-
- if ( aFileDlg.Execute() != ERRCODE_NONE )
- break;
-
- Reference<XStorable> xStore( m_xModel, UNO_QUERY_THROW );
- INetURLObject aURL( aFileDlg.GetPath() );
- try
- {
- xStore->storeAsURL( aURL.GetMainURL( INetURLObject::NO_DECODE ), Sequence< PropertyValue >() );
- }
- catch( const Exception& )
- {
- lcl_handleException_nothrow( m_xModel, ::cppu::getCaughtException() );
- }
-
- /*updateTitle();*/
- m_bCurrentlyModified = sal_False;
- InvalidateFeature(ID_BROWSER_SAVEDOC);
- if ( getContainer()->getElementType() == E_NONE )
- {
- getContainer()->selectContainer(E_NONE);
- getContainer()->selectContainer(E_TABLE);
- // #i95524#
- getContainer()->Invalidate();
- refreshTables();
- }
-
- }
- 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:
- case SID_DB_FORM_NEW_PILOT:
- case SID_REPORT_CREATE_REPWIZ_PRE_SEL:
- case SID_APP_NEW_REPORT_PRE_SEL:
- case SID_FORM_CREATE_REPWIZ_PRE_SEL:
- case ID_DOCUMENT_CREATE_REPWIZ:
- case SID_APP_NEW_FORM:
- case SID_APP_NEW_REPORT:
- case ID_NEW_QUERY_SQL:
- case ID_NEW_QUERY_DESIGN:
- case ID_NEW_TABLE_DESIGN:
- {
- ElementType eType = E_TABLE;
- sal_Bool bAutoPilot = sal_False;
- ::comphelper::NamedValueCollection aCreationArgs;
-
- switch( _nId )
- {
- case SID_DB_FORM_NEW_PILOT:
- case SID_FORM_CREATE_REPWIZ_PRE_SEL:
- bAutoPilot = sal_True;
- // run through
- case SID_APP_NEW_FORM:
- eType = E_FORM;
- break;
- case ID_DOCUMENT_CREATE_REPWIZ:
- case SID_REPORT_CREATE_REPWIZ_PRE_SEL:
- bAutoPilot = sal_True;
- // run through
- case SID_APP_NEW_REPORT:
- case SID_APP_NEW_REPORT_PRE_SEL:
- eType = E_REPORT;
- break;
- case ID_APP_NEW_QUERY_AUTO_PILOT:
- bAutoPilot = sal_True;
- eType = E_QUERY;
- break;
- case ID_NEW_QUERY_DESIGN:
- aCreationArgs.put( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, sal_True );
- // run through
- case ID_NEW_QUERY_SQL:
- eType = E_QUERY;
- break;
- case ID_NEW_TABLE_DESIGN_AUTO_PILOT:
- bAutoPilot = sal_True;
- // run through
- case ID_NEW_TABLE_DESIGN:
- break;
- default:
- OSL_FAIL("illegal switch call!");
- }
- if ( bAutoPilot )
- getContainer()->PostUserEvent( LINK( this, OApplicationController, OnCreateWithPilot ), reinterpret_cast< void* >( eType ) );
- else
- {
- Reference< XComponent > xDocDefinition;
- newElement( eType, aCreationArgs, xDocDefinition );
- }
- }
- break;
- case SID_APP_NEW_FOLDER:
- {
- ElementType eType = getContainer()->getElementType();
- ::rtl::OUString sName = getContainer()->getQualifiedName( NULL );
- insertHierachyElement(eType,sName);
- }
- break;
- case ID_NEW_VIEW_DESIGN:
- case SID_DB_NEW_VIEW_SQL:
- {
- SharedConnection xConnection( ensureConnection() );
- if ( xConnection.is() )
- {
- QueryDesigner aDesigner( getORB(), this, getFrame(), true );
-
- ::comphelper::NamedValueCollection aCreationArgs;
- aCreationArgs.put( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, ID_NEW_VIEW_DESIGN == _nId );
-
- const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
- const Reference< XComponent > xComponent( aDesigner.createNew( xDataSource, aCreationArgs ), UNO_QUERY );
- onDocumentOpened( ::rtl::OUString(), E_QUERY, E_OPEN_DESIGN, xComponent, NULL );
- }
- }
- break;
- case SID_DB_APP_DELETE:
- case SID_DB_APP_TABLE_DELETE:
- case SID_DB_APP_QUERY_DELETE:
- case SID_DB_APP_FORM_DELETE:
- case SID_DB_APP_REPORT_DELETE:
- deleteEntries();
- break;
- case SID_DB_APP_RENAME:
- case SID_DB_APP_TABLE_RENAME:
- case SID_DB_APP_QUERY_RENAME:
- case SID_DB_APP_FORM_RENAME:
- case SID_DB_APP_REPORT_RENAME:
- renameEntry();
- break;
- case SID_DB_APP_EDIT:
- case SID_DB_APP_EDIT_SQL_VIEW:
- case SID_DB_APP_TABLE_EDIT:
- case SID_DB_APP_QUERY_EDIT:
- case SID_DB_APP_FORM_EDIT:
- case SID_DB_APP_REPORT_EDIT:
- doAction( _nId, E_OPEN_DESIGN );
- break;
- case SID_DB_APP_OPEN:
- case SID_DB_APP_TABLE_OPEN:
- case SID_DB_APP_QUERY_OPEN:
- case SID_DB_APP_FORM_OPEN:
- case SID_DB_APP_REPORT_OPEN:
- doAction( _nId, E_OPEN_NORMAL );
- break;
- case SID_DB_APP_CONVERTTOVIEW:
- doAction( _nId, E_OPEN_NORMAL );
- break;
- case SID_SELECTALL:
- getContainer()->selectAll();
- InvalidateAll();
- break;
- case SID_DB_APP_DSRELDESIGN:
- {
- Reference< XComponent > xRelationDesigner;
- if ( !m_pSubComponentManager->activateSubFrame( ::rtl::OUString(), SID_DB_APP_DSRELDESIGN, E_OPEN_DESIGN, xRelationDesigner ) )
- {
- SharedConnection xConnection( ensureConnection() );
- if ( xConnection.is() )
- {
- RelationDesigner aDesigner( getORB(), this, m_aCurrentFrame.getFrame() );
-
- const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
- const Reference< XComponent > xComponent( aDesigner.createNew( xDataSource ), UNO_QUERY );
- onDocumentOpened( ::rtl::OUString(), SID_DB_APP_DSRELDESIGN, E_OPEN_DESIGN, xComponent, NULL );
- }
- }
- }
- break;
- case SID_DB_APP_DSUSERADMIN:
- {
- SharedConnection xConnection( ensureConnection() );
- if ( xConnection.is() )
- openDialog(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.UserAdministrationDialog")));
- }
- 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:
- openDialog(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.AdvancedDatabaseSettingsDialog")));
- askToReconnect();
- break;
- case SID_DB_APP_DSCONNECTION_TYPE:
- openDialog(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DataSourceTypeChangeDialog")));
- askToReconnect();
- break;
- case ID_DIRECT_SQL:
- {
- SharedConnection xConnection( ensureConnection() );
- if ( xConnection.is() )
- openDirectSQLDialog();
- }
- break;
- case ID_MIGRATE_SCRIPTS:
- impl_migrateScripts_nothrow();
- break;
- case SID_DB_APP_VIEW_TABLES:
- m_aSelectContainerEvent.Call( reinterpret_cast< void* >( E_TABLE ) );
- break;
- case SID_DB_APP_VIEW_QUERIES:
- m_aSelectContainerEvent.Call( reinterpret_cast< void* >( E_QUERY ) );
- break;
- case SID_DB_APP_VIEW_FORMS:
- m_aSelectContainerEvent.Call( reinterpret_cast< void* >( E_FORM ) );
- break;
- case SID_DB_APP_VIEW_REPORTS:
- m_aSelectContainerEvent.Call( reinterpret_cast< void* >( E_REPORT ) );
- 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;
- case SID_MAIL_SENDDOC:
- {
- SfxMailModel aSendMail;
- if ( aSendMail.AttachDocument(rtl::OUString(),getModel(), rtl::OUString()) == SfxMailModel::SEND_MAIL_OK )
- aSendMail.Send( getFrame() );
- }
- break;
- case SID_DB_APP_SENDREPORTASMAIL:
- doAction( _nId, E_OPEN_FOR_MAIL );
- break;
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- InvalidateFeature(_nId);
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::describeSupportedFeatures()
-{
- OApplicationController_CBASE::describeSupportedFeatures();
-
- implDescribeSupportedFeature( ".uno:Save", ID_BROWSER_SAVEDOC, CommandGroup::DOCUMENT );
- implDescribeSupportedFeature( ".uno:SaveAs", ID_BROWSER_SAVEASDOC, CommandGroup::DOCUMENT );
- implDescribeSupportedFeature( ".uno:SendMail", SID_MAIL_SENDDOC, CommandGroup::DOCUMENT );
- implDescribeSupportedFeature( ".uno:DBSendReportAsMail",SID_DB_APP_SENDREPORTASMAIL,
- CommandGroup::DOCUMENT );
- implDescribeSupportedFeature( ".uno:DBSendReportToWriter",SID_DB_APP_SENDREPORTTOWRITER,
- CommandGroup::DOCUMENT );
- implDescribeSupportedFeature( ".uno:DBNewForm", SID_APP_NEW_FORM, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:DBNewFolder", SID_APP_NEW_FOLDER, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:DBNewFormAutoPilot", SID_DB_FORM_NEW_PILOT, CommandGroup::INSERT );
- implDescribeSupportedFeature( ".uno:DBNewFormAutoPilotWithPreSelection",
- SID_FORM_CREATE_REPWIZ_PRE_SEL,
- CommandGroup::APPLICATION );
-
- implDescribeSupportedFeature( ".uno:DBNewReport", SID_APP_NEW_REPORT, CommandGroup::INSERT );
- 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 );
- implDescribeSupportedFeature( ".uno:DBNewViewSQL", SID_DB_NEW_VIEW_SQL, CommandGroup::INSERT );
-
- implDescribeSupportedFeature( ".uno:DBDelete", SID_DB_APP_DELETE, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:Delete", SID_DB_APP_DELETE, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBRename", SID_DB_APP_RENAME, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBEdit", SID_DB_APP_EDIT, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBEditSqlView", SID_DB_APP_EDIT_SQL_VIEW, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:DBOpen", SID_DB_APP_OPEN, CommandGroup::EDIT );
-
- 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 );
-
- 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 );
-
- 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 );
-
- 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 );
-
- implDescribeSupportedFeature( ".uno:SelectAll", SID_SELECTALL, CommandGroup::EDIT );
- implDescribeSupportedFeature( ".uno:Undo", ID_BROWSER_UNDO, CommandGroup::EDIT );
-
- 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 );
- implDescribeSupportedFeature( ".uno:DBMigrateScripts", ID_MIGRATE_SCRIPTS, CommandGroup::APPLICATION );
- 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 );
-
- implDescribeSupportedFeature( ".uno:OpenUrl", SID_OPENURL, CommandGroup::APPLICATION );
-
- // this one should not appear under Tools->Customize->Keyboard
- implDescribeSupportedFeature( ".uno:DBNewReportWithPreSelection",
- SID_APP_NEW_REPORT_PRE_SEL,CommandGroup::INTERNAL );
- implDescribeSupportedFeature( ".uno:DBDSImport", SID_DB_APP_DSIMPORT, CommandGroup::INTERNAL);
- implDescribeSupportedFeature( ".uno:DBDSExport", SID_DB_APP_DSEXPORT, CommandGroup::INTERNAL);
- implDescribeSupportedFeature( ".uno:DBDBAdmin", SID_DB_APP_DBADMIN, CommandGroup::INTERNAL);
-
- // status info
- implDescribeSupportedFeature( ".uno:DBStatusType", SID_DB_APP_STATUS_TYPE, CommandGroup::INTERNAL);
- implDescribeSupportedFeature( ".uno:DBStatusDBName", SID_DB_APP_STATUS_DBNAME, CommandGroup::INTERNAL);
- implDescribeSupportedFeature( ".uno:DBStatusUserName", SID_DB_APP_STATUS_USERNAME, CommandGroup::INTERNAL);
- implDescribeSupportedFeature( ".uno:DBStatusHostName", SID_DB_APP_STATUS_HOSTNAME, CommandGroup::INTERNAL);
-}
-// -----------------------------------------------------------------------------
-OApplicationView* OApplicationController::getContainer() const
-{
- return static_cast< OApplicationView* >( getView() );
-}
-
-// -----------------------------------------------------------------------------
-// ::com::sun::star::container::XContainerListener
-void SAL_CALL OApplicationController::elementInserted( const ContainerEvent& _rEvent ) throw(RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
-
- Reference< XContainer > xContainer(_rEvent.Source, UNO_QUERY);
- if ( ::std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer) != m_aCurrentContainers.end() )
- {
- OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
- if ( getContainer() )
- {
- ::rtl::OUString sName;
- _rEvent.Accessor >>= sName;
- ElementType eType = getElementType(xContainer);
-
- switch( eType )
- {
- case E_TABLE:
- ensureConnection();
- break;
- case E_FORM:
- case E_REPORT:
- {
- Reference< XContainer > xSubContainer(_rEvent.Element,UNO_QUERY);
- if ( xSubContainer.is() )
- containerFound(xSubContainer);
- }
- break;
- default:
- break;
- }
- getContainer()->elementAdded(eType,sName,_rEvent.Element);
- }
- }
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OApplicationController::elementRemoved( const ContainerEvent& _rEvent ) throw(RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
-
- Reference< XContainer > xContainer(_rEvent.Source, UNO_QUERY);
- if ( ::std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer) != m_aCurrentContainers.end() )
- {
- OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
- ::rtl::OUString sName;
- _rEvent.Accessor >>= sName;
- ElementType eType = getElementType(xContainer);
- switch( eType )
- {
- case E_TABLE:
- ensureConnection();
- break;
- case E_FORM:
- case E_REPORT:
- {
- Reference<XContent> xContent(xContainer,UNO_QUERY);
- if ( xContent.is() )
- {
- sName = xContent->getIdentifier()->getContentIdentifier() + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + sName;
- }
- }
- break;
- default:
- break;
- }
- getContainer()->elementRemoved(eType,sName);
- }
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OApplicationController::elementReplaced( const ContainerEvent& _rEvent ) throw(RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
-
- Reference< XContainer > xContainer(_rEvent.Source, UNO_QUERY);
- if ( ::std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer) != m_aCurrentContainers.end() )
- {
- OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
- ::rtl::OUString sName;
- try
- {
- _rEvent.Accessor >>= sName;
- Reference<XConnection> xConnection;
- Reference<XPropertySet> xProp(_rEvent.Element,UNO_QUERY);
- ::rtl::OUString sNewName;
-
- ElementType eType = getElementType(xContainer);
- switch( eType )
- {
- case E_TABLE:
- {
- ensureConnection();
- if ( xProp.is() && m_xMetaData.is() )
- sNewName = ::dbaui::composeTableName( m_xMetaData, xProp, ::dbtools::eInDataManipulation, false, false, false );
- }
- break;
- case E_FORM:
- case E_REPORT:
- {
- Reference<XContent> xContent(xContainer,UNO_QUERY);
- if ( xContent.is() )
- {
- sName = xContent->getIdentifier()->getContentIdentifier() + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + sName;
- }
- }
- break;
- default:
- break;
- }
- // getContainer()->elementReplaced(getContainer()->getElementType(),sName,sNewName);
- }
- catch( Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-}
-namespace
-{
- ::rtl::OUString lcl_getToolBarResource(ElementType _eType)
- {
- ::rtl::OUString sToolbar;
- switch(_eType)
- {
- case E_TABLE:
- sToolbar = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/tableobjectbar" ));
- break;
- case E_QUERY:
- sToolbar = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/queryobjectbar" ));
- break;
- case E_FORM:
- sToolbar = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/formobjectbar" ));
- break;
- case E_REPORT:
- sToolbar = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/reportobjectbar" ));
- break;
- case E_NONE:
- break;
- default:
- OSL_FAIL("Invalid ElementType!");
- break;
- }
- return sToolbar;
- }
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationController::onContainerSelect(ElementType _eType)
-{
- OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
-
- if ( m_eCurrentType != _eType && _eType != E_NONE )
- {
- SelectionGuard aSelGuard( *m_pSelectionNotifier );
-
- if ( _eType == E_TABLE )
- {
- try
- {
- SharedConnection xConnection( ensureConnection() );
- if ( xConnection.is() && getContainer()->getDetailView() )
- {
- getContainer()->getDetailView()->createTablesPage(xConnection);
- Reference<XTablesSupplier> xTabSup(xConnection,UNO_QUERY);
- if ( xTabSup.is() )
- addContainerListener(xTabSup->getTables());
- }
- else
- {
- return sal_False;
- }
- }
- catch( const Exception& )
- {
- return sal_False;
- }
- }
- Reference< XLayoutManager > xLayoutManager = getLayoutManager( getFrame() );
- if ( xLayoutManager.is() )
- {
- ::rtl::OUString sToolbar = lcl_getToolBarResource(_eType);
- ::rtl::OUString sDestroyToolbar = lcl_getToolBarResource(m_eCurrentType);
-
- xLayoutManager->lock();
- xLayoutManager->destroyElement( sDestroyToolbar );
- if ( sToolbar.getLength() )
- {
- xLayoutManager->createElement( sToolbar );
- xLayoutManager->requestElement( sToolbar );
- }
- xLayoutManager->unlock();
- xLayoutManager->doLayout();
- }
-
- if ( _eType != E_TABLE && getContainer()->getDetailView() )
- {
- Reference< XNameAccess > xContainer = getElements(_eType);
- addContainerListener(xContainer);
- getContainer()->getDetailView()->createPage(_eType,xContainer);
- }
-
- SelectionByElementType::iterator pendingSelection = m_aPendingSelection.find( _eType );
- if ( pendingSelection != m_aPendingSelection.end() )
- {
- Sequence< ::rtl::OUString > aSelected( pendingSelection->second.size() );
- ::std::copy( pendingSelection->second.begin(), pendingSelection->second.end(), aSelected.getArray() );
- getContainer()->selectElements( aSelected );
-
- m_aPendingSelection.erase( pendingSelection );
- }
-
- InvalidateAll();
- }
- m_eCurrentType = _eType;
-
- return sal_True;
-}
-// -----------------------------------------------------------------------------
-bool OApplicationController::onEntryDoubleClick( SvTreeListBox& _rTree )
-{
- if ( getContainer() && getContainer()->isLeaf( _rTree.GetHdlEntry() ) )
- {
- try
- {
- openElement(
- getContainer()->getQualifiedName( _rTree.GetHdlEntry() ),
- getContainer()->getElementType(),
- E_OPEN_NORMAL
- );
- return true; // handled
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- return false; // not handled
-}
-// -----------------------------------------------------------------------------
-bool OApplicationController::impl_isAlterableView_nothrow( const ::rtl::OUString& _rTableOrViewName ) const
-{
- 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;
-}
-
-// -----------------------------------------------------------------------------
-Reference< XComponent > OApplicationController::openElement(const ::rtl::OUString& _sName, ElementType _eType,
- ElementOpenMode _eOpenMode, sal_uInt16 _nInstigatorCommand )
-{
- return openElementWithArguments( _sName, _eType, _eOpenMode, _nInstigatorCommand, ::comphelper::NamedValueCollection() );
-}
-
-// -----------------------------------------------------------------------------
-Reference< XComponent > OApplicationController::openElementWithArguments( const ::rtl::OUString& _sName, ElementType _eType,
- ElementOpenMode _eOpenMode, sal_uInt16 _nInstigatorCommand, const ::comphelper::NamedValueCollection& _rAdditionalArguments )
-{
- OSL_PRECOND( getContainer(), "OApplicationController::openElementWithArguments: no view!" );
- if ( !getContainer() )
- return NULL;
-
- Reference< XComponent > xRet;
- if ( _eOpenMode == E_OPEN_DESIGN )
- {
- // OJ: http://www.openoffice.org/issues/show_bug.cgi?id=30382
- getContainer()->showPreview(NULL);
- }
-
- bool isStandaloneDocument = false;
- switch ( _eType )
- {
- case E_REPORT:
- 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!
- case E_FORM:
- {
- if ( isStandaloneDocument || !m_pSubComponentManager->activateSubFrame( _sName, _eType, _eOpenMode, xRet ) )
- {
- ::std::auto_ptr< OLinkedDocumentsAccess > aHelper = getDocumentsAccess( _eType );
- if ( !aHelper->isConnected() )
- break;
-
- Reference< XComponent > xDefinition;
- xRet = aHelper->open( _sName, xDefinition, _eOpenMode, _rAdditionalArguments );
-
- if ( !isStandaloneDocument )
- onDocumentOpened( _sName, _eType, _eOpenMode, xRet, xDefinition );
- }
- }
- break;
-
- case E_QUERY:
- case E_TABLE:
- {
- if ( !m_pSubComponentManager->activateSubFrame( _sName, _eType, _eOpenMode, xRet ) )
- {
- SharedConnection xConnection( ensureConnection() );
- if ( !xConnection.is() )
- break;
-
- ::std::auto_ptr< DatabaseObjectView > pDesigner;
- ::comphelper::NamedValueCollection aArguments( _rAdditionalArguments );
-
- Any aDataSource;
- if ( _eOpenMode == E_OPEN_DESIGN )
- {
- bool bAddViewTypeArg = false;
-
- if ( _eType == E_TABLE )
- {
- if ( impl_isAlterableView_nothrow( _sName ) )
- {
- pDesigner.reset( new QueryDesigner( getORB(), this, m_aCurrentFrame.getFrame(), true ) );
- bAddViewTypeArg = true;
- }
- else
- {
- pDesigner.reset( new TableDesigner( getORB(), this, m_aCurrentFrame.getFrame() ) );
- }
- }
- else if ( _eType == E_QUERY )
- {
- pDesigner.reset( new QueryDesigner( getORB(), this, m_aCurrentFrame.getFrame(), false ) );
- bAddViewTypeArg = true;
- }
- aDataSource <<= m_xDataSource;
-
- if ( bAddViewTypeArg )
- {
- const bool bQueryGraphicalMode =( _nInstigatorCommand != SID_DB_APP_EDIT_SQL_VIEW );
- aArguments.put( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, bQueryGraphicalMode );
- }
-
- }
- else
- {
- pDesigner.reset( new ResultSetBrowser( getORB(), this, m_aCurrentFrame.getFrame(), _eType == E_TABLE ) );
-
- if ( !aArguments.has( (::rtl::OUString)PROPERTY_SHOWMENU ) )
- aArguments.put( (::rtl::OUString)PROPERTY_SHOWMENU, makeAny( (sal_Bool)sal_True ) );
-
- aDataSource <<= getDatabaseName();
- }
-
- xRet.set( pDesigner->openExisting( aDataSource, _sName, aArguments ) );
- onDocumentOpened( _sName, _eType, _eOpenMode, xRet, NULL );
- }
- }
- break;
-
- default:
- OSL_FAIL( "OApplicationController::openElement: illegal object type!" );
- break;
- }
- return xRet;
-}
-// -----------------------------------------------------------------------------
-IMPL_LINK( OApplicationController, OnSelectContainer, void*, _pType )
-{
- ElementType eType = (ElementType)reinterpret_cast< sal_IntPtr >( _pType );
- if (getContainer())
- getContainer()->selectContainer(eType);
- return 0L;
-}
-// -----------------------------------------------------------------------------
-IMPL_LINK( OApplicationController, OnCreateWithPilot, void*, _pType )
-{
- ElementType eType = (ElementType)reinterpret_cast< sal_IntPtr >( _pType );
- newElementWithPilot( eType );
- return 0L;
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationController::newElementWithPilot( ElementType _eType )
-{
- CloseVeto aKeepDoc( getFrame() );
- // prevent the document being closed while the wizard is open
-
- OSL_ENSURE( getContainer(), "OApplicationController::newElementWithPilot: without a view?" );
-
- switch ( _eType )
- {
- case E_REPORT:
- case E_FORM:
- {
- ::std::auto_ptr<OLinkedDocumentsAccess> aHelper = getDocumentsAccess(_eType);
- if ( aHelper->isConnected() )
- {
- sal_Int32 nCommandType = -1;
- const ::rtl::OUString sCurrentSelected( getCurrentlySelectedName( nCommandType ) );
- if ( E_REPORT == _eType )
- aHelper->newReportWithPilot( nCommandType, sCurrentSelected );
- else
- aHelper->newFormWithPilot( nCommandType, sCurrentSelected );
- }
- }
- break;
- case E_QUERY:
- case E_TABLE:
- {
- ::std::auto_ptr<OLinkedDocumentsAccess> aHelper = getDocumentsAccess(_eType);
- if ( aHelper->isConnected() )
- {
- if ( E_QUERY == _eType )
- aHelper->newQueryWithPilot();
- else
- aHelper->newTableWithPilot();
- }
- }
- break;
- case E_NONE:
- break;
- }
-
- // no need for onDocumentOpened, the table wizard opens the created table by using
- // XDatabaseDocumentUI::loadComponent method.
-}
-
-// -----------------------------------------------------------------------------
-Reference< XComponent > OApplicationController::newElement( ElementType _eType, const ::comphelper::NamedValueCollection& i_rAdditionalArguments,
- Reference< XComponent >& o_rDocumentDefinition )
-{
- OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
-
- Reference< XComponent > xComponent;
- o_rDocumentDefinition.clear();
-
- switch ( _eType )
- {
- case E_FORM:
- case E_REPORT:
- {
- ::std::auto_ptr<OLinkedDocumentsAccess> aHelper = getDocumentsAccess( _eType );
- if ( !aHelper->isConnected() )
- break;
-
- xComponent = aHelper->newDocument( _eType == E_FORM ? ID_FORM_NEW_TEXT : ID_REPORT_NEW_TEXT, i_rAdditionalArguments, o_rDocumentDefinition );
- }
- break;
-
- case E_QUERY:
- case E_TABLE:
- {
- ::std::auto_ptr< DatabaseObjectView > pDesigner;
- SharedConnection xConnection( ensureConnection() );
- if ( !xConnection.is() )
- break;
-
- if ( _eType == E_TABLE )
- {
- pDesigner.reset( new TableDesigner( getORB(), this, getFrame() ) );
- }
- else if ( _eType == E_QUERY )
- {
- pDesigner.reset( new QueryDesigner( getORB(), this, getFrame(), false ) );
- }
-
- Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
- xComponent.set( pDesigner->createNew( xDataSource, i_rAdditionalArguments ), UNO_QUERY );
- }
- break;
-
- default:
- OSL_FAIL( "OApplicationController::newElement: illegal type!" );
- break;
- }
-
- if ( xComponent.is() )
- onDocumentOpened( ::rtl::OUString(), _eType, E_OPEN_DESIGN, xComponent, o_rDocumentDefinition );
-
- return xComponent;
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationController::addContainerListener(const Reference<XNameAccess>& _xCollection)
-{
- try
- {
- Reference< XContainer > xCont(_xCollection, UNO_QUERY);
- if ( xCont.is() )
- {
- // add as listener to get notified if elements are inserted or removed
- 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);
- }
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::renameEntry()
-{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
-
- OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
- ::std::vector< ::rtl::OUString> aList;
- getSelectionElementNames(aList);
-
- Reference< XNameAccess > xContainer = getElements(getContainer()->getElementType());
- OSL_ENSURE(aList.size() == 1,"Invalid rename call here. More than one element!");
- if ( aList.empty() )
- return;
-
- try
- {
- if ( xContainer.is() )
- {
- ::std::auto_ptr< IObjectNameCheck > pNameChecker;
- ::std::auto_ptr< OSaveAsDlg > aDialog;
-
- Reference<XRename> xRename;
- const ElementType eType = getContainer()->getElementType();
- switch( eType )
- {
- case E_FORM:
- case E_REPORT:
- {
- Reference<XHierarchicalNameContainer> xHNames(xContainer, UNO_QUERY);
- if ( xHNames.is() )
- {
- String sLabel;
- if ( eType == E_FORM )
- sLabel = String(ModuleRes( STR_FRM_LABEL ));
- else
- sLabel = String(ModuleRes( STR_RPT_LABEL ));
-
- ::rtl::OUString sName = *aList.begin();
- 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;
- }
- }
- pNameChecker.reset( new HierarchicalNameCheck( xHNames.get(), String() ) );
- aDialog.reset( new OSaveAsDlg(
- getView(), getORB(), sName, sLabel, *pNameChecker, SAD_TITLE_RENAME ) );
- }
- }
- }
- break;
- case E_TABLE:
- ensureConnection();
- if ( !getConnection().is() )
- break;
- // NO break
- case E_QUERY:
- if ( xContainer->hasByName(*aList.begin()) )
- {
- xRename.set(xContainer->getByName(*aList.begin()),UNO_QUERY);
- sal_Int32 nCommandType = eType == E_QUERY ? CommandType::QUERY : CommandType::TABLE;
-
- ensureConnection();
- pNameChecker.reset( new DynamicTableOrQueryNameCheck( getConnection(), nCommandType ) );
- aDialog.reset( new OSaveAsDlg(
- getView(), nCommandType, getORB(), getConnection(),
- *aList.begin(), *pNameChecker, SAD_TITLE_RENAME ) );
- }
- break;
- default:
- break;
- }
-
- if ( xRename.is() && aDialog.get() )
- {
-
- sal_Bool bTryAgain = sal_True;
- while( bTryAgain )
- {
- if ( aDialog->Execute() == RET_OK )
- {
- try
- {
- ::rtl::OUString sNewName;
- if ( eType == E_TABLE )
- {
- ::rtl::OUString sName = aDialog->getName();
- ::rtl::OUString sCatalog = aDialog->getCatalog();
- ::rtl::OUString sSchema = aDialog->getSchema();
-
- sNewName = ::dbtools::composeTableName( m_xMetaData, sCatalog, sSchema, sName, sal_False, ::dbtools::eInDataManipulation );
- }
- else
- sNewName = aDialog->getName();
-
- ::rtl::OUString sOldName = *aList.begin();
- if ( eType == E_FORM || eType == E_REPORT )
- {
- Reference<XContent> xContent(xRename,UNO_QUERY);
- if ( xContent.is() )
- {
- sOldName = xContent->getIdentifier()->getContentIdentifier();
- }
- }
-
- xRename->rename(sNewName);
-
- if ( eType == E_TABLE )
- {
- Reference<XPropertySet> xProp(xRename,UNO_QUERY);
- sNewName = ::dbaui::composeTableName( m_xMetaData, xProp, ::dbtools::eInDataManipulation, false, false, false );
- }
- getContainer()->elementReplaced( eType , sOldName, sNewName );
-
- bTryAgain = sal_False;
- }
- catch(const SQLException& )
- {
- showError( SQLExceptionInfo( ::cppu::getCaughtException() ) );
-
- }
- catch(const ElementExistException& e)
- {
- static ::rtl::OUString sStatus = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000"));
- String sMsg = String( ModuleRes( STR_NAME_ALREADY_EXISTS ) );
- sMsg.SearchAndReplace('#',e.Message);
- showError(SQLExceptionInfo(SQLException(sMsg, e.Context, sStatus, 0, Any())));
- }
- catch(const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- else
- bTryAgain = sal_False;
- }
- }
- }
- }
- catch(const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationController::onSelectionChanged()
-{
- InvalidateAll();
-
- SelectionGuard aSelGuard( *m_pSelectionNotifier );
-
- OApplicationView* pView = getContainer();
- if ( !pView )
- return;
-
- if ( pView->getSelectionCount() == 1 )
- {
- const ElementType eType = pView->getElementType();
- if ( pView->isALeafSelected() )
- {
- const ::rtl::OUString sName = pView->getQualifiedName( NULL /* means 'first selected' */ );
- showPreviewFor( eType, sName );
- }
- }
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::showPreviewFor(const ElementType _eType,const ::rtl::OUString& _sName)
-{
- if ( m_ePreviewMode == E_PREVIEWNONE )
- return;
-
- OApplicationView* pView = getContainer();
- if ( !pView )
- return;
-
- try
- {
- switch( _eType )
- {
- case E_FORM:
- case E_REPORT:
- {
- Reference< XHierarchicalNameAccess > xContainer( getElements( _eType ), UNO_QUERY_THROW );
- Reference< XContent> xContent( xContainer->getByHierarchicalName( _sName ), UNO_QUERY_THROW );
- pView->showPreview( xContent );
- }
- break;
-
- case E_TABLE:
- case E_QUERY:
- {
- SharedConnection xConnection( ensureConnection() );
- if ( xConnection.is() )
- pView->showPreview( getDatabaseName(), xConnection, _sName, _eType == E_TABLE );
- }
- return;
-
- default:
- OSL_FAIL( "OApplicationController::showPreviewFor: unexpected element type!" );
- break;
- }
- }
- catch( const SQLException& )
- {
- showError( SQLExceptionInfo( ::cppu::getCaughtException() ) );
- }
- catch(const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-}
-
-//------------------------------------------------------------------------------
-IMPL_LINK( OApplicationController, OnClipboardChanged, void*, EMPTYARG )
-{
- return OnInvalidateClipboard( NULL );
-}
-//------------------------------------------------------------------------------
-IMPL_LINK(OApplicationController, OnInvalidateClipboard, void*, EMPTYARG)
-{
- InvalidateFeature(ID_BROWSER_CUT);
- InvalidateFeature(ID_BROWSER_COPY);
- InvalidateFeature(ID_BROWSER_PASTE);
- InvalidateFeature(SID_DB_APP_PASTE_SPECIAL);
- return 0L;
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::onCutEntry()
-{
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::onCopyEntry()
-{
- Execute(ID_BROWSER_COPY,Sequence<PropertyValue>());
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::onPasteEntry()
-{
- Execute(ID_BROWSER_PASTE,Sequence<PropertyValue>());
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::onDeleteEntry()
-{
- 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:
- OSL_FAIL("Invalid ElementType!");
- break;
- }
- executeChecked(nId,Sequence<PropertyValue>());
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationController::executeUnChecked(const URL& _rCommand, const Sequence< PropertyValue>& aArgs)
-{
- OApplicationController_CBASE::executeUnChecked( _rCommand, aArgs );
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationController::executeChecked(const URL& _rCommand, const Sequence< PropertyValue>& aArgs)
-{
- OApplicationController_CBASE::executeChecked( _rCommand, aArgs );
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationController::executeUnChecked(sal_uInt16 _nCommandId, const Sequence< PropertyValue>& aArgs)
-{
- OApplicationController_CBASE::executeUnChecked( _nCommandId, aArgs );
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationController::executeChecked(sal_uInt16 _nCommandId, const Sequence< PropertyValue>& aArgs)
-{
- OApplicationController_CBASE::executeChecked( _nCommandId, aArgs );
-}
-
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationController::isCommandEnabled(sal_uInt16 _nCommandId) const
-{
- return OApplicationController_CBASE::isCommandEnabled( _nCommandId );
-}
-
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationController::isCommandEnabled( const ::rtl::OUString& _rCompleteCommandURL ) const
-{
- return OApplicationController_CBASE::isCommandEnabled( _rCompleteCommandURL );
-}
-
-// -----------------------------------------------------------------------------
-sal_uInt16 OApplicationController::registerCommandURL( const ::rtl::OUString& _rCompleteCommandURL )
-{
- return OApplicationController_CBASE::registerCommandURL( _rCompleteCommandURL );
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationController::notifyHiContrastChanged()
-{
- OApplicationController_CBASE::notifyHiContrastChanged();
-}
-
-// -----------------------------------------------------------------------------
-Reference< XController > OApplicationController::getXController() throw( RuntimeException )
-{
- return OApplicationController_CBASE::getXController();
-}
-
-// -----------------------------------------------------------------------------
-bool OApplicationController::interceptUserInput( const NotifyEvent& _rEvent )
-{
- return OApplicationController_CBASE::interceptUserInput( _rEvent );
-}
-
-// -----------------------------------------------------------------------------
-PopupMenu* OApplicationController::getContextMenu( Control& /*_rControl*/ ) const
-{
- return new PopupMenu( ModuleRes( RID_MENU_APP_EDIT ) );
-}
-
-// -----------------------------------------------------------------------------
-IController& OApplicationController::getCommandController()
-{
- return *static_cast< IApplicationController* >( this );
-}
-
-// -----------------------------------------------------------------------------
-::cppu::OInterfaceContainerHelper* OApplicationController::getContextMenuInterceptors()
-{
- return &m_aContextMenuInterceptors;
-}
-
-// -----------------------------------------------------------------------------
-Any OApplicationController::getCurrentSelection( Control& _rControl ) const
-{
- Sequence< NamedDatabaseObject > aSelection;
- getContainer()->describeCurrentSelectionForControl( _rControl, aSelection );
- return makeAny( aSelection );
-}
-
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationController::requestQuickHelp( const SvLBoxEntry* /*_pEntry*/, String& /*_rText*/ ) const
-{
- return sal_False;
-}
-
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationController::requestDrag( sal_Int8 /*_nAction*/, const Point& /*_rPosPixel*/ )
-{
- TransferableHelper* pTransfer = NULL;
- if ( getContainer() && getContainer()->getSelectionCount() )
- {
- try
- {
- pTransfer = copyObject( );
- Reference< XTransferable> xEnsureDelete = pTransfer;
-
- if ( pTransfer && getContainer()->getDetailView() )
- {
- ElementType eType = getContainer()->getElementType();
- pTransfer->StartDrag( getContainer()->getDetailView()->getTreeWindow(), ((eType == E_FORM || eType == E_REPORT) ? DND_ACTION_COPYMOVE : DND_ACTION_COPY) );
- }
- }
- catch(const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- return NULL != pTransfer;
-}
-// -----------------------------------------------------------------------------
-sal_Int8 OApplicationController::queryDrop( const AcceptDropEvent& _rEvt, const DataFlavorExVector& _rFlavors )
-{
- sal_Int8 nActionAskedFor = _rEvt.mnAction;
- // 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
- if(::std::find_if(_rFlavors.begin(),_rFlavors.end(),TAppSupportedSotFunctor(eType,sal_True)) != _rFlavors.end())
- return DND_ACTION_COPY;
- if ( eType == E_FORM || eType == E_REPORT )
- {
- sal_Int8 nAction = OComponentTransferable::canExtractComponentDescriptor(_rFlavors,eType == E_FORM) ? DND_ACTION_COPY : DND_ACTION_NONE;
- if ( nAction != DND_ACTION_NONE )
- {
- SvLBoxEntry* pHitEntry = pView->getEntry(_rEvt.maPosPixel);
- ::rtl::OUString sName;
- if ( pHitEntry )
- {
- sName = pView->getQualifiedName( pHitEntry );
- if ( sName.getLength() )
- {
- 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() )
- nAction = nActionAskedFor & DND_ACTION_COPYMOVE;
- }
- else
- nAction = DND_ACTION_NONE;
- }
- }
- }
- return nAction;
- }
- }
- }
-
- return DND_ACTION_NONE;
-}
-// -----------------------------------------------------------------------------
-sal_Int8 OApplicationController::executeDrop( const ExecuteDropEvent& _rEvt )
-{
- OApplicationView* pView = getContainer();
- if ( !pView || pView->getElementType() == E_NONE )
- {
- OSL_FAIL("OApplicationController::executeDrop: what the hell did queryDrop do?");
- // queryDrop shoud not have allowed us to reach this situation ....
- 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);
-
-
- m_nAsyncDrop = 0;
- m_aAsyncDrop.aDroppedData.clear();
- m_aAsyncDrop.nType = pView->getElementType();
- m_aAsyncDrop.nAction = _rEvt.mnAction;
- m_aAsyncDrop.bError = sal_False;
- m_aAsyncDrop.bHtml = sal_False;
- m_aAsyncDrop.aUrl = ::rtl::OUString();
-
-
- // 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);
-
- // asyncron because we some dialogs and we aren't allowed to show them while in D&D
- m_nAsyncDrop = Application::PostUserEvent(LINK(this, OApplicationController, OnAsyncDrop));
- return DND_ACTION_COPY;
- }
- else if ( OComponentTransferable::canExtractComponentDescriptor(aDroppedData.GetDataFlavorExVector(),m_aAsyncDrop.nType == E_FORM) )
- {
- m_aAsyncDrop.aDroppedData = OComponentTransferable::extractComponentDescriptor(aDroppedData);
- SvLBoxEntry* pHitEntry = pView->getEntry(_rEvt.maPosPixel);
- if ( pHitEntry )
- m_aAsyncDrop.aUrl = pView->getQualifiedName( pHitEntry );
-
- sal_Int8 nAction = _rEvt.mnAction;
- Reference<XContent> xContent;
- m_aAsyncDrop.aDroppedData[daComponent] >>= xContent;
- if ( xContent.is() )
- {
- ::rtl::OUString sName = xContent->getIdentifier()->getContentIdentifier();
- sal_Int32 nIndex = 0;
- sName = sName.copy(sName.getToken(0,'/',nIndex).getLength() + 1);
- if ( m_aAsyncDrop.aUrl.Len() >= sName.getLength() && 0 == sName.compareTo(m_aAsyncDrop.aUrl,sName.getLength()) )
- {
- 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);
-
- if ( m_aAsyncDrop.aUrl.Len() && xContainer.is() && xContainer->hasByHierarchicalName(m_aAsyncDrop.aUrl) )
- 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;
- // asyncron because we some dialogs and we aren't allowed to show them while in D&D
- m_nAsyncDrop = Application::PostUserEvent(LINK(this, OApplicationController, OnAsyncDrop));
- }
- else
- m_aAsyncDrop.aDroppedData.clear();
- return nAction;
- }
- else
- {
- SharedConnection xConnection( ensureConnection() );
- if ( xConnection.is() && m_aTableCopyHelper.copyTagTable( aDroppedData, m_aAsyncDrop, xConnection ) )
- {
- // asyncron because we some dialogs and we aren't allowed to show them while in D&D
- m_nAsyncDrop = Application::PostUserEvent(LINK(this, OApplicationController, OnAsyncDrop));
- return DND_ACTION_COPY;
- }
- }
-
- return DND_ACTION_NONE;
-}
-// -----------------------------------------------------------------------------
-Reference< XModel > SAL_CALL OApplicationController::getModel(void) throw( RuntimeException )
-{
- return m_xModel;
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationController::onAttachedFrame()
-{
- 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;
- }
-
- m_aControllerConnectedEvent.Call();
-}
-
-// -----------------------------------------------------------------------------
-IMPL_LINK( OApplicationController, OnFirstControllerConnected, void*, /**/ )
-{
- ::osl::MutexGuard aGuard( getMutex() );
-
- if ( !m_xModel.is() )
- {
- OSL_FAIL( "OApplicationController::OnFirstControllerConnected: too late!" );
- }
-
- // 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
- return 0L;
- }
-
- try
- {
- // 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 ) )
- return 0L;
-
- // 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() )
- return 0L;
-
- SQLWarning aWarning;
- aWarning.Message = String( ModuleRes( STR_SUB_DOCS_WITH_SCRIPTS ) );
- SQLException aDetail;
- aDetail.Message = String( ModuleRes( STR_SUB_DOCS_WITH_SCRIPTS_DETAIL ) );
- aWarning.NextException <<= aDetail;
-
- ::comphelper::ComponentContext aContext( getORB() );
- Sequence< Any > aArgs(1);
- aArgs[0] <<= NamedValue( PROPERTY_SQLEXCEPTION, makeAny( aWarning ) );
- Reference< XExecutableDialog > xDialog(
- aContext.createComponentWithArguments( "com.sun.star.sdb.ErrorMessageDialog", aArgs ),
- UNO_QUERY_THROW );
- xDialog->execute();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- return 1L;
-}
-
-// -----------------------------------------------------------------------------
-void SAL_CALL OApplicationController::attachFrame( const Reference< XFrame > & i_rxFrame ) throw( RuntimeException )
-{
- OApplicationController_CBASE::attachFrame( i_rxFrame );
- if ( getFrame().is() )
- onAttachedFrame();
-}
-
-// -----------------------------------------------------------------------------
-sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > & _rxModel) throw( RuntimeException )
-{
- ::osl::MutexGuard aGuard( getMutex() );
- const Reference< XOfficeDatabaseDocument > xOfficeDoc( _rxModel, UNO_QUERY );
- const Reference< XModifiable > xDocModify( _rxModel, UNO_QUERY );
- if ( ( !xOfficeDoc.is() || !xDocModify.is() ) && _rxModel.is() )
- {
- OSL_FAIL( "OApplicationController::attachModel: invalid model!" );
- return sal_False;
- }
-
- 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;
- }
-
- const ::rtl::OUString aPropertyNames[] =
- {
- PROPERTY_URL, PROPERTY_USER
- };
-
- // 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();
- }
-
- m_xModel = _rxModel;
- m_xDocumentModify = xDocModify;
- m_xDataSource.set( xOfficeDoc.is() ? xOfficeDoc->getDataSource() : Reference< XDataSource >(), UNO_QUERY );
-
- // connect to new model
- try
- {
- 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 );
-
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- // initial preview mode
- if ( m_xDataSource.is() )
- {
- try
- {
- // to get the 'modified' for the data source
- ::comphelper::NamedValueCollection aLayoutInfo( m_xDataSource->getPropertyValue( PROPERTY_LAYOUTINFORMATION ) );
- if ( aLayoutInfo.has( (rtl::OUString)INFO_PREVIEW ) )
- {
- const sal_Int32 nPreviewMode( aLayoutInfo.getOrDefault( (rtl::OUString)INFO_PREVIEW, (sal_Int32)0 ) );
- m_ePreviewMode = static_cast< PreviewMode >( nPreviewMode );
- if ( getView() )
- getContainer()->switchPreview( m_ePreviewMode );
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- return sal_True;
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::containerFound( const Reference< XContainer >& _xContainer)
-{
- try
- {
- if ( _xContainer.is() )
- {
- m_aCurrentContainers.push_back(_xContainer);
- _xContainer->addContainerListener(this);
- }
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OApplicationController::getCurrentlySelectedName(sal_Int32& _rnCommandType) const
-{
- _rnCommandType = ( (getContainer()->getElementType() == E_QUERY)
- ? CommandType::QUERY : ( (getContainer()->getElementType() == E_TABLE) ? CommandType::TABLE : -1 ));
-
-
- ::rtl::OUString sName;
- if ( _rnCommandType != -1 )
- {
- try
- {
- sName = getContainer()->getQualifiedName( NULL );
- OSL_ENSURE( sName.getLength(), "OApplicationController::getCurrentlySelectedName: no name given!" );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- return sName;
-}
-
-// -----------------------------------------------------------------------------
-void SAL_CALL OApplicationController::addSelectionChangeListener( const Reference< view::XSelectionChangeListener >& _Listener ) throw (RuntimeException)
-{
- m_pSelectionNotifier->addListener( _Listener );
-}
-
-// -----------------------------------------------------------------------------
-void SAL_CALL OApplicationController::removeSelectionChangeListener( const Reference< view::XSelectionChangeListener >& _Listener ) throw (RuntimeException)
-{
- m_pSelectionNotifier->removeListener( _Listener );
-}
-
-// -----------------------------------------------------------------------------
-::sal_Bool SAL_CALL OApplicationController::select( const Any& _aSelection ) throw (IllegalArgumentException, RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
- Sequence< ::rtl::OUString> aSelection;
- if ( !_aSelection.hasValue() || !getView() )
- {
- getContainer()->selectElements(aSelection);
- return sal_True;
- }
-
- // --------------------------------------------------------------
- // BEGIN compatibility
- 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)
- {
- if ( pIter->Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Type")) )
- {
- sal_Int32 nType = 0;
- pIter->Value >>= nType;
- if ( nType < DatabaseObject::TABLE || nType > DatabaseObject::REPORT )
- throw IllegalArgumentException();
- eType = static_cast< ElementType >( nType );
- }
- else if ( pIter->Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Selection")) )
- pIter->Value >>= aSelection;
- }
-
- m_aSelectContainerEvent.CancelCall(); // just in case the async select request was running
- getContainer()->selectContainer(eType);
- getContainer()->selectElements(aSelection);
- return sal_True;
- }
- // 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(
- String(ModuleRes(RID_STR_NO_DIFF_CAT)),
- *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:
- {
- ::rtl::OUString sMessage = String(ModuleRes( RID_STR_UNSUPPORTED_OBJECT_TYPE ));
- ::comphelper::string::searchAndReplaceAsciiI( sMessage, "$type$", ::rtl::OUString::valueOf(sal_Int32( pObject->Type )) );
- throw IllegalArgumentException(sMessage, *this, sal_Int16( pObject - aSelectedObjects.getConstArray() ));
- }
- }
- }
-
- for ( SelectionByElementType::const_iterator sel = aSelectedElements.begin();
- sel != aSelectedElements.end();
- ++sel
- )
- {
- if ( sel->first == m_eCurrentType )
- {
- Sequence< ::rtl::OUString > aSelected( sel->second.size() );
- ::std::copy( sel->second.begin(), sel->second.end(), aSelected.getArray() );
- getContainer()->selectElements( aSelected );
- }
- 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;
-}
-// -----------------------------------------------------------------------------
-Any SAL_CALL OApplicationController::getSelection( ) throw (RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
-
- Sequence< NamedDatabaseObject > aCurrentSelection;
- const ElementType eType( getContainer()->getElementType() );
- if ( eType != E_NONE )
- {
- getContainer()->describeCurrentSelectionForType( eType, aCurrentSelection );
- 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:
- OSL_FAIL( "OApplicationController::getSelection: unexpected current element type!" );
- break;
- }
- }
- }
- return makeAny( aCurrentSelection );
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::impl_migrateScripts_nothrow()
-{
- try
- {
- ::rtl::OUString sDialogService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.application.MacroMigrationWizard" ) );
- ::comphelper::ComponentContext aContext( getORB() );
- Sequence< Any > aDialogArgs(1);
- aDialogArgs[0] <<= Reference< XOfficeDatabaseDocument >( m_xModel, UNO_QUERY_THROW );
- Reference< XExecutableDialog > xDialog(
- aContext.createComponentWithArguments( sDialogService, aDialogArgs ),
- UNO_QUERY );
-
- if ( !xDialog.is() )
- {
- ShowServiceNotAvailableError( getView(), sDialogService, true );
- return;
- }
-
- xDialog->execute();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-}
-
-//........................................................................
-} // namespace dbaui
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx
deleted file mode 100644
index a29213f6a..000000000
--- a/dbaccess/source/ui/app/AppController.hxx
+++ /dev/null
@@ -1,578 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef DBAUI_APPCONTROLLER_HXX
-#define DBAUI_APPCONTROLLER_HXX
-
-#include "IApplicationController.hxx"
-#include "AppElementType.hxx"
-#include "callbacks.hxx"
-#include "commontypes.hxx"
-#include "dsntypes.hxx"
-#include "genericcontroller.hxx"
-#include "linkeddocuments.hxx"
-#include "moduledbu.hxx"
-#include "TableCopyHelper.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/beans/XPropertyChangeListener.hpp>
-#include <com/sun/star/container/XContainerListener.hpp>
-#include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
-#include <com/sun/star/util/XModifiable.hpp>
-#include <com/sun/star/ui/XContextMenuInterception.hpp>
-/** === end UNO includes === **/
-
-#include <comphelper/stl_types.hxx>
-#include <comphelper/namedvaluecollection.hxx>
-#include <comphelper/uno3.hxx>
-#include <cppuhelper/implbase5.hxx>
-#include <sot/storage.hxx>
-#include <svtools/transfer.hxx>
-#include <svx/dataaccessdescriptor.hxx>
-#include <vcl/timer.hxx>
-
-#include <memory>
-
-class ListBox;
-class SvLBoxEntry;
-class SvTreeListBox;
-class TransferableHelper;
-class TransferableClipboardListener;
-class SfxFilter;
-
-FORWARD_DECLARE_INTERFACE(container,XNameContainer)
-FORWARD_DECLARE_INTERFACE(container,XContainer)
-FORWARD_DECLARE_INTERFACE(ucb,XContent)
-
-//........................................................................
-namespace dbaui
-{
-//........................................................................
-
- class SubComponentManager;
-
- //====================================================================
- //= OApplicationController
- //====================================================================
- class OApplicationController;
- class OApplicationView;
- class OLinkedDocumentsAccess;
- typedef OGenericUnoController OApplicationController_CBASE;
- typedef ::cppu::ImplHelper5 < ::com::sun::star::container::XContainerListener
- , ::com::sun::star::beans::XPropertyChangeListener
- , ::com::sun::star::sdb::application::XDatabaseDocumentUI
- , ::com::sun::star::ui::XContextMenuInterception
- , ::com::sun::star::view::XSelectionSupplier
- > OApplicationController_Base;
-
- class SelectionNotifier;
-
- class OApplicationController
- :public OApplicationController_CBASE
- ,public OApplicationController_Base
- ,public IApplicationController
- {
- public:
- typedef ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer > TContainer;
- typedef ::std::vector< TContainer > TContainerVector;
-
- private:
-
- OTableCopyHelper::DropDescriptor m_aAsyncDrop;
-
- SharedConnection m_xDataSourceConnection;
- ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >
- m_xMetaData;
-
- OModuleClient m_aModuleClient;
- TransferableDataHelper m_aSystemClipboard; // content of the clipboard
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
- m_xDataSource;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
- m_xModel;
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable >
- m_xDocumentModify;
- ::cppu::OInterfaceContainerHelper
- m_aContextMenuInterceptors;
-
- TContainerVector m_aCurrentContainers; // the containers where we are listener on
- ::rtl::Reference< SubComponentManager >
- m_pSubComponentManager;
- ::dbaccess::ODsnTypeCollection
- m_aTypeCollection;
- OTableCopyHelper m_aTableCopyHelper;
- TransferableClipboardListener*
- m_pClipbordNotifier; // notifier for changes in the clipboard
- sal_uLong m_nAsyncDrop;
- OAsyncronousLink m_aControllerConnectedEvent;
- OAsyncronousLink m_aSelectContainerEvent;
- PreviewMode m_ePreviewMode; // the mode of the preview
- ElementType m_eCurrentType;
- sal_Bool m_bNeedToReconnect; // true when the settings of the data source were modified and the connection is no longer up to date
- sal_Bool m_bSuspended; // is true when the controller was already suspended
-
- ::std::auto_ptr< SelectionNotifier >
- m_pSelectionNotifier;
- typedef ::std::map< ElementType, ::std::vector< ::rtl::OUString > > SelectionByElementType;
- SelectionByElementType m_aPendingSelection;
-
- private:
-
- OApplicationView* getContainer() const;
-
-
- /** returns the database name
- @return
- the database name
- */
- ::rtl::OUString getDatabaseName() const;
-
- /** returns the stripped database name.
- @return
- The stripped database name either the registered naem or if it is a file url the last segment.
- */
- ::rtl::OUString getStrippedDatabaseName() const;
-
- /** return the element type for given container
- @param _xContainer The container where the element type has to be found
- @return the element type coressponding to the given container
- */
- ElementType getElementType(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >& _xContainer) const;
-
- /** opens a new frame with either the table or the query or report or form or view
- @param _sName
- The name of the object to open
- @param _eType
- Defines the type to open
- @param _eOpenMode
- denotes the mode in which to open the object
- @param _nInstigatorCommand
- denotes the command which instigated the action. Might be 0.
- @return the form or report model will only be returned, otherwise <NULL/>
- */
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > openElement(
- const ::rtl::OUString& _sName,
- ElementType _eType,
- ElementOpenMode _eOpenMode,
- sal_uInt16 _nInstigatorCommand = 0
- );
-
- /** opens a new sub frame with a table/query/form/report/view, passing additional arguments
- */
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > openElementWithArguments(
- const ::rtl::OUString& _sName,
- ElementType _eType,
- ElementOpenMode _eOpenMode,
- sal_uInt16 _nInstigatorCommand,
- const ::comphelper::NamedValueCollection& _rAdditionalArguments
- );
-
- /** opens a new frame for creation or auto pilot
- @param _eType
- Defines the type to open
- @param i_rAdditionalArguments
- Additional arguments to pass when creating the component
- */
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
- newElement(
- ElementType _eType,
- const ::comphelper::NamedValueCollection& i_rAdditionalArguments,
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_rDocumentDefinition
- );
-
- /** creates a new database object, using an auto pilot
- @param _eType
- Defines the type of the object to create
- @precond
- Our mutex must not be locked.
- @since #i39203#
- */
- void newElementWithPilot( ElementType _eType );
-
- /** converts the query to a view
- @param _sName
- The name of the query.
- */
- void convertToView(const ::rtl::OUString& _sName);
-
- /** checks if the connection for the selected data source is read only. If the connection doesn't exist, <TRUE/> will be returned.
- @return
- <TRUE/> if read only or doesn't exist, otherwise <FALSE/>
- */
- sal_Bool isConnectionReadOnly() const;
-
- /// fills the list with the selected entries.
- void getSelectionElementNames( ::std::vector< ::rtl::OUString>& _rNames ) const;
-
- /// deletes the entries selected.
- void deleteEntries();
-
- /// renames the selected entry in the detail page
- void renameEntry();
-
- /** deletes queries, forms, or reports
- @param _eType
- the type of the objects
- @param _rList
- The names of the elements to delete
- @param _bConfirm
- determines whether the user must confirm the deletion
- */
- void deleteObjects( ElementType _eType,
- const ::std::vector< ::rtl::OUString>& _rList,
- bool _bConfirm );
-
- /** deletes tables.
- @param _rList
- The list of tables.
- */
- void deleteTables(const ::std::vector< ::rtl::OUString>& _rList);
-
- /// copies the current object into clipboard
- TransferableHelper* copyObject();
-
- /// returns the nameaccess
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getElements(ElementType _eType);
-
- /** returns the document access for the specific type
- @param _eType
- the type
- @return ::std::auto_ptr<OLinkedDocumentsAccess>
- */
- ::std::auto_ptr<OLinkedDocumentsAccess> getDocumentsAccess(ElementType _eType);
-
- /// returns the query definitions of the active data source.
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer> getQueryDefintions() const;
-
- /** pastes a special format from the system clipboard to the currently selected object types
- @param _nFormatId
- The format to be copied.
- */
- void pasteFormat(sal_uInt32 _nFormatId);
-
- /** pastes a query, form or report into the data source
- @param _eType
- The type of the object to paste.
- @param _rPasteData
- The data descriptor.
- @param _sParentFolder
- The name of the parent folder if it exists.
- @param _bMove
- if <TRUE/> the name of the content must be inserted without any change, otherwise not.
- @return
- <TRUE/> if the paste opertions was successfull, otherwise <FALSE/>.
- */
- sal_Bool paste( ElementType _eType,const ::svx::ODataAccessDescriptor& _rPasteData ,const String& _sParentFolder = String(),sal_Bool _bMove = sal_False);
-
- /// returns the system clipboard.
- const TransferableDataHelper& getViewClipboard() const { return m_aSystemClipboard; }
-
- /// returns <TRUE/> if the clipboard supports a table format, otherwise <FALSE/>.
- sal_Bool isTableFormat() const;
-
- /** fills the vector with all supported formats
- @param _eType
- The type for which we need the formats
- @param _rFormatIds
- The vector to be filled up.
- */
- void getSupportedFormats(ElementType _eType,::std::vector<SotFormatStringId>& _rFormatIds) const;
-
- /** adds a listener to the current name access.
- @param _xCollection
- The collection where we want to listen on.
- */
- void addContainerListener(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xCollection);
-
- /** opens a uno dialog withthe currently selected data source as initialize argument
- @param _sServiceName
- The serivce name of the dialog to be executed.
- */
- void openDialog(const ::rtl::OUString& _sServiceName);
-
- /** opens the administration dialog for the selected data source
- */
- void openDataSourceAdminDialog();
-
- /** opens the table filter dialog for the selected data source
- */
- void openTableFilterDialog();
-
- /** opens the DirectSQLDialog to execute hand made sql statements.
- */
- void openDirectSQLDialog();
-
- /** when the settings of the data source changed,
- it opens a dialog which ask to close all depending documents, then recreate the connection.
- The SolarMutex has to be locked before calling this.
- */
- void askToReconnect();
-
- /** remember a newly opened sub document for later access
- */
- void onDocumentOpened(
- const ::rtl::OUString& _rName,
- const sal_Int32 _nType,
- const ElementOpenMode _eMode,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _xDocument,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _xDefinition
- );
-
- /** Inserts a new object into the hierachy given be the type.
- @param _eType
- Where to insert the new item.
- @param _sParentFolder
- The name of the parent folder if it exists.
- @param _xContent
- The content to insert.
- @param _bMove
- if <TRUE/> the name of the content must be inserted without any change, otherwise not.
- @return
- <TRUE/> if the insert opertions was successfull, otherwise <FALSE/>.
- */
- sal_Bool insertHierachyElement( ElementType _eType
- ,const String& _sParentFolder
- ,sal_Bool _bCollection = sal_True
- ,const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent>& _xContent = ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent>()
- ,sal_Bool _bMove = sal_False);
- /** checks if delete command or rename comamnd is allowed
- @param _eType
- The element type.
- @param _bDelete
- If <TRUE> then the delete command should be checked.
- @return
- <TRUE> if the command is allowed
- */
- sal_Bool isRenameDeleteAllowed(ElementType _eType,sal_Bool _bDelete) const;
- /** all selected entries will be opened, or edited, or converted to a view
- @param _nId
- The slot which should be executed.
- @param _eOpenMode
- Defines the mode of opening. @see ElementOpenMode
- */
- void doAction(sal_uInt16 _nId ,ElementOpenMode _eOpenMode);
-
- /** returns the currently selected table or query name.
- *
- * \return the name of the currently table or query. If the tables or query container is selected otherwise an empty string will be returned.
- */
- ::rtl::OUString getCurrentlySelectedName(sal_Int32& _rnCommandType) const;
-
- /** shows the preview for the given entry
- */
- void showPreviewFor( const ElementType _eType,const ::rtl::OUString& _sName );
-
- /** called we were attached to a frame
-
- In particular, this is called *after* the controller has been announced to the model
- (XModel::connectController)
- */
- void onAttachedFrame();
-
- /// determines whether the given table name denotes a view which can be altered
- bool impl_isAlterableView_nothrow( const ::rtl::OUString& _rTableOrViewName ) const;
-
- /** does the macro/script migration, where macros/scripts in forms/reports are moved
- to the database document itself.
- */
- void impl_migrateScripts_nothrow();
-
- /** verifies the object type denotes a valid DatabaseObject, and the object name denotes an existing
- object of this type. Throws if not.
- */
- void impl_validateObjectTypeAndName_throw( const sal_Int32 _nObjectType, const ::boost::optional< ::rtl::OUString >& i_rObjectName );
-
- protected:
- // ----------------------------------------------------------------
- // initalizing members
- /** forces usage of a connection which we do not own
- <p>To be used from within XInitialization::initialize only.</p>
- */
- void initializeConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxForeignConn );
-
- // state of a feature. 'feature' may be the handle of a ::com::sun::star::util::URL somebody requested a dispatch interface for OR a toolbar slot.
- virtual FeatureState GetState(sal_uInt16 nId) const;
- // execute a feature
- virtual void Execute(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs);
-
- // OGenericUnoController
- virtual void onLoadedMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& _xLayoutManager );
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getPrivateModel() const
- {
- return m_xModel;
- }
-
- virtual ~OApplicationController();
-
- public:
- OApplicationController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
-
- DECLARE_XINTERFACE( )
- DECLARE_XTYPEPROVIDER( )
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
- // need by registration
- static ::rtl::OUString getImplementationName_Static() throw( ::com::sun::star::uno::RuntimeException );
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
- static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
- SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
-
- // ::com::sun::star::frame::XController
- virtual void SAL_CALL attachFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & xFrame) throw( ::com::sun::star::uno::RuntimeException );
- virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) throw( ::com::sun::star::uno::RuntimeException );
- virtual sal_Bool SAL_CALL attachModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel) throw( ::com::sun::star::uno::RuntimeException );
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL getModel(void) throw( ::com::sun::star::uno::RuntimeException );
-
- // ::com::sun::star::container::XContainerListener
- virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
- virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
- virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
-
- // XPropertyChangeListener
- virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
-
- // XDatabaseDocumentUI
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > SAL_CALL getDataSource() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getApplicationMainWindow() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getActiveConnection() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > > SAL_CALL getSubComponents() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isConnected( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL connect( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::beans::Pair< ::sal_Int32, ::rtl::OUString > SAL_CALL identifySubComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& SubComponent ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL closeSubComponents( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL loadComponent( ::sal_Int32 ObjectType, const ::rtl::OUString& ObjectName, ::sal_Bool ForEditing ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL loadComponentWithArguments( ::sal_Int32 ObjectType, const ::rtl::OUString& ObjectName, ::sal_Bool ForEditing, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL createComponent( ::sal_Int32 ObjectType, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_DocumentDefinition ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL createComponentWithArguments( ::sal_Int32 ObjectType, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_DocumentDefinition ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-
- // XContextMenuInterception
- virtual void SAL_CALL registerContextMenuInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XContextMenuInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL releaseContextMenuInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XContextMenuInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException);
-
- // XSelectionSupplier
- virtual ::sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& xSelection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getSelection( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
-
- /** retrieves the current connection, creates it if necessary
-
- If an error occurs, then this is either stored in the location pointed to by <arg>_pErrorInfo</arg>,
- or, if <code>_pErrorInfo</code> is <NULL/>, then the error is displayed to the user.
- */
- const SharedConnection& ensureConnection( ::dbtools::SQLExceptionInfo* _pErrorInfo = NULL );
-
- /** retrieves the current connection
- */
- const SharedConnection& getConnection() const { return m_xDataSourceConnection; }
-
- /// determines whether we're currently connected to the database
- bool isConnected() const { return m_xDataSourceConnection.is(); }
-
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >&
- getConnectionMetaData() const { return m_xMetaData; }
-
- /** refreshes the tables
- */
- void refreshTables();
-
- // IApplicationController
- virtual bool onEntryDoubleClick(SvTreeListBox& _rTree);
- virtual sal_Bool onContainerSelect(ElementType _eType);
- virtual void onSelectionChanged();
- virtual void onCutEntry();
- virtual void onCopyEntry();
- virtual void onPasteEntry();
- virtual void onDeleteEntry();
- virtual void previewChanged( sal_Int32 _nMode);
- virtual void containerFound( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >& _xContainer);
-
- // IController (base of IApplicationController)
- virtual void executeUnChecked(const ::com::sun::star::util::URL& _rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs);
- virtual void executeChecked(const ::com::sun::star::util::URL& _rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs);
- virtual void executeUnChecked(sal_uInt16 _nCommandId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs);
- virtual void executeChecked(sal_uInt16 _nCommandId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs);
- virtual sal_Bool isCommandEnabled(sal_uInt16 _nCommandId) const;
- virtual sal_Bool isCommandEnabled( const ::rtl::OUString& _rCompleteCommandURL ) const;
- virtual sal_uInt16 registerCommandURL( const ::rtl::OUString& _rCompleteCommandURL );
- virtual void notifyHiContrastChanged();
- virtual sal_Bool isDataSourceReadOnly() const;
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
- getXController(void) throw( ::com::sun::star::uno::RuntimeException );
- virtual bool interceptUserInput( const NotifyEvent& _rEvent );
-
- // IControlActionListener overridables
- virtual sal_Bool requestQuickHelp( const SvLBoxEntry* _pEntry, String& _rText ) const;
- virtual sal_Bool requestDrag( sal_Int8 _nAction, const Point& _rPosPixel );
- virtual sal_Int8 queryDrop( const AcceptDropEvent& _rEvt, const DataFlavorExVector& _rFlavors );
- virtual sal_Int8 executeDrop( const ExecuteDropEvent& _rEvt );
-
- // IContextMenuProvider (base of IApplicationController)
- virtual PopupMenu* getContextMenu( Control& _rControl ) const;
- virtual IController& getCommandController();
- virtual ::cppu::OInterfaceContainerHelper*
- getContextMenuInterceptors();
- virtual ::com::sun::star::uno::Any
- getCurrentSelection( Control& _rControl ) const;
-
- DECL_LINK( OnInvalidateClipboard, void* );
- DECL_LINK( OnClipboardChanged, void* );
- DECL_LINK( OnAsyncDrop, void* );
- DECL_LINK( OnCreateWithPilot, void* );
- DECL_LINK( OnSelectContainer, void* );
- DECL_LINK( OnFirstControllerConnected, void* );
-
- protected:
- using OApplicationController_CBASE::connect;
-
- /** disconnects from our XConnection, and cleans up this connection
- */
- virtual void disconnect();
-
- // late construction
- virtual sal_Bool Construct(Window* pParent);
- virtual void describeSupportedFeatures();
-
- protected:
- // XEventListener
- virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
-
- // OComponentHelper
- virtual void SAL_CALL disposing();
- };
-
-//........................................................................
-} // namespace dbaui
-//........................................................................
-
-#endif // DBAUI_APPCONTROLLER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx
deleted file mode 100644
index 854e2b66f..000000000
--- a/dbaccess/source/ui/app/AppControllerDnD.cxx
+++ /dev/null
@@ -1,818 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_dbaccess.hxx"
-
-#include "AppController.hxx"
-#include <comphelper/sequence.hxx>
-#include <comphelper/property.hxx>
-#include "dbustrings.hrc"
-#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
-#include <com/sun/star/sdbcx/XAppend.hpp>
-#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/uno/XNamingService.hpp>
-#include <com/sun/star/sdbc/XDataSource.hpp>
-#include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/container/XHierarchicalNameContainer.hpp>
-#include <com/sun/star/sdbc/DataType.hpp>
-#include <com/sun/star/sdb/CommandType.hpp>
-#include <com/sun/star/sdb/XBookmarksSupplier.hpp>
-#include <com/sun/star/sdb/SQLContext.hpp>
-#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
-#include <com/sun/star/sdb/XQueryDefinitionsSupplier.hpp>
-#include <com/sun/star/sdbcx/XDrop.hpp>
-#include <tools/urlobj.hxx>
-#include <unotools/ucbhelper.hxx>
-#include "dlgsave.hxx"
-#include <comphelper/types.hxx>
-#include <vcl/msgbox.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <cppuhelper/exc_hlp.hxx>
-#include <connectivity/dbexception.hxx>
-#include <vcl/waitobj.hxx>
-#include <rtl/ustrbuf.hxx>
-#include "AppView.hxx"
-#include <svx/dataaccessdescriptor.hxx>
-#include <svx/dbaobjectex.hxx>
-#include "browserids.hxx"
-#include "dbu_reghelper.hxx"
-#include "dbu_app.hrc"
-#include <vcl/menu.hxx>
-#include <comphelper/uno3.hxx>
-#include <vcl/svapp.hxx>
-#include <svtools/svlbitm.hxx>
-#include "listviewitems.hxx"
-#include "AppDetailView.hxx"
-#include "linkeddocuments.hxx"
-#include <vcl/lstbox.hxx>
-#include <connectivity/dbexception.hxx>
-#include <connectivity/dbtools.hxx>
-#include "sqlmessage.hxx"
-#include <tools/string.hxx>
-#include "dbexchange.hxx"
-#include "UITools.hxx"
-#include <algorithm>
-#include <svtools/svtreebx.hxx>
-#include <com/sun/star/sdb/XReportDocumentsSupplier.hpp>
-#include <com/sun/star/sdb/XFormDocumentsSupplier.hpp>
-#include <sfx2/filedlghelper.hxx>
-#include <unotools/pathoptions.hxx>
-#include <sfx2/docfilt.hxx>
-#include <svtools/fileview.hxx>
-#include <tools/diagnose_ex.h>
-#include <osl/diagnose.h>
-#include "defaultobjectnamecheck.hxx"
-#include <osl/mutex.hxx>
-#include "subcomponentmanager.hxx"
-
-//........................................................................
-namespace dbaui
-{
-//........................................................................
-using namespace ::dbtools;
-using namespace ::svx;
-using namespace ::svtools;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::task;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::lang;
-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::frame;
-using namespace ::com::sun::star::ucb;
-using namespace ::com::sun::star::util;
-
-// -----------------------------------------------------------------------------
-void OApplicationController::deleteTables(const ::std::vector< ::rtl::OUString>& _rList)
-{
- SharedConnection xConnection( ensureConnection() );
-
- Reference<XTablesSupplier> xSup(xConnection,UNO_QUERY);
- OSL_ENSURE(xSup.is(),"OApplicationController::deleteTable: no XTablesSuppier!");
- if ( xSup.is() )
- {
- Reference<XNameAccess> xTables = xSup->getTables();
- Reference<XDrop> xDrop(xTables,UNO_QUERY);
- if ( xDrop.is() )
- {
- bool bConfirm = true;
- ::std::vector< ::rtl::OUString>::const_iterator aEnd = _rList.end();
- for (::std::vector< ::rtl::OUString>::const_iterator aIter = _rList.begin(); aIter != aEnd; ++aIter)
- {
- ::rtl::OUString sTableName = *aIter;
-
- sal_Int32 nResult = RET_YES;
- if ( bConfirm )
- nResult = ::dbaui::askForUserAction(getView(),STR_TITLE_CONFIRM_DELETION ,STR_QUERY_DELETE_TABLE,_rList.size() > 1 && (aIter+1) != _rList.end(),sTableName);
-
- bool bUserConfirmedDelete =
- ( RET_YES == nResult )
- || ( RET_ALL == nResult );
- if ( bUserConfirmedDelete && m_pSubComponentManager->closeSubFrames( sTableName, E_TABLE ) )
- {
- SQLExceptionInfo aErrorInfo;
- try
- {
- if ( xTables->hasByName(sTableName) )
- xDrop->dropByName(sTableName);
- else
- {// could be a view
- Reference<XViewsSupplier> xViewsSup(xConnection,UNO_QUERY);
-
- Reference<XNameAccess> xViews;
- if ( xViewsSup.is() )
- {
- xViews = xViewsSup->getViews();
- if ( xViews.is() && xViews->hasByName(sTableName) )
- {
- xDrop.set(xViews,UNO_QUERY);
- if ( xDrop.is() )
- xDrop->dropByName(sTableName);
- }
- }
- }
- }
- catch(SQLContext& e) { aErrorInfo = e; }
- catch(SQLWarning& e) { aErrorInfo = e; }
- catch(SQLException& e) { aErrorInfo = e; }
- catch(WrappedTargetException& e)
- {
- SQLException aSql;
- if(e.TargetException >>= aSql)
- aErrorInfo = aSql;
- else
- OSL_FAIL("OApplicationController::implDropTable: something strange happended!");
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- if ( aErrorInfo.isValid() )
- showError(aErrorInfo);
-
- if ( RET_ALL == nResult )
- bConfirm = false;
- }
- else
- break;
- }
- }
- else
- {
- String sMessage(ModuleRes(STR_MISSING_TABLES_XDROP));
- ErrorBox aError(getView(), WB_OK, sMessage);
- aError.Execute();
- }
- }
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::deleteObjects( ElementType _eType, const ::std::vector< ::rtl::OUString>& _rList, bool _bConfirm )
-{
- Reference< XNameContainer > xNames( getElements( _eType ), UNO_QUERY );
- Reference< XHierarchicalNameContainer > xHierarchyName( xNames, UNO_QUERY );
- if ( xNames.is() )
- {
- ByteString sDialogPosition;
- svtools::QueryDeleteResult_Impl eResult = _bConfirm ? svtools::QUERYDELETE_YES : svtools::QUERYDELETE_ALL;
-
- // The list of elements to delete is allowed to contain related elements: A given element may
- // be the ancestor or child of another element from the list.
- // We want to ensure that ancestors get deleted first, so we normalize the list in this respect.
- // #i33353#
- ::std::set< ::rtl::OUString > aDeleteNames;
- // Note that this implicitly uses ::std::less< ::rtl::OUString > a comparison operation, which
- // results in lexicographical order, which is exactly what we need, because "foo" is *before*
- // any "foo/bar" in this order.
- ::std::copy(
- _rList.begin(), _rList.end(),
- ::std::insert_iterator< ::std::set< ::rtl::OUString > >( aDeleteNames, aDeleteNames.begin() )
- );
-
- ::std::set< ::rtl::OUString >::size_type nCount = aDeleteNames.size();
- for ( ::std::set< ::rtl::OUString >::size_type nObjectsLeft = nCount; !aDeleteNames.empty(); )
- {
- ::std::set< ::rtl::OUString >::iterator aThisRound = aDeleteNames.begin();
-
- if ( eResult != svtools::QUERYDELETE_ALL )
- {
- svtools::QueryDeleteDlg_Impl aDlg( getView(), *aThisRound );
-
- if ( sDialogPosition.Len() )
- aDlg.SetWindowState( sDialogPosition );
-
- if ( nObjectsLeft > 1 )
- aDlg.EnableAllButton();
-
- if ( aDlg.Execute() == RET_OK )
- eResult = aDlg.GetResult();
- else
- return;
-
- sDialogPosition = aDlg.GetWindowState( );
- }
-
- bool bSuccess = false;
-
- bool bUserConfirmedDelete =
- ( eResult == svtools::QUERYDELETE_ALL )
- || ( eResult == svtools::QUERYDELETE_YES );
-
- if ( bUserConfirmedDelete
- && ( ( _eType == E_QUERY ) ? m_pSubComponentManager->closeSubFrames( *aThisRound, _eType ) : true )
- )
- {
- try
- {
- if ( xHierarchyName.is() )
- xHierarchyName->removeByHierarchicalName( *aThisRound );
- else
- xNames->removeByName( *aThisRound );
-
- bSuccess = true;
-
- // now that we removed the element, care for all it's child elements
- // which may also be a part of the list
- // #i33353#
- OSL_ENSURE( aThisRound->getLength() - 1 >= 0, "OApplicationController::deleteObjects: empty name?" );
- ::rtl::OUStringBuffer sSmallestSiblingName( *aThisRound );
- sSmallestSiblingName.append( (sal_Unicode)( '/' + 1) );
-
- ::std::set< ::rtl::OUString >::iterator aUpperChildrenBound = aDeleteNames.lower_bound( sSmallestSiblingName.makeStringAndClear() );
- for ( ::std::set< ::rtl::OUString >::iterator aObsolete = aThisRound;
- aObsolete != aUpperChildrenBound;
- )
- {
-#if OSL_DEBUG_LEVEL > 0
- ::rtl::OUString sObsoleteName = *aObsolete;
-#endif
- ::std::set< ::rtl::OUString >::iterator aNextObsolete = aObsolete; ++aNextObsolete;
- aDeleteNames.erase( aObsolete );
- --nObjectsLeft;
- aObsolete = aNextObsolete;
- }
- }
- catch(const SQLException&)
- {
- showError( SQLExceptionInfo( ::cppu::getCaughtException() ) );
- }
- catch(WrappedTargetException& e)
- {
- SQLException aSql;
- if ( e.TargetException >>= aSql )
- showError( SQLExceptionInfo( e.TargetException ) );
- else
- OSL_FAIL( "OApplicationController::deleteObjects: something strange happended!" );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- if ( !bSuccess )
- {
- // okay, this object could not be deleted (or the user did not want to delete it),
- // but continue with the rest
- aDeleteNames.erase( aThisRound );
- --nObjectsLeft;
- }
- }
- }
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::deleteEntries()
-{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
-
- if ( getContainer() )
- {
- ::std::vector< ::rtl::OUString> aList;
- getSelectionElementNames(aList);
- ElementType eType = getContainer()->getElementType();
- switch(eType)
- {
- case E_TABLE:
- deleteTables(aList);
- break;
- case E_QUERY:
- deleteObjects( E_QUERY, aList, true );
- break;
- case E_FORM:
- deleteObjects( E_FORM, aList, true );
- break;
- case E_REPORT:
- deleteObjects( E_REPORT, aList, true );
- break;
- case E_NONE:
- break;
- }
- }
-}
-// -----------------------------------------------------------------------------
-const SharedConnection& OApplicationController::ensureConnection( ::dbtools::SQLExceptionInfo* _pErrorInfo )
-{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
-
- if ( !m_xDataSourceConnection.is() )
- {
- WaitObject aWO(getView());
- String sConnectingContext( ModuleRes( STR_COULDNOTCONNECT_DATASOURCE ) );
- sConnectingContext.SearchAndReplaceAscii("$name$", getStrippedDatabaseName());
-
- m_xDataSourceConnection.reset( connect( getDatabaseName(), sConnectingContext, _pErrorInfo ) );
- if ( m_xDataSourceConnection.is() )
- {
- SQLExceptionInfo aError;
- try
- {
- m_xMetaData = m_xDataSourceConnection->getMetaData();
- }
- catch( const SQLException& )
- {
- aError = ::cppu::getCaughtException();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- if ( aError.isValid() )
- {
- if ( _pErrorInfo )
- {
- *_pErrorInfo = aError;
- }
- else
- {
- showError( aError );
- }
- }
- }
- }
- return m_xDataSourceConnection;
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationController::isDataSourceReadOnly() const
-{
- Reference<XStorable> xStore(m_xModel,UNO_QUERY);
- return !xStore.is() || xStore->isReadonly();
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationController::isConnectionReadOnly() const
-{
- sal_Bool bIsConnectionReadOnly = sal_True;
- if ( m_xMetaData.is() )
- {
- try
- {
- bIsConnectionReadOnly = m_xMetaData->isReadOnly();
- }
- catch(const SQLException&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- // TODO check configuration
- return bIsConnectionReadOnly;
-}
-// -----------------------------------------------------------------------------
-Reference< XNameAccess > OApplicationController::getElements( ElementType _eType )
-{
- Reference< XNameAccess > xElements;
- try
- {
- switch ( _eType )
- {
- case E_REPORT:
- {
- Reference< XReportDocumentsSupplier > xSupp( m_xModel, UNO_QUERY_THROW );
- xElements.set( xSupp->getReportDocuments(), UNO_SET_THROW );
- }
- break;
-
- case E_FORM:
- {
- Reference< XFormDocumentsSupplier > xSupp( m_xModel, UNO_QUERY_THROW );
- xElements.set( xSupp->getFormDocuments(), UNO_SET_THROW );
- }
- break;
-
- case E_QUERY:
- {
- xElements.set( getQueryDefintions(), UNO_QUERY_THROW );
- }
- break;
-
- case E_TABLE:
- {
- if ( m_xDataSourceConnection.is() )
- {
- Reference< XTablesSupplier > xSup( getConnection(), UNO_QUERY_THROW );
- xElements.set( xSup->getTables(), UNO_SET_THROW );
- }
- }
- break;
-
- default:
- break;
- }
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- return xElements;
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::getSelectionElementNames(::std::vector< ::rtl::OUString>& _rNames) const
-{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
-
- OSL_ENSURE(getContainer(),"View isn't valid! -> GPF");
-
- getContainer()->getSelectionElementNames( _rNames );
-}
-
-// -----------------------------------------------------------------------------
-::std::auto_ptr< OLinkedDocumentsAccess > OApplicationController::getDocumentsAccess( ElementType _eType )
-{
- OSL_ENSURE( ( _eType == E_TABLE ) || ( _eType == E_QUERY ) || ( _eType == E_FORM ) || ( _eType == E_REPORT ),
- "OApplicationController::getDocumentsAccess: only forms and reports are supported here!" );
-
- SharedConnection xConnection( ensureConnection() );
- Reference< XNameAccess > xDocContainer;
-
- if ( ( _eType == E_FORM ) | ( _eType == E_REPORT ) )
- {
- xDocContainer.set( getElements( _eType ) );
- OSL_ENSURE( xDocContainer.is(), "OApplicationController::getDocumentsAccess: invalid container!" );
- }
-
- ::std::auto_ptr< OLinkedDocumentsAccess > pDocuments( new OLinkedDocumentsAccess(
- getView(), this, getORB(), xDocContainer, xConnection, getDatabaseName()
- ) );
- return pDocuments;
-}
-// -----------------------------------------------------------------------------
-TransferableHelper* OApplicationController::copyObject()
-{
- try
- {
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
-
- ElementType eType = getContainer()->getElementType();
- TransferableHelper* pData = NULL;
- switch( eType )
- {
- case E_TABLE:
- case E_QUERY:
- {
- SharedConnection xConnection( ensureConnection() );
- Reference< XDatabaseMetaData> xMetaData;
- if ( xConnection.is() )
- xMetaData = xConnection->getMetaData();
-
- ::rtl::OUString sName = getContainer()->getQualifiedName( NULL );
- if ( sName.getLength() )
- {
- ::rtl::OUString sDataSource = getDatabaseName();
-
- if ( eType == E_TABLE )
- {
- pData = new ODataClipboard(sDataSource, CommandType::TABLE, sName, xConnection, getNumberFormatter(xConnection,getORB()), getORB());
- }
- else
- {
- pData = new ODataClipboard(sDataSource, CommandType::QUERY, sName, getNumberFormatter(xConnection,getORB()), getORB());
- }
- }
- }
- break;
- case E_FORM:
- case E_REPORT:
- {
- ::std::vector< ::rtl::OUString> aList;
- getSelectionElementNames(aList);
- Reference< XHierarchicalNameAccess > xElements(getElements(eType),UNO_QUERY);
- if ( xElements.is() && !aList.empty() )
- {
- Reference< XContent> xContent(xElements->getByHierarchicalName(*aList.begin()),UNO_QUERY);
- pData = new OComponentTransferable( getDatabaseName(), xContent );
- }
- }
- break;
- default:
- break;
- }
-
- // the owner ship goes to ODataClipboards
- return pData;
- }
- catch(const SQLException&)
- {
- showError( SQLExceptionInfo( ::cppu::getCaughtException() ) );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return NULL;
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationController::paste( ElementType _eType,const ::svx::ODataAccessDescriptor& _rPasteData,const String& _sParentFolder ,sal_Bool _bMove)
-{
- try
- {
- if ( _eType == E_QUERY )
- {
- sal_Int32 nCommandType = CommandType::TABLE;
- if ( _rPasteData.has(daCommandType) )
- _rPasteData[daCommandType] >>= nCommandType;
-
- if ( CommandType::QUERY == nCommandType || CommandType::COMMAND == nCommandType )
- {
- // read all necessary data
-
- ::rtl::OUString sCommand;
- sal_Bool bEscapeProcessing = sal_True;
-
- _rPasteData[daCommand] >>= sCommand;
- if ( _rPasteData.has(daEscapeProcessing) )
- _rPasteData[daEscapeProcessing] >>= bEscapeProcessing;
-
- // plausibility check
- sal_Bool bValidDescriptor = sal_False;
- ::rtl::OUString sDataSourceName = _rPasteData.getDataSource();
- if (CommandType::QUERY == nCommandType)
- bValidDescriptor = sDataSourceName.getLength() && sCommand.getLength();
- else if (CommandType::COMMAND == nCommandType)
- bValidDescriptor = (0 != sCommand.getLength());
- if (!bValidDescriptor)
- {
- OSL_FAIL("OApplicationController::paste: invalid descriptor!");
- return sal_False;
- }
-
- // the target object name (as we'll suggest it to the user)
- ::rtl::OUString sTargetName;
- try
- {
- if ( CommandType::QUERY == nCommandType )
- sTargetName = sCommand;
-
- if ( !sTargetName.getLength() )
- {
- String sDefaultName = String( ModuleRes( STR_QRY_TITLE ) );
- sDefaultName = sDefaultName.GetToken( 0, ' ' );
-
- Reference< XNameAccess > xQueries( getQueryDefintions(), UNO_QUERY_THROW );
- sTargetName = ::dbtools::createUniqueName( xQueries, sDefaultName, sal_False );
- }
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- Reference< XPropertySet > xQuery;
- if (CommandType::QUERY == nCommandType)
- {
- // need to extract the statement and the escape processing flag from the query object
- sal_Bool bSuccess = sal_False;
- try
- {
- // the concrete query
- Reference< XQueryDefinitionsSupplier > xSourceQuerySup(
- getDataSourceByName( sDataSourceName, getView(), getORB(), NULL ),
- UNO_QUERY_THROW );
- Reference< XNameAccess > xQueries( xSourceQuerySup->getQueryDefinitions(), UNO_SET_THROW );
- if ( xQueries->hasByName( sCommand ) )
- {
- xQuery.set( xQueries->getByName(sCommand), UNO_QUERY_THROW );
- bSuccess = true;
- }
- }
- catch(SQLException&) { throw; } // caught and handled by the outer catch
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- if (!bSuccess)
- {
- OSL_FAIL("OApplicationController::paste: could not extract the source query object!");
- // TODO: maybe this is worth an error message to be displayed to the user ....
- return sal_False;
- }
- }
-
-
- Reference< XNameContainer > xDestQueries(getQueryDefintions(), UNO_QUERY);
- Reference< XSingleServiceFactory > xQueryFactory(xDestQueries, UNO_QUERY);
- if (!xQueryFactory.is())
- {
- OSL_FAIL("OApplicationController::paste: invalid destination query container!");
- return sal_False;
- }
-
- // here we have everything needed to create a new query object ...
- // ... ehm, except a new name
- ensureConnection();
-
- DynamicTableOrQueryNameCheck aNameChecker( getConnection(), CommandType::QUERY );
- ::dbtools::SQLExceptionInfo aDummy;
- bool bNeedAskForName = ( sCommand.getLength() == 0 )
- /* we did not have a source name, so the target name was auto-generated */
- || ( !aNameChecker.isNameValid( sTargetName, aDummy ) );
- /* name is invalid in the target DB (e.g. because it already
- has a /table/ with that name) */
- if ( bNeedAskForName )
- {
- OSaveAsDlg aAskForName( getView(),
- CommandType::QUERY,
- getORB(),
- getConnection(),
- sTargetName,
- aNameChecker,
- SAD_ADDITIONAL_DESCRIPTION | SAD_TITLE_PASTE_AS);
- if ( RET_OK != aAskForName.Execute() )
- // cancelled by the user
- return sal_False;
- sTargetName = aAskForName.getName();
- }
-
- // create a new object
- Reference< XPropertySet > xNewQuery(xQueryFactory->createInstance(), UNO_QUERY);
- OSL_ENSURE(xNewQuery.is(), "OApplicationController::paste: invalid object created by factory!");
- if (xNewQuery.is())
- {
- // initialize
- if ( xQuery.is() )
- ::comphelper::copyProperties(xQuery,xNewQuery);
- else
- {
- xNewQuery->setPropertyValue(PROPERTY_COMMAND,makeAny(sCommand));
- xNewQuery->setPropertyValue(PROPERTY_ESCAPE_PROCESSING,makeAny(bEscapeProcessing));
- }
- // insert
- xDestQueries->insertByName( sTargetName, makeAny(xNewQuery) );
- xNewQuery.set(xDestQueries->getByName( sTargetName),UNO_QUERY);
- if ( xQuery.is() && xNewQuery.is() )
- {
- Reference<XColumnsSupplier> xSrcColSup(xQuery,UNO_QUERY);
- Reference<XColumnsSupplier> xDstColSup(xNewQuery,UNO_QUERY);
- if ( xSrcColSup.is() && xDstColSup.is() )
- {
- Reference<XNameAccess> xSrcNameAccess = xSrcColSup->getColumns();
- Reference<XNameAccess> xDstNameAccess = xDstColSup->getColumns();
- Reference<XDataDescriptorFactory> xFac(xDstNameAccess,UNO_QUERY);
- Reference<XAppend> xAppend(xFac,UNO_QUERY);
- if ( xSrcNameAccess.is() && xDstNameAccess.is() && xSrcNameAccess->hasElements() && xAppend.is() )
- {
- Reference<XPropertySet> xDstProp(xFac->createDataDescriptor());
-
- Sequence< ::rtl::OUString> aSeq = xSrcNameAccess->getElementNames();
- const ::rtl::OUString* pIter = aSeq.getConstArray();
- const ::rtl::OUString* pEnd = pIter + aSeq.getLength();
- for( ; pIter != pEnd ; ++pIter)
- {
- Reference<XPropertySet> xSrcProp(xSrcNameAccess->getByName(*pIter),UNO_QUERY);
- ::comphelper::copyProperties(xSrcProp,xDstProp);
- xAppend->appendByDescriptor(xDstProp);
- }
- }
- }
- }
- }
- }
- else
- OSL_TRACE("There should be a sequence in it!");
- return sal_True;
- }
- else if ( _rPasteData.has(daComponent) ) // forms or reports
- {
- Reference<XContent> xContent;
- _rPasteData[daComponent] >>= xContent;
- return insertHierachyElement(_eType,_sParentFolder,Reference<XNameAccess>(xContent,UNO_QUERY).is(),xContent,_bMove);
- }
- }
- catch(const SQLException&) { showError( SQLExceptionInfo( ::cppu::getCaughtException() ) ); }
- catch(const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return sal_False;
-}
-// -----------------------------------------------------------------------------
-Reference<XNameContainer> OApplicationController::getQueryDefintions() const
-{
- Reference<XQueryDefinitionsSupplier> xSet(m_xDataSource,UNO_QUERY);
- Reference<XNameContainer> xNames;
- if ( xSet.is() )
- {
- xNames.set(xSet->getQueryDefinitions(),UNO_QUERY);
- }
- return xNames;
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::getSupportedFormats(ElementType _eType,::std::vector<SotFormatStringId>& _rFormatIds) const
-{
- switch( _eType )
- {
- case E_TABLE:
- _rFormatIds.push_back(SOT_FORMATSTR_ID_DBACCESS_TABLE);
- _rFormatIds.push_back(SOT_FORMAT_RTF);
- _rFormatIds.push_back(SOT_FORMATSTR_ID_HTML);
- // run through
- case E_QUERY:
- _rFormatIds.push_back(SOT_FORMATSTR_ID_DBACCESS_QUERY);
- break;
- default:
- break;
- }
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationController::isTableFormat() const
-{
- return m_aTableCopyHelper.isTableFormat(getViewClipboard());
-}
-// -----------------------------------------------------------------------------
-IMPL_LINK( OApplicationController, OnAsyncDrop, void*, /*NOTINTERESTEDIN*/ )
-{
- m_nAsyncDrop = 0;
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
-
-
- if ( m_aAsyncDrop.nType == E_TABLE )
- {
- SharedConnection xConnection( ensureConnection() );
- if ( xConnection.is() )
- m_aTableCopyHelper.asyncCopyTagTable( m_aAsyncDrop, getDatabaseName(), xConnection );
- }
- else
- {
- if ( paste(m_aAsyncDrop.nType,m_aAsyncDrop.aDroppedData,m_aAsyncDrop.aUrl,m_aAsyncDrop.nAction == DND_ACTION_MOVE)
- && m_aAsyncDrop.nAction == DND_ACTION_MOVE )
- {
- Reference<XContent> xContent;
- m_aAsyncDrop.aDroppedData[daComponent] >>= xContent;
- ::std::vector< ::rtl::OUString> aList;
- sal_Int32 nIndex = 0;
- ::rtl::OUString sName = xContent->getIdentifier()->getContentIdentifier();
- ::rtl::OUString sErase = sName.getToken(0,'/',nIndex); // we don't want to have the "private:forms" part
- if ( nIndex != -1 )
- {
- aList.push_back(sName.copy(sErase.getLength() + 1));
- deleteObjects( m_aAsyncDrop.nType, aList, false );
- }
- }
- }
-
- m_aAsyncDrop.aDroppedData.clear();
-
- return 0L;
-}
-//........................................................................
-} // namespace dbaui
-//........................................................................
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppControllerGen.cxx b/dbaccess/source/ui/app/AppControllerGen.cxx
deleted file mode 100644
index 077394437..000000000
--- a/dbaccess/source/ui/app/AppControllerGen.cxx
+++ /dev/null
@@ -1,845 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_dbaccess.hxx"
-
-#include "AppController.hxx"
-#include "AppDetailView.hxx"
-#include "AppView.hxx"
-#include "dbaccess_slotid.hrc"
-#include "dbu_app.hrc"
-#include "dbustrings.hrc"
-#include "defaultobjectnamecheck.hxx"
-#include "dlgsave.hxx"
-#include "UITools.hxx"
-#include "subcomponentmanager.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/container/XContainer.hpp>
-#include <com/sun/star/container/XHierarchicalNameContainer.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/sdb/CommandType.hpp>
-#include <com/sun/star/sdb/SQLContext.hpp>
-#include <com/sun/star/sdb/XQueriesSupplier.hpp>
-#include <com/sun/star/sdbcx/XRename.hpp>
-#include <com/sun/star/sdb/ErrorCondition.hpp>
-#include <com/sun/star/sdb/application/DatabaseObject.hpp>
-#include <com/sun/star/sdb/SQLContext.hpp>
-#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
-#include <com/sun/star/ucb/Command.hpp>
-#include <com/sun/star/ucb/XCommandEnvironment.hpp>
-#include <com/sun/star/ucb/XCommandProcessor.hpp>
-#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
-#include <com/sun/star/uno/XNamingService.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <com/sun/star/util/XRefreshable.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
-/** === end UNO includes === **/
-
-#include <cppuhelper/exc_hlp.hxx>
-#include <connectivity/dbexception.hxx>
-#include <connectivity/dbtools.hxx>
-#include <connectivity/sqlerror.hxx>
-#include <connectivity/dbexception.hxx>
-#include <sfx2/mailmodelapi.hxx>
-#include <svx/dbaexchange.hxx>
-#include <toolkit/unohlp.hxx>
-#include <tools/diagnose_ex.h>
-#include <osl/diagnose.h>
-#include <tools/urlobj.hxx>
-#include <unotools/bootstrap.hxx>
-#include <vcl/mnemonic.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/waitobj.hxx>
-#include <osl/mutex.hxx>
-
-//........................................................................
-namespace dbaui
-{
-using namespace ::dbtools;
-using namespace ::connectivity;
-using namespace ::svx;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt;
-using namespace ::com::sun::star::util;
-using namespace ::com::sun::star::frame;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::ui::dialogs;
-using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::ucb;
-
-/** === begin UNO using === **/
-using ::com::sun::star::util::XCloseable;
-using ::com::sun::star::ui::XContextMenuInterceptor;
-/** === end UNO using === **/
-
-namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject;
-namespace ErrorCondition = ::com::sun::star::sdb::ErrorCondition;
-
-//........................................................................
-// -----------------------------------------------------------------------------
-
-class CloseChecker : public ::cppu::WeakImplHelper1< com::sun::star::lang::XEventListener >
-{
- bool m_bClosed;
-
-public:
- CloseChecker()
- :m_bClosed( false )
- {
- }
-
- virtual ~CloseChecker()
- {
- }
-
- bool isClosed()
- {
- return true;
- }
-
- // interface XEventListener
- virtual void SAL_CALL disposing( const EventObject& /*Source*/ ) throw( RuntimeException )
- {
- m_bClosed = true;
- }
-
-};
-// -----------------------------------------------------------------------------
-void OApplicationController::convertToView(const ::rtl::OUString& _sName)
-{
- try
- {
- SharedConnection xConnection( getConnection() );
- Reference< XQueriesSupplier > xSup( xConnection, UNO_QUERY_THROW );
- Reference< XNameAccess > xQueries( xSup->getQueries(), UNO_QUERY_THROW );
- Reference< XPropertySet > xSourceObject( xQueries->getByName( _sName ), UNO_QUERY_THROW );
-
- Reference< XTablesSupplier > xTablesSup( xConnection, UNO_QUERY_THROW );
- Reference< XNameAccess > xTables( xTablesSup->getTables(), UNO_QUERY_THROW );
-
- Reference< XDatabaseMetaData > xMeta = xConnection->getMetaData();
-
- String aName = String(ModuleRes(STR_TBL_TITLE));
- aName = aName.GetToken(0,' ');
- String aDefaultName = ::dbaui::createDefaultName(xMeta,xTables,aName);
-
- DynamicTableOrQueryNameCheck aNameChecker( xConnection, CommandType::TABLE );
- OSaveAsDlg aDlg( getView(), CommandType::TABLE, getORB(), xConnection, aDefaultName, aNameChecker );
- if ( aDlg.Execute() == RET_OK )
- {
- ::rtl::OUString sName = aDlg.getName();
- ::rtl::OUString sCatalog = aDlg.getCatalog();
- ::rtl::OUString sSchema = aDlg.getSchema();
- ::rtl::OUString sNewName(
- ::dbtools::composeTableName( xMeta, sCatalog, sSchema, sName, sal_False, ::dbtools::eInTableDefinitions ) );
- Reference<XPropertySet> xView = ::dbaui::createView(sNewName,xConnection,xSourceObject);
- if ( !xView.is() )
- throw SQLException(String(ModuleRes(STR_NO_TABLE_FORMAT_INSIDE)),*this,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000")) ,0,Any());
- getContainer()->elementAdded(E_TABLE,sNewName,makeAny(xView));
- }
- }
- catch(const SQLException& )
- {
- showError( SQLExceptionInfo( ::cppu::getCaughtException() ) );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::pasteFormat(sal_uInt32 _nFormatId)
-{
- if ( _nFormatId )
- {
- try
- {
- const TransferableDataHelper& rClipboard = getViewClipboard();
- ElementType eType = getContainer()->getElementType();
- if ( eType == E_TABLE )
- {
- m_aTableCopyHelper.pasteTable( _nFormatId, rClipboard, getDatabaseName(), ensureConnection() );
- }
- else
- paste( eType, ODataAccessObjectTransferable::extractObjectDescriptor( rClipboard ) );
-
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::openDataSourceAdminDialog()
-{
- openDialog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.DatasourceAdministrationDialog" ) ) );
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationController::openDialog( const ::rtl::OUString& _sServiceName )
-{
- try
- {
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
- WaitObject aWO(getView());
-
- Sequence< Any > aArgs(3);
- sal_Int32 nArgPos = 0;
-
- Reference< ::com::sun::star::awt::XWindow> xWindow = getTopMostContainerWindow();
- if ( !xWindow.is() )
- {
- OSL_ENSURE( getContainer(), "OApplicationController::Construct: have no view!" );
- if ( getContainer() )
- xWindow = VCLUnoHelper::GetInterface(getView()->Window::GetParent());
- }
- // the parent window
- aArgs[nArgPos++] <<= PropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentWindow")),
- 0,
- makeAny(xWindow),
- PropertyState_DIRECT_VALUE);
-
- // the initial selection
- ::rtl::OUString sInitialSelection;
- if ( getContainer() )
- sInitialSelection = getDatabaseName();
- if ( sInitialSelection.getLength() )
- {
- aArgs[ nArgPos++ ] <<= PropertyValue(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InitialSelection" ) ), 0,
- makeAny( sInitialSelection ), PropertyState_DIRECT_VALUE );
- }
-
- SharedConnection xConnection( getConnection() );
- if ( xConnection.is() )
- {
- aArgs[ nArgPos++ ] <<= PropertyValue(
- PROPERTY_ACTIVE_CONNECTION, 0,
- makeAny( xConnection ), PropertyState_DIRECT_VALUE );
- }
- aArgs.realloc( nArgPos );
-
- // create the dialog
- Reference< XExecutableDialog > xAdminDialog;
- xAdminDialog = Reference< XExecutableDialog >(
- getORB()->createInstanceWithArguments(_sServiceName,aArgs), UNO_QUERY);
-
- // execute it
- if (xAdminDialog.is())
- xAdminDialog->execute();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::openTableFilterDialog()
-{
- openDialog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.TableFilterDialog" ) ) );
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationController::refreshTables()
-{
- if ( getContainer() && getContainer()->getDetailView() )
- {
- WaitObject aWO(getView());
- OSL_ENSURE(getContainer()->getElementType() == E_TABLE,"Only allowed when the tables container is selected!");
- try
- {
- Reference<XRefreshable> xRefresh(getElements(E_TABLE),UNO_QUERY);
- if ( xRefresh.is() )
- xRefresh->refresh();
- }
- catch(const Exception&)
- {
- OSL_FAIL("Could not refresh tables!");
- }
-
- getContainer()->getDetailView()->clearPages(sal_False);
- getContainer()->getDetailView()->createTablesPage( ensureConnection() );
- }
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::openDirectSQLDialog()
-{
- openDialog( SERVICE_SDB_DIRECTSQLDIALOG );
-}
-// -----------------------------------------------------------------------------
-void SAL_CALL OApplicationController::propertyChange( const PropertyChangeEvent& evt ) throw (RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
- if ( evt.PropertyName == PROPERTY_USER )
- {
- m_bNeedToReconnect = sal_True;
- InvalidateFeature(SID_DB_APP_STATUS_USERNAME);
- }
- else if ( evt.PropertyName == PROPERTY_URL )
- {
- m_bNeedToReconnect = sal_True;
- InvalidateFeature(SID_DB_APP_STATUS_DBNAME);
- InvalidateFeature(SID_DB_APP_STATUS_TYPE);
- InvalidateFeature(SID_DB_APP_STATUS_HOSTNAME);
- }
- else if ( PROPERTY_NAME == evt.PropertyName )
- {
- const ElementType eType = getContainer()->getElementType();
- if ( eType == E_FORM || eType == E_REPORT )
- {
- ::rtl::OUString sOldName,sNewName;
- evt.OldValue >>= sOldName;
- evt.NewValue >>= sNewName;
-
- // if the old name is empty, then this is a newly inserted content. We're notified of it via the
- // elementInserted method, so there's no need to handle it here.
-
- if ( sOldName.getLength() )
- {
- Reference<XChild> xChild(evt.Source,UNO_QUERY);
- if ( xChild.is() )
- {
- Reference<XContent> xContent(xChild->getParent(),UNO_QUERY);
- if ( xContent.is() )
- sOldName = xContent->getIdentifier()->getContentIdentifier() + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + sOldName;
- }
-
- getContainer()->elementReplaced( eType , sOldName, sNewName );
- }
- }
- }
-
- EventObject aEvt;
- aEvt.Source = m_xModel;
- modified(aEvt);
-}
-
-// -----------------------------------------------------------------------------
-Reference< XDataSource > SAL_CALL OApplicationController::getDataSource() throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( getMutex() );
- Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
- return xDataSource;
-}
-
-// -----------------------------------------------------------------------------
-Reference< XWindow > SAL_CALL OApplicationController::getApplicationMainWindow() throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( getMutex() );
- Reference< XFrame > xFrame( getFrame(), UNO_QUERY_THROW );
- Reference< XWindow > xWindow( xFrame->getContainerWindow(), UNO_QUERY_THROW );
- return xWindow;
-}
-
-// -----------------------------------------------------------------------------
-Sequence< Reference< XComponent > > SAL_CALL OApplicationController::getSubComponents() throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( getMutex() );
- return m_pSubComponentManager->getSubComponents();
-}
-
-// -----------------------------------------------------------------------------
-Reference< XConnection > SAL_CALL OApplicationController::getActiveConnection() throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( getMutex() );
- return m_xDataSourceConnection.getTyped();
-}
-
-// -----------------------------------------------------------------------------
-::sal_Bool SAL_CALL OApplicationController::isConnected( ) throw (RuntimeException)
-{
- ::osl::MutexGuard aGuard( getMutex() );
- return m_xDataSourceConnection.is();
-}
-
-// -----------------------------------------------------------------------------
-void SAL_CALL OApplicationController::connect( ) throw (SQLException, RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
-
- SQLExceptionInfo aError;
- SharedConnection xConnection = ensureConnection( &aError );
- if ( !xConnection.is() )
- {
- if ( aError.isValid() )
- aError.doThrow();
-
- // no particular error, but nonetheless could not connect -> throw a generic exception
- String sConnectingContext( ModuleRes( STR_COULDNOTCONNECT_DATASOURCE ) );
- sConnectingContext.SearchAndReplaceAscii( "$name$", getStrippedDatabaseName() );
- ::dbtools::throwGenericSQLException( sConnectingContext, *this );
- }
-}
-
-// -----------------------------------------------------------------------------
-beans::Pair< ::sal_Int32, ::rtl::OUString > SAL_CALL OApplicationController::identifySubComponent( const Reference< XComponent >& i_rSubComponent ) throw (IllegalArgumentException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( getMutex() );
-
- sal_Int32 nType = -1;
- ::rtl::OUString sName;
-
- if ( !m_pSubComponentManager->lookupSubComponent( i_rSubComponent, sName, nType ) )
- throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
-
- if ( nType == SID_DB_APP_DSRELDESIGN )
- // this is somewhat hacky ... we're expected to return a DatabaseObject value. However, there is no such
- // value for the relation design. /me thinks we should change the API definition here ...
- nType = -1;
-
- return beans::Pair< ::sal_Int32, ::rtl::OUString >( nType, sName );
-}
-
-// -----------------------------------------------------------------------------
-::sal_Bool SAL_CALL OApplicationController::closeSubComponents( ) throw (RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
- return m_pSubComponentManager->closeSubComponents();
-}
-
-
-// -----------------------------------------------------------------------------
-namespace
-{
- ElementType lcl_objectType2ElementType( const sal_Int32 _nObjectType )
- {
- ElementType eType( E_NONE );
- switch ( _nObjectType )
- {
- case DatabaseObject::TABLE: eType = E_TABLE; break;
- case DatabaseObject::QUERY: eType = E_QUERY; break;
- case DatabaseObject::FORM: eType = E_FORM; break;
- case DatabaseObject::REPORT: eType = E_REPORT; break;
- default:
- OSL_FAIL( "lcl_objectType2ElementType: unsupported object type!" );
- // this should have been caught earlier
- }
- return eType;
- }
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationController::impl_validateObjectTypeAndName_throw( const sal_Int32 _nObjectType, const ::boost::optional< ::rtl::OUString >& i_rObjectName )
-{
- // ensure we're connected
- if ( !isConnected() )
- {
- SQLError aError( getORB() );
- aError.raiseException( ErrorCondition::DB_NOT_CONNECTED, *this );
- }
-
- // ensure a proper object type
- if ( ( _nObjectType != DatabaseObject::TABLE )
- && ( _nObjectType != DatabaseObject::QUERY )
- && ( _nObjectType != DatabaseObject::FORM )
- && ( _nObjectType != DatabaseObject::REPORT )
- )
- throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
-
- if ( !i_rObjectName )
- return;
-
- // ensure an existing object
- Reference< XNameAccess > xContainer( getElements( lcl_objectType2ElementType( _nObjectType ) ) );
- if ( !xContainer.is() )
- // all possible reasons for this (e.g. not being connected currently) should
- // have been handled before
- throw RuntimeException( ::rtl::OUString(), *this );
-
- bool bExistentObject = false;
- switch ( _nObjectType )
- {
- case DatabaseObject::TABLE:
- case DatabaseObject::QUERY:
- bExistentObject = xContainer->hasByName( *i_rObjectName );
- break;
- case DatabaseObject::FORM:
- case DatabaseObject::REPORT:
- {
- Reference< XHierarchicalNameAccess > xHierarchy( xContainer, UNO_QUERY_THROW );
- bExistentObject = xHierarchy->hasByHierarchicalName( *i_rObjectName );
- }
- break;
- }
-
- if ( !bExistentObject )
- throw NoSuchElementException( *i_rObjectName, *this );
-}
-
-// -----------------------------------------------------------------------------
-Reference< XComponent > SAL_CALL OApplicationController::loadComponent( ::sal_Int32 _ObjectType,
- const ::rtl::OUString& _ObjectName, ::sal_Bool _ForEditing ) throw (IllegalArgumentException, NoSuchElementException, SQLException, RuntimeException)
-{
- return loadComponentWithArguments( _ObjectType, _ObjectName, _ForEditing, Sequence< PropertyValue >() );
-}
-
-// -----------------------------------------------------------------------------
-Reference< XComponent > SAL_CALL OApplicationController::loadComponentWithArguments( ::sal_Int32 _ObjectType,
- const ::rtl::OUString& _ObjectName, ::sal_Bool _ForEditing, const Sequence< PropertyValue >& _Arguments ) throw (IllegalArgumentException, NoSuchElementException, SQLException, RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
-
- impl_validateObjectTypeAndName_throw( _ObjectType, _ObjectName );
-
- Reference< XComponent > xComponent( openElementWithArguments(
- _ObjectName,
- lcl_objectType2ElementType( _ObjectType ),
- _ForEditing ? E_OPEN_DESIGN : E_OPEN_NORMAL,
- _ForEditing ? SID_DB_APP_EDIT : SID_DB_APP_OPEN,
- ::comphelper::NamedValueCollection( _Arguments )
- ) );
-
- return xComponent;
-}
-
-// -----------------------------------------------------------------------------
-Reference< XComponent > SAL_CALL OApplicationController::createComponent( ::sal_Int32 i_nObjectType, Reference< XComponent >& o_DocumentDefinition ) throw (IllegalArgumentException, SQLException, RuntimeException)
-{
- return createComponentWithArguments( i_nObjectType, Sequence< PropertyValue >(), o_DocumentDefinition );
-}
-
-// -----------------------------------------------------------------------------
-Reference< XComponent > SAL_CALL OApplicationController::createComponentWithArguments( ::sal_Int32 i_nObjectType, const Sequence< PropertyValue >& i_rArguments, Reference< XComponent >& o_DocumentDefinition ) throw (IllegalArgumentException, SQLException, RuntimeException)
-{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
-
- impl_validateObjectTypeAndName_throw( i_nObjectType, ::boost::optional< ::rtl::OUString >() );
-
- Reference< XComponent > xComponent( newElement(
- lcl_objectType2ElementType( i_nObjectType ),
- ::comphelper::NamedValueCollection( i_rArguments ),
- o_DocumentDefinition
- ) );
-
- return xComponent;
-}
-
-// -----------------------------------------------------------------------------
-void SAL_CALL OApplicationController::registerContextMenuInterceptor( const Reference< XContextMenuInterceptor >& _Interceptor ) throw (RuntimeException)
-{
- if ( _Interceptor.is() )
- m_aContextMenuInterceptors.addInterface( _Interceptor );
-}
-
-// -----------------------------------------------------------------------------
-void SAL_CALL OApplicationController::releaseContextMenuInterceptor( const Reference< XContextMenuInterceptor >& _Interceptor ) throw (RuntimeException)
-{
- m_aContextMenuInterceptors.removeInterface( _Interceptor );
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationController::previewChanged( sal_Int32 _nMode )
-{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( getMutex() );
-
- if ( m_xDataSource.is() && !isDataSourceReadOnly() )
- {
- try
- {
- ::comphelper::NamedValueCollection aLayoutInfo( m_xDataSource->getPropertyValue( PROPERTY_LAYOUTINFORMATION ) );
- sal_Int32 nOldMode = aLayoutInfo.getOrDefault( "Preview", _nMode );
- if ( nOldMode != _nMode )
- {
- aLayoutInfo.put( "Preview", _nMode );
- m_xDataSource->setPropertyValue( PROPERTY_LAYOUTINFORMATION, makeAny( aLayoutInfo.getPropertyValues() ) );
- }
- }
- catch ( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- InvalidateFeature(SID_DB_APP_DISABLE_PREVIEW);
- InvalidateFeature(SID_DB_APP_VIEW_DOCINFO_PREVIEW);
- InvalidateFeature(SID_DB_APP_VIEW_DOC_PREVIEW);
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::askToReconnect()
-{
- if ( m_bNeedToReconnect )
- {
- m_bNeedToReconnect = sal_False;
- sal_Bool bClear = sal_True;
- if ( !m_pSubComponentManager->empty() )
- {
- QueryBox aQry(getView(), ModuleRes(APP_CLOSEDOCUMENTS));
- switch (aQry.Execute())
- {
- case RET_YES:
- closeSubComponents();
- break;
- default:
- bClear = sal_False;
- break;
- }
- }
- if ( bClear )
- {
- ElementType eType = getContainer()->getElementType();
- disconnect();
- getContainer()->getDetailView()->clearPages(sal_False);
- getContainer()->selectContainer(E_NONE); // invalidate the old selection
- m_eCurrentType = E_NONE;
- getContainer()->selectContainer(eType); // reselect the current one again
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-::rtl::OUString OApplicationController::getDatabaseName() const
-{
- ::rtl::OUString sDatabaseName;
- try
- {
- if ( m_xDataSource.is() )
- {
- OSL_VERIFY( m_xDataSource->getPropertyValue( PROPERTY_NAME ) >>= sDatabaseName );
- }
- }
- catch ( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return sDatabaseName;
-}
-
-// -----------------------------------------------------------------------------
-::rtl::OUString OApplicationController::getStrippedDatabaseName() const
-{
- ::rtl::OUString sDatabaseName;
- return ::dbaui::getStrippedDatabaseName( m_xDataSource, sDatabaseName );
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationController::onDocumentOpened( const ::rtl::OUString& _rName, const sal_Int32 _nType,
- const ElementOpenMode _eMode, const Reference< XComponent >& _xDocument, const Reference< XComponent >& _rxDefinition )
-{
- if ( !_xDocument.is() )
- return;
-
- try
- {
- OSL_ENSURE( _xDocument.is(), "OApplicationController::onDocumentOpened: is there any *valid* scenario where this fails?" );
- m_pSubComponentManager->onSubComponentOpened( _rName, _nType, _eMode, _xDocument.is() ? _xDocument : _rxDefinition );
-
- if ( _rxDefinition.is() )
- {
- Reference< XPropertySet > xProp( _rxDefinition, UNO_QUERY_THROW );
- Reference< XPropertySetInfo > xPSI( xProp->getPropertySetInfo(), UNO_SET_THROW );
- xProp->addPropertyChangeListener( PROPERTY_NAME, static_cast< XPropertyChangeListener* >( this ) );
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationController::insertHierachyElement(ElementType _eType,const String& _sParentFolder,sal_Bool _bCollection,const Reference<XContent>& _xContent,sal_Bool _bMove)
-{
- Reference<XHierarchicalNameContainer> xNames(getElements(_eType), UNO_QUERY);
- return dbaui::insertHierachyElement(getView()
- ,getORB()
- ,xNames
- ,_sParentFolder
- ,_eType == E_FORM
- ,_bCollection
- ,_xContent
- ,_bMove);
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationController::isRenameDeleteAllowed(ElementType _eType,sal_Bool _bDelete) const
-{
- ElementType eType = getContainer()->getElementType();
- sal_Bool bEnabled = !isDataSourceReadOnly() && eType == _eType;
- if ( bEnabled )
- {
-
- if ( E_TABLE == eType )
- bEnabled = !isConnectionReadOnly() && getContainer()->isALeafSelected();
-
- sal_Bool bCompareRes = sal_False;
- if ( _bDelete )
- bCompareRes = getContainer()->getSelectionCount() > 0;
- else
- {
- bCompareRes = getContainer()->getSelectionCount() == 1;
- if ( bEnabled && bCompareRes && E_TABLE == eType )
- {
- ::std::vector< ::rtl::OUString> aList;
- getSelectionElementNames(aList);
-
- try
- {
- Reference< XNameAccess > xContainer = const_cast<OApplicationController*>(this)->getElements(eType);
- bEnabled = (xContainer.is() && xContainer->hasByName(*aList.begin()));
- if ( bEnabled )
- bEnabled = Reference<XRename>(xContainer->getByName(*aList.begin()),UNO_QUERY).is();
- }
- catch(Exception&)
- {
- bEnabled = sal_False;
- }
- }
- }
-
- bEnabled = bEnabled && bCompareRes;
- }
- return bEnabled;
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::onLoadedMenu(const Reference< ::com::sun::star::frame::XLayoutManager >& _xLayoutManager)
-{
-
- if ( _xLayoutManager.is() )
- {
- static ::rtl::OUString s_sStatusbar(RTL_CONSTASCII_USTRINGPARAM("private:resource/statusbar/statusbar"));
- _xLayoutManager->createElement( s_sStatusbar );
- _xLayoutManager->requestElement( s_sStatusbar );
-
- if ( getContainer() )
- {
- // we need to share the "mnemonic space":
- MnemonicGenerator aMnemonicGenerator;
- // - the menu already has mnemonics
- SystemWindow* pSystemWindow = getContainer()->GetSystemWindow();
- MenuBar* pMenu = pSystemWindow ? pSystemWindow->GetMenuBar() : NULL;
- if ( pMenu )
- {
- sal_uInt16 nMenuItems = pMenu->GetItemCount();
- for ( sal_uInt16 i = 0; i < nMenuItems; ++i )
- aMnemonicGenerator.RegisterMnemonic( pMenu->GetItemText( pMenu->GetItemId( i ) ) );
- }
- // - the icons should use automatic ones
- getContainer()->createIconAutoMnemonics( aMnemonicGenerator );
- // - as well as the entries in the task pane
- getContainer()->setTaskExternalMnemonics( aMnemonicGenerator );
- }
-
- Execute( SID_DB_APP_VIEW_FORMS, Sequence< PropertyValue >() );
- InvalidateAll();
- }
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::doAction(sal_uInt16 _nId ,ElementOpenMode _eOpenMode)
-{
- ::std::vector< ::rtl::OUString> aList;
- getSelectionElementNames(aList);
- ElementType eType = getContainer()->getElementType();
- ::comphelper::NamedValueCollection aArguments;
- ElementOpenMode eOpenMode = _eOpenMode;
- if ( eType == E_REPORT && E_OPEN_FOR_MAIL == _eOpenMode )
- {
- aArguments.put("Hidden",true);
- eOpenMode = E_OPEN_NORMAL;
- }
-
- ::std::vector< ::std::pair< ::rtl::OUString ,Reference< XModel > > > aCompoments;
- ::std::vector< ::rtl::OUString>::iterator aEnd = aList.end();
- for (::std::vector< ::rtl::OUString>::iterator aIter = aList.begin(); aIter != aEnd; ++aIter)
- {
- if ( SID_DB_APP_CONVERTTOVIEW == _nId )
- convertToView(*aIter);
- else
- {
- Reference< XModel > xModel( openElementWithArguments( *aIter, eType, eOpenMode, _nId,aArguments ), UNO_QUERY );
- aCompoments.push_back( ::std::pair< ::rtl::OUString, Reference< XModel > >( *aIter, xModel ) );
- }
- }
-
- // special handling for mail, if more than one document is selected attach them all
- if ( _eOpenMode == E_OPEN_FOR_MAIL )
- {
-
- ::std::vector< ::std::pair< ::rtl::OUString ,Reference< XModel > > >::iterator componentIter = aCompoments.begin();
- ::std::vector< ::std::pair< ::rtl::OUString ,Reference< XModel > > >::iterator componentEnd = aCompoments.end();
- ::rtl::OUString aDocTypeString;
- SfxMailModel aSendMail;
- SfxMailModel::SendMailResult eResult = SfxMailModel::SEND_MAIL_OK;
- for (; componentIter != componentEnd && SfxMailModel::SEND_MAIL_OK == eResult; ++componentIter)
- {
- try
- {
- Reference< XModel > xModel(componentIter->second,UNO_QUERY);
-
- // Send document as e-Mail using stored/default type
- eResult = aSendMail.AttachDocument(aDocTypeString,xModel,componentIter->first);
- ::comphelper::disposeComponent(xModel);
- }
- catch(const Exception&)
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- if ( !aSendMail.IsEmpty() )
- aSendMail.Send( getFrame() );
- }
-}
-// -----------------------------------------------------------------------------
-ElementType OApplicationController::getElementType(const Reference< XContainer >& _xContainer) const
-{
- ElementType eRet = E_NONE;
- Reference<XServiceInfo> xServiceInfo(_xContainer,UNO_QUERY);
- if ( xServiceInfo.is() )
- {
- if ( xServiceInfo->supportsService(SERVICE_SDBCX_TABLES) )
- eRet = E_TABLE;
- else if ( xServiceInfo->supportsService(SERVICE_NAME_FORM_COLLECTION) )
- eRet = E_FORM;
- else if ( xServiceInfo->supportsService(SERVICE_NAME_REPORT_COLLECTION) )
- eRet = E_REPORT;
- else
- eRet = E_QUERY;
- }
- return eRet;
-}
-
-//........................................................................
-} // namespace dbaui
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
deleted file mode 100644
index c488a0caf..000000000
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ /dev/null
@@ -1,1407 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_dbaccess.hxx"
-#include "AppDetailPageHelper.hxx"
-#include "moduledbu.hxx"
-#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
-#include <connectivity/dbtools.hxx>
-#include "tabletree.hxx"
-#include "UITools.hxx"
-#include "dbtreelistbox.hxx"
-#include <com/sun/star/frame/XLayoutManager.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/awt/XTabController.hpp>
-#include <com/sun/star/sdbc/XConnection.hpp>
-#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/FrameSearchFlag.hpp>
-#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/frame/XFrames.hpp>
-#include <com/sun/star/frame/XFramesSupplier.hpp>
-#include <com/sun/star/awt/XWindow.hpp>
-#include <toolkit/helper/vclunohelper.hxx>
-#include <com/sun/star/ucb/XCommandEnvironment.hpp>
-#include <com/sun/star/ucb/XCommandProcessor.hpp>
-#include <com/sun/star/ucb/Command.hpp>
-#include <com/sun/star/form/XLoadable.hpp>
-#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/container/XContainer.hpp>
-#include <com/sun/star/sdb/CommandType.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
-#include <com/sun/star/sdb/application/DatabaseObject.hpp>
-#include <com/sun/star/sdb/application/DatabaseObjectContainer.hpp>
-#include "AppView.hxx"
-#include "dbaccess_helpid.hrc"
-#include "dbu_app.hrc"
-#include "callbacks.hxx"
-#include "IController.hxx"
-#include "dbustrings.hrc"
-#include "dbaccess_slotid.hrc"
-#include "databaseobjectview.hxx"
-#include "imageprovider.hxx"
-#include <vcl/waitobj.hxx>
-#include <tools/stream.hxx>
-#include <tools/debug.hxx>
-#include <rtl/ustrbuf.hxx>
-#include "IApplicationController.hxx"
-
-#include <com/sun/star/document/XDocumentProperties.hpp>
-
-
-using namespace ::dbaui;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::ucb;
-using namespace ::com::sun::star::frame;
-using namespace ::com::sun::star::form;
-using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::sdb::application;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star;
-using ::com::sun::star::awt::XTabController;
-
-namespace dbaui
-{
- namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject;
- namespace DatabaseObjectContainer = ::com::sun::star::sdb::application::DatabaseObjectContainer;
-}
-
-namespace
-{
- SvLBoxEntry* lcl_findEntry_impl(DBTreeListBox& rTree,const ::rtl::OUString& _rName,SvLBoxEntry* _pFirst)
- {
- SvLBoxEntry* pReturn = NULL;
- sal_Int32 nIndex = 0;
- String sName( _rName.getToken(0,'/',nIndex) );
-
- SvLBoxEntry* pEntry = _pFirst;
- while( pEntry )
- {
- if ( rTree.GetEntryText(pEntry) == sName )
- {
- if ( nIndex != -1 )
- {
- sName = _rName.getToken(0,'/',nIndex);
- pEntry = rTree.FirstChild(pEntry);
- }
- else
- {
- pReturn = pEntry;
- break;
- }
- }
- else
- pEntry = rTree.NextSibling(pEntry);
- }
- return pReturn;
- }
- SvLBoxEntry* lcl_findEntry(DBTreeListBox& rTree,const ::rtl::OUString& _rName,SvLBoxEntry* _pFirst)
- {
- sal_Int32 nIndex = 0;
- ::rtl::OUString sErase = _rName.getToken(0,'/',nIndex); // we don't want to have the "private:forms" part
- return (nIndex != -1 ? lcl_findEntry_impl(rTree,_rName.copy(sErase.getLength() + 1),_pFirst) : NULL);
- }
- //==================================================================
- // class OPreviewWindow
- //==================================================================
- class OTablePreviewWindow : public Window
- {
- DECL_LINK(OnDisableInput, void*);
- void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
- protected:
- virtual void DataChanged(const DataChangedEvent& rDCEvt);
- public:
- OTablePreviewWindow( Window* pParent, WinBits nStyle = 0 );
- virtual long Notify( NotifyEvent& rNEvt );
- };
- // -----------------------------------------------------------------------------
- OTablePreviewWindow::OTablePreviewWindow(Window* pParent, WinBits nStyle) : Window( pParent, nStyle)
- {
- ImplInitSettings( sal_True, sal_True, sal_True );
- }
- // -----------------------------------------------------------------------------
- long OTablePreviewWindow::Notify( NotifyEvent& rNEvt )
- {
- long nRet = Window::Notify( rNEvt );
- if ( rNEvt.GetType() == EVENT_INPUTENABLE && IsInputEnabled() )
- PostUserEvent( LINK( this, OTablePreviewWindow, OnDisableInput) );
- return nRet;
- }
- // -----------------------------------------------------------------------------
- IMPL_LINK(OTablePreviewWindow, OnDisableInput, void*, EMPTYARG)
- {
- EnableInput(sal_False);
- return 0L;
- }
- // -----------------------------------------------------------------------------
- void OTablePreviewWindow::DataChanged( const DataChangedEvent& rDCEvt )
- {
- Window::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
- (rDCEvt.GetFlags() & SETTINGS_STYLE) )
- {
- ImplInitSettings( sal_True, sal_True, sal_True );
- Invalidate();
- }
- }
- // -----------------------------------------------------------------------------
- void OTablePreviewWindow::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground )
- {
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- if( bFont )
- {
- Font aFont;
- aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont( aFont );
- }
-
- if( bForeground || bFont )
- {
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
- }
-
- if( bBackground )
- SetBackground( rStyleSettings.GetFieldColor() );
- }
-
-}
-//==================================================================
-// class OAppDetailPageHelper
-DBG_NAME(OAppDetailPageHelper)
-//==================================================================
-OAppDetailPageHelper::OAppDetailPageHelper(Window* _pParent,OAppBorderWindow& _rBorderWin,PreviewMode _ePreviewMode) : Window(_pParent,WB_DIALOGCONTROL)
- ,m_rBorderWin(_rBorderWin)
- ,m_aFL(this,WB_VERT)
- ,m_aTBPreview(this,WB_TABSTOP )
- ,m_aBorder(this,WB_BORDER | WB_READONLY)
- ,m_aPreview(&m_aBorder)
- ,m_aDocumentInfo(&m_aBorder,WB_LEFT | WB_VSCROLL | WB_READONLY )
- ,m_pTablePreview(NULL)
- ,m_ePreviewMode(_ePreviewMode)
-{
- DBG_CTOR(OAppDetailPageHelper,NULL);
-
- m_aBorder.SetBorderStyle(WINDOW_BORDER_MONO);
-
- m_aMenu.reset(new PopupMenu( ModuleRes( RID_MENU_APP_PREVIEW ) ));
-
- m_aTBPreview.SetOutStyle(TOOLBOX_STYLE_FLAT);
- m_aTBPreview.InsertItem(SID_DB_APP_DISABLE_PREVIEW,m_aMenu->GetItemText(SID_DB_APP_DISABLE_PREVIEW),TIB_LEFT|TIB_DROPDOWN|TIB_AUTOSIZE|TIB_RADIOCHECK);
- m_aTBPreview.SetHelpId(HID_APP_VIEW_PREVIEW_CB);
- m_aTBPreview.SetDropdownClickHdl( LINK( this, OAppDetailPageHelper, OnDropdownClickHdl ) );
- m_aTBPreview.EnableMenuStrings();
- m_aTBPreview.Enable(sal_True);
-
- m_aBorder.SetUniqueId(UID_APP_VIEW_PREVIEW_1);
-
- m_aPreview.SetHelpId(HID_APP_VIEW_PREVIEW_1);
-
- m_pTablePreview = new OTablePreviewWindow(&m_aBorder,WB_READONLY | WB_DIALOGCONTROL );
- m_pTablePreview->SetHelpId(HID_APP_VIEW_PREVIEW_2);
-
- m_aDocumentInfo.SetHelpId(HID_APP_VIEW_PREVIEW_3);
-
- m_xWindow = VCLUnoHelper::GetInterface( m_pTablePreview );
-
- SetUniqueId(UID_APP_DETAILPAGE_HELPER);
- for (int i=0; i < E_ELEMENT_TYPE_COUNT; ++i)
- m_pLists[i] = NULL;
- ImplInitSettings();
-}
-// -----------------------------------------------------------------------------
-OAppDetailPageHelper::~OAppDetailPageHelper()
-{
- try
- {
- Reference< ::util::XCloseable> xCloseable(m_xFrame,UNO_QUERY);
- if ( xCloseable.is() )
- xCloseable->close(sal_True);
- }
- catch(const Exception&)
- {
- OSL_FAIL("Exception thrown while disposing preview frame!");
- }
-
- for (int i=0; i < E_ELEMENT_TYPE_COUNT; ++i)
- {
- if ( m_pLists[i] )
- {
- m_pLists[i]->clearCurrentSelection();
- m_pLists[i]->Hide();
- ::std::auto_ptr<DBTreeListBox> aTemp(m_pLists[i]);
- m_pLists[i]->clearCurrentSelection(); // why a second time?
- m_pLists[i] = NULL;
- }
-
- }
-
- DBG_DTOR(OAppDetailPageHelper,NULL);
-}
-// -----------------------------------------------------------------------------
-int OAppDetailPageHelper::getVisibleControlIndex() const
-{
- int i = 0;
- for (; i < E_ELEMENT_TYPE_COUNT ; ++i)
- {
- if ( m_pLists[i] && m_pLists[i]->IsVisible() )
- break;
- }
- return i;
-}
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::selectAll()
-{
- int nPos = getVisibleControlIndex();
- if ( nPos < E_ELEMENT_TYPE_COUNT )
- {
- m_pLists[nPos]->SelectAll(sal_True);
- }
-}
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::sort(int _nPos,SvSortMode _eSortMode )
-{
- OSL_ENSURE(m_pLists[_nPos],"List can not be NULL! ->GPF");
- SvLBoxTreeList* pModel = m_pLists[_nPos]->GetModel();
- SvSortMode eOldSortMode = pModel->GetSortMode();
- pModel->SetSortMode(_eSortMode);
- if ( eOldSortMode != _eSortMode )
- pModel->Resort();
-}
-// -----------------------------------------------------------------------------
-sal_Bool OAppDetailPageHelper::isSortUp() const
-{
- SvSortMode eSortMode = SortNone;
- int nPos = getVisibleControlIndex();
- if ( nPos < E_ELEMENT_TYPE_COUNT )
- {
- SvLBoxTreeList* pModel = m_pLists[nPos]->GetModel();
- eSortMode = pModel->GetSortMode();
- }
- return eSortMode == SortAscending;
-}
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::sortDown()
-{
- int nPos = getVisibleControlIndex();
- if ( nPos < E_ELEMENT_TYPE_COUNT )
- sort(nPos,SortDescending);
-}
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::sortUp()
-{
- int nPos = getVisibleControlIndex();
- if ( nPos < E_ELEMENT_TYPE_COUNT )
- sort(nPos,SortAscending);
-}
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::getSelectionElementNames( ::std::vector< ::rtl::OUString>& _rNames ) const
-{
- int nPos = getVisibleControlIndex();
- if ( nPos < E_ELEMENT_TYPE_COUNT )
- {
- DBTreeListBox& rTree = *m_pLists[nPos];
- sal_Int32 nCount = rTree.GetEntryCount();
- _rNames.reserve(nCount);
- SvLBoxEntry* pEntry = rTree.FirstSelected();
- ElementType eType = getElementType();
- while( pEntry )
- {
- if ( eType == E_TABLE )
- {
- if( rTree.GetChildCount(pEntry) == 0 )
- _rNames.push_back( getQualifiedName( pEntry ) );
- }
- else
- {
- ::rtl::OUString sName = rTree.GetEntryText(pEntry);
- SvLBoxEntry* pParent = rTree.GetParent(pEntry);
- while(pParent)
- {
- sName = rTree.GetEntryText(pParent) + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + sName;
- pParent = rTree.GetParent(pParent);
- }
- _rNames.push_back(sName);
- }
- pEntry = rTree.NextSelected(pEntry);
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::describeCurrentSelectionForControl( const Control& _rControl, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
-{
- enum ElementType eType = E_TABLE;
- for ( size_t i=0; i < E_ELEMENT_TYPE_COUNT; eType = static_cast< ElementType >( ++i ) )
- {
- if ( m_pLists[eType] == &_rControl )
- {
- describeCurrentSelectionForType( eType, _out_rSelectedObjects );
- return;
- }
- }
- OSL_FAIL( "OAppDetailPageHelper::describeCurrentSelectionForControl: invalid control!" );
-}
-
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::describeCurrentSelectionForType( const ElementType _eType, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
-{
- OSL_ENSURE( _eType < E_ELEMENT_TYPE_COUNT, "OAppDetailPageHelper::describeCurrentSelectionForType: invalid type!" );
- DBTreeListBox* pList = ( _eType < E_ELEMENT_TYPE_COUNT ) ? m_pLists[ _eType ] : NULL;
- OSL_ENSURE( pList, "OAppDetailPageHelper::describeCurrentSelectionForType: "
- "You really should ensure this type has already been viewed before!" );
- if ( !pList )
- return;
-
- ::std::vector< NamedDatabaseObject > aSelected;
-
- SvLBoxEntry* pEntry = pList->FirstSelected();
- while( pEntry )
- {
- NamedDatabaseObject aObject;
- switch ( _eType )
- {
- case E_TABLE:
- {
- OTableTreeListBox& rTableTree = dynamic_cast< OTableTreeListBox& >( *pList );
- aObject = rTableTree.describeObject( pEntry );
- }
- break;
- case E_QUERY:
- aObject.Type = DatabaseObject::QUERY;
- aObject.Name = pList->GetEntryText( pEntry );
- break;
-
- case E_FORM:
- case E_REPORT:
- {
- ::rtl::OUString sName = pList->GetEntryText(pEntry);
- SvLBoxEntry* pParent = pList->GetParent(pEntry);
- while ( pParent )
- {
- ::rtl::OUStringBuffer buffer;
- buffer.append( pList->GetEntryText( pParent ) );
- buffer.append( sal_Unicode( '/' ) );
- buffer.append( sName );
- sName = buffer.makeStringAndClear();
-
- pParent = pList->GetParent( pParent );
- }
-
- if ( isLeaf( pEntry ) )
- aObject.Type = ( _eType == E_FORM ) ? DatabaseObject::FORM : DatabaseObject::REPORT;
- else
- aObject.Type = ( _eType == E_FORM ) ? DatabaseObjectContainer::FORMS_FOLDER : DatabaseObjectContainer::REPORTS_FOLDER;
- aObject.Name = sName;
- }
- break;
- default:
- OSL_FAIL( "OAppDetailPageHelper::describeCurrentSelectionForType: unexpected type!" );
- break;
- }
-
- if ( aObject.Name.getLength() )
- {
- aSelected.push_back( aObject );
- }
-
- pEntry = pList->NextSelected(pEntry);
- }
-
- _out_rSelectedObjects.realloc( aSelected.size() );
- ::std::copy( aSelected.begin(), aSelected.end(), _out_rSelectedObjects.getArray() );
-}
-
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::selectElements(const Sequence< ::rtl::OUString>& _aNames)
-{
- int nPos = getVisibleControlIndex();
- if ( nPos < E_ELEMENT_TYPE_COUNT )
- {
- DBTreeListBox& rTree = *m_pLists[nPos];
- rTree.SelectAll(sal_False);
- const ::rtl::OUString* pIter = _aNames.getConstArray();
- const ::rtl::OUString* pEnd = pIter + _aNames.getLength();
- for(;pIter != pEnd;++pIter)
- {
- SvLBoxEntry* pEntry = rTree.GetEntryPosByName(*pIter);
- if ( pEntry )
- rTree.Select(pEntry);
- }
- }
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OAppDetailPageHelper::getQualifiedName( SvLBoxEntry* _pEntry ) const
-{
- int nPos = getVisibleControlIndex();
- ::rtl::OUString sComposedName;
-
- if ( nPos >= E_ELEMENT_TYPE_COUNT )
- return sComposedName;
-
- OSL_ENSURE(m_pLists[nPos],"Tables tree view is NULL! -> GPF");
- DBTreeListBox& rTree = *m_pLists[nPos];
-
- SvLBoxEntry* pEntry = _pEntry;
- if ( !pEntry )
- pEntry = rTree.FirstSelected();
-
- if ( !pEntry )
- return sComposedName;
-
- if ( getElementType() == E_TABLE )
- {
- const OTableTreeListBox& rTreeView = dynamic_cast< const OTableTreeListBox& >( *m_pLists[nPos] );
- sComposedName = rTreeView.getQualifiedTableName( pEntry );
- }
- else
- {
- sComposedName = rTree.GetEntryText(pEntry);
- SvLBoxEntry* pParent = rTree.GetParent(pEntry);
- while(pParent)
- {
- sComposedName = rTree.GetEntryText(pParent) + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")) + sComposedName;
- pParent = rTree.GetParent(pParent);
- }
- }
-
- return sComposedName;
-}
-// -----------------------------------------------------------------------------
-ElementType OAppDetailPageHelper::getElementType() const
-{
- int nPos = getVisibleControlIndex();
- return static_cast<ElementType>(nPos);
-}
-// -----------------------------------------------------------------------------
-sal_Int32 OAppDetailPageHelper::getSelectionCount()
-{
- sal_Int32 nCount = 0;
- int nPos = getVisibleControlIndex();
- if ( nPos < E_ELEMENT_TYPE_COUNT )
- {
- DBTreeListBox& rTree = *m_pLists[nPos];
- SvLBoxEntry* pEntry = rTree.FirstSelected();
- while( pEntry )
- {
- ++nCount;
- pEntry = rTree.NextSelected(pEntry);
- }
- }
- return nCount;
-}
-// -----------------------------------------------------------------------------
-sal_Int32 OAppDetailPageHelper::getElementCount()
-{
- sal_Int32 nCount = 0;
- int nPos = getVisibleControlIndex();
- if ( nPos < E_ELEMENT_TYPE_COUNT )
- {
- nCount = m_pLists[nPos]->GetEntryCount();
- }
- return nCount;
-}
-// -----------------------------------------------------------------------------
-sal_Bool OAppDetailPageHelper::isCutAllowed()
-{
- return sal_False;
-}
-// -----------------------------------------------------------------------------
-sal_Bool OAppDetailPageHelper::isCopyAllowed()
-{
- return sal_True;
-}
-// -----------------------------------------------------------------------------
-sal_Bool OAppDetailPageHelper::isPasteAllowed()
-{
- return sal_True;
-}
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::copy()
-{
-}
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::cut()
-{
-}
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::paste()
-{
-}
-// -----------------------------------------------------------------------------
-bool OAppDetailPageHelper::isLeaf(SvLBoxEntry* _pEntry) const
-{
- if ( !_pEntry )
- return false;
- sal_Int32 nEntryType = reinterpret_cast< sal_IntPtr >( _pEntry->GetUserData() );
- if ( ( nEntryType == DatabaseObjectContainer::TABLES )
- || ( nEntryType == DatabaseObjectContainer::CATALOG )
- || ( nEntryType == DatabaseObjectContainer::SCHEMA )
- || ( nEntryType == DatabaseObjectContainer::FORMS_FOLDER )
- || ( nEntryType == DatabaseObjectContainer::REPORTS_FOLDER )
- )
- return false;
-
- return true;
-}
-
-// -----------------------------------------------------------------------------
-sal_Bool OAppDetailPageHelper::isALeafSelected() const
-{
- int nPos = getVisibleControlIndex();
- sal_Bool bLeafSelected = sal_False;
- if ( nPos < E_ELEMENT_TYPE_COUNT )
- {
- DBTreeListBox& rTree = *m_pLists[nPos];
- SvLBoxEntry* pEntry = rTree.FirstSelected( );
- while( !bLeafSelected && pEntry )
- {
- bLeafSelected = isLeaf( pEntry );
- pEntry = rTree.NextSelected(pEntry);
- }
- }
- return bLeafSelected;
-}
-// -----------------------------------------------------------------------------
-SvLBoxEntry* OAppDetailPageHelper::getEntry( const Point& _aPosPixel) const
-{
- SvLBoxEntry* pReturn = NULL;
- int nPos = getVisibleControlIndex();
- if ( nPos < E_ELEMENT_TYPE_COUNT )
- pReturn = m_pLists[nPos]->GetEntry( _aPosPixel,sal_True );
- return pReturn;
-}
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::createTablesPage(const Reference< XConnection>& _xConnection)
-{
- OSL_ENSURE(_xConnection.is(),"Connection is NULL! -> GPF");
-
- if ( !m_pLists[E_TABLE] )
- {
- OTableTreeListBox* pTreeView = new OTableTreeListBox(this
- ,getBorderWin().getView()->getORB()
- ,WB_HASLINES | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT | WB_TABSTOP
- ,sal_False);
- pTreeView->SetHelpId(HID_APP_TABLE_TREE);
- m_pLists[E_TABLE] = pTreeView;
-
- ImageProvider aImageProvider( _xConnection );
- createTree( pTreeView,
- aImageProvider.getDefaultImage( DatabaseObject::TABLE )
- );
-
- pTreeView->notifyHiContrastChanged();
- m_aBorder.SetZOrder(pTreeView, WINDOW_ZORDER_BEHIND);
- }
- if ( !m_pLists[E_TABLE]->GetEntryCount() )
- {
- static_cast<OTableTreeListBox*>(m_pLists[E_TABLE])->UpdateTableList(_xConnection);
-
- SvLBoxEntry* pEntry = m_pLists[E_TABLE]->First();
- if ( pEntry )
- m_pLists[E_TABLE]->Expand(pEntry);
- m_pLists[E_TABLE]->SelectAll(sal_False);
- }
-
- setDetailPage(m_pLists[E_TABLE]);
-}
-
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::getElementIcons( ElementType _eType, sal_uInt16& _rImageId)
-{
- ImageProvider aImageProvider;
- _rImageId = 0;
-
- sal_Int32 nDatabaseObjectType( 0 );
- switch(_eType )
- {
- case E_FORM: nDatabaseObjectType = DatabaseObject::FORM; break;
- case E_REPORT: nDatabaseObjectType = DatabaseObject::REPORT; break;
- case E_QUERY: nDatabaseObjectType = DatabaseObject::QUERY; break;
- default:
- OSL_FAIL( "OAppDetailPageHelper::GetElementIcons: invalid element type!" );
- return;
- }
- _rImageId = aImageProvider.getDefaultImageResourceID( nDatabaseObjectType );
-}
-
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::createPage(ElementType _eType,const Reference< XNameAccess >& _xContainer)
-{
- OSL_ENSURE(E_TABLE != _eType,"E_TABLE isn't allowed.");
-
- sal_uInt16 nImageId = 0;
- rtl::OString sHelpId;
- ImageProvider aImageProvider;
- Image aFolderImage;
- switch( _eType )
- {
- case E_FORM:
- sHelpId = HID_APP_FORM_TREE;
- aFolderImage = aImageProvider.getFolderImage( DatabaseObject::FORM );
- break;
- case E_REPORT:
- sHelpId = HID_APP_REPORT_TREE;
- aFolderImage = aImageProvider.getFolderImage( DatabaseObject::REPORT );
- break;
- case E_QUERY:
- sHelpId = HID_APP_QUERY_TREE;
- aFolderImage = aImageProvider.getFolderImage( DatabaseObject::QUERY );
- break;
- default:
- OSL_FAIL("Illegal call!");
- }
- getElementIcons( _eType, nImageId );
-
- if ( !m_pLists[_eType] )
- {
- m_pLists[_eType] = createSimpleTree( sHelpId, aFolderImage );
- }
-
- if ( m_pLists[_eType] )
- {
- if ( !m_pLists[_eType]->GetEntryCount() && _xContainer.is() )
- {
- fillNames( _xContainer, _eType, nImageId, NULL );
-
- m_pLists[_eType]->SelectAll(sal_False);
- }
- setDetailPage(m_pLists[_eType]);
- }
-}
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::setDetailPage(Window* _pWindow)
-{
- OSL_ENSURE(_pWindow,"OAppDetailPageHelper::setDetailPage: Window is NULL!");
- Window* pCurrent = getCurrentView();
- if ( pCurrent )
- pCurrent->Hide();
-
- showPreview(NULL);
- sal_Bool bHasFocus = sal_False;
- m_aFL.Show();
- {
- bHasFocus = pCurrent->HasChildPathFocus();
- _pWindow->Show();
- }
- m_aTBPreview.Show();
- m_aBorder.Show();
- switchPreview(m_ePreviewMode,sal_True);
-
- if ( bHasFocus )
- _pWindow->GrabFocus();
- Resize();
-}
-
-// -----------------------------------------------------------------------------
-namespace
-{
- namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject;
- namespace DatabaseObjectContainer = ::com::sun::star::sdb::application::DatabaseObjectContainer;
-
- static sal_Int32 lcl_getFolderIndicatorForType( const ElementType _eType )
- {
- const sal_Int32 nFolderIndicator =
- ( _eType == E_FORM ) ? DatabaseObjectContainer::FORMS_FOLDER
- : ( _eType == E_REPORT ) ? DatabaseObjectContainer::REPORTS_FOLDER : -1;
- return nFolderIndicator;
- }
-}
-
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::fillNames( const Reference< XNameAccess >& _xContainer, const ElementType _eType,
- const sal_uInt16 _nImageId, SvLBoxEntry* _pParent )
-{
- OSL_ENSURE(_xContainer.is(),"Data source is NULL! -> GPF");
- OSL_ENSURE( ( _eType >= E_TABLE ) && ( _eType < E_ELEMENT_TYPE_COUNT ), "OAppDetailPageHelper::fillNames: invalid type!" );
-
- DBTreeListBox* pList = m_pLists[ _eType ];
- OSL_ENSURE( pList, "OAppDetailPageHelper::fillNames: you really should create the list before calling this!" );
- if ( !pList )
- return;
-
- if ( _xContainer.is() && _xContainer->hasElements() )
- {
- const sal_Int32 nFolderIndicator = lcl_getFolderIndicatorForType( _eType );
-
- Sequence< ::rtl::OUString> aSeq = _xContainer->getElementNames();
- const ::rtl::OUString* pIter = aSeq.getConstArray();
- const ::rtl::OUString* pEnd = pIter + aSeq.getLength();
- for(;pIter != pEnd;++pIter)
- {
- SvLBoxEntry* pEntry = NULL;
- Reference<XNameAccess> xSubElements(_xContainer->getByName(*pIter),UNO_QUERY);
- if ( xSubElements.is() )
- {
- pEntry = pList->InsertEntry( *pIter, _pParent, sal_False, LIST_APPEND, reinterpret_cast< void* >( nFolderIndicator ) );
- getBorderWin().getView()->getAppController().containerFound( Reference< XContainer >( xSubElements, UNO_QUERY ) );
- fillNames( xSubElements, _eType, _nImageId, pEntry );
- }
- else
- {
- pEntry = pList->InsertEntry( *pIter, _pParent );
-
- Image aImage = Image( ModuleRes( _nImageId ) );
- pList->SetExpandedEntryBmp( pEntry, aImage );
- pList->SetCollapsedEntryBmp( pEntry, aImage );
- }
- }
- }
-}
-// -----------------------------------------------------------------------------
-DBTreeListBox* OAppDetailPageHelper::createSimpleTree( const rtl::OString& _sHelpId, const Image& _rImage)
-{
- DBTreeListBox* pTreeView = new DBTreeListBox(this,getBorderWin().getView()->getORB(),WB_HASLINES | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT | WB_TABSTOP);
- pTreeView->SetHelpId( _sHelpId );
- return createTree( pTreeView, _rImage );
-}
-
-// -----------------------------------------------------------------------------
-DBTreeListBox* OAppDetailPageHelper::createTree( DBTreeListBox* _pTreeView, const Image& _rImage )
-{
- WaitObject aWaitCursor(this);
-
- _pTreeView->SetStyle(_pTreeView->GetStyle() | WB_HASLINES | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT | WB_TABSTOP);
- _pTreeView->GetModel()->SetSortMode(SortAscending);
- _pTreeView->EnableCheckButton( NULL ); // do not show any buttons
- _pTreeView->SetSelectionMode(MULTIPLE_SELECTION);
-
- _pTreeView->SetDefaultCollapsedEntryBmp( _rImage );
- _pTreeView->SetDefaultExpandedEntryBmp( _rImage );
-
- _pTreeView->SetDoubleClickHdl(LINK(this, OAppDetailPageHelper, OnEntryDoubleClick));
- _pTreeView->SetEnterKeyHdl(LINK(this, OAppDetailPageHelper, OnEntryDoubleClick));
- _pTreeView->SetSelChangeHdl(LINK(this, OAppDetailPageHelper, OnEntrySelChange));
-
- _pTreeView->setCutHandler(LINK(this, OAppDetailPageHelper, OnCutEntry));
- _pTreeView->setCopyHandler(LINK(this, OAppDetailPageHelper, OnCopyEntry));
- _pTreeView->setPasteHandler(LINK(this, OAppDetailPageHelper, OnPasteEntry));
- _pTreeView->setDeleteHandler(LINK(this, OAppDetailPageHelper, OnDeleteEntry));
-
- _pTreeView->setControlActionListener( &getBorderWin().getView()->getAppController() );
- _pTreeView->setContextMenuProvider( &getBorderWin().getView()->getAppController() );
-
- return _pTreeView;
-}
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::clearPages()
-{
- showPreview(NULL);
- for (size_t i=0; i < E_ELEMENT_TYPE_COUNT; ++i)
- {
- if ( m_pLists[i] )
- m_pLists[i]->Clear();
- }
-}
-// -----------------------------------------------------------------------------
-sal_Bool OAppDetailPageHelper::isFilled() const
-{
- size_t i = 0;
- for (; i < E_ELEMENT_TYPE_COUNT && !m_pLists[i]; ++i)
- ;
- return i != E_ELEMENT_TYPE_COUNT;
-}
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::elementReplaced(ElementType _eType
- ,const ::rtl::OUString& _rOldName
- ,const ::rtl::OUString& _rNewName )
-{
- DBTreeListBox* pTreeView = getCurrentView();
- if ( pTreeView )
- {
- ::rtl::OUString sNewName = _rNewName;
- SvLBoxEntry* pEntry = NULL;
- switch( _eType )
- {
- case E_TABLE:
- static_cast<OTableTreeListBox*>(pTreeView)->removedTable( _rOldName );
- static_cast<OTableTreeListBox*>(pTreeView)->addedTable( _rNewName );
- return;
-
- case E_QUERY:
- pEntry = lcl_findEntry_impl(*pTreeView,_rOldName,pTreeView->First());
- break;
- case E_FORM:
- case E_REPORT:
- pEntry = lcl_findEntry(*pTreeView,_rOldName,pTreeView->First());
- break;
- default:
- OSL_FAIL("Invalid element type");
- }
- OSL_ENSURE(pEntry,"Do you know that the name isn't existence!");
- if ( pEntry )
- {
- pTreeView->SetEntryText(pEntry,sNewName);
- }
- }
-}
-// -----------------------------------------------------------------------------
-SvLBoxEntry* OAppDetailPageHelper::elementAdded(ElementType _eType,const ::rtl::OUString& _rName, const Any& _rObject )
-{
- SvLBoxEntry* pRet = NULL;
- DBTreeListBox* pTreeView = m_pLists[_eType];
- if( _eType == E_TABLE && pTreeView )
- {
- pRet = static_cast<OTableTreeListBox*>(pTreeView)->addedTable( _rName );
- }
- else if ( pTreeView )
- {
-
- SvLBoxEntry* pEntry = NULL;
- Reference<XChild> xChild(_rObject,UNO_QUERY);
- if ( xChild.is() && E_QUERY != _eType )
- {
- Reference<XContent> xContent(xChild->getParent(),UNO_QUERY);
- if ( xContent.is() )
- {
- ::rtl::OUString sName = xContent->getIdentifier()->getContentIdentifier();
- pEntry = lcl_findEntry(*pTreeView,sName,pTreeView->First());
- }
- }
-
- sal_uInt16 nImageId = 0;
- getElementIcons( _eType, nImageId );
- Reference<XNameAccess> xContainer(_rObject,UNO_QUERY);
- if ( xContainer.is() )
- {
- const sal_Int32 nFolderIndicator = lcl_getFolderIndicatorForType( _eType );
- pRet = pTreeView->InsertEntry( _rName, pEntry, sal_False, LIST_APPEND, reinterpret_cast< void* >( nFolderIndicator ) );
- fillNames( xContainer, _eType, nImageId, pRet );
- }
- else
- {
- pRet = pTreeView->InsertEntry( _rName, pEntry );
-
- Image aImage = Image( ModuleRes( nImageId ) );
- pTreeView->SetExpandedEntryBmp( pRet, aImage );
- pTreeView->SetCollapsedEntryBmp( pRet, aImage );
- }
- }
- return pRet;
-}
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::elementRemoved( ElementType _eType,const ::rtl::OUString& _rName )
-{
- DBTreeListBox* pTreeView = getCurrentView();
- if ( pTreeView )
- {
- switch( _eType )
- {
- case E_TABLE:
- // we don't need to clear the table here, it is already done by the dispose listener
- static_cast< OTableTreeListBox* >( pTreeView )->removedTable( _rName );
- break;
- case E_QUERY:
- if ( pTreeView )
- {
- SvLBoxEntry* pEntry = lcl_findEntry_impl(*pTreeView,_rName,pTreeView->First());
- if ( pEntry )
- pTreeView->GetModel()->Remove(pEntry);
- }
- break;
- case E_FORM:
- case E_REPORT:
- {
- if ( pTreeView )
- {
- SvLBoxEntry* pEntry = lcl_findEntry(*pTreeView,_rName,pTreeView->First());
- if ( pEntry )
- pTreeView->GetModel()->Remove(pEntry);
- }
- }
- break;
- default:
- OSL_FAIL("Invalid element type");
- }
- if ( !pTreeView->GetEntryCount() )
- showPreview(NULL);
- }
-}
-// -----------------------------------------------------------------------------
-IMPL_LINK(OAppDetailPageHelper, OnEntryDoubleClick, SvTreeListBox*, _pTree)
-{
- OSL_ENSURE( _pTree, "OAppDetailPageHelper, OnEntryDoubleClick: invalid callback!" );
- bool bHandled = ( _pTree != NULL ) && getBorderWin().getView()->getAppController().onEntryDoubleClick( *_pTree );
- return bHandled ? 1L : 0L;
-}
-// -----------------------------------------------------------------------------
-IMPL_LINK(OAppDetailPageHelper, OnEntrySelChange, void*, /*NOINTERESTEDIN*/)
-{
- getBorderWin().getView()->getAppController().onSelectionChanged();
- return 1L;
-}
-// -----------------------------------------------------------------------------
-IMPL_LINK( OAppDetailPageHelper, OnCutEntry, void*, /*NOINTERESTEDIN*/ )
-{
- getBorderWin().getView()->getAppController().onCutEntry();
- return 1L;
-}
-// -----------------------------------------------------------------------------
-IMPL_LINK( OAppDetailPageHelper, OnCopyEntry, void*, /*NOINTERESTEDIN*/ )
-{
- getBorderWin().getView()->getAppController().onCopyEntry();
- return 1L;
-}
-// -----------------------------------------------------------------------------
-IMPL_LINK( OAppDetailPageHelper, OnPasteEntry, void*, /*NOINTERESTEDIN*/ )
-{
- getBorderWin().getView()->getAppController().onPasteEntry();
- return 1L;
-}
-// -----------------------------------------------------------------------------
-IMPL_LINK( OAppDetailPageHelper, OnDeleteEntry, void*, /*NOINTERESTEDIN*/ )
-{
- getBorderWin().getView()->getAppController().onDeleteEntry();
- return 1L;
-}
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::Resize()
-{
- // parent window dimension
- Size aOutputSize( GetOutputSize() );
- long nOutputWidth = aOutputSize.Width();
- long nOutputHeight = aOutputSize.Height();
-
- Window* pWindow = getCurrentView();
- if ( pWindow )
- {
- Size aFLSize = LogicToPixel( Size( 2, 6 ), MAP_APPFONT );
- sal_Int32 n6PPT = aFLSize.Height();
- long nHalfOutputWidth = static_cast<long>(nOutputWidth * 0.5);
-
- pWindow->SetPosSizePixel( Point(0, 0), Size(nHalfOutputWidth - n6PPT, nOutputHeight) );
-
- m_aFL.SetPosSizePixel( Point(nHalfOutputWidth , 0 ), Size(aFLSize.Width(), nOutputHeight ) );
-
- String sText = m_aTBPreview.GetItemText(SID_DB_APP_DISABLE_PREVIEW);
- Size aTBSize = m_aTBPreview.CalcWindowSizePixel();
- m_aTBPreview.SetPosSizePixel(Point(nOutputWidth - aTBSize.getWidth(), 0 ),
- aTBSize );
-
- m_aBorder.SetPosSizePixel(Point(nHalfOutputWidth + aFLSize.Width() + n6PPT, aTBSize.getHeight() + n6PPT ),
- Size(nHalfOutputWidth - aFLSize.Width() - n6PPT, nOutputHeight - 2*n6PPT - aTBSize.getHeight()) );
- m_aPreview.SetPosSizePixel(Point(0,0),m_aBorder.GetSizePixel() );
- m_aDocumentInfo.SetPosSizePixel(Point(0,0),m_aBorder.GetSizePixel() );
- m_pTablePreview->SetPosSizePixel(Point(0,0),m_aBorder.GetSizePixel() );
- }
-}
-// -----------------------------------------------------------------------------
-PreviewMode OAppDetailPageHelper::getPreviewMode()
-{
- return m_ePreviewMode;
-}
-// -----------------------------------------------------------------------------
-sal_Bool OAppDetailPageHelper::isPreviewEnabled()
-{
- return m_ePreviewMode != E_PREVIEWNONE;
-}
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::switchPreview(PreviewMode _eMode,sal_Bool _bForce)
-{
- if ( m_ePreviewMode != _eMode || _bForce )
- {
- m_ePreviewMode = _eMode;
-
- getBorderWin().getView()->getAppController().previewChanged(static_cast<sal_Int32>(m_ePreviewMode));
-
- sal_uInt16 nSelectedAction = SID_DB_APP_DISABLE_PREVIEW;
- switch ( m_ePreviewMode )
- {
- case E_PREVIEWNONE:
- nSelectedAction = SID_DB_APP_DISABLE_PREVIEW;
- break;
- case E_DOCUMENT:
- nSelectedAction = SID_DB_APP_VIEW_DOC_PREVIEW;
- break;
- case E_DOCUMENTINFO:
- if ( getBorderWin().getView()->getAppController().isCommandEnabled(SID_DB_APP_VIEW_DOCINFO_PREVIEW) )
- nSelectedAction = SID_DB_APP_VIEW_DOCINFO_PREVIEW;
- else
- m_ePreviewMode = E_PREVIEWNONE;
- break;
- }
-
- m_aMenu->CheckItem(nSelectedAction);
- m_aTBPreview.SetItemText(SID_DB_APP_DISABLE_PREVIEW, m_aMenu->GetItemText(nSelectedAction));
- Resize();
-
- // simulate a selectionChanged event at the controller, to force the preview to be updated
- if ( isPreviewEnabled() )
- {
- if ( getCurrentView() && getCurrentView()->FirstSelected() )
- {
- getBorderWin().getView()->getAppController().onSelectionChanged();
- }
- }
- else
- {
- m_pTablePreview->Hide();
- m_aPreview.Hide();
- m_aDocumentInfo.Hide();
- }
- }
-}
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::showPreview(const Reference< XContent >& _xContent)
-{
- if ( isPreviewEnabled() )
- {
- m_pTablePreview->Hide();
-
- WaitObject aWaitCursor( this );
- try
- {
- Reference<XCommandProcessor> xContent(_xContent,UNO_QUERY);
- if ( xContent.is() )
- {
- com::sun::star::ucb::Command aCommand;
- if ( m_ePreviewMode == E_DOCUMENT )
- aCommand.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("preview"));
- else
- aCommand.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("getDocumentInfo"));
-
- Any aPreview = xContent->execute(aCommand,xContent->createCommandIdentifier(),Reference< XCommandEnvironment >());
- if ( m_ePreviewMode == E_DOCUMENT )
- {
- m_aDocumentInfo.Hide();
- m_aPreview.Show();
-
- Graphic aGraphic;
- Sequence < sal_Int8 > aBmpSequence;
- if ( aPreview >>= aBmpSequence )
- {
- SvMemoryStream aData( aBmpSequence.getArray(),
- aBmpSequence.getLength(),
- STREAM_READ );
-
- GraphicConverter::Import(aData,aGraphic);
- }
- m_aPreview.setGraphic( aGraphic );
- m_aPreview.Invalidate();
- }
- else
- {
- m_aPreview.Hide();
- m_aDocumentInfo.Clear();
- m_aDocumentInfo.Show();
- Reference<document::XDocumentProperties> xProp(
- aPreview, UNO_QUERY);
- if ( xProp.is() )
- m_aDocumentInfo.fill(xProp,String());
- }
- }
- else
- {
- m_aPreview.Hide();
- m_aDocumentInfo.Hide();
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-}
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::showPreview( const ::rtl::OUString& _sDataSourceName,
- const ::rtl::OUString& _sName,
- sal_Bool _bTable)
-{
- if ( isPreviewEnabled() )
- {
- WaitObject aWaitCursor( this );
- m_aPreview.Hide();
- m_aDocumentInfo.Hide();
- m_pTablePreview->Show();
- if ( !m_xFrame.is() )
- {
- try
- {
- m_xFrame = Reference < XFrame > ( getBorderWin().getView()->getORB()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Frame")) ), UNO_QUERY );
- m_xFrame->initialize( m_xWindow );
-
- // no layout manager (and thus no toolbars) in the preview
- // Must be called after initialize ... but before any other call to this frame.
- // Otherwise frame throws "life time exceptions" as e.g. NON_INITIALIZED
- Reference< XPropertySet > xFrameProps( m_xFrame, UNO_QUERY_THROW );
- xFrameProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ), makeAny(Reference< XLayoutManager >()) );
-
- Reference<XFramesSupplier> xSup(getBorderWin().getView()->getAppController().getXController()->getFrame(),UNO_QUERY);
- if ( xSup.is() )
- {
- Reference<XFrames> xFrames = xSup->getFrames();
- xFrames->append(m_xFrame);
- }
- }
- catch(const Exception&)
- {
- }
- }
-
- Reference< XDatabaseDocumentUI > xApplication( getBorderWin().getView()->getAppController().getXController(), UNO_QUERY );
- ::std::auto_ptr< DatabaseObjectView > pDispatcher( new ResultSetBrowser(
- getBorderWin().getView()->getORB(), xApplication, NULL, _bTable
- ) );
- pDispatcher->setTargetFrame( m_xFrame );
-
- ::comphelper::NamedValueCollection aArgs;
- aArgs.put( "Preview", sal_True );
- aArgs.put( "ReadOnly", sal_True );
- aArgs.put( "AsTemplate", sal_False );
- aArgs.put( (::rtl::OUString)PROPERTY_SHOWMENU, sal_False );
-
- Reference< XController > xPreview( pDispatcher->openExisting( makeAny( _sDataSourceName ), _sName, aArgs ), UNO_QUERY );
- sal_Bool bClearPreview = !xPreview.is();
-
- // clear the preview when the query or table could not be loaded
- if ( !bClearPreview )
- {
- Reference< XTabController > xTabController( xPreview, UNO_QUERY );
- bClearPreview = !xTabController.is();
- if ( !bClearPreview )
- {
- Reference< XLoadable > xLoadable( xTabController->getModel(), UNO_QUERY );
- bClearPreview = !( xLoadable.is() && xLoadable->isLoaded() );
- }
- }
- if ( bClearPreview )
- showPreview(NULL);
- }
-}
-// -----------------------------------------------------------------------------
-IMPL_LINK(OAppDetailPageHelper, OnDropdownClickHdl, ToolBox*, /*pToolBox*/)
-{
- m_aTBPreview.EndSelection();
-
- // tell the toolbox that the item is pressed down
- m_aTBPreview.SetItemDown( SID_DB_APP_DISABLE_PREVIEW, sal_True );
-
- // simulate a mouse move (so the "down" state is really painted)
- Point aPoint = m_aTBPreview.GetItemRect( SID_DB_APP_DISABLE_PREVIEW ).TopLeft();
- MouseEvent aMove( aPoint, 0, MOUSE_SIMPLEMOVE | MOUSE_SYNTHETIC );
- m_aTBPreview.MouseMove( aMove );
-
- m_aTBPreview.Update();
-
- // execute the menu
- ::std::auto_ptr<PopupMenu> aMenu(new PopupMenu( ModuleRes( RID_MENU_APP_PREVIEW ) ));
-
- sal_uInt16 pActions[] = { SID_DB_APP_DISABLE_PREVIEW
- , SID_DB_APP_VIEW_DOC_PREVIEW
- , SID_DB_APP_VIEW_DOCINFO_PREVIEW
- };
-
- for(size_t i=0; i < SAL_N_ELEMENTS(pActions);++i)
- {
- aMenu->CheckItem(pActions[i],m_aMenu->IsItemChecked(pActions[i]));
- }
- aMenu->EnableItem( SID_DB_APP_VIEW_DOCINFO_PREVIEW, getBorderWin().getView()->getAppController().isCommandEnabled(SID_DB_APP_VIEW_DOCINFO_PREVIEW) );
-
- // no disabled entries
- aMenu->RemoveDisabledEntries();
-
- sal_uInt16 nSelectedAction = aMenu->Execute(&m_aTBPreview, m_aTBPreview.GetItemRect( SID_DB_APP_DISABLE_PREVIEW ));
- // "cleanup" the toolbox state
- MouseEvent aLeave( aPoint, 0, MOUSE_LEAVEWINDOW | MOUSE_SYNTHETIC );
- m_aTBPreview.MouseMove( aLeave );
- m_aTBPreview.SetItemDown( SID_DB_APP_DISABLE_PREVIEW, sal_False);
- if ( nSelectedAction )
- {
- m_aTBPreview.SetItemText(SID_DB_APP_DISABLE_PREVIEW, aMenu->GetItemText(nSelectedAction));
- Resize();
- getBorderWin().getView()->getAppController().executeChecked(nSelectedAction,Sequence<PropertyValue>());
- }
- return 0L;
-}
-
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::KeyInput( const KeyEvent& rKEvt )
-{
- SvTreeListBox* pCurrentView = getCurrentView();
- OSL_PRECOND( pCurrentView, "OAppDetailPageHelper::KeyInput: how this?" );
-
- KeyFuncType eFunc = rKEvt.GetKeyCode().GetFunction(); (void)eFunc;
- sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
-
- if ( ( KEY_RETURN == nCode ) && pCurrentView )
- {
- getBorderWin().getView()->getAppController().onEntryDoubleClick( *pCurrentView );
- }
- else
- Window::KeyInput(rKEvt);
-}
-
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::DataChanged( const DataChangedEvent& rDCEvt )
-{
- Window::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
- (rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
- (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
- ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
- (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
-
- {
- ImplInitSettings();
- if ( m_pLists[ E_TABLE ] )
- {
- OTableTreeListBox* pTableTree = dynamic_cast< OTableTreeListBox* >( m_pLists[ E_TABLE ] );
- OSL_ENSURE( pTableTree != NULL, "OAppDetailPageHelper::DataChanged: a tree list for tables which is no TableTreeList?" );
- if ( pTableTree )
- pTableTree->notifyHiContrastChanged();
- }
- }
-}
-// -----------------------------------------------------------------------------
-void OAppDetailPageHelper::ImplInitSettings()
-{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- Font aFont;
- aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont( aFont );
- m_aTBPreview.SetPointFont( aFont );
-
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
- m_aBorder.SetTextColor( rStyleSettings.GetFieldTextColor() );
- m_aBorder.SetTextFillColor();
- m_aTBPreview.SetTextColor( rStyleSettings.GetFieldTextColor() );
- m_aTBPreview.SetTextFillColor();
-
- SetBackground( rStyleSettings.GetFieldColor() );
- m_aBorder.SetBackground( rStyleSettings.GetFieldColor() );
- m_aFL.SetBackground( rStyleSettings.GetFieldColor() );
- m_aDocumentInfo.SetBackground( rStyleSettings.GetFieldColor() );
- m_aTBPreview.SetBackground( rStyleSettings.GetFieldColor() );
- m_pTablePreview->SetBackground( rStyleSettings.GetFieldColor() );
-}
-// -----------------------------------------------------------------------------
-OPreviewWindow::OPreviewWindow(Window* _pParent)
-: Window(_pParent)
-{
- ImplInitSettings( sal_True, sal_True, sal_True );
-}
-// -----------------------------------------------------------------------------
-sal_Bool OPreviewWindow::ImplGetGraphicCenterRect( const Graphic& rGraphic, Rectangle& rResultRect ) const
-{
- const Size aWinSize( GetOutputSizePixel() );
- Size aNewSize( LogicToPixel( rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode() ) );
- sal_Bool bRet = sal_False;
-
- if( aNewSize.Width() && aNewSize.Height() )
- {
- // scale to fit window
- const double fGrfWH = (double) aNewSize.Width() / aNewSize.Height();
- const double fWinWH = (double) aWinSize.Width() / aWinSize.Height();
-
- if ( fGrfWH < fWinWH )
- {
- aNewSize.Width() = (long) ( aWinSize.Height() * fGrfWH );
- aNewSize.Height()= aWinSize.Height();
- }
- else
- {
- aNewSize.Width() = aWinSize.Width();
- aNewSize.Height()= (long) ( aWinSize.Width() / fGrfWH);
- }
-
- const Point aNewPos( ( aWinSize.Width() - aNewSize.Width() ) >> 1,
- ( aWinSize.Height() - aNewSize.Height() ) >> 1 );
-
- rResultRect = Rectangle( aNewPos, aNewSize );
- bRet = sal_True;
- }
-
- return bRet;
-}
-
-// ------------------------------------------------------------------------
-
-void OPreviewWindow::Paint( const Rectangle& rRect )
-{
- Window::Paint( rRect );
-
- if( ImplGetGraphicCenterRect( m_aGraphicObj.GetGraphic(), m_aPreviewRect ) )
- {
- const Point aPos( m_aPreviewRect.TopLeft() );
- const Size aSize( m_aPreviewRect.GetSize() );
-
- if( m_aGraphicObj.IsAnimated() )
- m_aGraphicObj.StartAnimation( this, aPos, aSize );
- else
- m_aGraphicObj.Draw( this, aPos, aSize );
- }
-}
-// -----------------------------------------------------------------------------
-void OPreviewWindow::DataChanged( const DataChangedEvent& rDCEvt )
-{
- Window::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
- (rDCEvt.GetFlags() & SETTINGS_STYLE) )
- {
- ImplInitSettings( sal_True, sal_True, sal_True );
- Invalidate();
- }
-}
-// -----------------------------------------------------------------------------
-void OPreviewWindow::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground )
-{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- if( bFont )
- {
- Font aFont;
- aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont( aFont );
- }
-
- if( bForeground || bFont )
- {
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
- }
-
- if( bBackground )
- SetBackground( rStyleSettings.GetFieldColor() );
-}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.hxx b/dbaccess/source/ui/app/AppDetailPageHelper.hxx
deleted file mode 100644
index 67c426cde..000000000
--- a/dbaccess/source/ui/app/AppDetailPageHelper.hxx
+++ /dev/null
@@ -1,374 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef DBAUI_APPDETAILPAGEHELPER_HXX
-#define DBAUI_APPDETAILPAGEHELPER_HXX
-
-#include <vector>
-
-#include <rtl/ustring.hxx>
-#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
-#include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
-#include <com/sun/star/ucb/XContent.hpp>
-#include "AppElementType.hxx"
-#include <svtools/svtreebx.hxx>
-#include <svtools/DocumentInfoPreview.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/toolbox.hxx>
-#include <vcl/cvtgrf.hxx>
-#include <vcl/graph.hxx>
-#include <svtools/grfmgr.hxx>
-#include "callbacks.hxx"
-#include <memory>
-
-namespace com{ namespace sun { namespace star { namespace awt { class XWindow; } } } }
-namespace com{ namespace sun { namespace star { namespace frame { class XFrame; } } } }
-namespace com{ namespace sun { namespace star { namespace io { class XPersist; } } } }
-
-#define ELEMENT_COUNT size_t(E_ELEMENT_TYPE_COUNT)
-
-namespace dbaui
-{
- class OAppBorderWindow;
- class DBTreeListBox;
-
- class OPreviewWindow : public Window
- {
- GraphicObject m_aGraphicObj;
- Rectangle m_aPreviewRect;
-
- /** gets the graphic cnter rect
- @param rGraphic
- the graphic
- @param rResultRect
- the resulting rectangle
-
- @return
- <TRUE/> when successfull
- */
- sal_Bool ImplGetGraphicCenterRect( const Graphic& rGraphic, Rectangle& rResultRect ) const;
- void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
- protected:
- virtual void DataChanged(const DataChangedEvent& rDCEvt);
- public:
- OPreviewWindow(Window* _pParent);
-
- // window overloads
- virtual void Paint(const Rectangle& rRect);
-
- void setGraphic(const Graphic& _rGraphic ) { m_aGraphicObj.SetGraphic(_rGraphic); }
- };
- //==================================================================
- // A helper class for the controls in the detail page.
- // Combines general functionality.
- //==================================================================
- class OAppDetailPageHelper : public Window
- {
- DBTreeListBox* m_pLists[ELEMENT_COUNT];
- OAppBorderWindow& m_rBorderWin;
- FixedLine m_aFL;
- ToolBox m_aTBPreview;
- Window m_aBorder;
- OPreviewWindow m_aPreview;
- ::svtools::ODocumentInfoPreview
- m_aDocumentInfo;
- Window* m_pTablePreview;
- ::std::auto_ptr<PopupMenu> m_aMenu;
- PreviewMode m_ePreviewMode;
- ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame >
- m_xFrame;
- ::com::sun::star::uno::Reference < ::com::sun::star::io::XPersist >
- m_xDocInfo;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
- m_xWindow;
-
- /// returns the index of the visible control
- int getVisibleControlIndex() const;
-
- /** sorts the entries in the tree list box.
- @param _nPos
- Which list should be sorted.
- @param _eSortMode
- How should be sorted.
- */
- void sort(int _nPos,SvSortMode _eSortMode );
-
- /** retrieves the resource ids of the images representing elements of the given type
- */
- void getElementIcons( ElementType _eType, sal_uInt16& _rImageId);
-
- /** fills the names in the listbox
- @param _xContainer
- This can either be the queries, forms or report names.
- @param _eType
- the type of elements which are being filled
- @param _nImageId
- the resource id of the image to use for non-container entries
- @param _pParent
- The parent of the entries to be inserted.
- */
- void fillNames( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xContainer,
- const ElementType _eType,
- const sal_uInt16 _nImageId,
- SvLBoxEntry* _pParent );
-
- /** sets the detail page
- @param _pWindow
- The control which should be visible.
- */
- void setDetailPage(Window* _pWindow);
-
- /** sets all HandleCallbacks
- @param _pTreeView
- The newly created DBTreeListBox
- @param _rImage
- the resource id of the default icon
- @return
- The new tree.
- */
- DBTreeListBox* createTree( DBTreeListBox* _pTreeView, const Image& _rImage );
-
- /** creates the tree and sets all HandleCallbacks
- @param _nHelpId
- The help id of the control
- @param _nCollapsedBitmap
- The image to use in high contrast mode.
- @return
- The new tree.
- */
- DBTreeListBox* createSimpleTree( const rtl::OString& _sHelpId, const Image& _rImage);
-
- DECL_LINK( OnEntryDoubleClick, SvTreeListBox* );
- DECL_LINK( OnEntrySelChange, void* );
-
- DECL_LINK( OnCutEntry, void* );
- DECL_LINK( OnCopyEntry, void* );
- DECL_LINK( OnPasteEntry, void* );
- DECL_LINK( OnDeleteEntry, void* );
-
- DECL_LINK(PreviewChangeHdl, void*);
- // click a TB slot
- DECL_LINK(OnDropdownClickHdl, ToolBox*);
-
- inline OAppBorderWindow& getBorderWin() const { return m_rBorderWin; }
- void ImplInitSettings();
-
- public:
- OAppDetailPageHelper(Window* _pParent,OAppBorderWindow& _rBorderWin,PreviewMode _ePreviewMode);
- virtual ~OAppDetailPageHelper();
-
- // window overloads
- virtual void Resize();
- virtual void KeyInput( const KeyEvent& rKEvt );
-
- sal_Bool isCutAllowed();
- sal_Bool isCopyAllowed();
- sal_Bool isPasteAllowed();
- void copy();
- void cut();
- void paste();
-
- /** creates the tables page
- @param _xConnection
- The connection to get the table names
- */
- void createTablesPage(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection);
-
- /** creates the page for the specific type.
- @param _eType
- The type which should be created. E_TABLE isn't allowed.
- @param _xContainer
- The container of the elements to be inserted.
- */
- void createPage(ElementType _eType,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xContainer);
-
- /** returns the current visible tree list box
- */
- inline DBTreeListBox* getCurrentView() const
- {
- ElementType eType = getElementType();
- return (eType != E_NONE ) ? m_pLists[static_cast<sal_Int32>(eType)] : NULL;
- }
-
- /// select all entries in the visible control
- void selectAll();
-
- /// returns <TRUE/> if it sorts ascending
- sal_Bool isSortUp() const;
-
- /// sorts all entries ascending
- void sortDown();
-
- /// sorts all entries descending
- void sortUp();
-
- /** returns the element names which are selected
- @param _rNames
- The list will be filled.
- */
- void getSelectionElementNames( ::std::vector< ::rtl::OUString>& _rNames ) const;
-
- /** describes the current selection for the given control
- */
- void describeCurrentSelectionForControl(
- const Control& _rControl,
- ::com::sun::star::uno::Sequence< ::com::sun::star::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
- );
-
- /** describes the current selection for the given ElementType
- */
- void describeCurrentSelectionForType(
- const ElementType _eType,
- ::com::sun::star::uno::Sequence< ::com::sun::star::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
- );
-
- /** select all names on the currently selected container. Non existence names where ignored.
- *
- * \param _aNames the element names
- */
- void selectElements(const ::com::sun::star::uno::Sequence< ::rtl::OUString>& _aNames);
-
- /** return the qualified name.
- @param _pEntry
- The entry of a table, or query, form, report to get the qualified name.
- If the entry is <NULL/>, the first selected is chosen.
- @return
- the qualified name
- */
- ::rtl::OUString getQualifiedName( SvLBoxEntry* _pEntry ) const;
-
- /// return the element of currently select entry
- ElementType getElementType() const;
-
- /// returns the count of selected entries
- sal_Int32 getSelectionCount();
-
- /// returns the count of entries
- sal_Int32 getElementCount();
-
- /** returns if an entry is a leaf
- @param _pEntry
- The entry to check
- @return
- <TRUE/> if the entry is a leaf, otherwise <FALSE/>
- */
- bool isLeaf(SvLBoxEntry* _pEntry) const;
-
- /** returns if one of the selected entries is a leaf
- @return
- <TRUE/> if the entry is a leaf, otherwise <FALSE/>
- */
- sal_Bool isALeafSelected() const;
-
- SvLBoxEntry* getEntry( const Point& _aPosPixel ) const;
-
- /// clears the detail pages
- void clearPages();
-
- /// returns <TRUE/> when a detail page was filled
- sal_Bool isFilled() const;
-
- /** adds a new object to the detail page.
- @param _eType
- The type where the entry shold be appended.
- @param _rName
- The name of the object to be inserted
- @param _rObject
- The object to add.
- @param _rxConn
- If we insert a table, the connection must be set.
- */
- SvLBoxEntry* elementAdded(ElementType eType
- ,const ::rtl::OUString& _rName
- ,const ::com::sun::star::uno::Any& _rObject );
-
- /** replaces a objects name with a new one
- @param _eType
- The type where the entry shold be appended.
- @param _rOldName
- The old name of the object to be replaced
- @param _rNewName
- The new name of the object to be replaced
- @param _rxConn
- If we insert a table, the connection must be set.
- */
- void elementReplaced(ElementType eType
- ,const ::rtl::OUString& _rOldName
- ,const ::rtl::OUString& _rNewName );
-
- /** removes an element from the detail page.
- @param _eType
- The type where the entry shold be appended.
- @param _rName
- The name of the element to be removed.
- @param _rxConn
- If we remove a table, the connection must be set.
- */
- void elementRemoved(ElementType _eType
- ,const ::rtl::OUString& _rName );
-
-
- /// returns the preview mode
- PreviewMode getPreviewMode();
-
- /// <TRUE/> if the preview is enabled
- sal_Bool isPreviewEnabled();
-
- /** switches to the given preview mode
- @param _eMode
- the mode to set for the preview
- @param _bForce
- Force the preview to be resetted
- */
- void switchPreview(PreviewMode _eMode,sal_Bool _bForce = sal_False);
-
- /** shows the Preview of the content when it is enabled.
- @param _xContent
- The content which must support the "preview" command.
- */
- void showPreview(const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& _xContent);
-
- /** shows the Preview of a table or query
- @param _sDataSourceName
- the name of the data source
- @param _sName
- the name of table or query
- @param _bTable
- <TRUE/> if it is a table, otherwise <FALSE/>
- @return void
- */
- void showPreview( const ::rtl::OUString& _sDataSourceName,
- const ::rtl::OUString& _sName,
- sal_Bool _bTable);
-
- protected:
- void DataChanged( const DataChangedEvent& rDCEvt );
- };
-}
-#endif // DBAUI_APPDETAILPAGEHELPER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx
deleted file mode 100644
index 21fe3cab5..000000000
--- a/dbaccess/source/ui/app/AppDetailView.cxx
+++ /dev/null
@@ -1,963 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_dbaccess.hxx"
-#include "AppDetailView.hxx"
-#include <osl/diagnose.h>
-#include "dbaccess_helpid.hrc"
-#include "dbu_app.hrc"
-#include "AppView.hxx"
-#include <com/sun/star/ui/XUIConfigurationManager.hpp>
-#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
-#include <com/sun/star/ui/XImageManager.hpp>
-#include <com/sun/star/ui/ImageType.hpp>
-#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
-#include <com/sun/star/graphic/XGraphic.hpp>
-#include <com/sun/star/util/URL.hpp>
-#include "listviewitems.hxx"
-#include <vcl/image.hxx>
-#include <vcl/mnemonic.hxx>
-#include <vcl/mnemonic.hxx>
-#include "browserids.hxx"
-#include "AppDetailPageHelper.hxx"
-#include <vcl/svapp.hxx>
-#include "callbacks.hxx"
-#include "IController.hxx"
-#include "moduledbu.hxx"
-#include <svtools/localresaccess.hxx>
-#include <algorithm>
-#include "dbtreelistbox.hxx"
-#include "IApplicationController.hxx"
-#include "imageprovider.hxx"
-
-using namespace ::dbaui;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::ucb;
-using namespace ::com::sun::star::graphic;
-using namespace ::com::sun::star::ui;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::beans;
-using ::com::sun::star::util::URL;
-using ::com::sun::star::sdb::application::NamedDatabaseObject;
-
-#define SPACEBETWEENENTRIES 4
-
-// -----------------------------------------------------------------------------
-TaskEntry::TaskEntry( const sal_Char* _pAsciiUNOCommand, sal_uInt16 _nHelpID, sal_uInt16 _nTitleResourceID, bool _bHideWhenDisabled )
- :sUNOCommand( ::rtl::OUString::createFromAscii( _pAsciiUNOCommand ) )
- ,nHelpID( _nHelpID )
- ,sTitle( ModuleRes( _nTitleResourceID ) )
- ,bHideWhenDisabled( _bHideWhenDisabled )
-{
-}
-
-// -----------------------------------------------------------------------------
-OCreationList::OCreationList( OTasksWindow& _rParent )
- :SvTreeListBox( &_rParent, WB_TABSTOP | WB_HASBUTTONSATROOT | WB_HASBUTTONS )
- ,m_rTaskWindow( _rParent )
- ,m_pMouseDownEntry( NULL )
- ,m_pLastActiveEntry( NULL )
-{
- sal_uInt16 nSize = SPACEBETWEENENTRIES;
- SetSpaceBetweenEntries(nSize);
- SetSelectionMode( NO_SELECTION );
- SetExtendedWinBits( EWB_NO_AUTO_CURENTRY );
- SetNodeDefaultImages( );
- EnableEntryMnemonics();
-}
-// -----------------------------------------------------------------------------
-void OCreationList::Paint( const Rectangle& _rRect )
-{
- if ( m_pMouseDownEntry )
- m_aOriginalFont = GetFont();
-
- m_aOriginalBackgroundColor = GetBackground().GetColor();
- SvTreeListBox::Paint( _rRect );
- SetBackground( m_aOriginalBackgroundColor );
-
- if ( m_pMouseDownEntry )
- Control::SetFont( m_aOriginalFont );
-}
-
-// -----------------------------------------------------------------------------
-void OCreationList::PreparePaint( SvLBoxEntry* _pEntry )
-{
- Wallpaper aEntryBackground( m_aOriginalBackgroundColor );
- if ( _pEntry )
- {
- if ( _pEntry == GetCurEntry() )
- {
- // draw a selection background
- bool bIsMouseDownEntry = ( _pEntry == m_pMouseDownEntry );
- DrawSelectionBackground( GetBoundingRect( _pEntry ), bIsMouseDownEntry ? 1 : 2, sal_False, sal_True, sal_False );
-
- if ( bIsMouseDownEntry )
- {
- Font aFont( GetFont() );
- aFont.SetColor( GetSettings().GetStyleSettings().GetHighlightTextColor() );
- Control::SetFont( aFont );
- }
-
- // and temporary set a transparent background, for all the other
- // paint operations the SvTreeListBox is going to do
- aEntryBackground = Wallpaper( Color( COL_TRANSPARENT ) );
- }
- }
-
- SetBackground( aEntryBackground );
-}
-
-// -----------------------------------------------------------------------------
-void OCreationList::SelectSearchEntry( const void* _pEntry )
-{
- SvLBoxEntry* pEntry = const_cast< SvLBoxEntry* >( static_cast< const SvLBoxEntry* >( _pEntry ) );
- OSL_ENSURE( pEntry, "OCreationList::SelectSearchEntry: invalid entry!" );
-
- if ( pEntry )
- setCurrentEntryInvalidate( pEntry );
-
- if ( !HasChildPathFocus() )
- GrabFocus();
-}
-
-// -----------------------------------------------------------------------------
-void OCreationList::ExecuteSearchEntry( const void* _pEntry ) const
-{
- SvLBoxEntry* pEntry = const_cast< SvLBoxEntry* >( static_cast< const SvLBoxEntry* >( _pEntry ) );
- OSL_ENSURE( pEntry, "OCreationList::ExecuteSearchEntry: invalid entry!" );
- OSL_ENSURE( pEntry == GetCurEntry(), "OCreationList::ExecuteSearchEntry: SelectSearchEntry should have been called before!" );
-
- if ( pEntry )
- onSelected( pEntry );
-}
-
-// -----------------------------------------------------------------------------
-Rectangle OCreationList::GetFocusRect( SvLBoxEntry* _pEntry, long _nLine )
-{
- Rectangle aRect = SvTreeListBox::GetFocusRect( _pEntry, _nLine );
- aRect.Left() = 0;
-
- // try to let the focus rect start before the bitmap item - this looks better
- SvLBoxItem* pBitmapItem = _pEntry->GetFirstItem( SV_ITEM_ID_LBOXCONTEXTBMP );
- SvLBoxTab* pTab = pBitmapItem ? GetTab( _pEntry, pBitmapItem ) : NULL;
- SvViewDataItem* pItemData = pBitmapItem ? GetViewDataItem( _pEntry, pBitmapItem ) : NULL;
- OSL_ENSURE( pTab && pItemData, "OCreationList::GetFocusRect: could not find the first bitmap item!" );
- if ( pTab && pItemData )
- aRect.Left() = pTab->GetPos() - pItemData->aSize.Width() / 2;
-
- // inflate the rectangle a little bit - looks better, too
- aRect.Left() = ::std::max< long >( 0, aRect.Left() - 2 );
- aRect.Right() = ::std::min< long >( GetOutputSizePixel().Width() - 1, aRect.Right() + 2 );
-
- return aRect;
-}
-// -----------------------------------------------------------------------------
-void OCreationList::StartDrag( sal_Int8 /*_nAction*/, const Point& /*_rPosPixel*/ )
-{
- // don't give this to the base class, it does a ReleaseMouse as very first action
- // Though I think this is a bug (it should ReleaseMouse only if it is going to do
- // something with the drag-event), I hesitate to fix it in the current state,
- // since I don't overlook the consequences, and we're close to 2.0 ...)
-}
-// -----------------------------------------------------------------------------
-void OCreationList::ModelHasCleared()
-{
- SvTreeListBox::ModelHasCleared();
- m_pLastActiveEntry = NULL;
- m_pMouseDownEntry = NULL;
-}
-// -----------------------------------------------------------------------------
-void OCreationList::GetFocus()
-{
- SvTreeListBox::GetFocus();
- if ( !GetCurEntry() )
- setCurrentEntryInvalidate( m_pLastActiveEntry ? m_pLastActiveEntry : GetFirstEntryInView() );
-}
-// -----------------------------------------------------------------------------
-void OCreationList::LoseFocus()
-{
- SvTreeListBox::LoseFocus();
- m_pLastActiveEntry = GetCurEntry();
- setCurrentEntryInvalidate( NULL );
-}
-// -----------------------------------------------------------------------------
-void OCreationList::MouseButtonDown( const MouseEvent& rMEvt )
-{
- SvTreeListBox::MouseButtonDown( rMEvt );
-
- OSL_ENSURE( !m_pMouseDownEntry, "OCreationList::MouseButtonDown: I missed some mouse event!" );
- m_pMouseDownEntry = GetCurEntry();
- if ( m_pMouseDownEntry )
- {
- InvalidateEntry( m_pMouseDownEntry );
- CaptureMouse();
- }
-}
-// -----------------------------------------------------------------------------
-void OCreationList::MouseMove( const MouseEvent& rMEvt )
-{
- if ( rMEvt.IsLeaveWindow() )
- {
- setCurrentEntryInvalidate( NULL );
- }
- else if ( !rMEvt.IsSynthetic() )
- {
- SvLBoxEntry* pEntry = GetEntry( rMEvt.GetPosPixel() );
-
- if ( m_pMouseDownEntry )
- {
- // we're currently in a "mouse down" phase
- OSL_ENSURE( IsMouseCaptured(), "OCreationList::MouseMove: inconsistence (1)!" );
- if ( pEntry == m_pMouseDownEntry )
- {
- setCurrentEntryInvalidate( m_pMouseDownEntry );
- }
- else
- {
- OSL_ENSURE( ( GetCurEntry() == m_pMouseDownEntry ) || !GetCurEntry(),
- "OCreationList::MouseMove: inconsistence (2)!" );
- setCurrentEntryInvalidate( NULL );
- }
- }
- else
- {
- // the user is simply hovering with the mouse
- if ( setCurrentEntryInvalidate( pEntry ) )
- {
- if ( !m_pMouseDownEntry )
- updateHelpText();
- }
- }
- }
-
- SvTreeListBox::MouseMove(rMEvt);
-}
-// -----------------------------------------------------------------------------
-void OCreationList::MouseButtonUp( const MouseEvent& rMEvt )
-{
- SvLBoxEntry* pEntry = GetEntry( rMEvt.GetPosPixel() );
- bool bExecute = false;
- // Was the mouse released over the active entry?
- // (i.e. the entry which was under the mouse when the button went down)
- if ( pEntry && ( m_pMouseDownEntry == pEntry ) )
- {
- if ( !rMEvt.IsShift() && !rMEvt.IsMod1() && !rMEvt.IsMod2() && rMEvt.IsLeft() && rMEvt.GetClicks() == 1 )
- bExecute = true;
- }
-
- if ( m_pMouseDownEntry )
- {
- OSL_ENSURE( IsMouseCaptured(), "OCreationList::MouseButtonUp: hmmm .... no mouse captured, but an active entry?" );
- ReleaseMouse();
-
- InvalidateEntry( m_pMouseDownEntry );
- m_pMouseDownEntry = NULL;
- }
-
- SvTreeListBox::MouseButtonUp( rMEvt );
-
- if ( bExecute )
- onSelected( pEntry );
-}
-// -----------------------------------------------------------------------------
-bool OCreationList::setCurrentEntryInvalidate( SvLBoxEntry* _pEntry )
-{
- if ( GetCurEntry() != _pEntry )
- {
- if ( GetCurEntry() )
- InvalidateEntry( GetCurEntry() );
- SetCurEntry( _pEntry );
- if ( GetCurEntry() )
- {
- InvalidateEntry( GetCurEntry() );
- CallEventListeners( VCLEVENT_LISTBOX_SELECT, GetCurEntry() );
- }
- updateHelpText();
- return true;
- }
- return false;
-}
-// -----------------------------------------------------------------------------
-void OCreationList::updateHelpText()
-{
- sal_uInt16 nHelpTextId = 0;
- if ( GetCurEntry() )
- nHelpTextId = reinterpret_cast< TaskEntry* >( GetCurEntry()->GetUserData() )->nHelpID;
- m_rTaskWindow.setHelpText( nHelpTextId );
-}
-// -----------------------------------------------------------------------------
-void OCreationList::onSelected( SvLBoxEntry* _pEntry ) const
-{
- OSL_ENSURE( _pEntry, "OCreationList::onSelected: invalid entry!" );
- URL aCommand;
- aCommand.Complete = reinterpret_cast< TaskEntry* >( _pEntry->GetUserData() )->sUNOCommand;
- m_rTaskWindow.getDetailView()->getBorderWin().getView()->getAppController().executeChecked( aCommand, Sequence< PropertyValue >() );
-}
-// -----------------------------------------------------------------------------
-void OCreationList::KeyInput( const KeyEvent& rKEvt )
-{
- const KeyCode& rCode = rKEvt.GetKeyCode();
- if ( !rCode.IsMod1() && !rCode.IsMod2() && !rCode.IsShift() )
- {
- if ( rCode.GetCode() == KEY_RETURN )
- {
- SvLBoxEntry* pEntry = GetCurEntry() ? GetCurEntry() : FirstSelected();
- if ( pEntry )
- onSelected( pEntry );
- return;
- }
- }
- SvLBoxEntry* pOldCurrent = GetCurEntry();
- SvTreeListBox::KeyInput(rKEvt);
- SvLBoxEntry* pNewCurrent = GetCurEntry();
-
- if ( pOldCurrent != pNewCurrent )
- {
- if ( pOldCurrent )
- InvalidateEntry( pOldCurrent );
- if ( pNewCurrent )
- {
- InvalidateEntry( pNewCurrent );
- CallEventListeners( VCLEVENT_LISTBOX_SELECT, pNewCurrent );
- }
- updateHelpText();
- }
-}
-// -----------------------------------------------------------------------------
-DBG_NAME(OTasksWindow)
-OTasksWindow::OTasksWindow(Window* _pParent,OApplicationDetailView* _pDetailView)
- : Window(_pParent,WB_DIALOGCONTROL )
- ,m_aCreation(*this)
- ,m_aDescription(this)
- ,m_aHelpText(this,WB_WORDBREAK)
- ,m_aFL(this,WB_VERT)
- ,m_pDetailView(_pDetailView)
-{
- DBG_CTOR(OTasksWindow,NULL);
- SetUniqueId(UID_APP_TASKS_WINDOW);
- m_aCreation.SetHelpId(HID_APP_CREATION_LIST);
- m_aCreation.SetSelectHdl(LINK(this, OTasksWindow, OnEntrySelectHdl));
- m_aHelpText.SetHelpId(HID_APP_HELP_TEXT);
- m_aDescription.SetHelpId(HID_APP_DESCRIPTION_TEXT);
- m_aDescription.SetText(ModuleRes(STR_DESCRIPTION));
-
- ImageProvider aImageProvider;
- Image aFolderImage = aImageProvider.getFolderImage( DatabaseObject::FORM );
- m_aCreation.SetDefaultCollapsedEntryBmp( aFolderImage );
- m_aCreation.SetDefaultExpandedEntryBmp( aFolderImage );
-
- ImplInitSettings(sal_True,sal_True,sal_True);
-}
-// -----------------------------------------------------------------------------
-OTasksWindow::~OTasksWindow()
-{
- DBG_DTOR(OTasksWindow,NULL);
- Clear();
-}
-// -----------------------------------------------------------------------
-void OTasksWindow::DataChanged( const DataChangedEvent& rDCEvt )
-{
- DBG_CHKTHIS(OTasksWindow,NULL);
- Window::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
- (rDCEvt.GetFlags() & SETTINGS_STYLE) )
- {
- ImplInitSettings( sal_True, sal_True, sal_True );
- Invalidate();
- }
-}
-// -----------------------------------------------------------------------------
-void OTasksWindow::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground )
-{
- DBG_CHKTHIS(OTasksWindow,NULL);
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- if( bFont )
- {
- Font aFont;
- aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont( aFont );
- }
-
- if( bForeground || bFont )
- {
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
- m_aHelpText.SetTextColor( rStyleSettings.GetFieldTextColor() );
- m_aHelpText.SetTextFillColor();
- m_aDescription.SetTextColor( rStyleSettings.GetFieldTextColor() );
- m_aDescription.SetTextFillColor();
- }
-
- if( bBackground )
- {
- SetBackground( rStyleSettings.GetFieldColor() );
- m_aHelpText.SetBackground( rStyleSettings.GetFieldColor() );
- m_aDescription.SetBackground( rStyleSettings.GetFieldColor() );
- m_aFL.SetBackground( rStyleSettings.GetFieldColor() );
- }
-
- Font aFont = m_aDescription.GetControlFont();
- aFont.SetWeight(WEIGHT_BOLD);
- m_aDescription.SetControlFont(aFont);
-}
-// -----------------------------------------------------------------------------
-void OTasksWindow::setHelpText(sal_uInt16 _nId)
-{
- DBG_CHKTHIS(OTasksWindow,NULL);
- if ( _nId )
- {
- String sText = ModuleRes(_nId);
-
- m_aHelpText.SetText(sText);
- }
- else
- {
- m_aHelpText.SetText(String());
-}
-}
-// -----------------------------------------------------------------------------
-IMPL_LINK(OTasksWindow, OnEntrySelectHdl, SvTreeListBox*, /*_pTreeBox*/)
-{
- DBG_CHKTHIS(OTasksWindow,NULL);
- SvLBoxEntry* pEntry = m_aCreation.GetHdlEntry();
- if ( pEntry )
- m_aHelpText.SetText( ModuleRes( reinterpret_cast< TaskEntry* >( pEntry->GetUserData() )->nHelpID ) );
- return 1L;
-}
-// -----------------------------------------------------------------------------
-void OTasksWindow::Resize()
-{
- DBG_CHKTHIS(OTasksWindow,NULL);
-
- // parent window dimension
- Size aOutputSize( GetOutputSize() );
- long nOutputWidth = aOutputSize.Width();
- long nOutputHeight = aOutputSize.Height();
-
- Size aFLSize = LogicToPixel( Size( 2, 6 ), MAP_APPFONT );
- sal_Int32 n6PPT = aFLSize.Height();
- long nHalfOutputWidth = static_cast<long>(nOutputWidth * 0.5);
-
- m_aCreation.SetPosSizePixel( Point(0, 0), Size(nHalfOutputWidth - n6PPT, nOutputHeight) );
- // i77897 make the m_aHelpText a little bit smaller. (-5)
- sal_Int32 nNewWidth = nOutputWidth - nHalfOutputWidth - aFLSize.Width() - 5;
- m_aDescription.SetPosSizePixel( Point(nHalfOutputWidth + n6PPT, 0), Size(nNewWidth, nOutputHeight) );
- Size aDesc = m_aDescription.CalcMinimumSize();
- m_aHelpText.SetPosSizePixel( Point(nHalfOutputWidth + n6PPT, aDesc.Height() ), Size(nNewWidth, nOutputHeight - aDesc.Height() - n6PPT) );
-
- m_aFL.SetPosSizePixel( Point(nHalfOutputWidth , 0), Size(aFLSize.Width(), nOutputHeight ) );
-}
-// -----------------------------------------------------------------------------
-void OTasksWindow::fillTaskEntryList( const TaskEntryList& _rList )
-{
- DBG_CHKTHIS(OTasksWindow,NULL);
- Clear();
-
- try
- {
- Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier(
- getDetailView()->getBorderWin().getView()->getORB()->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) )
- ) ,
- UNO_QUERY
- );
- Reference< XUIConfigurationManager > xUIConfigMgr = xModuleCfgMgrSupplier->getUIConfigurationManager(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.OfficeDatabaseDocument" ) )
- );
- Reference< XImageManager > xImageMgr( xUIConfigMgr->getImageManager(), UNO_QUERY );
-
- // copy the commands so we can use them with the config managers
- Sequence< ::rtl::OUString > aCommands( _rList.size() );
- ::rtl::OUString* pCommands = aCommands.getArray();
- TaskEntryList::const_iterator aEnd = _rList.end();
- for ( TaskEntryList::const_iterator pCopyTask = _rList.begin(); pCopyTask != aEnd; ++pCopyTask, ++pCommands )
- *pCommands = pCopyTask->sUNOCommand;
-
- Sequence< Reference< XGraphic> > aImages = xImageMgr->getImages(
- ImageType::SIZE_DEFAULT | ImageType::COLOR_NORMAL ,
- aCommands
- );
-
- const Reference< XGraphic >* pImages( aImages.getConstArray() );
-
- for ( TaskEntryList::const_iterator pTask = _rList.begin(); pTask != aEnd; ++pTask, ++pImages )
- {
- SvLBoxEntry* pEntry = m_aCreation.InsertEntry( pTask->sTitle );
- pEntry->SetUserData( reinterpret_cast< void* >( new TaskEntry( *pTask ) ) );
-
- Image aImage = Image( *pImages );
- m_aCreation.SetExpandedEntryBmp( pEntry, aImage );
- m_aCreation.SetCollapsedEntryBmp( pEntry, aImage );
- }
- }
- catch(Exception&)
- {
- }
-
- m_aCreation.Show();
- m_aCreation.SelectAll(sal_False);
- m_aHelpText.Show();
- m_aDescription.Show();
- m_aFL.Show();
- m_aCreation.updateHelpText();
- Enable(!_rList.empty());
-}
-// -----------------------------------------------------------------------------
-void OTasksWindow::Clear()
-{
- DBG_CHKTHIS(OTasksWindow,NULL);
- m_aCreation.resetLastActive();
- SvLBoxEntry* pEntry = m_aCreation.First();
- while ( pEntry )
- {
- delete reinterpret_cast< TaskEntry* >( pEntry->GetUserData() );
- pEntry = m_aCreation.Next(pEntry);
- }
- m_aCreation.Clear();
-}
-//==================================================================
-// class OApplicationDetailView
-//==================================================================
-DBG_NAME(OApplicationDetailView)
-OApplicationDetailView::OApplicationDetailView(OAppBorderWindow& _rParent,PreviewMode _ePreviewMode) : OSplitterView(&_rParent,sal_False )
- ,m_aHorzSplitter(this)
- ,m_aTasks(this,STR_TASKS,WB_BORDER | WB_DIALOGCONTROL )
- ,m_aContainer(this,0,WB_BORDER | WB_DIALOGCONTROL )
- ,m_rBorderWin(_rParent)
-{
- DBG_CTOR(OApplicationDetailView,NULL);
- SetUniqueId(UID_APP_DETAIL_VIEW);
- ImplInitSettings( sal_True, sal_True, sal_True );
-
- m_pControlHelper = new OAppDetailPageHelper(&m_aContainer,m_rBorderWin,_ePreviewMode);
- m_pControlHelper->Show();
- m_aContainer.setChildWindow(m_pControlHelper);
-
- OTasksWindow* pTasks = new OTasksWindow(&m_aTasks,this);
- pTasks->Show();
- pTasks->Disable(m_rBorderWin.getView()->getCommandController().isDataSourceReadOnly());
- m_aTasks.setChildWindow(pTasks);
- m_aTasks.SetUniqueId(UID_APP_TASKS_VIEW);
- m_aTasks.Show();
-
- m_aContainer.SetUniqueId(UID_APP_CONTAINER_VIEW);
- m_aContainer.Show();
-
- const long nFrameWidth = LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width();
- m_aHorzSplitter.SetPosSizePixel( Point(0,50), Size(0,nFrameWidth) );
- // now set the components at the base class
- set(&m_aContainer,&m_aTasks);
-
- m_aHorzSplitter.Show();
- m_aHorzSplitter.SetUniqueId(UID_APP_VIEW_HORZ_SPLIT);
- setSplitter(&m_aHorzSplitter);
-}
-// -----------------------------------------------------------------------------
-OApplicationDetailView::~OApplicationDetailView()
-{
- DBG_DTOR(OApplicationDetailView,NULL);
- set(NULL,NULL);
- setSplitter(NULL);
- m_pControlHelper = NULL;
-}
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground )
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- if( bFont )
- {
- Font aFont;
- aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont( aFont );
- }
-
- if( bForeground || bFont )
- {
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
- }
-
- if( bBackground )
- SetBackground( rStyleSettings.GetFieldColor() );
-
- m_aHorzSplitter.SetBackground( rStyleSettings.GetDialogColor() );
- m_aHorzSplitter.SetFillColor( rStyleSettings.GetDialogColor() );
- m_aHorzSplitter.SetTextFillColor(rStyleSettings.GetDialogColor() );
-}
-// -----------------------------------------------------------------------
-void OApplicationDetailView::DataChanged( const DataChangedEvent& rDCEvt )
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- OSplitterView::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
- (rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
- (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
- ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
- (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
- {
- ImplInitSettings( sal_True, sal_True, sal_True );
- Invalidate();
- }
-}
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::GetFocus()
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- OSplitterView::GetFocus();
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::setTaskExternalMnemonics( MnemonicGenerator& _rMnemonics )
-{
- m_aExternalMnemonics = _rMnemonics;
-}
-
-// -----------------------------------------------------------------------------
-bool OApplicationDetailView::interceptKeyInput( const KeyEvent& _rEvent )
-{
- const KeyCode& rKeyCode = _rEvent.GetKeyCode();
- if ( rKeyCode.GetModifier() == KEY_MOD2 )
- return getTasksWindow().HandleKeyInput( _rEvent );
-
- // not handled
- return false;
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::createTablesPage(const Reference< XConnection >& _xConnection )
-{
- impl_createPage( E_TABLE, _xConnection, NULL );
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::createPage( ElementType _eType,const Reference< XNameAccess >& _xContainer )
-{
- impl_createPage( _eType, NULL, _xContainer );
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::impl_createPage( ElementType _eType, const Reference< XConnection >& _rxConnection,
- const Reference< XNameAccess >& _rxNonTableElements )
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
-
- // get the data for the pane
- const TaskPaneData& rData = impl_getTaskPaneData( _eType );
- getTasksWindow().fillTaskEntryList( rData.aTasks );
-
- // enable the pane as a whole, depending on the availability of the first command
- OSL_ENSURE( !rData.aTasks.empty(), "OApplicationDetailView::impl_createPage: no tasks at all!?" );
- bool bEnabled = rData.aTasks.empty()
- ? false
- : getBorderWin().getView()->getCommandController().isCommandEnabled( rData.aTasks[0].sUNOCommand );
- getTasksWindow().Enable( bEnabled );
- m_aContainer.setTitle( rData.nTitleId );
-
- // let our helper create the object list
- if ( _eType == E_TABLE )
- m_pControlHelper->createTablesPage( _rxConnection );
- else
- m_pControlHelper->createPage( _eType, _rxNonTableElements );
-
- // resize for proper window arrangements
- Resize();
-}
-
-// -----------------------------------------------------------------------------
-const TaskPaneData& OApplicationDetailView::impl_getTaskPaneData( ElementType _eType )
-{
- if ( m_aTaskPaneData.empty() )
- m_aTaskPaneData.resize( ELEMENT_COUNT );
- OSL_ENSURE( ( _eType >= 0 ) && ( _eType < E_ELEMENT_TYPE_COUNT ), "OApplicationDetailView::impl_getTaskPaneData: illegal element type!" );
- TaskPaneData& rData = m_aTaskPaneData[ _eType ];
-
- //oj: do not check, otherwise extensions will only be visible after a reload.
- impl_fillTaskPaneData( _eType, rData );
-
- return rData;
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::impl_fillTaskPaneData( ElementType _eType, TaskPaneData& _rData ) const
-{
- TaskEntryList& rList( _rData.aTasks );
- rList.clear(); rList.reserve( 4 );
-
- switch ( _eType )
- {
- case E_TABLE:
- rList.push_back( TaskEntry( ".uno:DBNewTable", RID_STR_TABLES_HELP_TEXT_DESIGN, RID_STR_NEW_TABLE ) );
- rList.push_back( TaskEntry( ".uno:DBNewTableAutoPilot", RID_STR_TABLES_HELP_TEXT_WIZARD, RID_STR_NEW_TABLE_AUTO ) );
- rList.push_back( TaskEntry( ".uno:DBNewView", RID_STR_VIEWS_HELP_TEXT_DESIGN, RID_STR_NEW_VIEW, true ) );
- _rData.nTitleId = RID_STR_TABLES_CONTAINER;
- break;
-
- case E_FORM:
- rList.push_back( TaskEntry( ".uno:DBNewForm", RID_STR_FORMS_HELP_TEXT, RID_STR_NEW_FORM ) );
- rList.push_back( TaskEntry( ".uno:DBNewFormAutoPilot", RID_STR_FORMS_HELP_TEXT_WIZARD, RID_STR_NEW_FORM_AUTO ) );
- _rData.nTitleId = RID_STR_FORMS_CONTAINER;
- break;
-
- case E_REPORT:
- rList.push_back( TaskEntry( ".uno:DBNewReport", RID_STR_REPORT_HELP_TEXT, RID_STR_NEW_REPORT, true ) );
- rList.push_back( TaskEntry( ".uno:DBNewReportAutoPilot", RID_STR_REPORTS_HELP_TEXT_WIZARD, RID_STR_NEW_REPORT_AUTO ) );
- _rData.nTitleId = RID_STR_REPORTS_CONTAINER;
- break;
-
- case E_QUERY:
- rList.push_back( TaskEntry( ".uno:DBNewQuery", RID_STR_QUERIES_HELP_TEXT, RID_STR_NEW_QUERY ) );
- rList.push_back( TaskEntry( ".uno:DBNewQueryAutoPilot", RID_STR_QUERIES_HELP_TEXT_WIZARD, RID_STR_NEW_QUERY_AUTO ) );
- rList.push_back( TaskEntry( ".uno:DBNewQuerySql", RID_STR_QUERIES_HELP_TEXT_SQL, RID_STR_NEW_QUERY_SQL ) );
- _rData.nTitleId = RID_STR_QUERIES_CONTAINER;
- break;
-
- default:
- OSL_FAIL( "OApplicationDetailView::impl_fillTaskPaneData: illegal element type!" );
- }
-
- MnemonicGenerator aAllMnemonics( m_aExternalMnemonics );
-
- // remove the entries which are not enabled currently
- for ( TaskEntryList::iterator pTask = rList.begin();
- pTask != rList.end();
- )
- {
- if ( pTask->bHideWhenDisabled
- && !getBorderWin().getView()->getCommandController().isCommandEnabled( pTask->sUNOCommand )
- )
- pTask = rList.erase( pTask );
- else
- {
- aAllMnemonics.RegisterMnemonic( pTask->sTitle );
- ++pTask;
- }
- }
-
- // for the remaining entries, assign mnemonics
- for ( TaskEntryList::iterator pTask = rList.begin();
- pTask != rList.end();
- ++pTask
- )
- {
- aAllMnemonics.CreateMnemonic( pTask->sTitle );
- // don't do this for now, until our task window really supports mnemonics
- }
-}
-
-// -----------------------------------------------------------------------------
-::rtl::OUString OApplicationDetailView::getQualifiedName( SvLBoxEntry* _pEntry ) const
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- return m_pControlHelper->getQualifiedName( _pEntry );
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationDetailView::isLeaf(SvLBoxEntry* _pEntry) const
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- return m_pControlHelper->isLeaf(_pEntry);
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationDetailView::isALeafSelected() const
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- return m_pControlHelper->isALeafSelected();
-}
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::selectAll()
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- m_pControlHelper->selectAll();
-}
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::sortDown()
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- m_pControlHelper->sortDown();
-}
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::sortUp()
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- m_pControlHelper->sortUp();
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationDetailView::isFilled() const
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- return m_pControlHelper->isFilled();
-}
-// -----------------------------------------------------------------------------
-ElementType OApplicationDetailView::getElementType() const
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- return m_pControlHelper->getElementType();
-}
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::clearPages(sal_Bool _bTaskAlso)
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- if ( _bTaskAlso )
- getTasksWindow().Clear();
- m_pControlHelper->clearPages();
-}
-// -----------------------------------------------------------------------------
-sal_Int32 OApplicationDetailView::getSelectionCount()
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- return m_pControlHelper->getSelectionCount();
-}
-// -----------------------------------------------------------------------------
-sal_Int32 OApplicationDetailView::getElementCount()
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- return m_pControlHelper->getElementCount();
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::getSelectionElementNames( ::std::vector< ::rtl::OUString>& _rNames ) const
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- m_pControlHelper->getSelectionElementNames( _rNames );
-}
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::describeCurrentSelectionForControl( const Control& _rControl, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- m_pControlHelper->describeCurrentSelectionForControl( _rControl, _out_rSelectedObjects );
-}
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::describeCurrentSelectionForType( const ElementType _eType, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- m_pControlHelper->describeCurrentSelectionForType( _eType, _out_rSelectedObjects );
-}
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::selectElements(const Sequence< ::rtl::OUString>& _aNames)
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- m_pControlHelper->selectElements( _aNames );
-}
-// -----------------------------------------------------------------------------
-SvLBoxEntry* OApplicationDetailView::getEntry( const Point& _aPoint ) const
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- return m_pControlHelper->getEntry(_aPoint);
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationDetailView::isCutAllowed()
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- return m_pControlHelper->isCutAllowed();
-}
-sal_Bool OApplicationDetailView::isCopyAllowed()
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- return m_pControlHelper->isCopyAllowed();
-}
-sal_Bool OApplicationDetailView::isPasteAllowed() { DBG_CHKTHIS(OApplicationDetailView,NULL);return m_pControlHelper->isPasteAllowed(); }
-void OApplicationDetailView::copy() { DBG_CHKTHIS(OApplicationDetailView,NULL);m_pControlHelper->copy(); }
-void OApplicationDetailView::cut() { DBG_CHKTHIS(OApplicationDetailView,NULL);m_pControlHelper->cut(); }
-void OApplicationDetailView::paste()
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- m_pControlHelper->paste();
-}
-// -----------------------------------------------------------------------------
-SvLBoxEntry* OApplicationDetailView::elementAdded(ElementType _eType,const ::rtl::OUString& _rName, const Any& _rObject )
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- return m_pControlHelper->elementAdded(_eType,_rName, _rObject );
-}
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::elementRemoved(ElementType _eType,const ::rtl::OUString& _rName )
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- m_pControlHelper->elementRemoved(_eType,_rName );
-}
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::elementReplaced(ElementType _eType
- ,const ::rtl::OUString& _rOldName
- ,const ::rtl::OUString& _rNewName )
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- m_pControlHelper->elementReplaced( _eType, _rOldName, _rNewName );
-}
-// -----------------------------------------------------------------------------
-PreviewMode OApplicationDetailView::getPreviewMode()
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- return m_pControlHelper->getPreviewMode();
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationDetailView::isPreviewEnabled()
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- return m_pControlHelper->isPreviewEnabled();
-}
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::switchPreview(PreviewMode _eMode)
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- m_pControlHelper->switchPreview(_eMode);
-}
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::showPreview(const Reference< XContent >& _xContent)
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- m_pControlHelper->showPreview(_xContent);
-}
-// -----------------------------------------------------------------------------
-void OApplicationDetailView::showPreview( const ::rtl::OUString& _sDataSourceName,
- const ::rtl::OUString& _sName,
- sal_Bool _bTable)
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- m_pControlHelper->showPreview(_sDataSourceName,_sName,_bTable);
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationDetailView::isSortUp() const
-{
- DBG_CHKTHIS(OApplicationDetailView,NULL);
- return m_pControlHelper->isSortUp();
-}
-// -----------------------------------------------------------------------------
-Window* OApplicationDetailView::getTreeWindow() const
-{
- return m_pControlHelper->getCurrentView();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppDetailView.hxx b/dbaccess/source/ui/app/AppDetailView.hxx
deleted file mode 100644
index 3e682287b..000000000
--- a/dbaccess/source/ui/app/AppDetailView.hxx
+++ /dev/null
@@ -1,380 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef DBAUI_APPDETAILVIEW_HXX
-#define DBAUI_APPDETAILVIEW_HXX
-
-#include <com/sun/star/frame/XController.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/sdbc/XConnection.hpp>
-#include <com/sun/star/ucb/XContent.hpp>
-#include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
-#include <vcl/split.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/mnemonic.hxx>
-#include "IClipBoardTest.hxx"
-#include "AppTitleWindow.hxx"
-#include "AppElementType.hxx"
-#include <svtools/svtreebx.hxx>
-#include "VertSplitView.hxx"
-
-#include <vector>
-
-class SvLBoxEntry;
-
-namespace dbaui
-{
- class OAppBorderWindow;
- class OApplicationDetailView;
- class OAppDetailPageHelper;
- class OTasksWindow;
-
- class OCreationList : public SvTreeListBox
- {
- OTasksWindow& m_rTaskWindow;
-
- // members related to drawing the currently hovered/selected entry
- SvLBoxEntry* m_pMouseDownEntry;
- SvLBoxEntry* m_pLastActiveEntry;
- Color m_aOriginalBackgroundColor;
- Font m_aOriginalFont;
-
- public:
- OCreationList( OTasksWindow& _rParent );
- // window overloads
- virtual void MouseMove( const MouseEvent& rMEvt );
- virtual void MouseButtonDown( const MouseEvent& rMEvt );
- virtual void MouseButtonUp( const MouseEvent& rMEvt );
- virtual void KeyInput( const KeyEvent& rKEvt );
- virtual void Paint( const Rectangle& rRect );
- virtual void StartDrag( sal_Int8 _nAction, const Point& _rPosPixel );
- virtual void GetFocus();
- virtual void LoseFocus();
-
- inline void resetLastActive() { m_pLastActiveEntry = NULL;}
-
- void updateHelpText();
-
- protected:
- virtual void PreparePaint( SvLBoxEntry* _pEntry );
- virtual Rectangle GetFocusRect( SvLBoxEntry* _pEntry, long _nLine );
- virtual void ModelHasCleared();
-
- // IMnemonicEntryList
- virtual void SelectSearchEntry( const void* _pEntry );
- virtual void ExecuteSearchEntry( const void* _pEntry ) const;
-
- private:
- void onSelected( SvLBoxEntry* _pEntry ) const;
- /** sets a new current entry, and invalidates the old and the new one, if necessary
- @return <TRUE/> if and only if the "current entry" changed
- */
- bool setCurrentEntryInvalidate( SvLBoxEntry* _pEntry );
- };
-
- struct TaskEntry
- {
- ::rtl::OUString sUNOCommand;
- sal_uInt16 nHelpID;
- String sTitle;
- bool bHideWhenDisabled;
- // TODO: we should be consistent in the task pane and the menus/toolbars:
- // If an entry is disabled in the latter, it should also be disabled in the former.
- // If an entry is *hidden* in the former, it should also be hidden in the latter.
-
- TaskEntry( const sal_Char* _pAsciiUNOCommand, sal_uInt16 _nHelpID, sal_uInt16 _nTitleResourceID, bool _bHideWhenDisabled = false );
- };
- typedef ::std::vector< TaskEntry > TaskEntryList;
-
- struct TaskPaneData
- {
- /// the tasks available in the pane
- TaskEntryList aTasks;
- /// the resource ID for the title of the pane
- sal_uInt16 nTitleId;
- };
-
- class OTasksWindow : public Window
- {
- OCreationList m_aCreation;
- FixedText m_aDescription;
- FixedText m_aHelpText;
- FixedLine m_aFL;
- OApplicationDetailView* m_pDetailView;
-
- DECL_LINK( OnEntrySelectHdl, SvTreeListBox* );
- void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
- protected:
- virtual void DataChanged(const DataChangedEvent& rDCEvt);
- public:
- OTasksWindow(Window* _pParent,OApplicationDetailView* _pDetailView);
- virtual ~OTasksWindow();
-
- // window overloads
- virtual void Resize();
-
- OApplicationDetailView* getDetailView() const { return m_pDetailView; }
-
- /// fills the Creation listbox with the necessary strings and images
- void fillTaskEntryList( const TaskEntryList& _rList );
-
- inline bool HandleKeyInput( const KeyEvent& _rKEvt )
- {
- return m_aCreation.HandleKeyInput( _rKEvt );
- }
-
- void Clear();
- void setHelpText(sal_uInt16 _nId);
- };
- //==================================================================
- class OApplicationDetailView : public OSplitterView
- , public IClipboardTest
- {
- Splitter m_aHorzSplitter;
- OTitleWindow m_aTasks;
- OTitleWindow m_aContainer;
- OAppBorderWindow& m_rBorderWin; // my parent
- OAppDetailPageHelper* m_pControlHelper;
- ::std::vector< TaskPaneData > m_aTaskPaneData;
- MnemonicGenerator m_aExternalMnemonics;
-
- void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
-
- protected:
- virtual void DataChanged(const DataChangedEvent& rDCEvt);
-
- public:
- OApplicationDetailView(OAppBorderWindow& _rParent,PreviewMode _ePreviewMode);
- virtual ~OApplicationDetailView();
- // window overloads
- virtual void GetFocus();
-
- /** creates the tables page
- @param _xConnection
- The connection to get the table names
- */
- void createTablesPage(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection);
-
- /** creates the page for the specific type.
- @param _eType
- The type which should be created. E_TABLE isn't allowed.
- @param _xContainer
- The container of the elements to be inserted.
- */
- void createPage(ElementType _eType,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xContainer);
-
- void setTaskExternalMnemonics( MnemonicGenerator& _rMnemonics );
-
- /** called to give the window the chance to intercept key events, while it has not
- the focus
-
- @return <TRUE/> if and only if the event has been handled, and should not
- not be further processed
- */
- bool interceptKeyInput( const KeyEvent& _rEvent );
-
- inline OAppBorderWindow& getBorderWin() const { return m_rBorderWin; }
- inline OTasksWindow& getTasksWindow() const { return *static_cast< OTasksWindow* >( m_aTasks.getChildWindow() ); }
-
- sal_Bool isCutAllowed() ;
- sal_Bool isCopyAllowed() ;
- sal_Bool isPasteAllowed();
- virtual sal_Bool hasChildPathFocus() { return HasChildPathFocus(); }
- void copy();
- void cut();
- void paste();
-
- /** return the qualified name.
- @param _pEntry
- The entry of a table, or query, form, report to get the qualified name.
- If the entry is <NULL/>, the first selected is chosen.
- @return
- the qualified name
- */
- ::rtl::OUString getQualifiedName( SvLBoxEntry* _pEntry ) const;
-
- /** returns if an entry is a leaf
- @param _pEntry
- The entry to check
- @return
- <TRUE/> if the entry is a leaf, otherwise <FALSE/>
- */
- sal_Bool isLeaf(SvLBoxEntry* _pEntry) const;
-
- /** returns if one of the selected entries is a leaf
- @return
- <TRUE/> if the entry is a leaf, otherwise <FALSE/>
- */
- sal_Bool isALeafSelected() const;
-
- /** select all entries in the detail page
- */
- void selectAll();
-
- /// returns <TRUE/> if it sorts ascending
- sal_Bool isSortUp() const;
-
- /// sort the entries in the detail page down
- void sortDown();
-
- /// sort the entries in the detail page up
- void sortUp();
-
- /// returns <TRUE/> when a detail page was filled
- sal_Bool isFilled() const;
-
- /// return the element of currently select entry
- ElementType getElementType() const;
-
- /** clears the detail pages.
- @param _bTaskAlso
- If <TRUE/> the task window will also be cleared.
- */
- void clearPages(sal_Bool _bTaskAlso = sal_True);
-
- /// returns the count of entries
- sal_Int32 getElementCount();
-
- /// returns the count of selected entries
- sal_Int32 getSelectionCount();
-
- /** returns the element names which are selected
- @param _rNames
- The list will be filled.
- */
- void getSelectionElementNames(::std::vector< ::rtl::OUString>& _rNames ) const;
-
- /** describes the current selection for the given control
- */
- void describeCurrentSelectionForControl(
- const Control& _rControl,
- ::com::sun::star::uno::Sequence< ::com::sun::star::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
- );
-
- /** describes the current selection for the given ElementType
- */
- void describeCurrentSelectionForType(
- const ElementType _eType,
- ::com::sun::star::uno::Sequence< ::com::sun::star::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
- );
-
- /** select all names on the currently selected container. Non existence names where ignored.
- *
- * \param _aNames the element names
- */
- void selectElements(const ::com::sun::star::uno::Sequence< ::rtl::OUString>& _aNames);
-
- /** adds a new object to the detail page.
- @param _eType
- The type where the entry shold be appended.
- @param _rName
- The name of the object to be inserted
- @param _rObject
- The object to add.
- @param _rxConn
- If we insert a table, the connection must be set.
- */
- SvLBoxEntry* elementAdded(ElementType eType
- ,const ::rtl::OUString& _rName
- ,const ::com::sun::star::uno::Any& _rObject );
-
- /** replaces a objects name with a new one
- @param _eType
- The type where the entry shold be appended.
- @param _rOldName
- The old name of the object to be replaced
- @param _rNewName
- The new name of the object to be replaced
- @param _rxConn
- If we insert a table, the connection must be set.
- @param _xObject
- The object which was replaced
- */
- void elementReplaced(ElementType eType
- ,const ::rtl::OUString& _rOldName
- ,const ::rtl::OUString& _rNewName );
-
- /** removes an element from the detail page.
- @param _eType
- The type where the entry shold be appended.
- @param _rName
- The name of the element to be removed.
- @param _rxConn
- If we remove a table, the connection must be set.
- */
- void elementRemoved(ElementType _eType
- ,const ::rtl::OUString& _rName );
-
- /// returns the preview mode
- PreviewMode getPreviewMode();
-
- /// <TRUE/> if the preview is enabled
- sal_Bool isPreviewEnabled();
-
-
- /** switches to the given preview mode
- @param _eMode
- the mode to set for the preview
- */
- void switchPreview(PreviewMode _eMode);
-
- /** shows the Preview of the content when it is enabled.
- @param _xContent
- The content which must support the "preview" command.
- */
- void showPreview(const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& _xContent);
-
- /** shows the Preview of a table or query
- @param _sDataSourceName
- the name of the data source
- @param _sName
- the name of table or query
- @param _bTable
- <TRUE/> if it is a table, otherwise <FALSE/>
- @return void
- */
- void showPreview( const ::rtl::OUString& _sDataSourceName,
- const ::rtl::OUString& _sName,
- sal_Bool _bTable);
-
- SvLBoxEntry* getEntry( const Point& _aPoint ) const;
-
- Window* getTreeWindow() const;
- private:
- void impl_createPage(
- ElementType _eType,
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxNonTableElements
- );
-
- const TaskPaneData& impl_getTaskPaneData( ElementType _eType );
- void impl_fillTaskPaneData( ElementType _eType, TaskPaneData& _rData ) const;
- };
-}
-#endif // DBAUI_APPDETAILVIEW_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppIconControl.cxx b/dbaccess/source/ui/app/AppIconControl.cxx
deleted file mode 100644
index 3c3689fb9..000000000
--- a/dbaccess/source/ui/app/AppIconControl.cxx
+++ /dev/null
@@ -1,120 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_dbaccess.hxx"
-#include "AppIconControl.hxx"
-#include <tools/debug.hxx>
-#include "dbaccess_helpid.hrc"
-#include "moduledbu.hxx"
-#include "dbu_app.hrc"
-#include <vcl/image.hxx>
-#include "callbacks.hxx"
-#include "AppElementType.hxx"
-#include <memory>
-
-using namespace ::dbaui;
-//==================================================================
-// class OApplicationIconControl
-DBG_NAME(OApplicationIconControl)
-//==================================================================
-OApplicationIconControl::OApplicationIconControl(Window* _pParent)
- : SvtIconChoiceCtrl(_pParent,WB_ICON | WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME | /*!WB_NOSELECTION |*/
- WB_TABSTOP | WB_CLIPCHILDREN | WB_NOVSCROLL | WB_SMART_ARRANGE | WB_NOHSCROLL | WB_CENTER)
- ,DropTargetHelper(this)
- ,m_pActionListener(NULL)
-{
- DBG_CTOR(OApplicationIconControl,NULL);
-
- struct CategoryDescriptor
- {
- sal_uInt16 nLabelResId;
- ElementType eType;
- sal_uInt16 nImageResId;
- } aCategories[] = {
- { RID_STR_TABLES_CONTAINER, E_TABLE, IMG_TABLEFOLDER_TREE_L },
- { RID_STR_QUERIES_CONTAINER, E_QUERY, IMG_QUERYFOLDER_TREE_L },
- { RID_STR_FORMS_CONTAINER, E_FORM, IMG_FORMFOLDER_TREE_L },
- { RID_STR_REPORTS_CONTAINER, E_REPORT, IMG_REPORTFOLDER_TREE_L }
- };
- for ( size_t i=0; i < SAL_N_ELEMENTS(aCategories); ++i)
- {
- SvxIconChoiceCtrlEntry* pEntry = InsertEntry(
- String( ModuleRes( aCategories[i].nLabelResId ) ) ,
- Image( ModuleRes( aCategories[i].nImageResId ) ) );
- if ( pEntry )
- pEntry->SetUserData( new ElementType( aCategories[i].eType ) );
- }
-
- SetChoiceWithCursor( sal_True );
- SetSelectionMode(SINGLE_SELECTION);
-}
-// -----------------------------------------------------------------------------
-OApplicationIconControl::~OApplicationIconControl()
-{
- sal_uLong nCount = GetEntryCount();
- for ( sal_uLong i = 0; i < nCount; ++i )
- {
- SvxIconChoiceCtrlEntry* pEntry = GetEntry( i );
- if ( pEntry )
- {
- ::std::auto_ptr<ElementType> aType(static_cast<ElementType*>(pEntry->GetUserData()));
- pEntry->SetUserData(NULL);
- }
- }
-
- DBG_DTOR(OApplicationIconControl,NULL);
-}
-// -----------------------------------------------------------------------------
-sal_Int8 OApplicationIconControl::AcceptDrop( const AcceptDropEvent& _rEvt )
-{
- sal_Int8 nDropOption = DND_ACTION_NONE;
- if ( m_pActionListener )
- {
-
- SvxIconChoiceCtrlEntry* pEntry = GetEntry(_rEvt.maPosPixel);
- if ( pEntry )
- {
- SetCursor(pEntry);
- nDropOption = m_pActionListener->queryDrop( _rEvt, GetDataFlavorExVector() );
- m_aMousePos = _rEvt.maPosPixel;
- }
- }
-
- return nDropOption;
-}
-// -----------------------------------------------------------------------------
-sal_Int8 OApplicationIconControl::ExecuteDrop( const ExecuteDropEvent& _rEvt )
-{
- if ( m_pActionListener )
- return m_pActionListener->executeDrop( _rEvt );
-
- return DND_ACTION_NONE;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppIconControl.hxx b/dbaccess/source/ui/app/AppIconControl.hxx
deleted file mode 100644
index be650da50..000000000
--- a/dbaccess/source/ui/app/AppIconControl.hxx
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef DBAUI_APPICONCONTROL_HXX
-#define DBAUI_APPICONCONTROL_HXX
-
-#include <svtools/ivctrl.hxx>
-#include <svtools/transfer.hxx>
-
-
-namespace dbaui
-{
- class IControlActionListener;
- //==================================================================
- class OApplicationIconControl :public SvtIconChoiceCtrl
- ,public DropTargetHelper
- {
- Point m_aMousePos;
- IControlActionListener* m_pActionListener;
-
- public:
- OApplicationIconControl(Window* _pParent);
- virtual ~OApplicationIconControl();
-
- void setControlActionListener( IControlActionListener* _pListener ) { m_pActionListener = _pListener; }
- IControlActionListener* getControlActionListener( ) const { return m_pActionListener; }
-
- protected:
- // DropTargetHelper overridables
- virtual sal_Int8 AcceptDrop( const AcceptDropEvent& _rEvt );
- virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& _rEvt );
- };
-}
-#endif // DBAUI_APPICONCONTROL_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppSwapWindow.cxx b/dbaccess/source/ui/app/AppSwapWindow.cxx
deleted file mode 100644
index 164fa5f87..000000000
--- a/dbaccess/source/ui/app/AppSwapWindow.cxx
+++ /dev/null
@@ -1,215 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_dbaccess.hxx"
-#include "AppSwapWindow.hxx"
-#include <tools/debug.hxx>
-#include "dbaccess_helpid.hrc"
-#include "dbu_app.hrc"
-#include "AppView.hxx"
-#include <vcl/svapp.hxx>
-#include <vcl/syswin.hxx>
-#include <vcl/menu.hxx>
-#include <vcl/mnemonic.hxx>
-#include "IApplicationController.hxx"
-
-#include <memory>
-
-using namespace ::dbaui;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::container;
-
-//==================================================================
-// class OApplicationSwapWindow
-DBG_NAME(OApplicationSwapWindow)
-//==================================================================
-OApplicationSwapWindow::OApplicationSwapWindow( Window* _pParent, OAppBorderWindow& _rBorderWindow )
- :Window(_pParent,WB_DIALOGCONTROL )
- ,m_aIconControl(this)
- ,m_eLastType(E_NONE)
- ,m_rBorderWin( _rBorderWindow )
-{
- DBG_CTOR(OApplicationSwapWindow,NULL);
-
- ImplInitSettings( sal_True, sal_True, sal_True );
-
- m_aIconControl.SetClickHdl(LINK(this, OApplicationSwapWindow, OnContainerSelectHdl));
- m_aIconControl.setControlActionListener( &m_rBorderWin.getView()->getAppController() );
- m_aIconControl.SetHelpId(HID_APP_SWAP_ICONCONTROL);
- m_aIconControl.Show();
-}
-// -----------------------------------------------------------------------------
-OApplicationSwapWindow::~OApplicationSwapWindow()
-{
-
- DBG_DTOR(OApplicationSwapWindow,NULL);
-}
-// -----------------------------------------------------------------------------
-void OApplicationSwapWindow::Resize()
-{
- Size aFLSize = LogicToPixel( Size( 8, 0 ), MAP_APPFONT );
- long nX = 0;
- if ( m_aIconControl.GetEntryCount() != 0 )
- nX = m_aIconControl.GetBoundingBox( m_aIconControl.GetEntry(0) ).GetWidth() + aFLSize.Width();
-
- Size aOutputSize = GetOutputSize();
-
- m_aIconControl.SetPosSizePixel( Point(static_cast<long>((aOutputSize.Width() - nX)*0.5), 0) ,Size(nX,aOutputSize.Height()));
- m_aIconControl.ArrangeIcons();
-}
-// -----------------------------------------------------------------------------
-void OApplicationSwapWindow::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground )
-{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- if( bFont )
- {
- Font aFont;
- aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont( aFont );
- }
-
- if( bForeground || bFont )
- {
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
- }
-
- if( bBackground )
- SetBackground( rStyleSettings.GetFieldColor() );
-}
-// -----------------------------------------------------------------------
-void OApplicationSwapWindow::DataChanged( const DataChangedEvent& rDCEvt )
-{
- Window::DataChanged( rDCEvt );
- if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
- (rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
- (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
- ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
- (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
- {
- ImplInitSettings( sal_True, sal_True, sal_True );
- Invalidate();
- }
-}
-// -----------------------------------------------------------------------------
-void OApplicationSwapWindow::clearSelection()
-{
- m_aIconControl.SetNoSelection();
- sal_uLong nPos = 0;
- SvxIconChoiceCtrlEntry* pEntry = m_aIconControl.GetSelectedEntry(nPos);
- if ( pEntry )
- m_aIconControl.InvalidateEntry(pEntry);
- m_aIconControl.GetClickHdl().Call(&m_aIconControl);
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationSwapWindow::createIconAutoMnemonics( MnemonicGenerator& _rMnemonics )
-{
- m_aIconControl.CreateAutoMnemonics( _rMnemonics );
-}
-
-// -----------------------------------------------------------------------------
-bool OApplicationSwapWindow::interceptKeyInput( const KeyEvent& _rEvent )
-{
- const KeyCode& rKeyCode = _rEvent.GetKeyCode();
- if ( rKeyCode.GetModifier() == KEY_MOD2 )
- return m_aIconControl.DoKeyInput( _rEvent );
-
- // not handled
- return false;
-}
-
-// -----------------------------------------------------------------------------
-ElementType OApplicationSwapWindow::getElementType() const
-{
- sal_uLong nPos = 0;
- SvxIconChoiceCtrlEntry* pEntry = m_aIconControl.GetSelectedEntry(nPos);
- return ( pEntry ) ? *static_cast<ElementType*>(pEntry->GetUserData()) : E_NONE;
-}
-
-// -----------------------------------------------------------------------------
-bool OApplicationSwapWindow::onContainerSelected( ElementType _eType )
-{
- if ( m_eLastType == _eType )
- return true;
-
- if ( m_rBorderWin.getView()->getAppController().onContainerSelect( _eType ) )
- {
- if ( _eType != E_NONE )
- m_eLastType = _eType;
- return true;
- }
-
- PostUserEvent( LINK( this, OApplicationSwapWindow, ChangeToLastSelected ) );
- return false;
-}
-
-// -----------------------------------------------------------------------------
-IMPL_LINK(OApplicationSwapWindow, OnContainerSelectHdl, SvtIconChoiceCtrl*, _pControl)
-{
- sal_uLong nPos = 0;
- SvxIconChoiceCtrlEntry* pEntry = _pControl->GetSelectedEntry( nPos );
- ElementType eType = E_NONE;
- if ( pEntry )
- {
- eType = *static_cast<ElementType*>(pEntry->GetUserData());
- onContainerSelected( eType ); // i87582
- }
-
- return 1L;
-}
-//------------------------------------------------------------------------------
-IMPL_LINK(OApplicationSwapWindow, ChangeToLastSelected, void*, EMPTYARG)
-{
- selectContainer(m_eLastType);
- return 0L;
-}
-// -----------------------------------------------------------------------------
-void OApplicationSwapWindow::selectContainer(ElementType _eType)
-{
- sal_uLong nCount = m_aIconControl.GetEntryCount();
- SvxIconChoiceCtrlEntry* pEntry = NULL;
- for (sal_uLong i=0; i < nCount; ++i)
- {
- pEntry = m_aIconControl.GetEntry(i);
- if ( pEntry && *static_cast<ElementType*>(pEntry->GetUserData()) == _eType )
- break;
- pEntry = NULL;
- }
-
- if ( pEntry )
- m_aIconControl.SetCursor(pEntry); // this call also initiates a onContainerSelected call
- else
- onContainerSelected( _eType );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppSwapWindow.hxx b/dbaccess/source/ui/app/AppSwapWindow.hxx
deleted file mode 100644
index 4a6783ccd..000000000
--- a/dbaccess/source/ui/app/AppSwapWindow.hxx
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef DBAUI_APPSWAPWINDOW_HXX
-#define DBAUI_APPSWAPWINDOW_HXX
-
-#include "IClipBoardTest.hxx"
-#include <vcl/lstbox.hxx>
-#include "AppIconControl.hxx"
-#include "AppElementType.hxx"
-
-namespace dbaui
-{
- class OAppBorderWindow;
- //==================================================================
- class OApplicationSwapWindow : public Window,
- public IClipboardTest
- {
- OApplicationIconControl m_aIconControl;
- ElementType m_eLastType;
- OAppBorderWindow& m_rBorderWin;
-
- void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
-
- DECL_LINK( OnContainerSelectHdl, SvtIconChoiceCtrl* );
- DECL_LINK( ChangeToLastSelected, void* );
- protected:
- virtual void DataChanged(const DataChangedEvent& rDCEvt);
- public:
- OApplicationSwapWindow( Window* _pParent, OAppBorderWindow& _rBorderWindow );
- virtual ~OApplicationSwapWindow();
- // window overloads
- virtual void Resize();
-
-
- inline sal_Bool isCutAllowed() { return sal_False; }
- inline sal_Bool isCopyAllowed() { return sal_False; }
- inline sal_Bool isPasteAllowed() { return sal_False; }
- virtual sal_Bool hasChildPathFocus() { return HasChildPathFocus(); }
- inline void copy() { }
- inline void cut() { }
- inline void paste() { }
-
- inline sal_uLong GetEntryCount() const { return m_aIconControl.GetEntryCount(); }
- inline SvxIconChoiceCtrlEntry* GetEntry( sal_uLong nPos ) const { return m_aIconControl.GetEntry(nPos); }
- inline Rectangle GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) const { return m_aIconControl.GetBoundingBox(pEntry); }
-
- /** automatically creates mnemonics for the icon/texts in our left hand side panel
- */
- void createIconAutoMnemonics( MnemonicGenerator& _rMnemonics );
-
- /** called to give the window the chance to intercept key events, while it has not
- the focus
-
- @return <TRUE/> if and only if the event has been handled, and should not
- not be further processed
- */
- bool interceptKeyInput( const KeyEvent& _rEvent );
-
- /// return the element of currently select entry
- ElementType getElementType() const;
-
-
- /** clears the selection in the icon choice control and calls the handler
- */
- void clearSelection();
-
- /** changes the container which should be displayed. The select handler will also be called.
- @param _eType
- Which container to show.
- */
- void selectContainer(ElementType _eType);
-
- private:
- bool onContainerSelected( ElementType _eType );
- };
-// .............................................................
-} // namespace dbaui
-// .............................................................
-#endif // DBAUI_APPSWAPWINDOW_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppTitleWindow.cxx b/dbaccess/source/ui/app/AppTitleWindow.cxx
deleted file mode 100644
index 81099275a..000000000
--- a/dbaccess/source/ui/app/AppTitleWindow.cxx
+++ /dev/null
@@ -1,182 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_dbaccess.hxx"
-#include "AppTitleWindow.hxx"
-#include "moduledbu.hxx"
-#include "memory"
-#include <vcl/svapp.hxx>
-#include <tools/debug.hxx>
-
-namespace dbaui
-{
-
-DBG_NAME(OTitleWindow)
-OTitleWindow::OTitleWindow(Window* _pParent,sal_uInt16 _nTitleId,WinBits _nBits,sal_Bool _bShift)
-: Window(_pParent,_nBits | WB_DIALOGCONTROL)
-, m_aSpace1(this)
-, m_aSpace2(this)
-, m_aTitle(this)
-, m_pChild(NULL)
-, m_bShift(_bShift)
-{
- DBG_CTOR(OTitleWindow,NULL);
-
- setTitle(_nTitleId);
- SetBorderStyle(WINDOW_BORDER_MONO);
- ImplInitSettings( sal_True, sal_True, sal_True );
-
- Window* pWindows [] = { &m_aSpace1, &m_aSpace2, &m_aTitle };
- for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i)
- pWindows[i]->Show();
-}
-// -----------------------------------------------------------------------------
-OTitleWindow::~OTitleWindow()
-{
- if ( m_pChild )
- {
- m_pChild->Hide();
- ::std::auto_ptr<Window> aTemp(m_pChild);
- m_pChild = NULL;
- }
-
- DBG_DTOR(OTitleWindow,NULL);
-}
-// -----------------------------------------------------------------------------
-void OTitleWindow::setChildWindow(Window* _pChild)
-{
- m_pChild = _pChild;
-}
-#define SPACE_BORDER 1
-// -----------------------------------------------------------------------------
-void OTitleWindow::Resize()
-{
- // parent window dimension
- Size aOutputSize( GetOutputSize() );
- long nOutputWidth = aOutputSize.Width();
- long nOutputHeight = aOutputSize.Height();
-
- Size aTextSize = LogicToPixel( Size( 6, 3 ), MAP_APPFONT );
- sal_Int32 nXOffset = aTextSize.Width();
- sal_Int32 nYOffset = aTextSize.Height();
- sal_Int32 nHeight = GetTextHeight() + 2*nYOffset;
-
- m_aSpace1.SetPosSizePixel( Point(SPACE_BORDER, SPACE_BORDER ),
- Size(nXOffset , nHeight - SPACE_BORDER) );
- m_aSpace2.SetPosSizePixel( Point(nXOffset + SPACE_BORDER, SPACE_BORDER ),
- Size(nOutputWidth - nXOffset - 2*SPACE_BORDER, nYOffset) );
- m_aTitle.SetPosSizePixel( Point(nXOffset + SPACE_BORDER, nYOffset + SPACE_BORDER),
- Size(nOutputWidth - nXOffset - 2*SPACE_BORDER, nHeight - nYOffset - SPACE_BORDER) );
- if ( m_pChild )
- {
- m_pChild->SetPosSizePixel( Point(m_bShift ? (nXOffset+SPACE_BORDER) : sal_Int32(SPACE_BORDER), nHeight + nXOffset + SPACE_BORDER),
- Size(nOutputWidth - ( m_bShift ? (2*nXOffset - 2*SPACE_BORDER) : sal_Int32(SPACE_BORDER) ), nOutputHeight - nHeight - 2*nXOffset - 2*SPACE_BORDER) );
- }
-}
-// -----------------------------------------------------------------------------
-void OTitleWindow::setTitle(sal_uInt16 _nTitleId)
-{
- if ( _nTitleId != 0 )
- {
- m_aTitle.SetText(ModuleRes(_nTitleId));
- }
-}
-// -----------------------------------------------------------------------------
-void OTitleWindow::GetFocus()
-{
- Window::GetFocus();
- if ( m_pChild )
- m_pChild->GrabFocus();
-}
-// -----------------------------------------------------------------------------
-long OTitleWindow::GetWidthPixel() const
-{
- Size aTextSize = LogicToPixel( Size( 12, 0 ), MAP_APPFONT );
- sal_Int32 nWidth = GetTextWidth(m_aTitle.GetText()) + 2*aTextSize.Width();
-
- return nWidth;
-}
-// -----------------------------------------------------------------------
-void OTitleWindow::DataChanged( const DataChangedEvent& rDCEvt )
-{
- Window::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
- (rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
- (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
- ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
- (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
- {
- ImplInitSettings( sal_True, sal_True, sal_True );
- Invalidate();
- }
-}
-//-----------------------------------------------------------------------------
-void OTitleWindow::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground )
-{
- AllSettings aAllSettings = GetSettings();
- StyleSettings aStyle = aAllSettings.GetStyleSettings();
- aStyle.SetMonoColor(aStyle.GetActiveBorderColor());//GetMenuBorderColor());
- aAllSettings.SetStyleSettings(aStyle);
- SetSettings(aAllSettings);
-
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- if( bFont )
- {
- Font aFont;
- aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont( aFont );
- }
-
- if( bForeground || bFont )
- {
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
- }
-
- if( bBackground )
- SetBackground( rStyleSettings.GetFieldColor() );
-
-
- Window* pWindows [] = { &m_aSpace1, &m_aSpace2, &m_aTitle};
- for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i)
- {
- Font aFont = pWindows[i]->GetFont();
- aFont.SetWeight(WEIGHT_BOLD);
- pWindows[i]->SetFont(aFont);
- pWindows[i]->SetTextColor( aStyle.GetLightColor() );
- pWindows[i]->SetBackground( Wallpaper( aStyle.GetShadowColor() ) );
- }
-}
-// .............................................................
-} // namespace dbaui
-// .............................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppTitleWindow.hxx b/dbaccess/source/ui/app/AppTitleWindow.hxx
deleted file mode 100644
index 42ab6794f..000000000
--- a/dbaccess/source/ui/app/AppTitleWindow.hxx
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef DBAUI_TITLE_WINDOW_HXX
-#define DBAUI_TITLE_WINDOW_HXX
-
-#include <vcl/fixed.hxx>
-
-namespace dbaui
-{
- class OTitleWindow : public Window
- {
- FixedText m_aSpace1;
- FixedText m_aSpace2;
- FixedText m_aTitle;
- Window* m_pChild;
- sal_Bool m_bShift;
- void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
- protected:
- virtual void DataChanged(const DataChangedEvent& rDCEvt);
- public:
- OTitleWindow(Window* _pParent,sal_uInt16 _nTitleId,WinBits _nBits,sal_Bool _bShift = sal_True);
- virtual ~OTitleWindow();
-
- // window overloads
- virtual void Resize();
- virtual void GetFocus();
-
- /** sets the child window which should be displayed below the title. It will be destroyed at the end.
- @param _pChild
- The child window.
- */
- void setChildWindow(Window* _pChild);
-
- /** gets the child window.
-
- @return
- The child winodw.
- */
- inline Window* getChildWindow() const { return m_pChild; }
-
- /** sets the title text out of the resource
- @param _nTitleId
- The resource id of the title text.
- */
- void setTitle(sal_uInt16 _nTitleId);
-
-
- /** Gets the min Width in Pixel which is needed to display the whole
-
- @return
- the min width
- */
- long GetWidthPixel() const;
- };
-// .............................................................
-} // namespace dbaui
-// .............................................................
-#endif // DBAUI_TITLE_WINDOW_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppView.cxx b/dbaccess/source/ui/app/AppView.cxx
deleted file mode 100644
index 50001c2a0..000000000
--- a/dbaccess/source/ui/app/AppView.cxx
+++ /dev/null
@@ -1,601 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_dbaccess.hxx"
-#include "AppView.hxx"
-#include "dbu_app.hrc"
-#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
-#include "dbaccess_helpid.hrc"
-#include <vcl/toolbox.hxx>
-#include <unotools/configmgr.hxx>
-#include <vcl/waitobj.hxx>
-#include <comphelper/types.hxx>
-#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-#include <com/sun/star/sdb/XQueriesSupplier.hpp>
-#include <unotools/syslocale.hxx>
-#include "UITools.hxx"
-#include "AppDetailView.hxx"
-#include "tabletree.hxx"
-#include "AppSwapWindow.hxx"
-#include <vcl/svapp.hxx>
-#include "AppSwapWindow.hxx"
-#include "AppTitleWindow.hxx"
-#include "dsntypes.hxx"
-#include "dbustrings.hrc"
-#include "IController.hxx"
-#include "browserids.hxx"
-#include <unotools/pathoptions.hxx>
-#include "IApplicationController.hxx"
-
-using namespace ::dbaui;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::ucb;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::datatransfer::clipboard;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::frame;
-using namespace ::com::sun::star::container;
-using ::com::sun::star::sdb::application::NamedDatabaseObject;
-
-//==================================================================
-// class OAppBorderWindow
-DBG_NAME(OAppBorderWindow)
-//==================================================================
-OAppBorderWindow::OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePreviewMode) : Window(_pParent,WB_DIALOGCONTROL)
- ,m_pPanel(NULL)
- ,m_pDetailView(NULL)
- ,m_pView(_pParent)
-{
- DBG_CTOR(OAppBorderWindow,NULL);
-
- SetBorderStyle(WINDOW_BORDER_MONO);
-
- m_pPanel = new OTitleWindow(this,STR_DATABASE,WB_BORDER | WB_DIALOGCONTROL ,sal_False);
- m_pPanel->SetBorderStyle(WINDOW_BORDER_MONO);
- OApplicationSwapWindow* pSwap = new OApplicationSwapWindow( m_pPanel, *this );
- pSwap->Show();
- pSwap->SetUniqueId(UID_APP_SWAP_VIEW);
-
- m_pPanel->setChildWindow(pSwap);
- m_pPanel->SetUniqueId(UID_APP_DATABASE_VIEW);
- m_pPanel->Show();
-
- m_pDetailView = new OApplicationDetailView(*this,_ePreviewMode);
- m_pDetailView->Show();
-
- ImplInitSettings();
-}
-// -----------------------------------------------------------------------------
-OAppBorderWindow::~OAppBorderWindow()
-{
- // destroy children
- if ( m_pPanel )
- {
- m_pPanel->Hide();
- ::std::auto_ptr<Window> aTemp(m_pPanel);
- m_pPanel = NULL;
- }
- if ( m_pDetailView )
- {
- m_pDetailView->Hide();
- ::std::auto_ptr<Window> aTemp(m_pDetailView);
- m_pDetailView = NULL;
- }
-
- DBG_DTOR(OAppBorderWindow,NULL);
-}
-// -----------------------------------------------------------------------------
-void OAppBorderWindow::GetFocus()
-{
- if ( m_pPanel )
- m_pPanel->GrabFocus();
-}
-// -----------------------------------------------------------------------------
-void OAppBorderWindow::Resize()
-{
- // parent window dimension
- Size aOutputSize( GetOutputSize() );
- long nOutputWidth = aOutputSize.Width();
- long nOutputHeight = aOutputSize.Height();
- long nX = 0;
-
- Size aFLSize = LogicToPixel( Size( 3, 8 ), MAP_APPFONT );
- if ( m_pPanel )
- {
- OApplicationSwapWindow* pSwap = getPanel();
- if ( pSwap )
- {
- if ( pSwap->GetEntryCount() != 0 )
- nX = pSwap->GetBoundingBox( pSwap->GetEntry(0) ).GetWidth() + aFLSize.Height();
- }
- nX = ::std::max(m_pPanel->GetWidthPixel() ,nX);
- m_pPanel->SetPosSizePixel(Point(0,0),Size(nX,nOutputHeight));
- }
-
- if ( m_pDetailView )
- m_pDetailView->SetPosSizePixel(Point(nX + aFLSize.Width(),0),Size(nOutputWidth - nX - aFLSize.Width(),nOutputHeight));
-}
-// -----------------------------------------------------------------------------
-void OAppBorderWindow::DataChanged( const DataChangedEvent& rDCEvt )
-{
- Window::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
- (rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
- (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
- ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
- (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
- {
- ImplInitSettings();
- Invalidate();
- }
-}
-// -----------------------------------------------------------------------------
-void OAppBorderWindow::ImplInitSettings()
-{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- if( true )
- {
- Font aFont;
- aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont( aFont );
- }
-
- if( true )
- {
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
- }
-
- if( true )
- SetBackground( rStyleSettings.GetDialogColor() );
-}
-// -----------------------------------------------------------------------------
-OApplicationView* OAppBorderWindow::getView() const
-{
- return m_pView;
-}
-
-// -----------------------------------------------------------------------------
-OApplicationSwapWindow* OAppBorderWindow::getPanel() const
-{
- return static_cast< OApplicationSwapWindow* >( m_pPanel->getChildWindow() );
-}
-
-// -----------------------------------------------------------------------------
-OApplicationDetailView* OAppBorderWindow::getDetailView() const
-{
- return m_pDetailView;
-}
-
-//==================================================================
-// class OApplicationView
-//==================================================================
-DBG_NAME(OApplicationView);
-//------------------------------------------------------------------------------
-OApplicationView::OApplicationView( Window* pParent
- ,const Reference< XMultiServiceFactory >& _rxOrb
- ,IApplicationController& _rAppController
- ,PreviewMode _ePreviewMode
- ) :
- ODataView( pParent, _rAppController, _rxOrb, WB_DIALOGCONTROL )
- ,m_rAppController( _rAppController )
- ,m_eChildFocus(NONE)
-{
- DBG_CTOR(OApplicationView,NULL);
-
- try
- {
- m_aLocale = SvtSysLocale().GetLocaleData().getLocale();
- }
- catch(Exception&)
- {
- }
-
- m_pWin = new OAppBorderWindow(this,_ePreviewMode);
- m_pWin->SetUniqueId(UID_APP_VIEW_BORDER_WIN);
- m_pWin->Show();
-
- ImplInitSettings();
-}
-
-//------------------------------------------------------------------------------
-OApplicationView::~OApplicationView()
-{
- DBG_DTOR(OApplicationView,NULL);
-
- {
- stopComponentListening(m_xObject);
- m_pWin->Hide();
- ::std::auto_ptr<Window> aTemp(m_pWin);
- m_pWin = NULL;
- }
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::createIconAutoMnemonics( MnemonicGenerator& _rMnemonics )
-{
- if ( m_pWin && m_pWin->getPanel() )
- m_pWin->getPanel()->createIconAutoMnemonics( _rMnemonics );
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationView::setTaskExternalMnemonics( MnemonicGenerator& _rMnemonics )
-{
- if ( m_pWin && m_pWin->getDetailView() )
- m_pWin->getDetailView()->setTaskExternalMnemonics( _rMnemonics );
-}
-
-// -----------------------------------------------------------------------------
-void OApplicationView::DataChanged( const DataChangedEvent& rDCEvt )
-{
- ODataView::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
- (rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
- (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
- ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
- (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
- {
- ImplInitSettings();
- Invalidate();
- }
-}
-//------------------------------------------------------------------------------
-void OApplicationView::resizeDocumentView(Rectangle& _rPlayground)
-{
- if ( m_pWin && !_rPlayground.IsEmpty() )
- {
- Size aFLSize = LogicToPixel( Size( 3, 3 ), MAP_APPFONT );
- _rPlayground.Move( aFLSize.A(),aFLSize.B() );
- Size aOldSize = _rPlayground.GetSize();
- _rPlayground.SetSize( Size(aOldSize.A() - 2*aFLSize.A(), aOldSize.B() - 2*aFLSize.B()) );
-
- m_pWin->SetPosSizePixel(_rPlayground.TopLeft() , _rPlayground.GetSize() );
- }
- // just for completeness: there is no space left, we occupied it all ...
- _rPlayground.SetPos( _rPlayground.BottomRight() );
- _rPlayground.SetSize( Size( 0, 0 ) );
-}
-//------------------------------------------------------------------------------
-long OApplicationView::PreNotify( NotifyEvent& rNEvt )
-{
- switch(rNEvt.GetType())
- {
- case EVENT_GETFOCUS:
- if( m_pWin && getPanel() && getPanel()->HasChildPathFocus() )
- m_eChildFocus = PANELSWAP;
- else if ( m_pWin && getDetailView() && getDetailView()->HasChildPathFocus() )
- m_eChildFocus = DETAIL;
- else
- m_eChildFocus = NONE;
- break;
- case EVENT_KEYINPUT:
- {
- const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
- // give the pane the chance to intercept mnemonic accelerators
- // #i34790#
- if ( getPanel() && getPanel()->interceptKeyInput( *pKeyEvent ) )
- return 1L;
- // and ditto the detail view
- // #i72799#
- if ( getDetailView() && getDetailView()->interceptKeyInput( *pKeyEvent ) )
- return 1L;
- }
- break;
- }
-
- return ODataView::PreNotify(rNEvt);
-}
-// -----------------------------------------------------------------------------
-IClipboardTest* OApplicationView::getActiveChild() const
-{
- IClipboardTest* pTest = NULL;
- if ( DETAIL == m_eChildFocus )
- pTest = getDetailView();
- return pTest;
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationView::isCopyAllowed()
-{
- IClipboardTest* pTest = getActiveChild();
- return pTest && pTest->isCopyAllowed();
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationView::isCutAllowed()
-{
- IClipboardTest* pTest = getActiveChild();
- return pTest && pTest->isCutAllowed();
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationView::isPasteAllowed()
-{
- IClipboardTest* pTest = getActiveChild();
- return pTest && pTest->isPasteAllowed();
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::copy()
-{
- IClipboardTest* pTest = getActiveChild();
- if ( pTest )
- pTest->copy();
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::cut()
-{
- IClipboardTest* pTest = getActiveChild();
- if ( pTest )
- pTest->cut();
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::paste()
-{
- IClipboardTest* pTest = getActiveChild();
- if ( pTest )
- pTest->paste();
-}
-// -----------------------------------------------------------------------------
-::rtl::OUString OApplicationView::getQualifiedName( SvLBoxEntry* _pEntry ) const
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- return getDetailView()->getQualifiedName( _pEntry );
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationView::isLeaf(SvLBoxEntry* _pEntry) const
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- return getDetailView()->isLeaf(_pEntry);
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationView::isALeafSelected() const
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- return getDetailView()->isALeafSelected();
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::selectAll()
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- getDetailView()->selectAll();
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationView::isSortUp() const
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- return getDetailView()->isSortUp();
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::sortDown()
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- getDetailView()->sortDown();
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::sortUp()
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- getDetailView()->sortUp();
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationView::isFilled() const
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- return getDetailView()->isFilled();
-}
-// -----------------------------------------------------------------------------
-ElementType OApplicationView::getElementType() const
-{
- OSL_ENSURE(m_pWin && getDetailView() && getPanel(),"Detail view is NULL! -> GPF");
- return getDetailView()->HasChildPathFocus() ? getDetailView()->getElementType() : getPanel()->getElementType();
-}
-// -----------------------------------------------------------------------------
-sal_Int32 OApplicationView::getSelectionCount()
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- return getDetailView()->getSelectionCount();
-}
-// -----------------------------------------------------------------------------
-sal_Int32 OApplicationView::getElementCount()
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- return getDetailView()->getElementCount();
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::getSelectionElementNames( ::std::vector< ::rtl::OUString>& _rNames ) const
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- getDetailView()->getSelectionElementNames( _rNames );
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::describeCurrentSelectionForControl( const Control& _rControl, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- getDetailView()->describeCurrentSelectionForControl( _rControl, _out_rSelectedObjects );
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::describeCurrentSelectionForType( const ElementType _eType, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- getDetailView()->describeCurrentSelectionForType( _eType, _out_rSelectedObjects );
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::selectElements(const Sequence< ::rtl::OUString>& _aNames)
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- getDetailView()->selectElements( _aNames );
-}
-// -----------------------------------------------------------------------------
-SvLBoxEntry* OApplicationView::elementAdded(ElementType eType,const ::rtl::OUString& _rName, const Any& _rObject )
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- return getDetailView()->elementAdded(eType,_rName,_rObject);
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::elementRemoved(ElementType eType,const ::rtl::OUString& _rName )
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- getDetailView()->elementRemoved(eType,_rName);
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::elementReplaced(ElementType _eType
- ,const ::rtl::OUString& _rOldName
- ,const ::rtl::OUString& _rNewName )
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- getDetailView()->elementReplaced(_eType, _rOldName, _rNewName );
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::clearPages(sal_Bool _bTaskAlso)
-{
- OSL_ENSURE(m_pWin && getDetailView() && getPanel(),"Detail view is NULL! -> GPF");
- getPanel()->clearSelection();
- getDetailView()->clearPages(_bTaskAlso);
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::selectContainer(ElementType _eType)
-{
- OSL_ENSURE(m_pWin && getPanel(),"Detail view is NULL! -> GPF");
- WaitObject aWO(this);
- getPanel()->selectContainer(_eType);
-}
-// -----------------------------------------------------------------------------
-SvLBoxEntry* OApplicationView::getEntry( const Point& _aPosPixel ) const
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- return getDetailView()->getEntry(_aPosPixel);
-}
-// -----------------------------------------------------------------------------
-PreviewMode OApplicationView::getPreviewMode()
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- return getDetailView()->getPreviewMode();
-}
-// -----------------------------------------------------------------------------
-sal_Bool OApplicationView::isPreviewEnabled()
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- return getDetailView()->isPreviewEnabled();
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::switchPreview(PreviewMode _eMode)
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- getDetailView()->switchPreview(_eMode);
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::showPreview(const Reference< XContent >& _xContent)
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- stopComponentListening(m_xObject);
- m_xObject = NULL;
- getDetailView()->showPreview(_xContent);
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::showPreview( const ::rtl::OUString& _sDataSourceName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
- const ::rtl::OUString& _sName,
- sal_Bool _bTable)
-{
- OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
- if ( isPreviewEnabled() )
- {
- stopComponentListening(m_xObject);
- m_xObject = NULL;
- try
- {
- Reference<XNameAccess> xNameAccess;
- if ( _bTable )
- {
- Reference<XTablesSupplier> xSup(_xConnection,UNO_QUERY);
- if ( xSup.is() )
- xNameAccess.set(xSup->getTables(),UNO_QUERY);
- }
- else
- {
- Reference<XQueriesSupplier> xSup(_xConnection,UNO_QUERY);
- if ( xSup.is() )
- xNameAccess.set(xSup->getQueries(),UNO_QUERY);
- }
- if ( xNameAccess.is() && xNameAccess->hasByName(_sName) )
- m_xObject.set(xNameAccess->getByName(_sName),UNO_QUERY);
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- if ( m_xObject.is() )
- startComponentListening(m_xObject);
- getDetailView()->showPreview(_sDataSourceName,_sName,_bTable);
- }
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::GetFocus()
-{
- if ( m_eChildFocus == NONE && m_pWin )
- {
- m_pWin->GrabFocus();
- }
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::_disposing( const ::com::sun::star::lang::EventObject& /*_rSource*/ )
-{
- if ( m_pWin && getDetailView() )
- showPreview(NULL);
-}
-// -----------------------------------------------------------------------------
-void OApplicationView::ImplInitSettings()
-{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- if( true )
- {
- Font aFont;
- aFont = rStyleSettings.GetFieldFont();
- aFont.SetColor( rStyleSettings.GetWindowTextColor() );
- SetPointFont( aFont );
- }
-
- if( true )
- {
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
- }
-
- if( true )
- SetBackground( rStyleSettings.GetFieldColor() );
-}
-//-----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/AppView.hxx b/dbaccess/source/ui/app/AppView.hxx
deleted file mode 100644
index 371a58daf..000000000
--- a/dbaccess/source/ui/app/AppView.hxx
+++ /dev/null
@@ -1,316 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef DBAUI_APPVIEW_HXX
-#define DBAUI_APPVIEW_HXX
-
-#include "dataview.hxx"
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
-#include <com/sun/star/ucb/XContent.hpp>
-#include <com/sun/star/sdb/application/NamedDatabaseObject.hpp>
-#include <vcl/fixed.hxx>
-#include <unotools/eventlisteneradapter.hxx>
-#include "IClipBoardTest.hxx"
-#include "AppElementType.hxx"
-
-namespace com{ namespace sun { namespace star { namespace beans { class XPropertySet; } } } }
-
-class Control;
-class SvLBoxEntry;
-class MnemonicGenerator;
-
-namespace dbaui
-{
- class IControlActionListener;
- class IApplicationController;
- class OApplicationView;
- class OApplicationDetailView;
- class OApplicationSwapWindow;
- class OTitleWindow;
- //==================================================================
- class OAppBorderWindow : public Window
- {
- OTitleWindow* m_pPanel;
- OApplicationDetailView* m_pDetailView;
- OApplicationView* m_pView;
-
- void ImplInitSettings();
- protected:
- // Window
- virtual void DataChanged( const DataChangedEvent& rDCEvt );
- public:
- OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePreviewMode);
- virtual ~OAppBorderWindow();
-
- // window overloads
- virtual void GetFocus();
- virtual void Resize();
-
- OApplicationView* getView() const;
- OApplicationSwapWindow* getPanel() const;
- OApplicationDetailView* getDetailView() const;
- };
-
- //==================================================================
- class OApplicationView : public ODataView
- ,public IClipboardTest
- ,public ::utl::OEventListenerAdapter
- {
- enum ChildFocusState
- {
- PANELSWAP,
- DETAIL,
- NONE
- };
- private:
- ::com::sun::star::lang::Locale m_aLocale;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
- m_xObject;
- OAppBorderWindow* m_pWin;
- IApplicationController& m_rAppController;
- ChildFocusState m_eChildFocus;
-
- IClipboardTest* getActiveChild() const;
-
- void ImplInitSettings();
- protected:
-
-
- // return the Rectangle where I can paint myself
- virtual void resizeDocumentView(Rectangle& rRect);
-
- // OEventListenerAdapter
- virtual void _disposing( const ::com::sun::star::lang::EventObject& _rSource );
-
- // Window
- virtual void DataChanged( const DataChangedEvent& rDCEvt );
- public:
- OApplicationView( Window* pParent
- ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
- ,IApplicationController& _rAppController
- ,PreviewMode _ePreviewMode
- );
- virtual ~OApplicationView();
-
- /// automatically creates mnemonics for the icon/texts in our left hand side panel
- void createIconAutoMnemonics( MnemonicGenerator& _rMnemonics );
-
- /// automatically creates mnemonics for the texts in our task pane
- void setTaskExternalMnemonics( MnemonicGenerator& _rMnemonics );
-
- // window overloads
- virtual long PreNotify( NotifyEvent& rNEvt );
- virtual void GetFocus();
-
- inline IApplicationController& getAppController() const { return m_rAppController; }
- inline const ::com::sun::star::lang::Locale& getLocale() const { return m_aLocale;}
-
- // IClipboardTest
- virtual sal_Bool isCutAllowed();
- virtual sal_Bool isCopyAllowed();
- virtual sal_Bool isPasteAllowed();
- virtual sal_Bool hasChildPathFocus() { return HasChildPathFocus(); }
- virtual void copy();
- virtual void cut();
- virtual void paste();
-
- /// get the left panel
- inline OApplicationSwapWindow* getPanel() const { return m_pWin->getPanel(); }
- /// get the detail page
- inline OApplicationDetailView* getDetailView() const { return m_pWin->getDetailView(); }
-
- /** return the qualified name.
- @param _pEntry
- The entry of a table, or query, form, report to get the qualified name.
- If the entry is <NULL/>, the first selected is chosen.
- @return
- the qualified name
- */
- ::rtl::OUString getQualifiedName( SvLBoxEntry* _pEntry ) const;
-
- /** returns if an entry is a leaf
- @param _pEntry
- The entry to check
- @return
- <TRUE/> if the entry is a leaf, otherwise <FALSE/>
- */
- sal_Bool isLeaf(SvLBoxEntry* _pEntry) const;
-
- /** returns if one of the selected entries is a leaf
- @return
- <TRUE/> if the entry is a leaf, otherwise <FALSE/>
- */
- sal_Bool isALeafSelected() const;
-
- /** select all entries in the detail page
- */
- void selectAll();
-
- /// returns <TRUE/> if it sorts ascending
- sal_Bool isSortUp() const;
-
- /// sort the entries in the detail page down
- void sortDown();
-
- /// sort the entries in the detail page up
- void sortUp();
-
- /// returns <TRUE/> when a detail page was filled
- sal_Bool isFilled() const;
-
- /// return the element of currently select entry
- ElementType getElementType() const;
-
- /// returns the count of entries
- sal_Int32 getElementCount();
-
- /// returns the count of selected entries
- sal_Int32 getSelectionCount();
-
- /** clears the detail page and the selection on the left side.
- @param _bTaskAlso
- If <TRUE/> the task window will also be cleared.
- */
- void clearPages(sal_Bool _bTaskAlso = sal_True);
-
- /** returns the element names which are selected
- @param _rNames
- The list will be filled.
- */
- void getSelectionElementNames( ::std::vector< ::rtl::OUString>& _rNames ) const;
-
- /** describes the current selection for the given control
- */
- void describeCurrentSelectionForControl(
- const Control& _rControl,
- ::com::sun::star::uno::Sequence< ::com::sun::star::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
- );
-
- /** describes the current selection for the given ElementType
- */
- void describeCurrentSelectionForType(
- const ElementType _eType,
- ::com::sun::star::uno::Sequence< ::com::sun::star::sdb::application::NamedDatabaseObject >& _out_rSelectedObjects
- );
-
- /** select all names on the currently selected container. Non existence names where ignored.
- *
- * \param _aNames the element names
- */
- void selectElements(const ::com::sun::star::uno::Sequence< ::rtl::OUString>& _aNames);
-
- /** adds a new object to the detail page.
- @param _eType
- The type where the entry shold be appended.
- @param _rName
- The name of the object to be inserted
- @param _rObject
- The object to add.
- @param _rxConn
- If we insert a table, the connection must be set.
- */
- SvLBoxEntry* elementAdded(ElementType _eType
- ,const ::rtl::OUString& _rName
- ,const ::com::sun::star::uno::Any& _rObject );
-
- /** replaces a objects name with a new one
- @param _eType
- The type where the entry shold be appended.
- @param _rOldName
- The old name of the object to be replaced
- @param _rNewName
- The new name of the object to be replaced
- @param _rxConn
- If we insert a table, the connection must be set.
- @param _xObject
- The object which was replaced
- */
- void elementReplaced(ElementType eType
- ,const ::rtl::OUString& _rOldName
- ,const ::rtl::OUString& _rNewName );
-
- /** removes an element from the detail page.
- @param _eType
- The type where the entry shold be appended.
- @param _rName
- The name of the element to be removed.
- @param _rxConn
- If we remove a table, the connection must be set.
- */
- void elementRemoved(ElementType _eType
- ,const ::rtl::OUString& _rName );
-
-
- /** changes the container which should be displayed. The select handler will also be called.
- @param _eType
- Which container to show.
- */
- void selectContainer(ElementType _eType);
-
- /// returns the preview mode
- PreviewMode getPreviewMode();
-
- /// <TRUE/> if the preview is enabled
- sal_Bool isPreviewEnabled();
-
- /** switches to the given preview mode
- @param _eMode
- the mode to set for the preview
- */
- void switchPreview(PreviewMode _eMode);
-
- /** shows the Preview of the content when it is enabled.
- @param _xContent
- The content which must support the "preview" command.
- */
- void showPreview(const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent >& _xContent);
-
- /** shows the Preview of a table or query
- @param _sDataSourceName
- the name of the data source
- @param _xConnection
- the connection which will be shared
- @param _sName
- the name of table or query
- @param _bTable
- <TRUE/> if it is a table, otherwise <FALSE/>
- @return void
- */
- void showPreview( const ::rtl::OUString& _sDataSourceName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
- const ::rtl::OUString& _sName,
- sal_Bool _bTable);
-
- SvLBoxEntry* getEntry( const Point& _aPosPixel ) const;
-
- DECL_LINK( SwitchHdl, Accelerator* );
- };
-}
-#endif // DBAUI_APPVIEW_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/IApplicationController.hxx b/dbaccess/source/ui/app/IApplicationController.hxx
deleted file mode 100644
index 2dc4ab871..000000000
--- a/dbaccess/source/ui/app/IApplicationController.hxx
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-#ifndef DBA30D_IAPPLICATIONCONTROLLER_HXX
-#define DBA30D_IAPPLICATIONCONTROLLER_HXX
-
-#include "IController.hxx"
-#include "AppElementType.hxx"
-#include "callbacks.hxx"
-
-/** === begin UNO includes === **/
-/** === end UNO includes === **/
-
-class SvTreeListBox;
-class SvLBoxEntry;
-
-//........................................................................
-namespace dbaui
-{
-//........................................................................
-
- class SAL_NO_VTABLE IApplicationController :public IController
- ,public IControlActionListener
- ,public IContextMenuProvider
- {
- public:
- /** called when an entry in a tree list box has been double-clicked
- @param _rTree
- The tree list box.
- @return
- <TRUE/> if the double click event has been handled by the called, and should not
- be processed further.
- */
- virtual bool onEntryDoubleClick( SvTreeListBox& _rTree ) = 0;
-
- /** called when a container (category) in the application view has been selected
- @param _pTree
- The tree list box.
- @return
- <TRUE/> if the cotainer could be changed otherwise <FALSE/>
- */
- virtual sal_Bool onContainerSelect(ElementType _eType) = 0;
-
- /** called when an entry in a tree view has been selected
- @param _pEntry
- the selected entry
- */
- virtual void onSelectionChanged() = 0;
-
- /** called when a "Cut" command is executed in a tree view
- */
- virtual void onCutEntry() = 0;
-
- /** called when a "Copy" command is executed in a tree view
- */
- virtual void onCopyEntry() = 0;
-
- /** called when a "Paste" command is executed in a tree view
- */
- virtual void onPasteEntry() = 0;
-
- /** called when a "Delete" command is executed in a tree view
- */
- virtual void onDeleteEntry() = 0;
-
- /// called when the preview mode was changed
- virtual void previewChanged( sal_Int32 _nMode ) = 0;
-
- /// called when an object container of any kind was found during enumerating tree view elements
- virtual void containerFound( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >& _xContainer) = 0;
- };
-
-//........................................................................
-} // namespace dbaui
-//........................................................................
-
-#endif // DBA30D_IAPPLICATIONCONTROLLER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/app.src b/dbaccess/source/ui/app/app.src
deleted file mode 100644
index 92c0e3ebc..000000000
--- a/dbaccess/source/ui/app/app.src
+++ /dev/null
@@ -1,478 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _DBU_APP_HRC_
-#include "dbu_app.hrc"
-#endif
-#ifndef _GLOBLMN_HRC
-#include <svx/globlmn.hrc>
-#endif
-#ifndef _CNTIDS_HRC
-#include <sfx2/cntids.hrc>
-#endif
-#ifndef DBACCESS_UI_BROWSER_ID_HXX
-#include "browserids.hxx"
-#endif
-#ifndef _DBA_DBACCESS_HELPID_HRC_
-#include "dbaccess_helpid.hrc"
-#endif
-#ifndef DBAUI_TOOLBOX_HXX
-#include "toolbox.hrc"
-#endif
-
-#define MN_PROPS 25
-
-
-String RID_STR_NEW_FORM
-{
- Text [ en-US ] = "Create Form in Design View..." ;
-};
-
-String RID_STR_NEW_FORM_AUTO
-{
- Text [ en-US ] = "Use Wizard to Create Form..." ;
-};
-
-String RID_STR_NEW_REPORT_AUTO
-{
- Text [ en-US ] = "Use Wizard to Create Report..." ;
-};
-
-String RID_STR_NEW_REPORT
-{
- Text [ en-US ] = "Create Report in Design View..." ;
-};
-
-String RID_STR_NEW_QUERY
-{
- Text [ en-US ] = "Create Query in Design View..." ;
-};
-
-String RID_STR_NEW_QUERY_SQL
-{
- Text [ en-US ] = "Create Query in SQL View..." ;
-};
-
-String RID_STR_NEW_QUERY_AUTO
-{
- Text [ en-US ] = "Use Wizard to Create Query..." ;
-};
-String RID_STR_NEW_TABLE
-{
- Text [ en-US ] = "Create Table in Design View..." ;
-};
-
-String RID_STR_NEW_TABLE_AUTO
-{
- Text [ en-US ] = "Use Wizard to Create Table..." ;
-};
-String RID_STR_NEW_VIEW
-{
- Text [ en-US ] = "Create View..." ;
-};
-
-String RID_STR_FORMS_CONTAINER
-{
- Text [ en-US ] = "Forms" ;
-};
-
-String RID_STR_REPORTS_CONTAINER
-{
- Text [ en-US ] = "Reports" ;
-};
-
-Menu RID_MENU_APP_NEW
-{
- ItemList =
- {
- MenuItem
- {
- Identifier = SID_APP_NEW_FORM;
- Command = ".uno:DBNewForm";
- Text [ en-US ] = "Form..." ;
- };
- MenuItem
- {
- Identifier = SID_APP_NEW_REPORT;
- Command = ".uno:DBNewReport";
- Text [ en-US ] = "Report..." ;
- };
- MenuItem
- {
- MID_DOCUMENT_CREATE_REPWIZ
- Command = ".uno:DBNewReportAutoPilot";
- };
- MenuItem
- {
- MID_QUERY_NEW_DESIGN
- Command = ".uno:DBNewQuery";
- };
- MenuItem
- {
- MID_QUERY_NEW_SQL
- Command = ".uno:DBNewQuerySql";
- };
- MenuItem
- {
- Separator = TRUE;
- };
- MenuItem
- {
- MID_NEW_TABLE_DESIGN
- Command = ".uno:DBNewTable";
- };
- MenuItem
- {
- MID_NEW_VIEW_DESIGN
- Command = ".uno:DBNewView";
- };
- MenuItem
- {
- Identifier = SID_DB_NEW_VIEW_SQL;
- Command = ".uno:DBNewViewSQL";
- Text [ en-US ] = "View (Simple)..." ;
- };
-
- };
-};
-
-Menu RID_MENU_APP_EDIT
-{
- ItemList =
- {
- MenuItem
- {
- ITEM_EDIT_COPY
- };
- MenuItem
- {
- ITEM_EDIT_PASTE
- };
- MenuItem
- {
- Identifier = SID_DB_APP_PASTE_SPECIAL;
- Text[ en-US ] = "Paste Special...";
- Command = ".uno:PasteSpecial";
- };
- MenuItem
- {
- Separator = TRUE ;
- };
- MenuItem
- {
- Identifier = SID_DB_APP_DELETE;
- Text[ en-US ] = "Delete";
- Command = ".uno:DBDelete";
- };
- MenuItem
- {
- Identifier = SID_DB_APP_RENAME;
- Text[ en-US ] = "Rename";
- Command = ".uno:DBRename";
- };
- MenuItem
- {
- Identifier = SID_DB_APP_EDIT;
- Text[ en-US ] = "Edit";
- Command = ".uno:DBEdit";
- };
- MenuItem
- {
- Identifier = SID_DB_APP_EDIT_SQL_VIEW;
- Text [ en-US ] = "Edit in SQL View...";
- Command = ".uno:DBEditSqlView";
- };
- MenuItem
- {
- Identifier = SID_DB_APP_OPEN;
- Text[ en-US ] = "Open";
- Command = ".uno:DBOpen";
- };
- MenuItem
- {
- Identifier = SID_DB_APP_CONVERTTOVIEW;
- Text[ en-US ] = "Create as View";
- Command = ".uno:DBConvertToView";
- };
- MenuItem
- {
- Identifier = SID_FORM_CREATE_REPWIZ_PRE_SEL;
- Text [ en-US ] = "Form Wizard...";
- Command = ".uno:DBNewFormAutoPilotWithPreSelection";
- };
- MenuItem
- {
- Identifier = SID_APP_NEW_REPORT_PRE_SEL;
- Command = ".uno:DBNewReportWithPreSelection";
- Text [ en-US ] = "Report..." ;
- };
- MenuItem
- {
- Identifier = SID_REPORT_CREATE_REPWIZ_PRE_SEL ;
- Text[ en-US ] = "Report Wizard...";
-
- Command = ".uno:DBNewReportAutoPilotWithPreSelection";
- };
- MenuItem
- {
- Separator = TRUE ;
- };
- MenuItem
- {
- Identifier = SID_SELECTALL;
- Text[ en-US ] = "Select All";
- Command = ".uno:SelectAll";
- };
- MenuItem
- {
- Separator = TRUE ;
- };
- MenuItem
- {
- Identifier = MN_PROPS;
- Text[ en-US ] = "~Database";
- SubMenu = Menu
- {
- ItemList =
- {
- MenuItem
- {
- Identifier = SID_DB_APP_DSPROPS;
- Text[ en-US ] = "Properties...";
- Command = ".uno:DBDSProperties";
- };
- MenuItem
- {
- Identifier = SID_DB_APP_DSCONNECTION_TYPE;
- Text[ en-US ] = "Connection Type...";
- Command = ".uno:DBDSConnectionType";
- };
- MenuItem
- {
- Identifier = SID_DB_APP_DSADVANCED_SETTINGS;
- Text[ en-US ] = "Advanced Settings...";
- Command = ".uno:DBDSAdvancedSettings";
- };
- };
- };
- };
- };
-};
-
-String STR_QUERY_DELETE_DATASOURCE
-{
- Text [ en-US ] = "Do you want to delete the data source '%1'?" ;
-};
-
-String STR_APP_TITLE
-{
- Text [ en-US ] = " - %PRODUCTNAME Base" ;
-};
-
-String RID_STR_REPORTS_HELP_TEXT_WIZARD
-{
- Text [ en-US ] = "The wizard will guide you through the steps necessary to create a report." ;
-};
-
-String RID_STR_FORMS_HELP_TEXT
-{
- Text [ en-US ] = "Create a form by specifying the record source, controls, and control properties." ;
-};
-
-String RID_STR_REPORT_HELP_TEXT
-{
- Text [ de ] ="Erstellen Sie einen Bericht, indem Sie die Datensatzquelle, Steuerelemente und Steuerelementeigenschaften angeben." ;
- Text [ en-US ] = "Create a report by specifying the record source, controls, and control properties." ;
-};
-
-String RID_STR_FORMS_HELP_TEXT_WIZARD
-{
- Text [ en-US ] = "The wizard will guide you through the steps necessary to create a form." ;
-};
-
-String RID_STR_QUERIES_HELP_TEXT
-{
- Text [ en-US ] = "Create a query by specifying the filters, input tables, field names, and properties for sorting or grouping." ;
-};
-
-String RID_STR_QUERIES_HELP_TEXT_SQL
-{
- Text [ en-US ] = "Create a query entering an SQL statement directly." ;
-};
-
-String RID_STR_QUERIES_HELP_TEXT_WIZARD
-{
- Text [ en-US ] = "The wizard will guide you through the steps necessary to create a query." ;
-};
-
-String RID_STR_TABLES_HELP_TEXT_DESIGN
-{
- Text [ en-US ] = "Create a table by specifying the field names and properties, as well as the data types." ;
-};
-
-String RID_STR_TABLES_HELP_TEXT_WIZARD
-{
- Text [ en-US ] = "Choose from a selection of business and personal table samples, which you customize to create a table." ;
-};
-
-String RID_STR_VIEWS_HELP_TEXT_DESIGN
-{
- Text [ en-US ] = "Create a view by specifying the tables and field names you would like to have visible." ;
-};
-
-String RID_STR_VIEWS_HELP_TEXT_WIZARD
-{
- Text [ en-US ] = "Opens the view wizard" ;
-};
-
-String STR_DATABASE
-{
- Text [ en-US ] = "Database" ;
-};
-
-String STR_TASKS
-{
- Text [ en-US ] = "Tasks" ;
-};
-
-String STR_DESCRIPTION
-{
- Text [ en-US ] = "Description" ;
-};
-
-String STR_PREVIEW
-{
- Text [ en-US ] = "Preview" ;
-};
-
-String STR_DISABLEPREVIEW
-{
- Text [ en-US ] = "Disable Preview" ;
-};
-
-QueryBox APP_SAVEMODIFIED
-{
- Buttons = WB_YES_NO_CANCEL ;
- DefButton = WB_DEF_YES ;
- Message [ en-US ] = "The database has been modified.\nDo you want to save the changes?" ;
-};
-
-QueryBox APP_CLOSEDOCUMENTS
-{
- Buttons = WB_YES_NO ;
- DefButton = WB_DEF_YES ;
- Message [ en-US ] = "The connection type has been altered.\nFor the changes to take effect, all forms, reports, queries and tables must be closed.\n\nDo you want to close all documents now?" ;
-};
-
-Menu RID_MENU_APP_PREVIEW
-{
- ItemList =
- {
- MenuItem
- {
- Identifier = SID_DB_APP_DISABLE_PREVIEW;
- Text[ en-US ] = "None";
- Command = ".uno:DBDisablePreview";
- Checkable = TRUE;
- RadioCheck = TRUE;
- AutoCheck = TRUE;
- };
- MenuItem
- {
- Identifier = SID_DB_APP_VIEW_DOCINFO_PREVIEW;
- Text[ en-US ] = "Document Information";
- Command = ".uno:DBShowDocInfoPreview";
- Checkable = TRUE;
- RadioCheck = TRUE;
- AutoCheck = TRUE;
- };
- MenuItem
- {
- Identifier = SID_DB_APP_VIEW_DOC_PREVIEW;
- Text[ en-US ] = "Document";
- Command = ".uno:DBShowDocPreview";
- Checkable = TRUE;
- RadioCheck = TRUE;
- AutoCheck = TRUE;
- };
- };
-};
-
-String RID_STR_FORM
-{
- Text [ en-US ] = "Form";
-};
-
-String RID_STR_REPORT
-{
- Text [ en-US ] = "Report";
-};
-
-String STR_FRM_LABEL
-{
- Text [ en-US ] = "F~orm name" ;
-};
-
-String STR_RPT_LABEL
-{
- Text [ en-US ] = "~Report name" ;
-};
-
-String STR_FOLDER_LABEL
-{
- Text [ en-US ] = "F~older name" ;
-};
-
-String STR_SUB_DOCS_WITH_SCRIPTS
-{
- Text [ en-US ] = "The document contains forms or reports with embedded macros.";
-};
-
-String STR_SUB_DOCS_WITH_SCRIPTS_DETAIL
-{
- Text [ en-US ] = "Macros should be embedded into the database document itself.\n\n"
-
- "You can continue to use your document as before, however, you are encouraged to migrate "
- "your macros. The menu item 'Tools / Migrate Macros ...' will assist you with this.\n\n"
-
- "Note that you won't be able to embed macros into the database document itself until "
- "this migration is done. ";
-};
-
-String RID_STR_EMBEDDED_DATABASE
-{
- Text [ en-US ] = "Embedded database";
-};
-
-String RID_STR_NO_DIFF_CAT
-{
- Text [ en-US ] = "You cannot select different categories.";
-};
-
-String RID_STR_UNSUPPORTED_OBJECT_TYPE
-{
- Text [ en-US ] = "Unsupported object type found ($type$).";
-};
diff --git a/dbaccess/source/ui/app/closeveto.cxx b/dbaccess/source/ui/app/closeveto.cxx
deleted file mode 100644
index 558df26b6..000000000
--- a/dbaccess/source/ui/app/closeveto.cxx
+++ /dev/null
@@ -1,180 +0,0 @@
-/*************************************************************************
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "precompiled_dbaccess.hxx"
-
-#include "closeveto.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/util/XCloseable.hpp>
-/** === end UNO includes === **/
-
-#include <cppuhelper/implbase1.hxx>
-#include <rtl/ref.hxx>
-#include <tools/diagnose_ex.h>
-
-//......................................................................................................................
-namespace dbaui
-{
-//......................................................................................................................
-
- /** === begin UNO using === **/
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::XInterface;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::UNO_SET_THROW;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::RuntimeException;
- using ::com::sun::star::uno::Any;
- using ::com::sun::star::uno::makeAny;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::uno::Type;
- using ::com::sun::star::util::XCloseable;
- using ::com::sun::star::util::XCloseListener;
- using ::com::sun::star::util::CloseVetoException;
- using ::com::sun::star::lang::EventObject;
- /** === end UNO using === **/
-
- //==================================================================================================================
- //= CloseListener_Impl
- //==================================================================================================================
- typedef ::cppu::WeakImplHelper1 < XCloseListener
- > CloseListener_Base;
- class DBACCESS_DLLPRIVATE CloseListener_Impl : public CloseListener_Base
- {
- public:
- CloseListener_Impl()
- :m_bHasOwnership( false )
- {
- }
-
- // XCloseListener
- virtual void SAL_CALL queryClosing( const EventObject& Source, ::sal_Bool GetsOwnership ) throw (CloseVetoException, RuntimeException);
- virtual void SAL_CALL notifyClosing( const EventObject& Source ) throw (RuntimeException);
-
- // XEventListener
- virtual void SAL_CALL disposing( const EventObject& Source) throw (RuntimeException);
-
- bool hasOwnership() const { return m_bHasOwnership; }
-
- protected:
- ~CloseListener_Impl()
- {
- }
-
- private:
- bool m_bHasOwnership;
- };
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL CloseListener_Impl::queryClosing( const EventObject& i_source, ::sal_Bool i_deliverOwnership ) throw (CloseVetoException, RuntimeException)
- {
- (void)i_source;
-
- if ( !m_bHasOwnership )
- m_bHasOwnership = i_deliverOwnership;
-
- throw CloseVetoException();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL CloseListener_Impl::notifyClosing( const EventObject& i_source ) throw (RuntimeException)
- {
- (void)i_source;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL CloseListener_Impl::disposing( const EventObject& i_source ) throw (RuntimeException)
- {
- (void)i_source;
- }
-
- //==================================================================================================================
- //= CloseVeto_Data
- //==================================================================================================================
- struct DBACCESS_DLLPRIVATE CloseVeto_Data
- {
- Reference< XCloseable > xCloseable;
- ::rtl::Reference< CloseListener_Impl > pListener;
- };
-
- //==================================================================================================================
- //= operations
- //==================================================================================================================
- namespace
- {
- //--------------------------------------------------------------------------------------------------------------
- void lcl_init( CloseVeto_Data& i_data, const Reference< XInterface >& i_closeable )
- {
- i_data.xCloseable.set( i_closeable, UNO_QUERY );
- ENSURE_OR_RETURN_VOID( i_data.xCloseable.is(), "CloseVeto: the component is not closeable!" );
-
- i_data.pListener = new CloseListener_Impl;
- i_data.xCloseable->addCloseListener( i_data.pListener.get() );
- }
-
- //--------------------------------------------------------------------------------------------------------------
- void lcl_deinit( CloseVeto_Data& i_data )
- {
- if ( !i_data.xCloseable.is() )
- return;
-
- i_data.xCloseable->removeCloseListener( i_data.pListener.get() );
- if ( i_data.pListener->hasOwnership() )
- {
- try
- {
- i_data.xCloseable->close( sal_True );
- }
- catch( const CloseVetoException& ) { }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- }
- }
-
- //==================================================================================================================
- //= CloseVeto
- //==================================================================================================================
- //------------------------------------------------------------------------------------------------------------------
- CloseVeto::CloseVeto( const Reference< XInterface >& i_closeable )
- :m_pData( new CloseVeto_Data )
- {
- lcl_init( *m_pData, i_closeable );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- CloseVeto::~CloseVeto()
- {
- lcl_deinit( *m_pData );
- }
-
-//......................................................................................................................
-} // namespace dbaui
-//......................................................................................................................
diff --git a/dbaccess/source/ui/app/closeveto.hxx b/dbaccess/source/ui/app/closeveto.hxx
deleted file mode 100644
index f7e1c8364..000000000
--- a/dbaccess/source/ui/app/closeveto.hxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/*************************************************************************
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef DBACCESS_CLOSEVETO_HXX
-#define DBACCESS_CLOSEVETO_HXX
-
-#include "dbaccessdllapi.h"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/uno/XInterface.hpp>
-/** === end UNO includes === **/
-
-#include <boost/scoped_ptr.hpp>
-
-//......................................................................................................................
-namespace dbaui
-{
-//......................................................................................................................
-
- //==================================================================================================================
- //= CloseVeto
- //==================================================================================================================
- struct CloseVeto_Data;
- /** will add a XCloseListener to a given component, and veto its closing as long as the <code>CloseVeto</code>
- instance is alive.
-
- If closing has been requested and vetoed while the <code>CloseVeto</code> instance is alive, and the ownership
- went to the <code>CloseVeto</code> instance, then it will close the component in its dtor.
- */
- class DBACCESS_DLLPRIVATE CloseVeto
- {
- public:
- CloseVeto( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_closeable );
- ~CloseVeto();
-
- private:
- ::boost::scoped_ptr< CloseVeto_Data > m_pData;
- };
-
-//......................................................................................................................
-} // namespace dbaui
-//......................................................................................................................
-
-#endif // DBACCESS_CLOSEVETO_HXX
diff --git a/dbaccess/source/ui/app/dbu_app.hrc b/dbaccess/source/ui/app/dbu_app.hrc
deleted file mode 100644
index 1fc719762..000000000
--- a/dbaccess/source/ui/app/dbu_app.hrc
+++ /dev/null
@@ -1,78 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _DBU_APP_HRC_
-#define _DBU_APP_HRC_
-
-#ifndef _DBU_RESOURCE_HRC_
-#include "dbu_resource.hrc"
-#endif
-
-#define TBI_SWITCH_PREVIEW RID_DBACCESS_START
-
-#define RID_STR_NEW_FORM RID_STR_APP_START
-#define RID_STR_NEW_FORM_AUTO RID_STR_APP_START + 1
-#define RID_STR_NEW_REPORT RID_STR_APP_START + 2
-#define RID_STR_NEW_REPORT_AUTO RID_STR_APP_START + 3
-#define RID_STR_NEW_TABLE RID_STR_APP_START + 4
-#define RID_STR_NEW_TABLE_AUTO RID_STR_APP_START + 5
-#define RID_STR_NEW_VIEW RID_STR_APP_START + 6
-#define RID_STR_NEW_VIEW_AUTO RID_STR_APP_START + 7
-#define RID_STR_NEW_QUERY RID_STR_APP_START + 8
-#define RID_STR_NEW_QUERY_AUTO RID_STR_APP_START + 9
-#define STR_QUERY_DELETE_DATASOURCE RID_STR_APP_START + 10
-#define STR_APP_TITLE RID_STR_APP_START + 11
-#define RID_STR_NEW_QUERY_SQL RID_STR_APP_START + 12
-#define RID_STR_REPORTS_CONTAINER RID_STR_APP_START + 13
-#define RID_STR_FORMS_CONTAINER RID_STR_APP_START + 14
-#define RID_STR_REPORTS_HELP_TEXT_WIZARD RID_STR_APP_START + 15
-#define RID_STR_FORMS_HELP_TEXT RID_STR_APP_START + 16
-#define RID_STR_QUERIES_HELP_TEXT RID_STR_APP_START + 17
-#define RID_STR_QUERIES_HELP_TEXT_SQL RID_STR_APP_START + 18
-#define RID_STR_VIEWS_HELP_TEXT_DESIGN RID_STR_APP_START + 19
-#define RID_STR_VIEWS_HELP_TEXT_WIZARD RID_STR_APP_START + 20
-#define STR_DATABASE RID_STR_APP_START + 21
-#define STR_TASKS RID_STR_APP_START + 22
-#define STR_DESCRIPTION RID_STR_APP_START + 23
-#define STR_PREVIEW RID_STR_APP_START + 24
-#define STR_DISABLEPREVIEW RID_STR_APP_START + 25
-#define RID_STR_QUERIES_HELP_TEXT_WIZARD RID_STR_APP_START + 26
-#define RID_STR_TABLES_HELP_TEXT_DESIGN RID_STR_APP_START + 27
-#define RID_STR_TABLES_HELP_TEXT_WIZARD RID_STR_APP_START + 28
-#define RID_STR_FORMS_HELP_TEXT_WIZARD RID_STR_APP_START + 29
-#define RID_STR_REPORT_HELP_TEXT RID_STR_APP_START + 30
-#define RID_STR_EMBEDDED_DATABASE RID_STR_APP_START + 31
-#define RID_STR_NO_DIFF_CAT RID_STR_APP_START + 32
-#define RID_STR_UNSUPPORTED_OBJECT_TYPE RID_STR_APP_START + 33
-
-// please adjust checking before insert new strings
-
-#if RID_STR_UNSUPPORTED_OBJECT_TYPE > RID_STR_APP_END
-#error Resource-Id Ueberlauf in #file, #line
-#endif
-
-#endif // _DBU_BRW_HRC_
-
diff --git a/dbaccess/source/ui/app/subcomponentmanager.cxx b/dbaccess/source/ui/app/subcomponentmanager.cxx
deleted file mode 100644
index 4a56bbe3d..000000000
--- a/dbaccess/source/ui/app/subcomponentmanager.cxx
+++ /dev/null
@@ -1,614 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-#include "subcomponentmanager.hxx"
-#include "AppController.hxx"
-#include "dbustrings.hrc"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/frame/XModel2.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <com/sun/star/awt/XTopWindow.hpp>
-#include <com/sun/star/embed/XComponentSupplier.hpp>
-#include <com/sun/star/ucb/XCommandProcessor.hpp>
-#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-/** === end UNO includes === **/
-
-#include <tools/diagnose_ex.h>
-#include <vcl/svapp.hxx>
-#include <osl/mutex.hxx>
-
-#include <algorithm>
-#include <functional>
-
-//......................................................................................................................
-namespace dbaui
-{
-//......................................................................................................................
-
- /** === begin UNO using === **/
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::XInterface;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::UNO_SET_THROW;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::RuntimeException;
- using ::com::sun::star::uno::Any;
- using ::com::sun::star::uno::makeAny;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::uno::Type;
- using ::com::sun::star::frame::XFrame;
- using ::com::sun::star::frame::XController;
- using ::com::sun::star::frame::XModel;
- using ::com::sun::star::lang::EventObject;
- using ::com::sun::star::lang::XComponent;
- using ::com::sun::star::frame::XModel2;
- using ::com::sun::star::container::XEnumeration;
- using ::com::sun::star::util::XCloseable;
- using ::com::sun::star::awt::XTopWindow;
- using ::com::sun::star::embed::XComponentSupplier;
- using ::com::sun::star::ucb::XCommandProcessor;
- using ::com::sun::star::ucb::Command;
- using ::com::sun::star::document::XDocumentEventBroadcaster;
- using ::com::sun::star::beans::XPropertySet;
- using ::com::sun::star::beans::PropertyChangeEvent;
- /** === end UNO using === **/
-
- //==================================================================================================================
- //= helper structs
- //==================================================================================================================
- namespace
- {
- //..............................................................................................................
- struct SubComponentDescriptor
- {
- /// the name of the sub component, empty if it is yet unsaved
- ::rtl::OUString sName;
- /// type of the component - an ElementType value, except for relation design
- sal_Int32 nComponentType;
- /// the mode in which the sub component has been opened
- ElementOpenMode eOpenMode;
- /// the frame which the component resides in. Must not be <NULL/>
- Reference< XFrame > xFrame;
- /// the controller of the sub component. Must not be <NULL/>
- Reference< XController > xController;
- /// the model of the sub component. Might be <NULL/>
- Reference< XModel > xModel;
- /// the document definition which holds the component, if any; as CommandProcessor
- Reference< XCommandProcessor > xComponentCommandProcessor;
- /// the document definition which holds the component, if any; as PropertySet
- Reference< XPropertySet > xDocumentDefinitionProperties;
-
- SubComponentDescriptor()
- :sName()
- ,nComponentType( -1 )
- ,eOpenMode( E_OPEN_NORMAL )
- ,xFrame()
- ,xController()
- ,xModel()
- {
- }
-
- SubComponentDescriptor( const ::rtl::OUString& i_rName, const sal_Int32 i_nComponentType,
- const ElementOpenMode i_eOpenMode, const Reference< XComponent >& i_rComponent )
- :sName( i_rName )
- ,nComponentType( i_nComponentType )
- ,eOpenMode( i_eOpenMode )
- {
- if ( !impl_constructFrom( i_rComponent ) )
- {
- // i_rComponent is neither a model, nor a controller, nor a frame
- // => it must be a css.sdb.DocumentDefinition
- Reference< XComponentSupplier > xCompSupp( i_rComponent, UNO_QUERY_THROW );
- Reference< XComponent > xComponent( xCompSupp->getComponent(), UNO_QUERY_THROW );
- if ( !impl_constructFrom( xComponent ) )
- throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Illegal component type." ) ), NULL );
- xComponentCommandProcessor.set( i_rComponent, UNO_QUERY_THROW );
- xDocumentDefinitionProperties.set( i_rComponent, UNO_QUERY_THROW );
- }
- }
-
- inline bool is() const { return xFrame.is(); }
-
- private:
- bool impl_constructFrom( const Reference< XComponent >& _rxComponent )
- {
- // is it a model?
- xModel.set( _rxComponent, UNO_QUERY );
- if ( xModel.is() )
- {
- xController.set( xModel->getCurrentController() );
- if ( xController.is() )
- xFrame.set( xController->getFrame(), UNO_SET_THROW );
- }
- else
- {
- // is it a controller?
- xController.set( _rxComponent, UNO_QUERY );
- if ( xController.is() )
- {
- xFrame.set( xController->getFrame(), UNO_SET_THROW );
- }
- else
- {
- // is it a frame?
- xFrame.set( _rxComponent, UNO_QUERY );
- if ( !xFrame.is() )
- return false;
-
- // ensure we have a controller
- xController.set( xFrame->getController(), UNO_SET_THROW );
- }
-
- // check wether there is a model (not required)
- xModel.set( xController->getModel() );
- }
-
- return true;
- }
- };
-
- //..............................................................................................................
- struct SelectSubComponent : public ::std::unary_function< SubComponentDescriptor, Reference< XComponent > >
- {
- Reference< XComponent > operator()( const SubComponentDescriptor &_desc ) const
- {
- if ( _desc.xModel.is() )
- return _desc.xModel.get();
- OSL_ENSURE( _desc.xController.is(), "SelectSubComponent::operator(): illegal component!" );
- return _desc.xController.get();
- }
- };
-
- //..............................................................................................................
- typedef ::std::vector< SubComponentDescriptor > SubComponents;
-
- //..............................................................................................................
- struct SubComponentMatch : public ::std::unary_function< SubComponentDescriptor, bool >
- {
- public:
- SubComponentMatch( const ::rtl::OUString& i_rName, const sal_Int32 i_nComponentType,
- const ElementOpenMode i_eOpenMode )
- :m_sName( i_rName )
- ,m_nComponentType( i_nComponentType )
- ,m_eOpenMode( i_eOpenMode )
- {
- }
-
- bool operator()( const SubComponentDescriptor& i_rCompareWith ) const
- {
- return ( m_sName == i_rCompareWith.sName )
- && ( m_nComponentType == i_rCompareWith.nComponentType )
- && ( m_eOpenMode == i_rCompareWith.eOpenMode );
- }
- private:
- const ::rtl::OUString m_sName;
- const sal_Int32 m_nComponentType;
- const ElementOpenMode m_eOpenMode;
- };
- }
-
- //==================================================================================================================
- //= SubComponentManager_Data
- //==================================================================================================================
- struct SubComponentManager_Data
- {
- SubComponentManager_Data( OApplicationController& _rController, const ::comphelper::SharedMutex& _rMutex )
- :m_rController( _rController )
- ,m_aMutex( _rMutex )
- {
- }
-
- OApplicationController& m_rController;
- mutable ::comphelper::SharedMutex m_aMutex;
- SubComponents m_aComponents;
-
- ::osl::Mutex& getMutex() const { return m_aMutex; }
- };
-
- //==================================================================================================================
- //= SubComponentManager
- //==================================================================================================================
- //------------------------------------------------------------------------------------------------------------------
- SubComponentManager::SubComponentManager( OApplicationController& _rController, const ::comphelper::SharedMutex& _rMutex )
- :m_pData( new SubComponentManager_Data( _rController, _rMutex ) )
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- SubComponentManager::~SubComponentManager()
- {
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SubComponentManager::disposing()
- {
- ::osl::MutexGuard aGuard( m_pData->getMutex() );
- m_pData->m_aComponents.clear();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- namespace
- {
- //..............................................................................................................
- bool lcl_fallbackToAnotherController( SubComponentDescriptor& _rCompDesc )
- {
- Reference< XController > xFallback;
- OSL_PRECOND( _rCompDesc.xModel.is(), "lcl_fallbackToAnotherController: illegal call!" );
- if ( !_rCompDesc.xModel.is() )
- return false;
-
- xFallback.set( _rCompDesc.xModel->getCurrentController() );
- if ( xFallback == _rCompDesc.xController )
- // don't accept the very same controller as fallback
- xFallback.clear();
-
- if ( !xFallback.is() )
- {
- // perhaps XModel2 can be of help here
- Reference< XModel2 > xModel2( _rCompDesc.xModel, UNO_QUERY );
- Reference< XEnumeration > xControllerEnum;
- if ( xModel2.is() )
- xControllerEnum = xModel2->getControllers();
- while ( xControllerEnum.is() && xControllerEnum->hasMoreElements() )
- {
- xFallback.set( xControllerEnum->nextElement(), UNO_QUERY );
- if ( xFallback == _rCompDesc.xController )
- xFallback.clear();
- }
- }
-
- if ( xFallback.is() )
- {
- _rCompDesc.xController = xFallback;
- _rCompDesc.xFrame.set( xFallback->getFrame(), UNO_SET_THROW );
- return true;
- }
-
- return false;
- }
-
- //..............................................................................................................
- bool lcl_closeComponent( const Reference< XCommandProcessor >& _rxCommandProcessor )
- {
- bool bSuccess = false;
- try
- {
- Reference< XCommandProcessor > xCommandProcessor( _rxCommandProcessor, UNO_SET_THROW );
- sal_Int32 nCommandIdentifier = xCommandProcessor->createCommandIdentifier();
-
- Command aCommand;
- aCommand.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "close" ) );
- xCommandProcessor->execute( aCommand, nCommandIdentifier, NULL );
- bSuccess = true;
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return bSuccess;
- }
-
- //..............................................................................................................
- bool lcl_closeComponent( const SubComponentDescriptor& _rComponent )
- {
- if ( _rComponent.xComponentCommandProcessor.is() )
- return lcl_closeComponent( _rComponent.xComponentCommandProcessor );
-
- Reference< XController > xController( _rComponent.xController );
- OSL_ENSURE( xController.is(), "lcl_closeComponent: invalid controller!" );
-
- // suspend the controller in the document
- if ( xController.is() )
- if ( !xController->suspend( sal_True ) )
- return false;
-
- bool bSuccess = false;
- try
- {
- Reference< XCloseable > xCloseable( _rComponent.xFrame, UNO_QUERY_THROW );
- xCloseable->close( sal_True );
- bSuccess = true;
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return bSuccess;
- }
-
- //..............................................................................................................
- void lcl_notifySubComponentEvent( const SubComponentManager_Data& _rData, const sal_Char* _pAsciiEventName,
- const SubComponentDescriptor& _rComponent )
- {
- try
- {
- Reference< XDocumentEventBroadcaster > xBroadcaster( _rData.m_rController.getModel(), UNO_QUERY_THROW );
- xBroadcaster->notifyDocumentEvent(
- ::rtl::OUString::createFromAscii( _pAsciiEventName ),
- &_rData.m_rController,
- makeAny( _rComponent.xFrame )
- );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SubComponentManager::propertyChange( const PropertyChangeEvent& i_rEvent ) throw (RuntimeException)
- {
- if ( i_rEvent.PropertyName != PROPERTY_NAME )
- // by definition, it's allowed to broadcast more than what we've registered for
- return;
-
- // find the sub component whose name changed
- for ( SubComponents::iterator comp = m_pData->m_aComponents.begin();
- comp != m_pData->m_aComponents.end();
- ++comp
- )
- {
- if ( comp->xDocumentDefinitionProperties != i_rEvent.Source )
- continue;
-
- ::rtl::OUString sNewName;
- OSL_VERIFY( i_rEvent.NewValue >>= sNewName );
-
- #if OSL_DEBUG_LEVEL > 0
- ::rtl::OUString sOldKnownName( comp->sName );
- ::rtl::OUString sOldName;
- OSL_VERIFY( i_rEvent.OldValue >>= sOldName );
- OSL_ENSURE( sOldName == sOldKnownName, "SubComponentManager::propertyChange: inconsistency in the old names!" );
- #endif
-
- comp->sName = sNewName;
- break;
- }
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL SubComponentManager::disposing( const EventObject& _rSource ) throw (RuntimeException)
- {
- ::osl::ClearableMutexGuard aGuard( m_pData->getMutex() );
-
- SubComponentDescriptor aClosedComponent;
-
- for ( SubComponents::iterator comp = m_pData->m_aComponents.begin();
- comp != m_pData->m_aComponents.end();
- ++comp
- )
- {
- bool bRemove = false;
-
- if ( comp->xController == _rSource.Source )
- {
- if ( !comp->xModel.is() )
- {
- bRemove = true;
- }
- else
- {
- // maybe this is just one view to the sub document, and only this view is closed
- if ( !lcl_fallbackToAnotherController( *comp ) )
- {
- bRemove = true;
- }
- }
- }
- else if ( comp->xModel == _rSource.Source )
- {
- bRemove = true;
- }
-
- if ( bRemove )
- {
- aClosedComponent = *comp;
- m_pData->m_aComponents.erase( comp );
- break;
- }
- }
-
- if ( aClosedComponent.is() )
- {
- aGuard.clear();
- lcl_notifySubComponentEvent( *m_pData, "OnSubComponentClosed", aClosedComponent );
- }
- }
-
- //------------------------------------------------------------------------------------------------------------------
- Sequence< Reference< XComponent> > SubComponentManager::getSubComponents() const
- {
- ::osl::MutexGuard aGuard( m_pData->getMutex() );
-
- Sequence< Reference< XComponent > > aComponents( m_pData->m_aComponents.size() );
- ::std::transform(
- m_pData->m_aComponents.begin(),
- m_pData->m_aComponents.end(),
- aComponents.getArray(),
- SelectSubComponent()
- );
- return aComponents;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- sal_Bool SubComponentManager::closeSubComponents()
- {
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_pData->getMutex() );
-
- try
- {
- SubComponents aWorkingCopy( m_pData->m_aComponents );
- for ( SubComponents::const_iterator comp = aWorkingCopy.begin();
- comp != aWorkingCopy.end();
- ++comp
- )
- {
- lcl_closeComponent( *comp );
- }
- }
- catch ( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- return empty();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- bool SubComponentManager::empty() const
- {
- ::osl::MutexGuard aGuard( m_pData->getMutex() );
- return m_pData->m_aComponents.empty();
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SubComponentManager::onSubComponentOpened( const ::rtl::OUString& _rName, const sal_Int32 _nComponentType,
- const ElementOpenMode _eOpenMode, const Reference< XComponent >& _rxComponent )
- {
- ::osl::ClearableMutexGuard aGuard( m_pData->getMutex() );
-
-#if OSL_DEBUG_LEVEL > 0
- if ( _rName.getLength() )
- {
- // check there does not already exist such a component
- SubComponents::const_iterator existentPos = ::std::find_if(
- m_pData->m_aComponents.begin(),
- m_pData->m_aComponents.end(),
- SubComponentMatch( _rName, _nComponentType, _eOpenMode )
- );
- OSL_ENSURE( existentPos == m_pData->m_aComponents.end(), "already existent!" );
- }
-#endif
- SubComponentDescriptor aElement( _rName, _nComponentType, _eOpenMode, _rxComponent );
- ENSURE_OR_THROW( aElement.xModel.is() || aElement.xController.is(), "illegal component" );
-
- m_pData->m_aComponents.push_back( aElement );
-
- // add as listener
- if ( aElement.xController.is() )
- aElement.xController->addEventListener( this );
- if ( aElement.xModel.is() )
- aElement.xModel->addEventListener( this );
- if ( aElement.xDocumentDefinitionProperties.is() )
- aElement.xDocumentDefinitionProperties->addPropertyChangeListener( PROPERTY_NAME, this );
-
- // notify this to interested parties
- aGuard.clear();
- lcl_notifySubComponentEvent( *m_pData, "OnSubComponentOpened", aElement );
- }
-
- //------------------------------------------------------------------------------------------------------------------
- bool SubComponentManager::activateSubFrame( const ::rtl::OUString& _rName, const sal_Int32 _nComponentType,
- const ElementOpenMode _eOpenMode, Reference< XComponent >& o_rComponent ) const
- {
- ::osl::MutexGuard aGuard( m_pData->getMutex() );
-
- SubComponents::const_iterator pos = ::std::find_if(
- m_pData->m_aComponents.begin(),
- m_pData->m_aComponents.end(),
- SubComponentMatch( _rName, _nComponentType, _eOpenMode )
- );
- if ( pos == m_pData->m_aComponents.end() )
- // no component with this name/type/open mode
- return false;
-
- const Reference< XFrame > xFrame( pos->xFrame, UNO_SET_THROW );
- const Reference< XTopWindow > xTopWindow( xFrame->getContainerWindow(), UNO_QUERY_THROW );
- xTopWindow->toFront();
-
- if ( pos->xModel.is() )
- o_rComponent = pos->xModel.get();
- else if ( pos->xController.is() )
- o_rComponent = pos->xController.get();
- else
- o_rComponent = pos->xFrame.get();
-
- return true;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- bool SubComponentManager::closeSubFrames( const ::rtl::OUString& i_rName, const sal_Int32 _nComponentType )
- {
- ::osl::MutexGuard aGuard( m_pData->getMutex() );
- ENSURE_OR_RETURN_FALSE( i_rName.getLength(), "SubComponentManager::closeSubFrames: illegal name!" );
-
- SubComponents aWorkingCopy( m_pData->m_aComponents );
- for ( SubComponents::const_iterator comp = aWorkingCopy.begin();
- comp != aWorkingCopy.end();
- ++comp
- )
- {
- if ( ( comp->sName != i_rName ) || ( comp->nComponentType != _nComponentType ) )
- continue;
-
- if ( !lcl_closeComponent( *comp ) )
- return false;
- }
-
- return true;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- bool SubComponentManager::lookupSubComponent( const Reference< XComponent >& i_rComponent,
- ::rtl::OUString& o_rName, sal_Int32& o_rComponentType )
- {
- for ( SubComponents::const_iterator comp = m_pData->m_aComponents.begin();
- comp != m_pData->m_aComponents.end();
- ++comp
- )
- {
- if ( ( comp->xModel.is()
- && ( comp->xModel == i_rComponent )
- )
- || ( comp->xController.is()
- && ( comp->xController == i_rComponent )
- )
- || ( comp->xFrame.is()
- && ( comp->xFrame == i_rComponent )
- )
- )
- {
- o_rName = comp->sName;
- o_rComponentType = comp->nComponentType;
- return true;
- }
- }
- return false;
- }
-
-//......................................................................................................................
-} // namespace dbaui
-//......................................................................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/subcomponentmanager.hxx b/dbaccess/source/ui/app/subcomponentmanager.hxx
deleted file mode 100644
index 1a653141e..000000000
--- a/dbaccess/source/ui/app/subcomponentmanager.hxx
+++ /dev/null
@@ -1,139 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
-************************************************************************/
-
-#ifndef DBACCESS_SUBCOMPONENTMANAGER_HXX
-#define DBACCESS_SUBCOMPONENTMANAGER_HXX
-
-#include "AppElementType.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/beans/XPropertyChangeListener.hpp>
-#include <com/sun/star/frame/XController.hpp>
-/** === end UNO includes === **/
-
-#include <comphelper/sharedmutex.hxx>
-#include <cppuhelper/implbase1.hxx>
-
-#include <memory>
-
-//........................................................................
-namespace dbaui
-{
-//........................................................................
-
- struct SubComponentManager_Data;
- class OApplicationController;
-
- //====================================================================
- //= SubComponentManager
- //====================================================================
- typedef ::cppu::WeakImplHelper1 < ::com::sun::star::beans::XPropertyChangeListener
- > SubComponentManager_Base;
- class SubComponentManager : public SubComponentManager_Base
- {
- public:
- SubComponentManager( OApplicationController& _rController, const ::comphelper::SharedMutex& _rMutex );
- virtual ~SubComponentManager();
-
- void disposing();
-
- // XPropertyChangeListener
- virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
-
- // XEventListener
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
-
- // XDatabaseDocumentUI helpers
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> >
- getSubComponents() const;
- sal_Bool closeSubComponents();
-
- // container access
- void onSubComponentOpened(
- const ::rtl::OUString& _rName,
- const sal_Int32 _nComponentType,
- const ElementOpenMode _eOpenMode,
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >&
- _rxComponent
- );
- bool empty() const;
-
- /** activates (i.e. brings to top) the frame in which the given component is loaded, if any
-
- @return
- <TRUE/> if any only of such a frame was found, i.e. the component had already been loaded
- previously
- */
- bool activateSubFrame(
- const ::rtl::OUString& _rName,
- const sal_Int32 _nComponentType,
- const ElementOpenMode _eOpenMode,
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_rComponent
- ) const;
-
- /** closes all frames of the given component
-
- If a view for the component (given by name and type) has been loaded into one or more
- frames (with potentially different OpenModes), then those frames are gracefully closed.
-
- @return
- <TRUE/> if and only if closing those frames was successful, or frames for the given sub component
- exist.
- */
- bool closeSubFrames(
- const ::rtl::OUString& _rName,
- const sal_Int32 _nComponentType
- );
-
- /** searches for the given sub component
-
- @param i_rComponent
- the sub component to look up
- @param o_rName
- contains, upon successful return, the name of the sub component
- @param o_nComponentType
- contains, upon successful return, the type of the sub component
- @return
- <TRUE/> if and only if the component was found
- */
- bool lookupSubComponent(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& i_rComponent,
- ::rtl::OUString& o_rName,
- sal_Int32& o_rComponentType
- );
-
- private:
- ::std::auto_ptr< SubComponentManager_Data > m_pData;
- };
-
-//........................................................................
-} // namespace dbaui
-//........................................................................
-
-#endif // DBACCESS_SUBCOMPONENTMANAGER_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/ui/app/window_layout.txt b/dbaccess/source/ui/app/window_layout.txt
deleted file mode 100644
index dba1ff98a..000000000
--- a/dbaccess/source/ui/app/window_layout.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-(still unfinished)
-
-OApplicationView
-|
-+-OAppBorderWindow
- |
- +-OTitleWindow "Database"
- | |
- | +-OApplicationSwapWindow
- | |
- | +-OApplicationIconControl
- |
- +-OApplicationDetailView
- |
- +-OTitleWindow "Tasks"
- | |
- | +-OTasksWindow
- | |
- | +-OCreationList
- |
- +-OTitleWindow "Forms" "Tables" "Queries" "Reports"
- |
- +-OAppDetailPageHelper
- |
- +-SvTreeListBox*
- |
- +-FixedLine
- |
- +-Window (Border)
- |
- +-OPreviewWindow