25#include <osl/diagnose.h>
38 const SvxBorderLine* pBrd = pItem->GetLeft();
92 pPara->push_back(
const_cast<SwTableBox*
>(pBox) );
97 const SvxBorderLine& rBrdLn,
size_t& rStt,
bool bTop )
99 sal_uInt16
nPos, nLastPos = 0;
100 for(
size_t nEnd = rCollTLB.
Count(); rStt < nEnd; ++rStt )
102 const SvxBorderLine* pBrd;
109 if( !pBrd || *pBrd != rBrdLn )
127 size_t& rStt,
bool bTop,
128 const SvxBorderLine& rLine,
135 const SvxBorderLine* pLn = &rLine;
138 if( pLn && *pLn == rLine )
142 aBox.
SetLine(
nullptr, SvxBoxItemLine::TOP );
144 aBox.
SetLine(
nullptr, SvxBoxItemLine::BOTTOM );
147 pShareFormats->
SetAttr( *pBox, aBox );
152 if( ++rStt >= rCollTLB.
Count() )
156 if( nNextPos > nEndPos )
171 const SvxBorderLine* pBrd;
173 for( SwTableBoxes::size_type
n = 0, nBoxes = rBoxes.size() - 1;
n < nBoxes; ++
n )
179 aBoxes.insert( aBoxes.begin(), pBox );
184 for( SwTableBoxes::size_type
i = aBoxes.size();
i; )
189 pBrd = pItem->GetRight();
198 aBox.
SetLine(
nullptr, SvxBoxItemLine::RIGHT );
224 sal_uInt16 nBtmPos, nTopPos;
228 const size_t nEndBtm {aBottom.
Count()};
229 const size_t nEndTop {aTop.
Count()};
233 const SvxBoxItem *pBtmItem =
nullptr, *pTopItem =
nullptr;
234 const SvxBorderLine *pBtmLine(
nullptr), *pTopLine(
nullptr);
235 bool bGetTopItem =
true, bGetBtmItem =
true;
243 if( pTopLine && pBtmLine && *pTopLine == *pBtmLine )
246 const size_t nSavSttBtm {nSttBtm};
247 const size_t nSavSttTop {nSttTop};
249 *pTopLine, nSttBtm,
false );
250 if( !nBtmEndPos ) nBtmEndPos = nBtmPos;
252 *pTopLine, nSttTop,
true );
253 if( !nTopEndPos ) nTopEndPos = nTopPos;
255 if( nTopEndPos <= nBtmEndPos )
258 nSttTop = nSavSttTop;
259 if( nTopPos <= nBtmEndPos )
261 *pBtmLine, pTopItem, nBtmEndPos,
264 nSttBtm = nSavSttBtm;
269 nSttBtm = nSavSttBtm;
270 if( nBtmPos <= nTopEndPos )
272 *pTopLine, pBtmItem, nTopEndPos,
275 nSttTop = nSavSttTop;
280 if( nTopPos == nBtmPos )
282 if( nSttBtm >= nEndBtm || nSttTop >= nEndTop )
285 pBtmBox = &aBottom.
GetBox( nSttBtm++, &nBtmPos );
286 pTopBox = &aTop.
GetBox( nSttTop++, &nTopPos );
287 bGetTopItem = bGetBtmItem =
true;
289 else if( nTopPos < nBtmPos )
291 if( nSttTop >= nEndTop )
293 pTopBox = &aTop.
GetBox( nSttTop++, &nTopPos );
299 if( nSttBtm >= nEndBtm )
301 pBtmBox = &aBottom.
GetBox( nSttBtm++, &nBtmPos );
333 GCLinePara(
SwTableLines& rLns, GCLinePara* pPara =
nullptr )
334 : pLns( &rLns ), pShareFormats( pPara ? pPara->pShareFormats : nullptr )
347 GCLinePara aPara( pTableBox->
GetTabLines(), pPara );
358 SwTableBoxes::iterator it = std::find( pInsLine->
GetTabBoxes().begin(), pInsLine->
GetTabBoxes().end(), pTableBox );
360 pTabBox->SetUpper( pInsLine );
368 if (pBox->GetFrameFormat()->GetItemState(
RES_BACKGROUND) != SfxItemState::SET)
370 pBox->ClaimFrameFormat();
371 pBox->GetFrameFormat()->SetFormatAttr(*pRowBrush);
392 SwTableBoxes::size_type nBoxes = pLn->
GetTabBoxes().size();
410 sal_uInt16 nInsPos = rLns.
GetPos( pLn );
411 OSL_ENSURE( USHRT_MAX != nInsPos,
"Could not find Line!" );
425 for(
auto pBoxLine : rBoxLns )
426 if( SfxItemState::SET != pBoxLine->GetFrameFormat()->
428 pGCPara->pShareFormats->SetAttr( *pBoxLine, *pItem );
437 rLns[ nInsPos++ ]->SetUpper( pUpper );
444 for( SwTableBoxes::size_type nLen = 0; nLen < pLn->
GetTabBoxes().
size(); ++nLen )
457 aPara.pShareFormats = &aShareFormats;
const editeng::SvxBorderLine * GetTop() const
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
const editeng::SvxBorderLine * GetBottom() const
Class for SplitTable Collects the uppermost or lowermost Lines of a Box from a Line in an array.
const SwTableBox & GetBox(std::size_t nPos, sal_uInt16 *pWidth=nullptr) const
bool CheckLeftBorderOfFormat(const SwFrameFormat &rFormat)
Check whether the left Border is the same as the set one.
bool IsAnyBorderFound() const
const editeng::SvxBorderLine * m_pBorderLine
void SetBorder(const editeng::SvxBorderLine &rBorderLine)
SwTableBox is one table cell in the document model.
SwFrameFormat * GetFrameFormat()
SwTableLines & GetTabLines()
const SwStartNode * GetSttNd() const
SwFrameFormat * ClaimFrameFormat()
SwTableLine is one table row in the document model.
SwFrameFormat * GetFrameFormat()
SwTableBoxes & GetTabBoxes()
iterator erase(iterator aIt)
iterator insert(iterator aIt, SwTableLine *pLine)
std::vector< SwTableLine * >::size_type size_type
sal_uInt16 GetPos(const SwTableLine *pBox) const
SwTableLines & GetTabLines()
void sw_GC_Line_Border(const SwTableLine *pLine, SwGCLineBorder *pGCPara)
static bool lcl_MergeGCBox(SwTableBox *pTableBox, GCLinePara *pPara)
static bool lcl_MergeGCLine(SwTableLine *pLine, GCLinePara *pPara)
static bool lcl_GCBorder_ChkBoxBrd_B(const SwTableBox *pBox, SwGCBorder_BoxBrd *pPara)
static const SvxBorderLine * lcl_GCBorder_GetBorder(const SwTableBox &rBox, bool bTop, const SvxBoxItem **ppItem)
static void lcl_GCBorder_GetLastBox_B(const SwTableBox *pBox, SwTableBoxes *pPara)
static bool lcl_GCBorder_ChkBoxBrd_L(const SwTableLine *pLine, SwGCBorder_BoxBrd *pPara)
static const SvxBorderLine * GetLineTB(const SvxBoxItem *pBox, bool bTop)
static void lcl_GC_Box_Border(const SwTableBox *pBox, SwGCLineBorder *pPara)
static sal_uInt16 lcl_FindEndPosOfBorder(const SwCollectTableLineBoxes &rCollTLB, const SvxBorderLine &rBrdLn, size_t &rStt, bool bTop)
static void lcl_GCBorder_GetLastBox_L(const SwTableLine *pLine, SwTableBoxes *pPara)
static void lcl_GCBorder_DelBorder(const SwCollectTableLineBoxes &rCollTLB, size_t &rStt, bool bTop, const SvxBorderLine &rLine, const SvxBoxItem *pItem, sal_uInt16 nEndPos, SwShareBoxFormats *pShareFormats)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(111)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
bool sw_Line_CollectBox(const SwTableLine *&rpLine, void *pPara)
const SwTableLines * pLines
SwShareBoxFormats * pShareFormats
std::vector< SwTableBox * > SwTableBoxes