Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef MWAW_PARAGRAPH
00035 # define MWAW_PARAGRAPH
00036
00037 #include <assert.h>
00038 #include <iostream>
00039 #include <vector>
00040
00041 #include <libwpd/libwpd.h>
00042
00043 #include "libmwaw_internal.hxx"
00044 #include "MWAWList.hxx"
00045
00046 class WPXPropertyList;
00047 class WPXPropertyListVector;
00048
00050 struct MWAWTabStop {
00052 enum Alignment { LEFT, RIGHT, CENTER, DECIMAL, BAR };
00054 MWAWTabStop(double position = 0.0, Alignment alignment = LEFT, uint16_t leaderCharacter='\0', uint16_t decimalCharacter = '.') :
00055 m_position(position), m_alignment(alignment), m_leaderCharacter(leaderCharacter), m_decimalCharacter(decimalCharacter) {
00056 }
00058 void addTo(WPXPropertyListVector &propList, double decalX=0.0) const;
00060 bool operator==(MWAWTabStop const &tabs) const {
00061 return cmp(tabs)==0;
00062 }
00064 bool operator!=(MWAWTabStop const &tabs) const {
00065 return cmp(tabs)!=0;
00066 }
00068 friend std::ostream &operator<<(std::ostream &o, MWAWTabStop const &ft);
00070 int cmp(MWAWTabStop const &tabs) const;
00072 double m_position;
00074 Alignment m_alignment;
00076 uint16_t m_leaderCharacter;
00078 uint16_t m_decimalCharacter;
00079 };
00080
00082 class MWAWParagraph
00083 {
00084 public:
00086 enum { NoBreakBit = 0x1, NoBreakWithNextBit=0x2 };
00088 enum Justification { JustificationLeft, JustificationFull, JustificationCenter,
00089 JustificationRight, JustificationFullAllLines
00090 };
00092 enum LineSpacingType { Fixed, AtLeast};
00093
00095 MWAWParagraph();
00097 virtual ~MWAWParagraph();
00099 bool operator==(MWAWParagraph const &p) const {
00100 return cmp(p)==0;
00101 }
00103 bool operator!=(MWAWParagraph const &p) const {
00104 return cmp(p)!=0;
00105 }
00107 int cmp(MWAWParagraph const &p) const;
00109 double getMarginsWidth() const;
00111 bool hasBorders() const;
00113 bool hasDifferentBorders() const;
00115 void resizeBorders(size_t newSize) {
00116 MWAWBorder empty;
00117 empty.m_style=MWAWBorder::None;
00118 m_borders.resize(newSize, empty);
00119 }
00121 void setInterline(double value, WPXUnit unit, LineSpacingType type=Fixed) {
00122 m_spacings[0]=value;
00123 m_spacingsInterlineUnit=unit;
00124 m_spacingsInterlineType=type;
00125 }
00127 void addTo(WPXPropertyList &propList, bool inTable) const;
00129 void addTabsTo(WPXPropertyListVector &propList, double decalX=0.0) const;
00130
00132 void insert(MWAWParagraph const ¶);
00134 friend std::ostream &operator<<(std::ostream &o, MWAWParagraph const &ft);
00135
00141 Variable<double> m_margins[3];
00143 Variable<WPXUnit> m_marginsUnit;
00149 Variable<double> m_spacings[3];
00151 Variable<WPXUnit> m_spacingsInterlineUnit;
00153 Variable<LineSpacingType> m_spacingsInterlineType;
00155 Variable<std::vector<MWAWTabStop> > m_tabs;
00157 Variable<bool> m_tabsRelativeToLeftMargin;
00158
00160 Variable<Justification> m_justify;
00162 Variable<int> m_breakStatus;
00163
00165 Variable<int> m_listLevelIndex;
00167 Variable<int> m_listId;
00169 Variable<int> m_listStartValue;
00171 Variable<MWAWListLevel> m_listLevel;
00172
00174 Variable<MWAWColor> m_backgroundColor;
00175
00177 std::vector<Variable<MWAWBorder> > m_borders;
00178
00180 std::string m_extra;
00181 };
00182 #endif
00183