diff options
-rw-r--r-- | accessibility/inc/helper/listboxhelper.hxx | 4 | ||||
-rw-r--r-- | cui/source/tabpages/grfpage.cxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/drwlayer.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/StatisticsDialogs/SamplingDialog.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/view/drawvie4.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/dlg/vectdlg.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmoutputtypepage.cxx | 5 | ||||
-rw-r--r-- | sw/source/ui/misc/pggrid.cxx | 4 |
8 files changed, 26 insertions, 7 deletions
diff --git a/accessibility/inc/helper/listboxhelper.hxx b/accessibility/inc/helper/listboxhelper.hxx index 346fdf6a9ecb..0aa01abb21e5 100644 --- a/accessibility/inc/helper/listboxhelper.hxx +++ b/accessibility/inc/helper/listboxhelper.hxx @@ -65,7 +65,9 @@ public: { tools::Rectangle aTemp = m_aComboListBox.GetDropDownPosSizePixel(); Size aSize = aTemp.GetSize(); - aSize.setHeight( aSize.Height() / m_aComboListBox.GetDisplayLineCount() ); + sal_uInt16 nLineCount = m_aComboListBox.GetDisplayLineCount(); + assert(nLineCount && "div-by-zero"); + aSize.setHeight( aSize.Height() / nLineCount ); Point aTopLeft = aTemp.TopLeft(); aTopLeft.AdjustY( aSize.Height() * ( nItem - m_aComboListBox.GetTopEntry() ) ); aRect = tools::Rectangle( aTopLeft, aSize ); diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx index c2ecb7e0d912..1546ed77e5f9 100644 --- a/cui/source/tabpages/grfpage.cxx +++ b/cui/source/tabpages/grfpage.cxx @@ -529,6 +529,7 @@ IMPL_LINK( SvxGrfCropPage, CropHdl, SpinField&, rField, void ) if(bZoom && ( ( ( aOrigSize.Height() - (nTop + nBottom )) * nHeightZoom) / 100 >= aPageSize.Height())) { + assert(nHeightZoom && "div-by-zero"); if(&rField == m_pTopMF) { nTop = aOrigSize.Height() - diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index a239079e28b0..c0bdcde30314 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -678,10 +678,14 @@ void ScDrawLayer::ResizeLastRectFromAnchor(const SdrObject* pObj, ScDrawObjData& tools::Rectangle aRectIncludingOffset = aRect; aRectIncludingOffset.setWidth(aRect.GetWidth() + rData.maStartOffset.X()); aRectIncludingOffset.setHeight(aRect.GetHeight() + rData.maStartOffset.Y()); + long nWidth = aRectIncludingOffset.GetWidth(); + assert(nWidth && "div-by-zero"); double fMaxWidthFactor = static_cast<double>(aCurrentCellRect.GetWidth()) - / static_cast<double>(aRectIncludingOffset.GetWidth()); + / static_cast<double>(nWidth); + long nHeight = aRectIncludingOffset.GetHeight(); + assert(nHeight && "div-by-zero"); double fMaxHeightFactor = static_cast<double>(aCurrentCellRect.GetHeight()) - / static_cast<double>(aRectIncludingOffset.GetHeight()); + / static_cast<double>(nHeight); double fMaxFactor = std::min(fMaxHeightFactor, fMaxWidthFactor); if (bIsGrowingLarger) // cell is growing larger diff --git a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx index 42887148cf8d..46a317b22627 100644 --- a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx @@ -201,6 +201,7 @@ ScRange ScSamplingDialog::PerformPeriodicSampling(ScDocShell* pDocShell) outRow = mOutputAddress.Row(); for (SCROW inRow = aStart.Row(); inRow <= aEnd.Row(); inRow++) { + assert(aPeriod && "div-by-zero"); if (i % aPeriod == aPeriod - 1 ) // Sample the last of period { double aValue = mDocument->GetValue(ScAddress(inCol, inRow, inTab)); diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index 2571d95f6bfe..4097186358a9 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -558,8 +558,12 @@ void ScDrawView::FitToCellSize() // For graphic objects, we want to keep the aspect ratio if (pObj->shouldKeepAspectRatio()) { - double fScaleX = static_cast<double>(aCellRect.GetWidth()) / static_cast<double>(aGraphicRect.GetWidth()); - double fScaleY = static_cast<double>(aCellRect.GetHeight()) / static_cast<double>(aGraphicRect.GetHeight()); + long nWidth = aGraphicRect.GetWidth(); + assert(nWidth && "div-by-zero"); + double fScaleX = static_cast<double>(aCellRect.GetWidth()) / static_cast<double>(nWidth); + long nHeight = aGraphicRect.GetHeight(); + assert(nHeight && "div-by-zero"); + double fScaleY = static_cast<double>(aCellRect.GetHeight()) / static_cast<double>(nHeight); double fScaleMin = std::min(fScaleX, fScaleY); aCellRect.setWidth(static_cast<double>(aGraphicRect.GetWidth()) * fScaleMin); diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx index d0baacc0e926..d1a153493abf 100644 --- a/sd/source/ui/dlg/vectdlg.cxx +++ b/sd/source/ui/dlg/vectdlg.cxx @@ -172,7 +172,9 @@ void SdVectorizeDlg::Calculate( Bitmap const & rBmp, GDIMetaFile& rMtf ) const long nHeight = pRAcc->Height(); const long nTileX = static_cast<long>(m_pMtFillHoles->GetValue()); const long nTileY = static_cast<long>(m_pMtFillHoles->GetValue()); + assert(nTileX && "div-by-zero"); const long nCountX = nWidth / nTileX; + assert(nTileY && "div-by-zero"); const long nCountY = nHeight / nTileY; const long nRestX = nWidth % nTileX; const long nRestY = nHeight % nTileY; diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx index ed7fcba2d4df..0725959da127 100644 --- a/sw/source/ui/dbui/mmoutputtypepage.cxx +++ b/sw/source/ui/dbui/mmoutputtypepage.cxx @@ -573,8 +573,11 @@ void SwSendMailDialog::UpdateTransferStatus() sStatus = m_sErrorStatus.replaceFirst("%1", OUString::number(m_nErrorCount) ); m_pErrorStatus->SetText(sStatus); - if(m_pImpl->aDescriptors.size()) + if (m_pImpl->aDescriptors.size()) + { + assert(m_nExpectedCount && "div-by-zero"); m_pProgressBar->SetValue(static_cast<sal_uInt16>(m_nSendCount * 100 / m_nExpectedCount)); + } else m_pProgressBar->SetValue(0); } diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx index 2ec697256232..df3717390434 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -417,7 +417,9 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField&, rField, void) } else if (m_pCharsPerLineNF == &rField) { - long nWidth = static_cast< sal_Int32 >(m_aPageSize.Width() / m_pCharsPerLineNF->GetValue()); + auto nValue = m_pCharsPerLineNF->GetValue(); + assert(nValue && "div-by-zero"); + long nWidth = static_cast< sal_Int32 >(m_aPageSize.Width() / nValue); m_pCharWidthMF->SetValue(m_pCharWidthMF->Normalize(nWidth), FUNIT_TWIP); SetLinesOrCharsRanges( *m_pCharsRangeFT , m_pCharsPerLineNF->GetMax() ); } |