void SwEditShell::ReinstatePaM(const SwRangeRedline& rRedline, SwPaM& rPaM)
{ if (rRedline.GetType() == RedlineType::Insert)
{ // Disable compressing redlines, that would merge a self-insert and a self-delete, which is // not wanted for reinstate.
IDocumentRedlineAccess& rIDRA = GetDoc()->getIDocumentRedlineAccess();
RedlineFlags eOld = rIDRA.GetRedlineFlags();
rIDRA.SetRedlineFlags(eOld | RedlineFlags::DontCombineRedlines);
DeleteSel(rPaM, /*isArtificialSelection=*/true);
rIDRA.SetRedlineFlags(eOld);
} elseif (rRedline.GetType() == RedlineType::Delete)
{ // Re-insert after the deletion.
SwDocShell* pDocShell = GetDoc()->GetDocShell(); if (!pDocShell)
{ return;
}
SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); if (!pWrtShell)
{ return;
}
// Get rid of table selection or multi-selection if there is one.
KillPams();
assert(!GetTableCursor() && "coverity#1645529");
SwShellCursor* pCursor = getShellCursor(/*bBlock=*/true);
*pCursor->GetPoint() = *rPaM.End();
SetMark();
*pCursor->GetMark() = *rPaM.Start();
rtl::Reference<SwTransferable> pTransfer(new SwTransferable(*pWrtShell)); // Copy rich text, but don't strip out text inside delete redlines.
pTransfer->Copy(/*bIsCut=*/false, /*bDeleteRedlines=*/false);
ClearMark();
*pCursor->GetPoint() = *rPaM.End();
TransferableDataHelper aHelper(pTransfer);
SwTransferable::Paste(*pWrtShell, aHelper);
}
}
// Work on a copy, since reinstate will modify the table, and reinstate of just inserted // redlines is not wanted.
std::vector<SwRangeRedline*> aRedlines(rTable.begin(), rTable.end());
IDocumentUndoRedo& rIDUR = GetDoc()->GetIDocumentUndoRedo(); if (rIDUR.DoesUndo())
{
rIDUR.StartUndo(SwUndoId::REINSTATE_REDLINE, nullptr);
} int nRedlines = 0; for (size_t nIndex = 0; nIndex < aRedlines.size(); ++nIndex)
{ const SwRangeRedline& rRedline = *aRedlines[nIndex]; if (!rRedline.HasMark() || !rRedline.IsVisible())
{ continue;
}
if (*rRedline.End() < aCursorStart)
{ // Ends before the selection, skip to the next redline. continue;
}
if (*rRedline.Start() > aCursorEnd)
{ // Starts after the selection, can stop. break;
}
// Check if the redline is only partially selected. const SwPosition* pStart = rRedline.Start(); if (*pStart < aCursorStart)
{
pStart = &aCursorStart;
} const SwPosition* pEnd = rRedline.End(); if (*pEnd > aCursorEnd)
{
pEnd = &aCursorEnd;
}
// Set the comment at the Redline bool SwEditShell::SetRedlineComment( const OUString& rS )
{ bool bRet = false; for(const SwPaM& rPaM : GetCursor()->GetRingContainer())
{
bRet = bRet || GetDoc()->getIDocumentRedlineAccess().SetRedlineComment( rPaM, rS );
}
return bRet;
}
const SwRangeRedline* SwEditShell::GetCurrRedline() const
{ if (const SwRangeRedline* pRed = GetDoc()->getIDocumentRedlineAccess().GetRedline( *GetCursor()->GetPoint(), nullptr )) return pRed; // check the other side of the selection to handle completely selected changes, where the Point is at the end return GetDoc()->getIDocumentRedlineAccess().GetRedline( *GetCursor()->GetMark(), nullptr );
}
/** Search the Redline of the data given * *@returnReturnsthePosoftheArray,orSwRedlineTable::nposifnotpresent
*/
SwRedlineTable::size_type SwEditShell::FindRedlineOfData( const SwRedlineData& rData ) const
{ const SwRedlineTable& rTable = GetDoc()->getIDocumentRedlineAccess().GetRedlineTable();
for( SwRedlineTable::size_type i = 0, nCnt = rTable.size(); i < nCnt; ++i ) if( &rTable[ i ]->GetRedlineData() == &rData ) return i; return SwRedlineTable::npos;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.