- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

WPSParagraph.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* libwps
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) 2009, 2011 Alonso Laurent (alonso@loria.fr)
11 * Copyright (C) 2006, 2007 Andrew Ziem
12 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
13 * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
14 * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
15 *
16 * For minor contributions see the git repository.
17 *
18 * Alternatively, the contents of this file may be used under the terms
19 * of the GNU Lesser General Public License Version 2.1 or later
20 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
21 * applicable instead of those above.
22 *
23 * For further information visit http://libwps.sourceforge.net
24 */
25
26 #ifndef WPS_PARAGRAPH
27 # define WPS_PARAGRAPH
28
29 #include <assert.h>
30 #include <iostream>
31
32 #include <vector>
33
34 #include "libwps_internal.h"
35
36 #include "WPSList.h"
37
38 class WPSContentListener;
39 class WPXPropertyListVector;
40
41 struct WPSTabStop
42 {
43 enum Alignment { LEFT, RIGHT, CENTER, DECIMAL, BAR };
44 WPSTabStop(double position = 0.0, Alignment alignment = LEFT, uint16_t leaderCharacter='\0', uint8_t leaderNumSpaces = 0) :
45 m_position(position), m_alignment(alignment), m_leaderCharacter(leaderCharacter), m_leaderNumSpaces(leaderNumSpaces)
46 {
47 }
48 void addTo(WPXPropertyListVector &propList, double decalX=0.0);
50 friend std::ostream &operator<<(std::ostream &o, WPSTabStop const &ft);
51 double m_position;
52 Alignment m_alignment;
53 uint16_t m_leaderCharacter;
54 uint8_t m_leaderNumSpaces;
55 };
56
58 struct WPSParagraph
59 {
60 typedef WPSList::Level ListLevel;
61
63 WPSParagraph() : m_tabs(), m_justify(libwps::JustificationLeft),
64 m_breakStatus(0), m_listLevelIndex(0), m_listLevel(), m_backgroundColor(0xFFFFFF),
65 m_border(0), m_borderStyle(), m_extra("")
66 {
67 for(int i = 0; i < 3; i++) m_margins[i] = m_spacings[i] = 0.0;
68 m_spacings[0] = 1.0; // interline normal
69 }
70 virtual ~WPSParagraph() {}
72 void send(shared_ptr<WPSContentListener> listener) const;
74 friend std::ostream &operator<<(std::ostream &o, WPSParagraph const &ft);
75
81 double m_margins[3]; // 0: first line left, 1: left, 2: right
87 double m_spacings[3]; // 0: interline, 1: before, 2: after
89 std::vector<WPSTabStop> m_tabs;
90
92 libwps::Justification m_justify;
94 int m_breakStatus; // BITS: 1: unbreakable, 2: dont break after
95
97 int m_listLevelIndex;
99 ListLevel m_listLevel;
100
102 uint32_t m_backgroundColor;
103
105 int m_border;
107 WPSBorder m_borderStyle;
108
110 std::string m_extra;
111 };
112 #endif
113 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */