From bfc1600c6ade6f006eb774bffe7caa9c948e8603 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 22 Jun 2021 10:21:21 +0200 Subject: loplugin:indentation improve checks for brace alignment Change-Id: I333100fda7e181f68f36b03279b3fbb8cb768310 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117615 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../source/core/api/SingleSelectQueryComposer.cxx | 20 ++-- .../source/core/dataaccess/documentcontainer.cxx | 2 +- .../source/core/dataaccess/documentdefinition.cxx | 2 +- dbaccess/source/ui/browser/formadapter.cxx | 4 +- dbaccess/source/ui/browser/sbagrid.cxx | 121 +++++++++++---------- .../source/ui/misc/dbsubcomponentcontroller.cxx | 2 +- 6 files changed, 76 insertions(+), 75 deletions(-) (limited to 'dbaccess') diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index 2284f1db3e3f..1153fb56714e 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -431,11 +431,11 @@ OUString OSingleSelectQueryComposer::impl_getColumnRealName_throw(const Referenc || !m_aCurrentColumns[SelectColumns] || !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_NAME) ) - { - OUString sError(DBA_RES(RID_STR_COLUMN_UNKNOWN_PROP)); - SQLException aErr(sError.replaceAll("%value", PROPERTY_NAME),*this,SQLSTATE_GENERAL,1000,Any() ); - throw SQLException(DBA_RES(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,makeAny(aErr) ); - } + { + OUString sError(DBA_RES(RID_STR_COLUMN_UNKNOWN_PROP)); + SQLException aErr(sError.replaceAll("%value", PROPERTY_NAME),*this,SQLSTATE_GENERAL,1000,Any() ); + throw SQLException(DBA_RES(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,makeAny(aErr) ); + } OUString aName, aNewName; column->getPropertyValue(PROPERTY_NAME) >>= aName; @@ -501,11 +501,11 @@ OUString OSingleSelectQueryComposer::impl_getColumnNameOrderBy_throw(const Refer || !m_aCurrentColumns[SelectColumns] || !column->getPropertySetInfo()->hasPropertyByName(PROPERTY_NAME) ) - { - OUString sError(DBA_RES(RID_STR_COLUMN_UNKNOWN_PROP)); - SQLException aErr(sError.replaceAll("%value", PROPERTY_NAME),*this,SQLSTATE_GENERAL,1000,Any() ); - throw SQLException(DBA_RES(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,makeAny(aErr) ); - } + { + OUString sError(DBA_RES(RID_STR_COLUMN_UNKNOWN_PROP)); + SQLException aErr(sError.replaceAll("%value", PROPERTY_NAME),*this,SQLSTATE_GENERAL,1000,Any() ); + throw SQLException(DBA_RES(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,makeAny(aErr) ); + } OUString aName; column->getPropertyValue(PROPERTY_NAME) >>= aName; diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index 472f60ad566f..4554a1fd4dcb 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -413,7 +413,7 @@ Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 Com aOpenCommand, Environment ); aRet <<= xSet; - } + } else { // Unsupported. diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 8291597870c5..b702d9133f94 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -883,7 +883,7 @@ Any ODocumentDefinition::onCommandOpenSomething( const Any& _rOpenArgument, cons _rxEnvironment ); // Unreachable OSL_FAIL( "unreachable" ); - } + } OSL_ENSURE( !m_pImpl->m_aProps.sPersistentName.isEmpty(), "ODocumentDefinition::onCommandOpenSomething: no persistent name - cannot load!" ); diff --git a/dbaccess/source/ui/browser/formadapter.cxx b/dbaccess/source/ui/browser/formadapter.cxx index 9620d5840a34..ee38f63609b0 100644 --- a/dbaccess/source/ui/browser/formadapter.cxx +++ b/dbaccess/source/ui/browser/formadapter.cxx @@ -1376,7 +1376,7 @@ void SbaXFormAdapter::implInsert(const Any& aElement, sal_Int32 nIndex, const OU if (!xElementSet.is()) { throw css::lang::IllegalArgumentException(); - } + } OUString sName; try { @@ -1545,7 +1545,7 @@ void SAL_CALL SbaXFormAdapter::replaceByIndex(sal_Int32 _rIndex, const Any& Elem if (!xElementSet.is()) { throw css::lang::IllegalArgumentException(); - } + } OUString sName; try { diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx index 7c6278d60fe2..795aae0350dc 100644 --- a/dbaccess/source/ui/browser/sbagrid.cxx +++ b/dbaccess/source/ui/browser/sbagrid.cxx @@ -1142,82 +1142,83 @@ sal_Int8 SbaGridControl::AcceptDrop( const BrowserAcceptDropEvent& rEvt ) if (!::dbtools::getConnection(Reference< XRowSet > (getDataSource(),UNO_QUERY)).is()) return nAction; - if ( IsDropFormatSupported( SotClipboardFormatId::STRING ) ) do - { // odd construction, but spares us a lot of (explicit ;) goto's + if ( IsDropFormatSupported( SotClipboardFormatId::STRING ) ) + do + { // odd construction, but spares us a lot of (explicit ;) goto's - if (!GetEmptyRow().is()) - // without an empty row we're not in update mode - break; + if (!GetEmptyRow().is()) + // without an empty row we're not in update mode + break; - const sal_Int32 nRow = GetRowAtYPosPixel(rEvt.maPosPixel.Y(), false); - const sal_uInt16 nCol = GetColumnId(GetColumnAtXPosPixel(rEvt.maPosPixel.X())); + const sal_Int32 nRow = GetRowAtYPosPixel(rEvt.maPosPixel.Y(), false); + const sal_uInt16 nCol = GetColumnId(GetColumnAtXPosPixel(rEvt.maPosPixel.X())); - sal_Int32 nCorrectRowCount = GetRowCount(); - if (GetOptions() & DbGridControlOptions::Insert) - --nCorrectRowCount; // there is an empty row for inserting records - if (IsCurrentAppending()) - --nCorrectRowCount; // the current data record doesn't really exist, we are appending a new one + sal_Int32 nCorrectRowCount = GetRowCount(); + if (GetOptions() & DbGridControlOptions::Insert) + --nCorrectRowCount; // there is an empty row for inserting records + if (IsCurrentAppending()) + --nCorrectRowCount; // the current data record doesn't really exist, we are appending a new one - if ( (nCol == BROWSER_INVALIDID) || (nRow >= nCorrectRowCount) || (nCol == 0) ) - // no valid cell under the mouse cursor - break; + if ( (nCol == BROWSER_INVALIDID) || (nRow >= nCorrectRowCount) || (nCol == 0) ) + // no valid cell under the mouse cursor + break; - tools::Rectangle aRect = GetCellRect(nRow, nCol, false); - if (!aRect.IsInside(rEvt.maPosPixel)) - // not dropped within a cell (a cell isn't as wide as the column - the are small spaces) - break; + tools::Rectangle aRect = GetCellRect(nRow, nCol, false); + if (!aRect.IsInside(rEvt.maPosPixel)) + // not dropped within a cell (a cell isn't as wide as the column - the are small spaces) + break; - if ((IsModified() || (GetCurrentRow().is() && GetCurrentRow()->IsModified())) && (GetCurrentPos() != nRow)) - // there is a current and modified row or cell and he text is to be dropped into another one - break; + if ((IsModified() || (GetCurrentRow().is() && GetCurrentRow()->IsModified())) && (GetCurrentPos() != nRow)) + // there is a current and modified row or cell and he text is to be dropped into another one + break; - CellControllerRef xCurrentController = Controller(); - if (xCurrentController.is() && xCurrentController->IsValueChangedFromSaved() && ((nRow != GetCurRow()) || (nCol != GetCurColumnId()))) - // the current controller is modified and the user wants to drop in another cell -> no chance - // (when leaving the modified cell an error may occur - this is deadly while dragging) - break; + CellControllerRef xCurrentController = Controller(); + if (xCurrentController.is() && xCurrentController->IsValueChangedFromSaved() && ((nRow != GetCurRow()) || (nCol != GetCurColumnId()))) + // the current controller is modified and the user wants to drop in another cell -> no chance + // (when leaving the modified cell an error may occur - this is deadly while dragging) + break; - Reference< XPropertySet > xField = getField(GetModelColumnPos(nCol)); - if (!xField.is()) - // the column is not valid bound (for instance a binary field) - break; + Reference< XPropertySet > xField = getField(GetModelColumnPos(nCol)); + if (!xField.is()) + // the column is not valid bound (for instance a binary field) + break; - try - { - if (::comphelper::getBOOL(xField->getPropertyValue(PROPERTY_ISREADONLY))) + try + { + if (::comphelper::getBOOL(xField->getPropertyValue(PROPERTY_ISREADONLY))) + break; + } + catch (const Exception& ) + { + // assume RO break; - } - catch (const Exception& ) - { - // assume RO - break; - } + } - try - { - // assume that text can be dropped into a field if the column has a css::awt::XTextComponent interface - Reference< XIndexAccess > xColumnControls(static_cast(GetPeer()), UNO_QUERY); - if (xColumnControls.is()) + try { - Reference< css::awt::XTextComponent > xColControl( - xColumnControls->getByIndex(GetViewColumnPos(nCol)), - css::uno::UNO_QUERY); - if (xColControl.is()) + // assume that text can be dropped into a field if the column has a css::awt::XTextComponent interface + Reference< XIndexAccess > xColumnControls(static_cast(GetPeer()), UNO_QUERY); + if (xColumnControls.is()) { - m_bActivatingForDrop = true; - GoToRowColumnId(nRow, nCol); - m_bActivatingForDrop = false; - - nAction = DND_ACTION_COPY; + Reference< css::awt::XTextComponent > xColControl( + xColumnControls->getByIndex(GetViewColumnPos(nCol)), + css::uno::UNO_QUERY); + if (xColControl.is()) + { + m_bActivatingForDrop = true; + GoToRowColumnId(nRow, nCol); + m_bActivatingForDrop = false; + + nAction = DND_ACTION_COPY; + } } } - } - catch( const Exception& ) - { - DBG_UNHANDLED_EXCEPTION("dbaccess"); - } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION("dbaccess"); + } - } while (false); + } while (false); if(nAction != DND_ACTION_COPY && GetEmptyRow().is()) { diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx index c036f8bdee82..74983ef30bb6 100644 --- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx +++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx @@ -227,7 +227,7 @@ namespace dbaui [](const Type& type) { return type == cppu::UnoType::get(); } ); aTypes.realloc( std::distance(aTypes.begin(), newEnd) ); - } + } return aTypes; } -- cgit v1.2.3