[Libreoffice-commits] core.git: Branch 'feature/cib_contract57d' - 3 commits - configure.ac cui/source editeng/inc editeng/source include/editeng sw/qa

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Tue Nov 3 14:35:56 UTC 2020


 configure.ac                        |    2 -
 cui/source/dialogs/SpellDialog.cxx  |   37 +++++++++++++++++++-----------------
 editeng/inc/editdoc.hxx             |    3 ++
 editeng/source/editeng/editdoc.cxx  |   12 ++++++++++-
 editeng/source/editeng/editeng.cxx  |    4 +++
 include/editeng/editeng.hxx         |    5 ++++
 sw/qa/extras/uiwriter/uiwriter2.cxx |    4 +--
 7 files changed, 46 insertions(+), 21 deletions(-)

New commits:
commit 1af995b8413f80f03df63068a5682985c2291af0
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Tue Nov 3 15:35:12 2020 +0100
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Tue Nov 3 15:35:12 2020 +0100

    Release 6.3.6.8
    
    Change-Id: Ia98028acc4fb1929910606c567b4b77985f43189

diff --git a/configure.ac b/configure.ac
index 8b9786155e77..d94bd198ac25 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,7 +9,7 @@ dnl in order to create a configure script.
 # several non-alphanumeric characters, those are split off and used only for the
 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
 
