1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _PROPREAD_HXX_ 25 #define _PROPREAD_HXX_ 26 27 #include <tools/solar.h> 28 #include <sot/storage.hxx> 29 #include <tools/gen.hxx> 30 #include <tools/list.hxx> 31 #include <tools/stream.hxx> 32 #include <tools/datetime.hxx> 33 34 #include <tools/string.hxx> 35 36 // SummaryInformation 37 #define PID_TITLE 0x02 38 #define PID_SUBJECT 0x03 39 #define PID_AUTHOR 0x04 40 #define PID_KEYWORDS 0x05 41 #define PID_COMMENTS 0x06 42 #define PID_TEMPLATE 0x07 43 #define PID_LASTAUTHOR 0x08 44 #define PID_REVNUMBER 0x09 45 #define PID_EDITTIME 0x0a 46 #define PID_LASTPRINTED_DTM 0x0b 47 #define PID_CREATE_DTM 0x0c 48 #define PID_LASTSAVED_DTM 0x0d 49 50 // DocumentSummaryInformation 51 #define PID_CATEGORY 0x02 52 #define PID_PRESFORMAT 0x03 53 #define PID_BYTECOUNT 0x04 54 #define PID_LINECOUNT 0x05 55 #define PID_PARACOUNT 0x06 56 #define PID_SLIDECOUNT 0x07 57 #define PID_NOTECOUNT 0x08 58 #define PID_HIDDENCOUNT 0x09 59 #define PID_MMCLIPCOUNT 0x0a 60 #define PID_SCALE 0x0b 61 #define PID_HEADINGPAIR 0x0c 62 #define PID_DOCPARTS 0x0d 63 #define PID_MANAGER 0x0e 64 #define PID_COMPANY 0x0f 65 #define PID_LINKSDIRTY 0x10 66 67 #define VT_EMPTY 0 68 #define VT_NULL 1 69 #define VT_I2 2 70 #define VT_I4 3 71 #define VT_R4 4 72 #define VT_R8 5 73 #define VT_CY 6 74 #define VT_DATE 7 75 #define VT_BSTR 8 76 #define VT_UI4 9 77 #define VT_ERROR 10 78 #define VT_BOOL 11 79 #define VT_VARIANT 12 80 #define VT_DECIMAL 14 81 #define VT_I1 16 82 #define VT_UI1 17 83 #define VT_UI2 18 84 #define VT_I8 20 85 #define VT_UI8 21 86 #define VT_INT 22 87 #define VT_UINT 23 88 #define VT_LPSTR 30 89 #define VT_LPWSTR 31 90 #define VT_FILETIME 64 91 #define VT_BLOB 65 92 #define VT_STREAM 66 93 #define VT_STORAGE 67 94 #define VT_STREAMED_OBJECT 68 95 #define VT_STORED_OBJECT 69 96 #define VT_BLOB_OBJECT 70 97 #define VT_CF 71 98 #define VT_CLSID 72 99 #define VT_VECTOR 0x1000 100 #define VT_ARRAY 0x2000 101 #define VT_BYREF 0x4000 102 #define VT_TYPEMASK 0xFFF 103 104 // ------------------------------------------------------------------------ 105 106 class PropItem : public SvMemoryStream 107 { 108 sal_uInt16 mnTextEnc; 109 110 public : PropItem()111 PropItem(){}; 112 void Clear(); 113 SetTextEncoding(sal_uInt16 nTextEnc)114 void SetTextEncoding( sal_uInt16 nTextEnc ){ mnTextEnc = nTextEnc; }; 115 sal_Bool Read( String& rString, sal_uInt32 nType = VT_EMPTY, sal_Bool bDwordAlign = sal_True ); 116 PropItem& operator=( PropItem& rPropItem ); 117 118 using SvStream::Read; 119 }; 120 121 // ------------------------------------------------------------------------ 122 123 class Dictionary : protected List 124 { 125 friend class Section; 126 127 void AddProperty( sal_uInt32 nId, const String& rString ); 128 129 public : Dictionary()130 Dictionary(){}; 131 ~Dictionary(); 132 Dictionary& operator=( Dictionary& rDictionary ); 133 sal_uInt32 GetProperty( const String& rPropName ); 134 }; 135 136 // ------------------------------------------------------------------------ 137 138 class Section : private List 139 { 140 sal_uInt16 mnTextEnc; 141 142 protected: 143 144 sal_uInt8 aFMTID[ 16 ]; 145 146 void AddProperty( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBufSize ); 147 148 public: 149 Section( const sal_uInt8* pFMTID ); 150 Section( Section& rSection ); 151 ~Section(); 152 153 Section& operator=( Section& rSection ); 154 sal_Bool GetProperty( sal_uInt32 nId, PropItem& rPropItem ); 155 sal_Bool GetDictionary( Dictionary& rDict ); GetFMTID() const156 const sal_uInt8* GetFMTID() const { return aFMTID; }; 157 void Read( SvStorageStream* pStrm ); 158 }; 159 160 // ------------------------------------------------------------------------ 161 162 class PropRead : private List 163 { 164 sal_Bool mbStatus; 165 SvStorageStreamRef mpSvStream; 166 167 sal_uInt16 mnByteOrder; 168 sal_uInt16 mnFormat; 169 sal_uInt16 mnVersionLo; 170 sal_uInt16 mnVersionHi; 171 sal_uInt8 mApplicationCLSID[ 16 ]; 172 173 void AddSection( Section& rSection ); 174 175 public: 176 PropRead( SvStorage& rSvStorage, const String& rName ); 177 ~PropRead(); 178 179 PropRead& operator=( PropRead& rPropRead ); 180 const Section* GetSection( const sal_uInt8* pFMTID ); IsValid() const181 sal_Bool IsValid() const { return mbStatus; }; 182 void Read(); 183 }; 184 185 186 #endif 187 188