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 <osl/mutex.hxx>
24 #include <vcl/svapp.hxx>
25 #include <vcl/outdev.hxx>
27 #include <basegfx/polygon/b2dpolypolygon.hxx>
29 #include <com/sun/star/uno/Reference.hxx>
31 #include "outdevprovider.hxx"
46 namespace com::sun::star::awt
53 namespace com::sun::star::drawing
55 struct HomogenMatrix3
;
58 namespace com::sun::star::geometry
62 struct RealRectangle2D
;
66 namespace com::sun::star::rendering
79 bitmapExFromXBitmap( const css::uno::Reference
<
80 css::rendering::XBitmap
>& );
82 /** Setup VCL font and output position
84 @returns false, if no text output should happen
86 bool setupFontTransform( ::Point
& o_rPoint
,
87 vcl::Font
& io_rVCLFont
,
88 const css::rendering::ViewState
& viewState
,
89 const css::rendering::RenderState
& renderState
,
90 ::OutputDevice
const & rOutDev
);
92 void setupFontWidth(const css::geometry::Matrix2D
& rFontMatrix
,
94 OutputDevice
& rOutDev
);
96 /** Predicate, to determine whether polygon is actually an axis-aligned rectangle
98 @return true, if the polygon is a rectangle.
100 bool isRectangle( const ::tools::PolyPolygon
& rPolyPoly
);
103 // Little helper to encapsulate locking into policy class
112 /// To be compatible with CanvasBase mutex concept
113 explicit LocalGuard( const ::osl::Mutex
& ) :
119 SolarMutexGuard aSolarGuard
;
122 class OutDevStateKeeper
125 explicit OutDevStateKeeper( OutputDevice
& rOutDev
) :
126 mpOutDev( &rOutDev
),
127 mbMappingWasEnabled( mpOutDev
->IsMapModeEnabled() ),
128 mnAntiAliasing( mpOutDev
->GetAntialiasing() )
133 explicit OutDevStateKeeper( const OutDevProviderSharedPtr
& rOutDev
) :
134 mpOutDev( rOutDev
? &(rOutDev
->getOutDev()) : nullptr ),
135 mbMappingWasEnabled( mpOutDev
&& mpOutDev
->IsMapModeEnabled() ),
136 mnAntiAliasing( mpOutDev
? mpOutDev
->GetAntialiasing() : AntialiasingFlags::NONE
)
145 mpOutDev
->EnableMapMode( mbMappingWasEnabled
);
146 mpOutDev
->SetAntialiasing( mnAntiAliasing
);
158 mpOutDev
->EnableMapMode(false);
159 mpOutDev
->SetAntialiasing( AntialiasingFlags::Enable
);
163 VclPtr
<OutputDevice
> mpOutDev
;
164 const bool mbMappingWasEnabled
;
165 const AntialiasingFlags mnAntiAliasing
;
168 ::Point
mapRealPoint2D( const css::geometry::RealPoint2D
& rPoint
,
169 const css::rendering::ViewState
& rViewState
,
170 const css::rendering::RenderState
& rRenderState
);
172 ::tools::PolyPolygon
mapPolyPolygon( const ::basegfx::B2DPolyPolygon
& rPoly
,
173 const css::rendering::ViewState
& rViewState
,
174 const css::rendering::RenderState
& rRenderState
);
176 ::BitmapEx
transformBitmap( const BitmapEx
& rBitmap
,
177 const ::basegfx::B2DHomMatrix
& rTransform
);
179 void SetDefaultDeviceAntiAliasing( OutputDevice
* pDevice
);
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */