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 #ifndef AP_PREVIEW_PARAGRAPH_H
00022 #define AP_PREVIEW_PARAGRAPH_H
00023
00024 #include "ut_misc.h"
00025 #include "ut_types.h"
00026 #include "ut_vector.h"
00027
00028 #include "xap_Preview.h"
00029 #include "ap_Dialog_Paragraph.h"
00030
00031
00032 class AP_Dialog_Lists;
00033
00034 class GR_Font;
00035
00036
00037
00038 class ABI_EXPORT AP_Preview_Paragraph_Block
00039 {
00040 public:
00041 AP_Preview_Paragraph_Block(UT_RGBColor & clr,
00042 GR_Graphics * gc,
00043 AP_Dialog_Paragraph::tAlignState m_align,
00044 UT_uint32 fontHeight);
00045 virtual ~AP_Preview_Paragraph_Block();
00046
00047
00048 void setText(const UT_UCSChar * text);
00049
00050 void setFormat(const gchar * pageLeftMargin,
00051 const gchar * pageRightMargin,
00052 AP_Dialog_Paragraph::tAlignState align,
00053 const gchar * firstLineIndent,
00054 AP_Dialog_Paragraph::tIndentState indent,
00055 const gchar * leftIndent,
00056 const gchar * rightIndent,
00057 const gchar * beforeSpacing,
00058 const gchar * afterSpacing,
00059 const gchar * lineSpacing,
00060 AP_Dialog_Paragraph::tSpacingState spacing);
00061
00062
00063
00064
00065
00066 UT_uint32 m_firstLineLeftStop;
00067 UT_uint32 m_leftStop;
00068 UT_uint32 m_rightStop;
00069
00070 UT_uint32 m_beforeSpacing;
00071 UT_uint32 m_afterSpacing;
00072 UT_uint32 m_lineSpacing;
00073
00074 AP_Dialog_Paragraph::tAlignState m_align;
00075 AP_Dialog_Paragraph::tIndentState m_indent;
00076 AP_Dialog_Paragraph::tSpacingState m_spacing;
00077
00078 UT_uint32 m_fontHeight;
00079 UT_RGBColor m_clr;
00080
00081 GR_Graphics * m_gc;
00082
00083
00084
00085
00086 UT_GenericVector<UT_UCSChar *> m_words;
00087 UT_NumberVector m_widths;
00088 };
00089
00090 class ABI_EXPORT AP_Preview_Paragraph : public XAP_Preview
00091 {
00092 public:
00093
00094 AP_Preview_Paragraph(GR_Graphics * gc, const UT_UCSChar * text,
00095 AP_Dialog_Paragraph * parent, const char * fontname = NULL);
00096
00097 AP_Preview_Paragraph(GR_Graphics * gc, const UT_UCSChar * text,
00098 XAP_Dialog * parent);
00099
00100 AP_Preview_Paragraph(GR_Graphics * gc,
00101 const UT_UCSChar * text,
00102 AP_Dialog_Lists * dlg);
00103
00104 virtual ~AP_Preview_Paragraph(void);
00105
00106 void setFormat(const gchar * pageLeftMargin,
00107 const gchar * pageRightMargin,
00108 AP_Dialog_Paragraph::tAlignState align,
00109 const gchar * firstLineIndent,
00110 AP_Dialog_Paragraph::tIndentState indent,
00111 const gchar * leftIndent,
00112 const gchar * rightIndent,
00113 const gchar * beforeSpacing,
00114 const gchar * afterSpacing,
00115 const gchar * lineSpacing,
00116 AP_Dialog_Paragraph::tSpacingState spacing,
00117 UT_BidiCharType dir = UT_BIDI_LTR);
00118
00119 virtual void draw(const UT_Rect *clip=NULL);
00120
00121 protected:
00122
00123
00124 UT_RGBColor * m_clrWhite;
00125 UT_RGBColor * m_clrBlack;
00126 UT_RGBColor * m_clrGray;
00127
00128
00129 UT_uint32 m_x;
00130 UT_uint32 m_y;
00131
00132 virtual bool _loadDrawFont(const char *name = NULL);
00133 virtual void _drawPageBackground(void);
00134 virtual void _drawPageBorder(void);
00135 virtual void _appendBlock(AP_Preview_Paragraph_Block * block);
00136 virtual UT_uint32 _appendLine(UT_GenericVector<UT_UCSChar *> * words,
00137 UT_NumberVector * widths,
00138 UT_uint32 startWithWord,
00139 UT_uint32 left,
00140 UT_uint32 right,
00141 AP_Dialog_Paragraph::tAlignState align,
00142 UT_uint32 y);
00143
00144
00145
00146 AP_Preview_Paragraph_Block * m_previousBlock;
00147 AP_Preview_Paragraph_Block * m_activeBlock;
00148 AP_Preview_Paragraph_Block * m_followingBlock;
00149
00150 GR_Font * m_font;
00151 UT_uint32 m_fontHeight;
00152 UT_BidiCharType m_dir;
00153 };
00154
00155 #endif