1 /* This file is part of the wvWare 2 project 2 Copyright (C) 2003 Werner Trobin <trobin@kde.org> 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Library General Public 6 License version 2 as published by the Free Software Foundation. 7 8 This library is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 Library General Public License for more details. 12 13 You should have received a copy of the GNU Library General Public License 14 along with this library; see the file COPYING.LIB. If not, write to 15 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 Boston, MA 02111-1307, USA. 17 */ 18 19 #ifndef GRAPHICS_H 20 #define GRAPHICS_H 21 22 #include <string> 23 24 #include "word_helper.h" 25 26 using std::string; 27 28 namespace wvWare 29 { 30 class OLEStreamReader; 31 namespace Word97 32 { 33 struct FSPA; 34 struct FIB; 35 struct FTXBXS; 36 struct BKD; 37 } 38 39 class Drawings 40 { 41 public: 42 Drawings( OLEStreamReader* table, const Word97::FIB &fib ); 43 ~Drawings(); 44 45 private: 46 Drawings( const Drawings& rhs ); 47 Drawings& operator=( const Drawings& rhs ); 48 49 PLCF<Word97::FSPA>* m_plcfspaMom; 50 PLCF<Word97::FSPA>* m_plcfspaHdr; 51 52 PLCF<Word97::FTXBXS>* m_plcftxbxTxt; 53 PLCF<Word97::FTXBXS>* m_plcfHdrtxbxTxt; 54 55 PLCF<Word97::BKD>* m_plcftxbxBkd; 56 PLCF<Word97::BKD>* m_plcfHdrtxbxBkd; 57 }; 58 59 class Pictures 60 { 61 }; 62 63 typedef enum 64 { 65 msoblipUsageDefault, // All non-texture fill blips get this. 66 msoblipUsageTexture, 67 msoblipUsageMax = 255 // Since this is stored in a byte 68 } MSOBLIPUSAGE; 69 70 typedef enum 71 { // GEL provided types... 72 msoblipERROR = 0, // An error occured during loading 73 msoblipUNKNOWN, // An unknown blip type 74 msoblipEMF, // Windows Enhanced Metafile 75 msoblipWMF, // Windows Metafile 76 msoblipPICT, // Macintosh PICT 77 msoblipJPEG, // JFIF 78 msoblipPNG, // PNG 79 msoblipDIB, // Windows DIB 80 msoblipFirstClient = 32, // First client defined blip type 81 msoblipLastClient = 255 // Last client defined blip type 82 } MSOBLIPTYPE; 83 84 typedef enum 85 { 86 msobiUNKNOWN = 0, 87 msobiWMF = 0x216, // Metafile header then compressed WMF 88 msobiEMF = 0x3D4, // Metafile header then compressed EMF 89 msobiPICT = 0x542, // Metafile header then compressed PICT 90 msobiPNG = 0x6E0, // One byte tag then PNG data 91 msobiJFIF = 0x46A, // One byte tag then JFIF data 92 msobiJPEG = msobiJFIF, 93 msobiDIB = 0x7A8, // One byte tag then DIB data 94 msobiClient=0x800 // Clients should set this bit 95 } MSOBI; // Blip signature as encoded in the MSOFBH.inst 96 97 //this is a common header that every record 98 //in Escher streams share 99 class EscherHeader 100 { 101 public: 102 EscherHeader( OLEStreamReader* stream ); 103 ~EscherHeader(); 104 105 bool isAtom(); 106 int recordSize(); 107 string getRecordType(); 108 void dump(); 109 110 private: 111 U32 ver:4; //4 bits 112 U32 inst:12; //12 bits 113 U32 fbt:16; //16 bits 114 U32 cbLength; //4 bytes 115 }; //EscherHeader 116 117 //msofbtSpContainer 118 //msofbtSp 119 //msofbtOPT 120 //msoftbClientAnchor 121 122 //this is a structure inside the msofbtBSE 123 //record 124 class FBSE 125 { 126 public: 127 FBSE( OLEStreamReader* stream ); 128 ~FBSE(); 129 130 int recordSize();//size of the record without the Escher header 131 //(does NOT include actual picture data, either, which is in a 132 //new record) 133 int getBlipType(); 134 int getStreamOffset(); 135 int getNameLength(); 136 void dump(); 137 138 private: 139 MSOBLIPTYPE btWin32; //required type on Win32 140 MSOBLIPTYPE btMacOS; //required type on Mac 141 U8 rgbUid[ 16 ]; //identifier of the blip 142 U16 tag; //unused 143 U32 size; //blip size in the stream 144 U32 cRef; //reference count on the blip 145 U32 foDelay; //file offset in the delay stream 146 MSOBLIPUSAGE usage; //how this blip is used 147 U8 cbName; //length of blip name 148 U8 unused2; //unused 149 U8 unused3; //unused 150 }; //FBSE 151 152 //this is a structure that actually contains the 153 //image data (it follows the FBSE in a new record) 154 class Blip 155 { 156 public: 157 Blip( OLEStreamReader* stream, string blipType ); 158 ~Blip(); 159 160 bool isMetafileBlip(); //is this an EMF, WMF, or PICT? 161 bool isCompressed(); //is this blip compressed? (only applied to metafile blips) 162 int recordSize(); //size of the record *without* the actual picture data 163 int imageSize(); //size of the *uncompressed* image 164 int compressedImageSize(); //size of the *compressed* image 165 void dump(); 166 private: 167 U8 m_rgbUid[16]; 168 U8 m_bTag; 169 U8 m_rgbUidPrimary[16]; //not always present! 170 U32 m_cb; 171 U32 m_rcBounds; 172 U32 m_ptSize; 173 U32 m_cbSave; 174 U8 m_fCompression; 175 U8 m_fFilter; 176 string m_blipType; 177 unsigned int m_size; //store size of record (without actual picture data) 178 //this is set in the constructor when the data is read in 179 bool m_isMetafileBlip; //flag for remembering whether it's metafile or bitmap 180 }; //Blip 181 182 } // namespace wvWare 183 184 #endif // GRAPHICS_H 185