28#include <osl/diagnose.h>
33#include <document.hxx>
36#include <stlsheet.hxx>
48using ::editeng::SvxBorderLine;
55 if (
nCol == -1 || !pDefaultColAttrArray || pDefaultColAttrArray->
mvData.empty() )
61 for (
size_t nIdx = 0; nIdx < pDefaultColAttrArray->
mvData.size(); ++nIdx )
63 mvData[nIdx].nEndRow = pDefaultColAttrArray->
mvData[nIdx].nEndRow;
66 bool bNumFormatChanged =
false;
79#if DEBUG_SC_TESTATTRARRAY
84 for (
auto const & rEntry :
mvData)
85 pDocPool->
Remove(*rEntry.pPattern);
88#if DEBUG_SC_TESTATTRARRAY
89void ScAttrArray::TestData()
const
105 SAL_WARN_IF( nErr,
"sc", nErr <<
" errors in attribute array, column " <<
nCol );
115 mvData.reserve( nNewLimit );
133 bool bNumFormatChanged;
142 pDocPool->
Remove(*pOldPattern);
151 mvData[0].pPattern = pNewPattern;
222 else if ((
i > 0) && (
mvData[
i - 1].nEndRow >= nRow))
283 if(nEndRow < nStartRow)
286 SCROW nTempStartRow = nStartRow;
287 SCROW nTempEndRow = nEndRow;
293 std::unique_ptr<ScPatternAttr> pNewPattern;
297 SCROW nPatternStartRow;
298 SCROW nPatternEndRow;
301 nTempEndRow = std::min<SCROW>( nPatternEndRow, nEndRow );
308 aNewCondFormatData.
reserve(rCondFormatData.
size()+1);
309 aNewCondFormatData = rCondFormatData;
312 pNewPattern->GetItemSet().Put( aItem );
318 pNewPattern->GetItemSet().Put( aItem );
325 pNewPattern->GetItemSet().Put( aItem );
326 nTempEndRow = nEndRow;
329 SetPatternArea( nTempStartRow, nTempEndRow, std::move(pNewPattern),
true );
330 nTempStartRow = nTempEndRow + 1;
332 while(nTempEndRow < nEndRow);
341 if(nEndRow < nStartRow)
344 SCROW nTempStartRow = nStartRow;
345 SCROW nTempEndRow = nEndRow;
353 SCROW nPatternStartRow;
354 SCROW nPatternEndRow;
357 nTempEndRow = std::min<SCROW>( nPatternEndRow, nEndRow );
360 auto pPatternAttr = std::make_unique<ScPatternAttr>( *pPattern );
364 pPatternAttr->GetItemSet().Put( aItem );
365 SetPatternArea( nTempStartRow, nTempEndRow, std::move(pPatternAttr),
true );
371 if(itr != rCondFormatData.
end())
374 aNewCondFormatData.
erase_at(std::distance(rCondFormatData.
begin(), itr));
376 pPatternAttr->GetItemSet().Put( aItem );
377 SetPatternArea( nTempStartRow, nTempEndRow, std::move(pPatternAttr),
true );
387 nTempStartRow = nTempEndRow + 1;
389 while(nTempEndRow < nEndRow);
396 assert(
nCol != -1 );
400 for (
SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow)
407 std::unique_ptr<EditTextObject> pOldData;
418 pDataArray->
AddItem(
nTab,
nCol, nRow, std::move(pOldData), std::move(pNewData));
425 if (
mvData.empty() && nReserve )
433 }
catch (std::bad_alloc
const &) {
437 else if (
mvData.capacity() < nReserve )
442 }
catch (std::bad_alloc
const &) {
457 if (bPassingOwnership)
492 while (
ns <= nEndRow )
494 if (
nCol != -1 && !bIsLoading )
498 bool bNumFormatChanged;
502 aAdrStart.
SetRow( std::max(nStartRow,
ns) );
514 bool bCombined =
false;
519 if (
mvData[ni].pPattern != pPattern )
521 if ( ni == 0 || (
mvData[ni-1].nEndRow < nStartRow - 1) )
524 if (
mvData[ni].nEndRow > nEndRow )
529 else if (
mvData[ni - 1].nEndRow == nStartRow - 1)
532 if ( ni > 0 &&
mvData[ni-1].pPattern == pPattern )
534 mvData[ni-1].nEndRow = nEndRow;
543 while ( nj <
mvData.size() &&
mvData[nj].nEndRow <= nEndRow )
547 if ( nj <
mvData.size() &&
mvData[nj].pPattern == pPattern )
551 if (
mvData[ni-1].pPattern == pPattern )
556 else if ( ni == nInsert )
557 mvData[ni-1].nEndRow = nStartRow - 1;
562 else if ( ni > 0 && ni == nInsert )
563 mvData[ni-1].nEndRow = nStartRow - 1;
572 for (
SCSIZE nk=ni; nk<nj; nk++)
578 mvData[ni].nEndRow = nEndRow;
579 mvData[ni].pPattern = pPattern;
591 if ( nInsert <=
mvData.size() )
602 mvData[nInsert-1].nEndRow = nStartRow - 1;
603 mvData[nInsert].nEndRow = nEndRow;
604 mvData[nInsert].pPattern = pPattern;
608 if (pDataArray &&
nCol != -1)
616#if DEBUG_SC_TESTATTRARRAY
632 OSL_FAIL(
"Search Failure");
642 std::unique_ptr<ScPatternAttr> pNewPattern(
new ScPatternAttr(*pOldPattern));
643 pNewPattern->SetStyleSheet(
const_cast<ScStyleSheet*
>(&rStyle));
648 if ( *pNewPattern == *pOldPattern )
654 else if ( nY1 < nStartRow || nY2 > nEndRow )
656 if (nY1 < nStartRow) nY1=nStartRow;
657 if (nY2 > nEndRow) nY2=nEndRow;
667 const SfxItemSet& rNewSet = pNewPattern->GetItemSet();
670 bool bNumFormatChanged;
688 while ((nStart <= nEndRow) && (
nPos <
mvData.size()));
692#if DEBUG_SC_TESTATTRARRAY
702 const_cast<SvxBorderLine*
>(dest)->SetColor(c);
706static void SetLine(
const SvxBorderLine* dest,
const SvxBorderLine* src)
710 SvxBorderLine* pCast =
const_cast<SvxBorderLine*
>(dest);
711 pCast->SetBorderLineStyle( src->GetBorderLineStyle() );
712 pCast->SetWidth( src->GetWidth() );
717 const SvxBorderLine* pLine,
bool bColorOnly )
719 if ( bColorOnly && !pLine )
730 OSL_FAIL(
"Search failure");
742 if ( pBoxItem || pTLBRItem || pBLTRItem )
744 std::unique_ptr<ScPatternAttr> pNewPattern(
new ScPatternAttr(*pOldPattern));
745 SfxItemSet& rNewSet = pNewPattern->GetItemSet();
749 std::unique_ptr<SvxBoxItem> pNewBoxItem( pBoxItem ? pBoxItem->
Clone() :
nullptr);
750 std::unique_ptr<SvxLineItem> pNewTLBRItem( pTLBRItem ? pTLBRItem->
Clone() :
nullptr);
751 std::unique_ptr<SvxLineItem> pNewBLTRItem(pBLTRItem ? pBLTRItem->
Clone() :
nullptr);
759 if ( pNewBoxItem->GetTop() ) pNewBoxItem->SetLine(
nullptr, SvxBoxItemLine::TOP );
760 if ( pNewBoxItem->GetBottom() ) pNewBoxItem->SetLine(
nullptr, SvxBoxItemLine::BOTTOM );
761 if ( pNewBoxItem->GetLeft() ) pNewBoxItem->SetLine(
nullptr, SvxBoxItemLine::LEFT );
762 if ( pNewBoxItem->GetRight() ) pNewBoxItem->SetLine(
nullptr, SvxBoxItemLine::RIGHT );
764 if( pNewTLBRItem && pNewTLBRItem->GetLine() )
765 pNewTLBRItem->SetLine(
nullptr );
766 if( pNewBLTRItem && pNewBLTRItem->GetLine() )
767 pNewBLTRItem->SetLine(
nullptr );
773 Color aColor( pLine->GetColor() );
790 SetLine( pNewBoxItem->GetTop(), pLine );
791 SetLine( pNewBoxItem->GetBottom(), pLine );
792 SetLine( pNewBoxItem->GetLeft(), pLine );
793 SetLine( pNewBoxItem->GetRight(), pLine );
796 SetLine( pNewTLBRItem->GetLine(), pLine );
798 SetLine( pNewBLTRItem->GetLine(), pLine );
801 if( pNewBoxItem ) rNewSet.
Put( std::move(pNewBoxItem) );
802 if( pNewTLBRItem ) rNewSet.
Put( std::move(pNewTLBRItem) );
803 if( pNewBLTRItem ) rNewSet.
Put( std::move(pNewBLTRItem) );
807 if ( nY1 < nStartRow || nY2 > nEndRow )
809 if (nY1 < nStartRow) nY1=nStartRow;
810 if (nY2 > nEndRow) nY2=nEndRow;
833 while ((nStart <= nEndRow) && (
nPos <
mvData.size()));
838#if DEBUG_SC_TESTATTRARRAY
850 OSL_FAIL(
"Search Failure");
861 if (pNewPattern != pOldPattern)
870 if ( nY1 < nStartRow || nY2 > nEndRow )
872 if (nY1 < nStartRow) nY1=nStartRow;
873 if (nY2 > nEndRow) nY2=nEndRow;
886 bool bNumFormatChanged;
910 while (nStart <= nEndRow);
914#if DEBUG_SC_TESTATTRARRAY
922 for (
auto const & rEntry :
mvData)
923 pDocPool->
Remove(*rEntry.pPattern);
925 mvData = std::move(vNewData);
928 SCROW lastEndRow = -1;
929 for(
const auto& entry :
mvData)
931 assert(entry.nEndRow > lastEndRow);
932 lastEndRow = entry.nEndRow;
946 if ( eOldState == SfxItemState::DEFAULT )
949 if ( eNewState == SfxItemState::SET )
955 else if ( eOldState == SfxItemState::SET )
958 if ( eNewState == SfxItemState::SET )
960 if ( pNewItem != pOldItem )
983 OSL_FAIL(
"Search failure");
995 if ( pPattern != rState.
pOld1 && pPattern != rState.
pOld2 )
1004 rState.
pItemSet->MergeValues( rThisSet );
1010 rState.
pItemSet->Set( rThisSet, bDeep );
1015 rState.
pOld1 = pPattern;
1024 while (nStart <= nEndRow);
1029static bool lcl_TestAttr(
const SvxBorderLine* pOldLine,
const SvxBorderLine* pNewLine,
1030 sal_uInt8& rModified,
const SvxBorderLine*& rpNew )
1042 if (pOldLine == pNewLine)
1048 if (pOldLine && pNewLine)
1049 if (*pOldLine == *pNewLine)
1062 bool bLeft,
SCCOL nDistRight,
bool bTop,
SCROW nDistBottom )
1072 const SvxBorderLine* pLeftAttr = pCellFrame->
GetLeft();
1073 const SvxBorderLine* pRightAttr = pCellFrame->
GetRight();
1074 const SvxBorderLine* pTopAttr = pCellFrame->
GetTop();
1075 const SvxBorderLine* pBottomAttr = pCellFrame->
GetBottom();
1076 const SvxBorderLine* pNew;
1081 pLineOuter->
SetLine( pNew, SvxBoxItemLine::TOP );
1086 pLineInner->
SetLine( pNew, SvxBoxInfoItemLine::HORI );
1089 if (nDistBottom == 0)
1092 pLineOuter->
SetLine( pNew, SvxBoxItemLine::BOTTOM );
1097 pLineInner->
SetLine( pNew, SvxBoxInfoItemLine::HORI );
1103 pLineOuter->
SetLine( pNew, SvxBoxItemLine::LEFT );
1108 pLineInner->
SetLine( pNew, SvxBoxInfoItemLine::VERT );
1111 if (nDistRight == 0)
1114 pLineOuter->
SetLine( pNew, SvxBoxItemLine::RIGHT );
1119 pLineInner->
SetLine( pNew, SvxBoxInfoItemLine::VERT );
1129 if (nStartRow == nEndRow)
1132 lcl_MergeToFrame( pLineOuter, pLineInner, rFlags, pPattern, bLeft, nDistRight,
true, 0 );
1134 else if ( !
mvData.empty() )
1137 lcl_MergeToFrame( pLineOuter, pLineInner, rFlags, pPattern, bLeft, nDistRight,
true,
1138 nEndRow-nStartRow );
1142 Search( nStartRow+1, nStartIndex );
1143 Search( nEndRow-1, nEndIndex );
1144 for (
SCSIZE i=nStartIndex;
i<=nEndIndex;
i++)
1146 pPattern =
mvData[
i].pPattern;
1147 lcl_MergeToFrame( pLineOuter, pLineInner, rFlags, pPattern, bLeft, nDistRight,
false,
1148 nEndRow - std::min(
mvData[
i].nEndRow,
static_cast<SCROW>(nEndRow-1) ) );
1153 lcl_MergeToFrame( pLineOuter, pLineInner, rFlags, pPattern, bLeft, nDistRight,
false, 0 );
1168 bool bLeft,
SCCOL nDistRight,
bool bTop,
SCROW nDistBottom )
1170 OSL_ENSURE( pBoxInfoItem,
"Missing line attributes!" );
1187 if( bLeft && nDistRight==0)
1189 if ( pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::LEFT) )
1191 if ( pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::RIGHT) )
1196 if ( (nDistRight==0) ? pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::LEFT) : pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::VERT) )
1198 SvxBoxItemLine::RIGHT );
1199 if ( bLeft ? pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::RIGHT) : pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::VERT) )
1201 SvxBoxItemLine::LEFT );
1206 if ( bLeft ? pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::LEFT) : pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::VERT) )
1208 SvxBoxItemLine::LEFT );
1209 if ( (nDistRight==0) ? pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::RIGHT) : pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::VERT) )
1211 SvxBoxItemLine::RIGHT );
1213 if ( bTop ? pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::TOP) : pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::HORI) )
1215 SvxBoxItemLine::TOP );
1216 if ( (nDistBottom==0) ? pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::BOTTOM) : pBoxInfoItem->
IsValid(SvxBoxInfoItemValidFlags::HORI) )
1218 SvxBoxItemLine::BOTTOM );
1220 if (aNewFrame == *pOldFrame)
1238 if (nStartRow == nEndRow)
1239 ApplyFrame(rLineOuter, pLineInner, nStartRow, nEndRow, bLeft, nDistRight,
true, 0);
1242 ApplyFrame(rLineOuter, pLineInner, nStartRow, nStartRow, bLeft, nDistRight,
1243 true, nEndRow-nStartRow);
1245 if ( nEndRow > nStartRow+1 )
1249 Search( nStartRow+1, nStartIndex );
1250 Search( nEndRow-1, nEndIndex );
1251 SCROW nTmpStart = nStartRow+1;
1253 for (
SCSIZE i=nStartIndex;
i<=nEndIndex;)
1255 nTmpEnd = std::min(
static_cast<SCROW>(nEndRow-1),
mvData[
i].nEndRow );
1256 bool bChanged =
ApplyFrame(rLineOuter, pLineInner, nTmpStart, nTmpEnd,
1257 bLeft, nDistRight,
false, nEndRow - nTmpEnd);
1258 nTmpStart = nTmpEnd+1;
1262 Search(nEndRow-1, nEndIndex);
1269 ApplyFrame(rLineOuter, pLineInner, nEndRow, nEndRow, bLeft, nDistRight,
false, 0);
1275 bool bFound =
false;
1301 if ( pShadow->
GetLocation() != SvxShadowLocation::NONE )
1312 bool bFoundTemp =
false;
1316 bool bContainsCondFormat = !
mvData.empty() &&
1318 if ( bContainsCondFormat &&
nCol != -1 )
1320 SCROW nRowStartCond = std::max<SCROW>( nRow1,
i ?
mvData[
i-1].nEndRow + 1: 0 );
1321 SCROW nRowEndCond = std::min<SCROW>( nRow2,
mvData[
i].nEndRow );
1322 bool bFoundCond =
false;
1323 for(
SCROW nRowCond = nRowStartCond; nRowCond <= nRowEndCond && !bFoundCond; ++nRowCond)
1341 bFoundCond = bFoundTemp;
1344 bFoundTemp = bFoundCond;
1356 if ( nAngle && nAngle != 9000_deg100 && nAngle != 27000_deg100 )
1378 if ( eLoc == SvxShadowLocation::TopRight || eLoc == SvxShadowLocation::BottomRight )
1381 if ( eLoc == SvxShadowLocation::BottomLeft || eLoc == SvxShadowLocation::BottomRight )
1388 if ( eHorJust == SvxCellHorJustify::Right || eHorJust == SvxCellHorJustify::Center )
1405 Search( nRow1, nStartIndex );
1407 Search( nRow2, nEndIndex );
1409 nEndIndex = nStartIndex;
1410 bool bFound =
false;
1412 for (
SCSIZE i=nStartIndex;
i<=nEndIndex && !bFound;
i++)
1463 assert(
nCol != -1 );
1469 Search( nStartRow, nStartIndex );
1470 Search( nEndRow, nEndIndex );
1471 bool bFound =
false;
1473 for (
SCSIZE i=nStartIndex;
i<=nEndIndex;
i++)
1475 pPattern =
mvData[
i].pPattern;
1479 if (nCountX>1 || nCountY>1)
1482 SCCOL nMergeEndCol = nThisCol + nCountX - 1;
1483 SCROW nMergeEndRow = nThisRow + nCountY - 1;
1485 rPaintCol = nMergeEndCol;
1487 rPaintRow = nMergeEndRow;
1492 if ( nMergeEndCol > nThisCol )
1495 if ( nMergeEndRow > nThisRow )
1498 if ( nMergeEndCol > nThisCol && nMergeEndRow > nThisRow )
1503 Search( nStartRow, nStartIndex );
1504 Search( nEndRow, nEndIndex );
1514 assert(
nCol != -1 );
1522 if (nThisStart < nStartRow)
1523 nThisStart = nStartRow;
1525 while ( nThisStart <= nEndRow )
1528 if (nThisEnd > nEndRow)
1535 if (nCountX>1 || nCountY>1)
1540 OSL_ENSURE( nCountY==1 || nThisStart==nThisEnd,
"What's up?" );
1543 SCCOL nMergeEndCol = nThisCol + nCountX - 1;
1544 SCROW nMergeEndRow = nThisEnd + nCountY - 1;
1547 for (
SCROW nThisRow = nThisStart; nThisRow <= nThisEnd; nThisRow++)
1552 pSet->
Put( *pFlagAttr );
1554 nTab, aNewPattern );
1577 bool bFirstUse =
true;
1581 while ( nThisRow <= nEndRow )
1584 if (pOldPattern != pWantedPattern)
1586 if (nThisRow < nStartRow) nThisRow = nStartRow;
1588 SCROW nAttrRow = std::min( nRow, nEndRow );
1597 std::unique_ptr<ScPatternAttr> pNewPattern(
new ScPatternAttr( *pWantedPattern ));
1598 pNewPattern->GetItemSet().Put( *pItem );
1599 SetPatternArea( nThisRow, nAttrRow, std::move(pNewPattern),
true );
1631 bool bChanged =
false;
1635 if (nThisRow < nStartRow) nThisRow = nStartRow;
1637 while ( nThisRow <= nEndRow )
1641 if ( (nOldValue | nFlags) != nOldValue )
1644 SCROW nAttrRow = std::min( nRow, nEndRow );
1645 auto pNewPattern = std::make_unique<ScPatternAttr>(*pOldPattern);
1646 pNewPattern->GetItemSet().Put(
ScMergeFlagAttr( nOldValue | nFlags ) );
1647 SetPatternArea( nThisRow, nAttrRow, std::move(pNewPattern),
true );
1668 bool bChanged =
false;
1672 if (nThisRow < nStartRow) nThisRow = nStartRow;
1674 while ( nThisRow <= nEndRow )
1678 if ( (nOldValue & ~nFlags) != nOldValue )
1681 SCROW nAttrRow = std::min( nRow, nEndRow );
1682 auto pNewPattern = std::make_unique<ScPatternAttr>(*pOldPattern);
1683 pNewPattern->GetItemSet().Put(
ScMergeFlagAttr( nOldValue & ~nFlags ) );
1684 SetPatternArea( nThisRow, nAttrRow, std::move(pNewPattern),
true );
1705 if (nThisRow < nStartRow) nThisRow = nStartRow;
1707 while ( nThisRow <= nEndRow )
1712 auto pNewPattern = std::make_unique<ScPatternAttr>(*pOldPattern);
1713 pNewPattern->ClearItems( pWhich );
1716 SCROW nAttrRow = std::min( nRow, nEndRow );
1717 SetPatternArea( nThisRow, nAttrRow, std::move(pNewPattern),
true );
1732 if (nThisStart < nStartRow) nThisStart = nStartRow;
1734 while ( nThisStart <= nEndRow )
1741 || (pItem->GetValue() != SvxCellHorJustify::Left &&
1742 pItem->GetValue() != SvxCellHorJustify::Right );
1744 sal_uInt16 nNewValue = nOldValue;
1759 if ( nNewValue > 0 )
1768 if ( bNeedJust || nNewValue != nOldValue )
1771 SCROW nAttrRow = std::min( nThisEnd, nEndRow );
1772 auto pNewPattern = std::make_unique<ScPatternAttr>(*pOldPattern);
1773 pNewPattern->GetItemSet().Put(
ScIndentItem( nNewValue ) );
1775 pNewPattern->GetItemSet().Put(
1777 SetPatternArea( nThisStart, nAttrRow, std::move(pNewPattern),
true );
1779 nThisStart = nThisEnd + 1;
1835 if (
mvData[
nPos].pPattern->GetStyleSheet() == pStyleSheet)
1837 rUsedRows.
setTrue(nStart, nEnd);
1845 Find(
ScResId(STR_STYLENAME_STANDARD),
1846 SfxStyleFamily::Para,
1847 SfxStyleSearchBits::Auto | SfxStyleSearchBits::ScStandard ) ) );
1870 if ( pStyle == &rStyle )
1876 bool bIsUsed =
false;
1885 if ( pStyle == &rStyle )
1914 bool bFound =
false;
1921 while ( nVisStart <
mvData.size() &&
mvData[nVisStart].pPattern->IsVisibleEqual(*
mvData[nVisStart-1].pPattern) )
1923 if ( nVisStart >=
mvData.size() ||
mvData[nVisStart-1].nEndRow > 0 )
1926 while ( nStart <
mvData.size() && !bFound )
1928 if (
mvData[nStart].pPattern->IsVisible() )
1930 rFirstRow = nStart ? (
mvData[nStart-1].nEndRow + 1 ) : 0;
1949 rLastRow = nLastData;
1967 if (nStartRow <= nLastData + 1)
1971 rLastRow = nLastData;
1976 bool bFound =
false;
1984 while ( nEndPos <
mvData.size()-1 &&
1985 mvData[nEndPos].pPattern->IsVisibleEqual(*
mvData[nEndPos+1].pPattern))
1988 if ( nAttrStartRow <= nLastData )
1989 nAttrStartRow = nLastData + 1;
1990 SCROW nAttrSize =
mvData[nEndPos].nEndRow + 1 - nAttrStartRow;
1993 else if (
mvData[nEndPos].pPattern->IsVisible() )
1995 rLastRow =
mvData[nEndPos].nEndRow;
2009 rLastRow = nLastData;
2021 SCROW nThisStart = nStartRow;
2022 bool bFound =
false;
2023 while (
nIndex <
mvData.size() && nThisStart <= nEndRow && !bFound )
2042 return ( pDefPattern1 == pDefPattern2 || pDefPattern1->
IsVisibleEqual( *pDefPattern2 ) );
2048 bool bDefNonDefCase =
false;
2051 pNonDefault = &rOther;
2053 bDefNonDefCase =
true;
2059 bDefNonDefCase =
true;
2062 if ( bDefNonDefCase )
2066 if ( nStartRow > 0 )
2069 while ( nPos < pNonDefault->
Count() && bEqual )
2072 bEqual = ( pNonDefPattern == pDefPattern ||
2075 if ( pNonDefault->
mvData[
nPos].nEndRow >= nEndRow )
break;
2085 if ( nStartRow > 0 )
2087 Search( nStartRow, nThisPos );
2088 rOther.
Search( nStartRow, nOtherPos );
2091 while ( nThisPos<
mvData.size() && nOtherPos<rOther.
Count() && bEqual )
2094 SCROW nOtherRow = rOther.
mvData[nOtherPos].nEndRow;
2097 bEqual = ( pThisPattern == pOtherPattern ||
2100 if ( nThisRow >= nOtherRow )
2102 if ( nOtherRow >= nEndRow )
break;
2105 if ( nThisRow <= nOtherRow )
2107 if ( nThisRow >= nEndRow )
break;
2122 return ( pDefPattern1 == pDefPattern2 );
2128 bool bDefNonDefCase =
false;
2131 pNonDefault = &rOther;
2133 bDefNonDefCase =
true;
2139 bDefNonDefCase =
true;
2142 if ( bDefNonDefCase )
2146 if ( nStartRow > 0 )
2149 while ( nPos < pNonDefault->
Count() && bEqual )
2152 bEqual = ( pNonDefPattern == pDefPattern );
2154 if ( pNonDefault->
mvData[
nPos].nEndRow >= nEndRow )
break;
2164 if ( nStartRow > 0 )
2166 Search( nStartRow, nThisPos );
2167 rOther.
Search( nStartRow, nOtherPos );
2170 while ( nThisPos<
mvData.size() && nOtherPos<rOther.
Count() && bEqual )
2173 SCROW nOtherRow = rOther.
mvData[nOtherPos].nEndRow;
2176 bEqual = ( pThisPattern == pOtherPattern );
2178 if ( nThisRow >= nOtherRow )
2180 if ( nOtherRow >= nEndRow )
break;
2183 if ( nThisRow <= nOtherRow )
2185 if ( nThisRow >= nEndRow )
break;
2202 if ( nStartRow > 0 )
2231 while ( nFirstLost &&
mvData[nFirstLost-1].nEndRow >= sal::static_int_cast<SCROW>(
rDocument.
MaxRow() + 1 - nSize) )
2234 return !
mvData[nFirstLost].pPattern->
2242 SCROW nSearch = nStartRow > 0 ? nStartRow - 1 : 0;
2250 assert( !bDoMerge ||
nCol != -1 );
2268 if (nRemove && nRemove <
mvData.size())
2276 for (
SCSIZE nAdd=0; nAdd<nSize; nAdd++)
2296 if (
mvData[
i].nEndRow >= nStartRow &&
mvData[
i].nEndRow <= sal::static_int_cast<SCROW>(nStartRow+nSize-1))
2311 nStart =
mvData[nStartIndex-1].nEndRow + 1;
2313 if (nStart < nStartRow)
2315 mvData[nStartIndex].nEndRow = nStartRow - 1;
2318 if (nEndIndex >= nStartIndex)
2321 if (nStartIndex > 0)
2322 if (
mvData[nStartIndex-1].pPattern ==
mvData[nStartIndex].pPattern )
2327 if (
mvData[
i].nEndRow >= nStartRow)
2339 for (
SCSIZE i = nStartIndex;
i <= nEndIndex;
i++)
2368 if (nThisRow < nStartRow) nThisRow = nStartRow;
2370 while ( nThisRow <= nEndRow )
2377 SCROW nAttrRow = std::min( nRow, nEndRow );
2379 auto pNewPattern = std::make_unique<ScPatternAttr>(*pOldPattern);
2385 if ( *pNewPattern == *pDefPattern )
2388 SetPatternArea( nThisRow, nAttrRow, std::move(pNewPattern),
true );
2404 SCROW nStart = nStartRow;
2407 if ((
mvData[
i].nEndRow >= nStartRow) && (
i == 0 ||
mvData[
i-1].nEndRow < nEndRow))
2413 nStart = std::max( nStart,
mvData[
i].nEndRow + 1 );
2432 bool bSamePool = (pSourceDocPool==pDestDocPool);
2441 for (
SCSIZE i = 0; (
i <
mvData.size()) && (nDestStart <= nDestEnd);
i++)
2443 if (
mvData[
i].nEndRow >= nStartRow)
2467 pNewPattern = &pDestDocPool->
Put(aTmpPattern);
2474 pNewPattern = &pDestDocPool->
Put(*pOldPattern);
2480 std::min(
static_cast<SCROW>(
mvData[
i].nEndRow + nDy), nDestEnd), pNewPattern);
2503 CopyArea( nStartRow+nDy, nEndRow+nDy, nDy, rAttrArray );
2509 bool bSamePool = (pSourceDocPool==pDestDocPool);
2524 for (
SCSIZE i = 0; (
i <
mvData.size()) && (nDestStart <= nDestEnd);
i++)
2526 if (
mvData[
i].nEndRow >= nStartRow)
2532 pNewPattern = &pDestDocPool->
Put(*pOldPattern);
2537 std::min(
static_cast<SCROW>(
mvData[
i].nEndRow + nDy), nDestEnd), pNewPattern,
false);
2550 bool bFound =
false;
2613 OSL_ENSURE( bFound || !
rDocument.
ValidRow(nRow),
"Internal failure in ScAttrArray::SearchStyle" );
2634 if (nMarkEnd>rEndRow)
2644 if (nMarkEnd<rEndRow)
2665 if (nMarkEnd>rEndRow)
2675 if (nMarkEnd<rEndRow)
2693 if( !
Search( nStartRow, nIndex1 ) )
2696 if( !
Search( nEndRow, nIndex2 ) )
2697 nIndex2 =
mvData.size() - 1;
2699 return nIndex2 - nIndex1 + 1;
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
static bool lcl_TestAttr(const SvxBorderLine *pOldLine, const SvxBorderLine *pNewLine, sal_uInt8 &rModified, const SvxBorderLine *&rpNew)
static void SetLineColor(SvxBorderLine const *dest, Color c)
static void SetLine(const SvxBorderLine *dest, const SvxBorderLine *src)
static void lcl_MergeToFrame(SvxBoxItem *pLineOuter, SvxBoxInfoItem *pLineInner, ScLineFlags &rFlags, const ScPatternAttr *pPattern, bool bLeft, SCCOL nDistRight, bool bTop, SCROW nDistBottom)
static void lcl_MergeDeep(SfxItemSet &rMergeSet, const SfxItemSet &rSource)
const SCROW SC_VISATTR_STOP
#define SC_ATTRARRAY_DELTA
@ All
dp button with popup arrow for multiple fields
virtual std::unique_ptr< EditTextObject > Clone() const=0
bool RemoveFlags(SCROW nStartRow, SCROW nEndRow, ScMF nFlags)
SCROW GetNextUnprotected(SCROW nRow, bool bUp) const
Including current, may return -1.
void ClearItems(SCROW nStartRow, SCROW nEndRow, const sal_uInt16 *pWhich)
ScAttrArray(const ScAttrArray &)=delete
void SetAttrEntries(std::vector< ScAttrEntry > &&vNewData)
void FindStyleSheet(const SfxStyleSheetBase *pStyleSheet, ScFlatBoolRowSegments &rUsedRows, bool bReset)
void DeleteArea(SCROW nStartRow, SCROW nEndRow)
bool Search(SCROW nRow, SCSIZE &nIndex) const
void DeleteHardAttr(SCROW nStartRow, SCROW nEndRow)
bool ApplyFrame(const SvxBoxItem &rLineOuter, const SvxBoxInfoItem *pLineInner, SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight, bool bTop, SCROW nDistBottom)
bool Reserve(SCSIZE nReserve)
bool HasVisibleAttrIn(SCROW nStartRow, SCROW nEndRow) const
bool IsVisibleEqual(const ScAttrArray &rOther, SCROW nStartRow, SCROW nEndRow) const
void RemoveCellCharAttribs(SCROW nStartRow, SCROW nEndRow, const ScPatternAttr *pPattern, ScEditDataArray *pDataArray)
bool IsMerged(SCROW nRow) const
bool ApplyFlags(SCROW nStartRow, SCROW nEndRow, ScMF nFlags)
void ApplyCacheArea(SCROW nStartRow, SCROW nEndRow, SfxItemPoolCache *pCache, ScEditDataArray *pDataArray=nullptr, bool *const pIsChanged=nullptr)
void Reset(const ScPatternAttr *pPattern)
SCROW SearchStyle(SCROW nRow, const ScStyleSheet *pSearchStyle, bool bUp, const ScMarkArray *pMarkArray=nullptr) const
May return -1 if not found.
void ChangeIndent(SCROW nStartRow, SCROW nEndRow, bool bIncrement)
void SetDefaultIfNotInit(SCSIZE nNeeded=1)
void DeleteRow(SCROW nStartRow, SCSIZE nSize)
void MoveTo(SCROW nStartRow, SCROW nEndRow, ScAttrArray &rAttrArray)
Move within a document.
void RemoveCondFormat(SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex)
if nIndex == 0, remove all conditional format data
const ScPatternAttr * GetPattern(SCROW nRow) const
void DeleteRange(SCSIZE nStartIndex, SCSIZE nEndIndex)
void ApplyLineStyleArea(SCROW nStartRow, SCROW nEndRow, const ::editeng::SvxBorderLine *pLine, bool bColorOnly)
bool GetLastVisibleAttr(SCROW &rLastRow, SCROW nLastData, bool bSkipEmpty) const
void MergePatternArea(SCROW nStartRow, SCROW nEndRow, ScMergePatternState &rState, bool bDeep) const
bool GetFirstVisibleAttr(SCROW &rFirstRow) const
void MergeBlockFrame(SvxBoxItem *pLineOuter, SvxBoxInfoItem *pLineInner, ScLineFlags &rFlags, SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight) const
bool ExtendMerge(SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow, SCCOL &rPaintCol, SCROW &rPaintRow, bool bRefresh)
Area around any given summaries expand and adapt any MergeFlag (bRefresh)
const ScPatternAttr * SetPatternAreaImpl(SCROW nStartRow, SCROW nEndRow, const ScPatternAttr *pPattern, bool bPutToPool=false, ScEditDataArray *pDataArray=nullptr, bool bPassingPatternOwnership=false)
void SetPatternArea(SCROW nStartRow, SCROW nEndRow, std::unique_ptr< ScPatternAttr > pPattern, bool bPutToPool=false, ScEditDataArray *pDataArray=nullptr)
bool IsAllEqual(const ScAttrArray &rOther, SCROW nStartRow, SCROW nEndRow) const
bool TestInsertRow(SCSIZE nSize) const
bool IsStyleSheetUsed(const ScStyleSheet &rStyle) const
bool HasAttrib_Impl(const ScPatternAttr *pPattern, HasAttrFlags nMask, SCROW nRow1, SCROW nRow2, SCSIZE i) const
void CopyAreaSafe(SCROW nStartRow, SCROW nEndRow, tools::Long nDy, ScAttrArray &rAttrArray)
Leave flags summarized with CopyArea.
const ScPatternAttr * GetPatternRange(SCROW &rStartRow, SCROW &rEndRow, SCROW nRow) const
Returns if you search for attributes at nRow the range from rStartRow to rEndRow where that attribute...
void ApplyStyleArea(SCROW nStartRow, SCROW nEndRow, const ScStyleSheet &rStyle)
bool SearchStyleRange(SCROW &rRow, SCROW &rEndRow, const ScStyleSheet *pSearchStyle, bool bUp, const ScMarkArray *pMarkArray=nullptr) const
void CopyArea(SCROW nStartRow, SCROW nEndRow, tools::Long nDy, ScAttrArray &rAttrArray, ScMF nStripFlags=ScMF::NONE) const
Copy between documents (Clipboard)
bool HasAttrib(SCROW nRow1, SCROW nRow2, HasAttrFlags nMask) const
void ApplyBlockFrame(const SvxBoxItem &rLineOuter, const SvxBoxInfoItem *pLineInner, SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight)
bool TestInsertCol(SCROW nStartRow, SCROW nEndRow) const
void InsertRow(SCROW nStartRow, SCSIZE nSize)
void SetPatternAreaSafe(SCROW nStartRow, SCROW nEndRow, const ScPatternAttr *pWantedPattern, bool bDefault)
std::vector< ScAttrEntry > mvData
void AddCondFormat(SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex)
void RemoveAreaMerge(SCROW nStartRow, SCROW nEndRow)
void InvalidateTextWidth(std::u16string_view rStyleName)
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
SC_DLLPUBLIC ScPatternAttr * GetDefPattern() const
bool ValidRow(SCROW nRow) const
SC_DLLPUBLIC SCCOL MaxCol() const
SC_DLLPUBLIC ScDocumentPool * GetPool()
SC_DLLPUBLIC void ApplyPatternAreaTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, const ScPatternAttr &rAttr)
SC_DLLPUBLIC SCROW MaxRow() const
SC_DLLPUBLIC bool InitColumnBlockPosition(sc::ColumnBlockPosition &rBlockPos, SCTAB nTab, SCCOL nCol)
SC_DLLPUBLIC bool ApplyFlagsTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, ScMF nFlags)
void SetStreamValid(SCTAB nTab, bool bSet, bool bIgnoreLock=false)
SC_DLLPUBLIC void ApplyAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, const SfxPoolItem &rAttr)
SfxObjectShell * GetDocumentShell() const
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
SC_DLLPUBLIC const SfxItemSet * GetCondResult(SCCOL nCol, SCROW nRow, SCTAB nTab, ScRefCellValue *pCell=nullptr) const
void AddItem(SCTAB nTab, SCCOL nCol, SCROW nRow, std::unique_ptr< EditTextObject > pOldData, std::unique_ptr< EditTextObject > pNewData)
static void RemoveCharAttribs(EditTextObject &rEditText, const ScPatternAttr &rAttr)
bool setTrue(SCROW nRow1, SCROW nRow2)
static bool CheckWidthInvalidate(bool &bNumFormatChanged, const SfxItemSet &rNewAttrs, const SfxItemSet &rOldAttrs)
This is a rather odd datastructure.
SCROW GetNextMarked(SCROW nRow, bool bUp) const
Including current row, may return -1 if bUp and not found.
SCROW GetMarkEnd(SCROW nRow, bool bUp) const
SCCOL GetColMerge() const
SCROW GetRowMerge() const
bool HasAutoFilter() const
bool IsOverlapped() const
ScPatternAttr * PutInPool(ScDocument *pDestDoc, ScDocument *pSrcDoc) const
const ScStyleSheet * GetStyleSheet() const
bool IsVisibleEqual(const ScPatternAttr &rOther) const
void SetStyleSheet(ScStyleSheet *pNewStyle, bool bClearDirectFormat=true)
sal_uInt64 GetKey() const
bool HasItemsSet(const sal_uInt16 *pWhich) const
SfxItemSet & GetItemSet()
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
static SvxCellOrientation GetCellOrientation(const SfxItemSet &rItemSet, const SfxItemSet *pCondSet)
bool GetProtection() const
void SetUsage(ScStyleSheet::Usage eUse) const
Degree100 GetValue() const
const SfxSetItem & ApplyTo(const SfxSetItem &rSetItem)
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
const T & Put(std::unique_ptr< T > xItem, sal_uInt16 nWhich=0)
void Remove(const SfxPoolItem &)
const WhichRangesContainer & GetRanges() const
SfxItemPool * GetPool() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void InvalidateItem(sal_uInt16 nWhich)
bool IsValid(SvxBoxInfoItemValidFlags nValid) const
const editeng::SvxBorderLine * GetHori() const
const editeng::SvxBorderLine * GetVert() const
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxInfoItemLine nLine)
const editeng::SvxBorderLine * GetTop() const
virtual SvxBoxItem * Clone(SfxItemPool *pPool=nullptr) const override
const editeng::SvxBorderLine * GetRight() const
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
const editeng::SvxBorderLine * GetLeft() const
const editeng::SvxBorderLine * GetBottom() const
virtual SvxLineItem * Clone(SfxItemPool *pPool=nullptr) const override
SvxShadowLocation GetLocation() const
const_iterator begin() const
void reserve(size_type amount)
const_iterator find(const Value &x) const
void erase_at(size_t index)
const_iterator end() const
std::pair< const_iterator, bool > insert(Value &&x)
#define SAL_WARN_IF(condition, area, stream)
bool IsDefaultItem(const SfxPoolItem *pItem)
OUString ScResId(TranslateId aId)
constexpr TypedWhichId< ScIndentItem > ATTR_INDENT(131)
constexpr TypedWhichId< ScMergeFlagAttr > ATTR_MERGE_FLAG(145)
constexpr TypedWhichId< ScPatternAttr > ATTR_PATTERN(156)
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_TLBR(141)
constexpr TypedWhichId< ScMergeAttr > ATTR_MERGE(144)
constexpr TypedWhichId< SvxShadowItem > ATTR_SHADOW(152)
constexpr TypedWhichId< ScRotateValueItem > ATTR_ROTATE_VALUE(135)
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
constexpr sal_uInt16 ATTR_PATTERN_START(100)
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_BLTR(142)
constexpr TypedWhichId< ScProtectionAttr > ATTR_PROTECTION(149)
constexpr sal_uInt16 ATTR_PATTERN_END(155)
constexpr TypedWhichId< ScLineBreakCell > ATTR_LINEBREAK(139)
constexpr TypedWhichId< ScCondFormatItem > ATTR_CONDITIONAL(154)
const ScPatternAttr * pOld2
std::optional< SfxItemSet > pItemSet
const ScPatternAttr * pOld1
existing objects, temporary
This is very similar to ScCellValue, except that it references the original value instead of copying ...
const EditTextObject * getEditText() const
Store position data for column array storage.