LibreOffice Module lotuswordpro (master) 1
lwpdocdata.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*************************************************************************
3 *
4 * The Contents of this file are made available subject to the terms of
5 * either of the following licenses
6 *
7 * - GNU Lesser General Public License Version 2.1
8 * - Sun Industry Standards Source License Version 1.1
9 *
10 * Sun Microsystems Inc., October, 2000
11 *
12 * GNU Lesser General Public License Version 2.1
13 * =============================================
14 * Copyright 2000 by Sun Microsystems, Inc.
15 * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 *
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License version 2.1, as published by the Free Software Foundation.
20 *
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public
27 * License along with this library; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 * MA 02111-1307 USA
30 *
31 *
32 * Sun Industry Standards Source License Version 1.1
33 * =================================================
34 * The contents of this file are subject to the Sun Industry Standards
35 * Source License Version 1.1 (the "License"); You may not use this file
36 * except in compliance with the License. You may obtain a copy of the
37 * License at http://www.openoffice.org/license.html.
38 *
39 * Software provided under this License is provided on an "AS IS" basis,
40 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
41 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
42 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
43 * See the License for the specific provisions governing your rights and
44 * obligations concerning the Software.
45 *
46 * The Initial Developer of the Original Code is: IBM Corporation
47 *
48 * Copyright: 2008 by IBM Corporation
49 *
50 * All Rights Reserved.
51 *
52 * Contributor(s): _______________________________________
53 *
54 *
55 ************************************************************************/
56#include <memory>
57#include <lwpdocdata.hxx>
59#include <localtime.hxx>
60#include <lwpfilehdr.hxx>
61#include <lwpglobalmgr.hxx>
62
64 :LwpObject(objHdr, pStrm)//m_pEditorAttrList(0)
65{}
66
68{
69}
70
72{
73 //XFDateTime
74
75 //doc options
76 //cOptionFlag
77 m_DocOptions.nOptionFlag = m_pObjStrm->QuickReaduInt16();
78 //cEncrypt1Password
80 //cEncrypt2Password
82 //cCharacterSet
84 //cGrammerSet
86 //cShowMarginMarks
87 m_DocOptions.nMarginMarks = m_pObjStrm->QuickReaduInt16();
88 //cMarginMarksLocation
89 m_DocOptions.nMarginMarksLocation = m_pObjStrm->QuickReaduInt16();
90 //cMarginMarksChar
91 m_DocOptions.nMarginMarksChar = m_pObjStrm->QuickReaduInt16();
92 m_pObjStrm->SkipExtra();
93
94 //doc info
95 //cDescription
97 //cKeyWord
99 //cCreatedBy
101 //cCreationTime
102 m_DocInfo.nCreationTime = m_pObjStrm->QuickReadInt32();
104 //cLastRevisionTime
105 m_DocInfo.nLastRevisionTime = m_pObjStrm->QuickReadInt32();
107 //cTotalEditTime
108 m_DocInfo.nTotalEditTime = m_pObjStrm->QuickReadInt32();
109
113 //cpVerDocInfo
115
116 //EditorList
117 m_DocInfo.nNumEditedBy = m_pObjStrm->QuickReaduInt16();
118 std::unique_ptr<LwpAtomHolder[]> pCDLNList(new LwpAtomHolder[m_DocInfo.nNumEditedBy]);
119 std::unique_ptr<LwpAtomHolder[]> pEditorList(new LwpAtomHolder[m_DocInfo.nNumEditedBy]);
120 sal_uInt16 i = 0;
121 for ( i = 0; i < m_DocInfo.nNumEditedBy; i++)
122 {
123 //CDLNList
124 pCDLNList[i].Read(m_pObjStrm.get()); //cName
125 m_pObjStrm->SkipExtra();
126 //CEditedBy
127 pEditorList[i].Read(m_pObjStrm.get()); //cName
128 m_pObjStrm->SkipExtra();
129 }
130
131 m_pObjStrm->SkipExtra();
132
133 pCDLNList.reset();
134 pEditorList.reset();
135
136 //doc control
137 //cGreeting
139 //cFlags
140 m_DocControl.nFlags = m_pObjStrm->QuickReaduInt16();
141
142 //cDocControlProtection
143 m_DocControl.nDocControlProtection = m_pObjStrm->QuickReaduInt16();
144 //Len
145 m_DocControl.nLen1 = m_pObjStrm->QuickReaduInt16();
146 //skip doc control password string
147 m_pObjStrm->SeekRel(m_DocControl.nLen1);
148
149 //cFileProtection
150 m_DocControl.nFileProtection = m_pObjStrm->QuickReaduInt16();
151 //Len
152 m_DocControl.nLen2 = m_pObjStrm->QuickReaduInt16();
153 //skip file password string
154 m_pObjStrm->SeekRel(m_DocControl.nLen2);
155
156 //cAutoVersioning
157 m_DocControl.nAutoVersioning = m_pObjStrm->QuickReaduInt16();
158 //cDocControlOnlyEditor
160 //cEditorVerification
161 m_DocControl.nEditorVerification = m_pObjStrm->QuickReaduInt16();
162
163 m_pObjStrm->SkipExtra();
164
165 //editor list
166 //numeditors
167 sal_uInt16 numeditors = m_pObjStrm->QuickReaduInt16();
169
170 for (i = 0;i<numeditors;i++)
171 {
172 std::unique_ptr<LwpEditorAttr> xEditorAttr(new LwpEditorAttr);
173 //cName
174 xEditorAttr->cName.Read(m_pObjStrm.get());
175 //cInitials
176 xEditorAttr->cInitials.Read(m_pObjStrm.get());
177 //cHiLite
178 xEditorAttr->cHiLiteColor.Read(m_pObjStrm.get());
179
180 //cID
181 xEditorAttr->nID = m_pObjStrm->QuickReaduInt16();
182
183 //cInsFontOver
184 //CFontAttributeOverride --cAttrBits
185 xEditorAttr->cInsFontOver.cFontAttributeOverride.cAttrBits = m_pObjStrm->QuickReaduInt16();
186 //CFontAttributeOverride --cAttrOverrideBits
187 xEditorAttr->cInsFontOver.cFontAttributeOverride.cAttrOverrideBits = m_pObjStrm->QuickReaduInt16();
188 //CFontAttributeOverride --cAttrApplyBits
189 xEditorAttr->cInsFontOver.cFontAttributeOverride.cAttrApplyBits = m_pObjStrm->QuickReaduInt16();
190 //CFontAttributeOverride --cAttrOverrideBits2
191 xEditorAttr->cInsFontOver.cFontAttributeOverride.cAttrOverrideBits2 = m_pObjStrm->QuickReaduInt8();
192 //CFontAttributeOverride --cAttrApplyBits2
193 xEditorAttr->cInsFontOver.cFontAttributeOverride.cAttrApplyBits2 = m_pObjStrm->QuickReaduInt8();
194 //CFontAttributeOverride --cCase
195 xEditorAttr->cInsFontOver.cFontAttributeOverride.cCase = m_pObjStrm->QuickReaduInt8();
196 //CFontAttributeOverride --cUnder
197 xEditorAttr->cInsFontOver.cFontAttributeOverride.cUnder = m_pObjStrm->QuickReaduInt8();
198 m_pObjStrm->SkipExtra();
199 //CFontDescriptionOverrideBase--cOverrideBits
200 xEditorAttr->cInsFontOver.cFontDescriptionOverrideBase.cOverrideBits = m_pObjStrm->QuickReaduInt8();
201 //CFontDescriptionOverrideBase--cApplyBits
202 xEditorAttr->cInsFontOver.cFontDescriptionOverrideBase.cApplyBits = m_pObjStrm->QuickReaduInt8();
203 //CFontDescriptionOverrideBase--cPointSize
204 xEditorAttr->cInsFontOver.cFontDescriptionOverrideBase.cPointSize = m_pObjStrm->QuickReadInt32();
205 //CFontDescriptionOverrideBase--cOverstrike
206 xEditorAttr->cInsFontOver.cFontDescriptionOverrideBase.cOverstrike = m_pObjStrm->QuickReaduInt8();
207 //CFontDescriptionOverrideBase--cTightness
208 xEditorAttr->cInsFontOver.cFontDescriptionOverrideBase.cTightness = m_pObjStrm->QuickReaduInt16();
209 //CFontDescriptionOverrideBase--cColor
210 xEditorAttr->cInsFontOver.cFontDescriptionOverrideBase.cColor.Read(m_pObjStrm.get());
211
212 //CFontDescriptionOverrideBase--cBackgroundColor
213 xEditorAttr->cInsFontOver.cFontDescriptionOverrideBase.cBackgroundColor.Read(m_pObjStrm.get());
214
215 m_pObjStrm->SkipExtra();
216 //cFaceName
217 xEditorAttr->cInsFontOver.cFaceName.Read(m_pObjStrm.get());
218 //cAltFaceName
219 xEditorAttr->cInsFontOver.cAltFaceName.Read(m_pObjStrm.get());
220 m_pObjStrm->SkipExtra();
221
222 //cDelFontOver
223 //CFontAttributeOverride --cAttrBits
224 xEditorAttr->cDelFontOver.cFontAttributeOverride.cAttrBits = m_pObjStrm->QuickReaduInt16();
225 //CFontAttributeOverride --cAttrOverrideBits
226 xEditorAttr->cDelFontOver.cFontAttributeOverride.cAttrOverrideBits = m_pObjStrm->QuickReaduInt16();
227 //CFontAttributeOverride --cAttrApplyBits
228 xEditorAttr->cDelFontOver.cFontAttributeOverride.cAttrApplyBits = m_pObjStrm->QuickReaduInt16();
229 //CFontAttributeOverride --cAttrOverrideBits2
230 xEditorAttr->cDelFontOver.cFontAttributeOverride.cAttrOverrideBits2 = m_pObjStrm->QuickReaduInt8();
231 //CFontAttributeOverride --cAttrApplyBits2
232 xEditorAttr->cDelFontOver.cFontAttributeOverride.cAttrApplyBits2 = m_pObjStrm->QuickReaduInt8();
233 //CFontAttributeOverride --cCase
234 xEditorAttr->cDelFontOver.cFontAttributeOverride.cCase = m_pObjStrm->QuickReaduInt8();
235 //CFontAttributeOverride --cUnder
236 xEditorAttr->cDelFontOver.cFontAttributeOverride.cUnder = m_pObjStrm->QuickReaduInt8();
237 m_pObjStrm->SkipExtra();
238 //CFontDescriptionOverrideBase--cOverrideBits
239 xEditorAttr->cDelFontOver.cFontDescriptionOverrideBase.cOverrideBits = m_pObjStrm->QuickReaduInt8();
240 //CFontDescriptionOverrideBase--cApplyBits
241 xEditorAttr->cDelFontOver.cFontDescriptionOverrideBase.cApplyBits = m_pObjStrm->QuickReaduInt8();
242 //CFontDescriptionOverrideBase--cPointSize
243 xEditorAttr->cDelFontOver.cFontDescriptionOverrideBase.cPointSize = m_pObjStrm->QuickReadInt32();
244 //CFontDescriptionOverrideBase--cOverstrike
245 xEditorAttr->cDelFontOver.cFontDescriptionOverrideBase.cOverstrike = m_pObjStrm->QuickReaduInt8();
246 //CFontDescriptionOverrideBase--cTightness
247 xEditorAttr->cDelFontOver.cFontDescriptionOverrideBase.cTightness = m_pObjStrm->QuickReaduInt16();
248 //CFontDescriptionOverrideBase--cColor
249 xEditorAttr->cDelFontOver.cFontDescriptionOverrideBase.cColor.Read(m_pObjStrm.get());
250
251 //CFontDescriptionOverrideBase--cBackgroundColor
252 xEditorAttr->cDelFontOver.cFontDescriptionOverrideBase.cBackgroundColor.Read(m_pObjStrm.get());
253
254 m_pObjStrm->SkipExtra();
255 //cFaceName
256 xEditorAttr->cDelFontOver.cFaceName.Read(m_pObjStrm.get());
257 //cAltFaceName
258 xEditorAttr->cDelFontOver.cAltFaceName.Read(m_pObjStrm.get());
259 m_pObjStrm->SkipExtra();
260
261 //cAbilities
262 xEditorAttr->nAbilities = m_pObjStrm->QuickReaduInt16();
263 //cLocks
264 xEditorAttr->nLocks = m_pObjStrm->QuickReaduInt16();
265 //cSuggestions
266 xEditorAttr->nSuggestions = m_pObjStrm->QuickReaduInt16();
267
268 //cDelTextAttr
269 //m_pEditorAttrList[i].cDelTextAttr.Read(m_pObjStrm);
270 if (m_pObjStrm->QuickReadBool())
271 {
272 xEditorAttr->cDelTextAttr.cOverride.cValues = m_pObjStrm->QuickReaduInt16();
273 xEditorAttr->cDelTextAttr.cOverride.cOverride = m_pObjStrm->QuickReaduInt16();
274 xEditorAttr->cDelTextAttr.cOverride.cApply = m_pObjStrm->QuickReaduInt16();
275 m_pObjStrm->SkipExtra();
276 xEditorAttr->cDelTextAttr.cHideLevels = m_pObjStrm->QuickReaduInt16();
277
279 {
280 xEditorAttr->cDelTextAttr.cBaselineOffset = m_pObjStrm->QuickReadInt32();
281 }
282 else
283 {
284 xEditorAttr->cDelTextAttr.cBaselineOffset = 0;
285 }
286 }
287 m_pObjStrm->SkipExtra();
288
289 m_pObjStrm->SkipExtra();
290
291 sal_uInt16 nID = xEditorAttr->nID;
292 pGlobal->SetEditorAttrMap(nID, xEditorAttr.release());
293 }
294}
296{
297 OUString aResult = OUString::number(dt.tm_year) + "-" + OUString::number(dt.tm_mon) + "-" + OUString::number(dt.tm_mday) +
298 "T" + OUString::number(dt.tm_hour) + ":" + OUString::number(dt.tm_min) + ":" + OUString::number(dt.tm_sec) + ".0";
299
300 return aResult;
301}
303{
304 //PT3H43M44S
305 OUString aResult = "PT" + OUString::number(dt.tm_hour) + "H" + OUString::number(dt.tm_min) + "M" + OUString::number(dt.tm_sec) + "S";
306
307 return aResult;
308}
309void LwpDocData::Parse(IXFStream *pOutputStream)
310{
311 //<!DOCTYPE office:document-meta PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "office.dtd">
312 //<office:document-meta xmlns:office="http://openoffice.org/2000/office" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="http://openoffice.org/2000/meta" office:version="1.0">
313 //</office:document-meta>
314 XFOfficeMeta xfMeta;
321 xfMeta.ToXml(pOutputStream);
322}
323
324/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Stream wrapper for sax writer.
Definition: ixfstream.hxx:72
AtomHolder class of Word Pro to hold a string.
void Read(LwpObjectStream *pStrm)
@descr read atomholder from object stream the default encoding used in Word Pro is 1252
const OUString & str() const
LtTm m_nCreationTime
Definition: lwpdocdata.hxx:168
LwpDocControl m_DocControl
Definition: lwpdocdata.hxx:165
LwpDocData(LwpObjectHeader const &objHdr, LwpSvStream *pStrm)
Definition: lwpdocdata.cxx:63
void Read() override
@descr default read function
Definition: lwpdocdata.cxx:71
static OUString TimeToOUString(LtTm const &dt)
Definition: lwpdocdata.cxx:302
void Parse(IXFStream *pOutputStream) override
@descr default parse function
Definition: lwpdocdata.cxx:309
LwpDocInfo m_DocInfo
Definition: lwpdocdata.hxx:164
virtual ~LwpDocData() override
Definition: lwpdocdata.cxx:67
LtTm m_nLastRevisionTime
Definition: lwpdocdata.hxx:169
LtTm m_nTotalEditTime
Definition: lwpdocdata.hxx:170
LwpDocOptions m_DocOptions
Definition: lwpdocdata.hxx:163
static OUString DateTimeToOUString(LtTm const &dt)
Definition: lwpdocdata.cxx:295
static sal_uInt16 m_nFileRevision
Definition: lwpfilehdr.hxx:77
void SetEditorAttrMap(sal_uInt16 nID, LwpEditorAttr *pAttr)
static LwpGlobalMgr * GetInstance(LwpSvStream *pSvStream=nullptr)
Base class of all Lwp VO objects.
Definition: lwpobjhdr.hxx:71
void ReadIndexed(LwpSvStream *pStrm)
@descr Read object id with indexed format from stream if index>0, lowid is get from time table per th...
Definition: lwpobjid.cxx:96
Base class of all Lwp VO objects.
Definition: lwpobj.hxx:83
std::unique_ptr< LwpObjectStream > m_pObjStrm
Definition: lwpobj.hxx:90
encapsulate XInputStream to provide SvStream like interfaces
Definition: lwpsvstream.hxx:69
void SetDescription(const OUString &dsr)
void SetLastTime(const OUString &lstime)
void SetCreationTime(const OUString &crtime)
void SetCreator(const OUString &creator)
void ToXml(IXFStream *pStream)
void SetKeywords(const OUString &keywords)
void SetEditTime(const OUString &edtime)
bool LtgLocalTime(tools::Long rtime, LtTm &rtm)
Definition: localtime.cxx:169
int i
tools::Long tm_mday
Definition: localtime.hxx:65
tools::Long tm_min
Definition: localtime.hxx:63
tools::Long tm_sec
Definition: localtime.hxx:62
tools::Long tm_hour
Definition: localtime.hxx:64
tools::Long tm_mon
Definition: localtime.hxx:66
tools::Long tm_year
Definition: localtime.hxx:67
sal_uInt16 nDocControlProtection
Definition: lwpdocdata.hxx:91
sal_uInt16 nAutoVersioning
Definition: lwpdocdata.hxx:97
sal_uInt16 nLen1
Definition: lwpdocdata.hxx:92
sal_uInt16 nFlags
Definition: lwpdocdata.hxx:90
sal_uInt16 nLen2
Definition: lwpdocdata.hxx:95
LwpAtomHolder cGreeting
Definition: lwpdocdata.hxx:89
LwpAtomHolder cDocControlOnlyEditor
Definition: lwpdocdata.hxx:98
sal_uInt16 nFileProtection
Definition: lwpdocdata.hxx:94
sal_uInt16 nEditorVerification
Definition: lwpdocdata.hxx:99
sal_Int32 nTotalEditTime
Definition: lwpdocdata.hxx:82
sal_Int32 nLastRevisionTime
Definition: lwpdocdata.hxx:81
sal_Int32 nCreationTime
Definition: lwpdocdata.hxx:80
sal_uInt16 nNumEditedBy
Definition: lwpdocdata.hxx:84
LwpAtomHolder keywords
Definition: lwpdocdata.hxx:78
LwpAtomHolder createdBy
Definition: lwpdocdata.hxx:79
LwpObjectID cpVerDocInfo
Definition: lwpdocdata.hxx:83
LwpAtomHolder description
Definition: lwpdocdata.hxx:77
sal_uInt16 nMarginMarks
Definition: lwpdocdata.hxx:71
sal_uInt16 nOptionFlag
Definition: lwpdocdata.hxx:66
LwpAtomHolder encrypt1password
Definition: lwpdocdata.hxx:67
LwpAtomHolder grammerSet
Definition: lwpdocdata.hxx:70
LwpAtomHolder encrypt2password
Definition: lwpdocdata.hxx:68
sal_uInt16 nMarginMarksChar
Definition: lwpdocdata.hxx:73
sal_uInt16 nMarginMarksLocation
Definition: lwpdocdata.hxx:72
LwpAtomHolder characterSet
Definition: lwpdocdata.hxx:69