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 INCLUDED_VCL_INC_IMPGRAPH_HXX
21 : #define INCLUDED_VCL_INC_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 : // - ImpSwapInfo -
31 :
32 683860 : struct ImpSwapInfo
33 : {
34 : MapMode maPrefMapMode;
35 : Size maPrefSize;
36 : };
37 :
38 : // - ImpGraphic -
39 :
40 : class OutputDevice;
41 : class GfxLink;
42 : struct ImpSwapFile;
43 : class GraphicConversionParameters;
44 :
45 : class ImpGraphic
46 : {
47 : friend class Graphic;
48 :
49 : private:
50 :
51 : GDIMetaFile maMetaFile;
52 : BitmapEx maEx;
53 : ImpSwapInfo maSwapInfo;
54 : Animation* mpAnimation;
55 : GraphicReader* mpContext;
56 : ImpSwapFile* mpSwapFile;
57 : GfxLink* mpGfxLink;
58 : GraphicType meType;
59 : mutable sal_uLong mnSizeBytes;
60 : sal_uLong mnRefCount;
61 : bool mbSwapOut;
62 : bool mbSwapUnderway;
63 :
64 : // SvgData support
65 : SvgDataPtr maSvgData;
66 :
67 : private:
68 :
69 : ImpGraphic();
70 : ImpGraphic( const ImpGraphic& rImpGraphic );
71 : ImpGraphic( const Bitmap& rBmp );
72 : ImpGraphic( const BitmapEx& rBmpEx );
73 : ImpGraphic(const SvgDataPtr& rSvgDataPtr);
74 : ImpGraphic( const Animation& rAnimation );
75 : ImpGraphic( const GDIMetaFile& rMtf );
76 : virtual ~ImpGraphic();
77 :
78 : ImpGraphic& operator=( const ImpGraphic& rImpGraphic );
79 : bool operator==( const ImpGraphic& rImpGraphic ) const;
80 0 : bool operator!=( const ImpGraphic& rImpGraphic ) const { return !( *this == rImpGraphic ); }
81 :
82 : void ImplClearGraphics( bool bCreateSwapInfo );
83 : void ImplClear();
84 :
85 284583 : GraphicType ImplGetType() const { return meType;}
86 : void ImplSetDefaultType();
87 : bool ImplIsSupportedGraphic() const;
88 :
89 : bool ImplIsTransparent() const;
90 : bool ImplIsAlpha() const;
91 : bool ImplIsAnimated() const;
92 : bool ImplIsEPS() const;
93 :
94 : Bitmap ImplGetBitmap(const GraphicConversionParameters& rParameters) const;
95 : BitmapEx ImplGetBitmapEx(const GraphicConversionParameters& rParameters) const;
96 : Animation ImplGetAnimation() const;
97 : const GDIMetaFile& ImplGetGDIMetaFile() const;
98 :
99 : Size ImplGetPrefSize() const;
100 : void ImplSetPrefSize( const Size& rPrefSize );
101 :
102 : MapMode ImplGetPrefMapMode() const;
103 : void ImplSetPrefMapMode( const MapMode& rPrefMapMode );
104 :
105 : sal_uLong ImplGetSizeBytes() const;
106 :
107 : void ImplDraw( OutputDevice* pOutDev,
108 : const Point& rDestPt ) const;
109 : void ImplDraw( OutputDevice* pOutDev,
110 : const Point& rDestPt,
111 : const Size& rDestSize ) const;
112 :
113 : void ImplStartAnimation( OutputDevice* pOutDev,
114 : const Point& rDestPt,
115 : const Size& rDestSize,
116 : long nExtraData = 0,
117 : OutputDevice* pFirstFrameOutDev = NULL );
118 : void ImplStopAnimation( OutputDevice* pOutputDevice = NULL,
119 : long nExtraData = 0 );
120 :
121 : void ImplSetAnimationNotifyHdl( const Link<>& rLink );
122 : Link<> ImplGetAnimationNotifyHdl() const;
123 :
124 : sal_uLong ImplGetAnimationLoopCount() const;
125 :
126 : private:
127 :
128 11807 : GraphicReader* ImplGetContext() { return mpContext;}
129 : void ImplSetContext( GraphicReader* pReader );
130 :
131 : private:
132 : bool ImplReadEmbedded( SvStream& rIStream );
133 : bool ImplWriteEmbedded( SvStream& rOStream );
134 :
135 : bool ImplSwapIn();
136 : bool ImplSwapIn( SvStream* pIStm );
137 :
138 : bool ImplSwapOut();
139 : void ImplSwapOutAsLink();
140 : bool ImplSwapOut( SvStream* pOStm );
141 :
142 224767 : bool ImplIsSwapOut() const { return mbSwapOut;}
143 :
144 : void ImplSetLink( const GfxLink& );
145 : GfxLink ImplGetLink();
146 : bool ImplIsLink() const;
147 :
148 : sal_uLong ImplGetChecksum() const;
149 :
150 : bool ImplExportNative( SvStream& rOStm ) const;
151 :
152 : friend SvStream& WriteImpGraphic( SvStream& rOStm, const ImpGraphic& rImpGraphic );
153 : friend SvStream& ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic );
154 :
155 : // SvgData support
156 7307 : const SvgDataPtr& getSvgData() const { return maSvgData;}
157 : };
158 :
159 : #endif // INCLUDED_VCL_INC_IMPGRAPH_HXX
160 :
161 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|