[Libreoffice-commits] libcdr.git: src/lib
Fridrich Štrba
fridrich.strba at bluewin.ch
Sat Jul 2 15:54:24 UTC 2016
src/lib/CDRDocumentStructure.h | 8 ++++++
src/lib/CMXParser.cpp | 52 +++++++++++++++++++++++++++++++++++++++--
src/lib/CMXParser.h | 6 +++-
3 files changed, 62 insertions(+), 4 deletions(-)
New commits:
commit 7b389bf71f76dd3909bd848fe3defbc3acb5cd95
Author: Fridrich Štrba <fridrich.strba at bluewin.ch>
Date: Sat Jul 2 17:54:00 2016 +0200
Rdot reader
Change-Id: I44bd901a4c6f1bfa5e70b19f6e9d17d88bd935e0
diff --git a/src/lib/CDRDocumentStructure.h b/src/lib/CDRDocumentStructure.h
index 5f93b77..19667d4 100644
--- a/src/lib/CDRDocumentStructure.h
+++ b/src/lib/CDRDocumentStructure.h
@@ -92,7 +92,15 @@
#define CDR_FOURCC_RIFF 0x46464952
#define CDR_FOURCC_RIFX 0x58464952
+#define CDR_FOURCC_rarw 0x77726172
#define CDR_FOURCC_rclr 0x726c6372
+#define CDR_FOURCC_rdot 0x746f6472
+#define CDR_FOURCC_rlst 0x74736c72
+#define CDR_FOURCC_rota 0x61746f72
+#define CDR_FOURCC_rotl 0x6c746f72
+#define CDR_FOURCC_rott 0x74746f72
+#define CDR_FOURCC_rpen 0x6e657072
+#define CDR_FOURCC_rscr 0x72637372
#define CDR_FOURCC_rvsn 0x6e737672
#define CDR_FOURCC_spnd 0x646e7073
diff --git a/src/lib/CMXParser.cpp b/src/lib/CMXParser.cpp
index 7c13278..bff21c4 100644
--- a/src/lib/CMXParser.cpp
+++ b/src/lib/CMXParser.cpp
@@ -125,7 +125,10 @@ void libcdr::CMXParser::readRecord(unsigned fourCC, unsigned &length, librevenge
readCcmm(input, recordEnd);
break;
case CDR_FOURCC_rclr:
- readRclr(input, length);
+ readRclr(input);
+ break;
+ case CDR_FOURCC_rdot:
+ readRdot(input);
break;
default:
break;
@@ -1098,7 +1101,7 @@ void libcdr::CMXParser::readJumpAbsolute(librevenge::RVNGInputStream *input)
return;
}
-void libcdr::CMXParser::readRclr(librevenge::RVNGInputStream *input, unsigned /* length */)
+void libcdr::CMXParser::readRclr(librevenge::RVNGInputStream *input)
{
unsigned numRecords = readU16(input, m_bigEndian);
CDR_DEBUG_MSG(("CMXParser::readRclr - numRecords %i\n", numRecords));
@@ -1143,6 +1146,51 @@ void libcdr::CMXParser::readRclr(librevenge::RVNGInputStream *input, unsigned /*
}
}
+void libcdr::CMXParser::readRdot(librevenge::RVNGInputStream *input)
+{
+ unsigned numRecords = readU16(input, m_bigEndian);
+ CDR_DEBUG_MSG(("CMXParser::readRdot - numRecords %i\n", numRecords));
+ for (unsigned j = 1; j < numRecords+1; ++j)
+ {
+ std::vector<unsigned> dots;
+ 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_Dash:
+ {
+ unsigned short dotCount = readU16(input, m_bigEndian);
+ for (unsigned short i = 0; i < dotCount; ++i)
+ dots.push_back(readU16(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)
+ {
+ unsigned short dotCount = readU16(input, m_bigEndian);
+ for (unsigned short i = 0; i < dotCount; ++i)
+ dots.push_back(readU16(input, m_bigEndian));
+ }
+ else
+ return;
+ m_parserState.m_dashArrays[j] = dots;
+ }
+}
+
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 f9af468..4b05fa1 100644
--- a/src/lib/CMXParser.h
+++ b/src/lib/CMXParser.h
@@ -25,8 +25,9 @@ class CDRCollector;
struct CMXParserState
{
- CMXParserState() : m_colorPalette() {}
+ CMXParserState() : m_colorPalette(), m_dashArrays() {}
std::map<unsigned, CDRColor> m_colorPalette;
+ std::map<unsigned, std::vector<unsigned> > m_dashArrays;
};
class CMXParser : protected CommonParser
@@ -47,7 +48,8 @@ private:
void readDisp(librevenge::RVNGInputStream *input, unsigned length);
void readCcmm(librevenge::RVNGInputStream *input, long &recordEnd);
void readPage(librevenge::RVNGInputStream *input, unsigned length);
- void readRclr(librevenge::RVNGInputStream *input, unsigned length);
+ void readRclr(librevenge::RVNGInputStream *input);
+ void readRdot(librevenge::RVNGInputStream *input);
// Command readers
void readBeginPage(librevenge::RVNGInputStream *input);
More information about the Libreoffice-commits
mailing list