21 #include <com/sun/star/text/HoriOrientation.hpp>
67 #define CHECK_TABLE(t) (t).CheckConsistency();
69 #define CHECK_TABLE(t)
81 explicit CpyTabFrame(
SwFrameFormat* pCurrentFrameFormat) : pNewFrameFormat(
nullptr )
82 { pFrameFormat = pCurrentFrameFormat; }
84 bool operator==(
const CpyTabFrame& rCpyTabFrame )
const
85 {
return pFrameFormat == rCpyTabFrame.pFrameFormat; }
86 bool operator<(
const CpyTabFrame& rCpyTabFrame )
const
87 {
return pFrameFormat < rCpyTabFrame.pFrameFormat; }
94 SwTwips nDiff, nSide, nMaxSize, nLowerDiff;
101 nDiff( nDif ), nSide( nSid ), nMaxSize( nMax ), nLowerDiff( 0 )
108 CR_SetBoxWidth(
const CR_SetBoxWidth& rCpy )
109 : pTableNd( rCpy.pTableNd ),
110 nDiff( rCpy.nDiff ), nSide( rCpy.nSide ),
111 nMaxSize( rCpy.nMaxSize ), nLowerDiff( 0 ),
113 bBigger( rCpy.bBigger ), bLeft( rCpy.bLeft )
134 #define CHECKBOXWIDTH \
136 SwTwips nSize = GetFrameFormat()->GetFrameSize().GetWidth(); \
137 for (size_t nTmp = 0; nTmp < m_aLines.size(); ++nTmp) \
138 ::CheckBoxWidth( *m_aLines[ nTmp ], nSize ); \
141 #define CHECKTABLELAYOUT \
143 for ( size_t i = 0; i < GetTabLines().size(); ++i ) \
145 SwFrameFormat* pFormat = GetTabLines()[i]->GetFrameFormat(); \
146 SwIterator<SwRowFrame,SwFormat> aIter( *pFormat ); \
147 for (SwRowFrame* pFrame=aIter.First(); pFrame; pFrame=aIter.Next())\
149 if ( pFrame->GetTabLine() == GetTabLines()[i] ) \
151 OSL_ENSURE( pFrame->GetUpper()->IsTabFrame(), \
152 "Table layout does not match table structure" ); \
160 #define CHECKBOXWIDTH
161 #define CHECKTABLELAYOUT
167 struct CR_SetLineHeight
176 nMaxSpace( 0 ), nMaxHeight( 0 )
181 CR_SetLineHeight(
const CR_SetLineHeight& rCpy )
182 : pTableNd( rCpy.pTableNd ),
183 nMaxSpace( rCpy.nMaxSpace ), nMaxHeight( rCpy.nMaxHeight ),
185 bBigger( rCpy.bBigger )
204 std::shared_ptr< std::vector< std::vector< sal_uLong > > > pWidths;
212 sal_uInt16 nCpyCnt, nInsPos;
213 sal_uInt16 nLnIdx, nBoxIdx;
218 : rDoc( pNd->
GetDoc() ), pTableNd( pNd ), rTabFrameArr(rFrameArr),
219 pInsLine(
nullptr), pInsBox(
nullptr), nOldSize(0), nNewSize(0),
220 nMinLeft(ULONG_MAX), nMaxRight(0),
221 nCpyCnt(nCopies), nInsPos(0),
222 nLnIdx(0), nBoxIdx(0),
223 nDelBorderFlag(0), bCpyContent(
true )
225 CpyPara(
const CpyPara& rPara,
SwTableLine* pLine )
226 : pWidths( rPara.pWidths ), rDoc(rPara.rDoc), pTableNd(rPara.pTableNd),
227 rTabFrameArr(rPara.rTabFrameArr), pInsLine(pLine), pInsBox(rPara.pInsBox),
228 nOldSize(0), nNewSize(rPara.nNewSize), nMinLeft( rPara.nMinLeft ),
229 nMaxRight( rPara.nMaxRight ), nCpyCnt(rPara.nCpyCnt), nInsPos(0),
230 nLnIdx( rPara.nLnIdx), nBoxIdx( rPara.nBoxIdx ),
231 nDelBorderFlag( rPara.nDelBorderFlag ), bCpyContent( rPara.bCpyContent )
233 CpyPara(
const CpyPara& rPara,
SwTableBox* pBox )
234 : pWidths( rPara.pWidths ), rDoc(rPara.rDoc), pTableNd(rPara.pTableNd),
235 rTabFrameArr(rPara.rTabFrameArr), pInsLine(rPara.pInsLine), pInsBox(pBox),
236 nOldSize(rPara.nOldSize), nNewSize(rPara.nNewSize),
237 nMinLeft( rPara.nMinLeft ), nMaxRight( rPara.nMaxRight ),
238 nCpyCnt(rPara.nCpyCnt), nInsPos(0), nLnIdx(rPara.nLnIdx), nBoxIdx(rPara.nBoxIdx),
239 nDelBorderFlag( rPara.nDelBorderFlag ), bCpyContent( rPara.bCpyContent )
253 if( pCpyPara->nCpyCnt )
257 nFndPos = itFind - pCpyPara->rTabFrameArr.begin();
258 if( itFind == pCpyPara->rTabFrameArr.end() || !(*itFind == aFindFrame) )
267 bool bDiffCount =
false;
270 pCmpLine = rFndBox.
GetLines().front().get();
280 for(
auto n = rFndBoxes.size();
n; )
282 nSz += rFndBoxes[--
n]->GetBox()->
283 GetFrameFormat()->GetFrameSize().GetWidth();
285 aFrameSz.SetWidth( aFrameSz.GetWidth() -
286 nSz / ( pCpyPara->nCpyCnt + 1 ) );
288 aFrameSz.SetWidth( nSz / ( pCpyPara->nCpyCnt + 1 ) );
292 MakeTableLineFormat());
293 *aFindFrame.pNewFrameFormat = *pNewFormat;
298 aFrameSz.SetWidth( aFrameSz.GetWidth() / ( pCpyPara->nCpyCnt + 1 ) );
301 aFindFrame.pNewFrameFormat = pNewFormat;
302 pCpyPara->rTabFrameArr.insert( aFindFrame );
303 aFindFrame.pFrameFormat = pNewFormat;
304 pCpyPara->rTabFrameArr.insert( aFindFrame );
309 aFindFrame = pCpyPara->rTabFrameArr[ nFndPos ];
316 if( pCpyPara->nDelBorderFlag &&
317 itFind != pCpyPara->rTabFrameArr.end() )
318 aFindFrame = *itFind;
325 pBox =
new SwTableBox( aFindFrame.pNewFrameFormat,
326 rFndBox.
GetLines().size(), pCpyPara->pInsLine );
327 pCpyPara->pInsLine->GetTabBoxes().insert( pCpyPara->pInsLine->GetTabBoxes().begin() + pCpyPara->nInsPos++, pBox );
328 CpyPara aPara( *pCpyPara, pBox );
329 aPara.nDelBorderFlag &= 7;
331 for (
auto const& pFndLine : rFndBox.
GetLines())
338 ::InsTableBox( pCpyPara->rDoc, pCpyPara->pTableNd, pCpyPara->pInsLine,
339 aFindFrame.pNewFrameFormat, pBox, pCpyPara->nInsPos++ );
342 if( 8 > pCpyPara->nDelBorderFlag
343 ? pCpyPara->nDelBorderFlag != 0
344 : &rFndBox == rFndBxs[rFndBxs.size() - 1].get())
347 if( 8 > pCpyPara->nDelBorderFlag
354 if( 8 > pCpyPara->nDelBorderFlag )
355 aNew.
SetLine(
nullptr, SvxBoxItemLine::TOP );
357 aNew.
SetLine(
nullptr, SvxBoxItemLine::RIGHT );
359 if( 1 == pCpyPara->nDelBorderFlag ||
360 8 == pCpyPara->nDelBorderFlag )
363 pBox = pCpyPara->pInsLine->GetTabBoxes()[
364 pCpyPara->nInsPos - 1 ];
373 if( !pCpyPara->nCpyCnt )
374 pCpyPara->rTabFrameArr.insert( aFindFrame );
384 rFndLine.
GetBoxes().size(), pCpyPara->pInsBox );
385 if( pCpyPara->pInsBox )
387 SwTableLines& rLines = pCpyPara->pInsBox->GetTabLines();
388 rLines.
insert( rLines.
begin() + pCpyPara->nInsPos++, pNewLine );
392 SwTableLines& rLines = pCpyPara->pTableNd->GetTable().GetTabLines();
393 rLines.
insert( rLines.
begin() + pCpyPara->nInsPos++, pNewLine );
396 CpyPara aPara( *pCpyPara, pNewLine );
397 for (
auto const& it : rFndLine.
GetBoxes())
402 pCpyPara->nDelBorderFlag &= 0xf8;
410 if( 1 == pFndLn->
GetBoxes().size() &&
411 !( pFBox = pFndLn->
GetBoxes()[0].get() )->GetBox()->GetSttNd() )
414 for (
auto &rpLine : pFBox->
GetLines())
416 lcl_InsCol( rpLine.get(), rCpyPara, nCpyCnt, bBehind );
421 rCpyPara.pInsLine = pFndLn->
GetLine();
423 pFndLn->
GetBoxes().size()-1 : 0 ]->GetBox();
428 for( sal_uInt16
n = 0;
n < nCpyCnt; ++
n )
430 if(
n + 1 == nCpyCnt && bBehind )
431 rCpyPara.nDelBorderFlag = 9;
433 rCpyPara.nDelBorderFlag = 8;
434 for (
auto const& it : pFndLn->
GetBoxes())
445 for(
SwRowFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next() )
446 if( pFrame->GetTabLine() == &rLine )
453 OSL_ENSURE( !rBoxes.
empty() && nCnt,
"No valid Box List" );
460 bRes = NewInsertCol( rDoc, rBoxes, nCnt, bBehind );
464 FndBox_ aFndBox(
nullptr,
nullptr );
466 FndPara aPara( rBoxes, &aFndBox );
472 SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout>());
482 CpyPara aCpyPara( pTableNd, nCnt, aTabFrameArr );
484 for (
auto & rpLine : aFndBox.
GetLines())
486 lcl_InsCol( rpLine.get(), aCpyPara, nCnt, bBehind );
502 pPCD->
AddRowCols( *
this, rBoxes, nCnt, bBehind );
511 sal_uInt16 nCnt,
bool bBehind )
513 OSL_ENSURE( pDoc && !rBoxes.
empty() && nCnt,
"No valid Box List" );
519 FndBox_ aFndBox(
nullptr,
nullptr );
521 FndPara aPara( rBoxes, &aFndBox );
527 SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout>());
532 while( 1 == pFndBox->
GetLines().size() )
534 pFndLine = pFndBox->
GetLines()[0].get();
535 if( 1 != pFndLine->
GetBoxes().size() )
547 const bool bLayout = !IsNewModel() &&
553 if( pFndBox != &aFndBox )
560 CpyPara aCpyPara( pTableNd, 0, aTabFrameArr );
563 pFndBox->
GetLines().size()-1 : 0 ]->GetLine();
564 if( &aFndBox == pFndBox )
565 aCpyPara.nInsPos = GetTabLines().GetPos( pLine );
568 aCpyPara.pInsBox = pFndBox->
GetBox();
575 aCpyPara.nDelBorderFlag = 1;
578 aCpyPara.nDelBorderFlag = 2;
580 for( sal_uInt16 nCpyCnt = 0; nCpyCnt < nCnt; ++nCpyCnt )
583 aCpyPara.nDelBorderFlag = 1;
584 for (
auto & rpFndLine : pFndBox->
GetLines())
595 if( pFndBox != &aFndBox )
606 pPCD->
AddRowCols( *
this, rBoxes, nCnt, bBehind );
620 for (
auto pLine : rLines )
627 SwTableBox& rBox = *(bFirst ? rBoxes.front() : rBoxes.back());
630 bFirst, rShareFormats );
635 aNew.
SetWidth( aNew.GetWidth() + nOffset );
647 rShareFormats.
AddFormat( *pBoxFormat, *pFormat );
652 bool bCalcNewSize,
const bool bCorrBorder,
656 SwTwips nBoxSz = bCalcNewSize ?
660 sal_uInt16 nDelPos = pLine->
GetBoxPos( pBox );
664 if( bCorrBorder && 1 < rTableBoxes.size() )
674 if( nDelPos + 1 < static_cast<sal_uInt16>(rTableBoxes.size()) )
676 SwTableBox* pNxtBox = rTableBoxes[ nDelPos + 1 ];
679 SwTableBox* pPrvBox = nDelPos ? rTableBoxes[ nDelPos - 1 ] :
nullptr;
687 SvxBoxItemLine::LEFT );
689 pShareFormats->
SetAttr( *pNxtBox, aTmp );
695 if( !bChgd && nDelPos )
697 SwTableBox* pPrvBox = rTableBoxes[ nDelPos - 1 ];
700 SwTableBox* pNxtBox = nDelPos + 1 <
static_cast<sal_uInt16
>(rTableBoxes.size())
701 ? rTableBoxes[ nDelPos + 1 ] :
nullptr;
709 SvxBoxItemLine::RIGHT );
711 pShareFormats->
SetAttr( *pPrvBox, aTmp );
722 pShareFormats->
RemoveFormat( *rTableBoxes[ nDelPos ]->GetFrameFormat() );
727 delete rTableBoxes[nDelPos];
728 rTableBoxes.erase( rTableBoxes.begin() + nDelPos );
734 static_cast<SwUndoTableNdsChg*>(pUndo)->SaveSection( pSttNd );
740 if( !rTableBoxes.empty() )
743 bool bLastBox = nDelPos == rTableBoxes.size();
746 pBox = rTableBoxes[nDelPos];
750 aNew.
SetWidth( aNew.GetWidth() + nBoxSz );
752 pShareFormats->
SetSize( *pBox, aNew );
762 pShareFormats ? *pShareFormats
780 delete pTabLineToDelete;
795 delete pTabLineToDelete;
803 sal_uInt16 nLinePos,
bool bNxt,
804 SwSelBoxes* pAllDelBoxes,
size_t *
const pCurPos)
814 SwTwips nFndWidth = nBoxStt + nBoxWidth;
819 if ( nFndWidth <= 0 )
825 nFndWidth -= nFndBoxWidth;
838 if( std::abs( nFndWidth ) >
COLFUZZY ||
839 std::abs( nBoxWidth - nFndBoxWidth ) >
COLFUZZY )
841 else if( pAllDelBoxes )
845 if( aFndIt == pAllDelBoxes->
end() )
847 size_t const nFndPos = aFndIt - pAllDelBoxes->
begin() ;
852 if( nFndPos <= *pCurPos )
854 pAllDelBoxes->
erase( pAllDelBoxes->
begin() + nFndPos );
856 }
while( bNxt ? ( nLinePos + 1 < static_cast<sal_uInt16>(rTableLns.
size()) ) : nLinePos != 0 );
864 size_t *
const pCurPos =
nullptr )
870 sal_uInt16 nDelPos = pLine->
GetBoxPos( pUpperBox );
885 sal_uInt16 nLnPos = pTableLns->
GetPos( pLine );
890 for( sal_uInt16
n = 0;
n < nDelPos; ++
n )
891 nBoxStt += rTableBoxes[
n ]->GetFrameFormat()->GetFrameSize().GetWidth();
894 SwTableBox *pPrvBox =
nullptr, *pNxtBox =
nullptr;
897 nLnPos,
false, pAllDelBoxes, pCurPos );
899 if( nLnPos + 1 < static_cast<sal_uInt16>(pTableLns->
size()) )
901 nLnPos,
true, pAllDelBoxes, pCurPos );
903 if( pNxtBox && pNxtBox->GetSttNd() )
905 const SvxBoxItem& rNxtBoxItem = pNxtBox->GetFrameFormat()->GetBox();
906 if( !rNxtBoxItem.
GetTop() && ( !pPrvBox ||
912 SvxBoxItemLine::TOP );
913 rShareFormats.
SetAttr( *pNxtBox, aTmp );
917 if( !(!bChgd && pPrvBox && pPrvBox->
GetSttNd()) )
921 if( !rPrvBoxItem.
GetTop() && ( !pNxtBox ||
922 !pNxtBox->GetFrameFormat()->GetBox().GetTop()) )
927 SvxBoxItemLine::BOTTOM );
928 rShareFormats.
SetAttr( *pPrvBox, aTmp );
938 const bool bDelMakeFrames,
const bool bCorrBorder )
940 OSL_ENSURE( pDoc,
"No doc?" );
942 if( !rBoxes.
empty() )
944 pTableNd =
const_cast<SwTableNode*
>(rBoxes[0]->GetSttNd()->FindTableNode());
949 SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout>());
952 FndBox_ aFndBox(
nullptr,
nullptr );
953 if ( bDelMakeFrames )
955 if( pMerged && !pMerged->
empty() )
957 else if( !rBoxes.
empty() )
968 for (
size_t n = 0;
n < aBoxes.
size(); ++
n)
975 PrepareDelBoxes( rBoxes );
979 for (
size_t n = 0;
n < rBoxes.
size(); ++
n)
981 size_t const nIdx = rBoxes.
size() - 1 -
n;
986 if (pPCD && pTableNd)
990 DeleteBox_( *
this, rBoxes[nIdx], pUndo,
true, bCorrBorder, &aShareFormats );
1011 OSL_ENSURE( !rBoxes.
empty() && nCnt,
"No valid values" );
1021 SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout>());
1025 std::unique_ptr<tools::Long[]> pRowHeights;
1029 for (
size_t n = 0;
n < rBoxes.
size(); ++
n)
1033 OSL_ENSURE( pRow,
"Where is the SwTableLine's Frame?" );
1040 FndBox_ aFndBox(
nullptr,
nullptr );
1044 for (
size_t n = 0;
n < rBoxes.
size(); ++
n)
1047 OSL_ENSURE( pSelBox,
"Box is not within the Table" );
1058 bool bChgLineSz = 0 != aFSz.GetHeight() || bSameHeight;
1060 aFSz.SetHeight( ( bSameHeight ? pRowHeights[
n ] : aFSz.GetHeight() ) /
1064 sal_uInt16 nBoxPos = pInsLine->
GetBoxPos( pSelBox );
1071 bool bMoveNodes =
true;
1075 while( nSttNd < nEndNd )
1076 if( !rDoc.
GetNodes()[ nSttNd++ ]->IsTextNode() )
1084 bool bChkBorder =
nullptr != pCpyBoxFrameFormat->
GetBox().
GetTop();
1088 for( sal_uInt16
i = 0;
i <= nCnt; ++
i )
1092 static_cast<SwTableLineFormat*>(pInsLine->
GetFrameFormat()), 1, pNewBox );
1107 ::InsTableBox( rDoc, pTableNd, pNewLine, pCpyBoxFrameFormat,
1114 aTmp.
SetLine(
nullptr, SvxBoxItemLine::TOP );
1140 pRowHeights.reset();
1153 OSL_ENSURE( !rBoxes.
empty() && nCnt,
"No valid values" );
1163 SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout>());
1165 ExpandSelection( aSelBoxes );
1168 FndBox_ aFndBox(
nullptr,
nullptr );
1173 std::vector<SwTableBoxFormat*> aLastBoxArr;
1174 for (
size_t n = 0;
n < aSelBoxes.
size(); ++
n)
1177 OSL_ENSURE( pSelBox,
"Box is not in the table" );
1185 sal_uInt16 nBoxPos = pInsLine->
GetBoxPos( pSelBox );
1189 CpyTabFrame aFindFrame( static_cast<SwTableBoxFormat*>(pSelBox->
GetFrameFormat()) );
1191 const size_t nFndPos = itFind - aFrameArr.
begin();
1192 if( itFind == aFrameArr.
end() || !(*itFind == aFindFrame) )
1196 SwTwips nBoxSz = aFindFrame.pNewFrameFormat->GetFrameSize().GetWidth();
1197 SwTwips nNewBoxSz = nBoxSz / ( nCnt + 1 );
1200 aFrameArr.
insert( aFindFrame );
1202 pLastBoxFormat = aFindFrame.pNewFrameFormat;
1203 if( nBoxSz != ( nNewBoxSz * (nCnt + 1)))
1209 nBoxSz - ( nNewBoxSz * nCnt ), 0 ) );
1211 aLastBoxArr.insert( aLastBoxArr.begin() + nFndPos, pLastBoxFormat );
1215 aFindFrame = aFrameArr[ nFndPos ];
1217 pLastBoxFormat = aLastBoxArr[ nFndPos ];
1221 for( sal_uInt16
i = 1;
i < nCnt; ++
i )
1222 ::
InsTableBox( rDoc, pTableNd, pInsLine, aFindFrame.pNewFrameFormat,
1223 pSelBox, nBoxPos +
i );
1226 pSelBox, nBoxPos + nCnt );
1229 const SvxBoxItem& aSelBoxItem = aFindFrame.pNewFrameFormat->GetBox();
1232 pInsLine->
GetTabBoxes()[ nBoxPos + nCnt ]->ClaimFrameFormat();
1235 aTmp.
SetLine(
nullptr, SvxBoxItemLine::RIGHT );
1236 aFindFrame.pNewFrameFormat->SetFormatAttr( aTmp );
1239 for(
auto i = aFrameArr.
size();
i; )
1241 const CpyTabFrame& rCTF = aFrameArr[ --
i ];
1242 if( rCTF.pNewFrameFormat == aFindFrame.pNewFrameFormat ||
1243 rCTF.pFrameFormat == aFindFrame.pNewFrameFormat )
1246 aLastBoxArr.erase( aLastBoxArr.begin() +
i );
1279 for( sal_uInt16
n = nStt;
n < nEnd; ++
n )
1280 rLines[
n]->SetUpper( pInsBox );
1284 rLines.
begin() + nStt, rLines.
begin() + nEnd );
1292 for( sal_uInt16
n = nStt;
n < nEnd; ++
n )
1293 rBoxes[
n]->SetUpper( pInsLine );
1296 rBoxes.begin() + nStt, rBoxes.begin() + nEnd );
1297 rBoxes.erase( rBoxes.begin() + nStt, rBoxes.begin() + nEnd );
1304 OSL_ENSURE( pBox->
GetTabLines().
size(),
"Box does not have any Lines" );
1307 OSL_ENSURE( pLine,
"Box is not within a Line" );
1310 for(
auto pTabBox : pLine->GetTabBoxes() )
1311 nWidth += pTabBox->GetFrameFormat()->GetFrameSize().GetWidth();
1335 : pTableNd( pTNd ), pInsLine( pLine ), pInsBox( nullptr ),
1337 { bUL_LR =
true; bUL =
true; }
1340 { bUL_LR =
false; bUL =
true;
if( pBox ) pInsBox = pBox; }
1342 { bUL_LR =
false; bUL =
false;
if( pBox ) pInsBox = pBox; }
1344 { bUL_LR =
true; bUL =
false;
if( pLine ) pInsLine = pLine; }
1355 sal_uInt16 nStt = 0, nEnd = rFndBox.
GetLines().size();
1357 if( !pULPara->bUL_LR )
1373 if( nPos +1 < static_cast<sal_uInt16>(pBoxes->size()) )
1375 nInsPos = pULPara->pInsLine->GetTabBoxes().size();
1377 *pBoxes, pULPara->pInsLine );
1382 else if (!rFndBox.
GetLines().empty())
1385 nStt = pULPara->bUL ? 0 : rFndBox.
GetLines().size()-1;
1389 pBoxes = &pULPara->pInsLine->GetTabBoxes();
1397 0, pULPara->pInsLine );
1398 InsULPara aPara( *pULPara );
1399 aPara.pInsBox = pBox;
1400 for (FndLines_t::iterator it = rFndBox.
GetLines().begin() + nStt;
1401 it != rFndBox.
GetLines().begin() + nEnd; ++it )
1408 nInsPos = pBoxes->size();
1409 pBoxes->insert( pBoxes->begin() + nInsPos, pBox );
1420 sal_uInt16 nStt = 0, nEnd = rFndLine.
GetBoxes().size();
1422 if( pULPara->bUL_LR )
1428 &pULPara->pTableNd->GetTable().GetTabLines();
1432 sal_uInt16 nLeft = pFndLn->
GetBoxPos( pLBx );
1433 sal_uInt16 nRight = pFndLn->
GetBoxPos( pRBx );
1435 if( !nLeft || nRight == pFndLn->
GetTabBoxes().size() )
1440 nPos = pLines->
GetPos( pFndLn );
1446 if( (nPos = pLines->
GetPos( pFndLn )) + 1 < static_cast<sal_uInt16>(pLines->
size()) )
1448 nInsPos = pULPara->pInsBox->GetTabLines().size();
1459 SwTableLine* pInsLine = pULPara->pLeftBox->GetUpper();
1461 static_cast<SwTableBoxFormat*>(pULPara->pLeftBox->GetFrameFormat()), 0, pInsLine );
1463 static_cast<SwTableLineFormat*>(pInsLine->
GetFrameFormat()), 2, pLMBox );
1475 nPos = pLines->
GetPos( pFndLn );
1481 if( (nPos = pLines->
GetPos( pFndLn )) + 1 < static_cast<sal_uInt16>(pLines->
size()) )
1491 nStt = pULPara->bUL ? 0 : rFndLine.
GetBoxes().size()-1;
1494 pLines = &pULPara->pInsBox->GetTabLines();
1498 InsULPara aPara( *pULPara );
1499 aPara.pInsLine = pNewLine;
1501 for (FndBoxes_t::iterator it = rLineBoxes.begin() + nStt;
1502 it != rLineBoxes.begin() + nEnd; ++it)
1510 nInsPos = pLines->
size();
1511 pLines->
insert( pLines->
begin() + nInsPos, pNewLine );
1522 OSL_ENSURE( !rBoxes.
empty() && pMergeBox,
"no valid values" );
1528 FndBox_ aFndBox(
nullptr,
nullptr );
1530 FndPara aPara( rBoxes, &aFndBox );
1541 SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout>());
1551 while( 1 == pFndBox->
GetLines().size() &&
1552 1 == pFndBox->
GetLines().front()->GetBoxes().size() )
1554 pFndBox = pFndBox->
GetLines().front()->GetBoxes().front().get();
1558 static_cast<SwTableLineFormat*>(pFndBox->
GetLines().front()->GetLine()->GetFrameFormat()), 0,
1567 sal_uInt16 nInsPos = pLines->
GetPos( pNewLine );
1568 pLines->
insert( pLines->
begin() + nInsPos, pInsLine );
1581 InsULPara aPara( pTableNd, pLeftBox, pInsLine );
1584 for (
auto & it : pFndBox->
GetLines().front()->GetBoxes())
1588 aPara.SetLower( pInsLine );
1589 const auto nEnd = pFndBox->
GetLines().size()-1;
1590 for (
auto & it : pFndBox->
GetLines()[nEnd]->GetBoxes())
1596 aPara.SetLeft( pLeftBox );
1597 for (
auto & rpFndLine : pFndBox->
GetLines())
1602 aPara.SetRight( pRightBox );
1603 for (
auto & rpFndLine : pFndBox->
GetLines())
1609 DeleteBox_( *
this, pLeftBox,
nullptr,
false,
false );
1613 if( pUndo && pLeftBox->
GetSttNd() )
1617 DeleteBox_( *
this, pRightBox,
nullptr,
false,
false );
1621 if( pUndo && pRightBox->
GetSttNd() )
1625 DeleteSel( pDoc, rBoxes,
nullptr,
nullptr,
false,
false );
1630 for(
const auto& rpBox : GetTabLines()[0]->GetTabBoxes() )
1652 if( nRowSpan > nMaxSpan )
1654 else if( nRowSpan < nMinSpan )
1655 pBox->
setRowSpan( nMinSpan > 0 ? nMaxSpan : nMinSpan );
1658 nMinSpan = -nMaxSpan;
1665 const FndBox_* pFirstBox = &rBox;
1666 while (!pFirstBox->
GetLines().empty())
1668 pFirstBox = pFirstBox->
GetLines().front()->GetBoxes().front().get();
1671 sal_uInt16 nRet = 0;
1676 for(
auto pCmp : rBoxes )
1680 nRet = nRet +
static_cast<sal_uInt16
>(pCmp->GetFrameFormat()->GetFrameSize().GetWidth());
1689 sal_uInt16 nRet = 0;
1692 nRet = nRet +
static_cast<sal_uInt16
>(rLine.
GetBoxes()[--
n]->GetBox()
1693 ->GetFrameFormat()->GetFrameSize().GetWidth());
1700 rPara.pWidths.reset();
1701 const size_t nLineCount = rFndLines.size();
1704 rPara.pWidths = std::make_shared< std::vector< std::vector< sal_uLong > > >
1708 for(
size_t nLine = 0; nLine < nLineCount; ++nLine )
1710 std::vector< sal_uLong > &rWidth = (*rPara.pWidths)[ nLine ];
1711 const FndLine_ *pFndLine = rFndLines[ nLine ].get();
1712 if( pFndLine && !pFndLine->
GetBoxes().empty() )
1721 pFndLine->
GetBoxes().front()->GetBox();
1724 while( nBox < nBoxCount )
1733 if( rPara.nMinLeft > nPos )
1734 rPara.nMinLeft = nPos;
1735 nBoxCount = pFndLine->
GetBoxes().size();
1736 rWidth = std::vector< sal_uLong >( nBoxCount+2 );
1740 for( nBox = 0; nBox < nBoxCount; )
1743 ->GetBox()->GetFrameFormat()->GetFrameSize().GetWidth();
1744 rWidth[ ++nBox ] = nPos;
1747 if( rPara.nMaxRight < nPos )
1748 rPara.nMaxRight = nPos;
1749 if( nPos <= rWidth[ 0 ] )
1756 sal_uLong nSelSize = rPara.nMaxRight - rPara.nMinLeft;
1760 for(
size_t nLine = 0; nLine < nLineCount; ++nLine )
1762 std::vector< sal_uLong > &rWidth = (*rPara.pWidths)[ nLine ];
1763 const size_t nCount = rWidth.size();
1766 rWidth[ nCount - 1 ] = rPara.nMaxRight;
1768 for(
size_t nBox = 0; nBox < nCount; ++nBox )
1770 sal_uInt64 nNextPos = rWidth[ nBox ];
1771 nNextPos -= rPara.nMinLeft;
1772 nNextPos *= rPara.nNewSize;
1773 nNextPos /= nSelSize;
1774 rWidth[ nBox ] =
static_cast<sal_uLong>(nNextPos - nLastPos);
1775 nLastPos =
static_cast<sal_uLong>(nNextPos);
1790 if( pCpyPara->pTableNd->GetTable().IsNewModel() )
1792 if( pCpyPara->nBoxIdx == 1 )
1793 nDummy1 = (*pCpyPara->pWidths)[pCpyPara->nLnIdx][0];
1794 nRealSize = (*pCpyPara->pWidths)[pCpyPara->nLnIdx][pCpyPara->nBoxIdx++];
1795 if( pCpyPara->nBoxIdx == (*pCpyPara->pWidths)[pCpyPara->nLnIdx].size()-1 )
1796 nDummy2 = (*pCpyPara->pWidths)[pCpyPara->nLnIdx][pCpyPara->nBoxIdx];
1800 nRealSize = pCpyPara->nNewSize;
1802 if (pCpyPara->nOldSize == 0)
1804 nRealSize /= pCpyPara->nOldSize;
1808 bool bDummy = nDummy1 > 0;
1821 std::shared_ptr<SwFormatFrameSize> aFrameSz(std::make_shared<SwFormatFrameSize>());
1835 bool DoCopyIt(itFind == pCpyPara->rTabFrameArr.end());
1839 DoCopyIt = !(*itFind == aFindFrame);
1844 aFindFrame = pCpyPara->rTabFrameArr[ nFndPos ];
1845 aFrameSz.reset(aFindFrame.pNewFrameFormat->GetFrameSize().Clone());
1846 DoCopyIt = aFrameSz->GetWidth() !=
static_cast<SwTwips>(nSize);
1852 aFindFrame.pNewFrameFormat = pCpyPara->rDoc.MakeTableBoxFormat();
1854 if( !pCpyPara->bCpyContent )
1856 aFrameSz->SetWidth( nSize );
1857 aFindFrame.pNewFrameFormat->SetFormatAttr( *aFrameSz );
1858 pCpyPara->rTabFrameArr.insert( aFindFrame );
1864 pBox =
new SwTableBox( aFindFrame.pNewFrameFormat,
1865 rFndBox.
GetLines().size(), pCpyPara->pInsLine );
1866 pCpyPara->pInsLine->GetTabBoxes().insert( pCpyPara->pInsLine->GetTabBoxes().begin() + pCpyPara->nInsPos++, pBox );
1867 CpyPara aPara( *pCpyPara, pBox );
1868 aPara.nNewSize = nSize;
1869 for (
auto const& rpFndLine : rFndBox.
GetLines())
1877 pCpyPara->rDoc.GetNodes().InsBoxen( pCpyPara->pTableNd, pCpyPara->pInsLine,
1878 aFindFrame.pNewFrameFormat,
1879 pCpyPara->rDoc.GetDfltTextFormatColl(),
1880 nullptr, pCpyPara->nInsPos );
1881 pBox = pCpyPara->pInsLine->GetTabBoxes()[ pCpyPara->nInsPos ];
1884 else if( pCpyPara->bCpyContent )
1891 SfxItemSet aBoxAttrSet( pCpyPara->rDoc.GetAttrPool(),
1894 if( aBoxAttrSet.Count() )
1903 if( nNewIdx != nOldIdx )
1916 pCpyPara->rDoc.GetNodes().Delete( aInsIdx );
1918 ++pCpyPara->nInsPos;
1942 if( itFind == pCpyPara->rTabFrameArr.end() )
1945 aFindFrame.pNewFrameFormat =
reinterpret_cast<SwTableBoxFormat*
>(pCpyPara->rDoc.MakeTableLineFormat());
1947 pCpyPara->rTabFrameArr.insert( aFindFrame );
1950 aFindFrame = *itFind;
1952 SwTableLine* pNewLine =
new SwTableLine( reinterpret_cast<SwTableLineFormat*>(aFindFrame.pNewFrameFormat),
1953 rFndLine.
GetBoxes().size(), pCpyPara->pInsBox );
1954 if( pCpyPara->pInsBox )
1956 SwTableLines& rLines = pCpyPara->pInsBox->GetTabLines();
1957 rLines.
insert( rLines.
begin() + pCpyPara->nInsPos++, pNewLine );
1961 SwTableLines& rLines = pCpyPara->pTableNd->GetTable().GetTabLines();
1962 rLines.
insert( rLines.
begin() + pCpyPara->nInsPos++, pNewLine);
1965 CpyPara aPara( *pCpyPara, pNewLine );
1967 if( pCpyPara->pTableNd->GetTable().IsNewModel() )
1972 else if( rFndLine.
GetBoxes().size() ==
1981 pFormat = pCpyPara->pTableNd->GetTable().GetFrameFormat();
1986 for (
auto &rpBox : rFndLine.
GetBoxes())
1988 aPara.nOldSize += rpBox->GetBox()->GetFrameFormat()->GetFrameSize().GetWidth();
1992 for (
auto const& it : rBoxes)
1996 if( pCpyPara->pTableNd->GetTable().IsNewModel() )
2006 SelLineFromBox( pBox, aSelBoxes );
2008 FndBox_ aFndBox(
nullptr,
nullptr );
2010 FndPara aPara( aSelBoxes, &aFndBox );
2020 GetFrameFormat()->GetDoc()->getIDocumentFieldsAccess().UpdateTableFields( &aMsgHint );
2024 CpyPara aPara( &rTableNd, 1, aCpyFormat );
2029 for (
const auto & rpFndLine : aFndBox.
GetLines())
2036 OSL_ENSURE( !pLine->
GetTabBoxes().empty(),
"Empty Table Line" );
2039 OSL_ENSURE( pTableBox,
"Missing Table Box" );
2040 pTableBox->setRowSpan( 1 );
2047 bool bCpyName )
const
2050 FndBox_ aFndBox(
nullptr,
nullptr );
2052 FndPara aPara( rSelBoxes, &aFndBox );
2060 SwDoc* pSrcDoc = GetFrameFormat()->GetDoc();
2061 if( pSrcDoc != &rInsDoc )
2069 rPos, 1, 1, GetFrameFormat()->GetHoriOrient().GetHoriOrient(),
2070 nullptr,
nullptr,
false, IsNewModel() ));
2077 OSL_ENSURE( pTableNd,
"Where is the TableNode now?" );
2083 if(
auto pSwDDETable = dynamic_cast<const SwDDETable*>(
this) )
2088 *pSwDDETable->GetDDEFieldType() );
2089 OSL_ENSURE( pFieldType,
"unknown FieldType" );
2093 static_cast<SwDDEFieldType*>(pFieldType) );
2094 pTableNd->
SetNewTable( std::unique_ptr<SwTable>(pNewTable),
false );
2117 CpyPara aPara( pTableNd, 1, aCpyFormat );
2118 aPara.nNewSize = aPara.nOldSize = GetFrameFormat()->GetFrameSize().GetWidth();
2123 for (
const auto & rpFndLine : aFndBox.
GetLines())
2133 sal_uInt16 nLnPos = GetTabLines().GetPos( pTmp );
2139 pLn = GetTabLines()[ nLnPos - 1 ];
2153 pFndLn = aFndBox.
GetLines().back().get();
2156 nLnPos = GetTabLines().GetPos( pTmp );
2157 if( nLnPos < GetTabLines().
size() - 1 )
2162 pLn = GetTabLines()[ nLnPos + 1 ];
2179 nullptr,
false, false );
2195 const SwTableBox* pSrchBox,
bool bOvrTableLns )
const
2200 if( !GetTabBoxes().empty() && pSrchBox )
2202 nFndPos = GetBoxPos( pSrchBox );
2204 nFndPos + 1 != static_cast<sal_uInt16>(GetTabBoxes().
size()) )
2206 pBox = GetTabBoxes()[ nFndPos + 1 ];
2216 OSL_ENSURE(
USHRT_MAX != nFndPos,
"Line is not in the Table" );
2218 if( nFndPos+1 >= static_cast<sal_uInt16>(GetUpper()->GetTabLines().
size()) )
2219 return GetUpper()->GetUpper()->FindNextBox( rTable, GetUpper(), bOvrTableLns );
2220 pLine = GetUpper()->GetTabLines()[nFndPos+1];
2222 else if( bOvrTableLns )
2226 if( nFndPos + 1 >= static_cast<sal_uInt16>(rTable.
GetTabLines().
size()) )
2241 return pLine->
FindNextBox( rTable,
nullptr, bOvrTableLns );
2246 const SwTableBox* pSrchBox,
bool bOvrTableLns )
const
2251 if( !GetTabBoxes().empty() && pSrchBox )
2253 nFndPos = GetBoxPos( pSrchBox );
2256 pBox = GetTabBoxes()[ nFndPos - 1 ];
2269 OSL_ENSURE(
USHRT_MAX != nFndPos,
"Line is not in the Table" );
2272 return GetUpper()->GetUpper()->FindPreviousBox( rTable, GetUpper(), bOvrTableLns );
2273 pLine = GetUpper()->GetTabLines()[nFndPos-1];
2275 else if( bOvrTableLns )
2302 const SwTableBox* pSrchBox,
bool bOvrTableLns )
const
2304 if( !pSrchBox && GetTabLines().empty() )
2306 return GetUpper()->
FindNextBox( rTable, pSrchBox ? pSrchBox :
this,
2315 if( !pSrchBox && GetTabLines().empty() )
2317 return GetUpper()->
FindPreviousBox( rTable, pSrchBox ? pSrchBox :
this );
2349 if( bFirst && !bLeft )
2353 while( nStt <
nPos )
2354 nRet += pLine->
GetTabBoxes()[ nStt++ ]->GetFrameFormat()
2355 ->GetFrameSize().GetWidth();
2365 for(
auto pBox : rBoxes )
2370 bool bGreaterBox =
false;
2380 && ((nDist + (rParam.bLeft ? 0 : nWidth)) >= rParam.nSide);
2389 nLowerDiff = (nDist + ( rParam.bLeft ? 0 : nWidth ) ) - rParam.nSide;
2390 nLowerDiff *= rParam.nDiff;
2391 nLowerDiff /= rParam.nMaxSize;
2392 nLowerDiff = rParam.nDiff - nLowerDiff;
2395 nLowerDiff = rParam.nDiff;
2397 if( nWidth < nLowerDiff || nWidth - nLowerDiff <
MINLAY )
2403 SwTwips nLowerDiff = 0, nOldLower = rParam.nLowerDiff;
2406 rParam.nLowerDiff = 0;
2409 if( nLowerDiff < rParam.nLowerDiff )
2410 nLowerDiff = rParam.nLowerDiff;
2412 rParam.nLowerDiff = nOldLower;
2416 ( nDist + ( rParam.bLeft ? 0 : nWidth ) ) >= rParam.nSide) ||
2428 nLowerDiff = (nDist + ( rParam.bLeft ? 0 : nWidth ) ) - rParam.nSide;
2429 nLowerDiff *= rParam.nDiff;
2430 nLowerDiff /= rParam.nMaxSize;
2431 nLowerDiff = rParam.nDiff - nLowerDiff;
2434 nLowerDiff = rParam.nDiff;
2437 rParam.nLowerDiff += nLowerDiff;
2439 if( rParam.bBigger )
2440 aNew.
SetWidth( nWidth + nLowerDiff );
2442 aNew.
SetWidth( nWidth - nLowerDiff );
2443 rParam.aShareFormats.SetSize( *pBox, aNew );
2455 nDist >= rParam.nSide )
2465 for(
auto pBox : rBoxes )
2478 ? std::abs( nDist - rParam.nSide ) <
COLFUZZY
2479 : ( rParam.bLeft ? nDist < rParam.nSide -
COLFUZZY
2480 : nDist >= rParam.nSide -
COLFUZZY )) )
2487 nDiff *= rParam.nDiff;
2488 nDiff /= rParam.nMaxSize;
2491 nDiff = rParam.nDiff;
2493 if( nWidth < nDiff || nWidth - nDiff <
MINLAY )
2499 SwTwips nLowerDiff = 0, nOldLower = rParam.nLowerDiff;
2502 rParam.nLowerDiff = 0;
2505 if( nLowerDiff < rParam.nLowerDiff )
2506 nLowerDiff = rParam.nLowerDiff;
2508 rParam.nLowerDiff = nOldLower;
2512 ? std::abs( nDist - rParam.nSide ) <
COLFUZZY
2513 : ( rParam.bLeft ? nDist < rParam.nSide -
COLFUZZY
2514 : nDist >= rParam.nSide -
COLFUZZY)
2524 nLowerDiff = nWidth;
2525 nLowerDiff *= rParam.nDiff;
2526 nLowerDiff /= rParam.nMaxSize;
2529 nLowerDiff = rParam.nDiff;
2532 rParam.nLowerDiff += nLowerDiff;
2534 if( rParam.bBigger )
2535 aNew.
SetWidth( nWidth - nLowerDiff );
2537 aNew.
SetWidth( nWidth + nLowerDiff );
2539 rParam.aShareFormats.SetSize( *pBox, aNew );
2545 nDist > rParam.nSide )
2554 for(
auto pBox : rBoxes )
2558 nWidth *= rParam.nDiff;
2559 nWidth /= rParam.nMaxSize;
2560 aSz.SetWidth( nWidth );
2561 rParam.aShareFormats.SetSize( *pBox, aSz );
2578 nCurrentSize += nBoxW;
2584 if (sal::static_int_cast< tools::ULong >(std::abs(nCurrentSize - nSize)) >
2587 OSL_FAIL(
"Line's Boxes are too small or too large" );
2593 SwTwips nAbsDiff,
SwTwips nRelDiff, std::unique_ptr<SwUndo>* ppUndo )
2595 SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout>());
2600 std::unique_ptr<FndBox_> xFndBox;
2610 CR_SetBoxWidth aParam( eType, nRelDiff, nDist,
2611 bLeft ? nDist : rSz.
GetWidth() - nDist,
2613 bBigger = aParam.bBigger;
2626 bool bChgLRSpace =
true;
2634 bChgLRSpace = bLeft ? rLR.
GetLeft() >= nAbsDiff
2638 bRet = bLeft ? rLR.
GetLeft() >= nAbsDiff
2647 bRet = SetColWidth( rCurrentBox, eType, nAbsDiff, nRelDiff,
2649 m_eTableChgMode = eOld;
2656 for(
auto const &
n: m_aLines )
2659 if( !(*fnSelBox)(
n, aParam, nDistStt,
true ))
2684 0, aSz.
GetWidth(), aParam.pTableNd );
2685 for(
size_t nLn = 0; nLn < m_aLines.size(); ++nLn )
2688 aParam.nDiff = nRelDiff /= 2;
2690 aParam.nMaxSize /= 2;
2704 GetFrameFormat()->SetFormatAttr( aLR );
2712 GetFrameFormat()->SetFormatAttr( aHOri );
2726 nFrameWidth += nAbsDiff;
2728 nFrameWidth -= nAbsDiff;
2742 GetFrameFormat()->SetFormatAttr( aSz );
2746 for( sal_uInt16
n = m_aLines.size();
n; )
2750 (*fnSelBox)( m_aLines[
n ], aParam, nDistStt, false );
2760 GetFrameFormat()->SetFormatAttr( aAbsSz );
2764 else if( bLeft ? nDist != 0 : std::abs( rSz.
GetWidth() - nDist ) >
COLFUZZY )
2768 aParam.bBigger = !bBigger;
2771 if( aParam.bBigger )
2773 for(
auto const &
n: m_aLines )
2776 if( !(*fnOtherBox)(
n, aParam, 0,
true ))
2785 for(
auto const &
n: m_aLines )
2788 if( !(*fnSelBox)(
n, aParam, nDistStt,
true ))
2799 CR_SetBoxWidth aParam1( aParam );
2805 for( sal_uInt16
n = m_aLines.size();
n; )
2809 aParam1.LoopClear();
2810 (*fnSelBox)( m_aLines[
n ], aParam, nDistStt, false );
2811 (*fnOtherBox)( m_aLines[
n ], aParam1, nDistStt, false );
2816 for( sal_uInt16
n = m_aLines.size();
n; )
2820 aParam1.LoopClear();
2821 (*fnOtherBox)( m_aLines[
n ], aParam1, nDistStt, false );
2822 (*fnSelBox)( m_aLines[
n ], aParam, nDistStt, false );
2837 bRet = SetColWidth( rCurrentBox, eType, nAbsDiff, nRelDiff,
2839 m_eTableChgMode = eOld;
2845 aParam.bBigger = !bBigger;
2852 const SwTableBoxes::size_type
nPos = pLine->
GetBoxPos( pBox );
2853 if( bLeft ? nPos != 0 : nPos + 1 != pLine->
GetTabBoxes().size() )
2866 aParam.nMaxSize = aParam.nSide;
2869 GetFrameSize().GetWidth() - aParam.nSide;
2874 bRet = (*fnTmp)( pLine, aParam, nDistStt, true );
2879 CR_SetBoxWidth aParam1( aParam );
2885 (*fnSelBox)( pLine, aParam, nDistStt, false );
2886 (*fnOtherBox)( pLine, aParam1, nDistStt, false );
2890 (*fnOtherBox)( pLine, aParam1, nDistStt, false );
2891 (*fnSelBox)( pLine, aParam, nDistStt, false );
2905 if( !bBigger || xFndBox->AreLinesToRestore( *
this ) )
2906 xFndBox->MakeFrames( *
this );
2915 #if defined DBG_UTIL
2930 OSL_ENSURE( pLineFrame,
"Where is the Frame from the SwTableLine?" );
2936 nMyNewH = nMyOldH + nNewHeight;
2941 aTmp *=
Fraction( nNewHeight, nOldHeight );
2971 else if( !rParam.bBigger )
2975 OSL_ENSURE( pLineFrame,
"Where is the Frame from the SwTableLine?" );
2977 if( (nRstHeight +
ROWFUZZY) < nDist )
2989 if( rParam.bBigger )
2993 OSL_ENSURE( pLineFrame,
"Where is the Frame from the SwTableLine?" );
2998 nDist /= rParam.nMaxHeight;
3010 OSL_ENSURE( pLineFrame,
"Where is the Frame from the SwTableLine??" );
3018 nDist /= rParam.nMaxHeight;
3024 nDist /= rParam.nMaxSpace;
3034 SwTwips nAbsDiff,
SwTwips nRelDiff, std::unique_ptr<SwUndo>* ppUndo )
3042 std::unique_ptr<FndBox_> xFndBox;
3046 sal_uInt16 nBaseLinePos = GetTabLines().GetPos( pBaseLine );
3048 CR_SetLineHeight aParam( eType,
3050 bBigger = aParam.bBigger;
3059 if( pLine == pBaseLine )
3064 nBaseLinePos = pLines->
GetPos( pLine );
3095 nEnd = nBaseLinePos;
3099 nStt = nBaseLinePos + 1;
3100 nEnd = pLines->
size();
3106 for(
auto n = nStt;
n < nEnd; ++
n )
3109 OSL_ENSURE( pLineFrame,
"Where is the Frame from the SwTableLine??" );
3113 if( bBigger && aParam.nMaxSpace < nAbsDiff )
3118 if( bTop ? nEnd != 0 : nStt < nEnd )
3133 for(
auto n = nStt;
n < nEnd; ++
n )
3154 CR_SetLineHeight aParam1( aParam );
3160 for(
auto n = nStt;
n < nEnd; ++
n )
3166 for(
auto n = nStt;
n < nEnd; ++
n )
3179 bRet = SetRowHeight( rCurrentBox, eType, nAbsDiff,
3182 m_eTableChgMode = eOld;
3197 if( bBigger || xFndBox->AreLinesToRestore( *
this ) )
3198 xFndBox->MakeFrames( *
this );
3213 for(
auto n = m_aNewFormats.size();
n; )
3214 if( ( pTmp = m_aNewFormats[ --
n ])->GetFrameSize().GetWidth()
3226 sal_uInt16 nWhich = rItem.
Which();
3229 for(
auto n = m_aNewFormats.size();
n; )
3230 if( SfxItemState::SET == ( pTmp = m_aNewFormats[ --
n ])->
3231 GetItemState( nWhich,
false, &pItem ) && *pItem == rItem &&
3232 pTmp->GetFormatAttr(
RES_FRM_SIZE,
false ) == rFrameSz )
3242 m_aNewFormats.push_back( &rNew );
3248 if( m_pOldFormat == &rFormat )
3251 std::vector<SwFrameFormat*>::iterator it = std::find( m_aNewFormats.begin(), m_aNewFormats.end(), &rFormat );
3252 if( m_aNewFormats.end() != it )
3253 m_aNewFormats.erase( it );
3254 return m_aNewFormats.empty();
3264 return Seek_Entry( rFormat, &nPos )
3265 ? m_ShareArr[ nPos ]->GetFormat(nWidth)
3272 return Seek_Entry( rFormat, &nPos )
3273 ? m_ShareArr[ nPos ]->GetFormat(rItem)
3281 if( !Seek_Entry( rOld, &nPos ))
3284 m_ShareArr.insert(m_ShareArr.begin() + nPos, std::unique_ptr<SwShareBoxFormat>(pEntry));
3287 pEntry = m_ShareArr[ nPos ].get();
3301 pBox->
ChgFrameFormat( static_cast<SwTableBoxFormat*>(&rFormat) );
3307 pLn->
ChgFrameFormat( static_cast<SwTableLineFormat*>(&rFormat) );
3311 RemoveFormat( *pOld );
3319 *pRet = GetFormat( *pBoxFormat, rSz.
GetWidth() );
3321 ChangeFrameFormat( &rBox,
nullptr, *pRet );
3326 AddFormat( *pBoxFormat, *pRet );
3333 *pRet = GetFormat( *pBoxFormat, rItem );
3335 ChangeFrameFormat( &rBox,
nullptr, *pRet );
3340 AddFormat( *pBoxFormat, *pRet );
3347 *pRet = GetFormat( *pLineFormat, rItem );
3349 ChangeFrameFormat(
nullptr, &rLine, *pRet );
3354 AddFormat( *pLineFormat, *pRet );
3360 for (
auto i = m_ShareArr.size();
i; )
3362 if (m_ShareArr[ --
i ]->RemoveFormat(rFormat))
3364 m_ShareArr.erase( m_ShareArr.begin() +
i );
3371 sal_uIntPtr nIdx =
reinterpret_cast<sal_uIntPtr
>(&rFormat);
3372 auto nO = m_ShareArr.size();
3373 decltype(nO) nU = 0;
3379 const auto nM = nU + ( nO - nU ) / 2;
3380 sal_uIntPtr nFormat =
reinterpret_cast<sal_uIntPtr
>(&m_ShareArr[ nM ]->GetOldFormat());
3381 if( nFormat == nIdx )
3387 else if( nFormat < nIdx )
void AddRowCols(const SwTable &rTable, const SwSelBoxes &rBoxes, sal_uInt16 nLines, bool bBehind)
SwChartDataProvider::AddRowCols tries to notify charts of added columns or rows and extends the value...
Instances of SwFields and those derived from it occur 0 to n times.
const SwEndNode * EndOfSectionNode() const
Starts a section of nodes in the document model.
std::vector< SwTableLine * >::size_type size_type
const FndLines_t & GetLines() const
tools::Long GetWidth() const
const SwTableLine * GetLine() const
const_iterator lower_bound(const Value &x) const
sal_uLong GetIndex() const
void Add(SwClient *pDepend)
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
void SetRowsToRepeat(sal_uInt16 nNumOfRows)
Marks a position in the document model.
static SwTwips lcl_GetDistance(SwTableBox *pBox, bool bLeft)
void DelFrames(SwRootFrame const *pLayout=nullptr)
Method deletes all views of document for the node.
static void lcl_CopyLineToDoc(FndLine_ const &rpFndLn, CpyPara *const pCpyPara)
constexpr TypedWhichId< SwTableBoxNumFormat > RES_BOXATR_FORMAT(RES_BOXATR_BEGIN)
sal_uLong GetSttIdx() const
SwDocShell * GetDocShell()
constexpr TypedWhichId< SwTableBoxValue > RES_BOXATR_VALUE(150)
static void lcl_CopyCol(FndBox_ &rFndBox, CpyPara *const pCpyPara)
static void lcl_CpyLines(sal_uInt16 nStt, sal_uInt16 nEnd, SwTableLines &rLines, SwTableBox *pInsBox, sal_uInt16 nPos=USHRT_MAX)
static void lcl_LastBoxSetWidth(SwTableBoxes &rBoxes, const tools::Long nOffset, bool bFirst, SwShareBoxFormats &rShareFormats)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
tools::Long GetRight() const
const SwRect & getFramePrintArea() const
bool AreLinesToRestore(const SwTable &rTable) const
SwTabFrame is one table in the document layout, containing rows (which contain cells).
virtual void CreateChartInternalDataProviders(const SwTable *pTable)=0
calls createInternalDataProvider for all charts using the specified table
SwFrameFormat * ClaimFrameFormat()
void setDummyFlag(bool bDummy)
void DelFrames(SwTable &rTable)
bool OldSplitRow(SwDoc &, const SwSelBoxes &, sal_uInt16, bool)
const_iterator find(const Value &x) const
virtual bool HasExtraRedlineTable() const =0
SwTableLine is one table row in the document model.
static sal_uInt16 lcl_GetLineWidth(const FndLine_ &rLine)
void CheckSectionCondColl() const
Call ChkCondcoll to all ContentNodes of section.
const editeng::SvxBorderLine * GetRight() const
SwTableLine * front() const
IDocumentContentOperations const & getIDocumentContentOperations() const
bool OldMerge(SwDoc *, const SwSelBoxes &, SwTableBox *, SwUndoTableMerge *)
SwTableFormat * GetFrameFormat()
void SetValues(bool bFlag)
Value in Var-direction gives minimum (can be exceeded but not be less).
static bool lcl_SetOtherLineHeight(SwTableLine *pLine, const CR_SetLineHeight &rParam, SwTwips nDist, bool bCheck)
void UpdateCharts(std::u16string_view rName) const
void ForEach_FndLineCopyCol(SwTableLines &rLines, FndPara *pFndPara)
This creates a structure mirroring the SwTable structure that contains all rows and non-leaf boxes (a...
sal_Int32 getRowSpan() const
SwTableBox * FindNextBox(const SwTable &, const SwTableBox *=nullptr, bool bOvrTableLns=true) const
SwTableLine * back() const
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
void Delete(const SwNodeIndex &rPos, sal_uLong nNodes=1)
delete nodes
void ChgFrameFormat(SwTableLineFormat *pNewFormat)
bool UpdateTableStyleFormatting(SwTableNode *pTableNode=nullptr, bool bResetDirect=false, OUString const *pStyleName=nullptr)
Update the direct formatting according to the current table style.
const SwRect & getFrameArea() const
static void lcl_CheckRowSpan(SwTable &rTable)
void sw_LineSetHeadCondColl(const SwTableLine *pLine)
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
static void SetLineHeight(SwTableLine &rLine, SwTwips nOldHeight, SwTwips nNewHeight, bool bMinSize)
virtual void UpdateTableFields(SfxPoolItem *pHt)=0
static void lcl_Merge_MoveBox(FndBox_ &rFndBox, InsULPara *const pULPara)
void Width(tools::Long nNew)
const FndBoxes_t & GetBoxes() const
iterator insert(iterator aIt, SwTableLine *pLine)
SwTextFormatColl * CopyTextColl(const SwTextFormatColl &rColl)
copy TextNodes
void CopyHeadlineIntoTable(SwTableNode &rTableNd)
const SwTable & GetTable() const
virtual void DeleteSection(SwNode *pNode)=0
Delete section containing the node.
static void lcl_Merge_MoveLine(FndLine_ &rFndLine, InsULPara *const pULPara)
o3tl::sorted_vector< CpyTabFrame > CpyTabFrames
const OUString & GetTableStyleName() const
Return the table style name of this table.
SwTableBox * FindPreviousBox(const SwTable &, const SwTableBox *) const
static void lcl_CalcWidth(SwTableBox *pBox)
bool HasOnlyOneListener() const
bool SplitCol(SwDoc &rDoc, const SwSelBoxes &rBoxes, sal_uInt16 nCnt)
void sw_BoxSetSplitBoxFormats(SwTableBox *pBox, SwCollectTableLineBoxes *pSplPara)
void MakeFrames(SwTable &rTable)
static void lcl_CpyBoxes(sal_uInt16 nStt, sal_uInt16 nEnd, SwTableBoxes &rBoxes, SwTableLine *pInsLine)
static void lcl_LastBoxSetWidthLine(SwTableLines &rLines, const tools::Long nOffset, bool bFirst, SwShareBoxFormats &rShareFormats)
Class for SplitTable Collects the uppermost or lowermost Lines of a Box from a Line in an array...
void InsTableBox(SwDoc &rDoc, SwTableNode *pTableNd, SwTableLine *pLine, SwTableBoxFormat *pBoxFrameFormat, SwTableBox *pBox, sal_uInt16 nInsPos, sal_uInt16 nCnt=1)
Table of Contents - heading.
const editeng::SvxBorderLine * GetTop() const
bool SetColWidth(SwTableBox &rCurrentBox, TableChgWidthHeightType eType, SwTwips nAbsDiff, SwTwips nRelDiff, std::unique_ptr< SwUndo > *ppUndo)
bool(* FN_lcl_SetBoxWidth)(SwTableLine *, CR_SetBoxWidth &, SwTwips, bool)
virtual const SwExtraRedlineTable & GetExtraRedlineTable() const =0
const editeng::SvxBorderLine * GetLeft() const
static SwRowFrame * GetRowFrame(SwTableLine &rLine)
void SetTableLines(const SwSelBoxes &rBoxes, const SwTable &rTable)
const SwStartNode * StartOfSectionNode() const
bool DeleteSel(SwDoc *, const SwSelBoxes &rBoxes, const SwSelBoxes *pMerged, SwUndo *pUndo, const bool bDelMakeFrames, const bool bCorrBorder)
void CheckBoxWidth(const SwTableLine &rLine, SwTwips nSize)
virtual SwChartDataProvider * GetChartDataProvider(bool bCreate=false) const =0
returns or creates the data-provider for chart
::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const
static void lcl_BoxSetHeadCondColl(const SwTableBox *pBox)
tools::Long GetHeight(const SwRect &rRect) const
void SetSelBoxes(const SwSelBoxes &rBoxes)
tools::Long GetLeft() const
constexpr sal_uInt16 RES_BOXATR_END(151)
static bool lcl_SetSelLineHeight(SwTableLine *pLine, const CR_SetLineHeight &rParam, SwTwips nDist, bool bCheck)
static SwTableBox * lcl_FndNxtPrvDelBox(const SwTableLines &rTableLns, SwTwips nBoxStt, SwTwips nBoxWidth, sal_uInt16 nLinePos, bool bNxt, SwSelBoxes *pAllDelBoxes, size_t *const pCurPos)
SwFrameFormat * GetFrameFormat()
bool SetRowHeight(SwTableBox &rCurrentBox, TableChgWidthHeightType eType, SwTwips nAbsDiff, SwTwips nRelDiff, std::unique_ptr< SwUndo > *ppUndo)
void MakeOwnFrames(SwNodeIndex *pIdxBehind)
Creates the frms for the table node (i.e. the TabFrames).
constexpr sal_uInt16 RES_BOXATR_BEGIN(RES_GRFATR_END)
Marks a node in the document model.
SwFrameFormat * GetFrameFormat()
const_iterator end() const
static bool lcl_SetSelBoxWidth(SwTableLine *pLine, CR_SetBoxWidth &rParam, SwTwips nDist, bool bCheck)
IDocumentChartDataProviderAccess const & getIDocumentChartDataProviderAccess() const
SwTableBox * FindPreviousBox(const SwTable &, const SwTableBox *=nullptr, bool bOvrTableLns=true) const
sal_uInt16 GetBoxPos(const SwTableBox *pBox) const
Frame cannot be moved in Var-direction.
SwTableLines & GetTabLines()
static void lcl_AjustLines(SwTableLine *pLine, CR_SetBoxWidth &rParam)
SwTable is one table in the document model, containing rows (which contain cells).
void SetWidth(tools::Long n)
SwTableLines & GetTabLines()
static sal_uInt16 lcl_GetBoxOffset(const FndBox_ &rBox)
const_iterator begin() const
void SetTableChgMode(TableChgMode eMode)
constexpr sal_uInt16 RES_FRMATR_END(131)
sal_uLong EndOfSectionIndex() const
void MakeNewFrames(SwTable &rTable, const sal_uInt16 nNumber, const bool bBehind)
SwTableBoxes & GetTabBoxes()
static void lcl_InsCol(FndLine_ *pFndLn, CpyPara &rCpyPara, sal_uInt16 nCpyCnt, bool bBehind)
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
std::vector< SwTableBox * > SwTableBoxes
static void lcl_SaveUpperLowerBorder(SwTable &rTable, const SwTableBox &rBox, SwShareBoxFormats &rShareFormats, SwSelBoxes *pAllDelBoxes=nullptr, size_t *const pCurPos=nullptr)
constexpr TypedWhichId< SwTableBoxFormula > RES_BOXATR_FORMULA(149)
std::vector< std::unique_ptr< FndBox_ > > FndBoxes_t
void sw_Box_CollectBox(const SwTableBox *pBox, SwCollectTableLineBoxes *pSplPara)
const SwStartNode * GetSttNd() const
static void lcl_CopyBoxToDoc(FndBox_ const &rFndBox, CpyPara *const pCpyPara)
bool operator<(TypeDescription const &left, TypeDescription const &right)
void ChgFrameFormat(SwTableBoxFormat *pNewFormat, bool bNeedToReregister=true)
bool(* FN_lcl_SetLineHeight)(SwTableLine *, CR_SetLineHeight &, SwTwips, bool)
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
void CopyWithFlyInFly(const SwNodeRange &rRg, const SwNodeIndex &rInsPos, const std::pair< const SwPaM &, const SwPosition & > *pCopiedPaM=nullptr, bool bMakeNewFrames=true, bool bDelRedlines=true, bool bCopyFlyAtFly=false, SwCopyFlags flags=SwCopyFlags::Default) const
note: rRg/rInsPos exclude a partially selected start text node; pCopiedPaM includes a partially selec...
virtual SwFieldType * InsertFieldType(const SwFieldType &)=0
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
void SetTableStyleName(const OUString &rName)
Set the new table style name for this table.
const SwTableBox * GetBox() const
bool InsertCol(SwDoc &, const SwSelBoxes &rBoxes, sal_uInt16 nCnt, bool bBehind)
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
static bool lcl_SetOtherBoxWidth(SwTableLine *pLine, CR_SetBoxWidth &rParam, SwTwips nDist, bool bCheck)
bool MakeCopy(SwDoc &, const SwPosition &, const SwSelBoxes &, bool bCpyName=false) const
SwTableBox is one table cell in the document model.
static void lcl_CopyRow(FndLine_ &rFndLine, CpyPara *const pCpyPara)
constexpr TableChgWidthHeightType extractPosition(TableChgWidthHeightType e)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
bool Resize(sal_uInt16 nOffset, sal_uInt16 nWidth)
SwFrameFormat * ClaimFrameFormat()
SwFEShell * GetFEShell()
For Core - it knows the DocShell but not the WrtShell!
std::vector< std::unique_ptr< FndLine_ > > FndLines_t
SwTableNode * FindTableNode()
Search table node, in which it is.
void DeleteBox_(SwTable &rTable, SwTableBox *pBox, SwUndo *pUndo, bool bCalcNewSize, const bool bCorrBorder, SwShareBoxFormats *pShareFormats)
void SetUpper(SwTableLine *pNew)
SwTableBox * FindNextBox(const SwTable &, const SwTableBox *, bool bOvrTableLns=true) const
static void lcl_CalcNewWidths(const FndLines_t &rFndLines, CpyPara &rPara)
void setRowSpan(sal_Int32 nNewRowSpan)
sal_uInt16 GetPos(const SwTableLine *pBox) const
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
void AddNewBox(sal_uLong nSttNdIdx)
Frame is variable in Var-direction.
const FndLine_ * GetUpper() const
void SetNewTable(std::unique_ptr< SwTable >, bool bNewFrames=true)
std::pair< const_iterator, bool > insert(Value &&x)
void DeleteBox(const SwTable *pTable, const SwTableBox &rBox)
std::vector< Value >::size_type size_type
const SwTable * InsertTable(const SwInsertTableOptions &rInsTableOpts, const SwPosition &rPos, sal_uInt16 nRows, sal_uInt16 nCols, sal_Int16 eAdjust, const SwTableAutoFormat *pTAFormat=nullptr, const std::vector< sal_uInt16 > *pColArr=nullptr, bool bCalledFromShell=false, bool bNewModel=true)
Insert new table at position.
void Height(tools::Long nNew)
bool operator==(const ScCsvLayoutData &rData1, const ScCsvLayoutData &rData2)
bool InsertRow_(SwDoc *, const SwSelBoxes &, sal_uInt16 nCnt, bool bBehind)
const editeng::SvxBorderLine * GetBottom() const
TableChgMode GetTableChgMode() const
iterator erase(iterator aIt)
std::vector< Value >::const_iterator const_iterator
size_type erase(const Value &x)
SwRowFrame is one table row in the document layout.
bool MoveNodes(const SwNodeRange &, SwNodes &rNodes, const SwNodeIndex &, bool bNewFrames=true)
move the node pointer
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
Base class of the Writer document model elements.