diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-09 11:54:41 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-08-09 15:48:32 +0200 |
commit | 0e1264f44ce421f6b175598fff68a15ccc8b5449 (patch) | |
tree | 205188c2842de6f539d7fef504b5520c58996950 /sc/source/ui/unoobj/nameuno.cxx | |
parent | f97077c5fe41195bf2054892ae08e3307983e6dc (diff) |
loplugin:flatten in sc/ui/unoobj
Change-Id: I9b03672387aa555eb11149763a1113e0768f3f37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100398
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/unoobj/nameuno.cxx')
-rw-r--r-- | sc/source/ui/unoobj/nameuno.cxx | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx index de209a3e745d..82ba1d88ffff 100644 --- a/sc/source/ui/unoobj/nameuno.cxx +++ b/sc/source/ui/unoobj/nameuno.cxx @@ -745,20 +745,20 @@ void ScNamedRangesObj::removeActionLock() void ScNamedRangesObj::setActionLocks( sal_Int16 nLock ) { SolarMutexGuard aGuard; - if ( nLock >= 0 ) + if ( nLock < 0 ) + return; + + ScDocument& rDoc = pDocShell->GetDocument(); + sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount(); + if ( nLock == 0 && nLockCount > 0 ) { - ScDocument& rDoc = pDocShell->GetDocument(); - sal_Int16 nLockCount = rDoc.GetNamedRangesLockCount(); - if ( nLock == 0 && nLockCount > 0 ) - { - unlock(); - } - if ( nLock > 0 && nLockCount == 0 ) - { - lock(); - } - rDoc.SetNamedRangesLockCount( nLock ); + unlock(); } + if ( nLock > 0 && nLockCount == 0 ) + { + lock(); + } + rDoc.SetNamedRangesLockCount( nLock ); } sal_Int16 ScNamedRangesObj::resetActionLocks() @@ -926,39 +926,39 @@ ScRangePair* ScLabelRangeObj::GetData_Impl() void ScLabelRangeObj::Modify_Impl( const ScRange* pLabel, const ScRange* pData ) { - if (pDocShell) - { - ScDocument& rDoc = pDocShell->GetDocument(); - ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges(); - if (pOldList) - { - ScRangePairListRef xNewList(pOldList->Clone()); - ScRangePair* pEntry = xNewList->Find( aRange ); - if (pEntry) - { - if ( pLabel ) - pEntry->GetRange(0) = *pLabel; - if ( pData ) - pEntry->GetRange(1) = *pData; + if (!pDocShell) + return; - xNewList->Join( *pEntry, true ); + ScDocument& rDoc = pDocShell->GetDocument(); + ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges(); + if (!pOldList) + return; - if (bColumn) - rDoc.GetColNameRangesRef() = xNewList; - else - rDoc.GetRowNameRangesRef() = xNewList; + ScRangePairListRef xNewList(pOldList->Clone()); + ScRangePair* pEntry = xNewList->Find( aRange ); + if (!pEntry) + return; - rDoc.CompileColRowNameFormula(); - pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid ); - pDocShell->SetDocumentModified(); + if ( pLabel ) + pEntry->GetRange(0) = *pLabel; + if ( pData ) + pEntry->GetRange(1) = *pData; - //! Undo ?!?! (here and from dialog) + xNewList->Join( *pEntry, true ); - if ( pLabel ) - aRange = *pLabel; // adapt object to find range again - } - } - } + if (bColumn) + rDoc.GetColNameRangesRef() = xNewList; + else + rDoc.GetRowNameRangesRef() = xNewList; + + rDoc.CompileColRowNameFormula(); + pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid ); + pDocShell->SetDocumentModified(); + + //! Undo ?!?! (here and from dialog) + + if ( pLabel ) + aRange = *pLabel; // adapt object to find range again } // sheet::XLabelRange @@ -1045,32 +1045,32 @@ void SAL_CALL ScLabelRangesObj::addNew( const table::CellRangeAddress& aLabelAre const table::CellRangeAddress& aDataArea ) { SolarMutexGuard aGuard; - if (pDocShell) - { - ScDocument& rDoc = pDocShell->GetDocument(); - ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges(); - if (pOldList) - { - ScRangePairListRef xNewList(pOldList->Clone()); + if (!pDocShell) + return; - ScRange aLabelRange; - ScRange aDataRange; - ScUnoConversion::FillScRange( aLabelRange, aLabelArea ); - ScUnoConversion::FillScRange( aDataRange, aDataArea ); - xNewList->Join( ScRangePair( aLabelRange, aDataRange ) ); + ScDocument& rDoc = pDocShell->GetDocument(); + ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges(); + if (!pOldList) + return; - if (bColumn) - rDoc.GetColNameRangesRef() = xNewList; - else - rDoc.GetRowNameRangesRef() = xNewList; + ScRangePairListRef xNewList(pOldList->Clone()); - rDoc.CompileColRowNameFormula(); - pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid ); - pDocShell->SetDocumentModified(); + ScRange aLabelRange; + ScRange aDataRange; + ScUnoConversion::FillScRange( aLabelRange, aLabelArea ); + ScUnoConversion::FillScRange( aDataRange, aDataArea ); + xNewList->Join( ScRangePair( aLabelRange, aDataRange ) ); - //! Undo ?!?! (here and from dialog) - } - } + if (bColumn) + rDoc.GetColNameRangesRef() = xNewList; + else + rDoc.GetRowNameRangesRef() = xNewList; + + rDoc.CompileColRowNameFormula(); + pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid ); + pDocShell->SetDocumentModified(); + + //! Undo ?!?! (here and from dialog) } void SAL_CALL ScLabelRangesObj::removeByIndex( sal_Int32 nIndex ) |