-AC_INIT([LibreOffice],[6.3.6.7],[],[],[http://documentfoundation.org/])
+AC_INIT([LibreOffice],[6.3.6.8],[],[],[http://documentfoundation.org/])
 
 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
commit 851c8f56cca10dfd2b936379b67d67ce090f6851
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Tue Nov 3 15:34:31 2020 +0100
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Tue Nov 3 15:34:31 2020 +0100

    Fix uiwriter2 unit test
    
    was obiviously a mismerge
    
    Change-Id: I6fd9810f58588b9f9d984a4ff295caae05968361

diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index e54a2b60307d..b359ef7df607 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -266,9 +266,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRedlineSplitContentNode)
     pWrtShell->ApplyViewOptions(aViewOptions);
 
     // enable redlining
-    dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+    lcl_dispatchCommand(mxComponent, ".uno:TrackChanges", {});
     // hide
-    dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+    lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
 
     SwDocShell* const pDocShell = pTextDoc->GetDocShell();
     SwDoc* const pDoc = pDocShell->GetDoc();
commit dfa6004433884cd0c1f951f4ee0339483e834d24
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Apr 24 16:38:26 2020 +0100
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Tue Nov 3 14:35:42 2020 +0100

    Resolves: tdf#132288 don't merge adjacent properties for spell checking
    
    spell checking relies on each attribute chunk being unmerged with identical
    adjacent chunks
    
    squash includes...
    
    nStartPosition and nEndPosition are always the same
    
    and
    
    tdf#132288 preservation of footnote depends on reverse iteration
    
    like TextCharAttribList::FindAttrib does which spell checking
    used before
    
    commit 243b5b392906042ab03800e0b5765e6f3513372c
    Author: Caolán McNamara <caolanm at redhat.com>
    Date:   Fri Jun 14 21:56:44 2019 +0100
    
        weld SpellDialog
    
    converted to use an EditEngine instead of a TextEngine in order to
    be able to host it in a native widget
    
    Change-Id: Ia835fa054cad0dee4304f16724b9eb0c29b46102
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92772
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit 994526fadb3faeb57c47cf1060a2ad7d53bd4f94)

diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 128ee804fe97..7366c15d62fc 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -1142,6 +1142,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()
@@ -1150,13 +1152,14 @@ SentenceEditWindow_Impl::~SentenceEditWindow_Impl()
 
 namespace
 {
-    const EECharAttrib* FindCharAttrib(int nStartPosition, int nEndPosition, sal_uInt16 nWhich, std::vector<EECharAttrib>& rAttribList)
+    const EECharAttrib* FindCharAttrib(int nPosition, sal_uInt16 nWhich, std::vector<EECharAttrib>& rAttribList)
     {
-        for (const auto& rTextAtr : rAttribList)
+        for (auto it = rAttribList.rbegin(); it != rAttribList.rend(); ++it)
         {
+            const auto& rTextAtr = *it;
             if (rTextAtr.pAttr->Which() != nWhich)
                 continue;
-            if (rTextAtr.nStart <= nStartPosition && rTextAtr.nEnd >= nEndPosition)
+            if (rTextAtr.nStart <= nPosition && rTextAtr.nEnd >= nPosition)
             {
                 return &rTextAtr;
             }
@@ -1272,8 +1275,8 @@ bool SentenceEditWindow_Impl::KeyInput(const KeyEvent& rKeyEvt)
         m_xEditEngine->GetCharAttribs(0, aAttribList);
 
         auto nCursor = aCurrentSelection.nStartPos;
-        const EECharAttrib* pBackAttr = FindCharAttrib(nCursor, nCursor, EE_CHAR_BKGCOLOR, aAttribList);
-        const EECharAttrib* pErrorAttr = FindCharAttrib(nCursor, nCursor, EE_CHAR_GRABBAG, aAttribList);
+        const EECharAttrib* pBackAttr = FindCharAttrib(nCursor, EE_CHAR_BKGCOLOR, aAttribList);
+        const EECharAttrib* pErrorAttr = FindCharAttrib(nCursor, EE_CHAR_GRABBAG, aAttribList);
         const EECharAttrib* pBackAttrLeft = nullptr;
         const EECharAttrib* pErrorAttrLeft = nullptr;
 
@@ -1299,8 +1302,8 @@ bool SentenceEditWindow_Impl::KeyInput(const KeyEvent& rKeyEvt)
                 while (nCursor < aCurrentSelection.nEndPos)
                 {
                     ++nCursor;
-                    const EECharAttrib* pIntBackAttr = FindCharAttrib(nCursor, nCursor, EE_CHAR_BKGCOLOR, aAttribList);
-                    const EECharAttrib* pIntErrorAttr = FindCharAttrib(nCursor, nCursor, EE_CHAR_GRABBAG, aAttribList);
+                    const EECharAttrib* pIntBackAttr = FindCharAttrib(nCursor, EE_CHAR_BKGCOLOR, aAttribList);
+                    const EECharAttrib* pIntErrorAttr = FindCharAttrib(nCursor, EE_CHAR_GRABBAG, aAttribList);
                     //if any attr has been found then BRACE
                     if (pIntBackAttr || pIntErrorAttr)
                         nSelectionType = BRACE;
@@ -1342,8 +1345,8 @@ bool SentenceEditWindow_Impl::KeyInput(const KeyEvent& rKeyEvt)
             if (nCursor)
             {
                 --nCursor;
-                pBackAttrLeft = FindCharAttrib(nCursor, nCursor, EE_CHAR_BKGCOLOR, aAttribList);
-                pErrorAttrLeft = FindCharAttrib(nCursor, nCursor, EE_CHAR_GRABBAG, aAttribList);
+                pBackAttrLeft = FindCharAttrib(nCursor, EE_CHAR_BKGCOLOR, aAttribList);
+                pErrorAttrLeft = FindCharAttrib(nCursor, EE_CHAR_GRABBAG, aAttribList);
                 bHasFieldLeft = pBackAttrLeft !=nullptr;
                 bHasErrorLeft = pErrorAttrLeft != nullptr;
                 ++nCursor;
@@ -1492,8 +1495,8 @@ bool SentenceEditWindow_Impl::KeyInput(const KeyEvent& rKeyEvt)
         //start position
         if (!IsUndoEditMode() && bIsErrorActive)
         {
-            const EECharAttrib* pFontColor = FindCharAttrib(nCursor, nCursor, EE_CHAR_COLOR, aAttribList);
-            const EECharAttrib* pErrorAttrib = FindCharAttrib(m_nErrorStart, m_nErrorStart, EE_CHAR_GRABBAG, aAttribList);
+            const EECharAttrib* pFontColor = FindCharAttrib(nCursor, EE_CHAR_COLOR, aAttribList);
+            const EECharAttrib* pErrorAttrib = FindCharAttrib(m_nErrorStart, EE_CHAR_GRABBAG, aAttribList);
             if (pFontColor && pErrorAttrib)
             {
                 m_nErrorStart = pFontColor->nStart;
@@ -1704,7 +1707,7 @@ int SentenceEditWindow_Impl::ChangeMarkedWord(const OUString& rNewWord, Language
     auto nDiffLen = rNewWord.getLength() - m_nErrorEnd + m_nErrorStart;
     //Remove spell error attribute
     m_xEditEngine->UndoActionStart(SPELLUNDO_MOVE_ERROREND);
-    const EECharAttrib* pErrorAttrib = FindCharAttrib(m_nErrorStart, m_nErrorStart, EE_CHAR_GRABBAG, aAttribList);
+    const EECharAttrib* pErrorAttrib = FindCharAttrib(m_nErrorStart, EE_CHAR_GRABBAG, aAttribList);
     DBG_ASSERT(pErrorAttrib, "no error attribute found");
     bool bSpellErrorDescription = false;
     SpellErrorDescription aSpellErrorDescription;
@@ -1715,7 +1718,7 @@ int SentenceEditWindow_Impl::ChangeMarkedWord(const OUString& rNewWord, Language
         bSpellErrorDescription = true;
     }
 
-    const EECharAttrib* pBackAttrib = FindCharAttrib(m_nErrorStart, m_nErrorStart, EE_CHAR_BKGCOLOR, aAttribList);
+    const EECharAttrib* pBackAttrib = FindCharAttrib(m_nErrorStart, EE_CHAR_BKGCOLOR, aAttribList);
 
     ESelection aSel(0, m_nErrorStart, 0, m_nErrorEnd);
     m_xEditEngine->QuickInsertText(rNewWord, aSel);
@@ -1730,7 +1733,7 @@ int SentenceEditWindow_Impl::ChangeMarkedWord(const OUString& rNewWord, Language
         //attributes following an error at the start of the text are not moved but expanded from the
         //text engine - this is done to keep full-paragraph-attributes
         //in the current case that handling is not desired
-        const EECharAttrib* pLangAttrib = FindCharAttrib(m_nErrorEnd, m_nErrorEnd, EE_CHAR_LANGUAGE, aAttribList);
+        const EECharAttrib* pLangAttrib = FindCharAttrib(m_nErrorEnd, EE_CHAR_LANGUAGE, aAttribList);
 
         if (pLangAttrib && !pLangAttrib->nStart && pLangAttrib->nEnd == nTextLen)
         {
@@ -1785,7 +1788,7 @@ bool SentenceEditWindow_Impl::GetErrorDescription(SpellErrorDescription& rSpellE
     std::vector<EECharAttrib> aAttribList;
     m_xEditEngine->GetCharAttribs(0, aAttribList);
 
-    if (const EECharAttrib* pEECharAttrib = FindCharAttrib(nPosition, nPosition, EE_CHAR_GRABBAG, aAttribList))
+    if (const EECharAttrib* pEECharAttrib = FindCharAttrib(nPosition, EE_CHAR_GRABBAG, aAttribList))
     {
         ExtractErrorDescription(*pEECharAttrib, rSpellErrorDescription);
         return true;
@@ -1904,7 +1907,7 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions() const
         const EECharAttrib* pError = nullptr;
         while (nCursor < nTextLen)
         {
-            const EECharAttrib* pLang = FindCharAttrib(nCursor, nCursor, EE_CHAR_LANGUAGE, aAttribList);
+            const EECharAttrib* pLang = FindCharAttrib(nCursor, EE_CHAR_LANGUAGE, aAttribList);
             if(pLang && pLang != pLastLang)
             {
                 eLang = static_cast<const SvxLanguageItem*>(pLang->pAttr)->GetLanguage();
@@ -1912,7 +1915,7 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions() const
                 lcl_InsertBreakPosition_Impl(aBreakPositions, pLang->nEnd, eLang);
                 pLastLang = pLang;
             }
-            pError = FindCharAttrib(nCursor, nCursor, EE_CHAR_GRABBAG, aAttribList);
+            pError = FindCharAttrib(nCursor, EE_CHAR_GRABBAG, aAttribList);
             if (pError && pLastError != pError)
             {
                 lcl_InsertBreakPosition_Impl(aBreakPositions, pError->nStart, eLang);
diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx
index 089addc59c07..258fa945912c 100644
--- a/editeng/inc/editdoc.hxx
+++ b/editeng/inc/editdoc.hxx
@@ -747,6 +747,7 @@ private:
 
     bool            bOwnerOfPool:1;
     bool            bModified:1;
+    bool            bDisableAttributeExpanding:1;
 
 private:
     void            ImplDestroyContents();
@@ -761,6 +762,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 73a356054741..aacc0b2c7b6b 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1906,7 +1906,8 @@ EditDoc::EditDoc( SfxItemPool* pPool ) :
     bIsTopToBottomVert(false),
     bIsFixedCellHeight(false),
     bOwnerOfPool(pPool == nullptr),
-    bModified(false)
+    bModified(false),
+    bDisableAttributeExpanding(false)
 {
     // Don't create an empty node, Clear() will be called in EditEngine-CTOR
 };
@@ -2354,6 +2355,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 458f71b34d3f..f46106a5773c 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2802,6 +2802,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 f585ce8b5796..7d4129c0ad0b 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -618,6 +618,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