WPSParagraph.h Source File documentation

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 <iostream>
30
31 #include <vector>
32
33 #include "libwps_internal.h"
34
35 #include "WPSList.h"
36
37 struct WPSTabStop
38 {
39 enum Alignment { LEFT, RIGHT, CENTER, DECIMAL, BAR };
40 WPSTabStop(double position = 0.0, Alignment alignment = LEFT, uint16_t leaderCharacter='\0', uint8_t leaderNumSpaces = 0)
41 : m_position(position)
42 , m_alignment(alignment)
43 , m_leaderCharacter(leaderCharacter)
44 , m_leaderNumSpaces(leaderNumSpaces)
45 {
46 }
47 void addTo(librevenge::RVNGPropertyListVector &propList, double decalX=0.0) const;
49 friend std::ostream &operator<<(std::ostream &o, WPSTabStop const &ft);
50 double m_position;
51 Alignment m_alignment;
52 uint16_t m_leaderCharacter;
53 uint8_t m_leaderNumSpaces;
54 };
55
57 struct WPSParagraph
58 {
59 typedef WPSList::Level ListLevel;
61 enum LineSpacingType { Fixed, AtLeast };
62
64 WPSParagraph()
65 : m_spacingsInterlineUnit(librevenge::RVNG_PERCENT)
66 , m_spacingsInterlineType(Fixed)
67 , m_tabs()
68 , m_justify(libwps::JustificationLeft)
69 , m_breakStatus(0)
70 , m_listLevelIndex(0)
71 , m_listLevel()
72 , m_backgroundColor(WPSColor::white())
73 , m_border(0)
74 , m_borderStyle()
75 , m_extra("")
76 {
77 for (int i = 0; i < 3; i++) m_margins[i] = m_spacings[i] = 0.0;
78 m_spacings[0] = 1.0; // interline normal
79 }
80 // destructor
81 virtual ~WPSParagraph() {}
83 void addTo(librevenge::RVNGPropertyList &propList, bool inTable) const;
85 void setInterline(double value, librevenge::RVNGUnit unit, LineSpacingType type=Fixed)
86 {
87 m_spacings[0]=value;
88 m_spacingsInterlineUnit=unit;
89 m_spacingsInterlineType=type;
90 }
92 friend std::ostream &operator<<(std::ostream &o, WPSParagraph const &ft);
93
99 double m_margins[3]; // 0: first line left, 1: left, 2: right
105 double m_spacings[3]; // 0: interline, 1: before, 2: after
107 librevenge::RVNGUnit m_spacingsInterlineUnit;
109 LineSpacingType m_spacingsInterlineType;
111 std::vector<WPSTabStop> m_tabs;
112
114 libwps::Justification m_justify;
116 int m_breakStatus; // BITS: 1: unbreakable, 2: dont break after
117
119 int m_listLevelIndex;
121 ListLevel m_listLevel;
122
124 WPSColor m_backgroundColor;
125
127 int m_border;
129 WPSBorder m_borderStyle;
130
132 std::string m_extra;
133 };
134 #endif
135 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
WPSTabStop::CENTER
Definition: WPSParagraph.h:39
WPSParagraph::m_justify
libwps::Justification m_justify
the justification
Definition: WPSParagraph.h:114
WPSParagraph::ListLevel
WPSList::Level ListLevel
Definition: WPSParagraph.h:59
WPSParagraph::m_breakStatus
int m_breakStatus
a list of bits: 0x1 (unbreakable), 0x2 (do not break after)
Definition: WPSParagraph.h:116
WPSParagraph
class to store the paragraph properties
Definition: WPSParagraph.h:57
WPSBorder
a border list
Definition: libwps_internal.h:394
libwps
Definition: libwps_internal.cpp:38
WPSParagraph::m_margins
double m_margins[3]
the margins
Definition: WPSParagraph.h:99
librevenge
Definition: WPSOLEStream.h:33
WPSList.h
WPSParagraph::setInterline
void setInterline(double value, librevenge::RVNGUnit unit, LineSpacingType type=Fixed)
set the interline
Definition: WPSParagraph.h:85
WPSTabStop::BAR
Definition: WPSParagraph.h:39
WPSTabStop::Alignment
Alignment
Definition: WPSParagraph.h:39
WPSParagraph::AtLeast
Definition: WPSParagraph.h:61
WPSTabStop::addTo
void addTo(librevenge::RVNGPropertyListVector &propList, double decalX=0.0) const
Definition: WPSParagraph.cpp:37
WPSParagraph::m_listLevelIndex
int m_listLevelIndex
the actual level index
Definition: WPSParagraph.h:119
libwps::Justification
Justification
Definition: libwps_internal.h:249
WPSParagraph::m_spacings
double m_spacings[3]
the line spacing
Definition: WPSParagraph.h:105
WPSList::Level
small structure to keep information about a level
Definition: WPSList.h:40
WPSParagraph::Fixed
Definition: WPSParagraph.h:61
WPSParagraph::m_tabs
std::vector< WPSTabStop > m_tabs
the tabulations
Definition: WPSParagraph.h:111
WPSParagraph::WPSParagraph
WPSParagraph()
constructor
Definition: WPSParagraph.h:64
WPSParagraph::m_border
int m_border
list of bits to indicated a border 1: LeftBorderBit, 2: RightBorderBit, ...
Definition: WPSParagraph.h:127
WPSTabStop::m_alignment
Alignment m_alignment
Definition: WPSParagraph.h:51
libwps_internal.h
WPSTabStop::m_leaderCharacter
uint16_t m_leaderCharacter
Definition: WPSParagraph.h:52
WPSParagraph::m_spacingsInterlineType
LineSpacingType m_spacingsInterlineType
the interline type: fixed, atLeast, ...
Definition: WPSParagraph.h:109
WPSParagraph::m_spacingsInterlineUnit
librevenge::RVNGUnit m_spacingsInterlineUnit
the interline unit PERCENT or INCH, ...
Definition: WPSParagraph.h:107
WPSParagraph::m_extra
std::string m_extra
a string to store some errors
Definition: WPSParagraph.h:132
WPSParagraph::~WPSParagraph
virtual ~WPSParagraph()
Definition: WPSParagraph.h:81
WPSTabStop::WPSTabStop
WPSTabStop(double position=0.0, Alignment alignment=LEFT, uint16_t leaderCharacter='\0', uint8_t leaderNumSpaces=0)
Definition: WPSParagraph.h:40
WPSTabStop::LEFT
Definition: WPSParagraph.h:39
WPSColor
the class to store a color
Definition: libwps_internal.h:280
WPSParagraph::operator<<
friend std::ostream & operator<<(std::ostream &o, WPSParagraph const &ft)
operator <<
Definition: WPSParagraph.cpp:110
WPSTabStop::operator<<
friend std::ostream & operator<<(std::ostream &o, WPSTabStop const &ft)
operator <<
Definition: WPSParagraph.cpp:79
WPSTabStop::m_position
double m_position
Definition: WPSParagraph.h:50
WPSTabStop::m_leaderNumSpaces
uint8_t m_leaderNumSpaces
Definition: WPSParagraph.h:53
WPSTabStop
Definition: WPSParagraph.h:37
WPSParagraph::m_borderStyle
WPSBorder m_borderStyle
the border style
Definition: WPSParagraph.h:129
WPSParagraph::LineSpacingType
LineSpacingType
the line spacing type: fixed or at least
Definition: WPSParagraph.h:61
libwps::JustificationLeft
Definition: libwps_internal.h:249
WPSParagraph::m_backgroundColor
WPSColor m_backgroundColor
the background color
Definition: WPSParagraph.h:124
WPSParagraph::m_listLevel
ListLevel m_listLevel
the actual level
Definition: WPSParagraph.h:121
WPSParagraph::addTo
void addTo(librevenge::RVNGPropertyList &propList, bool inTable) const
add to the propList
Definition: WPSParagraph.cpp:189
WPSTabStop::DECIMAL
Definition: WPSParagraph.h:39
WPSTabStop::RIGHT
Definition: WPSParagraph.h:39