26#include <osl/diagnose.h>
64#define CHECK_TABLE(t) (t).CheckConsistency();
103 for(
n = 0;
n < rText.getLength() &&
' ' >= ( c = rText[
n] ); ++
n )
105 rText = rText.replaceAt(
n, 1,
u" " );
106 for(
n = rText.getLength();
n &&
' ' >= ( c = rText[--
n] ); )
108 rText = rText.replaceAt(
n, 1,
u" " );
116 OUStringBuffer sBuff(rText);
118 for(
n = 0;
n < sBuff.getLength() &&
' ' >= ( c = sBuff[
n ]); ++
n )
121 sBuff.remove(
n--, 1 );
123 for(
n = sBuff.getLength();
n &&
' ' >= ( c = sBuff[ --
n ]); )
126 sBuff.remove(
n, 1 );
128 rText = sBuff.makeStringAndClear();
135 sal_uInt16 nInsPos, sal_uInt16 nCnt )
137 OSL_ENSURE( pBox->
GetSttNd(),
"Box with no start node" );
142 OSL_ENSURE( pCNd,
"Box with no content node" );
152 const std::shared_ptr<SfxItemSet>& handle = format.
GetStyleHandle();
153 aAttrSet.
Put(*handle);
163 static_cast<SwTextNode*
>(pCNd)->GetTextColl(),
164 &aAttrSet, nInsPos, nCnt );
168 static_cast<SwTextNode*
>(pCNd)->GetTextColl(),
180 for( sal_uInt16
i = 0;
i < nCnt; ++
i )
182 pBox = rTableBoxes[
i + nInsPos ];
190 m_pTableNode( nullptr ),
191 m_nGraphicsThatResize( 0 ),
192 m_nRowsToRepeat( 1 ),
193 m_bModifyLocked( false ),
201 :
SwClient( rTable.GetFrameFormat() ),
202 m_pTableNode( nullptr ),
203 m_eTableChgMode( rTable.m_eTableChgMode ),
204 m_nGraphicsThatResize( 0 ),
205 m_nRowsToRepeat( rTable.GetRowsToRepeat() ),
206 maTableStyleName(rTable.maTableStyleName),
207 m_bModifyLocked( false ),
208 m_bNewModel( rTable.m_bNewModel )
214 for (
size_t n = 0;
n < rSortCntBoxes.
size(); ++
n)
216 rSortCntBoxes[
n ]->m_pStartNode =
nullptr;
250T lcl_MulDiv64(sal_uInt64 nA, sal_uInt64 nM, sal_uInt64 nD)
253 return nD == 0 ?
static_cast<T
>(nA*nM) :
static_cast<T
>((nA*nM)/nD);
260 std::vector<SwFormat*>::const_iterator it = std::find( rFormatArr.begin(), rFormatArr.end(), pBoxFormat );
261 if ( it == rFormatArr.end() )
262 rFormatArr.push_back( pBoxFormat );
266 const tools::Long nNew, std::vector<SwFormat*>& rFormatArr );
269 const tools::Long nNew, std::vector<SwFormat*>& rFormatArr,
const bool bCheckSum )
271 for (
size_t i = 0;
i < rLines.
size(); ++
i )
277 const SwTwips nBox = lcl_MulDiv64<SwTwips>(pFormat->GetFrameSize().GetWidth(), nNew, nOld);
279 pFormat->LockModify();
280 pFormat->SetFormatAttr( aNewBox );
281 pFormat->UnlockModify();
287 const tools::Long nNew, std::vector<SwFormat*>& rFormatArr )
290 sal_uInt64 nOriginalSum = 0;
291 for (
size_t i = 0;
i < rBoxes.size(); ++
i )
302 nOriginalSum += nBox;
303 nBox = lcl_MulDiv64<sal_uInt64>(nBox, nNew, nOld);
304 const sal_uInt64 nWishedSum = lcl_MulDiv64<sal_uInt64>(nOriginalSum, nNew, nOld) - nSum;
307 if( nBox == nWishedSum )
320 OSL_FAIL(
"Rounding error" );
328 if (rHint.
GetId() != SfxHintId::SwLegacyModify)
332 const sal_uInt16 nWhich = pLegacy->
GetWhich();
338 if (pLegacy->m_pOld && pLegacy->m_pNew
343 pOldSize = &
static_cast<const SwAttrSetChg*
>(pLegacy->m_pOld)->GetChgSet()->GetFrameSize();
362 std::vector<SwFormat*> aFormatArr;
363 aFormatArr.reserve(
m_aLines[0]->GetTabBoxes().
size() );
369 for (
size_t i = 0;
i < rToFill.
Count(); ++
i )
381 const bool bRefreshHidden )
384 OSL_ENSURE(nWish,
"weird <= 0 width frmfrm");
401 for (
size_t i = 0;
i < rBoxes.size(); ++
i )
403 const SwTwips nWidth = rBoxes[
i]->GetFrameFormat()->GetFrameSize().GetWidth();
405 const tools::Long nTmp = lcl_MulDiv64<tools::Long>(nSum, nAct, nWish);
407 if (rBoxes[
i] != pCur)
409 if ( pLine == pBox->
GetUpper() || 0 == nLeftMin )
410 nLeftMin = nTmp -
nPos;
416 if ( 0 == nRightMax )
417 nRightMax = nTmp -
nPos;
422 pLine = pCur ? pCur->
GetUpper() :
nullptr;
426 bool bInsert = !bRefreshHidden;
427 for (
size_t j = 0; bInsert && (j < rToFill.
Count()); ++j )
435 else if (
nPos < nCmp )
443 else if ( bRefreshHidden )
446 if ( !bHidden || bRefreshHidden )
450 nLeftMin =
nPos - nLeftMin;
451 nRightMax =
nPos + nRightMax;
454 bool bFoundPos =
false;
455 bool bFoundMax =
false;
456 for (
size_t j = 0; !(bFoundPos && bFoundMax ) && j < rToFill.
Count(); ++j )
466 if ( nLeftMin > nOldMin )
467 rEntry.
nMin = nLeftMin;
470 if ( nRightMax < nOldMax )
471 rEntry.
nMax = nRightMax;
480 if (
nPos > nOldMin )
494 for (
size_t i = 0;
i < rLines.
size(); ++
i )
497 for (
size_t j = 0; j < rBoxes.size(); ++j )
520 bool bRefreshHidden,
bool bCurRowOnly )
const
523 if ( bRefreshHidden )
526 for (
size_t i = 0;
i < rToFill.
Count(); ++
i )
535 for (
size_t i = 0;
i < rToFill.
Count(); ++
i )
562 for (
size_t i = 0;
i < rBoxes.size(); ++
i )
571 for (
size_t k = 0; k < rBoxes2.size(); ++k )
573 pTabFormat,
false, bRefreshHidden );
577 if ( !bRefreshHidden )
593 for (
size_t i = 0;
i < rToFill.
Count(); ++
i )
622 for (
size_t i = rBoxes.size();
i > 0; )
634 for (
size_t i = rLines.
size();
i > 0; )
659 for (
size_t i = 0; (
i < rBoxes.size()) && (rBoxes[
i] != pCur); ++
i)
661 nLeft += lcl_MulDiv64<tools::Long>(
662 rBoxes[
i]->GetFrameFormat()->GetFrameSize().GetWidth(),
666 pLine = pCur ? pCur->
GetUpper() :
nullptr;
673 const tools::Long nWidth = lcl_MulDiv64<tools::Long>(
678 size_t nRightPos = 0;
679 bool bFoundLeftPos =
false;
680 bool bFoundRightPos =
false;
687 bFoundLeftPos =
true;
693 bFoundRightPos =
true;
696 nLeftDiff = bFoundLeftPos ?
697 rParm.
rOld[nLeftPos] - rParm.
rNew[nLeftPos] : 0;
698 nRightDiff= bFoundRightPos ?
699 rParm.
rNew[nRightPos] - rParm.
rOld[nRightPos] : 0;
707 const tools::Long nWidth = lcl_MulDiv64<tools::Long>(
727 if(
nPos && rTableBoxes[
nPos - 1 ]->getRowSpan() != 1 )
729 if(
nPos + 1 < o3tl::narrowing<sal_uInt16>(rTableBoxes.size()) &&
730 rTableBoxes[
nPos + 1 ]->getRowSpan() != 1 )
734 nLeftDiff = nRightDiff = 0;
736 if ( nLeftDiff || nRightDiff )
754 if ( aFormatFrameSize.
GetWidth() < 0 )
787 for (
size_t i = 0;
i < rLines.
size(); ++
i )
790 for (
size_t j = 0; j < rBoxes.size(); ++j )
795 rBoxArr.push_front( pBox );
797 rBoxArr.push_back( pBox );
804 for (
size_t i = 0;
i < rLines.
size(); ++
i )
807 [rLines[
i]->GetTabBoxes().
size()-1];
835 Parm aParm( rNew, rOld );
837 OSL_ENSURE( rOld.
Count() == rNew.
Count(),
"Number of columns changed.");
866 const bool bLeftDist = rNew.
GetLeft() != nShLeft;
868 if(!bLeftDist && !bRightDist)
870 else if(!bRightDist && rNew.
GetLeft() > nShLeft )
937 for (
size_t i = 0;
i < rBoxes.size(); ++
i )
947 for (
size_t i = 0;
i < rBoxes2.size(); ++
i )
949 if ( rBoxes2[
i] != pExcl )
959 for (
int j = aParm.
aBoxArr.size()-1; j >= 0; --j )
971 for (
size_t i = rLines.
size();
i > 0; )
995 Parm& rParm, sal_uInt16 nColFuzzy )
997 ChangeList::iterator pCurr = rOldNew.begin();
998 if( pCurr == rOldNew.end() )
1007 SwTwips nNewWidth = nWidth - nRest;
1010 if( pCurr != rOldNew.end() &&
nBorder + nColFuzzy >= pCurr->first )
1013 while( pCurr != rOldNew.end() &&
nBorder > pCurr->first )
1015 if( pCurr != rOldNew.end() )
1018 if(
nBorder + nColFuzzy >= pCurr->first )
1020 if( pCurr->second == pCurr->first )
1023 nRest = pCurr->second -
nBorder;
1029 if( nNewWidth != nWidth )
1033 nRest += 1 - nNewWidth;
1037 aFormatFrameSize.
SetWidth( nNewWidth );
1046 if( rChanges.empty() )
1051 if( rSpanPos.empty() )
1056 std::vector<sal_uInt16> aNewSpanPos;
1057 ChangeList::iterator pCurr = rChanges.begin();
1059 std::vector<sal_uInt16>::iterator pSpan = rSpanPos.begin();
1060 sal_uInt16 nCurr = 0;
1062 bool bRowSpan =
false;
1063 sal_uInt16 nRowSpanCount = 0;
1065 for(
size_t nCurrBox = 0; nCurrBox <
nCount; ++nCurrBox )
1069 const sal_Int32 nRowSpan = pBox->
getRowSpan();
1070 const bool bCurrRowSpan = bTop ? nRowSpan < 0 :
1071 ( nRowSpan > 1 || nRowSpan < -1 );
1072 if( bRowSpan || bCurrRowSpan )
1073 aNewSpanPos.push_back( nRowSpanCount );
1074 bRowSpan = bCurrRowSpan;
1075 nOrgSum += nCurrWidth;
1076 const sal_uInt16
nPos = lcl_MulDiv64<sal_uInt16>(
1077 lcl_MulDiv64<sal_uInt64>(nOrgSum, nWidth, nWish),
1079 while( pCurr != rChanges.end() && pCurr->first <
nPos )
1085 if( pCurr != rChanges.end() && pCurr->first <=
nPos &&
1086 pCurr->first != pCurr->second )
1088 pSpan = std::find_if(pSpan, rSpanPos.end(),
1089 [nCurr](
const sal_uInt16 nSpan) { return nSpan >= nCurr; });
1090 if( pSpan != rSpanPos.end() && *pSpan == nCurr )
1092 aNewChanges.push_back( *pCurr );
1100 aNewChanges.push_back( aTmp );
1105 pCurr = aNewChanges.begin();
1106 ChangeList::iterator pLast = pCurr;
1107 ChangeList::iterator pLeftMove = pCurr;
1108 while( pCurr != aNewChanges.end() )
1110 if( pLeftMove == pCurr )
1112 while( ++pLeftMove != aNewChanges.end() && pLeftMove->first <= pLeftMove->second )
1115 if( pCurr->second == pCurr->first )
1117 if( pLeftMove != aNewChanges.end() && pCurr->second > pLeftMove->second )
1119 if( pLeftMove->first == pLast->first )
1120 pCurr->second = pLeftMove->second;
1123 pCurr->second = lcl_MulDiv64<sal_uInt16>(
1124 pCurr->first - pLast->first,
1125 pLeftMove->second - pLast->second,
1126 pLeftMove->first - pLast->first) + pLast->second;
1132 else if( pCurr->second > pCurr->first )
1136 ChangeList::iterator pNext = pCurr;
1137 while( pNext != pLeftMove && pNext->second == pNext->first &&
1138 pNext->second < pLast->second )
1140 while( pCurr != pNext )
1142 if( pNext == aNewChanges.end() || pNext->first == pLast->first )
1143 pCurr->second = pLast->second;
1146 pCurr->second = lcl_MulDiv64<sal_uInt16>(
1147 pCurr->first - pLast->first,
1148 pNext->second - pLast->second,
1149 pNext->first - pLast->first) + pLast->second;
1162 rChanges.swap(aNewChanges);
1163 rSpanPos.swap(aNewSpanPos);
1169#if OSL_DEBUG_LEVEL > 1
1170 static int nCallCount = 0;
1177 if( nNewWidth < 1 || nOldWidth < 1 )
1179 for(
size_t i = 0;
i <= rOld.
Count(); ++
i )
1193 nNewPos = lcl_MulDiv64<tools::Long>(nNewPos, rParm.
nNewWish, nNewWidth);
1194 nOldPos = lcl_MulDiv64<tools::Long>(nOldPos, rParm.
nOldWish, nOldWidth);
1195 if( nOldPos != nNewPos && nNewPos > 0 && nOldPos > 0 )
1197 ColChange aChg( o3tl::narrowing<sal_uInt16>(nOldPos), o3tl::narrowing<sal_uInt16>(nNewPos) );
1198 aOldNew.push_back( aChg );
1202 int nCount = aOldNew.size();
1209 sal_uInt16 nCurr = rLines.
GetPos( pCurrLine );
1210 if( nCurr >= USHRT_MAX )
1214 aOldNew.push_front( aChg );
1215 std::vector<sal_uInt16> aRowSpanPos;
1219 sal_uInt16
nPos = 0;
1220 for(
const auto& rCop : aOldNew )
1222 aCopy.push_back( rCop );
1223 aRowSpanPos.push_back(
nPos++ );
1227 bool bGoOn = !aRowSpanPos.empty();
1228 sal_uInt16 j = nCurr;
1234 bGoOn = !aRowSpanPos.empty() && j > 0;
1236 aRowSpanPos.clear();
1238 if( nCurr+1 < o3tl::narrowing<sal_uInt16>(rLines.
size()) )
1241 sal_uInt16
nPos = 0;
1242 for(
const auto& rCop : aOldNew )
1244 aCopy.push_back( rCop );
1245 aRowSpanPos.push_back(
nPos++ );
1248 rParm.
nOldWish, nOldWidth,
false );
1249 bool bGoOn = !aRowSpanPos.empty();
1250 sal_uInt16 j = nCurr;
1254 rParm.
nOldWish, nOldWidth,
false );
1256 bGoOn = !aRowSpanPos.empty() && j+1 < o3tl::narrowing<sal_uInt16>(rLines.
size());
1263 for(
size_t i = 0;
i < rLines.
size(); ++
i )
1272 bool bIsValid =
true;
1273 size_t nLen = rStr.size();
1274 for(
size_t i = 0;
i < nLen && bIsValid; ++
i )
1277 if (cChar < '0' || cChar >
'9')
1286 const bool bPerformValidCheck )
1288 sal_uInt16 nRet = 0;
1295 bool overflow =
false;
1296 while (
nPos<rStr.getLength())
1299 if ((cChar<'A' || cChar>
'Z') && (cChar<'a' || cChar>
'z'))
1308 num = num * 52 + cChar;
1315 rStr = rStr.copy(
nPos );
1319 const sal_Int32
nPos = rStr.indexOf(
"." );
1325 nRet = o3tl::narrowing<sal_uInt16>(rStr.toInt32());
1332 const std::u16string_view aText( rStr.subView( 0,
nPos ) );
1337 rStr = rStr.copy(
nPos+1 );
1346 const bool bPerformValidCheck )
const
1352 sal_uInt16 nLine, nBox;
1353 OUString aNm( rName );
1354 while( !aNm.isEmpty() )
1370 if( !nLine || nLine > pLines->
size() )
1372 pLine = (*pLines)[ nLine-1 ];
1376 if( nBox >= pBoxes->size() )
1378 pBox = (*pBoxes)[ nBox ];
1384 OSL_FAIL(
"Box without content, looking for the next one!" );
1407 pTableNd = rNds[
nIndex ]->GetTableNode();
1411 pCNd = rNds[
nIndex ]->GetContentNode();
1418 if ( pCNd || pTableNd )
1493 if ( pLast !=
this )
1498 *pNewFormat = *pRet;
1503 if( pFrame->GetTabLine() ==
this )
1504 pFrame->RegisterToFormat( *pNewFormat );
1507 pNewFormat->
Add(
this );
1521 pNewFormat->
Add(
this);
1522 if(!pOld->HasWriterListeners())
1529 bLayoutAvailable =
false;
1536 if( pLast->GetTabLine() ==
this )
1539 bLayoutAvailable = ( pTab && pTab->
IsVertical() ) ?
1551 nRet += pLast->getFrameArea().Height();
1578 if ( aRedlineTable.
empty() )
1593 if ( aRedlineTable.
empty() )
1620 if ( pHasTextChangesOnlyProp && !pHasTextChangesOnlyProp->GetValue() )
1623 size_t nBoxes = rBoxes.size();
1624 bool bInsertion =
false;
1625 bool bPlainTextInLine =
false;
1628 for (
size_t nBoxIndex = 0; nBoxIndex < nBoxes && rRedlinePos < aRedlineTable.
size(); ++nBoxIndex)
1630 auto pBox = rBoxes[nBoxIndex];
1631 if ( pBox->IsEmpty() )
1637 bool bHasRedlineInBox =
false;
1642 for( ; rRedlinePos < aRedlineTable.
size(); ++rRedlinePos )
1646 if ( pRedline->
Start()->
nNode > pEndNodeIndex )
1654 if ( aCellStart <= *pRedline->
Start() )
1656 if ( !bHasRedlineInBox )
1658 bHasRedlineInBox =
true;
1661 bPlainTextInLine =
true;
1669 if ( RedlineType::Insert ==
nType )
1676 if ( pPreviousDeleteRedline &&
1677 *pPreviousDeleteRedline->
End() < *pRedline->
Start() )
1679 bPlainTextInLine =
true;
1687 aRedlineTable[nNewestRedline]->GetRedlineData().GetTimeStamp() <
1690 nNewestRedline = rRedlinePos;
1693 aRedlineTable[nOldestRedline]->GetRedlineData().GetTimeStamp() >
1696 nOldestRedline = rRedlinePos;
1702 if ( !bInsertion && ( !bHasRedlineInBox || ( pPreviousDeleteRedline &&
1707 bPlainTextInLine =
true;
1716 RedlineType::Insert == aRedlineTable[ nOldestRedline ]->GetType() )
1719 nRet = nOldestRedline;
1722 RedlineType::Delete == aRedlineTable[ nNewestRedline ]->GetType() )
1727 nRet = nNewestRedline;
1736 if ( bUpdateProperty )
1750 : aRedlineTable[ nRet ]->GetType());
1762 if ( RedlineType::Delete == aRedlineTable[
nPos]->GetType() )
1771 if ( aRedlineTable.
empty() )
1772 return RedlineType::None;
1778 if ( pHasTextChangesOnlyProp && !pHasTextChangesOnlyProp->GetValue() )
1786 return aRedlineTable[
nPos]->GetType();
1792 return RedlineType::None;
1798 , m_pStartNode(nullptr)
1801 , mbDummyFlag(false)
1802 , mbDirectFormatting(false)
1814 , mbDummyFlag(false)
1815 , mbDirectFormatting(false)
1823 assert(pTableNd &&
"In which table is that box?");
1833 , m_pStartNode(&rSttNd)
1836 , mbDummyFlag(false)
1837 , mbDirectFormatting(false)
1843 OSL_ENSURE( pTableNd,
"In which table is the box?" );
1856 assert(pTableNd &&
"In which table is that box?");
1891 *pNewFormat = *pFormat;
1897 pFormat = pNewFormat;
1913 if ( pLast !=
this )
1920 *pNewFormat = *pRet;
1927 if( pCell->GetTabBox() ==
this )
1928 pCell->RegisterToFormat( *pNewFormat );
1931 pNewFormat->
Add(
this );
1945 if(bNeedToReregister)
1948 pNewFormat->
Add(
this);
1957 const sal_uInt16 coDiff = 52;
1960 const sal_uInt16 nCalc = nCol % coDiff;
1962 rNm = OUStringChar(
sal_Unicode(
'a' - 26 + nCalc) ) + rNm;
1964 rNm = OUStringChar(
sal_Unicode(
'A' + nCalc) ) + rNm;
1966 nCol = nCol - nCalc;
1979 return Point( 0, 0 );
1991 nY = pLines->
GetPos( pLine ) + 1 ;
1995 return Point( nX, nY );
2017 sTmp = OUString::number(
nPos );
2018 if( !sNm.isEmpty() )
2019 sNm = sTmp +
"." + sNm;
2024 sTmp = OUString::number(
nPos + 1);
2026 if(
nullptr != pBox )
2027 sNm = sTmp +
"." + sNm;
2064 if( pCNd && !pCNd->
Len() )
2074 switch( rInfo.
Which() )
2155 if( SvxAdjust::Left == eAdjust || SvxAdjust::Block == eAdjust )
2169 std::optional<Color> pNewUserColor;
2171 pNewUserColor = pColorItem->
GetValue();
2173 if( ( pNewUserColor && pOldNumFormatColor &&
2174 *pNewUserColor == *pOldNumFormatColor ) ||
2175 ( !pNewUserColor && !pOldNumFormatColor ))
2181 else if( pColorItem )
2193 rBox.
SetSaveUserColor( pNewUserColor ? *pNewUserColor : std::optional<Color>() );
2202 if( pTNd->
GetText() != rText )
2205 const OUString& rOrig = pTNd->
GetText();
2210 for( ;
n < rOrig.getLength() &&
'\x01' == rOrig[
n]; ++
n )
2215 sal_Int32 nEndPos =
n;
2226 SwPaM aTemp(*pTNd, 0, *pTNd, rOrig.getLength());
2232 while( nCommentPos > aIdx.
GetIndex() )
2238 nEndPos = nCommentPos;
2243 while( nCommentPos > aIdx.
GetIndex() && nCommentPos == nEndPos );
2251 SwPaM aTemp(*pTNd, 0, *pTNd, rText.getLength());
2260 text::VertOrientation::TOP == pVertOrientItem->
GetVertOrient() ))
2277 const Color * pCol =
nullptr;
2282 const OUString sText( pTNd->
GetText() );
2287 SwIndex aIdx( pTNd, sText.getLength() );
2300 if( bChgAlign && pAttrSet &&
2302 SvxAdjust::Right == pAdjustItem->
GetAdjust() )
2313 std::optional<Color> pNewUserColor;
2315 pNewUserColor = pColorItem->
GetValue();
2317 if( ( pNewUserColor && pOldNumFormatColor &&
2318 *pNewUserColor == *pOldNumFormatColor ) ||
2319 ( !pNewUserColor && !pOldNumFormatColor ))
2325 else if( pColorItem )
2350 text::VertOrientation::BOTTOM == pVertOrientItem->
GetVertOrient() )
2361 nNewFormat = pNewFormat->
GetValue();
2365 pNewFormat =
nullptr;
2372 nNewFormat = pNewFormat ? pNewFormat->
GetValue() : nOldFormat;
2378 if(
GetDoc()->GetNumberFormatter()->IsTextFormat(nNewFormat))
2400 bool bNewIsTextFormat = pNumFormatr->
IsTextFormat(nNewFormat);
2402 if((!bNewIsTextFormat && nOldFormat != nNewFormat) || pNewFormula)
2404 bool bIsNumFormat =
false;
2406 bool bChgText =
true;
2416 sal_uInt32 nTmpFormatIdx = nNewFormat;
2417 OUString aText(
GetDoc()->GetNodes()[nNdPos] ->GetTextNode()->GetRedlineText());
2428 if(SvNumFormatType::PERCENT == pNumFormatr->
GetType(nNewFormat))
2430 sal_uInt32 nTmpFormat = 0;
2431 if(
GetDoc()->IsNumberFormat(aText, nTmpFormat, fVal))
2433 if(SvNumFormatType::NUMBER == pNumFormatr->
GetType( nTmpFormat))
2457 bIsNumFormat =
true;
2461 const Color* pCol =
nullptr;
2463 bool bChangeFormat =
true;
2486 sNewText = aOrigText;
2494 bChangeFormat =
false;
2507 else if(bNewIsTextFormat && nOldFormat != nNewFormat)
2511SwTableBox* SwTableBoxFormat::SwTableBoxFormat::GetTableBox()
2514 auto pBox = aIter.First();
2515 SAL_INFO_IF(!pBox,
"sw.core",
"no box found at format");
2516 SAL_WARN_IF(pBox && aIter.Next(),
"sw.core",
"more than one box found at format");
2523 if(rHint.
GetId() != SfxHintId::SwLegacyModify)
2536 switch(pLegacy->m_pNew ? pLegacy->m_pNew->Which() : 0)
2561 if( pNewFormat || pNewFormula || pNewVal )
2593 bool& rIsEmptyTextNd )
const
2602 rIsEmptyTextNd = aText.isEmpty();
2607 rFormatIndex = pItem->GetValue();
2609 if( !rIsEmptyTextNd && SvNumFormatType::PERCENT == pNumFormatr->
GetType( rFormatIndex ))
2611 sal_uInt32 nTmpFormat = 0;
2612 if(
GetFrameFormat()->GetDoc()->IsNumberFormat( aText, nTmpFormat, rNum ) &&
2613 SvNumFormatType::NUMBER == pNumFormatr->
GetType( nTmpFormat ))
2623 rIsEmptyTextNd =
false;
2640 GetTextNode()->GetRedlineText() );
2643 const Color* pCol =
nullptr;
2647 bRet = sNewText != sOldText ||
2665 while( ++
nIndex < nIndexEnd )
2670 pTextNode =
nullptr;
2677 pTextNode =
nullptr;
2696 sal_Int32 nNextSetField = 0;
2697 for(
size_t n = 0;
n < pHts->
Count(); ++
n )
2700 if( RES_TXTATR_NOEND_BEGIN <= pAttr->Which() )
2702 if ( (pAttr->
GetStart() == nNextSetField)
2716 nNextSetField = pAttr->
GetStart() + 1;
2741 sal_uInt16 nWhich = 0;
2752 ->GetTextNode() ) && pTNd->
GetText().isEmpty())
2775 double fVal = pValItem->
GetValue();
2776 const Color* pCol =
nullptr;
2781 if( rText != sNewText )
2819 const SwFrame * pResult =
nullptr;
2827 while (pFrame->
GetUpper() !=
nullptr)
2852 while ((pFrame = getNextFrameInTable(pFrame)) !=
nullptr)
2856 pResult =
static_cast<const SwCellFrame *
>(pFrame);
2868 while ((pFrame = getNextCellFrame(pFrame)) !=
nullptr)
2872 auto aIt = m_HandledTableBoxes.insert(pTabBox);
2875 pResult = pCellFrame;
2885 return m_pImpl->getCellFrame();
2890 if (m_pCellFrame ==
nullptr)
2892 if (m_pTabFrame !=
nullptr)
2898 return m_pCellFrame !=
nullptr;
2938 rFormat.
Add(
this );
2950 rFormat.
Add(
this );
constexpr sal_uInt32 getSwDefaultTextFormat()
The number formatter's default locale's @ Text format.
sal_uInt32 GetValue() const
virtual bool SetFieldsDirty(bool b, const SwNode *pChk, SwNodeOffset nLen)=0
virtual sfx2::LinkManager & GetLinkManager()=0
virtual bool IsIgnoreRedline() const =0
virtual bool DeleteRedline(const SwPaM &rPam, bool bSaveInUndo, RedlineType nDelType)=0
static bool IsRedlineOn(const RedlineFlags eM)
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
SvxAdjust GetAdjust() const
void SetAdjust(const SvxAdjust eType)
const Color & GetValue() const
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
sal_uInt16 CalcShadowSpace(SvxShadowItemSide nShadow) const
tools::Long GetWidth() const
void SetWidth(tools::Long n)
const SwAttrSet * GetChgSet() const
What has changed.
SwCellFrame is one table cell in the document layout.
const SwTableBox * GetTabBox() const
std::optional< sw::ModifyChangedHint > CheckRegistration(const SfxPoolItem *pOldValue)
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
virtual sal_Int32 Len() const
const SwAttrSet * GetpSwAttrSet() const
SwTableBoxFormat * MakeTableBoxFormat()
SwTableLineFormat * MakeTableLineFormat()
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
bool IsNumberFormat(const OUString &rString, sal_uInt32 &F_Index, double &fOutNumber)
const SwTextFormatColl * GetDfltTextFormatColl() const
void DelTableFrameFormat(SwTableFormat *pFormat)
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
bool IsInsTableAlignNum() const
Base class of all fields.
SwFieldTypesEnum GetTypeId() const
bool IsAnFollow(const SwFlowFrame *pFlow) const
const SwRect & getFrameArea() const
Base class of the Writer layout elements.
SwTabFrame * FindTabFrame()
SwLayoutFrame * GetUpper()
Marks a character position inside a document model node.
sal_Int32 GetIndex() const
bool IsModifyLocked() const
void Add(SwClient *pDepend)
SwClient * Remove(SwClient *pDepend)
bool HasWriterListeners() const
Marks a node in the document model.
SwNodeOffset GetIndex() const
Base class of the Writer document model elements.
SwStartNode * GetStartNode()
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwNodeOffset GetIndex() const
SwNodes & GetNodes()
Node is in which nodes-array/doc?
SwTableNode * FindTableNode()
Search table node, in which it is.
SwNodeOffset EndOfSectionIndex() const
SwContentNode * GetContentNode()
bool InsBoxen(SwTableNode *, SwTableLine *, SwTableBoxFormat *, SwTextFormatColl *, const SfxItemSet *pAutoAttr, sal_uInt16 nInsPos, sal_uInt16 nCnt=1)
Insert a new box in the line before InsPos.
SwContentNode * GoNext(SwNodeIndex *) const
SwNodeOffset Count() const
PaM is Point and Mark: a selection of the document model.
const SwPosition * End() const
const SwPosition * Start() const
RedlineType GetType(sal_uInt16 nPos=0) const
const SwRedlineData & GetRedlineData(sal_uInt16 nPos=0) const
Of course Writer needs its own rectangles.
void Height(tools::Long nNew)
void Width(tools::Long nNew)
const DateTime & GetTimeStamp() const
static constexpr size_type npos
vector_type::size_type size_type
SwRowFrame is one table row in the document layout.
virtual sal_uInt16 GetSubType() const override
Starts a section of nodes in the document model.
const SwTabColsEntry & GetEntry(size_t nPos) const
void Remove(size_t nPos, size_t nCount=1)
tools::Long GetLeft() const
tools::Long GetRight() const
tools::Long GetRightMax() const
void SetHidden(size_t nPos, bool bValue)
void Insert(tools::Long nValue, bool bValue, size_t nPos)
SwTabFrame is one table in the document layout, containing rows (which contain cells).
SwTabFrame * FindMaster(bool bFirstMaster=false) const
bool IsInHeadline(const SwFrame &rFrame) const
SwTableBox is one table cell in the document model.
SwNodeOffset IsValidNumTextNd(bool bCheckAttr=true) const
void SetSaveUserColor(std::optional< Color > p)
sal_uInt16 IsFormulaOrValueBox() const
bool IsNumberChanged() const
sal_Int32 getRowSpan() const
SwNodeOffset GetSttIdx() const
const std::optional< Color > & GetSaveUserColor() const
void setRowSpan(sal_Int32 nNewRowSpan)
const SwStartNode * m_pStartNode
static SwTableBoxFormat * CheckBoxFormat(SwTableBoxFormat *)
void SetSaveNumFormatColor(std::optional< Color > p)
SwFrameFormat * GetFrameFormat()
SwTableLines & GetTabLines()
bool getDummyFlag() const
void setDummyFlag(bool bDummy)
bool HasNumContent(double &rNum, sal_uInt32 &rFormatIndex, bool &rIsEmptyTextNd) const
Point GetCoordinates() const
bool IsInHeadline(const SwTable *pTable) const
virtual ~SwTableBox() override
const std::optional< Color > & GetSaveNumFormatColor() const
const SwStartNode * GetSttNd() const
void RegisterToFormat(SwFormat &rFormat)
void ChgFrameFormat(SwTableBoxFormat *pNewFormat, bool bNeedToReregister=true)
SwTableBox(const SwTableBox &)=delete
SwFrameFormat * ClaimFrameFormat()
const SwCellFrame * getCellFrame() const
std::unique_ptr< Impl > m_pImpl
SwTableCellInfo(SwTableCellInfo const &)=delete
const SwTableBox * getTableBox() const
SwTableLine is one table row in the document model.
SwFrameFormat * GetFrameFormat()
SwTableLine(SwTableLineFormat *, sal_uInt16 nBoxes, SwTableBox *pUp)
SwRedlineTable::size_type UpdateTextChangesOnly(SwRedlineTable::size_type &rRedlinePos, bool bUpdateProperty=true) const
void ChgFrameFormat(SwTableLineFormat *pNewFormat)
SwTwips GetTableLineHeight(bool &bLayoutAvailable) const
SwFrameFormat * ClaimFrameFormat()
void SetRedlineType(RedlineType eType)
SwTableBoxes & GetTabBoxes()
RedlineType GetRedlineType() const
bool IsDeleted(SwRedlineTable::size_type &rRedlinePos) const
RedlineType m_eRedlineType
sal_uInt16 GetBoxPos(const SwTableBox *pBox) const
virtual ~SwTableLine() override
std::vector< SwTableLine * >::const_iterator const_iterator
SwTableLine * back() const
SwTableLine * front() const
void reserve(size_type nSize)
sal_uInt16 GetPos(const SwTableLine *pBox) const
const SwTable & GetTable() const
SwTable is one table in the document model, containing rows (which contain cells).
void SetTabCols(const SwTabCols &rNew, const SwTabCols &rOld, const SwTableBox *pStart, bool bCurRowOnly)
virtual ~SwTable() override
SwTableNode * GetTableNode() const
void SetHTMLTableLayout(std::shared_ptr< SwHTMLTableLayout > const &r)
std::shared_ptr< SwHTMLTableLayout > m_xHTMLLayout
SwTableSortBoxes m_TabSortContentBoxes
void AdjustWidths(const tools::Long nOld, const tools::Long nNew)
SwTableNode * m_pTableNode
SwTableLines & GetTabLines()
SwTableFormat * GetFrameFormat()
bool IsTableComplex() const
void RegisterToFormat(SwFormat &rFormat)
TableChgMode m_eTableChgMode
const SwTableBox * GetTableBox(const OUString &rName, const bool bPerformValidCheck=false) const
bool HasDeletedRow() const
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
virtual bool GetInfo(SfxPoolItem &) const override
static SwTable * FindTable(SwFrameFormat const *const pFormat)
static sal_uInt16 GetBoxNum(OUString &rStr, bool bFirst=false, const bool bPerformValidCheck=false)
SwTableSortBoxes & GetTabSortBoxes()
void GetTabCols(SwTabCols &rToFill, const SwTableBox *pStart, bool bHidden=false, bool bCurRowOnly=false) const
tools::SvRef< SwServerObject > m_xRefObj
void NewSetTabCols(Parm &rP, const SwTabCols &rNew, const SwTabCols &rOld, const SwTableBox *pStart, bool bCurRowOnly)
void SetRefObject(SwServerObject *)
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
sal_Int32 GetStart() const
const SwFormatField & GetFormatField() const
SwTextNode is a paragraph in the document model.
void EraseText(const SwIndex &rIdx, const sal_Int32 nCount=SAL_MAX_INT32, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
delete text content ATTENTION: must not be called with a range that overlaps the start of an attribut...
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
bool DontExpandFormat(const SwIndex &rIdx, bool bFlag=true, bool bFormatToTextAttributes=true)
When appropriate set DontExpand-flag at INet or character styles respectively.
SwpHints * GetpSwpHints()
const OUString & GetText() const
OUString InsertText(const OUString &rStr, const SwIndex &rIdx, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
insert text content
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0) override
static ShellResource * GetShellRes()
An SwTextAttr container, stores all directly formatted text portions for a text node.
SwTextAttr * Get(size_t nPos) const
size_type erase(const Value &x)
std::pair< const_iterator, bool > insert(Value &&x)
void RemoveServer(SvLinkSource *rObj)
virtual void CallSwClientNotify(const SfxHint &rHint) const override
TableChgMode GetTableChgDefaultMode()
EmbeddedObjectRef * pObject
@ Variable
Frame is variable in Var-direction.
constexpr TypedWhichId< SwFormatFootnote > RES_TXTATR_FTN(59)
constexpr TypedWhichId< SwFindNearestNode > RES_FINDNEARESTNODE(184)
constexpr TypedWhichId< SwTableBoxValue > RES_BOXATR_VALUE(152)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
constexpr TypedWhichId< SvxAdjustItem > RES_PARATR_ADJUST(64)
constexpr TypedWhichId< SwTableBoxFormula > RES_BOXATR_FORMULA(151)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_ANNOTATION(60)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(163)
constexpr TypedWhichId< SwTableBoxNumFormat > RES_BOXATR_FORMAT(RES_BOXATR_BEGIN)
constexpr TypedWhichId< SwAutoFormatGetDocNode > RES_AUTOFMT_DOCNODE(173)
constexpr TypedWhichId< SwFormatAutoFormat > RES_PARATR_LIST_AUTOFMT(87)
constexpr TypedWhichId< SvxPrintItem > RES_PRINT(98)
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_CONTENT_VISIBLE(185)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(102)
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
#define SAL_INFO_IF(condition, area, stream)
#define SAL_WARN_IF(condition, area, stream)
tools::Long const nBorder
const SwExtendedSubType SUB_INVISIBLE
Invisible.
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
constexpr SwNodeOffset NODE_OFFSET_MAX(SAL_MAX_INT32)
SwNodeOffset abs(const SwNodeOffset &a)
SwShareBoxFormats aShareFormats
std::deque< SwTableBox * > aBoxArr
Parm(const SwTabCols &rN, const SwTabCols &rO)
Marks a position in the document model.
TableBoxes_t m_HandledTableBoxes
const SwTabFrame * m_pTabFrame
const SwCellFrame * m_pCellFrame
const SwCellFrame * getNextCellFrame(const SwFrame *pFrame)
void setTable(const SwTable *pTable)
const SwCellFrame * getNextTableBoxsCellFrame(const SwFrame *pFrame)
const SwCellFrame * getCellFrame() const
o3tl::sorted_vector< const SwTableBox * > TableBoxes_t
const SwFrame * getNextFrameInTable(const SwFrame *pFrame)
sal_uInt16 GetWhich() const
std::list< ColChange > ChangeList
static void lcl_AdjustWidthsInLine(SwTableLine *pLine, ChangeList &rOldNew, Parm &rParm, sal_uInt16 nColFuzzy)
static void lcl_ProcessBoxPtr(SwTableBox *pBox, std::deque< SwTableBox * > &rBoxArr, bool bBefore)
std::pair< sal_uInt16, sal_uInt16 > ColChange
static void lcl_ProcessLine(SwTableLine *pLine, Parm &rParm)
static OUString & lcl_TabToBlankAtSttEnd(OUString &rText)
static void lcl_ProcessLineGet(const SwTableLine *pLine, SwTabCols &rToFill, const SwFrameFormat *pTabFormat)
static void ChgNumToText(SwTableBox &rBox, sal_uLong nFormat)
static void lcl_ProcessBoxSet(SwTableBox *pBox, Parm &rParm)
static void lcl_ModifyLines(SwTableLines &rLines, const tools::Long nOld, const tools::Long nNew, std::vector< SwFormat * > &rFormatArr, const bool bCheckSum)
static void lcl_ModifyBoxes(SwTableBoxes &rBoxes, const tools::Long nOld, const tools::Long nNew, std::vector< SwFormat * > &rFormatArr)
static void lcl_ProcessBoxGet(const SwTableBox *pBox, SwTabCols &rToFill, const SwFrameFormat *pTabFormat, bool bRefreshHidden)
static void lcl_AdjustBox(SwTableBox *pBox, const tools::Long nDiff, Parm &rParm)
static void lcl_AdjustLines(SwTableLines &rLines, const tools::Long nDiff, Parm &rParm)
static void FormatInArr(std::vector< SwFormat * > &rFormatArr, SwFormat *pBoxFormat)
static void lcl_CalcNewWidths(std::vector< sal_uInt16 > &rSpanPos, ChangeList &rChanges, SwTableLine *pLine, tools::Long nWish, tools::Long nWidth, bool bTop)
static bool lcl_IsValidRowName(std::u16string_view rStr)
static void ChgTextToNum(SwTableBox &rBox, const OUString &rText, const Color *pCol, bool bChgAlign, SwNodeOffset nNdPos)
static void lcl_RefreshHidden(SwTabCols &rToFill, size_t nPos)
void DelBoxNode(SwTableSortBoxes const &rSortCntBoxes)
static void lcl_SortedTabColInsert(SwTabCols &rToFill, const SwTableBox *pBox, const SwFrameFormat *pTabFormat, const bool bHidden, const bool bRefreshHidden)
static OUString & lcl_DelTabsAtSttEnd(OUString &rText)
void sw_GetTableBoxColStr(sal_uInt16 nCol, OUString &rNm)
void InsTableBox(SwDoc &rDoc, SwTableNode *pTableNd, SwTableLine *pLine, SwTableBoxFormat *pBoxFrameFormat, SwTableBox *pBox, sal_uInt16 nInsPos, sal_uInt16 nCnt)
std::vector< SwTableBox * > SwTableBoxes
void CheckBoxWidth(const SwTableLine &rLine, SwTwips nSize)