Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _SV_IMPGRAPH_HXX
21 : #define _SV_IMPGRAPH_HXX
22 :
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>
29 :
30 : // ---------------
31 : // - ImpSwapInfo -
32 : // ---------------
33 :
34 22399 : struct ImpSwapInfo
35 : {
36 : MapMode maPrefMapMode;
37 : Size maPrefSize;
38 : };
39 :
40 : // --------------
41 : // - ImpGraphic -
42 : // --------------
43 :
44 : class OutputDevice;
45 : class GfxLink;
46 : struct ImpSwapFile;
47 : class GraphicConversionParameters;
48 :
49 : class ImpGraphic
50 : {
51 : friend class Graphic;
52 :
53 : private:
54 :
55 : GDIMetaFile maMetaFile;
56 : BitmapEx maEx;
57 : ImpSwapInfo maSwapInfo;
58 : Animation* mpAnimation;
59 : GraphicReader* mpContext;
60 : ImpSwapFile* mpSwapFile;
61 : GfxLink* mpGfxLink;
62 : GraphicType meType;
63 : String maDocFileURLStr;
64 : sal_uLong mnDocFilePos;
65 : mutable sal_uLong mnSizeBytes;
66 : sal_uLong mnRefCount;
67 : sal_Bool mbSwapOut;
68 : sal_Bool mbSwapUnderway;
69 :
70 : // SvgData support
71 : SvgDataPtr maSvgData;
72 :
73 : private:
74 :
75 : ImpGraphic();
76 : ImpGraphic( const ImpGraphic& rImpGraphic );
77 : ImpGraphic( const Bitmap& rBmp );
78 : ImpGraphic( const BitmapEx& rBmpEx );
79 : ImpGraphic(const SvgDataPtr& rSvgDataPtr);
80 : ImpGraphic( const Animation& rAnimation );
81 : ImpGraphic( const GDIMetaFile& rMtf );
82 : virtual ~ImpGraphic();
83 :
84 : ImpGraphic& operator=( const ImpGraphic& rImpGraphic );
85 : sal_Bool operator==( const ImpGraphic& rImpGraphic ) const;
86 0 : sal_Bool operator!=( const ImpGraphic& rImpGraphic ) const { return !( *this == rImpGraphic ); }
87 :
88 : void ImplClearGraphics( sal_Bool bCreateSwapInfo );
89 : void ImplClear();
90 :
91 : GraphicType ImplGetType() const;
92 : void ImplSetDefaultType();
93 : sal_Bool ImplIsSupportedGraphic() const;
94 :
95 : sal_Bool ImplIsTransparent() const;
96 : sal_Bool ImplIsAlpha() const;
97 : sal_Bool ImplIsAnimated() const;
98 : sal_Bool ImplIsEPS() const;
99 :
100 : Bitmap ImplGetBitmap(const GraphicConversionParameters& rParameters) const;
101 : BitmapEx ImplGetBitmapEx(const GraphicConversionParameters& rParameters) const;
102 : Animation ImplGetAnimation() const;
103 : const GDIMetaFile& ImplGetGDIMetaFile() const;
104 :
105 :
106 : Size ImplGetPrefSize() const;
107 : void ImplSetPrefSize( const Size& rPrefSize );
108 :
109 : MapMode ImplGetPrefMapMode() const;
110 : void ImplSetPrefMapMode( const MapMode& rPrefMapMode );
111 :
112 : sal_uLong ImplGetSizeBytes() const;
113 :
114 : void ImplDraw( OutputDevice* pOutDev,
115 : const Point& rDestPt ) const;
116 : void ImplDraw( OutputDevice* pOutDev,
117 : const Point& rDestPt,
118 : const Size& rDestSize ) const;
119 :
120 : void ImplStartAnimation( OutputDevice* pOutDev,
121 : const Point& rDestPt,
122 : const Size& rDestSize,
123 : long nExtraData = 0,
124 : OutputDevice* pFirstFrameOutDev = NULL );
125 : void ImplStopAnimation( OutputDevice* pOutputDevice = NULL,
126 : long nExtraData = 0 );
127 :
128 : void ImplSetAnimationNotifyHdl( const Link& rLink );
129 : Link ImplGetAnimationNotifyHdl() const;
130 :
131 : sal_uLong ImplGetAnimationLoopCount() const;
132 :
133 : private:
134 :
135 : GraphicReader* ImplGetContext();
136 : void ImplSetContext( GraphicReader* pReader );
137 :
138 : private:
139 :
140 : void ImplSetDocFileName( const String& rName, sal_uLong nFilePos );
141 : const String& ImplGetDocFileName() const;
142 : sal_uLong ImplGetDocFilePos() const;
143 :
144 : sal_Bool ImplReadEmbedded( SvStream& rIStream, sal_Bool bSwap = sal_False );
145 : sal_Bool ImplWriteEmbedded( SvStream& rOStream );
146 :
147 : sal_Bool ImplSwapIn();
148 : sal_Bool ImplSwapIn( SvStream* pIStm );
149 :
150 : sal_Bool ImplSwapOut();
151 : sal_Bool ImplSwapOut( SvStream* pOStm );
152 :
153 : sal_Bool ImplIsSwapOut() const;
154 :
155 : void ImplSetLink( const GfxLink& );
156 : GfxLink ImplGetLink();
157 : sal_Bool ImplIsLink() const;
158 :
159 : sal_uLong ImplGetChecksum() const;
160 :
161 : sal_Bool ImplExportNative( SvStream& rOStm ) const;
162 :
163 : friend SvStream& operator<<( SvStream& rOStm, const ImpGraphic& rImpGraphic );
164 : friend SvStream& operator>>( SvStream& rIStm, ImpGraphic& rImpGraphic );
165 :
166 : // SvgData support
167 : const SvgDataPtr& getSvgData() const;
168 : };
169 :
170 : #endif // _SV_IMPGRAPH_HXX
171 :
172 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|