1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: galobj.hxx,v $
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>
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
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
88 class SVX_DLLPUBLIC SgaObject
90 friend class GalleryTheme
;
94 void ImplUpdateURL( const INetURLObject
& rNewURL
) { aURL
= rNewURL
; }
99 GDIMetaFile aThumbMtf
;
106 virtual void WriteData( SvStream
& rOut
, const String
& rDestDir
) const;
107 virtual void ReadData( SvStream
& rIn
, UINT16
& rReadVersion
);
109 BOOL
CreateThumb( const Graphic
& rGraphic
);
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
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; }
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 // -------------------
164 class SgaObjectSvDraw
: public SgaObject
166 using SgaObject::CreateThumb
;
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; }
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
; }
188 static BOOL
DrawCentered( OutputDevice
* pOut
, const FmFormModel
& rModel
);
195 class SgaObjectBmp
: public SgaObject
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; }
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
; }
220 class SgaObjectAnim
: public SgaObjectBmp
224 SgaObjectAnim( const INetURLObject
& ) {};
229 SgaObjectAnim( const Graphic
& rGraphic
, const INetURLObject
& rURL
, const String
& rFormatName
);
231 virtual ~SgaObjectAnim() {};
233 virtual SgaObjKind
GetObjKind() const { return SGA_OBJ_ANIM
; }
240 class SgaObjectINet
: public SgaObjectAnim
244 SgaObjectINet( const INetURLObject
& ) {};
249 SgaObjectINet( const Graphic
& rGraphic
, const INetURLObject
& rURL
, const String
& rFormatName
);
251 virtual ~SgaObjectINet() {};
253 virtual SgaObjKind
GetObjKind() const { return SGA_OBJ_INET
; }