summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2018-12-18 15:26:07 +0100
committerMichael Stahl <Michael.Stahl@cib.de>2018-12-18 16:12:12 +0100
commita7a8d0bbf06d54b98a3dbb1ec944efa2557b0ffb (patch)
treebc0aa031ceb18ac54530df79b0f1d8192b97970d
parentsw_redlinehide: make layout based Show/Hide mode the default (diff)
downloadcore-a7a8d0bbf06d54b98a3dbb1ec944efa2557b0ffb.tar.gz
core-a7a8d0bbf06d54b98a3dbb1ec944efa2557b0ffb.zip
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
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx16
-rw-r--r--sw/source/core/doc/docnum.cxx7
2 files changed, 12 insertions, 11 deletions
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();