author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 06 Jul 2010 15:10:48 +0300 | |
changeset 30 | 5dc02b23752f |
parent 0 | 1918ee327afb |
permissions | -rw-r--r-- |
0 | 1 |
/* |
2 |
* Copyright (C) 2007 Alp Toker <alp@atoker.com> |
|
3 |
* Copyright (C) 2007 Apple Inc. |
|
4 |
* |
|
5 |
* This library is free software; you can redistribute it and/or |
|
6 |
* modify it under the terms of the GNU Library General Public |
|
7 |
* License as published by the Free Software Foundation; either |
|
8 |
* version 2 of the License, or (at your option) any later version. |
|
9 |
* |
|
10 |
* This library is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 |
* Library General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU Library General Public License |
|
16 |
* along with this library; see the file COPYING.LIB. If not, write to |
|
17 |
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
18 |
* Boston, MA 02110-1301, USA. |
|
19 |
*/ |
|
20 |
||
21 |
#ifndef PrintContext_h |
|
22 |
#define PrintContext_h |
|
23 |
||
24 |
#include <wtf/Vector.h> |
|
25 |
||
26 |
namespace WebCore { |
|
27 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
28 |
class Element; |
0 | 29 |
class Frame; |
30 |
class FloatRect; |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
31 |
class FloatSize; |
0 | 32 |
class GraphicsContext; |
33 |
class IntRect; |
|
34 |
||
35 |
class PrintContext { |
|
36 |
public: |
|
37 |
PrintContext(Frame*); |
|
38 |
~PrintContext(); |
|
39 |
||
40 |
int pageCount() const; |
|
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
41 |
const IntRect& pageRect(int pageNumber) const; |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
42 |
const Vector<IntRect>& pageRects() const { return m_pageRects; } |
0 | 43 |
|
44 |
void computePageRects(const FloatRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, float& outPageHeight); |
|
45 |
||
46 |
// TODO: eliminate width param |
|
47 |
void begin(float width); |
|
48 |
||
49 |
// TODO: eliminate width param |
|
50 |
void spoolPage(GraphicsContext& ctx, int pageNumber, float width); |
|
51 |
||
52 |
void end(); |
|
53 |
||
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
54 |
// Used by layout tests. |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
55 |
static int pageNumberForElement(Element*, const FloatSize& pageSizeInPixels); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
56 |
static int numberOfPages(Frame*, const FloatSize& pageSizeInPixels); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
57 |
|
0 | 58 |
protected: |
30
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
59 |
void computePageRectsWithPageSize(const FloatSize& pageSizeInPixels, float userScaleFactor); |
5dc02b23752f
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
60 |
|
0 | 61 |
Frame* m_frame; |
62 |
Vector<IntRect> m_pageRects; |
|
63 |
}; |
|
64 |
||
65 |
} |
|
66 |
||
67 |
#endif |