summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/app/AppController.cxx
diff options
context:
space:
mode:
authorRelease Engineers <releng@openoffice.org>2008-12-01 12:31:27 +0000
committerRelease Engineers <releng@openoffice.org>2008-12-01 12:31:27 +0000
commit2363c961947028ee152cbdfca7e4b4d1099ca019 (patch)
treed4e60312f0d4cca1098aa9ea181329711867e53e /dbaccess/source/ui/app/AppController.cxx
parentf2c90bcc552da21d692df2abeaf3997f8a7eda78 (diff)
CWS-TOOLING: integrate CWS dba31e
2008-11-19 12:36:23 +0100 msc r263980 : i96104 2008-11-19 12:31:19 +0100 msc r263979 : i96104 2008-11-19 12:21:55 +0100 msc r263977 : i96104 2008-11-19 12:18:53 +0100 msc r263976 : i96104 2008-11-18 09:09:45 +0100 oj r263746 : disable color entry when area is set 2008-11-18 08:37:52 +0100 oj r263741 : #remove sub report entry 2008-11-17 11:20:25 +0100 fs r263708 : #i10000# 2008-11-17 11:06:52 +0100 fs r263706 : minimal version now is 3.1 2008-11-12 22:25:59 +0100 fs r263621 : #i96150# 2008-11-12 22:20:02 +0100 fs r263620 : rebased to m34 2008-11-12 21:39:41 +0100 fs r263618 : MANUAL REBASE: rebase CWS dba31d to DEV300_m34 2008-11-12 13:54:58 +0100 fs r263597 : #i96134# MediaDescriptor.URL is to be preferred over MediaDescriptor.FileName. Nonetheless, ensure both are handled 2008-11-12 13:53:40 +0100 fs r263596 : #i96134# re-enabled the code for #i41897#, a better fix is to come 2008-11-12 12:48:21 +0100 fs r263585 : #i96134# disable saving URLs of file-base databases relatively 2008-11-11 16:11:11 +0100 msc r263566 : #i96104# 2008-11-05 09:09:47 +0100 oj r263342 : #i88727# color noe added 2008-11-05 08:41:43 +0100 oj r263341 : #i77916# zoom added 2008-11-04 21:24:15 +0100 fs r263339 : disposing: call disposeAndClear without own mutex locked - some of our listeners insist on locking the SolarMutex, which sometimes led to deadlocks on the complex test cases 2008-11-04 21:23:15 +0100 fs r263338 : remove SolarMutex locking - this happned in CWS dba31c (in the CVS version), which this CWS was created from, but seems to got lost during resync 2008-11-04 20:49:50 +0100 fs r263335 : docu formatting 2008-11-04 20:06:39 +0100 fs r263334 : #i95826# use m_aMutex, not a DocumentGuard (wrongly resolved merge conflicts) 2008-11-04 17:36:29 +0100 fs r263332 : #i92688# properly revoke as XEventListener from m_xActiveController when disposing 2008-11-04 14:49:34 +0100 fs r263324 : #i92322# enable Input Required if EmptyIsNULL does not exist at the control 2008-10-31 11:10:04 +0100 oj r262857 : merge from cvs to svn 2008-10-31 09:46:45 +0100 oj r262853 : merge from cvs to svn 2008-10-31 08:46:37 +0100 oj r262849 : merge from cvs to svn 2008-10-31 08:44:24 +0100 oj r262848 : merge from cvs to svn 2008-10-31 08:43:33 +0100 oj r262847 : merge from cvs to svn 2008-10-31 08:42:28 +0100 oj r262846 : merge from cvs to svn 2008-10-31 08:41:58 +0100 oj r262845 : merge from cvs to svn 2008-10-31 08:41:32 +0100 oj r262844 : merge from cvs to svn 2008-10-28 12:19:50 +0100 oj r262733 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:42 +0100 oj r262732 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:36 +0100 oj r262731 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:31 +0100 oj r262730 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:22 +0100 oj r262729 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:18 +0100 oj r262728 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:10 +0100 oj r262727 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:06 +0100 oj r262726 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:05 +0100 oj r262725 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:19:01 +0100 oj r262724 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:50 +0100 oj r262723 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:41 +0100 oj r262722 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:40 +0100 oj r262721 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:27 +0100 oj r262720 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:10 +0100 oj r262719 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:18:01 +0100 oj r262718 : #iXXXXX#: migrate CWS dba31e to SVN 2008-10-28 12:17:39 +0100 oj r262717 : #iXXXXX#: migrate CWS dba31e to SVN
Diffstat (limited to 'dbaccess/source/ui/app/AppController.cxx')
-rw-r--r--dbaccess/source/ui/app/AppController.cxx210
1 files changed, 78 insertions, 132 deletions
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 4c7c97054368..ccac5237d7dc 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -34,6 +34,7 @@
#include "AppController.hxx"
#include "dbustrings.hrc"
#include "advancedsettingsdlg.hxx"
+#include "subcomponentmanager.hxx"
/** === begin UNO includes === **/
#include <com/sun/star/beans/NamedValue.hpp>
@@ -407,7 +408,8 @@ DBG_NAME(OApplicationController)
//--------------------------------------------------------------------
OApplicationController::OApplicationController(const Reference< XMultiServiceFactory >& _rxORB)
:OApplicationController_CBASE( _rxORB )
- ,m_aContextMenuInterceptors( m_aMutex )
+ ,m_aContextMenuInterceptors( getMutex() )
+ ,m_pSubComponentManager( new SubComponentManager( getSharedMutex() ) )
,m_aTableCopyHelper(this)
,m_pClipbordNotifier(NULL)
,m_nAsyncDrop(0)
@@ -417,7 +419,7 @@ OApplicationController::OApplicationController(const Reference< XMultiServiceFac
,m_eCurrentType(E_NONE)
,m_bNeedToReconnect(sal_False)
,m_bSuspended( sal_False )
- ,m_pSelectionNotifier( new SelectionNotifier( m_aMutex, *this ) )
+ ,m_pSelectionNotifier( new SelectionNotifier( getMutex(), *this ) )
{
DBG_CTOR(OApplicationController,NULL);
@@ -472,8 +474,7 @@ void SAL_CALL OApplicationController::disposing()
::std::for_each(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),XContainerFunctor(this));
m_aCurrentContainers.clear();
- m_aSpecialSubFrames.clear();
- m_aDocuments.clear();
+ m_pSubComponentManager->disposing();
m_pSelectionNotifier->disposing();
if ( getView() )
@@ -596,7 +597,7 @@ sal_Bool OApplicationController::Construct(Window* _pParent)
//--------------------------------------------------------------------
void SAL_CALL OApplicationController::disposing(const EventObject& _rSource) throw( RuntimeException )
{
- ::osl::MutexGuard aGuard(m_aMutex);
+ ::osl::MutexGuard aGuard( getMutex() );
Reference<XConnection> xCon(_rSource.Source, UNO_QUERY);
if ( xCon.is() )
{
@@ -622,22 +623,7 @@ void SAL_CALL OApplicationController::disposing(const EventObject& _rSource) thr
}
else
{
- Reference<XComponent> xComp(_rSource.Source,UNO_QUERY);
- Reference<XContainer> xContainer(_rSource.Source,UNO_QUERY);
- if ( xComp.is() )
- {
- TDocuments::iterator aFind = ::std::find_if(m_aDocuments.begin(),m_aDocuments.end(),
- ::std::compose1(::std::bind2nd(::std::equal_to<Reference<XComponent> >(),xComp),::std::select1st<TDocuments::value_type>()));
- if ( aFind != m_aDocuments.end() )
- m_aDocuments.erase(aFind);
-
- TFrames::iterator aFind2 = ::std::find_if(m_aSpecialSubFrames.begin(),m_aSpecialSubFrames.end(),
- ::std::compose1(::std::bind2nd(::std::equal_to<Reference<XComponent> >(),xComp),
- ::std::compose1(::std::select2nd<TTypeFrame>(),::std::select2nd<TFrames::value_type>())));
- if ( aFind2 != m_aSpecialSubFrames.end() )
- m_aSpecialSubFrames.erase(aFind2);
-
- }
+ Reference<XContainer> xContainer( _rSource.Source, UNO_QUERY );
if ( xContainer.is() )
{
TContainerVector::iterator aFind = ::std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer);
@@ -662,7 +648,7 @@ sal_Bool SAL_CALL OApplicationController::suspend(sal_Bool bSuspend) throw( Runt
}
::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ::osl::MutexGuard aGuard(m_aMutex);
+ ::osl::MutexGuard aGuard( getMutex() );
if ( getView() && getView()->IsInModalMode() )
return sal_False;
@@ -1150,7 +1136,7 @@ namespace
void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& aArgs)
{
::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ::osl::MutexGuard aGuard(m_aMutex);
+ ::osl::MutexGuard aGuard( getMutex() );
if ( isUserDefinedFeature( _nId ) )
{
@@ -1329,7 +1315,6 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
lcl_handleException_nothrow( m_xModel, ::cppu::getCaughtException() );
}
- m_sDatabaseName = ::rtl::OUString();
/*updateTitle();*/
m_bCurrentlyModified = sal_False;
InvalidateFeature(ID_BROWSER_SAVEDOC);
@@ -1425,7 +1410,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
Reference< XComponent > xComponent( aDesigner.createNew( xDataSource ), UNO_QUERY );
- addDocumentListener( xComponent, NULL );
+ onDocumentOpened( ::rtl::OUString(), E_QUERY, E_OPEN_DESIGN, xComponent, NULL );
}
}
break;
@@ -1466,18 +1451,17 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
InvalidateAll();
break;
case SID_DB_APP_DSRELDESIGN:
- if ( !impl_activateSubFrame_throw(::rtl::OUString(),SID_DB_APP_DSRELDESIGN,E_OPEN_DESIGN) )
+ if ( !m_pSubComponentManager->activateSubFrame( ::rtl::OUString(), SID_DB_APP_DSRELDESIGN, E_OPEN_DESIGN ) )
{
SharedConnection xConnection( ensureConnection() );
if ( xConnection.is() )
{
RelationDesigner aDesigner( getORB(), this, m_aCurrentFrame.getFrame() );
+
Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
Reference< XComponent > xComponent( aDesigner.createNew( xDataSource ), UNO_QUERY );
- addDocumentListener( xComponent, NULL );
- m_aSpecialSubFrames.insert(TFrames::value_type(::rtl::OUString(),
- TTypeFrame(TTypeOpenMode(SID_DB_APP_DSRELDESIGN,E_OPEN_DESIGN),xComponent)));
- } // if ( xConnection.is() )
+ onDocumentOpened( ::rtl::OUString(), SID_DB_APP_DSRELDESIGN, E_OPEN_DESIGN, xComponent, NULL );
+ }
}
break;
case SID_DB_APP_DSUSERADMIN:
@@ -1676,7 +1660,7 @@ OApplicationView* OApplicationController::getContainer() const
void SAL_CALL OApplicationController::elementInserted( const ContainerEvent& _rEvent ) throw(RuntimeException)
{
::vos::OGuard aSolarGuard(Application::GetSolarMutex());
- ::osl::MutexGuard aGuard(m_aMutex);
+ ::osl::MutexGuard aGuard( getMutex() );
Reference< XContainer > xContainer(_rEvent.Source, UNO_QUERY);
if ( ::std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer) != m_aCurrentContainers.end() )
@@ -1712,7 +1696,7 @@ void SAL_CALL OApplicationController::elementInserted( const ContainerEvent& _rE
void SAL_CALL OApplicationController::elementRemoved( const ContainerEvent& _rEvent ) throw(RuntimeException)
{
::vos::OGuard aSolarGuard(Application::GetSolarMutex());
- ::osl::MutexGuard aGuard(m_aMutex);
+ ::osl::MutexGuard aGuard( getMutex() );
Reference< XContainer > xContainer(_rEvent.Source, UNO_QUERY);
if ( ::std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer) != m_aCurrentContainers.end() )
@@ -1746,7 +1730,7 @@ void SAL_CALL OApplicationController::elementRemoved( const ContainerEvent& _rEv
void SAL_CALL OApplicationController::elementReplaced( const ContainerEvent& _rEvent ) throw(RuntimeException)
{
::vos::OGuard aSolarGuard(Application::GetSolarMutex());
- ::osl::MutexGuard aGuard(m_aMutex);
+ ::osl::MutexGuard aGuard( getMutex() );
Reference< XContainer > xContainer(_rEvent.Source, UNO_QUERY);
if ( ::std::find(m_aCurrentContainers.begin(),m_aCurrentContainers.end(),xContainer) != m_aCurrentContainers.end() )
@@ -1971,16 +1955,15 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const
Reference< XComponent > xDefinition;
xRet = aHelper->open( _sName, xDefinition, _eOpenMode, _rAdditionalArguments );
- addDocumentListener(xRet,xDefinition);
+ onDocumentOpened( _sName, _eType, _eOpenMode, xRet, xDefinition );
}
break;
case E_QUERY:
case E_TABLE:
{
- if ( !impl_activateSubFrame_throw(_sName,_eType,_eOpenMode) )
+ if ( !m_pSubComponentManager->activateSubFrame( _sName, _eType, _eOpenMode ) )
{
-
SharedConnection xConnection( ensureConnection() );
if ( !xConnection.is() )
break;
@@ -2017,9 +2000,7 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const
}
Reference< XComponent > xComponent( pDesigner->openExisting( aDataSource, _sName, aArguments.getPropertyValues() ), UNO_QUERY );
- addDocumentListener( xComponent, NULL );
- m_aSpecialSubFrames.insert(TFrames::value_type(_sName,
- TTypeFrame(TTypeOpenMode(_eType,_eOpenMode),xComponent)));
+ onDocumentOpened( _sName, _eType, _eOpenMode, xComponent, NULL );
}
}
break;
@@ -2066,7 +2047,7 @@ void OApplicationController::newElementWithPilot( ElementType _eType )
else
xComponent = aHelper->newFormWithPilot(xDefinition,nCommandType,sName);
- addDocumentListener(xComponent,xDefinition);
+ onDocumentOpened( ::rtl::OUString(), _eType, E_OPEN_DESIGN, xComponent, xDefinition );
}
}
break;
@@ -2076,12 +2057,13 @@ void OApplicationController::newElementWithPilot( ElementType _eType )
::std::auto_ptr<OLinkedDocumentsAccess> aHelper = getDocumentsAccess(_eType);
if ( aHelper->isConnected() )
{
- Reference< XComponent > xComponent,xDefinition;
+ Reference< XComponent > xComponent;
if ( E_QUERY == _eType )
xComponent = aHelper->newQueryWithPilot();
else
xComponent = aHelper->newTableWithPilot();
- addDocumentListener(xComponent,xDefinition);
+
+ onDocumentOpened( ::rtl::OUString(), _eType, E_OPEN_DESIGN, xComponent, NULL );
}
}
break;
@@ -2107,7 +2089,7 @@ void OApplicationController::newElement( ElementType _eType, sal_Bool _bSQLView
sal_Int32 nCommandType = -1;
const ::rtl::OUString sName(getCurrentlySelectedName(nCommandType));
xComponent = aHelper->newDocument(_eType == E_FORM ? ID_FORM_NEW_TEXT : ID_REPORT_NEW_TEXT,xDefinition,nCommandType,sName);
- addDocumentListener(xComponent,xDefinition);
+ onDocumentOpened( ::rtl::OUString(), _eType, E_OPEN_DESIGN, xComponent, xDefinition );
}
}
break;
@@ -2129,7 +2111,7 @@ void OApplicationController::newElement( ElementType _eType, sal_Bool _bSQLView
Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
Reference< XComponent > xComponent( pDesigner->createNew( xDataSource ), UNO_QUERY );
- addDocumentListener(xComponent,NULL);
+ onDocumentOpened( ::rtl::OUString(), _eType, E_OPEN_DESIGN, xComponent, NULL );
}
}
break;
@@ -2163,7 +2145,7 @@ void OApplicationController::addContainerListener(const Reference<XNameAccess>&
void OApplicationController::renameEntry()
{
::vos::OGuard aSolarGuard(Application::GetSolarMutex());
- ::osl::MutexGuard aGuard(m_aMutex);
+ ::osl::MutexGuard aGuard( getMutex() );
OSL_ENSURE(getContainer(),"View is NULL! -> GPF");
::std::vector< ::rtl::OUString> aList;
@@ -2311,68 +2293,59 @@ void OApplicationController::renameEntry()
DBG_UNHANDLED_EXCEPTION();
}
}
-// -----------------------------------------------------------------------------
-void OApplicationController::onEntryDeSelect(SvTreeListBox& /*_rTree*/)
-{
- SelectionGuard aSelGuard( *m_pSelectionNotifier );
- InvalidateAll();
-}
// -----------------------------------------------------------------------------
-void OApplicationController::onEntrySelect(SvLBoxEntry* _pEntry)
+void OApplicationController::onSelectionChanged()
{
InvalidateAll();
+ SelectionGuard aSelGuard( *m_pSelectionNotifier );
+
OApplicationView* pView = getContainer();
- if ( pView )
- {
- SelectionGuard aSelGuard( *m_pSelectionNotifier );
+ if ( !pView )
+ return;
+ if ( pView->getSelectionCount() == 1 )
+ {
const ElementType eType = pView->getElementType();
- if ( _pEntry && pView->isALeafSelected() )
+ if ( pView->isALeafSelected() )
{
- const ::rtl::OUString sName = pView->getQualifiedName( _pEntry );
- selectEntry(eType,sName);
+ const ::rtl::OUString sName = pView->getQualifiedName( NULL /* means 'first selected' */ );
+ showPreviewFor( eType, sName );
}
}
}
// -----------------------------------------------------------------------------
-void OApplicationController::selectEntry(const ElementType _eType,const ::rtl::OUString& _sName)
+void OApplicationController::showPreviewFor(const ElementType _eType,const ::rtl::OUString& _sName)
{
OApplicationView* pView = getContainer();
- Reference< XContent> xContent;
+ if ( !pView )
+ return;
+
try
{
switch( _eType )
{
case E_FORM:
case E_REPORT:
- if ( _sName.getLength() )
- {
- Reference< XHierarchicalNameAccess > xContainer(getElements(_eType),UNO_QUERY);
- if ( xContainer.is() && xContainer->hasByHierarchicalName(_sName) )
- xContent.set(xContainer->getByHierarchicalName(_sName),UNO_QUERY);
- }
- break;
+ {
+ 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:
- if ( pView->isPreviewEnabled() )
{
SharedConnection xConnection( ensureConnection() );
if ( xConnection.is() )
- pView->showPreview(getDatabaseName(),xConnection,_sName,sal_False);
+ pView->showPreview( getDatabaseName(), xConnection, _sName, _eType == E_TABLE );
}
return;
- case E_TABLE:
- {
- SharedConnection xConnection( ensureConnection() );
- if ( xConnection.is() )
- {
- pView->showPreview(getDatabaseName(),xConnection,_sName,_eType == E_TABLE);
- return;
- }
- }
- break;
+
default:
+ OSL_ENSURE( false, "OApplicationController::showPreviewFor: unexpected element type!" );
break;
}
}
@@ -2384,8 +2357,6 @@ void OApplicationController::selectEntry(const ElementType _eType,const ::rtl::O
{
DBG_UNHANDLED_EXCEPTION();
}
-
- pView->showPreview(xContent);
}
//------------------------------------------------------------------------------
@@ -2403,21 +2374,21 @@ IMPL_LINK(OApplicationController, OnInvalidateClipboard, void*, EMPTYARG)
return 0L;
}
// -----------------------------------------------------------------------------
-void OApplicationController::onCutEntry(SvLBoxEntry* /*_pEntry*/)
+void OApplicationController::onCutEntry()
{
}
// -----------------------------------------------------------------------------
-void OApplicationController::onCopyEntry(SvLBoxEntry* /*_pEntry*/)
+void OApplicationController::onCopyEntry()
{
Execute(ID_BROWSER_COPY,Sequence<PropertyValue>());
}
// -----------------------------------------------------------------------------
-void OApplicationController::onPasteEntry(SvLBoxEntry* /*_pEntry*/)
+void OApplicationController::onPasteEntry()
{
Execute(ID_BROWSER_PASTE,Sequence<PropertyValue>());
}
// -----------------------------------------------------------------------------
-void OApplicationController::onDeleteEntry(SvLBoxEntry* /*_pEntry*/)
+void OApplicationController::onDeleteEntry()
{
ElementType eType = getContainer()->getElementType();
sal_uInt16 nId = 0;
@@ -2796,7 +2767,7 @@ IMPL_LINK( OApplicationController, OnFirstControllerConnected, void*, /**/ )
// -----------------------------------------------------------------------------
sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > & _rxModel) throw( RuntimeException )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard( getMutex() );
Reference< XOfficeDatabaseDocument > xOfficeDoc( _rxModel, UNO_QUERY );
if ( !xOfficeDoc.is() && _rxModel.is() )
{
@@ -2822,14 +2793,10 @@ sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel >
}
m_xDataSource.set(xOfficeDoc.is() ? xOfficeDoc->getDataSource() : Reference<XDataSource>(),UNO_QUERY);
- if ( !m_xDataSource.is() )
- m_sDatabaseName = ::rtl::OUString();
- else
+ if ( m_xDataSource.is() )
{
try
{
- m_xDataSource->getPropertyValue(PROPERTY_NAME) >>= m_sDatabaseName;
-
m_xDataSource->addPropertyChangeListener(PROPERTY_INFO, this);
m_xDataSource->addPropertyChangeListener(PROPERTY_URL, this);
m_xDataSource->addPropertyChangeListener(PROPERTY_ISPASSWORDREQUIRED, this);
@@ -2920,7 +2887,7 @@ void SAL_CALL OApplicationController::removeSelectionChangeListener( const Refer
::sal_Bool SAL_CALL OApplicationController::select( const Any& _aSelection ) throw (IllegalArgumentException, RuntimeException)
{
::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ::osl::MutexGuard aGuard(m_aMutex);
+ ::osl::MutexGuard aGuard( getMutex() );
Sequence< ::rtl::OUString> aSelection;
if ( !_aSelection.hasValue() || !getView() )
{
@@ -3048,12 +3015,30 @@ void SAL_CALL OApplicationController::removeSelectionChangeListener( const Refer
Any SAL_CALL OApplicationController::getSelection( ) throw (RuntimeException)
{
::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
- ::osl::MutexGuard aGuard(m_aMutex);
+ ::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_ENSURE( false, "OApplicationController::getSelection: unexpected current element type!" );
+ break;
+ }
+ }
+ }
return makeAny( aCurrentSelection );
}
// -----------------------------------------------------------------------------
@@ -3083,45 +3068,6 @@ void OApplicationController::impl_migrateScripts_nothrow()
}
}
-// -----------------------------------------------------------------------------
-bool OApplicationController::impl_activateSubFrame_throw(const ::rtl::OUString& _sName,const sal_Int32 _nKind,const ElementOpenMode _eOpenMode) const
-{
- bool bFound = false;
- TFrames::const_iterator aFind = m_aSpecialSubFrames.find(_sName);
- for(;aFind != m_aSpecialSubFrames.end();++aFind)
- {
- if ( aFind->second.first.first == _nKind && aFind->second.first.second == _eOpenMode )
- {
- const Reference< XFrame> xFrame(aFind->second.second,UNO_QUERY);
- if ( xFrame.is() )
- {
- Reference< awt::XTopWindow> xTopWindow(xFrame->getContainerWindow(),UNO_QUERY);
- if ( xTopWindow.is() )
- xTopWindow->toFront();
- bFound = true;
- }
- break;
- } // if ( aFind->second.first.first == _nKind && aFind->second.first.second == _eOpenMode )
- }
- return bFound;
-}
-// -----------------------------------------------------------------------------
-void OApplicationController::impl_deActivateSubFrame_throw(const ::rtl::OUString& _sName,const sal_Int32 _nKind)
-{
- TFrames aCopy = m_aSpecialSubFrames;
- TFrames::iterator aFind = aCopy.find(_sName);
- for(;aFind != aCopy.end();++aFind)
- {
- if ( aFind->second.first.first == _nKind )
- {
- Reference< XFrame> xFrame(aFind->second.second,UNO_QUERY);
- if ( xFrame.is() )
- {
- ::comphelper::disposeComponent(xFrame);
- }
- } // if ( aFind->second.first.first == _nKind && aFind->second.first.second == _eOpenMode )
- }
-}
//........................................................................
} // namespace dbaui
//........................................................................