diff options
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/api/tablecontainer.cxx | 10 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/documentdefinition.cxx | 119 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/UITools.cxx | 20 |
3 files changed, 71 insertions, 78 deletions
diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx index a7ce9d8981e2..afd6dab6852b 100644 --- a/dbaccess/source/core/api/tablecontainer.cxx +++ b/dbaccess/source/core/api/tablecontainer.cxx @@ -414,13 +414,11 @@ void SAL_CALL OTableContainer::elementRemoved( const ContainerEvent& /*Event*/ ) void SAL_CALL OTableContainer::elementReplaced( const ContainerEvent& Event ) { // create a new config entry - { - OUString sOldComposedName,sNewComposedName; - Event.ReplacedElement >>= sOldComposedName; - Event.Accessor >>= sNewComposedName; + OUString sOldComposedName,sNewComposedName; + Event.ReplacedElement >>= sOldComposedName; + Event.Accessor >>= sNewComposedName; - renameObject(sOldComposedName,sNewComposedName); - } + renameObject(sOldComposedName,sNewComposedName); } void SAL_CALL OTableContainer::disposing() diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 360876726591..c61e4b7ae9e3 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -1300,78 +1300,75 @@ void ODocumentDefinition::saveAs() } try { - { - ::SolarMutexGuard aSolarGuard; - - // the request - DocumentSaveRequest aRequest; - aRequest.Name = m_pImpl->m_aProps.aTitle; - - aRequest.Content.set(m_xParentContainer,UNO_QUERY); - OInteractionRequest* pRequest = new OInteractionRequest(makeAny(aRequest)); - Reference< XInteractionRequest > xRequest(pRequest); - // some knittings - // two continuations allowed: OK and Cancel - ODocumentSaveContinuation* pDocuSave = new ODocumentSaveContinuation; - pRequest->addContinuation(pDocuSave); - OInteraction< XInteractionDisapprove >* pDisApprove = new OInteraction< XInteractionDisapprove >; - pRequest->addContinuation(pDisApprove); - OInteractionAbort* pAbort = new OInteractionAbort; - pRequest->addContinuation(pAbort); - - // create the handler, let it handle the request - Reference< XInteractionHandler2 > xHandler( InteractionHandler::createWithParent(m_aContext, nullptr) ); - xHandler->handle(xRequest); + ::SolarMutexGuard aSolarGuard; - if ( pAbort->wasSelected() ) - return; - if ( pDisApprove->wasSelected() ) - return; - if ( pDocuSave->wasSelected() ) + // the request + DocumentSaveRequest aRequest; + aRequest.Name = m_pImpl->m_aProps.aTitle; + + aRequest.Content.set(m_xParentContainer,UNO_QUERY); + OInteractionRequest* pRequest = new OInteractionRequest(makeAny(aRequest)); + Reference< XInteractionRequest > xRequest(pRequest); + // some knittings + // two continuations allowed: OK and Cancel + ODocumentSaveContinuation* pDocuSave = new ODocumentSaveContinuation; + pRequest->addContinuation(pDocuSave); + OInteraction< XInteractionDisapprove >* pDisApprove = new OInteraction< XInteractionDisapprove >; + pRequest->addContinuation(pDisApprove); + OInteractionAbort* pAbort = new OInteractionAbort; + pRequest->addContinuation(pAbort); + + // create the handler, let it handle the request + Reference< XInteractionHandler2 > xHandler( InteractionHandler::createWithParent(m_aContext, nullptr) ); + xHandler->handle(xRequest); + + if ( pAbort->wasSelected() ) + return; + if ( pDisApprove->wasSelected() ) + return; + if ( pDocuSave->wasSelected() ) + { + ::osl::MutexGuard aGuard(m_aMutex); + Reference<XNameContainer> xNC(pDocuSave->getContent(),UNO_QUERY); + if ( xNC.is() ) { - ::osl::MutexGuard aGuard(m_aMutex); - Reference<XNameContainer> xNC(pDocuSave->getContent(),UNO_QUERY); - if ( xNC.is() ) + if ( m_pImpl->m_aProps.aTitle != pDocuSave->getName() ) { - if ( m_pImpl->m_aProps.aTitle != pDocuSave->getName() ) + try { - try - { - Reference< XStorage> xStorage = getContainerStorage(); - - OUString sPersistentName = ::dbtools::createUniqueName(xStorage,"Obj"); - xStorage->copyElementTo(m_pImpl->m_aProps.sPersistentName,xStorage,sPersistentName); - - OUString sOldName = m_pImpl->m_aProps.aTitle; - rename(pDocuSave->getName()); - updateDocumentTitle(); - - uno::Sequence<uno::Any> aArguments(comphelper::InitAnyPropertySequence( - { - {PROPERTY_NAME, uno::Any(sOldName)}, // set as folder - {PROPERTY_PERSISTENT_NAME, uno::Any(sPersistentName)}, - {PROPERTY_AS_TEMPLATE, uno::Any(m_pImpl->m_aProps.bAsTemplate)}, - })); - 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(const Exception&) + Reference< XStorage> xStorage = getContainerStorage(); + + OUString sPersistentName = ::dbtools::createUniqueName(xStorage,"Obj"); + xStorage->copyElementTo(m_pImpl->m_aProps.sPersistentName,xStorage,sPersistentName); + + OUString sOldName = m_pImpl->m_aProps.aTitle; + rename(pDocuSave->getName()); + updateDocumentTitle(); + + uno::Sequence<uno::Any> aArguments(comphelper::InitAnyPropertySequence( { - DBG_UNHANDLED_EXCEPTION(); - } + {PROPERTY_NAME, uno::Any(sOldName)}, // set as folder + {PROPERTY_PERSISTENT_NAME, uno::Any(sPersistentName)}, + {PROPERTY_AS_TEMPLATE, uno::Any(m_pImpl->m_aProps.bAsTemplate)}, + })); + 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() ) + catch(const Exception&) { - xPersist->storeOwn(); - notifyDataSourceModified(); + DBG_UNHANDLED_EXCEPTION(); } } + Reference<XEmbedPersist> xPersist(m_xEmbeddedObject,UNO_QUERY); + if ( xPersist.is() ) + { + xPersist->storeOwn(); + notifyDataSourceModified(); + } } } - } catch(const Exception&) { diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index f9dbd8421ad3..a8840427cc86 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -1114,18 +1114,16 @@ TOTypeInfoSP queryPrimaryKeyType(const OTypeInfoMap& _rTypeInfo) // because we don't have the possibility to know how to create // such auto increment column later on // so until we know how to do it, we create a column without autoincrement - // if ( !aIter->second->bAutoIncrement ) - { // therefore we have searched - if ( aIter->second->nType == DataType::INTEGER ) - { - pTypeInfo = aIter->second; // alternative - break; - } - else if ( !pTypeInfo.get() && aIter->second->nType == DataType::DOUBLE ) - pTypeInfo = aIter->second; // alternative - else if ( !pTypeInfo.get() && aIter->second->nType == DataType::REAL ) - pTypeInfo = aIter->second; // alternative + // therefore we have searched + if ( aIter->second->nType == DataType::INTEGER ) + { + pTypeInfo = aIter->second; // alternative + break; } + else if ( !pTypeInfo.get() && aIter->second->nType == DataType::DOUBLE ) + pTypeInfo = aIter->second; // alternative + else if ( !pTypeInfo.get() && aIter->second->nType == DataType::REAL ) + pTypeInfo = aIter->second; // alternative } if ( !pTypeInfo.get() ) // just a fallback pTypeInfo = queryTypeInfoByType(DataType::VARCHAR,_rTypeInfo); |