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 <libwpd/libwpd.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   std::map<std::string, std::string> 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 collectParagraphProperties(const char *level, const char *listid, const char *parentid,
00054                                   const char *style, const char *props);
00055   void collectSectionProperties(const char *, const char *, const char *, const char *,
00056                                 const char *, const char *, const char *, const char *,
00057                                 const char *) {}
00058   void collectCharacterProperties(const char *, const char *) {}
00059   void collectPageSize(const char *, const char *, const char *, const char *) {}
00060   void closeParagraphOrListElement() {}
00061   void closeSpan() {}
00062   void openLink(const char *) {}
00063   void closeLink() {}
00064   void openFoot(const char *) {}
00065   void closeFoot() {}
00066   void openEndnote(const char *) {}
00067   void closeEndnote() {}
00068   void endSection() {}
00069   void startDocument() {}
00070   void endDocument() {}
00071   void insertLineBreak() {}
00072   void insertColumnBreak() {}
00073   void insertPageBreak() {}
00074   void insertText(const char *) {}
00075   void insertImage(const char *, const char *) {}
00076 
00077   void collectData(const char *name, const char *mimeType, const WPXBinaryData &data);
00078   void collectHeaderFooter(const char *, const char *) {}
00079   void collectList(const char *id, const char *listDecimal, const char *listDelim,
00080                    const char *parentid, const char *startValue, const char *type);
00081 
00082   void openTable(const char *props);
00083   void closeTable();
00084   void openCell(const char *props);
00085   void closeCell();
00086 
00087 private:
00088   ABWStylesCollector(const ABWStylesCollector &);
00089   ABWStylesCollector &operator=(const ABWStylesCollector &);
00090 
00091   std::string _findCellProperty(const char *name);
00092   void _processList(int id, const char *listDelim, int parentid, int startValue, int type);
00093 
00094   ABWStylesParsingState *m_ps;
00095   std::map<int, int> &m_tableSizes;
00096   std::map<std::string, ABWData> &m_data;
00097   int m_tableCounter;
00098   std::map<int, ABWListElement *> &m_listElements;
00099 };
00100 
00101 } // namespace libabw
00102 
00103 #endif /* __ABWSTYLESCOLLECTOR_H__ */
00104 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */