00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef SCRIBUS_H
00025 #define SCRIBUS_H
00026
00027 #define VERS13x
00028
00029
00030 #include <vector>
00031
00032
00033 #include <QAction>
00034 #include <QActionGroup>
00035 #include <QApplication>
00036 #include <QClipboard>
00037 #include <QCloseEvent>
00038 #include <QDragEnterEvent>
00039 #include <QDropEvent>
00040 #include <QEvent>
00041 #include <QFont>
00042 #include <QKeyEvent>
00043 #include <QLabel>
00044 #include <QMainWindow>
00045 #include <QMap>
00046 #include <QMenu>
00047 #include <QMenuBar>
00048 #include <QMessageBox>
00049 #include <QMouseEvent>
00050 #include <QMultiHash>
00051 #include <QPainter>
00052 #include <QPixmap>
00053 #include <QPointer>
00054 #include <QProcess>
00055 #include <QProgressBar>
00056 #include <QProgressDialog>
00057 #include <QStatusBar>
00058 #include <QString>
00059 #include <QTimer>
00060 #include <QToolButton>
00061 #include <QToolTip>
00062 #include <QWheelEvent>
00063 #include <QWorkspace>
00064
00065
00066
00067 #include "scribusapi.h"
00068 #include "scribusview.h"
00069 #include "scribusdoc.h"
00070 #include "customfdialog.h"
00071
00072 class ActionManager;
00073 class AlignDistributePalette;
00074 class Autoforms;
00075 class Biblio;
00076 class BookPalette;
00077 class CharSelect;
00078 class CheckDocument;
00079 class ColorCombo;
00080 class EditToolBar;
00081 class FileToolBar;
00082 class FontCombo;
00083 class FormatsManager;
00084 class GuideManager;
00085 class HelpBrowser;
00086 class LayerPalette;
00087 class Measurements;
00088 class MenuManager;
00089 class ModeToolBar;
00090 class NodePalette;
00091 class OutlinePalette;
00092 class PDFToolBar;
00093 class PSLib;
00094 class PageItem;
00095 class PagePalette;
00096 class Preferences;
00097 class PrefsContext;
00098 class PrefsManager;
00099 class PropertiesPalette;
00100 class ReformDoc;
00101 class ScToolBar;
00102 class ScrAction;
00103 class ScribusCore;
00104 class ScribusMainWindow;
00105 class ScribusQApp;
00106 class ScribusWin;
00107 class SimpleState;
00108 class StoryEditor;
00109 class StyleManager;
00110 class TOCGenerator;
00111 class UndoManager;
00112 class UndoPalette;
00113 class UndoState;
00114
00115
00116 extern SCRIBUS_API ScribusQApp* ScQApp;
00117
00124 class SCRIBUS_API ScribusMainWindow : public QMainWindow, public UndoObject
00125 {
00126 Q_OBJECT
00127
00128 public:
00130 ScribusMainWindow();
00132 ~ScribusMainWindow();
00136 int initScMW(bool primaryMainwWindow);
00137 void addScToolBar(ScToolBar *tb, QString name);
00138 bool warningVersion(QWidget *parent);
00139 void SetShortCut();
00140 void startUpDialog();
00141 void setDefaultPrinter(const QString&, const QString&, const QString&);
00142 void getDefaultPrinter(QString& name, QString& file, QString& command);
00143
00144 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);
00145 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);
00146 bool DoFileSave(const QString& fileName, QString* savedFileName = NULL);
00147 void changeEvent(QEvent *e);
00148 void closeEvent(QCloseEvent *ce);
00149 void keyPressEvent(QKeyEvent *k);
00150 void keyReleaseEvent(QKeyEvent *k);
00151 void mouseReleaseEvent(QMouseEvent *m);
00152 void wheelEvent(QWheelEvent *w);
00153 void setTBvals(PageItem *currItem);
00154 void ShowSubs();
00155 void applyNewMaster(QString name);
00156 void updateRecent(QString fn);
00157 void doPasteRecent(QString data);
00158 QString GetLang(QString inLang);
00159 bool getPDFDriver(const QString & fn, const QString & nam,
00160 int Components, const std::vector<int> & pageNs,
00161 const QMap<int,QPixmap> & thumbs, QString& error,
00162 bool* cancelled = NULL);
00163 bool DoSaveAsEps(QString fn, QString& error);
00164 QString CFileDialog(QString wDir = ".", QString caption = "", QString filter = "", QString defNa = "",
00165 int optionFlags = fdExistingFiles, bool *docom = 0, bool *doFont = 0, bool *doProfiles = 0);
00169 void recalcColors(QProgressBar *dia = 0);
00170 void SwitchWin();
00171 void RestoreBookMarks();
00172
00173 void emergencySave();
00174
00179 bool arrowKeyDown();
00184 bool isObjectSpecificUndo();
00185 void restore(UndoState* state, bool isUndo);
00186 void restoreGrouping(SimpleState *state, bool isUndo);
00187 void restoreUngrouping(SimpleState *state, bool isUndo);
00188 void restoreAddPage(SimpleState *state, bool isUndo);
00189 void restoreDeletePage(SimpleState *state, bool isUndo);
00190 struct CopyPasteBuffer Buffer;
00191 struct CopyContentsBuffer contentsBuffer;
00192 QString Buffer2;
00193 QString Buffer3;
00194 bool BuFromApp;
00195 bool internalCopy;
00196 int HaveDoc;
00197 PrefsContext* dirs;
00203 ScribusView *view;
00207 ScribusDoc *doc;
00208
00209
00210 QProgressBar* mainWindowProgressBar;
00211 QLabel* mainWindowXPosLabel;
00212 QLabel* mainWindowXPosDataLabel;
00213 QLabel* mainWindowYPosLabel;
00214 QLabel* mainWindowYPosDataLabel;
00215 GuideManager *guidePalette;
00216 CharSelect *charPalette;
00217 PropertiesPalette *propertiesPalette;
00218 NodePalette *nodePalette;
00219 OutlinePalette *outlinePalette;
00220 Biblio *scrapbookPalette;
00221 LayerPalette* layerPalette;
00222 PagePalette *pagePalette;
00223 BookPalette *bookmarkPalette;
00224 Measurements* measurementPalette;
00225 CheckDocument * docCheckerPalette;
00226 UndoPalette* undoPalette;
00227 AlignDistributePalette *alignDistributePalette;
00228 StoryEditor* storyEditor;
00229 StoryEditor* CurrStED;
00230 QMap<QString,QString> Sprachen;
00231 QWorkspace *wsp;
00232 ScribusWin* ActWin;
00233 QClipboard *ClipB;
00234 QString LoadEnc;
00235 bool ScriptRunning;
00236 QMap<QString, QStringList> InstLang;
00237 QMap<QString,QString> LangTransl;
00238
00239 QProcess *ExternalApp;
00240
00241 QMap<QString, QPointer<ScrAction> > scrActions;
00242 QMap<QString, QPointer<ScrAction> > scrRecentFileActions;
00243 QMap<QString, QPointer<ScrAction> > scrWindowsActions;
00244 QMap<QString, QPointer<ScrAction> > scrLayersActions;
00245 QMap<QString, QPointer<ScrAction> > scrRecentPasteActions;
00246 QMap<QString, QPointer<ScToolBar> > scrToolBars;
00247 QMultiHash<QString, QActionGroup*> scrActionGroups;
00248 MenuManager* scrMenuMgr;
00249 ActionManager* actionManager;
00250 QStringList RecentDocs;
00251
00252 public slots:
00253 void languageChange();
00254 void specialActionKeyEvent(const QString& actionName, int unicodevalue);
00255 void newView();
00256 void ToggleStickyTools();
00257 void ToggleAllGuides();
00258 void ToggleAllPalettes();
00259 void slotStoryEditor();
00260 void slotCharSelect();
00261 void ImageEffects();
00262 QString Collect(const bool compress = false, const bool withFonts = false, const bool withProfiles = false, const QString& newDirectory=QString::null);
00263 void AddBookMark(PageItem *ite);
00264 void DelBookMark(PageItem *ite);
00265 void BookMarkTxT(PageItem *ite);
00266 void StoreBookmarks();
00267
00268
00269 void setStatusBarMousePosition(double xp, double yp);
00270 void setStatusBarInfoText(QString newText);
00271 bool DoFileClose();
00272
00273 void windowsMenuAboutToShow();
00275 void extrasMenuAboutToShow();
00276 void newActWin(QWidget *w);
00277 void closeActiveWindowMasterPageEditor();
00278 void updateActiveWindowCaption(const QString &newCaption);
00279 void windowsMenuActivated(int id);
00280 void UnDoAction();
00281 void RedoAction();
00282
00283
00284 void slotTest();
00285 void slotTest2();
00286 void PutScrap();
00287 void PutToPatterns();
00288 void changeLayer(int);
00289 void showLayer();
00290
00291 void ManageJava();
00292 void manageMasterPages(QString temp = "");
00293 void manageMasterPagesEnd();
00295 bool slotFileNew();
00296 bool slotPageImport();
00297 bool loadPage(QString fileName, int Nr, bool Mpa, const QString& renamedPageName=QString::null);
00298
00299 void slotGetContent();
00300 void slotGetContent2();
00305 void slotFileAppend();
00306
00307 void removeRecent(QString fn);
00308 void loadRecent(QString fn);
00309 void rebuildRecentFileMenu();
00310 void rebuildRecentPasteMenu();
00311 void pasteRecent(QString fn);
00312 void pasteFromScrapbook(QString fn);
00313 void rebuildLayersList();
00314 bool slotDocOpen();
00315 bool loadDoc(QString);
00319 bool postLoadDoc();
00320 void slotAutoSaved();
00322 bool slotFileSave();
00324 bool slotFileSaveAs();
00325 void slotFileRevert();
00327 void SaveText();
00329 bool slotFileClose();
00331 void slotFilePrint();
00332 void slotReallyPrint();
00340 bool doPrint(PrintOptions &options, QString& error);
00342 void slotFileQuit();
00345 void slotEditCut();
00347 void slotEditCopy();
00349 void slotEditPaste();
00350 void slotEditCopyContents();
00351 void slotEditPasteContents(int absolute=0);
00352 void EnableTxEdit();
00353 void DisableTxEdit();
00354 void SelectAll();
00355 void deselectAll();
00356 void ClipChange();
00357
00359 void slotHelpAbout();
00360 void slotHelpAboutPlugins();
00361 void slotHelpAboutQt();
00362 void slotHelpCheckUpdates();
00363 void slotOnlineHelp();
00364 void slotOnlineHelpClosed();
00365 void ToggleTips();
00367 void slotNewPageP(int wo, QString templ);
00368 void slotNewPageM();
00369 void slotNewMasterPage(int w, const QString &);
00370 void slotNewPage(int w, const QString& masterPageName=QString::null, bool mov = true);
00371 void duplicateToMasterPage();
00373 void DeletePage();
00379 void DeletePage(int from, int to);
00380 void DeletePage2(int pg);
00382 void MovePage();
00383 void CopyPage();
00384 void changePageMargins();
00392 void slotZoom(double zoomFactor);
00394 void ToggleMarks();
00395 void ToggleBleeds();
00396 void ToggleFrames();
00397 void ToggleLayerMarkers();
00398 void ToggleTextLinks();
00399 void ToggleTextControls();
00400 void ToggleColumnBorders();
00401 void ToggleRulers();
00402 void ToggleRulerMode();
00403
00404
00405
00406
00407
00408
00409 void togglePagePalette();
00410 void setPagePalette(bool visible);
00411
00412 void toggleUndoPalette();
00413 void setUndoPalette(bool visible);
00414 void toggleCheckPal();
00416 void TogglePics();
00418 void ToggleRaster();
00420 void ToggleURaster();
00422 void toggleNodeEdit();
00423 void slotSelect();
00426 void setAppMode(int mode);
00427 void setAppModeByToggle(bool isOn, int newMode);
00429 void HaveNewDoc();
00430 void HaveNewSel(int Nr);
00431 void rebuildStyleMenu(int itemType);
00433 void slotDocCh(bool reb = true);
00435 void setItemShade(int id);
00438 void SetNewFont(const QString& nf);
00440 void setItemFSize(int id);
00442 void slotEditColors();
00444
00445
00446
00447
00448
00449
00450
00451 void updtGradFill();
00452
00453
00454
00455
00456
00457
00458 void setCSMenu();
00460
00462 void MakeFrame(int f, int c, double *vals);
00463
00464
00466 void duplicateItem();
00468 void duplicateItemMulti();
00471 bool slotDocSetup();
00472 void objectAttributes();
00473 void getImageInfo();
00474 void generateTableOfContents();
00477 void slotPrefsOrg();
00478
00479 void setNewAlignment(int a);
00480 void setNewParStyle(const QString& name);
00481 void setNewCharStyle(const QString& name);
00482 void setAbsValue(int a);
00483 void selectItemsFromOutlines(PageItem *ite);
00484 void selectItemsFromOutlines(int Page, int Item, bool single = false);
00485 void selectPagesFromOutlines(int Page);
00486 void doPrintPreview();
00487 void printPreview();
00488 void SaveAsEps();
00489 void reallySaveAsEps();
00490 void SaveAsPDF();
00491 void doSaveAsPDF();
00492 void setMainWindowActive();
00493 void setItemHoch(int h);
00494 void setStilvalue(int s);
00495 void setItemTypeStyle(int id);
00496 void slotElemRead(QString Name, double x, double y, bool art, bool loca, ScribusDoc* docc, ScribusView* vie);
00497 void slotChangeUnit(int art, bool draw = true);
00502 void ApplyMasterPage();
00503 void Apply_MasterPage(QString pageName, int pageNumber, bool reb = true);
00504 void GroupObj(bool showLockDia = true);
00505 void UnGroupObj();
00506 void StatusPic();
00507 void ModifyAnnot();
00508 void ToggleGuides();
00509 void ToggleBase();
00510 void ToggleUGuides();
00511 void HaveRaster(bool art);
00512 void EditTabs();
00513 void SearchText();
00514 void imageEditorExited(int, QProcess::ExitStatus);
00516 void callImageEditor();
00517 void docCheckToggle(bool visible);
00519 bool scanDocument();
00520 void setUndoMode(bool isObjectSpecific);
00522 void insertSampleText();
00523
00524 void updateItemLayerList();
00528 void docSetup(ReformDoc* dia);
00532 void prefsOrg(Preferences* dia);
00534 void slotInsertFrame();
00536 void managePatterns();
00538 void enableTextActions(QMap<QString, QPointer<ScrAction> > *actionMap, bool enabled, const QString& fontName=QString::null);
00540 StyleManager *styleMgr() const {return styleManager;};
00541
00542 signals:
00543 void TextStyle(const ParagraphStyle&);
00544
00545 void TextISize(double);
00546 void TextIFont(const QString&);
00547 void TextUSval(double);
00548 void TextStil(int);
00549 void TextFarben(QString, QString, double, double);
00550 void TextScale(double);
00551 void TextScaleV(double);
00552 void TextBase(double);
00553 void TextShadow(double, double);
00554 void TextOutline(double);
00555 void TextUnderline(double, double);
00556 void TextStrike(double, double);
00557
00558 protected:
00562 bool eventFilter( QObject *o, QEvent *e );
00563 virtual void dragEnterEvent( QDragEnterEvent* e);
00564 virtual void dropEvent( QDropEvent* e);
00565
00566 private:
00568 void initSplash(bool showSplash);
00569 void initMenuBar();
00570 void addDefaultWindowMenuItems();
00571 void initStatusBar();
00572 void initToolBars();
00573
00574 void initHyphenator();
00575 void initDefaultValues();
00576 void initKeyboardShortcuts();
00577 void initPalettes();
00578 void initScrapbook();
00579
00580 void updateColorMenu(QProgressBar* progressBar=NULL);
00581 void ToggleFrameEdit();
00582 void NoFrameEdit();
00583
00584 QLabel* mainWindowStatusLabel;
00585 QString recentFileMenuName;
00586 QString recentPasteMenuName;
00587 QString layerMenuName;
00588 QPixmap noIcon;
00589 EditToolBar *editToolBar;
00590 FileToolBar *fileToolBar;
00591 ModeToolBar* modeToolBar;
00592 PDFToolBar* pdfToolBar;
00593 QToolButton* DatOpe;
00594 QToolButton* DatSav;
00595 QToolButton* DatClo;
00596 QToolButton* DatPri;
00597 QToolButton* DatPDF;
00598 QToolButton* DatNeu;
00599 int toolbarMenuTools;
00600 int toolbarMenuPDFTools;
00601 int viewToolbars;
00602 int viewPropertiesPalette;
00603 int viewOutlinePalette;
00604 int viewNodePalette;
00605 int viewBpal;
00606 int viewLayerPalette;
00607 int viewPagePalette;
00608 int viewBopal;
00609 int viewUndoPalette;
00610
00611 bool palettesStatus[10];
00612 bool guidesStatus[13];
00613
00614 bool keyrep;
00616 bool _arrowKeyDown;
00618 bool objectSpecificUndo;
00619
00620 void addNewPages(int wo, int where, int numPages, double height, double width, int orient, QString siz, bool mov, QStringList* basedOn = 0);
00621
00622 void *PSDriver;
00623 int DocNr;
00624 bool PrinterUsed;
00625 struct PDe {
00626 QString Pname;
00627 QString Dname;
00628 QString Command;
00629 } PDef ;
00630 TOCGenerator *tocGenerator;
00631 int storedPageNum;
00632 int storedViewXCoor;
00633 int storedViewYCoor;
00634 double storedViewScale;
00635 StyleManager *styleManager;
00636 UndoManager *undoManager;
00637 PrefsManager *prefsManager;
00638 FormatsManager *formatsManager;
00639
00640 HelpBrowser* helpBrowser;
00641 };
00642
00643 #endif