22#include <osl/diagnose.h>
63#undef DEL_ONLY_EMPTY_LINES
64#undef DEL_EMPTY_BOXES_AT_START_AND_END
76 bool operator<(
const CmpLPt& rCmp )
const
79 return X() > rCmp.X() || (
X() == rCmp.X() &&
Y() < rCmp.Y() );
81 return Y() < rCmp.Y() || (
Y() == rCmp.Y() &&
X() < rCmp.X() );
98 explicit Sort_CellFrame(
const SwCellFrame& rCFrame )
99 : pFrame( &rCFrame ) {}
164 "Tabselection not on Cnt." );
194 OSL_ENSURE( pMarkBox,
"Point in table, mark outside?" );
197 sal_uInt16 nSttPos = rLines.
GetPos( pLine );
198 OSL_ENSURE( USHRT_MAX != nSttPos,
"Where is my row in the table?" );
200 sal_uInt16 nEndPos = rLines.
GetPos( pLine );
201 OSL_ENSURE( USHRT_MAX != nEndPos,
"Where is my row in the table?" );
203 if ( nSttPos != USHRT_MAX && nEndPos != USHRT_MAX )
205 if( nEndPos < nSttPos )
206 std::swap( nSttPos, nEndPos );
209 for( ; nSttPos <= nEndPos; ++nSttPos )
211 pLine = rLines[ nSttPos ];
216 if( !bChkProtected ||
225 Point aPtPos, aMkPos;
233 std::pair<Point, bool> tmp(aPtPos,
true);
241 GetTableSel( pStart, pEnd, rBoxes,
nullptr, eSearchType );
252 OSL_FAIL(
"GetTableSel without start table" );
262 bool bTableIsValid =
true;
271 Point aCurrentBottomRight( 0, 0 );
273 const SwCellFrame* pCurrentTopRightFrame =
nullptr;
274 const SwCellFrame* pCurrentBottomLeftFrame =
nullptr;
275 const SwCellFrame* pCurrentBottomRightFrame =
nullptr;
278 for (
size_t i = 0;
i < aUnions.size() && bTableIsValid; ++
i)
285 bTableIsValid =
false;
294 while( pRow && bTableIsValid )
298 bTableIsValid =
false;
310 bTableIsValid =
false;
314 OSL_ENSURE( pCell->
IsCellFrame(),
"Frame without Cell" );
318 static_cast<const SwCellFrame*
>(pCell)->GetTabBox());
320 if( !bChkProtected ||
331 if ( aTopLeft.
getY() < aCurrentTopLeft.
getY() ||
332 ( aTopLeft.
getY() == aCurrentTopLeft.
getY() &&
333 aTopLeft.
getX() < aCurrentTopLeft.
getX() ) )
335 aCurrentTopLeft = aTopLeft;
336 pCurrentTopLeftFrame =
static_cast<const SwCellFrame*
>( pCell );
339 if ( aTopRight.
getY() < aCurrentTopRight.
getY() ||
340 ( aTopRight.
getY() == aCurrentTopRight.
getY() &&
341 aTopRight.
getX() > aCurrentTopRight.
getX() ) )
343 aCurrentTopRight = aTopRight;
344 pCurrentTopRightFrame =
static_cast<const SwCellFrame*
>( pCell );
347 if ( aBottomLeft.
getY() > aCurrentBottomLeft.
getY() ||
348 ( aBottomLeft.
getY() == aCurrentBottomLeft.
getY() &&
349 aBottomLeft.
getX() < aCurrentBottomLeft.
getX() ) )
351 aCurrentBottomLeft = aBottomLeft;
352 pCurrentBottomLeftFrame =
static_cast<const SwCellFrame*
>( pCell );
355 if ( aBottomRight.
getY() > aCurrentBottomRight.
getY() ||
356 ( aBottomRight.
getY() == aCurrentBottomRight.
getY() &&
357 aBottomRight.
getX() > aCurrentBottomRight.
getX() ) )
359 aCurrentBottomRight = aBottomRight;
360 pCurrentBottomRightFrame =
static_cast<const SwCellFrame*
>( pCell );
382 pCells->push_back(
const_cast< SwCellFrame*
>(pCurrentTopLeftFrame) );
383 pCells->push_back(
const_cast< SwCellFrame*
>(pCurrentTopRightFrame) );
384 pCells->push_back(
const_cast< SwCellFrame*
>(pCurrentBottomLeftFrame) );
385 pCells->push_back(
const_cast< SwCellFrame*
>(pCurrentBottomRightFrame) );
407 if(
nullptr == pTable )
415 OSL_FAIL(
"Current box has been deleted during GetTableSel()" );
423 OSL_ENSURE( nLoopMax,
"Table layout is still invalid!" );
447 std::pair<Point, bool> tmp(aNullPos,
true);
451 OSL_ENSURE( pStart,
"without frame nothing works" );
467 OSL_ENSURE( pEnd,
"without frame nothing works" );
474 bool bTableIsValid =
true;
475 bValidChartSel =
true;
477 sal_uInt16 nRowCells = USHRT_MAX;
484 for(
auto & rSelUnion : aUnions )
486 if (!bTableIsValid || !bValidChartSel)
497 bTableIsValid =
false;
501 std::deque< Sort_CellFrame > aCellFrames;
508 while( pRow && bTableIsValid && bValidChartSel )
512 bTableIsValid =
false;
524 bTableIsValid =
false;
528 OSL_ENSURE( pCell->
IsCellFrame(),
"Frame without Cell" );
534 const tools::Long nFrameRight = rFrameRect.Right();
535 const tools::Long nFrameBottom = rFrameRect.Bottom();
542 if( !( rUnion.
Top() + nYFuzzy > nFrameBottom ||
543 nUnionBottom < rFrameRect.Top() + nYFuzzy ||
544 rUnion.
Left() + nXFuzzy > nFrameRight ||
545 nUnionRight < rFrameRect.Left() + nXFuzzy ))
551 if( rUnion.
Left() <= rFrameRect.Left() + nXFuzzy &&
552 rFrameRect.Left() <= nUnionRight &&
553 rUnion.
Left() <= nFrameRight &&
554 nFrameRight <= nUnionRight + nXFuzzy &&
555 rUnion.
Top() <= rFrameRect.Top() + nYFuzzy &&
556 rFrameRect.Top() <= nUnionBottom &&
557 rUnion.
Top() <= nFrameBottom &&
558 nFrameBottom <= nUnionBottom+ nYFuzzy )
560 aCellFrames.emplace_back( *
static_cast<const SwCellFrame*
>(pCell) );
563 bValidChartSel =
false;
580 if( !bValidChartSel )
586 sal_uInt16 nCellCnt = 0;
591 for(
n = 0 ;
n < aCellFrames.size(); ++
n )
593 const Sort_CellFrame& rCF = aCellFrames[
n ];
594 if( aRectFnSet.
GetTop(rCF.pFrame->getFrameArea()) != nYPos )
599 if( USHRT_MAX == nRowCells )
600 nRowCells = nCellCnt;
601 else if( nRowCells != nCellCnt )
603 bValidChartSel =
false;
608 nYPos = aRectFnSet.
GetTop(rCF.pFrame->getFrameArea());
609 nHeight = aRectFnSet.
GetHeight(rCF.pFrame->getFrameArea());
612 aRectFnSet.
GetLeft(rCF.pFrame->getFrameArea()) :
613 aRectFnSet.
GetRight(rCF.pFrame->getFrameArea());
615 else if( nXPos == ( bRTL ?
616 aRectFnSet.
GetRight(rCF.pFrame->getFrameArea()) :
617 aRectFnSet.
GetLeft(rCF.pFrame->getFrameArea()) ) &&
618 nHeight == aRectFnSet.
GetHeight(rCF.pFrame->getFrameArea()) )
620 nXPos += ( bRTL ? -1 : 1 ) *
621 aRectFnSet.
GetWidth(rCF.pFrame->getFrameArea());
626 bValidChartSel =
false;
632 if( USHRT_MAX == nRowCells )
633 nRowCells = nCellCnt;
634 else if( nRowCells != nCellCnt )
635 bValidChartSel =
false;
645 for( SwSelUnions::size_type
i = 0;
i < aUnions.size(); ++
i )
657 if(
nullptr == pTable )
663 OSL_ENSURE( nLoopMax,
"table layout is still invalid!" );
665 return bValidChartSel;
670 OSL_ENSURE( pCell->
IsCellFrame(),
"Frame without Gazelle" );
697 std::pair<Point, bool> tmp(pCursor->
GetPtPos(),
true);
714 bool bTstRow =
true, bFound =
false;
717 for( SwSelUnions::size_type
i = 0;
i < aUnions.size(); ++
i )
734 while( pCell && pRow->
IsAnLower( pCell ) )
736 if( pCell == pSttCell )
738 sal_uInt16 nWhichId = 0;
739 for(
size_t n = rBoxes.size();
n; )
742 if( USHRT_MAX != nWhichId )
748 bTstRow = 0 == nWhichId || USHRT_MAX == nWhichId;
753 OSL_ENSURE( pCell->
IsCellFrame(),
"Frame without cell" );
755 pUpperCell =
static_cast<const SwCellFrame*
>(pCell);
768 rBoxes.push_back(
const_cast< SwCellFrame*
>(pUpperCell) );
788 for( SwSelUnions::size_type
i = 0;
i < aUnions.size(); ++
i )
804 while( pCell && pRow->
IsAnLower( pCell ) )
806 if( pCell == pSttCell )
808 sal_uInt16 nWhichId = 0;
809 for(
size_t n = rBoxes.size();
n; )
811 nWhichId = rBoxes[ --
n ]
813 if( USHRT_MAX != nWhichId )
819 bFound = 0 != nWhichId && USHRT_MAX != nWhichId;
824 OSL_ENSURE( pCell->
IsCellFrame(),
"Frame without cell" );
828 rBoxes.push_back( pC );
857 for (
size_t n = 0;
n < rBoxes.
size(); ++
n)
859 if( rBoxes[
n ]->GetFrameFormat()->GetProtect().IsContentProtected() )
868CmpLPt::CmpLPt(
const Point& rPt,
const SwTableBox* pBox,
bool bVertical )
869 : aPos( rPt ), pSelBox( pBox ), bVert( bVertical )
873 sal_uInt16 nInsPos, sal_uInt16 nCnt = 1 )
875 OSL_ENSURE( pBox->
GetSttNd(),
"Box without Start-Node" );
909 for(
auto pFormat : rFormats )
914 ((RndStdIds::FLY_AT_PARA == rAnchor.
GetAnchorId()) ||
915 (RndStdIds::FLY_AT_CHAR == rAnchor.
GetAnchorId())) &&
916 nSttIdx <= ( nIdx = pAnchorNode->
GetIndex() ) &&
933 "Tabselection not on Cnt." );
941 std::pair<Point, bool>
const tmp(aPt,
true);
953 if( aUnions.empty() )
956 const SwTable *pTable = aUnions.front().GetTable()->GetTable();
959 GetSttNd()->FindTableNode());
967 for (
auto & rSelUnion : aUnions )
984 while ( pCell && pRow->
IsAnLower( pCell ) )
986 OSL_ENSURE( pCell->
IsCellFrame(),
"Frame without cell" );
1005 nWidth = nWidth * aNew.
GetWidth() /
1015 pBox, aRectFnSet.
IsVert() ) );
1032 pBox, aRectFnSet.
IsVert() ) );
1048 nRight = nRight * aNew.
GetWidth() /
1050 nWidth = aNew.
GetWidth() - nLeft - nRight;
1059 aBox.
SetLine(
nullptr, SvxBoxItemLine::RIGHT );
1076 pBox, aRectFnSet.
IsVert() ) );
1101 nRight = nRight * aNew.
GetWidth() /
1138 if( 1 >= rBoxes.
size() )
1148 bool bCalcWidth =
true;
1149 const SwTableBox* pFirstBox = aPosArr[ 0 ].pSelBox;
1157#if defined( DEL_ONLY_EMPTY_LINES )
1160 sal_uInt16
n, nSttPos = 0;
1162 for(
n = 0;
n < aPosArr.Count(); ++
n )
1164 const CmpLPt& rPt = aPosArr[
n ];
1165 if(
n && aPosArr[
n - 1 ].
Y() == rPt.Y() )
1167 if( bEmptyLine && !
IsEmptyBox( *rPt.pSelBox, aPam ))
1170 nWidth += rPt.pSelBox->GetFrameFormat()->GetFrameSize().GetWidth();
1174 if( bCalcWidth &&
n )
1177 if( bEmptyLine && nSttPos <
n )
1182 for( sal_uInt16
i = nSttPos;
i <
n; ++
i )
1185 aPosArr.Remove( nSttPos,
n - nSttPos );
1191 bEmptyLine =
IsEmptyBox( *aPosArr[
n].pSelBox, aPam );
1194 if( bEmptyLine && nSttPos <
n )
1197 for( sal_uInt16
i = nSttPos;
i <
n; ++
i )
1199 aPosArr.Remove( nSttPos,
n - nSttPos );
1201#elif defined( DEL_EMPTY_BOXES_AT_START_AND_END )
1204 sal_uInt16
n, nSttPos = 0, nSEndPos = 0, nESttPos = 0;
1206 for(
n = 0;
n < aPosArr.Count(); ++
n )
1208 const CmpLPt& rPt = aPosArr[
n ];
1209 if(
n && aPosArr[
n - 1 ].
Y() == rPt.Y() )
1211 bool bEmptyBox =
IsEmptyBox( *rPt.pSelBox, aPam );
1215 nESttPos = ++nSEndPos;
1221 nWidth += rPt.pSelBox->GetFrameFormat()->GetFrameSize().GetWidth();
1225 if( bCalcWidth &&
n )
1229 if( nSttPos < nSEndPos )
1234 for( sal_uInt16
i = nSttPos;
i < nSEndPos; ++
i )
1237 sal_uInt16 nCnt = nSEndPos - nSttPos;
1238 aPosArr.Remove( nSttPos, nCnt );
1248 for( sal_uInt16
i = nESttPos;
i <
n; ++
i )
1251 sal_uInt16 nCnt =
n - nESttPos;
1252 aPosArr.Remove( nESttPos, nCnt );
1256 nSttPos = nSEndPos = nESttPos =
n;
1265 if( nSttPos < nSEndPos )
1270 for( sal_uInt16
i = nSttPos;
i < nSEndPos; ++
i )
1273 sal_uInt16 nCnt = nSEndPos - nSttPos;
1274 aPosArr.Remove( nSttPos, nCnt );
1283 for( sal_uInt16
i = nESttPos;
i <
n; ++
i )
1286 sal_uInt16 nCnt =
n - nESttPos;
1287 aPosArr.Remove( nESttPos, nCnt );
1296 aPosArr[ 0 ].Y() ) :
1301 const CmpLPt& rPt = aPosArr[
n ];
1304 if( nY == ( aRectFnSet.
IsVert() ? rPt.X() : rPt.Y() ) )
1305 nWidth += rPt.pSelBox->GetFrameFormat()->GetFrameSize().GetWidth();
1326 sal_uInt16 nInsPos = pInsLine->
GetBoxPos( pTmpBox );
1329 (*ppMergeBox) = pInsLine->
GetTabBoxes()[ nInsPos ];
1331 (*ppMergeBox)->SetUpper(
nullptr );
1332 (*ppMergeBox)->ClaimFrameFormat();
1336 if( pLastBox && pFirstBox )
1344 (*ppMergeBox)->GetFrameFormat()->SetFormatAttr( aBox );
1349 if( !aPosArr.
empty() )
1351 SwPosition aInsPos( *(*ppMergeBox)->GetSttNd() );
1353 SwPaM aPam( aInsPos );
1355 for(
const auto &rPt : aPosArr )
1363 SwNodeIndex aSttNdIdx( *rPt.pSelBox->GetSttNd(), 1 );
1399 OSL_ENSURE( (*ppMergeBox)->GetSttIdx()+2 <
1400 (*ppMergeBox)->GetSttNd()->EndOfSectionIndex(),
1402 SwNodeIndex aIdx( *(*ppMergeBox)->GetSttNd()->EndOfSectionNode(), -1 );
1409 pUndo->
AddNewBox( (*ppMergeBox)->GetSttIdx() );
1416 for (
auto const& it : rFndLine.
GetBoxes())
1434 for (
auto const& rpFndLine : rFndBox.
GetLines())
1455 std::pair<Point, bool> tmp(aPt,
true);
1470 if( !rBoxes.
empty() )
1474 FndBox_ aFndBox(
nullptr,
nullptr );
1475 FndPara aPara( rBoxes, &aFndBox );
1480 bool bMergeSelOk =
true;
1483 while( pFndBox && 1 == pFndBox->
GetLines().size() )
1485 pFndLine = pFndBox->
GetLines().front().get();
1486 if( 1 == pFndLine->
GetBoxes().size() )
1487 pFndBox = pFndLine->
GetBoxes().front().get();
1493 for (
auto const& it : pFndBox->
GetLines())
1500 for (
auto const& it : pFndLine->
GetBoxes())
1533 nRet += ( bRTL ? -1 : 1 ) * nTmp * nAct / nWish;
1544 const bool bChkProtected )
1552 std::deque<const SwLayoutFrame *> aSttArr, aEndArr;
1557 aSttArr.push_front( pTmp );
1562 aEndArr.push_front( pTmp );
1565 for( std::deque<const SwLayoutFrame *>::size_type
n = 0;
n < aEndArr.size() &&
n < aSttArr.size(); ++
n )
1566 if( aSttArr[
n ] != aEndArr[
n ] )
1571 rpStart = aSttArr[
n ];
1572 rpEnd = aEndArr[
n ];
1579 rpStart = aSttArr[
n+1 ];
1580 rpEnd = aEndArr[
n+1 ];
1585 GetTabBox()->GetTabLines();
1586 if( rLns[ 0 ] ==
static_cast<const SwRowFrame*
>(aSttArr[
n ])->GetTabLine() &&
1587 rLns[ rLns.
size() - 1 ] ==
1590 rpStart = rpEnd = pCellFrame;
1601 if( !bChkProtected )
1613 const bool bChkProtected )
1627 const tools::Long nWish = ( nTmpWish > 0 ) ? nTmpWish : 1;
1629 while ( pTab->IsFollow() )
1632 OSL_ENSURE( pTmp->
IsTabFrame(),
"Predecessor of Follow is not Master." );
1678 if ( pTmpRow && pTmpRow->
GetNext() )
1679 pLastValidTab = pTab;
1682 pLastValidTab = pTab = pTab->
GetFollow();
1684 pTab = pLastValidTab;
1699 rpEnd = pLastContent ? pLastContent->
GetUpper() :
nullptr;
1702 if ( !pLastContent )
return;
1711 if( !pTmpLeaf || !pTab->
IsAnLower( pTmpLeaf ) )
1716 if( !bChkProtected )
1750 if ( !pTmpLeaf || !pTmpTab->
IsAnLower( pTmpLeaf ) )
1753 OSL_ENSURE( pTmpTab->
IsTabFrame(),
"Predecessor of Follow not Master.");
1773 if ( !pStart || !pEnd )
1775 OSL_FAIL(
"MakeSelUnions with pStart or pEnd not in CellFrame" );
1781 if( !pTable || !pEndTable )
1783 bool bExchange =
false;
1785 if ( pTable != pEndTable )
1787 if ( !pTable->IsAnFollow( pEndTable ) )
1789 OSL_ENSURE( pEndTable->IsAnFollow( pTable ),
"Tabchain in knots." );
1798 if( nSttTop == nEndTop )
1804 else if( aRectFnSet.
IsVert() == ( nSttTop < nEndTop ) )
1823 if ( !pEnd || !pStart )
return;
1841 nEd1 +=
static_cast<tools::Long>((nEdSz * nPrtWidth) / nWish) - 1;
1843 nSt1 +=
static_cast<tools::Long>((nStSz * nPrtWidth) / nWish) - 1;
1857 std::swap( nSt1, nEd1 );
1859 std::swap( nSt2, nEd2 );
1860 if( aRectFnSet.
IsVert() )
1862 aSt =
Point( nSt2, nSt1 );
1863 aEd =
Point( nEd2, nEd1 );
1867 aSt =
Point( nSt1, nSt2 );
1868 aEd =
Point( nEd1, nEd2 );
1871 const Point aDiff( aEd - aSt );
1892 const SwFrame* pTmpCell =
nullptr;
1895 const SwFrame* pTmpRow = pRow;
1901 OSL_ENSURE( !pTmpCell || pTmpCell->
IsCellFrame(),
"Lower of rowframe != cellframe?!" );
1929 if ( pFirst && pLast )
1940 rUnions.emplace_back(aUnion,
const_cast<SwTabFrame*
>(pTable));
1944 if ( pTable != pEndTable && pEndTable->IsAnFollow( pTable ) )
1964 sal_uInt16 nMinValue = nDiv *
MINLAY;
1967 Point aPtPos, aMkPos;
1976 std::pair<Point, bool> tmp(aPtPos,
true);
1994 for (
const auto& rSelUnion : aUnions )
2009 while ( pCell && pRow->
IsAnLower( pCell ) )
2011 OSL_ENSURE( pCell->
IsCellFrame(),
"Frame without cell" );
2046 if ( pSibling && pTabFrame->
IsInHeadline( *pSibling ) )
2052 pRow->
Paste( pUpper, pSibling );
2058 std::unique_ptr<FndBox_> pFndBox(
new FndBox_( pBox, pFndPara->
pFndLine ));
2061 FndPara aPara( *pFndPara, pFndBox.get() );
2063 if( pFndBox->GetLines().empty() )
2080 std::unique_ptr<FndLine_> pFndLine(
new FndLine_(pLine, pFndPara->
pFndBox));
2081 FndPara aPara(*pFndPara, pFndLine.get());
2082 for(
auto& rpBox : pFndLine->GetLine()->GetTabBoxes() )
2084 if( !pFndLine->GetBoxes().empty() )
2104 sal_uInt16 nStPos = USHRT_MAX;
2105 sal_uInt16 nEndPos= 0;
2107 for (
size_t i = 0;
i < rBoxes.
size(); ++
i)
2115 OSL_ENSURE(
nPos != USHRT_MAX,
"TableLine not found." );
2120 if( nEndPos <
nPos )
2123 if (USHRT_MAX != nStPos && nStPos > 1)
2142 OSL_ENSURE( USHRT_MAX !=
nPos,
"Line is not in table" );
2146 pTmpLine =
GetLines().back()->GetLine();
2148 OSL_ENSURE( USHRT_MAX !=
nPos,
"Line is not in the table" );
2155 pTab->m_pPrecede =
nullptr;
2166 sal_uInt16 nStPos = 0;
2174 OSL_ENSURE( nStPos != USHRT_MAX,
"The fox stole the line!" );
2183 OSL_ENSURE( nEndPos != USHRT_MAX,
"The fox stole the line!" );
2188 for ( sal_uInt16
i = nStPos;
i <= nEndPos; ++
i)
2198 static_cast<SwTabFrame*
>(pFrame->GetUpper()) :
nullptr;
2201 const sal_uInt16 nRepeat =
2202 static_cast<SwTabFrame*
>(pFrame->GetUpper())->GetTable()->GetRowsToRepeat();
2204 static_cast<SwTabFrame*
>(pFrame->GetUpper())->IsFollow() )
2206 if ( !pFrame->GetNext() )
2209 static_cast<SwTabFrame*
>(pFrame->GetUpper())->GetFirstNonHeadlineRow();
2210 if ( pFirstNonHeadline == pFrame )
2212 pUp =
static_cast<SwTabFrame*
>(pFrame->GetUpper());
2220 SwTabFrame *pPrev = pUp->IsFollow() ? pUp :
nullptr;
2225 "Predecessor of Follow is no Master.");
2230 pPrev->SetFollow( pFollow );
2241 if ( pPrev || pFollow )
2247 bool bOldSectLock =
false;
2254 if ( pSctFrame && !bOldSectLock )
2267 !pFrame->GetNext() &&
2273 static_cast<SwTabFrame*
>(pTabFrame)->SetFollowFlowLine(
false );
2286 if( pTableFrame->IsFollow() )
2287 pTableFrame = pTableFrame->
FindMaster(
true );
2288 return &rTable == pTableFrame;
2293 OSL_ENSURE( rTabFrame.IsFollow(),
"lcl_UpdateRepeatedHeadlines called for non-follow tab" );
2307 for ( sal_uInt16 nIdx = 0; nIdx < nRepeat; ++nIdx )
2311 pHeadline->
Paste( &rTabFrame, pLower );
2323 sal_uInt16 nStPos = 0;
2333 OSL_ENSURE( nStPos != USHRT_MAX,
"Fox stole the line!" );
2341 OSL_ENSURE( nEndPos != USHRT_MAX,
"Fox stole the line!" );
2348 if ( !pTable->IsFollow() )
2351 SwFrame *pUpperFrame =
nullptr;
2354 i >= 0 && !pSibling; --
i )
2359 pSibling = aIter.
First();
2360 while ( pSibling && (
2369 pSibling = aIter.
Next();
2374 pUpperFrame = pSibling->
GetUpper();
2380 pUpperFrame = pTable;
2383 for ( sal_uInt16 j = nStPos; j <= nEndPos; ++j )
2386 if ( !bHideChanges || !pLine->
IsDeleted(nRedlinePos) )
2391 static_cast<SwTabFrame*
>(pUpperFrame)->SetCalcLowers();
2402 const bool bBehind )
2417 const sal_uInt16 nCnt =
2419 (nBfPos != USHRT_MAX ? nBfPos + 1 : 0)) / (nNumber + 1);
2424 for ( pTable = aTabIter.
First(); pTable; pTable = aTabIter.
Next() )
2426 if( !pTable->IsFollow() )
2435 pSibling = aIter.
First();
2436 while ( pSibling && (
2446 pSibling = aIter.
Next();
2450 pUpperFrame = pSibling->
GetUpper();
2455 pUpperFrame = pTable;
2457 const sal_uInt16 nMax = nBhPos != USHRT_MAX ?
2460 sal_uInt16
i = nBfPos != USHRT_MAX ? nBfPos + 1 + nCnt : nCnt;
2462 for ( ;
i < nMax; ++
i )
2465 static_cast<SwTabFrame*
>(pUpperFrame)->SetCalcLowers();
2473 for (
i = 0; !pSibling; ++
i )
2478 pSibling = aIter.
First();
2480 while ( pSibling && (
2496 pSibling = aIter.
Next();
2500 pUpperFrame = pSibling->
GetUpper();
2504 sal_uInt16 nMax = nBhPos != USHRT_MAX ?
2508 i = nBfPos != USHRT_MAX ? nBfPos + 1 : 0;
2509 for ( ;
i < nMax; ++
i )
2511 pUpperFrame, pSibling );
2521 if ( !(nRowsToRepeat > 0 &&
2522 ( ( !bBehind && ( nBfPos == USHRT_MAX || nBfPos + 1 < nRowsToRepeat ) ) ||
2523 ( bBehind && ( ( nBfPos == USHRT_MAX && nRowsToRepeat > 1 ) || nBfPos + 2 < nRowsToRepeat ) ) )) )
2526 for ( pTable = aTabIter.
First(); pTable; pTable = aTabIter.
Next() )
2528 if ( pTable->
Lower() )
2530 if ( pTable->IsFollow() )
2536 rTable.
GetTabLines()[0],
"MakeNewFrames: Table corruption!" );
2566 if ( nBfPos == nBhPos )
2568 OSL_FAIL(
"Table, erase but not on any area !?!" );
2578 if( pTable->IsFollow() )
2587 if ( nBfPos == USHRT_MAX && nBhPos == 0 )
2591 if ( nBhPos == USHRT_MAX && nBfPos == (rTable.
GetTabLines().
size() - 1) )
2595 if ( nBfPos != USHRT_MAX && nBhPos != USHRT_MAX && (nBfPos + 1) == nBhPos )
void SetTableLines(const SwSelBoxes &rBoxes, const SwTable &rTable)
SwTableLine * m_pLineBehind
For deleting/restoring the layout.
const FndLines_t & GetLines() const
SwTableLine * m_pLineBefore
For deleting/restoring the layout.
void MakeNewFrames(SwTable &rTable, const sal_uInt16 nNumber, const bool bBehind)
void MakeFrames(SwTable &rTable)
bool AreLinesToRestore(const SwTable &rTable) const
void DelFrames(SwTable &rTable)
const SwTableBox * GetBox() const
const FndBoxes_t & GetBoxes() const
virtual bool AppendTextNode(SwPosition &rPos)=0
virtual bool MoveNodeRange(SwNodeRange &, SwNode &, SwMoveFlags)=0
virtual const SwRootFrame * GetCurrentLayout() const =0
constexpr tools::Long Y() const
constexpr tools::Long X() const
constexpr tools::Long getX() const
constexpr tools::Long getY() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const editeng::SvxBorderLine * GetTop() const
const editeng::SvxBorderLine * GetRight() const
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
const editeng::SvxBorderLine * GetLeft() const
const editeng::SvxBorderLine * GetBottom() const
bool IsContentProtected() const
tools::Long GetWidth() const
void SetWidth(tools::Long n)
SwCellFrame is one table cell in the document layout.
const SwTableBox * GetTabBox() const
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
virtual sal_Int32 Len() const
const SwAttrSet * GetpSwAttrSet() const
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
const SwShellTableCursor * GetTableCursor() const
SwShellCursor * getShellCursor(bool bBlock)
Delivers the current shell cursor.
SwShellTableCursor * m_pTableCursor
table Cursor; only in tables when the selection lays over 2 columns
SwShellCursor * m_pCurrentCursor
current cursor
size_t UpdateTableSelBoxes()
helper class to check if a frame has been deleted during an operation WARNING! This should only be us...
bool HasBeenDeleted() const
return true if mpFrame != 0 and mpFrame is not client of pRegIn false otherwise
IDocumentContentOperations const & getIDocumentContentOperations() const
IDocumentUndoRedo & GetIDocumentUndoRedo()
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
const SwTextFormatColl * GetDfltTextFormatColl() const
const sw::FrameFormats< sw::SpzFrameFormat * > * GetSpzFrameFormats() const
const SwRect & getFrameArea() const
bool isFrameAreaDefinitionValid() const
const SwRect & getFramePrintArea() const
Base class of the Writer layout elements.
SwSectionFrame * FindSctFrame()
SwTabFrame * FindTabFrame()
SwFrameType GetType() const
virtual void Calc(vcl::RenderContext *pRenderContext) const
bool IsRightToLeft() const
const SwRowFrame * IsInFollowFlowRow() const
SwLayoutFrame * GetUpper()
const SwLayoutFrame * GetNextLayoutLeaf() const
SwRootFrame * getRootFrame()
void SetCompletePaint() const
const SwLayoutFrame * GetPrevLayoutLeaf() const
const SwRowFrame * IsInSplitTableRow() const
static void DestroyFrame(SwFrame *const pFrame)
this is the only way to delete a SwFrame instance
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
const SwCellFrame * FirstCell() const
Calls ContainsAny first to reach the innermost cell.
bool IsAnLower(const SwFrame *) const
virtual const SwFrameFormat * GetFormat() const
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr) override
const SwFrame * Lower() const
Marks a node in the document model.
const SwNodes & GetNodes() const
Base class of the Writer document model elements.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwNodeOffset GetIndex() const
SwNodeOffset StartOfSectionIndex() const
SwTableNode * FindTableNode()
Search table node, in which it is.
SwNodeOffset EndOfSectionIndex() const
SwContentNode * GetContentNode()
const SwEndNode * EndOfSectionNode() const
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
bool InsBoxen(SwTableNode *, SwTableLine *, SwTableBoxFormat *, SwTextFormatColl *, const SfxItemSet *pAutoAttr, sal_uInt16 nInsPos, sal_uInt16 nCnt=1)
Insert a new box in the line before InsPos.
SwContentNode * GoNextSection(SwNodeIndex *, bool bSkipHidden=true, bool bSkipProtect=true) const
Go to next content-node that is not protected or hidden (Both set FALSE ==> GoNext/GoPrevious!...
PaM is Point and Mark: a selection of the document model.
const SwPosition * GetMark() const
SwNode & GetPointNode() const
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
SwContentNode * GetPointContentNode() const
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
SwContentNode * GetMarkContentNode() const
SwNode & GetMarkNode() const
const SwPosition * GetPoint() const
tools::Long GetHeight(const SwRect &rRect) const
tools::Long GetWidth(const SwRect &rRect) const
tools::Long GetTop(const SwRect &rRect) const
Point GetPos(const SwRect &rRect) const
tools::Long GetLeft(const SwRect &rRect) const
tools::Long GetPrtLeft(const SwFrame &rFrame) const
tools::Long GetBottom(const SwRect &rRect) const
tools::Long GetRight(const SwRect &rRect) const
Of course Writer needs its own rectangles.
SwRect & Union(const SwRect &rRect)
void Top(const tools::Long nTop)
void Right(const tools::Long nRight)
void Bottom(const tools::Long nBottom)
SwRect GetUnion(const SwRect &rRect) const
bool Overlaps(const SwRect &rRect) const
Point BottomRight() const
void Left(const tools::Long nLeft)
void Width(tools::Long nNew)
vector_type::size_type size_type
The root element of a Writer document layout.
SwViewShell * GetCurrShell() const
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding).
bool MakeTableCursors(SwTableCursor &)
Calculates the cells included from the current selection.
SwRowFrame is one table row in the document layout.
virtual void Cut() override
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...
bool IsRepeatedHeadline() const
const SwTableLine * GetTabLine() const
const SwRect & GetUnion() const
const SwTabFrame * GetTable() const
Represents the current text cursor of one opened edit window.
const Point & GetPtPos() const
const Point & GetMkPos() const
SwTabFrame is one table in the document layout, containing rows (which contain cells).
SwTabFrame * FindMaster(bool bFirstMaster=false) const
const SwTabFrame * GetFollow() const
SwRowFrame * GetFirstNonHeadlineRow() const
SwFrame * FindLastContentOrTable()
const SwTable * GetTable() const
bool IsInHeadline(const SwFrame &rFrame) const
void SetFollowFlowLine(bool bNew)
bool HasFollowFlowLine() const
virtual void Cut() override
SwTableBox is one table cell in the document model.
sal_uInt16 IsFormulaOrValueBox() const
SwNodeOffset GetSttIdx() const
SwFrameFormat * GetFrameFormat()
SwTableLines & GetTabLines()
const SwStartNode * GetSttNd() const
SwFrameFormat * ClaimFrameFormat()
const SwSelBoxes & GetSelectedBoxes() const
size_t GetSelectedBoxesCount() const
SwTableLine is one table row in the document model.
SwFrameFormat * GetFrameFormat()
SwTableBoxes & GetTabBoxes()
bool IsDeleted(SwRedlineTable::size_type &rRedlinePos) const
sal_uInt16 GetBoxPos(const SwTableBox *pBox) const
std::vector< SwTableLine * >::iterator iterator
sal_uInt16 GetPos(const SwTableLine *pBox) const
const SwTable & GetTable() const
SwTable is one table in the document model, containing rows (which contain cells).
void CheckRowSpan(SwTableLine *&rpLine, bool bUp) const
SwTable::CheckRowSpan(..) looks for the next line without an overlapping to the previous line.
void CreateSelection(const SwPaM &rPam, SwSelBoxes &rBoxes, const SearchType eSearchType, bool bProtect) const
void SwTable::CreateSelection(..) fills the selection structure with table cells for a given SwPaM,...
SwTableLines & GetTabLines()
SwTableFormat * GetFrameFormat()
bool IsTableComplex() const
const SwTableBox * GetTableBox(const OUString &rName, const bool bPerformValidCheck=false) const
sal_uInt16 GetRowsToRepeat() const
SwTableSortBoxes & GetTabSortBoxes()
SwTextNode is a paragraph in the document model.
const OUString & GetText() const
SwTextFormatColl * GetTextColl() const
void MoveBoxContent(SwDoc &rDoc, SwNodeRange &rRg, SwNode &rPos)
void AddNewBox(SwNodeOffset nSttNdIdx)
void SaveCollection(const SwTableBox &rBox)
vcl::RenderContext * GetOut() const
SwRootFrame * GetLayout() const
const_iterator begin() const
const_iterator find(const Value &x) const
size_type erase(const Value &x)
const_iterator end() const
std::vector< Value >::size_type size_type
std::pair< const_iterator, bool > insert(Value &&x)
@ Variable
Frame is variable in Var-direction.
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
bool GoInContent(SwPaM &rPam, SwMoveFnCollection const &fnMove)
SwMoveFnCollection const & fnMoveBackward
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
const SwSelBoxes & rBoxes
Marks a position in the document model.
void Adjust(SwNodeOffset nDelta)
Adjust node position, and resets content position to zero.
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
SwNodeOffset GetNodeIndex() const
static const SwLayoutFrame * lcl_FindCellFrame(const SwLayoutFrame *pLay)
static bool lcl_IsLineOfTableFrame(const SwTabFrame &rTable, const SwFrame &rChk)
o3tl::sorted_vector< CmpLPt > MergePos
static bool lcl_CheckRow(const FndLine_ &rFndLine, bool *pPara)
void ForEach_FndLineCopyCol(SwTableLines &rLines, FndPara *pFndPara)
This creates a structure mirroring the SwTable structure that contains all rows and non-leaf boxes (a...
static SwTwips lcl_CalcWish(const SwLayoutFrame *pCell, tools::Long nWish, const tools::Long nAct)
void GetMergeSel(const SwPaM &rPam, SwSelBoxes &rBoxes, SwTableBox **ppMergeBox, SwUndoTableMerge *pUndo)
static void lcl_FindStartEndCol(const SwLayoutFrame *&rpStart, const SwLayoutFrame *&rpEnd, const bool bChkProtected)
void GetTableSelCrs(const SwCursorShell &rShell, SwSelBoxes &rBoxes)
void GetTableSel(const SwCursorShell &rShell, SwSelBoxes &rBoxes, const SwTableSearchType eSearchType)
bool CheckSplitCells(const SwCursorShell &rShell, sal_uInt16 nDiv, const SwTableSearchType eSearchType)
static bool lcl_CheckCol(FndBox_ const &, bool *pPara)
void MakeSelUnions(SwSelUnions &rUnions, const SwLayoutFrame *pStart, const SwLayoutFrame *pEnd, const SwTableSearchType eSearchType)
bool GetAutoSumSel(const SwCursorShell &rShell, SwCellFrames &rBoxes)
TableMergeErr CheckMergeSel(const SwPaM &rPam)
bool IsEmptyBox(const SwTableBox &rBox, SwPaM &rPam)
bool IsFrameInTableSel(const SwRect &rUnion, const SwFrame *pCell)
static const SwLayoutFrame * lcl_FindNextCellFrame(const SwLayoutFrame *pLay)
static void FndLineCopyCol(SwTableLine *pLine, FndPara *pFndPara)
static void lcl_FindStartEndRow(const SwLayoutFrame *&rpStart, const SwLayoutFrame *&rpEnd, const bool bChkProtected)
static void lcl_InsTableBox(SwTableNode *pTableNd, SwDoc *pDoc, SwTableBox *pBox, sal_uInt16 nInsPos, sal_uInt16 nCnt=1)
static void lcl_UpdateRepeatedHeadlines(SwTabFrame &rTabFrame, bool bCalcLowers)
static void FndBoxCopyCol(SwTableBox *pBox, FndPara *pFndPara)
static void lcl_InsertRow(SwTableLine const &rLine, SwLayoutFrame *pUpper, SwFrame *pSibling)
bool ChkChartSel(const SwNode &rSttNd, const SwNode &rEndNd)
bool HasProtectedCells(const SwSelBoxes &rBoxes)
void UnsetFollow(SwFlowFrame *pTab)
std::deque< SwCellFrame * > SwCellFrames
std::vector< SwSelUnion > SwSelUnions
bool operator<(const wwFont &r1, const wwFont &r2)