Update ooo320-m1
[ooovba.git] / sw / source / core / text / txtpaint.hxx
blob81b92bfabdf5db2fd2e1ef64a90005d7e146c2e8
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: txtpaint.hxx,v $
10 * $Revision: 1.9 $
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 ************************************************************************/
30 #ifndef _TXTPAINT_HXX
31 #define _TXTPAINT_HXX
32 #include <vcl/outdev.hxx>
34 class SwRect; // SwSaveClip
35 #include <txtfrm.hxx>
37 /*************************************************************************
38 * class SwSaveClip
39 *************************************************************************/
41 class SwSaveClip
43 Region aClip;
44 const sal_Bool bOn;
45 sal_Bool bChg;
46 protected:
47 OutputDevice* pOut;
48 void _ChgClip( const SwRect &rRect, const SwTxtFrm* pFrm,
49 sal_Bool bEnlargeRect );
50 public:
51 inline SwSaveClip( OutputDevice* pOut );
52 inline ~SwSaveClip();
53 inline void ChgClip( const SwRect &rRect, const SwTxtFrm* pFrm = 0,
54 sal_Bool bEnlargeRect = sal_False)
55 { if( pOut ) _ChgClip( rRect, pFrm, bEnlargeRect ); }
56 void Reset();
57 inline sal_Bool IsOn() const { return bOn; }
58 inline sal_Bool IsChg() const { return bChg; }
59 inline sal_Bool IsOut() const { return 0 != pOut; }
60 inline OutputDevice *GetOut() { return pOut; }
63 inline SwSaveClip::SwSaveClip( OutputDevice* pOutDev ) :
64 bOn( pOutDev && pOutDev->IsClipRegion() ),
65 bChg( sal_False ),
66 pOut(pOutDev)
69 inline SwSaveClip::~SwSaveClip()
71 Reset();
74 #ifndef PRODUCT
76 /*************************************************************************
77 * class SwDbgOut
78 *************************************************************************/
80 class SwDbgOut
82 protected:
83 OutputDevice* pOut;
84 public:
85 inline SwDbgOut( OutputDevice* pOutDev, const sal_Bool bOn = sal_True );
88 /*************************************************************************
89 * class DbgColor
90 *************************************************************************/
92 class DbgColor
94 Font *pFnt;
95 Color aColor;
96 public:
97 inline DbgColor( Font *pFont, const sal_Bool bOn = sal_True,
98 const ColorData eColor = COL_BLUE );
99 inline ~DbgColor();
102 /*************************************************************************
103 * class DbgBrush
104 *************************************************************************/
106 class DbgBackColor : public SwDbgOut
108 Color aOldFillColor;
109 public:
110 DbgBackColor( OutputDevice* pOut, const sal_Bool bOn = sal_True,
111 ColorData nColor = COL_YELLOW );
112 ~DbgBackColor();
115 /*************************************************************************
116 * class DbgRect
117 *************************************************************************/
119 class DbgRect : public SwDbgOut
121 public:
122 DbgRect( OutputDevice* pOut, const Rectangle &rRect,
123 const sal_Bool bOn = sal_True,
124 ColorData eColor = COL_LIGHTBLUE );
127 /*************************************************************************
128 * Inline-Implementierung
129 *************************************************************************/
131 inline SwDbgOut::SwDbgOut( OutputDevice* pOutDev, const sal_Bool bOn )
132 :pOut( bOn ? pOutDev : 0 )
136 inline DbgColor::DbgColor( Font *pFont, const sal_Bool bOn,
137 const ColorData eColor )
138 :pFnt( bOn ? pFont : 0 )
140 if( pFnt )
142 aColor = pFnt->GetColor();
143 pFnt->SetColor( Color( eColor ) );
147 inline DbgColor::~DbgColor()
149 if( pFnt )
150 pFnt->SetColor( aColor );
153 inline DbgBackColor::DbgBackColor( OutputDevice* pOutDev, const sal_Bool bOn,
154 ColorData eColor )
155 :SwDbgOut( pOutDev, bOn )
157 if( pOut )
159 aOldFillColor = pOut->GetFillColor();
160 pOut->SetFillColor( Color(eColor) );
164 inline DbgBackColor::~DbgBackColor()
166 if( pOut )
168 pOut->SetFillColor( aOldFillColor );
172 inline DbgRect::DbgRect( OutputDevice* pOutDev, const Rectangle &rRect,
173 const sal_Bool bOn,
174 ColorData eColor )
175 : SwDbgOut( pOutDev, bOn )
177 if( pOut )
179 const Color aColor( eColor );
180 Color aLineColor = pOut->GetLineColor();
181 pOut->SetLineColor( aColor );
182 Color aFillColor = pOut->GetFillColor();
183 pOut->SetFillColor( Color(COL_TRANSPARENT) );
184 pOut->DrawRect( rRect );
185 pOut->SetLineColor( aLineColor );
186 pOut->SetFillColor( aFillColor );
190 #endif
194 #endif