47
48
switch(getSubGroup())
49
case WP5_TOP_FONT_GROUP_COLOR:
50
input->seek(3, WPX_SEEK_CUR);
51
m_red = readU8(input, encryption);
52
m_green = readU8(input, encryption);
53
m_blue = readU8(input, encryption);
55
case WP5_TOP_FONT_GROUP_FONT_CHANGE:
56
input->seek(25, WPX_SEEK_CUR);
57
m_fontNumber = readU8(input, encryption);
60
input->seek(2, WPX_SEEK_CUR);
61
m_fontSize = (double)(readU16(input, encryption) / 50);
50
case WP5_TOP_FONT_GROUP_COLOR:
51
input->seek(3, WPX_SEEK_CUR);
52
m_red = readU8(input, encryption);
53
m_green = readU8(input, encryption);
54
m_blue = readU8(input, encryption);
56
case WP5_TOP_FONT_GROUP_FONT_CHANGE:
57
input->seek(25, WPX_SEEK_CUR);
58
m_fontNumber = readU8(input, encryption);
61
input->seek(2, WPX_SEEK_CUR);
62
m_fontSize = (double)(readU16(input, encryption) / 50);
69
70
void WP5FontGroup::parse(WP5Listener *listener)
71
72
WPD_DEBUG_MSG(("WordPerfect: handling a Font group\n"));
73
74
int tmpFontNameOffset;
74
75
double tmpFontSize = 12.0;
75
76
WPXString tmpFontName("Times New Roman");
77
78
switch(getSubGroup())
79
case WP5_TOP_FONT_GROUP_COLOR:
80
listener->characterColorChange(m_red, m_green, m_blue);
82
case WP5_TOP_FONT_GROUP_FONT_CHANGE:
83
if (listener->getGeneralPacketData(15))
85
tmpFontSize = static_cast<const WP5ListFontsUsedPacket*>(listener->getGeneralPacketData(15))->getFontSize(m_fontNumber);
86
tmpFontNameOffset = static_cast<const WP5ListFontsUsedPacket*>(listener->getGeneralPacketData(15))->getFontNameOffset(m_fontNumber);
89
else if (listener->getGeneralPacketData(2))
91
tmpFontSize = static_cast<const WP5ListFontsUsedPacket*>(listener->getGeneralPacketData(2))->getFontSize(m_fontNumber);
92
tmpFontNameOffset = static_cast<const WP5ListFontsUsedPacket*>(listener->getGeneralPacketData(2))->getFontNameOffset(m_fontNumber);
96
listener->setFont(tmpFontName, tmpFontSize);
100
if (listener->getGeneralPacketData(7))
101
tmpFontName = static_cast<const WP5FontNameStringPoolPacket*>(listener->getGeneralPacketData(7))->getFontName(tmpFontNameOffset);
103
tmpFontSize = m_fontSize;
105
WPD_DEBUG_MSG(("WP5 Parsing Font Change, fontNumber %i, fontName: %s, fontSize: %.4f\n", m_fontNumber, tmpFontName.cstr(), tmpFontSize));
80
case WP5_TOP_FONT_GROUP_COLOR:
81
listener->characterColorChange(m_red, m_green, m_blue);
83
case WP5_TOP_FONT_GROUP_FONT_CHANGE:
84
if (listener->getGeneralPacketData(15))
86
tmpFontSize = static_cast<const WP5ListFontsUsedPacket *>(listener->getGeneralPacketData(15))->getFontSize(m_fontNumber);
87
tmpFontNameOffset = static_cast<const WP5ListFontsUsedPacket *>(listener->getGeneralPacketData(15))->getFontNameOffset(m_fontNumber);
90
else if (listener->getGeneralPacketData(2))
92
tmpFontSize = static_cast<const WP5ListFontsUsedPacket *>(listener->getGeneralPacketData(2))->getFontSize(m_fontNumber);
93
tmpFontNameOffset = static_cast<const WP5ListFontsUsedPacket *>(listener->getGeneralPacketData(2))->getFontNameOffset(m_fontNumber);
106
97
listener->setFont(tmpFontName, tmpFontSize);
101
if (listener->getGeneralPacketData(7))
102
tmpFontName = static_cast<const WP5FontNameStringPoolPacket *>(listener->getGeneralPacketData(7))->getFontName(tmpFontNameOffset);
104
tmpFontSize = m_fontSize;
106
WPD_DEBUG_MSG(("WP5 Parsing Font Change, fontNumber %i, fontName: %s, fontSize: %.4f\n", m_fontNumber, tmpFontName.cstr(), tmpFontSize));
107
listener->setFont(tmpFontName, tmpFontSize);
113
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */