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 INCLUDED_SVX_INC_GALOBJ_HXX
21 #define INCLUDED_SVX_INC_GALOBJ_HXX
23 #include <tools/urlobj.hxx>
24 #include <vcl/graph.hxx>
25 #include <svx/galmisc.hxx>
42 class SVX_DLLPUBLIC SgaObject
44 friend class GalleryTheme
;
48 void ImplUpdateURL( const INetURLObject
& rNewURL
) { aURL
= rNewURL
; }
52 BitmapEx aThumbBmp
; // Allow transparence to survive
53 GDIMetaFile aThumbMtf
;
59 virtual void WriteData( SvStream
& rOut
, const OUString
& rDestDir
) const;
60 virtual void ReadData( SvStream
& rIn
, sal_uInt16
& rReadVersion
);
62 bool CreateThumb( const Graphic
& rGraphic
);
66 virtual ~SgaObject() {};
68 virtual SgaObjKind
GetObjKind() const = 0;
69 virtual sal_uInt16
GetVersion() const = 0;
71 virtual BitmapEx
GetThumbBmp() const { return aThumbBmp
; }
72 const GDIMetaFile
& GetThumbMtf() const { return aThumbMtf
; }
73 const INetURLObject
& GetURL() const { return aURL
; }
74 bool IsValid() const { return bIsValid
; }
75 bool IsThumbBitmap() const { return bIsThumbBmp
; }
77 OUString
const & GetTitle() const;
78 void SetTitle( const OUString
& rTitle
);
80 friend SvStream
& WriteSgaObject( SvStream
& rOut
, const SgaObject
& rObj
);
81 friend SvStream
& ReadSgaObject( SvStream
& rIn
, SgaObject
& rObj
);
83 BitmapEx
createPreviewBitmapEx(const Size
& rSizePixel
) const;
86 class SgaObjectSound
: public SgaObject
90 GalSoundType eSoundType
;
92 virtual void WriteData( SvStream
& rOut
, const OUString
& rDestDir
) const override
;
93 virtual void ReadData( SvStream
& rIn
, sal_uInt16
& rReadVersion
) override
;
95 virtual sal_uInt16
GetVersion() const override
{ return 6; }
100 SgaObjectSound( const INetURLObject
& rURL
);
101 virtual ~SgaObjectSound() override
;
103 virtual SgaObjKind
GetObjKind() const override
{ return SgaObjKind::Sound
; }
104 virtual BitmapEx
GetThumbBmp() const override
;
109 class SgaObjectSvDraw
: public SgaObject
111 using SgaObject::CreateThumb
;
115 bool CreateThumb( const FmFormModel
& rModel
);
117 virtual void WriteData( SvStream
& rOut
, const OUString
& rDestDir
) const override
;
118 virtual void ReadData( SvStream
& rIn
, sal_uInt16
& rReadVersion
) override
;
120 virtual sal_uInt16
GetVersion() const override
{ return 5; }
125 SgaObjectSvDraw( const FmFormModel
& rModel
, const INetURLObject
& rURL
);
126 SgaObjectSvDraw( SvStream
& rIStm
, const INetURLObject
& rURL
);
128 virtual SgaObjKind
GetObjKind() const override
{ return SgaObjKind::SvDraw
; }
131 class SgaObjectBmp
: public SgaObject
135 void Init( const Graphic
& rGraphic
, const INetURLObject
& rURL
);
137 virtual void WriteData( SvStream
& rOut
, const OUString
& rDestDir
) const override
;
138 virtual void ReadData( SvStream
& rIn
, sal_uInt16
& rReadVersion
) override
;
140 virtual sal_uInt16
GetVersion() const override
{ return 5; }
145 SgaObjectBmp( const INetURLObject
& rURL
);
146 SgaObjectBmp( const Graphic
& rGraphic
, const INetURLObject
& rURL
);
148 virtual SgaObjKind
GetObjKind() const override
{ return SgaObjKind::Bitmap
; }
151 class SgaObjectAnim
: public SgaObjectBmp
156 SgaObjectAnim( const Graphic
& rGraphic
, const INetURLObject
& rURL
);
158 virtual SgaObjKind
GetObjKind() const override
{ return SgaObjKind::Animation
; }
161 class SgaObjectINet
: public SgaObjectAnim
166 SgaObjectINet( const Graphic
& rGraphic
, const INetURLObject
& rURL
);
168 virtual SgaObjKind
GetObjKind() const override
{ return SgaObjKind::Inet
; }
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */