Coverage Report

Created: 2026-04-29 07:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libwpd/src/lib/WP3HeaderFooterGroup.cpp
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2
/* libwpd
3
 * Version: MPL 2.0 / LGPLv2.1+
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
 * Major Contributor(s):
10
 * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
11
 *
12
 * For minor contributions see the git repository.
13
 *
14
 * Alternatively, the contents of this file may be used under the terms
15
 * of the GNU Lesser General Public License Version 2.1 or later
16
 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
17
 * applicable instead of those above.
18
 *
19
 * For further information visit http://libwpd.sourceforge.net
20
 */
21
22
/* "This product is not manufactured, approved, or supported by
23
 * Corel Corporation or Corel Corporation Limited."
24
 */
25
26
#include "WP3HeaderFooterGroup.h"
27
#include "libwpd_internal.h"
28
#include "WP3FileStructure.h"
29
30
WP3HeaderFooterGroup::WP3HeaderFooterGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption) :
31
206k
  WP3VariableLengthGroup(),
32
206k
  m_definition(0),
33
206k
  m_subDocument()
34
206k
{
35
206k
  _read(input, encryption);
36
206k
}
37
38
WP3HeaderFooterGroup::~WP3HeaderFooterGroup()
39
206k
{
40
206k
}
41
42
void WP3HeaderFooterGroup::_readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption)
43
206k
{
44
206k
  if (getSubGroup() <= WP3_HEADER_FOOTER_GROUP_FOOTER_B)  // omit watermarks for the while
45
202k
  {
46
202k
    input->seek(14, librevenge::RVNG_SEEK_CUR);
47
202k
    unsigned short tmpSubDocumentLength = readU16(input, encryption, true);  // read first the old subdocument length
48
202k
    input->seek(tmpSubDocumentLength, librevenge::RVNG_SEEK_CUR);  // and skip the old subdocument
49
202k
    if (input->isEnd())
50
61.0k
      return;
51
141k
    m_definition = readU8(input, encryption);
52
141k
    input->seek(4, librevenge::RVNG_SEEK_CUR);
53
141k
    tmpSubDocumentLength = input->isEnd() ? 0 : readU16(input, encryption, true);
54
141k
    if (tmpSubDocumentLength)
55
137k
      m_subDocument = std::make_shared<WP3SubDocument>(input, encryption, tmpSubDocumentLength);
56
141k
  }
57
206k
}
58
59
void WP3HeaderFooterGroup::parse(WP3Listener *listener)
60
206k
{
61
206k
  WPD_DEBUG_MSG(("WordPerfect: handling a HeaderFooter group\n"));
62
63
206k
  if (getSubGroup() <= WP3_HEADER_FOOTER_GROUP_FOOTER_B)  // omit watermarks for the while
64
202k
  {
65
202k
    listener->headerFooterGroup(getSubGroup(), m_definition, m_subDocument);
66
202k
  }
67
206k
}
68
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */