CMXParser.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003  * This file is part of the libcdr project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  */
00009 
00010 #ifndef __CMXPARSER_H__
00011 #define __CMXPARSER_H__
00012 
00013 #include <stdio.h>
00014 #include <iostream>
00015 #include <vector>
00016 #include <map>
00017 #include <librevenge-stream/librevenge-stream.h>
00018 #include "CDRTypes.h"
00019 #include "CommonParser.h"
00020 
00021 namespace libcdr
00022 {
00023 
00024 class CDRCollector;
00025 
00026 class CMXParser : protected CommonParser
00027 {
00028 public:
00029   explicit CMXParser(CDRCollector *collector);
00030   virtual ~CMXParser();
00031   bool parseRecords(librevenge::RVNGInputStream *input, long size = -1, unsigned level = 0);
00032 
00033 private:
00034   CMXParser();
00035   CMXParser(const CMXParser &);
00036   CMXParser &operator=(const CMXParser &);
00037   bool parseRecord(librevenge::RVNGInputStream *input, unsigned level = 0);
00038   void readRecord(unsigned fourCC, unsigned &length, librevenge::RVNGInputStream *input);
00039 
00040   void readCMXHeader(librevenge::RVNGInputStream *input);
00041   void readDisp(librevenge::RVNGInputStream *input, unsigned length);
00042   void readCcmm(librevenge::RVNGInputStream *input, long &recordEnd);
00043   void readPage(librevenge::RVNGInputStream *input, unsigned length);
00044 
00045   // Command readers
00046   void readBeginPage(librevenge::RVNGInputStream *input);
00047   void readBeginLayer(librevenge::RVNGInputStream *input);
00048   void readBeginGroup(librevenge::RVNGInputStream *input);
00049   void readPolyCurve(librevenge::RVNGInputStream *input);
00050   void readEllipse(librevenge::RVNGInputStream *input);
00051   void readRectangle(librevenge::RVNGInputStream *input);
00052   void readJumpAbsolute(librevenge::RVNGInputStream *input);
00053 
00054   // Types readers
00055   CDRTransform readMatrix(librevenge::RVNGInputStream *input);
00056   CDRBox readBBox(librevenge::RVNGInputStream *input);
00057   void readFill(librevenge::RVNGInputStream *input);
00058 
00059   // Complex types readers
00060   void readRenderingAttributes(librevenge::RVNGInputStream *input);
00061 
00062   bool m_bigEndian;
00063   unsigned short m_unit;
00064   double m_scale;
00065   double m_xmin, m_xmax, m_ymin, m_ymax;
00066   unsigned m_indexSectionOffset;
00067   unsigned m_infoSectionOffset;
00068   unsigned m_thumbnailOffset;
00069   unsigned m_fillIndex;
00070   unsigned m_nextInstructionOffset;
00071 };
00072 
00073 } // namespace libcdr
00074 
00075 #endif // __CMXPARSER_H__
00076 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */