Back to index

scribus-ng  1.3.4.dfsg+svn20071115
scribus.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                           scribus.h  -  description
00009                              -------------------
00010     begin                : Fre Apr  6 21:09:31 CEST 2001
00011     copyright            : (C) 2001 by Franz Schmid
00012     email                : Franz.Schmid@altmuehlnet.de
00013  ***************************************************************************/
00014 
00015 /***************************************************************************
00016  *                                                                         *
00017  *   This program is free software; you can redistribute it and/or modify  *
00018  *   it under the terms of the GNU General Public License as published by  *
00019  *   the Free Software Foundation; either version 2 of the License, or     *
00020  *   (at your option) any later version.                                   *
00021  *                                                                         *
00022  ***************************************************************************/
00023 
00024 #ifndef SCRIBUS_H
00025 #define SCRIBUS_H
00026 
00027 #define VERS13x
00028 
00029 // include from stl
00030 #include <vector>
00031 
00032 // include files for QT
00033 #include <qapplication.h>
00034 #include <qmainwindow.h>
00035 #include <qaction.h>
00036 #include <qmenubar.h>
00037 #include <qpopupmenu.h>
00038 #include <qtoolbar.h>
00039 #include <qtoolbutton.h>
00040 #include <qstatusbar.h>
00041 #include <qtooltip.h>
00042 #include <qstring.h>
00043 #include <qpixmap.h>
00044 #include <qmessagebox.h>
00045 #include <qpainter.h>
00046 #include <qmap.h>
00047 #include <qdict.h>
00048 #include <qguardedptr.h>
00049 #include <qfont.h>
00050 #include <qtimer.h>
00051 #include <qintdict.h>
00052 #include <qprogressdialog.h>
00053 #include <qprogressbar.h>
00054 #include <qworkspace.h>
00055 #include <qptrlist.h>
00056 #include <qclipboard.h>
00057 #include <qprocess.h>
00058 
00059 // application specific includes
00060 #include "scribusapi.h"
00061 #include "scribusview.h"
00062 #include "scribusdoc.h"
00063 #include "scribusstructs.h"
00064 #include "customfdialog.h"
00065 
00066 class ActionManager;
00067 class AlignDistributePalette;
00068 class Autoforms;
00069 class Biblio;
00070 class BookPalette;
00071 class CheckDocument;
00072 
00073 class FontCombo;
00074 class GuideManager;
00075 class CharSelect;
00076 class ColorCombo;
00077 class LayerPalette;
00078 class LineFormate;
00079 class Mpalette;
00080 class Measurements;
00081 class MenuManager;
00082 class NodePalette;
00083 class PageItem;
00084 class PagePalette;
00085 class Preferences;
00086 class PrefsManager;
00087 class PrefsContext;
00088 class PSLib;
00089 class ReformDoc;
00090 class ScrAction;
00091 class ScribusCore;
00092 class ScribusMainWindow;
00093 class ScribusQApp;
00094 class ScribusWin;
00095 class ScToolBar;
00096 class SimpleState;
00097 class StilFormate;
00098 class StoryEditor;
00099 class StyleManager;
00100 class TOCGenerator;
00101 class Tree;
00102 class UndoManager;
00103 class UndoPalette;
00104 class UndoState;
00105 class ModeToolBar;
00106 class PDFToolBar;
00107 
00108 extern SCRIBUS_API ScribusQApp* ScQApp;
00109 
00116 class SCRIBUS_API ScribusMainWindow : public QMainWindow, public UndoObject
00117 {
00118        Q_OBJECT
00119 
00120 public:
00122        ScribusMainWindow();
00124        ~ScribusMainWindow();
00128        int initScMW(bool primaryMainwWindow);
00129        bool warningVersion(QWidget *parent);
00130        void SetShortCut();
00131        void startUpDialog();
00132        void setDefaultPrinter(const QString&, const QString&, const QString&);
00133        void getDefaultPrinter(QString*, QString*, QString*);
00134 
00135        ScribusDoc *doFileNew(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, const QString& defaultPageSize, bool requiresGUI, int pageCount=1, bool showView=true);
00136        ScribusDoc *newDoc(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, const QString& defaultPageSize, bool requiresGUI, int pageCount=1, bool showView=true);
00137        bool DoFileSave(QString fn);
00138        void closeEvent(QCloseEvent *ce);
00139        void keyPressEvent(QKeyEvent *k);
00140        void keyReleaseEvent(QKeyEvent *k);
00141        void mouseReleaseEvent(QMouseEvent *m);
00142        void wheelEvent(QWheelEvent *w);
00143        void setTBvals(PageItem *currItem);
00144        void ShowSubs();
00145        void applyNewMaster(QString name);
00146        void updateRecent(QString fn);
00147        QString GetLang(QString inLang);
00148        bool getPDFDriver(const QString & fn, const QString & nam,
00149                                      int Components, const std::vector<int> & pageNs,
00150                                      const QMap<int,QPixmap> & thumbs);
00151        bool DoSaveAsEps(QString fn);
00152        QString CFileDialog(QString wDir = ".", QString caption = "", QString filter = "", QString defNa = "",
00153                                           int optionFlags = fdExistingFiles, bool *docom = 0, bool *doFont = 0, bool *doProfiles = 0);
00157        void recalcColors(QProgressBar *dia = 0);
00158        void SwitchWin();
00159        void RestoreBookMarks();
00160 //     void ReorgFonts();
00161 
00162        void emergencySave();
00163 
00168        bool arrowKeyDown();
00173        bool isObjectSpecificUndo();
00174        void restore(UndoState* state, bool isUndo);
00175        void restoreGrouping(SimpleState *state, bool isUndo);
00176        void restoreUngrouping(SimpleState *state, bool isUndo);
00177        void restoreAddPage(SimpleState *state, bool isUndo);
00178        void restoreDeletePage(SimpleState *state, bool isUndo);
00179        struct CopyPasteBuffer Buffer;
00180        struct CopyContentsBuffer contentsBuffer;
00181        QString Buffer2;
00182        QString Buffer3;
00183        bool BuFromApp;
00184        int HaveDoc;
00185        PrefsContext* dirs;
00191        ScribusView *view;
00195        ScribusDoc *doc;
00196 
00197 
00198        QProgressBar* mainWindowProgressBar;
00199        QLabel* mainWindowXPosLabel;
00200        QLabel* mainWindowXPosDataLabel;
00201        QLabel* mainWindowYPosLabel;
00202        QLabel* mainWindowYPosDataLabel;
00203        GuideManager *guidePalette;
00204        CharSelect *charPalette;
00205        Mpalette *propertiesPalette;
00206        NodePalette *nodePalette;
00207        Tree *outlinePalette;
00208        Biblio *scrapbookPalette;
00209        LayerPalette* layerPalette;
00210        PagePalette *pagePalette;
00211        BookPalette *bookmarkPalette;
00212        Measurements* measurementPalette;
00213        CheckDocument * docCheckerPalette;
00214        UndoPalette* undoPalette;
00215        AlignDistributePalette *alignDistributePalette;
00216        StoryEditor* storyEditor;
00217        StoryEditor* CurrStED;
00218        QMap<QString,QString> Sprachen;
00219        QWorkspace *wsp;
00220        ScribusWin* ActWin;
00221        QClipboard *ClipB;
00222        QString LoadEnc;
00223        bool ScriptRunning;
00224        Autoforms* SCustom;
00225        ModeToolBar* mainToolBar;
00226 
00227        QMap<QString, QStringList> InstLang;
00228        QMap<QString,QString> LangTransl;
00229 
00230        QProcess *ExternalApp;
00231 
00232        QMap<QString, QGuardedPtr<ScrAction> > scrActions;
00233        QMap<QString, QGuardedPtr<ScrAction> > scrRecentFileActions;
00234        QMap<QString, QGuardedPtr<ScrAction> > scrWindowsActions;
00235        QMap<QString, QGuardedPtr<ScrAction> > scrLayersActions;
00236        QMap<QString, QGuardedPtr<ScrAction> > scrRecentPasteActions;
00237        QDict<QActionGroup> scrActionGroups;
00238        MenuManager* scrMenuMgr;
00239        ActionManager* actionManager;
00240        QStringList RecentDocs;
00241 
00242 public slots:
00243        void languageChange();
00244        void specialActionKeyEvent(const QString& actionName, int unicodevalue);
00245        void newView();
00246        void ToggleStickyTools();
00247        void ToggleAllGuides();
00248        void ToggleAllPalettes();
00249        void slotStoryEditor();
00250        void slotCharSelect();
00251        void ImageEffects();
00252        QString Collect(const bool compress = false, const bool withFonts = false, const bool withProfiles = false, const QString& newDirectory=QString::null);
00253        void AddBookMark(PageItem *ite);
00254        void DelBookMark(PageItem *ite);
00255        void BookMarkTxT(PageItem *ite);
00256        void StoreBookmarks();
00257        //void setItemFillTransparency(double t);
00258        //void setItemLineTransparency(double t);
00259        void setStatusBarMousePosition(double xp, double yp);
00260        void setStatusBarInfoText(QString newText);
00261        bool DoFileClose();
00262        //bool DoSaveClose();
00263        void fontMenuAboutToShow();
00264        void windowsMenuAboutToShow();
00265        void newActWin(QWidget *w);
00266        void closeActiveWindowMasterPageEditor();
00267        void updateActiveWindowCaption(const QString &newCaption);
00268        void windowsMenuActivated(int id);
00269        void UnDoAction();
00270        void RedoAction();
00271        //void doHyphenate();
00272        //void doDeHyphenate();
00273        void slotTest();
00274        void slotTest2();
00275        void PutScrap();
00276        void PutToPatterns();
00277        void changeLayer(int);
00278        void showLayer();
00279        //void LayerRemove(int l, bool dl = false);
00280        void ManageJava();
00281        void manageMasterPages(QString temp = "");
00282        void manageMasterPagesEnd();
00284        bool slotFileNew();
00285        bool slotPageImport();
00286        bool loadPage(QString fileName, int Nr, bool Mpa, const QString& renamedPageName=QString::null);
00287 
00288        void slotGetContent();
00289        void slotGetContent2(); // kk2006
00294        void slotFileAppend();
00295 
00296        void removeRecent(QString fn);
00297        void loadRecent(QString fn);
00298        void rebuildRecentFileMenu();
00299        void rebuildRecentPasteMenu();
00300        void pasteRecent(QString fn);
00301        void rebuildLayersList();
00302        bool slotDocOpen();
00303        bool loadDoc(QString);
00307        bool postLoadDoc();
00308        void slotAutoSaved();
00310        bool slotFileSave();
00312        bool slotFileSaveAs();
00313        void slotFileRevert();
00315        void SaveText();
00317        bool slotFileClose();
00319        void slotFilePrint();
00320        void slotReallyPrint();
00327        bool doPrint(PrintOptions &options);
00329        void slotFileQuit();
00332        void slotEditCut();
00334        void slotEditCopy();
00336        void slotEditPaste();
00337        void slotEditCopyContents();
00338        void slotEditPasteContents(int absolute=0);
00339        void EnableTxEdit();
00340        void DisableTxEdit();
00341        void SelectAll();
00342        void deselectAll();
00343        void ClipChange();
00344        //void clearContents();
00346        void slotHelpAbout();
00347        void slotHelpAboutPlugins();
00348     void slotHelpAboutQt();
00349        void slotOnlineHelp();
00350        void ToggleTips();
00352        void slotNewPageP(int wo, QString templ);
00353        void slotNewPageM();
00354        void slotNewMasterPage(int w, const QString &);
00355        void slotNewPage(int w, const QString& masterPageName=QString::null, bool mov = true);
00356        void duplicateToMasterPage();
00358        void DeletePage();
00364        void DeletePage(int from, int to);
00365        void DeletePage2(int pg);
00367        void MovePage();
00368        void CopyPage();
00369        void changePageMargins();
00377        void slotZoom(double zoomFactor); // 20, 50, 100, or -100 for Fit
00379        void ToggleMarks();
00380        void ToggleBleeds();
00381        void ToggleFrames();
00382        void ToggleLayerMarkers();
00383        void ToggleTextLinks();
00384        void ToggleTextControls();
00385        void ToggleColumnBorders();
00386        void ToggleRulers();
00387        void ToggleRulerMode();
00388        /* Schaltet Masspalette ein/aus */
00389        //void togglePropertiesPalette();
00390        /* Schaltet Uebersichtspalette ein/aus*/
00391        //void toggleOutlinePalette();
00392        //void toggleScrapbookPalette();
00393        //void toggleLayerPalette();
00394        void togglePagePalette();
00395        void setPagePalette(bool visible);
00396        //void toggleBookmarkPalette();
00397        void toggleUndoPalette();
00398        void setUndoPalette(bool visible);
00399        void toggleCheckPal();
00401        void TogglePics();
00403        void ToggleRaster();
00405        void ToggleURaster();
00407        void ToggleFrameEdit();
00408        void slotSelect();
00411        void setAppMode(int mode);
00412        void setAppModeByToggle(bool isOn, int newMode);
00414        void HaveNewDoc();
00415        void HaveNewSel(int Nr);
00416        void rebuildStyleMenu(int itemType);
00418        void slotDocCh(bool reb = true);
00420        void setItemFarbe(int id);
00422        void setItemShade(int id);
00424        void setItemFont(int id);
00425        void setItemFont2(int id);
00427        void AdjustFontMenu(const QString& nf);
00428        void SetNewFont(const QString& nf);
00430        void setItemFSize(int id);
00431        void setFSizeMenu(int size);
00433        void slotEditColors();
00435 //     void slotStyleManager();
00436        /*
00437        // Setzt den Pen-Tonwert
00438        void setPenShade(int sh);
00439        // Setzt den Brush-Tonwert
00440        void setBrushShade(int sh);
00441        void setGradFill(int typ);
00442        */
00443        void updtGradFill();
00444        /*
00445        // Setzt die Pen-Farbe
00446        void setPenFarbe(QString farbe);
00447        // Setzt die Brush-Farbe
00448        void setBrushFarbe(QString farbe);
00449        */
00450        void setCSMenu();
00452 //     void GetBrushPen();
00454        void MakeFrame(int f, int c, double *vals);
00455        //** Loescht ein Element */
00456        //void DeleteObjekt();
00458        void ObjektDup();
00460        void ObjektDupM();
00463        bool slotDocSetup();
00464        void objectAttributes();
00465        void getImageInfo();
00466        void generateTableOfContents();
00467        void buildFontMenu();
00470        void slotPrefsOrg();
00471        void saveStyles(StilFormate *dia); //still required for style save from SE
00472        void setNewAlignment(int a);
00473        void setNewParStyle(const QString& name);
00474        void setNewCharStyle(const QString& name);
00475        void setAbsValue(int a);
00476        void selectItemsFromOutlines(PageItem *ite);
00477        void selectItemsFromOutlines(int Page, int Item, bool single = false);
00478        void selectPagesFromOutlines(int Page);
00479        void doPrintPreview();
00480        void printPreview();
00481        void SaveAsEps();
00482        void reallySaveAsEps();
00483        void SaveAsPDF();
00484        void doSaveAsPDF();
00485        void setMainWindowActive();
00486        void setItemHoch(int h);
00487        void setStilvalue(int s);
00488        void setItemTypeStyle(int id);
00489        void slotElemRead(QString Name, double x, double y, bool art, bool loca, ScribusDoc* docc, ScribusView* vie);
00490        void slotChangeUnit(int art, bool draw = true);
00491        void NoFrameEdit();
00496        void ApplyMasterPage();
00497        void Apply_MasterPage(QString pageName, int pageNumber, bool reb = true);
00498        void GroupObj(bool showLockDia = true);
00499        void UnGroupObj();
00500        void StatusPic();
00501        void ModifyAnnot();
00502        void ToggleGuides();
00503        void ToggleBase();
00504        void ToggleUGuides();
00505        void HaveRaster(bool art);
00506        void EditTabs();
00507        void SearchText();
00508        void imageEditorExited();
00510        void callImageEditor();
00511        void docCheckToggle(bool visible);
00513        bool scanDocument();
00514        void setUndoMode(bool isObjectSpecific);
00516        void insertSampleText();
00517        //void sendToLayer(int layerNumber);
00518        void updateItemLayerList();
00522        void docSetup(ReformDoc* dia);
00526        void prefsOrg(Preferences* dia);
00528        void slotInsertFrame();
00530        void managePatterns();
00532        void enableTextActions(QMap<QString, QGuardedPtr<ScrAction> > *actionMap, bool enabled, const QString& fontName=QString::null);
00534        StyleManager *styleMgr() const {return styleManager;};
00535 
00536 signals:
00537        void TextStyle(const ParagraphStyle&);
00538 //deprecated: (av)
00539        void TextISize(int);
00540        void TextIFont(const QString&);
00541        void TextUSval(int);
00542        void TextStil(int);
00543        void TextFarben(QString, QString, int, int);
00544        void TextScale(int);
00545        void TextScaleV(int);
00546        void TextBase(int);
00547        void TextShadow(int, int);
00548        void TextOutline(int);
00549        void TextUnderline(int, int);
00550        void TextStrike(int, int);
00551 
00552 protected:
00556        bool eventFilter( QObject *o, QEvent *e );
00557        virtual void dragEnterEvent( QDragEnterEvent* e);
00558        virtual void dropEvent( QDropEvent* e);
00559 
00560 private:
00562        void initSplash(bool showSplash);
00563        void initMenuBar(); // initMenuBar creates the menu_bar and inserts the menuitems
00564        void addDefaultWindowMenuItems(); // addDefaultWindowMenuItems adds the basic Windows menu items, excluding the actual list of windows
00565        void initStatusBar(); // setup the statusbar
00566        void initToolBars(); // setup the toolbars
00567        //Returns false when there are no fonts
00568        void initHyphenator();
00569        void initDefaultValues();
00570        void initKeyboardShortcuts();
00571        void initPalettes();
00572        void initScrapbook();
00573 
00574        void updateColorMenu(QProgressBar* progressBar=NULL);
00575 
00576        QLabel* mainWindowStatusLabel;
00577        QString recentFileMenuName;
00578        QString recentPasteMenuName;
00579        QString layerMenuName;
00580        QPixmap noIcon;
00581        ColorCombo *ColorMenC;
00583        QPopupMenu *ShapeMenu;
00585        QPopupMenu *FontMenu;
00586        FontCombo* FontSub;
00587        ScToolBar *fileToolBar;
00588        ScToolBar *editToolBar;
00589        PDFToolBar* pdfToolBar;
00590        QToolButton* DatOpe;
00591        QToolButton* DatSav;
00592        QToolButton* DatClo;
00593        QToolButton* DatPri;
00594        QToolButton* DatPDF;
00595        QToolButton* DatNeu;
00596        int toolbarMenuTools;
00597        int toolbarMenuPDFTools;
00598        int viewToolbars;
00599        int viewPropertiesPalette;
00600        int viewOutlinePalette;
00601        int viewNodePalette;
00602        int viewBpal;
00603        int viewLayerPalette;
00604        int viewPagePalette;
00605        int viewBopal;
00606        int viewUndoPalette;
00607 
00608        bool palettesStatus[10];
00609        bool guidesStatus[13];
00610 
00611        bool keyrep;
00613        bool _arrowKeyDown;
00615        bool objectSpecificUndo;
00616 
00617        void addNewPages(int wo, int where, int numPages, double height, double width, int orient, QString siz, bool mov, QStringList* basedOn = 0);
00618        QMap<int,QString> FontID;
00619 
00620        void *PSDriver;
00621        int DocNr;
00622        bool PrinterUsed;
00623        struct PDe {
00624                                    QString Pname;
00625                                    QString Dname;
00626                                    QString Command;
00627                                    QByteArray DevMode;
00628                             } PDef ;
00629        TOCGenerator *tocGenerator;
00630        int storedPageNum;
00631        int storedViewXCoor;
00632        int storedViewYCoor;
00633        double storedViewScale;
00634        StyleManager *styleManager;
00635        UndoManager *undoManager;
00636        PrefsManager *prefsManager;
00637        QString currentFontForFontMenu;
00638 };
00639 
00640 #endif