WPSParagraph.h
Go to the documentation of this file.
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* libwps
* Version: MPL 2.0 / LGPLv2.1+
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Major Contributor(s):
* Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
* Copyright (C) 2006, 2007 Andrew Ziem
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
* Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms
* of the GNU Lesser General Public License Version 2.1 or later
* (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
* applicable instead of those above.
*
* For further information visit http://libwps.sourceforge.net
*/
#ifndef WPS_PARAGRAPH
# define WPS_PARAGRAPH
#include <assert.h>
#include <iostream>
#include <vector>
#include "libwps_internal.h"
#include "WPSList.h"
class WPSContentListener;
class WPXPropertyListVector;
struct WPSTabStop
{
enum Alignment { LEFT, RIGHT, CENTER, DECIMAL, BAR };
WPSTabStop(double position = 0.0, Alignment alignment = LEFT, uint16_t leaderCharacter='\0', uint8_t leaderNumSpaces = 0) :
m_position(position), m_alignment(alignment), m_leaderCharacter(leaderCharacter), m_leaderNumSpaces(leaderNumSpaces)
{
}
void addTo(WPXPropertyListVector &propList, double decalX=0.0);
friend std::ostream &operator<<(std::ostream &o, WPSTabStop const &ft);
double m_position;
Alignment m_alignment;
uint16_t m_leaderCharacter;
uint8_t m_leaderNumSpaces;
};
struct WPSParagraph
{
typedef WPSList::Level ListLevel;
WPSParagraph() : m_tabs(), m_justify(libwps::JustificationLeft),
m_breakStatus(0), m_listLevelIndex(0), m_listLevel(), m_backgroundColor(0xFFFFFF),
m_border(0), m_borderStyle(), m_extra("")
{
for(int i = 0; i < 3; i++) m_margins[i] = m_spacings[i] = 0.0;
m_spacings[0] = 1.0; // interline normal
}
virtual ~WPSParagraph() {}
void send(shared_ptr<WPSContentListener> listener) const;
friend std::ostream &operator<<(std::ostream &o, WPSParagraph const &ft);
double m_margins[3]; // 0: first line left, 1: left, 2: right
double m_spacings[3]; // 0: interline, 1: before, 2: after
std::vector<WPSTabStop> m_tabs;
libwps::Justification m_justify;
int m_breakStatus; // BITS: 1: unbreakable, 2: dont break after
int m_listLevelIndex;
ListLevel m_listLevel;
uint32_t m_backgroundColor;
int m_border;
WPSBorder m_borderStyle;
std::string m_extra;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */