Impress Remote 1.0.5, tag sdremote-1.0.5
[LibreOffice.git] / sw / source / core / text / txtpaint.hxx
blobaa466966c0100e2d31d0702f0ac366b32c4c1a04
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef _TXTPAINT_HXX
20 #define _TXTPAINT_HXX
21 #include <vcl/outdev.hxx>
23 class SwRect; // SwSaveClip
24 #include <txtfrm.hxx>
26 /*************************************************************************
27 * class SwSaveClip
28 *************************************************************************/
30 class SwSaveClip
32 Region aClip;
33 const sal_Bool bOn;
34 sal_Bool bChg;
35 protected:
36 OutputDevice* pOut;
37 void _ChgClip( const SwRect &rRect, const SwTxtFrm* pFrm,
38 sal_Bool bEnlargeRect );
39 public:
40 inline SwSaveClip( OutputDevice* pOut );
41 inline ~SwSaveClip();
42 inline void ChgClip( const SwRect &rRect, const SwTxtFrm* pFrm = 0,
43 sal_Bool bEnlargeRect = sal_False)
44 { if( pOut ) _ChgClip( rRect, pFrm, bEnlargeRect ); }
45 void Reset();
46 inline sal_Bool IsOn() const { return bOn; }
47 inline sal_Bool IsChg() const { return bChg; }
48 inline sal_Bool IsOut() const { return 0 != pOut; }
49 inline OutputDevice *GetOut() { return pOut; }
52 inline SwSaveClip::SwSaveClip( OutputDevice* pOutDev ) :
53 bOn( pOutDev && pOutDev->IsClipRegion() ),
54 bChg( sal_False ),
55 pOut(pOutDev)
58 inline SwSaveClip::~SwSaveClip()
60 Reset();
63 #ifdef DBG_UTIL
65 /*************************************************************************
66 * class SwDbgOut
67 *************************************************************************/
69 class SwDbgOut
71 protected:
72 OutputDevice* pOut;
73 public:
74 inline SwDbgOut( OutputDevice* pOutDev, const sal_Bool bOn = sal_True );
77 /*************************************************************************
78 * class DbgBrush
79 *************************************************************************/
81 class DbgBackColor : public SwDbgOut
83 Color aOldFillColor;
84 public:
85 DbgBackColor( OutputDevice* pOut, const sal_Bool bOn = sal_True,
86 ColorData nColor = COL_YELLOW );
87 ~DbgBackColor();
90 /*************************************************************************
91 * class DbgRect
92 *************************************************************************/
94 class DbgRect : public SwDbgOut
96 public:
97 DbgRect( OutputDevice* pOut, const Rectangle &rRect,
98 const sal_Bool bOn = sal_True,
99 ColorData eColor = COL_LIGHTBLUE );
102 /*************************************************************************
103 * Inline-Implementierung
104 *************************************************************************/
106 inline SwDbgOut::SwDbgOut( OutputDevice* pOutDev, const sal_Bool bOn )
107 :pOut( bOn ? pOutDev : 0 )
111 inline DbgBackColor::DbgBackColor( OutputDevice* pOutDev, const sal_Bool bOn,
112 ColorData eColor )
113 :SwDbgOut( pOutDev, bOn )
115 if( pOut )
117 aOldFillColor = pOut->GetFillColor();
118 pOut->SetFillColor( Color(eColor) );
122 inline DbgBackColor::~DbgBackColor()
124 if( pOut )
126 pOut->SetFillColor( aOldFillColor );
130 inline DbgRect::DbgRect( OutputDevice* pOutDev, const Rectangle &rRect,
131 const sal_Bool bOn,
132 ColorData eColor )
133 : SwDbgOut( pOutDev, bOn )
135 if( pOut )
137 const Color aColor( eColor );
138 Color aLineColor = pOut->GetLineColor();
139 pOut->SetLineColor( aColor );
140 Color aFillColor = pOut->GetFillColor();
141 pOut->SetFillColor( Color(COL_TRANSPARENT) );
142 pOut->DrawRect( rRect );
143 pOut->SetLineColor( aLineColor );
144 pOut->SetFillColor( aFillColor );
148 #endif
152 #endif
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */