1 /* ListStyle: Stores (and writes) list-based information that is
2  * needed at the head of an OO document.
3  *
4  * Copyright (C) 2002-2003 William Lachance (william.lachance@sympatico.ca)
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19  *
20  * For further information visit http://libwpd.sourceforge.net
21  *
22  */
23 
24 /* "This product is not manufactured, approved, or supported by
25  * Corel Corporation or Corel Corporation Limited."
26  */
27 #ifndef _LISTSTYLE_H
28 #define _LISTSTYLE_H
29 #if defined _MSC_VER
30 #pragma warning( push, 1 )
31 #endif
32 #include <libwpd/libwpd.h>
33 #if defined _MSC_VER
34 #pragma warning( pop )
35 #endif
36 
37 #define WP6_NUM_LIST_LEVELS 8 // see WP6FileStructure.h (we shouldn't need to reference this)
38 
39 #include "Style.hxx"
40 #include "WriterProperties.hxx"
41 
42 class DocumentElement;
43 
44 class ListLevelStyle
45 {
46 public:
~ListLevelStyle()47 	virtual ~ListLevelStyle() {};
48 	virtual void write(DocumentHandler *pHandler, int iLevel) const = 0;
49 };
50 
51 class OrderedListLevelStyle : public ListLevelStyle
52 {
53 public:
54 	OrderedListLevelStyle(const WPXPropertyList &xPropList);
55 	void write(DocumentHandler *pHandler, int iLevel) const;
56 private:
57         WPXPropertyList mPropList;
58 };
59 
60 class UnorderedListLevelStyle : public ListLevelStyle
61 {
62 public:
63 	UnorderedListLevelStyle(const WPXPropertyList &xPropList);
64 	void write(DocumentHandler *pHandler, int iLevel) const;
65 private:
66         WPXPropertyList mPropList;
67 };
68 
69 class ListStyle : public Style
70 {
71 public:
72 	ListStyle(const char *psName, const int iListID);
73 	virtual ~ListStyle();
74 	virtual void updateListLevel(const int iLevel, const WPXPropertyList &xPropList) = 0;
75 	virtual void write(DocumentHandler *pHandler) const;
getListID() const76 	int getListID() const { return miListID; }
77 	bool isListLevelDefined(int iLevel) const;
78 
79 protected:
80 	void setListLevel(int iLevel, ListLevelStyle *iListLevelStyle);
81 
82 private:
83 	ListLevelStyle *mppListLevels[WP6_NUM_LIST_LEVELS];
84 	int miNumListLevels;
85 	const int miListID;
86 };
87 
88 class OrderedListStyle : public ListStyle
89 {
90 public:
OrderedListStyle(const char * psName,const int iListID)91 	OrderedListStyle(const char *psName, const int iListID) : ListStyle(psName, iListID) {}
92 	void updateListLevel(const int iLevel, const WPXPropertyList &xPropList);
93 };
94 
95 class UnorderedListStyle : public ListStyle
96 {
97 public:
UnorderedListStyle(const char * psName,const int iListID)98 	UnorderedListStyle(const char *psName, const int iListID) : ListStyle(psName, iListID) {}
99 	void updateListLevel(const int iLevel, const WPXPropertyList &xPropList);
100 };
101 #endif
102