1*38d50f7bSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*38d50f7bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*38d50f7bSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*38d50f7bSAndrew Rist * distributed with this work for additional information 6*38d50f7bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*38d50f7bSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*38d50f7bSAndrew Rist * "License"); you may not use this file except in compliance 9*38d50f7bSAndrew Rist * with the License. You may obtain a copy of the License at 10*38d50f7bSAndrew Rist * 11*38d50f7bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*38d50f7bSAndrew Rist * 13*38d50f7bSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*38d50f7bSAndrew Rist * software distributed under the License is distributed on an 15*38d50f7bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*38d50f7bSAndrew Rist * KIND, either express or implied. See the License for the 17*38d50f7bSAndrew Rist * specific language governing permissions and limitations 18*38d50f7bSAndrew Rist * under the License. 19*38d50f7bSAndrew Rist * 20*38d50f7bSAndrew Rist *************************************************************/ 21*38d50f7bSAndrew Rist 22*38d50f7bSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SC_PREVLOC_HXX 25cdf0e10cSrcweir #define SC_PREVLOC_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "address.hxx" 28cdf0e10cSrcweir #include <tools/list.hxx> 29cdf0e10cSrcweir #include <vcl/mapmod.hxx> 30cdf0e10cSrcweir #include <sal/types.h> 31cdf0e10cSrcweir 32cdf0e10cSrcweir 33cdf0e10cSrcweir #define SC_PREVIEW_MAXRANGES 4 34cdf0e10cSrcweir #define SC_PREVIEW_RANGE_EDGE 0 35cdf0e10cSrcweir #define SC_PREVIEW_RANGE_REPCOL 1 36cdf0e10cSrcweir #define SC_PREVIEW_RANGE_REPROW 2 37cdf0e10cSrcweir #define SC_PREVIEW_RANGE_TAB 3 38cdf0e10cSrcweir 39cdf0e10cSrcweir class OutputDevice; 40cdf0e10cSrcweir class String; 41cdf0e10cSrcweir class Point; 42cdf0e10cSrcweir class Rectangle; 43cdf0e10cSrcweir class ScAddress; 44cdf0e10cSrcweir class ScRange; 45cdf0e10cSrcweir class ScDocument; 46cdf0e10cSrcweir 47cdf0e10cSrcweir struct ScPreviewColRowInfo 48cdf0e10cSrcweir { 49cdf0e10cSrcweir sal_Bool bIsHeader; 50cdf0e10cSrcweir SCCOLROW nDocIndex; 51cdf0e10cSrcweir long nPixelStart; 52cdf0e10cSrcweir long nPixelEnd; 53cdf0e10cSrcweir SetScPreviewColRowInfo54cdf0e10cSrcweir void Set( sal_Bool bHeader, SCCOLROW nIndex, long nStart, long nEnd ) 55cdf0e10cSrcweir { 56cdf0e10cSrcweir bIsHeader = bHeader; 57cdf0e10cSrcweir nDocIndex = nIndex; 58cdf0e10cSrcweir nPixelStart = nStart; 59cdf0e10cSrcweir nPixelEnd = nEnd; 60cdf0e10cSrcweir } 61cdf0e10cSrcweir }; 62cdf0e10cSrcweir 63cdf0e10cSrcweir class ScPreviewTableInfo 64cdf0e10cSrcweir { 65cdf0e10cSrcweir SCTAB nTab; 66cdf0e10cSrcweir SCCOL nCols; 67cdf0e10cSrcweir SCROW nRows; 68cdf0e10cSrcweir ScPreviewColRowInfo* pColInfo; 69cdf0e10cSrcweir ScPreviewColRowInfo* pRowInfo; 70cdf0e10cSrcweir 71cdf0e10cSrcweir public: 72cdf0e10cSrcweir ScPreviewTableInfo(); 73cdf0e10cSrcweir ~ScPreviewTableInfo(); 74cdf0e10cSrcweir GetTab() const75cdf0e10cSrcweir SCTAB GetTab() const { return nTab; } GetCols() const76cdf0e10cSrcweir SCCOL GetCols() const { return nCols; } GetRows() const77cdf0e10cSrcweir SCROW GetRows() const { return nRows; } GetColInfo() const78cdf0e10cSrcweir const ScPreviewColRowInfo* GetColInfo() const { return pColInfo; } GetRowInfo() const79cdf0e10cSrcweir const ScPreviewColRowInfo* GetRowInfo() const { return pRowInfo; } 80cdf0e10cSrcweir 81cdf0e10cSrcweir void SetTab( SCTAB nNewTab ); 82cdf0e10cSrcweir void SetColInfo( SCCOL nCount, ScPreviewColRowInfo* pNewInfo ); 83cdf0e10cSrcweir void SetRowInfo( SCROW nCount, ScPreviewColRowInfo* pNewInfo ); 84cdf0e10cSrcweir void LimitToArea( const Rectangle& rPixelArea ); 85cdf0e10cSrcweir }; 86cdf0e10cSrcweir 87cdf0e10cSrcweir 88cdf0e10cSrcweir class ScPreviewLocationData 89cdf0e10cSrcweir { 90cdf0e10cSrcweir OutputDevice* pWindow; 91cdf0e10cSrcweir ScDocument* pDoc; 92cdf0e10cSrcweir MapMode aCellMapMode; 93cdf0e10cSrcweir MapMode aDrawMapMode[SC_PREVIEW_MAXRANGES]; 94cdf0e10cSrcweir Rectangle aDrawRectangle[SC_PREVIEW_MAXRANGES]; 95cdf0e10cSrcweir sal_uInt8 aDrawRangeId[SC_PREVIEW_MAXRANGES]; 96cdf0e10cSrcweir sal_uInt16 nDrawRanges; 97cdf0e10cSrcweir SCTAB nPrintTab; 98cdf0e10cSrcweir List aEntries; 99cdf0e10cSrcweir 100cdf0e10cSrcweir //UNUSED2008-05 ScAddress GetCellFromRange( const Size& rOffsetPixel, const ScRange& rRange ) const; 101cdf0e10cSrcweir Rectangle GetOffsetPixel( const ScAddress& rCellPos, const ScRange& rRange ) const; 102cdf0e10cSrcweir 103cdf0e10cSrcweir public: 104cdf0e10cSrcweir ScPreviewLocationData( ScDocument* pDocument, OutputDevice* pWin ); 105cdf0e10cSrcweir ~ScPreviewLocationData(); 106cdf0e10cSrcweir 107cdf0e10cSrcweir void SetCellMapMode( const MapMode& rMapMode ); 108cdf0e10cSrcweir void SetPrintTab( SCTAB nNew ); 109cdf0e10cSrcweir void Clear(); 110cdf0e10cSrcweir void AddCellRange( const Rectangle& rRect, const ScRange& rRange, sal_Bool bRepCol, sal_Bool bRepRow, 111cdf0e10cSrcweir const MapMode& rDrawMap ); 112cdf0e10cSrcweir void AddColHeaders( const Rectangle& rRect, SCCOL nStartCol, SCCOL nEndCol, sal_Bool bRepCol ); 113cdf0e10cSrcweir void AddRowHeaders( const Rectangle& rRect, SCROW nStartRow, SCROW nEndRow, sal_Bool bRepRow ); 114cdf0e10cSrcweir void AddHeaderFooter( const Rectangle& rRect, sal_Bool bHeader, sal_Bool bLeft ); 115cdf0e10cSrcweir void AddNoteMark( const Rectangle& rRect, const ScAddress& rPos ); 116cdf0e10cSrcweir void AddNoteText( const Rectangle& rRect, const ScAddress& rPos ); 117cdf0e10cSrcweir GetPrintTab() const118cdf0e10cSrcweir SCTAB GetPrintTab() const { return nPrintTab; } 119cdf0e10cSrcweir 120cdf0e10cSrcweir // Get info on visible columns/rows in the visible area 121cdf0e10cSrcweir void GetTableInfo( const Rectangle& rVisiblePixel, ScPreviewTableInfo& rInfo ) const; 122cdf0e10cSrcweir GetDrawRanges() const123cdf0e10cSrcweir sal_uInt16 GetDrawRanges() const { return nDrawRanges; } 124cdf0e10cSrcweir void GetDrawRange( sal_uInt16 nPos, Rectangle& rPixelRect, MapMode& rMapMode, sal_uInt8& rRangeId ) const; 125cdf0e10cSrcweir 126cdf0e10cSrcweir sal_Bool GetHeaderPosition( Rectangle& rHeaderRect ) const; 127cdf0e10cSrcweir sal_Bool GetFooterPosition( Rectangle& rFooterRect ) const; 128cdf0e10cSrcweir sal_Bool IsHeaderLeft() const; 129cdf0e10cSrcweir sal_Bool IsFooterLeft() const; 130cdf0e10cSrcweir 131cdf0e10cSrcweir long GetNoteCountInRange( const Rectangle& rVisiblePixel, sal_Bool bNoteMarks ) const; 132cdf0e10cSrcweir sal_Bool GetNoteInRange( const Rectangle& rVisiblePixel, long nIndex, sal_Bool bNoteMarks, 133cdf0e10cSrcweir ScAddress& rCellPos, Rectangle& rNoteRect ) const; 134cdf0e10cSrcweir Rectangle GetNoteInRangeOutputRect(const Rectangle& rVisiblePixel, sal_Bool bNoteMarks, 135cdf0e10cSrcweir const ScAddress& aCellPos) const; 136cdf0e10cSrcweir 137cdf0e10cSrcweir // Check if any cells (including column/row headers) are in the visible area 138cdf0e10cSrcweir sal_Bool HasCellsInRange( const Rectangle& rVisiblePixel ) const; 139cdf0e10cSrcweir 140cdf0e10cSrcweir sal_Bool GetCellPosition( const ScAddress& rCellPos, Rectangle& rCellRect ) const; 141cdf0e10cSrcweir 142cdf0e10cSrcweir // returns the rectangle where the EditEngine draws the text of a Header Cell 143cdf0e10cSrcweir // if bColHeader is true it returns the rectangle of the header of the column in rCellPos 144cdf0e10cSrcweir // otherwise of the header of the row in rCellPos 145cdf0e10cSrcweir Rectangle GetHeaderCellOutputRect(const Rectangle& rVisRect, const ScAddress& rCellPos, sal_Bool bColHeader) const; 146cdf0e10cSrcweir Rectangle GetCellOutputRect(const ScAddress& rCellPos) const; 147cdf0e10cSrcweir 148cdf0e10cSrcweir // Query the range and rectangle of the main (non-repeat) cell range. 149cdf0e10cSrcweir // Returns sal_False if not contained. 150cdf0e10cSrcweir sal_Bool GetMainCellRange( ScRange& rRange, Rectangle& rPixRect ) const; 151cdf0e10cSrcweir }; 152cdf0e10cSrcweir 153cdf0e10cSrcweir #endif 154