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
00040 public:
00041 KoTextDocument * textDocument() const { return document(); }
00042
00043 KoTextFormat * paragraphFormat() const
00044 { return static_cast<KoTextFormat *>( paragFormat() ); }
00045
00048 virtual void setParagLayout( const KoParagLayout &layout, int flags = KoParagLayout::All );
00049
00050 const KoParagLayout & paragLayout() { return m_layout; }
00051
00052
00053 double margin( QStyleSheetItem::Margin m ) { return m_layout.margins[m]; }
00054 const double * margins() const { return m_layout.margins; }
00055 void setMargin( QStyleSheetItem::Margin m, double _i );
00056 void setMargins( const double * _i );
00057
00059 double kwLineSpacing() const { return m_layout.lineSpacingValue(); }
00060
00061 void setLineSpacing( double _i );
00062
00063 KoParagLayout::SpacingType kwLineSpacingType() const { return m_layout.lineSpacingType; }
00064
00065 void setLineSpacingType( KoParagLayout::SpacingType _type );
00066
00067
00069 void setAlign( int align );
00071 int resolveAlignment() const;
00072
00075 int breakableTopMargin() const;
00076
00077
00078 KoBorder leftBorder() const { return m_layout.leftBorder; }
00079 KoBorder rightBorder() const { return m_layout.rightBorder; }
00080 KoBorder topBorder() const { return m_layout.topBorder; }
00081 KoBorder bottomBorder() const { return m_layout.bottomBorder; }
00082 bool hasBorder() const { return m_layout.hasBorder(); }
00083
00084 void setLeftBorder( const KoBorder & _brd ) { m_layout.leftBorder = _brd; }
00085 void setRightBorder( const KoBorder & _brd ) { m_layout.rightBorder = _brd; }
00086 void setTopBorder( const KoBorder & _brd );
00087 void setBottomBorder( const KoBorder & _brd );
00088
00089
00090 void setCounter( const KoParagCounter & counter );
00091 void setNoCounter();
00092 void setCounter( const KoParagCounter * pCounter )
00093 {
00094 if ( pCounter ) setCounter( *pCounter );
00095 else setNoCounter();
00096 }
00097 KoParagCounter *counter();
00098
00102 int counterWidth() const;
00103
00105 KoStyle *style() const { return m_layout.style; }
00107 void setStyle( KoStyle *style ) { m_layout.style = style; }
00109 void applyStyle( KoStyle *style );
00110
00112 const KoTabulatorList& tabList() const { return m_layout.tabList(); }
00114 void setTabList( const KoTabulatorList &tabList );
00115
00117 int shadowX( KoZoomHandler *zh ) const;
00119 int shadowY( KoZoomHandler *zh ) const;
00121 double shadowDistanceY() const;
00122
00124 void setCustomItem( int index, KoTextCustomItem * custom, KoTextFormat * currentFormat );
00126 void removeCustomItem( int index );
00127
00130 int findCustomItem( const KoTextCustomItem * custom ) const;
00131
00133 QMap<int, int>& tabCache() { return m_tabCache; }
00134
00136 QRect pixelRect( KoZoomHandler* zh ) const;
00137
00141 static void drawFontEffects( QPainter * p, KoTextFormat *format, KoZoomHandler *zh, QFont font, const QColor & color, int startX, int baseLine, int bw, int y, int h, QChar firstChar );
00142
00144 QString toString( int from = 0, int length = 0xffffffff ) const;
00145
00147 void fixParagWidth( bool viewFormattingChars );
00148
00149 #ifndef NDEBUG
00150 void printRTDebug( int );
00151 #endif
00152
00153 protected:
00154 void invalidateCounters();
00155 bool lineHyphenated( int l ) const;
00156
00157 void paintLines( QPainter &painter, const QColorGroup &cg, KoTextCursor *cursor, bool drawSelections,
00158 int clipx, int clipy, int clipw, int cliph );
00159
00160 void drawParagString( QPainter &painter, const QString &str, int start, int len, int startX,
00161 int lastY, int baseLine, int bw, int h, bool drawSelections,
00162 KoTextFormat *lastFormat, const QMemArray<int> &selectionStarts,
00163 const QMemArray<int> &selectionEnds, const QColorGroup &cg, bool rightToLeft, int line );
00164 void drawParagStringInternal( QPainter &painter, const QString &s, int start, int len, int startX,
00165 int lastY, int baseLine, int bw, int h, bool drawSelections,
00166 KoTextFormat *lastFormat, const QMemArray<int> &selectionStarts,
00167 const QMemArray<int> &selectionEnds, const QColorGroup &cg, bool rightToLeft, int line, KoZoomHandler* zh, bool drawingShadow );
00168
00170 enum { FormattingSpace = 1, FormattingBreak = 2, FormattingEndParag = 4, FormattingTabs = 8,
00171 AllFormattingChars = FormattingSpace | FormattingBreak | FormattingEndParag | FormattingTabs };
00172
00177 virtual void drawFormattingChars( QPainter &painter, int start, int len,
00178 int lastY_pix, int baseLine_pix, int h_pix,
00179 bool drawSelections,
00180 KoTextFormat *format, const QMemArray<int> &selectionStarts,
00181 const QMemArray<int> &selectionEnds, const QColorGroup &cg,
00182 bool rightToLeft, int line, KoZoomHandler* zh,
00183 int whichFormattingChars );
00184
00185 protected:
00186 KoParagLayout m_layout;
00187 QMap<int, int> m_tabCache;