[Libreoffice-commits] core.git: sw/source

Jan Holesovsky (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 25 10:03:23 UTC 2020


 sw/source/core/doc/docredln.cxx |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 56e7c74b2994ead8b1f376b65549ad8a623018cd
Author:     Jan Holesovsky <kendy at collabora.com>
AuthorDate: Tue Nov 24 15:34:55 2020 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Wed Nov 25 11:02:35 2020 +0100

    lok: Don't even iterate through the redlines when they are disabled.
    
    It is not necessary, when we are not issuing any output anyway.
    
    Change-Id: Id952549befb1bef04a2dd9237d286922939eaae2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106509
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    (cherry picked from commit 8f44a939ad09d0365607ae8960e2abfe77e3fe72)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106517
    Tested-by: Jenkins
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index ab57f1bb6b50..8a0f8d4b3597 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -341,14 +341,22 @@ void lcl_LOKInvalidateStartEndFrames(SwShellCursor& rCursor)
                             FRM_CNTNT, &rCursor.GetEndPos());
 }
 
+bool lcl_LOKRedlineNotificationEnabled()
+{
+    static bool bDisableRedlineComments = getenv("DISABLE_REDLINE") != nullptr;
+    if (comphelper::LibreOfficeKit::isActive() && !bDisableRedlineComments)
+        return true;
+
+    return false;
+}
+
 } // anonymous namespace
 
 /// Emits LOK notification about one addition / removal of a redline item.
 void SwRedlineTable::LOKRedlineNotification(RedlineNotification nType, SwRangeRedline* pRedline)
 {
     // Disable since usability is very low beyond some small number of changes.
-    static bool bDisableRedlineComments = getenv("DISABLE_REDLINE") != nullptr;
-    if (!comphelper::LibreOfficeKit::isActive() || bDisableRedlineComments)
+    if (!lcl_LOKRedlineNotificationEnabled())
         return;
 
     boost::property_tree::ptree aRedline;
@@ -1044,7 +1052,7 @@ SwRangeRedline::~SwRangeRedline()
 
 void MaybeNotifyRedlineModification(SwRangeRedline& rRedline, SwDoc& rDoc)
 {
-    if (!comphelper::LibreOfficeKit::isActive())
+    if (!lcl_LOKRedlineNotificationEnabled())
         return;
 
     const SwRedlineTable& rRedTable = rDoc.getIDocumentRedlineAccess().GetRedlineTable();
@@ -1060,7 +1068,7 @@ void MaybeNotifyRedlineModification(SwRangeRedline& rRedline, SwDoc& rDoc)
 
 void SwRangeRedline::MaybeNotifyRedlinePositionModification(tools::Long nTop)
 {
-    if (!comphelper::LibreOfficeKit::isActive())
+    if (!lcl_LOKRedlineNotificationEnabled())
         return;
 
     if(!m_oLOKLastNodeTop || *m_oLOKLastNodeTop != nTop)


More information about the Libreoffice-commits mailing list