Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / core / text / txtpaint.hxx
blob1f9700af4c96868d6c69f0655cbb3756d755b6cf
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 .
20 #pragma once
22 #include <vcl/outdev.hxx>
24 class SwRect; // SwSaveClip
25 class SwTextFrame;
27 class SwSaveClip final
29 vcl::Region m_aClip;
30 const bool m_bOn;
31 bool m_bChg;
33 VclPtr<OutputDevice> m_pOut;
34 void ChgClip_( const SwRect &rRect, const SwTextFrame* pFrame,
35 bool bEnlargeRect,
36 sal_Int32 nEnlargeTop,
37 sal_Int32 nEnlargeBottom );
38 public:
39 explicit SwSaveClip(OutputDevice* pOutDev)
40 : m_bOn(pOutDev && pOutDev->IsClipRegion())
41 , m_bChg(false)
42 , m_pOut(pOutDev)
46 ~SwSaveClip();
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; }
58 #ifdef DBG_UTIL
60 class SwDbgOut
62 protected:
63 VclPtr<OutputDevice> pOut;
64 public:
65 inline SwDbgOut( OutputDevice* pOutDev, const bool bOn );
68 class DbgBackColor : public SwDbgOut
70 Color aOldFillColor;
71 public:
72 DbgBackColor( OutputDevice* pOut, const bool bOn );
73 ~DbgBackColor();
76 class DbgRect : public SwDbgOut
78 public:
79 DbgRect( OutputDevice* pOut, const tools::Rectangle &rRect,
80 const bool bOn,
81 Color eColor );
84 inline SwDbgOut::SwDbgOut( OutputDevice* pOutDev, const bool bOn )
85 :pOut( bOn ? pOutDev : nullptr )
86 { }
88 inline DbgBackColor::DbgBackColor( OutputDevice* pOutDev, const bool bOn )
89 :SwDbgOut( pOutDev, bOn )
91 if( pOut )
93 aOldFillColor = pOut->GetFillColor();
94 pOut->SetFillColor( COL_RED );
98 inline DbgBackColor::~DbgBackColor()
100 if( pOut )
102 pOut->SetFillColor( aOldFillColor );
106 inline DbgRect::DbgRect( OutputDevice* pOutDev, const tools::Rectangle &rRect,
107 const bool bOn,
108 Color eColor )
109 : SwDbgOut( pOutDev, bOn )
111 if( pOut )
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 );
124 #endif
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */