1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "precompile.h"
28 bool HyperText::Read(HWPFile
& hwpf
)
30 hwpf
.Read1b(filename
, 256);
31 hwpf
.Read2b(bookmark
, 16);
32 hwpf
.Read1b(macro
, 325);
33 hwpf
.Read1b(&type
, 1);
34 hwpf
.Read1b(reserve
, 3);
37 for( int i
= 1; i
< 256; i
++)
39 filename
[i
-1] = filename
[i
];
40 if( filename
[i
] == 0 )
48 EmPicture::EmPicture(size_t tsize
)
49 : size(tsize
>= 32 ? tsize
- 32 : 0)
54 data
= new uchar
[size
];
57 #define unlink _unlink
59 EmPicture::~EmPicture(void)
65 bool EmPicture::Read(HWPFile
& hwpf
)
69 hwpf
.Read1b(name
, 16);
70 hwpf
.Read1b(type
, 16);
74 if (hwpf
.ReadBlock(data
, size
) == 0)
80 OlePicture::OlePicture(int tsize
)
92 OlePicture::~OlePicture()
102 #define FILESTG_SIGNATURE_NORMAL 0xF8995568
104 bool OlePicture::Read(HWPFile
& hwpf
)
109 // We process only FILESTG_SIGNATURE_NORMAL.
110 hwpf
.Read4b(&signature
, 1);
111 if (signature
!= FILESTG_SIGNATURE_NORMAL
)
114 char *data
= new char[size
];
115 if( data
== 0 || hwpf
.ReadBlock(data
,size
) == 0 )
124 if (0 == (fp
= fopen(tname
, "wb")))
129 fwrite(data
, size
, 1, fp
);
132 MultiByteToWideChar(CP_ACP
, 0, tname
, -1, wtname
, 200);
133 if( StgOpenStorage(wtname
, NULL
,
134 STGM_READWRITE
|STGM_SHARE_EXCLUSIVE
|STGM_TRANSACTED
,
135 NULL
, 0, &pis
) != S_OK
) {
142 if (pis
== 0 || hwpf
.ReadBlock(pis
, size
) == 0)
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */