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

sw: clarify what the hell SwTextFrame::GetFormatted() actually does

Change-Id: I3af0ef5f10c6c2172499b481f3fab1400dca3c6f
üst 2993bb63
...@@ -55,7 +55,12 @@ class SW_DLLPUBLIC SwTextFrame: public SwContentFrame ...@@ -55,7 +55,12 @@ class SW_DLLPUBLIC SwTextFrame: public SwContentFrame
friend class TextFrameLockGuard; // May Lock()/Unlock() friend class TextFrameLockGuard; // May Lock()/Unlock()
friend bool sw_ChangeOffset( SwTextFrame* pFrame, sal_Int32 nNew ); friend bool sw_ChangeOffset( SwTextFrame* pFrame, sal_Int32 nNew );
static SwCache *pTextCache; // Pointer to the Line Cache /// SwLineLayout cache: the lines are not actually owned by the SwTextFrame
/// but by this SwCache, so they will be deleted in large documents
/// if there are too many of them, but the "valid" flags of the frame
/// will still be set; GetFormatted() is the function that forces
/// recreation of the SwLineLayout by Format() if necessary.
static SwCache *pTextCache;
static long nMinPrtLine; // This Line must not be underrun when printing static long nMinPrtLine; // This Line must not be underrun when printing
// Hack for table cells stretching multiple pages // Hack for table cells stretching multiple pages
...@@ -446,7 +451,7 @@ public: ...@@ -446,7 +451,7 @@ public:
SwTextFrame *FindQuoVadisFrame(); SwTextFrame *FindQuoVadisFrame();
/** /**
* Makes up for formatting if the Idle Handler has struck * In case the SwLineLayout was cleared out of the pTextCache, recreate it.
* *
* #i29062# GetFormatted() can trigger a full formatting * #i29062# GetFormatted() can trigger a full formatting
* of the paragraph, causing other layout frames to become invalid. This * of the paragraph, causing other layout frames to become invalid. This
......
...@@ -2123,18 +2123,18 @@ SwTextFrame* SwTextFrame::GetFormatted( bool bForceQuickFormat ) ...@@ -2123,18 +2123,18 @@ SwTextFrame* SwTextFrame::GetFormatted( bool bForceQuickFormat )
vcl::RenderContext* pRenderContext = getRootFrame()->GetCurrShell()->GetOut(); vcl::RenderContext* pRenderContext = getRootFrame()->GetCurrShell()->GetOut();
SwSwapIfSwapped swap( this ); SwSwapIfSwapped swap( this );
// The IdleCollector could've removed my cached information // In case the SwLineLayout was cleared out of the pTextCache, recreate it.
// Calc() calls our format
// Not for empty paragraphs // Not for empty paragraphs
if( !HasPara() && !(isFrameAreaDefinitionValid() && IsEmpty()) ) if( !HasPara() && !(isFrameAreaDefinitionValid() && IsEmpty()) )
{ {
// Calc() must be called, because frame position can be wrong // Calc() must be called, because frame position can be wrong
const bool bFormat = isFrameAreaSizeValid(); const bool bFormat = isFrameAreaSizeValid();
Calc(pRenderContext); Calc(pRenderContext); // calls Format() if invalid
// It could be that Calc() did not trigger Format(), because // If the flags were valid (hence bFormat=true), Calc did nothing,
// we've been asked by the IdleCollector to throw away our // so Format() must be called manually in order to recreate
// format information // the SwLineLayout that has been deleted from the
// SwTextFrame::pTextCache (hence !HasPara() above).
// Optimization with FormatQuick() // Optimization with FormatQuick()
if( bFormat && !FormatQuick( bForceQuickFormat ) ) if( bFormat && !FormatQuick( bForceQuickFormat ) )
Format(getRootFrame()->GetCurrShell()->GetOut()); Format(getRootFrame()->GetCurrShell()->GetOut());
......
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