1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: txtpaint.hxx,v $
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 ************************************************************************/
32 #include <vcl/outdev.hxx>
34 class SwRect
; // SwSaveClip
37 /*************************************************************************
39 *************************************************************************/
48 void _ChgClip( const SwRect
&rRect
, const SwTxtFrm
* pFrm
,
49 sal_Bool bEnlargeRect
);
51 inline SwSaveClip( OutputDevice
* pOut
);
53 inline void ChgClip( const SwRect
&rRect
, const SwTxtFrm
* pFrm
= 0,
54 sal_Bool bEnlargeRect
= sal_False
)
55 { if( pOut
) _ChgClip( rRect
, pFrm
, bEnlargeRect
); }
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() ),
69 inline SwSaveClip::~SwSaveClip()
76 /*************************************************************************
78 *************************************************************************/
85 inline SwDbgOut( OutputDevice
* pOutDev
, const sal_Bool bOn
= sal_True
);
88 /*************************************************************************
90 *************************************************************************/
97 inline DbgColor( Font
*pFont
, const sal_Bool bOn
= sal_True
,
98 const ColorData eColor
= COL_BLUE
);
102 /*************************************************************************
104 *************************************************************************/
106 class DbgBackColor
: public SwDbgOut
110 DbgBackColor( OutputDevice
* pOut
, const sal_Bool bOn
= sal_True
,
111 ColorData nColor
= COL_YELLOW
);
115 /*************************************************************************
117 *************************************************************************/
119 class DbgRect
: public SwDbgOut
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 )
142 aColor
= pFnt
->GetColor();
143 pFnt
->SetColor( Color( eColor
) );
147 inline DbgColor::~DbgColor()
150 pFnt
->SetColor( aColor
);
153 inline DbgBackColor::DbgBackColor( OutputDevice
* pOutDev
, const sal_Bool bOn
,
155 :SwDbgOut( pOutDev
, bOn
)
159 aOldFillColor
= pOut
->GetFillColor();
160 pOut
->SetFillColor( Color(eColor
) );
164 inline DbgBackColor::~DbgBackColor()
168 pOut
->SetFillColor( aOldFillColor
);
172 inline DbgRect::DbgRect( OutputDevice
* pOutDev
, const Rectangle
&rRect
,
175 : SwDbgOut( pOutDev
, bOn
)
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
);