include/vcl/pdfextoutdevdata.hxx | 9 ++------- sw/source/core/text/EnhancedPDFExportHelper.cxx | 3 +-- vcl/source/gdi/pdfextoutdevdata.cxx | 19 +++++++++---------- 3 files changed, 12 insertions(+), 19 deletions(-)
New commits: commit 1ea27b7e35faf6619112bf3f1d69e4ec41c0bf23 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Mon Oct 2 20:42:41 2023 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Oct 4 11:43:40 2023 +0200 vcl: remove defensive programming from SetCurrentStructureElement() Change-Id: I47b0f29a564cdbdd1a55fe4a332fa9efd63af557 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157505 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx index 631ba74eadfa..199f30a00c59 100644 --- a/include/vcl/pdfextoutdevdata.hxx +++ b/include/vcl/pdfextoutdevdata.hxx @@ -405,14 +405,9 @@ public: </p> @param nElement - the id of the new current structure element - - @returns - True if the current structure element could be set successfully - False if the current structure element could not be changed - (e.g. if the passed element id is invalid) + the id of the new current structure element, which must be valid */ - bool SetCurrentStructureElement( sal_Int32 nElement ); + void SetCurrentStructureElement( sal_Int32 nElement ); /** get the current structure element id @returns diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 9ebc233dc687..b71b699b8e36 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -478,8 +478,7 @@ void SwTaggedPDFHelper::CheckRestoreTag() const { if ( m_nRestoreCurrentTag != -1 ) { - const bool bSuccess = mpPDFExtOutDevData->SetCurrentStructureElement( m_nRestoreCurrentTag ); - OSL_ENSURE( bSuccess, "Failed to restore reopened tag" ); + mpPDFExtOutDevData->SetCurrentStructureElement( m_nRestoreCurrentTag ); #if OSL_DEBUG_LEVEL > 1 aStructStack.pop_back(); diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index 7719d6bb97d1..1eac67561084 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -851,25 +851,24 @@ sal_Int32 PDFExtOutDevData::WrapBeginStructureElement( void PDFExtOutDevData::EndStructureElement() { + assert(mpGlobalSyncData->mCurrentStructElement != 0); // underflow? mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::EndStructureElement ); mpGlobalSyncData->mCurrentStructElement = mpGlobalSyncData->mStructParents[ mpGlobalSyncData->mCurrentStructElement ]; } -bool PDFExtOutDevData::SetCurrentStructureElement( sal_Int32 nStructId ) + +void PDFExtOutDevData::SetCurrentStructureElement(sal_Int32 const nStructId) { - bool bSuccess = false; - if( o3tl::make_unsigned(nStructId) < mpGlobalSyncData->mStructParents.size() ) - { - mpGlobalSyncData->mCurrentStructElement = nStructId; - mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::SetCurrentStructureElement ); - mpPageSyncData->mParaInts.push_back( nStructId ); - bSuccess = true; - } - return bSuccess; + assert(o3tl::make_unsigned(nStructId) < mpGlobalSyncData->mStructParents.size()); + mpGlobalSyncData->mCurrentStructElement = nStructId; + mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::SetCurrentStructureElement ); + mpPageSyncData->mParaInts.push_back( nStructId ); } + sal_Int32 PDFExtOutDevData::GetCurrentStructureElement() const { return mpGlobalSyncData->mCurrentStructElement; } + void PDFExtOutDevData::SetStructureAttribute( PDFWriter::StructAttribute eAttr, PDFWriter::StructAttributeValue eVal ) { mpPageSyncData->PushAction( mrOutDev, PDFExtOutDevDataSync::SetStructureAttribute );