20 #include <libxml/xmlwriter.h>
22 #include <config_wasm_strip.h>
44 #include <UndoManager.hxx>
78 #include <section.hxx>
81 #include <strings.hrc>
99 #include <osl/diagnose.h>
102 #define CHECK_TABLE(t) (t).CheckConsistency();
104 #define CHECK_TABLE(t)
107 using ::editeng::SvxBorderLine;
114 bool bTop =
false, bBottom =
false, bLeft =
false, bRight =
false;
117 case 0: bTop = bBottom = bLeft =
true;
break;
118 case 1: bTop = bBottom = bLeft = bRight =
true;
break;
119 case 2: bBottom = bLeft =
true;
break;
120 case 3: bBottom = bLeft = bRight =
true;
break;
129 aLine.SetBorderLineStyle(SvxBorderLineStyle::DOUBLE);
134 aBox.
SetLine( &aLine, SvxBoxItemLine::TOP );
136 aBox.
SetLine( &aLine, SvxBoxItemLine::BOTTOM );
138 aBox.
SetLine( &aLine, SvxBoxItemLine::LEFT );
140 aBox.
SetLine( &aLine, SvxBoxItemLine::RIGHT );
155 rBoxFormatArr[ nId ] = pMap;
160 DfltBoxAttrMap_t::iterator
const iter(pMap->find(pBoxFrameFormat));
161 if (pMap->end() != iter)
163 pNewTableBoxFormat = iter->second;
173 pAutoFormat->UpdateToSet( nId,
false,
false,
174 const_cast<SfxItemSet&>(static_cast<SfxItemSet const &>(pNewTableBoxFormat->
GetAttrSet())),
180 (*pMap)[pBoxFrameFormat] = pNewTableBoxFormat;
188 if ( !rBoxFormatArr[nId] )
191 if( USHRT_MAX != nCols )
193 USHRT_MAX / nCols, 0 ));
195 rBoxFormatArr[ nId ] = pBoxFormat;
197 return rBoxFormatArr[nId];
202 const sal_uInt16 nRows,
const sal_uInt16 nCols,
sal_uInt8 nId )
204 if( !rBoxFormatArr[nId] )
208 const_cast<SfxItemSet&>(static_cast<SfxItemSet const &>(pBoxFormat->
GetAttrSet())),
211 if( USHRT_MAX != nCols )
213 USHRT_MAX / nCols, 0 ));
214 rBoxFormatArr[ nId ] = pBoxFormat;
216 return rBoxFormatArr[nId];
226 if(
nullptr != pTableNd )
247 OSL_ENSURE( pLine,
"No valid Line" );
251 SwTableBox *pPrvBox =
nullptr, *pNxtBox =
nullptr;
254 if( nInsPos < pLine->GetTabBoxes().size() )
258 if(
nullptr == pPrvBox )
265 if(
nullptr == pNxtBox )
272 if(
nullptr == pNxtBox )
276 if( !pPrvBox && !pNxtBox )
278 bool bSetIdxPos =
true;
288 while( !( pNxtBox = pLine->
GetTabBoxes()[0])->GetTabLines().empty() )
289 pLine = pNxtBox->GetTabLines()[0];
290 nIdxPos = pNxtBox->GetSttIdx();
299 nIdxPos = pNxtBox->GetSttIdx();
304 for( sal_uInt16
n = 0;
n < nCnt; ++
n )
311 pPrvBox =
new SwTableBox( pBoxFormat, *pSttNd, pLine );
314 sal_uInt16 nRealInsPos = nInsPos +
n;
315 if (nRealInsPos > rTabBoxes.size())
316 nRealInsPos = rTabBoxes.size();
318 rTabBoxes.insert( rTabBoxes.begin() + nRealInsPos, pPrvBox );
326 pTextColl, pAutoAttr );
345 sal_uInt16 nCols, sal_Int16 eAdjust,
347 const std::vector<sal_uInt16> *pColArr,
348 bool bCalledFromShell,
351 assert(nRows &&
"Table without line?");
352 assert(nCols &&
"Table without rows?");
371 std::make_unique<SwUndoInsTable>( rPos, nCols, nRows, o3tl::narrowing<sal_uInt16>(eAdjust),
372 rInsTableOpts, pTAFormat, pColArr,
378 *pHeadColl = pBodyColl;
385 const sal_uInt16 nRowsToRepeat =
404 bCalledFromShell ? &pContentNd->GetSwAttrSet() : nullptr );
414 const SwAttrSet & aNdSet = pContentNd->GetSwAttrSet();
430 sal_uInt16 nSttPos = pColArr->front();
431 sal_uInt16 nLastPos = pColArr->back();
434 sal_uInt16 nFrameWidth = nLastPos;
435 nLastPos = (*pColArr)[ pColArr->size()-2 ];
438 nWidth = nLastPos - nSttPos;
475 std::vector<SwTableBoxFormat*> aBoxFormatArr;
477 if( !bDfltBorders && !pTAFormat )
484 const sal_uInt16 nBoxArrLen = pTAFormat ? 16 : 4;
485 aBoxFormatArr.resize( nBoxArrLen,
nullptr );
491 for( sal_uInt16
n = 0;
n < nRows; ++
n )
496 for( sal_uInt16
i = 0;
i < nCols; ++
i )
508 aCharSet.ClearItem();
509 pTAFormat->
UpdateToSet( nId, nRows==1, nCols==1, aCharSet,
511 if( aCharSet.Count() )
516 else if( bDfltBorders )
518 sal_uInt8 nBoxId = (
i < nCols - 1 ? 0 : 1) + (
n ? 2 : 0 );
528 nWidth = (*pColArr)[
i + 1 ] - (*pColArr)[
i ];
534 *pNewFormat = *pBoxF;
542 rBoxes.insert( rBoxes.begin() +
i, pBox );
577 if( !pHeadlineTextColl || !nLines )
578 pHeadlineTextColl = pContentTextColl;
588 for( sal_uInt16 nL = 0; nL < nLines; ++nL )
590 for( sal_uInt16 nB = 0; nB < nBoxes; ++nB )
600 if (
nullptr != pAttrSet )
602 static const sal_uInt16 aPropagateItems[] = {
608 const sal_uInt16* pIdx = aPropagateItems;
612 SfxItemState::SET == pAttrSet->
GetItemState( *pIdx,
true, &pItem ) )
613 static_cast<SwContentNode *>(pTmpNd)->SetAttr(*pItem);
620 if ( nL + 1 >= nRepeat )
621 pTextColl = pContentTextColl;
638 for( ; nCnt <= pEnd->nNode.GetIndex(); ++nCnt )
639 if( !
GetNodes()[ nCnt ]->IsTextNode() )
646 SwPaM aOriginal( *pStt, *pEnd );
655 o3tl::narrowing<sal_uInt16>(eAdjust), pTAFormat );
669 bool bEndContent = 0 != pEnd->nContent.GetIndex();
674 if( pEnd->nNode.GetNode().GetContentNode()->Len() != pEnd->nContent.GetIndex()
679 const_cast<SwIndex&
>(pEnd->nContent).Assign(
680 pEnd->nNode.GetNode().GetContentNode(), 0 );
691 OSL_FAIL(
"empty range" );
730 aRg, cCh, pTableFormat, pLineFormat, pBoxFormat,
735 const sal_uInt16 nRowsToRepeat =
741 bool bUseBoxFormat =
false;
746 bUseBoxFormat =
true;
758 sal_uInt8 nBoxArrLen = pTAFormat ? 16 : 4;
759 std::unique_ptr< DfltBoxAttrList_t > aBoxFormatArr1;
760 std::optional< std::vector<SwTableBoxFormat*> > aBoxFormatArr2;
767 aBoxFormatArr2 = std::vector<SwTableBoxFormat*>( nBoxArrLen, nullptr );
780 const SwTableBoxes::size_type nCols = rBoxes.
size();
781 for( SwTableBoxes::size_type
i = 0;
i < nCols; ++
i )
789 ? 12 : (4 * (1 + ((
n-1) & 1 )))));
791 (
i+1 == nCols ? 3 : (1 + ((
i-1) & 1))));
796 bChgSz =
nullptr == (*aBoxFormatArr2)[ nId ];
798 *pTAFormat, USHRT_MAX, USHRT_MAX, nId );
804 aCharSet.ClearItem();
805 pTAFormat->
UpdateToSet( nId, nRows==1, nCols==1, aCharSet,
807 if( aCharSet.Count() )
811 for( ; nSttNd < nEndNd; ++nSttNd )
835 bChgSz =
nullptr == (*aBoxFormatArr2)[ nId ];
854 delete (*aBoxFormatArr1)[
i ];
869 aNode2Layout.RestoreUpperFrames(
GetNodes(), nIdx, nIdx + 1 );
940 size_t const nBoxes = pCurrLine->
GetTabBoxes().size();
941 if (nMaxBoxes != nBoxes)
944 nullptr, nBoxes, nMaxBoxes - nBoxes);
948 for (
size_t i = nBoxes;
i < nMaxBoxes; ++
i)
955 if (!
n && pPositions)
966 std::vector<sal_uInt16> *
const pPositions)
968 if (pPositions && !pPositions->empty())
971 sal_uInt16 nLastPos = 0;
972 for (
size_t n = 0;
n < pPositions->size(); ++
n)
977 for (
size_t nTmpLine = 0; nTmpLine < rLns.
size(); ++nTmpLine)
981 pNewFormat->
Add( rLns[ nTmpLine ]->GetTabBoxes()[
n ] );
984 nLastPos = (*pPositions)[
n ];
989 "who is still registered in the format?");
994 size_t nWidth = nMaxBoxes ? USHRT_MAX / nMaxBoxes : USHRT_MAX;
1013 std::vector<sal_uInt16> aPosArr;
1016 sal_uInt16 nBoxes, nLines, nMaxBoxes = 0;
1020 for( nLines = 0, nBoxes = 0;
1025 OSL_ENSURE( pTextNd,
"Only add TextNodes to the Table" );
1027 if( !nLines && 0x0b == cCh )
1033 if( aFInfo.IsOneLine() )
1035 OUString
const& rText(pTextNd->
GetText());
1036 for (sal_Int32 nChPos = 0; nChPos < rText.getLength(); ++nChPos)
1038 if (rText[nChPos] == cCh)
1042 aPosArr.push_back( o3tl::narrowing<sal_uInt16>(
1048 o3tl::narrowing<sal_uInt16>(aFInfo.GetFrame()->IsVertical() ?
1049 aFInfo.GetFrame()->getFramePrintArea().Bottom() :
1050 aFInfo.GetFrame()->getFramePrintArea().Right()) );
1071 for (sal_Int32 nChPos = 0; nChPos < pTextNd->
GetText().getLength();)
1073 if (pTextNd->
GetText()[nChPos] == cCh)
1076 std::function<void (SwTextNode *, sw::mark::RestoreMode, bool)> restoreFunc(
1079 if (!pContentStore->Empty())
1081 pContentStore->Restore(*pNewNode, nChPos, nChPos + 1, eMode);
1096 pNewNd->m_pStartOfSection = pSttNd;
1099 pBox =
new SwTableBox( pBoxFormat, *pSttNd, pLine );
1110 if( !pContentStore->Empty())
1111 pContentStore->Restore( *pTextNd, pTextNd->
GetText().getLength(), pTextNd->
GetText().getLength()+1 );
1118 pBox =
new SwTableBox( pBoxFormat, *pSttNd, pLine );
1120 if( nMaxBoxes < nBoxes )
1133 if (rTableNodes.empty())
1136 const std::vector<SwNodeRange>& rFirstRange = *rTableNodes.begin();
1138 if (rFirstRange.empty())
1141 const std::vector<SwNodeRange>& rLastRange = *rTableNodes.rbegin();
1143 if (rLastRange.empty())
1149 const SwNodeRange& rStartRange = *rFirstRange.begin();
1150 const SwNodeRange& rEndRange = *rLastRange.rbegin();
1195 OSL_FAIL(
"empty range" );
1203 SwNodeIndex const prev(rTableNodes.begin()->begin()->aStart, -1);
1206 for (
const auto& rRow : rTableNodes)
1208 for (
const auto& rCell : rRow)
1211 SwPaM pam(rCell.aStart, 0, *pPrev,
1212 (pPrev->GetNode().IsContentNode())
1213 ? pPrev->GetNode().GetContentNode()->Len() : 0);
1215 pPrev = &rCell.aEnd;
1220 (pPrev->GetNode().IsContentNode())
1258 rTableNodes, pTableFormat, pLineFormat, pBoxFormat );
1272 aNode2Layout.RestoreUpperFrames(
GetNodes(), nIdx, nIdx + 1 );
1282 bool bChanged =
false;
1290 while (aIndex < aEndIndex)
1300 if (aIndex > aNewEnd)
1311 if (aStartIndex < aNewStart)
1313 aNewStart = aStartIndex;
1318 if (aIndex < aEndIndex)
1327 aNewStart = aStartIndex;
1335 std::unique_ptr<SwNodeRange> pResult;
1337 pResult.reset(
new SwNodeRange(aNewStart, aNewEnd));
1347 for (
size_t nTmpLine = 0; nTmpLine < rLines.
size(); ++nTmpLine)
1349 SwTableBoxes & rBoxes = rLines[nTmpLine]->GetTabBoxes();
1350 assert(!rBoxes.empty());
1351 size_t const nMissing = nMaxBoxes - rBoxes.
size();
1356 size_t nWidth = nMaxBoxes ? USHRT_MAX / nMaxBoxes : USHRT_MAX;
1358 nWidth * (nMissing + 1)) );
1359 pNewFormat->
Add(rBoxes.back());
1362 size_t nWidth = nMaxBoxes ? USHRT_MAX / nMaxBoxes : USHRT_MAX;
1372 if( rTableNodes.empty() )
1377 SwNodeIndex aInsertIndex( rTableNodes.rbegin()->rbegin()->aEnd );
1382 new SwEndNode( aInsertIndex, *pTableNd );
1387 sal_uInt16 nLines, nMaxBoxes = 0;
1389 SwNodeIndex aNodeIndex = rTableNodes.begin()->begin()->aStart;
1391 for( nLines = 0; aNodeIndex <= rTableNodes.rbegin()->rbegin()->aEnd; ++aNodeIndex,++nLines )
1397 (0 == nLines) ? pTableFormat :
nullptr);
1402 for(
const auto& rRow : rTableNodes )
1404 sal_uInt16 nBoxes = 0;
1408 for(
const auto& rCell : rRow )
1424 for(;aCellNodeIdx <= rCell.aEnd; ++aCellNodeIdx )
1433 pBox =
new SwTableBox( pBoxFormat, *pSttNd, pLine );
1436 if( nMaxBoxes < nBoxes )
1463 std::unique_ptr<SwUndoTableToText> pUndo;
1481 pUndo->SetRange( *pUndoRg );
1506 pLastNd(nullptr), rNds( rNodes ), pUndo( pU ), cCh( cChar ) {}
1516 assert(pPara &&
"The parameters are missing!");
1517 DelTabPara aPara( *pPara );
1522 pPara->pLastNd = aPara.pLastNd;
1527 assert(pDelPara &&
"The parameters are missing");
1537 SwDoc& rDoc = pDelPara->rNds.GetDoc();
1541 pDelPara->rNds.SectionUp( &aDelRg );
1543 if (
T2T_PARA != pDelPara->cCh && pDelPara->pLastNd)
1544 pCurTextNd = aDelRg.aStart.GetNode().
GetTextNode();
1545 if (
nullptr != pCurTextNd)
1550 if( pDelPara->pLastNd == &aDelRg.aStart.GetNode() )
1553 SwIndex aCntIdx( pDelPara->pLastNd,
1554 pDelPara->pLastNd->GetText().getLength());
1555 pDelPara->pLastNd->InsertText( OUString(pDelPara->cCh), aCntIdx,
1557 if( pDelPara->pUndo )
1558 pDelPara->pUndo->AddBoxPos( rDoc, nNdIdx, aDelRg.aEnd.GetIndex(),
1559 aCntIdx.GetIndex() );
1562 const sal_Int32 nOldTextLen = aCntIdx.GetIndex();
1565 pDelPara->pLastNd->JoinNext();
1567 if( !pContentStore->Empty() )
1568 pContentStore->Restore( rDoc, pDelPara->pLastNd->GetIndex(), nOldTextLen );
1570 else if( pDelPara->pUndo )
1573 pDelPara->pUndo->AddBoxPos( rDoc, nNdIdx, aDelRg.aEnd.GetIndex() );
1576 else if( pDelPara->pUndo )
1577 pDelPara->pUndo->AddBoxPos( rDoc, aDelRg.aStart.GetIndex(), aDelRg.aEnd.GetIndex() );
1579 pDelPara->pLastNd = aDelRg.aEnd.GetNode().GetTextNode();
1582 if( pDelPara->pLastNd && pDelPara->pLastNd->HasSwAttrSet() )
1594 if (
nullptr == pTableNd ||
1607 pTableNd->DelFrames();
1610 DelTabPara aDelPara( *
this, cCh, pUndo );
1611 for(
SwTableLine *pLine : pTableNd->m_pTable->GetTabLines() )
1623 const SfxItemSet& rTableSet = pTableNd->m_pTable->GetFrameFormat()->GetAttrSet();
1627 if( pBreak || pDesc )
1645 delete pNode2Layout;
1654 if(
nullptr != pCNd )
1659 static_cast<SwTableNode*>(pFrameNd)->MakeFramesForAdjacentContentNode(aDelRg.
aStart);
1661 static_cast<SwSectionNode*>(pFrameNd)->MakeFramesForAdjacentContentNode(aDelRg.
aStart);
1684 for(
auto pFly : rFlyArr )
1690 ((RndStdIds::FLY_AT_PARA == rAnchor.
GetAnchorId()) ||
1691 (RndStdIds::FLY_AT_CHAR == rAnchor.
GetAnchorId())) &&
1714 if( !aBoxes.
empty() )
1720 OSL_ENSURE( !rBoxes.
empty(),
"No valid Box list" );
1725 SwTable& rTable = pTableNd->GetTable();
1726 if( dynamic_cast<const SwDDETable*>( &rTable) !=
nullptr)
1730 std::unique_ptr<SwUndoTableNdsChg> pUndo;
1734 0, 0, nCnt, bBehind,
false ));
1746 bRet = rTable.
InsertCol(*
this, rBoxes, nCnt, bBehind);
1757 pUndo->SaveNewBoxes( *pTableNd, aTmpLst );
1769 if( !aBoxes.
empty() )
1775 OSL_ENSURE( !rBoxes.
empty(),
"No valid Box list" );
1780 SwTable& rTable = pTableNd->GetTable();
1781 if( dynamic_cast<const SwDDETable*>( &rTable) !=
nullptr)
1785 std::unique_ptr<SwUndoTableNdsChg> pUndo;
1789 0, 0, nCnt, bBehind,
false ));
1801 bRet = rTable.
InsertRow(
this, rBoxes, nCnt, bBehind );
1812 pUndo->SaveNewBoxes( *pTableNd, aTmpLst );
1837 if(dynamic_cast<const SwDDETable*>( & pTableNd->
GetTable()) !=
nullptr)
1841 FndBox_ aFndBox(
nullptr,
nullptr );
1843 FndPara aPara( aBoxes, &aFndBox );
1858 while( 1 == pFndBox->
GetLines().size() &&
1859 1 == pFndBox->
GetLines().front()->GetBoxes().size() )
1861 FndBox_ *
const pTmp = pFndBox->
GetLines().front()->GetBoxes()[0].get();
1883 pDelLine = pFndBox->
GetLines().front()->GetLine();
1886 pDelBox = pDelBox->
GetTabLines()[0]->GetTabBoxes()[0];
1908 SwPaM* pPam =
const_cast<SwPaM*
>(
static_cast<SwPaM const *
>(&rCursor));
1954 OSL_ENSURE( !rBoxes.
empty(),
"No valid Box list" );
1959 if (!(eMode & SwDoc::RowColMode::DeleteProtected)
1960 &&
dynamic_cast<const SwDDETable*
>(&pTableNd->GetTable()) !=
nullptr)
1967 SwTable &rTable = pTableNd->GetTable();
1981 if( pTableNd->GetTable().GetTabSortBoxes().size() == aSelBoxes.
size() &&
1982 aSelBoxes[0]->GetSttIdx()-1 == nTmpIdx1 &&
1983 nTmpIdx2 == pTableNd->EndOfSectionIndex() )
1985 bool bNewTextNd =
false;
1991 const SwNodeOffset nTableEnd = pTableNd->EndOfSectionIndex() + 1;
1993 if( nTableEnd == nSectEnd )
2016 SwPaM aPaM( *pTableNd->EndOfSectionNode(), aIdx.
GetNode() );
2020 const SwNodeIndex aTmpIdx( *pTableNd->EndOfSectionNode(), 1 );
2033 SwPaM const tmpPaM(*pTableNd, *pTableNd->EndOfSectionNode());
2038 bool bSavePageBreak =
false, bSavePageDesc =
false;
2039 SwNodeOffset nNextNd = pTableNd->EndOfSectionIndex()+1;
2043 SwFrameFormat* pTableFormat = pTableNd->GetTable().GetFrameFormat();
2049 bSavePageDesc =
true;
2056 bSavePageBreak =
true;
2061 pUndo->SetTableDelLastNd();
2062 pUndo->SetPgBrkFlags( bSavePageBreak, bSavePageDesc );
2063 pUndo->SetTableName(pTableNd->GetTable().GetFrameFormat()->GetName());
2070 const SwNodeIndex aTmpIdx( *pTableNd->EndOfSectionNode(), 1 );
2083 SwPaM const tmpPaM(*pTableNd, *pTableNd->EndOfSectionNode());
2091 SwFrameFormat* pTableFormat = pTableNd->GetTable().GetFrameFormat();
2102 pTableNd->DelFrames();
2114 std::unique_ptr<SwUndoTableNdsChg> pUndo;
2118 nMin, nMax, 0,
false,
false ));
2135 pUndo->ReNewBoxes( aSelBoxes );
2137 bRet = rTable.
DeleteSel(
this, aSelBoxes,
nullptr, pUndo.get(),
true, true );
2161 OSL_ENSURE( !rBoxes.
empty() && nCnt,
"No valid Box list" );
2166 SwTable& rTable = pTableNd->GetTable();
2167 if( dynamic_cast<const SwDDETable*>( &rTable) !=
nullptr)
2170 std::vector<SwNodeOffset> aNdsCnts;
2172 std::unique_ptr<SwUndoTableNdsChg> pUndo;
2176 nCnt, bVert, bSameHeight ));
2181 for (
size_t n = 0;
n < rBoxes.
size(); ++
n)
2199 bRet = rTable.
SplitCol(*
this, rBoxes, nCnt);
2201 bRet = rTable.
SplitRow(*
this, rBoxes, nCnt, bSameHeight);
2215 pUndo->SaveNewBoxes( *pTableNd, aTmpLst );
2217 pUndo->SaveNewBoxes( *pTableNd, aTmpLst, rBoxes, aNdsCnts );
2231 if( dynamic_cast<const SwDDETable*>( &rTable) !=
nullptr )
2248 std::unique_ptr<SwUndoTableMerge> pUndo;
2257 if( !rTable.
PrepareMerge( rPam, aBoxes, aMerged, &pMergeBox, pUndo.get() ) )
2295 SwPaM* pTmp = &rPam;
2296 while( &rPam != ( pTmp = pTmp->
GetNext() ))
2297 for(
int i = 0;
i < 2; ++
i )
2300 if (
SwTableCursor* pTableCursor = dynamic_cast<SwTableCursor*>(&rPam))
2306 pTableCursor->NewTableSelection();
2315 if( pTableNd->
GetTable().
Merge(
this, aBoxes, aMerged, pMergeBox, pUndo.get() ))
2369 OSL_ENSURE( pNode,
"No ContentNode or CopyNode and new Node is identical");
2375 while(
nullptr != (pFrame = aNode2Layout.NextFrame()) )
2398 OSL_ENSURE( pIdxBehind,
"No Index" );
2399 *pIdxBehind = *
this;
2407 while(
nullptr != (pUpper = aNode2Layout.
UpperFrame( pFrame, *
this )) )
2415 pNew->
Paste( pUpper, pFrame );
2421 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
2424 if ( pViewShell && pViewShell->GetLayout() &&
2425 pViewShell->GetLayout()->IsAnyShellAccessible() )
2429 pViewShell->InvalidateAccessibleParaFlowRelation(
2430 pNext ? pNext->DynCastTextFrame() :
nullptr,
2431 pPrev ? pPrev->DynCastTextFrame() : nullptr );
2449 bool bAgain =
false;
2460 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
2463 if ( pViewShell && pViewShell->GetLayout() &&
2464 pViewShell->GetLayout()->IsAnyShellAccessible() )
2468 pViewShell->InvalidateAccessibleParaFlowRelation(
2469 pNext ? pNext->DynCastTextFrame() :
nullptr,
2470 pPrev ? pPrev->DynCastTextFrame() : nullptr );
2480 pFrame = bAgain ? aIter.
First() : aIter.
Next();
2506 (
void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwTableNode"));
2507 (
void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"ptr"),
"%p",
this);
2508 (
void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"index"), BAD_CAST(OString::number(sal_Int32(
GetIndex())).getStr()));
2512 (
void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwTable"));
2513 (
void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"ptr"),
"%p",
m_pTable.get());
2514 m_pTable->GetFrameFormat()->dumpAsXml(pWriter);
2515 for (
const auto& pLine :
m_pTable->GetTabLines())
2517 (
void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwTableLine"));
2518 (
void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST(
"ptr"),
"%p", pLine);
2519 pLine->GetFrameFormat()->dumpAsXml(pWriter);
2520 (
void)xmlTextWriterEndElement(pWriter);
2522 (
void)xmlTextWriterEndElement(pWriter);
2530 OSL_ENSURE( pBoxFrame,
"pBoxFrame needs to be specified!" );
2573 for (
size_t i = 0;
i < rBoxes.
size(); ++
i)
2584 OSL_ENSURE( pBoxFrame,
"GetTabRows called without pBoxFrame" );
2599 const SwPosition aPos(*static_cast<const SwTextFrame*>(pContent)->GetTextNodeFirst());
2600 const SwCursor aTmpCursor( aPos,
nullptr );
2607 OSL_FAIL(
"Current box has been deleted during GetTabRows()" );
2613 OSL_ENSURE( pTab,
"GetTabRows called without a table" );
2634 typedef std::map< tools::Long, std::pair< tools::Long, long >, FuzzyCompare > BoundaryMap;
2635 BoundaryMap aBoundaries;
2636 BoundaryMap::iterator aIter;
2637 std::pair< tools::Long, long > aPair;
2639 typedef std::map< tools::Long, bool > HiddenMap;
2641 HiddenMap::iterator aHiddenIter;
2643 while ( pFrame && pTab->
IsAnLower( pFrame ) )
2652 aIter = aBoundaries.find( nUpperBorder );
2653 if ( aIter == aBoundaries.end() )
2655 aPair.first = nUpperBorder; aPair.second =
LONG_MAX;
2656 aBoundaries[ nUpperBorder ] = aPair;
2660 aIter = aBoundaries.find( nLowerBorder );
2661 if ( aIter == aBoundaries.end() )
2663 aPair.first = nUpperBorder; aPair.second =
LONG_MAX;
2667 nLowerBorder = (*aIter).first;
2668 tools::Long nNewLowerBorderUpperBoundary = std::max( (*aIter).second.first, nUpperBorder );
2669 aPair.first = nNewLowerBorderUpperBoundary; aPair.second =
LONG_MAX;
2671 aBoundaries[ nLowerBorder ] = aPair;
2677 aHiddenIter = aHidden.find( nTmpVal );
2678 if ( aHiddenIter == aHidden.end() )
2679 aHidden[ nTmpVal ] = !
lcl_IsFrameInColumn( *static_cast<const SwCellFrame*>(pFrame), aBoxes );
2682 if ( aHidden[ nTmpVal ] &&
2684 aHidden[ nTmpVal ] =
false;
2686 nTmpVal = nLowerBorder;
2695 for (
const auto& rEntry : aBoundaries )
2699 const std::pair< tools::Long, long > aTmpPair = rEntry.second;
2703 aHiddenIter = aHidden.find( rEntry.first );
2704 const bool bHidden = aHiddenIter != aHidden.end() && (*aHiddenIter).second;
2705 rFill.
Insert( nKey, nFirst, nSecond, bHidden, nIdx++ );
2709 OSL_ENSURE( rFill.
Count(),
"Deleting from empty vector. Fasten your seatbelts!" );
2730 OSL_ENSURE(
false,
"must specify pBoxFrame" );
2746 aShadow.CalcShadowSpace( SvxShadowItemSide::RIGHT );
2748 if( nPrtWidth != rTableFrameSz.
GetWidth() )
2759 aRectFnSet.
GetLeft(pPage->getFrameArea());
2761 aRectFnSet.
GetLeft(pPage->getFrameArea());
2764 aOld.SetLeftMin ( nLeftMin );
2767 aOld.SetRightMax( nRightMax - nLeftMin );
2770 SetTabCols(rTab, rNew, aOld, pBox, bCurRowOnly );
2784 OSL_ENSURE(
false,
"must specify pBoxFrame" );
2798 if ( aRectFnSet.
IsVert() )
2800 nLeftMin = pTab->
GetPrtLeft() - pPage->getFrameArea().Left();
2802 aOld.SetRightMax( aOld.GetRight() );
2807 nLeftMin = pTab->
GetPrtTop() - pPage->getFrameArea().Top();
2811 aOld.SetLeftMin ( nLeftMin );
2820 OSL_ENSURE( pTable,
"My colleague told me, this couldn't happen" );
2822 for (
size_t i = 0;
i <= nCount; ++
i )
2824 const size_t nIdxStt = aRectFnSet.
IsVert() ? nCount -
i :
i - 1;
2825 const size_t nIdxEnd = aRectFnSet.
IsVert() ? nCount -
i - 1 :
i;
2827 const tools::Long nOldRowStart =
i == 0 ? 0 : aOld[ nIdxStt ];
2828 const tools::Long nOldRowEnd =
i == nCount ? aOld.GetRight() : aOld[ nIdxEnd ];
2829 const tools::Long nOldRowHeight = nOldRowEnd - nOldRowStart;
2831 const tools::Long nNewRowStart =
i == 0 ? 0 : rNew[ nIdxStt ];
2833 const tools::Long nNewRowHeight = nNewRowEnd - nNewRowStart;
2835 const tools::Long nDiff = nNewRowHeight - nOldRowHeight;
2848 while ( pFrame && pTab->
IsAnLower( pFrame ) )
2856 if ( !bCurColOnly || pFrame == pBoxFrame )
2863 const sal_Int32 nRowSpan = pBox->
getRowSpan();
2865 pTextFrame =
static_cast<const SwTextFrame*
>(pContent);
2868 if( pLine && pTextFrame )
2873 if( nNewSize != aNew.GetHeight() )
2875 aNew.SetHeight( nNewSize );
2879 const SwPosition aPos(*static_cast<const SwTextFrame*>(pContent)->GetTextNodeFirst());
2880 const SwCursor aTmpCursor( aPos,
nullptr );
2912 std::make_unique<SwUndoAttrTable>( *rTab.
GetTableNode(), true ));
2914 rTab.
SetTabCols( rNew, rOld, pStart, bCurRowOnly );
2927 std::make_unique<SwUndoTableHeadline>(rTable, rTable.
GetRowsToRepeat(), nSet) );
2956 std::vector<sal_uInt16>::size_type
n;
2980 std::vector<sal_uInt16>::size_type
n;
3003 for( n = 0; n < nArrSize; ++n )
3019 for(
const auto& rpBox : const_cast<SwTableLine*>(rpLine)->GetTabBoxes() )
3022 for(
auto& rpBox : const_cast<SwTableLine*>(rpLine)->GetTabBoxes() )
3042 pSplPara->
AddBox( *pBox );
3071 if( aNew != rBoxItem )
3083 if( aTmpSet.Count() )
3127 if( dynamic_cast<const SwDDETable*>( &pTNd->
GetTable() ) !=
nullptr)
3163 FndBox_ aFndBox(
nullptr,
nullptr );
3176 *pNew, std::move(pSaveRowSp), eHdlnMode, bCalcNewSize);
3178 if( aHistory.
Count() )
3267 if( USHRT_MAX == aTableMaxSz.GetWidth() )
3273 aTableMaxSz.SetWidth( 0 );
3276 for(
auto pLn : rLns )
3280 for(
auto pBox : rBoxes )
3281 nMaxLnWidth += pBox->GetFrameFormat()->GetFrameSize().GetWidth();
3283 if( nMaxLnWidth > aTableMaxSz.GetWidth() )
3284 aTableMaxSz.SetWidth( nMaxLnWidth );
3295 class SplitTable_Para
3297 std::map<SwFrameFormat const*, SwFrameFormat*> m_aSrcDestMap;
3303 : m_pNewTableNode(pNew)
3308 auto it = m_aSrcDestMap.find(pSrcFormat);
3309 return it == m_aSrcDestMap.end() ?
nullptr : it->second;
3314 m_aSrcDestMap[pSrcFormat] = pDestFormat;
3332 if( pDestFormat ==
nullptr )
3347 if( pDestFormat ==
nullptr )
3355 pPara->ChgBox( pBox );
3383 if( USHRT_MAX == nLinePos ||
3397 assert(pOldTableEndNd &&
"Where is the EndNode?");
3405 pNewTableNd->m_pEndOfSection = pOldTableEndNd;
3409 OSL_ENSURE( pBoxNd->
IsStartNode(),
"This needs to be a StartNode!" );
3412 }
while( pBoxNd != pOldTableEndNd );
3430 const SwTableBoxes::size_type nBoxCnt = rTable.
GetTabLines()[ nLineIdx ]->GetTabBoxes().
size();
3431 for (SwTableBoxes::size_type j = 0; j < nBoxCnt; ++j)
3433 const SwTableBoxes::size_type nIdx = nBoxCnt - 1 - j;
3444 SplitTable_Para aPara( pNewTableNd, rTable );
3457 *pNewTableFormat = *pOldTableFormat;
3489 pDelTableNd = rNds[ pTableNd->
GetIndex() - 1 ]->FindTableNode();
3495 if( dynamic_cast<const SwDDETable*>( &pTableNd->
GetTable() ) !=
nullptr ||
3496 dynamic_cast<const SwDDETable*>( &pDelTableNd->GetTable() ) !=
nullptr)
3501 pDelTableNd->GetTable().SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout>());
3505 std::unique_ptr<SwHistory> pHistory;
3517 aMsgHint.m_pHistory = pHistory.get();
3521 SwNodeIndex aIdx( bWithPrev ? *pTableNd : *pDelTableNd );
3522 bool bRet = rNds.
MergeTable( aIdx, !bWithPrev, nMode );
3526 if( pHistory->Count() )
3544 OSL_ENSURE( pDelTableNd,
"Where did the TableNode go?" );
3547 OSL_ENSURE( pTableNd,
"Where did the TableNode go?" );
3549 if( !pDelTableNd || !pTableNd )
3558 FndBox_ aFndBox(
nullptr,
nullptr );
3570 if( rTableSz != rDelTableSz )
3605 pTableNd->m_pEndOfSection = pTableEndNd;
3611 OSL_ENSURE( pBoxNd->
IsStartNode(),
"This needs to be a StartNode!" );
3614 }
while( pBoxNd != pTableEndNd );
3647 struct SetAFormatTabPara
3651 sal_uInt16 nEndBox, nCurBox;
3653 bool bSingleRowTable;
3657 nEndBox( 0 ), nCurBox( 0 ), nAFormatLine( 0 ), nAFormatBox( 0 ), bSingleRowTable(
false)
3669 for (
auto const& it : rLine.
GetBoxes())
3680 if( !pSetPara->nCurBox )
3681 pSetPara->nAFormatBox = 0;
3682 else if( pSetPara->nCurBox == pSetPara->nEndBox )
3683 pSetPara->nAFormatBox = 3;
3685 pSetPara->nAFormatBox =
static_cast<sal_uInt8>(1 + ((pSetPara->nCurBox-1) & 1));
3699 sal_uInt8 nPos = pSetPara->nAFormatLine * 4 + pSetPara->nAFormatBox;
3700 const bool bSingleRowTable = pSetPara->bSingleRowTable;
3701 const bool bSingleColTable = pSetPara->nEndBox == 0;
3705 if (aCharSet.Count())
3709 for (; nSttNd < nEndNd; ++nSttNd)
3717 if (aBoxSet.Count())
3719 if (pSetPara->pUndo && SfxItemState::SET == aBoxSet.GetItemState(
RES_BOXATR_FORMAT))
3720 pSetPara->pUndo->SaveBoxContent( *pSetBox );
3730 const bool bOrigSingleRowTable = pSetPara->bSingleRowTable;
3731 pSetPara->bSingleRowTable = rBox.
GetLines().size() == 1;
3732 for (
auto const& rpFndLine : rBox.
GetLines())
3736 pSetPara->bSingleRowTable = bOrigSingleRowTable;
3740 ++pSetPara->nCurBox;
3746 OSL_ENSURE( !rBoxes.
empty(),
"No valid Box list" );
3752 FndBox_ aFndBox(
nullptr,
nullptr );
3754 FndPara aPara( rBoxes, &aFndBox );
3764 while( 1 == pFndBox->
GetLines().size() &&
3765 1 == pFndBox->
GetLines().front()->GetBoxes().size())
3767 pFndBox = pFndBox->
GetLines().front()->GetBoxes()[0].get();
3785 pTableNd->GetTable().SetTableStyleName(rNew.
GetName());
3790 SetAFormatTabPara aPara( rNew );
3792 aPara.bSingleRowTable = rFLns.size() == 1;
3794 for (FndLines_t::size_type
n = 0;
n < rFLns.size(); ++
n)
3803 aPara.nAFormatLine = 0;
3804 else if (static_cast<size_t>(
n+1) == rFLns.size())
3805 aPara.nAFormatLine = 3;
3807 aPara.nAFormatLine = static_cast<sal_uInt8>(1 + ((
n-1) & 1 ));
3809 aPara.nAFormatBox = 0;
3811 aPara.nEndBox = pLine->
GetBoxes().size()-1;
3812 aPara.pUndo = pUndo;
3813 for (
auto const& it : pLine->
GetBoxes())
3837 OSL_ENSURE( !rBoxes.
empty(),
"No valid Box list" );
3843 FndBox_ aFndBox(
nullptr,
nullptr );
3845 FndPara aPara( rBoxes, &aFndBox );
3856 while( 1 == pFndBox->
GetLines().size() &&
3857 1 == pFndBox->
GetLines().front()->GetBoxes().size())
3859 pFndBox = pFndBox->
GetLines().front()->GetBoxes()[0].get();
3867 sal_uInt16 aLnArr[4];
3869 aLnArr[1] = 1 < rFLns.size() ? 1 : 0;
3870 aLnArr[2] = 2 < rFLns.size() ? 2 : aLnArr[1];
3871 aLnArr[3] = rFLns.size() - 1;
3873 for(
sal_uInt8 nLine = 0; nLine < 4; ++nLine )
3875 FndLine_& rLine = *rFLns[ aLnArr[ nLine ] ];
3877 sal_uInt16 aBoxArr[4];
3879 aBoxArr[1] = 1 < rLine.
GetBoxes().size() ? 1 : 0;
3880 aBoxArr[2] = 2 < rLine.
GetBoxes().size() ? 2 : aBoxArr[1];
3881 aBoxArr[3] = rLine.
GetBoxes().size() - 1;
3883 for(
sal_uInt8 nBox = 0; nBox < 4; ++nBox )
3888 pFBox = pFBox->
GetTabLines()[0]->GetTabBoxes()[0];
3922 OUString
newName =
"MailMergeTable"
3932 std::unique_ptr<sal_uInt8[]> pSetFlags(
new sal_uInt8[ nFlagSize ] );
3933 memset( pSetFlags.get(), 0, nFlagSize );
3939 pFormat->
GetName().startsWith( aName ) )
3942 const sal_Int32 nNmLen = aName.getLength();
3944 if( nNum-- && nNum < mpTableFrameFormatTable->
size() )
3945 pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
3951 for(
size_t n = 0;
n < nFlagSize; ++
n )
3953 auto nTmp = pSetFlags[
n ];
3967 return aName + OUString::number( ++nNum );
3979 for( ; it != itEnd; ++it )
3997 std::unique_ptr<SwUndo> pUndo;
4013 eType, nAbsDiff, nRelDiff,
4014 bUndo ? &pUndo :
nullptr );
4021 eType, nAbsDiff, nRelDiff,
4022 bUndo ? &pUndo :
nullptr );
4041 if( rString.getLength() > 308 )
4045 OUStringBuffer sStringBuffer(rString);
4047 while( nCommentPosition != -1 )
4049 sStringBuffer.remove( nCommentPosition, 1 );
4050 nCommentPosition = sStringBuffer.indexOf(
CH_TXTATR_INWORD, nCommentPosition );
4064 std::unique_ptr<SwUndoTableNumFormat> pUndo;
4066 bool bIsEmptyTextNd;
4068 sal_uInt32 nFormatIdx;
4070 if( rBox.
HasNumContent( fNumber, nFormatIdx, bIsEmptyTextNd ) )
4080 pUndo->SetNumFormat( nFormatIdx, fNumber );
4086 bool bLockModify =
true;
4093 if( pNumFormatItem && !bForceNumberFormat )
4099 if( nFormatType == pNumFormatr->
GetType( nOldNumFormat ) || SvNumFormatType::NUMBER == nFormatType )
4103 nFormatIdx = nOldNumFormat;
4104 bSetNumberFormat =
true;
4110 bLockModify = bSetNumberFormat =
false;
4114 if( bSetNumberFormat || bForceNumberFormat )
4124 if( !bSetNumberFormat && !bIsEmptyTextNd && pNumFormatItem )
4135 if( bSetNumberFormat )
4156 if( !bIsEmptyTextNd )
4175 pUndo->SetBox( rBox );
4223 if (
nullptr == pNode )
4230 && pTextNode->
GetText().isEmpty()))
4235 pTextNode->SwContentNode::GetAttr( rSet );
4253 std::unique_ptr<SfxStringItem> pNewItem(pFormatItem->
Clone());
4254 pNewItem->SetValue(OUString());
4255 rSet.Put( std::move(pNewItem) );
4262 if(
nullptr == pSttNd ||
4305 const SwTable* pCpyTable,
bool bCpyName,
bool bCorrPos,
const OUString& rStyleName )
4311 : rBoxes[ 0 ]->GetSttNd()->FindTableNode();
4316 if( !pCpyTable && !pInsTableNd )
4318 std::unique_ptr<SwUndoCpyTable> pUndo;
4328 bCpyName, rStyleName );
4335 pUndo->SetTableSttIdx( pInsTableNd->
GetIndex() );
4347 std::unique_ptr<SwUndoTableCpyTable> pUndo;
4356 bool bDelCpyDoc = xCpyDoc ==
this;
4361 xCpyDoc =
new SwDoc;
4384 && ( bDelCpyDoc || !rBoxes.
empty() ) )
4394 OSL_ENSURE( pBox,
"Box is not in this Table" );
4403 *pBoxes, pUndo.get() );
4409 aNdIdx, pUndo.get() );
4418 if( bRet || !pUndo->IsEmpty() )
4426 rInsPos.
nNode = *pSttNd;
4443 std::unique_ptr<SwUndoAttrTable> pUndo;
4448 for (
size_t i = rSrtBox.
size();
i; )
4458 if( pUndo && bChgd )
4477 if( !rBoxes.
empty() )
4479 std::unique_ptr<SwUndoAttrTable> pUndo;
4481 pUndo.reset(
new SwUndoAttrTable( *rBoxes[0]->GetSttNd()->FindTableNode() ));
4483 std::map<SwFrameFormat*, SwTableBoxFormat*> aFormatsMap;
4484 for (
size_t i = rBoxes.
size();
i; )
4490 std::map<SwFrameFormat*, SwTableBoxFormat*>::const_iterator
const it =
4491 aFormatsMap.find(pBoxFormat);
4492 if (aFormatsMap.end() != it)
4499 aFormatsMap.insert(std::make_pair(pBoxFormat, pNewBoxFormat));
4505 if( pUndo && bChgd )
4515 bool bChgd =
false, bHasSel = rPam.
HasMark() ||
4520 for(
auto n = rFormats.
size();
n ; )
4530 bool bFound =
false;
4534 *pEnd = pTmp->
End();
4536 nTableIdx < pEnd->nNode.GetIndex();
4538 }
while( !bFound && &rPam != ( pTmp = pTmp->
GetNext() ) );
4553 const OUString* pTableName,
4554 bool* pFullTableProtection )
4556 bool bHasProtection =
false;
4570 for (
size_t i = rSrtBox.
size();
i; )
4575 if( !bHasProtection )
4577 bHasProtection =
true;
4578 if( !pFullTableProtection )
4580 *pFullTableProtection =
true;
4583 else if( bHasProtection && pFullTableProtection )
4585 *pFullTableProtection =
false;
4590 return bHasProtection;
4604 std::make_unique<SwUndoTableStyleMake>(rName, *
this));
4610 return pTableFormat;
4620 std::vector<SwTable*> vAffectedTables;
4621 if (pReleasedFormat)
4624 for (
size_t i=0;
i < nTableCount; ++
i)
4631 vAffectedTables.push_back(pTable);
4640 std::make_unique<SwUndoTableStyleDelete>(std::move(pReleasedFormat), std::move(vAffectedTables), *
this));
4644 return pReleasedFormat;
4654 *pFormat = rNewFormat;
4658 for (
size_t i=0;
i < nTableCount; ++
i)
4671 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)
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)
static const sal_Int16 VeryThin
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)
SwNodeOffset EndOfSectionIndex() const
void SetRowsToRepeat(sal_uInt16 nNumOfRows)
Represents the style of a paragraph.
void RegisterToFormat(SwFormat &rFormat)
void SetTableNodeOffset(SwNodeOffset nIdx)
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
Marks a position in the document model.
bool IsSectionNode() const
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CTL_FONT(27)
void SetLeft(tools::Long nNew)
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
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
void DelFrames(SwRootFrame const *pLayout=nullptr)
Method deletes all views of document for the node.
SwPageDesc * GetPageDesc()
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
SwDocShell * GetDocShell()
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
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.
SwNodeOffset StartOfSectionIndex() const
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.
SwTableFormat * FindTableFormatByName(const OUString &rName, bool bAll=false) const
SwFrameFormat * ClaimFrameFormat()
void DelFrames(SwTable &rTable)
exports com.sun.star. table
bool IsGetFromTop() const
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
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
constexpr TypedWhichId< SwConditionTextFormatColl > RES_CONDTXTFMTCOLL(160)
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.
constexpr TypedWhichId< SwTableBoxValue > RES_BOXATR_VALUE(152)
SwNodeOffset abs(const SwNodeOffset &a)
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)
SwNodeOffset GetSttIdx() const
static void lcl_SplitTable_CpyBox(SwTableBox *pBox, SplitTable_Para *pPara)
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
OUString SwResId(TranslateId aId)
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.
void DelNodes(const SwNodeIndex &rStart, SwNodeOffset nCnt=SwNodeOffset(1))
Delete a number of nodes.
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.
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
void SetColRowWidthHeight(SwTableBox &rCurrentBox, TableChgWidthHeightType eType, SwTwips nAbsDiff, SwTwips nRelDiff)
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 UnProtectCells(const OUString &rTableName)
void SetTableModel(bool bNew)
virtual void UpdateTableFields(SfxPoolItem *pHt)=0
virtual void DelLayoutFormat(SwFrameFormat *pFormat)=0
virtual SfxStringItem * Clone(SfxItemPool *=nullptr) const override
SwNode * FindPrvNxtFrameNode(SwNodeIndex &rFrameIdx, const SwNode *pEnd, SwRootFrame const *pLayout=nullptr) const
Search previous / next content node or table node with frames.
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
static void lcl_RemoveBreaks(SwContentNode &rNode, SwTableFormat *const pTableFormat)
iterator insert(iterator aIt, SwTableLine *pLine)
void SetHTMLTableLayout(std::shared_ptr< SwHTMLTableLayout > const &r)
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Dumps the node structure to the given destination (file nodes.xml in the current directory by default...
void CopyHeadlineIntoTable(SwTableNode &rTableNd)
const SwTable & GetTable() const
virtual void DeleteSection(SwNode *pNode)=0
Delete section containing the node.
const SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
SwNodeOffset GetIndex() const
const OUString & GetTableStyleName() const
Return the table style name of this table.
SwTableBox * FindPreviousBox(const SwTable &, const SwTableBox *) const
void UpdateCharts(const OUString &rName) 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)
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()
SwNodeIndex & Assign(SwNodes const &rNds, SwNodeOffset)
bool GoNext(SwNode *pNd, SwIndex *pIdx, sal_uInt16 nMode)
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.