From 5f646281f777019a4e91c467f1d6f8a7f2083ffd Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 29 Jul 2020 16:13:56 +0200 Subject: loplugin:flatten in sc/ui Change-Id: I4e12da123924b1036c1348ad1b04eef1826ae26a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99703 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/source/ui/docshell/docsh4.cxx | 110 +++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 55 deletions(-) (limited to 'sc/source/ui/docshell/docsh4.cxx') diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index ffb31aaeaa5f..dab72363ce3f 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -1436,31 +1436,31 @@ void ScDocShell::DoRecalc( bool bApi ) pSh->UpdateInputHandler(); } } - if (!bDone) // otherwise re-calculate document + if (bDone) // otherwise re-calculate document + return; + + weld::WaitObject aWaitObj( GetActiveDialogParent() ); + if ( pHdl ) { - weld::WaitObject aWaitObj( GetActiveDialogParent() ); - if ( pHdl ) - { - // tdf97897 set current cell to Dirty to force recalculation of cell - ScFormulaCell* pFC = m_aDocument.GetFormulaCell( pHdl->GetCursorPos()); - if (pFC) - pFC->SetDirty(); - } - m_aDocument.CalcFormulaTree(); - if ( pSh ) - pSh->UpdateCharts(true); + // tdf97897 set current cell to Dirty to force recalculation of cell + ScFormulaCell* pFC = m_aDocument.GetFormulaCell( pHdl->GetCursorPos()); + if (pFC) + pFC->SetDirty(); + } + m_aDocument.CalcFormulaTree(); + if ( pSh ) + pSh->UpdateCharts(true); - m_aDocument.BroadcastUno( SfxHint( SfxHintId::DataChanged ) ); + m_aDocument.BroadcastUno( SfxHint( SfxHintId::DataChanged ) ); - // If there are charts, then paint everything, so that PostDataChanged - // and the charts do not come one after the other and parts are painted twice. + // If there are charts, then paint everything, so that PostDataChanged + // and the charts do not come one after the other and parts are painted twice. - ScChartListenerCollection* pCharts = m_aDocument.GetChartListenerCollection(); - if ( pCharts && pCharts->hasListeners() ) - PostPaintGridAll(); - else - PostDataChanged(); - } + ScChartListenerCollection* pCharts = m_aDocument.GetChartListenerCollection(); + if ( pCharts && pCharts->hasListeners() ) + PostPaintGridAll(); + else + PostDataChanged(); } void ScDocShell::DoHardRecalc() @@ -1509,19 +1509,19 @@ void ScDocShell::DoAutoStyle( const ScRange& rRange, const OUString& rStyle ) if (!pStyleSheet) pStyleSheet = static_cast( pStylePool->Find( ScResId(STR_STYLENAME_STANDARD_CELL), SfxStyleFamily::Para )); - if (pStyleSheet) - { - OSL_ENSURE(rRange.aStart.Tab() == rRange.aEnd.Tab(), - "DoAutoStyle with several tables"); - SCTAB nTab = rRange.aStart.Tab(); - SCCOL nStartCol = rRange.aStart.Col(); - SCROW nStartRow = rRange.aStart.Row(); - SCCOL nEndCol = rRange.aEnd.Col(); - SCROW nEndRow = rRange.aEnd.Row(); - m_aDocument.ApplyStyleAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, *pStyleSheet ); - m_aDocument.ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow, nTab ); - PostPaint( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab, PaintPartFlags::Grid ); - } + if (!pStyleSheet) + return; + + OSL_ENSURE(rRange.aStart.Tab() == rRange.aEnd.Tab(), + "DoAutoStyle with several tables"); + SCTAB nTab = rRange.aStart.Tab(); + SCCOL nStartCol = rRange.aStart.Col(); + SCROW nStartRow = rRange.aStart.Row(); + SCCOL nEndCol = rRange.aEnd.Col(); + SCROW nEndRow = rRange.aEnd.Row(); + m_aDocument.ApplyStyleAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, *pStyleSheet ); + m_aDocument.ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow, nTab ); + PostPaint( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab, PaintPartFlags::Grid ); } void ScDocShell::NotifyStyle( const SfxStyleSheetHint& rHint ) @@ -1604,31 +1604,31 @@ void ScDocShell::SetPrintZoom( SCTAB nTab, sal_uInt16 nScale, sal_uInt16 nPages ScStyleSheetPool* pStylePool = m_aDocument.GetStyleSheetPool(); SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aStyleName, SfxStyleFamily::Page ); OSL_ENSURE( pStyleSheet, "PageStyle not found" ); - if ( pStyleSheet ) - { - ScDocShellModificator aModificator( *this ); + if ( !pStyleSheet ) + return; - SfxItemSet& rSet = pStyleSheet->GetItemSet(); - const bool bUndo(m_aDocument.IsUndoEnabled()); - if (bUndo) - { - sal_uInt16 nOldScale = rSet.Get(ATTR_PAGE_SCALE).GetValue(); - sal_uInt16 nOldPages = rSet.Get(ATTR_PAGE_SCALETOPAGES).GetValue(); - GetUndoManager()->AddUndoAction( std::make_unique( - this, nTab, nOldScale, nOldPages, nScale, nPages ) ); - } + ScDocShellModificator aModificator( *this ); - rSet.Put( SfxUInt16Item( ATTR_PAGE_SCALE, nScale ) ); - rSet.Put( SfxUInt16Item( ATTR_PAGE_SCALETOPAGES, nPages ) ); + SfxItemSet& rSet = pStyleSheet->GetItemSet(); + const bool bUndo(m_aDocument.IsUndoEnabled()); + if (bUndo) + { + sal_uInt16 nOldScale = rSet.Get(ATTR_PAGE_SCALE).GetValue(); + sal_uInt16 nOldPages = rSet.Get(ATTR_PAGE_SCALETOPAGES).GetValue(); + GetUndoManager()->AddUndoAction( std::make_unique( + this, nTab, nOldScale, nOldPages, nScale, nPages ) ); + } - ScPrintFunc aPrintFunc( this, GetPrinter(), nTab ); - aPrintFunc.UpdatePages(); - aModificator.SetDocumentModified(); + rSet.Put( SfxUInt16Item( ATTR_PAGE_SCALE, nScale ) ); + rSet.Put( SfxUInt16Item( ATTR_PAGE_SCALETOPAGES, nPages ) ); - SfxBindings* pBindings = GetViewBindings(); - if (pBindings) - pBindings->Invalidate( FID_RESET_PRINTZOOM ); - } + ScPrintFunc aPrintFunc( this, GetPrinter(), nTab ); + aPrintFunc.UpdatePages(); + aModificator.SetDocumentModified(); + + SfxBindings* pBindings = GetViewBindings(); + if (pBindings) + pBindings->Invalidate( FID_RESET_PRINTZOOM ); } bool ScDocShell::AdjustPrintZoom( const ScRange& rRange ) -- cgit