[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - sw/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 17 11:37:39 UTC 2021


 sw/source/core/doc/extinput.cxx |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

New commits:
commit d8dbd123bfa7f39489ceb15ac83142635531fd43
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Sep 16 16:53:40 2021 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Fri Sep 17 13:37:04 2021 +0200

    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 at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx
index 4795862e9e1a..9f60ec1fabcf 100644
--- a/sw/source/core/doc/extinput.cxx
+++ b/sw/source/core/doc/extinput.cxx
@@ -102,18 +102,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( bInsText )
                 {
                     pDoc->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 );


More information about the Libreoffice-commits mailing list