XMLCollector.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 libe-book 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 XMLCOLLECTOR_H_INCLUDED
00011 #define XMLCOLLECTOR_H_INCLUDED
00012 
00013 #include <string>
00014 
00015 #include <boost/shared_ptr.hpp>
00016 
00017 #include <librevenge/librevenge.h>
00018 
00019 #include "XMLTreeWalker.h"
00020 
00021 namespace libebook
00022 {
00023 
00024 class XMLCollector
00025 {
00026   // disable copying
00027   XMLCollector(const XMLCollector &);
00028   XMLCollector &operator=(const XMLCollector &);
00029 
00030 public:
00031   struct State;
00032 
00033 public:
00034   explicit XMLCollector(librevenge::RVNGTextInterface *document);
00035 
00036   void collectMetadata(const librevenge::RVNGPropertyList &metadata);
00037 
00038   void collectText(const std::string &text);
00039   void collectSpace();
00040   void collectTab();
00041   void collectLineBreak();
00042 
00043   void collectImage(const librevenge::RVNGPropertyList &props);
00044 
00045   void collectCoveredTableCell(const librevenge::RVNGPropertyList &props);
00046 
00047   void openPageSpan(const librevenge::RVNGPropertyList &props);
00048   void closePageSpan();
00049   void openHeader(const librevenge::RVNGPropertyList &props);
00050   void closeHeader();
00051   void openFooter(const librevenge::RVNGPropertyList &props);
00052   void closeFooter();
00053   void openFootnote(const librevenge::RVNGPropertyList &props);
00054   void closeFootnote();
00055 
00056   void openParagraph(const librevenge::RVNGPropertyList &props);
00057   void closeParagraph();
00058   void openSpan(const librevenge::RVNGPropertyList &props);
00059   void closeSpan();
00060   void openLink(const librevenge::RVNGPropertyList &props);
00061   void closeLink();
00062 
00063   void openTable(const librevenge::RVNGPropertyList &props);
00064   void closeTable();
00065   void openTableRow(const librevenge::RVNGPropertyList &props);
00066   void closeTableRow();
00067   void openTableCell(const librevenge::RVNGPropertyList &props);
00068   void closeTableCell();
00069 
00070   void openOrderedList(const librevenge::RVNGPropertyList &props);
00071   void closeOrderedList();
00072   void openUnorderedList(const librevenge::RVNGPropertyList &props);
00073   void closeUnorderedList();
00074 
00075   void openListElement(const librevenge::RVNGPropertyList &props);
00076   void closeListElement();
00077 
00078   void openObject(const librevenge::RVNGPropertyList &props);
00079   void closeObject();
00080 
00083   void finish();
00084 
00085 private:
00086   librevenge::RVNGTextInterface *const m_document;
00087   boost::shared_ptr<State> m_state;
00088 };
00089 
00090 }
00091 
00092 #endif // XMLCOLLECTOR_H_INCLUDED
00093 
00094 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */