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"
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
72 class SVX_DLLPUBLIC SgaObject
74 friend class GalleryTheme
;
78 void ImplUpdateURL( const INetURLObject
& rNewURL
) { aURL
= rNewURL
; }
83 GDIMetaFile aThumbMtf
;
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
);
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
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; }
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 // -------------------
148 class SgaObjectSvDraw
: public SgaObject
150 using SgaObject::CreateThumb
;
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; }
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
; }
172 static sal_Bool
DrawCentered( OutputDevice
* pOut
, const FmFormModel
& rModel
);
179 class SgaObjectBmp
: public SgaObject
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; }
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
; }
204 class SgaObjectAnim
: public SgaObjectBmp
208 SgaObjectAnim( const INetURLObject
& ) {};
213 SgaObjectAnim( const Graphic
& rGraphic
, const INetURLObject
& rURL
, const String
& rFormatName
);
215 virtual ~SgaObjectAnim() {};
217 virtual SgaObjKind
GetObjKind() const { return SGA_OBJ_ANIM
; }
224 class SgaObjectINet
: public SgaObjectAnim
228 SgaObjectINet( const INetURLObject
& ) {};
233 SgaObjectINet( const Graphic
& rGraphic
, const INetURLObject
& rURL
, const String
& rFormatName
);
235 virtual ~SgaObjectINet() {};
237 virtual SgaObjKind
GetObjKind() const { return SGA_OBJ_INET
; }
241 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */