summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-09-16 16:53:40 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2021-10-06 11:10:26 +0200
commit8ede76d9accc8e3b1ea2c8e332cbb373a1b4d9cf (patch)
tree2ab35edfb70a96a081c558a27510820fddfcbde0 /sw/source
parent7df324b4561a6551812bdfa5b72ba1c937148c41 (diff)
lok: IME: directly copy formatting for inserted text
This is a fix for online where after: lok: IME: preserve formatting when inserting at the end of paragraph https://cgit.freedesktop.org/libreoffice/core/commit/?h=distro/collabora/cp-6.4&id=bf96d1f23e5c12f9263643dfdab94fd1361bb098 text formatting is lost. Change-Id: I3d316f8f4c4d750eac7900228f9f2d99f70d99bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122199 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122478 Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123101 Tested-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/doc/extinput.cxx11
1 files changed, 5 insertions, 6 deletions
diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx
index 5790126b1810..09f4dba1e016 100644
--- a/sw/source/core/doc/extinput.cxx
+++ b/sw/source/core/doc/extinput.cxx
@@ -104,18 +104,17 @@ SwExtTextInput::~SwExtTextInput()
{
// we need to keep correct formatting
// ie. when we erase first, then we will lost information about format
- // so:
- // 0. initial status: xxxx | OLD
- // 1. insert new content using Doc interface at the end so we will use the same formatting
- // status: xxxx | OLD | NEW
- // 2. erase old content which is placed at "start" position and before recently inserted text
- // status: xxxx | NEW
sal_Int32 nLenghtOfOldString = nEndCnt - nSttCnt;
if( m_bInsText )
{
rDoc.getIDocumentContentOperations().InsertString( *this, sText );
+
+ // Copy formatting to the inserted string
+ SfxItemSet aSet(pTNd->GetDoc().GetAttrPool(), aCharFormatSetRange);
+ pTNd->GetParaAttr( aSet, nSttCnt + nLenghtOfOldString, nEndCnt + nLenghtOfOldString );
+ pTNd->SetAttr( aSet, nSttCnt, nEndCnt );
}
pTNd->EraseText( rIdx, nLenghtOfOldString );