Version 7.1.7.1, tag libreoffice-7.1.7.1
[LibreOffice.git] / svx / inc / galobj.hxx
blob1c2b013bf6f992be209e734a27b063dc1f6faffa
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 <config_options.h>
24 #include <tools/urlobj.hxx>
25 #include <vcl/graph.hxx>
26 #include <vcl/gdimtf.hxx>
27 #include <svx/galmisc.hxx>
28 #include <svx/gallerybinaryengine.hxx>
30 #define S_THUMB 80
33 enum GalSoundType
35 SOUND_STANDARD = 0,
36 SOUND_COMPUTER = 1,
37 SOUND_MISC = 2,
38 SOUND_MUSIC = 3,
39 SOUND_NATURE = 4,
40 SOUND_SPEECH = 5,
41 SOUND_TECHNIC = 6,
42 SOUND_ANIMAL = 7
45 class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) SgaObject
47 friend class GalleryTheme;
48 friend class GalleryBinaryEngine;
50 private:
52 void ImplUpdateURL( const INetURLObject& rNewURL ) { aURL = rNewURL; }
54 protected:
56 BitmapEx aThumbBmp; // Allow transparence to survive
57 GDIMetaFile aThumbMtf;
58 INetURLObject aURL;
59 OUString aTitle;
60 bool bIsValid;
61 bool bIsThumbBmp;
63 virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const;
64 virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
66 bool CreateThumb( const Graphic& rGraphic );
68 public:
69 SgaObject();
70 SgaObject(const SgaObject& aObject);
72 virtual ~SgaObject() {};
74 virtual SgaObjKind GetObjKind() const = 0;
75 virtual sal_uInt16 GetVersion() const = 0;
77 virtual BitmapEx GetThumbBmp() const { return aThumbBmp; }
78 const GDIMetaFile& GetThumbMtf() const { return aThumbMtf; }
79 const INetURLObject& GetURL() const { return aURL; }
80 bool IsValid() const { return bIsValid; }
81 bool IsThumbBitmap() const { return bIsThumbBmp; }
83 OUString const & GetTitle() const;
84 void SetTitle( const OUString& rTitle );
86 friend SvStream& WriteSgaObject( SvStream& rOut, const SgaObject& rObj );
87 friend SvStream& ReadSgaObject( SvStream& rIn, SgaObject& rObj );
89 BitmapEx createPreviewBitmapEx(const Size& rSizePixel) const;
92 class SgaObjectSound final : public SgaObject
94 private:
96 GalSoundType eSoundType;
98 virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const override;
99 virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion ) override;
101 virtual sal_uInt16 GetVersion() const override { return 6; }
103 public:
105 SgaObjectSound();
106 SgaObjectSound( const INetURLObject& rURL );
107 virtual ~SgaObjectSound() override;
109 virtual SgaObjKind GetObjKind() const override { return SgaObjKind::Sound; }
110 virtual BitmapEx GetThumbBmp() const override;
113 class FmFormModel;
115 class SgaObjectSvDraw final : public SgaObject
117 using SgaObject::CreateThumb;
119 private:
121 bool CreateThumb( const FmFormModel& rModel );
123 virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const override;
124 virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion ) override;
126 virtual sal_uInt16 GetVersion() const override { return 5; }
128 public:
130 SgaObjectSvDraw();
131 SgaObjectSvDraw( const FmFormModel& rModel, const INetURLObject& rURL );
132 SgaObjectSvDraw( SvStream& rIStm, const INetURLObject& rURL );
134 virtual SgaObjKind GetObjKind() const override { return SgaObjKind::SvDraw; }
137 class SgaObjectBmp: public SgaObject
139 private:
141 void Init( const Graphic& rGraphic, const INetURLObject& rURL );
143 virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const override;
144 virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion ) override;
146 virtual sal_uInt16 GetVersion() const override { return 5; }
148 public:
150 SgaObjectBmp();
151 SgaObjectBmp( const INetURLObject& rURL );
152 SgaObjectBmp( const Graphic& rGraphic, const INetURLObject& rURL );
154 virtual SgaObjKind GetObjKind() const override { return SgaObjKind::Bitmap; }
157 class SgaObjectAnim : public SgaObjectBmp
159 public:
161 SgaObjectAnim();
162 SgaObjectAnim( const Graphic& rGraphic, const INetURLObject& rURL );
164 virtual SgaObjKind GetObjKind() const override { return SgaObjKind::Animation; }
167 class SgaObjectINet final : public SgaObjectAnim
169 public:
171 SgaObjectINet();
172 SgaObjectINet( const Graphic& rGraphic, const INetURLObject& rURL );
174 virtual SgaObjKind GetObjKind() const override { return SgaObjKind::Inet; }
176 #endif
178 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */