Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / svx / inc / galobj.hxx
blob46f018db4f7ca3673330bdabc1f39c75139c768a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
29 #ifndef _SVX_GALOBJ_HXX_
30 #define _SVX_GALOBJ_HXX_
32 #include <tools/urlobj.hxx>
33 #include <vcl/graph.hxx>
34 #include "svx/galmisc.hxx"
36 // -----------
37 // - Defines -
38 // -----------
40 #define S_THUMB 80
42 // -----------------------------------------------------------------------------
44 #define SGA_FORMAT_NONE 0x00000000L
45 #define SGA_FORMAT_STRING 0x00000001L
46 #define SGA_FORMAT_GRAPHIC 0x00000010L
47 #define SGA_FORMAT_SOUND 0x00000100L
48 #define SGA_FORMAT_OLE 0x00001000L
49 #define SGA_FORMAT_SVDRAW 0x00010000L
50 #define SGA_FORMAT_ALL 0xFFFFFFFFL
52 // ----------------
53 // - GalSoundType -
54 // ----------------
56 enum GalSoundType
58 SOUND_STANDARD = 0,
59 SOUND_COMPUTER = 1,
60 SOUND_MISC = 2,
61 SOUND_MUSIC = 3,
62 SOUND_NATURE = 4,
63 SOUND_SPEECH = 5,
64 SOUND_TECHNIC = 6,
65 SOUND_ANIMAL = 7
68 // -------------
69 // - SgaObject -
70 // -------------
72 class SVX_DLLPUBLIC SgaObject
74 friend class GalleryTheme;
76 private:
78 void ImplUpdateURL( const INetURLObject& rNewURL ) { aURL = rNewURL; }
80 protected:
82 Bitmap aThumbBmp;
83 GDIMetaFile aThumbMtf;
84 INetURLObject aURL;
85 String aUserName;
86 String aTitle;
87 sal_Bool bIsValid;
88 sal_Bool bIsThumbBmp;
90 virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
91 virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
93 sal_Bool CreateThumb( const Graphic& rGraphic );
95 public:
97 SgaObject();
98 virtual ~SgaObject() {};
100 virtual SgaObjKind GetObjKind() const = 0;
101 virtual sal_uInt16 GetVersion() const = 0;
103 virtual Bitmap GetThumbBmp() const { return aThumbBmp; }
104 const GDIMetaFile& GetThumbMtf() const { return aThumbMtf; }
105 const INetURLObject& GetURL() const { return aURL; }
106 sal_Bool IsValid() const { return bIsValid; }
107 sal_Bool IsThumbBitmap() const { return bIsThumbBmp; }
109 const String GetTitle() const;
110 void SetTitle( const String& rTitle );
112 friend SvStream& operator<<( SvStream& rOut, const SgaObject& rObj );
113 friend SvStream& operator>>( SvStream& rIn, SgaObject& rObj );
116 // ------------------
117 // - SgaObjectSound -
118 // ------------------
120 class SgaObjectSound : public SgaObject
122 private:
124 GalSoundType eSoundType;
126 virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
127 virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
129 virtual sal_uInt16 GetVersion() const { return 6; }
131 public:
133 SgaObjectSound();
134 SgaObjectSound( const INetURLObject& rURL );
135 virtual ~SgaObjectSound();
137 virtual SgaObjKind GetObjKind() const { return SGA_OBJ_SOUND; }
138 virtual Bitmap GetThumbBmp() const;
139 GalSoundType GetSoundType() const { return eSoundType; }
142 // -------------------
143 // - SgaObjectSvDraw -
144 // -------------------
146 class FmFormModel;
148 class SgaObjectSvDraw : public SgaObject
150 using SgaObject::CreateThumb;
152 private:
154 sal_Bool CreateThumb( const FmFormModel& rModel );
156 virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
157 virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
159 virtual sal_uInt16 GetVersion() const { return 5; }
161 public:
163 SgaObjectSvDraw();
164 SgaObjectSvDraw( const FmFormModel& rModel, const INetURLObject& rURL );
165 SgaObjectSvDraw( SvStream& rIStm, const INetURLObject& rURL );
166 virtual ~SgaObjectSvDraw() {};
168 virtual SgaObjKind GetObjKind() const { return SGA_OBJ_SVDRAW; }
170 public:
172 static sal_Bool DrawCentered( OutputDevice* pOut, const FmFormModel& rModel );
175 // ----------------
176 // - SgaObjectBmp -
177 // ----------------
179 class SgaObjectBmp: public SgaObject
181 private:
183 void Init( const Graphic& rGraphic, const INetURLObject& rURL );
185 virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
186 virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
188 virtual sal_uInt16 GetVersion() const { return 5; }
190 public:
192 SgaObjectBmp();
193 SgaObjectBmp( const INetURLObject& rURL );
194 SgaObjectBmp( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormat );
195 virtual ~SgaObjectBmp() {};
197 virtual SgaObjKind GetObjKind() const { return SGA_OBJ_BMP; }
200 // -----------------
201 // - SgaObjectAnim -
202 // -----------------
204 class SgaObjectAnim : public SgaObjectBmp
206 private:
208 SgaObjectAnim( const INetURLObject& ) {};
210 public:
212 SgaObjectAnim();
213 SgaObjectAnim( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormatName );
215 virtual ~SgaObjectAnim() {};
217 virtual SgaObjKind GetObjKind() const { return SGA_OBJ_ANIM; }
220 // -----------------
221 // - SgaObjectINet -
222 // -----------------
224 class SgaObjectINet : public SgaObjectAnim
226 private:
228 SgaObjectINet( const INetURLObject& ) {};
230 public:
232 SgaObjectINet();
233 SgaObjectINet( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormatName );
235 virtual ~SgaObjectINet() {};
237 virtual SgaObjKind GetObjKind() const { return SGA_OBJ_INET; }
239 #endif
241 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */