Line data Source code
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_SD_SOURCE_FILTER_PPT_PROPREAD_HXX
21 : #define INCLUDED_SD_SOURCE_FILTER_PPT_PROPREAD_HXX
22 :
23 : #include <map>
24 : #include <boost/ptr_container/ptr_vector.hpp>
25 :
26 : #include <sal/types.h>
27 : #include <sot/storage.hxx>
28 : #include <tools/stream.hxx>
29 :
30 : // SummaryInformation
31 : #define PID_TITLE 0x02
32 : #define PID_SUBJECT 0x03
33 : #define PID_AUTHOR 0x04
34 : #define PID_KEYWORDS 0x05
35 : #define PID_COMMENTS 0x06
36 : #define PID_TEMPLATE 0x07
37 : #define PID_LASTAUTHOR 0x08
38 : #define PID_REVNUMBER 0x09
39 : #define PID_EDITTIME 0x0a
40 : #define PID_LASTPRINTED_DTM 0x0b
41 : #define PID_CREATE_DTM 0x0c
42 : #define PID_LASTSAVED_DTM 0x0d
43 :
44 : // DocumentSummaryInformation
45 : #define PID_CATEGORY 0x02
46 : #define PID_PRESFORMAT 0x03
47 : #define PID_BYTECOUNT 0x04
48 : #define PID_LINECOUNT 0x05
49 : #define PID_PARACOUNT 0x06
50 : #define PID_SLIDECOUNT 0x07
51 : #define PID_NOTECOUNT 0x08
52 : #define PID_HIDDENCOUNT 0x09
53 : #define PID_MMCLIPCOUNT 0x0a
54 : #define PID_SCALE 0x0b
55 : #define PID_HEADINGPAIR 0x0c
56 : #define PID_DOCPARTS 0x0d
57 : #define PID_MANAGER 0x0e
58 : #define PID_COMPANY 0x0f
59 : #define PID_LINKSDIRTY 0x10
60 :
61 : #define VT_EMPTY 0
62 : #define VT_NULL 1
63 : #define VT_I2 2
64 : #define VT_I4 3
65 : #define VT_R4 4
66 : #define VT_R8 5
67 : #define VT_CY 6
68 : #define VT_DATE 7
69 : #define VT_BSTR 8
70 : #define VT_UI4 9
71 : #define VT_ERROR 10
72 : #define VT_BOOL 11
73 : #define VT_VARIANT 12
74 : #define VT_DECIMAL 14
75 : #define VT_I1 16
76 : #define VT_UI1 17
77 : #define VT_UI2 18
78 : #define VT_I8 20
79 : #define VT_UI8 21
80 : #define VT_INT 22
81 : #define VT_UINT 23
82 : #define VT_LPSTR 30
83 : #define VT_LPWSTR 31
84 : #define VT_FILETIME 64
85 : #define VT_BLOB 65
86 : #define VT_STREAM 66
87 : #define VT_STORAGE 67
88 : #define VT_STREAMED_OBJECT 68
89 : #define VT_STORED_OBJECT 69
90 : #define VT_BLOB_OBJECT 70
91 : #define VT_CF 71
92 : #define VT_CLSID 72
93 : #define VT_VECTOR 0x1000
94 : #define VT_ARRAY 0x2000
95 : #define VT_BYREF 0x4000
96 : #define VT_TYPEMASK 0xFFF
97 :
98 : typedef std::map<OUString,sal_uInt32> Dictionary;
99 :
100 : struct PropEntry
101 : {
102 : sal_uInt32 mnId;
103 : sal_uInt32 mnSize;
104 : sal_uInt16 mnTextEnc;
105 : sal_uInt8* mpBuf;
106 :
107 : PropEntry( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBufSize, sal_uInt16 nTextEnc );
108 : PropEntry( const PropEntry& rProp );
109 332 : ~PropEntry() { delete[] mpBuf; } ;
110 :
111 : PropEntry& operator=(const PropEntry& rPropEntry);
112 : };
113 :
114 40 : class PropItem : public SvMemoryStream
115 : {
116 : sal_uInt16 mnTextEnc;
117 :
118 : public:
119 40 : PropItem()
120 40 : : mnTextEnc(RTL_TEXTENCODING_DONTKNOW)
121 : {
122 40 : }
123 : void Clear();
124 :
125 46 : void SetTextEncoding( sal_uInt16 nTextEnc ){ mnTextEnc = nTextEnc; };
126 : bool Read( OUString& rString, sal_uInt32 nType = VT_EMPTY, bool bDwordAlign = true );
127 : PropItem& operator=( PropItem& rPropItem );
128 :
129 : using SvStream::Read;
130 : };
131 :
132 56 : class Section
133 : {
134 : sal_uInt16 mnTextEnc;
135 : boost::ptr_vector<PropEntry> maEntries;
136 :
137 : protected:
138 :
139 : sal_uInt8 aFMTID[ 16 ];
140 :
141 : void AddProperty( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBufSize );
142 :
143 : public:
144 : Section( const sal_uInt8* pFMTID );
145 : Section( const Section& rSection );
146 :
147 : Section& operator=( const Section& rSection );
148 : bool GetProperty( sal_uInt32 nId, PropItem& rPropItem );
149 : bool GetDictionary( Dictionary& rDict );
150 46 : const sal_uInt8* GetFMTID() const { return aFMTID; };
151 : void Read( SvStorageStream* pStrm );
152 : };
153 :
154 18 : class PropRead
155 : {
156 : bool mbStatus;
157 : SvStorageStreamRef mpSvStream;
158 :
159 : sal_uInt16 mnByteOrder;
160 : sal_uInt16 mnFormat;
161 : sal_uInt16 mnVersionLo;
162 : sal_uInt16 mnVersionHi;
163 : sal_uInt8 mApplicationCLSID[ 16 ];
164 : boost::ptr_vector<Section> maSections;
165 :
166 : void AddSection( Section& rSection );
167 :
168 : public:
169 : PropRead( SvStorage& rSvStorage, const OUString& rName );
170 :
171 : PropRead& operator=( const PropRead& rPropRead );
172 : const Section* GetSection( const sal_uInt8* pFMTID );
173 18 : bool IsValid() const { return mbStatus; };
174 : void Read();
175 : };
176 :
177 : #endif
178 :
179 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|