Back to index

scribus-ng  1.3.4.dfsg+svn20071115
smlinestyle.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 
00008 #ifndef SMLINESTYLE_H
00009 #define SMLINESTYLE_H
00010 
00011 #include "scribusstructs.h"
00012 #include "styleitem.h"
00013 #include "smlinestylewbase.h"
00014 
00015 #include <qobject.h>
00016 #include <qcolor.h>
00017 
00018 class ScribusDoc;
00019 class LineCombo;
00020 class MSpinBox;
00021 
00022 class LineStyleWidget : public LineStyleWBase // .ui implementation
00023 {
00024        Q_OBJECT
00025 public:
00026        LineStyleWidget();
00027        ~LineStyleWidget();
00028        void showStyle(const multiLine &lineStyle, ColorList &colorList, int subLine = 0);
00029 
00030        void languageChange();
00031 
00032 private:
00033        LineCombo *dashCombo;
00034        MSpinBox  *lineWidth;
00035        multiLine  currentStyle;
00036        ColorList  colors;
00037 
00038        void updateLineList();
00039        QColor getColor(const QString &name, int shade);
00040 
00041        friend class SMLineStyle;
00042 
00043 protected slots:
00044        void slotEditNewLine(int i);
00045 
00046 };
00047 
00048 class SMLineStyle : public StyleItem
00049 {
00050        Q_OBJECT
00051 public:
00052        SMLineStyle();
00053        ~SMLineStyle();
00054        QTabWidget* widget();
00055        QString typeNamePlural();
00056        QString typeNameSingular();
00057        void currentDoc(ScribusDoc *doc);
00058        QValueList<StyleName> styles(bool reloadFromDoc = true);
00059        void reload();
00060        void selected(const QStringList &styleNames);
00061        QString fromSelection() const;
00062        void toSelection(const QString &styleName) const;
00063        QString newStyle();
00064        QString newStyle(const QString &fromStyle);
00065        void apply();
00066        QString shortcut(const QString &stylename) const;
00067        void setShortcut(const QString &shortcut);
00068        void deleteStyles(const QValueList<RemoveItem> &removeList);
00069        void nameChanged(const QString &newName);
00070        QString getUniqueName(const QString &name);
00071        void languageChange();
00072        void unitChange();
00073 
00074 signals:
00075        void deleteDone();
00076        void selectionDirty();
00077 
00078 private:
00079        ScribusDoc               *doc_;
00080        LineStyleWidget          *widget_;
00081        QTabWidget               *twidget_;
00082        QMap<QString, multiLine>  tmpLines;
00083        bool                      selectionIsDirty_;
00084        QMap<QString, multiLine*> selection_;
00085        QValueList<RemoveItem>    deleted_;
00086        int                       currentLine_;
00087 
00088        void setSelection(const QString& styleName);
00089        void setMultiSelection(const QStringList& styles);
00090        void setupConnections();
00091        void removeConnections();
00092        void updateSList();
00093        void updatePreview();
00094        void resort();
00095        void rebuildList();
00096        QColor calcFarbe(const QString &name, int shade);
00097 
00098 private slots:
00099        void slotCurrentLineChanged(int i);
00100        void slotLineStyle(int i);
00101        void slotSetEnd(int i);
00102        void slotSetJoin(int i);
00103        void slotColor(const QString &s);
00104        void slotShade(int i);
00105        void slotLineWidth();
00106        void slotAddLine();
00107        void slotDeleteLine();
00108 
00109        // FIXME make line styles subclass of Style and remove this hack
00110        // ugly hack which will be removed once all styles are subclassed from Style
00111        friend class StyleManager;
00112 };
00113 
00114 #endif