00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef RTFGENERATOR_H
00019 #define RTFGENERATOR_H
00020
00021 #include <iostream>
00022 #include <fstream>
00023 #include <string>
00024 #include <sstream>
00025
00026 #include "codegenerator.h"
00027 #include "charcodes.h"
00028 #include "version.h"
00029
00030 namespace highlight {
00031
00043 struct PageSize {
00044 int width;
00045 int height;
00046 PageSize(){
00047 }
00048 PageSize(int w, int h){
00049 width=w;
00050 height = h;
00051 }
00052 };
00053
00054 typedef map<string, struct PageSize> PagesizeMap;
00055
00056 class RtfGenerator : public highlight::CodeGenerator
00057 {
00058 public:
00059
00060 RtfGenerator();
00061
00062 ~RtfGenerator();
00063
00069 bool initStyle(const string& stylePath);
00070
00074 string getHeader(const string & title);
00075
00077 string getFooter();
00078
00080 void printBody();
00081
00083 void setPageSize(const string & ps);
00084
00085 private:
00086
00087 PagesizeMap psMap;
00088 string pageSize;
00089
00091 virtual string maskCharacter(unsigned char );
00092
00094 string formatStyleAttributes( const ElementStyle & col);
00095
00097 string getOpenTag(int styleNumber,const ElementStyle &);
00098
00099 string getCloseTag(const ElementStyle &);
00100
00101 string getMatchingOpenTag(unsigned int styleID);
00102 string getMatchingCloseTag(unsigned int styleID);
00103 };
00104
00105 }
00106 #endif