xref: /aoo41x/main/vcl/inc/impgraph.hxx (revision ebfcd9af)
1*ebfcd9afSAndrew Rist /**************************************************************
2*ebfcd9afSAndrew Rist  *
3*ebfcd9afSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ebfcd9afSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ebfcd9afSAndrew Rist  * distributed with this work for additional information
6*ebfcd9afSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ebfcd9afSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ebfcd9afSAndrew Rist  * "License"); you may not use this file except in compliance
9*ebfcd9afSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ebfcd9afSAndrew Rist  *
11*ebfcd9afSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ebfcd9afSAndrew Rist  *
13*ebfcd9afSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ebfcd9afSAndrew Rist  * software distributed under the License is distributed on an
15*ebfcd9afSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ebfcd9afSAndrew Rist  * KIND, either express or implied.  See the License for the
17*ebfcd9afSAndrew Rist  * specific language governing permissions and limitations
18*ebfcd9afSAndrew Rist  * under the License.
19*ebfcd9afSAndrew Rist  *
20*ebfcd9afSAndrew Rist  *************************************************************/
21*ebfcd9afSAndrew Rist 
22*ebfcd9afSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SV_IMPGRAPH_HXX
25cdf0e10cSrcweir #define _SV_IMPGRAPH_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <tools/urlobj.hxx>
28cdf0e10cSrcweir #include <vcl/bitmap.hxx>
29cdf0e10cSrcweir #include <vcl/bitmapex.hxx>
30cdf0e10cSrcweir #include <vcl/animate.hxx>
31cdf0e10cSrcweir #include <vcl/gdimtf.hxx>
32cdf0e10cSrcweir #include <vcl/graph.h>
33ddde725dSArmin Le Grand #include <vcl/svgdata.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir // ---------------
36cdf0e10cSrcweir // - ImpSwapInfo -
37cdf0e10cSrcweir // ---------------
38cdf0e10cSrcweir 
39cdf0e10cSrcweir struct ImpSwapInfo
40cdf0e10cSrcweir {
41cdf0e10cSrcweir 	MapMode		maPrefMapMode;
42cdf0e10cSrcweir 	Size		maPrefSize;
43cdf0e10cSrcweir };
44cdf0e10cSrcweir 
45cdf0e10cSrcweir // --------------
46cdf0e10cSrcweir // - ImpGraphic -
47cdf0e10cSrcweir // --------------
48cdf0e10cSrcweir 
49cdf0e10cSrcweir class	OutputDevice;
50cdf0e10cSrcweir class	GfxLink;
51cdf0e10cSrcweir struct	ImpSwapFile;
52cdf0e10cSrcweir class GraphicConversionParameters;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir class ImpGraphic
55cdf0e10cSrcweir {
56cdf0e10cSrcweir 	friend class Graphic;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir private:
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 	GDIMetaFile			maMetaFile;
61cdf0e10cSrcweir 	BitmapEx			maEx;
62cdf0e10cSrcweir 	ImpSwapInfo			maSwapInfo;
63cdf0e10cSrcweir 	Animation*			mpAnimation;
64cdf0e10cSrcweir 	GraphicReader*		mpContext;
65cdf0e10cSrcweir 	ImpSwapFile*		mpSwapFile;
66cdf0e10cSrcweir 	GfxLink*			mpGfxLink;
67cdf0e10cSrcweir 	GraphicType			meType;
68cdf0e10cSrcweir 	String				maDocFileURLStr;
69ddde725dSArmin Le Grand 	sal_uLong			mnDocFilePos;
70ddde725dSArmin Le Grand     mutable sal_uLong   mnSizeBytes;
71ddde725dSArmin Le Grand 	sal_uLong			mnRefCount;
72ddde725dSArmin Le Grand 	sal_Bool			mbSwapOut;
73ddde725dSArmin Le Grand 	sal_Bool			mbSwapUnderway;
74ddde725dSArmin Le Grand 
75ddde725dSArmin Le Grand     // SvgData support
76ddde725dSArmin Le Grand     SvgDataPtr          maSvgData;
77cdf0e10cSrcweir 
78cdf0e10cSrcweir private:
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 						ImpGraphic();
81cdf0e10cSrcweir 						ImpGraphic( const ImpGraphic& rImpGraphic );
82cdf0e10cSrcweir 						ImpGraphic( const Bitmap& rBmp );
83cdf0e10cSrcweir 						ImpGraphic( const BitmapEx& rBmpEx );
84ddde725dSArmin Le Grand 						ImpGraphic(const SvgDataPtr& rSvgDataPtr);
85cdf0e10cSrcweir 						ImpGraphic( const Animation& rAnimation );
86cdf0e10cSrcweir 						ImpGraphic( const GDIMetaFile& rMtf );
87cdf0e10cSrcweir 	virtual				~ImpGraphic();
88cdf0e10cSrcweir 
89ddde725dSArmin Le Grand     ImpGraphic&			operator=( const ImpGraphic& rImpGraphic );
90cdf0e10cSrcweir 	sal_Bool				operator==( const ImpGraphic& rImpGraphic ) const;
operator !=(const ImpGraphic & rImpGraphic) const91cdf0e10cSrcweir 	sal_Bool				operator!=( const ImpGraphic& rImpGraphic ) const { return !( *this == rImpGraphic ); }
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 	void				ImplClearGraphics( sal_Bool bCreateSwapInfo );
94cdf0e10cSrcweir 	void				ImplClear();
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 	GraphicType			ImplGetType() const;
97cdf0e10cSrcweir 	void				ImplSetDefaultType();
98cdf0e10cSrcweir 	sal_Bool				ImplIsSupportedGraphic() const;
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 	sal_Bool			ImplIsTransparent() const;
101cdf0e10cSrcweir 	sal_Bool			ImplIsAlpha() const;
102cdf0e10cSrcweir 	sal_Bool			ImplIsAnimated() const;
103cdf0e10cSrcweir 	sal_Bool			ImplIsEPS() const;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 	Bitmap				    ImplGetBitmap(const GraphicConversionParameters& rParameters) const;
106cdf0e10cSrcweir 	BitmapEx			    ImplGetBitmapEx(const GraphicConversionParameters& rParameters) const;
107cdf0e10cSrcweir 	Animation			    ImplGetAnimation() const;
108cdf0e10cSrcweir 	const GDIMetaFile&	    ImplGetGDIMetaFile() const;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	Size				ImplGetPrefSize() const;
112cdf0e10cSrcweir 	void				ImplSetPrefSize( const Size& rPrefSize );
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 	MapMode				ImplGetPrefMapMode() const;
115cdf0e10cSrcweir 	void				ImplSetPrefMapMode( const MapMode& rPrefMapMode );
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	sal_uLong				ImplGetSizeBytes() const;
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	void				ImplDraw( OutputDevice* pOutDev,
120cdf0e10cSrcweir 								  const Point& rDestPt ) const;
121cdf0e10cSrcweir 	void				ImplDraw( OutputDevice* pOutDev,
122cdf0e10cSrcweir 								  const Point& rDestPt,
123cdf0e10cSrcweir 								  const Size& rDestSize ) const;
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 	void				ImplStartAnimation( OutputDevice* pOutDev,
126cdf0e10cSrcweir 											const Point& rDestPt,
127cdf0e10cSrcweir 											long nExtraData = 0,
128cdf0e10cSrcweir 											OutputDevice* pFirstFrameOutDev = NULL );
129cdf0e10cSrcweir 	void				ImplStartAnimation( OutputDevice* pOutDev,
130cdf0e10cSrcweir 											const Point& rDestPt,
131cdf0e10cSrcweir 											const Size& rDestSize,
132cdf0e10cSrcweir 											long nExtraData = 0,
133cdf0e10cSrcweir 											OutputDevice* pFirstFrameOutDev = NULL );
134cdf0e10cSrcweir 	void				ImplStopAnimation( OutputDevice* pOutputDevice = NULL,
135cdf0e10cSrcweir 										   long nExtraData = 0 );
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 	void				ImplSetAnimationNotifyHdl( const Link& rLink );
138cdf0e10cSrcweir 	Link				ImplGetAnimationNotifyHdl() const;
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 	sal_uLong				ImplGetAnimationLoopCount() const;
141cdf0e10cSrcweir 	void				ImplResetAnimationLoopCount();
142cdf0e10cSrcweir 
143cdf0e10cSrcweir 	List*				ImplGetAnimationInfoList() const;
144cdf0e10cSrcweir 
145cdf0e10cSrcweir private:
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 	GraphicReader*		ImplGetContext();
148cdf0e10cSrcweir 	void				ImplSetContext( GraphicReader* pReader );
149cdf0e10cSrcweir 
150cdf0e10cSrcweir private:
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 	void				ImplSetDocFileName( const String& rName, sal_uLong nFilePos );
153cdf0e10cSrcweir 	const String&		ImplGetDocFileName() const;
154cdf0e10cSrcweir 	sal_uLong				ImplGetDocFilePos() const;
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 	sal_Bool				ImplReadEmbedded( SvStream& rIStream, sal_Bool bSwap = sal_False );
157cdf0e10cSrcweir 	sal_Bool				ImplWriteEmbedded( SvStream& rOStream );
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 	sal_Bool				ImplSwapIn();
160cdf0e10cSrcweir 	sal_Bool				ImplSwapIn( SvStream* pIStm );
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 	sal_Bool				ImplSwapOut();
163cdf0e10cSrcweir 	sal_Bool				ImplSwapOut( SvStream* pOStm );
164cdf0e10cSrcweir 
165cdf0e10cSrcweir 	sal_Bool				ImplIsSwapOut() const;
166cdf0e10cSrcweir 
167cdf0e10cSrcweir 	void				ImplSetLink( const GfxLink& );
168cdf0e10cSrcweir 	GfxLink				ImplGetLink();
169cdf0e10cSrcweir 	sal_Bool				ImplIsLink() const;
170cdf0e10cSrcweir 
171cdf0e10cSrcweir 	sal_uLong				ImplGetChecksum() const;
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 	sal_Bool				ImplExportNative( SvStream& rOStm ) const;
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 	friend SvStream&	operator<<( SvStream& rOStm, const ImpGraphic& rImpGraphic );
176cdf0e10cSrcweir 	friend SvStream&	operator>>( SvStream& rIStm, ImpGraphic& rImpGraphic );
177ddde725dSArmin Le Grand 
178ddde725dSArmin Le Grand     // SvgData support
179ddde725dSArmin Le Grand     const SvgDataPtr& getSvgData() const;
180cdf0e10cSrcweir };
181cdf0e10cSrcweir 
182cdf0e10cSrcweir #endif // _SV_IMPGRAPH_HXX
183