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 <assert.h>
38 #include <iostream>
39 #include <vector>
40 
41 #include <libwpd/libwpd.h>
42 
43 #include "libmwaw_internal.hxx"
44 #include "MWAWList.hxx"
45 
46 class WPXPropertyList;
47 class WPXPropertyListVector;
48 
50 struct MWAWTabStop {
54  MWAWTabStop(double position = 0.0, Alignment alignment = LEFT, uint16_t leaderCharacter='\0', uint16_t decimalCharacter = '.') :
55  m_position(position), m_alignment(alignment), m_leaderCharacter(leaderCharacter), m_decimalCharacter(decimalCharacter) {
56  }
58  void addTo(WPXPropertyListVector &propList, double decalX=0.0) const;
60  bool operator==(MWAWTabStop const &tabs) const {
61  return cmp(tabs)==0;
62  }
64  bool operator!=(MWAWTabStop const &tabs) const {
65  return cmp(tabs)!=0;
66  }
68  friend std::ostream &operator<<(std::ostream &o, MWAWTabStop const &ft);
70  int cmp(MWAWTabStop const &tabs) const;
72  double m_position;
79 };
80 
83 {
84 public:
86  enum { NoBreakBit = 0x1, NoBreakWithNextBit=0x2 };
90  };
93 
95  MWAWParagraph();
97  virtual ~MWAWParagraph();
99  bool operator==(MWAWParagraph const &p) const {
100  return cmp(p)==0;
101  }
103  bool operator!=(MWAWParagraph const &p) const {
104  return cmp(p)!=0;
105  }
107  int cmp(MWAWParagraph const &p) const;
109  double getMarginsWidth() const;
111  bool hasBorders() const;
113  bool hasDifferentBorders() const;
115  void resizeBorders(size_t newSize) {
116  MWAWBorder empty;
118  m_borders.resize(newSize, empty);
119  }
121  void setInterline(double value, WPXUnit unit, LineSpacingType type=Fixed) {
122  m_spacings[0]=value;
125  }
127  void addTo(WPXPropertyList &propList, bool inTable) const;
129  void addTabsTo(WPXPropertyListVector &propList, double decalX=0.0) const;
130 
132  void insert(MWAWParagraph const &para);
134  friend std::ostream &operator<<(std::ostream &o, MWAWParagraph const &ft);
135 
141  Variable<double> m_margins[3]; // 0: first line left, 1: left, 2: right
149  Variable<double> m_spacings[3]; // 0: interline, 1: before, 2: after
158 
162  Variable<int> m_breakStatus; // BITS: 1: unbreakable, 2: dont break after
163 
172 
175 
177  std::vector<Variable<MWAWBorder> > m_borders;
178 
180  std::string m_extra;
181 };
182 #endif
183 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWParagraph()
constructor
Definition: MWAWParagraph.cxx:140
Definition: MWAWParagraph.hxx:92
Definition: MWAWParagraph.hxx:88
Variable< std::vector< MWAWTabStop > > m_tabs
the tabulations
Definition: MWAWParagraph.hxx:155
Definition: MWAWParagraph.hxx:88
Definition: MWAWParagraph.hxx:52
double m_position
the tab position
Definition: MWAWParagraph.hxx:72
Alignment m_alignment
the alignement ( left, center, ...)
Definition: MWAWParagraph.hxx:74
uint16_t m_decimalCharacter
the decimal char
Definition: MWAWParagraph.hxx:78
Variable< double > m_margins[3]
the margins
Definition: MWAWParagraph.hxx:141
Definition: MWAWParagraph.hxx:89
void insert(MWAWParagraph const &para)
insert the set values of para in the actual paragraph
Definition: MWAWParagraph.cxx:208
bool operator==(MWAWTabStop const &tabs) const
operator==
Definition: MWAWParagraph.hxx:60
bool operator!=(MWAWParagraph const &p) const
operator!=
Definition: MWAWParagraph.hxx:103
Definition: MWAWParagraph.hxx:86
std::vector< Variable< MWAWBorder > > m_borders
list of border ( order MWAWBorder::Pos)
Definition: MWAWParagraph.hxx:177
Definition: MWAWParagraph.hxx:52
MWAWTabStop(double position=0.0, Alignment alignment=LEFT, uint16_t leaderCharacter='\0', uint16_t decimalCharacter= '.')
constructor
Definition: MWAWParagraph.hxx:54
uint16_t m_leaderCharacter
the leader char
Definition: MWAWParagraph.hxx:76
a border
Definition: libmwaw_internal.hxx:237
Definition: MWAWParagraph.hxx:92
Variable< int > m_breakStatus
a list of bits: 0x1 (unbreakable), 0x2 (do not break after)
Definition: MWAWParagraph.hxx:162
void addTo(WPXPropertyListVector &propList, double decalX=0.0) const
add a tab to the propList
Definition: MWAWParagraph.cxx:48
int cmp(MWAWTabStop const &tabs) const
a comparison function
Definition: MWAWParagraph.cxx:92
Alignment
the tab alignement
Definition: MWAWParagraph.hxx:52
Variable< WPXUnit > m_spacingsInterlineUnit
the interline unit PERCENT or INCH, ...
Definition: MWAWParagraph.hxx:151
Variable< 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:157
Definition: MWAWParagraph.hxx:52
Variable< Justification > m_justify
the justification
Definition: MWAWParagraph.hxx:160
void addTo(WPXPropertyList &propList, bool inTable) const
add to the propList
Definition: MWAWParagraph.cxx:275
bool operator!=(MWAWTabStop const &tabs) const
operator!=
Definition: MWAWParagraph.hxx:64
Definition: MWAWParagraph.hxx:52
Variable< double > m_spacings[3]
the line spacing
Definition: MWAWParagraph.hxx:149
void addTabsTo(WPXPropertyListVector &propList, double decalX=0.0) const
add tabs to the propList
Definition: MWAWParagraph.cxx:374
Definition: libmwaw_internal.hxx:239
void resizeBorders(size_t newSize)
a function used to resize the borders list ( adding empty borders if needed )
Definition: MWAWParagraph.hxx:115
Variable< int > m_listLevelIndex
the actual level index
Definition: MWAWParagraph.hxx:165
class to store a tab use by MWAWParagraph
Definition: MWAWParagraph.hxx:50
std::string m_extra
a string to store some errors
Definition: MWAWParagraph.hxx:180
Variable< WPXUnit > m_marginsUnit
the margins INCH, ...
Definition: MWAWParagraph.hxx:143
Definition: MWAWParagraph.hxx:89
LineSpacingType
the line spacing type: fixed or at least
Definition: MWAWParagraph.hxx:92
Style m_style
the border style
Definition: libmwaw_internal.hxx:270
Definition: MWAWParagraph.hxx:52
bool hasBorders() const
check if the paragraph has some borders
Definition: MWAWParagraph.cxx:245
class to store the paragraph properties
Definition: MWAWParagraph.hxx:82
Variable< LineSpacingType > m_spacingsInterlineType
the interline type: fixed, atLeast, ...
Definition: MWAWParagraph.hxx:153
Variable< MWAWColor > m_backgroundColor
the background color
Definition: MWAWParagraph.hxx:174
Variable< int > m_listStartValue
the list start value (if set )
Definition: MWAWParagraph.hxx:169
friend std::ostream & operator<<(std::ostream &o, MWAWTabStop const &ft)
operator &lt;&lt;
Definition: MWAWParagraph.cxx:106
double getMarginsWidth() const
return the paragraph margin width (in inches)
Definition: MWAWParagraph.cxx:269
bool operator==(MWAWParagraph const &p) const
operator==
Definition: MWAWParagraph.hxx:99
friend std::ostream & operator<<(std::ostream &o, MWAWParagraph const &ft)
operator &lt;&lt;
Definition: MWAWParagraph.cxx:385
Variable< MWAWListLevel > m_listLevel
the actual level
Definition: MWAWParagraph.hxx:171
Justification
an enum used to defined the paragraph justification: left, center, right, full ...
Definition: MWAWParagraph.hxx:88
int cmp(MWAWParagraph const &p) const
a comparison function
Definition: MWAWParagraph.cxx:157
virtual ~MWAWParagraph()
destructor
Definition: MWAWParagraph.cxx:153
Definition: MWAWParagraph.hxx:86
Definition: MWAWParagraph.hxx:88
bool hasDifferentBorders() const
check if the paragraph has different borders
Definition: MWAWParagraph.cxx:256
Variable< int > m_listId
the list id (if know )
Definition: MWAWParagraph.hxx:167
void setInterline(double value, WPXUnit unit, LineSpacingType type=Fixed)
set the interline
Definition: MWAWParagraph.hxx:121

Generated on Tue Mar 10 2015 17:32:09 for libmwaw by doxygen 1.8.5