13334a7e6SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 33334a7e6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 43334a7e6SAndrew Rist * or more contributor license agreements. See the NOTICE file 53334a7e6SAndrew Rist * distributed with this work for additional information 63334a7e6SAndrew Rist * regarding copyright ownership. The ASF licenses this file 73334a7e6SAndrew Rist * to you under the Apache License, Version 2.0 (the 83334a7e6SAndrew Rist * "License"); you may not use this file except in compliance 93334a7e6SAndrew Rist * with the License. You may obtain a copy of the License at 103334a7e6SAndrew Rist * 113334a7e6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 123334a7e6SAndrew Rist * 133334a7e6SAndrew Rist * Unless required by applicable law or agreed to in writing, 143334a7e6SAndrew Rist * software distributed under the License is distributed on an 153334a7e6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 163334a7e6SAndrew Rist * KIND, either express or implied. See the License for the 173334a7e6SAndrew Rist * specific language governing permissions and limitations 183334a7e6SAndrew Rist * under the License. 193334a7e6SAndrew Rist * 203334a7e6SAndrew Rist *************************************************************/ 213334a7e6SAndrew Rist 223334a7e6SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SVX_GALOBJ_HXX_ 25cdf0e10cSrcweir #define _SVX_GALOBJ_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <tools/urlobj.hxx> 28cdf0e10cSrcweir #include <vcl/graph.hxx> 29cdf0e10cSrcweir #include "svx/galmisc.hxx" 30cdf0e10cSrcweir 31cdf0e10cSrcweir // ----------- 32cdf0e10cSrcweir // - Defines - 33cdf0e10cSrcweir // ----------- 34cdf0e10cSrcweir 35cdf0e10cSrcweir #define S_THUMB 80 36cdf0e10cSrcweir 37cdf0e10cSrcweir // ----------------------------------------------------------------------------- 38cdf0e10cSrcweir 39cdf0e10cSrcweir #define SGA_FORMAT_NONE 0x00000000L 40cdf0e10cSrcweir #define SGA_FORMAT_STRING 0x00000001L 41cdf0e10cSrcweir #define SGA_FORMAT_GRAPHIC 0x00000010L 42cdf0e10cSrcweir #define SGA_FORMAT_SOUND 0x00000100L 43cdf0e10cSrcweir #define SGA_FORMAT_OLE 0x00001000L 44cdf0e10cSrcweir #define SGA_FORMAT_SVDRAW 0x00010000L 45cdf0e10cSrcweir #define SGA_FORMAT_ALL 0xFFFFFFFFL 46cdf0e10cSrcweir 47cdf0e10cSrcweir // ---------------- 48cdf0e10cSrcweir // - GalSoundType - 49cdf0e10cSrcweir // ---------------- 50cdf0e10cSrcweir 51cdf0e10cSrcweir enum GalSoundType 52cdf0e10cSrcweir { 53cdf0e10cSrcweir SOUND_STANDARD = 0, 54cdf0e10cSrcweir SOUND_COMPUTER = 1, 55cdf0e10cSrcweir SOUND_MISC = 2, 56cdf0e10cSrcweir SOUND_MUSIC = 3, 57cdf0e10cSrcweir SOUND_NATURE = 4, 58cdf0e10cSrcweir SOUND_SPEECH = 5, 59cdf0e10cSrcweir SOUND_TECHNIC = 6, 60cdf0e10cSrcweir SOUND_ANIMAL = 7 61cdf0e10cSrcweir }; 62cdf0e10cSrcweir 63cdf0e10cSrcweir // ------------- 64cdf0e10cSrcweir // - SgaObject - 65cdf0e10cSrcweir // ------------- 66cdf0e10cSrcweir 67cdf0e10cSrcweir class SVX_DLLPUBLIC SgaObject 68cdf0e10cSrcweir { 69cdf0e10cSrcweir friend class GalleryTheme; 70cdf0e10cSrcweir 71cdf0e10cSrcweir private: 72cdf0e10cSrcweir 73cdf0e10cSrcweir void ImplUpdateURL( const INetURLObject& rNewURL ) { aURL = rNewURL; } 74cdf0e10cSrcweir 75cdf0e10cSrcweir protected: 76cdf0e10cSrcweir 77*6dd94783SArmin Le Grand BitmapEx aThumbBmp; // Allow transparence to survive 78cdf0e10cSrcweir GDIMetaFile aThumbMtf; 79cdf0e10cSrcweir INetURLObject aURL; 80cdf0e10cSrcweir String aUserName; 81cdf0e10cSrcweir String aTitle; 82cdf0e10cSrcweir sal_Bool bIsValid; 83cdf0e10cSrcweir sal_Bool bIsThumbBmp; 84cdf0e10cSrcweir 85cdf0e10cSrcweir virtual void WriteData( SvStream& rOut, const String& rDestDir ) const; 86cdf0e10cSrcweir virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion ); 87cdf0e10cSrcweir 88cdf0e10cSrcweir sal_Bool CreateThumb( const Graphic& rGraphic ); 89cdf0e10cSrcweir 90cdf0e10cSrcweir public: 91cdf0e10cSrcweir 92cdf0e10cSrcweir SgaObject(); 93cdf0e10cSrcweir virtual ~SgaObject() {}; 94cdf0e10cSrcweir 95cdf0e10cSrcweir virtual SgaObjKind GetObjKind() const = 0; 96cdf0e10cSrcweir virtual sal_uInt16 GetVersion() const = 0; 97cdf0e10cSrcweir 98*6dd94783SArmin Le Grand virtual BitmapEx GetThumbBmp() const { return aThumbBmp; } 99cdf0e10cSrcweir const GDIMetaFile& GetThumbMtf() const { return aThumbMtf; } 100cdf0e10cSrcweir const INetURLObject& GetURL() const { return aURL; } 101cdf0e10cSrcweir sal_Bool IsValid() const { return bIsValid; } 102cdf0e10cSrcweir sal_Bool IsThumbBitmap() const { return bIsThumbBmp; } 103cdf0e10cSrcweir 104cdf0e10cSrcweir const String GetTitle() const; 105cdf0e10cSrcweir void SetTitle( const String& rTitle ); 106cdf0e10cSrcweir 107cdf0e10cSrcweir friend SvStream& operator<<( SvStream& rOut, const SgaObject& rObj ); 108cdf0e10cSrcweir friend SvStream& operator>>( SvStream& rIn, SgaObject& rObj ); 109cdf0e10cSrcweir }; 110cdf0e10cSrcweir 111cdf0e10cSrcweir // ------------------ 112cdf0e10cSrcweir // - SgaObjectSound - 113cdf0e10cSrcweir // ------------------ 114cdf0e10cSrcweir 115cdf0e10cSrcweir class SgaObjectSound : public SgaObject 116cdf0e10cSrcweir { 117cdf0e10cSrcweir private: 118cdf0e10cSrcweir 119cdf0e10cSrcweir GalSoundType eSoundType; 120cdf0e10cSrcweir 121cdf0e10cSrcweir virtual void WriteData( SvStream& rOut, const String& rDestDir ) const; 122cdf0e10cSrcweir virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion ); 123cdf0e10cSrcweir 124cdf0e10cSrcweir virtual sal_uInt16 GetVersion() const { return 6; } 125cdf0e10cSrcweir 126cdf0e10cSrcweir public: 127cdf0e10cSrcweir 128cdf0e10cSrcweir SgaObjectSound(); 129cdf0e10cSrcweir SgaObjectSound( const INetURLObject& rURL ); 130cdf0e10cSrcweir virtual ~SgaObjectSound(); 131cdf0e10cSrcweir 132cdf0e10cSrcweir virtual SgaObjKind GetObjKind() const { return SGA_OBJ_SOUND; } 133*6dd94783SArmin Le Grand virtual BitmapEx GetThumbBmp() const; 134cdf0e10cSrcweir GalSoundType GetSoundType() const { return eSoundType; } 135cdf0e10cSrcweir }; 136cdf0e10cSrcweir 137cdf0e10cSrcweir // ------------------- 138cdf0e10cSrcweir // - SgaObjectSvDraw - 139cdf0e10cSrcweir // ------------------- 140cdf0e10cSrcweir 141cdf0e10cSrcweir class FmFormModel; 142cdf0e10cSrcweir 143cdf0e10cSrcweir class SgaObjectSvDraw : public SgaObject 144cdf0e10cSrcweir { 145cdf0e10cSrcweir using SgaObject::CreateThumb; 146cdf0e10cSrcweir 147cdf0e10cSrcweir private: 148cdf0e10cSrcweir 149cdf0e10cSrcweir sal_Bool CreateThumb( const FmFormModel& rModel ); 150cdf0e10cSrcweir 151cdf0e10cSrcweir virtual void WriteData( SvStream& rOut, const String& rDestDir ) const; 152cdf0e10cSrcweir virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion ); 153cdf0e10cSrcweir 154cdf0e10cSrcweir virtual sal_uInt16 GetVersion() const { return 5; } 155cdf0e10cSrcweir 156cdf0e10cSrcweir public: 157cdf0e10cSrcweir 158cdf0e10cSrcweir SgaObjectSvDraw(); 159cdf0e10cSrcweir SgaObjectSvDraw( const FmFormModel& rModel, const INetURLObject& rURL ); 160cdf0e10cSrcweir SgaObjectSvDraw( SvStream& rIStm, const INetURLObject& rURL ); 161cdf0e10cSrcweir virtual ~SgaObjectSvDraw() {}; 162cdf0e10cSrcweir 163cdf0e10cSrcweir virtual SgaObjKind GetObjKind() const { return SGA_OBJ_SVDRAW; } 164cdf0e10cSrcweir }; 165cdf0e10cSrcweir 166cdf0e10cSrcweir // ---------------- 167cdf0e10cSrcweir // - SgaObjectBmp - 168cdf0e10cSrcweir // ---------------- 169cdf0e10cSrcweir 170cdf0e10cSrcweir class SgaObjectBmp: public SgaObject 171cdf0e10cSrcweir { 172cdf0e10cSrcweir private: 173cdf0e10cSrcweir 174cdf0e10cSrcweir void Init( const Graphic& rGraphic, const INetURLObject& rURL ); 175cdf0e10cSrcweir 176cdf0e10cSrcweir virtual void WriteData( SvStream& rOut, const String& rDestDir ) const; 177cdf0e10cSrcweir virtual void ReadData( SvStream& rIn, sal_uInt16& rReadVersion ); 178cdf0e10cSrcweir 179cdf0e10cSrcweir virtual sal_uInt16 GetVersion() const { return 5; } 180cdf0e10cSrcweir 181cdf0e10cSrcweir public: 182cdf0e10cSrcweir 183cdf0e10cSrcweir SgaObjectBmp(); 184cdf0e10cSrcweir SgaObjectBmp( const INetURLObject& rURL ); 185cdf0e10cSrcweir SgaObjectBmp( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormat ); 186cdf0e10cSrcweir virtual ~SgaObjectBmp() {}; 187cdf0e10cSrcweir 188cdf0e10cSrcweir virtual SgaObjKind GetObjKind() const { return SGA_OBJ_BMP; } 189cdf0e10cSrcweir }; 190cdf0e10cSrcweir 191cdf0e10cSrcweir // ----------------- 192cdf0e10cSrcweir // - SgaObjectAnim - 193cdf0e10cSrcweir // ----------------- 194cdf0e10cSrcweir 195cdf0e10cSrcweir class SgaObjectAnim : public SgaObjectBmp 196cdf0e10cSrcweir { 197cdf0e10cSrcweir private: 198cdf0e10cSrcweir 199cdf0e10cSrcweir SgaObjectAnim( const INetURLObject& ) {}; 200cdf0e10cSrcweir 201cdf0e10cSrcweir public: 202cdf0e10cSrcweir 203cdf0e10cSrcweir SgaObjectAnim(); 204cdf0e10cSrcweir SgaObjectAnim( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormatName ); 205cdf0e10cSrcweir 206cdf0e10cSrcweir virtual ~SgaObjectAnim() {}; 207cdf0e10cSrcweir 208cdf0e10cSrcweir virtual SgaObjKind GetObjKind() const { return SGA_OBJ_ANIM; } 209cdf0e10cSrcweir }; 210cdf0e10cSrcweir 211cdf0e10cSrcweir // ----------------- 212cdf0e10cSrcweir // - SgaObjectINet - 213cdf0e10cSrcweir // ----------------- 214cdf0e10cSrcweir 215cdf0e10cSrcweir class SgaObjectINet : public SgaObjectAnim 216cdf0e10cSrcweir { 217cdf0e10cSrcweir private: 218cdf0e10cSrcweir 219cdf0e10cSrcweir SgaObjectINet( const INetURLObject& ) {}; 220cdf0e10cSrcweir 221cdf0e10cSrcweir public: 222cdf0e10cSrcweir 223cdf0e10cSrcweir SgaObjectINet(); 224cdf0e10cSrcweir SgaObjectINet( const Graphic& rGraphic, const INetURLObject& rURL, const String& rFormatName ); 225cdf0e10cSrcweir 226cdf0e10cSrcweir virtual ~SgaObjectINet() {}; 227cdf0e10cSrcweir 228cdf0e10cSrcweir virtual SgaObjKind GetObjKind() const { return SGA_OBJ_INET; } 229cdf0e10cSrcweir }; 230cdf0e10cSrcweir #endif 231