[Libreoffice-commits] libcdr.git: src/lib
Fridrich Štrba
fridrich.strba at bluewin.ch
Sat Jul 2 16:10:47 UTC 2016
src/lib/CMXParser.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++
src/lib/CMXParser.h | 12 +++++++++++-
2 files changed, 57 insertions(+), 1 deletion(-)
New commits:
commit c5c804ea40039b2e6ce9b603a65fcb79d4a36178
Author: Fridrich Štrba <fridrich.strba at bluewin.ch>
Date: Sat Jul 2 18:10:25 2016 +0200
rott reader
Change-Id: I1d22bf5e5f02eedb0f799516bd91a58569b7f352
diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index bff21c4..371b746 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -130,6 +130,9 @@ void libcdr::CMXParser::readRecord(unsigned fourCC, unsigned &length, librevenge
case CDR_FOURCC_rdot:
readRdot(input);
break;
+ case CDR_FOURCC_rott:
+ readRott(input);
+ break;
default:
break;
}
@@ -1191,6 +1194,49 @@ void libcdr::CMXParser::readRdot(librevenge::RVNGInputStream *input)
}
}
+void libcdr::CMXParser::readRott(librevenge::RVNGInputStream *input)
+{
+ unsigned numRecords = readU16(input, m_bigEndian);
+ CDR_DEBUG_MSG(("CMXParser::readRott - numRecords %i\n", numRecords));
+ for (unsigned j = 1; j < numRecords+1; ++j)
+ {
+ CMXLineStyle lineStyle;
+ if (m_precision == libcdr::PRECISION_32BIT)
+ {
+ unsigned char tagId = 0;
+ do
+ {
+ long offset = input->tell();
+ tagId = readU8(input, m_bigEndian);
+ if (tagId == CMX_Tag_EndTag)
+ break;
+ unsigned short tagLength = readU16(input, m_bigEndian);
+ switch (tagId)
+ {
+ case CMX_Tag_DescrSection_LineStyle:
+ {
+ lineStyle.m_spec = readU8(input, m_bigEndian);
+ lineStyle.m_capAndJoin = readU8(input, m_bigEndian);
+ break;
+ }
+ default:
+ break;
+ }
+ input->seek(offset+tagLength, librevenge::RVNG_SEEK_SET);
+ }
+ while (tagId != CMX_Tag_EndTag);
+ }
+ else if (m_precision == libcdr::PRECISION_16BIT)
+ {
+ lineStyle.m_spec = readU8(input, m_bigEndian);
+ lineStyle.m_capAndJoin = readU8(input, m_bigEndian);
+ }
+ else
+ return;
+ m_parserState.m_lineStyles[j] = lineStyle;
+ }
+}
+
libcdr::CDRColor libcdr::CMXParser::getPaletteColor(unsigned id)
{
const std::map<unsigned, libcdr::CDRColor>::const_iterator iter = m_parserState.m_colorPalette.find(id);
diff --git a/src/lib/CMXParser.h b/src/lib/CMXParser.h
index 4b05fa1..b713fbb 100644
--- a/src/lib/CMXParser.h
+++ b/src/lib/CMXParser.h
@@ -23,11 +23,20 @@ namespace libcdr
class CDRCollector;
+struct CMXLineStyle
+{
+ CMXLineStyle() : m_spec(0), M_capAndJoin(0) {}
+ unsigned char m_spec;
+ unsigned char m_capAndJoin;
+};
+
struct CMXParserState
{
- CMXParserState() : m_colorPalette(), m_dashArrays() {}
+ CMXParserState()
+ : m_colorPalette(), m_dashArrays(), m_lineStyles() {}
std::map<unsigned, CDRColor> m_colorPalette;
std::map<unsigned, std::vector<unsigned> > m_dashArrays;
+ std::map<unsigned, CMXLineStyle> m_lineStyles;
};
class CMXParser : protected CommonParser
@@ -49,6 +58,7 @@ private:
void readCcmm(librevenge::RVNGInputStream *input, long &recordEnd);
void readPage(librevenge::RVNGInputStream *input, unsigned length);
void readRclr(librevenge::RVNGInputStream *input);
+ void readRott(librevenge::RVNGInputStream *input);
void readRdot(librevenge::RVNGInputStream *input);
// Command readers
More information about the Libreoffice-commits
mailing list