1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_PREVLOC_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_PREVLOC_HXX
23 #include <boost/ptr_container/ptr_list.hpp>
25 #include <sal/types.h>
26 #include <vcl/mapmod.hxx>
28 #include "address.hxx"
30 #define SC_PREVIEW_MAXRANGES 4
31 #define SC_PREVIEW_RANGE_EDGE 0
32 #define SC_PREVIEW_RANGE_REPCOL 1
33 #define SC_PREVIEW_RANGE_REPROW 2
34 #define SC_PREVIEW_RANGE_TAB 3
41 struct ScPreviewLocationEntry
;
43 struct ScPreviewColRowInfo
50 void Set( bool bHeader
, SCCOLROW nIndex
, long nStart
, long nEnd
)
59 class ScPreviewTableInfo
64 ScPreviewColRowInfo
* pColInfo
;
65 ScPreviewColRowInfo
* pRowInfo
;
69 ~ScPreviewTableInfo();
71 SCTAB
GetTab() const { return nTab
; }
72 SCCOL
GetCols() const { return nCols
; }
73 SCROW
GetRows() const { return nRows
; }
74 const ScPreviewColRowInfo
* GetColInfo() const { return pColInfo
; }
75 const ScPreviewColRowInfo
* GetRowInfo() const { return pRowInfo
; }
77 void SetTab( SCTAB nNewTab
);
78 void SetColInfo( SCCOL nCount
, ScPreviewColRowInfo
* pNewInfo
);
79 void SetRowInfo( SCROW nCount
, ScPreviewColRowInfo
* pNewInfo
);
80 void LimitToArea( const Rectangle
& rPixelArea
);
83 class ScPreviewLocationData
85 VclPtr
<OutputDevice
> pWindow
;
88 MapMode aDrawMapMode
[SC_PREVIEW_MAXRANGES
];
89 Rectangle aDrawRectangle
[SC_PREVIEW_MAXRANGES
];
90 sal_uInt8 aDrawRangeId
[SC_PREVIEW_MAXRANGES
];
91 sal_uInt16 nDrawRanges
;
93 boost::ptr_list
<ScPreviewLocationEntry
> aEntries
;
95 Rectangle
GetOffsetPixel( const ScAddress
& rCellPos
, const ScRange
& rRange
) const;
98 ScPreviewLocationData( ScDocument
* pDocument
, OutputDevice
* pWin
);
99 ~ScPreviewLocationData();
101 void SetCellMapMode( const MapMode
& rMapMode
);
102 void SetPrintTab( SCTAB nNew
);
104 void AddCellRange( const Rectangle
& rRect
, const ScRange
& rRange
, bool bRepCol
, bool bRepRow
,
105 const MapMode
& rDrawMap
);
106 void AddColHeaders( const Rectangle
& rRect
, SCCOL nStartCol
, SCCOL nEndCol
, bool bRepCol
);
107 void AddRowHeaders( const Rectangle
& rRect
, SCROW nStartRow
, SCROW nEndRow
, bool bRepRow
);
108 void AddHeaderFooter( const Rectangle
& rRect
, bool bHeader
, bool bLeft
);
109 void AddNoteMark( const Rectangle
& rRect
, const ScAddress
& rPos
);
110 void AddNoteText( const Rectangle
& rRect
, const ScAddress
& rPos
);
112 SCTAB
GetPrintTab() const { return nPrintTab
; }
114 // Get info on visible columns/rows in the visible area
115 void GetTableInfo( const Rectangle
& rVisiblePixel
, ScPreviewTableInfo
& rInfo
) const;
117 sal_uInt16
GetDrawRanges() const { return nDrawRanges
; }
118 void GetDrawRange( sal_uInt16 nPos
, Rectangle
& rPixelRect
, MapMode
& rMapMode
, sal_uInt8
& rRangeId
) const;
120 bool GetHeaderPosition( Rectangle
& rHeaderRect
) const;
121 bool GetFooterPosition( Rectangle
& rFooterRect
) const;
122 bool IsHeaderLeft() const;
123 bool IsFooterLeft() const;
125 long GetNoteCountInRange( const Rectangle
& rVisiblePixel
, bool bNoteMarks
) const;
126 bool GetNoteInRange( const Rectangle
& rVisiblePixel
, long nIndex
, bool bNoteMarks
,
127 ScAddress
& rCellPos
, Rectangle
& rNoteRect
) const;
128 Rectangle
GetNoteInRangeOutputRect(const Rectangle
& rVisiblePixel
, bool bNoteMarks
,
129 const ScAddress
& aCellPos
) const;
131 // Check if any cells (including column/row headers) are in the visible area
132 bool HasCellsInRange( const Rectangle
& rVisiblePixel
) const;
134 bool GetCellPosition( const ScAddress
& rCellPos
, Rectangle
& rCellRect
) const;
136 // returns the rectangle where the EditEngine draws the text of a Header Cell
137 // if bColHeader is true it returns the rectangle of the header of the column in rCellPos
138 // otherwise of the header of the row in rCellPos
139 Rectangle
GetHeaderCellOutputRect(const Rectangle
& rVisRect
, const ScAddress
& rCellPos
, bool bColHeader
) const;
140 Rectangle
GetCellOutputRect(const ScAddress
& rCellPos
) const;
142 // Query the range and rectangle of the main (non-repeat) cell range.
143 // Returns sal_False if not contained.
144 bool GetMainCellRange( ScRange
& rRange
, Rectangle
& rPixRect
) const;
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */