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 #ifndef RTFGENERATOR_H
00029 #define RTFGENERATOR_H
00030
00031 #include <string>
00032
00033 #include "codegenerator.h"
00034
00035 namespace highlight
00036 {
00037
00041 struct PageSize
00042 {
00044 int width;
00046 int height;
00047
00048 PageSize()
00049 {
00050 }
00051
00055 PageSize ( int w, int h )
00056 {
00057 width=w;
00058 height = h;
00059 }
00060
00061 };
00062
00064 typedef map<string, struct PageSize> PagesizeMap;
00065
00076 class RtfGenerator : public highlight::CodeGenerator
00077 {
00078 public:
00079
00080 RtfGenerator();
00081
00082 ~RtfGenerator();
00083
00086 void setRTFPageSize ( const string & ps );
00087
00089 void setRTFCharStyles ( bool cs );
00090
00091 private:
00092
00095 string getHeader();
00096
00098 string getFooter();
00099
00101 void printBody();
00102
00104 void initOutputTags();
00105
00107 PagesizeMap psMap;
00108
00110 string pageSize;
00111
00113 bool addCharStyles;
00114
00116 virtual string maskCharacter ( unsigned char );
00117
00119 string getAttributes ( const ElementStyle & col );
00120
00124 string getOpenTag ( int styleNumber,const ElementStyle &elem );
00125
00130 string getCharStyle ( int styleNumber,const ElementStyle &elem, const string&styleName );
00131
00134 string getCloseTag ( const ElementStyle &elem );
00135
00138 string getKeywordOpenTag ( unsigned int styleID );
00139
00142 string getKeywordCloseTag ( unsigned int styleID );
00143 };
00144
00145 }
00146 #endif