fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / vcl / graph.hxx
blob4f1facae5395ef3130c7c802bf05875ec67ba525
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 _SV_GRAPH_HXX
21 #define _SV_GRAPH_HXX
23 #include <tools/stream.hxx>
24 #include <vcl/dllapi.h>
25 #include <tools/solar.h>
26 #include <vcl/bitmap.hxx>
27 #include <vcl/bitmapex.hxx>
28 #include <vcl/animate.hxx>
29 #include <vcl/gdimtf.hxx>
30 #include <vcl/graph.h>
31 #include <vcl/gfxlink.hxx>
32 #include <com/sun/star/uno/Reference.hxx>
33 #include <vcl/svgdata.hxx>
35 namespace com { namespace sun { namespace star { namespace graphic { class XGraphic;} } } }
37 // -----------
38 // - Graphic -
39 // -----------
41 class ImpGraphic;
42 class OutputDevice;
43 class Font;
44 class GfxLink;
46 class VCL_DLLPUBLIC GraphicConversionParameters
48 private:
49 Size maSizePixel; // default is (0,0)
51 // bitfield
52 unsigned mbUnlimitedSize : 1; // default is false
53 unsigned mbAntiAliase : 1; // default is false
54 unsigned mbSnapHorVerLines : 1; // default is false
56 public:
57 GraphicConversionParameters(
58 const Size& rSizePixel = Size(),
59 bool bUnlimitedSize = false,
60 bool bAntiAliase = false,
61 bool bSnapHorVerLines = false)
62 : maSizePixel(rSizePixel),
63 mbUnlimitedSize(bUnlimitedSize),
64 mbAntiAliase(bAntiAliase),
65 mbSnapHorVerLines(bSnapHorVerLines)
69 // data read access
70 const Size getSizePixel() const { return maSizePixel; }
71 bool getUnlimitedSize() const { return mbUnlimitedSize; }
72 bool getAntiAliase() const { return mbAntiAliase; }
73 bool getSnapHorVerLines() const { return mbSnapHorVerLines; }
76 class VCL_DLLPUBLIC Graphic : public SvDataCopyStream
78 private:
80 ImpGraphic* mpImpGraphic;
82 public:
84 SAL_DLLPRIVATE void ImplTestRefCount();
85 SAL_DLLPRIVATE ImpGraphic* ImplGetImpGraphic() const { return mpImpGraphic; }
87 public:
89 TYPEINFO();
91 Graphic();
92 Graphic( const Graphic& rGraphic );
93 Graphic( const Bitmap& rBmp );
94 Graphic( const BitmapEx& rBmpEx );
95 Graphic( const SvgDataPtr& rSvgDataPtr );
96 Graphic( const Animation& rAnimation );
97 Graphic( const GDIMetaFile& rMtf );
98 Graphic( const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rxGraphic );
99 virtual ~Graphic();
101 Graphic& operator=( const Graphic& rGraphic );
102 sal_Bool operator==( const Graphic& rGraphic ) const;
103 sal_Bool operator!=( const Graphic& rGraphic ) const;
104 sal_Bool operator!() const;
106 void Clear();
108 GraphicType GetType() const;
109 void SetDefaultType();
110 sal_Bool IsSupportedGraphic() const;
112 sal_Bool IsTransparent() const;
113 sal_Bool IsAlpha() const;
114 sal_Bool IsAnimated() const;
115 sal_Bool IsEPS() const;
117 // #i102089# Access of Bitmap potentially will have to rasterconvert the Graphic
118 // if it is a MetaFile. To be able to control this conversion it is necessary to
119 // allow giving parameters which control AntiAliasing and LineSnapping of the
120 // MetaFile when played. Defaults will use a no-AAed, not snapped conversion as
121 // before.
122 Bitmap GetBitmap(const GraphicConversionParameters& rParameters = GraphicConversionParameters()) const;
123 BitmapEx GetBitmapEx(const GraphicConversionParameters& rParameters = GraphicConversionParameters()) const;
125 Animation GetAnimation() const;
126 const GDIMetaFile& GetGDIMetaFile() const;
128 ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > GetXGraphic() const;
130 Size GetPrefSize() const;
131 void SetPrefSize( const Size& rPrefSize );
133 MapMode GetPrefMapMode() const;
134 void SetPrefMapMode( const MapMode& rPrefMapMode );
136 Size GetSizePixel( const OutputDevice* pRefDevice = NULL ) const;
138 sal_uLong GetSizeBytes() const;
140 void Draw( OutputDevice* pOutDev,
141 const Point& rDestPt ) const;
142 void Draw( OutputDevice* pOutDev,
143 const Point& rDestPt,
144 const Size& rDestSize ) const;
145 static void DrawEx( OutputDevice* pOutDev, const OUString& rText,
146 Font& rFont, const BitmapEx& rBitmap,
147 const Point& rDestPt, const Size& rDestSize );
149 void StartAnimation( OutputDevice* pOutDev,
150 const Point& rDestPt,
151 const Size& rDestSize,
152 long nExtraData = 0L,
153 OutputDevice* pFirstFrameOutDev = NULL );
154 void StopAnimation( OutputDevice* pOutputDevice = NULL,
155 long nExtraData = 0L );
157 void SetAnimationNotifyHdl( const Link& rLink );
158 Link GetAnimationNotifyHdl() const;
160 sal_uLong GetAnimationLoopCount() const;
162 sal_uLong GetChecksum() const;
164 public:
166 GraphicReader* GetContext();
167 void SetContext( GraphicReader* pReader );
169 public:
171 void SetDocFileName( const String& rName, sal_uLong nFilePos );
172 const String& GetDocFileName() const;
173 sal_uLong GetDocFilePos() const;
175 sal_Bool SwapOut();
176 sal_Bool SwapOut( SvStream* pOStm );
177 sal_Bool SwapIn();
178 sal_Bool SwapIn( SvStream* pIStm );
179 sal_Bool IsSwapOut() const;
181 void SetLink( const GfxLink& );
182 GfxLink GetLink() const;
183 sal_Bool IsLink() const;
185 sal_Bool ExportNative( SvStream& rOStream ) const;
187 friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStream, const Graphic& rGraphic );
188 friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStream, Graphic& rGraphic );
190 public:
192 virtual void Load( SvStream& );
193 virtual void Save( SvStream& );
194 virtual void Assign( const SvDataCopyStream& );
196 const SvgDataPtr& getSvgData() const;
199 #endif // _SV_GRAPH_HXX
201 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */