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  * Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
00004  * Copyright (C) 2006, 2007 Andrew Ziem
00005  * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
00006  * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
00007  * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Library General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2 of the License, or (at your option) any later version.
00013  *
00014  * This library is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * Library General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Library General Public
00020  * License along with this library; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
00022  *
00023  * For further information visit http://libwps.sourceforge.net
00024  */
00025 
00026 /* "This product is not manufactured, approved, or supported by
00027  * Corel Corporation or Corel Corporation Limited."
00028  */
00029 
00030 #ifndef WPS_PARAGRAPH
00031 #  define WPS_PARAGRAPH
00032 
00033 #include <assert.h>
00034 #include <iostream>
00035 
00036 #include <vector>
00037 
00038 #include "libwps_internal.h"
00039 
00040 #include "WPSList.h"
00041 
00042 class WPSContentListener;
00043 class WPXPropertyListVector;
00044 
00045 struct WPSTabStop
00046 {
00047         enum Alignment { LEFT, RIGHT, CENTER, DECIMAL, BAR };
00048         WPSTabStop(double position = 0.0, Alignment alignment = LEFT, uint16_t leaderCharacter='\0', uint8_t leaderNumSpaces = 0)  :
00049                 m_position(position), m_alignment(alignment), m_leaderCharacter(leaderCharacter), m_leaderNumSpaces(leaderNumSpaces)
00050         {
00051         }
00052         void addTo(WPXPropertyListVector &propList, double decalX=0.0);
00054         friend std::ostream &operator<<(std::ostream &o, WPSTabStop const &ft);
00055         double m_position;
00056         Alignment m_alignment;
00057         uint16_t m_leaderCharacter;
00058         uint8_t m_leaderNumSpaces;
00059 };
00060 
00062 struct WPSParagraph
00063 {
00064         typedef WPSList::Level ListLevel;
00065 
00067         WPSParagraph() : m_tabs(), m_justify(libwps::JustificationLeft),
00068                 m_breakStatus(0), m_listLevelIndex(0), m_listLevel(),
00069                 m_border(0), m_borderStyle(libwps::BorderSingle), m_borderWidth(1), m_borderColor(0), m_extra("")
00070         {
00071                 for(int i = 0; i < 3; i++) m_margins[i] = m_spacings[i] = 0.0;
00072                 m_spacings[0] = 1.0; // interline normal
00073         }
00074         virtual ~WPSParagraph() {}
00076         void send(shared_ptr<WPSContentListener> listener) const;
00078         friend std::ostream &operator<<(std::ostream &o, WPSParagraph const &ft);
00079 
00085         double m_margins[3]; // 0: first line left, 1: left, 2: right
00091         double m_spacings[3]; // 0: interline, 1: before, 2: after
00093         std::vector<WPSTabStop> m_tabs;
00094 
00096         libwps::Justification m_justify;
00098         int m_breakStatus; // BITS: 1: unbreakable, 2: dont break after
00099 
00101         int m_listLevelIndex;
00103         ListLevel m_listLevel;
00104 
00106         int m_border;
00108         libwps::BorderStyle m_borderStyle;
00110         int m_borderWidth;
00112         uint32_t m_borderColor;
00113 
00115         std::string m_extra;
00116 };
00117 #endif
00118 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */