void SwTextFrame::SetPara( SwParaPortion *pNew, bool bDelete )
{ if ( GetCacheIdx() != USHRT_MAX )
{ // Only change the information, the CacheObj stays there
SwTextLine *pTextLine = static_cast<SwTextLine*>(SwTextFrame::GetTextCache()->
Get( this, GetCacheIdx(), false )); if ( pTextLine )
{
pTextLine->SetPara( pNew, bDelete );
} else
{
OSL_ENSURE( !pNew, "+SetPara: Losing SwParaPortion" );
mnCacheIndex = USHRT_MAX;
}
} elseif ( pNew )
{ // Insert a new one
SwTextLine *pTextLine = new SwTextLine( this, std::unique_ptr<SwParaPortion>(pNew) ); if (SwTextFrame::GetTextCache()->Insert(pTextLine, false))
mnCacheIndex = pTextLine->GetCachePos(); else
{
OSL_FAIL( "+SetPara: InsertCache failed." );
}
}
}
/** Prevent the SwParaPortions of the *visible* paragraphs from being deleted; theywouldjustberecreatedonthenextpaint.
Heuristic:100perviewarevisible
Ifthecacheistoosmall,enlargeittoensuretherearesufficientfree entriesforthelayoutsoitdoesn'thavetothrowawayanode's SwParaPortionwhenitstartsformattingthenextnode.
*/
SwSaveSetLRUOfst::SwSaveSetLRUOfst()
{
sal_uInt16 nVisibleShells(0); for (auto pView = SfxViewShell::GetFirst(true, checkSfxViewShell<SwView>);
pView != nullptr;
pView = SfxViewShell::GetNext(*pView, true, checkSfxViewShell<SwView>))
{ // Apparently we are not interested here what document pView is for, but only in the // total number of shells in the process?
++nVisibleShells;
}