diff options
author | Mark Hung <marklh9@gmail.com> | 2020-10-19 00:07:34 +0800 |
---|---|---|
committer | Mark Hung <marklh9@gmail.com> | 2020-10-23 15:36:22 +0200 |
commit | 5b74b3322fd51cf075eb0c218b3adb786a28b4c9 (patch) | |
tree | 360adde43c0211572b46f5e4913fe105a63fc1a7 /editeng/source/editeng/editview.cxx | |
parent | f4c56849b52be5e6daebdffb1f54eccbce277414 (diff) |
tdf#104378: don't reset para attributes while
converting Chinese characters.
In TextConvWrapper::ChangeText_impl, calls to
EditView::RemoveAttribs() reset the paragraph attributes.
That makes SvxLanguageItem of EE_CHAR_LANGUAGE_CJK become
LANGUAGE_DONTKNOW. Hence it always stops converting after the
first success.
This patch overload EditView::RemoveAttribs() so that it is
possible to clear all character attributes of the selction
without touching paragraph attributes.
Before, bRemoveParaAttribs either removes items between
EE_ITEMS_START and EE_CHAR_END, or removes items between
EE_CHAR_START and EE_CHAR_END. The patch add a new enum
class EERemoveParaAttribsMode, with the following values:
1. RemoveAll : correspond to the old bRemoveParaAttribs = true
2. RemoveCharItems: correspond to the old bRemoveParaAttribs = false
3. RemoveNone: new thing for "don't touch para attributes."
Change-Id: I5132e708dea9e2066f13f1b001bd954d7b477f56
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104484
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'editeng/source/editeng/editview.cxx')
-rw-r--r-- | editeng/source/editeng/editview.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index f13a67870902..94012cf70651 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -568,10 +568,15 @@ void EditView::RemoveAttribsKeepLanguages( bool bRemoveParaAttribs ) void EditView::RemoveAttribs( bool bRemoveParaAttribs, sal_uInt16 nWhich ) { + RemoveAttribs(bRemoveParaAttribs ? EERemoveParaAttribsMode::RemoveAll + : EERemoveParaAttribsMode::RemoveCharItems, nWhich); +} +void EditView::RemoveAttribs( EERemoveParaAttribsMode eMode, sal_uInt16 nWhich ) +{ pImpEditView->DrawSelectionXOR(); pImpEditView->pEditEngine->UndoActionStart( EDITUNDO_RESETATTRIBS ); - pImpEditView->pEditEngine->RemoveCharAttribs( pImpEditView->GetEditSelection(), bRemoveParaAttribs, nWhich ); + pImpEditView->pEditEngine->RemoveCharAttribs( pImpEditView->GetEditSelection(), eMode, nWhich ); pImpEditView->pEditEngine->UndoActionEnd(); pImpEditView->pEditEngine->FormatAndUpdate( this ); } |