LibreOffice Module sd (master) 1
propread.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#pragma once
21
22#include <map>
23#include <vector>
24#include <memory>
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_CREATE_DTM 0x0c
40
41// DocumentSummaryInformation
42#define PID_SLIDECOUNT 0x07
43#define PID_HEADINGPAIR 0x0c
44#define PID_DOCPARTS 0x0d
45
46#define VT_EMPTY 0
47#define VT_NULL 1
48#define VT_I2 2
49#define VT_I4 3
50#define VT_R4 4
51#define VT_R8 5
52#define VT_CY 6
53#define VT_DATE 7
54#define VT_BSTR 8
55#define VT_ERROR 10
56#define VT_BOOL 11
57#define VT_VARIANT 12
58#define VT_DECIMAL 14
59#define VT_I1 16
60#define VT_UI1 17
61#define VT_UI2 18
62#define VT_UI4 19
63#define VT_I8 20
64#define VT_UI8 21
65#define VT_INT 22
66#define VT_UINT 23
67#define VT_LPSTR 30
68#define VT_LPWSTR 31
69#define VT_FILETIME 64
70#define VT_BLOB 65
71#define VT_STREAM 66
72#define VT_STORAGE 67
73#define VT_STREAMED_OBJECT 68
74#define VT_STORED_OBJECT 69
75#define VT_BLOB_OBJECT 70
76#define VT_CF 71
77#define VT_CLSID 72
78#define VT_VECTOR 0x1000
79#define VT_ARRAY 0x2000
80#define VT_BYREF 0x4000
81#define VT_TYPEMASK 0xFFF
82
83typedef std::map<OUString,sal_uInt32> PropDictionary;
84
86{
87 sal_uInt32 mnId;
88 sal_uInt32 mnSize;
89 std::unique_ptr<sal_uInt8[]> mpBuf;
90
91 PropEntry( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBufSize );
92 PropEntry( const PropEntry& rProp );
93
94 PropEntry& operator=(const PropEntry& rPropEntry);
95};
96
98{
99 sal_uInt16 mnTextEnc;
100
101public:
103 : mnTextEnc(RTL_TEXTENCODING_DONTKNOW)
104 {
105 }
106 void Clear();
107
108 void SetTextEncoding( sal_uInt16 nTextEnc ){ mnTextEnc = nTextEnc; };
109 bool Read( OUString& rString, sal_uInt32 nType = VT_EMPTY, bool bDwordAlign = true );
110 PropItem& operator=( PropItem& rPropItem );
111};
112
113class Section final
114{
115 sal_uInt16 mnTextEnc;
116 std::vector<std::unique_ptr<PropEntry> > maEntries;
117
119
120 void AddProperty( sal_uInt32 nId, const sal_uInt8* pBuf, sal_uInt32 nBufSize );
121
122 public:
123 explicit Section( const sal_uInt8* pFMTID );
124 Section( const Section& rSection );
125
126 Section& operator=( const Section& rSection );
127 bool GetProperty( sal_uInt32 nId, PropItem& rPropItem );
128 void GetDictionary( PropDictionary& rDict );
129 const sal_uInt8* GetFMTID() const { return aFMTID; };
130 void Read( SotStorageStream* pStrm );
131};
132
134{
137
138 sal_uInt16 mnByteOrder;
140 std::vector<std::unique_ptr<Section> > maSections;
141
142 public:
143 PropRead( SotStorage& rSvStorage, const OUString& rName );
144
145 PropRead& operator=( const PropRead& rPropRead );
146 const Section* GetSection( const sal_uInt8* pFMTID );
147 bool IsValid() const { return mbStatus; };
148 void Read();
149};
150
151/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PropItem & operator=(PropItem &rPropItem)
Definition: propread.cxx:190
void Clear()
Definition: propread.cxx:56
bool Read(OUString &rString, sal_uInt32 nType=VT_EMPTY, bool bDwordAlign=true)
Definition: propread.cxx:73
void SetTextEncoding(sal_uInt16 nTextEnc)
Definition: propread.hxx:108
sal_uInt16 mnTextEnc
Definition: propread.hxx:99
bool mbStatus
Definition: propread.hxx:135
bool IsValid() const
Definition: propread.hxx:147
const Section * GetSection(const sal_uInt8 *pFMTID)
Definition: propread.cxx:551
std::vector< std::unique_ptr< Section > > maSections
Definition: propread.hxx:140
PropRead & operator=(const PropRead &rPropRead)
Definition: propread.cxx:599
tools::SvRef< SotStorageStream > mpSvStream
Definition: propread.hxx:136
void Read()
Definition: propread.cxx:560
sal_uInt8 mApplicationCLSID[16]
Definition: propread.hxx:139
sal_uInt16 mnByteOrder
Definition: propread.hxx:138
PropRead(SotStorage &rSvStorage, const OUString &rName)
Definition: propread.cxx:535
Section & operator=(const Section &rSection)
Definition: propread.cxx:523
void GetDictionary(PropDictionary &rDict)
Definition: propread.cxx:262
Section(const sal_uInt8 *pFMTID)
Definition: propread.cxx:212
bool GetProperty(sal_uInt32 nId, PropItem &rPropItem)
Definition: propread.cxx:218
void Read(SotStorageStream *pStrm)
Definition: propread.cxx:311
std::vector< std::unique_ptr< PropEntry > > maEntries
Definition: propread.hxx:116
sal_uInt16 mnTextEnc
Definition: propread.hxx:115
void AddProperty(sal_uInt32 nId, const sal_uInt8 *pBuf, sal_uInt32 nBufSize)
Definition: propread.cxx:237
const sal_uInt8 * GetFMTID() const
Definition: propread.hxx:129
sal_uInt8 aFMTID[16]
Definition: propread.hxx:118
#define VT_EMPTY
Definition: propread.hxx:46
std::map< OUString, sal_uInt32 > PropDictionary
Definition: propread.hxx:83
PropEntry(sal_uInt32 nId, const sal_uInt8 *pBuf, sal_uInt32 nBufSize)
Definition: propread.cxx:28
sal_uInt32 mnSize
Definition: propread.hxx:88
sal_uInt32 mnId
Definition: propread.hxx:87
PropEntry & operator=(const PropEntry &rPropEntry)
Definition: propread.cxx:44
std::unique_ptr< sal_uInt8[]> mpBuf
Definition: propread.hxx:89
unsigned char sal_uInt8