Branch data 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 _SVX_GALOBJ_HXX_
21 : : #define _SVX_GALOBJ_HXX_
22 : :
23 : : #include <tools/urlobj.hxx>
24 : : #include <vcl/graph.hxx>
25 : : #include "svx/galmisc.hxx"
26 : :
27 : : // -----------
28 : : // - Defines -
29 : : // -----------
30 : :
31 : : #define S_THUMB 80
32 : :
33 : : // -----------------------------------------------------------------------------
34 : :
35 : : #define SGA_FORMAT_NONE 0x00000000L
36 : : #define SGA_FORMAT_STRING 0x00000001L
37 : : #define SGA_FORMAT_GRAPHIC 0x00000010L
38 : : #define SGA_FORMAT_SOUND 0x00000100L
39 : : #define SGA_FORMAT_OLE 0x00001000L
40 : : #define SGA_FORMAT_SVDRAW 0x00010000L
41 : : #define SGA_FORMAT_ALL 0xFFFFFFFFL
42 : :
43 : : // ----------------
44 : : // - GalSoundType -
45 : : // ----------------
46 : :
47 : : enum GalSoundType
48 : : {
49 : : SOUND_STANDARD = 0,
50 : : SOUND_COMPUTER = 1,
51 : : SOUND_MISC = 2,
52 : : SOUND_MUSIC = 3,
53 : : SOUND_NATURE = 4,
54 : : SOUND_SPEECH = 5,
55 : : SOUND_TECHNIC = 6,
56 : : SOUND_ANIMAL = 7
57 : : };
58 : :
59 : : // -------------
60 : : // - SgaObject -
61 : : // -------------
62 : :
63 : : class SVX_DLLPUBLIC SgaObject
64 : : {
65 : : friend class GalleryTheme;
66 : :
67 : : private:
68 : :
69 : 0 : void ImplUpdateURL( const INetURLObject& rNewURL ) { aURL = rNewURL; }
70 : :
71 : : protected:
72 : :
73 : : Bitmap aThumbBmp;
74 : : GDIMetaFile aThumbMtf;
75 : : INetURLObject aURL;
76 : : String aUserName;
77 : : String aTitle;
78 : : sal_Bool bIsValid;
79 : : sal_Bool bIsThumbBmp;
80 : :
81 : : virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
82 : : virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
83 : :
84 : : sal_Bool CreateThumb( const Graphic& rGraphic );
85 : :
86 : : public:
87 : :
88 : : SgaObject();
89 [ # # ][ # # ]: 0 : virtual ~SgaObject() {};
[ # # ][ # # ]
[ # # ]
90 : :
91 : : virtual SgaObjKind GetObjKind() const = 0;
92 : : virtual sal_uInt16 GetVersion() const = 0;
93 : :
94 : 0 : virtual Bitmap GetThumbBmp() const { return aThumbBmp; }
95 : 0 : const GDIMetaFile& GetThumbMtf() const { return aThumbMtf; }
96 : 0 : const INetURLObject& GetURL() const { return aURL; }
97 : 0 : sal_Bool IsValid() const { return bIsValid; }
98 : 0 : sal_Bool IsThumbBitmap() const { return bIsThumbBmp; }
99 : :
100 : : const String GetTitle() const;
101 : : void SetTitle( const String& rTitle );
102 : :
103 : : friend SvStream& operator<<( SvStream& rOut, const SgaObject& rObj );
104 : : friend SvStream& operator>>( SvStream& rIn, SgaObject& rObj );
105 : : };
106 : :
107 : : // ------------------
108 : : // - SgaObjectSound -
109 : : // ------------------
110 : :
111 : : class SgaObjectSound : public SgaObject
112 : : {
113 : : private:
114 : :
115 : : GalSoundType eSoundType;
116 : :
117 : : virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
118 : : virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
119 : :
120 : 0 : virtual sal_uInt16 GetVersion() const { return 6; }
121 : :
122 : : public:
123 : :
124 : : SgaObjectSound();
125 : : SgaObjectSound( const INetURLObject& rURL );
126 : : virtual ~SgaObjectSound();
127 : :
128 : 0 : virtual SgaObjKind GetObjKind() const { return SGA_OBJ_SOUND; }
129 : : virtual Bitmap GetThumbBmp() const;
130 : : GalSoundType GetSoundType() const { return eSoundType; }
131 : : };
132 : :
133 : : // -------------------
134 : : // - SgaObjectSvDraw -
135 : : // -------------------
136 : :
137 : : class FmFormModel;
138 : :
139 : : class SgaObjectSvDraw : public SgaObject
140 : : {
141 : : using SgaObject::CreateThumb;
142 : :
143 : : private:
144 : :
145 : : sal_Bool CreateThumb( const FmFormModel& rModel );
146 : :
147 : : virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
148 : : virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
149 : :
150 : 0 : virtual sal_uInt16 GetVersion() const { return 5; }
151 : :
152 : : public:
153 : :
154 : : SgaObjectSvDraw();
155 : : SgaObjectSvDraw( const FmFormModel& rModel, const INetURLObject& rURL );
156 : : SgaObjectSvDraw( SvStream& rIStm, const INetURLObject& rURL );
157 [ # # ]: 0 : virtual ~SgaObjectSvDraw() {};
158 : :
159 : 0 : virtual SgaObjKind GetObjKind() const { return SGA_OBJ_SVDRAW; }
160 : :
161 : : public:
162 : :
163 : : static sal_Bool DrawCentered( OutputDevice* pOut, const FmFormModel& rModel );
164 : : };
165 : :
166 : : // ----------------
167 : : // - SgaObjectBmp -
168 : : // ----------------
169 : :
170 : : class SgaObjectBmp: public SgaObject
171 : : {
172 : : private:
173 : :
174 : : void Init( const Graphic& rGraphic, const INetURLObject& rURL );
175 : :
176 : : virtual void WriteData( SvStream& rOut, const String& rDestDir ) const;
177 : : virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
178 : :
179 : 0 : virtual sal_uInt16 GetVersion() const { return 5; }
180 : :
181 : : public:
182 : :
183 : : SgaObjectBmp();
184 : : SgaObjectBmp( const INetURLObject& rURL );
185 : : SgaObjectBmp( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormat );
186 [ # # ]: 0 : virtual ~SgaObjectBmp() {};
187 : :
188 : 0 : virtual SgaObjKind GetObjKind() const { return SGA_OBJ_BMP; }
189 : : };
190 : :
191 : : // -----------------
192 : : // - SgaObjectAnim -
193 : : // -----------------
194 : :
195 : : class SgaObjectAnim : public SgaObjectBmp
196 : : {
197 : : private:
198 : :
199 : : SgaObjectAnim( const INetURLObject& ) {};
200 : :
201 : : public:
202 : :
203 : : SgaObjectAnim();
204 : : SgaObjectAnim( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormatName );
205 : :
206 [ # # ]: 0 : virtual ~SgaObjectAnim() {};
207 : :
208 : 0 : virtual SgaObjKind GetObjKind() const { return SGA_OBJ_ANIM; }
209 : : };
210 : :
211 : : // -----------------
212 : : // - SgaObjectINet -
213 : : // -----------------
214 : :
215 : : class SgaObjectINet : public SgaObjectAnim
216 : : {
217 : : private:
218 : :
219 : : SgaObjectINet( const INetURLObject& ) {};
220 : :
221 : : public:
222 : :
223 : : SgaObjectINet();
224 : : SgaObjectINet( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormatName );
225 : :
226 [ # # ]: 0 : virtual ~SgaObjectINet() {};
227 : :
228 : 0 : virtual SgaObjKind GetObjKind() const { return SGA_OBJ_INET; }
229 : : };
230 : : #endif
231 : :
232 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|