MWAWParagraph.hxx Source File documentation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

MWAWParagraph.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
3 /* libmwaw
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33
34 #ifndef MWAW_PARAGRAPH
35 # define MWAW_PARAGRAPH
36
37 #include <iostream>
38 #include <vector>
39
40 #include <librevenge/librevenge.h>
41
42 #include "libmwaw_internal.hxx"
43 #include "MWAWList.hxx"
44
46 struct MWAWTabStop {
48 enum Alignment { LEFT, RIGHT, CENTER, DECIMAL, BAR };
50 MWAWTabStop(double position = 0.0, Alignment alignment = LEFT, uint16_t leaderCharacter='\0', uint16_t decimalCharacter = '.') :
51 m_position(position), m_alignment(alignment), m_leaderCharacter(leaderCharacter), m_decimalCharacter(decimalCharacter)
52 {
53 }
55 void addTo(librevenge::RVNGPropertyListVector &propList, double decalX=0.0) const;
57 bool operator==(MWAWTabStop const &tabs) const
58 {
59 return cmp(tabs)==0;
60 }
62 bool operator!=(MWAWTabStop const &tabs) const
63 {
64 return cmp(tabs)!=0;
65 }
67 friend std::ostream &operator<<(std::ostream &o, MWAWTabStop const &ft);
69 int cmp(MWAWTabStop const &tabs) const;
71 double m_position;
73 Alignment m_alignment;
75 uint16_t m_leaderCharacter;
77 uint16_t m_decimalCharacter;
78 };
79
81 class MWAWParagraph
82 {
83 public:
85 enum { NoBreakBit = 0x1, NoBreakWithNextBit=0x2 };
87 enum Justification { JustificationLeft, JustificationFull, JustificationCenter,
88 JustificationRight, JustificationFullAllLines
89 };
91 enum LineSpacingType { Fixed, AtLeast};
92
94 MWAWParagraph();
96 virtual ~MWAWParagraph();
98 bool operator==(MWAWParagraph const &p) const
99 {
100 return cmp(p)==0;
101 }
103 bool operator!=(MWAWParagraph const &p) const
104 {
105 return cmp(p)!=0;
106 }
108 int cmp(MWAWParagraph const &p) const;
110 double getMarginsWidth() const;
112 bool hasBorders() const;
114 bool hasDifferentBorders() const;
116 void resizeBorders(size_t newSize)
117 {
118 MWAWBorder empty;
119 empty.m_style=MWAWBorder::None;
120 m_borders.resize(newSize, MWAWVariable<MWAWBorder>(empty));
121 }
123 void setInterline(double value, librevenge::RVNGUnit unit, LineSpacingType type=Fixed)
124 {
125 m_spacings[0]=value;
126 m_spacingsInterlineUnit=unit;
127 m_spacingsInterlineType=type;
128 }
130 void addTo(librevenge::RVNGPropertyList &propList, bool inTable) const;
131
133 void insert(MWAWParagraph const &para);
135 friend std::ostream &operator<<(std::ostream &o, MWAWParagraph const &ft);
136
142 MWAWVariable<double> m_margins[3]; // 0: first line left, 1: left, 2: right
144 MWAWVariable<librevenge::RVNGUnit> m_marginsUnit;
150 MWAWVariable<double> m_spacings[3]; // 0: interline, 1: before, 2: after
152 MWAWVariable<librevenge::RVNGUnit> m_spacingsInterlineUnit;
154 MWAWVariable<LineSpacingType> m_spacingsInterlineType;
156 MWAWVariable<std::vector<MWAWTabStop> > m_tabs;
158 MWAWVariable<bool> m_tabsRelativeToLeftMargin;
159
161 MWAWVariable<Justification> m_justify;
163 MWAWVariable<int> m_breakStatus; // BITS: 1: unbreakable, 2: dont break after
165 MWAWVariable<libmwaw::WritingMode> m_writingMode;
166
168 MWAWVariable<int> m_listLevelIndex;
170 MWAWVariable<int> m_listId;
172 MWAWVariable<int> m_listStartValue;
174 MWAWVariable<MWAWListLevel> m_listLevel;
175
177 MWAWVariable<MWAWColor> m_backgroundColor;
178
180 std::vector<MWAWVariable<MWAWBorder> > m_borders;
182 std::string m_styleName;
184 std::string m_extra;
185 };
186 #endif
187 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWParagraph::m_breakStatus
MWAWVariable< int > m_breakStatus
a list of bits: 0x1 (unbreakable), 0x2 (do not break after)
Definition: MWAWParagraph.hxx:163
MWAWTabStop::RIGHT
Definition: MWAWParagraph.hxx:48
libmwaw_internal.hxx
MWAWTabStop::m_position
double m_position
the tab position
Definition: MWAWParagraph.hxx:71
MWAWTabStop::m_alignment
Alignment m_alignment
the alignment ( left, center, ...)
Definition: MWAWParagraph.hxx:73
MWAWTabStop::m_decimalCharacter
uint16_t m_decimalCharacter
the decimal char
Definition: MWAWParagraph.hxx:77
MWAWParagraph::JustificationRight
Definition: MWAWParagraph.hxx:88
MWAWList.hxx
MWAWTabStop::operator==
bool operator==(MWAWTabStop const &tabs) const
operator==
Definition: MWAWParagraph.hxx:57
MWAWParagraph::operator!=
bool operator!=(MWAWParagraph const &p) const
operator!=
Definition: MWAWParagraph.hxx:103
MWAWParagraph::m_listLevelIndex
MWAWVariable< int > m_listLevelIndex
the actual level index
Definition: MWAWParagraph.hxx:168
MWAWParagraph::m_borders
std::vector< MWAWVariable< MWAWBorder > > m_borders
list of border ( order MWAWBorder::Pos)
Definition: MWAWParagraph.hxx:180
MWAWTabStop::CENTER
Definition: MWAWParagraph.hxx:48
MWAWTabStop::MWAWTabStop
MWAWTabStop(double position=0.0, Alignment alignment=LEFT, uint16_t leaderCharacter='\0', uint16_t decimalCharacter= '.')
constructor
Definition: MWAWParagraph.hxx:50
MWAWTabStop::m_leaderCharacter
uint16_t m_leaderCharacter
the leader char
Definition: MWAWParagraph.hxx:75
MWAWBorder
a border
Definition: libmwaw_internal.hxx:314
MWAWTabStop::cmp
int cmp(MWAWTabStop const &tabs) const
a comparison function
Definition: MWAWParagraph.cxx:95
MWAWTabStop::Alignment
Alignment
the tab alignment
Definition: MWAWParagraph.hxx:48
MWAWTabStop::DECIMAL
Definition: MWAWParagraph.hxx:48
MWAWTabStop::operator!=
bool operator!=(MWAWTabStop const &tabs) const
operator!=
Definition: MWAWParagraph.hxx:62
MWAWTabStop::BAR
Definition: MWAWParagraph.hxx:48
MWAWParagraph::m_spacingsInterlineType
MWAWVariable< LineSpacingType > m_spacingsInterlineType
the interline type: fixed, atLeast, ...
Definition: MWAWParagraph.hxx:154
MWAWBorder::None
Definition: libmwaw_internal.hxx:316
MWAWParagraph::resizeBorders
void resizeBorders(size_t newSize)
a function used to resize the borders list ( adding empty borders if needed )
Definition: MWAWParagraph.hxx:116
MWAWParagraph::m_listStartValue
MWAWVariable< int > m_listStartValue
the list start value (if set )
Definition: MWAWParagraph.hxx:172
MWAWTabStop
class to store a tab use by MWAWParagraph
Definition: MWAWParagraph.hxx:46
MWAWParagraph::m_extra
std::string m_extra
a string to store some errors
Definition: MWAWParagraph.hxx:184
MWAWParagraph::m_tabs
MWAWVariable< std::vector< MWAWTabStop > > m_tabs
the tabulations
Definition: MWAWParagraph.hxx:156
MWAWParagraph::m_styleName
std::string m_styleName
the style name
Definition: MWAWParagraph.hxx:182
MWAWParagraph::setInterline
void setInterline(double value, librevenge::RVNGUnit unit, LineSpacingType type=Fixed)
set the interline
Definition: MWAWParagraph.hxx:123
MWAWParagraph::LineSpacingType
LineSpacingType
the line spacing type: fixed or at least
Definition: MWAWParagraph.hxx:91
MWAWBorder::m_style
Style m_style
the border style
Definition: libmwaw_internal.hxx:350
MWAWTabStop::LEFT
Definition: MWAWParagraph.hxx:48
MWAWParagraph
class to store the paragraph properties
Definition: MWAWParagraph.hxx:81
MWAWParagraph::m_listLevel
MWAWVariable< MWAWListLevel > m_listLevel
the actual level
Definition: MWAWParagraph.hxx:174
MWAWParagraph::m_listId
MWAWVariable< int > m_listId
the list id (if know )
Definition: MWAWParagraph.hxx:170
MWAWParagraph::m_spacingsInterlineUnit
MWAWVariable< librevenge::RVNGUnit > m_spacingsInterlineUnit
the interline unit PERCENT or INCH, ...
Definition: MWAWParagraph.hxx:152
MWAWParagraph::m_marginsUnit
MWAWVariable< librevenge::RVNGUnit > m_marginsUnit
the margins INCH, ...
Definition: MWAWParagraph.hxx:144
MWAWTabStop::operator<<
friend std::ostream & operator<<(std::ostream &o, MWAWTabStop const &ft)
operator <<
Definition: MWAWParagraph.cxx:109
MWAWParagraph::m_justify
MWAWVariable< Justification > m_justify
the justification
Definition: MWAWParagraph.hxx:161
MWAWParagraph::operator==
bool operator==(MWAWParagraph const &p) const
operator==
Definition: MWAWParagraph.hxx:98
MWAWParagraph::Justification
Justification
an enum used to defined the paragraph justification: left, center, right, full ...
Definition: MWAWParagraph.hxx:87
MWAWVariable< MWAWBorder >
MWAWParagraph::m_tabsRelativeToLeftMargin
MWAWVariable< bool > m_tabsRelativeToLeftMargin
true if the tabs are relative to left margin, false if there are relative to the page margin (default...
Definition: MWAWParagraph.hxx:158
MWAWTabStop::addTo
void addTo(librevenge::RVNGPropertyListVector &propList, double decalX=0.0) const
add a tab to the propList
Definition: MWAWParagraph.cxx:48
MWAWParagraph::JustificationLeft
Definition: MWAWParagraph.hxx:87
MWAWParagraph::m_backgroundColor
MWAWVariable< MWAWColor > m_backgroundColor
the background color
Definition: MWAWParagraph.hxx:177
MWAWParagraph::m_writingMode
MWAWVariable< libmwaw::WritingMode > m_writingMode
the writing mode
Definition: MWAWParagraph.hxx:165