| 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ |
| 2 | /* librevenge |
| 3 | * Version: MPL 2.0 / LGPLv2.1+ |
| 4 | * |
| 5 | * This Source Code Form is subject to the terms of the Mozilla Public |
| 6 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 7 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 8 | * |
| 9 | * Major Contributor(s): |
| 10 | * Copyright (C) 2002-2004 William Lachance ([email protected]) |
| 11 | * Copyright (C) 2002 Marc Maurer ([email protected]) |
| 12 | * Copyright (C) 2004 Fridrich Strba ([email protected]) |
| 13 | * Copyright (C) 2005 Net Integration Technologies (http://www.net-itech.com) |
| 14 | * |
| 15 | * For minor contributions see the git repository. |
| 16 | * |
| 17 | * Alternatively, the contents of this file may be used under the terms |
| 18 | * of the GNU Lesser General Public License Version 2.1 or later |
| 19 | * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are |
| 20 | * applicable instead of those above. |
| 21 | */ |
| 22 | |
| 23 | #ifndef RVNGHTMLTEXT_TABLESTYLE_H |
| 24 | #define RVNGHTMLTEXT_TABLESTYLE_H |
| 25 | |
| 26 | #include <librevenge/librevenge.h> |
| 27 | |
| 28 | #include <ostream> |
| 29 | #include <string> |
| 30 | #include <map> |
| 31 | #include <vector> |
| 32 | |
| 33 | namespace librevenge |
| 34 | { |
| 35 | /** Small class to manage the tables style */ |
| 36 | class RVNGHTMLTextTableStyleManager |
| 37 | { |
| 38 | public: |
| 39 | //! constructor |
| 40 | RVNGHTMLTextTableStyleManager() : m_cellContentNameMap(), m_rowContentNameMap(), m_columWitdhsStack() |
| 41 | { |
| 42 | } |
| 43 | //! destructor |
| 44 | ~RVNGHTMLTextTableStyleManager() |
| 45 | { |
| 46 | } |
| 47 | //! open a table |
| 48 | void openTable(RVNGPropertyListVector const &colList); |
| 49 | //! close a table |
| 50 | void closeTable(); |
| 51 | //! returns the class name corresponding to a propertylist |
| 52 | std::string getCellClass(RVNGPropertyList const &pList); |
| 53 | //! returns the class name corresponding to a propertylist |
| 54 | std::string getRowClass(RVNGPropertyList const &pList); |
| 55 | //! send the data to the stream |
| 56 | void send(std::ostream &out); |
| 57 | private: |
| 58 | //! convert a property list in a html content string |
| 59 | std::string getCellContent(RVNGPropertyList const &pList) const; |
| 60 | //! convert a property list in a html content string |
| 61 | static std::string getRowContent(RVNGPropertyList const &pList); |
| 62 | //! try to return the col width |
| 63 | bool getColumnsWidth(int i, int numSpanned, double &w) const; |
| 64 | //! a map cell content -> name |
| 65 | std::map<std::string, std::string> m_cellContentNameMap; |
| 66 | //! a map row content -> name |
| 67 | std::map<std::string, std::string> m_rowContentNameMap; |
| 68 | //! a stack of column width (in inches ) |
| 69 | std::vector<std::vector<double> > m_columWitdhsStack; |
| 70 | |
| 71 | RVNGHTMLTextTableStyleManager(RVNGHTMLTextTableStyleManager const &orig); |
| 72 | RVNGHTMLTextTableStyleManager operator=(RVNGHTMLTextTableStyleManager const &orig); |
| 73 | }; |
| 74 | } |
| 75 | #endif |
| 76 | /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */ |