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