tdf#166230 Switch off page number of page breaks

Makes is possible to switch off the page number of page breaks
in paragraph dialog.

Change-Id: Ic185e492080630ffd9906492e0a00e7d8b87d028
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184336
Tested-by: Jenkins
Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
This commit is contained in:
Oliver Specht 2025-04-17 16:46:11 +02:00 committed by Gabor Kelemen
parent 4dcb25e23d
commit 6ea60a38f8

View File

@ -662,6 +662,7 @@ void SfxToSwPageDescAttr( const SwWrtShell& rShell, SfxItemSet& rSet )
SwFormatPageDesc aPgDesc;
bool bChanged = false;
bool bRemoveNumOffset = false;
// Page number
switch (rSet.GetItemState(SID_ATTR_PARA_PAGENUM, false, &pItem))
{
@ -678,6 +679,7 @@ void SfxToSwPageDescAttr( const SwWrtShell& rShell, SfxItemSet& rSet )
}
case SfxItemState::UNKNOWN:
case SfxItemState::DEFAULT:
bRemoveNumOffset = true;
break;
default:
assert(false); // unexpected
@ -705,13 +707,14 @@ void SfxToSwPageDescAttr( const SwWrtShell& rShell, SfxItemSet& rSet )
if(const SwFormatPageDesc* pPageDescItem = aCoreSet.GetItemIfSet( RES_PAGEDESC ) )
{
const SwPageDesc* pPageDesc = pPageDescItem->GetPageDesc();
if (bRemoveNumOffset && pPageDescItem->GetNumOffset())
bChanged = true;
if( pPageDesc )
{
aPgDesc.RegisterToPageDesc( *const_cast<SwPageDesc*>(pPageDesc) );
}
}
}
if(bChanged)
rSet.Put( aPgDesc );
}