diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2024-10-10 19:48:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-10-12 11:36:00 +0200 |
commit | 7970ad40041b87a6ddb6829271208fe3993ed01c (patch) | |
tree | bede315e36e15a3309c5b249b28c9584e825cf5a /svx | |
parent | d923c227fa290ffdca175a5b903b5a745e2f4b3a (diff) |
cid#1608328 Overflowed constant
Change-Id: I2a69dd73ee915299f803efae891cbbd991f43b2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174772
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdedxv.cxx | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index fd6315976a5e..ef877e45cd70 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -2812,36 +2812,34 @@ void SdrObjEditView::OnEndPasteOrDrop(PasteOrDropInfos*) sal_uInt16 SdrObjEditView::GetSelectionLevel() const { - sal_uInt16 nLevel = 0xFFFF; - if (IsTextEdit()) - { - DBG_ASSERT(mpTextEditOutlinerView != nullptr, - "SdrObjEditView::GetAttributes(): mpTextEditOutlinerView=NULL"); - DBG_ASSERT(mpTextEditOutliner != nullptr, - "SdrObjEditView::GetAttributes(): mpTextEditOutliner=NULL"); - if (mpTextEditOutlinerView) - { - //start and end position - ESelection aSelect = mpTextEditOutlinerView->GetSelection(); - sal_uInt16 nStartPara = ::std::min(aSelect.nStartPara, aSelect.nEndPara); - sal_uInt16 nEndPara = ::std::max(aSelect.nStartPara, aSelect.nEndPara); - //get level from each paragraph - nLevel = 0; - for (sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++) - { - sal_uInt16 nParaDepth - = 1 << static_cast<sal_uInt16>(mpTextEditOutliner->GetDepth(nPara)); - if (!(nLevel & nParaDepth)) - nLevel += nParaDepth; - } - //reduce one level for Outliner Object - //if( nLevel > 0 && GetTextEditObject()->GetObjIdentifier() == OBJ_OUTLINETEXT ) - // nLevel = nLevel >> 1; - //no bullet paragraph selected - if (nLevel == 0) - nLevel = 0xFFFF; - } - } + if (!IsTextEdit()) + return 0xFFFF; + DBG_ASSERT(mpTextEditOutlinerView != nullptr, + "SdrObjEditView::GetAttributes(): mpTextEditOutlinerView=NULL"); + DBG_ASSERT(mpTextEditOutliner != nullptr, + "SdrObjEditView::GetAttributes(): mpTextEditOutliner=NULL"); + if (!mpTextEditOutlinerView) + return 0xFFFF; + //start and end position + ESelection aSelect = mpTextEditOutlinerView->GetSelection(); + sal_uInt16 nStartPara = ::std::min(aSelect.nStartPara, aSelect.nEndPara); + sal_uInt16 nEndPara = ::std::max(aSelect.nStartPara, aSelect.nEndPara); + //get level from each paragraph + sal_uInt16 nLevel = 0; + for (sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++) + { + sal_Int16 nDepth = mpTextEditOutliner->GetDepth(nPara); + assert(nDepth >= 0 && nDepth <= 15); + sal_uInt16 nParaDepth = 1 << static_cast<sal_uInt16>(nDepth); + if (!(nLevel & nParaDepth)) + nLevel += nParaDepth; + } + //reduce one level for Outliner Object + //if( nLevel > 0 && GetTextEditObject()->GetObjIdentifier() == OBJ_OUTLINETEXT ) + // nLevel = nLevel >> 1; + //no bullet paragraph selected + if (nLevel == 0) + nLevel = 0xFFFF; return nLevel; } |