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 {
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 {
86 public:
88  enum { NoBreakBit = 0x1, NoBreakWithNextBit=0x2 };
92  };
95 
97  MWAWParagraph();
98  MWAWParagraph(MWAWParagraph const &)=default;
99  MWAWParagraph &operator=(MWAWParagraph const &)=default;
101  virtual ~MWAWParagraph();
103  bool operator==(MWAWParagraph const &p) const
104  {
105  return cmp(p)==0;
106  }
108  bool operator!=(MWAWParagraph const &p) const
109  {
110  return cmp(p)!=0;
111  }
113  int cmp(MWAWParagraph const &p) const;
115  double getMarginsWidth() const;
117  bool hasBorders() const;
119  bool hasDifferentBorders() const;
121  void resizeBorders(size_t newSize)
122  {
123  MWAWBorder empty;
125  m_borders.resize(newSize, MWAWVariable<MWAWBorder>(empty));
126  }
128  void setInterline(double value, librevenge::RVNGUnit unit, LineSpacingType type=Fixed)
129  {
130  m_spacings[0]=value;
133  }
135  void addTo(librevenge::RVNGPropertyList &propList, bool inTable) const;
136 
138  void insert(MWAWParagraph const &para);
140  friend std::ostream &operator<<(std::ostream &o, MWAWParagraph const &ft);
141 
147  MWAWVariable<double> m_margins[3]; // 0: first line left, 1: left, 2: right
155  MWAWVariable<double> m_spacings[3]; // 0: interline, 1: before, 2: after
164 
168  MWAWVariable<int> m_breakStatus; // BITS: 1: unbreakable, 2: dont break after
171 
180 
183 
185  std::vector<MWAWVariable<MWAWBorder> > m_borders;
187  std::string m_styleName;
189  std::string m_extra;
190 };
191 #endif
192 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWParagraph::Fixed
Definition: MWAWParagraph.hxx:94
MWAWTabStop::operator==
bool operator==(MWAWTabStop const &tabs) const
operator==
Definition: MWAWParagraph.hxx:60
MWAWParagraph::m_justify
MWAWVariable< Justification > m_justify
the justification
Definition: MWAWParagraph.hxx:166
MWAWParagraph::operator==
bool operator==(MWAWParagraph const &p) const
operator==
Definition: MWAWParagraph.hxx:103
MWAWTabStop::LEFT
Definition: MWAWParagraph.hxx:48
MWAWParagraph::cmp
int cmp(MWAWParagraph const &p) const
a comparison function
Definition: MWAWParagraph.cxx:179
MWAWTabStop::m_leaderCharacter
uint16_t m_leaderCharacter
the leader char
Definition: MWAWParagraph.hxx:78
MWAWParagraph::MWAWParagraph
MWAWParagraph()
constructor
Definition: MWAWParagraph.cxx:145
MWAW_DEBUG_MSG
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:129
MWAWParagraph::m_listStartValue
MWAWVariable< int > m_listStartValue
the list start value (if set )
Definition: MWAWParagraph.hxx:177
MWAWParagraph::resizeBorders
void resizeBorders(size_t newSize)
a function used to resize the borders list ( adding empty borders if needed )
Definition: MWAWParagraph.hxx:121
MWAWVariable< MWAWBorder >
MWAWTabStop::MWAWTabStop
MWAWTabStop(double position=0.0, Alignment alignment=LEFT, uint16_t leaderCharacter='\0', uint16_t decimalCharacter='.')
constructor
Definition: MWAWParagraph.hxx:50
MWAWBorder::isEmpty
bool isEmpty() const
returns true if the border is empty
Definition: libmwaw_internal.hxx:356
MWAWTabStop::Alignment
Alignment
the tab alignment
Definition: MWAWParagraph.hxx:48
MWAWTabStop::cmp
int cmp(MWAWTabStop const &tabs) const
a comparison function
Definition: MWAWParagraph.cxx:95
MWAWParagraph::m_writingMode
MWAWVariable< libmwaw::WritingMode > m_writingMode
the writing mode
Definition: MWAWParagraph.hxx:170
MWAWParagraph::m_tabs
MWAWVariable< std::vector< MWAWTabStop > > m_tabs
the tabulations
Definition: MWAWParagraph.hxx:161
MWAWParagraph::m_styleName
std::string m_styleName
the style name
Definition: MWAWParagraph.hxx:187
MWAWTabStop::addTo
void addTo(librevenge::RVNGPropertyListVector &propList, double decalX=0.0) const
add a tab to the propList
Definition: MWAWParagraph.cxx:48
MWAWParagraph::m_listLevelIndex
MWAWVariable< int > m_listLevelIndex
the actual level index
Definition: MWAWParagraph.hxx:173
MWAWTabStop::CENTER
Definition: MWAWParagraph.hxx:48
MWAWParagraph::setInterline
void setInterline(double value, librevenge::RVNGUnit unit, LineSpacingType type=Fixed)
set the interline
Definition: MWAWParagraph.hxx:128
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:192
libmwaw::appendUnicode
void appendUnicode(uint32_t val, librevenge::RVNGString &buffer)
adds an unicode character to a string
Definition: libmwaw_internal.cxx:63
MWAWParagraph::hasDifferentBorders
bool hasDifferentBorders() const
check if the paragraph has different borders
Definition: MWAWParagraph.cxx:283
MWAWParagraph::m_spacings
MWAWVariable< double > m_spacings[3]
the line spacing
Definition: MWAWParagraph.hxx:155
MWAWParagraph::JustificationFullAllLines
Definition: MWAWParagraph.hxx:91
MWAWParagraph::addTo
void addTo(librevenge::RVNGPropertyList &propList, bool inTable) const
add to the propList
Definition: MWAWParagraph.cxx:302
MWAWParagraph
class to store the paragraph properties
Definition: MWAWParagraph.hxx:84
MWAWColor::str
std::string str() const
print the color in the form #rrggbb
Definition: libmwaw_internal.cxx:232
MWAWParagraph::m_listLevel
MWAWVariable< MWAWListLevel > m_listLevel
the actual level
Definition: MWAWParagraph.hxx:179
MWAWParagraph::m_spacingsInterlineType
MWAWVariable< LineSpacingType > m_spacingsInterlineType
the interline type: fixed, atLeast, ...
Definition: MWAWParagraph.hxx:159
MWAWBorder::None
Definition: libmwaw_internal.hxx:335
MWAWParagraph::m_margins
MWAWVariable< double > m_margins[3]
the margins
Definition: MWAWParagraph.hxx:147
MWAWTabStop::DECIMAL
Definition: MWAWParagraph.hxx:48
MWAWTabStop
class to store a tab use by MWAWParagraph
Definition: MWAWParagraph.hxx:46
MWAWVariable::isSet
bool isSet() const
return true if the variable is set
Definition: libmwaw_internal.hxx:633
MWAWParagraph::LineSpacingType
LineSpacingType
the line spacing type: fixed or at least
Definition: MWAWParagraph.hxx:94
MWAWParagraph::m_borders
std::vector< MWAWVariable< MWAWBorder > > m_borders
list of border ( order MWAWBorder::Pos)
Definition: MWAWParagraph.hxx:185
MWAWParagraph::AtLeast
Definition: MWAWParagraph.hxx:94
MWAWParagraph::JustificationCenter
Definition: MWAWParagraph.hxx:90
MWAWParagraph::m_breakStatus
MWAWVariable< int > m_breakStatus
a list of bits: 0x1 (unbreakable), 0x2 (do not break after)
Definition: MWAWParagraph.hxx:168
MWAWParagraph::Justification
Justification
an enum used to defined the paragraph justification: left, center, right, full ...
Definition: MWAWParagraph.hxx:90
MWAWTabStop::operator!=
bool operator!=(MWAWTabStop const &tabs) const
operator!=
Definition: MWAWParagraph.hxx:65
MWAWParagraph.hxx
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:163
libmwaw::Bottom
Definition: libmwaw_internal.hxx:176
libmwaw_internal.hxx
MWAWPosition.hxx
MWAWParagraph::m_backgroundColor
MWAWVariable< MWAWColor > m_backgroundColor
the background color
Definition: MWAWParagraph.hxx:182
MWAWTabStop::operator<<
friend std::ostream & operator<<(std::ostream &o, MWAWTabStop const &ft)
operator <<
Definition: MWAWParagraph.cxx:109
MWAWParagraph::getMarginsWidth
double getMarginsWidth() const
return the paragraph margin width (in inches)
Definition: MWAWParagraph.cxx:296
MWAWBorder
a border
Definition: libmwaw_internal.hxx:333
MWAWBorder::addTo
bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const
add the border property to proplist (if needed )
Definition: libmwaw_internal.cxx:436
libmwaw::writingModeToString
std::string writingModeToString(WritingMode mode)
a function to convert a writing mode in string lt-rb, ...
Definition: libmwaw_internal.cxx:184
MWAWTabStop::m_alignment
Alignment m_alignment
the alignment ( left, center, ...)
Definition: MWAWParagraph.hxx:76
MWAWVariable::insert
void insert(MWAWVariable const &orig)
update the current value if orig is set
Definition: libmwaw_internal.hxx:598
MWAWVariable::get
const T & get() const
return the current value
Definition: libmwaw_internal.hxx:628
MWAWTabStop::m_position
double m_position
the tab position
Definition: MWAWParagraph.hxx:74
MWAWTabStop::m_decimalCharacter
uint16_t m_decimalCharacter
the decimal char
Definition: MWAWParagraph.hxx:80
MWAWParagraph::JustificationLeft
Definition: MWAWParagraph.hxx:90
MWAWParagraph::~MWAWParagraph
virtual ~MWAWParagraph()
destructor
Definition: MWAWParagraph.cxx:175
libmwaw::Top
Definition: libmwaw_internal.hxx:176
MWAWBorder::m_style
Style m_style
the border style
Definition: libmwaw_internal.hxx:380
MWAWList.hxx
MWAWParagraph::hasBorders
bool hasBorders() const
check if the paragraph has some borders
Definition: MWAWParagraph.cxx:272
MWAWParagraph::m_marginsUnit
MWAWVariable< librevenge::RVNGUnit > m_marginsUnit
the margins INCH, ...
Definition: MWAWParagraph.hxx:149
MWAWParagraph::NoBreakWithNextBit
Definition: MWAWParagraph.hxx:88
operator<<
std::ostream & operator<<(std::ostream &o, MWAWTabStop const &tab)
Definition: MWAWParagraph.cxx:109
libmwaw::Right
Definition: libmwaw_internal.hxx:176
MWAWParagraph::m_spacingsInterlineUnit
MWAWVariable< librevenge::RVNGUnit > m_spacingsInterlineUnit
the interline unit PERCENT or INCH, ...
Definition: MWAWParagraph.hxx:157
MWAWParagraph::JustificationFull
Definition: MWAWParagraph.hxx:90
MWAWParagraph::JustificationRight
Definition: MWAWParagraph.hxx:91
MWAWParagraph::operator!=
bool operator!=(MWAWParagraph const &p) const
operator!=
Definition: MWAWParagraph.hxx:108
libmwaw::Left
Definition: libmwaw_internal.hxx:176
MWAWTabStop::BAR
Definition: MWAWParagraph.hxx:48
MWAWParagraph::operator=
MWAWParagraph & operator=(MWAWParagraph const &)=default
MWAWListLevel::cmp
int cmp(MWAWListLevel const &levl) const
comparison function ( compare all values excepted m_startValues
Definition: MWAWList.cxx:116
libmwaw
namespace used to regroup all libwpd functions, enumerations which we have redefined for internal usa...
Definition: libmwaw_internal.cxx:50
MWAWColor::isWhite
bool isWhite() const
return true if the color is white
Definition: libmwaw_internal.hxx:289
MWAWPosition::getScaleFactor
static float getScaleFactor(librevenge::RVNGUnit orig, librevenge::RVNGUnit dest)
Definition: MWAWPosition.hxx:158
librevenge
Definition: MWAWDocument.hxx:56
MWAWTabStop::RIGHT
Definition: MWAWParagraph.hxx:48
MWAWParagraph::insert
void insert(MWAWParagraph const &para)
insert the set values of para in the actual paragraph
Definition: MWAWParagraph.cxx:233
MWAWParagraph::m_extra
std::string m_extra
a string to store some errors
Definition: MWAWParagraph.hxx:189
MWAWParagraph::m_listId
MWAWVariable< int > m_listId
the list id (if know )
Definition: MWAWParagraph.hxx:175
libmwaw::WritingInherited
Definition: libmwaw_internal.hxx:185
MWAWParagraph::operator<<
friend std::ostream & operator<<(std::ostream &o, MWAWParagraph const &ft)
operator <<
Definition: MWAWParagraph.cxx:426
MWAWParagraph::NoBreakBit
Definition: MWAWParagraph.hxx:88
MWAWVariable::setSet
void setSet(bool newVal)
define if the variable is set
Definition: libmwaw_internal.hxx:638

Generated on Mon Aug 19 2019 21:07:33 for libmwaw by doxygen 1.8.16