filters

layout.h

00001 
00002 /*
00003 ** Header file for inclusion with kword_xml2latex.c
00004 **
00005 ** Copyright (C) 2000 Robert JACOLIN
00006 **
00007 ** This library is free software; you can redistribute it and/or
00008 ** modify it under the terms of the GNU Library General Public
00009 ** License as published by the Free Software Foundation; either
00010 ** version 2 of the License, or (at your option) any later version.
00011 **
00012 ** This library is distributed in the hope that it will be useful,
00013 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 ** Library General Public License for more details.
00016 **
00017 ** To receive a copy of the GNU Library General Public License, write to the
00018 ** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020 **
00021 */
00022 
00023 #ifndef __KWORD_LAYOUT_H__
00024 #define __KWORD_LAYOUT_H__
00025 
00026 #include <qtextstream.h>
00027 #include <qstring.h>
00028 #include <kdebug.h>
00029 #include "textformat.h"
00030 
00031 enum _EType
00032 {
00033     TL_NONE,        /* NONE       */
00034     TL_ARABIC,      /* 1, 2, ...  */
00035     TL_LLETTER,     /* a, b, ...  */
00036     TL_CLETTER,     /* A, B, ...  */
00037     TL_LLNUMBER,        /* i, ii, ... */
00038     TL_CLNUMBER,        /* I, II, ... */
00039     TL_CUSTOM_SIMPLE,   /* */
00040     TL_CUSTOM_COMPLEX,  /* */
00041     TL_CIRCLE_BULLET,   /* o */
00042     TL_SQUARE_BULLET,   /* * */
00043     TL_DISC_BULLET      /* o */
00044 };
00045 
00046 enum _EEnv
00047 {
00048     ENV_NONE,
00049     ENV_LEFT,
00050     ENV_RIGHT,
00051     ENV_CENTER,
00052     ENV_JUSTIFY /* default in latex */
00053 };
00054 
00055 typedef enum _EType EType;
00056 typedef enum _EEnv EEnv;
00057 
00058 /***********************************************************************/
00059 /* Class: Layout                                                       */
00060 /***********************************************************************/
00061 
00066 class Layout: public TextFormat
00067 {
00068     QString      _name;
00069     QString      _following;
00070     EType        _counterType;
00071     int          _counterDepth;
00072     int          _counterBullet;
00073     int          _counterStart;
00074     int          _numberingType;
00075     EEnv         _env;
00076     static QString _last_name;
00077     static EType   _last_counter;
00078     bool           _useHardBreakAfter;
00079     bool           _useHardBreak;
00080     bool           _keepLinesTogether;
00081     
00082     public:
00088         Layout();
00089 
00090         /* 
00091          * Destructor
00092          *
00093          * Nothing to do.
00094          */
00095         virtual ~Layout() {
00096             kdDebug(30522) << "Destruction of a layout." << endl;
00097         }
00098 
00102         bool    isChapter          () const { return (_numberingType == 1); }
00103         bool    isList             () const { return (_numberingType == 0); }
00104         bool    isEnum             () const { return (_counterType != TL_NONE); }
00105         bool    isLastSame         () const { return (_name == _last_name); }
00106         bool    isNextSame         () const { return (_following == _name); }
00107         QString getLastName        () const { return _last_name;     }
00108         EType   getLastCounter     () const { return _last_counter;  }
00109         EType   getCounterType     () const { return _counterType;   }
00110         int     getCounterDepth    () const { return _counterDepth;  }
00111         int     getCounterBullet   () const { return _counterBullet; }
00112         int     getCounterStart    () const { return _counterStart;  }
00113         int     getNumberingType   () const { return _numberingType; }
00114         EEnv    getEnv             () const { return _env;           }
00115         bool    isHardBreakAfter   () const { return _useHardBreakAfter; }
00116         bool    isHardBreak        () const { return _useHardBreak;      }
00117         bool    isKeppLinesTogether() const { return _keepLinesTogether; }
00118 
00122         void setName         (QString name) { _name = name; }
00123         void setLastName     ()             { _last_name   = _name; }
00124         void setLastCounter  ()             { _last_counter= _counterType; }
00125         void setFollowing    (QString name) { _following = name; }
00126         void setCounterType  (int ct)       { _counterType   = (EType) ct; }
00127         void setCounterDepth (int cd)       { _counterDepth  = cd; }
00128         void setCounterBullet(int cb)       { _counterBullet = cb; }
00129         void setCounterStart (int cs)       { _counterStart  = cs; }
00130         void setNumberingType(int nt)       { _numberingType = nt; }
00131         void setEnv          (int env)      { _env = (EEnv) env;   }
00132         void useHardBreakAfter()            { _useHardBreakAfter = true; }
00133         void useHardBreak     ()            { _useHardBreak      = true; }
00134         void keepLinesTogether()            { _keepLinesTogether = true; }
00135 
00140         void analyseLayout  (const QDomNode);
00141 
00142     private:
00143         void analyseCounter  (const QDomNode);
00144         void analyseFollowing(const QDomNode);
00145         void analyseName     (const QDomNode);
00146         void analyseEnv      (const QDomNode);
00147         void analyseBreakLine(const QDomNode);
00148 };
00149 
00150 #endif /* __KWORD_LAYOUT_H__ */
KDE Home | KDE Accessibility Home | Description of Access Keys