merge the formfield patch from ooo-build
[ooovba.git] / svx / inc / galobj.hxx
blobd106f4b6ce51cc24dded95dec64d6037a973650a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: galobj.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SVX_GALOBJ_HXX_
32 #define _SVX_GALOBJ_HXX_
34 #include <tools/urlobj.hxx>
35 #include <vcl/graph.hxx>
37 // -----------
38 // - Defines -
39 // -----------
41 #define S_THUMB 80
43 // -----------------------------------------------------------------------------
45 #define SGA_FORMAT_NONE 0x00000000L
46 #define SGA_FORMAT_STRING 0x00000001L
47 #define SGA_FORMAT_GRAPHIC 0x00000010L
48 #define SGA_FORMAT_SOUND 0x00000100L
49 #define SGA_FORMAT_OLE 0x00001000L
50 #define SGA_FORMAT_SVDRAW 0x00010000L
51 #define SGA_FORMAT_ALL 0xFFFFFFFFL
53 // --------------
54 // - SgaObjKind -
55 // --------------
57 enum SgaObjKind
59 SGA_OBJ_NONE = 0, // Abstraktes Objekt
60 SGA_OBJ_BMP = 1, // Bitmap-Objekt
61 SGA_OBJ_SOUND = 2, // Sound-Objekt
62 SGA_OBJ_VIDEO = 3, // Video-Objekt
63 SGA_OBJ_ANIM = 4, // Animations-Objekt
64 SGA_OBJ_SVDRAW = 5, // Svdraw-Objekt
65 SGA_OBJ_INET = 6 // Grafik aus dem Internet
68 // ----------------
69 // - GalSoundType -
70 // ----------------
72 enum GalSoundType
74 SOUND_STANDARD = 0,
75 SOUND_COMPUTER = 1,
76 SOUND_MISC = 2,
77 SOUND_MUSIC = 3,
78 SOUND_NATURE = 4,
79 SOUND_SPEECH = 5,
80 SOUND_TECHNIC = 6,
81 SOUND_ANIMAL = 7
84 // -------------
85 // - SgaObject -
86 // -------------
88 class SVX_DLLPUBLIC SgaObject
90 friend class GalleryTheme;
92 private:
94 void ImplUpdateURL( const INetURLObject& rNewURL ) { aURL = rNewURL; }
96 protected:
98 Bitmap aThumbBmp;
99 GDIMetaFile aThumbMtf;
100 INetURLObject aURL;
101 String aUserName;
102 String aTitle;
103 BOOL bIsValid;
104 BOOL bIsThumbBmp;
106 virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
107 virtual void ReadData( SvStream& rIn, UINT16& rReadVersion );
109 BOOL CreateThumb( const Graphic& rGraphic );
111 public:
113 SgaObject();
114 virtual ~SgaObject() {};
116 virtual SgaObjKind GetObjKind() const = 0;
117 virtual UINT16 GetVersion() const = 0;
119 virtual Bitmap GetThumbBmp() const { return aThumbBmp; }
120 const GDIMetaFile& GetThumbMtf() const { return aThumbMtf; }
121 const INetURLObject& GetURL() const { return aURL; }
122 BOOL IsValid() const { return bIsValid; }
123 BOOL IsThumbBitmap() const { return bIsThumbBmp; }
125 const String GetTitle() const;
126 void SetTitle( const String& rTitle );
128 friend SvStream& operator<<( SvStream& rOut, const SgaObject& rObj );
129 friend SvStream& operator>>( SvStream& rIn, SgaObject& rObj );
132 // ------------------
133 // - SgaObjectSound -
134 // ------------------
136 class SgaObjectSound : public SgaObject
138 private:
140 GalSoundType eSoundType;
142 virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
143 virtual void ReadData( SvStream& rIn, UINT16& rReadVersion );
145 virtual UINT16 GetVersion() const { return 6; }
147 public:
149 SgaObjectSound();
150 SgaObjectSound( const INetURLObject& rURL );
151 virtual ~SgaObjectSound();
153 virtual SgaObjKind GetObjKind() const { return SGA_OBJ_SOUND; }
154 virtual Bitmap GetThumbBmp() const;
155 GalSoundType GetSoundType() const { return eSoundType; }
158 // -------------------
159 // - SgaObjectSvDraw -
160 // -------------------
162 class FmFormModel;
164 class SgaObjectSvDraw : public SgaObject
166 using SgaObject::CreateThumb;
168 private:
170 BOOL CreateThumb( const FmFormModel& rModel );
172 virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
173 virtual void ReadData( SvStream& rIn, UINT16& rReadVersion );
175 virtual UINT16 GetVersion() const { return 5; }
177 public:
179 SgaObjectSvDraw();
180 SgaObjectSvDraw( const FmFormModel& rModel, const INetURLObject& rURL );
181 SgaObjectSvDraw( SvStream& rIStm, const INetURLObject& rURL );
182 virtual ~SgaObjectSvDraw() {};
184 virtual SgaObjKind GetObjKind() const { return SGA_OBJ_SVDRAW; }
186 public:
188 static BOOL DrawCentered( OutputDevice* pOut, const FmFormModel& rModel );
191 // ----------------
192 // - SgaObjectBmp -
193 // ----------------
195 class SgaObjectBmp: public SgaObject
197 private:
199 void Init( const Graphic& rGraphic, const INetURLObject& rURL );
201 virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
202 virtual void ReadData( SvStream& rIn, UINT16& rReadVersion );
204 virtual UINT16 GetVersion() const { return 5; }
206 public:
208 SgaObjectBmp();
209 SgaObjectBmp( const INetURLObject& rURL );
210 SgaObjectBmp( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormat );
211 virtual ~SgaObjectBmp() {};
213 virtual SgaObjKind GetObjKind() const { return SGA_OBJ_BMP; }
216 // -----------------
217 // - SgaObjectAnim -
218 // -----------------
220 class SgaObjectAnim : public SgaObjectBmp
222 private:
224 SgaObjectAnim( const INetURLObject& ) {};
226 public:
228 SgaObjectAnim();
229 SgaObjectAnim( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormatName );
231 virtual ~SgaObjectAnim() {};
233 virtual SgaObjKind GetObjKind() const { return SGA_OBJ_ANIM; }
236 // -----------------
237 // - SgaObjectINet -
238 // -----------------
240 class SgaObjectINet : public SgaObjectAnim
242 private:
244 SgaObjectINet( const INetURLObject& ) {};
246 public:
248 SgaObjectINet();
249 SgaObjectINet( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormatName );
251 virtual ~SgaObjectINet() {};
253 virtual SgaObjKind GetObjKind() const { return SGA_OBJ_INET; }
255 #endif