ABWStylesCollector.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 libabw 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 __ABWSTYLESCOLLECTOR_H__
00011 #define __ABWSTYLESCOLLECTOR_H__
00012 
00013 #include <stack>
00014 #include <librevenge/librevenge.h>
00015 #include "ABWCollector.h"
00016 
00017 namespace libabw
00018 {
00019 
00020 struct ABWStylesTableState
00021 {
00022   ABWStylesTableState();
00023   ABWStylesTableState(const ABWStylesTableState &ts);
00024   ~ABWStylesTableState();
00025 
00026   ABWPropertyMap m_currentCellProperties;
00027 
00028   int m_currentTableWidth;
00029   int m_currentTableRow;
00030   int m_currentTableId;
00031 };
00032 
00033 struct ABWStylesParsingState
00034 {
00035   ABWStylesParsingState();
00036   ABWStylesParsingState(const ABWStylesParsingState &ps);
00037   ~ABWStylesParsingState();
00038 
00039   std::stack<ABWStylesTableState> m_tableStates;
00040 };
00041 
00042 class ABWStylesCollector : public ABWCollector
00043 {
00044 public:
00045   ABWStylesCollector(std::map<int, int> &tableSizes,
00046                      std::map<std::string, ABWData> &data,
00047                      std::map<int, ABWListElement *> &listElements);
00048   virtual ~ABWStylesCollector();
00049 
00050   // collector functions
00051 
00052   void collectTextStyle(const char *, const char *, const char *, const char *) {}
00053   void collectDocumentProperties(const char *) {}
00054   void collectParagraphProperties(const char *level, const char *listid, const char *parentid,
00055                                   const char *style, const char *props);
00056   void collectSectionProperties(const char *, const char *, const char *, const char *,
00057                                 const char *, const char *, const char *, const char *,
00058                                 const char *) {}
00059   void collectCharacterProperties(const char *, const char *) {}
00060   void collectPageSize(const char *, const char *, const char *, const char *) {}
00061   void closeParagraphOrListElement() {}
00062   void closeSpan() {}
00063   void openLink(const char *) {}
00064   void closeLink() {}
00065   void openFoot(const char *) {}
00066   void closeFoot() {}
00067   void openEndnote(const char *) {}
00068   void closeEndnote() {}
00069   void endSection() {}
00070   void startDocument() {}
00071   void endDocument() {}
00072   void insertLineBreak() {}
00073   void insertColumnBreak() {}
00074   void insertPageBreak() {}
00075   void insertText(const char *) {}
00076   void insertImage(const char *, const char *) {}
00077 
00078   void collectData(const char *name, const char *mimeType, const librevenge::RVNGBinaryData &data);
00079   void collectHeaderFooter(const char *, const char *) {}
00080   void collectList(const char *id, const char *listDecimal, const char *listDelim,
00081                    const char *parentid, const char *startValue, const char *type);
00082 
00083   void openTable(const char *props);
00084   void closeTable();
00085   void openCell(const char *props);
00086   void closeCell();
00087 
00088   void addMetadataEntry(const char *, const char *) {}
00089 
00090 private:
00091   ABWStylesCollector(const ABWStylesCollector &);
00092   ABWStylesCollector &operator=(const ABWStylesCollector &);
00093 
00094   std::string _findCellProperty(const char *name);
00095   void _processList(int id, const char *listDelim, int parentid, int startValue, int type);
00096 
00097   ABWStylesParsingState *m_ps;
00098   std::map<int, int> &m_tableSizes;
00099   std::map<std::string, ABWData> &m_data;
00100   int m_tableCounter;
00101   std::map<int, ABWListElement *> &m_listElements;
00102 };
00103 
00104 } // namespace libabw
00105 
00106 #endif /* __ABWSTYLESCOLLECTOR_H__ */
00107 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */