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 <assert.h>
38
#include <iostream>
39
40
#include <vector>
41
42
#include <libwpd/libwpd.h>
43
44
#include "
libmwaw_internal.hxx
"
45
#include "
MWAWList.hxx
"
46
47
class
WPXPropertyList;
48
class
WPXPropertyListVector;
49
51
struct
MWAWTabStop
{
53
enum
Alignment
{
LEFT
,
RIGHT
,
CENTER
,
DECIMAL
,
BAR
};
55
MWAWTabStop
(
double
position = 0.0,
Alignment
alignment =
LEFT
, uint16_t leaderCharacter=
'\0'
, uint16_t decimalCharacter =
'.'
) :
56
m_position
(position),
m_alignment
(alignment),
m_leaderCharacter
(leaderCharacter),
m_decimalCharacter
(decimalCharacter) {
57
}
59
void
addTo
(WPXPropertyListVector &propList,
double
decalX=0.0)
const
;
61
bool
operator==
(
MWAWTabStop
const
&tabs)
const
{
62
return
!
operator!=
(tabs);
63
}
65
bool
operator!=
(
MWAWTabStop
const
&tabs)
const
{
66
return
m_position
< tabs.
m_position
||
m_position
> tabs.
m_position
||
67
m_alignment
!= tabs.
m_alignment
||
68
m_leaderCharacter
!= tabs.
m_leaderCharacter
||
69
m_decimalCharacter
!= tabs.
m_decimalCharacter
;
70
}
72
friend
std::ostream &
operator<<
(std::ostream &o,
MWAWTabStop
const
&ft);
74
double
m_position
;
76
Alignment
m_alignment
;
78
uint16_t
m_leaderCharacter
;
80
uint16_t
m_decimalCharacter
;
81
};
82
84
class
MWAWParagraph
85
{
86
public
:
88
enum
{
NoBreakBit
= 0x1,
NoBreakWithNextBit
=0x2 };
90
enum
Justification
{
JustificationLeft
,
JustificationFull
,
JustificationCenter
,
91
JustificationRight
,
JustificationFullAllLines
92
};
94
enum
LineSpacingType
{
Fixed
,
AtLeast
};
95
97
MWAWParagraph
();
99
virtual
~MWAWParagraph
();
101
bool
operator==
(
MWAWParagraph
const
&p)
const
{
102
return
!
operator!=
(p);
103
}
105
bool
operator!=
(
MWAWParagraph
const
&p)
const
;
107
double
getMarginsWidth
()
const
;
109
bool
hasBorders
()
const
;
111
bool
hasDifferentBorders
()
const
;
113
void
setInterline
(
double
value, WPXUnit unit,
LineSpacingType
type=
Fixed
) {
114
m_spacings
[0]=value;
115
m_spacingsInterlineUnit
=unit;
116
m_spacingsInterlineType
=type;
117
}
119
void
addTo
(WPXPropertyList &propList,
bool
inTable)
const
;
121
void
addTabsTo
(WPXPropertyListVector &propList,
double
decalX=0.0)
const
;
122
124
void
insert
(
MWAWParagraph
const
¶);
126
friend
std::ostream &
operator<<
(std::ostream &o,
MWAWParagraph
const
&ft);
127
133
Variable<double>
m_margins
[3];
// 0: first line left, 1: left, 2: right
135
Variable<WPXUnit>
m_marginsUnit
;
141
Variable<double>
m_spacings
[3];
// 0: interline, 1: before, 2: after
143
Variable<WPXUnit>
m_spacingsInterlineUnit
;
145
Variable<LineSpacingType>
m_spacingsInterlineType
;
147
Variable<std::vector<MWAWTabStop>
>
m_tabs
;
149
Variable<bool>
m_tabsRelativeToLeftMargin
;
150
152
Variable<Justification>
m_justify
;
154
Variable<int>
m_breakStatus
;
// BITS: 1: unbreakable, 2: dont break after
155
157
Variable<int>
m_listLevelIndex
;
159
Variable<int>
m_listId
;
161
Variable<int>
m_listStartValue
;
163
Variable<MWAWListLevel>
m_listLevel
;
164
166
Variable<MWAWColor>
m_backgroundColor
;
167
169
std::vector<Variable<MWAWBorder> >
m_borders
;
170
172
std::string
m_extra
;
173
};
174
#endif
175
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
Generated on Tue Apr 30 2013 06:31:13 for libmwaw by
doxygen
1.8.3.1