1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SVX_GALOBJ_HXX_
21 #define _SVX_GALOBJ_HXX_
23 #include <tools/urlobj.hxx>
24 #include <vcl/graph.hxx>
25 #include "svx/galmisc.hxx"
30 #define SGA_FORMAT_NONE 0x00000000L
31 #define SGA_FORMAT_STRING 0x00000001L
32 #define SGA_FORMAT_GRAPHIC 0x00000010L
33 #define SGA_FORMAT_SOUND 0x00000100L
34 #define SGA_FORMAT_OLE 0x00001000L
35 #define SGA_FORMAT_SVDRAW 0x00010000L
36 #define SGA_FORMAT_ALL 0xFFFFFFFFL
50 class SVX_DLLPUBLIC SgaObject
52 friend class GalleryTheme
;
56 void ImplUpdateURL( const INetURLObject
& rNewURL
) { aURL
= rNewURL
; }
60 BitmapEx aThumbBmp
; // Allow transparence to survive
61 GDIMetaFile aThumbMtf
;
68 virtual void WriteData( SvStream
& rOut
, const String
& rDestDir
) const;
69 virtual void ReadData( SvStream
& rIn
, sal_uInt16
& rReadVersion
);
71 sal_Bool
CreateThumb( const Graphic
& rGraphic
);
76 virtual ~SgaObject() {};
78 virtual SgaObjKind
GetObjKind() const = 0;
79 virtual sal_uInt16
GetVersion() const = 0;
81 virtual BitmapEx
GetThumbBmp() const { return aThumbBmp
; }
82 const GDIMetaFile
& GetThumbMtf() const { return aThumbMtf
; }
83 const INetURLObject
& GetURL() const { return aURL
; }
84 sal_Bool
IsValid() const { return bIsValid
; }
85 sal_Bool
IsThumbBitmap() const { return bIsThumbBmp
; }
87 const String
GetTitle() const;
88 void SetTitle( const String
& rTitle
);
90 friend SvStream
& operator<<( SvStream
& rOut
, const SgaObject
& rObj
);
91 friend SvStream
& operator>>( SvStream
& rIn
, SgaObject
& rObj
);
94 class SgaObjectSound
: public SgaObject
98 GalSoundType eSoundType
;
100 virtual void WriteData( SvStream
& rOut
, const String
& rDestDir
) const;
101 virtual void ReadData( SvStream
& rIn
, sal_uInt16
& rReadVersion
);
103 virtual sal_uInt16
GetVersion() const { return 6; }
108 SgaObjectSound( const INetURLObject
& rURL
);
109 virtual ~SgaObjectSound();
111 virtual SgaObjKind
GetObjKind() const { return SGA_OBJ_SOUND
; }
112 virtual BitmapEx
GetThumbBmp() const;
113 GalSoundType
GetSoundType() const { return eSoundType
; }
118 class SgaObjectSvDraw
: public SgaObject
120 using SgaObject::CreateThumb
;
124 sal_Bool
CreateThumb( const FmFormModel
& rModel
);
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 5; }
134 SgaObjectSvDraw( const FmFormModel
& rModel
, const INetURLObject
& rURL
);
135 SgaObjectSvDraw( SvStream
& rIStm
, const INetURLObject
& rURL
);
136 virtual ~SgaObjectSvDraw() {};
138 virtual SgaObjKind
GetObjKind() const { return SGA_OBJ_SVDRAW
; }
141 class SgaObjectBmp
: public SgaObject
145 void Init( const Graphic
& rGraphic
, const INetURLObject
& rURL
);
147 virtual void WriteData( SvStream
& rOut
, const String
& rDestDir
) const;
148 virtual void ReadData( SvStream
& rIn
, sal_uInt16
& rReadVersion
);
150 virtual sal_uInt16
GetVersion() const { return 5; }
155 SgaObjectBmp( const INetURLObject
& rURL
);
156 SgaObjectBmp( const Graphic
& rGraphic
, const INetURLObject
& rURL
, const String
& rFormat
);
157 virtual ~SgaObjectBmp() {};
159 virtual SgaObjKind
GetObjKind() const { return SGA_OBJ_BMP
; }
162 class SgaObjectAnim
: public SgaObjectBmp
166 SgaObjectAnim( const INetURLObject
& ) {};
171 SgaObjectAnim( const Graphic
& rGraphic
, const INetURLObject
& rURL
, const String
& rFormatName
);
173 virtual ~SgaObjectAnim() {};
175 virtual SgaObjKind
GetObjKind() const { return SGA_OBJ_ANIM
; }
178 class SgaObjectINet
: public SgaObjectAnim
182 SgaObjectINet( const INetURLObject
& ) {};
187 SgaObjectINet( const Graphic
& rGraphic
, const INetURLObject
& rURL
, const String
& rFormatName
);
189 virtual ~SgaObjectINet() {};
191 virtual SgaObjKind
GetObjKind() const { return SGA_OBJ_INET
; }
195 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */