LCOV - code coverage report
Current view: top level - hwpfilter/source - hinfo.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 98 110 89.1 %
Date: 2014-04-11 Functions: 6 7 85.7 %
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           1 : HWPInfo::HWPInfo(void)
      42             : {
      43           1 :     info_block = 0;
      44           1 :      back_info.isset = false;
      45           1 : }
      46             : 
      47             : 
      48           1 : HWPInfo::~HWPInfo(void)
      49             : {
      50           1 :     if (info_block)
      51           0 :         delete[]info_block;
      52           1 :     info_block = 0;
      53           1 : }
      54             : 
      55             : 
      56             : /**
      57             :  * ¹®¼­Á¤º¸¸¦ ÀоîµéÀÌ´Â ÇÔ¼ö ( 128 bytes )
      58             :  * ¹®¼­Á¤º¸´Â ÆÄÀÏÀνÄÁ¤º¸( 30 bytes ) ´ÙÀ½¿¡ À§Ä¡ÇÑ Á¤º¸ÀÌ´Ù.
      59             :  */
      60           1 : bool HWPInfo::Read(HWPFile & hwpf)
      61             : {
      62           1 :     hwpf.Read2b(&cur_col, 1);                     /* ¹®¼­¸¦ ÀúÀåÇÒ ´ç½ÃÀÇ Ä¿¼­°¡ À§Ä¡ÇÑ ¹®´Ü¹øÈ£ */
      63           1 :     hwpf.Read2b(&cur_row, 1);                     /* ¹®´Ü Ä­ */
      64             : 
      65           1 :     hwpf.Read1b(&paper.paper_kind, 1);            /* ¿ëÁö Á¾·ù */
      66           1 :     hwpf.Read1b(&paper.paper_direction, 1);       /* ¿ëÁö ¹æÇâ */
      67             : 
      68             : // paper geometry information
      69           1 :     paper.paper_height = (short) hwpf.Read2b();   /* ¿ëÁö ±æÀÌ */
      70           1 :     paper.paper_width = (short) hwpf.Read2b();    /* ¿ëÁö ³Êºñ */
      71           1 :     paper.top_margin = (short) hwpf.Read2b();     /* À§ÂÊ ¿©¹é */
      72           1 :     paper.bottom_margin = (short) hwpf.Read2b();  /* ¾Æ·¡ÂÊ ¿©¹é */
      73           1 :     paper.left_margin = (short) hwpf.Read2b();    /* ¿ÞÂÊ ¿©¹é */
      74           1 :     paper.right_margin = (short) hwpf.Read2b();   /* ¿À¸¥ÂÊ ¿©¹é */
      75           1 :     paper.header_length = (short) hwpf.Read2b();  /* ¸Ó¸®¸» ±æÀÌ */
      76           1 :     paper.footer_length = (short) hwpf.Read2b();  /* ²¿¸®¸» ±æÀÌ */
      77           1 :     paper.gutter_length = (short) hwpf.Read2b();  /* Á¦º»¿©¹é */
      78           1 :     hwpf.Read2b(&readonly, 1);                    /* ¿¹¾à */
      79           1 :     hwpf.Read1b(reserved1, 4);                    /* ¿¹¾à */
      80           1 :     hwpf.Read1b(&chain_info.chain_page_no, 1);    /* ÂÊ ¹øÈ£ ¿¬°á 1-¿¬°á, 0-»õ·Î½ÃÀÛ (¿¬°áÀμ⿡¼­ »ç¿ë) */
      81           1 :     hwpf.Read1b(&chain_info.chain_footnote_no, 1);/* °¢ÁÖ¹øÈ£ ¿¬°á 1-¿¬°á 0-»õ·Î½ÃÀÛ */
      82             :                                                   /* ¿¬°áÀμâÇÒ ÆÄÀÏÀÇ À̸§ */
      83           1 :     hwpf.Read1b(chain_info.chain_filename, CHAIN_MAX_PATH);
      84             : 
      85           1 :     hwpf.Read1b(annotation, ANNOTATION_LEN);      /* µ¡ºÙÀÌ´Â ¸» ( ÆÄÀÏ ÀúÀåÇÒ ¶§ µ¡ºÙÀÌ´Â ¸»¿¡ ÁöÁ¤ÇÑ ³»¿ë ) */
      86           1 :     hwpf.Read2b(&encrypted, 1);                   /* ¾ÏÈ£ ¿©ºÎ 0-º¸ÅëÆÄÀÏ, ±×¿Ü-¾ÏÈ£°É¸° ÆÄÀÏ */
      87             : //hwpf.Read1b(reserved2, 6);                      /* ¾Æ·¡ 3°³ÀÇ°ªÀ¸·Î ¹Ù²î¾ú´Ù. */
      88           1 :     hwpf.Read2b(&beginpagenum,1);                 /* ÆäÀÌÁö½ÃÀÛ¹øÈ£ */
      89             : 
      90             : // footnote
      91           1 :     hwpf.Read2b(&beginfnnum,1);                   /* °¢ÁÖ ½ÃÀÛ¹øÈ£ */
      92           1 :     hwpf.Read2b(&countfn,1);                      /* °¢ÁÖ °¹¼ö */
      93           1 :     splinetext = (short) hwpf.Read2b();
      94           1 :     splinefn = (short) hwpf.Read2b();
      95           1 :     spfnfn = (short) hwpf.Read2b();
      96           1 :     hwpf.Read1b(&fnchar, 1);
      97           1 :     hwpf.Read1b(&fnlinetype, 1);
      98             : // border layout
      99           5 :     for (int ii = 0; ii < 4; ++ii)
     100           4 :         bordermargin[ii] = (short) hwpf.Read2b();
     101           1 :     hwpf.Read2b(&borderline, 1);
     102             : 
     103           1 :     hwpf.Read1b(&empty_line_hide, 1);
     104           1 :     hwpf.Read1b(&table_move, 1);
     105           1 :     hwpf.Read1b(&compressed, 1);
     106             : 
     107           1 :     hwpf.Read1b(&reserved3, 1);
     108             : 
     109           1 :     hwpf.Read2b(&info_block_len, 1);
     110           1 :     if (hwpf.State())
     111           0 :         return false;
     112             : 
     113             : /* ¹®¼­ ¿ä¾àÀ» Àд´Ù. */
     114           1 :     if (!summary.Read(hwpf))
     115           0 :         return false;
     116           1 :     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           1 :     hwpf.compressed = compressed ? true : false;
     127           1 :     hwpf.encrypted = encrypted ? true : false;
     128           1 :     hwpf.info_block_len = info_block_len;
     129           1 :     hwpf.SetCompressed(hwpf.compressed);
     130             : 
     131           1 :     return (!hwpf.State());
     132             : }
     133             : 
     134             : 
     135             : // Document Summary
     136             : 
     137           1 : bool HWPSummary::Read(HWPFile & hwpf)
     138             : {
     139           1 :     hwpf.Read2b(title, 56);
     140           1 :     hwpf.Read2b(subject, 56);
     141           1 :     hwpf.Read2b(author, 56);
     142           1 :     hwpf.Read2b(date, 56);
     143           1 :     hwpf.Read2b(keyword[0], 56);
     144           1 :     hwpf.Read2b(keyword[1], 56);
     145           1 :     hwpf.Read2b(etc[0], 56);
     146           1 :     hwpf.Read2b(etc[1], 56);
     147           1 :     hwpf.Read2b(etc[2], 56);
     148             : 
     149           1 :     return (!hwpf.State());
     150             : }
     151             : 
     152             : 
     153          14 : bool ParaShape::Read(HWPFile & hwpf)
     154             : {
     155          14 :      pagebreak = 0;
     156          14 :     left_margin = (short) hwpf.Read2b();
     157          14 :     right_margin = (short) hwpf.Read2b();
     158          14 :     indent = (short) hwpf.Read2b();
     159          14 :     lspacing = (short) hwpf.Read2b();
     160          14 :     pspacing_next = (short) hwpf.Read2b();
     161             : 
     162          14 :     hwpf.Read1b(&condense, 1);
     163          14 :     hwpf.Read1b(&arrange_type, 1);
     164         574 :     for (int ii = 0; ii < MAXTABS; ii++)
     165             :     {
     166         560 :         hwpf.Read1b(&tabs[ii].type, 1);
     167         560 :         hwpf.Read1b(&tabs[ii].dot_continue, 1);
     168         560 :         tabs[ii].position = (short) hwpf.Read2b();
     169             :     }
     170          14 :     hwpf.Read1b(&coldef.ncols, 1);
     171          14 :     hwpf.Read1b(&coldef.separator, 1);
     172          14 :     coldef.spacing = (short) hwpf.Read2b();
     173          14 :     coldef.columnlen = (short) hwpf.Read2b();
     174          14 :     coldef.columnlen0 = (short) hwpf.Read2b();
     175          14 :     hwpf.Read1b(&shade, 1);
     176          14 :     hwpf.Read1b(&outline, 1);
     177          14 :     hwpf.Read1b(&outline_continue, 1);
     178          14 :     pspacing_prev = (short) hwpf.Read2b();
     179             : 
     180          14 :     hwpf.Read1b(reserved, 2);
     181          14 :     return (!hwpf.State());
     182             : }
     183             : 
     184             : 
     185          17 : bool CharShape::Read(HWPFile & hwpf)
     186             : {
     187          17 :     size = (short) hwpf.Read2b();
     188          17 :     hwpf.Read1b(font, NLanguage);
     189          17 :     hwpf.Read1b(ratio, NLanguage);
     190          17 :     hwpf.Read1b(space, NLanguage);
     191          17 :     hwpf.Read1b(color, 2);
     192          17 :     hwpf.Read1b(&shade, 1);
     193          17 :     hwpf.Read1b(&attr, 1);
     194          17 :     hwpf.Read1b(reserved, 4);
     195             : 
     196          17 :     return (!hwpf.State());
     197             : }
     198             : 
     199             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10