diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-21 13:51:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-12-21 17:14:42 +0100 |
commit | 82233965486f88f4ce1313dcf35b4bc688e1832a (patch) | |
tree | ba10593b268cec21107c4d718629da118c3c6bea /dbaccess/source/ui/app | |
parent | 489bce598626390d9c0aa5e5b8514e26070add61 (diff) |
loplugin:flatten in desktop..drawinglayer
Change-Id: Ie6594c9961aba5517c6ff61fb3bc1142081b1197
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127225
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess/source/ui/app')
-rw-r--r-- | dbaccess/source/ui/app/AppController.cxx | 123 |
1 files changed, 61 insertions, 62 deletions
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 003b295e3178..f6837cfdbe65 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -1694,23 +1694,23 @@ bool OApplicationController::onEntryDoubleClick(const weld::TreeView& rTreeView) if (!rTreeView.get_cursor(xHdlEntry.get())) return false; - if (pContainer->isLeaf(rTreeView, *xHdlEntry)) + if (!pContainer->isLeaf(rTreeView, *xHdlEntry)) + return false; // not handled + + try { - try - { - // opens a new frame with either the table or the query or report or form or view - openElementWithArguments( - getContainer()->getQualifiedName(xHdlEntry.get()), - getContainer()->getElementType(), - E_OPEN_NORMAL, - 0, - ::comphelper::NamedValueCollection() ); - return true; // handled - } - catch(const Exception&) - { - DBG_UNHANDLED_EXCEPTION("dbaccess"); - } + // opens a new frame with either the table or the query or report or form or view + openElementWithArguments( + getContainer()->getQualifiedName(xHdlEntry.get()), + getContainer()->getElementType(), + E_OPEN_NORMAL, + 0, + ::comphelper::NamedValueCollection() ); + return true; // handled + } + catch(const Exception&) + { + DBG_UNHANDLED_EXCEPTION("dbaccess"); } return false; // not handled @@ -2324,43 +2324,42 @@ sal_Int8 OApplicationController::queryDrop( const AcceptDropEvent& _rEvt, const sal_Int8 nActionAskedFor = _rEvt.mnAction; // check if we're a table or query container OApplicationView* pView = getContainer(); - if ( pView && !isDataSourceReadOnly() ) + if ( !pView || isDataSourceReadOnly() ) + return DND_ACTION_NONE; + + ElementType eType = pView->getElementType(); + if ( eType == E_NONE || (eType == E_TABLE && isConnectionReadOnly()) ) + return DND_ACTION_NONE; + + // check for the concrete type + if(std::any_of(_rFlavors.begin(),_rFlavors.end(),TAppSupportedSotFunctor(eType))) + return DND_ACTION_COPY; + + if ( eType != E_FORM && eType != E_REPORT ) + return DND_ACTION_NONE; + + sal_Int8 nAction = OComponentTransferable::canExtractComponentDescriptor(_rFlavors,eType == E_FORM) ? DND_ACTION_COPY : DND_ACTION_NONE; + if ( nAction == DND_ACTION_NONE ) + return DND_ACTION_NONE; + + auto xHitEntry = pView->getEntry(_rEvt.maPosPixel); + if (xHitEntry) { - ElementType eType = pView->getElementType(); - if ( eType != E_NONE && (eType != E_TABLE || !isConnectionReadOnly()) ) + OUString sName = pView->getQualifiedName(xHitEntry.get()); + if ( !sName.isEmpty() ) { - // check for the concrete type - if(std::any_of(_rFlavors.begin(),_rFlavors.end(),TAppSupportedSotFunctor(eType))) - return DND_ACTION_COPY; - if ( eType == E_FORM || eType == E_REPORT ) + Reference< XHierarchicalNameAccess > xContainer(getElements(pView->getElementType()),UNO_QUERY); + if ( xContainer.is() && xContainer->hasByHierarchicalName(sName) ) { - sal_Int8 nAction = OComponentTransferable::canExtractComponentDescriptor(_rFlavors,eType == E_FORM) ? DND_ACTION_COPY : DND_ACTION_NONE; - if ( nAction != DND_ACTION_NONE ) - { - auto xHitEntry = pView->getEntry(_rEvt.maPosPixel); - if (xHitEntry) - { - OUString sName = pView->getQualifiedName(xHitEntry.get()); - if ( !sName.isEmpty() ) - { - 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; + Reference< XHierarchicalNameAccess > xHitObject(xContainer->getByHierarchicalName(sName),UNO_QUERY); + if ( xHitObject.is() ) + nAction = nActionAskedFor & DND_ACTION_COPYMOVE; } + else + nAction = DND_ACTION_NONE; } } - - return DND_ACTION_NONE; + return nAction; } sal_Int8 OApplicationController::executeDrop( const ExecuteDropEvent& _rEvt ) @@ -2616,25 +2615,25 @@ sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel > } // initial preview mode - if ( m_xDataSource.is() ) + if ( !m_xDataSource ) + return true; + + try { - try - { - // to get the 'modified' for the data source - ::comphelper::NamedValueCollection aLayoutInfo( m_xDataSource->getPropertyValue( PROPERTY_LAYOUTINFORMATION ) ); - if ( aLayoutInfo.has( INFO_PREVIEW ) ) - { - const sal_Int32 nPreviewMode( aLayoutInfo.getOrDefault( INFO_PREVIEW, sal_Int32(0) ) ); - m_ePreviewMode = static_cast< PreviewMode >( nPreviewMode ); - if ( getView() ) - getContainer()->switchPreview( m_ePreviewMode ); - } - } - catch( const Exception& ) + // to get the 'modified' for the data source + ::comphelper::NamedValueCollection aLayoutInfo( m_xDataSource->getPropertyValue( PROPERTY_LAYOUTINFORMATION ) ); + if ( aLayoutInfo.has( INFO_PREVIEW ) ) { - DBG_UNHANDLED_EXCEPTION("dbaccess"); + const sal_Int32 nPreviewMode( aLayoutInfo.getOrDefault( INFO_PREVIEW, sal_Int32(0) ) ); + m_ePreviewMode = static_cast< PreviewMode >( nPreviewMode ); + if ( getView() ) + getContainer()->switchPreview( m_ePreviewMode ); } } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION("dbaccess"); + } return true; } |