21 #include <osl/diagnose.h>
72 "no columns to remove." );
76 while ( pColumn->GetNext() )
78 OSL_ENSURE( pColumn->GetNext()->IsColumnFrame(),
79 "neighbor of ColumnFrame is no ColumnFrame." );
82 for ( sal_uInt16
i = 0;
i < nCnt; ++
i )
95 pCol = static_cast<SwPageFrame*>(pLay)->FindBodyCont()->Lower();
101 for ( i = 0; pTmp; pTmp = pTmp->
GetNext(), ++i )
103 return i == nCount ?
static_cast<SwLayoutFrame*
>(pCol) :
nullptr;
127 for ( nAdd = 1; pCol; pCol = pCol->
GetNext(), ++nAdd )
131 if (
nullptr != (pNeighbourCol =
lcl_FindColumns( pNeighbour, nCount+nAdd )) &&
132 pNeighbourCol != pCont )
134 pNeighbourCol =
nullptr;
135 pNeighbour = aIter.
Next();
150 for ( sal_uInt16
i = 0;
i < nCount; ++
i )
164 for ( sal_uInt16
i = 0;
i < nCount; ++
i )
169 pTmp->
Paste( pCont );
189 const bool bChgFootnote )
201 sal_uInt16 nNewNum, nOldNum = 1;
205 while(
nullptr != (pCol=pCol->
GetNext()) )
218 bool bAdjustAttributes = nOldNum != rOld.
GetNumCols();
222 if( nOldNum != nNewNum || bChgFootnote )
225 OSL_ENSURE( pDoc,
"FrameFormat doesn't return a document." );
233 if ( nNewNum == 1 && !bAtEnd )
253 if ( nOldNum > nNewNum )
256 bAdjustAttributes =
true;
258 else if( nOldNum < nNewNum )
260 sal_uInt16 nAdd = nNewNum - nOldNum;
265 if ( !bAdjustAttributes )
270 bAdjustAttributes =
true;
274 for (
size_t i = 0;
i < nCount; ++
i )
277 bAdjustAttributes =
true;
291 static_cast<SwLayoutFrame*>(
Lower())->
Lower() &&
315 if ( !bAdjustAttributes )
321 nAvail -= (pCol->getFrameArea().*fnRect->
fnGetWidth)();
331 const sal_uInt16 nMin = bLine ? sal_uInt16( 20 + ( pAttr->
GetLineWidth() / 2) ) : 0;
342 for ( sal_uInt16
i = 0;
i < pAttr->
GetNumCols() && pCol; ++
i )
350 const Size aColSz = bVert ?
366 if ( bOrtho || bAdjustAttributes )
376 const sal_uInt16 nLeft = pC->
GetLeft();
377 const sal_uInt16 nRight = pC->
GetRight();
379 aLR.SetLeft ( nLeft );
380 aLR.SetRight( nRight );
386 aLR.SetRight( std::max( nRight, nMin ) );
390 aLR.SetLeft ( std::max( nLeft, nMin ) );
394 aLR.SetLeft ( std::max( nLeft, nMin ) );
395 aLR.SetRight( std::max( nRight, nMin ) );
399 if ( bAdjustAttributes )
409 nGutter += aLR.GetLeft() + aLR.GetRight();
428 nWidth = nInnerWidth + aLR.
GetLeft() + aLR.GetRight();
433 const Size aColSz = bVert ?
void InsertBefore(SwLayoutFrame *pParent, SwFrame *pBehind)
Insert SwFrame into existing structure.
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Base class of the Writer layout elements.
const SvxLRSpaceItem & GetLRSpace(bool=true) const
void Add(SwClient *pDepend)
void RemoveFootnotes(SwPageFrame *pPage=nullptr, bool bPageOnly=false, bool bEndNotes=false)
Remove all footnotes (but no references)
virtual const SwRootFrame * GetCurrentLayout() const =0
const SwRect & getFramePrintArea() const
SwFrameFormat * MakeFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom, bool bBroadcast=false, bool bAuto=true)
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr) override
static void lcl_RemoveColumns(SwLayoutFrame *pCont, sal_uInt16 nCnt)
static void DestroyFrame(SwFrame *const pFrame)
this is the only way to delete a SwFrame instance
IDocumentUndoRedo & GetIDocumentUndoRedo()
friend SwFrame * SaveContent(SwLayoutFrame *, SwFrame *)
virtual Size ChgSize(const Size &aNewSize)
bool IsPageBodyFrame() const
virtual void DestroyImpl() override
bool HasOnlyOneListener() const
const SwAttrSet * GetAttrSet() const
WARNING: this may not return correct RES_PAGEDESC/RES_BREAK items for SwTextFrame, use GetBreakItem()/GetPageDescItem() instead.
bool IsColumnFrame() const
SwRectFn fnRectVertL2RB2T
static SwLayoutFrame * lcl_FindColumns(SwLayoutFrame *pLay, sal_uInt16 nCount)
const SwFrame * GetLastLower() const
void SetFrameFormat(SwFrameFormat *)
virtual bool IsModified() const =0
Changes of document?
SwPageFrame * FindPageFrame()
virtual void Cut() override
SwColumnFrame(SwFrameFormat *, SwFrame *)
const SwFrame * Lower() const
void ChgColumns(const SwFormatCol &rOld, const SwFormatCol &rNew, const bool bChgFootnote=false)
add or remove columns from a layoutframe.
tools::Long GetLeft() const
SwLayoutFrame * GetUpper()
const SwFrameFormat * GetColumnContFormat() const
IDocumentState const & getIDocumentState() const
friend void RestoreContent(SwFrame *, SwLayoutFrame *, SwFrame *pSibling)
static bool lcl_AddColumns(SwLayoutFrame *pCont, sal_uInt16 nCount)
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
const SwFrameFormat * GetDfltFrameFormat() const
void sw_RemoveFootnotes(SwFootnoteBossFrame *pBoss, bool bPageOnly, bool bEndNotes)
remove all footnotes (not the references) and all footnote pages
bool IsLayoutFrame() const
const SvxULSpaceItem & GetULSpace(bool=true) const
sal_uInt16 GetRight() const
void InsertBehind(SwLayoutFrame *pParent, SwFrame *pBefore)
Insert SwFrame into existing structure.
bool IsNoTextFrame() const
bool IsRightToLeft() const
sal_uInt16 GetLeft() const
void DelFrameFormat(SwFrameFormat *pFormat, bool bBroadcast=false)
void AdjustColumns(const SwFormatCol *pCol, bool bAdjustAttributes)
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
virtual void DestroyImpl() override
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
virtual ~SwColumnFrame() override
Container of body content (i.e.
virtual const SwFrameFormat * GetFormat() const
virtual void ResetModified()=0