xref: /AOO41X/main/vcl/inc/impgraph.hxx (revision ddde725d65c83fe3ba1186d46f6e3e08f12ba47e)
1cdf0e10cSrcweir /*************************************************************************
2cdf0e10cSrcweir  *
3cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4cdf0e10cSrcweir  *
5cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6cdf0e10cSrcweir  *
7cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8cdf0e10cSrcweir  *
9cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10cdf0e10cSrcweir  *
11cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14cdf0e10cSrcweir  *
15cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20cdf0e10cSrcweir  *
21cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25cdf0e10cSrcweir  *
26cdf0e10cSrcweir  ************************************************************************/
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #ifndef _SV_IMPGRAPH_HXX
29cdf0e10cSrcweir #define _SV_IMPGRAPH_HXX
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <tools/urlobj.hxx>
32cdf0e10cSrcweir #include <vcl/bitmap.hxx>
33cdf0e10cSrcweir #include <vcl/bitmapex.hxx>
34cdf0e10cSrcweir #include <vcl/animate.hxx>
35cdf0e10cSrcweir #include <vcl/gdimtf.hxx>
36cdf0e10cSrcweir #include <vcl/graph.h>
37*ddde725dSArmin Le Grand #include <vcl/svgdata.hxx>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir // ---------------
40cdf0e10cSrcweir // - ImpSwapInfo -
41cdf0e10cSrcweir // ---------------
42cdf0e10cSrcweir 
43cdf0e10cSrcweir struct ImpSwapInfo
44cdf0e10cSrcweir {
45cdf0e10cSrcweir 	MapMode		maPrefMapMode;
46cdf0e10cSrcweir 	Size		maPrefSize;
47cdf0e10cSrcweir };
48cdf0e10cSrcweir 
49cdf0e10cSrcweir // --------------
50cdf0e10cSrcweir // - ImpGraphic -
51cdf0e10cSrcweir // --------------
52cdf0e10cSrcweir 
53cdf0e10cSrcweir class	OutputDevice;
54cdf0e10cSrcweir class	GfxLink;
55cdf0e10cSrcweir struct	ImpSwapFile;
56cdf0e10cSrcweir class GraphicConversionParameters;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir class ImpGraphic
59cdf0e10cSrcweir {
60cdf0e10cSrcweir 	friend class Graphic;
61cdf0e10cSrcweir 
62cdf0e10cSrcweir private:
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 	GDIMetaFile			maMetaFile;
65cdf0e10cSrcweir 	BitmapEx			maEx;
66cdf0e10cSrcweir 	ImpSwapInfo			maSwapInfo;
67cdf0e10cSrcweir 	Animation*			mpAnimation;
68cdf0e10cSrcweir 	GraphicReader*		mpContext;
69cdf0e10cSrcweir 	ImpSwapFile*		mpSwapFile;
70cdf0e10cSrcweir 	GfxLink*			mpGfxLink;
71cdf0e10cSrcweir 	GraphicType			meType;
72cdf0e10cSrcweir 	String				maDocFileURLStr;
73cdf0e10cSrcweir 	sal_uLong			mnDocFilePos;
74cdf0e10cSrcweir     mutable sal_uLong   mnSizeBytes;
75cdf0e10cSrcweir 	sal_uLong			mnRefCount;
76cdf0e10cSrcweir 	sal_Bool			mbSwapOut;
77cdf0e10cSrcweir 	sal_Bool			mbSwapUnderway;
78cdf0e10cSrcweir 
79*ddde725dSArmin Le Grand     // SvgData support
80*ddde725dSArmin Le Grand     SvgDataPtr          maSvgData;
81*ddde725dSArmin Le Grand 
82cdf0e10cSrcweir private:
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 						ImpGraphic();
85cdf0e10cSrcweir 						ImpGraphic( const ImpGraphic& rImpGraphic );
86cdf0e10cSrcweir 						ImpGraphic( const Bitmap& rBmp );
87cdf0e10cSrcweir 						ImpGraphic( const BitmapEx& rBmpEx );
88*ddde725dSArmin Le Grand 						ImpGraphic(const SvgDataPtr& rSvgDataPtr);
89cdf0e10cSrcweir 						ImpGraphic( const Animation& rAnimation );
90cdf0e10cSrcweir 						ImpGraphic( const GDIMetaFile& rMtf );
91cdf0e10cSrcweir 	virtual				~ImpGraphic();
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     ImpGraphic&			operator=( const ImpGraphic& rImpGraphic );
94cdf0e10cSrcweir 	sal_Bool				operator==( const ImpGraphic& rImpGraphic ) const;
95cdf0e10cSrcweir 	sal_Bool				operator!=( const ImpGraphic& rImpGraphic ) const { return !( *this == rImpGraphic ); }
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 	void				ImplClearGraphics( sal_Bool bCreateSwapInfo );
98cdf0e10cSrcweir 	void				ImplClear();
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 	GraphicType			ImplGetType() const;
101cdf0e10cSrcweir 	void				ImplSetDefaultType();
102cdf0e10cSrcweir 	sal_Bool				ImplIsSupportedGraphic() const;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	sal_Bool			ImplIsTransparent() const;
105cdf0e10cSrcweir 	sal_Bool			ImplIsAlpha() const;
106cdf0e10cSrcweir 	sal_Bool			ImplIsAnimated() const;
107cdf0e10cSrcweir 	sal_Bool			ImplIsEPS() const;
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 	Bitmap				    ImplGetBitmap(const GraphicConversionParameters& rParameters) const;
110cdf0e10cSrcweir 	BitmapEx			    ImplGetBitmapEx(const GraphicConversionParameters& rParameters) const;
111cdf0e10cSrcweir 	Animation			    ImplGetAnimation() const;
112cdf0e10cSrcweir 	const GDIMetaFile&	    ImplGetGDIMetaFile() const;
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 	Size				ImplGetPrefSize() const;
116cdf0e10cSrcweir 	void				ImplSetPrefSize( const Size& rPrefSize );
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 	MapMode				ImplGetPrefMapMode() const;
119cdf0e10cSrcweir 	void				ImplSetPrefMapMode( const MapMode& rPrefMapMode );
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 	sal_uLong				ImplGetSizeBytes() const;
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 	void				ImplDraw( OutputDevice* pOutDev,
124cdf0e10cSrcweir 								  const Point& rDestPt ) const;
125cdf0e10cSrcweir 	void				ImplDraw( OutputDevice* pOutDev,
126cdf0e10cSrcweir 								  const Point& rDestPt,
127cdf0e10cSrcweir 								  const Size& rDestSize ) const;
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 	void				ImplStartAnimation( OutputDevice* pOutDev,
130cdf0e10cSrcweir 											const Point& rDestPt,
131cdf0e10cSrcweir 											long nExtraData = 0,
132cdf0e10cSrcweir 											OutputDevice* pFirstFrameOutDev = NULL );
133cdf0e10cSrcweir 	void				ImplStartAnimation( OutputDevice* pOutDev,
134cdf0e10cSrcweir 											const Point& rDestPt,
135cdf0e10cSrcweir 											const Size& rDestSize,
136cdf0e10cSrcweir 											long nExtraData = 0,
137cdf0e10cSrcweir 											OutputDevice* pFirstFrameOutDev = NULL );
138cdf0e10cSrcweir 	void				ImplStopAnimation( OutputDevice* pOutputDevice = NULL,
139cdf0e10cSrcweir 										   long nExtraData = 0 );
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 	void				ImplSetAnimationNotifyHdl( const Link& rLink );
142cdf0e10cSrcweir 	Link				ImplGetAnimationNotifyHdl() const;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 	sal_uLong				ImplGetAnimationLoopCount() const;
145cdf0e10cSrcweir 	void				ImplResetAnimationLoopCount();
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 	List*				ImplGetAnimationInfoList() const;
148cdf0e10cSrcweir 
149cdf0e10cSrcweir private:
150cdf0e10cSrcweir 
151cdf0e10cSrcweir 	GraphicReader*		ImplGetContext();
152cdf0e10cSrcweir 	void				ImplSetContext( GraphicReader* pReader );
153cdf0e10cSrcweir 
154cdf0e10cSrcweir private:
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 	void				ImplSetDocFileName( const String& rName, sal_uLong nFilePos );
157cdf0e10cSrcweir 	const String&		ImplGetDocFileName() const;
158cdf0e10cSrcweir 	sal_uLong				ImplGetDocFilePos() const;
159cdf0e10cSrcweir 
160cdf0e10cSrcweir 	sal_Bool				ImplReadEmbedded( SvStream& rIStream, sal_Bool bSwap = sal_False );
161cdf0e10cSrcweir 	sal_Bool				ImplWriteEmbedded( SvStream& rOStream );
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 	sal_Bool				ImplSwapIn();
164cdf0e10cSrcweir 	sal_Bool				ImplSwapIn( SvStream* pIStm );
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 	sal_Bool				ImplSwapOut();
167cdf0e10cSrcweir 	sal_Bool				ImplSwapOut( SvStream* pOStm );
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 	sal_Bool				ImplIsSwapOut() const;
170cdf0e10cSrcweir 
171cdf0e10cSrcweir 	void				ImplSetLink( const GfxLink& );
172cdf0e10cSrcweir 	GfxLink				ImplGetLink();
173cdf0e10cSrcweir 	sal_Bool				ImplIsLink() const;
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 	sal_uLong				ImplGetChecksum() const;
176cdf0e10cSrcweir 
177cdf0e10cSrcweir 	sal_Bool				ImplExportNative( SvStream& rOStm ) const;
178cdf0e10cSrcweir 
179cdf0e10cSrcweir 	friend SvStream&	operator<<( SvStream& rOStm, const ImpGraphic& rImpGraphic );
180cdf0e10cSrcweir 	friend SvStream&	operator>>( SvStream& rIStm, ImpGraphic& rImpGraphic );
181*ddde725dSArmin Le Grand 
182*ddde725dSArmin Le Grand     // SvgData support
183*ddde725dSArmin Le Grand     const SvgDataPtr& getSvgData() const;
184cdf0e10cSrcweir };
185cdf0e10cSrcweir 
186cdf0e10cSrcweir #endif // _SV_IMPGRAPH_HXX
187