103 sal_uInt32
nIndex(0), nOffset(0);
112 if( (cFlags & 0x01) != 0 )
135 sal_Int32 nX(0), nY(0), nW(0), nH(0);
187 pTmp = static_cast<SwSectionFrame*>(pTmp)->ContainsAny();
193 SwTextFrame const*
const pFrame(static_cast<SwTextFrame const*>(pTmp));
196 if( nNdIdx > nStartOfContent )
200 bool bFollow =
static_cast<SwTextFrame*
>(pTmp)->IsFollow();
203 nNdIdx -= nStartOfContent;
223 while( pTab != pTmp )
232 assert(pTab &&
"Table follow without master");
239 if( nNdIdx > nStartOfContent )
244 nNdIdx -= nStartOfContent;
268 if( pTabPage != pPage )
272 "Looping Tableframes" );
289 if (
SwFlyFrame *pFly = dynamic_cast<SwFlyFrame*>(pAnchoredObj))
291 if( pFly->getFrameArea().Left() !=
FAR_AWAY &&
292 !pFly->GetAnchorFrame()->FindFooterOrHeader() )
298 sal_uInt32 nOrdNum = pAnchoredObj->GetDrawObj()->GetOrdNum();
304 const SwRect& rRct = pFly->getFrameArea();
310 .WriteInt32( rRct.
Height() );
339 if( nIndex >=
m_pImpl->size() )
345 pTmp = static_cast<const SwSectionFrame*>(pTmp)->ContainsAny();
351 SwTextFrame const*
const pFrame(static_cast<SwTextFrame const*>(pTmp));
354 if( nNdIdx > nStartOfContent )
356 bool bFollow =
static_cast<const SwTextFrame*
>(pTmp)->IsFollow();
357 nNdIdx -= nStartOfContent;
358 if(
m_pImpl->GetBreakIndex( nIndex ) != nNdIdx ||
360 m_pImpl->GetBreakType( nIndex ) ||
362 ? sal_Int32(static_cast<const SwTextFrame*>(pTmp)->GetOffset())
379 while( pTab != pTmp )
394 if( nNdIdx > nStartOfContent )
396 nNdIdx -= nStartOfContent;
397 if(
m_pImpl->GetBreakIndex( nIndex ) != nNdIdx ||
399 m_pImpl->GetBreakType( nIndex ) ||
400 nOfst !=
m_pImpl->GetBreakOfst( nIndex ) )
420 if( pTabPage != pPage )
449 OSL_ENSURE( !
m_nLockCount,
"Deleting a locked SwLayoutCache!?" );
457 m_pSectFrame( pSect ),
473 nNodeIndex -= nStartOfContent;
478 if (nBreakIndex < nNodeIndex || nMaxIndex <= nBreakIndex)
481 "invalid node index in layout-cache: " << nBreakIndex);
488 if (!rNodes[nBreakIndex + nStartOfContent]->IsTextNode())
491 "invalid node of type 'P' in layout-cache");
496 if (!rNodes[nBreakIndex + nStartOfContent]->IsTableNode())
499 "invalid node of type 'T' in layout-cache");
525 , mrpActualSection( rpA )
526 , mbBreakAfter(false)
528 , mnMaxParaPerPage( 25 )
529 , mnParagraphCnt( bCache ? 0 :
USHRT_MAX )
537 if (sanityCheckLayoutCache(*
mpImpl, rNodes, nNodeIndex))
547 mnIndex = std::numeric_limits<size_t>::max();
553 mnIndex = std::numeric_limits<size_t>::max();
578 nPgCount = pCache->
size() + 1;
584 if ( nPgCount <= 10 )
600 if ( nNdCount > 100 )
614 if ( nNdCount < 1000 )
649 rBrk.
GetBreak() == SvxBreak::PageBoth;
651 bBrk = rBrk.
GetBreak() == SvxBreak::PageBefore ||
652 rBrk.
GetBreak() == SvxBreak::PageBoth;
656 ::std::optional<sal_uInt16> oPgNum;
668 bool bInsertEmpty =
false;
673 bNextPageRight = !bNextPageRight;
679 bNextPageRight, bNextPageFirst, bInsertEmpty,
false,
mrpPage->
GetNext());
691 if ( mrpPage->IsEmptyPage() )
693 OSL_ENSURE( mrpPage->GetNext(),
"No new page?" );
694 mrpPage =
static_cast<SwPageFrame*
>(mrpPage->GetNext());
715 bool bLongTab =
false;
718 sal_uInt16 nRows( 0 );
771 sal_Int32 nRowCount = 0;
781 nOfst =
static_cast<sal_Int32
>(nRowCount + nMaxRowPerPage);
785 while( mnIndex < mpImpl->
size() &&
788 if( mnIndex < mpImpl->
size() &&
800 sal_uInt16 nRepeat( 0 );
803 nOfst < static_cast<SwTextFrame*>(
mrpFrame)->GetText().getLength())
809 GetTable()->GetRowsToRepeat();
810 bSplit = nOfst < nRows && nRowCount + nRepeat < nOfst;
811 bLongTab = bLongTab && bSplit;
820 aFrm.
Pos().AdjustY(1 );
838 sal_uInt16 nRowIdx = 0;
840 while( nRowIdx < nRepeat )
846 pHeadline->InsertBefore( pFoll,
nullptr );
847 pHeadline->RegistFlys();
854 nRows = nRows + nRepeat;
858 while( pRow && nRowCount < nOfst )
867 pRow->InsertBehind( pFoll, pPrv );
877 ->GetTextNodeFirst()->MakeFrame(
mrpFrame));
930 aFrm.
Pos().AdjustY(1 );
938 }
while( bLongTab || (
mpImpl && mnIndex < mpImpl->
size() &&
947 struct SdrObjectCompare
955 struct FlyCacheCompare
995 while( nIdx < nFlyCount &&
998 aFlyCacheSet.
insert( pFlyC );
1006 if (
SwFlyFrame *pFly = dynamic_cast<SwFlyFrame*>(pAnchoredObj))
1008 if( pFly->GetAnchorFrame() &&
1009 !pFly->GetAnchorFrame()->FindFooterOrHeader() )
1014 aFlySet.
insert( pAnchoredObj->GetDrawObj() );
1020 if ( aFlyCacheSet.
size() != aFlySet.
size() )
1023 auto aFlySetIt = aFlySet.
begin();
1025 for (
const SwFlyCache* pFlyCache : aFlyCacheSet )
1038 aFrm.
Width( pFlyCache->Width() );
1039 aFrm.
Height( pFlyCache->Height() );
1048 m_pStream( &rStrm ),
1049 m_nFlagRecEnd ( 0 ),
1052 m_bWriteMode( bWrtMd ),
1079 OSL_ENSURE( nVal,
"OpenRec: Record-Header is 0" );
1080 OSL_ENSURE( cRecTyp == cType,
"OpenRec: Wrong Record Type" );
1086 sal_uInt32 nSize = nVal >> 8;
1087 m_aRecords.emplace_back(cRecTyp, nPos+nSize );
1096 OSL_ENSURE( !
m_aRecords.empty(),
"CloseRec: no levels" );
1104 sal_uInt32 nSize = nPos - nBgn;
1105 sal_uInt32 nVal = ( nSize << 8 ) |
m_aRecords.back().type;
1114 OSL_ENSURE( n >= nPos,
"CloseRec: too much data read" );
1138 if( nEndPos > nPos )
1171 OSL_ENSURE( !
m_bWriteMode,
"OpenFlagRec illegal in write mode" );
1175 return (cFlags >> 4);
1180 OSL_ENSURE(
m_bWriteMode,
"OpenFlagRec illegal in read mode" );
1181 OSL_ENSURE( (nFlags & 0xF0) == 0,
"illegal flags set" );
1182 OSL_ENSURE( nLen < 16,
"wrong flag record length" );
1183 sal_uInt8 cFlags = (nFlags << 4) + nLen;
SwSectionNode * FindSectionNode()
Search section node, in which it is.
#define SW_LAYCACHE_IO_REC_FLY
SwPageFlyCache m_FlyCache
Base class of the Writer layout elements.
Represents the visualization of a paragraph.
const ::std::optional< sal_uInt16 > & GetNumOffset() const
SwNode & GetEndOfInserts() const
Section for all footnotes.
sal_uLong GetIndex() const
IDocumentStatistics const & getIDocumentStatistics() const
SwNode & GetEndOfAutotext() const
Section for all Flys/Header/Footers.
std::deque< sal_Int32 > m_aOffset
either a textframe character offset, or a row index inside a table
void CloseRec()
Close a record.
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
SvStream & WriteUInt16(sal_uInt16 nUInt16)
SwPageDesc * GetPageDesc()
sal_uLong nPara
paragraphs for document statistic: non-empty and non-hidden ones
virtual const SwRootFrame * GetCurrentLayout() const =0
SvStream & WriteInt32(sal_Int32 nInt32)
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
const SwFrameFormats * GetTableFrameFormats() const
static void Write(SvStream &rStream, const SwDoc &rDoc)
writes the index (more precise: the difference between the index and the first index of the document ...
bool IsUseFlyCache() const
const SwTable * GetTable() const
void Left(const tools::Long nLeft)
SwActualSection(SwActualSection *pUpper, SwSectionFrame *pSect, SwSectionNode *pNd)
helper class to create not nested section frames for nested sections.
const SwRect & getFramePrintArea() const
#define SW_LAYCACHE_IO_REC_TABLE
SwTabFrame is one table in the document layout, containing rows (which contain cells).
sw::MergedPara * GetMergedPara()
#define SW_LAYCACHE_IO_REC_PAGES
bool CheckInsert(sal_uLong nNodeIndex)
entry point for the InsertCnt_-function.
sal_uInt64 Seek(sal_uInt64 nPos)
sal_uLong GetBreakIndex(size_t nIdx) const
void OpenRec(sal_uInt8 nType)
Open a record of type "nType".
void Pos(const Point &rNew)
Of course Writer needs its own rectangles.
virtual const SvxFormatBreakItem & GetBreakItem() const
virtual const SwFormatPageDesc & GetPageDescItem() const
static SwFlowFrame * CastFlowFrame(SwFrame *pFrame)
The root element of a Writer document layout.
sal_uLong nOrdNum
Id to recognize text frames.
std::unique_ptr< SwActualSection > & mrpActualSection
void Read(SvStream &rStream)
sal_uInt16 GetPhyPageNum() const
size_t GetFlyCount() const
size_t mnIndex
the index in the page break array
wrapper class for the positioning of Writer fly frames and drawing objects
sal_uInt16 GetMajorVersion() const
sal_uInt16 GetMinorVersion() const
const SwRect & getFrameArea() const
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
bool getBrowseMode() const
SwFlyCache & GetFlyCache(size_t nIdx)
void Width(tools::Long nNew)
SvStream & WriteUInt32(sal_uInt32 nUInt32)
sal_uInt8 OpenFlagRec()
Open a flag record for reading.
std::vector< sal_uLong > mIndices
void SkipRec()
Skip the current record.
SwSectionNode * m_pSectNode
SwLayoutCache * GetLayoutCache() const
sal_uInt16 m_nMajorVersion
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
SvStream & ReadUInt32(sal_uInt32 &rUInt32)
SwTextNode * GetTextNodeFirst()
SwTabFrame * FindMaster(bool bFirstMaster=false) const
sal_uInt16 nPageNum
page number
const SwSortedObjs * GetSortedObjs() const
std::vector< RecTypeSize > m_aRecords
bool Read(SvStream &rStream)
const SwStartNode * StartOfSectionNode() const
SwPageFrame * FindPageFrame()
SwLayCacheImpl * LockImpl()
const SwFrame * Lower() const
SwPageDesc * GetPageDesc()
void ManipOfst(TextFrameIndex const nNewOfst)
void SetFollow(SwFlowFrame *const pFollow)
sal_uInt32 BytesLeft()
Return the number of bytes contained in the current record that haven't been read by now...
sal_uInt16 GetBreakType(size_t nIdx) const
SwLayoutFrame * GetUpper()
void CloseFlagRec()
Close a flag record. Any bytes left are skipped.
size_t mnFlyIdx
the index in the fly cache array
sal_uInt32 GetOrdNum() const
void SetRepeatedHeadline(bool bNew)
Marks a node in the document model.
SvStream & ReadUChar(unsigned char &rChar)
ErrCode const & GetErrorCode() const
bool isFrameAreaSizeValid() const
A page of the document layout.
sal_uInt8 Peek()
Return the current record's type.
SwTableLines & GetTabLines()
sal_uLong mnMaxParaPerPage
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
SvStream & ReadInt32(sal_Int32 &rInt32)
const SwPageDesc * GetFollow() const
const SwNodeIndex * GetContentIdx() const
const_iterator begin() const
#define SW_LAYCACHE_IO_REC_PARA
bool IsLayoutFrame() const
SwLayCacheIoImpl(SvStream &rStrm, bool bWrtMd)
general base class for all free-flowing frames
bool IsRightPageByNumber(SwRootFrame const &rLayout, sal_uInt16 nPageNum)
const SwViewOption * GetViewOptions() const
SwLayHelper(SwDoc *pD, SwFrame *&rpF, SwFrame *&rpP, SwPageFrame *&rpPg, SwLayoutFrame *&rpL, std::unique_ptr< SwActualSection > &rpA, sal_uLong nNodeIndex, bool bCache)
helper class, which utilizes the layout cache information to distribute the document content to the r...
const SwFrame * ContainsAny(const bool _bInvestigateFootnoteForSections=false) const
Method doesn't investigate content of footnotes by default.
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
void InsertBehind(SwLayoutFrame *pParent, SwFrame *pBefore)
Insert SwFrame into existing structure.
SvStream & GetStream() const
Get input or output stream.
virtual const SwDocStat & GetDocStat() const =0
Document - Statistics.
SvStream & WriteUChar(unsigned char nChar)
void Top(const tools::Long nTop)
#define SW_LAYCACHE_IO_VERSION_MAJOR
sal_Int32 GetBreakOfst(size_t nIdx) const
std::unique_ptr< SwLayCacheImpl > m_pImpl
bool CheckInsertPage()
inserts a page and return true, if
#define SW_LAYCACHE_IO_VERSION_MINOR
bool CompareLayout(const SwDoc &rDoc) const
const SwTabFrame * GetFollow() const
void Insert(sal_uInt16 nType, sal_uLong nIndex, sal_Int32 nOffset)
#define SAL_WARN(area, stream)
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
const SwLayoutFrame * GetNextLayoutLeaf() const
void CheckFlyCache_(SwPageFrame *pPage)
If a new page is inserted, the last page is analysed.
std::pair< const_iterator, bool > insert(Value &&x)
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
SwViewShell * GetCurrShell() const
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
class for collecting anchored objects
void Height(tools::Long nNew)
sal_uLong CalcPageCount()
Does NOT really calculate the page count, it returns the page count value from the layout cache...
const sal_Int32 COMPLETE_STRING
SwRootFrame * getRootFrame()
sal_uLong mnStartOfContent
sal_uInt16 m_nMinorVersion
SwRowFrame is one table row in the document layout.
std::vector< sal_uInt16 > m_aType
virtual const SwFrameFormat * GetFormat() const
SwTableNode * GetTableNode() const