40 #include <UndoManager.hxx>
74 #include <section.hxx>
77 #include <strings.hrc>
95 #define CHECK_TABLE(t) (t).CheckConsistency();
97 #define CHECK_TABLE(t)
100 using ::editeng::SvxBorderLine;
107 bool bTop =
false, bBottom =
false, bLeft =
false, bRight =
false;
110 case 0: bTop = bBottom = bLeft =
true;
break;
111 case 1: bTop = bBottom = bLeft = bRight =
true;
break;
112 case 2: bBottom = bLeft =
true;
break;
113 case 3: bBottom = bLeft = bRight =
true;
break;
121 aLine.SetBorderLineStyle(SvxBorderLineStyle::DOUBLE);
127 aBox.
SetLine( &aLine, SvxBoxItemLine::TOP );
129 aBox.
SetLine( &aLine, SvxBoxItemLine::BOTTOM );
131 aBox.
SetLine( &aLine, SvxBoxItemLine::LEFT );
133 aBox.
SetLine( &aLine, SvxBoxItemLine::RIGHT );
148 rBoxFormatArr[ nId ] = pMap;
153 DfltBoxAttrMap_t::iterator
const iter(pMap->find(pBoxFrameFormat));
154 if (pMap->end() != iter)
156 pNewTableBoxFormat = iter->second;
166 pAutoFormat->UpdateToSet( nId,
false,
false,
167 const_cast<SfxItemSet&>(static_cast<SfxItemSet const &>(pNewTableBoxFormat->
GetAttrSet())),
173 (*pMap)[pBoxFrameFormat] = pNewTableBoxFormat;
181 if ( !rBoxFormatArr[nId] )
188 rBoxFormatArr[ nId ] = pBoxFormat;
190 return rBoxFormatArr[nId];
195 const sal_uInt16 nRows,
const sal_uInt16 nCols,
sal_uInt8 nId )
197 if( !rBoxFormatArr[nId] )
201 const_cast<SfxItemSet&>(static_cast<SfxItemSet const &>(pBoxFormat->
GetAttrSet())),
207 rBoxFormatArr[ nId ] = pBoxFormat;
209 return rBoxFormatArr[nId];
219 if(
nullptr != pTableNd )
240 OSL_ENSURE( pLine,
"No valid Line" );
244 SwTableBox *pPrvBox =
nullptr, *pNxtBox =
nullptr;
247 if( nInsPos < pLine->GetTabBoxes().size() )
251 if(
nullptr == pPrvBox )
258 if(
nullptr == pNxtBox )
265 if(
nullptr == pNxtBox )
269 if( !pPrvBox && !pNxtBox )
271 bool bSetIdxPos =
true;
281 while( !( pNxtBox = pLine->
GetTabBoxes()[0])->GetTabLines().empty() )
282 pLine = pNxtBox->GetTabLines()[0];
283 nIdxPos = pNxtBox->GetSttIdx();
292 nIdxPos = pNxtBox->GetSttIdx();
297 for( sal_uInt16
n = 0;
n < nCnt; ++
n )
304 pPrvBox =
new SwTableBox( pBoxFormat, *pSttNd, pLine );
307 sal_uInt16 nRealInsPos = nInsPos +
n;
308 if (nRealInsPos > rTabBoxes.size())
309 nRealInsPos = rTabBoxes.size();
311 rTabBoxes.insert( rTabBoxes.begin() + nRealInsPos, pPrvBox );
319 pTextColl, pAutoAttr );
338 sal_uInt16 nCols, sal_Int16 eAdjust,
340 const std::vector<sal_uInt16> *pColArr,
341 bool bCalledFromShell,
344 assert(nRows &&
"Table without line?");
345 assert(nCols &&
"Table without rows?");
364 std::make_unique<SwUndoInsTable>( rPos, nCols, nRows, static_cast<sal_uInt16>(eAdjust),
365 rInsTableOpts, pTAFormat, pColArr,
371 *pHeadColl = pBodyColl;
378 const sal_uInt16 nRowsToRepeat =
397 bCalledFromShell ? &pContentNd->GetSwAttrSet() : nullptr );
407 const SwAttrSet & aNdSet = pContentNd->GetSwAttrSet();
426 sal_uInt16 nSttPos = pColArr->front();
427 sal_uInt16 nLastPos = pColArr->back();
430 sal_uInt16 nFrameWidth = nLastPos;
431 nLastPos = (*pColArr)[ pColArr->size()-2 ];
434 nWidth = nLastPos - nSttPos;
473 std::vector<SwTableBoxFormat*> aBoxFormatArr;
475 if( !bDfltBorders && !pTAFormat )
482 const sal_uInt16 nBoxArrLen = pTAFormat ? 16 : 4;
483 aBoxFormatArr.resize( nBoxArrLen,
nullptr );
489 for( sal_uInt16
n = 0;
n < nRows; ++
n )
494 for( sal_uInt16
i = 0;
i < nCols; ++
i )
506 aCharSet.ClearItem();
507 pTAFormat->
UpdateToSet( nId, nRows==1, nCols==1, aCharSet,
509 if( aCharSet.Count() )
510 GetNodes()[ aNdIdx.GetIndex()+1 ]->GetContentNode()->
514 else if( bDfltBorders )
516 sal_uInt8 nBoxId = (
i < nCols - 1 ? 0 : 1) + (
n ? 2 : 0 );
526 nWidth = (*pColArr)[
i + 1 ] - (*pColArr)[
i ];
532 *pNewFormat = *pBoxF;
540 rBoxes.insert( rBoxes.begin() +
i, pBox );
575 if( !pHeadlineTextColl || !nLines )
576 pHeadlineTextColl = pContentTextColl;
586 for( sal_uInt16 nL = 0; nL < nLines; ++nL )
588 for( sal_uInt16 nB = 0; nB < nBoxes; ++nB )
598 if (
nullptr != pAttrSet )
600 static const sal_uInt16 aPropagateItems[] = {
606 const sal_uInt16* pIdx = aPropagateItems;
610 SfxItemState::SET == pAttrSet->
GetItemState( *pIdx,
true, &pItem ) )
611 static_cast<SwContentNode *>(pTmpNd)->SetAttr(*pItem);
618 if ( nL + 1 >= nRepeat )
619 pTextColl = pContentTextColl;
636 for( ; nCnt <= pEnd->nNode.GetIndex(); ++nCnt )
637 if( !
GetNodes()[ nCnt ]->IsTextNode() )
644 SwPaM aOriginal( *pStt, *pEnd );
653 static_cast<sal_uInt16>(eAdjust), pTAFormat );
667 bool bEndContent = 0 != pEnd->nContent.GetIndex();
672 if( pEnd->nNode.GetNode().GetContentNode()->Len() != pEnd->nContent.GetIndex()
677 const_cast<SwIndex&
>(pEnd->nContent).Assign(
678 pEnd->nNode.GetNode().GetContentNode(), 0 );
689 OSL_FAIL(
"empty range" );
731 aRg, cCh, pTableFormat, pLineFormat, pBoxFormat,
736 const sal_uInt16 nRowsToRepeat =
742 bool bUseBoxFormat =
false;
747 bUseBoxFormat =
true;
759 sal_uInt8 nBoxArrLen = pTAFormat ? 16 : 4;
760 std::unique_ptr< DfltBoxAttrList_t > aBoxFormatArr1;
761 std::unique_ptr< std::vector<SwTableBoxFormat*> > aBoxFormatArr2;
768 aBoxFormatArr2.reset(
new std::vector<SwTableBoxFormat*>( nBoxArrLen,
nullptr ));
781 const SwTableBoxes::size_type nCols = rBoxes.
size();
782 for( SwTableBoxes::size_type
i = 0;
i < nCols; ++
i )
790 ? 12 : (4 * (1 + ((
n-1) & 1 )))));
792 (
i+1 == nCols ? 3 : (1 + ((
i-1) & 1))));
797 bChgSz =
nullptr == (*aBoxFormatArr2)[ nId ];
805 aCharSet.ClearItem();
806 pTAFormat->
UpdateToSet( nId, nRows==1, nCols==1, aCharSet,
808 if( aCharSet.Count() )
812 for( ; nSttNd < nEndNd; ++nSttNd )
836 bChgSz =
nullptr == (*aBoxFormatArr2)[ nId ];
855 delete (*aBoxFormatArr1)[
i ];
870 aNode2Layout.RestoreUpperFrames(
GetNodes(), nIdx, nIdx + 1 );
920 && static_cast<SwFormatPageDesc const*>(pItem)->GetPageDesc())
941 size_t const nBoxes = pCurrLine->
GetTabBoxes().size();
942 if (nMaxBoxes != nBoxes)
945 nullptr, nBoxes, nMaxBoxes - nBoxes);
949 for (
size_t i = nBoxes;
i < nMaxBoxes; ++
i)
956 if (!
n && pPositions)
967 std::vector<sal_uInt16> *
const pPositions)
969 if (pPositions && !pPositions->empty())
972 sal_uInt16 nLastPos = 0;
973 for (
size_t n = 0;
n < pPositions->size(); ++
n)
978 for (
size_t nTmpLine = 0; nTmpLine < rLns.
size(); ++nTmpLine)
982 pNewFormat->
Add( rLns[ nTmpLine ]->GetTabBoxes()[
n ] );
985 nLastPos = (*pPositions)[
n ];
990 "who is still registered in the format?");
1014 std::vector<sal_uInt16> aPosArr;
1017 sal_uInt16 nBoxes, nLines, nMaxBoxes = 0;
1021 for( nLines = 0, nBoxes = 0;
1023 aSttIdx += 2, nLines++, nBoxes = 0 )
1026 OSL_ENSURE( pTextNd,
"Only add TextNodes to the Table" );
1028 if( !nLines && 0x0b == cCh )
1034 if( aFInfo.IsOneLine() )
1036 OUString
const& rText(pTextNd->
GetText());
1037 for (sal_Int32 nChPos = 0; nChPos < rText.getLength(); ++nChPos)
1039 if (rText[nChPos] == cCh)
1043 aPosArr.push_back( static_cast<sal_uInt16>(
1049 static_cast<sal_uInt16>(aFInfo.GetFrame()->IsVertical() ?
1050 aFInfo.GetFrame()->getFramePrintArea().Bottom() :
1051 aFInfo.GetFrame()->getFramePrintArea().Right()) );
1072 for (sal_Int32 nChPos = 0; nChPos < pTextNd->
GetText().getLength();)
1074 if (pTextNd->
GetText()[nChPos] == cCh)
1077 std::function<void (SwTextNode *, sw::mark::RestoreMode)> restoreFunc(
1080 if (!pContentStore->Empty())
1082 pContentStore->Restore(*pNewNode, nChPos, nChPos + 1, eMode);
1097 pNewNd->m_pStartOfSection = pSttNd;
1100 pBox =
new SwTableBox( pBoxFormat, *pSttNd, pLine );
1111 if( !pContentStore->Empty())
1112 pContentStore->Restore( *pTextNd, pTextNd->
GetText().getLength(), pTextNd->
GetText().getLength()+1 );
1119 pBox =
new SwTableBox( pBoxFormat, *pSttNd, pLine );
1121 if( nMaxBoxes < nBoxes )
1134 if (rTableNodes.empty())
1137 const std::vector<SwNodeRange>& rFirstRange = *rTableNodes.begin();
1139 if (rFirstRange.empty())
1142 const std::vector<SwNodeRange>& rLastRange = *rTableNodes.rbegin();
1144 if (rLastRange.empty())
1150 const SwNodeRange& rStartRange = *rFirstRange.begin();
1151 const SwNodeRange& rEndRange = *rLastRange.rbegin();
1196 OSL_FAIL(
"empty range" );
1204 SwNodeIndex const prev(rTableNodes.begin()->begin()->aStart, -1);
1207 for (
const auto& rRow : rTableNodes)
1209 for (
const auto& rCell : rRow)
1212 SwPaM pam(rCell.aStart, 0, *pPrev,
1213 (pPrev->GetNode().IsContentNode())
1214 ? pPrev->GetNode().GetContentNode()->Len() : 0);
1216 pPrev = &rCell.aEnd;
1221 (pPrev->GetNode().IsContentNode())
1250 && pItem !=
nullptr)
1262 rTableNodes, pTableFormat, pLineFormat, pBoxFormat );
1276 aNode2Layout.RestoreUpperFrames(
GetNodes(), nIdx, nIdx + 1 );
1286 bool bChanged =
false;
1294 while (aIndex < aEndIndex)
1304 if (aIndex > aNewEnd)
1315 if (aStartIndex < aNewStart)
1317 aNewStart = aStartIndex;
1322 if (aIndex < aEndIndex)
1331 aNewStart = aStartIndex;
1339 std::unique_ptr<SwNodeRange> pResult;
1341 pResult.reset(
new SwNodeRange(aNewStart, aNewEnd));
1351 for (
size_t nTmpLine = 0; nTmpLine < rLines.
size(); ++nTmpLine)
1353 SwTableBoxes & rBoxes = rLines[nTmpLine]->GetTabBoxes();
1355 size_t const nMissing = nMaxBoxes - rBoxes.size();
1362 nWidth * (nMissing + 1)) );
1363 pNewFormat->
Add(rBoxes.back());
1376 if( rTableNodes.empty() )
1381 SwNodeIndex aInsertIndex( rTableNodes.rbegin()->rbegin()->aEnd );
1386 new SwEndNode( aInsertIndex, *pTableNd );
1391 sal_uInt16 nLines, nMaxBoxes = 0;
1393 SwNodeIndex aNodeIndex = rTableNodes.begin()->begin()->aStart;
1395 for( nLines = 0; aNodeIndex <= rTableNodes.rbegin()->rbegin()->aEnd; ++aNodeIndex,++nLines )
1401 (0 == nLines) ? pTableFormat :
nullptr);
1406 for(
const auto& rRow : rTableNodes )
1408 sal_uInt16 nBoxes = 0;
1412 for(
const auto& rCell : rRow )
1428 for(;aCellNodeIdx <= rCell.aEnd; ++aCellNodeIdx )
1437 pBox =
new SwTableBox( pBoxFormat, *pSttNd, pLine );
1440 if( nMaxBoxes < nBoxes )
1467 std::unique_ptr<SwUndoTableToText> pUndo;
1472 pUndoRg =
new SwNodeRange( aRg.aStart, -1, aRg.aEnd, +1 );
1485 pUndo->SetRange( *pUndoRg );
1510 pLastNd(nullptr), rNds( rNodes ), pUndo( pU ), cCh( cChar ) {}
1520 assert(pPara &&
"The parameters are missing!");
1521 DelTabPara aPara( *pPara );
1526 pPara->pLastNd = aPara.pLastNd;
1531 assert(pDelPara &&
"The parameters are missing");
1541 SwDoc& rDoc = pDelPara->rNds.GetDoc();
1545 pDelPara->rNds.SectionUp( &aDelRg );
1547 if (
T2T_PARA != pDelPara->cCh && pDelPara->pLastNd)
1548 pCurTextNd = aDelRg.aStart.GetNode().
GetTextNode();
1549 if (
nullptr != pCurTextNd)
1554 if( pDelPara->pLastNd == &aDelRg.aStart.GetNode() )
1557 SwIndex aCntIdx( pDelPara->pLastNd,
1558 pDelPara->pLastNd->GetText().getLength());
1559 pDelPara->pLastNd->InsertText( OUString(pDelPara->cCh), aCntIdx,
1561 if( pDelPara->pUndo )
1562 pDelPara->pUndo->AddBoxPos( rDoc, nNdIdx, aDelRg.aEnd.GetIndex(),
1563 aCntIdx.GetIndex() );
1566 const sal_Int32 nOldTextLen = aCntIdx.GetIndex();
1569 pDelPara->pLastNd->JoinNext();
1571 if( !pContentStore->Empty() )
1572 pContentStore->Restore( rDoc, pDelPara->pLastNd->GetIndex(), nOldTextLen );
1574 else if( pDelPara->pUndo )
1577 pDelPara->pUndo->AddBoxPos( rDoc, nNdIdx, aDelRg.aEnd.GetIndex() );
1580 else if( pDelPara->pUndo )
1581 pDelPara->pUndo->AddBoxPos( rDoc, aDelRg.aStart.GetIndex(), aDelRg.aEnd.GetIndex() );
1583 pDelPara->pLastNd = aDelRg.aEnd.GetNode().GetTextNode();
1586 if( pDelPara->pLastNd && pDelPara->pLastNd->HasSwAttrSet() )
1598 if (
nullptr == pTableNd ||
1611 pTableNd->DelFrames();
1614 DelTabPara aDelPara( *
this, cCh, pUndo );
1615 for(
SwTableLine *pLine : pTableNd->m_pTable->GetTabLines() )
1627 const SfxItemSet& rTableSet = pTableNd->m_pTable->GetFrameFormat()->GetAttrSet();
1634 if( pBreak || pDesc )
1652 delete pNode2Layout;
1661 if(
nullptr != pCNd )
1666 static_cast<SwTableNode*>(pFrameNd)->MakeFramesForAdjacentContentNode(aDelRg.
aStart);
1668 static_cast<SwSectionNode*>(pFrameNd)->MakeFramesForAdjacentContentNode(aDelRg.
aStart);
1691 for(
auto pFly : rFlyArr )
1697 ((RndStdIds::FLY_AT_PARA == rAnchor.
GetAnchorId()) ||
1698 (RndStdIds::FLY_AT_CHAR == rAnchor.
GetAnchorId())) &&
1721 if( !aBoxes.
empty() )
1727 OSL_ENSURE( !rBoxes.
empty(),
"No valid Box list" );
1732 SwTable& rTable = pTableNd->GetTable();
1733 if( dynamic_cast<const SwDDETable*>( &rTable) !=
nullptr)
1737 std::unique_ptr<SwUndoTableNdsChg> pUndo;
1741 0, 0, nCnt, bBehind,
false ));
1753 bRet = rTable.
InsertCol(*
this, rBoxes, nCnt, bBehind);
1764 pUndo->SaveNewBoxes( *pTableNd, aTmpLst );
1776 if( !aBoxes.
empty() )
1782 OSL_ENSURE( !rBoxes.
empty(),
"No valid Box list" );
1787 SwTable& rTable = pTableNd->GetTable();
1788 if( dynamic_cast<const SwDDETable*>( &rTable) !=
nullptr)
1792 std::unique_ptr<SwUndoTableNdsChg> pUndo;
1796 0, 0, nCnt, bBehind,
false ));
1808 bRet = rTable.
InsertRow(
this, rBoxes, nCnt, bBehind );
1819 pUndo->SaveNewBoxes( *pTableNd, aTmpLst );
1844 if(dynamic_cast<const SwDDETable*>( & pTableNd->
GetTable()) !=
nullptr)
1848 FndBox_ aFndBox(
nullptr,
nullptr );
1850 FndPara aPara( aBoxes, &aFndBox );
1865 while( 1 == pFndBox->
GetLines().size() &&
1866 1 == pFndBox->
GetLines().front()->GetBoxes().size() )
1868 FndBox_ *
const pTmp = pFndBox->
GetLines().front()->GetBoxes()[0].get();
1890 pDelLine = pFndBox->
GetLines().front()->GetLine();
1893 pDelBox = pDelBox->
GetTabLines()[0]->GetTabBoxes()[0];
1915 SwPaM* pPam =
const_cast<SwPaM*
>(
static_cast<SwPaM const *
>(&rCursor));
1961 OSL_ENSURE( !rBoxes.
empty(),
"No valid Box list" );
1966 if (!(eMode & SwDoc::RowColMode::DeleteProtected)
1967 &&
dynamic_cast<const SwDDETable*
>(&pTableNd->GetTable()) !=
nullptr)
1974 SwTable &rTable = pTableNd->GetTable();
1986 const sal_uLong nTmpIdx1 = pTableNd->GetIndex();
1988 if( pTableNd->GetTable().GetTabSortBoxes().size() == aSelBoxes.
size() &&
1989 aSelBoxes[0]->GetSttIdx()-1 == nTmpIdx1 &&
1990 nTmpIdx2 == pTableNd->EndOfSectionIndex() )
1992 bool bNewTextNd =
false;
2000 if( nTableEnd == nSectEnd )
2023 SwPaM aPaM( *pTableNd->EndOfSectionNode(), aIdx.
GetNode() );
2027 const SwNodeIndex aTmpIdx( *pTableNd->EndOfSectionNode(), 1 );
2040 SwPaM const tmpPaM(*pTableNd, *pTableNd->EndOfSectionNode());
2045 bool bSavePageBreak =
false, bSavePageDesc =
false;
2046 sal_uLong nNextNd = pTableNd->EndOfSectionIndex()+1;
2050 SwFrameFormat* pTableFormat = pTableNd->GetTable().GetFrameFormat();
2056 bSavePageDesc =
true;
2063 bSavePageBreak =
true;
2066 std::unique_ptr<SwUndoDelete> pUndo(
new SwUndoDelete( aPaM ));
2068 pUndo->SetTableDelLastNd();
2069 pUndo->SetPgBrkFlags( bSavePageBreak, bSavePageDesc );
2070 pUndo->SetTableName(pTableNd->GetTable().GetFrameFormat()->GetName());
2077 const SwNodeIndex aTmpIdx( *pTableNd->EndOfSectionNode(), 1 );
2090 SwPaM const tmpPaM(*pTableNd, *pTableNd->EndOfSectionNode());
2098 SwFrameFormat* pTableFormat = pTableNd->GetTable().GetFrameFormat();
2109 pTableNd->DelFrames();
2121 std::unique_ptr<SwUndoTableNdsChg> pUndo;
2125 nMin, nMax, 0,
false,
false ));
2142 pUndo->ReNewBoxes( aSelBoxes );
2144 bRet = rTable.
DeleteSel(
this, aSelBoxes,
nullptr, pUndo.get(),
true, true );
2168 OSL_ENSURE( !rBoxes.
empty() && nCnt,
"No valid Box list" );
2173 SwTable& rTable = pTableNd->GetTable();
2174 if( dynamic_cast<const SwDDETable*>( &rTable) !=
nullptr)
2177 std::vector<sal_uLong> aNdsCnts;
2179 std::unique_ptr<SwUndoTableNdsChg> pUndo;
2183 nCnt, bVert, bSameHeight ));
2188 for (
size_t n = 0;
n < rBoxes.
size(); ++
n)
2206 bRet = rTable.
SplitCol(*
this, rBoxes, nCnt);
2208 bRet = rTable.
SplitRow(*
this, rBoxes, nCnt, bSameHeight);
2222 pUndo->SaveNewBoxes( *pTableNd, aTmpLst );
2224 pUndo->SaveNewBoxes( *pTableNd, aTmpLst, rBoxes, aNdsCnts );
2238 if( dynamic_cast<const SwDDETable*>( &rTable) !=
nullptr )
2255 std::unique_ptr<SwUndoTableMerge> pUndo;
2264 if( !rTable.
PrepareMerge( rPam, aBoxes, aMerged, &pMergeBox, pUndo.get() ) )
2302 SwPaM* pTmp = &rPam;
2303 while( &rPam != ( pTmp = pTmp->
GetNext() ))
2304 for(
int i = 0;
i < 2; ++
i )
2307 if (
SwTableCursor* pTableCursor = dynamic_cast<SwTableCursor*>(&rPam))
2313 pTableCursor->NewTableSelection();
2322 if( pTableNd->
GetTable().
Merge(
this, aBoxes, aMerged, pMergeBox, pUndo.get() ))
2376 OSL_ENSURE( pNode,
"No ContentNode or CopyNode and new Node is identical");
2382 while(
nullptr != (pFrame = aNode2Layout.NextFrame()) )
2405 OSL_ENSURE( pIdxBehind,
"No Index" );
2406 *pIdxBehind = *
this;
2414 while(
nullptr != (pUpper = aNode2Layout.
UpperFrame( pFrame, *
this )) )
2422 pNew->
Paste( pUpper, pFrame );
2430 if ( pViewShell && pViewShell->GetLayout() &&
2431 pViewShell->GetLayout()->IsAnyShellAccessible() )
2434 dynamic_cast<SwTextFrame*>(pNew->
FindNextCnt(
true )),
2435 dynamic_cast<SwTextFrame*>(pNew->
FindPrevCnt()) );
2452 bool bAgain =
false;
2465 if ( pViewShell && pViewShell->GetLayout() &&
2466 pViewShell->GetLayout()->IsAnyShellAccessible() )
2469 dynamic_cast<SwTextFrame*>(pFrame->
FindNextCnt(
true )),
2470 dynamic_cast<SwTextFrame*>(pFrame->
FindPrevCnt()) );
2478 pFrame = bAgain ? aIter.
First() : aIter.
Next();
2505 OSL_ENSURE( pBoxFrame,
"pBoxFrame needs to be specified!" );
2543 return ( s1 < s2 && std::abs( s1 - s2 ) >
ROWFUZZY );
2548 for (
size_t i = 0;
i < rBoxes.
size(); ++
i)
2559 OSL_ENSURE( pBoxFrame,
"GetTabRows called without pBoxFrame" );
2574 const SwPosition aPos(*static_cast<const SwTextFrame*>(pContent)->GetTextNodeFirst());
2575 const SwCursor aTmpCursor( aPos,
nullptr );
2582 OSL_FAIL(
"Current box has been deleted during GetTabRows()" );
2588 OSL_ENSURE( pTab,
"GetTabRows called without a table" );
2609 typedef std::map< tools::Long, std::pair< tools::Long, long >, FuzzyCompare > BoundaryMap;
2610 BoundaryMap aBoundaries;
2611 BoundaryMap::iterator aIter;
2612 std::pair< tools::Long, long > aPair;
2614 typedef std::map< tools::Long, bool > HiddenMap;
2616 HiddenMap::iterator aHiddenIter;
2618 while ( pFrame && pTab->
IsAnLower( pFrame ) )
2627 aIter = aBoundaries.find( nUpperBorder );
2628 if ( aIter == aBoundaries.end() )
2630 aPair.first = nUpperBorder; aPair.second =
LONG_MAX;
2631 aBoundaries[ nUpperBorder ] = aPair;
2635 aIter = aBoundaries.find( nLowerBorder );
2636 if ( aIter == aBoundaries.end() )
2638 aPair.first = nUpperBorder; aPair.second =
LONG_MAX;
2642 nLowerBorder = (*aIter).first;
2643 tools::Long nNewLowerBorderUpperBoundary = std::max( (*aIter).second.first, nUpperBorder );
2644 aPair.first = nNewLowerBorderUpperBoundary; aPair.second =
LONG_MAX;
2646 aBoundaries[ nLowerBorder ] = aPair;
2652 aHiddenIter = aHidden.find( nTmpVal );
2653 if ( aHiddenIter == aHidden.end() )
2654 aHidden[ nTmpVal ] = !
lcl_IsFrameInColumn( *static_cast<const SwCellFrame*>(pFrame), aBoxes );
2657 if ( aHidden[ nTmpVal ] &&
2659 aHidden[ nTmpVal ] =
false;
2661 nTmpVal = nLowerBorder;
2670 for (
const auto& rEntry : aBoundaries )
2674 const std::pair< tools::Long, long > aTmpPair = rEntry.second;
2678 aHiddenIter = aHidden.find( rEntry.first );
2679 const bool bHidden = aHiddenIter != aHidden.end() && (*aHiddenIter).second;
2680 rFill.
Insert( nKey, nFirst, nSecond, bHidden, nIdx++ );
2684 OSL_ENSURE( rFill.
Count(),
"Deleting from empty vector. Fasten your seatbelts!" );
2705 OSL_ENSURE(
false,
"must specify pBoxFrame" );
2721 aShadow.CalcShadowSpace( SvxShadowItemSide::RIGHT );
2723 if( nPrtWidth != rTableFrameSz.
GetWidth() )
2734 aRectFnSet.
GetLeft(pPage->getFrameArea());
2736 aRectFnSet.
GetLeft(pPage->getFrameArea());
2739 aOld.SetLeftMin ( nLeftMin );
2742 aOld.SetRightMax( nRightMax - nLeftMin );
2745 SetTabCols(rTab, rNew, aOld, pBox, bCurRowOnly );
2759 OSL_ENSURE(
false,
"must specify pBoxFrame" );
2773 if ( aRectFnSet.
IsVert() )
2775 nLeftMin = pTab->
GetPrtLeft() - pPage->getFrameArea().Left();
2777 aOld.SetRightMax( aOld.GetRight() );
2782 nLeftMin = pTab->
GetPrtTop() - pPage->getFrameArea().Top();
2786 aOld.SetLeftMin ( nLeftMin );
2795 OSL_ENSURE( pTable,
"My colleague told me, this couldn't happen" );
2797 for (
size_t i = 0;
i <= nCount; ++
i )
2799 const size_t nIdxStt = aRectFnSet.
IsVert() ? nCount -
i :
i - 1;
2800 const size_t nIdxEnd = aRectFnSet.
IsVert() ? nCount -
i - 1 :
i;
2802 const tools::Long nOldRowStart =
i == 0 ? 0 : aOld[ nIdxStt ];
2803 const tools::Long nOldRowEnd =
i == nCount ? aOld.GetRight() : aOld[ nIdxEnd ];
2804 const tools::Long nOldRowHeight = nOldRowEnd - nOldRowStart;
2806 const tools::Long nNewRowStart =
i == 0 ? 0 : rNew[ nIdxStt ];
2808 const tools::Long nNewRowHeight = nNewRowEnd - nNewRowStart;
2810 const tools::Long nDiff = nNewRowHeight - nOldRowHeight;
2811 if ( std::abs( nDiff ) >=
ROWFUZZY )
2823 while ( pFrame && pTab->
IsAnLower( pFrame ) )
2829 if ( std::abs( aRectFnSet.
YInc( nTabTop, nOldRowEnd ) - nLowerBorder ) <=
ROWFUZZY )
2831 if ( !bCurColOnly || pFrame == pBoxFrame )
2838 const sal_Int32 nRowSpan = pBox->
getRowSpan();
2840 pTextFrame =
static_cast<const SwTextFrame*
>(pContent);
2843 if( pLine && pTextFrame )
2848 if( nNewSize != aNew.GetHeight() )
2850 aNew.SetHeight( nNewSize );
2854 const SwPosition aPos(*static_cast<const SwTextFrame*>(pContent)->GetTextNodeFirst());
2855 const SwCursor aTmpCursor( aPos,
nullptr );
2887 std::make_unique<SwUndoAttrTable>( *rTab.
GetTableNode(), true ));
2889 rTab.
SetTabCols( rNew, rOld, pStart, bCurRowOnly );
2903 std::make_unique<SwUndoTableHeadline>(rTable, rTable.
GetRowsToRepeat(), nSet) );
2932 std::vector<sal_uInt16>::size_type
n;
2956 std::vector<sal_uInt16>::size_type
n;
2979 for( n = 0; n < nArrSize; ++n )
2995 for(
const auto& rpBox : const_cast<SwTableLine*>(rpLine)->GetTabBoxes() )
2998 for(
auto& rpBox : const_cast<SwTableLine*>(rpLine)->GetTabBoxes() )
3018 pSplPara->
AddBox( *pBox );
3047 if( aNew != rBoxItem )
3053 sal_uInt16
const aTableSplitBoxSetRange[] {
3061 aTableSplitBoxSetRange );
3063 if( aTmpSet.Count() )
3107 if( dynamic_cast<const SwDDETable*>( &pTNd->
GetTable() ) !=
nullptr)
3143 FndBox_ aFndBox(
nullptr,
nullptr );
3156 *pNew, std::move(pSaveRowSp), eHdlnMode, bCalcNewSize);
3158 if( aHistory.
Count() )
3238 return nullptr != pNew;
3249 if(
USHRT_MAX == aTableMaxSz.GetWidth() )
3255 aTableMaxSz.SetWidth( 0 );
3258 for(
auto pLn : rLns )
3262 for(
auto pBox : rBoxes )
3263 nMaxLnWidth += pBox->GetFrameFormat()->GetFrameSize().GetWidth();
3265 if( nMaxLnWidth > aTableMaxSz.GetWidth() )
3266 aTableMaxSz.SetWidth( nMaxLnWidth );
3277 class SplitTable_Para
3279 std::map<SwFrameFormat const*, SwFrameFormat*> m_aSrcDestMap;
3286 , m_pNewTableNode(pNew)
3291 auto it = m_aSrcDestMap.find(pSrcFormat);
3292 return it == m_aSrcDestMap.end() ?
nullptr : it->second;
3297 m_aSrcDestMap[pSrcFormat] = pDestFormat;
3315 if( pDestFormat ==
nullptr )
3330 if( pDestFormat ==
nullptr )
3338 pPara->ChgBox( pBox );
3380 assert(pOldTableEndNd &&
"Where is the EndNode?");
3388 pNewTableNd->m_pEndOfSection = pOldTableEndNd;
3392 OSL_ENSURE( pBoxNd->
IsStartNode(),
"This needs to be a StartNode!" );
3395 }
while( pBoxNd != pOldTableEndNd );
3413 const SwTableBoxes::size_type nBoxCnt = rTable.
GetTabLines()[ nLineIdx ]->GetTabBoxes().
size();
3414 for (SwTableBoxes::size_type j = 0; j < nBoxCnt; ++j)
3416 const SwTableBoxes::size_type nIdx = nBoxCnt - 1 - j;
3427 SplitTable_Para aPara( pNewTableNd, rTable );
3440 *pNewTableFormat = *pOldTableFormat;
3472 pDelTableNd = rNds[ pTableNd->
GetIndex() - 1 ]->FindTableNode();
3478 if( dynamic_cast<const SwDDETable*>( &pTableNd->
GetTable() ) !=
nullptr ||
3479 dynamic_cast<const SwDDETable*>( &pDelTableNd->GetTable() ) !=
nullptr)
3484 pDelTableNd->GetTable().SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout>());
3488 std::unique_ptr<SwHistory> pHistory;
3500 aMsgHint.m_pHistory = pHistory.get();
3504 SwNodeIndex aIdx( bWithPrev ? *pTableNd : *pDelTableNd );
3505 bool bRet = rNds.
MergeTable( aIdx, !bWithPrev, nMode );
3509 if( pHistory->Count() )
3527 OSL_ENSURE( pDelTableNd,
"Where did the TableNode go?" );
3530 OSL_ENSURE( pTableNd,
"Where did the TableNode go?" );
3532 if( !pDelTableNd || !pTableNd )
3541 FndBox_ aFndBox(
nullptr,
nullptr );
3553 if( rTableSz != rDelTableSz )
3588 pTableNd->m_pEndOfSection = pTableEndNd;
3594 OSL_ENSURE( pBoxNd->
IsStartNode(),
"This needs to be a StartNode!" );
3597 }
while( pBoxNd != pTableEndNd );
3630 struct SetAFormatTabPara
3634 sal_uInt16 nEndBox, nCurBox;
3636 bool bSingleRowTable;
3640 nEndBox( 0 ), nCurBox( 0 ), nAFormatLine( 0 ), nAFormatBox( 0 ), bSingleRowTable(false)
3652 for (
auto const& it : rLine.
GetBoxes())
3663 if( !pSetPara->nCurBox )
3664 pSetPara->nAFormatBox = 0;
3665 else if( pSetPara->nCurBox == pSetPara->nEndBox )
3666 pSetPara->nAFormatBox = 3;
3668 pSetPara->nAFormatBox =
static_cast<sal_uInt8>(1 + ((pSetPara->nCurBox-1) & 1));
3682 sal_uInt8 nPos = pSetPara->nAFormatLine * 4 + pSetPara->nAFormatBox;
3683 const bool bSingleRowTable = pSetPara->bSingleRowTable;
3684 const bool bSingleColTable = pSetPara->nEndBox == 0;
3688 if (aCharSet.Count())
3692 for (; nSttNd < nEndNd; ++nSttNd)
3700 if (aBoxSet.Count())
3702 if (pSetPara->pUndo && SfxItemState::SET == aBoxSet.GetItemState(
RES_BOXATR_FORMAT))
3703 pSetPara->pUndo->SaveBoxContent( *pSetBox );
3713 const bool bOrigSingleRowTable = pSetPara->bSingleRowTable;
3714 pSetPara->bSingleRowTable = rBox.
GetLines().size() == 1;
3715 for (
auto const& rpFndLine : rBox.
GetLines())
3719 pSetPara->bSingleRowTable = bOrigSingleRowTable;
3723 ++pSetPara->nCurBox;
3729 OSL_ENSURE( !rBoxes.
empty(),
"No valid Box list" );
3735 FndBox_ aFndBox(
nullptr,
nullptr );
3737 FndPara aPara( rBoxes, &aFndBox );
3747 while( 1 == pFndBox->
GetLines().size() &&
3748 1 == pFndBox->
GetLines().front()->GetBoxes().size())
3750 pFndBox = pFndBox->
GetLines().front()->GetBoxes()[0].get();
3768 pTableNd->GetTable().SetTableStyleName(rNew.
GetName());
3773 SetAFormatTabPara aPara( rNew );
3775 aPara.bSingleRowTable = rFLns.size() == 1;
3777 for (FndLines_t::size_type
n = 0;
n < rFLns.size(); ++
n)
3786 aPara.nAFormatLine = 0;
3787 else if (static_cast<size_t>(
n+1) == rFLns.size())
3788 aPara.nAFormatLine = 3;
3790 aPara.nAFormatLine = static_cast<sal_uInt8>(1 + ((
n-1) & 1 ));
3792 aPara.nAFormatBox = 0;
3794 aPara.nEndBox = pLine->
GetBoxes().size()-1;
3795 aPara.pUndo = pUndo;
3796 for (
auto const& it : pLine->
GetBoxes())
3820 OSL_ENSURE( !rBoxes.
empty(),
"No valid Box list" );
3826 FndBox_ aFndBox(
nullptr,
nullptr );
3828 FndPara aPara( rBoxes, &aFndBox );
3839 while( 1 == pFndBox->
GetLines().size() &&
3840 1 == pFndBox->
GetLines().front()->GetBoxes().size())
3842 pFndBox = pFndBox->
GetLines().front()->GetBoxes()[0].get();
3850 sal_uInt16 aLnArr[4];
3852 aLnArr[1] = 1 < rFLns.size() ? 1 : 0;
3853 aLnArr[2] = 2 < rFLns.size() ? 2 : aLnArr[1];
3854 aLnArr[3] = rFLns.size() - 1;
3856 for(
sal_uInt8 nLine = 0; nLine < 4; ++nLine )
3858 FndLine_& rLine = *rFLns[ aLnArr[ nLine ] ];
3860 sal_uInt16 aBoxArr[4];
3862 aBoxArr[1] = 1 < rLine.
GetBoxes().size() ? 1 : 0;
3863 aBoxArr[2] = 2 < rLine.
GetBoxes().size() ? 2 : aBoxArr[1];
3864 aBoxArr[3] = rLine.
GetBoxes().size() - 1;
3866 for(
sal_uInt8 nBox = 0; nBox < 4; ++nBox )
3871 pFBox = pFBox->
GetTabLines()[0]->GetTabBoxes()[0];
3905 OUString
newName =
"MailMergeTable"
3915 std::unique_ptr<sal_uInt8[]> pSetFlags(
new sal_uInt8[ nFlagSize ] );
3916 memset( pSetFlags.get(), 0, nFlagSize );
3922 pFormat->
GetName().startsWith( aName ) )
3925 const sal_Int32 nNmLen = aName.getLength();
3926 size_t nNum = pFormat->
GetName().copy( nNmLen ).toInt32();
3927 if( nNum-- && nNum < mpTableFrameFormatTable->
size() )
3928 pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
3934 for(
size_t n = 0;
n < nFlagSize; ++
n )
3936 auto nTmp = pSetFlags[
n ];
3950 return aName + OUString::number( ++nNum );
3979 std::unique_ptr<SwUndo> pUndo;
3995 eType, nAbsDiff, nRelDiff,
3996 bUndo ? &pUndo :
nullptr );
4003 eType, nAbsDiff, nRelDiff,
4004 bUndo ? &pUndo :
nullptr );
4024 if( rString.getLength() > 308 )
4028 OUStringBuffer sStringBuffer(rString);
4030 while( nCommentPosition != -1 )
4032 sStringBuffer.remove( nCommentPosition, 1 );
4033 nCommentPosition = sStringBuffer.indexOf(
CH_TXTATR_INWORD, nCommentPosition );
4045 static_cast<const SwTableBoxNumFormat*>(pNumFormatItem)->
GetValue() ))
4048 std::unique_ptr<SwUndoTableNumFormat> pUndo;
4050 bool bIsEmptyTextNd;
4052 sal_uInt32 nFormatIdx;
4054 if( rBox.
HasNumContent( fNumber, nFormatIdx, bIsEmptyTextNd ) )
4064 pUndo->SetNumFormat( nFormatIdx, fNumber );
4070 bool bLockModify =
true;
4077 if( pNumFormatItem && !bForceNumberFormat )
4083 if( nFormatType == pNumFormatr->
GetType( nOldNumFormat ) || SvNumFormatType::NUMBER == nFormatType )
4087 nFormatIdx = nOldNumFormat;
4088 bSetNumberFormat =
true;
4094 bLockModify = bSetNumberFormat =
false;
4098 if( bSetNumberFormat || bForceNumberFormat )
4108 if( !bSetNumberFormat && !bIsEmptyTextNd && pNumFormatItem )
4119 if( bSetNumberFormat )
4126 const SfxPoolItem* pValueItem =
nullptr, *pFormatItem =
nullptr;
4129 false, &pFormatItem ) ||
4131 false, &pValueItem ))
4143 if( !bIsEmptyTextNd )
4162 pUndo->SetBox( rBox );
4210 if (
nullptr == pNode )
4217 && pTextNode->
GetText().isEmpty()))
4223 pTextNode->SwContentNode::GetAttr( rSet );
4224 if ( SfxItemState::SET != rSet.GetItemState(
RES_PARATR_NUMRULE ,
false , &pFormatItem ) )
4240 std::unique_ptr<SfxStringItem> pNewItem(static_cast<SfxStringItem*>(pFormatItem->
Clone()));
4241 pNewItem->SetValue(OUString());
4242 rSet.Put( std::move(pNewItem) );
4249 if(
nullptr == pSttNd ||
4273 static_cast<const SwTableBoxNumFormat*>(pFormatItem)->
GetValue() ))
4292 const SwTable* pCpyTable,
bool bCpyName,
bool bCorrPos )
4298 : rBoxes[ 0 ]->GetSttNd()->FindTableNode();
4303 if( !pCpyTable && !pInsTableNd )
4305 std::unique_ptr<SwUndoCpyTable> pUndo;
4322 pUndo->SetTableSttIdx( pInsTableNd->
GetIndex() );
4334 std::unique_ptr<SwUndoTableCpyTable> pUndo;
4343 bool bDelCpyDoc = xCpyDoc ==
this;
4348 xCpyDoc =
new SwDoc;
4371 && ( bDelCpyDoc || !rBoxes.
empty() ) )
4381 OSL_ENSURE( pBox,
"Box is not in this Table" );
4390 *pBoxes, pUndo.get() );
4396 aNdIdx, pUndo.get() );
4405 if( bRet || !pUndo->IsEmpty() )
4413 rInsPos.
nNode = *pSttNd;
4430 std::unique_ptr<SwUndoAttrTable> pUndo;
4435 for (
size_t i = rSrtBox.
size();
i; )
4445 if( pUndo && bChgd )
4464 if( !rBoxes.
empty() )
4466 std::unique_ptr<SwUndoAttrTable> pUndo;
4468 pUndo.reset(
new SwUndoAttrTable( *rBoxes[0]->GetSttNd()->FindTableNode() ));
4470 std::map<SwFrameFormat*, SwTableBoxFormat*> aFormatsMap;
4471 for (
size_t i = rBoxes.
size();
i; )
4477 std::map<SwFrameFormat*, SwTableBoxFormat*>::const_iterator
const it =
4478 aFormatsMap.find(pBoxFormat);
4479 if (aFormatsMap.end() != it)
4486 aFormatsMap.insert(std::make_pair(pBoxFormat, pNewBoxFormat));
4492 if( pUndo && bChgd )
4502 bool bChgd =
false, bHasSel = rPam.
HasMark() ||
4507 for(
auto n = rFormats.
size();
n ; )
4517 bool bFound =
false;
4521 *pEnd = pTmp->
End();
4523 nTableIdx < pEnd->nNode.GetIndex();
4525 }
while( !bFound && &rPam != ( pTmp = pTmp->
GetNext() ) );
4540 const OUString* pTableName,
4541 bool* pFullTableProtection )
4543 bool bHasProtection =
false;
4557 for (
size_t i = rSrtBox.
size();
i; )
4562 if( !bHasProtection )
4564 bHasProtection =
true;
4565 if( !pFullTableProtection )
4567 *pFullTableProtection =
true;
4570 else if( bHasProtection && pFullTableProtection )
4572 *pFullTableProtection =
false;
4577 return bHasProtection;
4591 std::make_unique<SwUndoTableStyleMake>(rName, *
this));
4597 return pTableFormat;
4607 std::vector<SwTable*> vAffectedTables;
4608 if (pReleasedFormat)
4611 for (
size_t i=0;
i < nTableCount; ++
i)
4618 vAffectedTables.push_back(pTable);
4627 std::make_unique<SwUndoTableStyleDelete>(std::move(pReleasedFormat), vAffectedTables, *
this));
4631 return pReleasedFormat;
4641 *pFormat = rNewFormat;
4645 for (
size_t i=0;
i < nTableCount; ++
i)
4658 std::make_unique<SwUndoTableStyleUpdate>(*pFormat, aOldFormat, *
this));
SwStartNode * FindSttNodeByType(SwStartNodeType eTyp)
bool IsInsTableChangeNumFormat() const
sal_uInt16 GetRedlSaveCount() const
bool IsAnLower(const SwFrame *) const
SwTableFormat * MakeTableFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom)
void SetTableBoxFormulaAttrs(SwTableBox &rBox, const SfxItemSet &rSet)
bool IsTableComplex() const
static SwTableBoxFormat * lcl_CreateAFormatBoxFormat(SwDoc &rDoc, std::vector< SwTableBoxFormat * > &rBoxFormatArr, const SwTableAutoFormat &rAutoFormat, const sal_uInt16 nRows, const sal_uInt16 nCols, sal_uInt8 nId)
const SwEndNode * EndOfSectionNode() const
Starts a section of nodes in the document model.
constexpr TypedWhichId< SvxProtectItem > RES_PROTECT(100)
std::vector< SwTableLine * >::size_type size_type
Base class of the Writer layout elements.
Represents the visualization of a paragraph.
const FndLines_t & GetLines() const
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
virtual sal_Int32 Len() const
tools::Long GetWidth() const
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
void SwClearFntCacheTextGlyphs()
Clears the pre-calculated text glyphs in all SwFntObj instances.
tools::Long GetRight(const SwRect &rRect) const
virtual void Cut() override
bool IsInMailMerge() const
static SwTableBoxFormat * lcl_CreateDfltBoxFormat(SwDoc &rDoc, std::vector< SwTableBoxFormat * > &rBoxFormatArr, sal_uInt16 nCols, sal_uInt8 nId)
sal_uLong GetIndex() const
bool IsUsed(const sw::BroadcastingModify &) const
SwNode & GetNode(bool bPoint=true) const
const Value & back() const
SwTableLineFormat * MakeTableLineFormat()
SwStartNode * m_pStartOfSection
void Add(SwClient *pDepend)
static SwFormat * FindFormatByName(const SwFormatsBase &rFormatArr, std::u16string_view rName)
void SetRowsToRepeat(sal_uInt16 nNumOfRows)
Represents the style of a paragraph.
void RegisterToFormat(SwFormat &rFormat)
Marks a position in the document model.
bool IsSectionNode() const
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CTL_FONT(27)
void SetLeft(tools::Long nNew)
const SwTableBox * GetTableBox(const OUString &rName, const bool bPerformValidCheck=false) const
static bool lcl_ChgTableSize(SwTable &rTable)
bool SplitRow(SwDoc &rDoc, const SwSelBoxes &rBoxes, sal_uInt16 nCnt, bool bSameHeight)
std::vector< SwTableBox * > m_Boxes
sal_uLong StartOfSectionIndex() const
void DelFrames(SwRootFrame const *pLayout=nullptr)
Method deletes all views of document for the node.
constexpr TypedWhichId< SwTableBoxNumFormat > RES_BOXATR_FORMAT(RES_BOXATR_BEGIN)
void FindSuperfluousRows(SwSelBoxes &rBoxes)
bool IsInsTableFormatNum() const
bool TableToText(const SwTableNode *pTableNd, sal_Unicode cCh)
Table to Text.
const OUString & GetText() const
void UpdateCharts() const
static void lcl_SetTableBoxWidths2(SwTable &rTable, size_t const nMaxBoxes, SwTableBoxFormat &rBoxFormat, SwDoc &rDoc)
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr) override
sal_uLong GetSttIdx() const
SwDocShell * GetDocShell()
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
constexpr TypedWhichId< SwTableBoxValue > RES_BOXATR_VALUE(150)
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
const SwFrameFormats * GetTableFrameFormats() const
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
void DeleteRow(const SwCursor &rCursor)
Deleting Columns/Rows.
const SwTable * GetTable() const
void Left(const tools::Long nLeft)
void SetRight(tools::Long nNew)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
SwDoc & GetDoc()
Which Doc contains the nodes-array?
static void GetTabCols(SwTabCols &rFill, const SwCellFrame *pBoxFrame)
static bool lcl_SetAFormatBox(FndBox_ &, SetAFormatTabPara *pSetPara, bool bResetDirect)
virtual void SetModified()=0
Must be called manually at changes of format.
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
OUString GetUniqueTableName() const
const SwRect & getFramePrintArea() const
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
const SwPosition * GetMark() const
SwTabFrame is one table in the document layout, containing rows (which contain cells).
SwInsertTableFlags mnInsMode
virtual void CreateChartInternalDataProviders(const SwTable *pTable)=0
calls createInternalDataProvider for all charts using the specified table
bool IsContentHidden() const
Check for not hidden areas whether there is content that is not in a hidden sub-area.
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
virtual SwContentFrame * MakeFrame(SwFrame *pSib)=0
MakeFrame will be called for a certain layout pSib is another SwFrame of the same layout (e...
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
SwFrameFormat * ClaimFrameFormat()
void DelFrames(SwTable &rTable)
exports com.sun.star. table
bool IsGetFromTop() const
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
virtual bool HasExtraRedlineTable() const =0
SwTableLine is one table row in the document model.
void SetTabRows(const SwTabCols &rNew, bool bCurColOnly, const SwCellFrame *pBoxFrame)
void PrepareDeleteCol(tools::Long nMin, tools::Long nMax)
SwTable::PrepareDeleteCol(..) adjusts the widths of the neighbour cells of a cell selection for an up...
OUString newName(std::u16string_view aNewPrefix, const OUString &aOldPrefix, std::u16string_view old_Name)
bool HasProtectedCells(const SwSelBoxes &rBoxes)
sal_uInt16 GetRowsToRepeat() const
static void DestroyFrame(SwFrame *const pFrame)
this is the only way to delete a SwFrame instance
SwTextNode * SplitContentNode(const SwPosition &, std::function< void(SwTextNode *, sw::mark::RestoreMode)> const *pContentIndexRestore)
SwPosition & GetBound(bool bOne=true)
IDocumentUndoRedo & GetIDocumentUndoRedo()
void CheckSectionCondColl() const
Call ChkCondcoll to all ContentNodes of section.
tools::Long GetWidth(const SwRect &rRect) const
bool InsertRow(SwDoc *, const SwSelBoxes &rBoxes, sal_uInt16 nCnt, bool bBehind)
SwTable::InsertRow(..) inserts one or more rows before or behind the selected boxes.
IDocumentContentOperations const & getIDocumentContentOperations() const
bool HasWriterListeners() const
The root element of a Writer document layout.
static void GetTabRows(SwTabCols &rFill, const SwCellFrame *pBoxFrame)
sal_uInt16 mnRowsToRepeat
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
SwTableFormat * GetFrameFormat()
void SetValues(bool bFlag)
const SwFrameFormats * GetSpzFrameFormats() const
void ClearBoxNumAttrs(const SwNodeIndex &rNode)
Value in Var-direction gives minimum (can be exceeded but not be less).
bool PrepareMerge(const SwPaM &rPam, SwSelBoxes &rBoxes, SwSelBoxes &rMerged, SwTableBox **ppMergeBox, SwUndoTableMerge *pUndo)
SwTable::PrepareMerge(..) some preparation for the coming Merge(..)
void UnProtectTables(const SwPaM &rPam)
static void lcl_SplitTable_CpyBox(SwTableBox *pBox, SplitTable_Para *pPara)
void UpdateCharts(std::u16string_view rName) const
SwTableNode * TextToTable(const SwNodeRange &rRange, sal_Unicode cCh, SwTableFormat *pTableFormat, SwTableLineFormat *pLineFormat, SwTableBoxFormat *pBoxFormat, SwTextFormatColl *pTextColl, SwUndoTextToTable *pUndo)
Create balanced table from selected range.
void ForEach_FndLineCopyCol(SwTableLines &rLines, FndPara *pFndPara)
This creates a structure mirroring the SwTable structure that contains all rows and non-leaf boxes (a...
bool TableToText(const SwNodeRange &rRange, sal_Unicode cCh, SwUndoTableToText *)
Create regular text from what was table.
std::unique_ptr< SwTable > m_pTable
static void lcl_SetTableBoxWidths(SwTable &rTable, size_t const nMaxBoxes, SwTableBoxFormat &rBoxFormat, SwDoc &rDoc, std::vector< sal_uInt16 > *const pPositions)
sal_Int32 getRowSpan() const
const SwSection & GetSection() const
SwContentNode * GetContentNode(bool bPoint=true) const
void SetRightMax(tools::Long nNew)
SwTableBox * FindNextBox(const SwTable &, const SwTableBox *=nullptr, bool bOvrTableLns=true) const
tools::Long GetTop(const SwRect &rRect) const
void UnProtectCells(std::u16string_view rTableName)
void MakeFramesForAdjacentContentNode(SwContentNode &rNode)
Method creates all views of document for given node.
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(102)
void ChgFrameFormat(SwTableLineFormat *pNewFormat)
bool IsAssignedToListLevelOfOutlineStyle() const
void MakeFramesForAdjacentContentNode(const SwNodeIndex &rIdx)
Method creates all views of the document for the previous node.
void SetUpper(FndBox_ *pUp)
void GetTabCols(SwTabCols &rToFill, const SwTableBox *pStart, bool bHidden=false, bool bCurRowOnly=false) const
SwTableNode * GetTableNode()
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
static void lcl_SplitTable_CpyLine(SwTableLine *pLn, SplitTable_Para *pPara)
std::unique_ptr< SwFrameFormats > mpTableFrameFormatTable
bool UpdateTableStyleFormatting(SwTableNode *pTableNode=nullptr, bool bResetDirect=false, OUString const *pStyleName=nullptr)
Update the direct formatting according to the current table style.
const SwTableBox * GetTabBox() const
void RegisterInModify(sw::BroadcastingModify *pRegIn, const SwNode &rNd)
const SwRect & getFrameArea() const
SwTableNode * SplitTable(const SwNodeIndex &rPos, bool bAfter=true, bool bCalcNewSize=false)
Splits a table at the base-line which contains the index.
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
void sw_LineSetHeadCondColl(const SwTableLine *pLine)
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
const SwTextFormatColl * GetDfltTextFormatColl() const
void SetAttr(const SfxPoolItem &, SwFormat &)
Set attribute in given format.1y If Undo is enabled, the old values is added to the Undo history...
void MakeOwnFrames(SwNodeIndex *pIdxBehind, SwNodeIndex *pEnd=nullptr)
Creates the frms for the SectionNode (i.e.
static bool IsRedlineOn(const RedlineFlags eM)
std::vector< NodeRanges_t > TableRanges_t
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.
void SetTableModel(bool bNew)
sal_uLong GetIndex() const
virtual void UpdateTableFields(SfxPoolItem *pHt)=0
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
virtual void DoUndo(bool const bDoUndo)=0
Enable/Disable Undo.
virtual ~SwTableNode() override
void SetTabCols(const SwTabCols &rNew, const SwTabCols &rOld, const SwTableBox *pStart, bool bCurRowOnly)
const FndBoxes_t & GetBoxes() const
virtual bool SetFieldsDirty(bool b, const SwNode *pChk, sal_uLong nLen)=0
static void lcl_RemoveBreaks(SwContentNode &rNode, SwTableFormat *const pTableFormat)
iterator insert(iterator aIt, SwTableLine *pLine)
void SetHTMLTableLayout(std::shared_ptr< SwHTMLTableLayout > const &r)
void CopyHeadlineIntoTable(SwTableNode &rTableNd)
const SwTable & GetTable() const
virtual void DeleteSection(SwNode *pNode)=0
Delete section containing the node.
void DelNodes(const SwNodeIndex &rStart, sal_uLong nCnt=1)
Delete a number of nodes.
const SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
const OUString & GetTableStyleName() const
Return the table style name of this table.
void SetAllDistances(sal_uInt16 nNew)
SwTableBox * FindPreviousBox(const SwTable &, const SwTableBox *) const
tools::Long GetLeft(const SwRect &rRect) const
bool InsTable(const SwTable &rCpyTable, const SwNodeIndex &, SwUndoTableCpyTable *pUndo)
Copy Table into this Box.
virtual bool IsEnableSetModified() const =0
bool SplitCol(SwDoc &rDoc, const SwSelBoxes &rBoxes, sal_uInt16 nCnt)
tools::Long GetPrtLeft() const
virtual bool DoesUndo() const =0
Is Undo enabled?
void SetRowHeight(const SwCursor &rCursor, const SwFormatFrameSize &rNew)
void sw_BoxSetSplitBoxFormats(SwTableBox *pBox, SwCollectTableLineBoxes *pSplPara)
const FndBox_ * GetUpper() const
helper class to check if a frame has been deleted during an operation WARNING! This should only be us...
void ClearLineNumAttrs(SwPosition const &rPos)
void InsertRow(const SwCursor &rCursor, sal_uInt16 nCnt=1, bool bBehind=true)
void DeleteCol(const SwCursor &rCursor)
void MakeFrames(SwTable &rTable)
void SetTableNodeOffset(sal_uLong nIdx)
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr)=0
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Class for SplitTable Collects the uppermost or lowermost Lines of a Box from a Line in an array...
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
SwTableSortBoxes & GetTabSortBoxes()
Table of Contents - heading.
bool IsContentNode() const
PaM is Point and Mark: a selection of the document model.
std::unique_ptr< SwTableAutoFormatTable > m_pTableStyles
Table styles (autoformats that are applied with table changes).
const SwAttrSet * GetpSwAttrSet() const
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
const editeng::SvxBorderLine * GetTop() const
static SwTable * FindTable(SwFrameFormat const *const pFormat)
virtual void AppendUndo(std::unique_ptr< SwUndo > pUndo)=0
Add new Undo action.
SwTabFrame * ImplFindTabFrame()
virtual void ClearRedo()=0
Delete all Redo actions.
bool SetColWidth(SwTableBox &rCurrentBox, TableChgWidthHeightType eType, SwTwips nAbsDiff, SwTwips nRelDiff, std::unique_ptr< SwUndo > *ppUndo)
::sw::UndoManager & GetUndoManager()
bool GoNext(SwNode *pNd, SwIndex *pIdx, sal_uInt16 nMode)
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
virtual const SwExtraRedlineTable & GetExtraRedlineTable() const =0
void Broadcast(const SfxHint &rHint)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
void SetTableLines(const SwSelBoxes &rBoxes, const SwTable &rTable)
static void lcl_DelLine(SwTableLine *pLine, DelTabPara *pPara)