Scribus
Open source desktop publishing at your fingertips
scribusdoc.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 /***************************************************************************
8  scribusdoc.h - description
9  -------------------
10  begin : Fre Apr 6 21:47:55 CEST 2001
11  copyright : (C) 2001 by Franz Schmid
12  email : Franz.Schmid@altmuehlnet.de
13  ***************************************************************************/
14 
15 /***************************************************************************
16  * *
17  * This program is free software; you can redistribute it and/or modify *
18  * it under the terms of the GNU General Public License as published by *
19  * the Free Software Foundation; either version 2 of the License, or *
20  * (at your option) any later version. *
21  * *
22  ***************************************************************************/
23 #ifndef SCRIBUSDOC_H
24 #define SCRIBUSDOC_H
25 #ifdef HAVE_CONFIG_H
26 #include "scconfig.h"
27 #endif
28 // include files for QT
29 #include <QColor>
30 #include <QFont>
31 #include <QList>
32 #include <QMap>
33 #include <QHash>
34 #include <QObject>
35 #include <QPixmap>
36 #include <QRectF>
37 #include <QStringList>
38 #include <QTimer>
39 #include <QFile>
40 
41 #include "gtgettext.h" //CB For the ImportSetup struct and itemadduserframe
42 #include "scribusapi.h"
43 #include "colormgmt/sccolormgmtengine.h"
44 #include "documentinformation.h"
45 #include "numeration.h"
46 #include "marks.h"
47 #include "nodeeditcontext.h"
48 #include "notesstyles.h"
49 #include "observable.h"
50 #include "pageitem.h"
51 #include "pageitem_group.h"
52 #include "pageitem_latexframe.h"
53 #include "pageitem_textframe.h"
54 #include "pagestructs.h"
55 #include "prefsstructs.h"
56 #include "scguardedptr.h"
57 #include "scpage.h"
58 #include "sclayer.h"
59 #include "styles/styleset.h"
60 #include "styles/tablestyle.h"
61 #include "styles/cellstyle.h"
62 #include "undoobject.h"
63 #include "undostate.h"
64 #include "undotransaction.h"
65 #include "updatemanager.h"
66 #include "usertaskstructs.h"
67 
68 class DocUpdater;
69 class FPoint;
70 class UndoManager;
71 // class UndoState;
72 class PDFOptions;
73 class Hyphenator;
74 class Selection;
75 class ScribusView;
76 class ScribusMainWindow;
77 class ResourceCollection;
78 class PageSize;
79 class ScPattern;
80 class Serializer;
81 class QProgressBar;
82 class MarksManager;
83 class NotesStyle;
84 class TextNote;
85 
86 
87 
90 class SCRIBUS_API ScribusDoc : public QObject, public UndoObject, public Observable<ScribusDoc>
91 {
92  Q_OBJECT
93 
94 public:
95  ScribusDoc();
96  ScribusDoc(const QString& docName, int unitIndex, const PageSize& pagesize, const MarginStruct& margins, const DocPagesSetup& pagesSetup);
97  ~ScribusDoc();
98  void init();
99  bool inAnEditMode() const;
100  bool inASpecialEditMode() const;
101  QList<PageItem*> getAllItems(QList<PageItem*> &items);
102  QList<PageItem*> *parentGroup(PageItem* item, QList<PageItem*> *list);
103  void setup(const int, const int, const int, const int, const int, const QString&, const QString&);
104  void setLoading(const bool);
105  bool isLoading() const;
106  void setModified(const bool);
107  bool isModified() const;
109  void setPage(double w, double h, double t, double l, double r, double b, double sp, double ab, bool atf, int fp);
110  void resetPage(int fp, MarginStruct* newMargins=0);
111 
115  ScribusView* view() const;
116  ScribusMainWindow* scMW() const {return m_ScMW;}
117  void setGUI(bool hasgui, ScribusMainWindow* mw, ScribusView* view);
118 
122  const ScGuardedPtr<ScribusDoc>& guardedPtr() const;
123 
124  UpdateManager* updateManager() { return &m_updateManager; }
125  MassObservable<PageItem*> * itemsChanged() { return &m_itemsChanged; }
126  MassObservable<ScPage*> * pagesChanged() { return &m_pagesChanged; }
127  MassObservable<QRectF> * regionsChanged() { return &m_regionsChanged; }
128 
129  void invalidateAll();
130  void invalidateLayer(int layerID);
131  void invalidateRegion(QRectF region);
132 
133 
134  MarginStruct* scratch() { return &docPrefsData.displayPrefs.scratch; }
135  MarginStruct* bleeds() { return &docPrefsData.docSetupPrefs.bleeds; }
136  MarginStruct& bleedsVal() { return docPrefsData.docSetupPrefs.bleeds; }
137  MarginStruct* margins() { return &docPrefsData.docSetupPrefs.margins; }
138  MarginStruct& marginsVal() { return docPrefsData.docSetupPrefs.margins; }
139  double pageGapHorizontal() const { return docPrefsData.displayPrefs.pageGapHorizontal; }
140  double pageGapVertical() const { return docPrefsData.displayPrefs.pageGapVertical; }
141  void setPageGapHorizontal(double h) { docPrefsData.displayPrefs.pageGapHorizontal=h; }
142  void setPageGapVertical(double v) { docPrefsData.displayPrefs.pageGapVertical=v; }
143  const QList<PageSet>& pageSets() const { return docPrefsData.pageSets; }
144  void setPageSetFirstPage(int layout, int fp);
145  void clearPageSets() { docPrefsData.pageSets.clear(); }
146  void appendToPageSets(const PageSet& ps) { docPrefsData.pageSets.append(ps); }
147  void setPaperColor(const QColor &c) { docPrefsData.displayPrefs.paperColor=c; }
148  const QColor& paperColor() const { return docPrefsData.displayPrefs.paperColor; }
149  int hyphMinimumWordLength() const { return docPrefsData.hyphPrefs.MinWordLen; }
150  int hyphConsecutiveLines() const { return docPrefsData.hyphPrefs.HyCount; }
151  const QString& hyphLanguage() const { return docPrefsData.hyphPrefs.Language; }
152  bool hyphAutomatic() const { return docPrefsData.hyphPrefs.Automatic; }
153  bool hyphAutoCheck() const { return docPrefsData.hyphPrefs.AutoCheck; }
154  void setHyphMinimumWordLength(int i) { docPrefsData.hyphPrefs.MinWordLen=i; }
155  void setHyphConsecutiveLines(int i) { docPrefsData.hyphPrefs.HyCount=i; }
156  void setHyphLanguage(const QString& s) { docPrefsData.hyphPrefs.Language=s; }
157  void setHyphAutomatic(bool b) { docPrefsData.hyphPrefs.Automatic=b; }
158  void setHyphAutoCheck(bool b) { docPrefsData.hyphPrefs.AutoCheck=b; }
159  bool autoSave() const { return docPrefsData.docSetupPrefs.AutoSave; }
160  int autoSaveTime() const { return docPrefsData.docSetupPrefs.AutoSaveTime; }
161  bool autoSaveClockDisplay() const { return docPrefsData.displayPrefs.showAutosaveClockOnCanvas; }
162  void setAutoSave(bool b) { docPrefsData.docSetupPrefs.AutoSave=b; }
163  void setAutoSaveTime(int i) { docPrefsData.docSetupPrefs.AutoSaveTime=i; }
164  //FIXME (maybe) :non const, the loaders make a mess here
165  PDFOptions& pdfOptions() { return docPrefsData.pdfPrefs; }
166  ObjAttrVector& itemAttributes() { return docPrefsData.itemAttrPrefs.defaultItemAttributes; }
167  void setItemAttributes(ObjAttrVector& oav) { docPrefsData.itemAttrPrefs.defaultItemAttributes=oav;}
168  void clearItemAttributes() { docPrefsData.itemAttrPrefs.defaultItemAttributes.clear(); }
169  void appendToItemAttributes(const ObjectAttribute& oa) { docPrefsData.itemAttrPrefs.defaultItemAttributes.append(oa); }
170  ToCSetupVector& tocSetups() { return docPrefsData.tocPrefs.defaultToCSetups; }
171  void setTocSetups(ToCSetupVector& tsv) { docPrefsData.tocPrefs.defaultToCSetups=tsv; }
172  void clearTocSetups() { docPrefsData.tocPrefs.defaultToCSetups.clear(); }
173  void appendToTocSetups(const ToCSetup& ts) { docPrefsData.tocPrefs.defaultToCSetups.append(ts); }
174  void setArrowStyles(QList<ArrowDesc>& as) { docPrefsData.arrowStyles=as; }
175  QList<ArrowDesc>& arrowStyles() { return docPrefsData.arrowStyles; }
176  void appendToArrowStyles(const struct ArrowDesc& as) { docPrefsData.arrowStyles.append(as); }
177  const bool marginColored() const { return docPrefsData.displayPrefs.marginColored; }
178  void setMarginColored(bool b) { docPrefsData.displayPrefs.marginColored=b; }
179  QMap<QString, CheckerPrefs>& checkerProfiles() { return docPrefsData.verifierPrefs.checkerPrefsList; }
180  void setCheckerProfiles(const QMap<QString, CheckerPrefs>& cl) { docPrefsData.verifierPrefs.checkerPrefsList=cl; }
181  void set1CheckerProfile(const QString profileName, const struct CheckerPrefs& cs) { docPrefsData.verifierPrefs.checkerPrefsList[profileName] = cs; }
182  void clearCheckerProfiles() { docPrefsData.verifierPrefs.checkerPrefsList.clear(); }
183  const QString& curCheckProfile() const { return docPrefsData.verifierPrefs.curCheckProfile; }
184  void setCurCheckProfile(const QString& s) { docPrefsData.verifierPrefs.curCheckProfile=s; }
185  int pageOrientation() const { return docPrefsData.docSetupPrefs.pageOrientation; }
186  void setPageOrientation(int o) { docPrefsData.docSetupPrefs.pageOrientation=o; }
187  int pagePositioning() const { return docPrefsData.docSetupPrefs.pagePositioning; }
188  void setPagePositioning(int p) { docPrefsData.docSetupPrefs.pagePositioning=p; }
189  double pageHeight() const { return docPrefsData.docSetupPrefs.pageHeight; }
190  double pageWidth() const { return docPrefsData.docSetupPrefs.pageWidth; }
191  const QString& pageSize() const { return docPrefsData.docSetupPrefs.pageSize; }
192  void setPageHeight(double h) { docPrefsData.docSetupPrefs.pageHeight=h; }
193  void setPageWidth(double w) { docPrefsData.docSetupPrefs.pageWidth=w; }
194  void setPageSize(const QString& s) { docPrefsData.docSetupPrefs.pageSize=s; }
195  int marginPreset() const { return docPrefsData.docSetupPrefs.marginPreset; }
196  void setMarginPreset(int mp) { docPrefsData.docSetupPrefs.marginPreset=mp; }
197 
198  TypoPrefs& typographicPrefs() { return docPrefsData.typoPrefs; }
199  GuidesPrefs& guidesPrefs() { return docPrefsData.guidesPrefs; }
200  ItemToolPrefs& itemToolPrefs() { return docPrefsData.itemToolPrefs; }
201  OperatorToolPrefs& opToolPrefs() { return docPrefsData.opToolPrefs; }
202  ColorPrefs& colorPrefs() { return docPrefsData.colorPrefs; }
203  CMSData& cmsSettings() { return docPrefsData.colorPrefs.DCMSset; }
204  DocumentInformation& documentInfo() { return docPrefsData.docInfo; }
205  void setDocumentInfo(DocumentInformation di) { docPrefsData.docInfo=di; }
206  DocumentSectionMap& sections() { return docPrefsData.docSectionMap; }
207  void setSections(DocumentSectionMap dsm) { docPrefsData.docSectionMap=dsm; }
208  const QMap<QString, int> & usedFonts() { return UsedFonts; }
209 
210  const ApplicationPrefs& prefsData() { return docPrefsData; }
211  void setNewPrefs(const ApplicationPrefs& prefsData, const ApplicationPrefs& oldPrefsData, bool resizePages, bool resizeMasterPages, bool resizePageMargins, bool resizeMasterPageMargins);
212 
213  // Add, delete and move pages
214 
215  ScPage* addPage(const int pageNumber, const QString& masterPageName=QString::null, const bool addAutoFrame=false);
216  void deletePage(const int);
218  ScPage* addMasterPage(const int, const QString&);
219  void deleteMasterPage(const int);
221  void rebuildMasterNames(void);
223  void replaceMasterPage(const QString& oldMasterPage);
225  bool renameMasterPage(const QString& oldPageName, const QString& newPageName);
227  void createDefaultMasterPages();
229  void createNewDocPages(int pageCount);
235  int addAutomaticTextFrame(const int pageNumber);
240  void setLocationBasedPageLRMargins(uint pageIndex);
246  void swapPage(const int a, const int b);
254  void movePage(const int fromPage, const int toPage, const int dest, const int position);
255 
263  void copyPage(int pageNumberToCopy, int existingPage, int whereToInsert, int copyCount);
264 
265  // Add, delete and move layers
272  int addLayer(const QString& layerName=QString::null, const bool activate=false);
279  void copyLayer(int layerIDToCopy, int whereToInsert);
286  bool deleteLayer(const int layerID, const bool deleteItems);
291  int activeLayer();
292 
297  const QString& activeLayerName();
303  bool setActiveLayer(const int layerToActivate);
309  bool setActiveLayer(const QString & layerNameToActivate);
316  bool setLayerPrintable(const int layerID, const bool isPrintable);
322  bool layerPrintable(const int layerID);
329  bool setLayerVisible(const int layerID, const bool isViewable);
335  bool layerVisible(const int layerID);
341  bool layerSelectable(const int layerID);
348  bool setLayerSelectable(const int layerID, const bool isSelectable);
355  bool setLayerLocked(const int layerID, const bool isLocked);
361  bool layerLocked(const int layerID);
368  bool setLayerFlow(const int layerID, const bool flow);
374  bool layerFlow(const int layerID);
381  bool setLayerTransparency(const int layerID, double trans);
387  double layerTransparency(const int layerID);
394  bool setLayerBlendMode(const int ID, int blend);
400  int layerBlendMode(const int ID);
406  int layerLevelFromID(const int layerID);
413  bool setLayerMarker(const int layerID, QColor color);
419  QColor layerMarker(const int layerID);
426  bool setLayerOutline(const int layerID, const bool outline);
432  bool layerOutline(const int layerID);
438  int layerIDFromLevel(const int layerLevel);
443  int layerIDFromName(QString name);
444  int layerCount() const;
450  bool lowerLayer(const int layerID);
456  bool lowerLayerByLevel(const int layerLevel);
462  bool raiseLayer(const int layerID);
468  bool raiseLayerByLevel(const int layerLevel);
474  QString layerName(const int layerID) const;
481  bool changeLayerName(const int layerID, const QString& newName);
487  bool layerContainsItems(const int layerID);
494  bool renumberLayer(const int layerID, const int newLayerID);
499  void orderedLayerList(QStringList* list);
500 
501  int firstLayerID();
502  //Items
503  bool deleteTaggedItems();
504 
508  void getUsedProfiles(ProfilesL& usedProfiles);
509  bool OpenCMSProfiles(ProfilesL InPo, ProfilesL InPoCMYK, ProfilesL MoPo, ProfilesL PrPo);
510  void CloseCMSProfiles();
511  void SetDefaultCMSParams();
516  void enableCMS(bool enable);
517 
518  const ParagraphStyle& paragraphStyle(QString name) { return docParagraphStyles.get(name); }
519  const StyleSet<ParagraphStyle>& paragraphStyles() { return docParagraphStyles; }
520  bool isDefaultStyle( const ParagraphStyle& p ) const { return docParagraphStyles.isDefault(p); }
521  bool isDefaultStyle( const CharStyle& c ) const { return docCharStyles.isDefault(c); }
522 // bool isDefaultStyle( LineStyle& l ) const { return MLineStyles......; }
523 
527  const TableStyle& tableStyle(QString name) { return docTableStyles.get(name); }
531  const StyleSet<TableStyle>& tableStyles() { return docTableStyles; }
535  bool isDefaultStyle(const TableStyle& style) const { return docTableStyles.isDefault(style); }
540  void redefineTableStyles(const StyleSet<TableStyle>& newStyles, bool removeUnused = false);
547  void replaceTableStyles(const QMap<QString, QString>& newNameForOld);
548 
552  const CellStyle& cellStyle(QString name) { return docCellStyles.get(name); }
556  const StyleSet<CellStyle>& cellStyles() { return docCellStyles; }
560  bool isDefaultStyle(const CellStyle& style) const { return docCellStyles.isDefault(style); }
565  void redefineCellStyles(const StyleSet<CellStyle>& newStyles, bool removeUnused = false);
572  void replaceCellStyles(const QMap<QString, QString>& newNameForOld);
573 
574  void getNamedResources(ResourceCollection& lists) const;
575  struct ResMapped
576  {
577  ResMapped(ResourceCollection& newNames) { m_newNames = newNames;}
578 
579  void operator()(PageItem *item)
580  {
581  item->replaceNamedResources(m_newNames);
582  }
583 
584  ResourceCollection m_newNames;
585  };
586  void replaceNamedResources(ResourceCollection& newNames);
587  bool styleExists(QString styleName);
588 
589  QList<int> getSortedStyleList();
590  QList<int> getSortedCharStyleList();
591  QList<int> getSortedTableStyleList();
592  QList<int> getSortedCellStyleList();
593 
594  void redefineStyles(const StyleSet<ParagraphStyle>& newStyles, bool removeUnused=false);
600  void replaceStyles(const QMap<QString,QString>& newNameForOld);
606  void loadStylesFromFile(QString fileName);
615  void loadStylesFromFile(QString fileName, StyleSet<ParagraphStyle> *tempStyles,
616  StyleSet<CharStyle> *tempCharStyles,
617  QHash<QString, multiLine> *tempLineStyles);
618 
619  const CharStyle& charStyle(QString name) { return docCharStyles.get(name); }
620  const StyleSet<CharStyle>& charStyles() { return docCharStyles; }
621  void redefineCharStyles(const StyleSet<CharStyle>& newStyles, bool removeUnused=false);
627  void replaceCharStyles(const QMap<QString,QString>& newNameForOld);
628 
635  void lockGuides(bool isLocked);
642  void restore(UndoState* state, bool isUndo);
648  void setName(const QString& name);
652  QStringList getItemAttributeNames();
653 
654  bool AddFont(QString name, int fsize = 10);
659  QMap<QString,int> reorganiseFonts();
663  void getUsedFonts(QMap<QString,QMap<uint, FPointArray> > &Really);
664  void checkItemForFonts(PageItem *it, QMap<QString, QMap<uint, FPointArray> > & Really, uint lc);
665 
669  void replaceLineStyleColors(const QMap<QString, QString>& colorMap);
673  void getUsedColors(ColorList &colorsToUse, bool spot = false);
677  bool lineStylesUseColor(const QString& colorName);
681  void getUsedGradients(QHash<QString, VGradient> &Gradients);
685  bool addGradient(QString &name, VGradient &gradient);
686  void setGradients(QHash<QString, VGradient> &gradients);
690  bool addPattern(QString &name, ScPattern& pattern);
691  void removePattern(QString name);
692  void setPatterns(QHash<QString, ScPattern> &patterns);
696  ScPattern* checkedPattern(QString &name);
700  QStringList getUsedPatterns();
701  QStringList getUsedPatternsSelection(Selection* customSelection);
702  QStringList getUsedPatternsHelper(QString pattern, QStringList &results);
703  QStringList getPatternDependencyList(QStringList used);
707  QStringList getUsedSymbols();
708  QStringList getUsedSymbolsHelper(QString pattern, QStringList &results);
712  void setUnitIndex(const int);
713  int unitIndex() const;
714  double unitRatio() const;
718  bool applyMasterPage(const QString& pageName, const int pageNumber);
722  void restoreMasterPageApplying(SimpleState* ss, bool isUndo);
723  void restoreMasterPageRenaming(SimpleState* ss, bool isUndo);
724  void restoreCopyPage(SimpleState* ss, bool isUndo);
725  void restoreMovePage(SimpleState* ss, bool isUndo);
726  void restoreSwapPage(SimpleState* ss, bool isUndo);
727  void restoreAddMasterPage(SimpleState* ss, bool isUndo);
728  void restoreChangePageProperties(SimpleState* ss, bool isUndo);
732  void restoreGrouping(SimpleState* ss, bool isUndo);
736  void restoreLevelDown(SimpleState* ss, bool isUndo);
737  void restoreLevelBottom(SimpleState* ss, bool isUndo);
738  void restoreGuideLock(SimpleState* ss, bool isUndo);
742  bool save(const QString& fileName, QString* savedFile = NULL);
746  bool changePageProperties(const double initialTop, const double initialBottom, const double initialLeft, const double initialRight, const double initialHeight, const double initialWidth, const double Height, const double width, const int orientation, const QString& pageSize, const int marginPreset, const bool moveObjects, const int pageNumber=-1, const int pageType = 0);
750  void recalculateColorsList(QList<PageItem *> *itemList);
751  static void recalculateColorItem(PageItem *item);
752  void recalculateColors();
756  //void setScTextDefaultsFromDoc(ScText *);
760  bool copyPageToMasterPage(const int, const int, const int, const QString&, bool);
761 
762 
766  PageItem* createPageItem(const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, double x, double y, double b, double h, double w, const QString& fill, const QString& outline);
767 
786  int itemAdd(const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, const double x, const double y, const double b, const double h, const double w, const QString& fill, const QString& outline, const bool itemFinalised, const bool noteFrame = false);
787 
789  int itemAddArea(const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, const double x, const double y, const double w, const QString& fill, const QString& outline, const bool itemFinalised);
790 
796  int itemAddUserFrame(InsertAFrameData &iafData);
797 
803  bool itemAddCommit(PageItem* item);
804 
809  void itemAddDetails(const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, PageItem* newItem);
810 
811  uint getItemNrfromUniqueID(uint unique);
812  //return pointer to item
813  PageItem* getItemFromName(QString name);
814  //itemDelete
815  //itemBlah...
816 
823  void rebuildItemLists();
827  bool usesAutomaticTextFrames() const;
828  void setUsesAutomaticTextFrames(const bool);
829 
834 // bool LoadPict(QString fn, int ItNr, bool reload = false, bool showMsg = false);
842  bool loadPict(QString fn, PageItem *pageItem, bool reload = false, bool showMsg = false);
849  void RecalcPictures(ProfilesL *Pr, ProfilesL *PrCMYK, QProgressBar *dia = 0);
857  void RecalcPictures(QList<PageItem*>* items, ProfilesL *Pr, ProfilesL *PrCMYK, QProgressBar *dia = 0);
862  void canvasMinMax(FPoint&, FPoint&);
863 
864  int OnPage(double x2, double y2);
865  int OnPage(PageItem *currItem);
866  void GroupOnPage(PageItem *currItem);
867 
868  void reformPages(bool moveObjects = true);
870  void refreshGuides();
871 
873  void fixItemPageOwner();
875  void fixParagraphStyles();
877  void fixNotesStyles();
878 
884  double getXOffsetForPage(const int);
885  double getYOffsetForPage(const int);
886  void getBleeds(int pageNumber, MarginStruct& bleedData);
887  void getBleeds(const ScPage* page, MarginStruct& bleedData);
888  void getBleeds(const ScPage* page, const MarginStruct& baseValues, MarginStruct& bleedData);
889 
893  PageItem* convertItemTo(PageItem *currItem, PageItem::ItemType newType, PageItem* secondaryItem=NULL);
894 
898  int currentPageNumber();
899 
906  bool itemNameExists(const QString itemName);
907 
912  void setMasterPageMode(bool);
913 
914  /*** Is the document in master page mode? */
915  bool masterPageMode() const { return m_masterPageMode; }
919  void setSymbolEditMode(bool mode, QString symbolName = "");
920 
921  /*** Is the document in symbol edit mode? */
922  bool symbolEditMode() const { return m_symbolEditMode; }
923 
924  /*** get the name of the symbol currently in editing */
925  QString getEditedSymbol() const { return currentEditedSymbol; }
929  void setInlineEditMode(bool mode, int id = -1);
930 
931  /*** Is the document in symbol edit mode? */
932  bool inlineEditMode() const { return m_inlineEditMode; }
933 
938  void addSection(const int number=0, const QString& name=QString::null, const uint fromindex=0, const uint toindex=0, const NumFormat type=Type_1_2_3, const uint sectionstartindex=0, const bool reversed=false, const bool active=true, const QChar fillChar=QChar(), int fieldWidth=0);
942  bool deleteSection(const uint);
947  const QString getSectionPageNumberForPageIndex(const uint) const;
952  const QChar getSectionPageNumberFillCharForPageIndex(const uint) const;
957  int getSectionPageNumberWidthForPageIndex(const uint) const;
962  int getSectionKeyForPageIndex(const uint pageIndex) const;
967  void updateSectionPageNumbersToPages();
974  void addPageToSection(const uint otherPageIndex, const uint location, const uint count=1);
979  void removePageFromSection(const uint pageIndex);
983  void setFirstSectionFromFirstPageNumber();
988  QString getSectionNameForPageIndex(const uint pageIndex) const;
989 
991  typedef enum {alignFirst, alignLast, alignPage, alignMargins, alignGuide, alignSelection } AlignTo;
992  typedef enum {alignByMoving, alignByResizing } AlignMethod;
993  void buildAlignItemList(Selection* customSelection=0);
994  bool startAlign(uint minObjects = 1);
995  void endAlign();
1004  void insertColor(QString nam, double c, double m, double y, double k);
1005 
1006  QMap<QString, double>& constants() { return m_constants; }
1013  PageLocation locationOfPage(int pageIndex) const;
1019  int columnOfPage(int pageIndex) const;
1020 
1021 
1022  QList<PageItem*>* GroupOfItem(QList<PageItem*>* itemList, PageItem* item);
1023  PageItem* groupObjectsSelection(Selection* customSelection=0);
1024  PageItem* groupObjectsList(QList<PageItem*> &itemList);
1025  void groupObjectsToItem(PageItem* groupItem, QList<PageItem*> &itemList);
1026  PageItem * itemSelection_GroupObjects (bool changeLock, bool lock, Selection* customSelection=0);
1027  void itemSelection_UnGroupObjects(Selection* customSelection=0);
1028  void addToGroup(PageItem* group, PageItem* item);
1029  void removeFromGroup(PageItem* item);
1030  void rescaleGroup(PageItem* group, double scale);
1031  void resizeGroupToContents(PageItem* group);
1032  void itemSelection_resizeGroupToContents(Selection *customSelection=0);
1033  void itemSelection_convertItemsTo(const PageItem::ItemType newType, Selection* restoredSelection=0, Selection* customSelection=0);
1034  void itemSelection_convertItemsToSymbol(QString& patternName);
1035  void itemSelection_ApplyParagraphStyle(const ParagraphStyle & newstyle, Selection* customSelection=0, bool rmDirectFormatting = false);
1036  void itemSelection_SetParagraphStyle(const ParagraphStyle & newstyle, Selection* customSelection=0);
1037  void itemSelection_ApplyCharStyle(const CharStyle & newstyle, Selection* customSelection=0, QString ETEA = "");
1038  void itemSelection_SetCharStyle(const CharStyle & newstyle, Selection* customSelection=0);
1039  void itemSelection_EraseParagraphStyle(Selection* customSelection=0);
1040  void itemSelection_EraseCharStyle(Selection* customSelection=0);
1041 
1042  void itemSelection_SetNamedParagraphStyle(const QString & name, Selection* customSelection=0);
1043  void itemSelection_SetNamedCharStyle(const QString & name, Selection* customSelection=0);
1044  void itemSelection_SetNamedLineStyle(const QString & name, Selection* customSelection=0);
1045 
1046  void itemSelection_SetSoftShadow(bool has, QString color, double dx, double dy, double radius, int shade, double opac, int blend, bool erase, bool objopa);
1047 
1048  void itemSelection_SetLineWidth(double w);
1049  void itemSelection_SetLineArt(Qt::PenStyle w);
1050  void itemSelection_SetLineJoin(Qt::PenJoinStyle w);
1051  void itemSelection_SetLineEnd(Qt::PenCapStyle w);
1052  void itemSelection_SetAlignment(int w, Selection* customSelection=0);
1053  void itemSelection_SetLineSpacing(double w, Selection* customSelection=0);
1054  void itemSelection_SetLineSpacingMode(int w, Selection* customSelection=0);
1055  void itemSetFont(const QString& newFont);
1056  void itemSelection_SetFont(QString fon, Selection* customSelection=0);
1057  void itemSelection_SetFillColor(QString farbe, Selection* customSelection=0);
1058  void itemSelection_SetFillShade(int sha, Selection* customSelection=0);
1059  void itemSelection_SetStrokeColor(QString farbe, Selection* customSelection=0);
1060  void itemSelection_SetStrokeShade(int sha, Selection* customSelection=0);
1061  void itemSelection_SetScaleV(int, Selection* customSelection=0);
1062  void itemSelection_SetScaleH(int, Selection* customSelection=0);
1063  void itemSelection_SetBaselineOffset(int, Selection* customSelection=0);
1064  void itemSelection_SetOutlineWidth(int, Selection* customSelection=0);
1065  void itemSelection_SetShadowOffsets(int shx, int shy, Selection* customSelection=0);
1066  void itemSelection_SetUnderline(int pos, int wid, Selection* customSelection=0);
1067  void itemSelection_SetStrikethru(int pos, int wid, Selection* customSelection=0);
1068  void itemSelection_SetEffects(int s, Selection* customSelection=0);
1069  void itemSelection_SetOpticalMargins(int i, Selection* customSelection=0);
1070  void itemSelection_resetOpticalMargins(Selection* customSelection=0);
1071  void itemSelection_SetColorProfile(const QString& profileName, Selection* customSelection=0);
1072  void itemSelection_SetRenderIntent(int intentIndex, Selection* customSelection=0);
1073  void itemSelection_SetCompressionMethod(int cmIndex, Selection* customSelection=0);
1074  void itemSelection_SetCompressionQuality(int cqIndex, Selection* customSelection=0);
1075  void itemSelection_SetTracking(int us, Selection* customSelection=0);
1076  void itemSelection_SetFontSize(int size, Selection* customSelection=0);
1077  void MirrorPolyH(PageItem *currItem);
1078  void MirrorPolyV(PageItem *currItem);
1079  bool getItem(PageItem **currItem, int nr = -1);
1080  void setFrameRect();
1081  void setFrameRounded();
1082  void setFrameOval();
1083 
1084  void setRedrawBounding(PageItem *currItem);
1085  void adjustCanvas(FPoint minPos, FPoint maxPos, bool absolute = false);
1087  {
1088  PicResMapped(bool applyNewRes, int lowResType) { m_applyNewRes = applyNewRes; m_lowResType = lowResType;}
1089 
1090  void operator()(PageItem *item)
1091  {
1092  QList<PageItem*> allItems;
1093  if (item->isGroup())
1094  allItems = item->asGroupFrame()->getItemList();
1095  else
1096  allItems.append(item);
1097  for (int ii = 0; ii < allItems.count(); ii++)
1098  {
1099  item = allItems.at(ii);
1100  if (item->imageIsAvailable)
1101  {
1102  bool fho = item->imageFlippedH();
1103  bool fvo = item->imageFlippedV();
1104  if (m_applyNewRes)
1105  item->pixm.imgInfo.lowResType = m_lowResType;
1106  if (item->asLatexFrame())
1107  item->asLatexFrame()->rerunApplication(false);
1108  else
1109  item->loadImage(item->Pfile, true, -1, false);
1110  item->setImageFlippedH(fho);
1111  item->setImageFlippedV(fvo);
1112  item->AdjustPictScale();
1113  }
1114  }
1115  allItems.clear();
1116  }
1117 
1118  bool m_applyNewRes;
1119  int m_lowResType;
1120  };
1121  void recalcPicturesRes(bool applyNewRes = false);
1122  int previewQuality();
1123  void connectDocSignals();
1124  void disconnectDocSignals();
1125  void removeLayer(int l, bool dl = false); //FIXME: Make protected once scripter function no longer uses this directly
1130  void changed();
1133  ScPage* currentPage();
1136  void setCurrentPage(ScPage *newPage);
1137  bool hasGUI() const {return m_hasGUI;}
1139  QPoint ApplyGrid(const QPoint& in);
1141  FPoint ApplyGridF(const FPoint& in);
1143  bool hasTOCSetup() { return !docPrefsData.tocPrefs.defaultToCSetups.empty(); }
1145  void getClosestGuides(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, ScPage* refPage = NULL);
1147  void getClosestElementBorder(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, ScPage* refPage = NULL);
1149  void SnapToGuides(PageItem *currItem);
1150  bool ApplyGuides(double *x, double *y, bool elementSnap = false);
1151  bool ApplyGuides(FPoint* point, bool elementSnap = false);
1152  bool MoveItem(double newX, double newY, PageItem* ite);
1153  void RotateItem(double win, PageItem *currItem);
1154  void MoveRotated(PageItem *currItem, FPoint npv);
1155  bool SizeItem(double newX, double newY, PageItem *pi, bool fromMP = false, bool DoUpdateClip = true, bool redraw = true);
1156  bool MoveSizeItem(FPoint newX, FPoint newY, PageItem* currItem, bool fromMP = false, bool constrainRotation = false);
1157  void AdjustItemSize(PageItem *currItem, bool includeGroup = false, bool moveInGroup = true);
1158  void moveGroup(double x, double y, Selection* customSelection = 0);
1159  void rotateGroup(double angle, Selection* customSelection = 0);
1160  void rotateGroup(double angle, FPoint RCenter, Selection* customSelection = 0);
1161  void scaleGroup(double scx, double scy, bool scaleText=true, Selection* customSelection = 0, bool scaleLine = false);
1163  QMap<PageItem*, QString> getDocItemNames(PageItem::ItemType itemType);
1165  Serializer *serializer();
1167  Serializer *textSerializer();
1168 
1170  int RotMode() const {return rotMode;}
1172  void RotMode(const int& val);
1173 
1175  // unncessary signals when doing updates on multiple items
1176  void beginUpdate();
1177  void endUpdate();
1178  int addToInlineFrames(PageItem *item);
1179  void removeInlineFrame(int fIndex);
1180  void checkItemForFrames(PageItem *it, int fIndex);
1181  bool hasPreflightErrors();
1182  QFileDevice::Permissions filePermissions() { return docFilePermissions; }
1183  void saveFilePermissions(QFileDevice::Permissions p) { docFilePermissions=p; }
1184 
1185 protected:
1186  void addSymbols();
1187  void applyPrefsPageSizingAndMargins(bool resizePages, bool resizeMasterPages, bool resizePageMargins, bool resizeMasterPageMargins);
1188  bool m_hasGUI;
1189  QFileDevice::Permissions docFilePermissions;
1190  ApplicationPrefs& appPrefsData;
1191  ApplicationPrefs docPrefsData;
1192  UndoManager * const undoManager;
1193  bool loading;
1194  bool modified;
1195  int ActiveLayer;
1196  double docUnitRatio;
1197  int rotMode;
1198  bool automaticTextFrames; // Flag for automatic Textframes
1199  bool m_masterPageMode;
1200  bool m_symbolEditMode;
1201  bool m_inlineEditMode;
1202  int m_storedLayerID;
1203  bool m_storedLayerLock;
1204  bool m_storedLayerVis;
1205  QMap<QString, double> m_constants;
1206  ScribusMainWindow* m_ScMW;
1207  ScribusView* m_View;
1208  ScGuardedObject<ScribusDoc> m_guardedObject;
1209  Serializer *m_serializer, *m_tserializer;
1210  QString currentEditedSymbol;
1211  int currentEditedIFrame;
1212 
1213 public: // Public attributes
1214  bool is12doc; //public for now, it will be removed later
1215  int NrItems;
1216  int First;
1217  int Last;
1218  int viewCount;
1219  int viewID;
1220  bool SnapGrid;
1221  bool SnapGuides;
1222  bool SnapElement;
1223  bool GuideLock;
1224  bool dontResize;
1227  FPoint maxCanvasCoordinate;
1228  FPoint stored_minCanvasCoordinate;
1229  FPoint stored_maxCanvasCoordinate;
1230  double rulerXoffset;
1231  double rulerYoffset;
1233  QList<ScPage*>* Pages;
1235  QList<ScPage*> MasterPages;
1237  QList<ScPage*> DocPages;
1239  QList<ScPage*> TempPages;
1241  QMap<QString,int> MasterNames;
1243  QList<PageItem*>* Items;
1244  QList<PageItem*> MasterItems;
1245  QList<PageItem*> DocItems;
1246  QHash<int, PageItem*> FrameItems;
1247  QList<PageItem*> EditFrameItems;
1248  PageItem *currentEditedTextframe;
1249  Selection* const m_Selection;
1251  double PageSp;
1253  double PageSpa;
1255  //int currentPageLayout;
1260  int appMode;
1261  int SubMode;
1262  double *ShapeValues;
1263  int ValCount;
1264  QString DocName;
1265  QMap<QString,int> UsedFonts;
1266  SCFonts * const AllFonts;
1267  QList<AlignObjs> AObjects;
1268  int CurrentSel;
1269  ParagraphStyle currentStyle;
1270  NodeEditContext nodeEdit;
1275  bool DragP;
1276  bool leaveDrag;
1277  PageItem *DraggedElem;
1278  PageItem *ElemToLink;
1279  QList<PageItem*> DragElements;
1280 private:
1281  StyleSet<ParagraphStyle> docParagraphStyles;
1282  StyleSet<CharStyle> docCharStyles;
1283  StyleSet<TableStyle> docTableStyles;
1284  StyleSet<CellStyle> docCellStyles;
1285 public:
1286  ScLayers Layers;
1287  //bool marginColored;
1288  int GroupCounter;
1289 
1290  ScColorMgmtEngine colorEngine;
1291  ScColorProfile DocInputImageRGBProf;
1292  ScColorProfile DocInputImageCMYKProf;
1293  ScColorProfile DocInputRGBProf;
1294  ScColorProfile DocInputCMYKProf;
1295  ScColorProfile DocDisplayProf;
1296  ScColorProfile DocPrinterProf;
1297  ScColorTransform stdTransRGBMon;
1298  ScColorTransform stdTransCMYKMon;
1299  ScColorTransform stdProof;
1300  ScColorTransform stdTransImg;
1301  ScColorTransform stdProofImg;
1302  ScColorTransform stdProofImgCMYK;
1303  ScColorTransform stdTransCMYK;
1304  ScColorTransform stdProofCMYK;
1305  ScColorTransform stdTransRGB;
1306  ScColorTransform stdProofGC;
1307  ScColorTransform stdProofCMYKGC;
1308  ScColorTransform stdLabToRGBTrans;
1309  ScColorTransform stdLabToCMYKTrans;
1310  ScColorTransform stdProofLab;
1311  ScColorTransform stdProofLabGC;
1312  bool BlackPoint;
1313  bool SoftProofing;
1314  bool Gamut;
1315  eRenderIntent IntentColors;
1316  eRenderIntent IntentImages;
1317  bool HasCMS;
1318  QMap<QString,QString> JavaScripts;
1319  int TotalItems;
1320  PrintOptions Print_Options;
1321  bool RePos;
1322  struct BookMa {
1323  QString Title;
1324  QString Text;
1325  QString Aktion;
1326  PageItem *PageObject;
1327  int Parent;
1328  int ItemNr;
1329  int First;
1330  int Last;
1331  int Prev;
1332  int Next;
1333  };
1334  QList<BookMa> BookMarks;
1335  bool OldBM;
1336  bool hasName;
1337  bool isConverted;
1338  QTimer * const autoSaveTimer;
1339  QHash<QString,multiLine> MLineStyles;
1340  QHash<QString, ScPattern> docPatterns;
1341  QHash<QString, VGradient> docGradients;
1342  QWidget* WinHan;
1343  bool DoDrawing;
1344  bool drawAsPreview;
1345  bool viewAsPreview;
1346  bool editOnPreview;
1347  int previewVisual;
1349  {
1350  int type;
1351  ScPage *page;
1352  PageItem *item;
1353  };
1354  QList<OpenNodesList> OpenNodes;
1355  QTimer *CurTimer;
1356  QMap<int, errorCodes> pageErrors;
1357  QMap<int, errorCodes> docLayerErrors;
1358  QMap<PageItem*, errorCodes> docItemErrors;
1359  QMap<PageItem*, errorCodes> masterItemErrors;
1360  FPointArray symReturn;
1361  FPointArray symNewLine;
1362  FPointArray symTab;
1363  FPointArray symNonBreak;
1364  FPointArray symNewCol;
1365  FPointArray symNewFrame;
1366 
1367  Hyphenator * docHyphenator;
1368  void itemResizeToMargin(PageItem* item, int direction); //direction reflect enum numbers from Canvas::FrameHandle
1369 
1370 private:
1371  UndoTransaction m_itemCreationTransaction;
1372  UndoTransaction m_alignTransaction;
1373 
1374  ScPage* m_currentPage;
1375  UpdateManager m_updateManager;
1376  MassObservable<PageItem*> m_itemsChanged;
1377  MassObservable<ScPage*> m_pagesChanged;
1378  MassObservable<QRectF> m_regionsChanged;
1379  DocUpdater* m_docUpdater;
1380 
1381 signals:
1382  //Lets make our doc talk to our GUI rather than confusing all our normal stuff
1386  void docChanged();
1387  void saved(QString name);
1388  void updateContents();
1389  void updateContents(const QRect &r);
1390  void refreshItem(PageItem *);
1391  void canvasAdjusted(double width, double height, double dX, double dY);
1392  void firstSelectedItemType(int);
1393  void setApplicationMode(int);
1403  void signalRebuildOutLinePalette();
1405  void widthAndHeight(double, double);
1406 
1408  void rotationMode(int);
1409  void updateEditItem();
1410  void updateAutoSaveClock();
1411  void addBookmark(PageItem *);
1412  void deleteBookmark(PageItem *);
1413  void changeLayers(int);
1414 
1415 public slots:
1416  void selectionChanged();
1417  void itemSelection_ToggleLock();
1418  void itemSelection_ToggleSizeLock();
1419  void itemSelection_ToggleImageShown();
1420  void itemSelection_TogglePrintEnabled();
1421  void itemSelection_ToggleBookMark(Selection* customSelection=0);
1422  void itemSelection_ToggleAnnotation(Selection* customSelection=0);
1423  void itemSelection_Transform(int nrOfCopies, QTransform matrix, int basepoint);
1424  void itemSelection_ChangePreviewResolution(int id);
1425 
1429  void allItems_ChangePreviewResolution(int id);
1430 
1431  //FIXME : change to process a selection
1432  void item_setFrameShape(PageItem* item, int frameType, int count, double* points);
1433 
1434  void itemSelection_ClearItem(Selection* customSelection=0, bool useWarning=false);
1435  void itemSelection_TruncateItem(Selection* customSelection=0);
1437  void itemSelection_DeleteItem(Selection* customSelection=0, bool forceDeletion=false);
1438  void itemSelection_SetItemTextReversed(bool reversed, Selection* customSelection=0);
1439  void itemSelection_SetItemFillTransparency(double t);
1440  void itemSelection_SetItemLineTransparency(double t);
1441  void itemSelection_SetItemFillBlend(int t);
1442  void itemSelection_SetItemLineBlend(int t);
1443  void itemSelection_SetLineGradient(VGradient& newGradient, Selection* customSelection=0);
1444  void itemSelection_SetFillGradient(VGradient& newGradient, Selection* customSelection=0);
1445  void itemSelection_SetMaskGradient(VGradient& newGradient, Selection* customSelection=0);
1446  void itemSelection_SetOverprint(bool overprint, Selection* customSelection=0);
1447  void itemSelection_ApplyImageEffects(ScImageEffectList& newEffectList, Selection* customSelection=0);
1448  void itemSelection_FlipH();
1449  void itemSelection_FlipV();
1450  void itemSelection_Rotate(double angle, Selection* customSelection = 0);
1451  void itemSelection_DoHyphenate();
1452  void itemSelection_DoDeHyphenate();
1453  void itemSelection_UnlinkTextFrameWithText(Selection *customSelection=0, bool cutText=false);
1454  void itemSelection_UnlinkTextFrameWithTextCut(Selection *customSelection=0);
1455  void itemSelection_SendToLayer(int layerID);
1456  void itemSelection_SetImageOffset(double x, double y, Selection* customSelection=0);
1457  void itemSelection_SetImageScale(double x, double y, Selection* customSelection=0);
1458  void itemSelection_SetImageScaleAndOffset(double ox, double oy, double sx, double sy, Selection* customSelection=0);
1459  void itemSelection_SetImageRotation(double rot, Selection* customSelection=0);
1460  void itemSelection_AlignItemLeft(int i, double newX, AlignMethod how);
1461  void itemSelection_AlignItemRight(int i, double newX, AlignMethod how);
1462  void itemSelection_AlignItemTop(int i, double newY, AlignMethod how);
1463  void itemSelection_AlignItemBottom(int i, double newY, AlignMethod how);
1464  void itemSelection_AlignLeftOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1465  void itemSelection_AlignRightOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1466  void itemSelection_AlignBottomIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1467  void itemSelection_AlignRightIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1468  void itemSelection_AlignBottomOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1469  void itemSelection_AlignCenterHor(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1470  void itemSelection_AlignLeftIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1471  void itemSelection_AlignCenterVer(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1472  void itemSelection_AlignTopOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1473  void itemSelection_AlignTopIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1474 
1475  void sendItemSelectionToBack();
1476  void bringItemSelectionToFront();
1477  void itemSelection_LowerItem();
1478  void itemSelection_RaiseItem();
1479  void itemSelection_DistributeDistH(bool usingDistance=false, double distance=0.0, bool reverseDistribute=false);
1480  void itemSelection_DistributeAcrossPage(bool useMargins=false);
1481  void itemSelection_DistributeRight();
1482  void itemSelection_DistributeBottom();
1483  void itemSelection_DistributeCenterH();
1484  void itemSelection_DistributeDistV(bool usingDistance=false, double distance=0.0, bool reverseDistribute=false);
1485  void itemSelection_DistributeDownPage(bool useMargins=false);
1486  void itemSelection_DistributeLeft();
1487  void itemSelection_DistributeCenterV();
1488  void itemSelection_DistributeTop();
1489  void itemSelection_SwapLeft();
1490  void itemSelection_SwapRight();
1491  void itemSelection_MultipleDuplicate(ItemMultipleDuplicateData&);
1492  void itemSelection_UniteItems(Selection* customSelection=0);
1493  void itemSelection_SplitItems(Selection* customSelection=0);
1497  void itemSelection_AdjustFrametoImageSize(Selection* customSelection=0);
1501  void itemSelection_AdjustImagetoFrameSize(Selection* customSelection=0);
1502  void itemSelection_AdjustFrameHeightToText( Selection *customSelection=0);
1504  void itemSelection_ApplyArrowHead(int startArrowID=-1, int endArrowID=-1, Selection* customSelection=0);
1505  void itemSelection_ApplyArrowScale(int startArrowSc, int endArrowSc, Selection* customSelection);
1506 
1507  void itemSelection_SetItemPen(QString farbe);
1508  void itemSelection_SetItemPenShade(int sha);
1509  void itemSelection_SetItemGradStroke(int typ);
1510  void itemSelection_SetItemBrush(QString farbe);
1511  void itemSelection_SetItemBrushShade(int sha);
1512  void itemSelection_SetItemGradMask(int typ);
1513  void itemSelection_SetItemGradFill(int typ);
1514  void itemSelection_SetItemPatternFill(QString pattern);
1515  void itemSelection_SetItemPatternProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
1516  void itemSelection_SetItemStrokePattern(QString pattern);
1517  void itemSelection_SetItemStrokePatternProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, double space, bool mirrorX, bool mirrorY);
1518  void itemSelection_SetItemStrokePatternType(bool type);
1519  void itemSelection_SetItemPatternMask(QString pattern);
1520  void itemSelection_SetItemPatternMaskProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
1521 
1522  // Table related slots.
1523 
1534  void itemSelection_InsertTableRows();
1535 
1546  void itemSelection_InsertTableColumns();
1547 
1557  void itemSelection_DeleteTableRows();
1558 
1568  void itemSelection_DeleteTableColumns();
1569 
1578  void itemSelection_MergeTableCells();
1579 
1586 
1597  void itemSelection_SetTableRowHeights();
1598 
1609  void itemSelection_SetTableColumnWidths();
1610 
1619  void itemSelection_DistributeTableRowsEvenly();
1620 
1629  void itemSelection_DistributeTableColumnsEvenly();
1630 
1636  void itemSelection_AdjustFrameToTable();
1637 
1643  void itemSelection_AdjustTableToFrame();
1644 
1645  void undoRedoBegin();
1646  void undoRedoDone();
1647 
1648  void updatePic();
1649  void updatePict(QString name);
1650  void updatePictDir(QString name);
1651  void removePict(QString name);
1652 
1653 // Marks and notes
1654 public:
1662  //return page where endnotesframe should be located depending of notes style range and location of master mark
1663  const ScPage* page4EndNotes(NotesStyle* NS, PageItem* item);
1664 
1665  //data handling structures
1666 private:
1667  QList<Mark*> m_docMarksList;
1668  QList<TextNote*> m_docNotesList;
1669  //flags used for indicating needs of updates
1670  bool flag_notesChanged;
1671 
1672 public:
1673  const QList<Mark*> marksList() { return m_docMarksList; }
1674  const QList<TextNote*> notesList() { return m_docNotesList; }
1675  QList<NotesStyle*> m_docNotesStylesList;
1676  QMap<PageItem_NoteFrame*, rangeItem> m_docEndNotesFramesMap;
1677  QList<NotesStyle*> ns2Update; //list of notes styles to update
1678 
1679  //returns list of notesframes for given Notes Style
1680  QList<PageItem_NoteFrame*> listNotesFrames(NotesStyle* NS);
1681 
1682  //flags used for indicating needs of updates
1683  bool notesChanged() { return flag_notesChanged; }
1684  void setNotesChanged(bool on) { flag_notesChanged = on; }
1685  bool flag_restartMarksRenumbering;
1686  bool flag_updateMarksLabels;
1687  bool flag_updateEndNotes;
1688  bool flag_layoutNotesFrames;
1689 
1690  //returns list of marks labels for given mark type
1691  QStringList marksLabelsList(MarkType type);
1692 
1693  //return mark with given label and given type
1694  Mark* getMark(QString label, MarkType type); //returns mark with label and type (labels are unique only for same type marks)
1695  Mark* newMark(Mark* mrk = NULL);
1696  TextNote* newNote(NotesStyle* NS);
1697 
1698  bool isMarkUsed(Mark* mrk, bool visible = false);
1699  //set cursor in text where given mark will be found
1700  void setCursor2MarkPos(Mark* mark);
1701  //return false if mark was not found
1702  bool eraseMark(Mark* mrk, bool fromText=false, PageItem* item=NULL, bool force = false); //force is used only for deleting non-unique marks by MarksManager
1703  void setUndoDelMark(Mark* mrk);
1704  //invalidate all text frames where given mark will found
1705  //usefull spacially for varaible text marks after changing its text definition
1706  //if forceUpdate then found master frames are relayouted
1707  bool invalidateVariableTextFrames(Mark* mrk, bool forceUpdate = false); //returns if any text was changed
1708 
1709  //for foot/endnotes
1710  NotesStyle* newNotesStyle(NotesStyle NS);
1711  void renameNotesStyle(NotesStyle* NS, QString newName);
1712  //delete whole notes style with its notesframes and notes
1713  void deleteNotesStyle(QString nsName);
1714  void undoSetNotesStyle(SimpleState* ss, NotesStyle* ns);
1715  NotesStyle* getNotesStyle(QString nsName);
1716  //delete note, if fromText than marks for given note will be removed
1717  void deleteNote(TextNote* note);
1718  void setUndoDelNote(TextNote* note);
1719  PageItem_NoteFrame* createNoteFrame(PageItem_TextFrame* inFrame, NotesStyle *nStyle, int index = -1);
1720  PageItem_NoteFrame* createNoteFrame(NotesStyle *nStyle, double x, double y, double w, double h, double w2, QString fill, QString outline);
1721  //delete noteframe
1722  void delNoteFrame(PageItem_NoteFrame *nF, bool removeMarks=true, bool forceDeletion = true);
1723  //renumber notes for given notes style
1724  //return true if doc needs update after changing numbers of notes
1725  bool updateNotesNums(NotesStyle* nStyle);
1726  //set new text styles for notes marks
1727  void updateNotesFramesStyles(NotesStyle* nStyle);
1728  //check conflicts beetween notes styles
1729  bool validateNSet(NotesStyle NS, QString newName = "");
1730  //update layout remove empty notesframes
1731  bool notesFramesUpdate();
1732  //update notesframes after changing automatic features of notes style
1733  void updateNotesFramesSettings(NotesStyle* NS);
1734 
1735  //search for endnotesframe for given notes style and item holding master mark
1736  PageItem_NoteFrame* endNoteFrame(NotesStyle* nStyle, PageItem_TextFrame* master);
1737  //
1738  void setEndNoteFrame(PageItem_NoteFrame* nF, void* ptr) { rangeItem rI={ptr}; m_docEndNotesFramesMap.insert(nF,rI); }
1739  void setEndNoteFrame(PageItem_NoteFrame* nF, int section) { rangeItem rI; rI.sectionIndex = section; m_docEndNotesFramesMap.insert(nF, rI); }
1740  //update all endnotesframes content for given notes style
1741  void updateEndnotesFrames(NotesStyle* nStyle = NULL, bool invalidate = false);
1742  //update endnotesframe content
1743  void updateEndNotesFrameContent(PageItem_NoteFrame* nF, bool invalidate = false);
1744  //insert noteframe into list of changed
1745  void endNoteFrameChanged(PageItem_NoteFrame* nF) { m_docEndNotesFramesChanged.append(nF); }
1746  //update content for changed endnotesframes
1747  void updateChangedEndNotesFrames();
1748  //finds mark position in text
1749  //return true if mark was found, CPos is set for mark`s position
1750  //if item==NULL then search in all items and if mark is found than item is set
1751  int findMarkCPos(Mark* mrk, PageItem* &item, int Start = 0);
1752  QList<PageItem_NoteFrame*> m_docEndNotesFramesChanged;
1753 
1754  //finds item which holds given mark, start searching from next to lastItem index in DocItems
1755  PageItem* findMarkItem(Mark* mrk, int &lastItem);
1756 
1757 private:
1758  //QMap<PageItem_NoteFrame*, QList<TextNote *> > map of notesframes and its list of notes
1759  NotesInFrameMap m_docNotesInFrameMap;
1760 
1761  PageItem* findFirstMarkItem(Mark* mrk) { int tmp = -1; return findMarkItem(mrk, tmp); }
1762 
1763  //search for endnotesframe for given notes style and item holding master mark or section number
1764  PageItem_NoteFrame* endNoteFrame(NotesStyle* nStyle, void* item = NULL);
1765  PageItem_NoteFrame* endNoteFrame(NotesStyle* nStyle, int sectIndex);
1766  //clear list of notes for given notesframe
1767  void clearNotesInFrameList(PageItem_NoteFrame* nF) { m_docNotesInFrameMap.insert(nF, QList<TextNote*>()); }
1768  //renumber notes with given notes style for given frame starting from number num
1769  void updateItemNotesNums(PageItem_TextFrame *frame, NotesStyle* nStyle, int &num);
1770  //update notesframes text styles
1771  void updateItemNotesFramesStyles(PageItem *item, ParagraphStyle newStyle);
1772 
1773  //not used?
1774  bool updateEndNotesNums(); //return true if doc needs update
1775  void invalidateNoteFrames(NotesStyle* nStyle);
1776  void invalidateMasterFrames(NotesStyle* nStyle);
1777 
1778 public slots:
1779  //update strings (page numbers) for marks
1780  bool updateMarks(bool updateNotesMarks = false);
1781 
1782 //welding two items
1783 public slots:
1784  void itemSelection_UnWeld();
1785  void itemSelection_Weld();
1786  void itemSelection_EditWeld();
1787  void restartAutoSaveTimer();
1788 
1789 protected slots:
1790  void slotAutoSave();
1791 
1792 //auto-numerations
1793 public:
1794  QMap<QString, NumStruct*> numerations;
1795  QStringList orgNumNames; //orgNumerations keeps original settings read from paragraph styles for reset settings overrided localy
1796  void setupNumerations(); //read styles for used auto-numerations, initialize numCounters
1797  QString getNumberStr(QString numName, int level, bool reset, ParagraphStyle &style);
1798  void setNumerationCounter(QString numName, int level, int number);
1799  bool flag_Renumber;
1800  bool flag_NumUpdateRequest;
1801  // for local numeration of paragraphs
1802  bool updateLocalNums(StoryText& itemText); //return true if any num strings were updated and item need s invalidation
1803  void updateNumbers(bool updateNumerations = false);
1804  void itemSelection_ClearBulNumStrings(Selection *customSelection);
1805 /* Functions for PDF Form Actions */
1806 
1807 public:
1808  void SubmitForm();
1809  void ImportData();
1810  void ResetFormFields();
1811 
1812 };
1813 
1814 Q_DECLARE_METATYPE(ScribusDoc*);
1815 
1816 #endif
Definition: prefsstructs.h:453
Definition: pageitem_noteframe.h:8
Definition: storytext.h:71
Definition: prefsstructs.h:177
Definition: charstyle.h:78
Definition: undotransaction.h:45
Definition: tablestyle.h:30
QList< ScPage * > MasterPages
List of Master Pages.
Definition: scribusdoc.h:1235
Definition: prefsstructs.h:29
Pagemargins and bleeds.
Definition: margins.h:25
QList< ScPage * > * Pages
List of Pages.
Definition: scribusdoc.h:1233
FPoint minCanvasCoordinate
Minimum and Maximum Points of Document.
Definition: scribusdoc.h:1226
Definition: scribusdoc.cpp:124
Definition: pageitem_textframe.h:45
Definition: sccolorprofile.h:16
Definition: usertaskstructs.h:15
const CellStyle & cellStyle(QString name)
Definition: scribusdoc.h:552
Definition: pagestructs.h:15
Definition: hyphenator.h:26
Definition: prefsstructs.h:70
bool hasTOCSetup()
Does this doc have any TOC setups and potentially a TOC to generate.
Definition: scribusdoc.h:1143
double PageSp
Number of Columns.
Definition: scribusdoc.h:1251
Definition: prefsstructs.h:221
Definition: scpage.h:46
void setImageFlippedH(bool flipped)
Horizontally flip / unflip the image.
Definition: pageitem.cpp:4527
bool isDefaultStyle(const CellStyle &style) const
Definition: scribusdoc.h:560
UndoState describes an undoable state (action).
Definition: undostate.h:59
This Class is the base class for your application. It sets up the main window and providing a menubar...
Definition: scribus.h:123
Definition: sccolortransform.h:16
void setImageFlippedV(bool flipped)
Vertically flip / unflip the image.
Definition: pageitem.cpp:4544
Definition: scribusstructs.h:90
QList< PageItem * > * Items
List of Objects.
Definition: scribusdoc.h:1243
Definition: scpattern.h:36
double PageSpa
Distance of Columns.
Definition: scribusdoc.h:1253
Definition: notesstyles.h:28
Definition: vgradient.h:78
const StyleSet< TableStyle > & tableStyles()
Definition: scribusdoc.h:531
Definition: paragraphstyle.h:27
Definition: marks.h:40
Definition: nodeeditcontext.h:39
bool imageFlippedV() const
Is the image flipped vertically?
Definition: pageitem.h:987
Definition: sccolor.h:155
Definition: scribusstructs.h:75
Definition: pagestructs.h:30
A point with floating point precision.
Definition: fpoint.h:43
Definition: documentinformation.h:28
the Document Class
Definition: scribusdoc.h:90
Definition: cellstyle.h:32
QList< ScPage * > TempPages
List for temporary Pages.
Definition: scribusdoc.h:1239
Definition: usertaskstructs.h:35
ItemFrameType
Frame Type.
Definition: pageitem.h:208
Definition: scribusstructs.h:213
Definition: pagesize.h:40
Definition: observable.h:206
QString Pfile
Dateiname des Bildes.
Definition: pageitem.h:1278
virtual PageItem_LatexFrame * asLatexFrame()
Return self if Render frame item, otherwise null.
Definition: pageitem.h:226
bool loadImage(const QString &filename, const bool reload, const int gsResolution=-1, bool showMsg=false)
Load an image into an image frame, moved from ScribusView.
Definition: pageitem.cpp:9399
bool imageFlippedH() const
Is the image flipped horizontally?
Definition: pageitem.h:980
Definition: scribusdoc.h:1086
QList< ScPage * > DocPages
List of Document Pages.
Definition: scribusdoc.h:1237
Definition: scribusdoc.h:1348
Definition: prefsstructs.h:330
ColorList PageColors
Im Dokument benutzte Farben.
Definition: scribusdoc.h:1259
Definition: sclayer.h:38
Definition: prefsstructs.h:290
Superclass for all objects that are wanted to have undoable actions.
Definition: undoobject.h:59
Coord distance(Point const &a, Point const &b)
Definition: point.h:205
Definition: sccolormgmtengine.h:16
PDF Options struture. Capable of verifying its self, but otherwise largely a dumb struct...
Definition: pdfoptions.h:37
AlignTo
Some internal align tools.
Definition: scribusdoc.h:991
bool imageIsAvailable
Flag to hiold image file availability.
Definition: pageitem.h:1289
QMap< QString, int > MasterNames
Mapping Master Page Name to Master Page numbers.
Definition: scribusdoc.h:1241
const StyleSet< CellStyle > & cellStyles()
Definition: scribusdoc.h:556
void AdjustPictScale()
Adjust the picture scale, moved from the view, no view code here FIXME: Move to PageItem_TextFrame.
Definition: pageitem.cpp:9825
Definition: scribusdoc.h:575
Definition: serializer.h:49
void itemSelection_SplitTableCells()
Definition: scribusdoc.h:1585
virtual PageItem_Group * asGroupFrame()
Return self if Group item, otherwise null.
Definition: pageitem.h:224
Definition: scribusstructs.h:164
ItemType
Item Type.
Definition: pageitem.h:174
Definition: pageitem.h:92
bool isDefaultStyle(const TableStyle &style) const
Definition: scribusdoc.h:535
int RotMode() const
Get rotation mode.
Definition: scribusdoc.h:1170
UndoManager handles the undo stack.
Definition: undomanager.h:81
PageItem * LastAuto
Letztes Element fuer AutoTextrahmen.
Definition: scribusdoc.h:1272
Definition: scribusdoc.h:1322
Definition: fpointarray.h:42
Definition: notesstyles.h:20
virtual bool isGroup() const
Return true if Group item, otherwise false.
Definition: pageitem.h:241
Definition: updatemanager.h:66
const TableStyle & tableStyle(QString name)
Definition: scribusdoc.h:527
Definition: resourcecollection.h:41
PageItem * FirstAuto
Erstes Element fuer AutoTextrahmen.
Definition: scribusdoc.h:1274
Definition: scribusview.h:87
Main class SCFonts. Subclass of QDict. This class replaces the previous SCFonts typedef...
Definition: scfonts.h:36
Definition: scribusstructs.h:102
Definition: notesstyles.h:91
ScImage pixm
Darzustellendes Bild.
Definition: pageitem.h:1277
SimpleState provides a simple implementation of the UndoState.
Definition: undostate.h:145
int FirstPnum
current Pagelayout
Definition: scribusdoc.h:1257
virtual void restore(UndoState *state, bool isUndo)=0
Method used when an undo/redo is requested.
Definition: selection.h:34