|
rpm-build |
6f7582 |
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
/* libmwaw
|
|
rpm-build |
6f7582 |
* Version: MPL 2.0 / LGPLv2+
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
* The contents of this file are subject to the Mozilla Public License Version
|
|
rpm-build |
6f7582 |
* 2.0 (the "License"); you may not use this file except in compliance with
|
|
rpm-build |
6f7582 |
* the License or as specified alternatively below. You may obtain a copy of
|
|
rpm-build |
6f7582 |
* the License at http://www.mozilla.org/MPL/
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
rpm-build |
6f7582 |
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
rpm-build |
6f7582 |
* for the specific language governing rights and limitations under the
|
|
rpm-build |
6f7582 |
* License.
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
* Major Contributor(s):
|
|
rpm-build |
6f7582 |
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
|
|
rpm-build |
6f7582 |
* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
|
|
rpm-build |
6f7582 |
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
|
|
rpm-build |
6f7582 |
* Copyright (C) 2006, 2007 Andrew Ziem
|
|
rpm-build |
6f7582 |
* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
* All Rights Reserved.
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
* For minor contributions see the git repository.
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
* Alternatively, the contents of this file may be used under the terms of
|
|
rpm-build |
6f7582 |
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
|
|
rpm-build |
6f7582 |
* in which case the provisions of the LGPLv2+ are applicable
|
|
rpm-build |
6f7582 |
* instead of those above.
|
|
rpm-build |
6f7582 |
*/
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
#ifndef MWAW_PARAGRAPH
|
|
rpm-build |
6f7582 |
# define MWAW_PARAGRAPH
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
#include <iostream>
|
|
rpm-build |
6f7582 |
#include <vector>
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
#include <librevenge/librevenge.h>
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
#include "libmwaw_internal.hxx"
|
|
rpm-build |
6f7582 |
#include "MWAWList.hxx"
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
/** class to store a tab use by MWAWParagraph */
|
|
rpm-build |
6f7582 |
struct MWAWTabStop {
|
|
rpm-build |
6f7582 |
//! the tab alignment
|
|
rpm-build |
6f7582 |
enum Alignment { LEFT, RIGHT, CENTER, DECIMAL, BAR };
|
|
rpm-build |
6f7582 |
//! constructor
|
|
rpm-build |
6f7582 |
explicit MWAWTabStop(double position = 0.0, Alignment alignment = LEFT, uint16_t leaderCharacter='\0', uint16_t decimalCharacter = '.')
|
|
rpm-build |
6f7582 |
: m_position(position)
|
|
rpm-build |
6f7582 |
, m_alignment(alignment)
|
|
rpm-build |
6f7582 |
, m_leaderCharacter(leaderCharacter)
|
|
rpm-build |
6f7582 |
, m_decimalCharacter(decimalCharacter)
|
|
rpm-build |
6f7582 |
{
|
|
rpm-build |
6f7582 |
}
|
|
rpm-build |
6f7582 |
//! add a tab to the propList
|
|
rpm-build |
6f7582 |
void addTo(librevenge::RVNGPropertyListVector &propList, double decalX=0.0) const;
|
|
rpm-build |
6f7582 |
//! operator==
|
|
rpm-build |
6f7582 |
bool operator==(MWAWTabStop const &tabs) const
|
|
rpm-build |
6f7582 |
{
|
|
rpm-build |
6f7582 |
return cmp(tabs)==0;
|
|
rpm-build |
6f7582 |
}
|
|
rpm-build |
6f7582 |
//! operator!=
|
|
rpm-build |
6f7582 |
bool operator!=(MWAWTabStop const &tabs) const
|
|
rpm-build |
6f7582 |
{
|
|
rpm-build |
6f7582 |
return cmp(tabs)!=0;
|
|
rpm-build |
6f7582 |
}
|
|
rpm-build |
6f7582 |
//! operator <<
|
|
rpm-build |
6f7582 |
friend std::ostream &operator<<(std::ostream &o, MWAWTabStop const &ft;;
|
|
rpm-build |
6f7582 |
//! a comparison function
|
|
rpm-build |
6f7582 |
int cmp(MWAWTabStop const &tabs) const;
|
|
rpm-build |
6f7582 |
//! the tab position
|
|
rpm-build |
6f7582 |
double m_position;
|
|
rpm-build |
6f7582 |
//! the alignment ( left, center, ...)
|
|
rpm-build |
6f7582 |
Alignment m_alignment;
|
|
rpm-build |
6f7582 |
//! the leader char
|
|
rpm-build |
6f7582 |
uint16_t m_leaderCharacter;
|
|
rpm-build |
6f7582 |
//! the decimal char
|
|
rpm-build |
6f7582 |
uint16_t m_decimalCharacter;
|
|
rpm-build |
6f7582 |
};
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! class to store the paragraph properties
|
|
rpm-build |
6f7582 |
class MWAWParagraph
|
|
rpm-build |
6f7582 |
{
|
|
rpm-build |
6f7582 |
public:
|
|
rpm-build |
6f7582 |
/** some bit use to defined the break status */
|
|
rpm-build |
6f7582 |
enum { NoBreakBit = 0x1, NoBreakWithNextBit=0x2 };
|
|
rpm-build |
6f7582 |
/** an enum used to defined the paragraph justification: left, center, right, full ... */
|
|
rpm-build |
6f7582 |
enum Justification { JustificationLeft, JustificationFull, JustificationCenter,
|
|
rpm-build |
6f7582 |
JustificationRight, JustificationFullAllLines
|
|
rpm-build |
6f7582 |
};
|
|
rpm-build |
6f7582 |
/** the line spacing type: fixed or at least */
|
|
rpm-build |
6f7582 |
enum LineSpacingType { Fixed, AtLeast};
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! constructor
|
|
rpm-build |
6f7582 |
MWAWParagraph();
|
|
rpm-build |
6f7582 |
//! destructor
|
|
rpm-build |
6f7582 |
virtual ~MWAWParagraph();
|
|
rpm-build |
6f7582 |
//! operator==
|
|
rpm-build |
6f7582 |
bool operator==(MWAWParagraph const &p) const
|
|
rpm-build |
6f7582 |
{
|
|
rpm-build |
6f7582 |
return cmp(p)==0;
|
|
rpm-build |
6f7582 |
}
|
|
rpm-build |
6f7582 |
//! operator!=
|
|
rpm-build |
6f7582 |
bool operator!=(MWAWParagraph const &p) const
|
|
rpm-build |
6f7582 |
{
|
|
rpm-build |
6f7582 |
return cmp(p)!=0;
|
|
rpm-build |
6f7582 |
}
|
|
rpm-build |
6f7582 |
//! a comparison function
|
|
rpm-build |
6f7582 |
int cmp(MWAWParagraph const &p) const;
|
|
rpm-build |
6f7582 |
//! return the paragraph margin width (in inches)
|
|
rpm-build |
6f7582 |
double getMarginsWidth() const;
|
|
rpm-build |
6f7582 |
//! check if the paragraph has some borders
|
|
rpm-build |
6f7582 |
bool hasBorders() const;
|
|
rpm-build |
6f7582 |
//! check if the paragraph has different borders
|
|
rpm-build |
6f7582 |
bool hasDifferentBorders() const;
|
|
rpm-build |
6f7582 |
//! a function used to resize the borders list ( adding empty borders if needed )
|
|
rpm-build |
6f7582 |
void resizeBorders(size_t newSize)
|
|
rpm-build |
6f7582 |
{
|
|
rpm-build |
6f7582 |
MWAWBorder empty;
|
|
rpm-build |
6f7582 |
empty.m_style=MWAWBorder::None;
|
|
rpm-build |
6f7582 |
m_borders.resize(newSize, MWAWVariable<MWAWBorder>(empty));
|
|
rpm-build |
6f7582 |
}
|
|
rpm-build |
6f7582 |
//! set the interline
|
|
rpm-build |
6f7582 |
void setInterline(double value, librevenge::RVNGUnit unit, LineSpacingType type=Fixed)
|
|
rpm-build |
6f7582 |
{
|
|
rpm-build |
6f7582 |
m_spacings[0]=value;
|
|
rpm-build |
6f7582 |
m_spacingsInterlineUnit=unit;
|
|
rpm-build |
6f7582 |
m_spacingsInterlineType=type;
|
|
rpm-build |
6f7582 |
}
|
|
rpm-build |
6f7582 |
//! add to the propList
|
|
rpm-build |
6f7582 |
void addTo(librevenge::RVNGPropertyList &propList, bool inTable) const;
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! insert the set values of para in the actual paragraph
|
|
rpm-build |
6f7582 |
void insert(MWAWParagraph const ¶);
|
|
rpm-build |
6f7582 |
//! operator <<
|
|
rpm-build |
6f7582 |
friend std::ostream &operator<<(std::ostream &o, MWAWParagraph const &ft;;
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
/** the margins
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
* - 0: first line left margin
|
|
rpm-build |
6f7582 |
* - 1: left margin
|
|
rpm-build |
6f7582 |
* - 2: right margin*/
|
|
rpm-build |
6f7582 |
MWAWVariable<double> m_margins[3]; // 0: first line left, 1: left, 2: right
|
|
rpm-build |
6f7582 |
/** the margins INCH, ... */
|
|
rpm-build |
6f7582 |
MWAWVariable<librevenge::RVNGUnit> m_marginsUnit;
|
|
rpm-build |
6f7582 |
/** the line spacing
|
|
rpm-build |
6f7582 |
*
|
|
rpm-build |
6f7582 |
* - 0: interline
|
|
rpm-build |
6f7582 |
* - 1: before
|
|
rpm-build |
6f7582 |
* - 2: after */
|
|
rpm-build |
6f7582 |
MWAWVariable<double> m_spacings[3]; // 0: interline, 1: before, 2: after
|
|
rpm-build |
6f7582 |
/** the interline unit PERCENT or INCH, ... */
|
|
rpm-build |
6f7582 |
MWAWVariable<librevenge::RVNGUnit> m_spacingsInterlineUnit;
|
|
rpm-build |
6f7582 |
/** the interline type: fixed, atLeast, ... */
|
|
rpm-build |
6f7582 |
MWAWVariable<LineSpacingType> m_spacingsInterlineType;
|
|
rpm-build |
6f7582 |
//! the tabulations
|
|
rpm-build |
6f7582 |
MWAWVariable<std::vector<MWAWTabStop> > m_tabs;
|
|
rpm-build |
6f7582 |
//! true if the tabs are relative to left margin, false if there are relative to the page margin (default)
|
|
rpm-build |
6f7582 |
MWAWVariable<bool> m_tabsRelativeToLeftMargin;
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
/** the justification */
|
|
rpm-build |
6f7582 |
MWAWVariable<Justification> m_justify;
|
|
rpm-build |
6f7582 |
/** a list of bits: 0x1 (unbreakable), 0x2 (do not break after) */
|
|
rpm-build |
6f7582 |
MWAWVariable<int> m_breakStatus; // BITS: 1: unbreakable, 2: dont break after
|
|
rpm-build |
6f7582 |
//! the writing mode
|
|
rpm-build |
6f7582 |
MWAWVariable<libmwaw::WritingMode> m_writingMode;
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
/** the actual level index */
|
|
rpm-build |
6f7582 |
MWAWVariable<int> m_listLevelIndex;
|
|
rpm-build |
6f7582 |
/** the list id (if know ) */
|
|
rpm-build |
6f7582 |
MWAWVariable<int> m_listId;
|
|
rpm-build |
6f7582 |
/** the list start value (if set ) */
|
|
rpm-build |
6f7582 |
MWAWVariable<int> m_listStartValue;
|
|
rpm-build |
6f7582 |
/** the actual level */
|
|
rpm-build |
6f7582 |
MWAWVariable<MWAWListLevel> m_listLevel;
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! the background color
|
|
rpm-build |
6f7582 |
MWAWVariable<MWAWColor> m_backgroundColor;
|
|
rpm-build |
6f7582 |
|
|
rpm-build |
6f7582 |
//! list of border ( order MWAWBorder::Pos)
|
|
rpm-build |
6f7582 |
std::vector<MWAWVariable<MWAWBorder> > m_borders;
|
|
rpm-build |
6f7582 |
//! the style name
|
|
rpm-build |
6f7582 |
std::string m_styleName;
|
|
rpm-build |
6f7582 |
//! a string to store some errors
|
|
rpm-build |
6f7582 |
std::string m_extra;
|
|
rpm-build |
6f7582 |
};
|
|
rpm-build |
6f7582 |
#endif
|
|
rpm-build |
6f7582 |
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
|