00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
#ifndef kotextformatter_h
00021
#define kotextformatter_h
00022
00023
#include "korichtext.h"
00024
class KoZoomHandler;
00025
class KoHyphenator;
00026
00034 class KoTextFormatter :
public KoTextFormatterBase
00035 {
00036
public:
00037
KoTextFormatter();
00038
virtual ~
KoTextFormatter();
00039
00040
virtual bool format( KoTextDocument *doc, KoTextParag *parag,
int start,
const QMap<int, KoTextParagLineStart*> &oldLineStarts,
int& y,
int& widthUsed );
00041
00042
00043
virtual void postFormat( KoTextParag* parag );
00044
00045
KoHyphenator* hyphenator() {
00046
return m_hyphenator;
00047 }
00048
private:
00049
KoHyphenator* m_hyphenator;
00050 };
00051
00052
00053
00054
00055
class KoTextFormatterCore
00056 {
00057
public:
00058 KoTextFormatterCore(
KoTextFormatter* settings, KoTextDocument *doc, KoTextParag *parag,
int start );
00059
00060
bool format();
00061
00062
00063
00064
00065
00066
int widthUsed()
const {
return wused; }
00067
int resultY()
const {
return y; }
00068
00069
protected:
00070
00071
00072
QPair<int, int> determineCharWidth();
00073
00074 KoTextParagLineStart *koFormatLine(
00075
KoZoomHandler *zh,
00076 KoTextParag * , KoTextString *string, KoTextParagLineStart *line,
00077 KoTextStringChar *startChar, KoTextStringChar *lastChar,
int align,
int space );
00078
00079 KoTextParagLineStart *koBidiReorderLine(
00080
KoZoomHandler *zh,
00081 KoTextParag * , KoTextString *text, KoTextParagLineStart *line,
00082 KoTextStringChar *startChar, KoTextStringChar *lastChar,
int align,
int space );
00083
00084
void moveChar( KoTextStringChar& chr,
KoZoomHandler *zh,
00085
int deltaX,
int deltaPixelX );
00086
00087
00088
00089
00090
int leftMargin(
bool firstLine )
const;
00091
int rightMargin(
bool firstLine )
const;
00092
00093
00094
private:
00095
KoTextFormatter* settings;
00096 KoTextDocument* doc;
00097 KoTextParag* parag;
00098
int start;
00099
int wused;
00100
int y;
00101
int availableWidth;
00102
int maxY;
00103
00104
00105
00106
QPair<int,int> maxAvailableWidth;
00107
00108
00109 KoTextStringChar *c;
00110
int i;
00111
int x;
00112 };
00113
00114
#endif