LCOV - code coverage report
Current view: top level - hwpfilter/source - hinfo.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 110 0.0 %
Date: 2014-04-14 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "precompile.h"
      21             : 
      22             : #include "hwplib.h"
      23             : #include "hinfo.h"
      24             : #include "hwpfile.h"
      25             : 
      26             : // Info Block
      27             : 
      28             : 
      29           0 : static bool HWPReadInfoBlock(void *ptr, int len, HWPFile & hwpf)
      30             : {
      31           0 :     hwpf.info_block_len = len;
      32           0 :     if (0 == len)
      33           0 :         return true;
      34             :     else
      35           0 :         return hwpf.ReadBlock(ptr, len) ? true : false;
      36             : }
      37             : 
      38             : 
      39             : // Document Information
      40             : 
      41           0 : HWPInfo::HWPInfo(void)
      42             : {
      43           0 :     info_block = 0;
      44           0 :      back_info.isset = false;
      45           0 : }
      46             : 
      47             : 
      48           0 : HWPInfo::~HWPInfo(void)
      49             : {
      50           0 :     if (info_block)
      51           0 :         delete[]info_block;
      52           0 :     info_block = 0;
      53           0 : }
      54             : 
      55             : 
      56             : /**
      57             :  * ¹®¼­Á¤º¸¸¦ ÀоîµéÀÌ´Â ÇÔ¼ö ( 128 bytes )
      58             :  * ¹®¼­Á¤º¸´Â ÆÄÀÏÀνÄÁ¤º¸( 30 bytes ) ´ÙÀ½¿¡ À§Ä¡ÇÑ Á¤º¸ÀÌ´Ù.
      59             :  */
      60           0 : bool HWPInfo::Read(HWPFile & hwpf)
      61             : {
      62           0 :     hwpf.Read2b(&cur_col, 1);                     /* ¹®¼­¸¦ ÀúÀåÇÒ ´ç½ÃÀÇ Ä¿¼­°¡ À§Ä¡ÇÑ ¹®´Ü¹øÈ£ */
      63           0 :     hwpf.Read2b(&cur_row, 1);                     /* ¹®´Ü Ä­ */
      64             : 
      65           0 :     hwpf.Read1b(&paper.paper_kind, 1);            /* ¿ëÁö Á¾·ù */
      66           0 :     hwpf.Read1b(&paper.paper_direction, 1);       /* ¿ëÁö ¹æÇâ */
      67             : 
      68             : // paper geometry information
      69           0 :     paper.paper_height = (short) hwpf.Read2b();   /* ¿ëÁö ±æÀÌ */
      70           0 :     paper.paper_width = (short) hwpf.Read2b();    /* ¿ëÁö ³Êºñ */
      71           0 :     paper.top_margin = (short) hwpf.Read2b();     /* À§ÂÊ ¿©¹é */
      72           0 :     paper.bottom_margin = (short) hwpf.Read2b();  /* ¾Æ·¡ÂÊ ¿©¹é */
      73           0 :     paper.left_margin = (short) hwpf.Read2b();    /* ¿ÞÂÊ ¿©¹é */
      74           0 :     paper.right_margin = (short) hwpf.Read2b();   /* ¿À¸¥ÂÊ ¿©¹é */
      75           0 :     paper.header_length = (short) hwpf.Read2b();  /* ¸Ó¸®¸» ±æÀÌ */
      76           0 :     paper.footer_length = (short) hwpf.Read2b();  /* ²¿¸®¸» ±æÀÌ */
      77           0 :     paper.gutter_length = (short) hwpf.Read2b();  /* Á¦º»¿©¹é */
      78           0 :     hwpf.Read2b(&readonly, 1);                    /* ¿¹¾à */
      79           0 :     hwpf.Read1b(reserved1, 4);                    /* ¿¹¾à */
      80           0 :     hwpf.Read1b(&chain_info.chain_page_no, 1);    /* ÂÊ ¹øÈ£ ¿¬°á 1-¿¬°á, 0-»õ·Î½ÃÀÛ (¿¬°áÀμ⿡¼­ »ç¿ë) */
      81           0 :     hwpf.Read1b(&chain_info.chain_footnote_no, 1);/* °¢ÁÖ¹øÈ£ ¿¬°á 1-¿¬°á 0-»õ·Î½ÃÀÛ */
      82             :                                                   /* ¿¬°áÀμâÇÒ ÆÄÀÏÀÇ À̸§ */
      83           0 :     hwpf.Read1b(chain_info.chain_filename, CHAIN_MAX_PATH);
      84             : 
      85           0 :     hwpf.Read1b(annotation, ANNOTATION_LEN);      /* µ¡ºÙÀÌ´Â ¸» ( ÆÄÀÏ ÀúÀåÇÒ ¶§ µ¡ºÙÀÌ´Â ¸»¿¡ ÁöÁ¤ÇÑ ³»¿ë ) */
      86           0 :     hwpf.Read2b(&encrypted, 1);                   /* ¾ÏÈ£ ¿©ºÎ 0-º¸ÅëÆÄÀÏ, ±×¿Ü-¾ÏÈ£°É¸° ÆÄÀÏ */
      87             : //hwpf.Read1b(reserved2, 6);                      /* ¾Æ·¡ 3°³ÀÇ°ªÀ¸·Î ¹Ù²î¾ú´Ù. */
      88           0 :     hwpf.Read2b(&beginpagenum,1);                 /* ÆäÀÌÁö½ÃÀÛ¹øÈ£ */
      89             : 
      90             : // footnote
      91           0 :     hwpf.Read2b(&beginfnnum,1);                   /* °¢ÁÖ ½ÃÀÛ¹øÈ£ */
      92           0 :     hwpf.Read2b(&countfn,1);                      /* °¢ÁÖ °¹¼ö */
      93           0 :     splinetext = (short) hwpf.Read2b();
      94           0 :     splinefn = (short) hwpf.Read2b();
      95           0 :     spfnfn = (short) hwpf.Read2b();
      96           0 :     hwpf.Read1b(&fnchar, 1);
      97           0 :     hwpf.Read1b(&fnlinetype, 1);
      98             : // border layout
      99           0 :     for (int ii = 0; ii < 4; ++ii)
     100           0 :         bordermargin[ii] = (short) hwpf.Read2b();
     101           0 :     hwpf.Read2b(&borderline, 1);
     102             : 
     103           0 :     hwpf.Read1b(&empty_line_hide, 1);
     104           0 :     hwpf.Read1b(&table_move, 1);
     105           0 :     hwpf.Read1b(&compressed, 1);
     106             : 
     107           0 :     hwpf.Read1b(&reserved3, 1);
     108             : 
     109           0 :     hwpf.Read2b(&info_block_len, 1);
     110           0 :     if (hwpf.State())
     111           0 :         return false;
     112             : 
     113             : /* ¹®¼­ ¿ä¾àÀ» Àд´Ù. */
     114           0 :     if (!summary.Read(hwpf))
     115           0 :         return false;
     116           0 :     if (info_block_len > 0)
     117             :     {
     118           0 :         info_block = new unsigned char[info_block_len + 1];
     119             : 
     120           0 :         if (0 == info_block ||
     121           0 :             !HWPReadInfoBlock(info_block, info_block_len, hwpf))
     122           0 :             return false;
     123             :     }
     124             : 
     125             : /* hwpfÀÇ °ªÀ» Àç¼³Á¤ ÇÑ´Ù. */
     126           0 :     hwpf.compressed = compressed ? true : false;
     127           0 :     hwpf.encrypted = encrypted ? true : false;
     128           0 :     hwpf.info_block_len = info_block_len;
     129           0 :     hwpf.SetCompressed(hwpf.compressed);
     130             : 
     131           0 :     return (!hwpf.State());
     132             : }
     133             : 
     134             : 
     135             : // Document Summary
     136             : 
     137           0 : bool HWPSummary::Read(HWPFile & hwpf)
     138             : {
     139           0 :     hwpf.Read2b(title, 56);
     140           0 :     hwpf.Read2b(subject, 56);
     141           0 :     hwpf.Read2b(author, 56);
     142           0 :     hwpf.Read2b(date, 56);
     143           0 :     hwpf.Read2b(keyword[0], 56);
     144           0 :     hwpf.Read2b(keyword[1], 56);
     145           0 :     hwpf.Read2b(etc[0], 56);
     146           0 :     hwpf.Read2b(etc[1], 56);
     147           0 :     hwpf.Read2b(etc[2], 56);
     148             : 
     149           0 :     return (!hwpf.State());
     150             : }
     151             : 
     152             : 
     153           0 : bool ParaShape::Read(HWPFile & hwpf)
     154             : {
     155           0 :      pagebreak = 0;
     156           0 :     left_margin = (short) hwpf.Read2b();
     157           0 :     right_margin = (short) hwpf.Read2b();
     158           0 :     indent = (short) hwpf.Read2b();
     159           0 :     lspacing = (short) hwpf.Read2b();
     160           0 :     pspacing_next = (short) hwpf.Read2b();
     161             : 
     162           0 :     hwpf.Read1b(&condense, 1);
     163           0 :     hwpf.Read1b(&arrange_type, 1);
     164           0 :     for (int ii = 0; ii < MAXTABS; ii++)
     165             :     {
     166           0 :         hwpf.Read1b(&tabs[ii].type, 1);
     167           0 :         hwpf.Read1b(&tabs[ii].dot_continue, 1);
     168           0 :         tabs[ii].position = (short) hwpf.Read2b();
     169             :     }
     170           0 :     hwpf.Read1b(&coldef.ncols, 1);
     171           0 :     hwpf.Read1b(&coldef.separator, 1);
     172           0 :     coldef.spacing = (short) hwpf.Read2b();
     173           0 :     coldef.columnlen = (short) hwpf.Read2b();
     174           0 :     coldef.columnlen0 = (short) hwpf.Read2b();
     175           0 :     hwpf.Read1b(&shade, 1);
     176           0 :     hwpf.Read1b(&outline, 1);
     177           0 :     hwpf.Read1b(&outline_continue, 1);
     178           0 :     pspacing_prev = (short) hwpf.Read2b();
     179             : 
     180           0 :     hwpf.Read1b(reserved, 2);
     181           0 :     return (!hwpf.State());
     182             : }
     183             : 
     184             : 
     185           0 : bool CharShape::Read(HWPFile & hwpf)
     186             : {
     187           0 :     size = (short) hwpf.Read2b();
     188           0 :     hwpf.Read1b(font, NLanguage);
     189           0 :     hwpf.Read1b(ratio, NLanguage);
     190           0 :     hwpf.Read1b(space, NLanguage);
     191           0 :     hwpf.Read1b(color, 2);
     192           0 :     hwpf.Read1b(&shade, 1);
     193           0 :     hwpf.Read1b(&attr, 1);
     194           0 :     hwpf.Read1b(reserved, 4);
     195             : 
     196           0 :     return (!hwpf.State());
     197             : }
     198             : 
     199             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10