~ubuntu-branches/ubuntu/saucy/libwpd/saucy-proposed

« back to all changes in this revision

Viewing changes to src/lib/WP5VariableLengthGroup.cpp

  • Committer: Package Import Robot
  • Author(s): Rene Engelhard
  • Date: 2011-11-29 23:31:13 UTC
  • mfrom: (1.2.5)
  • Revision ID: package-import@ubuntu.com-20111129233113-xdtwca9h0y6wdxst
Tags: 0.9.4-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
1
2
/* libwpd
2
3
 * Copyright (C) 2003 William Lachance (wrlach@gmail.com)
3
4
 * Copyright (C) 2003-2004 Marc Maurer (uwog@uwog.net)
4
5
 * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
5
 
 *  
 
6
 *
6
7
 * This library is free software; you can redistribute it and/or
7
8
 * modify it under the terms of the GNU Lesser General Public
8
9
 * License as published by the Free Software Foundation; either
20
21
 * For further information visit http://libwpd.sourceforge.net
21
22
 */
22
23
 
23
 
/* "This product is not manufactured, approved, or supported by 
 
24
/* "This product is not manufactured, approved, or supported by
24
25
 * Corel Corporation or Corel Corporation Limited."
25
26
 */
26
27
 
42
43
{
43
44
}
44
45
 
45
 
WP5VariableLengthGroup * WP5VariableLengthGroup::constructVariableLengthGroup(WPXInputStream *input, WPXEncryption *encryption, const uint8_t group)
 
46
WP5VariableLengthGroup *WP5VariableLengthGroup::constructVariableLengthGroup(WPXInputStream *input, WPXEncryption *encryption, const uint8_t group)
46
47
{
47
 
        WPD_DEBUG_MSG(("WordPerfect: handling a variable length group Ox%x\n", group)); 
 
48
        WPD_DEBUG_MSG(("WordPerfect: handling a variable length group Ox%x\n", group));
48
49
        switch (group)
49
50
        {
50
 
                case WP5_TOP_DEFINITION_GROUP:
51
 
                        return new WP5DefinitionGroup(input, encryption);
52
 
                case WP5_TOP_PAGE_FORMAT_GROUP:
53
 
                        return new WP5PageFormatGroup(input, encryption);
54
 
                case WP5_TOP_HEADER_FOOTER_GROUP:
55
 
                        return new WP5HeaderFooterGroup(input, encryption);
56
 
                case WP5_TOP_FONT_GROUP:
57
 
                        return new WP5FontGroup(input, encryption);
58
 
                case WP5_TOP_FOOTNOTE_ENDNOTE_GROUP:
59
 
                        return new WP5FootnoteEndnoteGroup(input, encryption);
60
 
                case WP5_TOP_BOX_GROUP:
61
 
                        return new WP5BoxGroup(input, encryption);
62
 
                case WP5_TOP_TABLE_EOL_GROUP:
63
 
                        return new WP5TableEOLGroup(input, encryption);
64
 
                case WP5_TOP_TABLE_EOP_GROUP:
65
 
                        return new WP5TableEOPGroup(input, encryption);
66
 
                default:
67
 
                        // this is an unhandled group, just skip it
68
 
                        return new WP5UnsupportedVariableLengthGroup(input, encryption);
 
51
        case WP5_TOP_DEFINITION_GROUP:
 
52
                return new WP5DefinitionGroup(input, encryption);
 
53
        case WP5_TOP_PAGE_FORMAT_GROUP:
 
54
                return new WP5PageFormatGroup(input, encryption);
 
55
        case WP5_TOP_HEADER_FOOTER_GROUP:
 
56
                return new WP5HeaderFooterGroup(input, encryption);
 
57
        case WP5_TOP_FONT_GROUP:
 
58
                return new WP5FontGroup(input, encryption);
 
59
        case WP5_TOP_FOOTNOTE_ENDNOTE_GROUP:
 
60
                return new WP5FootnoteEndnoteGroup(input, encryption);
 
61
        case WP5_TOP_BOX_GROUP:
 
62
                return new WP5BoxGroup(input, encryption);
 
63
        case WP5_TOP_TABLE_EOL_GROUP:
 
64
                return new WP5TableEOLGroup(input, encryption);
 
65
        case WP5_TOP_TABLE_EOP_GROUP:
 
66
                return new WP5TableEOPGroup(input, encryption);
 
67
        default:
 
68
                // this is an unhandled group, just skip it
 
69
                return new WP5UnsupportedVariableLengthGroup(input, encryption);
69
70
        }
70
71
}
71
72
 
98
99
                        input->seek(startPosition, WPX_SEEK_SET);
99
100
                        return false;
100
101
                }
101
 
                
 
102
 
102
103
                input->seek(startPosition, WPX_SEEK_SET);
103
104
                return true;
104
105
        }
115
116
 
116
117
        m_subGroup = readU8(input, encryption);
117
118
        m_size = readU16(input, encryption) + 4; // the length is the number of data bytes minus 4 (ie. the function codes)
118
 
        
 
119
 
119
120
        WPD_DEBUG_MSG(("WordPerfect: Read variable group header (start_position: %i, sub_group: 0x%2x, size: %i)\n", startPosition, m_subGroup, m_size));
120
121
 
121
122
        _readContents(input, encryption);
135
136
 
136
137
        input->seek((startPosition + m_size - 1), WPX_SEEK_SET);
137
138
}
 
139
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */