Move setting of LD_LIBRARY_PATH closer to invocation of cppunittester
[LibreOffice.git] / canvas / source / vcl / impltools.hxx
blob030d5341b5b9422f4a386480d3cdc936297c82b8
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 <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"
34 class OutputDevice;
35 class Point;
36 class Size;
38 namespace basegfx
40 namespace matrix
42 class B2DHomMatrix;
46 namespace com::sun::star::awt
48 struct Point;
49 struct Size;
50 struct Rectangle;
53 namespace com::sun::star::drawing
55 struct HomogenMatrix3;
58 namespace com::sun::star::geometry
60 struct RealPoint2D;
61 struct RealSize2D;
62 struct RealRectangle2D;
63 struct Matrix2D;
66 namespace com::sun::star::rendering
68 struct RenderState;
69 struct ViewState;
70 class XBitmap;
74 namespace vclcanvas
76 namespace tools
78 ::BitmapEx
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,
93 vcl::Font& rFont,
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
104 class LocalGuard
106 public:
107 LocalGuard() :
108 aSolarGuard()
112 /// To be compatible with CanvasBase mutex concept
113 explicit LocalGuard( const ::osl::Mutex& ) :
114 aSolarGuard()
118 private:
119 SolarMutexGuard aSolarGuard;
122 class OutDevStateKeeper
124 public:
125 explicit OutDevStateKeeper( OutputDevice& rOutDev ) :
126 mpOutDev( &rOutDev ),
127 mbMappingWasEnabled( mpOutDev->IsMapModeEnabled() ),
128 mnAntiAliasing( mpOutDev->GetAntialiasing() )
130 init();
133 explicit OutDevStateKeeper( const OutDevProviderSharedPtr& rOutDev ) :
134 mpOutDev( rOutDev ? &(rOutDev->getOutDev()) : nullptr ),
135 mbMappingWasEnabled( mpOutDev && mpOutDev->IsMapModeEnabled() ),
136 mnAntiAliasing( mpOutDev ? mpOutDev->GetAntialiasing() : AntialiasingFlags::NONE )
138 init();
141 ~OutDevStateKeeper()
143 if( mpOutDev )
145 mpOutDev->EnableMapMode( mbMappingWasEnabled );
146 mpOutDev->SetAntialiasing( mnAntiAliasing );
148 mpOutDev->Pop();
152 private:
153 void init()
155 if( mpOutDev )
157 mpOutDev->Push();
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: */