Back to index

scribus-ng  1.3.4.dfsg+svn20071115
tabruler.h
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #ifndef TABRULER_H
00008 #define TABRULER_H
00009 
00010 #include <qvariant.h>
00011 #include <qwidget.h>
00012 
00013 #include "scribusapi.h"
00014 #include "sctextstruct.h"
00015 
00016 class QVBoxLayout;
00017 class QHBoxLayout;
00018 class QGridLayout;
00019 class QComboBox;
00020 class QLabel;
00021 class QPushButton;
00022 class MSpinBox;
00023 class QToolButton;
00024 
00025 class SCRIBUS_API RulerT : public QWidget
00026 {
00027        Q_OBJECT
00028 
00029 public:
00030        RulerT(QWidget* parent, int ein, QValueList<ParagraphStyle::TabRecord> Tabs, bool ind, double wid);
00031        ~RulerT() {};
00032        void setTabs(QValueList<ParagraphStyle::TabRecord> Tabs, int dEin);
00033        void updateTabList();
00034        bool mousePressed;
00035        QValueList<ParagraphStyle::TabRecord> tabValues;
00036        bool haveInd;
00037        int unitIndex;
00038        int offset;
00039        int actTab;
00040        double leftIndent;
00041        double firstLine;
00042        double Width;
00043        int rulerCode;
00044        int mouseX;
00045        int offsetIncrement;
00046 
00047 public slots:
00048        void resetOffsetInc();
00049        void decreaseOffset();
00050        void increaseOffset();
00051        void changeTab(int t);
00052        void changeTabChar(QChar t);
00053        void moveTab(double t);
00054        void moveFirstLine(double t);
00055        void moveLeftIndent(double t);
00056 
00057 signals:
00058        void tabMoved(double);
00059        void typeChanged(int);
00060        void fillCharChanged(QChar);
00061        void leftIndentMoved(double);
00062        void firstLineMoved(double);
00063        void noTabs();
00064        void newTab();
00065        void mouseReleased();
00066        void tabSelected();
00067 
00068 protected:
00069        virtual void paintEvent(QPaintEvent *);
00070        virtual void mousePressEvent(QMouseEvent *m);
00071        virtual void mouseReleaseEvent(QMouseEvent *);
00072        virtual void mouseMoveEvent(QMouseEvent *m);
00073        virtual void leaveEvent(QEvent*);
00074        
00075 private:
00076        double iter, iter2;
00077 };
00078 
00079 class SCRIBUS_API Tabruler : public QWidget
00080 {
00081        Q_OBJECT
00082 
00083 public:
00084        Tabruler( QWidget* parent,
00085                  bool haveFirst = true,
00086                  int dEin = 1,
00087                  QValueList<ParagraphStyle::TabRecord> Tabs = QValueList<ParagraphStyle::TabRecord>(),
00088                  double wid = -1);
00089        ~Tabruler() {};
00090 
00091        virtual void setTabs(QValueList<ParagraphStyle::TabRecord> Tabs, int dEin);
00092 
00093        QValueList<ParagraphStyle::TabRecord> getTabVals();
00094        bool haveF;
00095        double getFirstLine();
00096        double getLeftIndent();
00097        double getRightIndent();
00098 
00099 public slots:
00100        void resetOFfL();
00101        void resetOFfR();
00102        void clearAll();
00103        void tabAdded();
00104        void lastTabRemoved();
00105        void setTabType(int t);
00106        void setType();
00107        void setTabData(double t);
00108        void setTab();
00109        void setFirstLineData(double t);
00110        void setFirstLine();
00111        void setLeftIndentData(double t);
00112        void setLeftIndent();
00113        void setRightIndentData(double t);
00114        void setRightIndent();
00115        void setTabFillChar(QChar t);
00116        void setFillChar();
00117        void setCustomFillChar(const QString &txt);
00118 
00119 signals:
00122        void tabrulerChanged();
00123 
00125        void tabsChanged();
00127        void leftIndentChanged(double);
00129        void rightIndentChanged(double);
00131        void firstLineChanged(double);
00132        void mouseReleased();
00133 
00134 protected:
00135        QVBoxLayout* tabrulerLayout;
00136        QHBoxLayout* layout2;
00137        QHBoxLayout* layout1;
00138        QHBoxLayout* indentLayout;
00139        QVBoxLayout* layout3;
00140        QHBoxLayout *layout4;
00141        QComboBox* TypeCombo;
00142        QComboBox* tabFillCombo;
00143        QLabel* tabFillComboT;
00144        RulerT* ruler;
00145        QToolButton* rulerScrollL;
00146        QToolButton* rulerScrollR;
00147        QLabel* positionLabel;
00148        QLabel* firstLineLabel;
00149        QLabel* leftIndentLabel;
00150        QLabel* rightIndentLabel;
00151        MSpinBox* tabData;
00152        MSpinBox* firstLineData;
00153        MSpinBox* leftIndentData;
00154        MSpinBox* rightIndentData;
00155        QPushButton* clearButton;
00156 
00157        double docUnitRatio;
00158 protected slots:
00159        void slotMouseReleased();
00160 };
00161 
00162 #endif // TABRULER_H