From 083975f9666e3dc6fd665dc0418e6c3130628359 Mon Sep 17 00:00:00 2001 From: Baole Fang Date: Sat, 29 Apr 2023 20:37:03 -0400 Subject: tdf#90507: Prevent changing default style in AutoCorrect Change-Id: I3bc7d99daf49ff32d9d80fcbbb7538cc036bc279 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151213 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- sw/source/core/edit/autofmt.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sw/source') diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index f8bcfebe9875..2c9eb69ac16a 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -1433,7 +1433,6 @@ void SwAutoFormat::BuildText() bBreak = !IsFastFullLine(*m_pCurTextFrame) || IsBlanksInString(*m_pCurTextFrame) || IsSentenceAtEnd(*m_pCurTextFrame); - SetColl( RES_POOLCOLL_TEXT, true ); if( !bBreak ) { SetRedlineText( STR_AUTOFMTREDL_DEL_MORELINES ); @@ -2420,6 +2419,12 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFormatFlags aFlags, break; } + // replace custom styles with text body + if ( IsPoolUserFormat( nPoolId ) && m_aFlags.bChgUserColl ) + { + SetColl( RES_POOLCOLL_TEXT, true ); + } + // check for left margin set by the style if( IsPoolUserFormat( nPoolId ) || RES_POOLCOLL_STANDARD == nPoolId ) -- cgit