filters

fileheader.h

00001 /*
00002 ** Header file for inclusion with kword_xml2latex.c
00003 **
00004 ** Copyright (C) 2000, 2002 Robert JACOLIN
00005 **
00006 ** This library is free software; you can redistribute it and/or
00007 ** modify it under the terms of the GNU Library General Public
00008 ** License as published by the Free Software Foundation; either
00009 ** version 2 of the License, or (at your option) any later version.
00010 **
00011 ** This library is distributed in the hope that it will be useful,
00012 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 ** Library General Public License for more details.
00015 **
00016 ** To receive a copy of the GNU Library General Public License, write to the
00017 ** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 **
00020 */
00021 
00022 #ifndef __KWORD_FILEHEADER_H__
00023 #define __KWORD_FILEHEADER_H__
00024 
00025 #include <qtextstream.h>
00026 
00027 #include "xmlparser.h"
00028 
00029 /***********************************************************************/
00030 /* Class: FileHeader                                                   */
00031 /***********************************************************************/
00032 
00039 class FileHeader: public XmlParser
00040 {
00041     public:
00042         enum TFormat { TF_A3, TF_A4, TF_A5, TF_USLETTER, TF_USLEGAL, TF_SCREEN,
00043             TF_CUSTOM, TF_B3, TF_USEXECUTIVE };
00044         enum TUnit { TU_MM, TU_CM, TU_PT, TU_INCH };
00045         enum TOrient { TO_PORTRAIT, TO_LANDSCAPE };
00046         enum TColonne { TC_NONE, TC_1, TC_2, TC_MORE };
00047         enum THeadfoot { TH_ALL = 0, TH_XXX = 1, TH_FIRST = 2, TH_EVODD = 3 };
00048         enum TProcType { TP_NORMAL, TP_DTP };
00049 
00050         static FileHeader* instance(void);
00051 
00052     private:
00053         /* PAPER */
00054         TFormat   _format;
00055         double    _width,
00056                 _height;
00057         TOrient   _orientation;
00058         TColonne  _colonne;
00059         double    _columnSpacing;
00060         THeadfoot _headType;
00061         THeadfoot _footType;
00062         TProcType _processing;
00063         int       _standardPage;
00064         double    _footBody;
00065         double    _headBody;
00066 
00067         /* PAPERBORDERS */
00068         double    _leftBorder,
00069                 _rightBorder,
00070                 _bottomBorder,
00071                 _topBorder;
00072 
00073         /* ATTRIBUTES */
00074         TUnit    _unite;
00075         bool     _hasHeader;
00076         bool     _hasFooter;
00077         bool     _hasTOC;
00078 
00079         /* FOOTNOTEMGR */
00080 
00081         /* DIVERSE */
00082         /* for special packages to include */
00083         bool     _hasColor;
00084         bool     _hasUnderline;
00085         bool     _hasEnumerate;
00086         bool     _hasGraphics;
00087         bool     _hasTable;
00088 
00089     public:
00090         
00094         virtual ~FileHeader();
00095 
00099         TFormat   getFormat        () const { return _format;         }
00100         TOrient   getOrientation   () const { return _orientation;    }
00101         TColonne  getColumns       () const { return _colonne;        }
00102         THeadfoot getHeadType      () const { return _headType;       }
00103         THeadfoot getFootType      () const { return _footType;       }
00104         TUnit     getUnit          () const { return _unite;          }
00105         TProcType getProcessing    () const { return _processing;     }
00106         int       getStandardPge   () const { return _standardPage;   }
00107         bool      hasHeader        () const { return _hasHeader;      }
00108         bool      hasFooter        () const { return _hasFooter;      }
00109         bool      hasTOC           () const { return _hasTOC;         }
00110         bool      hasColor         () const { return _hasColor;       }
00111         bool      hasUnderline     () const { return _hasUnderline;   }
00112         bool      hasEnumerate     () const { return _hasEnumerate;   }
00113         bool      hasGraphics      () const { return _hasGraphics;    }
00114         bool      hasTable         () const { return _hasTable;       }
00115 
00119         void setFormat     (TFormat f)  { _format       = f;              }
00120         void setFormat     (int f)      { _format       = (TFormat) f;    }
00121         void setOrientation(TOrient o)  { _orientation  = o;              }
00122         void setOrientation(int o)      { _orientation  = (TOrient) o;    }
00123         void setColumns    (TColonne c) { _colonne      = c;              }
00124         void setColumns    (int c)      { _colonne      = (TColonne) c;   }
00125         void setUnit       (int u)      { _unite        = (TUnit) u;      }
00126         void setProcessing (int p)      { _processing   = (TProcType) p;  }
00127         void setStandardPge(int s)      { _standardPage = s;              }
00128         void setTOC        (int t)      { _hasTOC       = t;              }
00129         void setHeadType   (int ht)     { _headType     = (THeadfoot) ht; }
00130         void setFootType   (int ft)     { _footType     = (THeadfoot) ft; }
00131         void useColor      ()           { _hasColor     = true;           }
00132         void useUnderline  ()           { _hasUnderline = true;           }
00133         void useEnumerate  ()           { _hasEnumerate = true;           }
00134         void useGraphics   ()           { _hasGraphics  = true;           }
00135         void useTable      ()           { _hasTable     = true;           }
00136 
00137         void analysePaper     (const QDomNode);
00138         void analyseAttributs (const QDomNode);
00139 
00140         void generate         (QTextStream &);
00141 
00142     protected:
00146         FileHeader();       /* Ensure singleton */
00147 
00148         static FileHeader* _instance; /* singleton */
00149 
00150     private:
00151 
00152         void analysePaperParam(const QDomNode);
00153 
00154         void generatePaper    (QTextStream&);
00155         void generateLatinPreambule(QTextStream&);
00156         void generateUnicodePreambule(QTextStream&);
00157         void generatePackage  (QTextStream&);
00158 
00159 };
00160 
00161 #endif /* __KWORD_FILEHEADER_H__ */
KDE Home | KDE Accessibility Home | Description of Access Keys