sw/source/core/doc/docredln.cxx   |    4 +-
 sw/source/uibase/uno/unotxdoc.cxx |   69 ++++++++++++++++++++++----------------
 2 files changed, 44 insertions(+), 29 deletions(-)

New commits:
commit cbff1b6f6d71ab721eb8dff1638cb441ac367959
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Thu Nov 8 11:02:26 2018 -0500
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Tue Sep 3 13:36:19 2019 +0200

    LOK: don't emit redline comments
    
    Change tracking can be quite numerous. Showing the
    markers (and their comments" as comment-boxes is
    sensible where there is limited change in a doc.
    
    However with extensively modified doc, this becomes
    overwhelming both in terms of browser load and
    editing performance. As such, we disable them
    as they don't add much value. The user can still
    access them from the Track Changes > Manage menu.
    
    Use a rather nasty env. var hack to propagate this
    setting from WSD for now.
    
    Change-Id: I3f964816b4a10f565012b273added8a8413cd309
    Signed-off-by: Michael Meeks <michael.me...@collabora.com>
    (cherry picked from commit c99e885565f9d741a659e7e18c22d092ed90b9de)
    Reviewed-on: https://gerrit.libreoffice.org/78431
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    Tested-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index a323b595f0fc..5656f35fb3d1 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -360,7 +360,9 @@ void lcl_LOKInvalidateStartEndFrames(SwShellCursor& rCursor)
 /// Emits LOK notification about one addition / removal of a redline item.
 void SwRedlineTable::LOKRedlineNotification(RedlineNotification nType, 
SwRangeRedline* pRedline)
 {
-    if (!comphelper::LibreOfficeKit::isActive())
+    // Disable since usability is very low beyond some small number of changes.
+    static bool bDisableRedlineComments = getenv("DISABLE_REDLINE") != nullptr;
+    if (!comphelper::LibreOfficeKit::isActive() || bDisableRedlineComments)
         return;
 
     boost::property_tree::ptree aRedline;
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index d4f98f8f44ec..2c3366d575fc 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3280,40 +3280,53 @@ Pointer SwXTextDocument::getPointer()
 
 OUString SwXTextDocument::getTrackedChanges()
 {
-    const SwRedlineTable& rRedlineTable = 
pDocShell->GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
     boost::property_tree::ptree aTrackedChanges;
-    for (SwRedlineTable::size_type i = 0; i < rRedlineTable.size(); ++i)
-    {
-        boost::property_tree::ptree aTrackedChange;
-        aTrackedChange.put("index", rRedlineTable[i]->GetId());
-        aTrackedChange.put("author", 
rRedlineTable[i]->GetAuthorString(1).toUtf8().getStr());
-        aTrackedChange.put("type", 
nsRedlineType_t::SwRedlineTypeToOUString(rRedlineTable[i]->GetRedlineData().GetType()).toUtf8().getStr());
-        aTrackedChange.put("comment", 
rRedlineTable[i]->GetRedlineData().GetComment().toUtf8().getStr());
-        aTrackedChange.put("description", 
rRedlineTable[i]->GetDescr().toUtf8().getStr());
-        OUString sDateTime = 
utl::toISO8601(rRedlineTable[i]->GetRedlineData().GetTimeStamp().GetUNODateTime());
-        aTrackedChange.put("dateTime", sDateTime.toUtf8().getStr());
-
-        SwContentNode* pContentNd = rRedlineTable[i]->GetContentNode();
-        SwView* pView = dynamic_cast<SwView*>(SfxViewShell::Current());
-        if (pView && pContentNd)
+
+    // Disable since usability is very low beyond some small number of changes.
+    static bool bDisableRedlineComments = getenv("DISABLE_REDLINE") != nullptr;
+    if (!bDisableRedlineComments)
+    {
+        const SwRedlineTable& rRedlineTable
+            = 
pDocShell->GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
+        for (SwRedlineTable::size_type i = 0; i < rRedlineTable.size(); ++i)
         {
-            SwShellCursor aCursor(pView->GetWrtShell(), 
*(rRedlineTable[i]->Start()));
-            aCursor.SetMark();
-            aCursor.GetMark()->nNode = *pContentNd;
-            aCursor.GetMark()->nContent.Assign(pContentNd, 
rRedlineTable[i]->End()->nContent.GetIndex());
+            boost::property_tree::ptree aTrackedChange;
+            aTrackedChange.put("index", rRedlineTable[i]->GetId());
+            aTrackedChange.put("author", 
rRedlineTable[i]->GetAuthorString(1).toUtf8().getStr());
+            aTrackedChange.put("type", 
nsRedlineType_t::SwRedlineTypeToOUString(
+                                           
rRedlineTable[i]->GetRedlineData().GetType())
+                                           .toUtf8()
+                                           .getStr());
+            aTrackedChange.put("comment",
+                               
rRedlineTable[i]->GetRedlineData().GetComment().toUtf8().getStr());
+            aTrackedChange.put("description", 
rRedlineTable[i]->GetDescr().toUtf8().getStr());
+            OUString sDateTime = utl::toISO8601(
+                
rRedlineTable[i]->GetRedlineData().GetTimeStamp().GetUNODateTime());
+            aTrackedChange.put("dateTime", sDateTime.toUtf8().getStr());
+
+            SwContentNode* pContentNd = rRedlineTable[i]->GetContentNode();
+            SwView* pView = dynamic_cast<SwView*>(SfxViewShell::Current());
+            if (pView && pContentNd)
+            {
+                SwShellCursor aCursor(pView->GetWrtShell(), 
*(rRedlineTable[i]->Start()));
+                aCursor.SetMark();
+                aCursor.GetMark()->nNode = *pContentNd;
+                aCursor.GetMark()->nContent.Assign(pContentNd,
+                                                   
rRedlineTable[i]->End()->nContent.GetIndex());
 
-            aCursor.FillRects();
+                aCursor.FillRects();
 
-            SwRects* pRects(&aCursor);
-            std::vector<OString> aRects;
-            for(SwRect& rNextRect : *pRects)
-                aRects.push_back(rNextRect.SVRect().toString());
+                SwRects* pRects(&aCursor);
+                std::vector<OString> aRects;
+                for (SwRect& rNextRect : *pRects)
+                    aRects.push_back(rNextRect.SVRect().toString());
 
-            const OString sRects = comphelper::string::join("; ", aRects);
-            aTrackedChange.put("textRange", sRects.getStr());
-        }
+                const OString sRects = comphelper::string::join("; ", aRects);
+                aTrackedChange.put("textRange", sRects.getStr());
+            }
 
-        aTrackedChanges.push_back(std::make_pair("", aTrackedChange));
+            aTrackedChanges.push_back(std::make_pair("", aTrackedChange));
+        }
     }
 
     boost::property_tree::ptree aTree;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to