libwpd_internal.h
Go to the documentation of this file.
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* libwpd
* Version: MPL 2.0 / LGPLv2.1+
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Major Contributor(s):
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms
* of the GNU Lesser General Public License Version 2.1 or later
* (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
* applicable instead of those above.
*
* For further information visit http://libwpd.sourceforge.net
*/
/* "This product is not manufactured, approved, or supported by
* Corel Corporation or Corel Corporation Limited."
*/
#ifndef LIBWPD_INTERNAL_H
#define LIBWPD_INTERNAL_H
#include <librevenge/librevenge.h>
#include <librevenge-stream/librevenge-stream.h>
#include "WPXEncryption.h"
/* Various functions/defines that need not/should not be exported externally */
#if defined(HAVE_FUNC_ATTRIBUTE_FORMAT)
#define WPD_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg)))
#else
#define WPD_ATTRIBUTE_PRINTF(fmt, arg)
#endif
#ifdef DEBUG
namespace libwpd
{
void debugPrint(const char *format, ...) WPD_ATTRIBUTE_PRINTF(1, 2);
}
#define WPD_DEBUG_MSG(M) libwpd::debugPrint M
#else
#define WPD_DEBUG_MSG(M)
#endif
#define WPD_NUM_ELEMENTS(array) sizeof(array)/sizeof(array[0])
namespace libwpd
{
struct WPXDummyDeleter
{
void operator()(void *) {}
};
}
// add more of these as needed for byteswapping
// (the 8-bit functions are just there to make things consistent)
unsigned char readU8(librevenge::RVNGInputStream *input, WPXEncryption *encryption);
unsigned short readU16(librevenge::RVNGInputStream *input, WPXEncryption *encryption, bool bigendian=false);
signed short readS16(librevenge::RVNGInputStream *input, WPXEncryption *encryption, bool bigendian=false);
unsigned readU32(librevenge::RVNGInputStream *input, WPXEncryption *encryption, bool bigendian=false);
librevenge::RVNGString readPascalString(librevenge::RVNGInputStream *input, WPXEncryption *encryption);
librevenge::RVNGString readCString(librevenge::RVNGInputStream *input, WPXEncryption *encryption);
void appendUCS4(librevenge::RVNGString &str, unsigned ucs4);
// Various helper structures for the libwpd parser..
int extendedCharacterWP6ToUCS4(unsigned char character, unsigned char characterSet,
const unsigned **chars);
int extendedCharacterWP5ToUCS4(unsigned char character, unsigned char characterSet,
const unsigned **chars);
int appleWorldScriptToUCS4(unsigned short character, const unsigned **chars);
int extendedCharacterWP42ToUCS4(unsigned char character, const unsigned **chars);
unsigned short fixedPointToWPUs(const unsigned fixedPointNumber);
double fixedPointToDouble(const unsigned fixedPointNumber);
double wpuToFontPointSize(const unsigned short wpuNumber);
enum WPXFileType { WP6_DOCUMENT, WP5_DOCUMENT, WP42_DOCUMENT, OTHER };
enum WPXNumberingType { ARABIC, LOWERCASE, UPPERCASE, LOWERCASE_ROMAN, UPPERCASE_ROMAN };
enum WPXNoteType { FOOTNOTE, ENDNOTE };
enum WPXHeaderFooterType { HEADER, FOOTER };
enum WPXHeaderFooterInternalType { HEADER_A, HEADER_B, FOOTER_A, FOOTER_B, DUMMY };
enum WPXHeaderFooterOccurrence { ODD, EVEN, ALL, NEVER };
enum WPXPageNumberPosition { PAGENUMBER_POSITION_NONE = 0, PAGENUMBER_POSITION_TOP_LEFT, PAGENUMBER_POSITION_TOP_CENTER,
PAGENUMBER_POSITION_TOP_RIGHT, PAGENUMBER_POSITION_TOP_LEFT_AND_RIGHT,
PAGENUMBER_POSITION_BOTTOM_LEFT, PAGENUMBER_POSITION_BOTTOM_CENTER,
PAGENUMBER_POSITION_BOTTOM_RIGHT, PAGENUMBER_POSITION_BOTTOM_LEFT_AND_RIGHT,
PAGENUMBER_POSITION_TOP_INSIDE_LEFT_AND_RIGHT,
PAGENUMBER_POSITION_BOTTOM_INSIDE_LEFT_AND_RIGHT
};
enum WPXFormOrientation { PORTRAIT, LANDSCAPE };
enum WPXTabAlignment { LEFT, RIGHT, CENTER, DECIMAL, BAR };
enum WPXVerticalAlignment { TOP, MIDDLE, BOTTOM, FULL };
enum WPXTextColumnType { NEWSPAPER, NEWSPAPER_VERTICAL_BALANCE, PARALLEL, PARALLEL_PROTECT };
enum WPXSubDocumentType { WPX_SUBDOCUMENT_NONE, WPX_SUBDOCUMENT_HEADER_FOOTER, WPX_SUBDOCUMENT_NOTE, WPX_SUBDOCUMENT_TEXT_BOX, WPX_SUBDOCUMENT_COMMENT_ANNOTATION };
// ATTRIBUTE bits
#define WPX_EXTRA_LARGE_BIT 1
#define WPX_VERY_LARGE_BIT 2
#define WPX_LARGE_BIT 4
#define WPX_SMALL_PRINT_BIT 8
#define WPX_FINE_PRINT_BIT 16
#define WPX_SUPERSCRIPT_BIT 32
#define WPX_SUBSCRIPT_BIT 64
#define WPX_OUTLINE_BIT 128
#define WPX_ITALICS_BIT 256
#define WPX_SHADOW_BIT 512
#define WPX_REDLINE_BIT 1024
#define WPX_DOUBLE_UNDERLINE_BIT 2048
#define WPX_BOLD_BIT 4096
#define WPX_STRIKEOUT_BIT 8192
#define WPX_UNDERLINE_BIT 16384
#define WPX_SMALL_CAPS_BIT 32768
#define WPX_BLINK_BIT 65536
#define WPX_REVERSEVIDEO_BIT 131072
// JUSTIFICATION bits.
#define WPX_PARAGRAPH_JUSTIFICATION_LEFT 0x00
#define WPX_PARAGRAPH_JUSTIFICATION_FULL 0x01
#define WPX_PARAGRAPH_JUSTIFICATION_CENTER 0x02
#define WPX_PARAGRAPH_JUSTIFICATION_RIGHT 0x03
#define WPX_PARAGRAPH_JUSTIFICATION_FULL_ALL_LINES 0x04
#define WPX_PARAGRAPH_JUSTIFICATION_DECIMAL_ALIGNED 0x05
// TABLE POSITION bits.
#define WPX_TABLE_POSITION_ALIGN_WITH_LEFT_MARGIN 0x00
#define WPX_TABLE_POSITION_ALIGN_WITH_RIGHT_MARGIN 0x01
#define WPX_TABLE_POSITION_CENTER_BETWEEN_MARGINS 0x02
#define WPX_TABLE_POSITION_FULL 0x03
#define WPX_TABLE_POSITION_ABSOLUTE_FROM_LEFT_MARGIN 0x04
// TABLE CELL BORDER bits
const unsigned char WPX_TABLE_CELL_LEFT_BORDER_OFF = 0x01;
const unsigned char WPX_TABLE_CELL_RIGHT_BORDER_OFF = 0x02;
const unsigned char WPX_TABLE_CELL_TOP_BORDER_OFF = 0x04;
const unsigned char WPX_TABLE_CELL_BOTTOM_BORDER_OFF = 0x08;
// BREAK bits
#define WPX_PAGE_BREAK 0x00
#define WPX_SOFT_PAGE_BREAK 0x01
#define WPX_COLUMN_BREAK 0x02
// Generic bits
#define WPX_LEFT 0x00
#define WPX_RIGHT 0x01
#define WPX_CENTER 0x02
#define WPX_TOP 0x03
#define WPX_BOTTOM 0x04
struct RGBSColor
{
RGBSColor(unsigned char r, unsigned char g, unsigned char b, unsigned char s);
RGBSColor(unsigned short red, unsigned short green, unsigned short blue); // Construct
// RBBSColor from double precision RGB color used by WP3.x for Mac
RGBSColor(); // initializes all values to 0
unsigned char m_r;
unsigned char m_g;
unsigned char m_b;
unsigned char m_s;
};
struct WPXColumnDefinition
{
WPXColumnDefinition(); // initializes all values to 0
double m_width;
double m_leftGutter;
double m_rightGutter;
};
struct WPXColumnProperties
{
WPXColumnProperties();
unsigned m_attributes;
unsigned char m_alignment;
};
struct WPXTabStop
{
WPXTabStop();
double m_position;
WPXTabAlignment m_alignment;
unsigned m_leaderCharacter;
unsigned char m_leaderNumSpaces;
};
// Various exceptions: libwpd does not propagate exceptions externally..
class VersionException
{
};
class FileException
{
};
class ParseException
{
};
class GenericException
{
};
class UnsupportedEncryptionException
{
};
class SupportedEncryptionException
{
};
class WrongPasswordException
{
};
// Various usefull, but cheesey functions
int _extractNumericValueFromRoman(const char romanChar);
int _extractDisplayReferenceNumberFromBuf(const librevenge::RVNGString &buf, const WPXNumberingType listType);
WPXNumberingType _extractWPXNumberingTypeFromBuf(const librevenge::RVNGString &buf, const WPXNumberingType putativeWPXNumberingType);
librevenge::RVNGString _numberingTypeToString(WPXNumberingType t);
extern const unsigned macRomanCharacterMap[];
librevenge::RVNGString doubleToString(const double value);
#endif /* LIBWPD_INTERNAL_H */
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WPXEncryption.h
FileException
Definition libwpd_internal.h:209
GenericException
Definition libwpd_internal.h:217
ParseException
Definition libwpd_internal.h:213
SupportedEncryptionException
Definition libwpd_internal.h:225
UnsupportedEncryptionException
Definition libwpd_internal.h:221
VersionException
Definition libwpd_internal.h:205
WPXEncryption
Definition WPXEncryption.h:36
WrongPasswordException
Definition libwpd_internal.h:229
macRomanCharacterMap
const unsigned macRomanCharacterMap[]
Definition libwpd_internal.cpp:1353
WPXHeaderFooterOccurrence
WPXHeaderFooterOccurrence
Definition libwpd_internal.h:96
NEVER
@ NEVER
Definition libwpd_internal.h:96
EVEN
@ EVEN
Definition libwpd_internal.h:96
ODD
@ ODD
Definition libwpd_internal.h:96
ALL
@ ALL
Definition libwpd_internal.h:96
WPX_TABLE_CELL_BOTTOM_BORDER_OFF
const unsigned char WPX_TABLE_CELL_BOTTOM_BORDER_OFF
Definition libwpd_internal.h:152
WPXHeaderFooterType
WPXHeaderFooterType
Definition libwpd_internal.h:94
HEADER
@ HEADER
Definition libwpd_internal.h:94
FOOTER
@ FOOTER
Definition libwpd_internal.h:94
WPXFormOrientation
WPXFormOrientation
Definition libwpd_internal.h:105
LANDSCAPE
@ LANDSCAPE
Definition libwpd_internal.h:105
PORTRAIT
@ PORTRAIT
Definition libwpd_internal.h:105
WPXPageNumberPosition
WPXPageNumberPosition
Definition libwpd_internal.h:97
PAGENUMBER_POSITION_BOTTOM_INSIDE_LEFT_AND_RIGHT
@ PAGENUMBER_POSITION_BOTTOM_INSIDE_LEFT_AND_RIGHT
Definition libwpd_internal.h:102
PAGENUMBER_POSITION_BOTTOM_LEFT_AND_RIGHT
@ PAGENUMBER_POSITION_BOTTOM_LEFT_AND_RIGHT
Definition libwpd_internal.h:100
PAGENUMBER_POSITION_BOTTOM_LEFT
@ PAGENUMBER_POSITION_BOTTOM_LEFT
Definition libwpd_internal.h:99
PAGENUMBER_POSITION_TOP_CENTER
@ PAGENUMBER_POSITION_TOP_CENTER
Definition libwpd_internal.h:97
PAGENUMBER_POSITION_TOP_RIGHT
@ PAGENUMBER_POSITION_TOP_RIGHT
Definition libwpd_internal.h:98
PAGENUMBER_POSITION_TOP_LEFT_AND_RIGHT
@ PAGENUMBER_POSITION_TOP_LEFT_AND_RIGHT
Definition libwpd_internal.h:98
PAGENUMBER_POSITION_TOP_LEFT
@ PAGENUMBER_POSITION_TOP_LEFT
Definition libwpd_internal.h:97
PAGENUMBER_POSITION_BOTTOM_RIGHT
@ PAGENUMBER_POSITION_BOTTOM_RIGHT
Definition libwpd_internal.h:100
PAGENUMBER_POSITION_TOP_INSIDE_LEFT_AND_RIGHT
@ PAGENUMBER_POSITION_TOP_INSIDE_LEFT_AND_RIGHT
Definition libwpd_internal.h:101
PAGENUMBER_POSITION_NONE
@ PAGENUMBER_POSITION_NONE
Definition libwpd_internal.h:97
PAGENUMBER_POSITION_BOTTOM_CENTER
@ PAGENUMBER_POSITION_BOTTOM_CENTER
Definition libwpd_internal.h:99
wpuToFontPointSize
double wpuToFontPointSize(const unsigned short wpuNumber)
Definition libwpd_internal.cpp:1179
WPXTabAlignment
WPXTabAlignment
Definition libwpd_internal.h:106
CENTER
@ CENTER
Definition libwpd_internal.h:106
BAR
@ BAR
Definition libwpd_internal.h:106
LEFT
@ LEFT
Definition libwpd_internal.h:106
RIGHT
@ RIGHT
Definition libwpd_internal.h:106
DECIMAL
@ DECIMAL
Definition libwpd_internal.h:106
WPX_TABLE_CELL_RIGHT_BORDER_OFF
const unsigned char WPX_TABLE_CELL_RIGHT_BORDER_OFF
Definition libwpd_internal.h:150
_extractNumericValueFromRoman
int _extractNumericValueFromRoman(const char romanChar)
Definition libwpd_internal.cpp:1230
WPXFileType
WPXFileType
Definition libwpd_internal.h:91
WP6_DOCUMENT
@ WP6_DOCUMENT
Definition libwpd_internal.h:91
OTHER
@ OTHER
Definition libwpd_internal.h:91
WP5_DOCUMENT
@ WP5_DOCUMENT
Definition libwpd_internal.h:91
WP42_DOCUMENT
@ WP42_DOCUMENT
Definition libwpd_internal.h:91
fixedPointToWPUs
unsigned short fixedPointToWPUs(const unsigned fixedPointNumber)
Definition libwpd_internal.cpp:1164
readS16
signed short readS16(librevenge::RVNGInputStream *input, WPXEncryption *encryption, bool bigendian=false)
Definition libwpd_internal.cpp:134
WPD_ATTRIBUTE_PRINTF
#define WPD_ATTRIBUTE_PRINTF(fmt, arg)
Definition libwpd_internal.h:39
_extractWPXNumberingTypeFromBuf
WPXNumberingType _extractWPXNumberingTypeFromBuf(const librevenge::RVNGString &buf, const WPXNumberingType putativeWPXNumberingType)
Definition libwpd_internal.cpp:1303
_numberingTypeToString
librevenge::RVNGString _numberingTypeToString(WPXNumberingType t)
Definition libwpd_internal.cpp:1323
_extractDisplayReferenceNumberFromBuf
int _extractDisplayReferenceNumberFromBuf(const librevenge::RVNGString &buf, const WPXNumberingType listType)
Definition libwpd_internal.cpp:1257
WPXTextColumnType
WPXTextColumnType
Definition libwpd_internal.h:109
NEWSPAPER_VERTICAL_BALANCE
@ NEWSPAPER_VERTICAL_BALANCE
Definition libwpd_internal.h:109
NEWSPAPER
@ NEWSPAPER
Definition libwpd_internal.h:109
PARALLEL_PROTECT
@ PARALLEL_PROTECT
Definition libwpd_internal.h:109
PARALLEL
@ PARALLEL
Definition libwpd_internal.h:109
appendUCS4
void appendUCS4(librevenge::RVNGString &str, unsigned ucs4)
Definition libwpd_internal.cpp:154
readCString
librevenge::RVNGString readCString(librevenge::RVNGInputStream *input, WPXEncryption *encryption)
Definition libwpd_internal.cpp:184
readU8
unsigned char readU8(librevenge::RVNGInputStream *input, WPXEncryption *encryption)
Definition libwpd_internal.cpp:106
doubleToString
librevenge::RVNGString doubleToString(const double value)
Definition libwpd_internal.cpp:1385
WPXNumberingType
WPXNumberingType
Definition libwpd_internal.h:92
UPPERCASE
@ UPPERCASE
Definition libwpd_internal.h:92
UPPERCASE_ROMAN
@ UPPERCASE_ROMAN
Definition libwpd_internal.h:92
ARABIC
@ ARABIC
Definition libwpd_internal.h:92
LOWERCASE_ROMAN
@ LOWERCASE_ROMAN
Definition libwpd_internal.h:92
LOWERCASE
@ LOWERCASE
Definition libwpd_internal.h:92
extendedCharacterWP5ToUCS4
int extendedCharacterWP5ToUCS4(unsigned char character, unsigned char characterSet, const unsigned **chars)
Definition libwpd_internal.cpp:1018
WPXHeaderFooterInternalType
WPXHeaderFooterInternalType
Definition libwpd_internal.h:95
FOOTER_B
@ FOOTER_B
Definition libwpd_internal.h:95
HEADER_B
@ HEADER_B
Definition libwpd_internal.h:95
FOOTER_A
@ FOOTER_A
Definition libwpd_internal.h:95
HEADER_A
@ HEADER_A
Definition libwpd_internal.h:95
DUMMY
@ DUMMY
Definition libwpd_internal.h:95
WPXSubDocumentType
WPXSubDocumentType
Definition libwpd_internal.h:111
WPX_SUBDOCUMENT_TEXT_BOX
@ WPX_SUBDOCUMENT_TEXT_BOX
Definition libwpd_internal.h:111
WPX_SUBDOCUMENT_NOTE
@ WPX_SUBDOCUMENT_NOTE
Definition libwpd_internal.h:111
WPX_SUBDOCUMENT_NONE
@ WPX_SUBDOCUMENT_NONE
Definition libwpd_internal.h:111
WPX_SUBDOCUMENT_COMMENT_ANNOTATION
@ WPX_SUBDOCUMENT_COMMENT_ANNOTATION
Definition libwpd_internal.h:111
WPX_SUBDOCUMENT_HEADER_FOOTER
@ WPX_SUBDOCUMENT_HEADER_FOOTER
Definition libwpd_internal.h:111
WPXVerticalAlignment
WPXVerticalAlignment
Definition libwpd_internal.h:107
TOP
@ TOP
Definition libwpd_internal.h:107
MIDDLE
@ MIDDLE
Definition libwpd_internal.h:107
BOTTOM
@ BOTTOM
Definition libwpd_internal.h:107
FULL
@ FULL
Definition libwpd_internal.h:107
extendedCharacterWP6ToUCS4
int extendedCharacterWP6ToUCS4(unsigned char character, unsigned char characterSet, const unsigned **chars)
Definition libwpd_internal.cpp:660
WPX_TABLE_CELL_TOP_BORDER_OFF
const unsigned char WPX_TABLE_CELL_TOP_BORDER_OFF
Definition libwpd_internal.h:151
fixedPointToDouble
double fixedPointToDouble(const unsigned fixedPointNumber)
Definition libwpd_internal.cpp:1172
readU16
unsigned short readU16(librevenge::RVNGInputStream *input, WPXEncryption *encryption, bool bigendian=false)
Definition libwpd_internal.cpp:119
WPX_TABLE_CELL_LEFT_BORDER_OFF
const unsigned char WPX_TABLE_CELL_LEFT_BORDER_OFF
Definition libwpd_internal.h:149
WPXNoteType
WPXNoteType
Definition libwpd_internal.h:93
FOOTNOTE
@ FOOTNOTE
Definition libwpd_internal.h:93
ENDNOTE
@ ENDNOTE
Definition libwpd_internal.h:93
readPascalString
librevenge::RVNGString readPascalString(librevenge::RVNGInputStream *input, WPXEncryption *encryption)
Definition libwpd_internal.cpp:163
readU32
unsigned readU32(librevenge::RVNGInputStream *input, WPXEncryption *encryption, bool bigendian=false)
Definition libwpd_internal.cpp:139
extendedCharacterWP42ToUCS4
int extendedCharacterWP42ToUCS4(unsigned char character, const unsigned **chars)
Definition libwpd_internal.cpp:1151
appleWorldScriptToUCS4
int appleWorldScriptToUCS4(unsigned short character, const unsigned **chars)
Definition libwpd_internal.cpp:1409
libwpd
Definition libwpd_internal.h:56
RGBSColor::m_b
unsigned char m_b
Definition libwpd_internal.h:174
RGBSColor::RGBSColor
RGBSColor()
Definition libwpd_internal.cpp:1192
RGBSColor::RGBSColor
RGBSColor(unsigned char r, unsigned char g, unsigned char b, unsigned char s)
Definition libwpd_internal.cpp:1184
RGBSColor::m_r
unsigned char m_r
Definition libwpd_internal.h:172
RGBSColor::m_s
unsigned char m_s
Definition libwpd_internal.h:175
RGBSColor::m_g
unsigned char m_g
Definition libwpd_internal.h:173
WPXColumnDefinition::m_leftGutter
double m_leftGutter
Definition libwpd_internal.h:182
WPXColumnDefinition::WPXColumnDefinition
WPXColumnDefinition()
Definition libwpd_internal.cpp:1216
WPXColumnDefinition::m_width
double m_width
Definition libwpd_internal.h:181
WPXColumnDefinition::m_rightGutter
double m_rightGutter
Definition libwpd_internal.h:183
WPXColumnProperties::WPXColumnProperties
WPXColumnProperties()
Definition libwpd_internal.cpp:1223
WPXColumnProperties::m_alignment
unsigned char m_alignment
Definition libwpd_internal.h:190
WPXColumnProperties::m_attributes
unsigned m_attributes
Definition libwpd_internal.h:189
WPXTabStop::WPXTabStop
WPXTabStop()
Definition libwpd_internal.cpp:1208
WPXTabStop::m_alignment
WPXTabAlignment m_alignment
Definition libwpd_internal.h:197
WPXTabStop::m_position
double m_position
Definition libwpd_internal.h:196
WPXTabStop::m_leaderNumSpaces
unsigned char m_leaderNumSpaces
Definition libwpd_internal.h:199
WPXTabStop::m_leaderCharacter
unsigned m_leaderCharacter
Definition libwpd_internal.h:198
libwpd::WPXDummyDeleter
Definition libwpd_internal.h:58
libwpd::WPXDummyDeleter::operator()
void operator()(void *)
Definition libwpd_internal.h:59