summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbaccess/source/core/api/RowSetBase.cxx2
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.cxx78
-rw-r--r--dbaccess/source/core/dataaccess/documentevents.cxx2
-rw-r--r--dbaccess/source/ui/app/AppController.cxx7
-rw-r--r--dbaccess/source/ui/app/subcomponentmanager.cxx51
-rw-r--r--dbaccess/source/ui/app/subcomponentmanager.hxx4
-rw-r--r--dbaccess/source/ui/dlg/CollectionView.cxx2
-rw-r--r--dbaccess/source/ui/misc/dsmeta.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx6
9 files changed, 107 insertions, 47 deletions
diff --git a/dbaccess/source/core/api/RowSetBase.cxx b/dbaccess/source/core/api/RowSetBase.cxx
index 5ba71d0e74d8..ec56a3ebf6e3 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -1383,7 +1383,7 @@ void ORowSetBase::onDeleteRow( const Any& _rBookmark )
return;
::osl::MutexGuard aGuard( *m_pMutex );
- OSL_ENSURE( m_aBookmark.hasValue(), "ORowSetBase::onDeleteRow: Bookmark isn't valid!" );
+ //OSL_ENSURE( m_aBookmark.hasValue(), "ORowSetBase::onDeleteRow: Bookmark isn't valid!" );
if ( compareBookmarks( _rBookmark, m_aBookmark ) == 0 )
{
positionCache( MOVE_NONE_REFRESH_ONLY );
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index 4e724c571235..80096ebe427d 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -1444,42 +1444,54 @@ sal_Bool ODocumentDefinition::saveAs()
Reference<XNameContainer> xNC(pDocuSave->getContent(),UNO_QUERY);
if ( xNC.is() )
{
- try
+ if ( m_pImpl->m_aProps.aTitle == pDocuSave->getName() )
{
- Reference< XStorage> xStorage = getContainerStorage();
- const static ::rtl::OUString sBaseName(RTL_CONSTASCII_USTRINGPARAM("Obj"));
- // -----------------------------------------------------------------------------
- Reference<XNameAccess> xElements(xStorage,UNO_QUERY_THROW);
- ::rtl::OUString sPersistentName = ::dbtools::createUniqueName(xElements,sBaseName);
- xStorage->copyElementTo(m_pImpl->m_aProps.sPersistentName,xStorage,sPersistentName);
-
- ::rtl::OUString sOldName = m_pImpl->m_aProps.aTitle;
- rename(pDocuSave->getName());
- updateDocumentTitle();
-
- Sequence< Any > aArguments(3);
- PropertyValue aValue;
- // set as folder
- aValue.Name = PROPERTY_NAME;
- aValue.Value <<= sOldName;
- aArguments[0] <<= aValue;
-
- aValue.Name = PROPERTY_PERSISTENT_NAME;
- aValue.Value <<= sPersistentName;
- aArguments[1] <<= aValue;
-
- aValue.Name = PROPERTY_AS_TEMPLATE;
- aValue.Value <<= m_pImpl->m_aProps.bAsTemplate;
- aArguments[2] <<= aValue;
-
- Reference< XMultiServiceFactory > xORB( m_xParentContainer, UNO_QUERY_THROW );
- Reference< XInterface > xComponent( xORB->createInstanceWithArguments( SERVICE_SDB_DOCUMENTDEFINITION, aArguments ) );
- Reference< XNameContainer > xNameContainer( m_xParentContainer, UNO_QUERY_THROW );
- xNameContainer->insertByName( sOldName, makeAny( xComponent ) );
+ Reference<XEmbedPersist> xPersist(m_xEmbeddedObject,UNO_QUERY);
+ if ( xPersist.is() )
+ {
+ xPersist->storeOwn();
+ notifyDataSourceModified();
+ }
}
- catch(Exception&)
+ else
{
- DBG_UNHANDLED_EXCEPTION();
+ try
+ {
+ Reference< XStorage> xStorage = getContainerStorage();
+ const static ::rtl::OUString sBaseName(RTL_CONSTASCII_USTRINGPARAM("Obj"));
+ // -----------------------------------------------------------------------------
+ Reference<XNameAccess> xElements(xStorage,UNO_QUERY_THROW);
+ ::rtl::OUString sPersistentName = ::dbtools::createUniqueName(xElements,sBaseName);
+ xStorage->copyElementTo(m_pImpl->m_aProps.sPersistentName,xStorage,sPersistentName);
+
+ ::rtl::OUString sOldName = m_pImpl->m_aProps.aTitle;
+ rename(pDocuSave->getName());
+ updateDocumentTitle();
+
+ Sequence< Any > aArguments(3);
+ PropertyValue aValue;
+ // set as folder
+ aValue.Name = PROPERTY_NAME;
+ aValue.Value <<= sOldName;
+ aArguments[0] <<= aValue;
+
+ aValue.Name = PROPERTY_PERSISTENT_NAME;
+ aValue.Value <<= sPersistentName;
+ aArguments[1] <<= aValue;
+
+ aValue.Name = PROPERTY_AS_TEMPLATE;
+ aValue.Value <<= m_pImpl->m_aProps.bAsTemplate;
+ aArguments[2] <<= aValue;
+
+ Reference< XMultiServiceFactory > xORB( m_xParentContainer, UNO_QUERY_THROW );
+ Reference< XInterface > xComponent( xORB->createInstanceWithArguments( SERVICE_SDB_DOCUMENTDEFINITION, aArguments ) );
+ Reference< XNameContainer > xNameContainer( m_xParentContainer, UNO_QUERY_THROW );
+ xNameContainer->insertByName( sOldName, makeAny( xComponent ) );
+ }
+ catch(Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
}
}
diff --git a/dbaccess/source/core/dataaccess/documentevents.cxx b/dbaccess/source/core/dataaccess/documentevents.cxx
index cf93fa553eb4..f0c591b62f2a 100644
--- a/dbaccess/source/core/dataaccess/documentevents.cxx
+++ b/dbaccess/source/core/dataaccess/documentevents.cxx
@@ -120,6 +120,8 @@ namespace dbaccess
{ "OnPrepareViewClosing", true },
{ "OnViewClosed", false },
{ "OnTitleChanged", false },
+ { "OnSubComponentOpened", false },
+ { "OnSubComponentClosed", false },
{ NULL, false }
};
return s_aData;
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 85bc7a0d8d23..1f6be558f551 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -409,7 +409,7 @@ DBG_NAME(OApplicationController)
OApplicationController::OApplicationController(const Reference< XMultiServiceFactory >& _rxORB)
:OApplicationController_CBASE( _rxORB )
,m_aContextMenuInterceptors( getMutex() )
- ,m_pSubComponentManager( new SubComponentManager( getSharedMutex() ) )
+ ,m_pSubComponentManager( new SubComponentManager( *this, getSharedMutex() ) )
,m_aTableCopyHelper(this)
,m_pClipbordNotifier(NULL)
,m_nAsyncDrop(0)
@@ -942,7 +942,7 @@ FeatureState OApplicationController::GetState(sal_uInt16 _nId) const
case SID_DB_APP_DSUSERADMIN:
{
::dbaccess::DATASOURCE_TYPE eType = m_aTypeCollection.getType(::comphelper::getString(m_xDataSource->getPropertyValue(PROPERTY_URL)));
- aReturn.bEnabled = ::dbaccess::DST_EMBEDDED_HSQLDB != eType;
+ aReturn.bEnabled = ( ::dbaccess::DST_EMBEDDED_HSQLDB != eType );
}
break;
case SID_DB_APP_DSRELDESIGN:
@@ -2322,6 +2322,9 @@ void OApplicationController::onSelectionChanged()
// -----------------------------------------------------------------------------
void OApplicationController::showPreviewFor(const ElementType _eType,const ::rtl::OUString& _sName)
{
+ if ( m_ePreviewMode == E_PREVIEWNONE )
+ return;
+
OApplicationView* pView = getContainer();
if ( !pView )
return;
diff --git a/dbaccess/source/ui/app/subcomponentmanager.cxx b/dbaccess/source/ui/app/subcomponentmanager.cxx
index c3ce4923b9c2..59a552ffc7cf 100644
--- a/dbaccess/source/ui/app/subcomponentmanager.cxx
+++ b/dbaccess/source/ui/app/subcomponentmanager.cxx
@@ -28,6 +28,7 @@
************************************************************************/
#include "subcomponentmanager.hxx"
+#include "AppController.hxx"
/** === begin UNO includes === **/
#include <com/sun/star/frame/XFrame.hpp>
@@ -35,6 +36,7 @@
#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/document/XDocumentEventBroadcaster.hpp>
/** === end UNO includes === **/
#include <tools/diagnose_ex.h>
@@ -71,6 +73,7 @@ namespace dbaui
using ::com::sun::star::container::XEnumeration;
using ::com::sun::star::util::XCloseable;
using ::com::sun::star::awt::XTopWindow;
+ using ::com::sun::star::document::XDocumentEventBroadcaster;
/** === end UNO using === **/
//==============================================================================
@@ -116,6 +119,8 @@ namespace dbaui
if ( !xModel.is() )
xModel.set( xController->getModel() );
}
+
+ inline bool is() const { return xFrame.is(); }
};
struct SelectSubComponent : public ::std::unary_function< SubComponentDescriptor, Reference< XComponent > >
@@ -180,11 +185,13 @@ namespace dbaui
//==============================================================================
struct SubComponentManager_Data
{
- SubComponentManager_Data( const ::comphelper::SharedMutex& _rMutex )
- :m_aMutex( _rMutex )
+ SubComponentManager_Data( OApplicationController& _rController, const ::comphelper::SharedMutex& _rMutex )
+ :m_rController( _rController )
+ ,m_aMutex( _rMutex )
{
}
+ OApplicationController& m_rController;
mutable ::comphelper::SharedMutex m_aMutex;
SubComponentMap m_aComponents;
@@ -195,8 +202,8 @@ namespace dbaui
//= SubComponentManager
//====================================================================
//--------------------------------------------------------------------
- SubComponentManager::SubComponentManager( const ::comphelper::SharedMutex& _rMutex )
- :m_pData( new SubComponentManager_Data( _rMutex ) )
+ SubComponentManager::SubComponentManager( OApplicationController& _rController, const ::comphelper::SharedMutex& _rMutex )
+ :m_pData( new SubComponentManager_Data( _rController, _rMutex ) )
{
}
@@ -276,12 +283,33 @@ namespace dbaui
}
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::disposing( const EventObject& _rSource ) throw (RuntimeException)
{
- ::osl::MutexGuard aGuard( m_pData->getMutex() );
+ ::osl::ClearableMutexGuard aGuard( m_pData->getMutex() );
+
+ SubComponentDescriptor aClosedComponent;
for ( SubComponentMap::iterator comp = m_pData->m_aComponents.begin();
comp != m_pData->m_aComponents.end();
@@ -312,10 +340,17 @@ namespace dbaui
if ( bRemove )
{
+ aClosedComponent = comp->second;
m_pData->m_aComponents.erase( comp );
break;
}
}
+
+ if ( aClosedComponent.is() )
+ {
+ aGuard.clear();
+ lcl_notifySubComponentEvent( *m_pData, "OnSubComponentClosed", aClosedComponent );
+ }
}
//--------------------------------------------------------------------
@@ -372,7 +407,7 @@ namespace dbaui
void SubComponentManager::onSubComponentOpened( const ::rtl::OUString& _rName, const sal_Int32 _nComponentType,
const ElementOpenMode _eOpenMode, const Reference< XComponent >& _rxComponent )
{
- ::osl::MutexGuard aGuard( m_pData->getMutex() );
+ ::osl::ClearableMutexGuard aGuard( m_pData->getMutex() );
// put into map
SubComponentAccessor aKey( _rName, _nComponentType, _eOpenMode );
@@ -386,6 +421,10 @@ namespace dbaui
aElement.xController->addEventListener( this );
if ( aElement.xModel.is() )
aElement.xModel->addEventListener( this );
+
+ // notify this to interested parties
+ aGuard.clear();
+ lcl_notifySubComponentEvent( *m_pData, "OnSubComponentOpened", aElement );
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/app/subcomponentmanager.hxx b/dbaccess/source/ui/app/subcomponentmanager.hxx
index e2f882052d28..fbcdf92d4bd9 100644
--- a/dbaccess/source/ui/app/subcomponentmanager.hxx
+++ b/dbaccess/source/ui/app/subcomponentmanager.hxx
@@ -48,6 +48,8 @@ namespace dbaui
//........................................................................
struct SubComponentManager_Data;
+ class OApplicationController;
+
//====================================================================
//= SubComponentManager
//====================================================================
@@ -56,7 +58,7 @@ namespace dbaui
class SubComponentManager : public SubComponentManager_Base
{
public:
- SubComponentManager( const ::comphelper::SharedMutex& _rMutex );
+ SubComponentManager( OApplicationController& _rController, const ::comphelper::SharedMutex& _rMutex );
virtual ~SubComponentManager();
void disposing();
diff --git a/dbaccess/source/ui/dlg/CollectionView.cxx b/dbaccess/source/ui/dlg/CollectionView.cxx
index 183fb995b04c..1f7d45706391 100644
--- a/dbaccess/source/ui/dlg/CollectionView.cxx
+++ b/dbaccess/source/ui/dlg/CollectionView.cxx
@@ -271,7 +271,7 @@ IMPL_LINK( OCollectionView, Save_Click, PushButton*, EMPTYARG )
QueryBox aBox( this, WB_YES_NO, ModuleRes( STR_ALREADYEXISTOVERWRITE ) );
if ( aBox.Execute() != RET_YES )
return 0;
- xNameContainer->removeByName(sName);
+ // xNameContainer->removeByName(sName);
}
m_aName.SetText(sName);
EndDialog( TRUE );
diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx
index aa31554f861b..26e9bfd1e953 100644
--- a/dbaccess/source/ui/misc/dsmeta.cxx
+++ b/dbaccess/source/ui/misc/dsmeta.cxx
@@ -122,7 +122,7 @@ namespace dbaui
s_aSupport[ ::dbaccess::DST_MSACCESS ] = InitAdvanced( 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0 );
s_aSupport[ ::dbaccess::DST_MYSQL_ODBC ] = InitAdvanced( 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0 );
s_aSupport[ ::dbaccess::DST_MYSQL_JDBC ] = InitAdvanced( 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0 );
- s_aSupport[ ::dbaccess::DST_MYSQL_NATIVE ] = InitAdvanced( 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0 );
+ s_aSupport[ ::dbaccess::DST_MYSQL_NATIVE ] = InitAdvanced( 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0 );
s_aSupport[ ::dbaccess::DST_ORACLE_JDBC ] = InitAdvanced( InitAdvanced::All );
s_aSupport[ ::dbaccess::DST_ADABAS ] = InitAdvanced( 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0 );
s_aSupport[ ::dbaccess::DST_CALC ] = InitAdvanced( InitAdvanced::None );
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 1c5461bbe29f..56f52c986253 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -1806,7 +1806,8 @@ void OSelectionBrowseBox::AddGroupBy( const OTableFieldDescRef& rInfo , sal_uInt
if (bCase(aField,rInfo->GetField()) &&
bCase(aAlias,rInfo->GetAlias()) &&
- pEntry->GetFunctionType() == rInfo->GetFunctionType())
+ pEntry->GetFunctionType() == rInfo->GetFunctionType() &&
+ pEntry->GetFunction() == rInfo->GetFunction())
{
/*sal_uInt32 nPos = aIter - rFields.begin();
bAppend = _nCurrentPos > nPos && (rInfo->IsGroupBy() != pEntry->IsGroupBy());
@@ -1859,7 +1860,8 @@ void OSelectionBrowseBox::AddCondition( const OTableFieldDescRef& rInfo, const S
if (bCase(aField,rInfo->GetField()) &&
bCase(aAlias,rInfo->GetAlias()) &&
- pEntry->GetFunctionType() == rInfo->GetFunctionType())
+ pEntry->GetFunctionType() == rInfo->GetFunctionType() &&
+ pEntry->GetFunction() == rInfo->GetFunction())
{
if ( pEntry->isNumericOrAggreateFunction() && rInfo->IsGroupBy() )
pEntry->SetGroupBy(sal_False);