diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index 56cdec6f4f50..d2112117d385 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -789,17 +789,13 @@ bool SdDrawDocument::InsertBookmarkAsPage( if (nInsertPos > 0) { sal_uInt16 nSdPageStart = (nInsertPos - 1) / 2; - sal_uInt16 nSdPageEnd = GetSdPageCount(PageKind::Standard) - nSdPageCount + - nSdPageStart - 1; + sal_uInt16 nSdPageEnd = bReplace + ? nSdPageStart + nReplacedStandardPages - 1 + : GetSdPageCount(PageKind::Standard) - nSdPageCount + nSdPageStart - 1; const bool bRemoveEmptyPresObj = (pBookmarkDoc->GetDocumentType() == DocumentType::Impress) && (GetDocumentType() == DocumentType::Draw); - if( bReplace ) - { - nSdPageEnd = nSdPageStart + nReplacedStandardPages - 1; - } - std::vector::iterator pExchangeIter; if (pExchangeList)