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 <config_options.h>
24 #include <tools/urlobj.hxx>
25 #include <vcl/graph.hxx>
26 #include <vcl/gdimtf.hxx>
27 #include <svx/galmisc.hxx>
44 class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC
) SgaObject
46 friend class GalleryTheme
;
47 friend class GalleryFileStorage
;
51 void ImplUpdateURL( const INetURLObject
& rNewURL
) { aURL
= rNewURL
; }
55 BitmapEx aThumbBmp
; // Allow transparence to survive
56 GDIMetaFile aThumbMtf
;
62 virtual void WriteData( SvStream
& rOut
, const OUString
& rDestDir
) const;
63 virtual void ReadData( SvStream
& rIn
, sal_uInt16
& rReadVersion
);
65 bool CreateThumb( const Graphic
& rGraphic
);
69 SgaObject(const SgaObject
& aObject
);
71 virtual ~SgaObject() {};
73 virtual SgaObjKind
GetObjKind() const = 0;
74 virtual sal_uInt16
GetVersion() const = 0;
76 virtual BitmapEx
GetThumbBmp() const { return aThumbBmp
; }
77 const GDIMetaFile
& GetThumbMtf() const { return aThumbMtf
; }
78 const INetURLObject
& GetURL() const { return aURL
; }
79 bool IsValid() const { return bIsValid
; }
80 bool IsThumbBitmap() const { return bIsThumbBmp
; }
82 OUString
const & GetTitle() const;
83 void SetTitle( const OUString
& rTitle
);
85 friend SvStream
& WriteSgaObject( SvStream
& rOut
, const SgaObject
& rObj
);
86 friend SvStream
& ReadSgaObject( SvStream
& rIn
, SgaObject
& rObj
);
88 BitmapEx
createPreviewBitmapEx(const Size
& rSizePixel
) const;
91 class SgaObjectSound final
: public SgaObject
95 GalSoundType eSoundType
;
97 virtual void WriteData( SvStream
& rOut
, const OUString
& rDestDir
) const override
;
98 virtual void ReadData( SvStream
& rIn
, sal_uInt16
& rReadVersion
) override
;
100 virtual sal_uInt16
GetVersion() const override
{ return 6; }
105 SgaObjectSound( const INetURLObject
& rURL
);
106 virtual ~SgaObjectSound() override
;
108 virtual SgaObjKind
GetObjKind() const override
{ return SgaObjKind::Sound
; }
109 virtual BitmapEx
GetThumbBmp() const override
;
114 class SgaObjectSvDraw final
: public SgaObject
116 using SgaObject::CreateThumb
;
120 bool CreateThumb( const FmFormModel
& rModel
);
122 virtual void WriteData( SvStream
& rOut
, const OUString
& rDestDir
) const override
;
123 virtual void ReadData( SvStream
& rIn
, sal_uInt16
& rReadVersion
) override
;
125 virtual sal_uInt16
GetVersion() const override
{ return 5; }
130 SgaObjectSvDraw( const FmFormModel
& rModel
, const INetURLObject
& rURL
);
131 SgaObjectSvDraw( SvStream
& rIStm
, const INetURLObject
& rURL
);
133 virtual SgaObjKind
GetObjKind() const override
{ return SgaObjKind::SvDraw
; }
136 class SgaObjectBmp
: public SgaObject
140 void Init( const Graphic
& rGraphic
, const INetURLObject
& rURL
);
142 virtual void WriteData( SvStream
& rOut
, const OUString
& rDestDir
) const override
;
143 virtual void ReadData( SvStream
& rIn
, sal_uInt16
& rReadVersion
) override
;
145 virtual sal_uInt16
GetVersion() const override
{ return 5; }
150 SgaObjectBmp( const INetURLObject
& rURL
);
151 SgaObjectBmp( const Graphic
& rGraphic
, const INetURLObject
& rURL
);
153 virtual SgaObjKind
GetObjKind() const override
{ return SgaObjKind::Bitmap
; }
156 class SgaObjectAnim
: public SgaObjectBmp
161 SgaObjectAnim( const Graphic
& rGraphic
, const INetURLObject
& rURL
);
163 virtual SgaObjKind
GetObjKind() const override
{ return SgaObjKind::Animation
; }
166 class SgaObjectINet final
: public SgaObjectAnim
171 SgaObjectINet( const Graphic
& rGraphic
, const INetURLObject
& rURL
);
173 virtual SgaObjKind
GetObjKind() const override
{ return SgaObjKind::Inet
; }
177 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */