WPSParagraph.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
00002 /* libwps
00003  * Version: MPL 2.0 / LGPLv2.1+
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * Major Contributor(s):
00010  * Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
00011  * Copyright (C) 2006, 2007 Andrew Ziem
00012  * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
00013  * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
00014  * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
00015  *
00016  * For minor contributions see the git repository.
00017  *
00018  * Alternatively, the contents of this file may be used under the terms
00019  * of the GNU Lesser General Public License Version 2.1 or later
00020  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
00021  * applicable instead of those above.
00022  *
00023  * For further information visit http://libwps.sourceforge.net
00024  */
00025 
00026 #ifndef WPS_PARAGRAPH
00027 #  define WPS_PARAGRAPH
00028 
00029 #include <assert.h>
00030 #include <iostream>
00031 
00032 #include <vector>
00033 
00034 #include "libwps_internal.h"
00035 
00036 #include "WPSList.h"
00037 
00038 struct WPSTabStop
00039 {
00040         enum Alignment { LEFT, RIGHT, CENTER, DECIMAL, BAR };
00041         WPSTabStop(double position = 0.0, Alignment alignment = LEFT, uint16_t leaderCharacter='\0', uint8_t leaderNumSpaces = 0)  :
00042                 m_position(position), m_alignment(alignment), m_leaderCharacter(leaderCharacter), m_leaderNumSpaces(leaderNumSpaces)
00043         {
00044         }
00045         void addTo(librevenge::RVNGPropertyListVector &propList, double decalX=0.0) const;
00047         friend std::ostream &operator<<(std::ostream &o, WPSTabStop const &ft);
00048         double m_position;
00049         Alignment m_alignment;
00050         uint16_t m_leaderCharacter;
00051         uint8_t m_leaderNumSpaces;
00052 };
00053 
00055 struct WPSParagraph
00056 {
00057         typedef WPSList::Level ListLevel;
00058 
00060         WPSParagraph() : m_tabs(), m_justify(libwps::JustificationLeft),
00061                 m_breakStatus(0), m_listLevelIndex(0), m_listLevel(), m_backgroundColor(0xFFFFFF),
00062                 m_border(0), m_borderStyle(), m_extra("")
00063         {
00064                 for (int i = 0; i < 3; i++) m_margins[i] = m_spacings[i] = 0.0;
00065                 m_spacings[0] = 1.0; // interline normal
00066         }
00067         // destructor
00068         virtual ~WPSParagraph() {}
00070         void addTo(librevenge::RVNGPropertyList &propList, bool inTable) const;
00072         friend std::ostream &operator<<(std::ostream &o, WPSParagraph const &ft);
00073 
00079         double m_margins[3]; // 0: first line left, 1: left, 2: right
00085         double m_spacings[3]; // 0: interline, 1: before, 2: after
00087         std::vector<WPSTabStop> m_tabs;
00088 
00090         libwps::Justification m_justify;
00092         int m_breakStatus; // BITS: 1: unbreakable, 2: dont break after
00093 
00095         int m_listLevelIndex;
00097         ListLevel m_listLevel;
00098 
00100         uint32_t m_backgroundColor;
00101 
00103         int m_border;
00105         WPSBorder m_borderStyle;
00106 
00108         std::string m_extra;
00109 };
00110 #endif
00111 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */