fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / canvas / source / vcl / impltools.hxx
blob7c2a506181da6eb888bc208bf3a7fc2aea52d59d
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 #ifndef _VCLCANVAS_TOOLS_HXX
21 #define _VCLCANVAS_TOOLS_HXX
23 #include <osl/mutex.hxx>
25 #include <vcl/svapp.hxx>
26 #include <vcl/outdev.hxx>
27 #include <vcl/solarmutex.hxx>
29 #include <basegfx/polygon/b2dpolypolygon.hxx>
31 #include <com/sun/star/uno/Reference.hxx>
32 #include <com/sun/star/uno/Sequence.hxx>
34 #include <canvas/vclwrapper.hxx>
35 #include "outdevprovider.hxx"
38 class OutputDevice;
39 class Point;
40 class Size;
42 namespace basegfx
44 namespace matrix
46 class B2DHomMatrix;
50 namespace com { namespace sun { namespace star { namespace awt
52 struct Point;
53 struct Size;
54 struct Rectangle;
55 } } } }
57 namespace com { namespace sun { namespace star { namespace drawing
59 struct HomogenMatrix3;
60 } } } }
62 namespace com { namespace sun { namespace star { namespace geometry
64 struct RealPoint2D;
65 struct RealSize2D;
66 struct RealRectangle2D;
67 } } } }
69 namespace com { namespace sun { namespace star { namespace rendering
71 struct RenderState;
72 struct ViewState;
73 class XBitmap;
74 } } } }
77 namespace vclcanvas
79 namespace tools
81 ::BitmapEx
82 bitmapExFromXBitmap( const ::com::sun::star::uno::Reference<
83 ::com::sun::star::rendering::XBitmap >& );
85 /** Setup VCL font and output position
87 @returns false, if no text output should happen
89 bool setupFontTransform( ::Point& o_rPoint,
90 ::Font& io_rVCLFont,
91 const ::com::sun::star::rendering::ViewState& viewState,
92 const ::com::sun::star::rendering::RenderState& renderState,
93 ::OutputDevice& rOutDev );
95 /** Predicate, to determine whether polygon is actually an axis-aligned rectangle
97 @return true, if the polygon is a rectangle.
99 bool isRectangle( const PolyPolygon& rPolyPoly );
102 // Little helper to encapsulate locking into policy class
103 class LocalGuard
105 public:
106 LocalGuard() :
107 aSolarGuard()
111 /// To be compatible with CanvasBase mutex concept
112 LocalGuard( const ::osl::Mutex& ) :
113 aSolarGuard()
117 private:
118 SolarMutexGuard aSolarGuard;
121 class OutDevStateKeeper
123 public:
124 explicit OutDevStateKeeper( OutputDevice& rOutDev ) :
125 mpOutDev( &rOutDev ),
126 mbMappingWasEnabled( mpOutDev->IsMapModeEnabled() )
128 init();
131 explicit OutDevStateKeeper( const OutDevProviderSharedPtr& rOutDev ) :
132 mpOutDev( rOutDev.get() ? &(rOutDev->getOutDev()) : NULL ),
133 mbMappingWasEnabled( mpOutDev ? mpOutDev->IsMapModeEnabled() : false )
135 init();
138 ~OutDevStateKeeper()
140 if( mpOutDev )
142 mpOutDev->EnableMapMode( mbMappingWasEnabled );
143 mpOutDev->Pop();
147 private:
148 void init()
150 if( mpOutDev )
152 mpOutDev->Push();
153 mpOutDev->EnableMapMode(sal_False);
157 OutputDevice* mpOutDev;
158 const bool mbMappingWasEnabled;
161 ::Point mapRealPoint2D( const ::com::sun::star::geometry::RealPoint2D& rPoint,
162 const ::com::sun::star::rendering::ViewState& rViewState,
163 const ::com::sun::star::rendering::RenderState& rRenderState );
165 ::PolyPolygon mapPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly,
166 const ::com::sun::star::rendering::ViewState& rViewState,
167 const ::com::sun::star::rendering::RenderState& rRenderState );
169 enum ModulationMode
171 MODULATE_NONE,
172 MODULATE_WITH_DEVICECOLOR
175 ::BitmapEx transformBitmap( const BitmapEx& rBitmap,
176 const ::basegfx::B2DHomMatrix& rTransform,
177 const ::com::sun::star::uno::Sequence< double >& rDeviceColor,
178 ModulationMode eModulationMode );
183 #endif /* _VCLCANVAS_TOOLS_HXX */
185 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */