[Libreoffice-commits] core.git: Branch 'private/mst/sw_redlinehide_4b' - 4 commits - sw/qa sw/source sw/uiconfig sw/UIConfig_swriter.mk

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Dec 18 15:16:03 UTC 2018


Rebased ref, commits from common ancestor:
commit 086539add06c6ee29a53f63705a0f2382d4878ef
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Dec 17 22:37:32 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Dec 18 16:13:32 2018 +0100

    Revert "HACK: ODF import: always hide redlines"
    
    This reverts commit da23ebcb675ce57d84bb02a3db04751b8988afa9.

diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 60c8445d59b0..138dc19981c8 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -856,11 +856,7 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
     if( !(IsOrganizerMode() || IsBlockMode() || m_bInsertMode ||
           m_aOption.IsFormatsOnly() ||
             // sw_redlinehide: disable layout cache for now
-#if 0
           !*o3tl::doAccess<bool>(xInfoSet->getPropertyValue(sShowChanges))))
-#else
-          true))
-#endif
     {
         try
         {
@@ -893,10 +889,8 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
     // restore redline mode from import info property set
     RedlineFlags nRedlineFlags = RedlineFlags::ShowInsert;
     aAny = xInfoSet->getPropertyValue( sShowChanges );
-#if 0
     if ( *o3tl::doAccess<bool>(aAny) )
         nRedlineFlags |= RedlineFlags::ShowDelete;
-#endif
     aAny = xInfoSet->getPropertyValue( sRecordChanges );
     if ( *o3tl::doAccess<bool>(aAny) || (aKey.getLength() > 0) )
         nRedlineFlags |= RedlineFlags::On;
commit 050fbb57be9f7d503267cad58315a7bc19b5de7a
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Nov 30 18:00:19 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Dec 18 16:13:32 2018 +0100

    HACK: ODF import: always hide redlines
    
    Change-Id: I275c6738943ee0d74ccacea69af1c1f4c9ede1df

diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 138dc19981c8..60c8445d59b0 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -856,7 +856,11 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
     if( !(IsOrganizerMode() || IsBlockMode() || m_bInsertMode ||
           m_aOption.IsFormatsOnly() ||
             // sw_redlinehide: disable layout cache for now
+#if 0
           !*o3tl::doAccess<bool>(xInfoSet->getPropertyValue(sShowChanges))))
+#else
+          true))
+#endif
     {
         try
         {
@@ -889,8 +893,10 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, con
     // restore redline mode from import info property set
     RedlineFlags nRedlineFlags = RedlineFlags::ShowInsert;
     aAny = xInfoSet->getPropertyValue( sShowChanges );
+#if 0
     if ( *o3tl::doAccess<bool>(aAny) )
         nRedlineFlags |= RedlineFlags::ShowDelete;
+#endif
     aAny = xInfoSet->getPropertyValue( sRecordChanges );
     if ( *o3tl::doAccess<bool>(aAny) || (aKey.getLength() > 0) )
         nRedlineFlags |= RedlineFlags::On;
commit 273c901842386d3a26b4a215020a0da300725055
Author:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
AuthorDate: Tue Dec 18 00:36:24 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Dec 18 16:13:31 2018 +0100

    sw_redlinehide: fix tdf#113479 by removing nag dialog
    
    No need to suggest showing redlines beyond 250 changes anymore.
    
    Change-Id: Ia219a4eb3af64079979538b8ab4aaf2a94ec19c8

diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index 37dffed460ed..bba8c908e805 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -198,7 +198,6 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
 	sw/uiconfig/swriter/ui/queryredlinedialog \
 	sw/uiconfig/swriter/ui/queryrotateintostandarddialog \
 	sw/uiconfig/swriter/ui/querysavelabeldialog \
-	sw/uiconfig/swriter/ui/queryshowchangesdialog \
 	sw/uiconfig/swriter/ui/mailmerge \
 	sw/uiconfig/swriter/ui/managechangessidebar \
 	sw/uiconfig/swriter/ui/mmaddressblockpage \
diff --git a/sw/qa/unit/data/sw-dialogs-test.txt b/sw/qa/unit/data/sw-dialogs-test.txt
index 931a40c09c28..54fa2761b575 100644
--- a/sw/qa/unit/data/sw-dialogs-test.txt
+++ b/sw/qa/unit/data/sw-dialogs-test.txt
@@ -163,7 +163,6 @@ modules/swriter/ui/querycontinueenddialog.ui
 modules/swriter/ui/querydefaultcompatdialog.ui
 modules/swriter/ui/queryrotateintostandarddialog.ui
 modules/swriter/ui/querysavelabeldialog.ui
-modules/swriter/ui/queryshowchangesdialog.ui
 modules/swriter/ui/renameautotextdialog.ui
 modules/swriter/ui/renameentrydialog.ui
 modules/swriter/ui/renameobjectdialog.ui
diff --git a/sw/qa/unit/data/sw-dialogs-test_2.txt b/sw/qa/unit/data/sw-dialogs-test_2.txt
index 797c410136dd..a36bbdca3dae 100644
--- a/sw/qa/unit/data/sw-dialogs-test_2.txt
+++ b/sw/qa/unit/data/sw-dialogs-test_2.txt
@@ -32,7 +32,6 @@ modules/swriter/ui/querycontinueenddialog.ui
 modules/swriter/ui/querydefaultcompatdialog.ui
 modules/swriter/ui/queryrotateintostandarddialog.ui
 modules/swriter/ui/querysavelabeldialog.ui
-modules/swriter/ui/queryshowchangesdialog.ui
 modules/swriter/ui/renameautotextdialog.ui
 modules/swriter/ui/renameentrydialog.ui
 modules/swriter/ui/renameobjectdialog.ui
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 377d776a7db2..f0fa451eb7ab 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -800,7 +800,6 @@ DocumentRedlineManager::DocumentRedlineManager(SwDoc& i_rSwdoc)
     , mpRedlineTable(new SwRedlineTable)
     , mpExtraRedlineTable(new SwExtraRedlineTable)
     , mbIsRedlineMove(false)
-    , mbReadlineChecked(false)
     , mnAutoFormatRedlnCommentNo(0)
 {
 }
@@ -2981,27 +2980,6 @@ void DocumentRedlineManager::SetAutoFormatRedlineComment( const OUString* pText,
     mnAutoFormatRedlnCommentNo = nSeqNo;
 }
 
-#define MAX_REDLINE_COUNT   250
-
-void DocumentRedlineManager::checkRedlining(RedlineFlags& _rReadlineMode)
-{
-    const SwRedlineTable& rRedlineTable = GetRedlineTable();
-    SwEditShell* pEditShell = m_rDoc.GetEditShell();
-    vcl::Window* pParent = pEditShell ? pEditShell->GetWin() : nullptr;
-    if ( pParent && !mbReadlineChecked && rRedlineTable.size() > MAX_REDLINE_COUNT
-        && ((_rReadlineMode & RedlineFlags::ShowDelete) != RedlineFlags::ShowDelete) )
-    {
-        std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pParent->GetFrameWeld(), "modules/swriter/ui/queryshowchangesdialog.ui"));
-        std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("QueryShowChangesDialog"));
-        sal_uInt16 nResult = xQuery->run();
-        mbReadlineChecked = true;
-        if ( nResult == RET_YES )
-        {
-            _rReadlineMode |= RedlineFlags::ShowInsert | RedlineFlags::ShowDelete;
-        }
-    }
-}
-
 DocumentRedlineManager::~DocumentRedlineManager()
 {
 }
diff --git a/sw/source/core/inc/DocumentRedlineManager.hxx b/sw/source/core/inc/DocumentRedlineManager.hxx
index c25abf25d394..8412e9a57c04 100644
--- a/sw/source/core/inc/DocumentRedlineManager.hxx
+++ b/sw/source/core/inc/DocumentRedlineManager.hxx
@@ -124,8 +124,6 @@ public:
      Sequence number is for conjoining of Redlines by the UI. */
     void SetAutoFormatRedlineComment( const OUString* pText, sal_uInt16 nSeqNo = 0 );
 
-    void checkRedlining(RedlineFlags& _rReadlineMode);
-
     bool IsHideRedlines() const { return m_bHideRedlines; }
     void SetHideRedlines(bool const bHideRedlines) { m_bHideRedlines = bHideRedlines; }
 
@@ -143,7 +141,6 @@ private:
     std::unique_ptr<SwExtraRedlineTable> mpExtraRedlineTable;      //< List of all Extra Redlines.
     std::unique_ptr<OUString> mpAutoFormatRedlnComment;  //< Comment for Redlines inserted via AutoFormat.
     bool mbIsRedlineMove;    //< true: Redlines are moved into to / out of the section.
-    bool mbReadlineChecked;    //< true: if the query was already shown
     sal_uInt16 mnAutoFormatRedlnCommentNo;  /**< SeqNo for conjoining of AutoFormat-Redlines.
                                          by the UI. Managed by SwAutoFormat! */
     css::uno::Sequence <sal_Int8 > maRedlinePasswd;
diff --git a/sw/uiconfig/swriter/ui/queryshowchangesdialog.ui b/sw/uiconfig/swriter/ui/queryshowchangesdialog.ui
deleted file mode 100644
index 97b7a654f28b..000000000000
--- a/sw/uiconfig/swriter/ui/queryshowchangesdialog.ui
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.2 -->
-<interface domain="sw">
-  <requires lib="gtk+" version="3.18"/>
-  <object class="GtkMessageDialog" id="QueryShowChangesDialog">
-    <property name="can_focus">False</property>
-    <property name="title" translatable="yes" context="queryshowchangesdialog|QueryShowChangesDialog">Show changes?</property>
-    <property name="resizable">False</property>
-    <property name="modal">True</property>
-    <property name="type_hint">dialog</property>
-    <property name="skip_taskbar_hint">True</property>
-    <property name="message_type">question</property>
-    <property name="buttons">yes-no</property>
-    <property name="text" translatable="yes" context="queryshowchangesdialog|QueryShowChangesDialog">Do you want to show changes to avoid delays?</property>
-    <property name="secondary_text" translatable="yes" context="queryshowchangesdialog|QueryShowChangesDialog">In the current document, changes are being recorded but not shown as such. In large documents, delays can occur when the document is edited. Showing changes will avoid delays.</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="messagedialog-vbox">
-        <property name="can_focus">False</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">12</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="messagedialog-action_area">
-            <property name="can_focus">False</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-  </object>
-</interface>
commit a7a8d0bbf06d54b98a3dbb1ec944efa2557b0ffb
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Dec 18 15:26:07 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Tue Dec 18 16:12:12 2018 +0100

    sw_redlinehide_4b: tdf#113479 SetRedlineFlags() calls no longer...
    
    ...able to be triggered by the UI, so the performance problem should be
    gone.
    
    The SwXTextDocument "ShowChanges" property allows API clients to call
    SetRedlineFlags() and change the model; this API should be retained
    as-is for now, because there is no way currently (outside of the rather
    specialised a11y API) to get a "merged view" of the paragraphs in the
    document, so API clients may want to (temporarily) toggle this property
    to then retrieve properties from the model.  In case we later find that
    there are no API clients that want to do such things, the property can
    be removed.
    
    A run with assert() instead of SAL_WARN_IF() found only 2 tests that
    explicitly call SetRedlineFlags() to clear ShowDelete.
    
    Change-Id: I44aee90f7727948ca0bbaaff9d04f8dd6b97cbd1

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 6e34a5d33ddc..e38d1ea866e5 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -3689,7 +3689,6 @@ bool DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl( SwPaM & rPa
     assert(m_rDoc.getIDocumentRedlineAccess().IsRedlineOn());
 
     RedlineFlags eOld = m_rDoc.getIDocumentRedlineAccess().GetRedlineFlags();
-    m_rDoc.GetDocumentRedlineManager().checkRedlining( eOld );
 
     if (*rPam.GetPoint() == *rPam.GetMark())
     {
@@ -3750,9 +3749,10 @@ bool DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl( SwPaM & rPa
     std::vector<std::unique_ptr<SwUndoRedlineDelete>> undos;
     if (m_rDoc.GetIDocumentUndoRedo().DoesUndo())
     {
-        /* please don't translate -- for cultural reasons this comment is protected
-           until the redline implementation is finally fixed some day */
-        //JP 06.01.98: MUSS noch optimiert werden!!!
+        // this should no longer happen in calls from the UI but maybe via API
+        // (randomTest and testTdf54819 triggers it)
+        SAL_WARN_IF((eOld & RedlineFlags::ShowMask) != RedlineFlags::ShowMask,
+                "sw.core", "redlines will be moved in DeleteAndJoin");
         m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags(
             RedlineFlags::On | RedlineFlags::ShowInsert | RedlineFlags::ShowDelete);
         for (SwRangeRedline * pRedline : redlines)
@@ -3811,7 +3811,6 @@ bool DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl( SwPaM & rPa
         {
             m_rDoc.GetIDocumentUndoRedo().EndUndo(SwUndoId::EMPTY, nullptr);
         }
-        //JP 06.01.98: MUSS noch optimiert werden!!!
         m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags( eOld );
     }
     return true;
@@ -4075,9 +4074,12 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt
         if( m_rDoc.getIDocumentRedlineAccess().IsRedlineOn() )
         {
             RedlineFlags eOld = m_rDoc.getIDocumentRedlineAccess().GetRedlineFlags();
-            m_rDoc.GetDocumentRedlineManager().checkRedlining(eOld);
             if (m_rDoc.GetIDocumentUndoRedo().DoesUndo())
             {
+                // this should no longer happen in calls from the UI but maybe via API
+                SAL_WARN_IF((eOld & RedlineFlags::ShowMask) != RedlineFlags::ShowMask,
+                        "sw.core", "redlines will be moved in ReplaceRange");
+
                 m_rDoc.GetIDocumentUndoRedo().StartUndo(SwUndoId::EMPTY, nullptr);
 
                 // If any Redline will change (split!) the node
@@ -4086,7 +4088,6 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt
                         OUString(), IDocumentMarkAccess::MarkType::UNO_BOOKMARK,
                         ::sw::mark::InsertMode::New);
 
-                //JP 06.01.98: MUSS noch optimiert werden!!!
                 m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags(
                     RedlineFlags::On | RedlineFlags::ShowInsert | RedlineFlags::ShowDelete );
 
@@ -4185,7 +4186,6 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt
                 rPam.GetPoint()->nNode = 0;
                 rPam.GetPoint()->nContent = rIdx;
                 *rPam.GetMark() = *rPam.GetPoint();
-                //JP 06.01.98: MUSS noch optimiert werden!!!
                 m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags( eOld );
 
                 *rPam.GetPoint() = pBkmk->GetMarkPos();
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index a6e1c267f0f1..e99195f85a75 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -2261,10 +2261,12 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, long const nOffset,
             }
 
             RedlineFlags eOld = getIDocumentRedlineAccess().GetRedlineFlags();
-            GetDocumentRedlineManager().checkRedlining(eOld);
             if (GetIDocumentUndoRedo().DoesUndo())
             {
-                // Still NEEDS to be optimized (even after 14 years)
+                // this should no longer happen in calls from the UI but maybe via API
+                SAL_WARN_IF((eOld & RedlineFlags::ShowMask) != RedlineFlags::ShowMask,
+                    "sw.core", "redlines will be moved in DeleteAndJoin");
+
                 getIDocumentRedlineAccess().SetRedlineFlags(
                    RedlineFlags::On | RedlineFlags::ShowInsert | RedlineFlags::ShowDelete );
                 GetIDocumentUndoRedo().AppendUndo(
@@ -2285,7 +2287,6 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, long const nOffset,
             aPam.GetBound(false).nContent.Assign(aPam.GetBound(false).nNode.GetNode().GetContentNode(), 0);
             sw::UpdateFramesForAddDeleteRedline(*this, aPam);
 
-            // Still NEEDS to be optimized!
             getIDocumentRedlineAccess().SetRedlineFlags( eOld );
             GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
             getIDocumentState().SetModified();


More information about the Libreoffice-commits mailing list