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