merge the formfield patch from ooo-build
[ooovba.git] / sw / source / core / inc / drawdev.hxx
blob04687b0351f126af8f2f84e3530c1e498aeb9a1e
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: drawdev.hxx,v $
10 * $Revision: 1.4 $
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 _DRAWDEV_HXX
32 #define _DRAWDEV_HXX
34 #include "swrect.hxx"
36 #ifndef _OUTDEV_HXX //autogen
37 #include <vcl/outdev.hxx>
38 #endif
40 /*************************************************************************
41 * class SwDrawDev
43 * Alle Draw-Methoden werden um den Offset *pPos verschoben.
44 *************************************************************************/
46 class SwDrawDev
48 OutputDevice *pOut;
49 const Point *pPos;
51 public:
52 inline SwDrawDev( OutputDevice *pOutDev, const Point *pPosition )
53 :pOut(pOutDev), pPos(pPosition) { }
55 inline OutputDevice *GetOut() { return pOut; }
57 // Ausgabemethoden
58 inline void DrawText( const Point& rStart, const String& rTxt,
59 const USHORT nIdx = 0,
60 const USHORT nLen = STRING_LEN );
61 inline void DrawStretchText( const Point& rStart, USHORT nWidth,
62 const String& rTxt,
63 const USHORT nIdx = 0,
64 const USHORT nLen = STRING_LEN );
65 inline void DrawTextArray( const Point& rStart,
66 const String& rTxt,
67 long *pKernArray = 0,
68 const USHORT nIdx = 0,
69 const USHORT nLen = STRING_LEN);
70 inline void DrawLine( const Point& rStart, const Point& rEnd );
71 inline void DrawRect( const SwRect& rRect,
72 const USHORT nHorzRount = 0,
73 const USHORT nVertRound = 0 );
75 inline const Point *GetOrigin() const {return pPos; }
78 /*************************************************************************
79 * SwDrawDev::DrawText
80 *************************************************************************/
82 inline void SwDrawDev::DrawText( const Point& rStart, const String& rTxt,
83 const USHORT nIdx, const USHORT nLen )
85 if( !pPos )
86 pOut->DrawText( rStart, rTxt, nIdx, nLen );
87 else
88 pOut->DrawText( rStart - *pPos, rTxt, nIdx, nLen );
91 /*************************************************************************
92 * SwDrawDev::DrawStretchText
93 *************************************************************************/
95 inline void SwDrawDev::DrawStretchText( const Point& rStart, USHORT nWidth,
96 const String& rTxt, const USHORT nIdx, const USHORT nLen )
98 if( !pPos )
99 pOut->DrawStretchText( rStart, nWidth, rTxt, nIdx, nLen );
100 else
101 pOut->DrawStretchText( rStart - *pPos, nWidth, rTxt, nIdx, nLen );
104 /*************************************************************************
105 * SwDrawDev::DrawTextArray
106 *************************************************************************/
108 inline void SwDrawDev::DrawTextArray( const Point& rStart, const String& rTxt,
109 long *pKernArray, const USHORT nIdx, const USHORT nLen )
111 if( !pPos )
112 pOut->DrawTextArray( rStart, rTxt, pKernArray, nIdx, nLen );
113 else
114 pOut->DrawTextArray( rStart - *pPos, rTxt, pKernArray, nIdx, nLen );
117 /*************************************************************************
118 * SwDrawDev::DrawLine
119 *************************************************************************/
121 inline void SwDrawDev::DrawLine( const Point& rStart, const Point& rEnd )
123 if( !pPos )
124 pOut->DrawLine( rStart, rEnd );
125 else
126 pOut->DrawLine( rStart - *pPos, rEnd - *pPos );
129 /*************************************************************************
130 * SwDrawDev::DrawRect
131 *************************************************************************/
133 inline void SwDrawDev::DrawRect( const SwRect& rRect,
134 const USHORT nHorzRound, const USHORT nVertRound )
136 SwRect aRect( rRect );
137 if( pPos )
138 aRect.Pos() -= *pPos;
139 pOut->DrawRect( aRect.SVRect(), nHorzRound, nVertRound );
143 #endif