| 1 |
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */ |
| 2 |
|
| 3 |
/* libmwaw |
| 4 |
* Version: MPL 2.0 / LGPLv2+ |
| 5 |
* |
| 6 |
* The contents of this file are subject to the Mozilla Public License Version |
| 7 |
* 2.0 (the "License"); you may not use this file except in compliance with |
| 8 |
* the License or as specified alternatively below. You may obtain a copy of |
| 9 |
* the License at http://www.mozilla.org/MPL/ |
| 10 |
* |
| 11 |
* Software distributed under the License is distributed on an "AS IS" basis, |
| 12 |
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
| 13 |
* for the specific language governing rights and limitations under the |
| 14 |
* License. |
| 15 |
* |
| 16 |
* Major Contributor(s): |
| 17 |
* Copyright (C) 2002 William Lachance ([email protected]) |
| 18 |
* Copyright (C) 2002,2004 Marc Maurer ([email protected]) |
| 19 |
* Copyright (C) 2004-2006 Fridrich Strba ([email protected]) |
| 20 |
* Copyright (C) 2006, 2007 Andrew Ziem |
| 21 |
* Copyright (C) 2011, 2012 Alonso Laurent ([email protected]) |
| 22 |
* |
| 23 |
* |
| 24 |
* All Rights Reserved. |
| 25 |
* |
| 26 |
* For minor contributions see the git repository. |
| 27 |
* |
| 28 |
* Alternatively, the contents of this file may be used under the terms of |
| 29 |
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"), |
| 30 |
* in which case the provisions of the LGPLv2+ are applicable |
| 31 |
* instead of those above. |
| 32 |
*/ |
| 33 |
|
| 34 |
#include <algorithm> |
| 35 |
#include <iomanip> |
| 36 |
#include <iostream> |
| 37 |
#include <sstream> |
| 38 |
#include <stack> |
| 39 |
#include <utility> |
| 40 |
|
| 41 |
#include <librevenge/librevenge.h> |
| 42 |
|
| 43 |
#include "MWAWPresentationListener.hxx" |
| 44 |
#include "MWAWFont.hxx" |
| 45 |
#include "MWAWFontConverter.hxx" |
| 46 |
#include "MWAWHeader.hxx" |
| 47 |
#include "MWAWGraphicShape.hxx" |
| 48 |
#include "MWAWGraphicStyle.hxx" |
| 49 |
#include "MWAWParagraph.hxx" |
| 50 |
#include "MWAWPosition.hxx" |
| 51 |
#include "MWAWPrinter.hxx" |
| 52 |
|
| 53 |
#include "PowerPoint3OLE.hxx" |
| 54 |
#include "PowerPoint7Graph.hxx" |
| 55 |
#include "PowerPoint7Parser.hxx" |
| 56 |
#include "PowerPoint7Struct.hxx" |
| 57 |
#include "PowerPoint7Text.hxx" |
| 58 |
|
| 59 |
/** Internal: the structures of a PowerPoint7Parser */ |
| 60 |
namespace PowerPoint7ParserInternal |
| 61 |
{ |
| 62 |
//! Internal: the basic information about a slide/notes/... zone in a PowerPoint7Parser |
| 63 |
struct SlideInfo { |
| 64 |
//! constructor |
| 65 |
SlideInfo() |
| 66 |
: m_box() |
| 67 |
, m_displayMaster(true) |
| 68 |
, m_hasBackground(false) |
| 69 |
{ |
| 70 |
} |
| 71 |
//! the bdbox |
| 72 |
MWAWBox2i m_box; |
| 73 |
//! a flag to know if we need to display the master slide graphic |
| 74 |
bool m_displayMaster; |
| 75 |
//! a flag to know if the slide has some background or no background |
| 76 |
bool m_hasBackground; |
| 77 |
}; |
| 78 |
//////////////////////////////////////// |
| 79 |
//! Internal: the state of a PowerPoint7Parser |
| 80 |
struct State { |
| 81 |
//! constructor |
| 82 |
State() |
| 83 |
: m_fontFamily("CP1252") |
| 84 |
, m_pageDimension(5760,4320) |
| 85 |
, m_graphParser() |
| 86 |
, m_textParser() |
| 87 |
, m_oleParser() |
| 88 |
, m_slideList() |
| 89 |
, m_masterSlideIdToNameMap() |
| 90 |
, m_idToMasterIdMap() |
| 91 |
, m_idToSlideInfoMap() |
| 92 |
, m_slideIdStack() |
| 93 |
, m_colorListStack() |
| 94 |
{ |
| 95 |
} |
| 96 |
//! add a slide |
| 97 |
void addSlide(PowerPoint7Struct::SlideId const &sId, PowerPoint7Struct::SlideId const &mId) |
| 98 |
{ |
| 99 |
if (!sId.isValid()) |
| 100 |
return; |
| 101 |
if (sId.m_isMaster) { |
| 102 |
if (m_masterSlideIdToNameMap.find(sId)!=m_masterSlideIdToNameMap.end()) |
| 103 |
return; |
| 104 |
std::stringstream s; |
| 105 |
s << "Master" << m_masterSlideIdToNameMap.size(); |
| 106 |
m_masterSlideIdToNameMap[sId]=librevenge::RVNGString(s.str().c_str()); |
| 107 |
return; |
| 108 |
} |
| 109 |
m_slideList.push_back(sId); |
| 110 |
if (mId.isValid()) |
| 111 |
m_idToMasterIdMap[sId]=mId; |
| 112 |
} |
| 113 |
//! push a new slide id |
| 114 |
void pushSlideId(PowerPoint7Struct::SlideId const &id) |
| 115 |
{ |
| 116 |
if (m_graphParser) m_graphParser->setSlideId(id); |
| 117 |
m_slideIdStack.push(id); |
| 118 |
} |
| 119 |
//! pop a slide id |
| 120 |
void popSlideId() |
| 121 |
{ |
| 122 |
if (m_slideIdStack.empty()) { |
| 123 |
MWAW_DEBUG_MSG(("PowerPoint7ParserInternal::State::popSlideId: the stack is empty\n")); |
| 124 |
return; |
| 125 |
} |
| 126 |
m_slideIdStack.pop(); |
| 127 |
if (m_graphParser) |
| 128 |
m_graphParser->setSlideId(m_slideIdStack.empty() ? PowerPoint7Struct::SlideId() : m_slideIdStack.top()); |
| 129 |
} |
| 130 |
//! push a new slide id |
| 131 |
void pushColorList(std::vector<MWAWColor> const &colorList) |
| 132 |
{ |
| 133 |
if (m_graphParser) m_graphParser->setColorList(colorList); |
| 134 |
m_colorListStack.push(colorList); |
| 135 |
} |
| 136 |
//! pop a slide id |
| 137 |
void popColorList() |
| 138 |
{ |
| 139 |
if (m_colorListStack.empty()) { |
| 140 |
MWAW_DEBUG_MSG(("PowerPoint7ParserInternal::State::popSlideId: the stack is empty\n")); |
| 141 |
return; |
| 142 |
} |
| 143 |
m_colorListStack.pop(); |
| 144 |
if (m_graphParser) |
| 145 |
m_graphParser->setColorList(m_colorListStack.empty() ? std::vector<MWAWColor>() : m_colorListStack.top()); |
| 146 |
} |
| 147 |
//! the basic pc font family if known |
| 148 |
std::string m_fontFamily; |
| 149 |
//! the page dimension |
| 150 |
MWAWVec2i m_pageDimension; |
| 151 |
//! the graph parser |
| 152 |
std::shared_ptr<PowerPoint7Graph> m_graphParser; |
| 153 |
//! the text parser |
| 154 |
std::shared_ptr<PowerPoint7Text> m_textParser; |
| 155 |
//! the ole parser |
| 156 |
std::shared_ptr<PowerPoint3OLE> m_oleParser; |
| 157 |
//! the list of slides |
| 158 |
std::vector<PowerPoint7Struct::SlideId> m_slideList; |
| 159 |
//! the master slide |
| 160 |
std::map<PowerPoint7Struct::SlideId, librevenge::RVNGString> m_masterSlideIdToNameMap; |
| 161 |
//! the slideId to masterId slide |
| 162 |
std::map<PowerPoint7Struct::SlideId, PowerPoint7Struct::SlideId> m_idToMasterIdMap; |
| 163 |
//! the slideId to information slide |
| 164 |
std::map<PowerPoint7Struct::SlideId, SlideInfo> m_idToSlideInfoMap; |
| 165 |
//! a stack of slide id |
| 166 |
std::stack<PowerPoint7Struct::SlideId> m_slideIdStack; |
| 167 |
//! a stack of color list |
| 168 |
std::stack<std::vector<MWAWColor> > m_colorListStack; |
| 169 |
}; |
| 170 |
|
| 171 |
} |
| 172 |
|
| 173 |
//////////////////////////////////////////////////////////// |
| 174 |
// constructor/destructor, ... |
| 175 |
//////////////////////////////////////////////////////////// |
| 176 |
PowerPoint7Parser::PowerPoint7Parser(MWAWInputStreamPtr const &input, MWAWRSRCParserPtr const &rsrcParser, MWAWHeader *header) |
| 177 |
: MWAWPresentationParser(input, rsrcParser, header) |
| 178 |
, m_state(new PowerPoint7ParserInternal::State) |
| 179 |
{ |
| 180 |
setAsciiName("main-1"); |
| 181 |
m_state->m_graphParser.reset(new PowerPoint7Graph(*this)); |
| 182 |
m_state->m_textParser.reset(new PowerPoint7Text(*this)); |
| 183 |
} |
| 184 |
|
| 185 |
PowerPoint7Parser::~PowerPoint7Parser() |
| 186 |
{ |
| 187 |
} |
| 188 |
|
| 189 |
bool PowerPoint7Parser::sendText(int textId) |
| 190 |
{ |
| 191 |
return m_state->m_textParser->sendText(textId); |
| 192 |
} |
| 193 |
|
| 194 |
bool PowerPoint7Parser::getColor(int cId, MWAWColor &col) const |
| 195 |
{ |
| 196 |
if (m_state->m_colorListStack.empty() || cId<0 || |
| 197 |
cId>=int(m_state->m_colorListStack.top().size())) { |
| 198 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::getColor: can not find color %d\n", cId)); |
| 199 |
return false; |
| 200 |
} |
| 201 |
col=m_state->m_colorListStack.top()[size_t(cId)]; |
| 202 |
return true; |
| 203 |
} |
| 204 |
|
| 205 |
//////////////////////////////////////////////////////////// |
| 206 |
// the parser |
| 207 |
//////////////////////////////////////////////////////////// |
| 208 |
void PowerPoint7Parser::parse(librevenge::RVNGPresentationInterface *docInterface) |
| 209 |
{ |
| 210 |
if (!getInput().get() || !checkHeader(nullptr)) throw(libmwaw::ParseException()); |
| 211 |
bool ok = true; |
| 212 |
try { |
| 213 |
ok = createZones(); |
| 214 |
if (ok) { |
| 215 |
createDocument(docInterface); |
| 216 |
sendSlides(); |
| 217 |
} |
| 218 |
|
| 219 |
#ifdef DEBUG |
| 220 |
if (m_state->m_oleParser) |
| 221 |
m_state->m_oleParser->checkForUnparsedStream(); |
| 222 |
checkForUnparsedZones(); |
| 223 |
#endif |
| 224 |
ascii().reset(); |
| 225 |
} |
| 226 |
catch (...) { |
| 227 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::parse: exception catched when parsing\n")); |
| 228 |
ok = false; |
| 229 |
} |
| 230 |
|
| 231 |
resetPresentationListener(); |
| 232 |
if (!ok) throw(libmwaw::ParseException()); |
| 233 |
} |
| 234 |
|
| 235 |
//////////////////////////////////////////////////////////// |
| 236 |
// create the document |
| 237 |
//////////////////////////////////////////////////////////// |
| 238 |
void PowerPoint7Parser::createDocument(librevenge::RVNGPresentationInterface *documentInterface) |
| 239 |
{ |
| 240 |
if (!documentInterface) return; |
| 241 |
if (getPresentationListener()) { |
| 242 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::createDocument: listener already exist\n")); |
| 243 |
return; |
| 244 |
} |
| 245 |
|
| 246 |
std::vector<MWAWPageSpan> pageList; |
| 247 |
for (auto const &id : m_state->m_slideList) { |
| 248 |
if (!id.isValid()) continue; |
| 249 |
MWAWPageSpan ps(getPageSpan()); |
| 250 |
bool showMaster=true; |
| 251 |
if (m_state->m_idToSlideInfoMap.find(id)!=m_state->m_idToSlideInfoMap.end()) |
| 252 |
showMaster=m_state->m_idToSlideInfoMap.find(id)->second.m_displayMaster; |
| 253 |
if (showMaster && m_state->m_idToMasterIdMap.find(id)!=m_state->m_idToMasterIdMap.end()) { |
| 254 |
PowerPoint7Struct::SlideId mId=m_state->m_idToMasterIdMap.find(id)->second; |
| 255 |
if (m_state->m_masterSlideIdToNameMap.find(mId)!=m_state->m_masterSlideIdToNameMap.end()) |
| 256 |
ps.setMasterPageName(m_state->m_masterSlideIdToNameMap.find(mId)->second); |
| 257 |
} |
| 258 |
pageList.push_back(ps); |
| 259 |
} |
| 260 |
|
| 261 |
// |
| 262 |
MWAWPresentationListenerPtr listen(new MWAWPresentationListener(*getParserState(), pageList, documentInterface)); |
| 263 |
setPresentationListener(listen); |
| 264 |
if (m_state->m_oleParser) { |
| 265 |
librevenge::RVNGPropertyList metaData; |
| 266 |
m_state->m_oleParser->updateMetaData(metaData); |
| 267 |
listen->setDocumentMetaData(metaData); |
| 268 |
} |
| 269 |
listen->startDocument(); |
| 270 |
} |
| 271 |
|
| 272 |
|
| 273 |
//////////////////////////////////////////////////////////// |
| 274 |
// Intermediate level |
| 275 |
//////////////////////////////////////////////////////////// |
| 276 |
|
| 277 |
// create the different zones |
| 278 |
bool PowerPoint7Parser::createZones() |
| 279 |
{ |
| 280 |
MWAWInputStreamPtr input=getInput(); |
| 281 |
if (!input || !input->isStructured()) { |
| 282 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::createZones: can not find the main input\n")); |
| 283 |
return false; |
| 284 |
} |
| 285 |
|
| 286 |
MWAWInputStreamPtr mainOle=input->getSubStreamByName("PowerPoint Document"); |
| 287 |
if (!mainOle) { |
| 288 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::createZones: can not find the main ole\n")); |
| 289 |
return false; |
| 290 |
} |
| 291 |
int fId=getFontConverter()->getId("CP1252"); |
| 292 |
m_state->m_oleParser.reset(new PowerPoint3OLE(input, version(), getFontConverter(), fId)); |
| 293 |
m_state->m_oleParser->parse(); |
| 294 |
int encoding=m_state->m_oleParser->getFontEncoding(); |
| 295 |
if (encoding>=1250 && encoding<=1258) { |
| 296 |
std::stringstream s; |
| 297 |
s << "CP" << encoding; |
| 298 |
m_state->m_fontFamily=s.str(); |
| 299 |
m_state->m_textParser->setFontFamily(m_state->m_fontFamily); |
| 300 |
} |
| 301 |
parseTextContent(input->getSubStreamByName("Text_Content")); |
| 302 |
getParserState()->m_input=input=mainOle; |
| 303 |
input->setReadInverted(true); |
| 304 |
|
| 305 |
// create the asciiFile |
| 306 |
ascii().setStream(input); |
| 307 |
ascii().open(asciiName()); |
| 308 |
|
| 309 |
input->seek(0, librevenge::RVNG_SEEK_SET); |
| 310 |
if (!readDocRoot()) |
| 311 |
return false; |
| 312 |
if (!input->isEnd()) { |
| 313 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::createZones: find extra data\n")); |
| 314 |
ascii().addPos(input->tell()); |
| 315 |
ascii().addNote("Entries(Extra):###"); |
| 316 |
} |
| 317 |
return !m_state->m_slideList.empty(); |
| 318 |
} |
| 319 |
|
| 320 |
bool PowerPoint7Parser::readDocRoot() |
| 321 |
{ |
| 322 |
MWAWInputStreamPtr input=getInput(); |
| 323 |
long pos=input->tell(); |
| 324 |
long lastPos=input->size(); |
| 325 |
|
| 326 |
libmwaw::DebugStream f; |
| 327 |
PowerPoint7Struct::Zone header; |
| 328 |
if (!header.read(input,lastPos) || header.m_type!=3) { |
| 329 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readDocRoot: can not find the main zone header\n")); |
| 330 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 331 |
return false; |
| 332 |
} |
| 333 |
f << "Entries(Root):" << header; |
| 334 |
ascii().addPos(pos); |
| 335 |
ascii().addNote(f.str().c_str()); |
| 336 |
|
| 337 |
long endPos=pos+16+header.m_dataSize; |
| 338 |
while (input->tell()<endPos) { |
| 339 |
pos=input->tell(); |
| 340 |
auto cType=int(input->readULong(2)); //3e8 followed by a |
| 341 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 342 |
|
| 343 |
bool done=false; |
| 344 |
switch (cType) { |
| 345 |
case 0xa: |
| 346 |
done=readMainSub10(endPos); |
| 347 |
break; |
| 348 |
case 1000: |
| 349 |
done=readDocument(endPos); |
| 350 |
break; |
| 351 |
default: |
| 352 |
done=readZone(1,endPos); |
| 353 |
if (done) { |
| 354 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readDocRoot: find unexpected zone %d\n", cType)); |
| 355 |
} |
| 356 |
break; |
| 357 |
} |
| 358 |
if (done) continue; |
| 359 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readDocRoot: can not read some data\n")); |
| 360 |
ascii().addPos(pos); |
| 361 |
ascii().addNote("Root:###extra"); |
| 362 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 363 |
break; |
| 364 |
} |
| 365 |
return true; |
| 366 |
} |
| 367 |
|
| 368 |
bool PowerPoint7Parser::readMainSub10(long lastPos) |
| 369 |
{ |
| 370 |
MWAWInputStreamPtr input=getInput(); |
| 371 |
long pos=input->tell(); |
| 372 |
|
| 373 |
libmwaw::DebugStream f; |
| 374 |
PowerPoint7Struct::Zone header; |
| 375 |
if (!header.read(input,lastPos) || header.m_type!=10) { |
| 376 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readMainSub10: can not find the zone header\n")); |
| 377 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 378 |
return false; |
| 379 |
} |
| 380 |
f << "Entries(MSub10):" << header; |
| 381 |
if (header.m_dataSize!=8) { |
| 382 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readMainSub10: find unexpected data size\n")); |
| 383 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 384 |
if (header.m_dataSize) |
| 385 |
ascii().addDelimiter(pos+16,'|'); |
| 386 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 387 |
} |
| 388 |
else { |
| 389 |
int val; |
| 390 |
for (int i=0; i<2; ++i) { |
| 391 |
val=int(input->readULong(2)); |
| 392 |
if (val!=1-i) f << "f" << i << "=" << val << ","; |
| 393 |
} |
| 394 |
val=int(input->readULong(4)); // 100|11c|123 |
| 395 |
if (val!=0x100) f << "unk=" << std::hex << val << std::dec << ","; |
| 396 |
} |
| 397 |
ascii().addPos(pos); |
| 398 |
ascii().addNote(f.str().c_str()); |
| 399 |
return true; |
| 400 |
} |
| 401 |
|
| 402 |
bool PowerPoint7Parser::readDocument(long lastPos) |
| 403 |
{ |
| 404 |
MWAWInputStreamPtr input=getInput(); |
| 405 |
long pos=input->tell(); |
| 406 |
|
| 407 |
libmwaw::DebugStream f; |
| 408 |
PowerPoint7Struct::Zone header; |
| 409 |
if (!header.read(input,lastPos) || header.m_type!=1000) { |
| 410 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readDocument: can not find the zone header\n")); |
| 411 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 412 |
return false; |
| 413 |
} |
| 414 |
f << "Entries(DocMain):" << header; |
| 415 |
ascii().addPos(pos); |
| 416 |
ascii().addNote(f.str().c_str()); |
| 417 |
|
| 418 |
long endPos=pos+16+header.m_dataSize; |
| 419 |
while (input->tell()<endPos) { |
| 420 |
pos=input->tell(); |
| 421 |
auto cType=int(input->readULong(2)); |
| 422 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 423 |
|
| 424 |
bool done=false; |
| 425 |
switch (cType) { |
| 426 |
case 1001: |
| 427 |
done=readDocAtom(1,endPos); |
| 428 |
break; |
| 429 |
case 1002: |
| 430 |
done=readZoneNoData(1,endPos,"DocMain","end"); |
| 431 |
break; |
| 432 |
case 1008: |
| 433 |
done=readNotes(1,endPos); |
| 434 |
break; |
| 435 |
case 1010: |
| 436 |
done=readEnvironment(1,endPos); |
| 437 |
break; |
| 438 |
case 1025: |
| 439 |
done=readSSDocInfoAtom(1,endPos); |
| 440 |
break; |
| 441 |
case 1026: |
| 442 |
done=readSummary(1,endPos); |
| 443 |
break; |
| 444 |
case 2000: |
| 445 |
done=readContainerList(1,endPos); |
| 446 |
break; |
| 447 |
case 4041: |
| 448 |
done=readHandout(1,endPos); |
| 449 |
break; |
| 450 |
default: |
| 451 |
done=readZone(1,endPos); |
| 452 |
if (done) { |
| 453 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readDocument: find unexpected zone %d\n", cType)); |
| 454 |
} |
| 455 |
break; |
| 456 |
} |
| 457 |
if (done) continue; |
| 458 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readDocument: can not read some data\n")); |
| 459 |
ascii().addPos(pos); |
| 460 |
ascii().addNote("DocMain:###extra"); |
| 461 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 462 |
break; |
| 463 |
} |
| 464 |
return true; |
| 465 |
} |
| 466 |
|
| 467 |
bool PowerPoint7Parser::readDocAtom(int level, long lastPos) |
| 468 |
{ |
| 469 |
MWAWInputStreamPtr input=getInput(); |
| 470 |
long pos=input->tell(); |
| 471 |
|
| 472 |
libmwaw::DebugStream f; |
| 473 |
PowerPoint7Struct::Zone header; |
| 474 |
if (!header.read(input,lastPos) || header.m_type!=1001) { |
| 475 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readDocAtom: can not find the zone header\n")); |
| 476 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 477 |
return false; |
| 478 |
} |
| 479 |
f << "Entries(DocMain)[atom," << level << "]:" << header; |
| 480 |
if (header.m_dataSize!=0x2c) { |
| 481 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readDocAtom: find unexpected data size\n")); |
| 482 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 483 |
if (header.m_dataSize) |
| 484 |
ascii().addDelimiter(pos+16,'|'); |
| 485 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 486 |
} |
| 487 |
else { |
| 488 |
int val; |
| 489 |
for (int i=0; i<2; ++i) { |
| 490 |
int dim[2]; |
| 491 |
for (auto &d : dim) d=int(input->readLong(4)); |
| 492 |
MWAWVec2i size(dim[0],dim[1]); |
| 493 |
if (i==0 && dim[0]>0 && dim[1]>0) { |
| 494 |
m_state->m_pageDimension=size; |
| 495 |
m_state->m_graphParser->setPageSize(size); |
| 496 |
|
| 497 |
getPageSpan().setFormLength(double(size.y())/576.0); |
| 498 |
getPageSpan().setFormWidth(double(size.x())/576.0); |
| 499 |
} |
| 500 |
char const *wh[]= {"page","paper"}; |
| 501 |
f << "dim[" << wh[i] << "]=" << size << ","; |
| 502 |
} |
| 503 |
for (int i=0; i<2; ++i) { // f0=0|1, f1=1 |
| 504 |
val=int(input->readULong(2)); |
| 505 |
if (val) |
| 506 |
f << "f" << i << "=" << val << ","; |
| 507 |
} |
| 508 |
f << "ids=["; |
| 509 |
for (int i=0; i<2; ++i) |
| 510 |
f << std::hex << input->readULong(4) << std::dec << ","; |
| 511 |
f << "],"; |
| 512 |
for (int i=0; i<7; ++i) { // f2=db00|e[34]00, f3,f5,f7 small number |
| 513 |
val=int(input->readULong(2)); |
| 514 |
if (val) |
| 515 |
f << "f" << i+2 << "=" << val << ","; |
| 516 |
} |
| 517 |
input->seek(pos+16+header.m_dataSize, librevenge::RVNG_SEEK_SET); |
| 518 |
} |
| 519 |
ascii().addPos(pos); |
| 520 |
ascii().addNote(f.str().c_str()); |
| 521 |
return true; |
| 522 |
} |
| 523 |
|
| 524 |
bool PowerPoint7Parser::readSlideInformation(int level, long lastPos) |
| 525 |
{ |
| 526 |
MWAWInputStreamPtr input=getInput(); |
| 527 |
long pos=input->tell(); |
| 528 |
|
| 529 |
libmwaw::DebugStream f; |
| 530 |
PowerPoint7Struct::Zone header; |
| 531 |
if (!header.read(input,lastPos) || header.m_type!=1005) { |
| 532 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlideInformation: can not find the zone header\n")); |
| 533 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 534 |
return false; |
| 535 |
} |
| 536 |
f << "Entries(SlideInfo)[" << level << "]:" << header; |
| 537 |
if (header.m_dataSize!=0x18) { |
| 538 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlideInformation: find unexpected data size\n")); |
| 539 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 540 |
if (header.m_dataSize) |
| 541 |
ascii().addDelimiter(pos+16,'|'); |
| 542 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 543 |
ascii().addPos(pos); |
| 544 |
ascii().addNote(f.str().c_str()); |
| 545 |
return true; |
| 546 |
} |
| 547 |
PowerPoint7ParserInternal::SlideInfo info; |
| 548 |
int dim[4]; |
| 549 |
for (auto &d : dim) d=int(input->readLong(4)); |
| 550 |
info.m_box=MWAWBox2i(MWAWVec2i(dim[0],dim[1]),MWAWVec2i(dim[2],dim[3])); |
| 551 |
f << "box=" << info.m_box << ","; |
| 552 |
int val; |
| 553 |
for (int i=0; i<2; ++i) { // always 1,1 |
| 554 |
val=int(input->readLong(1)); |
| 555 |
if (val==1) continue; |
| 556 |
if (i==0) { |
| 557 |
if (val==0) { |
| 558 |
info.m_displayMaster=false; |
| 559 |
f << "omit[graphic,master],"; |
| 560 |
} |
| 561 |
else |
| 562 |
f << "###omit[graphic,master]=" << val << ","; |
| 563 |
} |
| 564 |
else |
| 565 |
f << "fl" << i << "=" << val << ","; |
| 566 |
} |
| 567 |
val=int(input->readLong(2)); // 0 |
| 568 |
if (val) f << "f0=" << val << ","; |
| 569 |
val=int(input->readULong(1)); |
| 570 |
if (val==0) { |
| 571 |
info.m_hasBackground=true; |
| 572 |
f << "has[background],"; |
| 573 |
} |
| 574 |
else if (val!=1) |
| 575 |
f << "##has[background]=" << val << ","; |
| 576 |
for (int i=0; i<3; ++i) { // fl2=0-e3, fl3=0|8|9|62|b7,fl4=0|50 |
| 577 |
val=int(input->readULong(1)); |
| 578 |
if (val) f << "fl" << i+2 << "=" << std::hex << val << std::dec << ","; |
| 579 |
} |
| 580 |
if (m_state->m_slideIdStack.empty() || |
| 581 |
m_state->m_idToSlideInfoMap.find(m_state->m_slideIdStack.top())!=m_state->m_idToSlideInfoMap.end()) { |
| 582 |
f << "###noSave,"; |
| 583 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlideInformation: can not save the information\n")); |
| 584 |
} |
| 585 |
else |
| 586 |
m_state->m_idToSlideInfoMap[m_state->m_slideIdStack.top()]=info; |
| 587 |
input->seek(pos+16+header.m_dataSize, librevenge::RVNG_SEEK_SET); |
| 588 |
ascii().addPos(pos); |
| 589 |
ascii().addNote(f.str().c_str()); |
| 590 |
return true; |
| 591 |
} |
| 592 |
|
| 593 |
bool PowerPoint7Parser::readSlides(int level, long lastPos, bool master) |
| 594 |
{ |
| 595 |
MWAWInputStreamPtr input=getInput(); |
| 596 |
long pos=input->tell(); |
| 597 |
|
| 598 |
libmwaw::DebugStream f; |
| 599 |
PowerPoint7Struct::Zone header; |
| 600 |
int const expectedType=master ? 1016 : 1006; |
| 601 |
if (!header.read(input,lastPos) || header.m_type!=expectedType) { |
| 602 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlides: can not find the zone header\n")); |
| 603 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 604 |
return false; |
| 605 |
} |
| 606 |
f << "Entries(SlideContent)[" << level << "]:" << header; |
| 607 |
if (master) f << "master,"; |
| 608 |
ascii().addPos(pos); |
| 609 |
ascii().addNote(f.str().c_str()); |
| 610 |
|
| 611 |
long endPos=pos+16+header.m_dataSize; |
| 612 |
bool pushSlideId=false, pushColor=false; |
| 613 |
while (input->tell()<endPos) { |
| 614 |
pos=input->tell(); |
| 615 |
auto cType=int(input->readULong(2)); |
| 616 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 617 |
|
| 618 |
bool done=false; |
| 619 |
switch (cType) { |
| 620 |
case 1005: |
| 621 |
done=readSlideInformation(level+1,endPos); |
| 622 |
break; |
| 623 |
case 1007: { |
| 624 |
PowerPoint7Struct::SlideId sId, mId; |
| 625 |
done=readSlideAtom(level+1,endPos, sId, mId); |
| 626 |
if (done && !pushSlideId) { |
| 627 |
pushSlideId=true; |
| 628 |
m_state->addSlide(sId,mId); |
| 629 |
m_state->pushSlideId(sId); |
| 630 |
} |
| 631 |
break; |
| 632 |
} |
| 633 |
case 1008: |
| 634 |
done=readNotes(level+1,endPos); |
| 635 |
break; |
| 636 |
case 1012: { |
| 637 |
std::vector<MWAWColor> colors; |
| 638 |
done=readColorScheme(level+1,endPos,colors); |
| 639 |
if (done && !pushColor) { |
| 640 |
pushColor=true; |
| 641 |
m_state->pushColorList(colors); |
| 642 |
} |
| 643 |
break; |
| 644 |
} |
| 645 |
case 1015: |
| 646 |
done=readZone1015(level+1,endPos); |
| 647 |
break; |
| 648 |
case 1017: |
| 649 |
done=readSlideShowInfo(level+1,endPos); |
| 650 |
break; |
| 651 |
case 2031: { // in master, the different color scheme are stored directly here |
| 652 |
std::vector<MWAWColor> colors; |
| 653 |
done=readColorList(level+1,endPos, colors); |
| 654 |
break; |
| 655 |
} |
| 656 |
case 3000: |
| 657 |
done=readZone3000(level+1,endPos); |
| 658 |
break; |
| 659 |
case 3008: |
| 660 |
done=m_state->m_graphParser->readRect(level+1,endPos); |
| 661 |
break; |
| 662 |
case 4026: { |
| 663 |
std::string string; |
| 664 |
int zId; // 140: template name(in master) |
| 665 |
done=readString(level+1,endPos, string, zId, "SlideContent"); |
| 666 |
break; |
| 667 |
} |
| 668 |
case 4057: |
| 669 |
done=readHeaderFooters(level+1,endPos); |
| 670 |
break; |
| 671 |
default: |
| 672 |
done=readZone(level+1,endPos); |
| 673 |
if (done) { |
| 674 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlides: find unexpected zone %d\n", cType)); |
| 675 |
} |
| 676 |
break; |
| 677 |
} |
| 678 |
if (done) continue; |
| 679 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlides: can not read some data\n")); |
| 680 |
ascii().addPos(pos); |
| 681 |
ascii().addNote("SlideContent:###extra"); |
| 682 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 683 |
break; |
| 684 |
} |
| 685 |
if (pushColor) |
| 686 |
m_state->popColorList(); |
| 687 |
if (pushSlideId) |
| 688 |
m_state->popSlideId(); |
| 689 |
return true; |
| 690 |
} |
| 691 |
|
| 692 |
bool PowerPoint7Parser::readSlideAtom(int level, long lastPos, PowerPoint7Struct::SlideId &sId, PowerPoint7Struct::SlideId &mId) |
| 693 |
{ |
| 694 |
MWAWInputStreamPtr input=getInput(); |
| 695 |
long pos=input->tell(); |
| 696 |
|
| 697 |
libmwaw::DebugStream f; |
| 698 |
PowerPoint7Struct::Zone header; |
| 699 |
if (!header.read(input,lastPos) || header.m_type!=1007) { |
| 700 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlideAtom: can not find the zone header\n")); |
| 701 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 702 |
return false; |
| 703 |
} |
| 704 |
f << "Entries(SlideContent)[atom," << level << "]:" << header; |
| 705 |
if (header.m_dataSize!=8) { |
| 706 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlideAtom: find unexpected data size\n")); |
| 707 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 708 |
if (header.m_dataSize) |
| 709 |
ascii().addDelimiter(pos+16,'|'); |
| 710 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 711 |
} |
| 712 |
else { |
| 713 |
for (int i=0; i<2; ++i) { |
| 714 |
PowerPoint7Struct::SlideId id(input->readULong(4)); |
| 715 |
if (!id.isValid()) continue; |
| 716 |
if (i==0) { |
| 717 |
sId=id; |
| 718 |
f << id << ","; |
| 719 |
} |
| 720 |
else { |
| 721 |
mId=id; |
| 722 |
f << "master=" << id << ","; |
| 723 |
} |
| 724 |
} |
| 725 |
} |
| 726 |
ascii().addPos(pos); |
| 727 |
ascii().addNote(f.str().c_str()); |
| 728 |
return true; |
| 729 |
} |
| 730 |
|
| 731 |
bool PowerPoint7Parser::readNotes(int level, long lastPos) |
| 732 |
{ |
| 733 |
MWAWInputStreamPtr input=getInput(); |
| 734 |
long pos=input->tell(); |
| 735 |
|
| 736 |
libmwaw::DebugStream f; |
| 737 |
PowerPoint7Struct::Zone header; |
| 738 |
if (!header.read(input,lastPos) || header.m_type!=1008) { |
| 739 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readNotes: can not find the zone header\n")); |
| 740 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 741 |
return false; |
| 742 |
} |
| 743 |
f << "Entries(Note)[" << level << "]:" << header; |
| 744 |
ascii().addPos(pos); |
| 745 |
ascii().addNote(f.str().c_str()); |
| 746 |
|
| 747 |
long endPos=pos+16+header.m_dataSize; |
| 748 |
bool pushSlideId=false, pushColor=false; |
| 749 |
while (input->tell()<endPos) { |
| 750 |
pos=input->tell(); |
| 751 |
auto cType=int(input->readULong(2)); |
| 752 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 753 |
|
| 754 |
bool done=false; |
| 755 |
switch (cType) { |
| 756 |
case 1005: |
| 757 |
done=readSlideInformation(level+1,endPos); |
| 758 |
break; |
| 759 |
case 1009: { |
| 760 |
PowerPoint7Struct::SlideId sId; |
| 761 |
done=readNoteAtom(level+1,endPos, sId); |
| 762 |
if (done && !pushSlideId) { |
| 763 |
pushSlideId=true; |
| 764 |
m_state->pushSlideId(sId); |
| 765 |
} |
| 766 |
break; |
| 767 |
} |
| 768 |
case 1012: { |
| 769 |
std::vector<MWAWColor> colors; |
| 770 |
done=readColorScheme(level+1,endPos,colors); |
| 771 |
if (done && !pushColor) { |
| 772 |
pushColor=true; |
| 773 |
m_state->pushColorList(colors); |
| 774 |
} |
| 775 |
break; |
| 776 |
} |
| 777 |
case 3000: |
| 778 |
done=readZone3000(level+1,endPos); |
| 779 |
break; |
| 780 |
case 3008: |
| 781 |
done=m_state->m_graphParser->readRect(level+1,endPos); |
| 782 |
break; |
| 783 |
case 4057: |
| 784 |
done=readHeaderFooters(level+1,endPos); |
| 785 |
break; |
| 786 |
default: |
| 787 |
done=readZone(level+1,endPos); |
| 788 |
if (done) { |
| 789 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readNotes: find unexpected zone %d\n", cType)); |
| 790 |
} |
| 791 |
break; |
| 792 |
} |
| 793 |
if (done) continue; |
| 794 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readNotes: can not read some data\n")); |
| 795 |
ascii().addPos(pos); |
| 796 |
ascii().addNote("Note:###extra"); |
| 797 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 798 |
break; |
| 799 |
} |
| 800 |
if (pushColor) |
| 801 |
m_state->popColorList(); |
| 802 |
if (pushSlideId) |
| 803 |
m_state->popSlideId(); |
| 804 |
return true; |
| 805 |
} |
| 806 |
|
| 807 |
bool PowerPoint7Parser::readNoteAtom(int level, long lastPos, PowerPoint7Struct::SlideId &sId) |
| 808 |
{ |
| 809 |
MWAWInputStreamPtr input=getInput(); |
| 810 |
long pos=input->tell(); |
| 811 |
|
| 812 |
libmwaw::DebugStream f; |
| 813 |
PowerPoint7Struct::Zone header; |
| 814 |
if (!header.read(input,lastPos) || header.m_type!=1009) { |
| 815 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readNoteAtom: can not find the zone header\n")); |
| 816 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 817 |
return false; |
| 818 |
} |
| 819 |
f << "Entries(Note)[atom" << level << "]:" << header; |
| 820 |
if (header.m_dataSize!=4) { |
| 821 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readNoteAtom: find unexpected data size\n")); |
| 822 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 823 |
if (header.m_dataSize) |
| 824 |
ascii().addDelimiter(pos+16,'|'); |
| 825 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 826 |
} |
| 827 |
else { |
| 828 |
sId=PowerPoint7Struct::SlideId(input->readULong(4)); |
| 829 |
sId.m_inNotes=true; |
| 830 |
if (sId.isValid()) |
| 831 |
f << sId << ","; |
| 832 |
} |
| 833 |
ascii().addPos(pos); |
| 834 |
ascii().addNote(f.str().c_str()); |
| 835 |
return true; |
| 836 |
} |
| 837 |
|
| 838 |
bool PowerPoint7Parser::readEnvironment(int level, long lastPos) |
| 839 |
{ |
| 840 |
MWAWInputStreamPtr input=getInput(); |
| 841 |
long pos=input->tell(); |
| 842 |
|
| 843 |
libmwaw::DebugStream f; |
| 844 |
PowerPoint7Struct::Zone header; |
| 845 |
if (!header.read(input,lastPos) || header.m_type!=1010) { |
| 846 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readEnvironment: can not find the zone header\n")); |
| 847 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 848 |
return false; |
| 849 |
} |
| 850 |
f << "Entries(EnvironList)[" << level << "]:" << header; |
| 851 |
ascii().addPos(pos); |
| 852 |
ascii().addNote(f.str().c_str()); |
| 853 |
|
| 854 |
long endPos=pos+16+header.m_dataSize; |
| 855 |
while (input->tell()<endPos) { |
| 856 |
pos=input->tell(); |
| 857 |
auto cType=int(input->readULong(2)); |
| 858 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 859 |
|
| 860 |
bool done=false; |
| 861 |
switch (cType) { |
| 862 |
case 1028: |
| 863 |
done=readZone1028(level+1,endPos); |
| 864 |
break; |
| 865 |
case 2005: // FontCollection |
| 866 |
done=m_state->m_textParser->readFontCollection(level+1,endPos); |
| 867 |
break; |
| 868 |
case 2006: |
| 869 |
done=m_state->m_graphParser->readPictureList(level+1,endPos); |
| 870 |
break; |
| 871 |
case 2020: // SoundCollection |
| 872 |
done=readSoundCollection(level+1,endPos); |
| 873 |
break; |
| 874 |
case 2027: |
| 875 |
done=m_state->m_textParser->readFieldList(level+1,endPos); |
| 876 |
break; |
| 877 |
case 2031: { // basic font color? |
| 878 |
std::vector<MWAWColor> colors; |
| 879 |
done=readColorList(level+1,endPos, colors); |
| 880 |
break; |
| 881 |
} |
| 882 |
case 3012: |
| 883 |
done=readZone3012(level+1,endPos); |
| 884 |
break; |
| 885 |
case 4016: |
| 886 |
done=m_state->m_textParser->readRulerList(level+1,endPos); |
| 887 |
break; |
| 888 |
case 4040: |
| 889 |
done=readKinsoku(level+1,endPos); |
| 890 |
break; |
| 891 |
default: |
| 892 |
done=readZone(level+1,endPos); |
| 893 |
if (done) { |
| 894 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readEnvironment: find unexpected zone %d\n", cType)); |
| 895 |
} |
| 896 |
break; |
| 897 |
} |
| 898 |
if (done) continue; |
| 899 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readEnvironment: can not read some data\n")); |
| 900 |
ascii().addPos(pos); |
| 901 |
ascii().addNote("EnvironList:###extra"); |
| 902 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 903 |
break; |
| 904 |
} |
| 905 |
return true; |
| 906 |
} |
| 907 |
|
| 908 |
bool PowerPoint7Parser::readColorScheme(int level, long lastPos, std::vector<MWAWColor> &colors) |
| 909 |
{ |
| 910 |
MWAWInputStreamPtr input=getInput(); |
| 911 |
long pos=input->tell(); |
| 912 |
|
| 913 |
libmwaw::DebugStream f; |
| 914 |
PowerPoint7Struct::Zone header; |
| 915 |
if (!header.read(input,lastPos) || header.m_type!=1012) { |
| 916 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readColorScheme: can not find the zone header\n")); |
| 917 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 918 |
return false; |
| 919 |
} |
| 920 |
f << "Entries(ColorScheme)[" << level << "]:" << header; |
| 921 |
ascii().addPos(pos); |
| 922 |
ascii().addNote(f.str().c_str()); |
| 923 |
|
| 924 |
long endPos=pos+16+header.m_dataSize; |
| 925 |
while (input->tell()<endPos) { |
| 926 |
pos=input->tell(); |
| 927 |
auto cType=int(input->readULong(2)); |
| 928 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 929 |
|
| 930 |
bool done=false; |
| 931 |
switch (cType) { |
| 932 |
case 2031: |
| 933 |
done=readColorList(level+1,endPos, colors); |
| 934 |
break; |
| 935 |
default: |
| 936 |
done=readZone(level+1,endPos); |
| 937 |
if (done) { |
| 938 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readColorScheme: find unexpected zone %d\n", cType)); |
| 939 |
} |
| 940 |
break; |
| 941 |
} |
| 942 |
if (done) continue; |
| 943 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readColorScheme: can not read some data\n")); |
| 944 |
ascii().addPos(pos); |
| 945 |
ascii().addNote("ColorScheme:###extra"); |
| 946 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 947 |
break; |
| 948 |
} |
| 949 |
return true; |
| 950 |
} |
| 951 |
|
| 952 |
bool PowerPoint7Parser::readZone1015(int level, long lastPos) |
| 953 |
{ |
| 954 |
MWAWInputStreamPtr input=getInput(); |
| 955 |
long pos=input->tell(); |
| 956 |
|
| 957 |
libmwaw::DebugStream f; |
| 958 |
PowerPoint7Struct::Zone header; |
| 959 |
if (!header.read(input,lastPos) || header.m_type!=1015) { |
| 960 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone1015: can not find the zone header\n")); |
| 961 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 962 |
return false; |
| 963 |
} |
| 964 |
f << "Entries(Zone1015B)[" << level << "]:" << header; |
| 965 |
if (header.m_dataSize!=12) { |
| 966 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone1015: find unexpected data size\n")); |
| 967 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 968 |
if (header.m_dataSize) |
| 969 |
ascii().addDelimiter(pos+16,'|'); |
| 970 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 971 |
} |
| 972 |
else { |
| 973 |
int val; |
| 974 |
for (int i=0; i<2; ++i) { // f0=1|10 |
| 975 |
val=int(input->readULong(2)); |
| 976 |
if (val) f << "f" << i << "=" << val << ","; |
| 977 |
} |
| 978 |
for (int i=0; i<4; ++i) { // small number |
| 979 |
val=int(input->readULong(1)); |
| 980 |
if (val) f << "f" << i+2 << "=" << val << ","; |
| 981 |
} |
| 982 |
for (int i=0; i<2; ++i) { // f6=0|7 |
| 983 |
val=int(input->readULong(2)); |
| 984 |
if (val) f << "f" << i+6 << "=" << val << ","; |
| 985 |
} |
| 986 |
} |
| 987 |
ascii().addPos(pos); |
| 988 |
ascii().addNote(f.str().c_str()); |
| 989 |
return true; |
| 990 |
} |
| 991 |
|
| 992 |
bool PowerPoint7Parser::readSlideShowInfo(int level, long lastPos) |
| 993 |
{ |
| 994 |
MWAWInputStreamPtr input=getInput(); |
| 995 |
long pos=input->tell(); |
| 996 |
|
| 997 |
libmwaw::DebugStream f; |
| 998 |
PowerPoint7Struct::Zone header; |
| 999 |
if (!header.read(input,lastPos) || header.m_type!=1017) { |
| 1000 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlideShowInfo: can not find the zone header\n")); |
| 1001 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1002 |
return false; |
| 1003 |
} |
| 1004 |
f << "Entries(SlideShowInfo)[" << level << "]:" << header; |
| 1005 |
if (header.m_dataSize!=24) { |
| 1006 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlideShowInfo: find unexpected data size\n")); |
| 1007 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 1008 |
if (header.m_dataSize) |
| 1009 |
ascii().addDelimiter(pos+16,'|'); |
| 1010 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 1011 |
} |
| 1012 |
else { |
| 1013 |
for (int i=0; i<6; ++i) { |
| 1014 |
auto val=int(input->readLong(4)); |
| 1015 |
int const expected[]= {0,2,2,0,1,-1}; |
| 1016 |
if (val!=expected[i]) |
| 1017 |
f << "f" << i << "=" << val << ","; |
| 1018 |
} |
| 1019 |
} |
| 1020 |
ascii().addPos(pos); |
| 1021 |
ascii().addNote(f.str().c_str()); |
| 1022 |
return true; |
| 1023 |
} |
| 1024 |
|
| 1025 |
bool PowerPoint7Parser::readSlideViewInfo(int level, long lastPos) |
| 1026 |
{ |
| 1027 |
MWAWInputStreamPtr input=getInput(); |
| 1028 |
long pos=input->tell(); |
| 1029 |
|
| 1030 |
libmwaw::DebugStream f; |
| 1031 |
PowerPoint7Struct::Zone header; |
| 1032 |
if (!header.read(input,lastPos) || header.m_type!=1018) { |
| 1033 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlideViewInfo: can not find the zone header\n")); |
| 1034 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1035 |
return false; |
| 1036 |
} |
| 1037 |
f << "Entries(SlideViewInfo)[list," << level << "]:" << header; |
| 1038 |
ascii().addPos(pos); |
| 1039 |
ascii().addNote(f.str().c_str()); |
| 1040 |
|
| 1041 |
long endPos=pos+16+header.m_dataSize; |
| 1042 |
while (input->tell()<endPos) { |
| 1043 |
pos=input->tell(); |
| 1044 |
auto cType=int(input->readULong(2)); |
| 1045 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1046 |
|
| 1047 |
bool done=false; |
| 1048 |
switch (cType) { |
| 1049 |
case 1021: |
| 1050 |
done=readViewInfoAtom(level+1,endPos); |
| 1051 |
break; |
| 1052 |
case 1022: |
| 1053 |
done=readSlideViewInfoAtom(level+1,endPos); |
| 1054 |
break; |
| 1055 |
case 2026: |
| 1056 |
done=readZone2026(level+1,endPos); |
| 1057 |
break; |
| 1058 |
default: |
| 1059 |
done=readZone(level+1,endPos); |
| 1060 |
if (done) { |
| 1061 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlideViewInfo: find unexpected zone %d\n", cType)); |
| 1062 |
} |
| 1063 |
break; |
| 1064 |
} |
| 1065 |
if (done) continue; |
| 1066 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlideViewInfo: can not read some data\n")); |
| 1067 |
ascii().addPos(pos); |
| 1068 |
ascii().addNote("SlideViewInfo:###extra"); |
| 1069 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 1070 |
break; |
| 1071 |
} |
| 1072 |
return true; |
| 1073 |
} |
| 1074 |
|
| 1075 |
bool PowerPoint7Parser::readGuideAtom(int level, long lastPos) |
| 1076 |
{ |
| 1077 |
MWAWInputStreamPtr input=getInput(); |
| 1078 |
long pos=input->tell(); |
| 1079 |
|
| 1080 |
libmwaw::DebugStream f; |
| 1081 |
PowerPoint7Struct::Zone header; |
| 1082 |
if (!header.read(input,lastPos) || header.m_type!=1019) { |
| 1083 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readGuideAtom: can not find the zone header\n")); |
| 1084 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1085 |
return false; |
| 1086 |
} |
| 1087 |
f << "Entries(GuideAtom)[" << level << "]:" << header; |
| 1088 |
if (header.m_dataSize!=8) { |
| 1089 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readGuideAtom: find unexpected data size\n")); |
| 1090 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 1091 |
if (header.m_dataSize) |
| 1092 |
ascii().addDelimiter(pos+16,'|'); |
| 1093 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 1094 |
} |
| 1095 |
else { |
| 1096 |
for (int i=0; i<4; ++i) { // f0=0|1 |
| 1097 |
auto val=int(input->readLong(2)); |
| 1098 |
if (val) f << "f" << i << "=" << val << ","; |
| 1099 |
} |
| 1100 |
} |
| 1101 |
ascii().addPos(pos); |
| 1102 |
ascii().addNote(f.str().c_str()); |
| 1103 |
return true; |
| 1104 |
} |
| 1105 |
|
| 1106 |
bool PowerPoint7Parser::readViewInfoAtom(int level, long lastPos) |
| 1107 |
{ |
| 1108 |
MWAWInputStreamPtr input=getInput(); |
| 1109 |
long pos=input->tell(); |
| 1110 |
|
| 1111 |
libmwaw::DebugStream f; |
| 1112 |
PowerPoint7Struct::Zone header; |
| 1113 |
if (!header.read(input,lastPos) || header.m_type!=1021) { |
| 1114 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readViewInfoAtom: can not find the zone header\n")); |
| 1115 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1116 |
return false; |
| 1117 |
} |
| 1118 |
f << "Entries(VViewInfoAtom)[" << level << "]:" << header; |
| 1119 |
if (header.m_dataSize!=52) { |
| 1120 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readViewInfoAtom: find unexpected data size\n")); |
| 1121 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 1122 |
if (header.m_dataSize) |
| 1123 |
ascii().addDelimiter(pos+16,'|'); |
| 1124 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 1125 |
} |
| 1126 |
else { |
| 1127 |
f << "dims=["; |
| 1128 |
for (int i=0; i<4; ++i) { |
| 1129 |
long number=int(input->readLong(4)); |
| 1130 |
long denom=int(input->readLong(4)); |
| 1131 |
f << number << "/" << denom << ","; |
| 1132 |
} |
| 1133 |
f << "],"; |
| 1134 |
f << "dim2=["; |
| 1135 |
for (int i=0; i<4; ++i) |
| 1136 |
f << input->readLong(4) << ","; |
| 1137 |
f << "],"; |
| 1138 |
for (int i=0; i<2; ++i) { // f0=0|1, f1=76-b8 |
| 1139 |
auto val=int(input->readLong(2)); |
| 1140 |
if (val) f << "f" << i << "=" << val << ","; |
| 1141 |
} |
| 1142 |
} |
| 1143 |
ascii().addPos(pos); |
| 1144 |
ascii().addNote(f.str().c_str()); |
| 1145 |
return true; |
| 1146 |
} |
| 1147 |
|
| 1148 |
bool PowerPoint7Parser::readSlideViewInfoAtom(int level, long lastPos) |
| 1149 |
{ |
| 1150 |
MWAWInputStreamPtr input=getInput(); |
| 1151 |
long pos=input->tell(); |
| 1152 |
|
| 1153 |
libmwaw::DebugStream f; |
| 1154 |
PowerPoint7Struct::Zone header; |
| 1155 |
if (!header.read(input,lastPos) || header.m_type!=1022) { |
| 1156 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlideViewInfoAtom: can not find the zone header\n")); |
| 1157 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1158 |
return false; |
| 1159 |
} |
| 1160 |
f << "Entries(SlideViewInfo)[atom," << level << "]:" << header; |
| 1161 |
if (header.m_dataSize!=2) { |
| 1162 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlideViewInfoAtom: find unexpected data size\n")); |
| 1163 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 1164 |
if (header.m_dataSize) |
| 1165 |
ascii().addDelimiter(pos+16,'|'); |
| 1166 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 1167 |
} |
| 1168 |
else { |
| 1169 |
unsigned long val=input->readULong(2); |
| 1170 |
if (val!=0x100) |
| 1171 |
f << "id?=" << val << ","; |
| 1172 |
} |
| 1173 |
ascii().addPos(pos); |
| 1174 |
ascii().addNote(f.str().c_str()); |
| 1175 |
return true; |
| 1176 |
} |
| 1177 |
|
| 1178 |
bool PowerPoint7Parser::readVbaInfo(int level, long lastPos) |
| 1179 |
{ |
| 1180 |
MWAWInputStreamPtr input=getInput(); |
| 1181 |
long pos=input->tell(); |
| 1182 |
|
| 1183 |
libmwaw::DebugStream f; |
| 1184 |
PowerPoint7Struct::Zone header; |
| 1185 |
if (!header.read(input,lastPos) || header.m_type!=1023) { |
| 1186 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readVbaInfo: can not find the zone header\n")); |
| 1187 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1188 |
return false; |
| 1189 |
} |
| 1190 |
f << "Entries(VbaInfo)[" << level << "]:" << header; |
| 1191 |
ascii().addPos(pos); |
| 1192 |
ascii().addNote(f.str().c_str()); |
| 1193 |
|
| 1194 |
long endPos=pos+16+header.m_dataSize; |
| 1195 |
while (input->tell()<endPos) { |
| 1196 |
pos=input->tell(); |
| 1197 |
auto cType=int(input->readULong(2)); |
| 1198 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1199 |
|
| 1200 |
bool done=false; |
| 1201 |
switch (cType) { |
| 1202 |
case 1024: |
| 1203 |
done=readVbaInfoAtom(level+1,endPos); |
| 1204 |
break; |
| 1205 |
case 4026: { |
| 1206 |
std::string string; |
| 1207 |
int zId; // 7:_VBA_PROJECT, 160:"" |
| 1208 |
done=readString(level+1,endPos,string,zId,"VbaInfo"); |
| 1209 |
break; |
| 1210 |
} |
| 1211 |
default: |
| 1212 |
done=readZone(level+1,endPos); |
| 1213 |
if (done) { |
| 1214 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readVbaInfo: find unexpected zone %d\n", cType)); |
| 1215 |
} |
| 1216 |
break; |
| 1217 |
} |
| 1218 |
if (done) continue; |
| 1219 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readVbaInfo: can not read some data\n")); |
| 1220 |
ascii().addPos(pos); |
| 1221 |
ascii().addNote("VbaInfo:###extra"); |
| 1222 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 1223 |
break; |
| 1224 |
} |
| 1225 |
return true; |
| 1226 |
} |
| 1227 |
|
| 1228 |
bool PowerPoint7Parser::readVbaInfoAtom(int level, long lastPos) |
| 1229 |
{ |
| 1230 |
MWAWInputStreamPtr input=getInput(); |
| 1231 |
long pos=input->tell(); |
| 1232 |
|
| 1233 |
libmwaw::DebugStream f; |
| 1234 |
PowerPoint7Struct::Zone header; |
| 1235 |
if (!header.read(input,lastPos) || header.m_type!=1024) { |
| 1236 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readVbaInfoAtom: can not find the zone header\n")); |
| 1237 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1238 |
return false; |
| 1239 |
} |
| 1240 |
f << "Entries(VbaInfo)[atom," << level << "]:" << header; |
| 1241 |
if (header.m_dataSize%4) { |
| 1242 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readVbaInfoAtom: find unexpected data size\n")); |
| 1243 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 1244 |
if (header.m_dataSize) |
| 1245 |
ascii().addDelimiter(pos+16,'|'); |
| 1246 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 1247 |
} |
| 1248 |
else { |
| 1249 |
auto N=int(header.m_dataSize/4); |
| 1250 |
for (int i=0; i<N; ++i) { // always 0 |
| 1251 |
auto val=int(input->readLong(4)); |
| 1252 |
if (val) f << "f" << i << "=" << val << ","; |
| 1253 |
} |
| 1254 |
input->seek(pos+16+header.m_dataSize, librevenge::RVNG_SEEK_SET); |
| 1255 |
} |
| 1256 |
ascii().addPos(pos); |
| 1257 |
ascii().addNote(f.str().c_str()); |
| 1258 |
return true; |
| 1259 |
} |
| 1260 |
|
| 1261 |
bool PowerPoint7Parser::readSSDocInfoAtom(int level, long lastPos) |
| 1262 |
{ |
| 1263 |
MWAWInputStreamPtr input=getInput(); |
| 1264 |
long pos=input->tell(); |
| 1265 |
|
| 1266 |
libmwaw::DebugStream f; |
| 1267 |
PowerPoint7Struct::Zone header; |
| 1268 |
if (!header.read(input,lastPos) || header.m_type!=1025) { |
| 1269 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSSDocInfoAtom: can not find the zone header\n")); |
| 1270 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1271 |
return false; |
| 1272 |
} |
| 1273 |
f << "Entries(SSDocInfoAtom)[" << level << "]:" << header; |
| 1274 |
if (header.m_dataSize!=0xc) { |
| 1275 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSSDocInfoAtom: find unexpected data size\n")); |
| 1276 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 1277 |
if (header.m_dataSize) |
| 1278 |
ascii().addDelimiter(pos+16,'|'); |
| 1279 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 1280 |
} |
| 1281 |
else { |
| 1282 |
for (int i=0; i<6; ++i) { |
| 1283 |
auto val=int(input->readLong(2)); |
| 1284 |
int const expected[]= {1,0,0,0,0,0x100}; |
| 1285 |
if (val!=expected[i]) |
| 1286 |
f << "f" << i << "=" << val << ","; |
| 1287 |
} |
| 1288 |
} |
| 1289 |
ascii().addPos(pos); |
| 1290 |
ascii().addNote(f.str().c_str()); |
| 1291 |
return true; |
| 1292 |
} |
| 1293 |
|
| 1294 |
bool PowerPoint7Parser::readSummary(int level, long lastPos) |
| 1295 |
{ |
| 1296 |
MWAWInputStreamPtr input=getInput(); |
| 1297 |
long pos=input->tell(); |
| 1298 |
|
| 1299 |
libmwaw::DebugStream f; |
| 1300 |
PowerPoint7Struct::Zone header; |
| 1301 |
if (!header.read(input,lastPos) || header.m_type!=1026) { |
| 1302 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSummary: can not find the zone header\n")); |
| 1303 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1304 |
return false; |
| 1305 |
} |
| 1306 |
f << "Entries(SummaryList)[" << level << "]:" << header; |
| 1307 |
ascii().addPos(pos); |
| 1308 |
ascii().addNote(f.str().c_str()); |
| 1309 |
|
| 1310 |
long endPos=pos+16+header.m_dataSize; |
| 1311 |
while (input->tell()<endPos) { |
| 1312 |
pos=input->tell(); |
| 1313 |
auto cType=int(input->readULong(2)); |
| 1314 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1315 |
|
| 1316 |
bool done=false; |
| 1317 |
switch (cType) { |
| 1318 |
case 2019: |
| 1319 |
done=readBookmarkCollection(level+1,endPos); |
| 1320 |
break; |
| 1321 |
default: |
| 1322 |
done=readZone(level+1,endPos); |
| 1323 |
if (done) { |
| 1324 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSummary: find unexpected zone %d\n", cType)); |
| 1325 |
} |
| 1326 |
break; |
| 1327 |
} |
| 1328 |
if (done) continue; |
| 1329 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSummary: can not read some data\n")); |
| 1330 |
ascii().addPos(pos); |
| 1331 |
ascii().addNote("SummaryList:###extra"); |
| 1332 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 1333 |
break; |
| 1334 |
} |
| 1335 |
return true; |
| 1336 |
} |
| 1337 |
|
| 1338 |
bool PowerPoint7Parser::readZone1028(int level, long lastPos) |
| 1339 |
{ |
| 1340 |
MWAWInputStreamPtr input=getInput(); |
| 1341 |
long pos=input->tell(); |
| 1342 |
|
| 1343 |
libmwaw::DebugStream f; |
| 1344 |
PowerPoint7Struct::Zone header; |
| 1345 |
if (!header.read(input,lastPos) || header.m_type!=1028) { |
| 1346 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone1028: can not find the zone header\n")); |
| 1347 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1348 |
return false; |
| 1349 |
} |
| 1350 |
f << "Entries(Zone1028B)[" << level << "]:" << header; |
| 1351 |
ascii().addPos(pos); |
| 1352 |
ascii().addNote(f.str().c_str()); |
| 1353 |
|
| 1354 |
long endPos=pos+16+header.m_dataSize; |
| 1355 |
while (input->tell()<endPos) { |
| 1356 |
pos=input->tell(); |
| 1357 |
auto cType=int(input->readULong(2)); |
| 1358 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1359 |
|
| 1360 |
bool done=false; |
| 1361 |
switch (cType) { |
| 1362 |
case 1029: |
| 1363 |
done=readZone1028Atom(level+1,endPos); |
| 1364 |
break; |
| 1365 |
case 4052: |
| 1366 |
done=readZone1028Data(level+1,endPos); |
| 1367 |
break; |
| 1368 |
default: |
| 1369 |
done=readZone(level+1,endPos); |
| 1370 |
if (done) { |
| 1371 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone1028: find unexpected zone %d\n", cType)); |
| 1372 |
} |
| 1373 |
break; |
| 1374 |
} |
| 1375 |
if (done) continue; |
| 1376 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone1028: can not read some data\n")); |
| 1377 |
ascii().addPos(pos); |
| 1378 |
ascii().addNote("Zone1028:###extra"); |
| 1379 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 1380 |
break; |
| 1381 |
} |
| 1382 |
return true; |
| 1383 |
} |
| 1384 |
|
| 1385 |
bool PowerPoint7Parser::readZone1028Atom(int level, long lastPos) |
| 1386 |
{ |
| 1387 |
MWAWInputStreamPtr input=getInput(); |
| 1388 |
long pos=input->tell(); |
| 1389 |
|
| 1390 |
libmwaw::DebugStream f; |
| 1391 |
PowerPoint7Struct::Zone header; |
| 1392 |
if (!header.read(input,lastPos) || header.m_type!=1029) { |
| 1393 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone1028Atom: can not find the zone header\n")); |
| 1394 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1395 |
return false; |
| 1396 |
} |
| 1397 |
f << "Entries(Zone1028B)[atom," << level << "]:" << header; |
| 1398 |
if (header.m_dataSize!=0xa) { |
| 1399 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone1028Atom: find unexpected data size\n")); |
| 1400 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 1401 |
if (header.m_dataSize) |
| 1402 |
ascii().addDelimiter(pos+16,'|'); |
| 1403 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 1404 |
} |
| 1405 |
else { |
| 1406 |
for (int i=0; i<10; ++i) { // f0-f6=0|1,f7=f8=0, f9=d-b2 |
| 1407 |
auto val=int(input->readULong(1)); |
| 1408 |
if (val==1) |
| 1409 |
f << "f" << i << ","; |
| 1410 |
else if (val) |
| 1411 |
f << "f" << i << "=" << std::hex << val << std::dec << ","; |
| 1412 |
} |
| 1413 |
} |
| 1414 |
ascii().addPos(pos); |
| 1415 |
ascii().addNote(f.str().c_str()); |
| 1416 |
return true; |
| 1417 |
} |
| 1418 |
|
| 1419 |
bool PowerPoint7Parser::readOutlineViewInfo(int level, long lastPos) |
| 1420 |
{ |
| 1421 |
MWAWInputStreamPtr input=getInput(); |
| 1422 |
long pos=input->tell(); |
| 1423 |
|
| 1424 |
libmwaw::DebugStream f; |
| 1425 |
PowerPoint7Struct::Zone header; |
| 1426 |
if (!header.read(input,lastPos) || header.m_type!=1031) { |
| 1427 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readOutlineViewInfo: can not find the zone header\n")); |
| 1428 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1429 |
return false; |
| 1430 |
} |
| 1431 |
f << "Entries(OutlineViewInfo)[" << level << "]:" << header; |
| 1432 |
ascii().addPos(pos); |
| 1433 |
ascii().addNote(f.str().c_str()); |
| 1434 |
|
| 1435 |
long endPos=pos+16+header.m_dataSize; |
| 1436 |
while (input->tell()<endPos) { |
| 1437 |
pos=input->tell(); |
| 1438 |
auto cType=int(input->readULong(2)); |
| 1439 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1440 |
|
| 1441 |
bool done=false; |
| 1442 |
switch (cType) { |
| 1443 |
case 1021: |
| 1444 |
done=readViewInfoAtom(level+1,endPos); |
| 1445 |
break; |
| 1446 |
default: |
| 1447 |
done=readZone(level+1,endPos); |
| 1448 |
if (done) { |
| 1449 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readOutlineViewInfo: find unexpected zone %d\n", cType)); |
| 1450 |
} |
| 1451 |
break; |
| 1452 |
} |
| 1453 |
if (done) continue; |
| 1454 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readOutlineViewInfo: can not read some data\n")); |
| 1455 |
ascii().addPos(pos); |
| 1456 |
ascii().addNote("OutlineViewInfo:###extra"); |
| 1457 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 1458 |
break; |
| 1459 |
} |
| 1460 |
return true; |
| 1461 |
} |
| 1462 |
|
| 1463 |
bool PowerPoint7Parser::readSorterViewInfo(int level, long lastPos) |
| 1464 |
{ |
| 1465 |
MWAWInputStreamPtr input=getInput(); |
| 1466 |
long pos=input->tell(); |
| 1467 |
|
| 1468 |
libmwaw::DebugStream f; |
| 1469 |
PowerPoint7Struct::Zone header; |
| 1470 |
if (!header.read(input,lastPos) || header.m_type!=1032) { |
| 1471 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSorterViewInfo: can not find the zone header\n")); |
| 1472 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1473 |
return false; |
| 1474 |
} |
| 1475 |
f << "Entries(SorterViewInfo)[" << level << "]:" << header; |
| 1476 |
ascii().addPos(pos); |
| 1477 |
ascii().addNote(f.str().c_str()); |
| 1478 |
|
| 1479 |
long endPos=pos+16+header.m_dataSize; |
| 1480 |
while (input->tell()<endPos) { |
| 1481 |
pos=input->tell(); |
| 1482 |
auto cType=int(input->readULong(2)); |
| 1483 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1484 |
|
| 1485 |
bool done=false; |
| 1486 |
switch (cType) { |
| 1487 |
case 1021: |
| 1488 |
done=readViewInfoAtom(level+1,endPos); |
| 1489 |
break; |
| 1490 |
default: |
| 1491 |
done=readZone(level+1,endPos); |
| 1492 |
if (done) { |
| 1493 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSorterViewInfo: find unexpected zone %d\n", cType)); |
| 1494 |
} |
| 1495 |
break; |
| 1496 |
} |
| 1497 |
if (done) continue; |
| 1498 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSorterViewInfo: can not read some data\n")); |
| 1499 |
ascii().addPos(pos); |
| 1500 |
ascii().addNote("SorterViewInfo:###extra"); |
| 1501 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 1502 |
break; |
| 1503 |
} |
| 1504 |
return true; |
| 1505 |
} |
| 1506 |
|
| 1507 |
bool PowerPoint7Parser::readContainerList(int level, long lastPos) |
| 1508 |
{ |
| 1509 |
MWAWInputStreamPtr input=getInput(); |
| 1510 |
long pos=input->tell(); |
| 1511 |
|
| 1512 |
libmwaw::DebugStream f; |
| 1513 |
PowerPoint7Struct::Zone header; |
| 1514 |
if (!header.read(input,lastPos) || header.m_type!=2000) { |
| 1515 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readContainerList: can not find the zone header\n")); |
| 1516 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1517 |
return false; |
| 1518 |
} |
| 1519 |
f << "Entries(Container)[list," << level << "]:" << header; |
| 1520 |
switch (header.m_values[3]) { |
| 1521 |
case 10: |
| 1522 |
f << "slides,"; |
| 1523 |
break; |
| 1524 |
case 11: |
| 1525 |
f << "slides[master],"; |
| 1526 |
break; |
| 1527 |
case 12: // vbaInfo, viewInfo, bookmark collection |
| 1528 |
f << "info,"; |
| 1529 |
break; |
| 1530 |
case 15: |
| 1531 |
f << "group,"; |
| 1532 |
break; |
| 1533 |
default: |
| 1534 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readContainerList: unknown type\n")); |
| 1535 |
f << "##type=" << header.m_values[3] << ","; |
| 1536 |
} |
| 1537 |
ascii().addPos(pos); |
| 1538 |
ascii().addNote(f.str().c_str()); |
| 1539 |
|
| 1540 |
long endPos=pos+16+header.m_dataSize; |
| 1541 |
while (input->tell()<endPos) { |
| 1542 |
pos=input->tell(); |
| 1543 |
auto cType=int(input->readULong(2)); |
| 1544 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1545 |
|
| 1546 |
bool done=false; |
| 1547 |
switch (cType) { |
| 1548 |
case 1006: |
| 1549 |
done=readSlides(level+1,endPos,false); |
| 1550 |
break; |
| 1551 |
case 1016: |
| 1552 |
done=readSlides(level+1,endPos,true); |
| 1553 |
break; |
| 1554 |
case 1018: |
| 1555 |
done=readSlideViewInfo(level+1,endPos); |
| 1556 |
break; |
| 1557 |
case 1023: |
| 1558 |
done=readVbaInfo(level+1,endPos); |
| 1559 |
break; |
| 1560 |
case 1031: |
| 1561 |
done=readOutlineViewInfo(level+1,endPos); |
| 1562 |
break; |
| 1563 |
case 1032: |
| 1564 |
done=readSorterViewInfo(level+1,endPos); |
| 1565 |
break; |
| 1566 |
case 2001: { |
| 1567 |
int N; // the number of child: slides, shapes, ... |
| 1568 |
done=readContainerAtom(level+1,endPos,N); |
| 1569 |
break; |
| 1570 |
} |
| 1571 |
case 3001: |
| 1572 |
done=m_state->m_graphParser->readGroup(level+1,endPos); |
| 1573 |
break; |
| 1574 |
case 3008: |
| 1575 |
done=m_state->m_graphParser->readRect(level+1,endPos); |
| 1576 |
break; |
| 1577 |
case 3014: |
| 1578 |
done=m_state->m_graphParser->readLine(level+1,endPos); |
| 1579 |
break; |
| 1580 |
case 3016: |
| 1581 |
done=m_state->m_graphParser->readPolygon(level+1,endPos); |
| 1582 |
break; |
| 1583 |
case 3018: |
| 1584 |
done=m_state->m_graphParser->readArc(level+1,endPos); |
| 1585 |
break; |
| 1586 |
default: |
| 1587 |
done=readZone(level+1,endPos); |
| 1588 |
if (done) { |
| 1589 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readContainerList: find unexpected zone %d\n", cType)); |
| 1590 |
} |
| 1591 |
break; |
| 1592 |
} |
| 1593 |
if (done) continue; |
| 1594 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readContainerList: can not read some data\n")); |
| 1595 |
ascii().addPos(pos); |
| 1596 |
ascii().addNote("Container:###extra"); |
| 1597 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 1598 |
break; |
| 1599 |
} |
| 1600 |
return true; |
| 1601 |
} |
| 1602 |
|
| 1603 |
bool PowerPoint7Parser::readContainerAtom(int level, long lastPos, int &N) |
| 1604 |
{ |
| 1605 |
MWAWInputStreamPtr input=getInput(); |
| 1606 |
long pos=input->tell(); |
| 1607 |
|
| 1608 |
libmwaw::DebugStream f; |
| 1609 |
PowerPoint7Struct::Zone header; |
| 1610 |
if (!header.read(input,lastPos) || header.m_type!=2001) { |
| 1611 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readContainerAtom: can not find the zone header\n")); |
| 1612 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1613 |
return false; |
| 1614 |
} |
| 1615 |
f << "Entries(Container)[atom," << level << "]:" << header; |
| 1616 |
if (header.m_dataSize!=0x4) { |
| 1617 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readContainerAtom: find unexpected data size\n")); |
| 1618 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 1619 |
if (header.m_dataSize) |
| 1620 |
ascii().addDelimiter(pos+16,'|'); |
| 1621 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 1622 |
N=0; |
| 1623 |
} |
| 1624 |
else { |
| 1625 |
N=int(input->readULong(4)); |
| 1626 |
f << "N=" << N << ","; |
| 1627 |
} |
| 1628 |
ascii().addPos(pos); |
| 1629 |
ascii().addNote(f.str().c_str()); |
| 1630 |
return true; |
| 1631 |
} |
| 1632 |
|
| 1633 |
bool PowerPoint7Parser::readIdentifier(int level, long endPos, int &id, std::string const &wh) |
| 1634 |
{ |
| 1635 |
MWAWInputStreamPtr input=getInput(); |
| 1636 |
long pos=input->tell(); |
| 1637 |
long lastPos=endPos<0 ? input->size() : endPos; |
| 1638 |
if (pos+16>lastPos) |
| 1639 |
return false; |
| 1640 |
|
| 1641 |
PowerPoint7Struct::Zone header; |
| 1642 |
if (!header.read(input,lastPos) || header.m_type!=2017) { |
| 1643 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1644 |
return false; |
| 1645 |
} |
| 1646 |
libmwaw::DebugStream f; |
| 1647 |
if (!wh.empty()) |
| 1648 |
f << "Entries(" << wh << ")[id," << level << "]:" << header; |
| 1649 |
else |
| 1650 |
f << "Entries(Identifier)[" << level << "]:" << header; |
| 1651 |
if (header.m_dataSize) { |
| 1652 |
f << "###dSz=" << header.m_dataSize << ","; |
| 1653 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readIdentifier: find unexpected data for zone\n")); |
| 1654 |
} |
| 1655 |
id=header.m_values[3]; |
| 1656 |
ascii().addPos(pos); |
| 1657 |
ascii().addNote(f.str().c_str()); |
| 1658 |
return true; |
| 1659 |
} |
| 1660 |
|
| 1661 |
bool PowerPoint7Parser::readBookmarkCollection(int level, long lastPos) |
| 1662 |
{ |
| 1663 |
MWAWInputStreamPtr input=getInput(); |
| 1664 |
long pos=input->tell(); |
| 1665 |
|
| 1666 |
libmwaw::DebugStream f; |
| 1667 |
PowerPoint7Struct::Zone header; |
| 1668 |
if (!header.read(input,lastPos) || header.m_type!=2019) { |
| 1669 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readBookmarkCollection: can not find the zone header\n")); |
| 1670 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1671 |
return false; |
| 1672 |
} |
| 1673 |
f << "Entries(BookmarkCollection)[" << level << "]:" << header; |
| 1674 |
ascii().addPos(pos); |
| 1675 |
ascii().addNote(f.str().c_str()); |
| 1676 |
|
| 1677 |
long endPos=pos+16+header.m_dataSize; |
| 1678 |
while (input->tell()<endPos) { |
| 1679 |
pos=input->tell(); |
| 1680 |
auto cType=int(input->readULong(2)); |
| 1681 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1682 |
|
| 1683 |
bool done=false; |
| 1684 |
switch (cType) { |
| 1685 |
case 2017: { |
| 1686 |
int id; |
| 1687 |
done=readIdentifier(level+1,endPos,id,"BookmarkCollection"); |
| 1688 |
break; |
| 1689 |
} |
| 1690 |
case 2018: |
| 1691 |
done=readZoneNoData(level+1,endPos,"BookmarkCollection","id,end"); |
| 1692 |
break; |
| 1693 |
case 2025: |
| 1694 |
done=readBookmarkSeedAtom(level+1,endPos); |
| 1695 |
break; |
| 1696 |
default: |
| 1697 |
done=readZone(level+1,endPos); |
| 1698 |
if (done) { |
| 1699 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readBookmarkCollection: find unexpected zone %d\n", cType)); |
| 1700 |
} |
| 1701 |
break; |
| 1702 |
} |
| 1703 |
if (done) continue; |
| 1704 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readBookmarkCollection: can not read some data\n")); |
| 1705 |
ascii().addPos(pos); |
| 1706 |
ascii().addNote("BookmarkCollection:###extra"); |
| 1707 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 1708 |
break; |
| 1709 |
} |
| 1710 |
return true; |
| 1711 |
} |
| 1712 |
|
| 1713 |
bool PowerPoint7Parser::readSoundCollection(int level, long lastPos) |
| 1714 |
{ |
| 1715 |
MWAWInputStreamPtr input=getInput(); |
| 1716 |
long pos=input->tell(); |
| 1717 |
|
| 1718 |
libmwaw::DebugStream f; |
| 1719 |
PowerPoint7Struct::Zone header; |
| 1720 |
if (!header.read(input,lastPos) || header.m_type!=2020) { |
| 1721 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSoundCollection: can not find the zone header\n")); |
| 1722 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1723 |
return false; |
| 1724 |
} |
| 1725 |
f << "Entries(SoundCollection)[" << level << "]:" << header; |
| 1726 |
ascii().addPos(pos); |
| 1727 |
ascii().addNote(f.str().c_str()); |
| 1728 |
|
| 1729 |
long endPos=pos+16+header.m_dataSize; |
| 1730 |
while (input->tell()<endPos) { |
| 1731 |
pos=input->tell(); |
| 1732 |
auto cType=int(input->readULong(2)); |
| 1733 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1734 |
|
| 1735 |
bool done=false; |
| 1736 |
switch (cType) { |
| 1737 |
default: |
| 1738 |
done=readZone(level+1,endPos); |
| 1739 |
if (done) { |
| 1740 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSoundCollection: find unexpected zone %d\n", cType)); |
| 1741 |
} |
| 1742 |
break; |
| 1743 |
} |
| 1744 |
if (done) continue; |
| 1745 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSoundCollection: can not read some data\n")); |
| 1746 |
ascii().addPos(pos); |
| 1747 |
ascii().addNote("SoundCollection:###extra"); |
| 1748 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 1749 |
break; |
| 1750 |
} |
| 1751 |
return true; |
| 1752 |
} |
| 1753 |
|
| 1754 |
bool PowerPoint7Parser::readBookmarkSeedAtom(int level, long lastPos) |
| 1755 |
{ |
| 1756 |
MWAWInputStreamPtr input=getInput(); |
| 1757 |
long pos=input->tell(); |
| 1758 |
|
| 1759 |
libmwaw::DebugStream f; |
| 1760 |
PowerPoint7Struct::Zone header; |
| 1761 |
if (!header.read(input,lastPos) || header.m_type!=2025) { |
| 1762 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readBookmarkSeedAtom: can not find the zone header\n")); |
| 1763 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1764 |
return false; |
| 1765 |
} |
| 1766 |
f << "Entries(BookmarkSeedAtom)[" << level << "]:" << header; |
| 1767 |
if (header.m_dataSize!=4) { |
| 1768 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readBookmarkSeedAtom: find unexpected data size\n")); |
| 1769 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 1770 |
if (header.m_dataSize) |
| 1771 |
ascii().addDelimiter(pos+16,'|'); |
| 1772 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 1773 |
} |
| 1774 |
else { |
| 1775 |
for (int i=0; i<2; ++i) { // f0=1 |
| 1776 |
auto val=int(input->readULong(2)); |
| 1777 |
if (val) f << "f" << i << "=" << val << ","; |
| 1778 |
} |
| 1779 |
} |
| 1780 |
ascii().addPos(pos); |
| 1781 |
ascii().addNote(f.str().c_str()); |
| 1782 |
return true; |
| 1783 |
} |
| 1784 |
|
| 1785 |
bool PowerPoint7Parser::readZone2026(int level, long lastPos) |
| 1786 |
{ |
| 1787 |
MWAWInputStreamPtr input=getInput(); |
| 1788 |
long pos=input->tell(); |
| 1789 |
|
| 1790 |
libmwaw::DebugStream f; |
| 1791 |
PowerPoint7Struct::Zone header; |
| 1792 |
if (!header.read(input,lastPos) || header.m_type!=2026) { |
| 1793 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone2026: can not find the zone header\n")); |
| 1794 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1795 |
return false; |
| 1796 |
} |
| 1797 |
f << "Entries(Zone2026B)[" << level << "]:" << header; |
| 1798 |
ascii().addPos(pos); |
| 1799 |
ascii().addNote(f.str().c_str()); |
| 1800 |
|
| 1801 |
long endPos=pos+16+header.m_dataSize; |
| 1802 |
while (input->tell()<endPos) { |
| 1803 |
pos=input->tell(); |
| 1804 |
auto cType=int(input->readULong(2)); |
| 1805 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1806 |
|
| 1807 |
bool done=false; |
| 1808 |
switch (cType) { |
| 1809 |
case 1019: |
| 1810 |
done=readGuideAtom(level+1,endPos); |
| 1811 |
break; |
| 1812 |
default: |
| 1813 |
done=readZone(level+1,endPos); |
| 1814 |
if (done) { |
| 1815 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone2026: find unexpected zone %d\n", cType)); |
| 1816 |
} |
| 1817 |
break; |
| 1818 |
} |
| 1819 |
if (done) continue; |
| 1820 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone2026: can not read some data\n")); |
| 1821 |
ascii().addPos(pos); |
| 1822 |
ascii().addNote("Zone2026B:###extra"); |
| 1823 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 1824 |
break; |
| 1825 |
} |
| 1826 |
return true; |
| 1827 |
} |
| 1828 |
|
| 1829 |
bool PowerPoint7Parser::readColorList(int level, long lastPos, std::vector<MWAWColor> &colors) |
| 1830 |
{ |
| 1831 |
colors.resize(0); |
| 1832 |
|
| 1833 |
MWAWInputStreamPtr input=getInput(); |
| 1834 |
long pos=input->tell(); |
| 1835 |
|
| 1836 |
libmwaw::DebugStream f; |
| 1837 |
PowerPoint7Struct::Zone header; |
| 1838 |
if (!header.read(input,lastPos) || header.m_type!=2031) { |
| 1839 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readColorList: can not find the zone header\n")); |
| 1840 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1841 |
return false; |
| 1842 |
} |
| 1843 |
long endPos=pos+16+header.m_dataSize; |
| 1844 |
f << "Entries(ColorList)[" << level << "]:" << header; |
| 1845 |
bool ok=true; |
| 1846 |
if (header.m_dataSize<4 || (header.m_dataSize%4)!=0) { |
| 1847 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readColorList: find unexpected data size\n")); |
| 1848 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 1849 |
ok=false; |
| 1850 |
} |
| 1851 |
int N=ok? int(input->readULong(4)) : 0; |
| 1852 |
if (ok && header.m_dataSize/4-1!=N) { |
| 1853 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readColorList: the number of colors seems bad\n")); |
| 1854 |
f << "###N=" << N << ","; |
| 1855 |
N=0; |
| 1856 |
} |
| 1857 |
f << "colors=["; |
| 1858 |
colors.resize(size_t(N)); |
| 1859 |
for (auto &color : colors) { |
| 1860 |
unsigned char col[4]; |
| 1861 |
for (auto &c : col) c=static_cast<unsigned char>(input->readULong(1)); |
| 1862 |
color=MWAWColor(col[0],col[1],col[2]); |
| 1863 |
f << color << ","; |
| 1864 |
} |
| 1865 |
f << "],"; |
| 1866 |
if (input->tell()!=endPos) { |
| 1867 |
ascii().addDelimiter(pos+16,'|'); |
| 1868 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 1869 |
} |
| 1870 |
ascii().addPos(pos); |
| 1871 |
ascii().addNote(f.str().c_str()); |
| 1872 |
return true; |
| 1873 |
} |
| 1874 |
|
| 1875 |
bool PowerPoint7Parser::readZone3000(int level, long lastPos) |
| 1876 |
{ |
| 1877 |
MWAWInputStreamPtr input=getInput(); |
| 1878 |
long pos=input->tell(); |
| 1879 |
|
| 1880 |
libmwaw::DebugStream f; |
| 1881 |
PowerPoint7Struct::Zone header; |
| 1882 |
if (!header.read(input,lastPos) || header.m_type!=3000) { |
| 1883 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone3000: can not find the zone header\n")); |
| 1884 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1885 |
return false; |
| 1886 |
} |
| 1887 |
f << "Entries(Zone3000B)[" << level << "]:" << header; |
| 1888 |
ascii().addPos(pos); |
| 1889 |
ascii().addNote(f.str().c_str()); |
| 1890 |
|
| 1891 |
long endPos=pos+16+header.m_dataSize; |
| 1892 |
while (input->tell()<endPos) { |
| 1893 |
pos=input->tell(); |
| 1894 |
auto cType=int(input->readULong(2)); |
| 1895 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1896 |
|
| 1897 |
bool done=false; |
| 1898 |
switch (cType) { |
| 1899 |
case 3001: |
| 1900 |
done=m_state->m_graphParser->readGroup(level+1,endPos); |
| 1901 |
break; |
| 1902 |
case 3008: |
| 1903 |
done=m_state->m_graphParser->readRect(level+1,endPos); |
| 1904 |
break; |
| 1905 |
case 3010: |
| 1906 |
done=m_state->m_graphParser->readPlaceholderContainer(level+1,endPos); |
| 1907 |
break; |
| 1908 |
case 3014: |
| 1909 |
done=m_state->m_graphParser->readLine(level+1,endPos); |
| 1910 |
break; |
| 1911 |
case 3016: |
| 1912 |
done=m_state->m_graphParser->readPolygon(level+1,endPos); |
| 1913 |
break; |
| 1914 |
case 3018: |
| 1915 |
done=m_state->m_graphParser->readArc(level+1,endPos); |
| 1916 |
break; |
| 1917 |
default: |
| 1918 |
done=readZone(level+1,endPos); |
| 1919 |
if (done) { |
| 1920 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone3000: find unexpected zone %d\n", cType)); |
| 1921 |
} |
| 1922 |
break; |
| 1923 |
} |
| 1924 |
if (done) continue; |
| 1925 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone3000: can not read some data\n")); |
| 1926 |
ascii().addPos(pos); |
| 1927 |
ascii().addNote("Zone3000B:###extra"); |
| 1928 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 1929 |
break; |
| 1930 |
} |
| 1931 |
return true; |
| 1932 |
} |
| 1933 |
|
| 1934 |
bool PowerPoint7Parser::readZone3012(int level, long lastPos) |
| 1935 |
{ |
| 1936 |
// one by file: maybe a default frame? |
| 1937 |
MWAWInputStreamPtr input=getInput(); |
| 1938 |
long pos=input->tell(); |
| 1939 |
|
| 1940 |
libmwaw::DebugStream f; |
| 1941 |
PowerPoint7Struct::Zone header; |
| 1942 |
if (!header.read(input,lastPos) || header.m_type!=3012) { |
| 1943 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone3012: can not find the zone header\n")); |
| 1944 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1945 |
return false; |
| 1946 |
} |
| 1947 |
f << "Entries(Zone3012B)[" << level << "]:" << header; |
| 1948 |
ascii().addPos(pos); |
| 1949 |
ascii().addNote(f.str().c_str()); |
| 1950 |
|
| 1951 |
long endPos=pos+16+header.m_dataSize; |
| 1952 |
while (input->tell()<endPos) { |
| 1953 |
pos=input->tell(); |
| 1954 |
auto cType=int(input->readULong(2)); |
| 1955 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 1956 |
|
| 1957 |
bool done=false; |
| 1958 |
switch (cType) { |
| 1959 |
case 3005: |
| 1960 |
done=m_state->m_graphParser->readStyle(level+1,endPos); |
| 1961 |
break; |
| 1962 |
case 3009: |
| 1963 |
done=m_state->m_graphParser->readRectAtom(level+1,endPos); |
| 1964 |
break; |
| 1965 |
case 3013: |
| 1966 |
done=readZone3012Atom(level+1,endPos); |
| 1967 |
break; |
| 1968 |
case 4001: { |
| 1969 |
int tId=-1; |
| 1970 |
done=readStyleTextPropAtom(level+1,endPos,tId); |
| 1971 |
break; |
| 1972 |
} |
| 1973 |
default: |
| 1974 |
done=readZone(level+1,endPos); |
| 1975 |
if (done) { |
| 1976 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone3012: find unexpected zone %d\n", cType)); |
| 1977 |
} |
| 1978 |
break; |
| 1979 |
} |
| 1980 |
if (done) continue; |
| 1981 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone3012: can not read some data\n")); |
| 1982 |
ascii().addPos(pos); |
| 1983 |
ascii().addNote("Zone3012B:###extra"); |
| 1984 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 1985 |
break; |
| 1986 |
} |
| 1987 |
return true; |
| 1988 |
} |
| 1989 |
|
| 1990 |
bool PowerPoint7Parser::readZone3012Atom(int level, long lastPos) |
| 1991 |
{ |
| 1992 |
MWAWInputStreamPtr input=getInput(); |
| 1993 |
long pos=input->tell(); |
| 1994 |
|
| 1995 |
libmwaw::DebugStream f; |
| 1996 |
PowerPoint7Struct::Zone header; |
| 1997 |
if (!header.read(input,lastPos) || header.m_type!=3013) { |
| 1998 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone3012Atom: can not find the zone header\n")); |
| 1999 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2000 |
return false; |
| 2001 |
} |
| 2002 |
f << "Entries(Zone3012B)[atom," << level << "]:" << header; |
| 2003 |
if (header.m_dataSize!=2) { |
| 2004 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone3012Atom: find unexpected data size\n")); |
| 2005 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 2006 |
if (header.m_dataSize) |
| 2007 |
ascii().addDelimiter(pos+16,'|'); |
| 2008 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 2009 |
} |
| 2010 |
else { |
| 2011 |
auto val=int(input->readULong(2)); // 0 |
| 2012 |
if (val) |
| 2013 |
f << "f0=" << val << ","; |
| 2014 |
} |
| 2015 |
ascii().addPos(pos); |
| 2016 |
ascii().addNote(f.str().c_str()); |
| 2017 |
return true; |
| 2018 |
} |
| 2019 |
|
| 2020 |
bool PowerPoint7Parser::readTextCharsAtom(int level, long lastPos) |
| 2021 |
{ |
| 2022 |
MWAWInputStreamPtr input=getInput(); |
| 2023 |
long pos=input->tell(); |
| 2024 |
|
| 2025 |
libmwaw::DebugStream f; |
| 2026 |
PowerPoint7Struct::Zone header; |
| 2027 |
if (!header.read(input,lastPos) || header.m_type!=4000) { |
| 2028 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readTextCharsAtom: can not find the zone header\n")); |
| 2029 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2030 |
return false; |
| 2031 |
} |
| 2032 |
f << "Entries(TextCharsAtom)[" << level << "]:" << header; |
| 2033 |
if (header.m_dataSize!=16) { |
| 2034 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readTextCharsAtom: find unexpected data size\n")); |
| 2035 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 2036 |
if (header.m_dataSize) |
| 2037 |
ascii().addDelimiter(pos+16,'|'); |
| 2038 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 2039 |
} |
| 2040 |
else { |
| 2041 |
for (int i=0; i<2; ++i) { // the text anchor dimension |
| 2042 |
unsigned long val=input->readULong(4); |
| 2043 |
if (!val) continue; |
| 2044 |
f << "anchor" << (i==0 ? "LR" : "BT") << "=" << float(val)/8.f << "pt,"; |
| 2045 |
} |
| 2046 |
auto val=int(input->readULong(1)); |
| 2047 |
if (val&1) f << "adjust[text],"; |
| 2048 |
if (val&4) f << "wrap[word],"; |
| 2049 |
val&=0xfa; |
| 2050 |
if (val!=0xc0) |
| 2051 |
f << "fl0=" << std::hex << val << std::dec << ","; |
| 2052 |
for (int i=0; i<7; ++i) { |
| 2053 |
val=int(input->readULong(1)); |
| 2054 |
int const expected[]= {0x6e,7,0x50,3,0xe0,0x62,0}; |
| 2055 |
if (val==expected[i]) |
| 2056 |
continue; |
| 2057 |
if (i==3) { |
| 2058 |
f << "v[align]=" << (val>>4) << ","; // 1: center, 2:top |
| 2059 |
f << "h[align]=" << (val&0xf) << ","; // 1: center, 3:left? |
| 2060 |
} |
| 2061 |
else |
| 2062 |
f << "fl" << i+1 << "=" << std::hex << val << std::dec << ","; |
| 2063 |
} |
| 2064 |
} |
| 2065 |
ascii().addPos(pos); |
| 2066 |
ascii().addNote(f.str().c_str()); |
| 2067 |
return true; |
| 2068 |
} |
| 2069 |
|
| 2070 |
bool PowerPoint7Parser::readStyleTextPropAtom(int level, long lastPos, int &tId) |
| 2071 |
{ |
| 2072 |
tId=-1; |
| 2073 |
MWAWInputStreamPtr input=getInput(); |
| 2074 |
long pos=input->tell(); |
| 2075 |
|
| 2076 |
libmwaw::DebugStream f; |
| 2077 |
PowerPoint7Struct::Zone header; |
| 2078 |
if (!header.read(input,lastPos) || header.m_type!=4001) { |
| 2079 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readStyleTextPropAtom: can not find the zone header\n")); |
| 2080 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2081 |
return false; |
| 2082 |
} |
| 2083 |
f << "Entries(StyleTextPropAtom)[" << level << "]:" << header; |
| 2084 |
ascii().addPos(pos); |
| 2085 |
ascii().addNote(f.str().c_str()); |
| 2086 |
|
| 2087 |
long endPos=pos+16+header.m_dataSize; |
| 2088 |
while (input->tell()<endPos) { |
| 2089 |
pos=input->tell(); |
| 2090 |
auto cType=int(input->readULong(2)); |
| 2091 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2092 |
|
| 2093 |
bool done=false; |
| 2094 |
switch (cType) { |
| 2095 |
case 4000: |
| 2096 |
done=readTextCharsAtom(level+1,endPos); |
| 2097 |
break; |
| 2098 |
case 4002: |
| 2099 |
if (tId!=-1) { |
| 2100 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readStyleTextPropAtom: find duplicated text zone\n")); |
| 2101 |
} |
| 2102 |
done=m_state->m_textParser->readTextMasterProp(level+1,endPos,tId); |
| 2103 |
break; |
| 2104 |
case 4068: |
| 2105 |
if (tId!=-1) { |
| 2106 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readStyleTextPropAtom: find duplicated text zone\n")); |
| 2107 |
} |
| 2108 |
done=m_state->m_textParser->readExternalHyperlink9(level+1,endPos,tId); |
| 2109 |
break; |
| 2110 |
default: |
| 2111 |
done=readZone(level+1,endPos); |
| 2112 |
if (done) { |
| 2113 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readStyleTextPropAtom: find unexpected zone %d\n", cType)); |
| 2114 |
} |
| 2115 |
break; |
| 2116 |
} |
| 2117 |
if (done) continue; |
| 2118 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readStyleTextPropAtom: can not read some data\n")); |
| 2119 |
ascii().addPos(pos); |
| 2120 |
ascii().addNote("StyleTextPropAtom:###extra"); |
| 2121 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 2122 |
break; |
| 2123 |
} |
| 2124 |
return true; |
| 2125 |
} |
| 2126 |
|
| 2127 |
bool PowerPoint7Parser::readOutlineTextProps9Atom(int level, long lastPos, int &id, PowerPoint7Struct::SlideId &sId) |
| 2128 |
{ |
| 2129 |
id=-1; |
| 2130 |
sId=PowerPoint7Struct::SlideId(); |
| 2131 |
MWAWInputStreamPtr input=getInput(); |
| 2132 |
long pos=input->tell(); |
| 2133 |
|
| 2134 |
libmwaw::DebugStream f; |
| 2135 |
PowerPoint7Struct::Zone header; |
| 2136 |
if (!header.read(input,lastPos) || header.m_type!=4014) { |
| 2137 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readOutlineTextProps9Atom: can not find the zone header\n")); |
| 2138 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2139 |
return false; |
| 2140 |
} |
| 2141 |
f << "Entries(OutlineTextProps9)[" << level << "]:" << header; |
| 2142 |
ascii().addPos(pos); |
| 2143 |
ascii().addNote(f.str().c_str()); |
| 2144 |
|
| 2145 |
long endPos=pos+16+header.m_dataSize; |
| 2146 |
while (input->tell()<endPos) { |
| 2147 |
pos=input->tell(); |
| 2148 |
auto cType=int(input->readULong(2)); |
| 2149 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2150 |
|
| 2151 |
bool done=false; |
| 2152 |
switch (cType) { |
| 2153 |
case 4015: |
| 2154 |
done=readOutlineTextPropsHeader9Atom(level+1,endPos); |
| 2155 |
break; |
| 2156 |
case 4044: { |
| 2157 |
int pId; |
| 2158 |
done=m_state->m_graphParser->readExternalOleEmbed(level+1,endPos,pId); |
| 2159 |
if (done && pId!=-1 && id==-1) id=pId; |
| 2160 |
break; |
| 2161 |
} |
| 2162 |
case 4053: { |
| 2163 |
int pId; |
| 2164 |
done=m_state->m_graphParser->readPictureIdContainer(level+1,endPos,pId); |
| 2165 |
if (done && pId!=-1) id=pId; |
| 2166 |
break; |
| 2167 |
} |
| 2168 |
case 4054: |
| 2169 |
done=readSlideIdentifierContainer(level+1,endPos,sId); |
| 2170 |
break; |
| 2171 |
default: |
| 2172 |
done=readZone(level+1,endPos); |
| 2173 |
if (done) { |
| 2174 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readOutlineTextProps9Atom: find unexpected zone %d\n", cType)); |
| 2175 |
} |
| 2176 |
break; |
| 2177 |
} |
| 2178 |
if (done) continue; |
| 2179 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readOutlineTextProps9Atom: can not read some data\n")); |
| 2180 |
ascii().addPos(pos); |
| 2181 |
ascii().addNote("OutlineTextProps9:###extra"); |
| 2182 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 2183 |
break; |
| 2184 |
} |
| 2185 |
if (id==-1 && !sId.isValid()) { |
| 2186 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readOutlineTextProps9Atom: does not find any data\n")); |
| 2187 |
} |
| 2188 |
return true; |
| 2189 |
} |
| 2190 |
|
| 2191 |
bool PowerPoint7Parser::readOutlineTextPropsHeader9Atom(int level, long lastPos) |
| 2192 |
{ |
| 2193 |
MWAWInputStreamPtr input=getInput(); |
| 2194 |
long pos=input->tell(); |
| 2195 |
|
| 2196 |
libmwaw::DebugStream f; |
| 2197 |
PowerPoint7Struct::Zone header; |
| 2198 |
if (!header.read(input,lastPos) || header.m_type!=4015) { |
| 2199 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readOutlineTextPropsHeader9Atom: can not find the zone header\n")); |
| 2200 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2201 |
return false; |
| 2202 |
} |
| 2203 |
f << "Entries(OutlineTextProps9)[header," << level << "]:" << header; |
| 2204 |
if (header.m_dataSize!=16) { |
| 2205 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readOutlineTextPropsHeader9Atom: find unexpected data size\n")); |
| 2206 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 2207 |
if (header.m_dataSize) |
| 2208 |
ascii().addDelimiter(pos+16,'|'); |
| 2209 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 2210 |
} |
| 2211 |
else { |
| 2212 |
for (int i=0; i<8; ++i) { // 0 |
| 2213 |
auto val=int(input->readULong(2)); |
| 2214 |
if (val) f << "f" << i << "=" << val << ","; |
| 2215 |
} |
| 2216 |
} |
| 2217 |
ascii().addPos(pos); |
| 2218 |
ascii().addNote(f.str().c_str()); |
| 2219 |
return true; |
| 2220 |
} |
| 2221 |
|
| 2222 |
bool PowerPoint7Parser::readString(int level, long lastPos, std::string &text, int &zId, std::string const &what) |
| 2223 |
{ |
| 2224 |
text=""; |
| 2225 |
MWAWInputStreamPtr input=getInput(); |
| 2226 |
long pos=input->tell(); |
| 2227 |
|
| 2228 |
libmwaw::DebugStream f; |
| 2229 |
PowerPoint7Struct::Zone header; |
| 2230 |
if (!header.read(input,lastPos) || header.m_type!=4026) { |
| 2231 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readString: can not find the zone header\n")); |
| 2232 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2233 |
return false; |
| 2234 |
} |
| 2235 |
zId=header.m_values[3]; |
| 2236 |
if (!what.empty()) |
| 2237 |
f << "Entries(" << what << ")[string," << level << "]:" << header; |
| 2238 |
else |
| 2239 |
f << "Entries(CString)[" << level << "]:" << header; |
| 2240 |
for (long i=0; i<header.m_dataSize; ++i) text+=char(input->readULong(1)); |
| 2241 |
f << text << ","; |
| 2242 |
ascii().addPos(pos); |
| 2243 |
ascii().addNote(f.str().c_str()); |
| 2244 |
return true; |
| 2245 |
} |
| 2246 |
|
| 2247 |
bool PowerPoint7Parser::readSlideIdentifier(int level, long lastPos, PowerPoint7Struct::SlideId &sId) |
| 2248 |
{ |
| 2249 |
sId=PowerPoint7Struct::SlideId(); |
| 2250 |
MWAWInputStreamPtr input=getInput(); |
| 2251 |
long pos=input->tell(); |
| 2252 |
|
| 2253 |
libmwaw::DebugStream f; |
| 2254 |
PowerPoint7Struct::Zone header; |
| 2255 |
if (!header.read(input,lastPos) || header.m_type!=4032) { |
| 2256 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlideIdentifier: can not find the zone header\n")); |
| 2257 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2258 |
return false; |
| 2259 |
} |
| 2260 |
f << "Entries(SlideId)[" << level << "]:" << header; |
| 2261 |
if (header.m_dataSize!=4) { |
| 2262 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlideIdentifier: find unexpected data size\n")); |
| 2263 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 2264 |
if (header.m_dataSize) |
| 2265 |
ascii().addDelimiter(pos+16,'|'); |
| 2266 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 2267 |
} |
| 2268 |
else { |
| 2269 |
sId=PowerPoint7Struct::SlideId(input->readULong(4)); |
| 2270 |
if (sId.isValid()) |
| 2271 |
f << sId << ","; |
| 2272 |
} |
| 2273 |
ascii().addPos(pos); |
| 2274 |
ascii().addNote(f.str().c_str()); |
| 2275 |
return true; |
| 2276 |
} |
| 2277 |
|
| 2278 |
bool PowerPoint7Parser::readKinsoku(int level, long lastPos) |
| 2279 |
{ |
| 2280 |
MWAWInputStreamPtr input=getInput(); |
| 2281 |
long pos=input->tell(); |
| 2282 |
|
| 2283 |
libmwaw::DebugStream f; |
| 2284 |
PowerPoint7Struct::Zone header; |
| 2285 |
if (!header.read(input,lastPos) || header.m_type!=4040) { |
| 2286 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readKinsoku: can not find the zone header\n")); |
| 2287 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2288 |
return false; |
| 2289 |
} |
| 2290 |
f << "Entries(Kinsoku)[" << level << "]:" << header; |
| 2291 |
ascii().addPos(pos); |
| 2292 |
ascii().addNote(f.str().c_str()); |
| 2293 |
|
| 2294 |
long endPos=pos+16+header.m_dataSize; |
| 2295 |
while (input->tell()<endPos) { |
| 2296 |
pos=input->tell(); |
| 2297 |
auto cType=int(input->readULong(2)); |
| 2298 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2299 |
|
| 2300 |
bool done=false; |
| 2301 |
switch (cType) { |
| 2302 |
case 4026: { |
| 2303 |
std::string string; |
| 2304 |
int zId; // 4:"", 5:"" |
| 2305 |
done=readString(level+1,endPos,string,zId,"Kinsoku"); |
| 2306 |
break; |
| 2307 |
} |
| 2308 |
case 4050: |
| 2309 |
done=readKinsokuAtom(level+1,endPos); |
| 2310 |
break; |
| 2311 |
default: |
| 2312 |
done=readZone(level+1,endPos); |
| 2313 |
if (done) { |
| 2314 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readKinsoku: find unexpected zone %d\n", cType)); |
| 2315 |
} |
| 2316 |
break; |
| 2317 |
} |
| 2318 |
if (done) continue; |
| 2319 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readKinsoku: can not read some data\n")); |
| 2320 |
ascii().addPos(pos); |
| 2321 |
ascii().addNote("Kinsoku:###extra"); |
| 2322 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 2323 |
break; |
| 2324 |
} |
| 2325 |
return true; |
| 2326 |
} |
| 2327 |
|
| 2328 |
bool PowerPoint7Parser::readZone4039(int level, long lastPos) |
| 2329 |
{ |
| 2330 |
MWAWInputStreamPtr input=getInput(); |
| 2331 |
long pos=input->tell(); |
| 2332 |
|
| 2333 |
libmwaw::DebugStream f; |
| 2334 |
PowerPoint7Struct::Zone header; |
| 2335 |
if (!header.read(input,lastPos) || header.m_type!=4039) { |
| 2336 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone4039: can not find the zone header\n")); |
| 2337 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2338 |
return false; |
| 2339 |
} |
| 2340 |
f << "Entries(Zone4039B)[" << level << "]:" << header; |
| 2341 |
if (header.m_dataSize!=0x20) { |
| 2342 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone4039: find unexpected data size\n")); |
| 2343 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 2344 |
if (header.m_dataSize) |
| 2345 |
ascii().addDelimiter(pos+16,'|'); |
| 2346 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 2347 |
ascii().addPos(pos); |
| 2348 |
ascii().addNote(f.str().c_str()); |
| 2349 |
return true; |
| 2350 |
} |
| 2351 |
|
| 2352 |
for (int i=0; i<16; ++i) { // f0=1010,f1=6,f14=f15=-1 |
| 2353 |
auto val=int(input->readLong(2)); |
| 2354 |
if (val) f << "f" << i << "=" << val << ","; |
| 2355 |
} |
| 2356 |
input->seek(pos+16+header.m_dataSize, librevenge::RVNG_SEEK_SET); |
| 2357 |
ascii().addPos(pos); |
| 2358 |
ascii().addNote(f.str().c_str()); |
| 2359 |
|
| 2360 |
return true; |
| 2361 |
} |
| 2362 |
|
| 2363 |
bool PowerPoint7Parser::readHandout(int level, long lastPos) |
| 2364 |
{ |
| 2365 |
MWAWInputStreamPtr input=getInput(); |
| 2366 |
long pos=input->tell(); |
| 2367 |
|
| 2368 |
libmwaw::DebugStream f; |
| 2369 |
PowerPoint7Struct::Zone header; |
| 2370 |
if (!header.read(input,lastPos) || header.m_type!=4041) { |
| 2371 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readHandout: can not find the zone header\n")); |
| 2372 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2373 |
return false; |
| 2374 |
} |
| 2375 |
f << "Entries(HandoutList)[" << level << "]:" << header; |
| 2376 |
ascii().addPos(pos); |
| 2377 |
ascii().addNote(f.str().c_str()); |
| 2378 |
|
| 2379 |
PowerPoint7Struct::SlideId hId; |
| 2380 |
hId.m_inHandout=true; |
| 2381 |
m_state->pushSlideId(hId); |
| 2382 |
long endPos=pos+16+header.m_dataSize; |
| 2383 |
bool pushColor=false; |
| 2384 |
while (input->tell()<endPos) { |
| 2385 |
pos=input->tell(); |
| 2386 |
auto cType=int(input->readULong(2)); |
| 2387 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2388 |
|
| 2389 |
bool done=false; |
| 2390 |
switch (cType) { |
| 2391 |
case 1005: |
| 2392 |
done=readSlideInformation(level+1,endPos); |
| 2393 |
break; |
| 2394 |
case 1012: { |
| 2395 |
std::vector<MWAWColor> colors; |
| 2396 |
done=readColorScheme(level+1,endPos,colors); |
| 2397 |
if (done && !pushColor) { |
| 2398 |
pushColor=true; |
| 2399 |
m_state->pushColorList(colors); |
| 2400 |
} |
| 2401 |
break; |
| 2402 |
} |
| 2403 |
case 3000: |
| 2404 |
done=readZone3000(level+1,endPos); |
| 2405 |
break; |
| 2406 |
case 3008: |
| 2407 |
done=m_state->m_graphParser->readRect(level+1,endPos); |
| 2408 |
break; |
| 2409 |
case 4057: |
| 2410 |
done=readHeaderFooters(level+1,endPos); |
| 2411 |
break; |
| 2412 |
default: |
| 2413 |
done=readZone(level+1,endPos); |
| 2414 |
if (done) { |
| 2415 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readHandout: find unexpected zone %d\n", cType)); |
| 2416 |
} |
| 2417 |
break; |
| 2418 |
} |
| 2419 |
if (done) continue; |
| 2420 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readHandout: can not read some data\n")); |
| 2421 |
ascii().addPos(pos); |
| 2422 |
ascii().addNote("HandoutList:###extra"); |
| 2423 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 2424 |
break; |
| 2425 |
} |
| 2426 |
if (pushColor) |
| 2427 |
m_state->popColorList(); |
| 2428 |
m_state->popSlideId(); |
| 2429 |
return true; |
| 2430 |
} |
| 2431 |
|
| 2432 |
bool PowerPoint7Parser::readKinsokuAtom(int level, long lastPos) |
| 2433 |
{ |
| 2434 |
MWAWInputStreamPtr input=getInput(); |
| 2435 |
long pos=input->tell(); |
| 2436 |
|
| 2437 |
libmwaw::DebugStream f; |
| 2438 |
PowerPoint7Struct::Zone header; |
| 2439 |
if (!header.read(input,lastPos) || header.m_type!=4050) { |
| 2440 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readKinsokuAtom: can not find the zone header\n")); |
| 2441 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2442 |
return false; |
| 2443 |
} |
| 2444 |
f << "Entries(Kinsoku)[atom," << level << "]:" << header; |
| 2445 |
if (header.m_dataSize!=4) { |
| 2446 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readKinsokuAtom: find unexpected data size\n")); |
| 2447 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 2448 |
if (header.m_dataSize) |
| 2449 |
ascii().addDelimiter(pos+16,'|'); |
| 2450 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 2451 |
} |
| 2452 |
else { // 0,10000,cdcdcdcd |
| 2453 |
f << "f0=" << std::hex << input->readULong(4) << std::dec << ","; |
| 2454 |
} |
| 2455 |
ascii().addPos(pos); |
| 2456 |
ascii().addNote(f.str().c_str()); |
| 2457 |
return true; |
| 2458 |
} |
| 2459 |
|
| 2460 |
bool PowerPoint7Parser::readZone1028Data(int level, long lastPos) |
| 2461 |
{ |
| 2462 |
MWAWInputStreamPtr input=getInput(); |
| 2463 |
long pos=input->tell(); |
| 2464 |
|
| 2465 |
libmwaw::DebugStream f; |
| 2466 |
PowerPoint7Struct::Zone header; |
| 2467 |
if (!header.read(input,lastPos) || header.m_type!=4052) { |
| 2468 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone1028Data: can not find the zone header\n")); |
| 2469 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2470 |
return false; |
| 2471 |
} |
| 2472 |
f << "Entries(Zone1028B)[data," << level << "]:" << header; |
| 2473 |
if (header.m_dataSize!=0x1d8) { |
| 2474 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone1028Data: find unexpected data size\n")); |
| 2475 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 2476 |
if (header.m_dataSize) |
| 2477 |
ascii().addDelimiter(pos+16,'|'); |
| 2478 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 2479 |
ascii().addPos(pos); |
| 2480 |
ascii().addNote(f.str().c_str()); |
| 2481 |
return true; |
| 2482 |
} |
| 2483 |
ascii().addDelimiter(input->tell(),'|'); |
| 2484 |
input->seek(pos+16+8, librevenge::RVNG_SEEK_SET); |
| 2485 |
ascii().addPos(pos); |
| 2486 |
ascii().addNote(f.str().c_str()); |
| 2487 |
for (int i=0; i<12; ++i) { |
| 2488 |
// A0-A4 is probably related to font, A6-A11 is probably related to ruler |
| 2489 |
pos=input->tell(); |
| 2490 |
int const dSz=i<5 ? 24 : i==5 ? 32 : 52; |
| 2491 |
f.str(""); |
| 2492 |
f << "Zone1028B-A" << i << ":"; |
| 2493 |
ascii().addPos(pos); |
| 2494 |
ascii().addNote(f.str().c_str()); |
| 2495 |
input->seek(pos+dSz, librevenge::RVNG_SEEK_SET); |
| 2496 |
} |
| 2497 |
return true; |
| 2498 |
} |
| 2499 |
|
| 2500 |
bool PowerPoint7Parser::readSlideIdentifierContainer(int level, long lastPos, PowerPoint7Struct::SlideId &sId) |
| 2501 |
{ |
| 2502 |
MWAWInputStreamPtr input=getInput(); |
| 2503 |
long pos=input->tell(); |
| 2504 |
|
| 2505 |
libmwaw::DebugStream f; |
| 2506 |
PowerPoint7Struct::Zone header; |
| 2507 |
if (!header.read(input,lastPos) || header.m_type!=4054) { |
| 2508 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlideIdentifierContainer: can not find the zone header\n")); |
| 2509 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2510 |
return false; |
| 2511 |
} |
| 2512 |
f << "Entries(SlideId)[container," << level << "]:" << header; |
| 2513 |
ascii().addPos(pos); |
| 2514 |
ascii().addNote(f.str().c_str()); |
| 2515 |
|
| 2516 |
long endPos=pos+16+header.m_dataSize; |
| 2517 |
while (input->tell()<endPos) { |
| 2518 |
pos=input->tell(); |
| 2519 |
auto cType=int(input->readULong(2)); |
| 2520 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2521 |
|
| 2522 |
bool done=false; |
| 2523 |
switch (cType) { |
| 2524 |
case 4032: |
| 2525 |
done=readSlideIdentifier(level+1,endPos, sId); |
| 2526 |
break; |
| 2527 |
default: |
| 2528 |
done=readZone(level+1,endPos); |
| 2529 |
if (done) { |
| 2530 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlideIdentifierContainer: find unexpected zone %d\n", cType)); |
| 2531 |
} |
| 2532 |
break; |
| 2533 |
} |
| 2534 |
if (done) continue; |
| 2535 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readSlideIdentifierContainer: can not read some data\n")); |
| 2536 |
ascii().addPos(pos); |
| 2537 |
ascii().addNote("SlideId:###extra"); |
| 2538 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 2539 |
break; |
| 2540 |
} |
| 2541 |
return true; |
| 2542 |
} |
| 2543 |
|
| 2544 |
bool PowerPoint7Parser::readHeaderFooters(int level, long lastPos) |
| 2545 |
{ |
| 2546 |
MWAWInputStreamPtr input=getInput(); |
| 2547 |
long pos=input->tell(); |
| 2548 |
|
| 2549 |
libmwaw::DebugStream f; |
| 2550 |
PowerPoint7Struct::Zone header; |
| 2551 |
if (!header.read(input,lastPos) || header.m_type!=4057) { |
| 2552 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readHeaderFooters: can not find the zone header\n")); |
| 2553 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2554 |
return false; |
| 2555 |
} |
| 2556 |
f << "Entries(HF)[list," << level << "]:" << header; |
| 2557 |
ascii().addPos(pos); |
| 2558 |
ascii().addNote(f.str().c_str()); |
| 2559 |
|
| 2560 |
long endPos=pos+16+header.m_dataSize; |
| 2561 |
while (input->tell()<endPos) { |
| 2562 |
pos=input->tell(); |
| 2563 |
auto cType=int(input->readULong(2)); |
| 2564 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2565 |
|
| 2566 |
bool done=false; |
| 2567 |
switch (cType) { |
| 2568 |
case 4026: { |
| 2569 |
std::string string; |
| 2570 |
int zId; // 46:"", 47:"", 48:"" |
| 2571 |
done=readString(level+1,endPos,string,zId,"HF"); |
| 2572 |
break; |
| 2573 |
} |
| 2574 |
case 4058: |
| 2575 |
done=readHeaderFooterAtom(level+1,endPos); |
| 2576 |
break; |
| 2577 |
default: |
| 2578 |
done=readZone(level+1,endPos); |
| 2579 |
if (done) { |
| 2580 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readHeaderFooters: find unexpected zone %d\n", cType)); |
| 2581 |
} |
| 2582 |
break; |
| 2583 |
} |
| 2584 |
if (done) continue; |
| 2585 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readHeaderFooters: can not read some data\n")); |
| 2586 |
ascii().addPos(pos); |
| 2587 |
ascii().addNote("HF:###extra"); |
| 2588 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 2589 |
break; |
| 2590 |
} |
| 2591 |
return true; |
| 2592 |
} |
| 2593 |
|
| 2594 |
bool PowerPoint7Parser::readHeaderFooterAtom(int level, long lastPos) |
| 2595 |
{ |
| 2596 |
MWAWInputStreamPtr input=getInput(); |
| 2597 |
long pos=input->tell(); |
| 2598 |
|
| 2599 |
libmwaw::DebugStream f; |
| 2600 |
PowerPoint7Struct::Zone header; |
| 2601 |
if (!header.read(input,lastPos) || header.m_type!=4058) { |
| 2602 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readHeaderFooterAtom: can not find the zone header\n")); |
| 2603 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2604 |
return false; |
| 2605 |
} |
| 2606 |
f << "Entries(HF)[atom," << level << "]:" << header; |
| 2607 |
if (header.m_dataSize!=8) { |
| 2608 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readHeaderFooterAtom: find unexpected data size\n")); |
| 2609 |
f << "###dataSz=" << header.m_dataSize << ","; |
| 2610 |
if (header.m_dataSize) |
| 2611 |
ascii().addDelimiter(pos+16,'|'); |
| 2612 |
input->seek(header.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 2613 |
} |
| 2614 |
else { |
| 2615 |
f << "flags=["; |
| 2616 |
for (int i=0; i<8; ++i) { // list of 0 and 1 |
| 2617 |
auto val=int(input->readULong(1)); |
| 2618 |
if (val==1) |
| 2619 |
f << "*,"; |
| 2620 |
else if (val) |
| 2621 |
f << val << ","; |
| 2622 |
else |
| 2623 |
f << "_,"; |
| 2624 |
} |
| 2625 |
f << "],"; |
| 2626 |
} |
| 2627 |
ascii().addPos(pos); |
| 2628 |
ascii().addNote(f.str().c_str()); |
| 2629 |
return true; |
| 2630 |
} |
| 2631 |
|
| 2632 |
bool PowerPoint7Parser::readZone4072(int level, long lastPos) |
| 2633 |
{ |
| 2634 |
MWAWInputStreamPtr input=getInput(); |
| 2635 |
long pos=input->tell(); |
| 2636 |
|
| 2637 |
libmwaw::DebugStream f; |
| 2638 |
PowerPoint7Struct::Zone header; |
| 2639 |
if (!header.read(input,lastPos) || header.m_type!=4072) { |
| 2640 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone4072: can not find the zone header\n")); |
| 2641 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2642 |
return false; |
| 2643 |
} |
| 2644 |
f << "Entries(Zone4072B)[" << level << "]:" << header; |
| 2645 |
ascii().addPos(pos); |
| 2646 |
ascii().addNote(f.str().c_str()); |
| 2647 |
|
| 2648 |
long endPos=pos+16+header.m_dataSize; |
| 2649 |
while (input->tell()<endPos) { |
| 2650 |
pos=input->tell(); |
| 2651 |
auto cType=int(input->readULong(2)); |
| 2652 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2653 |
|
| 2654 |
bool done=false; |
| 2655 |
switch (cType) { |
| 2656 |
case 4026: { |
| 2657 |
std::string string; |
| 2658 |
int zId; // 160:"" |
| 2659 |
done=readString(level+1,endPos,string,zId,"Zone4072B"); |
| 2660 |
break; |
| 2661 |
} |
| 2662 |
case 4039: |
| 2663 |
done=readZone4039(level+1,endPos); |
| 2664 |
break; |
| 2665 |
default: |
| 2666 |
done=readZone(level+1,endPos); |
| 2667 |
if (done) { |
| 2668 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone4072: find unexpected zone %d\n", cType)); |
| 2669 |
} |
| 2670 |
break; |
| 2671 |
} |
| 2672 |
if (done) continue; |
| 2673 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone4072: can not read some data\n")); |
| 2674 |
ascii().addPos(pos); |
| 2675 |
ascii().addNote("Zone4072B:###extra"); |
| 2676 |
input->seek(endPos, librevenge::RVNG_SEEK_SET); |
| 2677 |
break; |
| 2678 |
} |
| 2679 |
return true; |
| 2680 |
} |
| 2681 |
|
| 2682 |
bool PowerPoint7Parser::readZoneNoData(int level, long endPos, std::string const &name, std::string const &wh) |
| 2683 |
{ |
| 2684 |
MWAWInputStreamPtr input=getInput(); |
| 2685 |
long pos=input->tell(); |
| 2686 |
long lastPos=endPos<0 ? input->size() : endPos; |
| 2687 |
if (pos+16>lastPos) |
| 2688 |
return false; |
| 2689 |
|
| 2690 |
PowerPoint7Struct::Zone header; |
| 2691 |
if (!header.read(input,lastPos)) { |
| 2692 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2693 |
return false; |
| 2694 |
} |
| 2695 |
libmwaw::DebugStream f; |
| 2696 |
if (!wh.empty()) |
| 2697 |
f << "Entries(" << name << ")[" << wh << "," << level << "]:" << header; |
| 2698 |
else |
| 2699 |
f << "Entries(" << name << ")[" << level << "]:" << header; |
| 2700 |
if (header.m_dataSize) { |
| 2701 |
f << "###dSz=" << header.m_dataSize << ","; |
| 2702 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZoneNoData: find unexpected data for zone %s\n", name.c_str())); |
| 2703 |
input->seek(pos+16+header.m_dataSize, librevenge::RVNG_SEEK_SET); |
| 2704 |
} |
| 2705 |
ascii().addPos(pos); |
| 2706 |
ascii().addNote(f.str().c_str()); |
| 2707 |
return true; |
| 2708 |
} |
| 2709 |
|
| 2710 |
bool PowerPoint7Parser::readZone(int level, long endPos) |
| 2711 |
{ |
| 2712 |
MWAWInputStreamPtr input=getInput(); |
| 2713 |
long pos=input->tell(); |
| 2714 |
long lastPos=endPos<0 ? input->size() : endPos; |
| 2715 |
if (pos+16>lastPos) |
| 2716 |
return false; |
| 2717 |
|
| 2718 |
PowerPoint7Struct::Zone header; |
| 2719 |
if (!header.read(input,lastPos)) { |
| 2720 |
input->seek(pos, librevenge::RVNG_SEEK_SET); |
| 2721 |
return false; |
| 2722 |
} |
| 2723 |
libmwaw::DebugStream f; |
| 2724 |
f << "Entries(" << header.getName() << ")[" << level << "]:" << header; |
| 2725 |
long lastDataPos=pos+16+header.m_dataSize; |
| 2726 |
bool isList=false; |
| 2727 |
if (header.m_dataSize>=16) { |
| 2728 |
// first check that we can read all data |
| 2729 |
isList=true; |
| 2730 |
while (input->tell()<lastDataPos) { |
| 2731 |
PowerPoint7Struct::Zone cHeader; |
| 2732 |
if (!cHeader.read(input, lastDataPos)) { |
| 2733 |
isList=false; |
| 2734 |
break; |
| 2735 |
} |
| 2736 |
input->seek(cHeader.m_dataSize, librevenge::RVNG_SEEK_CUR); |
| 2737 |
} |
| 2738 |
input->seek(pos+16, librevenge::RVNG_SEEK_SET); |
| 2739 |
if (isList) { |
| 2740 |
while (input->tell()<lastDataPos) { |
| 2741 |
long actPos=input->tell(); |
| 2742 |
if (readZone(level+1, lastDataPos)) |
| 2743 |
continue; |
| 2744 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::readZone: can not read some data\n")); |
| 2745 |
libmwaw::DebugStream f1; |
| 2746 |
f1 << header.getName() << ":###extra"; |
| 2747 |
ascii().addPos(actPos); |
| 2748 |
ascii().addNote(f1.str().c_str()); |
| 2749 |
break; |
| 2750 |
} |
| 2751 |
} |
| 2752 |
} |
| 2753 |
if (header.m_dataSize && !isList) |
| 2754 |
ascii().addDelimiter(input->tell(),'|'); |
| 2755 |
input->seek(lastDataPos, librevenge::RVNG_SEEK_SET); |
| 2756 |
ascii().addPos(pos); |
| 2757 |
ascii().addNote(f.str().c_str()); |
| 2758 |
return true; |
| 2759 |
} |
| 2760 |
|
| 2761 |
void PowerPoint7Parser::checkForUnparsedZones() |
| 2762 |
{ |
| 2763 |
// check if there remains some unparsed zone |
| 2764 |
} |
| 2765 |
|
| 2766 |
//////////////////////////////////////////////////////////// |
| 2767 |
// try to read the different zones |
| 2768 |
//////////////////////////////////////////////////////////// |
| 2769 |
bool PowerPoint7Parser::parseTextContent(MWAWInputStreamPtr input) |
| 2770 |
{ |
| 2771 |
if (!input) { |
| 2772 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::parseTextContent: can not find the input\n")); |
| 2773 |
return false; |
| 2774 |
} |
| 2775 |
libmwaw::DebugFile ascFile(input); |
| 2776 |
ascFile.open("Text_Content"); |
| 2777 |
libmwaw::DebugStream f; |
| 2778 |
f << "Entries(TextContent):"; |
| 2779 |
input->seek(0, librevenge::RVNG_SEEK_SET); |
| 2780 |
long pos=0; |
| 2781 |
while (!input->isEnd()) { |
| 2782 |
auto c=char(input->readULong(1)); |
| 2783 |
if (c==0) { |
| 2784 |
input->seek(-1, librevenge::RVNG_SEEK_CUR); |
| 2785 |
break; |
| 2786 |
} |
| 2787 |
f << c; |
| 2788 |
if (c==0xd) { |
| 2789 |
ascFile.addPos(pos); |
| 2790 |
ascFile.addNote(f.str().c_str()); |
| 2791 |
pos=input->tell(); |
| 2792 |
f.str(""); |
| 2793 |
f << "TextContent:"; |
| 2794 |
} |
| 2795 |
} |
| 2796 |
if (!input->isEnd()) { |
| 2797 |
ascFile.addPos(input->tell()); |
| 2798 |
ascFile.addNote("TextContent:#"); |
| 2799 |
} |
| 2800 |
return true; |
| 2801 |
} |
| 2802 |
|
| 2803 |
//////////////////////////////////////////////////////////// |
| 2804 |
// try to send data |
| 2805 |
//////////////////////////////////////////////////////////// |
| 2806 |
void PowerPoint7Parser::sendSlides() |
| 2807 |
{ |
| 2808 |
MWAWPresentationListenerPtr listener=getPresentationListener(); |
| 2809 |
if (!listener) { |
| 2810 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::sendSlides: can not find the listener\n")); |
| 2811 |
return; |
| 2812 |
} |
| 2813 |
for (auto const &mIt : m_state->m_masterSlideIdToNameMap) { |
| 2814 |
if (!mIt.first.isValid()) continue; |
| 2815 |
MWAWPageSpan ps(getPageSpan()); |
| 2816 |
ps.setMasterPageName(mIt.second); |
| 2817 |
if (!listener->openMasterPage(ps)) { |
| 2818 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::sendSlides: can not create the master page\n")); |
| 2819 |
} |
| 2820 |
else { |
| 2821 |
m_state->m_graphParser->sendSlide(mIt.first,true); |
| 2822 |
listener->closeMasterPage(); |
| 2823 |
} |
| 2824 |
} |
| 2825 |
bool firstSlideSent=false; |
| 2826 |
for (auto const &id : m_state->m_slideList) { |
| 2827 |
if (!id.isValid()) continue; |
| 2828 |
if (firstSlideSent) |
| 2829 |
listener->insertBreak(MWAWListener::PageBreak); |
| 2830 |
firstSlideSent=true; |
| 2831 |
bool sendBackground=false; |
| 2832 |
if (m_state->m_idToSlideInfoMap.find(id)!=m_state->m_idToSlideInfoMap.end()) |
| 2833 |
sendBackground=m_state->m_idToSlideInfoMap.find(id)->second.m_hasBackground; |
| 2834 |
m_state->m_graphParser->sendSlide(id,sendBackground); |
| 2835 |
} |
| 2836 |
} |
| 2837 |
|
| 2838 |
|
| 2839 |
//////////////////////////////////////////////////////////// |
| 2840 |
// Low level |
| 2841 |
//////////////////////////////////////////////////////////// |
| 2842 |
|
| 2843 |
// read the header |
| 2844 |
bool PowerPoint7Parser::checkHeader(MWAWHeader *header, bool /*strict*/) |
| 2845 |
{ |
| 2846 |
MWAWInputStreamPtr input = getInput(); |
| 2847 |
if (!input || !input->hasDataFork() || !input->isStructured()) |
| 2848 |
return false; |
| 2849 |
/* a PPT95 containing a PPT97. Let suppose that a PPT97 filter |
| 2850 |
exists...*/ |
| 2851 |
if (input->getSubStreamByName("PP97_DUALSTORAGE/PowerPoint Document")) { |
| 2852 |
#ifndef DEBUG |
| 2853 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::checkHeader: this file is a dual PowerPoint 95 and 97, it will only be converted in debug mode\n")); |
| 2854 |
#endif |
| 2855 |
return false; |
| 2856 |
} |
| 2857 |
input=input->getSubStreamByName("PowerPoint Document"); |
| 2858 |
if (!input || !getInput()->getSubStreamByName("PersistentStorage Directory")) |
| 2859 |
return false; |
| 2860 |
auto endPos=long(input->size()); |
| 2861 |
input->setReadInverted(true); |
| 2862 |
input->seek(0, librevenge::RVNG_SEEK_SET); |
| 2863 |
if (endPos<116 || input->readULong(2)!=3) { |
| 2864 |
MWAW_DEBUG_MSG(("PowerPoint7Parser::checkHeader: file is too short\n")); |
| 2865 |
return false; |
| 2866 |
} |
| 2867 |
input->seek(8, librevenge::RVNG_SEEK_SET); |
| 2868 |
auto dSz=long(input->readULong(4)); |
| 2869 |
if (dSz<100 || endPos-16<dSz || 16+dSz>endPos) return false; |
| 2870 |
|
| 2871 |
setVersion(7); |
| 2872 |
if (header) |
| 2873 |
header->reset(MWAWDocument::MWAW_T_POWERPOINT, 7, MWAWDocument::MWAW_K_PRESENTATION); |
| 2874 |
return true; |
| 2875 |
} |
| 2876 |
|
| 2877 |
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: |