25#include <unordered_set>
37#ifdef OPTICAL_CHECK_CLIPRANGE_FOR_MERGED_CELL
73 explicit Cell(
const Cell&) =
default;
78 void SetStyleLeft(
const Style& rStyle) {
maLeft = rStyle; }
79 void SetStyleRight(
const Style& rStyle) {
maRight = rStyle; }
80 void SetStyleTop(
const Style& rStyle) {
maTop = rStyle; }
81 void SetStyleBottom(
const Style& rStyle) {
maBottom = rStyle; }
82 void SetStyleTLBR(
const Style& rStyle) {
maTLBR = rStyle; }
83 void SetStyleBLTR(
const Style& rStyle) {
maBLTR = rStyle; }
85 const Style& GetStyleLeft()
const {
return maLeft; }
87 const Style& GetStyleTop()
const {
return maTop; }
89 const Style& GetStyleTLBR()
const {
return maTLBR; }
90 const Style& GetStyleBLTR()
const {
return maBLTR; }
98 const Array& rArray, sal_Int32 nCol, sal_Int32 nRow )
const;
100 const Array& rArray, sal_Int32 nColLeft, sal_Int32 nRowTop, sal_Int32 nColRight, sal_Int32 nRowBottom )
const;
125 const double fSnapped(::basegfx::snapToZeroRange(
mfOrientation, M_PI * 2.0));
128 static const double fMinAng(M_PI/360.0);
131 const bool bForbidSkew(
132 fSnapped < fMinAng ||
133 fSnapped > (M_PI * 2.0) - fMinAng ||
134 fabs(fSnapped - M_PI) < fMinAng);
149 aOrigin.
setX(aOrigin.
getX() + (fSkew * 0.5));
154 aOrigin.
setX(aOrigin.
getX() + fSkew);
168 const Array& rArray, sal_Int32 nCol, sal_Int32 nRow)
const
170 const Point aPoint( rArray.GetColPosition( nCol ), rArray.GetRowPosition( nRow ) );
171 const Size aSize( rArray.GetColWidth( nCol, nCol ) + 1, rArray.GetRowHeight( nRow, nRow ) + 1 );
174 return HelperCreateB2DHomMatrixFromB2DRange( aRange );
178 const Array& rArray, sal_Int32 nColLeft, sal_Int32 nRowTop, sal_Int32 nColRight, sal_Int32 nRowBottom)
const
181 nColLeft, nRowTop, nColRight, nRowBottom ) );
200 return HelperCreateB2DHomMatrixFromB2DRange( aRange );
218 return new Cell(*
this);
221bool Cell::operator==(
const SfxPoolItem& rItem)
const
223 if (!SfxPoolItem::operator==(rItem))
225 const Cell& rOther =
static_cast<const Cell&
>(rItem);
226 return maLeft == rOther.maLeft
228 &&
maTop == rOther.maTop
230 &&
maTLBR == rOther.maTLBR
231 &&
maBLTR == rOther.maBLTR
241void Cell::MirrorSelfX()
251static void lclRecalcCoordVec( std::vector<sal_Int32>& rCoords,
const std::vector<sal_Int32>& rSizes )
253 DBG_ASSERT( rCoords.size() == rSizes.size() + 1,
"lclRecalcCoordVec - inconsistent vectors" );
254 auto aCIt = rCoords.begin();
255 for(
const auto& rSize : rSizes )
257 *(aCIt + 1) = *aCIt + rSize;
264 for( sal_Int32 nCol = nFirstCol; nCol <= nLastCol; ++nCol )
266 for( sal_Int32 nRow = nFirstRow; nRow <= nLastRow; ++nRow )
268 const Cell* pCell = rCells[ nRow * nWidth + nCol ];
269 Cell aTempCell(*pCell);
270 aTempCell.mbOverlapX = nCol > nFirstCol;
271 aTempCell.mbOverlapY = nRow > nFirstRow;
272 rCells[ nRow * nWidth + nCol ] = &rPool.
Put(aTempCell);
275 Cell aTempCell(*rCells[ nFirstRow * nWidth + nFirstCol ]);
276 rCells[ nFirstRow * nWidth + nFirstCol ] = &rPool.
Put(aTempCell);
302 explicit ArrayImpl( sal_Int32 nWidth, sal_Int32 nHeight );
306 sal_Int32
GetIndex( sal_Int32 nCol, sal_Int32 nRow )
const
307 {
return nRow *
mnWidth + nCol; }
309 const Cell& GetCell( sal_Int32 nCol, sal_Int32 nRow )
const;
310 void PutCell( sal_Int32 nCol, sal_Int32 nRow,
const Cell& );
312 sal_Int32 GetMergedFirstCol( sal_Int32 nCol, sal_Int32 nRow )
const;
313 sal_Int32 GetMergedFirstRow( sal_Int32 nCol, sal_Int32 nRow )
const;
314 sal_Int32 GetMergedLastCol( sal_Int32 nCol, sal_Int32 nRow )
const;
315 sal_Int32 GetMergedLastRow( sal_Int32 nCol, sal_Int32 nRow )
const;
317 const Cell& GetMergedOriginCell( sal_Int32 nCol, sal_Int32 nRow )
const;
318 const Cell& GetMergedLastCell( sal_Int32 nCol, sal_Int32 nRow )
const;
320 bool IsMergedOverlappedLeft( sal_Int32 nCol, sal_Int32 nRow )
const;
321 bool IsMergedOverlappedRight( sal_Int32 nCol, sal_Int32 nRow )
const;
322 bool IsMergedOverlappedTop( sal_Int32 nCol, sal_Int32 nRow )
const;
323 bool IsMergedOverlappedBottom( sal_Int32 nCol, sal_Int32 nRow )
const;
325 bool IsInClipRange( sal_Int32 nCol, sal_Int32 nRow )
const;
326 bool IsColInClipRange( sal_Int32 nCol )
const;
327 bool IsRowInClipRange( sal_Int32 nRow )
const;
329 bool OverlapsClipRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow )
const;
333 sal_Int32 GetColPosition( sal_Int32 nCol )
const;
334 sal_Int32 GetRowPosition( sal_Int32 nRow )
const;
336 bool HasCellRotation()
const;
342ArrayImpl::ArrayImpl( sal_Int32 nWidth, sal_Int32 nHeight ) :
348 mnLastClipCol( nWidth - 1 ),
349 mnLastClipRow( nHeight - 1 ),
350 mbXCoordsDirty( false ),
351 mbYCoordsDirty( false ),
352 mbMayHaveCellRotation( false )
376 sal_Int32 nFirstCol = nCol;
383 sal_Int32 nFirstRow = nRow;
390 sal_Int32 nLastCol = nCol + 1;
397 sal_Int32 nLastRow = nRow + 1;
415 return rCell.mbOverlapX || (rCell.mnAddLeft > 0);
420 return GetCell( nCol + 1, nRow ).mbOverlapX || (
GetCell( nCol, nRow ).mnAddRight > 0);
426 return rCell.mbOverlapY || (rCell.mnAddTop > 0);
431 return GetCell( nCol, nRow + 1 ).mbOverlapY || (
GetCell( nCol, nRow ).mnAddBottom > 0);
489 for (
const auto& aCell :
maCells)
491 if (aCell->IsRotated())
502class MergedCellIterator
505 explicit MergedCellIterator(
const Array& rArray, sal_Int32 nCol, sal_Int32 nRow );
508 sal_Int32
Col()
const {
return mnCol; }
509 sal_Int32
Row()
const {
return mnRow; }
524MergedCellIterator::MergedCellIterator(
const Array& rArray, sal_Int32 nCol, sal_Int32 nRow )
526 DBG_ASSERT( rArray.IsMerged( nCol, nRow ),
"svx::frame::MergedCellIterator::MergedCellIterator - not in merged range" );
532MergedCellIterator& MergedCellIterator::operator++()
534 DBG_ASSERT( Is(),
"svx::frame::MergedCellIterator::operator++() - already invalid" );
544#define DBG_FRAME_CHECK( cond, funcname, error ) DBG_ASSERT( cond, "svx::frame::Array::" funcname " - " error )
545#define DBG_FRAME_CHECK_COL( col, funcname ) DBG_FRAME_CHECK( (col) < GetColCount(), funcname, "invalid column index" )
546#define DBG_FRAME_CHECK_ROW( row, funcname ) DBG_FRAME_CHECK( (row) < GetRowCount(), funcname, "invalid row index" )
547#define DBG_FRAME_CHECK_COLROW( col, row, funcname ) DBG_FRAME_CHECK( ((col) < GetColCount()) && ((row) < GetRowCount()), funcname, "invalid cell index" )
548#define DBG_FRAME_CHECK_COL_1( col, funcname ) DBG_FRAME_CHECK( (col) <= GetColCount(), funcname, "invalid column index" )
549#define DBG_FRAME_CHECK_ROW_1( row, funcname ) DBG_FRAME_CHECK( (row) <= GetRowCount(), funcname, "invalid row index" )
552#define CELL( col, row ) mxImpl->GetCell( col, row )
553#define PUTCELL( col, row, cell ) mxImpl->PutCell( col, row, cell )
554#define ORIGCELL( col, row ) mxImpl->GetMergedOriginCell( col, row )
555#define LASTCELL( col, row ) mxImpl->GetMergedLastCell( col, row )
585 return mxImpl->maCells.size();
592 nCol =
mxImpl->GetMirrorCol(nCol);
593 return mxImpl->GetIndex( nCol, nRow );
601 aTempCell.SetStyleLeft(rStyle);
602 PUTCELL( nCol, nRow, aTempCell );
609 aTempCell.SetStyleRight(rStyle);
610 PUTCELL( nCol, nRow, aTempCell );
617 aTempCell.SetStyleTop(rStyle);
618 PUTCELL( nCol, nRow, aTempCell );
625 aTempCell.SetStyleBottom(rStyle);
626 PUTCELL( nCol, nRow, aTempCell );
633 aTempCell.SetStyleTLBR(rStyle);
634 PUTCELL( nCol, nRow, aTempCell );
641 aTempCell.SetStyleBLTR(rStyle);
642 PUTCELL( nCol, nRow, aTempCell );
649 aTempCell.SetStyleTLBR(rTLBR);
650 aTempCell.SetStyleBLTR(rBLTR);
651 PUTCELL( nCol, nRow, aTempCell );
657 for( sal_Int32 nRow = 0; nRow <
mxImpl->mnHeight; ++nRow )
664 for( sal_Int32 nRow = 0; nRow <
mxImpl->mnHeight; ++nRow )
671 for( sal_Int32 nCol = 0; nCol <
mxImpl->mnWidth; ++nCol )
678 for( sal_Int32 nCol = 0; nCol <
mxImpl->mnWidth; ++nCol )
686 aTempCell.meRotMode = eRotMode;
687 aTempCell.mfOrientation = fOrientation;
688 PUTCELL( nCol, nRow, aTempCell );
690 if (!
mxImpl->mbMayHaveCellRotation)
694 mxImpl->mbMayHaveCellRotation = aTempCell.IsRotated();
700 if (!
mxImpl->mbMayHaveCellRotation)
706 return mxImpl->HasCellRotation();
712 if( !
mxImpl->IsRowInClipRange( nRow ) ||
mxImpl->IsMergedOverlappedLeft( nCol, nRow ) )
715 if( nCol ==
mxImpl->mnFirstClipCol )
716 return ORIGCELL( nCol, nRow ).GetStyleLeft();
718 if( nCol ==
mxImpl->mnLastClipCol + 1 )
719 return ORIGCELL( nCol - 1, nRow ).GetStyleRight();
721 if( !
mxImpl->IsColInClipRange( nCol ) )
724 return std::max(
ORIGCELL( nCol, nRow ).GetStyleLeft(),
ORIGCELL( nCol - 1, nRow ).GetStyleRight() );
730 if( !
mxImpl->IsRowInClipRange( nRow ) ||
mxImpl->IsMergedOverlappedRight( nCol, nRow ) )
733 if( nCol + 1 ==
mxImpl->mnFirstClipCol )
734 return ORIGCELL( nCol + 1, nRow ).GetStyleLeft();
736 if( nCol ==
mxImpl->mnLastClipCol )
737 return LASTCELL( nCol, nRow ).GetStyleRight();
739 if( !
mxImpl->IsColInClipRange( nCol ) )
742 return std::max(
ORIGCELL( nCol, nRow ).GetStyleRight(),
ORIGCELL( nCol + 1, nRow ).GetStyleLeft() );
748 if( !
mxImpl->IsColInClipRange( nCol ) ||
mxImpl->IsMergedOverlappedTop( nCol, nRow ) )
751 if( nRow ==
mxImpl->mnFirstClipRow )
752 return ORIGCELL( nCol, nRow ).GetStyleTop();
754 if( nRow ==
mxImpl->mnLastClipRow + 1 )
755 return ORIGCELL( nCol, nRow - 1 ).GetStyleBottom();
757 if( !
mxImpl->IsRowInClipRange( nRow ) )
760 return std::max(
ORIGCELL( nCol, nRow ).GetStyleTop(),
ORIGCELL( nCol, nRow - 1 ).GetStyleBottom() );
766 if( !
mxImpl->IsColInClipRange( nCol ) ||
mxImpl->IsMergedOverlappedBottom( nCol, nRow ) )
769 if( nRow + 1 ==
mxImpl->mnFirstClipRow )
770 return ORIGCELL( nCol, nRow + 1 ).GetStyleTop();
772 if( nRow ==
mxImpl->mnLastClipRow )
773 return LASTCELL( nCol, nRow ).GetStyleBottom();
775 if( !
mxImpl->IsRowInClipRange( nRow ) )
778 return std::max(
ORIGCELL( nCol, nRow ).GetStyleBottom(),
ORIGCELL( nCol, nRow + 1 ).GetStyleTop() );
783 return CELL( nCol, nRow ).GetStyleTLBR();
788 return CELL( nCol, nRow ).GetStyleBLTR();
794 if( !
mxImpl->IsInClipRange( nCol, nRow ) )
797 sal_Int32 nFirstCol =
mxImpl->GetMergedFirstCol( nCol, nRow );
798 sal_Int32 nFirstRow =
mxImpl->GetMergedFirstRow( nCol, nRow );
799 return ((nCol == nFirstCol) && (nRow == nFirstRow)) ?
806 if( !
mxImpl->IsInClipRange( nCol, nRow ) )
809 sal_Int32 nLastCol =
mxImpl->GetMergedLastCol( nCol, nRow );
810 sal_Int32 nLastRow =
mxImpl->GetMergedLastRow( nCol, nRow );
811 return ((nCol == nLastCol) && (nRow == nLastRow)) ?
818 if( !
mxImpl->IsInClipRange( nCol, nRow ) )
821 sal_Int32 nFirstCol =
mxImpl->GetMergedFirstCol( nCol, nRow );
822 sal_Int32 nLastRow =
mxImpl->GetMergedLastRow( nCol, nRow );
823 return ((nCol == nFirstCol) && (nRow == nLastRow)) ?
830 if( !
mxImpl->IsInClipRange( nCol, nRow ) )
833 sal_Int32 nFirstRow =
mxImpl->GetMergedFirstRow( nCol, nRow );
834 sal_Int32 nLastCol =
mxImpl->GetMergedLastCol( nCol, nRow );
835 return ((nCol == nLastCol) && (nRow == nFirstRow)) ?
844#if OSL_DEBUG_LEVEL >= 2
847 for( sal_Int32 nCurrCol = nFirstCol; !bFound && (nCurrCol <= nLastCol); ++nCurrCol )
848 for( sal_Int32 nCurrRow = nFirstRow; !bFound && (nCurrRow <= nLastRow); ++nCurrRow )
849 bFound =
CELL( nCurrCol, nCurrRow ).IsMerged();
850 DBG_FRAME_CHECK( !bFound,
"SetMergedRange",
"overlapping merged ranges" );
853 if(
mxImpl->IsValidPos( nFirstCol, nFirstRow ) &&
mxImpl->IsValidPos( nLastCol, nLastRow ) )
860 DBG_FRAME_CHECK(
mxImpl->GetMergedFirstCol( nCol, nRow ) == 0,
"SetAddMergedLeftSize",
"additional border inside array" );
861 for( MergedCellIterator aIt( *
this, nCol, nRow ); aIt.Is(); ++aIt )
863 Cell aTempCell(
CELL(aIt.Col(), aIt.Row()));
864 aTempCell.mnAddLeft = nAddSize;
865 PUTCELL( nCol, nRow, aTempCell );
872 DBG_FRAME_CHECK(
mxImpl->GetMergedLastCol( nCol, nRow ) + 1 ==
mxImpl->mnWidth,
"SetAddMergedRightSize",
"additional border inside array" );
873 for( MergedCellIterator aIt( *
this, nCol, nRow ); aIt.Is(); ++aIt )
875 Cell aTempCell(
CELL(aIt.Col(), aIt.Row()));
876 aTempCell.mnAddRight = nAddSize;
877 PUTCELL( nCol, nRow, aTempCell );
884 DBG_FRAME_CHECK(
mxImpl->GetMergedFirstRow( nCol, nRow ) == 0,
"SetAddMergedTopSize",
"additional border inside array" );
885 for( MergedCellIterator aIt( *
this, nCol, nRow ); aIt.Is(); ++aIt )
887 Cell aTempCell(
CELL(aIt.Col(), aIt.Row()));
888 aTempCell.mnAddTop = nAddSize;
889 PUTCELL( nCol, nRow, aTempCell );
896 DBG_FRAME_CHECK(
mxImpl->GetMergedLastRow( nCol, nRow ) + 1 ==
mxImpl->mnHeight,
"SetAddMergedBottomSize",
"additional border inside array" );
897 for( MergedCellIterator aIt( *
this, nCol, nRow ); aIt.Is(); ++aIt )
899 Cell aTempCell(
CELL(aIt.Col(), aIt.Row()));
900 aTempCell.mnAddBottom = nAddSize;
901 PUTCELL( nCol, nRow, aTempCell );
908 return CELL( nCol, nRow ).IsMerged();
914 rnFirstCol =
mxImpl->GetMergedFirstCol( nCol, nRow );
915 rnFirstRow =
mxImpl->GetMergedFirstRow( nCol, nRow );
919 sal_Int32& rnLastCol, sal_Int32& rnLastRow, sal_Int32 nCol, sal_Int32 nRow )
const
922 rnLastCol =
mxImpl->GetMergedLastCol( nCol, nRow );
923 rnLastRow =
mxImpl->GetMergedLastRow( nCol, nRow );
927void Array::SetClipRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow )
931 mxImpl->mnFirstClipCol = nFirstCol;
932 mxImpl->mnFirstClipRow = nFirstRow;
933 mxImpl->mnLastClipCol = nLastCol;
934 mxImpl->mnLastClipRow = nLastRow;
940 mxImpl->maXCoords[ 0 ] = nXOffset;
941 mxImpl->mbXCoordsDirty =
true;
946 mxImpl->maYCoords[ 0 ] = nYOffset;
947 mxImpl->mbYCoordsDirty =
true;
953 mxImpl->maWidths[ nCol ] = nWidth;
954 mxImpl->mbXCoordsDirty =
true;
960 mxImpl->maHeights[ nRow ] = nHeight;
961 mxImpl->mbYCoordsDirty =
true;
966 std::fill(
mxImpl->maWidths.begin(),
mxImpl->maWidths.end(), nWidth );
967 mxImpl->mbXCoordsDirty =
true;
972 std::fill(
mxImpl->maHeights.begin(),
mxImpl->maHeights.end(), nHeight );
973 mxImpl->mbYCoordsDirty =
true;
979 return mxImpl->GetColPosition( nCol );
985 return mxImpl->GetRowPosition( nRow );
1015 const sal_Int32 nFirstCol(
mxImpl->GetMergedFirstCol( nCol, nRow ));
1016 const sal_Int32 nFirstRow(
mxImpl->GetMergedFirstRow( nCol, nRow ));
1017 const sal_Int32 nLastCol(
mxImpl->GetMergedLastCol( nCol, nRow ));
1018 const sal_Int32 nLastRow(
mxImpl->GetMergedLastRow( nCol, nRow ));
1024 const Cell& rCell =
CELL( nCol, nRow );
1026 if( rCell.IsMerged() )
1058 sal_Int32 nCol, nRow;
1059 for( nRow = 0; nRow <
mxImpl->mnHeight; ++nRow )
1061 for( nCol = 0; nCol <
mxImpl->mnWidth; ++nCol )
1064 aTempCell.MirrorSelfX();
1065 aNewCells.push_back( &
mxImpl->mxPool->Put(aTempCell) );
1068 mxImpl->maCells.swap( aNewCells );
1070 std::reverse(
mxImpl->maWidths.begin(),
mxImpl->maWidths.end() );
1071 mxImpl->mbXCoordsDirty =
true;
1076 const Array& rArray,
1077 const Style& rStyle,
1085 const Color* pForceColor)
1123 const Array& rArray,
1124 const Style& rStyle,
1132 const Color* pForceColor)
1182 if(aResultPP.count() > 0)
1186 if(aResultP.
count() > 0)
1191 if(aResultStart != aResultEnd)
1193 rStart = aResultStart;
1194 rDirection = aResultEnd - aResultStart;
1201 const Array& rArray,
1202 const Style& rStyle,
1208 sal_Int32 nColRight,
1210 sal_Int32 nRowBottom,
1211 const Color* pForceColor,
1221 if(
nullptr != pClipRange)
1251 const Array& rArray,
1252 const Style& rStyle,
1258 sal_Int32 nColRight,
1260 sal_Int32 nRowBottom,
1261 const Color* pForceColor,
1271 if(
nullptr != pClipRange)
1301 sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow,
1302 const Color* pForceColor )
const
1307#ifdef OPTICAL_CHECK_CLIPRANGE_FOR_MERGED_CELL
1308 std::vector<basegfx::B2DRange> aClipRanges;
1327 const sal_Int32 nStartRow(nFirstRow > 0 ? nFirstRow - 1 : nFirstRow);
1328 const sal_Int32 nEndRow(nLastRow <
GetRowCount() - 1 ? nLastRow + 1 : nLastRow);
1329 const sal_Int32 nStartCol(nFirstCol > 0 ? nFirstCol - 1 : nFirstCol);
1330 const sal_Int32 nEndCol(nLastCol <
GetColCount() - 1 ? nLastCol + 1 : nLastCol);
1337 std::unordered_set< sal_Int32 > aMergedCells;
1339 for (sal_Int32 nRow(nStartRow); nRow <= nEndRow; ++nRow)
1341 for (sal_Int32 nCol(nStartCol); nCol <= nEndCol; ++nCol)
1345 const Cell& rCell(
CELL(nCol, nRow));
1352 const bool bOverlapX(rCell.mbOverlapX);
1353 const bool bFirstCol(nCol == nFirstCol);
1358 const bool bRotated(rCell.IsRotated());
1363 const bool bSuppressLeft(!bRotated && nCol > nFirstCol &&
CELL(nCol - 1, nRow).
IsRotated());
1364 const bool bSuppressAbove(!bRotated && nRow > nFirstRow &&
CELL(nCol, nRow - 1).
IsRotated());
1369 const bool bOverlapY(rCell.mbOverlapY);
1370 const bool bLastCol(nCol == nLastCol);
1371 const bool bFirstRow(nRow == nFirstRow);
1372 const bool bLastRow(nRow == nLastRow);
1429 if(rCell.IsMerged())
1433 sal_Int32 nColLeft(nCol), nRowTop(nRow), nColRight(nCol), nRowBottom(nRow);
1434 GetMergedRange(nColLeft, nRowTop, nColRight, nRowBottom, nCol, nRow);
1435 const sal_Int32 nIndexOfMergedCell(
mxImpl->GetIndex(nColLeft, nRowTop));
1437 auto aItInsertedPair = aMergedCells.insert(nIndexOfMergedCell);
1438 if(aItInsertedPair.second)
1453 if(
mxImpl->OverlapsClipRange(nColLeft, nRowTop, nColRight, nRowBottom))
1458 const Cell& rMergedCell(
CELL(nColLeft, nRowTop));
1459 aCoordinateSystem = rMergedCell.CreateCoordinateSystemMergedCell(
1460 *
this, nColLeft, nRowTop, nColRight, nRowBottom);
1470 !
mxImpl->IsColInClipRange(nColLeft) ||
1471 !
mxImpl->IsRowInClipRange(nRowTop) ||
1472 !
mxImpl->IsColInClipRange(nColRight) ||
1473 !
mxImpl->IsRowInClipRange(nRowBottom));
1485 nColRight, nRowBottom));
1490 bNeedToClip = !aClipRange.
isEmpty();
1492#ifdef OPTICAL_CHECK_CLIPRANGE_FOR_MERGED_CELL
1493 aClipRanges.push_back(aClipRange);
1499 nColLeft, nRowTop, nColRight, nRowBottom, pForceColor,
1500 bNeedToClip ? &aClipRange :
nullptr);
1504 nColLeft, nRowTop, nColRight, nRowBottom, pForceColor,
1505 bNeedToClip ? &aClipRange :
nullptr);
1514 if(
mxImpl->IsInClipRange( nCol, nRow ) )
1523 nCol, nRow, nCol, nRow, pForceColor,
nullptr);
1526 nCol, nRow, nCol, nRow, pForceColor,
nullptr);
1566#ifdef OPTICAL_CHECK_CLIPRANGE_FOR_MERGED_CELL
1567 for(
auto const& rClipRange : aClipRanges)
1597#undef DBG_FRAME_CHECK_ROW_1
1598#undef DBG_FRAME_CHECK_COL_1
1599#undef DBG_FRAME_CHECK_COLROW
1600#undef DBG_FRAME_CHECK_ROW
1601#undef DBG_FRAME_CHECK_COL
1602#undef DBG_FRAME_CHECK
const T & Put(std::unique_ptr< T > xItem, sal_uInt16 nWhich=0)
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 PUTCELL(col, row, cell)
#define DBG_FRAME_CHECK(cond, funcname, error)
#define DBG_FRAME_CHECK_ROW(row, funcname)
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
css::uno::Reference< css::animations::XAnimationNode > Clone(const css::uno::Reference< css::animations::XAnimationNode > &xSourceNode, const SdPage *pSource=nullptr, const SdPage *pTarget=nullptr)
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 lclSetMergedRange(SfxItemPool &rPool, CellVec &rCells, sal_Int32 nWidth, sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow)
static void lclRecalcCoordVec(std::vector< sal_Int32 > &rCoords, const std::vector< sal_Int32 > &rSizes)
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< const Cell * > CellVec
const SfxItemInfo maItemInfos[]
bool IsRotated(const OUString &rsCommandName, const OUString &rsModuleName)
@ SVX_ROTATE_MODE_STANDARD
rtl::Reference< SfxItemPool > mxPool
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
void PutCell(sal_Int32 nCol, sal_Int32 nRow, const Cell &)
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
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
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)