Branch libreoffice-5-0-4
[LibreOffice.git] / vcl / inc / impgraph.hxx
blob51937b5e93498d73f7d7d03e97665db32f3da70c
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 INCLUDED_VCL_INC_IMPGRAPH_HXX
21 #define INCLUDED_VCL_INC_IMPGRAPH_HXX
23 #include <vcl/bitmap.hxx>
24 #include <vcl/bitmapex.hxx>
25 #include <vcl/animate.hxx>
26 #include <vcl/gdimtf.hxx>
27 #include <vcl/graph.h>
28 #include <vcl/svgdata.hxx>
30 // - ImpSwapInfo -
32 struct ImpSwapInfo
34 MapMode maPrefMapMode;
35 Size maPrefSize;
38 // - ImpGraphic -
40 class OutputDevice;
41 class GfxLink;
42 struct ImpSwapFile;
43 class GraphicConversionParameters;
45 class ImpGraphic
47 friend class Graphic;
49 private:
51 GDIMetaFile maMetaFile;
52 BitmapEx maEx;
53 ImpSwapInfo maSwapInfo;
54 Animation* mpAnimation;
55 GraphicReader* mpContext;
56 ImpSwapFile* mpSwapFile;
57 GfxLink* mpGfxLink;
58 GraphicType meType;
59 mutable sal_uLong mnSizeBytes;
60 sal_uLong mnRefCount;
61 bool mbSwapOut;
62 bool mbSwapUnderway;
64 // SvgData support
65 SvgDataPtr maSvgData;
67 private:
69 ImpGraphic();
70 ImpGraphic( const ImpGraphic& rImpGraphic );
71 ImpGraphic( const Bitmap& rBmp );
72 ImpGraphic( const BitmapEx& rBmpEx );
73 ImpGraphic(const SvgDataPtr& rSvgDataPtr);
74 ImpGraphic( const Animation& rAnimation );
75 ImpGraphic( const GDIMetaFile& rMtf );
76 virtual ~ImpGraphic();
78 ImpGraphic& operator=( const ImpGraphic& rImpGraphic );
79 bool operator==( const ImpGraphic& rImpGraphic ) const;
80 bool operator!=( const ImpGraphic& rImpGraphic ) const { return !( *this == rImpGraphic ); }
82 void ImplClearGraphics( bool bCreateSwapInfo );
83 void ImplClear();
85 GraphicType ImplGetType() const { return meType;}
86 void ImplSetDefaultType();
87 bool ImplIsSupportedGraphic() const;
89 bool ImplIsTransparent() const;
90 bool ImplIsAlpha() const;
91 bool ImplIsAnimated() const;
92 bool ImplIsEPS() const;
94 Bitmap ImplGetBitmap(const GraphicConversionParameters& rParameters) const;
95 BitmapEx ImplGetBitmapEx(const GraphicConversionParameters& rParameters) const;
96 Animation ImplGetAnimation() const;
97 const GDIMetaFile& ImplGetGDIMetaFile() const;
99 Size ImplGetPrefSize() const;
100 void ImplSetPrefSize( const Size& rPrefSize );
102 MapMode ImplGetPrefMapMode() const;
103 void ImplSetPrefMapMode( const MapMode& rPrefMapMode );
105 sal_uLong ImplGetSizeBytes() const;
107 void ImplDraw( OutputDevice* pOutDev,
108 const Point& rDestPt ) const;
109 void ImplDraw( OutputDevice* pOutDev,
110 const Point& rDestPt,
111 const Size& rDestSize ) const;
113 void ImplStartAnimation( OutputDevice* pOutDev,
114 const Point& rDestPt,
115 const Size& rDestSize,
116 long nExtraData = 0,
117 OutputDevice* pFirstFrameOutDev = NULL );
118 void ImplStopAnimation( OutputDevice* pOutputDevice = NULL,
119 long nExtraData = 0 );
121 void ImplSetAnimationNotifyHdl( const Link<>& rLink );
122 Link<> ImplGetAnimationNotifyHdl() const;
124 sal_uLong ImplGetAnimationLoopCount() const;
126 private:
128 GraphicReader* ImplGetContext() { return mpContext;}
129 void ImplSetContext( GraphicReader* pReader );
131 private:
132 bool ImplReadEmbedded( SvStream& rIStream );
133 bool ImplWriteEmbedded( SvStream& rOStream );
135 bool ImplSwapIn();
136 bool ImplSwapIn( SvStream* pIStm );
138 bool ImplSwapOut();
139 void ImplSwapOutAsLink();
140 bool ImplSwapOut( SvStream* pOStm );
142 bool ImplIsSwapOut() const { return mbSwapOut;}
144 void ImplSetLink( const GfxLink& );
145 GfxLink ImplGetLink();
146 bool ImplIsLink() const;
148 BitmapChecksum ImplGetChecksum() const;
150 bool ImplExportNative( SvStream& rOStm ) const;
152 friend SvStream& WriteImpGraphic( SvStream& rOStm, const ImpGraphic& rImpGraphic );
153 friend SvStream& ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic );
155 // SvgData support
156 const SvgDataPtr& getSvgData() const { return maSvgData;}
159 #endif // INCLUDED_VCL_INC_IMPGRAPH_HXX
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */