21#include <document.hxx>
24#include <osl/diagnose.h>
53 bool bRepCol,
bool bRepRow ) :
102 while ( nEnd > 0 &&
pColInfo[nEnd-1].nPixelStart > rPixelArea.
Right() )
105 if ( nStart > 0 || nEnd <
nCols )
109 SCCOL nNewCount = nEnd - nStart;
130 while ( nEnd > 0 &&
pRowInfo[nEnd-1].nPixelStart > rPixelArea.
Bottom() )
133 if ( nStart <= 0 && nEnd >=
nRows )
138 SCROW nNewCount = nEnd - nStart;
182 m_Entries.push_front( std::make_unique<ScPreviewLocationEntry>(SC_PLOC_CELLRANGE, aPixelRect, rRange, bRepCol, bRepRow) );
213 ScRange aRange( nStartCol, 0, nTab, nEndCol, 0, nTab );
216 m_Entries.push_front( std::make_unique<ScPreviewLocationEntry>(SC_PLOC_COLHEADER, aPixelRect, aRange, bRepCol,
false) );
222 ScRange aRange( 0, nStartRow, nTab, 0, nEndRow, nTab );
225 m_Entries.push_front( std::make_unique<ScPreviewLocationEntry>(SC_PLOC_ROWHEADER, aPixelRect, aRange,
false, bRepRow) );
233 ScPreviewLocationType
eType = bHeader ?
234 ( bLeft ? SC_PLOC_LEFTHEADER : SC_PLOC_RIGHTHEADER ) :
235 ( bLeft ? SC_PLOC_LEFTFOOTER : SC_PLOC_RIGHTFOOTER );
237 m_Entries.push_front( std::make_unique<ScPreviewLocationEntry>(
eType, aPixelRect, aRange,
false,
false) );
245 m_Entries.push_front( std::make_unique<ScPreviewLocationEntry>(SC_PLOC_NOTEMARK, aPixelRect, aRange,
false,
false) );
253 m_Entries.push_front( std::make_unique<ScPreviewLocationEntry>(SC_PLOC_NOTETEXT, aPixelRect, aRange,
false,
false) );
269 const ScAddress& rPos, ScPreviewLocationType
const eType)
271 for (
auto const& it : rEntries)
273 if ( it->eType ==
eType && it->aCellRange.Contains( rPos ) )
301 Size aOffsetLogic( nPosX, nPosY );
302 Size aSizeLogic( nSizeX, nSizeY );
326 if ( it->eType == SC_PLOC_CELLRANGE || it->eType == SC_PLOC_COLHEADER || it->eType == SC_PLOC_ROWHEADER )
327 if ( it->aPixelRect.Overlaps( rVisiblePixel ) )
338 if ( it->eType == SC_PLOC_LEFTHEADER || it->eType == SC_PLOC_RIGHTHEADER )
340 rRect = it->aPixelRect;
352 if ( it->eType == SC_PLOC_LEFTFOOTER || it->eType == SC_PLOC_RIGHTFOOTER )
354 rRect = it->aPixelRect;
366 if ( it->eType == SC_PLOC_LEFTHEADER )
369 if ( it->eType == SC_PLOC_RIGHTHEADER )
380 if ( it->eType == SC_PLOC_LEFTFOOTER )
383 if ( it->eType == SC_PLOC_RIGHTFOOTER )
392 ScPreviewLocationType
eType = bNoteMarks ? SC_PLOC_NOTEMARK : SC_PLOC_NOTETEXT;
397 if ( it->eType ==
eType && it->aPixelRect.Overlaps( rVisiblePixel ) )
407 ScPreviewLocationType
eType = bNoteMarks ? SC_PLOC_NOTEMARK : SC_PLOC_NOTETEXT;
412 if ( it->eType ==
eType && it->aPixelRect.Overlaps( rVisiblePixel ) )
414 if (
nPos == sal::static_int_cast<sal_uLong>(
nIndex) )
416 rCellPos = it->aCellRange.aStart;
417 rNoteRect = it->aPixelRect;
429 ScPreviewLocationType
eType = bNoteMarks ? SC_PLOC_NOTEMARK : SC_PLOC_NOTETEXT;
433 if ( it->eType ==
eType && it->aPixelRect.Overlaps( rVisiblePixel ) )
435 if ( aCellPos == it->aCellRange.aStart )
436 return it->aPixelRect;
446 bool bHasHeaderCol =
false;
447 bool bHasRepCols =
false;
448 bool bHasMainCols =
false;
449 SCCOL nRepeatColStart = 0;
450 SCCOL nRepeatColEnd = 0;
451 SCCOL nMainColStart = 0;
452 SCCOL nMainColEnd = 0;
455 bool bHasHeaderRow =
false;
456 bool bHasRepRows =
false;
457 bool bHasMainRows =
false;
458 SCROW nRepeatRowStart = 0;
459 SCROW nRepeatRowEnd = 0;
460 SCROW nMainRowStart = 0;
461 SCROW nMainRowEnd = 0;
468 if ( it->eType == SC_PLOC_CELLRANGE )
470 if ( it->bRepeatCol )
473 nRepeatColStart = it->aCellRange.aStart.Col();
474 nRepeatColEnd = it->aCellRange.aEnd.Col();
475 aRepeatRect.
SetLeft( it->aPixelRect.Left() );
476 aRepeatRect.
SetRight( it->aPixelRect.Right() );
481 nMainColStart = it->aCellRange.aStart.Col();
482 nMainColEnd = it->aCellRange.aEnd.Col();
483 aMainRect.
SetLeft( it->aPixelRect.Left() );
484 aMainRect.
SetRight( it->aPixelRect.Right() );
486 if ( it->bRepeatRow )
489 nRepeatRowStart = it->aCellRange.aStart.Row();
490 nRepeatRowEnd = it->aCellRange.aEnd.Row();
491 aRepeatRect.
SetTop( it->aPixelRect.Top() );
492 aRepeatRect.
SetBottom( it->aPixelRect.Bottom() );
497 nMainRowStart = it->aCellRange.aStart.Row();
498 nMainRowEnd = it->aCellRange.aEnd.Row();
499 aMainRect.
SetTop( it->aPixelRect.Top() );
500 aMainRect.
SetBottom( it->aPixelRect.Bottom() );
502 nTab = it->aCellRange.aStart.Tab();
504 else if ( it->eType == SC_PLOC_ROWHEADER )
507 bHasHeaderCol =
true;
508 aHeaderRect.
SetLeft( it->aPixelRect.Left() );
509 aHeaderRect.
SetRight( it->aPixelRect.Right() );
511 else if ( it->eType == SC_PLOC_COLHEADER )
514 bHasHeaderRow =
true;
515 aHeaderRect.
SetTop( it->aPixelRect.Top() );
516 aHeaderRect.
SetBottom( it->aPixelRect.Bottom() );
527 for ( nCol=nRepeatColStart; nCol<=nRepeatColEnd; nCol++ )
531 for ( nCol=nMainColStart; nCol<=nMainColEnd; nCol++ )
542 pColInfo[nColPos].
Set(
true, 0, aHeaderRect.
Left(), aHeaderRect.
Right() );
548 for ( nCol=nRepeatColStart; nCol<=nRepeatColEnd; nCol++ )
557 pColInfo[nColPos].
Set(
false, nCol,
558 aRepeatRect.
Left() + nPixelStart,
559 aRepeatRect.
Left() + nPixelEnd );
568 for ( nCol=nMainColStart; nCol<=nMainColEnd; nCol++ )
577 pColInfo[nColPos].
Set(
false, nCol,
578 aMainRect.
Left() + nPixelStart,
579 aMainRect.
Left() + nPixelEnd );
607 pRowInfo[nRowPos].
Set(
true, 0, aHeaderRect.
Top(), aHeaderRect.
Bottom() );
613 for (
SCROW nRow = nRepeatRowStart; nRow <= nRepeatRowEnd; ++nRow)
624 pRowInfo[nRowPos].
Set(
false, nRow,
625 aRepeatRect.
Top() + nPixelStart,
626 aRepeatRect.
Top() + nPixelEnd );
635 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;
SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab) const
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
SC_DLLPUBLIC sal_uInt16 GetOriginalHeight(SCROW nRow, SCTAB nTab) const
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
sal_uInt8 aDrawRangeId[SC_PREVIEW_MAXRANGES]
void AddColHeaders(const tools::Rectangle &rRect, SCCOL nStartCol, SCCOL nEndCol, bool bRepCol)
void AddCellRange(const tools::Rectangle &rRect, const ScRange &rRange, bool bRepCol, bool bRepRow, const MapMode &rDrawMap)
bool GetHeaderPosition(tools::Rectangle &rHeaderRect) const
bool IsFooterLeft() const
tools::Rectangle aDrawRectangle[SC_PREVIEW_MAXRANGES]
VclPtr< OutputDevice > pWindow
void SetPrintTab(SCTAB nNew)
bool GetNoteInRange(const tools::Rectangle &rVisiblePixel, tools::Long nIndex, bool bNoteMarks, ScAddress &rCellPos, tools::Rectangle &rNoteRect) const
MapMode aDrawMapMode[SC_PREVIEW_MAXRANGES]
bool HasCellsInRange(const tools::Rectangle &rVisiblePixel) const
void AddNoteMark(const tools::Rectangle &rRect, const ScAddress &rPos)
void AddRowHeaders(const tools::Rectangle &rRect, SCROW nStartRow, SCROW nEndRow, bool bRepRow)
bool GetMainCellRange(ScRange &rRange, tools::Rectangle &rPixRect) const
tools::Rectangle GetCellOutputRect(const ScAddress &rCellPos) const
tools::Rectangle GetHeaderCellOutputRect(const tools::Rectangle &rVisRect, const ScAddress &rCellPos, bool bColHeader) const
void SetCellMapMode(const MapMode &rMapMode)
ScPreviewLocationData(ScDocument *pDocument, OutputDevice *pWin)
tools::Rectangle GetNoteInRangeOutputRect(const tools::Rectangle &rVisiblePixel, bool bNoteMarks, const ScAddress &aCellPos) const
void AddHeaderFooter(const tools::Rectangle &rRect, bool bHeader, bool bLeft)
tools::Long GetNoteCountInRange(const tools::Rectangle &rVisiblePixel, bool bNoteMarks) const
bool IsHeaderLeft() const
void GetCellPosition(const ScAddress &rCellPos, tools::Rectangle &rCellRect) const
void GetTableInfo(const tools::Rectangle &rVisiblePixel, ScPreviewTableInfo &rInfo) const
tools::Rectangle GetOffsetPixel(const ScAddress &rCellPos, const ScRange &rRange) const
bool GetFooterPosition(tools::Rectangle &rFooterRect) const
std::list< std::unique_ptr< ScPreviewLocationEntry > > Entries_t
void GetDrawRange(sal_uInt16 nPos, tools::Rectangle &rPixelRect, MapMode &rMapMode, sal_uInt8 &rRangeId) const
void AddNoteText(const tools::Rectangle &rRect, const ScAddress &rPos)
std::unique_ptr< ScPreviewColRowInfo[]> pColInfo
std::unique_ptr< ScPreviewColRowInfo[]> pRowInfo
const ScPreviewColRowInfo * GetRowInfo() const
void SetColInfo(SCCOL nCount, ScPreviewColRowInfo *pNewInfo)
void LimitToArea(const tools::Rectangle &rPixelArea)
void SetTab(SCTAB nNewTab)
const ScPreviewColRowInfo * GetColInfo() const
void SetRowInfo(SCROW nCount, ScPreviewColRowInfo *pNewInfo)
constexpr tools::Long Height() const
constexpr tools::Long Width() const
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
static ScPreviewLocationEntry * lcl_GetEntryByAddress(ScPreviewLocationData::Entries_t const &rEntries, const ScAddress &rPos, ScPreviewLocationType const eType)
#define SC_PREVIEW_RANGE_EDGE
#define SC_PREVIEW_RANGE_TAB
#define SC_PREVIEW_RANGE_REPCOL
#define SC_PREVIEW_RANGE_REPROW
#define SC_PREVIEW_MAXRANGES
void Set(bool bHeader, SCCOLROW nIndex, tools::Long nStart, tools::Long nEnd)
tools::Rectangle aPixelRect
ScPreviewLocationType eType
ScPreviewLocationEntry(ScPreviewLocationType eNewType, const tools::Rectangle &rPixel, const ScRange &rRange, bool bRepCol, bool bRepRow)