LibreOffice Module svx (master)  1
galobj.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_SVX_INC_GALOBJ_HXX
21 #define INCLUDED_SVX_INC_GALOBJ_HXX
22 
23 #include <tools/urlobj.hxx>
24 #include <vcl/graph.hxx>
25 #include <vcl/gdimtf.hxx>
26 #include <svx/galmisc.hxx>
27 
28 #define S_THUMB 80
29 
30 
32 {
41 };
42 
44 {
45  friend class GalleryTheme;
46 
47 private:
48 
49  void ImplUpdateURL( const INetURLObject& rNewURL ) { aURL = rNewURL; }
50 
51 protected:
52 
53  BitmapEx aThumbBmp; // Allow transparence to survive
56  OUString aTitle;
57  bool bIsValid;
59 
60  virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const;
61  virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
62 
63  bool CreateThumb( const Graphic& rGraphic );
64 
65 public:
66  SgaObject();
67  virtual ~SgaObject() {};
68 
69  virtual SgaObjKind GetObjKind() const = 0;
70  virtual sal_uInt16 GetVersion() const = 0;
71 
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; }
77 
78  OUString const & GetTitle() const;
79  void SetTitle( const OUString& rTitle );
80 
81  friend SvStream& WriteSgaObject( SvStream& rOut, const SgaObject& rObj );
82  friend SvStream& ReadSgaObject( SvStream& rIn, SgaObject& rObj );
83 
84  BitmapEx createPreviewBitmapEx(const Size& rSizePixel) const;
85 };
86 
87 class SgaObjectSound : public SgaObject
88 {
89 private:
90 
92 
93  virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const override;
94  virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion ) override;
95 
96  virtual sal_uInt16 GetVersion() const override { return 6; }
97 
98 public:
99 
100  SgaObjectSound();
101  SgaObjectSound( const INetURLObject& rURL );
102  virtual ~SgaObjectSound() override;
103 
104  virtual SgaObjKind GetObjKind() const override { return SgaObjKind::Sound; }
105  virtual BitmapEx GetThumbBmp() const override;
106 };
107 
108 class FmFormModel;
109 
111 {
113 
114 private:
115 
116  bool CreateThumb( const FmFormModel& rModel );
117 
118  virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const override;
119  virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion ) override;
120 
121  virtual sal_uInt16 GetVersion() const override { return 5; }
122 
123 public:
124 
125  SgaObjectSvDraw();
126  SgaObjectSvDraw( const FmFormModel& rModel, const INetURLObject& rURL );
127  SgaObjectSvDraw( SvStream& rIStm, const INetURLObject& rURL );
128 
129  virtual SgaObjKind GetObjKind() const override { return SgaObjKind::SvDraw; }
130 };
131 
132 class SgaObjectBmp: public SgaObject
133 {
134 private:
135 
136  void Init( const Graphic& rGraphic, const INetURLObject& rURL );
137 
138  virtual void WriteData( SvStream& rOut, const OUString& rDestDir ) const override;
139  virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion ) override;
140 
141  virtual sal_uInt16 GetVersion() const override { return 5; }
142 
143 public:
144 
145  SgaObjectBmp();
146  SgaObjectBmp( const INetURLObject& rURL );
147  SgaObjectBmp( const Graphic& rGraphic, const INetURLObject& rURL );
148 
149  virtual SgaObjKind GetObjKind() const override { return SgaObjKind::Bitmap; }
150 };
151 
153 {
154 public:
155 
156  SgaObjectAnim();
157  SgaObjectAnim( const Graphic& rGraphic, const INetURLObject& rURL );
158 
159  virtual SgaObjKind GetObjKind() const override { return SgaObjKind::Animation; }
160 };
161 
163 {
164 public:
165 
166  SgaObjectINet();
167  SgaObjectINet( const Graphic& rGraphic, const INetURLObject& rURL );
168 
169  virtual SgaObjKind GetObjKind() const override { return SgaObjKind::Inet; }
170 };
171 #endif
172 
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
GDIMetaFile aThumbMtf
Definition: galobj.hxx:54
BitmapEx aThumbBmp
Definition: galobj.hxx:53
const GDIMetaFile & GetThumbMtf() const
Definition: galobj.hxx:73
bool CreateThumb(const Graphic &rGraphic)
Definition: galobj.cxx:92
virtual void ReadData(SvStream &rIn, sal_uInt16 &rReadVersion) override
Definition: galobj.cxx:346
virtual ~SgaObjectSound() override
Definition: galobj.cxx:310
URL aURL
virtual BitmapEx GetThumbBmp() const override
Definition: galobj.cxx:314
virtual BitmapEx GetThumbBmp() const
Definition: galobj.hxx:72
virtual sal_uInt16 GetVersion() const override
Definition: galobj.hxx:141
virtual ~SgaObject()
Definition: galobj.hxx:67
SvStream & ReadSgaObject(SvStream &rIn, SgaObject &rObj)
Definition: galobj.cxx:234
virtual void WriteData(SvStream &rOut, const OUString &rDestDir) const override
Definition: galobj.cxx:339
bool CreateThumb(const FmFormModel &rModel)
Definition: galobj.cxx:438
SAL_DLLPRIVATE SvStream & WriteData(SvStream &rOut) const
Definition: galtheme.cxx:1236
virtual void WriteData(SvStream &rOut, const OUString &rDestDir) const override
Definition: galobj.cxx:495
SvStream & WriteSgaObject(SvStream &rOut, const SgaObject &rObj)
Definition: galobj.cxx:228
INetURLObject aURL
Definition: galobj.hxx:55
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
virtual SgaObjKind GetObjKind() const override
Definition: galobj.hxx:104
UNOTOOLS_DLLPUBLIC bool GetTitle(OUString const &url, OUString *title)
bool IsThumbBitmap() const
Definition: galobj.hxx:76
bool bIsThumbBmp
Definition: galobj.hxx:58
SAL_DLLPRIVATE SvStream & ReadData(SvStream &rIn)
Definition: galtheme.cxx:1324
virtual sal_uInt16 GetVersion() const override
Definition: galobj.hxx:121
virtual void ReadData(SvStream &rIn, sal_uInt16 &rReadVersion) override
Definition: galobj.cxx:501
const INetURLObject & GetURL() const
Definition: galobj.hxx:74
SgaObjKind
Definition: galmisc.hxx:54
virtual sal_uInt16 GetVersion() const override
Definition: galobj.hxx:96
virtual void ReadData(SvStream &rIn, sal_uInt16 &rReadVersion) override
Definition: galobj.cxx:279
virtual SgaObjKind GetObjKind() const override
Definition: galobj.hxx:129
GalSoundType eSoundType
Definition: galobj.hxx:91
void Init(const Graphic &rGraphic, const INetURLObject &rURL)
Definition: galobj.cxx:263
bool IsValid() const
Definition: galobj.hxx:75
virtual SgaObjKind GetObjKind() const override
Definition: galobj.hxx:169
GalSoundType
Definition: galobj.hxx:31
virtual void WriteData(SvStream &rOut, const OUString &rDestDir) const override
Definition: galobj.cxx:269
void ImplUpdateURL(const INetURLObject &rNewURL)
Definition: galobj.hxx:49
sal_uInt16 GetVersion(sal_uInt16)
Definition: legacyitem.cxx:29
OUString aTitle
Definition: galobj.hxx:56
virtual SgaObjKind GetObjKind() const override
Definition: galobj.hxx:149
virtual SgaObjKind GetObjKind() const override
Definition: galobj.hxx:159
bool bIsValid
Definition: galobj.hxx:57