Kaydet (Commit) 09657e31 authored tarafından Michael Stahl's avatar Michael Stahl

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
Reviewed-on: https://gerrit.libreoffice.org/65350
Tested-by: Jenkins
Reviewed-by: 's avatarMichael Stahl <Michael.Stahl@cib.de>
üst 4aa66236
...@@ -3689,7 +3689,6 @@ bool DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl( SwPaM & rPa ...@@ -3689,7 +3689,6 @@ bool DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl( SwPaM & rPa
assert(m_rDoc.getIDocumentRedlineAccess().IsRedlineOn()); assert(m_rDoc.getIDocumentRedlineAccess().IsRedlineOn());
RedlineFlags eOld = m_rDoc.getIDocumentRedlineAccess().GetRedlineFlags(); RedlineFlags eOld = m_rDoc.getIDocumentRedlineAccess().GetRedlineFlags();
m_rDoc.GetDocumentRedlineManager().checkRedlining( eOld );
if (*rPam.GetPoint() == *rPam.GetMark()) if (*rPam.GetPoint() == *rPam.GetMark())
{ {
...@@ -3750,9 +3749,10 @@ bool DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl( SwPaM & rPa ...@@ -3750,9 +3749,10 @@ bool DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl( SwPaM & rPa
std::vector<std::unique_ptr<SwUndoRedlineDelete>> undos; std::vector<std::unique_ptr<SwUndoRedlineDelete>> undos;
if (m_rDoc.GetIDocumentUndoRedo().DoesUndo()) if (m_rDoc.GetIDocumentUndoRedo().DoesUndo())
{ {
/* please don't translate -- for cultural reasons this comment is protected // this should no longer happen in calls from the UI but maybe via API
until the redline implementation is finally fixed some day */ // (randomTest and testTdf54819 triggers it)
//JP 06.01.98: MUSS noch optimiert werden!!! SAL_WARN_IF((eOld & RedlineFlags::ShowMask) != RedlineFlags::ShowMask,
"sw.core", "redlines will be moved in DeleteAndJoin");
m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags( m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags(
RedlineFlags::On | RedlineFlags::ShowInsert | RedlineFlags::ShowDelete); RedlineFlags::On | RedlineFlags::ShowInsert | RedlineFlags::ShowDelete);
for (SwRangeRedline * pRedline : redlines) for (SwRangeRedline * pRedline : redlines)
...@@ -3811,7 +3811,6 @@ bool DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl( SwPaM & rPa ...@@ -3811,7 +3811,6 @@ bool DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl( SwPaM & rPa
{ {
m_rDoc.GetIDocumentUndoRedo().EndUndo(SwUndoId::EMPTY, nullptr); m_rDoc.GetIDocumentUndoRedo().EndUndo(SwUndoId::EMPTY, nullptr);
} }
//JP 06.01.98: MUSS noch optimiert werden!!!
m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags( eOld ); m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags( eOld );
} }
return true; return true;
...@@ -4075,9 +4074,12 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt ...@@ -4075,9 +4074,12 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt
if( m_rDoc.getIDocumentRedlineAccess().IsRedlineOn() ) if( m_rDoc.getIDocumentRedlineAccess().IsRedlineOn() )
{ {
RedlineFlags eOld = m_rDoc.getIDocumentRedlineAccess().GetRedlineFlags(); RedlineFlags eOld = m_rDoc.getIDocumentRedlineAccess().GetRedlineFlags();
m_rDoc.GetDocumentRedlineManager().checkRedlining(eOld);
if (m_rDoc.GetIDocumentUndoRedo().DoesUndo()) 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); m_rDoc.GetIDocumentUndoRedo().StartUndo(SwUndoId::EMPTY, nullptr);
// If any Redline will change (split!) the node // If any Redline will change (split!) the node
...@@ -4086,7 +4088,6 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt ...@@ -4086,7 +4088,6 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt
OUString(), IDocumentMarkAccess::MarkType::UNO_BOOKMARK, OUString(), IDocumentMarkAccess::MarkType::UNO_BOOKMARK,
::sw::mark::InsertMode::New); ::sw::mark::InsertMode::New);
//JP 06.01.98: MUSS noch optimiert werden!!!
m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags( m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags(
RedlineFlags::On | RedlineFlags::ShowInsert | RedlineFlags::ShowDelete ); RedlineFlags::On | RedlineFlags::ShowInsert | RedlineFlags::ShowDelete );
...@@ -4185,7 +4186,6 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt ...@@ -4185,7 +4186,6 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt
rPam.GetPoint()->nNode = 0; rPam.GetPoint()->nNode = 0;
rPam.GetPoint()->nContent = rIdx; rPam.GetPoint()->nContent = rIdx;
*rPam.GetMark() = *rPam.GetPoint(); *rPam.GetMark() = *rPam.GetPoint();
//JP 06.01.98: MUSS noch optimiert werden!!!
m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags( eOld ); m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags( eOld );
*rPam.GetPoint() = pBkmk->GetMarkPos(); *rPam.GetPoint() = pBkmk->GetMarkPos();
......
...@@ -2261,10 +2261,12 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, long const nOffset, ...@@ -2261,10 +2261,12 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, long const nOffset,
} }
RedlineFlags eOld = getIDocumentRedlineAccess().GetRedlineFlags(); RedlineFlags eOld = getIDocumentRedlineAccess().GetRedlineFlags();
GetDocumentRedlineManager().checkRedlining(eOld);
if (GetIDocumentUndoRedo().DoesUndo()) 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( getIDocumentRedlineAccess().SetRedlineFlags(
RedlineFlags::On | RedlineFlags::ShowInsert | RedlineFlags::ShowDelete ); RedlineFlags::On | RedlineFlags::ShowInsert | RedlineFlags::ShowDelete );
GetIDocumentUndoRedo().AppendUndo( GetIDocumentUndoRedo().AppendUndo(
...@@ -2285,7 +2287,6 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, long const nOffset, ...@@ -2285,7 +2287,6 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, long const nOffset,
aPam.GetBound(false).nContent.Assign(aPam.GetBound(false).nNode.GetNode().GetContentNode(), 0); aPam.GetBound(false).nContent.Assign(aPam.GetBound(false).nNode.GetNode().GetContentNode(), 0);
sw::UpdateFramesForAddDeleteRedline(*this, aPam); sw::UpdateFramesForAddDeleteRedline(*this, aPam);
// Still NEEDS to be optimized!
getIDocumentRedlineAccess().SetRedlineFlags( eOld ); getIDocumentRedlineAccess().SetRedlineFlags( eOld );
GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr ); GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
getIDocumentState().SetModified(); getIDocumentState().SetModified();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment