xref: /aoo42x/main/svx/inc/galobj.hxx (revision 21b36550)
13334a7e6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
33334a7e6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
43334a7e6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
53334a7e6SAndrew Rist  * distributed with this work for additional information
63334a7e6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
73334a7e6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
83334a7e6SAndrew Rist  * "License"); you may not use this file except in compliance
93334a7e6SAndrew Rist  * with the License.  You may obtain a copy of the License at
103334a7e6SAndrew Rist  *
113334a7e6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
123334a7e6SAndrew Rist  *
133334a7e6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
143334a7e6SAndrew Rist  * software distributed under the License is distributed on an
153334a7e6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
163334a7e6SAndrew Rist  * KIND, either express or implied.  See the License for the
173334a7e6SAndrew Rist  * specific language governing permissions and limitations
183334a7e6SAndrew Rist  * under the License.
193334a7e6SAndrew Rist  *
203334a7e6SAndrew Rist  *************************************************************/
213334a7e6SAndrew Rist 
223334a7e6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SVX_GALOBJ_HXX_
25cdf0e10cSrcweir #define _SVX_GALOBJ_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <tools/urlobj.hxx>
28cdf0e10cSrcweir #include <vcl/graph.hxx>
29cdf0e10cSrcweir #include "svx/galmisc.hxx"
30cdf0e10cSrcweir 
31cdf0e10cSrcweir // -----------
32cdf0e10cSrcweir // - Defines -
33cdf0e10cSrcweir // -----------
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #define S_THUMB 80
36cdf0e10cSrcweir 
37cdf0e10cSrcweir // -----------------------------------------------------------------------------
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #define SGA_FORMAT_NONE					0x00000000L
40cdf0e10cSrcweir #define	SGA_FORMAT_STRING				0x00000001L
41cdf0e10cSrcweir #define	SGA_FORMAT_GRAPHIC				0x00000010L
42cdf0e10cSrcweir #define	SGA_FORMAT_SOUND				0x00000100L
43cdf0e10cSrcweir #define	SGA_FORMAT_OLE					0x00001000L
44cdf0e10cSrcweir #define	SGA_FORMAT_SVDRAW				0x00010000L
45cdf0e10cSrcweir #define SGA_FORMAT_ALL					0xFFFFFFFFL
46cdf0e10cSrcweir 
47cdf0e10cSrcweir // ----------------
48cdf0e10cSrcweir // - GalSoundType -
49cdf0e10cSrcweir // ----------------
50cdf0e10cSrcweir 
51cdf0e10cSrcweir enum GalSoundType
52cdf0e10cSrcweir {
53cdf0e10cSrcweir 	SOUND_STANDARD = 0,
54cdf0e10cSrcweir 	SOUND_COMPUTER = 1,
55cdf0e10cSrcweir 	SOUND_MISC = 2,
56cdf0e10cSrcweir 	SOUND_MUSIC = 3,
57cdf0e10cSrcweir 	SOUND_NATURE = 4,
58cdf0e10cSrcweir 	SOUND_SPEECH = 5,
59cdf0e10cSrcweir 	SOUND_TECHNIC = 6,
60cdf0e10cSrcweir 	SOUND_ANIMAL = 7
61cdf0e10cSrcweir };
62cdf0e10cSrcweir 
63cdf0e10cSrcweir // -------------
64cdf0e10cSrcweir // - SgaObject -
65cdf0e10cSrcweir // -------------
66cdf0e10cSrcweir 
67cdf0e10cSrcweir class SVX_DLLPUBLIC SgaObject
68cdf0e10cSrcweir {
69cdf0e10cSrcweir 	friend class GalleryTheme;
70cdf0e10cSrcweir 
71cdf0e10cSrcweir private:
72cdf0e10cSrcweir 
ImplUpdateURL(const INetURLObject & rNewURL)73cdf0e10cSrcweir 	void					ImplUpdateURL( const INetURLObject& rNewURL ) { aURL = rNewURL; }
74cdf0e10cSrcweir 
75cdf0e10cSrcweir protected:
76cdf0e10cSrcweir 
776dd94783SArmin Le Grand 	BitmapEx				aThumbBmp; // Allow transparence to survive
78cdf0e10cSrcweir 	GDIMetaFile				aThumbMtf;
79cdf0e10cSrcweir 	INetURLObject			aURL;
80cdf0e10cSrcweir 	String					aUserName;
81cdf0e10cSrcweir 	String					aTitle;
82cdf0e10cSrcweir 	sal_Bool					bIsValid;
83cdf0e10cSrcweir 	sal_Bool					bIsThumbBmp;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	virtual void 			WriteData( SvStream& rOut, const String& rDestDir ) const;
86cdf0e10cSrcweir 	virtual void 			ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	sal_Bool					CreateThumb( const Graphic& rGraphic );
89cdf0e10cSrcweir 
90cdf0e10cSrcweir public:
91cdf0e10cSrcweir 							SgaObject();
~SgaObject()92cdf0e10cSrcweir 	virtual					~SgaObject() {};
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 	virtual SgaObjKind		GetObjKind() const = 0;
95cdf0e10cSrcweir 	virtual sal_uInt16			GetVersion() const = 0;
96cdf0e10cSrcweir 
GetThumbBmp() const976dd94783SArmin Le Grand 	virtual BitmapEx		GetThumbBmp() const { return aThumbBmp; }
GetThumbMtf() const98cdf0e10cSrcweir 	const GDIMetaFile&		GetThumbMtf() const { return aThumbMtf; }
GetURL() const99cdf0e10cSrcweir 	const INetURLObject&	GetURL() const { return aURL; }
IsValid() const100cdf0e10cSrcweir 	sal_Bool					IsValid() const { return bIsValid; }
IsThumbBitmap() const101cdf0e10cSrcweir 	sal_Bool					IsThumbBitmap() const { return bIsThumbBmp; }
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     const String            GetTitle() const;
104cdf0e10cSrcweir     void                    SetTitle( const String& rTitle );
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	friend SvStream& 		operator<<( SvStream& rOut, const SgaObject& rObj );
107cdf0e10cSrcweir 	friend SvStream& 		operator>>( SvStream& rIn, SgaObject& rObj );
108*21b36550SArmin Le Grand 
109*21b36550SArmin Le Grand     BitmapEx createPreviewBitmapEx(const Size& rSizePixel) const;
110cdf0e10cSrcweir };
111cdf0e10cSrcweir 
112cdf0e10cSrcweir // ------------------
113cdf0e10cSrcweir // - SgaObjectSound -
114cdf0e10cSrcweir // ------------------
115cdf0e10cSrcweir 
116cdf0e10cSrcweir class SgaObjectSound : public SgaObject
117cdf0e10cSrcweir {
118cdf0e10cSrcweir private:
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 	GalSoundType		eSoundType;
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	virtual void 		WriteData( SvStream& rOut, const String& rDestDir ) const;
123cdf0e10cSrcweir 	virtual void 		ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
124cdf0e10cSrcweir 
GetVersion() const125cdf0e10cSrcweir 	virtual sal_uInt16		GetVersion() const { return 6; }
126cdf0e10cSrcweir 
127cdf0e10cSrcweir public:
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 						SgaObjectSound();
130cdf0e10cSrcweir 						SgaObjectSound( const INetURLObject& rURL );
131cdf0e10cSrcweir 	virtual 	   	   ~SgaObjectSound();
132cdf0e10cSrcweir 
GetObjKind() const133cdf0e10cSrcweir 	virtual SgaObjKind	GetObjKind() const { return SGA_OBJ_SOUND; }
1346dd94783SArmin Le Grand 	virtual BitmapEx	GetThumbBmp() const;
GetSoundType() const135cdf0e10cSrcweir 	GalSoundType		GetSoundType() const { return eSoundType; }
136cdf0e10cSrcweir };
137cdf0e10cSrcweir 
138cdf0e10cSrcweir // -------------------
139cdf0e10cSrcweir // - SgaObjectSvDraw -
140cdf0e10cSrcweir // -------------------
141cdf0e10cSrcweir 
142cdf0e10cSrcweir class FmFormModel;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir class SgaObjectSvDraw : public SgaObject
145cdf0e10cSrcweir {
146cdf0e10cSrcweir 	using SgaObject::CreateThumb;
147cdf0e10cSrcweir 
148cdf0e10cSrcweir private:
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 	sal_Bool				CreateThumb( const FmFormModel& rModel );
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 	virtual void 		WriteData( SvStream& rOut, const String& rDestDir ) const;
153cdf0e10cSrcweir 	virtual void 		ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
154cdf0e10cSrcweir 
GetVersion() const155cdf0e10cSrcweir 	virtual sal_uInt16		GetVersion() const { return 5; }
156cdf0e10cSrcweir 
157cdf0e10cSrcweir public:
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 						SgaObjectSvDraw();
160cdf0e10cSrcweir 						SgaObjectSvDraw( const FmFormModel& rModel, const INetURLObject& rURL );
161cdf0e10cSrcweir 						SgaObjectSvDraw( SvStream& rIStm, const INetURLObject& rURL );
~SgaObjectSvDraw()162cdf0e10cSrcweir 	virtual 	   	   ~SgaObjectSvDraw() {};
163cdf0e10cSrcweir 
GetObjKind() const164cdf0e10cSrcweir 	virtual SgaObjKind	GetObjKind() const { return SGA_OBJ_SVDRAW; }
165cdf0e10cSrcweir };
166cdf0e10cSrcweir 
167cdf0e10cSrcweir // ----------------
168cdf0e10cSrcweir // - SgaObjectBmp -
169cdf0e10cSrcweir // ----------------
170cdf0e10cSrcweir 
171cdf0e10cSrcweir class SgaObjectBmp: public SgaObject
172cdf0e10cSrcweir {
173cdf0e10cSrcweir private:
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 	void				Init( const Graphic& rGraphic, const INetURLObject& rURL );
176cdf0e10cSrcweir 
177cdf0e10cSrcweir 	virtual void   		WriteData( SvStream& rOut, const String& rDestDir ) const;
178cdf0e10cSrcweir 	virtual void   		ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
179cdf0e10cSrcweir 
GetVersion() const180cdf0e10cSrcweir 	virtual sal_uInt16		GetVersion() const { return 5; }
181cdf0e10cSrcweir 
182cdf0e10cSrcweir public:
183cdf0e10cSrcweir 
184cdf0e10cSrcweir 						SgaObjectBmp();
185cdf0e10cSrcweir 						SgaObjectBmp( const INetURLObject& rURL );
186cdf0e10cSrcweir 						SgaObjectBmp( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormat );
~SgaObjectBmp()187cdf0e10cSrcweir 	virtual				~SgaObjectBmp() {};
188cdf0e10cSrcweir 
GetObjKind() const189cdf0e10cSrcweir 	virtual SgaObjKind	GetObjKind() const { return SGA_OBJ_BMP; }
190cdf0e10cSrcweir };
191cdf0e10cSrcweir 
192cdf0e10cSrcweir // -----------------
193cdf0e10cSrcweir // - SgaObjectAnim -
194cdf0e10cSrcweir // -----------------
195cdf0e10cSrcweir 
196cdf0e10cSrcweir class SgaObjectAnim : public SgaObjectBmp
197cdf0e10cSrcweir {
198cdf0e10cSrcweir private:
199cdf0e10cSrcweir 
SgaObjectAnim(const INetURLObject &)200cdf0e10cSrcweir 						SgaObjectAnim( const INetURLObject& ) {};
201cdf0e10cSrcweir 
202cdf0e10cSrcweir public:
203cdf0e10cSrcweir 
204cdf0e10cSrcweir 						SgaObjectAnim();
205cdf0e10cSrcweir 						SgaObjectAnim( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormatName );
206cdf0e10cSrcweir 
~SgaObjectAnim()207cdf0e10cSrcweir 	virtual 	   	   ~SgaObjectAnim() {};
208cdf0e10cSrcweir 
GetObjKind() const209cdf0e10cSrcweir 	virtual SgaObjKind	GetObjKind() const { return SGA_OBJ_ANIM; }
210cdf0e10cSrcweir };
211cdf0e10cSrcweir 
212cdf0e10cSrcweir // -----------------
213cdf0e10cSrcweir // - SgaObjectINet -
214cdf0e10cSrcweir // -----------------
215cdf0e10cSrcweir 
216cdf0e10cSrcweir class SgaObjectINet : public SgaObjectAnim
217cdf0e10cSrcweir {
218cdf0e10cSrcweir private:
219cdf0e10cSrcweir 
SgaObjectINet(const INetURLObject &)220cdf0e10cSrcweir 						SgaObjectINet( const INetURLObject& ) {};
221cdf0e10cSrcweir 
222cdf0e10cSrcweir public:
223cdf0e10cSrcweir 
224cdf0e10cSrcweir 						SgaObjectINet();
225cdf0e10cSrcweir 						SgaObjectINet( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormatName );
226cdf0e10cSrcweir 
~SgaObjectINet()227cdf0e10cSrcweir 	virtual 	   	   ~SgaObjectINet() {};
228cdf0e10cSrcweir 
GetObjKind() const229cdf0e10cSrcweir 	virtual SgaObjKind	GetObjKind() const { return SGA_OBJ_INET; }
230cdf0e10cSrcweir };
231cdf0e10cSrcweir #endif
232