| 393 | } |
| 394 | |
| 395 | bool OriginAnyParser::readWindowElement() |
| 396 | { |
| 397 | LOG_PRINT(logfile, "readWindowElement()\n") |
| 398 | /* get general info and details of a window |
| 399 | * return true if a Window is found, otherwise return false */ |
| 400 | unsigned int wde_header_size = 0; |
| 401 | std::streamoff wdh_start = 0; |
| 402 | |
| 403 | // get window header size |
| 404 | wde_header_size = readObjectSize(); |
| 405 | if (wde_header_size == 0) |
| 406 | return false; |
| 407 | |
| 408 | curpos = file.tellg(); |
| 409 | wdh_start = curpos; |
| 410 | LOG_PRINT(logfile, |
| 411 | "Window found: header size %d [0x%X], starts at %" PRId64 " [0x%" PRIx64 "]: ", |
| 412 | wde_header_size, wde_header_size, curpos, curpos) |
| 413 | string wde_header = readObjectAsString(wde_header_size); |
| 414 | |
| 415 | // get known info |
| 416 | string name(25, 0); |
| 417 | name = wde_header.substr(0x02, 25).c_str(); |
| 418 | LOG_PRINT(logfile, "%s\n", name.c_str()) |
| 419 | |
| 420 | // classify type of window |
| 421 | ispread = findSpreadByName(name); |
| 422 | imatrix = findMatrixByName(name); |
| 423 | iexcel = findExcelByName(name); |
| 424 | igraph = -1; |
| 425 | |
| 426 | if (ispread != -1) { |
| 427 | LOG_PRINT(logfile, "\n Window is a Worksheet book\n") |
| 428 | getWindowProperties(spreadSheets[ispread], wde_header, wde_header_size); |
| 429 | } else if (imatrix != -1) { |
| 430 | LOG_PRINT(logfile, "\n Window is a Matrix book\n") |
| 431 | getWindowProperties(matrixes[imatrix], wde_header, wde_header_size); |
| 432 | } else if (iexcel != -1) { |
| 433 | LOG_PRINT(logfile, "\n Window is an Excel book\n") |
| 434 | getWindowProperties(excels[iexcel], wde_header, wde_header_size); |
| 435 | } else { |
| 436 | LOG_PRINT(logfile, "\n Window is a Graph\n") |
| 437 | graphs.push_back(Graph(name)); |
| 438 | igraph = (int)graphs.size() - 1; |
| 439 | getWindowProperties(graphs[igraph], wde_header, wde_header_size); |
| 440 | } |
| 441 | |
| 442 | // go to end of window header |
| 443 | file.seekg(wdh_start + wde_header_size + 1, ios_base::beg); |
| 444 | |
| 445 | // get layer list |
| 446 | unsigned int layer_list_size = 0; |
| 447 | |
| 448 | LOG_PRINT(logfile, " Reading Layers ...\n") |
| 449 | while (true) { |
| 450 | ilayer = layer_list_size; |
| 451 | if (!readLayerElement()) |
| 452 | break; |