1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <vcl/outdev.hxx>
24 class SwRect
; // SwSaveClip
27 class SwSaveClip final
33 VclPtr
<OutputDevice
> m_pOut
;
34 void ChgClip_( const SwRect
&rRect
, const SwTextFrame
* pFrame
,
36 sal_Int32 nEnlargeTop
,
37 sal_Int32 nEnlargeBottom
);
39 explicit SwSaveClip(OutputDevice
* pOutDev
)
40 : m_bOn(pOutDev
&& pOutDev
->IsClipRegion())
47 void ChgClip( const SwRect
&rRect
, const SwTextFrame
* pFrame
= nullptr,
48 bool bEnlargeRect
= false,
49 sal_Int32 nEnlargeTop
= 0,
50 sal_Int32 nEnlargeBottom
= 0)
51 { if( m_pOut
) ChgClip_( rRect
, pFrame
,
52 bEnlargeRect
, nEnlargeTop
, nEnlargeBottom
); }
53 bool IsOn() const { return m_bOn
; }
54 bool IsChg() const { return m_bChg
; }
63 VclPtr
<OutputDevice
> pOut
;
65 inline SwDbgOut( OutputDevice
* pOutDev
, const bool bOn
);
68 class DbgBackColor
: public SwDbgOut
72 DbgBackColor( OutputDevice
* pOut
, const bool bOn
);
76 class DbgRect
: public SwDbgOut
79 DbgRect( OutputDevice
* pOut
, const tools::Rectangle
&rRect
,
84 inline SwDbgOut::SwDbgOut( OutputDevice
* pOutDev
, const bool bOn
)
85 :pOut( bOn
? pOutDev
: nullptr )
88 inline DbgBackColor::DbgBackColor( OutputDevice
* pOutDev
, const bool bOn
)
89 :SwDbgOut( pOutDev
, bOn
)
93 aOldFillColor
= pOut
->GetFillColor();
94 pOut
->SetFillColor( COL_RED
);
98 inline DbgBackColor::~DbgBackColor()
102 pOut
->SetFillColor( aOldFillColor
);
106 inline DbgRect::DbgRect( OutputDevice
* pOutDev
, const tools::Rectangle
&rRect
,
109 : SwDbgOut( pOutDev
, bOn
)
113 const Color
aColor( eColor
);
114 Color aLineColor
= pOut
->GetLineColor();
115 pOut
->SetLineColor( aColor
);
116 Color aFillColor
= pOut
->GetFillColor();
117 pOut
->SetFillColor( COL_TRANSPARENT
);
118 pOut
->DrawRect( rRect
);
119 pOut
->SetLineColor( aLineColor
);
120 pOut
->SetFillColor( aFillColor
);
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */