22#include <osl/diagnose.h>
104 sal_uInt32
nIndex(0), nOffset(0);
113 if( (cFlags & 0x01) != 0 )
136 sal_Int32 nX(0), nY(0), nW(0), nH(0);
197 if( nNdIdx > nStartOfContent )
201 bool bFollow =
static_cast<SwTextFrame*
>(pTmp)->IsFollow();
204 nNdIdx -= nStartOfContent;
217 if( pTab->IsFollow() )
222 if( pTab->IsFollow() )
224 while( pTab != pTmp )
233 assert(pTab &&
"Table follow without master");
240 if( nNdIdx > nStartOfContent )
245 nNdIdx -= nStartOfContent;
269 if( pTabPage != pPage )
273 "Looping Tableframes" );
292 if( pFly->getFrameArea().Left() !=
FAR_AWAY &&
293 !pFly->GetAnchorFrame()->FindFooterOrHeader() )
299 sal_uInt32 nOrdNum = pAnchoredObj->GetDrawObj()->GetOrdNum();
305 const SwRect& rRct = pFly->getFrameArea();
355 if( nNdIdx > nStartOfContent )
357 bool bFollow =
static_cast<const SwTextFrame*
>(pTmp)->IsFollow();
358 nNdIdx -= nStartOfContent;
363 ? sal_Int32(
static_cast<const SwTextFrame*
>(pTmp)->GetOffset())
375 if( pTab->IsFollow() )
378 if( pTab->IsFollow() )
380 while( pTab != pTmp )
395 if( nNdIdx > nStartOfContent )
397 nNdIdx -= nStartOfContent;
421 if( pTabPage != pPage )
450 OSL_ENSURE( !
m_nLockCount,
"Deleting a locked SwLayoutCache!?" );
458 m_pSectFrame( pSect ),
474 nNodeIndex -= nStartOfContent;
479 if (nBreakIndex < nNodeIndex || nMaxIndex <= nBreakIndex)
482 "invalid node index in layout-cache: " << nBreakIndex);
489 if (!rNodes[nBreakIndex + nStartOfContent]->IsTextNode())
492 "invalid node of type 'P' in layout-cache");
497 if (!rNodes[nBreakIndex + nStartOfContent]->IsTableNode())
500 "invalid node of type 'T' in layout-cache");
526 , mrpActualSection( rpA )
527 , mbBreakAfter(false)
529 , mnMaxParaPerPage( 25 )
530 , mnParagraphCnt( bCache ? 0 : USHRT_MAX )
538 if (sanityCheckLayoutCache(*
mpImpl, rNodes, nNodeIndex))
548 mnIndex = std::numeric_limits<size_t>::max();
554 mnIndex = std::numeric_limits<size_t>::max();
579 nPgCount = pCache->
size() + 1;
585 if ( nPgCount <= 10 )
599 nNdCount = sal_Int32(nTmp);
601 if ( nNdCount > 100 )
615 if ( nNdCount < 1000 )
644 SwFlowFrame::CastFlowFrame(
mrpFrame )->IsFollow() ?
650 rBrk.
GetBreak() == SvxBreak::PageBoth;
652 bBrk = rBrk.
GetBreak() == SvxBreak::PageBefore ||
653 rBrk.
GetBreak() == SvxBreak::PageBoth;
657 ::std::optional<sal_uInt16> oPgNum;
669 bool bInsertEmpty =
false;
674 bNextPageRight = !bNextPageRight;
680 bNextPageRight, bNextPageFirst, bInsertEmpty,
false,
mrpPage->
GetNext());
716 bool bLongTab =
false;
719 sal_uInt16 nRows( 0 );
764 ( ++mnIndex < mpImpl->
size() &&
772 sal_Int32 nRowCount = 0;
782 nOfst =
static_cast<sal_Int32
>(nRowCount + nMaxRowPerPage);
786 while( mnIndex < mpImpl->
size() &&
789 if( mnIndex < mpImpl->
size() &&
801 sal_uInt16 nRepeat( 0 );
810 GetTable()->GetRowsToRepeat();
811 bSplit = nOfst < nRows && nRowCount + nRepeat < nOfst;
812 bLongTab = bLongTab && bSplit;
821 aFrm.
Pos().AdjustY(1 );
838 sal_uInt16 nRowIdx = 0;
840 while( nRowIdx < nRepeat )
852 nRows = nRows + nRepeat;
856 while( pRow && nRowCount < nOfst )
875 ->GetTextNodeFirst()->MakeFrame(
mrpFrame));
928 aFrm.
Pos().AdjustY(1 );
936 }
while( bLongTab || (
mpImpl && mnIndex < mpImpl->
size() &&
945struct SdrObjectCompare
953struct FlyCacheCompare
993 while( nIdx < nFlyCount &&
996 aFlyCacheSet.
insert( pFlyC );
1006 if( pFly->GetAnchorFrame() &&
1007 !pFly->GetAnchorFrame()->FindFooterOrHeader() )
1012 aFlySet.
insert( pAnchoredObj->GetDrawObj() );
1018 if ( aFlyCacheSet.
size() != aFlySet.
size() )
1021 auto aFlySetIt = aFlySet.
begin();
1023 for (
const SwFlyCache* pFlyCache : aFlyCacheSet )
1036 aFrm.
Width( pFlyCache->Width() );
1037 aFrm.
Height( pFlyCache->Height() );
1047 m_nFlagRecEnd ( 0 ),
1050 m_bWriteMode( bWrtMd ),
1077 OSL_ENSURE( nVal,
"OpenRec: Record-Header is 0" );
1078 OSL_ENSURE( cRecTyp == cType,
"OpenRec: Wrong Record Type" );
1084 sal_uInt32 nSize = nVal >> 8;
1094 OSL_ENSURE( !
m_aRecords.empty(),
"CloseRec: no levels" );
1102 sal_uInt32 nSize =
nPos - nBgn;
1103 sal_uInt32 nVal = ( nSize << 8 ) |
m_aRecords.back().type;
1112 OSL_ENSURE(
n >=
nPos,
"CloseRec: too much data read" );
1136 if( nEndPos >
nPos )
1169 OSL_ENSURE( !
m_bWriteMode,
"OpenFlagRec illegal in write mode" );
1173 return (cFlags >> 4);
1178 OSL_ENSURE(
m_bWriteMode,
"OpenFlagRec illegal in read mode" );
1179 OSL_ENSURE( (nFlags & 0xF0) == 0,
"illegal flags set" );
1180 OSL_ENSURE( nLen < 16,
"wrong flag record length" );
1181 sal_uInt8 cFlags = (nFlags << 4) + nLen;
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...
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual const SwDocStat & GetDocStat() const =0
Document - Statistics.
sal_uInt32 GetOrdNum() const
SvStream & WriteInt32(sal_Int32 nInt32)
SvStream & WriteUChar(unsigned char nChar)
SvStream & WriteUInt16(sal_uInt16 nUInt16)
SvStream & WriteUInt32(sal_uInt32 nUInt32)
SvStream & ReadUInt32(sal_uInt32 &rUInt32)
sal_uInt64 Seek(sal_uInt64 nPos)
SvStream & ReadInt32(sal_Int32 &rInt32)
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
ErrCode const & GetErrorCode() const
SvStream & ReadUChar(unsigned char &rChar)
SwSectionNode * m_pSectNode
SwActualSection(SwActualSection *pUpper, SwSectionFrame *pSect, SwSectionNode *pNd)
helper class to create not nested section frames for nested sections.
wrapper class for the positioning of Writer fly frames and drawing objects
const sw::TableFrameFormats * GetTableFrameFormats() const
SwLayoutCache * GetLayoutCache() const
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
IDocumentStatistics const & getIDocumentStatistics() const
sal_uInt16 nPageNum
page number
sal_uLong nOrdNum
Id to recognize text frames.
general base class for all free-flowing frames
virtual const SwFlyFrame * DynCastFlyFrame() const override
const SwNodeIndex * GetContentIdx() const
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
SwPageDesc * GetPageDesc()
const ::std::optional< sal_uInt16 > & GetNumOffset() const
const SwRect & getFrameArea() const
const SwRect & getFramePrintArea() const
bool isFrameAreaSizeValid() const
Base class of the Writer layout elements.
void InsertBehind(SwLayoutFrame *pParent, SwFrame *pBefore)
Insert SwFrame into existing structure.
void InsertBefore(SwLayoutFrame *pParent, SwFrame *pBehind)
Insert SwFrame into existing structure.
SwLayoutFrame * GetUpper()
const SwLayoutFrame * GetNextLayoutLeaf() const
SwRootFrame * getRootFrame()
virtual const SvxFormatBreakItem & GetBreakItem() const
SwPageFrame * FindPageFrame()
virtual const SwFormatPageDesc & GetPageDescItem() const
bool IsLayoutFrame() const
sal_Int32 GetBreakOfst(size_t nIdx) const
sal_uInt16 GetBreakType(size_t nIdx) const
std::vector< sal_uInt16 > m_aType
size_t GetFlyCount() const
SwPageFlyCache m_FlyCache
std::vector< SwNodeOffset > mIndices
bool IsUseFlyCache() const
std::deque< sal_Int32 > m_aOffset
either a textframe character offset, or a row index inside a table
SwFlyCache & GetFlyCache(size_t nIdx)
bool Read(SvStream &rStream)
void Insert(sal_uInt16 nType, SwNodeOffset nIndex, sal_Int32 nOffset)
SwNodeOffset GetBreakIndex(size_t nIdx) const
sal_uInt16 GetMajorVersion() const
void CloseRec()
Close a record.
std::vector< RecTypeSize > m_aRecords
sal_uInt16 GetMinorVersion() const
sal_uInt8 OpenFlagRec()
Open a flag record for reading.
sal_uInt32 BytesLeft()
Return the number of bytes contained in the current record that haven't been read by now.
SvStream & GetStream() const
Get input or output stream.
sal_uInt16 m_nMajorVersion
void OpenRec(sal_uInt8 nType)
Open a record of type "nType".
void CloseFlagRec()
Close a flag record. Any bytes left are skipped.
sal_uInt8 Peek()
Return the current record's type.
void SkipRec()
Skip the current record.
sal_uInt16 m_nMinorVersion
SwLayCacheIoImpl(SvStream &rStrm, bool bWrtMd)
sal_uLong CalcPageCount()
Does NOT really calculate the page count, it returns the page count value from the layout cache,...
size_t mnFlyIdx
the index in the fly cache array
SwNodeOffset mnStartOfContent
bool CheckInsert(SwNodeOffset nNodeIndex)
entry point for the InsertCnt_-function.
SwLayHelper(SwDoc *pD, SwFrame *&rpF, SwFrame *&rpP, SwPageFrame *&rpPg, SwLayoutFrame *&rpL, std::unique_ptr< SwActualSection > &rpA, SwNodeOffset nNodeIndex, bool bCache)
helper class, which utilizes the layout cache information to distribute the document content to the r...
void CheckFlyCache_(SwPageFrame *pPage)
If a new page is inserted, the last page is analysed.
size_t mnIndex
the index in the page break array
sal_uLong mnMaxParaPerPage
std::unique_ptr< SwActualSection > & mrpActualSection
bool CheckInsertPage()
inserts a page and return true, if
std::unique_ptr< SwLayCacheImpl > m_pImpl
SwLayCacheImpl * LockImpl()
void Read(SvStream &rStream)
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 CompareLayout(const SwDoc &rDoc) const
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
virtual const SwFrameFormat * GetFormat() const
const SwFrame * ContainsAny(const bool _bInvestigateFootnoteForSections=false) const
Method <ContainsAny()> doesn't investigate content of footnotes by default.
const SwFrame * Lower() const
Marks a node in the document model.
SwNodeOffset GetIndex() const
SwSectionNode * FindSectionNode()
Search section node, in which it is.
const SwStartNode * StartOfSectionNode() const
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
SwNode & GetEndOfAutotext() const
Section for all Flys/Header/Footers.
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
SwNode & GetEndOfInserts() const
Section for all footnotes.
const SwPageDesc * GetFollow() const
A page of the document layout.
sal_uInt16 GetPhyPageNum() const
const SwSortedObjs * GetSortedObjs() const
SwPageDesc * GetPageDesc()
Of course Writer needs its own rectangles.
void Height(tools::Long nNew)
void Top(const tools::Long nTop)
void Pos(const Point &rNew)
void Left(const tools::Long nLeft)
void Width(tools::Long nNew)
The root element of a Writer document layout.
SwViewShell * GetCurrShell() const
SwRowFrame is one table row in the document layout.
void SetRepeatedHeadline(bool bNew)
void RegistFlys(SwPageFrame *pPage=nullptr)
Register Flys after a line was created AND inserted Must be called by the creator; the Fly is inserte...
A section node represents the start of a section on the UI, i.e.
class for collecting anchored objects
SwTabFrame is one table in the document layout, containing rows (which contain cells).
SwTabFrame * FindMaster(bool bFirstMaster=false) const
const SwTabFrame * GetFollow() const
const SwTable * GetTable() const
SwTableNode * GetTableNode() const
SwTableLines & GetTabLines()
Represents the visualization of a paragraph.
SwTextFrame * GetFollow()
sw::MergedPara * GetMergedPara()
SwTextNode * GetTextNodeFirst()
void ManipOfst(TextFrameIndex const nNewOfst)
const OUString & GetText() const
Returns the text portion we want to edit (for inline see underneath)
bool getBrowseMode() const
const SwViewOption * GetViewOptions() const
const_iterator begin() const
std::pair< const_iterator, bool > insert(Value &&x)
GtkMediaStream * m_pStream
#define SW_LAYCACHE_IO_VERSION_MINOR
#define SW_LAYCACHE_IO_REC_PAGES
#define SW_LAYCACHE_IO_REC_TABLE
#define SW_LAYCACHE_IO_REC_PARA
#define SW_LAYCACHE_IO_VERSION_MAJOR
#define SW_LAYCACHE_IO_REC_FLY
#define SAL_WARN(area, stream)
bool IsRightPageByNumber(SwRootFrame const &rLayout, sal_uInt16 nPageNum)
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
constexpr SwNodeOffset NODE_OFFSET_MAX(SAL_MAX_INT32)
sal_uLong nPara
paragraphs for document statistic: non-empty and non-hidden ones
constexpr sal_Int32 COMPLETE_STRING