Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / svx / inc / galobj.hxx
blob68b988f2c0a59490a7f92b4d4f808e1874b05cf8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <vcl/gdimtf.hxx>
26 #include <svx/galmisc.hxx>
28 #define S_THUMB 80
31 enum GalSoundType
33 SOUND_STANDARD = 0,
34 SOUND_COMPUTER = 1,
35 SOUND_MISC = 2,
36 SOUND_MUSIC = 3,
37 SOUND_NATURE = 4,
38 SOUND_SPEECH = 5,
39 SOUND_TECHNIC = 6,
40 SOUND_ANIMAL = 7
43 class SVX_DLLPUBLIC SgaObject
45 friend class GalleryTheme;
47 private:
49 void ImplUpdateURL( const INetURLObject& rNewURL ) { aURL = rNewURL; }
51 protected:
53 BitmapEx aThumbBmp; // Allow transparence to survive
54 GDIMetaFile aThumbMtf;
55 INetURLObject aURL;
56 OUString aTitle;
57 bool bIsValid;
58 bool bIsThumbBmp;
60 virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const;
61 virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
63 bool CreateThumb( const Graphic& rGraphic );
65 public:
66 SgaObject();
67 virtual ~SgaObject() {};
69 virtual SgaObjKind GetObjKind() const = 0;
70 virtual sal_uInt16 GetVersion() const = 0;
72 virtual BitmapEx GetThumbBmp() const { return aThumbBmp; }
73 const GDIMetaFile& GetThumbMtf() const { return aThumbMtf; }
74 const INetURLObject& GetURL() const { return aURL; }
75 bool IsValid() const { return bIsValid; }
76 bool IsThumbBitmap() const { return bIsThumbBmp; }
78 OUString const & GetTitle() const;
79 void SetTitle( const OUString& rTitle );
81 friend SvStream& WriteSgaObject( SvStream& rOut, const SgaObject& rObj );
82 friend SvStream& ReadSgaObject( SvStream& rIn, SgaObject& rObj );
84 BitmapEx createPreviewBitmapEx(const Size& rSizePixel) const;
87 class SgaObjectSound : public SgaObject
89 private:
91 GalSoundType eSoundType;
93 virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const override;
94 virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion ) override;
96 virtual sal_uInt16 GetVersion() const override { return 6; }
98 public:
100 SgaObjectSound();
101 SgaObjectSound( const INetURLObject& rURL );
102 virtual ~SgaObjectSound() override;
104 virtual SgaObjKind GetObjKind() const override { return SgaObjKind::Sound; }
105 virtual BitmapEx GetThumbBmp() const override;
108 class FmFormModel;
110 class SgaObjectSvDraw : public SgaObject
112 using SgaObject::CreateThumb;
114 private:
116 bool CreateThumb( const FmFormModel& rModel );
118 virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const override;
119 virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion ) override;
121 virtual sal_uInt16 GetVersion() const override { return 5; }
123 public:
125 SgaObjectSvDraw();
126 SgaObjectSvDraw( const FmFormModel& rModel, const INetURLObject& rURL );
127 SgaObjectSvDraw( SvStream& rIStm, const INetURLObject& rURL );
129 virtual SgaObjKind GetObjKind() const override { return SgaObjKind::SvDraw; }
132 class SgaObjectBmp: public SgaObject
134 private:
136 void Init( const Graphic& rGraphic, const INetURLObject& rURL );
138 virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const override;
139 virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion ) override;
141 virtual sal_uInt16 GetVersion() const override { return 5; }
143 public:
145 SgaObjectBmp();
146 SgaObjectBmp( const INetURLObject& rURL );
147 SgaObjectBmp( const Graphic& rGraphic, const INetURLObject& rURL );
149 virtual SgaObjKind GetObjKind() const override { return SgaObjKind::Bitmap; }
152 class SgaObjectAnim : public SgaObjectBmp
154 public:
156 SgaObjectAnim();
157 SgaObjectAnim( const Graphic& rGraphic, const INetURLObject& rURL );
159 virtual SgaObjKind GetObjKind() const override { return SgaObjKind::Animation; }
162 class SgaObjectINet : public SgaObjectAnim
164 public:
166 SgaObjectINet();
167 SgaObjectINet( const Graphic& rGraphic, const INetURLObject& rURL );
169 virtual SgaObjKind GetObjKind() const override { return SgaObjKind::Inet; }
171 #endif
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */