[Libreoffice-commits] core.git: cui/source editeng/inc editeng/source include/editeng

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Apr 24 19:04:32 UTC 2020


 cui/source/dialogs/SpellDialog.cxx |    2 ++
 editeng/inc/editdoc.hxx            |    3 +++
 editeng/source/editeng/editdoc.cxx |   12 +++++++++++-
 editeng/source/editeng/editeng.cxx |    4 ++++
 include/editeng/editeng.hxx        |    5 +++++
 5 files changed, 25 insertions(+), 1 deletion(-)

New commits:
commit 9e8bb8fa8a77665552db9c01cac1034d5040da7b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Apr 24 16:38:26 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Apr 24 21:03:57 2020 +0200

    Resolves: tdf#132288 don't merge adjacent properties for spell checking
    
    spell checking relies on each attribute chunk being unmerged with identical
    adjacent chunks
    
    Change-Id: Ia835fa054cad0dee4304f16724b9eb0c29b46102
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92866
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 388856498f5d..e2e4e6bb735f 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -1112,6 +1112,8 @@ void SentenceEditWindow_Impl::SetDrawingArea(weld::DrawingArea* pDrawingArea)
                pDrawingArea->get_text_height() * 6);
     pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
     WeldEditView::SetDrawingArea(pDrawingArea);
+    // tdf#132288 don't merge equal adjacent attributes
+    m_xEditEngine->DisableAttributeExpanding();
 }
 
 SentenceEditWindow_Impl::~SentenceEditWindow_Impl()
diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx
index 454f764bbb48..2a5fc1e3f8de 100644
--- a/editeng/inc/editdoc.hxx
+++ b/editeng/inc/editdoc.hxx
@@ -731,6 +731,7 @@ private:
 
     bool            bOwnerOfPool:1;
     bool            bModified:1;
+    bool            bDisableAttributeExpanding:1;
 
 private:
     void            ImplDestroyContents();
@@ -745,6 +746,8 @@ public:
     bool            IsModified() const      { return bModified; }
     void            SetModified( bool b );
 
+    void            DisableAttributeExpanding() { bDisableAttributeExpanding = true; }
+
     void            SetModifyHdl( const Link<LinkParamNone*,void>& rLink ) { aModifyHdl = rLink; }
 
     void            CreateDefFont( bool bUseStyles );
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index ebc55808da25..fbcb4c51ed41 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1908,7 +1908,8 @@ EditDoc::EditDoc( SfxItemPool* pPool ) :
     mnRotation(TextRotation::NONE),
     bIsFixedCellHeight(false),
     bOwnerOfPool(pPool == nullptr),
-    bModified(false)
+    bModified(false),
+    bDisableAttributeExpanding(false)
 {
     // Don't create an empty node, Clear() will be called in EditEngine-CTOR
 };
@@ -2369,6 +2370,15 @@ void EditDoc::InsertAttribInSelection( ContentNode* pNode, sal_Int32 nStart, sal
 
     RemoveAttribs( pNode, nStart, nEnd, pStartingAttrib, pEndingAttrib, rPoolItem.Which() );
 
+    // tdf#132288  By default inserting an attribute beside another that is of
+    // the same type expands the original instead of inserting another. But the
+    // spell check dialog doesn't want that behaviour
+    if (bDisableAttributeExpanding)
+    {
+        pStartingAttrib = nullptr;
+        pEndingAttrib = nullptr;
+    }
+
     if ( pStartingAttrib && pEndingAttrib &&
          ( *(pStartingAttrib->GetItem()) == rPoolItem ) &&
          ( *(pEndingAttrib->GetItem()) == rPoolItem ) )
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 1b76d967b3ba..73d85a07b7ce 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2814,6 +2814,10 @@ bool EditEngine::IsPageOverflow() {
     return pImpEditEngine->IsPageOverflow();
 }
 
+void EditEngine::DisableAttributeExpanding() {
+    pImpEditEngine->GetEditDoc().DisableAttributeExpanding();
+}
+
 EFieldInfo::EFieldInfo()
 {
 }
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index 20c15e6539e1..d8e780e736e8 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -623,6 +623,11 @@ public:
     sal_Int32 GetOverflowingLineNum() const;
     void ClearOverflowingParaNum();
     bool IsPageOverflow();
+
+    // tdf#132288  By default inserting an attribute beside another that is of
+    // the same type expands the original instead of inserting another. But the
+    // spell check dialog doesn't want that behaviour
+    void DisableAttributeExpanding();
 };
 
 #endif // INCLUDED_EDITENG_EDITENG_HXX


More information about the Libreoffice-commits mailing list