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
50 explicit MWAWTabStop(double position = 0.0, Alignment alignment = LEFT, uint16_t leaderCharacter='\0', uint16_t decimalCharacter = '.')
51 : m_position(position)
52 , m_alignment(alignment)
53 , m_leaderCharacter(leaderCharacter)
54 , m_decimalCharacter(decimalCharacter)
55 {
56 }
58 void addTo(librevenge::RVNGPropertyListVector &propList, double decalX=0.0) const;
60 bool operator==(MWAWTabStop const &tabs) const
61 {
62 return cmp(tabs)==0;
63 }
65 bool operator!=(MWAWTabStop const &tabs) const
66 {
67 return cmp(tabs)!=0;
68 }
70 friend std::ostream &operator<<(std::ostream &o, MWAWTabStop const &ft);
72 int cmp(MWAWTabStop const &tabs) const;
74 double m_position;
81};
82
85{
86public:
88 enum { NoBreakBit = 0x1, NoBreakWithNextBit=0x2 };
92 };
95
98 MWAWParagraph(MWAWParagraph const &)=default;
102 virtual ~MWAWParagraph();
104 bool operator==(MWAWParagraph const &p) const
105 {
106 return cmp(p)==0;
107 }
109 bool operator!=(MWAWParagraph const &p) const
110 {
111 return cmp(p)!=0;
112 }
114 int cmp(MWAWParagraph const &p) const;
116 double getMarginsWidth() const;
118 bool hasBorders() const;
120 bool hasDifferentBorders() const;
122 void resizeBorders(size_t newSize)
123 {
124 MWAWBorder empty;
126 m_borders.resize(newSize, MWAWVariable<MWAWBorder>(empty));
127 }
129 void setInterline(double value, librevenge::RVNGUnit unit, LineSpacingType type=Fixed)
130 {
131 m_spacings[0]=value;
134 }
136 void addTo(librevenge::RVNGPropertyList &propList, bool inTable) const;
137
139 void insert(MWAWParagraph const &para);
141 friend std::ostream &operator<<(std::ostream &o, MWAWParagraph const &ft);
142
148 MWAWVariable<double> m_margins[3]; // 0: first line left, 1: left, 2: right
156 MWAWVariable<double> m_spacings[3]; // 0: interline, 1: before, 2: after
165
169 MWAWVariable<int> m_breakStatus; // BITS: 1: unbreakable, 2: dont break after
172
181
184
186 std::vector<MWAWVariable<MWAWBorder> > m_borders;
191
193 std::string m_styleName;
195 std::string m_extra;
196};
197#endif
198// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
class to store the paragraph properties
Definition: MWAWParagraph.hxx:85
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:164
MWAWVariable< int > m_breakStatus
a list of bits: 0x1 (unbreakable), 0x2 (do not break after)
Definition: MWAWParagraph.hxx:169
bool hasDifferentBorders() const
check if the paragraph has different borders
Definition: MWAWParagraph.cxx:294
bool hasBorders() const
check if the paragraph has some borders
Definition: MWAWParagraph.cxx:283
MWAWVariable< MWAWColor > m_backgroundColor
the background color
Definition: MWAWParagraph.hxx:183
MWAWVariable< libmwaw::WritingMode > m_writingMode
the writing mode
Definition: MWAWParagraph.hxx:171
friend std::ostream & operator<<(std::ostream &o, MWAWParagraph const &ft)
operator <<
Definition: MWAWParagraph.cxx:447
void setInterline(double value, librevenge::RVNGUnit unit, LineSpacingType type=Fixed)
set the interline
Definition: MWAWParagraph.hxx:129
MWAWVariable< LineSpacingType > m_spacingsInterlineType
the interline type: fixed, atLeast, ...
Definition: MWAWParagraph.hxx:160
MWAWVariable< double > m_spacings[3]
the line spacing
Definition: MWAWParagraph.hxx:156
MWAWParagraph & operator=(MWAWParagraph const &)=default
MWAWParagraph()
constructor
Definition: MWAWParagraph.cxx:145
@ NoBreakWithNextBit
Definition: MWAWParagraph.hxx:88
@ NoBreakBit
Definition: MWAWParagraph.hxx:88
MWAWVariable< int > m_dropNumCharacters
the drop number character
Definition: MWAWParagraph.hxx:188
void resizeBorders(size_t newSize)
a function used to resize the borders list ( adding empty borders if needed )
Definition: MWAWParagraph.hxx:122
MWAWVariable< int > m_listStartValue
the list start value (if set )
Definition: MWAWParagraph.hxx:178
MWAWVariable< Justification > m_justify
the justification
Definition: MWAWParagraph.hxx:167
MWAWVariable< MWAWListLevel > m_listLevel
the actual level
Definition: MWAWParagraph.hxx:180
MWAWVariable< std::vector< MWAWTabStop > > m_tabs
the tabulations
Definition: MWAWParagraph.hxx:162
void insert(MWAWParagraph const &para)
insert the set values of para in the actual paragraph
Definition: MWAWParagraph.cxx:242
MWAWParagraph & operator=(MWAWParagraph &&)=default
int cmp(MWAWParagraph const &p) const
a comparison function
Definition: MWAWParagraph.cxx:183
Justification
an enum used to defined the paragraph justification: left, center, right, full ...
Definition: MWAWParagraph.hxx:90
@ JustificationRight
Definition: MWAWParagraph.hxx:91
@ JustificationFullAllLines
Definition: MWAWParagraph.hxx:91
@ JustificationLeft
Definition: MWAWParagraph.hxx:90
@ JustificationCenter
Definition: MWAWParagraph.hxx:90
@ JustificationFull
Definition: MWAWParagraph.hxx:90
double getMarginsWidth() const
return the paragraph margin width (in inches)
Definition: MWAWParagraph.cxx:307
std::vector< MWAWVariable< MWAWBorder > > m_borders
list of border ( order MWAWBorder::Pos)
Definition: MWAWParagraph.hxx:186
virtual ~MWAWParagraph()
destructor
Definition: MWAWParagraph.cxx:179
bool operator!=(MWAWParagraph const &p) const
operator!=
Definition: MWAWParagraph.hxx:109
MWAWParagraph(MWAWParagraph const &)=default
MWAWVariable< librevenge::RVNGUnit > m_marginsUnit
the margins INCH, ...
Definition: MWAWParagraph.hxx:150
void addTo(librevenge::RVNGPropertyList &propList, bool inTable) const
add to the propList
Definition: MWAWParagraph.cxx:313
MWAWVariable< int > m_listLevelIndex
the actual level index
Definition: MWAWParagraph.hxx:174
std::string m_styleName
the style name
Definition: MWAWParagraph.hxx:193
LineSpacingType
the line spacing type: fixed or at least
Definition: MWAWParagraph.hxx:94
@ AtLeast
Definition: MWAWParagraph.hxx:94
@ Fixed
Definition: MWAWParagraph.hxx:94
MWAWVariable< int > m_listId
the list id (if know )
Definition: MWAWParagraph.hxx:176
std::string m_extra
a string to store some errors
Definition: MWAWParagraph.hxx:195
MWAWVariable< double > m_margins[3]
the margins
Definition: MWAWParagraph.hxx:148
bool operator==(MWAWParagraph const &p) const
operator==
Definition: MWAWParagraph.hxx:104
MWAWVariable< int > m_dropNumLines
the drop number of lines
Definition: MWAWParagraph.hxx:190
MWAWVariable< librevenge::RVNGUnit > m_spacingsInterlineUnit
the interline unit PERCENT or INCH, ...
Definition: MWAWParagraph.hxx:158
a border
Definition: libmwaw_internal.hxx:333
Style m_style
the border style
Definition: libmwaw_internal.hxx:380
@ None
Definition: libmwaw_internal.hxx:335
class to store a tab use by MWAWParagraph
Definition: MWAWParagraph.hxx:46
double m_position
the tab position
Definition: MWAWParagraph.hxx:74
uint16_t m_decimalCharacter
the decimal char
Definition: MWAWParagraph.hxx:80
uint16_t m_leaderCharacter
the leader char
Definition: MWAWParagraph.hxx:78
Alignment
the tab alignment
Definition: MWAWParagraph.hxx:48
@ CENTER
Definition: MWAWParagraph.hxx:48
@ BAR
Definition: MWAWParagraph.hxx:48
@ LEFT
Definition: MWAWParagraph.hxx:48
@ RIGHT
Definition: MWAWParagraph.hxx:48
@ DECIMAL
Definition: MWAWParagraph.hxx:48
MWAWTabStop(double position=0.0, Alignment alignment=LEFT, uint16_t leaderCharacter='\0', uint16_t decimalCharacter='.')
constructor
Definition: MWAWParagraph.hxx:50
bool operator==(MWAWTabStop const &tabs) const
operator==
Definition: MWAWParagraph.hxx:60
void addTo(librevenge::RVNGPropertyListVector &propList, double decalX=0.0) const
add a tab to the propList
Definition: MWAWParagraph.cxx:48
friend std::ostream & operator<<(std::ostream &o, MWAWTabStop const &ft)
operator <<
Definition: MWAWParagraph.cxx:109
int cmp(MWAWTabStop const &tabs) const
a comparison function
Definition: MWAWParagraph.cxx:95
Alignment m_alignment
the alignment ( left, center, ...)
Definition: MWAWParagraph.hxx:76
bool operator!=(MWAWTabStop const &tabs) const
operator!=
Definition: MWAWParagraph.hxx:65
a generic variable template: value + flag to know if the variable is set
Definition: libmwaw_internal.hxx:577

Generated on Thu Jan 19 2023 00:00:00 for libmwaw by doxygen 1.9.6