00001 /* This file is part of the KDE project 00002 Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KOTABULATOR_H 00021 #define KOTABULATOR_H 00022 00023 #include <QChar> 00024 #include <QList> 00025 00026 enum KoTabulators { T_LEFT = 0, T_CENTER = 1, T_RIGHT = 2, T_DEC_PNT = 3, T_INVALID = -1 }; 00027 enum KoTabulatorFilling { TF_BLANK = 0, TF_DOTS = 1, TF_LINE = 2, TF_DASH = 3, TF_DASH_DOT = 4, TF_DASH_DOT_DOT = 5}; 00028 00033 struct KoTabulator { 00037 double ptPos; 00041 KoTabulators type; 00045 KoTabulatorFilling filling; 00049 double ptWidth; 00053 QChar alignChar; 00054 00055 bool operator==( const KoTabulator & t ) const { 00056 return QABS( ptPos - t.ptPos ) < 1E-4 && type == t.type && 00057 filling == t.filling && QABS( ptWidth - t.ptWidth ) < 1E-4; 00058 } 00059 bool operator!=( const KoTabulator & t ) const { 00060 return !operator==(t); 00061 } 00062 // Operators used for sorting 00063 bool operator < ( const KoTabulator & t ) const { 00064 return ptPos < t.ptPos; 00065 } 00066 bool operator <= ( const KoTabulator & t ) const { 00067 return ptPos <= t.ptPos; 00068 } 00069 bool operator > ( const KoTabulator & t ) const { 00070 return ptPos > t.ptPos; 00071 } 00072 }; 00073 00074 typedef QList<KoTabulator> KoTabulatorList; 00075 00076 #endif