/src/libwpd/src/lib/WP3TabGroup.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) 2007 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 "WP3TabGroup.h" |
27 | | #include "WP3FileStructure.h" |
28 | | #include "WP3Listener.h" |
29 | | #include "libwpd_internal.h" |
30 | | |
31 | | WP3TabGroup::WP3TabGroup(librevenge::RVNGInputStream *input, WPXEncryption *encryption, unsigned char groupID) : |
32 | 0 | WP3FixedLengthGroup(groupID), |
33 | 0 | m_subGroup(0), |
34 | 0 | m_modeType(0), |
35 | 0 | m_position(0.0) |
36 | 0 | { |
37 | 0 | _read(input, encryption); |
38 | 0 | } |
39 | | |
40 | | void WP3TabGroup::_readContents(librevenge::RVNGInputStream *input, WPXEncryption *encryption) |
41 | 0 | { |
42 | 0 | m_subGroup = readU8(input, encryption); |
43 | 0 | m_modeType = readU8(input, encryption); |
44 | 0 | m_position = fixedPointToDouble(readU32(input, encryption, true)) / 72.0; |
45 | 0 | } |
46 | | |
47 | | void WP3TabGroup::parse(WP3Listener *listener) |
48 | 0 | { |
49 | 0 | switch (m_subGroup) |
50 | 0 | { |
51 | 0 | case WP3_TAB_GROUP_TAB: |
52 | 0 | listener->insertTab(); |
53 | 0 | break; |
54 | 0 | case WP3_TAB_GROUP_CENTER: |
55 | 0 | case WP3_TAB_GROUP_FLUSH_RIGHT: |
56 | 0 | listener->insertTab(m_subGroup, m_position); |
57 | 0 | break; |
58 | 0 | case WP3_TAB_GROUP_BACK_TAB: |
59 | 0 | listener->backTab(); |
60 | 0 | break; |
61 | 0 | case WP3_TAB_GROUP_CHARACTER_KERNING: |
62 | 0 | listener->insertCharacter(0x0020); |
63 | 0 | break; |
64 | 0 | case WP3_TAB_GROUP_BAR_TAB: |
65 | 0 | listener->insertTab(); |
66 | 0 | listener->insertCharacter('|'); |
67 | 0 | break; |
68 | 0 | case WP3_TAB_GROUP_FIXED_TAB: |
69 | 0 | listener->insertTab(); |
70 | 0 | break; |
71 | 0 | default: |
72 | 0 | break; |
73 | 0 | } |
74 | 0 | } |
75 | | /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ |