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 <librevenge/librevenge.h>
00042
00043 #include "libmwaw_internal.hxx"
00044 #include "MWAWList.hxx"
00045
00047 struct MWAWTabStop {
00049 enum Alignment { LEFT, RIGHT, CENTER, DECIMAL, BAR };
00051 MWAWTabStop(double position = 0.0, Alignment alignment = LEFT, uint16_t leaderCharacter='\0', uint16_t decimalCharacter = '.') :
00052 m_position(position), m_alignment(alignment), m_leaderCharacter(leaderCharacter), m_decimalCharacter(decimalCharacter)
00053 {
00054 }
00056 void addTo(librevenge::RVNGPropertyListVector &propList, double decalX=0.0) const;
00058 bool operator==(MWAWTabStop const &tabs) const
00059 {
00060 return cmp(tabs)==0;
00061 }
00063 bool operator!=(MWAWTabStop const &tabs) const
00064 {
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 {
00101 return cmp(p)==0;
00102 }
00104 bool operator!=(MWAWParagraph const &p) const
00105 {
00106 return cmp(p)!=0;
00107 }
00109 int cmp(MWAWParagraph const &p) const;
00111 double getMarginsWidth() const;
00113 bool hasBorders() const;
00115 bool hasDifferentBorders() const;
00117 void resizeBorders(size_t newSize)
00118 {
00119 MWAWBorder empty;
00120 empty.m_style=MWAWBorder::None;
00121 m_borders.resize(newSize, empty);
00122 }
00124 void setInterline(double value, librevenge::RVNGUnit unit, LineSpacingType type=Fixed)
00125 {
00126 m_spacings[0]=value;
00127 m_spacingsInterlineUnit=unit;
00128 m_spacingsInterlineType=type;
00129 }
00131 void addTo(librevenge::RVNGPropertyList &propList, bool inTable) const;
00132
00134 void insert(MWAWParagraph const ¶);
00136 friend std::ostream &operator<<(std::ostream &o, MWAWParagraph const &ft);
00137
00143 MWAWVariable<double> m_margins[3];
00145 MWAWVariable<librevenge::RVNGUnit> m_marginsUnit;
00151 MWAWVariable<double> m_spacings[3];
00153 MWAWVariable<librevenge::RVNGUnit> m_spacingsInterlineUnit;
00155 MWAWVariable<LineSpacingType> m_spacingsInterlineType;
00157 MWAWVariable<std::vector<MWAWTabStop> > m_tabs;
00159 MWAWVariable<bool> m_tabsRelativeToLeftMargin;
00160
00162 MWAWVariable<Justification> m_justify;
00164 MWAWVariable<int> m_breakStatus;
00165
00167 MWAWVariable<int> m_listLevelIndex;
00169 MWAWVariable<int> m_listId;
00171 MWAWVariable<int> m_listStartValue;
00173 MWAWVariable<MWAWListLevel> m_listLevel;
00174
00176 MWAWVariable<MWAWColor> m_backgroundColor;
00177
00179 std::vector<MWAWVariable<MWAWBorder> > m_borders;
00180
00182 std::string m_styleName;
00184 std::string m_extra;
00185 };
00186 #endif
00187