Coverage Report

Created: 2026-07-20 07:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libwpd/src/lib/WP3SingleByteFunction.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) 2002 William Lachance (wrlach@gmail.com)
11
 * Copyright (C) 2002 Marc Maurer (uwog@uwog.net)
12
 * Copyright (C) 2004 Fridrich Strba (fridrich.strba@bluewin.ch)
13
 *
14
 * For minor contributions see the git repository.
15
 *
16
 * Alternatively, the contents of this file may be used under the terms
17
 * of the GNU Lesser General Public License Version 2.1 or later
18
 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
19
 * applicable instead of those above.
20
 *
21
 * For further information visit http://libwpd.sourceforge.net
22
 */
23
24
/* "This product is not manufactured, approved, or supported by
25
 * Corel Corporation or Corel Corporation Limited."
26
 */
27
28
#include "WP3SingleByteFunction.h"
29
#include "libwpd_internal.h"
30
#include "WP3Listener.h"
31
32
WP3SingleByteFunction *WP3SingleByteFunction::constructSingleByteFunction(librevenge::RVNGInputStream * /* input */, WPXEncryption * /* encryption */, unsigned char groupID)
33
0
{
34
35
0
  switch (groupID)
36
0
  {
37
0
  case 0x80: // condensed hard return
38
0
    return new WP3EOLFunction();
39
40
0
  case 0x81: // condensed hard page
41
0
    return new WP3EOPFunction();
42
43
0
  case 0x82: // condensed tab
44
0
    return new WP3CondensedTabFunction();
45
46
0
  case 0x83: // condensed back-tab
47
0
    return new WP3CondensedBackTabFunction();
48
49
0
  case 0x84: // condensed indent
50
0
    return new WP3CondensedIndentFunction();
51
52
0
  case 0x85: // condensed left-right indent
53
0
    return new WP3CondensedLRIndentFunction();
54
55
0
  case 0x96: // hard hyphen in line
56
0
    return new WP3HyphenFunction();
57
58
0
  case 0x97: // soft hyphen in line
59
0
    return new WP3SoftHyphenFunction();
60
61
0
  case 0xa0: // hard space
62
0
    return new WP3HardSpaceFunction();
63
64
0
  default:
65
    // should not happen
66
0
    return nullptr;
67
0
  }
68
0
}
69
70
void WP3HardSpaceFunction::parse(WP3Listener *listener)
71
0
{
72
0
  listener->insertCharacter((unsigned) 0xa0);
73
0
}
74
75
void WP3HyphenFunction::parse(WP3Listener *listener)
76
0
{
77
0
  listener->insertCharacter((unsigned) '-');
78
0
}
79
80
void WP3SoftHyphenFunction::parse(WP3Listener *listener)
81
0
{
82
0
  listener->insertCharacter((unsigned) 0xad);
83
0
}
84
85
void WP3EOLFunction::parse(WP3Listener *listener)
86
0
{
87
0
  listener->insertEOL();
88
0
}
89
90
void WP3EOPFunction::parse(WP3Listener *listener)
91
0
{
92
0
  listener->insertBreak(WPX_PAGE_BREAK);
93
0
}
94
95
void WP3CondensedTabFunction::parse(WP3Listener *listener)
96
0
{
97
0
  listener->insertTab();
98
0
}
99
100
void WP3CondensedBackTabFunction::parse(WP3Listener *listener)
101
0
{
102
0
  listener->backTab();
103
0
}
104
105
void WP3CondensedIndentFunction::parse(WP3Listener *listener)
106
0
{
107
0
  listener->leftIndent();
108
0
}
109
110
void WP3CondensedLRIndentFunction::parse(WP3Listener *listener)
111
0
{
112
0
  listener->leftRightIndent();
113
0
}
114
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */