25#include <unordered_set>
36#ifdef OPTICAL_CHECK_CLIPRANGE_FOR_MERGED_CELL
74 void SetStyleLeft(
const Style& rStyle) {
maLeft = rStyle; }
75 void SetStyleRight(
const Style& rStyle) {
maRight = rStyle; }
76 void SetStyleTop(
const Style& rStyle) {
maTop = rStyle; }
77 void SetStyleBottom(
const Style& rStyle) {
maBottom = rStyle; }
78 void SetStyleTLBR(
const Style& rStyle) {
maTLBR = rStyle; }
79 void SetStyleBLTR(
const Style& rStyle) {
maBLTR = rStyle; }
81 const Style& GetStyleLeft()
const {
return maLeft; }
83 const Style& GetStyleTop()
const {
return maTop; }
85 const Style& GetStyleTLBR()
const {
return maTLBR; }
86 const Style& GetStyleBLTR()
const {
return maBLTR; }
94 const Array& rArray, sal_Int32 nCol, sal_Int32 nRow )
const;
96 const Array& rArray, sal_Int32 nColLeft, sal_Int32 nRowTop, sal_Int32 nColRight, sal_Int32 nRowBottom )
const;
121 const double fSnapped(::basegfx::snapToZeroRange(
mfOrientation, M_PI * 2.0));
124 static const double fMinAng(M_PI/360.0);
127 const bool bForbidSkew(
128 fSnapped < fMinAng ||
129 fSnapped > (M_PI * 2.0) - fMinAng ||
130 fabs(fSnapped - M_PI) < fMinAng);
145 aOrigin.
setX(aOrigin.
getX() + (fSkew * 0.5));
150 aOrigin.
setX(aOrigin.
getX() + fSkew);
164 const Array& rArray, sal_Int32 nCol, sal_Int32 nRow)
const
166 const Point aPoint( rArray.GetColPosition( nCol ), rArray.GetRowPosition( nRow ) );
167 const Size aSize( rArray.GetColWidth( nCol, nCol ) + 1, rArray.GetRowHeight( nRow, nRow ) + 1 );
170 return HelperCreateB2DHomMatrixFromB2DRange( aRange );
174 const Array& rArray, sal_Int32 nColLeft, sal_Int32 nRowTop, sal_Int32 nColRight, sal_Int32 nRowBottom)
const
177 nColLeft, nRowTop, nColRight, nRowBottom ) );
196 return HelperCreateB2DHomMatrixFromB2DRange( aRange );
212void Cell::MirrorSelfX()
222static void lclRecalcCoordVec( std::vector<sal_Int32>& rCoords,
const std::vector<sal_Int32>& rSizes )
224 DBG_ASSERT( rCoords.size() == rSizes.size() + 1,
"lclRecalcCoordVec - inconsistent vectors" );
225 auto aCIt = rCoords.begin();
226 for(
const auto& rSize : rSizes )
228 *(aCIt + 1) = *aCIt + rSize;
233static void lclSetMergedRange(
CellVec& rCells, sal_Int32 nWidth, sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow )
235 for( sal_Int32 nCol = nFirstCol; nCol <= nLastCol; ++nCol )
237 for( sal_Int32 nRow = nFirstRow; nRow <= nLastRow; ++nRow )
239 Cell& rCell = rCells[ nRow * nWidth + nCol ];
240 rCell.mbMergeOrig =
false;
241 rCell.mbOverlapX = nCol > nFirstCol;
242 rCell.mbOverlapY = nRow > nFirstRow;
245 rCells[ nFirstRow * nWidth + nFirstCol ].mbMergeOrig =
true;
269 explicit ArrayImpl( sal_Int32 nWidth, sal_Int32 nHeight );
273 sal_Int32
GetIndex( sal_Int32 nCol, sal_Int32 nRow )
const
274 {
return nRow *
mnWidth + nCol; }
276 const Cell& GetCell( sal_Int32 nCol, sal_Int32 nRow )
const;
277 Cell& GetCellAcc( sal_Int32 nCol, sal_Int32 nRow );
279 sal_Int32 GetMergedFirstCol( sal_Int32 nCol, sal_Int32 nRow )
const;
280 sal_Int32 GetMergedFirstRow( sal_Int32 nCol, sal_Int32 nRow )
const;
281 sal_Int32 GetMergedLastCol( sal_Int32 nCol, sal_Int32 nRow )
const;
282 sal_Int32 GetMergedLastRow( sal_Int32 nCol, sal_Int32 nRow )
const;
284 const Cell& GetMergedOriginCell( sal_Int32 nCol, sal_Int32 nRow )
const;
285 const Cell& GetMergedLastCell( sal_Int32 nCol, sal_Int32 nRow )
const;
287 bool IsMergedOverlappedLeft( sal_Int32 nCol, sal_Int32 nRow )
const;
288 bool IsMergedOverlappedRight( sal_Int32 nCol, sal_Int32 nRow )
const;
289 bool IsMergedOverlappedTop( sal_Int32 nCol, sal_Int32 nRow )
const;
290 bool IsMergedOverlappedBottom( sal_Int32 nCol, sal_Int32 nRow )
const;
292 bool IsInClipRange( sal_Int32 nCol, sal_Int32 nRow )
const;
293 bool IsColInClipRange( sal_Int32 nCol )
const;
294 bool IsRowInClipRange( sal_Int32 nRow )
const;
296 bool OverlapsClipRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow )
const;
300 sal_Int32 GetColPosition( sal_Int32 nCol )
const;
301 sal_Int32 GetRowPosition( sal_Int32 nRow )
const;
303 bool HasCellRotation()
const;
306ArrayImpl::ArrayImpl( sal_Int32 nWidth, sal_Int32 nHeight ) :
311 mnLastClipCol( nWidth - 1 ),
312 mnLastClipRow( nHeight - 1 ),
313 mbXCoordsDirty( false ),
314 mbYCoordsDirty( false ),
315 mbMayHaveCellRotation( false )
338 sal_Int32 nFirstCol = nCol;
345 sal_Int32 nFirstRow = nRow;
352 sal_Int32 nLastCol = nCol + 1;
359 sal_Int32 nLastRow = nRow + 1;
377 return rCell.mbOverlapX || (rCell.mnAddLeft > 0);
382 return GetCell( nCol + 1, nRow ).mbOverlapX || (
GetCell( nCol, nRow ).mnAddRight > 0);
388 return rCell.mbOverlapY || (rCell.mnAddTop > 0);
393 return GetCell( nCol, nRow + 1 ).mbOverlapY || (
GetCell( nCol, nRow ).mnAddBottom > 0);
451 for (
const auto& aCell :
maCells)
453 if (aCell.IsRotated())
464class MergedCellIterator
467 explicit MergedCellIterator(
const Array& rArray, sal_Int32 nCol, sal_Int32 nRow );
470 sal_Int32
Col()
const {
return mnCol; }
471 sal_Int32
Row()
const {
return mnRow; }
486MergedCellIterator::MergedCellIterator(
const Array& rArray, sal_Int32 nCol, sal_Int32 nRow )
488 DBG_ASSERT( rArray.IsMerged( nCol, nRow ),
"svx::frame::MergedCellIterator::MergedCellIterator - not in merged range" );
494MergedCellIterator& MergedCellIterator::operator++()
496 DBG_ASSERT( Is(),
"svx::frame::MergedCellIterator::operator++() - already invalid" );
506#define DBG_FRAME_CHECK( cond, funcname, error ) DBG_ASSERT( cond, "svx::frame::Array::" funcname " - " error )
507#define DBG_FRAME_CHECK_COL( col, funcname ) DBG_FRAME_CHECK( (col) < GetColCount(), funcname, "invalid column index" )
508#define DBG_FRAME_CHECK_ROW( row, funcname ) DBG_FRAME_CHECK( (row) < GetRowCount(), funcname, "invalid row index" )
509#define DBG_FRAME_CHECK_COLROW( col, row, funcname ) DBG_FRAME_CHECK( ((col) < GetColCount()) && ((row) < GetRowCount()), funcname, "invalid cell index" )
510#define DBG_FRAME_CHECK_COL_1( col, funcname ) DBG_FRAME_CHECK( (col) <= GetColCount(), funcname, "invalid column index" )
511#define DBG_FRAME_CHECK_ROW_1( row, funcname ) DBG_FRAME_CHECK( (row) <= GetRowCount(), funcname, "invalid row index" )
514#define CELL( col, row ) mxImpl->GetCell( col, row )
515#define CELLACC( col, row ) mxImpl->GetCellAcc( col, row )
516#define ORIGCELL( col, row ) mxImpl->GetMergedOriginCell( col, row )
517#define LASTCELL( col, row ) mxImpl->GetMergedLastCell( col, row )
547 return mxImpl->maCells.size();
554 nCol =
mxImpl->GetMirrorCol(nCol);
555 return mxImpl->GetIndex( nCol, nRow );
562 CELLACC( nCol, nRow ).SetStyleLeft(rStyle);
568 CELLACC( nCol, nRow ).SetStyleRight(rStyle);
574 CELLACC( nCol, nRow ).SetStyleTop(rStyle);
580 CELLACC( nCol, nRow ).SetStyleBottom(rStyle);
586 CELLACC( nCol, nRow ).SetStyleTLBR(rStyle);
592 CELLACC( nCol, nRow ).SetStyleBLTR(rStyle);
599 rCell.SetStyleTLBR(rTLBR);
600 rCell.SetStyleBLTR(rBLTR);
606 for( sal_Int32 nRow = 0; nRow <
mxImpl->mnHeight; ++nRow )
613 for( sal_Int32 nRow = 0; nRow <
mxImpl->mnHeight; ++nRow )
620 for( sal_Int32 nCol = 0; nCol <
mxImpl->mnWidth; ++nCol )
627 for( sal_Int32 nCol = 0; nCol <
mxImpl->mnWidth; ++nCol )
636 rTarget.mfOrientation = fOrientation;
638 if (!
mxImpl->mbMayHaveCellRotation)
648 if (!
mxImpl->mbMayHaveCellRotation)
654 return mxImpl->HasCellRotation();
660 if( !
mxImpl->IsRowInClipRange( nRow ) ||
mxImpl->IsMergedOverlappedLeft( nCol, nRow ) )
663 if( nCol ==
mxImpl->mnFirstClipCol )
664 return ORIGCELL( nCol, nRow ).GetStyleLeft();
666 if( nCol ==
mxImpl->mnLastClipCol + 1 )
667 return ORIGCELL( nCol - 1, nRow ).GetStyleRight();
669 if( !
mxImpl->IsColInClipRange( nCol ) )
672 return std::max(
ORIGCELL( nCol, nRow ).GetStyleLeft(),
ORIGCELL( nCol - 1, nRow ).GetStyleRight() );
678 if( !
mxImpl->IsRowInClipRange( nRow ) ||
mxImpl->IsMergedOverlappedRight( nCol, nRow ) )
681 if( nCol + 1 ==
mxImpl->mnFirstClipCol )
682 return ORIGCELL( nCol + 1, nRow ).GetStyleLeft();
684 if( nCol ==
mxImpl->mnLastClipCol )
685 return LASTCELL( nCol, nRow ).GetStyleRight();
687 if( !
mxImpl->IsColInClipRange( nCol ) )
690 return std::max(
ORIGCELL( nCol, nRow ).GetStyleRight(),
ORIGCELL( nCol + 1, nRow ).GetStyleLeft() );
696 if( !
mxImpl->IsColInClipRange( nCol ) ||
mxImpl->IsMergedOverlappedTop( nCol, nRow ) )
699 if( nRow ==
mxImpl->mnFirstClipRow )
700 return ORIGCELL( nCol, nRow ).GetStyleTop();
702 if( nRow ==
mxImpl->mnLastClipRow + 1 )
703 return ORIGCELL( nCol, nRow - 1 ).GetStyleBottom();
705 if( !
mxImpl->IsRowInClipRange( nRow ) )
708 return std::max(
ORIGCELL( nCol, nRow ).GetStyleTop(),
ORIGCELL( nCol, nRow - 1 ).GetStyleBottom() );
714 if( !
mxImpl->IsColInClipRange( nCol ) ||
mxImpl->IsMergedOverlappedBottom( nCol, nRow ) )
717 if( nRow + 1 ==
mxImpl->mnFirstClipRow )
718 return ORIGCELL( nCol, nRow + 1 ).GetStyleTop();
720 if( nRow ==
mxImpl->mnLastClipRow )
721 return LASTCELL( nCol, nRow ).GetStyleBottom();
723 if( !
mxImpl->IsRowInClipRange( nRow ) )
726 return std::max(
ORIGCELL( nCol, nRow ).GetStyleBottom(),
ORIGCELL( nCol, nRow + 1 ).GetStyleTop() );
731 return CELL( nCol, nRow ).GetStyleTLBR();
736 return CELL( nCol, nRow ).GetStyleBLTR();
742 if( !
mxImpl->IsInClipRange( nCol, nRow ) )
745 sal_Int32 nFirstCol =
mxImpl->GetMergedFirstCol( nCol, nRow );
746 sal_Int32 nFirstRow =
mxImpl->GetMergedFirstRow( nCol, nRow );
747 return ((nCol == nFirstCol) && (nRow == nFirstRow)) ?
754 if( !
mxImpl->IsInClipRange( nCol, nRow ) )
757 sal_Int32 nLastCol =
mxImpl->GetMergedLastCol( nCol, nRow );
758 sal_Int32 nLastRow =
mxImpl->GetMergedLastRow( nCol, nRow );
759 return ((nCol == nLastCol) && (nRow == nLastRow)) ?
766 if( !
mxImpl->IsInClipRange( nCol, nRow ) )
769 sal_Int32 nFirstCol =
mxImpl->GetMergedFirstCol( nCol, nRow );
770 sal_Int32 nLastRow =
mxImpl->GetMergedLastRow( nCol, nRow );
771 return ((nCol == nFirstCol) && (nRow == nLastRow)) ?
778 if( !
mxImpl->IsInClipRange( nCol, nRow ) )
781 sal_Int32 nFirstRow =
mxImpl->GetMergedFirstRow( nCol, nRow );
782 sal_Int32 nLastCol =
mxImpl->GetMergedLastCol( nCol, nRow );
783 return ((nCol == nLastCol) && (nRow == nFirstRow)) ?
792#if OSL_DEBUG_LEVEL >= 2
795 for( sal_Int32 nCurrCol = nFirstCol; !bFound && (nCurrCol <= nLastCol); ++nCurrCol )
796 for( sal_Int32 nCurrRow = nFirstRow; !bFound && (nCurrRow <= nLastRow); ++nCurrRow )
797 bFound =
CELL( nCurrCol, nCurrRow ).IsMerged();
798 DBG_FRAME_CHECK( !bFound,
"SetMergedRange",
"overlapping merged ranges" );
801 if(
mxImpl->IsValidPos( nFirstCol, nFirstRow ) &&
mxImpl->IsValidPos( nLastCol, nLastRow ) )
808 DBG_FRAME_CHECK(
mxImpl->GetMergedFirstCol( nCol, nRow ) == 0,
"SetAddMergedLeftSize",
"additional border inside array" );
809 for( MergedCellIterator aIt( *
this, nCol, nRow ); aIt.Is(); ++aIt )
810 CELLACC( aIt.Col(), aIt.Row() ).mnAddLeft = nAddSize;
816 DBG_FRAME_CHECK(
mxImpl->GetMergedLastCol( nCol, nRow ) + 1 ==
mxImpl->mnWidth,
"SetAddMergedRightSize",
"additional border inside array" );
817 for( MergedCellIterator aIt( *
this, nCol, nRow ); aIt.Is(); ++aIt )
818 CELLACC( aIt.Col(), aIt.Row() ).mnAddRight = nAddSize;
824 DBG_FRAME_CHECK(
mxImpl->GetMergedFirstRow( nCol, nRow ) == 0,
"SetAddMergedTopSize",
"additional border inside array" );
825 for( MergedCellIterator aIt( *
this, nCol, nRow ); aIt.Is(); ++aIt )
826 CELLACC( aIt.Col(), aIt.Row() ).mnAddTop = nAddSize;
832 DBG_FRAME_CHECK(
mxImpl->GetMergedLastRow( nCol, nRow ) + 1 ==
mxImpl->mnHeight,
"SetAddMergedBottomSize",
"additional border inside array" );
833 for( MergedCellIterator aIt( *
this, nCol, nRow ); aIt.Is(); ++aIt )
834 CELLACC( aIt.Col(), aIt.Row() ).mnAddBottom = nAddSize;
840 return CELL( nCol, nRow ).IsMerged();
846 rnFirstCol =
mxImpl->GetMergedFirstCol( nCol, nRow );
847 rnFirstRow =
mxImpl->GetMergedFirstRow( nCol, nRow );
851 sal_Int32& rnLastCol, sal_Int32& rnLastRow, sal_Int32 nCol, sal_Int32 nRow )
const
854 rnLastCol =
mxImpl->GetMergedLastCol( nCol, nRow );
855 rnLastRow =
mxImpl->GetMergedLastRow( nCol, nRow );
859void Array::SetClipRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow )
863 mxImpl->mnFirstClipCol = nFirstCol;
864 mxImpl->mnFirstClipRow = nFirstRow;
865 mxImpl->mnLastClipCol = nLastCol;
866 mxImpl->mnLastClipRow = nLastRow;
872 mxImpl->maXCoords[ 0 ] = nXOffset;
873 mxImpl->mbXCoordsDirty =
true;
878 mxImpl->maYCoords[ 0 ] = nYOffset;
879 mxImpl->mbYCoordsDirty =
true;
885 mxImpl->maWidths[ nCol ] = nWidth;
886 mxImpl->mbXCoordsDirty =
true;
892 mxImpl->maHeights[ nRow ] = nHeight;
893 mxImpl->mbYCoordsDirty =
true;
898 std::fill(
mxImpl->maWidths.begin(),
mxImpl->maWidths.end(), nWidth );
899 mxImpl->mbXCoordsDirty =
true;
904 std::fill(
mxImpl->maHeights.begin(),
mxImpl->maHeights.end(), nHeight );
905 mxImpl->mbYCoordsDirty =
true;
911 return mxImpl->GetColPosition( nCol );
917 return mxImpl->GetRowPosition( nRow );
947 const sal_Int32 nFirstCol(
mxImpl->GetMergedFirstCol( nCol, nRow ));
948 const sal_Int32 nFirstRow(
mxImpl->GetMergedFirstRow( nCol, nRow ));
949 const sal_Int32 nLastCol(
mxImpl->GetMergedLastCol( nCol, nRow ));
950 const sal_Int32 nLastRow(
mxImpl->GetMergedLastRow( nCol, nRow ));
956 const Cell& rCell =
CELL( nCol, nRow );
958 if( rCell.IsMerged() )
990 sal_Int32 nCol, nRow;
991 for( nRow = 0; nRow <
mxImpl->mnHeight; ++nRow )
993 for( nCol = 0; nCol <
mxImpl->mnWidth; ++nCol )
995 aNewCells.push_back(
CELL(
mxImpl->GetMirrorCol( nCol ), nRow ) );
996 aNewCells.back().MirrorSelfX();
999 for( nRow = 0; nRow <
mxImpl->mnHeight; ++nRow )
1001 for( nCol = 0; nCol <
mxImpl->mnWidth; ++nCol )
1005 sal_Int32 nLastCol =
mxImpl->GetMergedLastCol( nCol, nRow );
1006 sal_Int32 nLastRow =
mxImpl->GetMergedLastRow( nCol, nRow );
1008 mxImpl->GetMirrorCol( nLastCol ), nRow,
1009 mxImpl->GetMirrorCol( nCol ), nLastRow );
1013 mxImpl->maCells.swap( aNewCells );
1015 std::reverse(
mxImpl->maWidths.begin(),
mxImpl->maWidths.end() );
1016 mxImpl->mbXCoordsDirty =
true;
1021 const Array& rArray,
1022 const Style& rStyle,
1030 const Color* pForceColor)
1068 const Array& rArray,
1069 const Style& rStyle,
1077 const Color* pForceColor)
1127 if(aResultPP.count() > 0)
1131 if(aResultP.
count() > 0)
1136 if(aResultStart != aResultEnd)
1138 rStart = aResultStart;
1139 rDirection = aResultEnd - aResultStart;
1146 const Array& rArray,
1147 const Style& rStyle,
1153 sal_Int32 nColRight,
1155 sal_Int32 nRowBottom,
1156 const Color* pForceColor,
1166 if(
nullptr != pClipRange)
1196 const Array& rArray,
1197 const Style& rStyle,
1203 sal_Int32 nColRight,
1205 sal_Int32 nRowBottom,
1206 const Color* pForceColor,
1216 if(
nullptr != pClipRange)
1246 sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow,
1247 const Color* pForceColor )
const
1252#ifdef OPTICAL_CHECK_CLIPRANGE_FOR_MERGED_CELL
1253 std::vector<basegfx::B2DRange> aClipRanges;
1272 const sal_Int32 nStartRow(nFirstRow > 0 ? nFirstRow - 1 : nFirstRow);
1273 const sal_Int32 nEndRow(nLastRow <
GetRowCount() - 1 ? nLastRow + 1 : nLastRow);
1274 const sal_Int32 nStartCol(nFirstCol > 0 ? nFirstCol - 1 : nFirstCol);
1275 const sal_Int32 nEndCol(nLastCol <
GetColCount() - 1 ? nLastCol + 1 : nLastCol);
1282 std::unordered_set< sal_Int32 > aMergedCells;
1284 for (sal_Int32 nRow(nStartRow); nRow <= nEndRow; ++nRow)
1286 for (sal_Int32 nCol(nStartCol); nCol <= nEndCol; ++nCol)
1290 const Cell& rCell(
CELL(nCol, nRow));
1297 const bool bOverlapX(rCell.mbOverlapX);
1298 const bool bFirstCol(nCol == nFirstCol);
1303 const bool bRotated(rCell.IsRotated());
1308 const bool bSuppressLeft(!bRotated && nCol > nFirstCol &&
CELL(nCol - 1, nRow).
IsRotated());
1309 const bool bSuppressAbove(!bRotated && nRow > nFirstRow &&
CELL(nCol, nRow - 1).
IsRotated());
1314 const bool bOverlapY(rCell.mbOverlapY);
1315 const bool bLastCol(nCol == nLastCol);
1316 const bool bFirstRow(nRow == nFirstRow);
1317 const bool bLastRow(nRow == nLastRow);
1374 if(rCell.IsMerged())
1378 sal_Int32 nColLeft(nCol), nRowTop(nRow), nColRight(nCol), nRowBottom(nRow);
1379 GetMergedRange(nColLeft, nRowTop, nColRight, nRowBottom, nCol, nRow);
1380 const sal_Int32 nIndexOfMergedCell(
mxImpl->GetIndex(nColLeft, nRowTop));
1382 if(aMergedCells.end() == aMergedCells.find(nIndexOfMergedCell))
1385 aMergedCells.insert(nIndexOfMergedCell);
1398 if(
mxImpl->OverlapsClipRange(nColLeft, nRowTop, nColRight, nRowBottom))
1403 const Cell& rMergedCell(
CELL(nColLeft, nRowTop));
1404 aCoordinateSystem = rMergedCell.CreateCoordinateSystemMergedCell(
1405 *
this, nColLeft, nRowTop, nColRight, nRowBottom);
1415 !
mxImpl->IsColInClipRange(nColLeft) ||
1416 !
mxImpl->IsRowInClipRange(nRowTop) ||
1417 !
mxImpl->IsColInClipRange(nColRight) ||
1418 !
mxImpl->IsRowInClipRange(nRowBottom));
1430 nColRight, nRowBottom));
1435 bNeedToClip = !aClipRange.
isEmpty();
1437#ifdef OPTICAL_CHECK_CLIPRANGE_FOR_MERGED_CELL
1438 aClipRanges.push_back(aClipRange);
1444 nColLeft, nRowTop, nColRight, nRowBottom, pForceColor,
1445 bNeedToClip ? &aClipRange :
nullptr);
1449 nColLeft, nRowTop, nColRight, nRowBottom, pForceColor,
1450 bNeedToClip ? &aClipRange :
nullptr);
1459 if(
mxImpl->IsInClipRange( nCol, nRow ) )
1468 nCol, nRow, nCol, nRow, pForceColor,
nullptr);
1471 nCol, nRow, nCol, nRow, pForceColor,
nullptr);
1511#ifdef OPTICAL_CHECK_CLIPRANGE_FOR_MERGED_CELL
1512 for(
auto const& rClipRange : aClipRanges)
1542#undef DBG_FRAME_CHECK_ROW_1
1543#undef DBG_FRAME_CHECK_COL_1
1544#undef DBG_FRAME_CHECK_COLROW
1545#undef DBG_FRAME_CHECK_ROW
1546#undef DBG_FRAME_CHECK_COL
1547#undef DBG_FRAME_CHECK
basegfx::B2DPoint const & getB2DPoint(sal_uInt32 nIndex) const
B2DPoint getMinimum() const
void intersect(const Range2D &rRange)
void append(const Primitive2DReference &)
void addSdrConnectStyleData(bool bStart, const svx::frame::Style &rStyle, const basegfx::B2DVector &rNormalizedPerpendicular, bool bStyleMirrored)
Stores frame styles of an array of cells, supports merged ranges.
void SetAddMergedLeftSize(sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nAddSize)
Sets an additional left width for the merged range that contains (nCol,nRow).
const Style & GetCellStyleTL(sal_Int32 nCol, sal_Int32 nRow) const
Returns the top-left to bottom-right frame style of the cell (nCol,nRow).
std::unique_ptr< ArrayImpl > mxImpl
~Array()
Destructs the array.
const Style & GetCellStyleLeft(sal_Int32 nCol, sal_Int32 nRow) const
Returns the left frame style of the cell (nCol,nRow).
const Style & GetCellStyleTLBR(sal_Int32 nCol, sal_Int32 nRow) const
Returns the top-left to bottom-right frame style of the cell (nCol,nRow).
sal_Int32 GetCellCount() const
Returns the number of cells in the array.
const Style & GetCellStyleTop(sal_Int32 nCol, sal_Int32 nRow) const
Returns the top frame style of the cell (nCol,nRow).
bool IsMerged(sal_Int32 nCol, sal_Int32 nRow) const
Returns true, if the cell (nCol,nRow) is part of a merged range.
drawinglayer::primitive2d::Primitive2DContainer CreateB2DPrimitiveRange(sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow, const Color *pForceColor) const
Draws the part of the specified range, that is inside the clipping range.
void SetRowHeight(sal_Int32 nRow, sal_Int32 nHeight)
Sets the output height of the specified row.
sal_Int32 GetColWidth(sal_Int32 nFirstCol, sal_Int32 nLastCol) const
Returns the output width of the specified range of columns.
void SetMergedRange(sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow)
Inserts a new merged cell range.
void SetCellStyleBottom(sal_Int32 nCol, sal_Int32 nRow, const Style &rStyle)
Sets the bottom frame style of the specified cell (nCol,nRow).
void SetAddMergedBottomSize(sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nAddSize)
Sets an additional bottom height for the merged range that contains (nCol,nRow).
bool HasCellRotation() const
Check if at least one cell is rotated.
void SetCellStyleTLBR(sal_Int32 nCol, sal_Int32 nRow, const Style &rStyle)
Sets the top-left to bottom-right frame style of the cell (nCol,nRow).
const Style & GetCellStyleBR(sal_Int32 nCol, sal_Int32 nRow) const
Returns the top-left to bottom-right frame style of the cell (nCol,nRow).
void SetCellStyleLeft(sal_Int32 nCol, sal_Int32 nRow, const Style &rStyle)
Sets the left frame style of the cell (nCol,nRow).
void SetCellStyleRight(sal_Int32 nCol, sal_Int32 nRow, const Style &rStyle)
Sets the right frame style of the cell (nCol,nRow).
void SetAddMergedRightSize(sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nAddSize)
Sets an additional right width for the merged range that contains (nCol,nRow).
void SetColWidth(sal_Int32 nCol, sal_Int32 nWidth)
Sets the output width of the specified column.
void SetXOffset(sal_Int32 nXOffset)
Sets the X output coordinate of the left column.
sal_Int32 GetWidth() const
Returns the output width of the entire array.
basegfx::B2DRange GetB2DRange(sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow) const
const Style & GetCellStyleTR(sal_Int32 nCol, sal_Int32 nRow) const
Returns the bottom-left to top-right frame style of the cell (nCol,nRow).
basegfx::B2DRange GetCellRange(sal_Int32 nCol, sal_Int32 nRow) const
Returns the output range of the cell (nCol,nRow).
Array()
Constructs an empty array.
const Style & GetCellStyleBLTR(sal_Int32 nCol, sal_Int32 nRow) const
Returns the bottom-left to top-right frame style of the cell (nCol,nRow).
void Initialize(sal_Int32 nWidth, sal_Int32 nHeight)
Reinitializes the array with the specified size.
void SetColumnStyleLeft(sal_Int32 nCol, const Style &rStyle)
Sets the left frame style of the specified column.
void GetMergedRange(sal_Int32 &rnFirstCol, sal_Int32 &rnFirstRow, sal_Int32 &rnLastCol, sal_Int32 &rnLastRow, sal_Int32 nCol, sal_Int32 nRow) const
Returns the top-left and bottom-right address of the merged range that contains (nCol,...
void SetRowStyleTop(sal_Int32 nRow, const Style &rStyle)
Sets the top frame style of the specified row.
void SetYOffset(sal_Int32 nYOffset)
Sets the Y output coordinate of the top row.
sal_Int32 GetRowHeight(sal_Int32 nFirstRow, sal_Int32 nLastRow) const
Returns the output height of the specified range of rows.
const Style & GetCellStyleBottom(sal_Int32 nCol, sal_Int32 nRow) const
Returns the top frame style of the cell (nCol,nRow).
const Style & GetCellStyleRight(sal_Int32 nCol, sal_Int32 nRow) const
Returns the right frame style of the cell (nCol,nRow).
void SetCellStyleDiag(sal_Int32 nCol, sal_Int32 nRow, const Style &rTLBR, const Style &rBLTR)
Sets both diagonal frame styles of the specified cell (nCol,nRow).
drawinglayer::primitive2d::Primitive2DContainer CreateB2DPrimitiveArray() const
Draws the part of the array, that is inside the clipping range.
void GetMergedOrigin(sal_Int32 &rnFirstCol, sal_Int32 &rnFirstRow, sal_Int32 nCol, sal_Int32 nRow) const
Returns the address of the top-left cell of the merged range that contains (nCol,nRow).
sal_Int32 GetHeight() const
Returns the output height of the entire array.
void SetAddMergedTopSize(sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nAddSize)
Sets an additional top height for the merged range that contains (nCol,nRow).
const Style & GetCellStyleBL(sal_Int32 nCol, sal_Int32 nRow) const
Returns the bottom-left to top-right frame style of the cell (nCol,nRow).
void SetAllColWidths(sal_Int32 nWidth)
Sets the same output width for all columns.
sal_Int32 GetColPosition(sal_Int32 nCol) const
Returns the X output coordinate of the left border of the specified column.
void SetCellStyleBLTR(sal_Int32 nCol, sal_Int32 nRow, const Style &rStyle)
Sets the bottom-left to top-right frame style of the cell (nCol,nRow).
void SetRowStyleBottom(sal_Int32 nRow, const Style &rStyle)
Sets the bottom frame style of the specified row.
sal_Int32 GetColCount() const
Returns the number of columns in the array.
void SetColumnStyleRight(sal_Int32 nCol, const Style &rStyle)
Sets the right frame style of the specified column.
sal_Int32 GetRowPosition(sal_Int32 nRow) const
Returns the Y output coordinate of the top border of the specified row.
void SetClipRange(sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow)
Sets a clipping range.
void SetAllRowHeights(sal_Int32 nHeight)
Sets the same output height for all rows.
sal_Int32 GetCellIndex(sal_Int32 nCol, sal_Int32 nRow, bool bRTL) const
Returns the cell index from the cell address (nCol,nRow).
void MirrorSelfX()
Mirrors the entire array horizontally.
void SetCellRotation(sal_Int32 nCol, sal_Int32 nRow, SvxRotateMode eRotMode, double fOrientation)
Sets the rotation parameters of the cell (nCol,nRow).
void SetCellStyleTop(sal_Int32 nCol, sal_Int32 nRow, const Style &rStyle)
Sets the top frame style of the cell (nCol,nRow).
sal_Int32 GetRowCount() const
Returns the number of rows in the array.
Contains the widths of primary and secondary line of a frame style.
bool IsUsed() const
Check if this style is used - this depends on it having any width definition.
#define DBG_ASSERT(sCon, aError)
#define LASTCELL(col, row)
#define DBG_FRAME_CHECK_COLROW(col, row, funcname)
#define DBG_FRAME_CHECK_COL(col, funcname)
#define DBG_FRAME_CHECK_ROW_1(row, funcname)
#define ORIGCELL(col, row)
#define DBG_FRAME_CHECK_COL_1(col, funcname)
#define DBG_FRAME_CHECK(cond, funcname, error)
#define DBG_FRAME_CHECK_ROW(row, funcname)
#define CELLACC(col, row)
RttiCompleteObjectLocator col
constexpr OUStringLiteral aData
B2DHomMatrix createCoordinateSystemTransform(const B2DPoint &rOrigin, const B2DVector &rX, const B2DVector &rY)
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
B2DTuple getColumn(const B2DHomMatrix &rMatrix, sal_uInt16 nCol)
B2DPolyPolygon clipPolygonOnRange(const B2DPolygon &rCandidate, const B2DRange &rRange, bool bInside, bool bStroke)
std::vector< SdrFrameBorderData > SdrFrameBorderDataVector
static void HelperCreateHorizontalEntry(const Array &rArray, const Style &rStyle, sal_Int32 col, sal_Int32 row, const basegfx::B2DPoint &rOrigin, const basegfx::B2DVector &rX, const basegfx::B2DVector &rY, drawinglayer::primitive2d::SdrFrameBorderDataVector &rData, bool bUpper, const Color *pForceColor)
static void HelperCreateBLTREntry(const Array &rArray, const Style &rStyle, drawinglayer::primitive2d::SdrFrameBorderDataVector &rData, const basegfx::B2DPoint &rOrigin, const basegfx::B2DVector &rX, const basegfx::B2DVector &rY, sal_Int32 nColLeft, sal_Int32 nColRight, sal_Int32 nRowTop, sal_Int32 nRowBottom, const Color *pForceColor, const basegfx::B2DRange *pClipRange)
const Style OBJ_STYLE_NONE
static void HelperCreateTLBREntry(const Array &rArray, const Style &rStyle, drawinglayer::primitive2d::SdrFrameBorderDataVector &rData, const basegfx::B2DPoint &rOrigin, const basegfx::B2DVector &rX, const basegfx::B2DVector &rY, sal_Int32 nColLeft, sal_Int32 nColRight, sal_Int32 nRowTop, sal_Int32 nRowBottom, const Color *pForceColor, const basegfx::B2DRange *pClipRange)
static void lclRecalcCoordVec(std::vector< sal_Int32 > &rCoords, const std::vector< sal_Int32 > &rSizes)
static void lclSetMergedRange(CellVec &rCells, sal_Int32 nWidth, sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow)
static void HelperCreateVerticalEntry(const Array &rArray, const Style &rStyle, sal_Int32 col, sal_Int32 row, const basegfx::B2DPoint &rOrigin, const basegfx::B2DVector &rX, const basegfx::B2DVector &rY, drawinglayer::primitive2d::SdrFrameBorderDataVector &rData, bool bLeft, const Color *pForceColor)
static void HelperClipLine(basegfx::B2DPoint &rStart, basegfx::B2DVector &rDirection, const basegfx::B2DRange &rClipRange)
std::vector< Cell > CellVec
bool IsRotated(const OUString &rsCommandName, const OUString &rsModuleName)
@ SVX_ROTATE_MODE_STANDARD
bool IsMergedOverlappedRight(sal_Int32 nCol, sal_Int32 nRow) const
sal_Int32 GetMergedFirstCol(sal_Int32 nCol, sal_Int32 nRow) const
std::vector< sal_Int32 > maXCoords
bool IsMergedOverlappedTop(sal_Int32 nCol, sal_Int32 nRow) const
bool OverlapsClipRange(sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow) const
const Cell & GetMergedLastCell(sal_Int32 nCol, sal_Int32 nRow) const
sal_Int32 GetMergedLastRow(sal_Int32 nCol, sal_Int32 nRow) const
bool IsRowInClipRange(sal_Int32 nRow) const
bool IsMergedOverlappedLeft(sal_Int32 nCol, sal_Int32 nRow) const
sal_Int32 GetMirrorCol(sal_Int32 nCol) const
sal_Int32 GetMergedFirstRow(sal_Int32 nCol, sal_Int32 nRow) const
sal_Int32 GetRowPosition(sal_Int32 nRow) const
std::vector< sal_Int32 > maYCoords
const Cell & GetMergedOriginCell(sal_Int32 nCol, sal_Int32 nRow) const
sal_Int32 GetIndex(sal_Int32 nCol, sal_Int32 nRow) const
sal_Int32 GetMergedLastCol(sal_Int32 nCol, sal_Int32 nRow) const
std::vector< sal_Int32 > maWidths
bool mbMayHaveCellRotation
bool IsColInClipRange(sal_Int32 nCol) const
sal_Int32 GetColPosition(sal_Int32 nCol) const
bool IsInClipRange(sal_Int32 nCol, sal_Int32 nRow) const
Cell & GetCellAcc(sal_Int32 nCol, sal_Int32 nRow)
std::vector< sal_Int32 > maHeights
bool IsValidPos(sal_Int32 nCol, sal_Int32 nRow) const
const Cell & GetCell(sal_Int32 nCol, sal_Int32 nRow) const
bool HasCellRotation() const
bool IsMergedOverlappedBottom(sal_Int32 nCol, sal_Int32 nRow) const
css::drawing::Direction3D aDirection