FB2ExtrasCollector.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* libe-book
00003  * Version: MPL 2.0 / LGPLv2.1+
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  * Alternatively, the contents of this file may be used under the terms
00010  * of the GNU Lesser General Public License Version 2.1 or later
00011  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
00012  * applicable instead of those above.
00013  *
00014  * For further information visit http://libebook.sourceforge.net
00015  */
00016 
00017 #ifndef FB2EXTRASCOLLECTOR_H_INCLUDED
00018 #define FB2EXTRASCOLLECTOR_H_INCLUDED
00019 
00020 #include "FB2Collector.h"
00021 
00022 namespace libebook
00023 {
00024 
00025 class FB2Content;
00026 class FB2ContentMap;
00027 class FB2Style;
00028 
00029 class GroupContent;
00030 
00031 class FB2ExtrasCollector : public FB2Collector
00032 {
00033   // no copying
00034   FB2ExtrasCollector(const FB2ExtrasCollector &other);
00035   FB2ExtrasCollector &operator=(const FB2ExtrasCollector &other);
00036 
00037 public:
00038   FB2ExtrasCollector(FB2ContentMap &notes, FB2ContentMap &bitmaps);
00039   virtual ~FB2ExtrasCollector();
00040 
00041 private:
00042   virtual void defineMetadataEntry(const char *name, const char *value);
00043   virtual void openMetadataEntry(const char *name);
00044   virtual void closeMetadataEntry();
00045 
00046   virtual void defineID(const char *);
00047 
00048   virtual void openPageSpan();
00049   virtual void closePageSpan();
00050 
00051   virtual void openBlock();
00052   virtual void closeBlock();
00053 
00054   virtual void openParagraph(const FB2BlockFormat &format);
00055   virtual void closeParagraph();
00056 
00057   virtual void openSpan(const FB2Style &style);
00058   virtual void closeSpan();
00059 
00060   virtual void insertText(const char *text);
00061 
00062   virtual void openTable(const FB2BlockFormat &format);
00063   virtual void closeTable();
00064 
00065   virtual void openTableRow(const FB2BlockFormat &format);
00066   virtual void closeTableRow();
00067 
00068   virtual void openTableCell(int rowspan, int colspan);
00069   virtual void closeTableCell();
00070   virtual void insertCoveredTableCell();
00071 
00072   virtual void insertFootnote(const char *id);
00073 
00074   virtual void insertBitmap(const char *id);
00075   virtual void insertBitmapData(const char *contentType, const char *base64Data);
00076 
00077   void flushCurrentNote();
00078   bool isInNote() const;
00079 
00080 private:
00081   FB2ContentMap &m_notes;
00082   FB2ContentMap &m_bitmaps;
00083   std::string m_currentID;
00084   GroupContent *m_currentNote;
00085   GroupContent *m_currentPara;
00086   const FB2Style *m_currentStyle;
00087 };
00088 
00089 }
00090 
00091 #endif // FB2EXTRASCOLLECTOR_H_INCLUDED
00092 
00093 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */