merge the formfield patch from ooo-build
[ooovba.git] / sc / source / ui / inc / prevloc.hxx
blob5e8c24d7bf66ad2c74063d94973258ace121d9ae
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: prevloc.hxx,v $
10 * $Revision: 1.12.32.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_PREVLOC_HXX
32 #define SC_PREVLOC_HXX
34 #include "address.hxx"
35 #include <tools/list.hxx>
36 #include <vcl/mapmod.hxx>
37 #include <sal/types.h>
40 #define SC_PREVIEW_MAXRANGES 4
41 #define SC_PREVIEW_RANGE_EDGE 0
42 #define SC_PREVIEW_RANGE_REPCOL 1
43 #define SC_PREVIEW_RANGE_REPROW 2
44 #define SC_PREVIEW_RANGE_TAB 3
46 class OutputDevice;
47 class String;
48 class Point;
49 class Rectangle;
50 class ScAddress;
51 class ScRange;
52 class ScDocument;
54 struct ScPreviewColRowInfo
56 BOOL bIsHeader;
57 SCCOLROW nDocIndex;
58 long nPixelStart;
59 long nPixelEnd;
61 void Set( BOOL bHeader, SCCOLROW nIndex, long nStart, long nEnd )
63 bIsHeader = bHeader;
64 nDocIndex = nIndex;
65 nPixelStart = nStart;
66 nPixelEnd = nEnd;
70 class ScPreviewTableInfo
72 SCTAB nTab;
73 SCCOL nCols;
74 SCROW nRows;
75 ScPreviewColRowInfo* pColInfo;
76 ScPreviewColRowInfo* pRowInfo;
78 public:
79 ScPreviewTableInfo();
80 ~ScPreviewTableInfo();
82 SCTAB GetTab() const { return nTab; }
83 SCCOL GetCols() const { return nCols; }
84 SCROW GetRows() const { return nRows; }
85 const ScPreviewColRowInfo* GetColInfo() const { return pColInfo; }
86 const ScPreviewColRowInfo* GetRowInfo() const { return pRowInfo; }
88 void SetTab( SCTAB nNewTab );
89 void SetColInfo( SCCOL nCount, ScPreviewColRowInfo* pNewInfo );
90 void SetRowInfo( SCROW nCount, ScPreviewColRowInfo* pNewInfo );
91 void LimitToArea( const Rectangle& rPixelArea );
95 class ScPreviewLocationData
97 OutputDevice* pWindow;
98 ScDocument* pDoc;
99 MapMode aCellMapMode;
100 MapMode aDrawMapMode[SC_PREVIEW_MAXRANGES];
101 Rectangle aDrawRectangle[SC_PREVIEW_MAXRANGES];
102 sal_uInt8 aDrawRangeId[SC_PREVIEW_MAXRANGES];
103 USHORT nDrawRanges;
104 SCTAB nPrintTab;
105 List aEntries;
107 //UNUSED2008-05 ScAddress GetCellFromRange( const Size& rOffsetPixel, const ScRange& rRange ) const;
108 Rectangle GetOffsetPixel( const ScAddress& rCellPos, const ScRange& rRange ) const;
110 public:
111 ScPreviewLocationData( ScDocument* pDocument, OutputDevice* pWin );
112 ~ScPreviewLocationData();
114 void SetCellMapMode( const MapMode& rMapMode );
115 void SetPrintTab( SCTAB nNew );
116 void Clear();
117 void AddCellRange( const Rectangle& rRect, const ScRange& rRange, BOOL bRepCol, BOOL bRepRow,
118 const MapMode& rDrawMap );
119 void AddColHeaders( const Rectangle& rRect, SCCOL nStartCol, SCCOL nEndCol, BOOL bRepCol );
120 void AddRowHeaders( const Rectangle& rRect, SCROW nStartRow, SCROW nEndRow, BOOL bRepRow );
121 void AddHeaderFooter( const Rectangle& rRect, BOOL bHeader, BOOL bLeft );
122 void AddNoteMark( const Rectangle& rRect, const ScAddress& rPos );
123 void AddNoteText( const Rectangle& rRect, const ScAddress& rPos );
125 SCTAB GetPrintTab() const { return nPrintTab; }
127 // Get info on visible columns/rows in the visible area
128 void GetTableInfo( const Rectangle& rVisiblePixel, ScPreviewTableInfo& rInfo ) const;
130 USHORT GetDrawRanges() const { return nDrawRanges; }
131 void GetDrawRange( USHORT nPos, Rectangle& rPixelRect, MapMode& rMapMode, sal_uInt8& rRangeId ) const;
133 BOOL GetHeaderPosition( Rectangle& rHeaderRect ) const;
134 BOOL GetFooterPosition( Rectangle& rFooterRect ) const;
135 BOOL IsHeaderLeft() const;
136 BOOL IsFooterLeft() const;
138 long GetNoteCountInRange( const Rectangle& rVisiblePixel, BOOL bNoteMarks ) const;
139 BOOL GetNoteInRange( const Rectangle& rVisiblePixel, long nIndex, BOOL bNoteMarks,
140 ScAddress& rCellPos, Rectangle& rNoteRect ) const;
141 Rectangle GetNoteInRangeOutputRect(const Rectangle& rVisiblePixel, BOOL bNoteMarks,
142 const ScAddress& aCellPos) const;
144 // Check if any cells (including column/row headers) are in the visible area
145 BOOL HasCellsInRange( const Rectangle& rVisiblePixel ) const;
147 BOOL GetCellPosition( const ScAddress& rCellPos, Rectangle& rCellRect ) const;
149 // returns the rectangle where the EditEngine draws the text of a Header Cell
150 // if bColHeader is true it returns the rectangle of the header of the column in rCellPos
151 // otherwise of the header of the row in rCellPos
152 Rectangle GetHeaderCellOutputRect(const Rectangle& rVisRect, const ScAddress& rCellPos, sal_Bool bColHeader) const;
153 Rectangle GetCellOutputRect(const ScAddress& rCellPos) const;
155 // Query the range and rectangle of the main (non-repeat) cell range.
156 // Returns FALSE if not contained.
157 BOOL GetMainCellRange( ScRange& rRange, Rectangle& rPixRect ) const;
160 #endif