21 #include <document.hxx>
23 #include <osl/diagnose.h>
52 bool bRepCol,
bool bRepRow ) :
56 bRepeatCol( bRepCol ),
101 while ( nEnd > 0 &&
pColInfo[nEnd-1].nPixelStart > rPixelArea.
Right() )
104 if ( nStart > 0 || nEnd <
nCols )
108 SCCOL nNewCount = nEnd - nStart;
129 while ( nEnd > 0 &&
pRowInfo[nEnd-1].nPixelStart > rPixelArea.
Bottom() )
132 if ( nStart <= 0 && nEnd >=
nRows )
137 SCROW nNewCount = nEnd - nStart;
181 m_Entries.push_front( std::make_unique<ScPreviewLocationEntry>(SC_PLOC_CELLRANGE, aPixelRect, rRange, bRepCol, bRepRow) );
212 ScRange aRange( nStartCol, 0, nTab, nEndCol, 0, nTab );
215 m_Entries.push_front( std::make_unique<ScPreviewLocationEntry>(SC_PLOC_COLHEADER, aPixelRect, aRange, bRepCol,
false) );
221 ScRange aRange( 0, nStartRow, nTab, 0, nEndRow, nTab );
224 m_Entries.push_front( std::make_unique<ScPreviewLocationEntry>(SC_PLOC_ROWHEADER, aPixelRect, aRange,
false, bRepRow) );
233 ( bLeft ? SC_PLOC_LEFTHEADER : SC_PLOC_RIGHTHEADER ) :
234 ( bLeft ? SC_PLOC_LEFTFOOTER : SC_PLOC_RIGHTFOOTER );
236 m_Entries.push_front( std::make_unique<ScPreviewLocationEntry>(eType, aPixelRect, aRange,
false,
false) );
244 m_Entries.push_front( std::make_unique<ScPreviewLocationEntry>(SC_PLOC_NOTEMARK, aPixelRect, aRange,
false,
false) );
252 m_Entries.push_front( std::make_unique<ScPreviewLocationEntry>(SC_PLOC_NOTETEXT, aPixelRect, aRange,
false,
false) );
257 OSL_ENSURE( nPos <
nDrawRanges,
"wrong position" );
270 for (
auto const& it : rEntries)
272 if ( it->eType == eType && it->aCellRange.In( rPos ) )
291 nPosX +=
static_cast<tools::Long>(nDocW * nScaleX);
297 nEndRow, nTab, nScaleY));
300 Size aOffsetLogic( nPosX, nPosY );
301 Size aSizeLogic( nSizeX, nSizeY );
325 if ( it->eType == SC_PLOC_CELLRANGE || it->eType == SC_PLOC_COLHEADER || it->eType == SC_PLOC_ROWHEADER )
326 if ( it->aPixelRect.IsOver( rVisiblePixel ) )
337 if ( it->eType == SC_PLOC_LEFTHEADER || it->eType == SC_PLOC_RIGHTHEADER )
339 rRect = it->aPixelRect;
351 if ( it->eType == SC_PLOC_LEFTFOOTER || it->eType == SC_PLOC_RIGHTFOOTER )
353 rRect = it->aPixelRect;
365 if ( it->eType == SC_PLOC_LEFTHEADER )
368 if ( it->eType == SC_PLOC_RIGHTHEADER )
379 if ( it->eType == SC_PLOC_LEFTFOOTER )
382 if ( it->eType == SC_PLOC_RIGHTFOOTER )
396 if ( it->eType == eType && it->aPixelRect.IsOver( rVisiblePixel ) )
411 if ( it->eType == eType && it->aPixelRect.IsOver( rVisiblePixel ) )
413 if ( nPos == sal::static_int_cast<sal_uLong>(nIndex) )
415 rCellPos = it->aCellRange.aStart;
416 rNoteRect = it->aPixelRect;
433 if ( it->eType == eType && it->aPixelRect.IsOver( rVisiblePixel ) )
435 if ( aCellPos == it->aCellRange.aStart )
436 return it->aPixelRect;
450 bool bHasHeaderCol =
false;
451 bool bHasRepCols =
false;
452 bool bHasMainCols =
false;
453 SCCOL nRepeatColStart = 0;
454 SCCOL nRepeatColEnd = 0;
455 SCCOL nMainColStart = 0;
456 SCCOL nMainColEnd = 0;
459 bool bHasHeaderRow =
false;
460 bool bHasRepRows =
false;
461 bool bHasMainRows =
false;
462 SCROW nRepeatRowStart = 0;
463 SCROW nRepeatRowEnd = 0;
464 SCROW nMainRowStart = 0;
465 SCROW nMainRowEnd = 0;
472 if ( it->eType == SC_PLOC_CELLRANGE )
474 if ( it->bRepeatCol )
477 nRepeatColStart = it->aCellRange.aStart.Col();
478 nRepeatColEnd = it->aCellRange.aEnd.Col();
479 aRepeatRect.
SetLeft( it->aPixelRect.Left() );
480 aRepeatRect.
SetRight( it->aPixelRect.Right() );
485 nMainColStart = it->aCellRange.aStart.Col();
486 nMainColEnd = it->aCellRange.aEnd.Col();
487 aMainRect.
SetLeft( it->aPixelRect.Left() );
488 aMainRect.
SetRight( it->aPixelRect.Right() );
490 if ( it->bRepeatRow )
493 nRepeatRowStart = it->aCellRange.aStart.Row();
494 nRepeatRowEnd = it->aCellRange.aEnd.Row();
495 aRepeatRect.
SetTop( it->aPixelRect.Top() );
496 aRepeatRect.
SetBottom( it->aPixelRect.Bottom() );
501 nMainRowStart = it->aCellRange.aStart.Row();
502 nMainRowEnd = it->aCellRange.aEnd.Row();
503 aMainRect.
SetTop( it->aPixelRect.Top() );
504 aMainRect.
SetBottom( it->aPixelRect.Bottom() );
506 nTab = it->aCellRange.aStart.Tab();
508 else if ( it->eType == SC_PLOC_ROWHEADER )
511 bHasHeaderCol =
true;
512 aHeaderRect.
SetLeft( it->aPixelRect.Left() );
513 aHeaderRect.
SetRight( it->aPixelRect.Right() );
515 else if ( it->eType == SC_PLOC_COLHEADER )
518 bHasHeaderRow =
true;
519 aHeaderRect.
SetTop( it->aPixelRect.Top() );
520 aHeaderRect.
SetBottom( it->aPixelRect.Bottom() );
531 for ( nCol=nRepeatColStart; nCol<=nRepeatColEnd; nCol++ )
535 for ( nCol=nMainColStart; nCol<=nMainColEnd; nCol++ )
546 pColInfo[nColPos].
Set(
true, 0, aHeaderRect.
Left(), aHeaderRect.
Right() );
552 for ( nCol=nRepeatColStart; nCol<=nRepeatColEnd; nCol++ )
560 pColInfo[nColPos].
Set(
false, nCol,
561 aRepeatRect.
Left() + nPixelStart,
562 aRepeatRect.
Left() + nPixelEnd );
571 for ( nCol=nMainColStart; nCol<=nMainColEnd; nCol++ )
579 pColInfo[nColPos].
Set(
false, nCol,
580 aMainRect.
Left() + nPixelStart,
581 aMainRect.
Left() + nPixelEnd );
609 pRowInfo[nRowPos].
Set(
true, 0, aHeaderRect.
Top(), aHeaderRect.
Bottom() );
615 for (
SCROW nRow = nRepeatRowStart; nRow <= nRepeatRowEnd; ++nRow)
625 pRowInfo[nRowPos].
Set(
false, nRow,
626 aRepeatRect.
Top() + nPixelStart,
627 aRepeatRect.
Top() + nPixelEnd );
636 for (
SCROW nRow = nMainRowStart; nRow <= nMainRowEnd; ++nRow)
646 pRowInfo[nRowPos].
Set(
false, nRow,
647 aMainRect.
Top() + nPixelStart,
648 aMainRect.
Top() + nPixelEnd );
673 if ( (rCellPos.
Col() >= 0) &&
674 (rCellPos.
Row() >= 0) && (rCellPos.
Col() < aTableInfo.
GetCols()) &&
680 nCol = rCellPos.
Col();
682 nRow = rCellPos.
Row();
707 if ( it->eType == SC_PLOC_CELLRANGE && !it->bRepeatCol && !it->bRepeatRow )
709 rRange = it->aCellRange;
710 rPixRect = it->aPixelRect;
void LimitToArea(const tools::Rectangle &rPixelArea)
#define SC_PREVIEW_RANGE_REPROW
tools::Rectangle GetOffsetPixel(const ScAddress &rCellPos, const ScRange &rRange) const
tools::Rectangle GetNoteInRangeOutputRect(const tools::Rectangle &rVisiblePixel, bool bNoteMarks, const ScAddress &aCellPos) const
void AddNoteText(const tools::Rectangle &rRect, const ScAddress &rPos)
void GetCellPosition(const ScAddress &rCellPos, tools::Rectangle &rCellRect) const
VclPtr< OutputDevice > pWindow
#define SC_PREVIEW_MAXRANGES
tools::Rectangle GetCellOutputRect(const ScAddress &rCellPos) const
std::list< std::unique_ptr< ScPreviewLocationEntry > > Entries_t
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
ScPreviewLocationEntry(ScPreviewLocationType eNewType, const tools::Rectangle &rPixel, const ScRange &rRange, bool bRepCol, bool bRepRow)
static ScPreviewLocationEntry * lcl_GetEntryByAddress(ScPreviewLocationData::Entries_t const &rEntries, const ScAddress &rPos, ScPreviewLocationType const eType)
bool GetNoteInRange(const tools::Rectangle &rVisiblePixel, tools::Long nIndex, bool bNoteMarks, ScAddress &rCellPos, tools::Rectangle &rNoteRect) const
void Set(bool bHeader, SCCOLROW nIndex, tools::Long nStart, tools::Long nEnd)
void AddNoteMark(const tools::Rectangle &rRect, const ScAddress &rPos)
tools::Rectangle GetHeaderCellOutputRect(const tools::Rectangle &rVisRect, const ScAddress &rCellPos, bool bColHeader) const
void AddHeaderFooter(const tools::Rectangle &rRect, bool bHeader, bool bLeft)
ScPreviewLocationData(ScDocument *pDocument, OutputDevice *pWin)
const ScPreviewColRowInfo * GetRowInfo() const
void SetTab(SCTAB nNewTab)
std::unique_ptr< ScPreviewColRowInfo[]> pRowInfo
bool GetFooterPosition(tools::Rectangle &rFooterRect) const
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
bool IsFooterLeft() const
sal_uInt8 aDrawRangeId[SC_PREVIEW_MAXRANGES]
void SetRowInfo(SCROW nCount, ScPreviewColRowInfo *pNewInfo)
MapMode aDrawMapMode[SC_PREVIEW_MAXRANGES]
#define SC_PREVIEW_RANGE_TAB
bool HasCellsInRange(const tools::Rectangle &rVisiblePixel) const
sal_uLong GetScaledRowHeight(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, double fScale, const sal_uLong *pnMaxHeight=nullptr) const
tools::Long Width() const
const ScPreviewColRowInfo * GetColInfo() const
#define SC_PREVIEW_RANGE_REPCOL
void AddColHeaders(const tools::Rectangle &rRect, SCCOL nStartCol, SCCOL nEndCol, bool bRepCol)
#define SC_PREVIEW_RANGE_EDGE
bool IsHeaderLeft() const
tools::Rectangle aDrawRectangle[SC_PREVIEW_MAXRANGES]
void SetPrintTab(SCTAB nNew)
std::unique_ptr< ScPreviewColRowInfo[]> pColInfo
Point LogicToPixel(const Point &rLogicPt) const
void AddRowHeaders(const tools::Rectangle &rRect, SCROW nStartRow, SCROW nEndRow, bool bRepRow)
SC_DLLPUBLIC sal_uInt16 GetOriginalHeight(SCROW nRow, SCTAB nTab) const
tools::Long GetNoteCountInRange(const tools::Rectangle &rVisiblePixel, bool bNoteMarks) const
void AddCellRange(const tools::Rectangle &rRect, const ScRange &rRange, bool bRepCol, bool bRepRow, const MapMode &rDrawMap)
void GetDrawRange(sal_uInt16 nPos, tools::Rectangle &rPixelRect, MapMode &rMapMode, sal_uInt8 &rRangeId) const
tools::Long Height() const
ScPreviewLocationType eType
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
void SetCellMapMode(const MapMode &rMapMode)
void SetColInfo(SCCOL nCount, ScPreviewColRowInfo *pNewInfo)
tools::Rectangle aPixelRect
bool GetMainCellRange(ScRange &rRange, tools::Rectangle &rPixRect) const
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const
void GetTableInfo(const tools::Rectangle &rVisiblePixel, ScPreviewTableInfo &rInfo) const
bool GetHeaderPosition(tools::Rectangle &rHeaderRect) const