Rev 19089 | Rev 19116 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4430 | cbradney | 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 | */ |
||
3 | paul | 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 |
||
2688 | craig | 26 | #include "scconfig.h" |
3 | paul | 27 | #endif |
28 | // include files for QT |
||
10220 | cbradney | 29 | #include <QColor> |
30 | #include <QFont> |
||
9767 | cbradney | 31 | #include <QList> |
10220 | cbradney | 32 | #include <QMap> |
17400 | fschmid | 33 | #include <QHash> |
10220 | cbradney | 34 | #include <QObject> |
35 | #include <QPixmap> |
||
10701 | avox | 36 | #include <QRectF> |
10220 | cbradney | 37 | #include <QStringList> |
38 | #include <QTimer> |
||
18719 | craig | 39 | #include <QFile> |
838 | cbradney | 40 | |
6132 | cbradney | 41 | #include "gtgettext.h" //CB For the ImportSetup struct and itemadduserframe |
2969 | craig | 42 | #include "scribusapi.h" |
14491 | jghali | 43 | #include "colormgmt/sccolormgmtengine.h" |
14170 | jghali | 44 | #include "documentinformation.h" |
18047 | craig | 45 | #include "numeration.h" |
17826 | craig | 46 | #include "marks.h" |
47 | #include "notesstyles.h" |
||
10532 | avox | 48 | #include "observable.h" |
3263 | cbradney | 49 | #include "pageitem.h" |
17376 | fschmid | 50 | #include "pageitem_group.h" |
51 | #include "pageitem_latexframe.h" |
||
17826 | craig | 52 | #include "pageitem_textframe.h" |
3757 | cbradney | 53 | #include "pagestructs.h" |
14170 | jghali | 54 | #include "prefsstructs.h" |
55 | #include "scguardedptr.h" |
||
16736 | jghali | 56 | #include "scpage.h" |
14170 | jghali | 57 | #include "sclayer.h" |
5980 | avox | 58 | #include "styles/styleset.h" |
16856 | craig | 59 | #include "styles/tablestyle.h" |
60 | #include "styles/cellstyle.h" |
||
14170 | jghali | 61 | #include "undoobject.h" |
16729 | fschmid | 62 | #include "undostate.h" |
10532 | avox | 63 | #include "updatemanager.h" |
14170 | jghali | 64 | #include "usertaskstructs.h" |
3179 | cbradney | 65 | |
10532 | avox | 66 | class DocUpdater; |
16856 | craig | 67 | class FPoint; |
1190 | tsoots | 68 | class UndoManager; |
16729 | fschmid | 69 | // class UndoState; |
1972 | craig | 70 | class PDFOptions; |
3252 | craig | 71 | class Hyphenator; |
3903 | cbradney | 72 | class Selection; |
4320 | cbradney | 73 | class ScribusView; |
5781 | cbradney | 74 | class ScribusMainWindow; |
8455 | avox | 75 | class ResourceCollection; |
10601 | mrdocs | 76 | class PageSize; |
77 | class ScPattern; |
||
11576 | avox | 78 | class UndoTransaction; |
13659 | cbradney | 79 | class Serializer; |
9953 | cbradney | 80 | class QProgressBar; |
17826 | craig | 81 | class MarksManager; |
82 | class NotesStyle; |
||
83 | class TextNote; |
||
3 | paul | 84 | |
10532 | avox | 85 | struct SCRIBUS_API NodeEditContext : public MassObservable<QPointF> |
86 | { |
||
87 | enum SubMode { MOVE_POINT = 0, ADD_POINT = 1, DEL_POINT = 2, SPLIT_PATH = 3 }; |
||
88 | int submode; |
||
89 | bool isContourLine; |
||
90 | FPointArray *oldClip; |
||
11576 | avox | 91 | UndoTransaction* nodeTransaction; |
10532 | avox | 92 | double oldItemX; |
93 | double oldItemY; |
||
94 | |||
95 | int ClRe; |
||
96 | int ClRe2; |
||
97 | int SegP1; |
||
98 | int SegP2; |
||
99 | bool EdPoints; |
||
100 | bool MoveSym; |
||
101 | QList<int> SelNode; |
||
102 | |||
11576 | avox | 103 | NodeEditContext(); |
10532 | avox | 104 | |
11576 | avox | 105 | bool hasNodeSelected(); |
106 | void deselect(); |
||
10532 | avox | 107 | |
11576 | avox | 108 | void reset(); |
10532 | avox | 109 | |
110 | void reset1Control(PageItem* currItem); |
||
111 | void resetControl(PageItem* currItem); |
||
112 | FPointArray beginTransaction(PageItem* currItem); |
||
113 | void finishTransaction(PageItem* currItem); |
||
16729 | fschmid | 114 | ScItemState<QPair<FPointArray, FPointArray> >* finishTransaction1(PageItem* currItem); |
115 | void finishTransaction2(PageItem* currItem, ScItemState<QPair<FPointArray, FPointArray> >* state); |
||
10532 | avox | 116 | void moveClipPoint(PageItem *currItem, FPoint ip); |
117 | }; |
||
3942 | cbradney | 118 | |
10532 | avox | 119 | |
4650 | subik | 120 | /**! \brief the Document Class |
3 | paul | 121 | */ |
10532 | avox | 122 | class SCRIBUS_API ScribusDoc : public QObject, public UndoObject, public Observable<ScribusDoc> |
3 | paul | 123 | { |
3082 | fschmid | 124 | Q_OBJECT |
125 | |||
3 | paul | 126 | public: |
2891 | cbradney | 127 | ScribusDoc(); |
5789 | cbradney | 128 | ScribusDoc(const QString& docName, int unitIndex, const PageSize& pagesize, const MarginStruct& margins, const DocPagesSetup& pagesSetup); |
2891 | cbradney | 129 | ~ScribusDoc(); |
5789 | cbradney | 130 | void init(); |
16105 | fschmid | 131 | QList<PageItem*> getAllItems(QList<PageItem*> &items); |
16594 | fschmid | 132 | QList<PageItem*> *parentGroup(PageItem* item, QList<PageItem*> *list); |
2901 | fschmid | 133 | void setup(const int, const int, const int, const int, const int, const QString&, const QString&); |
2891 | cbradney | 134 | void setLoading(const bool); |
3985 | cbradney | 135 | bool isLoading() const; |
2891 | cbradney | 136 | void setModified(const bool); |
137 | bool isModified() const; |
||
138 | /** Setzt die Seitenattribute */ |
||
14994 | cbradney | 139 | void setPage(double w, double h, double t, double l, double r, double b, double sp, double ab, bool atf, int fp); |
140 | void resetPage(int fp, MarginStruct* newMargins=0); |
||
4320 | cbradney | 141 | |
142 | /** |
||
143 | * @brief Return the view associated with the document |
||
144 | */ |
||
145 | ScribusView* view() const; |
||
5781 | cbradney | 146 | ScribusMainWindow* scMW() const {return m_ScMW;} |
5824 | cbradney | 147 | void setGUI(bool hasgui, ScribusMainWindow* mw, ScribusView* view); |
7906 | jghali | 148 | |
149 | /** |
||
150 | * @brief Return the guarded object associated with the document |
||
151 | */ |
||
152 | const ScGuardedPtr<ScribusDoc>& guardedPtr() const; |
||
3792 | cbradney | 153 | |
10532 | avox | 154 | UpdateManager* updateManager() { return &m_updateManager; } |
155 | MassObservable<PageItem*> * itemsChanged() { return &m_itemsChanged; } |
||
16729 | fschmid | 156 | MassObservable<ScPage*> * pagesChanged() { return &m_pagesChanged; } |
10701 | avox | 157 | MassObservable<QRectF> * regionsChanged() { return &m_regionsChanged; } |
15235 | jghali | 158 | |
15305 | jghali | 159 | void invalidateAll(); |
15235 | jghali | 160 | void invalidateLayer(int layerID); |
11046 | avox | 161 | void invalidateRegion(QRectF region); |
14924 | cbradney | 162 | |
163 | |||
164 | MarginStruct* scratch() { return &docPrefsData.displayPrefs.scratch; } |
||
14992 | cbradney | 165 | MarginStruct* bleeds() { return &docPrefsData.docSetupPrefs.bleeds; } |
14994 | cbradney | 166 | MarginStruct& bleedsVal() { return docPrefsData.docSetupPrefs.bleeds; } |
167 | MarginStruct* margins() { return &docPrefsData.docSetupPrefs.margins; } |
||
168 | MarginStruct& marginsVal() { return docPrefsData.docSetupPrefs.margins; } |
||
14924 | cbradney | 169 | double pageGapHorizontal() const { return docPrefsData.displayPrefs.pageGapHorizontal; } |
170 | double pageGapVertical() const { return docPrefsData.displayPrefs.pageGapVertical; } |
||
171 | void setPageGapHorizontal(double h) { docPrefsData.displayPrefs.pageGapHorizontal=h; } |
||
172 | void setPageGapVertical(double v) { docPrefsData.displayPrefs.pageGapVertical=v; } |
||
173 | const QList<PageSet>& pageSets() const { return docPrefsData.pageSets; } |
||
174 | void setPageSetFirstPage(int layout, int fp); |
||
175 | void clearPageSets() { docPrefsData.pageSets.clear(); } |
||
176 | void appendToPageSets(const PageSet& ps) { docPrefsData.pageSets.append(ps); } |
||
177 | void setPaperColor(const QColor &c) { docPrefsData.displayPrefs.paperColor=c; } |
||
178 | const QColor& paperColor() const { return docPrefsData.displayPrefs.paperColor; } |
||
179 | int hyphMinimumWordLength() const { return docPrefsData.hyphPrefs.MinWordLen; } |
||
180 | int hyphConsecutiveLines() const { return docPrefsData.hyphPrefs.HyCount; } |
||
181 | const QString& hyphLanguage() const { return docPrefsData.hyphPrefs.Language; } |
||
182 | bool hyphAutomatic() const { return docPrefsData.hyphPrefs.Automatic; } |
||
183 | bool hyphAutoCheck() const { return docPrefsData.hyphPrefs.AutoCheck; } |
||
184 | void setHyphMinimumWordLength(int i) { docPrefsData.hyphPrefs.MinWordLen=i; } |
||
185 | void setHyphConsecutiveLines(int i) { docPrefsData.hyphPrefs.HyCount=i; } |
||
186 | void setHyphLanguage(const QString& s) { docPrefsData.hyphPrefs.Language=s; } |
||
187 | void setHyphAutomatic(bool b) { docPrefsData.hyphPrefs.Automatic=b; } |
||
188 | void setHyphAutoCheck(bool b) { docPrefsData.hyphPrefs.AutoCheck=b; } |
||
14925 | cbradney | 189 | bool autoSave() const { return docPrefsData.docSetupPrefs.AutoSave; } |
190 | int autoSaveTime() const { return docPrefsData.docSetupPrefs.AutoSaveTime; } |
||
17805 | fschmid | 191 | bool autoSaveClockDisplay() const { return docPrefsData.displayPrefs.showAutosaveClockOnCanvas; } |
14925 | cbradney | 192 | void setAutoSave(bool b) { docPrefsData.docSetupPrefs.AutoSave=b; } |
193 | void setAutoSaveTime(int i) { docPrefsData.docSetupPrefs.AutoSaveTime=i; } |
||
14927 | cbradney | 194 | //FIXME (maybe) :non const, the loaders make a mess here |
14925 | cbradney | 195 | PDFOptions& pdfOptions() { return docPrefsData.pdfPrefs; } |
14927 | cbradney | 196 | ObjAttrVector& itemAttributes() { return docPrefsData.itemAttrPrefs.defaultItemAttributes; } |
197 | void setItemAttributes(ObjAttrVector& oav) { docPrefsData.itemAttrPrefs.defaultItemAttributes=oav;} |
||
198 | void clearItemAttributes() { docPrefsData.itemAttrPrefs.defaultItemAttributes.clear(); } |
||
199 | void appendToItemAttributes(const ObjectAttribute& oa) { docPrefsData.itemAttrPrefs.defaultItemAttributes.append(oa); } |
||
200 | ToCSetupVector& tocSetups() { return docPrefsData.tocPrefs.defaultToCSetups; } |
||
201 | void setTocSetups(ToCSetupVector& tsv) { docPrefsData.tocPrefs.defaultToCSetups=tsv; } |
||
202 | void clearTocSetups() { docPrefsData.tocPrefs.defaultToCSetups.clear(); } |
||
203 | void appendToTocSetups(const ToCSetup& ts) { docPrefsData.tocPrefs.defaultToCSetups.append(ts); } |
||
14969 | cbradney | 204 | void setArrowStyles(QList<ArrowDesc>& as) { docPrefsData.arrowStyles=as; } |
205 | QList<ArrowDesc>& arrowStyles() { return docPrefsData.arrowStyles; } |
||
206 | void appendToArrowStyles(const struct ArrowDesc& as) { docPrefsData.arrowStyles.append(as); } |
||
14971 | cbradney | 207 | const bool marginColored() const { return docPrefsData.displayPrefs.marginColored; } |
208 | void setMarginColored(bool b) { docPrefsData.displayPrefs.marginColored=b; } |
||
209 | QMap<QString, CheckerPrefs>& checkerProfiles() { return docPrefsData.verifierPrefs.checkerPrefsList; } |
||
210 | void setCheckerProfiles(const QMap<QString, CheckerPrefs>& cl) { docPrefsData.verifierPrefs.checkerPrefsList=cl; } |
||
211 | void set1CheckerProfile(const QString profileName, const struct CheckerPrefs& cs) { docPrefsData.verifierPrefs.checkerPrefsList[profileName] = cs; } |
||
212 | void clearCheckerProfiles() { docPrefsData.verifierPrefs.checkerPrefsList.clear(); } |
||
213 | const QString& curCheckProfile() const { return docPrefsData.verifierPrefs.curCheckProfile; } |
||
214 | void setCurCheckProfile(const QString& s) { docPrefsData.verifierPrefs.curCheckProfile=s; } |
||
14991 | cbradney | 215 | int pageOrientation() const { return docPrefsData.docSetupPrefs.pageOrientation; } |
216 | void setPageOrientation(int o) { docPrefsData.docSetupPrefs.pageOrientation=o; } |
||
15407 | craig | 217 | int pagePositioning() const { return docPrefsData.docSetupPrefs.pagePositioning; } |
218 | void setPagePositioning(int p) { docPrefsData.docSetupPrefs.pagePositioning=p; } |
||
14991 | cbradney | 219 | double pageHeight() const { return docPrefsData.docSetupPrefs.pageHeight; } |
220 | double pageWidth() const { return docPrefsData.docSetupPrefs.pageWidth; } |
||
221 | const QString& pageSize() const { return docPrefsData.docSetupPrefs.pageSize; } |
||
222 | void setPageHeight(double h) { docPrefsData.docSetupPrefs.pageHeight=h; } |
||
223 | void setPageWidth(double w) { docPrefsData.docSetupPrefs.pageWidth=w; } |
||
224 | void setPageSize(const QString& s) { docPrefsData.docSetupPrefs.pageSize=s; } |
||
14992 | cbradney | 225 | int marginPreset() const { return docPrefsData.docSetupPrefs.marginPreset; } |
226 | void setMarginPreset(int mp) { docPrefsData.docSetupPrefs.marginPreset=mp; } |
||
14925 | cbradney | 227 | |
14932 | cbradney | 228 | TypoPrefs& typographicPrefs() { return docPrefsData.typoPrefs; } |
229 | GuidesPrefs& guidesPrefs() { return docPrefsData.guidesPrefs; } |
||
230 | ItemToolPrefs& itemToolPrefs() { return docPrefsData.itemToolPrefs; } |
||
231 | OperatorToolPrefs& opToolPrefs() { return docPrefsData.opToolPrefs; } |
||
15001 | cbradney | 232 | ColorPrefs& colorPrefs() { return docPrefsData.colorPrefs; } |
233 | CMSData& cmsSettings() { return docPrefsData.colorPrefs.DCMSset; } |
||
15037 | cbradney | 234 | DocumentInformation& documentInfo() { return docPrefsData.docInfo; } |
235 | void setDocumentInfo(DocumentInformation di) { docPrefsData.docInfo=di; } |
||
236 | DocumentSectionMap& sections() { return docPrefsData.docSectionMap; } |
||
237 | void setSections(DocumentSectionMap dsm) { docPrefsData.docSectionMap=dsm; } |
||
15065 | cbradney | 238 | const QMap<QString, int> & usedFonts() { return UsedFonts; } |
14927 | cbradney | 239 | |
14991 | cbradney | 240 | const ApplicationPrefs& prefsData() { return docPrefsData; } |
15096 | cbradney | 241 | void setNewPrefs(const ApplicationPrefs& prefsData, const ApplicationPrefs& oldPrefsData, bool resizePages, bool resizeMasterPages, bool resizePageMargins, bool resizeMasterPageMargins); |
14991 | cbradney | 242 | |
2937 | cbradney | 243 | // Add, delete and move pages |
3852 | cbradney | 244 | |
16729 | fschmid | 245 | ScPage* addPage(const int pageNumber, const QString& masterPageName=QString::null, const bool addAutoFrame=false); |
4069 | craig | 246 | void deletePage(const int); |
6715 | cbradney | 247 | //! @brief Add a master page with this function, do not use addPage |
16729 | fschmid | 248 | ScPage* addMasterPage(const int, const QString&); |
6715 | cbradney | 249 | void deleteMasterPage(const int); |
10155 | jghali | 250 | //! @brief Rebuild master name list |
251 | void rebuildMasterNames(void); |
||
252 | //! @brief Replace a master page by default one |
||
253 | void replaceMasterPage(const QString& oldMasterPage); |
||
5685 | cbradney | 254 | //! @brief Rename a master page |
255 | bool renameMasterPage(const QString& oldPageName, const QString& newPageName); |
||
6715 | cbradney | 256 | //! @brief Create the default master pages based on the layout selected by the user, ie, Normal, Normal Left, etc. |
257 | void createDefaultMasterPages(); |
||
258 | //! @brief Create the requested pages in a new document, run after createDefaultMasterPages() |
||
259 | void createNewDocPages(int pageCount); |
||
3852 | cbradney | 260 | /** |
3860 | cbradney | 261 | * @brief Add the automatic text frame to the page |
4645 | subik | 262 | * @param pageNumber page number |
3860 | cbradney | 263 | * @return number of frame |
3852 | cbradney | 264 | */ |
4645 | subik | 265 | int addAutomaticTextFrame(const int pageNumber); |
3531 | cbradney | 266 | /** |
3852 | cbradney | 267 | * Set the left and right margins based on the location of the page |
268 | * @param pageIndex |
||
269 | */ |
||
270 | void setLocationBasedPageLRMargins(uint pageIndex); |
||
271 | /** |
||
3531 | cbradney | 272 | * @brief Move page(s) within the document |
17213 | craig | 273 | * @param fromPage page index |
274 | * @param toPage page index |
||
275 | * @param count target to move to (page index) |
||
276 | * @param position Before, After or at the end |
||
3531 | cbradney | 277 | */ |
17213 | craig | 278 | void movePage(const int fromPage, const int toPage, const int dest, const int position); |
3843 | cbradney | 279 | |
280 | /** |
||
281 | * @brief Copy a page (pageNumberToCopy) copyCount times, whereToInsert(before or after) the existingPage or at the end. |
||
282 | * @param pageNumberToCopy |
||
283 | * @param existingPage |
||
284 | * @param whereToInsert |
||
285 | * @param copyCount |
||
286 | */ |
||
287 | void copyPage(int pageNumberToCopy, int existingPage, int whereToInsert, int copyCount); |
||
288 | |||
2937 | cbradney | 289 | // Add, delete and move layers |
3201 | subik | 290 | /** |
2947 | cbradney | 291 | * @brief Add a layer to the current document |
4645 | subik | 292 | * @param layerName name of layer |
4650 | subik | 293 | * @param activate the layer active |
2947 | cbradney | 294 | * @return Number of the layer created |
295 | */ |
||
4645 | subik | 296 | int addLayer(const QString& layerName=QString::null, const bool activate=false); |
3201 | subik | 297 | /** |
6290 | fschmid | 298 | * @brief Copies a layer from the current document |
13875 | jghali | 299 | * @param layerIDToCopy source layer |
6290 | fschmid | 300 | * @param whereToInsert target layer |
301 | * @return Success or failure |
||
302 | */ |
||
13875 | jghali | 303 | void copyLayer(int layerIDToCopy, int whereToInsert); |
6290 | fschmid | 304 | /** |
2947 | cbradney | 305 | * @brief Delete a layer from the current document |
13875 | jghali | 306 | * @param layerID of layer |
4645 | subik | 307 | * @param deleteItems the items on the layer too? |
2947 | cbradney | 308 | * @return Success or failure |
309 | */ |
||
13875 | jghali | 310 | bool deleteLayer(const int layerID, const bool deleteItems); |
2947 | cbradney | 311 | /** |
312 | * @brief Return the number of the current layer |
||
313 | * @return Active layer number |
||
314 | */ |
||
3985 | cbradney | 315 | int activeLayer(); |
3201 | subik | 316 | |
2947 | cbradney | 317 | /** |
318 | * @brief Return the name of the current layer |
||
319 | * @return Name of the layer |
||
320 | */ |
||
2937 | cbradney | 321 | const QString& activeLayerName(); |
2947 | cbradney | 322 | /** |
323 | * @brief Set the active layer via the layer number |
||
4650 | subik | 324 | * @param layerToActivate Number of the layer |
2947 | cbradney | 325 | * @return Success or failure |
326 | */ |
||
4650 | subik | 327 | bool setActiveLayer(const int layerToActivate); |
2947 | cbradney | 328 | /** |
329 | * @brief Set the active layer via the layer name |
||
4650 | subik | 330 | * @param layerNameToActivate Name of the layer |
2947 | cbradney | 331 | * @return Success or failure |
332 | */ |
||
4650 | subik | 333 | bool setActiveLayer(const QString & layerNameToActivate); |
2947 | cbradney | 334 | /** |
335 | * @brief Set the layer printable via the layer number |
||
13875 | jghali | 336 | * @param layerID ID of the layer |
4650 | subik | 337 | * @param isPrintable bool true = layer is prantable |
2947 | cbradney | 338 | * @return Success or failure |
339 | */ |
||
13875 | jghali | 340 | bool setLayerPrintable(const int layerID, const bool isPrintable); |
2947 | cbradney | 341 | /** |
342 | * @brief Is the layer printable |
||
13875 | jghali | 343 | * @param layerID ID of the layer |
2947 | cbradney | 344 | * @return Printable or not |
345 | */ |
||
13875 | jghali | 346 | bool layerPrintable(const int layerID); |
2947 | cbradney | 347 | /** |
348 | * @brief Set the layer visible via the layer number |
||
13875 | jghali | 349 | * @param layerID ID of the layer |
4650 | subik | 350 | * @param isViewable true = layer is visible |
2947 | cbradney | 351 | * @return Success or failure |
352 | */ |
||
13875 | jghali | 353 | bool setLayerVisible(const int layerID, const bool isViewable); |
2947 | cbradney | 354 | /** |
355 | * @brief Is the layer visible |
||
13875 | jghali | 356 | * @param layerID ID of the layer |
2947 | cbradney | 357 | * @return Visible or not |
358 | */ |
||
13875 | jghali | 359 | bool layerVisible(const int layerID); |
2947 | cbradney | 360 | /** |
17454 | fschmid | 361 | * @brief are objects on the layer selectable |
362 | * @param layerID ID of the layer |
||
363 | * @return Items selectable or not |
||
364 | */ |
||
365 | bool layerSelectable(const int layerID); |
||
366 | /** |
||
367 | * @brief Set objects on the layer selectable via the layer ID |
||
368 | * @param layerID ID of the layer |
||
369 | * @param isSelectable true = layer objects are selectable |
||
370 | * @return bool Success or failure |
||
371 | */ |
||
372 | bool setLayerSelectable(const int layerID, const bool isSelectable); |
||
373 | /** |
||
4832 | fschmid | 374 | * @brief Set the layer locked via the layer number |
13875 | jghali | 375 | * @param layerID ID of the layer |
12071 | subik | 376 | * @param isLocked true = layer is locked |
4832 | fschmid | 377 | * @return Success or failure |
378 | */ |
||
13875 | jghali | 379 | bool setLayerLocked(const int layerID, const bool isLocked); |
4832 | fschmid | 380 | /** |
381 | * @brief Is the layer locked |
||
13875 | jghali | 382 | * @param layerID ID of the layer |
4832 | fschmid | 383 | * @return Locked or not |
384 | */ |
||
13875 | jghali | 385 | bool layerLocked(const int layerID); |
4832 | fschmid | 386 | /** |
5359 | fschmid | 387 | * @brief Set the layer flow via the layer number |
13875 | jghali | 388 | * @param layerID ID of the layer |
5359 | fschmid | 389 | * @param flow true = Text flows around objects on this layer |
390 | * @return Success or failure |
||
391 | */ |
||
13875 | jghali | 392 | bool setLayerFlow(const int layerID, const bool flow); |
5359 | fschmid | 393 | /** |
394 | * @brief does text flow around objects on this layer |
||
13875 | jghali | 395 | * @param layerID ID of the layer |
5359 | fschmid | 396 | * @return flow or not |
397 | */ |
||
13875 | jghali | 398 | bool layerFlow(const int layerID); |
5359 | fschmid | 399 | /** |
5373 | fschmid | 400 | * @brief Set the layer transparency via the layer number |
13875 | jghali | 401 | * @param layerID ID of the layer |
5373 | fschmid | 402 | * @param trans transparency value 0.0 - 1.0 |
403 | * @return Success or failure |
||
404 | */ |
||
13875 | jghali | 405 | bool setLayerTransparency(const int layerID, double trans); |
5373 | fschmid | 406 | /** |
407 | * @brief returns the layer transparency |
||
13875 | jghali | 408 | * @param layerID ID of the layer |
5373 | fschmid | 409 | * @return transparency value 0.0 - 1.0 |
410 | */ |
||
13875 | jghali | 411 | double layerTransparency(const int layerID); |
5373 | fschmid | 412 | /** |
5375 | fschmid | 413 | * @brief Set the layer layerBlendMode via the layer number |
13875 | jghali | 414 | * @param layerID ID of the layer |
12071 | subik | 415 | * @param blend layerBlendMode |
5375 | fschmid | 416 | * @return Success or failure |
417 | */ |
||
13875 | jghali | 418 | bool setLayerBlendMode(const int ID, int blend); |
5375 | fschmid | 419 | /** |
420 | * @brief returns the layer BlendMode |
||
13875 | jghali | 421 | * @param layerID ID of the layer |
5375 | fschmid | 422 | * @return layerBlendMode |
423 | */ |
||
13875 | jghali | 424 | int layerBlendMode(const int ID); |
5375 | fschmid | 425 | /** |
2947 | cbradney | 426 | * @brief Return the level of the requested layer |
13875 | jghali | 427 | * @param layerID ID of the layer |
2947 | cbradney | 428 | * @return Level of the layer |
429 | */ |
||
13875 | jghali | 430 | int layerLevelFromID(const int layerID); |
2947 | cbradney | 431 | /** |
5572 | fschmid | 432 | * @brief Set the layer marker color |
13875 | jghali | 433 | * @param ID Number of the layer |
5572 | fschmid | 434 | * @param color color of the marker |
435 | * @return Success or failure |
||
436 | */ |
||
13875 | jghali | 437 | bool setLayerMarker(const int layerID, QColor color); |
5572 | fschmid | 438 | /** |
439 | * @brief returns the layer marker color |
||
13875 | jghali | 440 | * @param layerID ID of the layer |
5572 | fschmid | 441 | * @return marker color |
442 | */ |
||
13875 | jghali | 443 | QColor layerMarker(const int layerID); |
5572 | fschmid | 444 | /** |
445 | * @brief Set the layer outline mode via the layer number |
||
13875 | jghali | 446 | * @param layerID ID of the layer |
5572 | fschmid | 447 | * @param outline true = layer is displayed in outlines only |
448 | * @return Success or failure |
||
449 | */ |
||
13875 | jghali | 450 | bool setLayerOutline(const int layerID, const bool outline); |
5572 | fschmid | 451 | /** |
452 | * @brief is this layer in outline mode |
||
13875 | jghali | 453 | * @param layerID ID of the layer |
5572 | fschmid | 454 | * @return outline or not |
455 | */ |
||
13875 | jghali | 456 | bool layerOutline(const int layerID); |
5572 | fschmid | 457 | /** |
2947 | cbradney | 458 | * @brief Return the number of the layer at a certain level |
4650 | subik | 459 | * @param layerLevel Layer level |
13875 | jghali | 460 | * @return Layer ID |
2947 | cbradney | 461 | */ |
13875 | jghali | 462 | int layerIDFromLevel(const int layerLevel); |
2947 | cbradney | 463 | /** |
464 | * @brief Return the layer count |
||
465 | * @return Number of layers in doc |
||
466 | */ |
||
17497 | fschmid | 467 | int layerIDFromName(QString name); |
3985 | cbradney | 468 | int layerCount() const; |
2947 | cbradney | 469 | /** |
470 | * @brief Lower a layer |
||
13875 | jghali | 471 | * @param layerID ID of the layer |
2947 | cbradney | 472 | * @return Success or failure |
473 | */ |
||
13875 | jghali | 474 | bool lowerLayer(const int layerID); |
2947 | cbradney | 475 | /** |
476 | * @brief Lower a layer using the level |
||
4650 | subik | 477 | * @param layerLevel Level of the layer |
2947 | cbradney | 478 | * @return Success or failure |
479 | */ |
||
4650 | subik | 480 | bool lowerLayerByLevel(const int layerLevel); |
2947 | cbradney | 481 | /** |
482 | * @brief Raise a layer |
||
13875 | jghali | 483 | * @param layerID ID of the layer |
2947 | cbradney | 484 | * @return Success or failure |
485 | */ |
||
13875 | jghali | 486 | bool raiseLayer(const int layerID); |
2947 | cbradney | 487 | /** |
488 | * @brief Raise a layer using the level |
||
4650 | subik | 489 | * @param layerLevel Level of the layer |
2947 | cbradney | 490 | * @return Success or failure |
491 | */ |
||
4650 | subik | 492 | bool raiseLayerByLevel(const int layerLevel); |
2947 | cbradney | 493 | /** |
494 | * @brief Return the layer name |
||
13875 | jghali | 495 | * @param layerID ID of the layer |
3201 | subik | 496 | * @return Name of the layer |
2947 | cbradney | 497 | */ |
13875 | jghali | 498 | QString layerName(const int layerID) const; |
2947 | cbradney | 499 | /** |
500 | * @brief Change the name of a layer |
||
13875 | jghali | 501 | * @param layerID ID of the layer |
4645 | subik | 502 | * @param newName new name of the layer |
2947 | cbradney | 503 | * @return Success or failure |
504 | */ |
||
13875 | jghali | 505 | bool changeLayerName(const int layerID, const QString& newName); |
2947 | cbradney | 506 | /** |
507 | * @brief Does the layer have items on it? |
||
13875 | jghali | 508 | * @param layerID ID of the layer |
2947 | cbradney | 509 | * @return Layer contains items bool |
510 | */ |
||
13875 | jghali | 511 | bool layerContainsItems(const int layerID); |
2947 | cbradney | 512 | /** |
513 | * @brief Renumber a layer. Used in particular for reinsertion for undo/redo |
||
13875 | jghali | 514 | * @param layerID old layer ID |
515 | * @param newLayerID New layer ID |
||
2947 | cbradney | 516 | * @return Success or failure |
517 | */ |
||
13875 | jghali | 518 | bool renumberLayer(const int layerID, const int newLayerID); |
2947 | cbradney | 519 | /** |
520 | * @brief Return a list of the layers in their order |
||
4650 | subik | 521 | * @param list QStringList to insert the layer names into |
2947 | cbradney | 522 | */ |
4650 | subik | 523 | void orderedLayerList(QStringList* list); |
18363 | fschmid | 524 | |
525 | int firstLayerID(); |
||
2937 | cbradney | 526 | //Items |
3985 | cbradney | 527 | bool deleteTaggedItems(); |
3201 | subik | 528 | |
7442 | avox | 529 | /*! |
530 | * @brief Builds a qmap of the icc profiles used within the document |
||
531 | */ |
||
532 | void getUsedProfiles(ProfilesL& usedProfiles); |
||
5345 | mrdocs | 533 | bool OpenCMSProfiles(ProfilesL InPo, ProfilesL InPoCMYK, ProfilesL MoPo, ProfilesL PrPo); |
1330 | fschmid | 534 | void CloseCMSProfiles(); |
10338 | jghali | 535 | void SetDefaultCMSParams(); |
6726 | fschmid | 536 | /** |
7442 | avox | 537 | * @brief Switch Colormanagement on or of |
6726 | fschmid | 538 | * @param enable bool, if true Colormanagement is switched on, else off |
539 | */ |
||
540 | void enableCMS(bool enable); |
||
7442 | avox | 541 | |
8521 | cbradney | 542 | const ParagraphStyle& paragraphStyle(QString name) { return docParagraphStyles.get(name); } |
7442 | avox | 543 | const StyleSet<ParagraphStyle>& paragraphStyles() { return docParagraphStyles; } |
7944 | cbradney | 544 | bool isDefaultStyle( const ParagraphStyle& p ) const { return docParagraphStyles.isDefault(p); } |
545 | bool isDefaultStyle( const CharStyle& c ) const { return docCharStyles.isDefault(c); } |
||
546 | // bool isDefaultStyle( LineStyle& l ) const { return MLineStyles......; } |
||
8455 | avox | 547 | |
16856 | craig | 548 | /** |
549 | * Returns the table style named @a name. |
||
550 | */ |
||
551 | const TableStyle& tableStyle(QString name) { return docTableStyles.get(name); } |
||
552 | /** |
||
553 | * Returns the set of table styles in the document. |
||
554 | */ |
||
555 | const StyleSet<TableStyle>& tableStyles() { return docTableStyles; } |
||
556 | /** |
||
557 | * Returns <code>true</code> if @a style is the default table style. |
||
558 | */ |
||
559 | bool isDefaultStyle(const TableStyle& style) const { return docTableStyles.isDefault(style); } |
||
560 | /** |
||
561 | * Redefines the set of table styles in the document using styles in @a newStyles. |
||
562 | * Removes unused table styles if @a removeUnused is <code>true</code>. |
||
563 | */ |
||
564 | void redefineTableStyles(const StyleSet<TableStyle>& newStyles, bool removeUnused = false); |
||
565 | /** |
||
566 | * Remove any reference to old table styles and replace with new name. |
||
567 | * This needs to be called when a style was removed. New name may be "". |
||
568 | * @a newNameForOld is a map which maps the name of any style to remove |
||
569 | * to a new table style name |
||
570 | */ |
||
571 | void replaceTableStyles(const QMap<QString, QString>& newNameForOld); |
||
572 | |||
573 | /** |
||
574 | * Returns the table cell style named @a name. |
||
575 | */ |
||
576 | const CellStyle& cellStyle(QString name) { return docCellStyles.get(name); } |
||
577 | /** |
||
578 | * Returns the set of table cell styles in the document. |
||
579 | */ |
||
580 | const StyleSet<CellStyle>& cellStyles() { return docCellStyles; } |
||
581 | /** |
||
582 | * Returns <code>true</code> if @a style is the default table cell style. |
||
583 | */ |
||
584 | bool isDefaultStyle(const CellStyle& style) const { return docCellStyles.isDefault(style); } |
||
585 | /** |
||
586 | * Redefines the set of table cell styles in the document using styles in @a newStyles. |
||
587 | * Removes unused table cell styles if @a removeUnused is <code>true</code>. |
||
588 | */ |
||
589 | void redefineCellStyles(const StyleSet<CellStyle>& newStyles, bool removeUnused = false); |
||
590 | /** |
||
591 | * Remove any reference to old table cell styles and replace with new name. |
||
592 | * This needs to be called when a style was removed. New name may be "". |
||
593 | * @a newNameForOld is a map which maps the name of any style to remove |
||
594 | * to a new table cell style name |
||
595 | */ |
||
596 | void replaceCellStyles(const QMap<QString, QString>& newNameForOld); |
||
597 | |||
8455 | avox | 598 | void getNamedResources(ResourceCollection& lists) const; |
17376 | fschmid | 599 | struct ResMapped |
600 | { |
||
601 | ResMapped(ResourceCollection& newNames) { m_newNames = newNames;} |
||
602 | |||
603 | void operator()(PageItem *item) |
||
604 | { |
||
605 | item->replaceNamedResources(m_newNames); |
||
606 | } |
||
607 | |||
608 | ResourceCollection m_newNames; |
||
609 | }; |
||
16386 | fschmid | 610 | void replaceNamedResources(ResourceCollection& newNames); |
611 | bool styleExists(QString styleName); |
||
16682 | jghali | 612 | |
16396 | fschmid | 613 | QList<int> getSortedStyleList(); |
614 | QList<int> getSortedCharStyleList(); |
||
16859 | craig | 615 | QList<int> getSortedTableStyleList(); |
616 | QList<int> getSortedCellStyleList(); |
||
8455 | avox | 617 | |
7595 | avox | 618 | void redefineStyles(const StyleSet<ParagraphStyle>& newStyles, bool removeUnused=false); |
7442 | avox | 619 | /** |
620 | * @brief Remove any reference to old styles and replace with new name. This needs to be |
||
621 | * called when a style was removed. New name may be "". |
||
622 | * @param newNameForOld a map which maps the name of any style to remove to a new stylename |
||
623 | */ |
||
7944 | cbradney | 624 | void replaceStyles(const QMap<QString,QString>& newNameForOld); |
12548 | pierre | 625 | /** |
626 | * @brief Insert styles from another document in this document. |
||
627 | * |
||
628 | * @param fileName The path of the document we want to extract its styles |
||
629 | */ |
||
630 | void loadStylesFromFile(QString fileName); |
||
631 | /** |
||
632 | * @brief Gather styles from another document. |
||
633 | * |
||
634 | * @param fileName The path of the document we want to extract its styles |
||
635 | * @param tempStyles A pointer to a StyleSet which will be filled by paragraph styles |
||
636 | * @param tempCharStyles A pointer to a StyleSet which will be filled by character styles |
||
637 | * @param tempLineStyles A map which will be filled by line styles |
||
638 | */ |
||
639 | void loadStylesFromFile(QString fileName, StyleSet<ParagraphStyle> *tempStyles, |
||
640 | StyleSet<CharStyle> *tempCharStyles, |
||
17400 | fschmid | 641 | QHash<QString, multiLine> *tempLineStyles); |
7442 | avox | 642 | |
8521 | cbradney | 643 | const CharStyle& charStyle(QString name) { return docCharStyles.get(name); } |
7442 | avox | 644 | const StyleSet<CharStyle>& charStyles() { return docCharStyles; } |
7595 | avox | 645 | void redefineCharStyles(const StyleSet<CharStyle>& newStyles, bool removeUnused=false); |
3201 | subik | 646 | /** |
7442 | avox | 647 | * @brief Remove any reference to old styles and replace with new name. This needs to be |
648 | * called when a style was removed. New name may be "". |
||
649 | * @param newNameForOld a map which maps the name of any style to remove to a new stylename |
||
650 | */ |
||
7944 | cbradney | 651 | void replaceCharStyles(const QMap<QString,QString>& newNameForOld); |
7442 | avox | 652 | |
653 | /** |
||
1179 | tsoots | 654 | * @brief Should guides be locked or not |
655 | * @param isLocked If true guides on pages cannot be moved if false they |
||
656 | * can be dragged to new positions. |
||
657 | * @author Riku Leino |
||
658 | */ |
||
659 | void lockGuides(bool isLocked); |
||
1190 | tsoots | 660 | /** |
1179 | tsoots | 661 | * @brief Method used when an undo/redo is requested. |
662 | * @param state State describing the action that is wanted to be undone/redone |
||
663 | * @param isUndo If true undo is wanted else if false redo. |
||
664 | * @author Riku Leino |
||
665 | */ |
||
666 | void restore(UndoState* state, bool isUndo); |
||
667 | /** |
||
668 | * @brief Sets the name of the document |
||
669 | * @param name Name for the document |
||
670 | * @author Riku Leino |
||
671 | */ |
||
672 | void setName(const QString& name); |
||
1694 | cbradney | 673 | /*! |
674 | * @brief Returns a stringlist of the item attributes within the document |
||
675 | */ |
||
676 | QStringList getItemAttributeNames(); |
||
3201 | subik | 677 | |
7442 | avox | 678 | bool AddFont(QString name, int fsize = 10); |
2960 | cbradney | 679 | /*! |
12319 | cbradney | 680 | * @brief TODO: Reorganise the fonts.. how? Moved from scribus.cpp |
681 | * CB: almost the same as getUsedFonts??? |
||
682 | */ |
||
12953 | fschmid | 683 | QMap<QString,int> reorganiseFonts(); |
12319 | cbradney | 684 | /*! |
5387 | avox | 685 | * @brief Returns a qmap of the fonts and their glyphs used within the document |
2960 | cbradney | 686 | */ |
5387 | avox | 687 | void getUsedFonts(QMap<QString,QMap<uint, FPointArray> > &Really); |
6407 | fschmid | 688 | void checkItemForFonts(PageItem *it, QMap<QString, QMap<uint, FPointArray> > & Really, uint lc); |
8985 | jghali | 689 | |
2960 | cbradney | 690 | /*! |
8985 | jghali | 691 | * @brief Replace line style colors |
692 | */ |
||
693 | void replaceLineStyleColors(const QMap<QString, QString>& colorMap); |
||
694 | /*! |
||
3057 | fschmid | 695 | * @brief Builds a qmap of the colours used within the document |
696 | */ |
||
3068 | fschmid | 697 | void getUsedColors(ColorList &colorsToUse, bool spot = false); |
3057 | fschmid | 698 | /*! |
8950 | jghali | 699 | * @brief Return if a specific color is used by line styles |
700 | */ |
||
701 | bool lineStylesUseColor(const QString& colorName); |
||
702 | /*! |
||
16016 | fschmid | 703 | * @brief Builds a qmap of the gradients used within the document |
704 | */ |
||
17400 | fschmid | 705 | void getUsedGradients(QHash<QString, VGradient> &Gradients); |
16016 | fschmid | 706 | /*! |
14150 | fschmid | 707 | * @brief Set the gradients for a document |
708 | */ |
||
709 | bool addGradient(QString &name, VGradient &gradient); |
||
17400 | fschmid | 710 | void setGradients(QHash<QString, VGradient> &gradients); |
14150 | fschmid | 711 | /*! |
6517 | cbradney | 712 | * @brief Set the patterns for a document |
713 | */ |
||
714 | bool addPattern(QString &name, ScPattern& pattern); |
||
17400 | fschmid | 715 | void setPatterns(QHash<QString, ScPattern> &patterns); |
6517 | cbradney | 716 | /*! |
6400 | fschmid | 717 | * @brief Builds a QStringList of the patterns used within the document |
718 | */ |
||
719 | QStringList getUsedPatterns(); |
||
12744 | fschmid | 720 | QStringList getUsedPatternsSelection(Selection* customSelection); |
6400 | fschmid | 721 | QStringList getUsedPatternsHelper(QString pattern, QStringList &results); |
16052 | fschmid | 722 | QStringList getPatternDependencyList(QStringList used); |
15077 | fschmid | 723 | /*! |
724 | * @brief Builds a QStringList of the symbols used within the document |
||
725 | */ |
||
726 | QStringList getUsedSymbols(); |
||
727 | QStringList getUsedSymbolsHelper(QString pattern, QStringList &results); |
||
2965 | cbradney | 728 | /** |
729 | * @brief Set and get the document's unit index |
||
730 | */ |
||
731 | void setUnitIndex(const int); |
||
3985 | cbradney | 732 | int unitIndex() const; |
733 | double unitRatio() const; |
||
3004 | cbradney | 734 | /** |
735 | * @brief Apply a master page |
||
736 | */ |
||
6578 | cbradney | 737 | bool applyMasterPage(const QString& pageName, const int pageNumber); |
3004 | cbradney | 738 | /** |
739 | * @brief Undo function for applying a master page |
||
740 | */ |
||
741 | void restoreMasterPageApplying(SimpleState *state, bool isUndo); |
||
17213 | craig | 742 | void restoreCopyPage(SimpleState *state, bool isUndo); |
743 | void restoreMovePage(SimpleState *state, bool isUndo); |
||
17640 | craig | 744 | void restoreAddMasterPage(SimpleState *state, bool isUndo); |
3020 | cbradney | 745 | /** |
13194 | jghali | 746 | * @brief Undo function for grouping/ungrouping |
747 | */ |
||
748 | void restoreGrouping(SimpleState *state, bool isUndo); |
||
749 | /** |
||
17640 | craig | 750 | * @brief Undo function for level |
751 | */ |
||
752 | void restoreLevelDown(SimpleState *state, bool isUndo); |
||
753 | void restoreLevelBottom(SimpleState *state, bool isUndo); |
||
754 | /** |
||
3020 | cbradney | 755 | * @brief Save function |
756 | */ |
||
11212 | jghali | 757 | bool save(const QString& fileName, QString* savedFile = NULL); |
3025 | cbradney | 758 | /** |
759 | * @brief Set the page margins. Current code uses current page only, also provide a (currently, TODO) option for this. |
||
760 | */ |
||
16509 | craig | 761 | bool changePageMargins(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); |
3123 | cbradney | 762 | /** |
763 | * @brief Recalculate the colors after CMS settings change. Update the items in the doc accordingly. |
||
764 | */ |
||
17371 | fschmid | 765 | void recalculateColorsList(QList<PageItem *> *itemList); |
17376 | fschmid | 766 | static void recalculateColorItem(PageItem *item); |
17371 | fschmid | 767 | void recalculateColors(); |
3179 | cbradney | 768 | /** |
769 | * @brief Sets up the ScText defaults from the document |
||
770 | */ |
||
18987 | avox | 771 | //void setScTextDefaultsFromDoc(ScText *); |
3200 | cbradney | 772 | /** |
773 | * @brief Copies a normal page to be a master pages |
||
774 | */ |
||
10833 | cbradney | 775 | bool copyPageToMasterPage(const int, const int, const int, const QString&, bool); |
3263 | cbradney | 776 | |
19111 | avox | 777 | |
778 | /** |
||
779 | * @brief Just create but don't add to items list and don't create undo record |
||
780 | */ |
||
781 | 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); |
||
782 | |||
3263 | cbradney | 783 | /** |
784 | * @brief Add an Item to the document. |
||
785 | * A simple function to create an item of a defined type and add it to the document |
||
786 | * Will need extensive rewriting once we have various classes of PageItems, at a guess. |
||
787 | * |
||
788 | * @param itemFinalised Used to handle item creation for undo while the user is still dragging. |
||
789 | * @return Number of created item, -1 on failure. |
||
4650 | subik | 790 | \param itemType type |
791 | \param frameType frame type |
||
792 | \param x X pos |
||
793 | \param y Y pos |
||
794 | \param b width |
||
795 | \param h height |
||
796 | \param w ? |
||
797 | \param fill fill color name |
||
798 | \param outline outline color name |
||
17826 | craig | 799 | \param noteFrame optional (default false) indicates that noteframes should be created, not text frame |
4650 | subik | 800 | */ |
17826 | craig | 801 | 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); |
5164 | tsoots | 802 | |
803 | /** Add an item to the page based on the x/y position. Item will be fitted to the closest guides/margins */ |
||
804 | 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); |
||
6115 | cbradney | 805 | |
6137 | cbradney | 806 | /** |
807 | * @brief Allow the user to create a frame easily with some simple placement and sizing options |
||
12071 | subik | 808 | * @param iafData a InsertAFrameData structure with params |
809 | * @return int item id? FIXME |
||
6137 | cbradney | 810 | */ |
6657 | cbradney | 811 | int itemAddUserFrame(InsertAFrameData &iafData); |
5164 | tsoots | 812 | |
3263 | cbradney | 813 | /** |
814 | * @brief Commit item creation when a user has click-drag created an item |
||
815 | * Only called from ScribusView. Note the undo target is the page, so the undo code remains their for now. |
||
816 | * @return If an item was committed and the view must emit its signal, which needs removing from here, TODO. |
||
817 | */ |
||
16943 | fschmid | 818 | bool itemAddCommit(PageItem* item); |
3263 | cbradney | 819 | |
820 | /** |
||
821 | * @brief Finalise item creation. Simply split off code from itemAdd |
||
822 | * Only to be called from itemAdd() |
||
823 | */ |
||
16943 | fschmid | 824 | void itemAddDetails(const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, PageItem* newItem); |
7068 | fschmid | 825 | |
826 | uint getItemNrfromUniqueID(uint unique); |
||
16926 | fschmid | 827 | //return pointer to item |
828 | PageItem* getItemFromName(QString name); |
||
3263 | cbradney | 829 | //itemDelete |
830 | //itemBlah... |
||
16943 | fschmid | 831 | |
3628 | cbradney | 832 | /** |
10140 | jghali | 833 | * @brief Rebuild item lists taking into account layer order. |
834 | * Utility function used in various places, basically handles keeping items numbered in the way |
||
835 | * they are layered. When layer is a property and not a fuction of storage, this should be removed. |
||
836 | * @sa updateFrameItems(); |
||
837 | */ |
||
838 | void rebuildItemLists(); |
||
839 | /** |
||
3648 | cbradney | 840 | * @brief Doc uses automatic text frames? |
841 | */ |
||
3985 | cbradney | 842 | bool usesAutomaticTextFrames() const; |
3648 | cbradney | 843 | void setUsesAutomaticTextFrames(const bool); |
3650 | cbradney | 844 | |
845 | /** |
||
846 | * @brief Load images into an image frame, moved from the view |
||
847 | * @retval Return false on failure |
||
848 | */ |
||
16943 | fschmid | 849 | // bool LoadPict(QString fn, int ItNr, bool reload = false, bool showMsg = false); |
3942 | cbradney | 850 | /** |
851 | * |
||
852 | * @param fn |
||
853 | * @param pageItem |
||
854 | * @param reload |
||
855 | * @return |
||
856 | */ |
||
5977 | jghali | 857 | bool loadPict(QString fn, PageItem *pageItem, bool reload = false, bool showMsg = false); |
3656 | cbradney | 858 | /** |
4650 | subik | 859 | * \brief Handle image with color profiles |
860 | * @param Pr profile |
||
861 | @param PrCMYK cmyk profile |
||
862 | @param dia optional progress widget |
||
3942 | cbradney | 863 | */ |
9953 | cbradney | 864 | void RecalcPictures(ProfilesL *Pr, ProfilesL *PrCMYK, QProgressBar *dia = 0); |
3942 | cbradney | 865 | /** |
14532 | jghali | 866 | * \brief Handle image with color profiles |
867 | * @param items list of page items to update |
||
868 | * @param Pr profile |
||
869 | * @param PrCMYK cmyk profile |
||
870 | * @param dia optional progress widget |
||
871 | */ |
||
872 | void RecalcPictures(QList<PageItem*>* items, ProfilesL *Pr, ProfilesL *PrCMYK, QProgressBar *dia = 0); |
||
873 | /** |
||
14535 | fschmid | 874 | * |
3656 | cbradney | 875 | * @brief Find the minX,MinY and maxX,maxY for the canvas required for the doc |
876 | */ |
||
877 | void canvasMinMax(FPoint&, FPoint&); |
||
3657 | cbradney | 878 | |
16697 | jghali | 879 | int OnPage(double x2, double y2); |
880 | int OnPage(PageItem *currItem); |
||
3657 | cbradney | 881 | void GroupOnPage(PageItem *currItem); |
17338 | jghali | 882 | |
4672 | cbradney | 883 | void reformPages(bool moveObjects = true); |
17338 | jghali | 884 | /** @brief Refresh automatic guides once Margin struct has been properly configure by reformPages() */ |
885 | void refreshGuides(); |
||
19089 | jghali | 886 | |
17338 | jghali | 887 | /** @brief Check and fix if needed PageItem OwnPage member */ |
16697 | jghali | 888 | void fixItemPageOwner(); |
19089 | jghali | 889 | /** @brief Fix paragraph styles */ |
890 | void fixParagraphStyles(); |
||
891 | /** @brief Fix notes styles */ |
||
892 | void fixNotesStyles(); |
||
3664 | cbradney | 893 | |
894 | /** |
||
3670 | cbradney | 895 | * @brief Return the x or y offset for a page on the canvas |
896 | * @retval double containing the offset. Returns -1.0 if page not in Pages list (as -ve is not possible). |
||
897 | * Mostly saves bringing in extra includes into files that already have scribusdoc.h |
||
3664 | cbradney | 898 | */ |
10508 | cbradney | 899 | double getXOffsetForPage(const int); |
900 | double getYOffsetForPage(const int); |
||
12419 | cbradney | 901 | void getBleeds(int pageNumber, MarginStruct& bleedData); |
16729 | fschmid | 902 | void getBleeds(const ScPage* page, MarginStruct& bleedData); |
903 | void getBleeds(const ScPage* page, const MarginStruct& baseValues, MarginStruct& bleedData); |
||
3670 | cbradney | 904 | |
905 | /** |
||
906 | * @brief Item type conversion functions |
||
907 | */ |
||
3676 | cbradney | 908 | PageItem* convertItemTo(PageItem *currItem, PageItem::ItemType newType, PageItem* secondaryItem=NULL); |
3670 | cbradney | 909 | |
910 | /** |
||
911 | * @brief The page number of the current page |
||
912 | */ |
||
10508 | cbradney | 913 | int currentPageNumber(); |
3689 | cbradney | 914 | |
915 | /** |
||
916 | * @brief Return true iff the passed name is not used by any existing PageItem |
||
917 | * in the same document as this PageItem. |
||
918 | * @author Craig Ringer |
||
919 | ** CB Moved from PageItem |
||
920 | */ |
||
921 | bool itemNameExists(const QString itemName); |
||
3724 | cbradney | 922 | |
923 | /** |
||
924 | * @brief Set the doc into Master page mode |
||
925 | * Do we need to return if the move to master page mode was successful? |
||
926 | */ |
||
4738 | cbradney | 927 | void setMasterPageMode(bool); |
4061 | craig | 928 | |
929 | /*** Is the document in master page mode? */ |
||
930 | bool masterPageMode() const { return m_masterPageMode; } |
||
16029 | fschmid | 931 | /** |
932 | * @brief Set the doc into symbol edit mode |
||
933 | */ |
||
934 | void setSymbolEditMode(bool mode, QString symbolName = ""); |
||
935 | |||
936 | /*** Is the document in symbol edit mode? */ |
||
937 | bool symbolEditMode() const { return m_symbolEditMode; } |
||
3757 | cbradney | 938 | |
16740 | fschmid | 939 | /*** get the name of the symbol currently in editing */ |
940 | QString getEditedSymbol() const { return currentEditedSymbol; } |
||
17410 | fschmid | 941 | /** |
942 | * @brief Set the doc into inline edit mode |
||
943 | */ |
||
944 | void setInlineEditMode(bool mode, int id = -1); |
||
16740 | fschmid | 945 | |
17410 | fschmid | 946 | /*** Is the document in symbol edit mode? */ |
947 | bool inlineEditMode() const { return m_inlineEditMode; } |
||
948 | |||
3757 | cbradney | 949 | /** |
950 | * @brief Add a section to the document sections list |
||
3776 | cbradney | 951 | * Set number to -1 to add in the default section if the map is empty |
3757 | cbradney | 952 | */ |
18047 | craig | 953 | 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); |
3757 | cbradney | 954 | /** |
955 | * @brief Delete a section from the document sections list |
||
956 | */ |
||
3985 | cbradney | 957 | bool deleteSection(const uint); |
3757 | cbradney | 958 | /** |
959 | * @brief Gets the page number to be printed based on the section it is in. |
||
960 | * Returns QString::null on failure to find the pageIndex |
||
961 | */ |
||
962 | const QString getSectionPageNumberForPageIndex(const uint) const; |
||
3776 | cbradney | 963 | /** |
15534 | craig | 964 | * @brief Gets the page number fill character to be printed based on the section it is in. |
965 | * Returns QString::null on failure to find the pageIndex |
||
966 | */ |
||
967 | const QChar getSectionPageNumberFillCharForPageIndex(const uint) const; |
||
968 | /** |
||
969 | * @brief Gets the page number fill character to be printed based on the section it is in. |
||
970 | * Returns QString::null on failure to find the pageIndex |
||
971 | */ |
||
972 | int getSectionPageNumberWidthForPageIndex(const uint) const; |
||
973 | /** |
||
3776 | cbradney | 974 | * @brief Gets the key of the sections map based on the section the page index is in. |
975 | * Returns -1 on failure to find the pageIndex |
||
976 | */ |
||
3985 | cbradney | 977 | int getSectionKeyForPageIndex(const uint pageIndex) const; |
3778 | cbradney | 978 | /** |
979 | * |
||
980 | * |
||
981 | */ |
||
982 | void updateSectionPageNumbersToPages(); |
||
3792 | cbradney | 983 | /** |
3894 | cbradney | 984 | * |
985 | * @param otherPageIndex |
||
986 | * @param location |
||
987 | * @param count |
||
988 | */ |
||
3792 | cbradney | 989 | void addPageToSection(const uint otherPageIndex, const uint location, const uint count=1); |
3894 | cbradney | 990 | /** |
991 | * |
||
992 | * @param pageIndex |
||
993 | */ |
||
3793 | cbradney | 994 | void removePageFromSection(const uint pageIndex); |
3894 | cbradney | 995 | /** |
996 | * |
||
997 | */ |
||
3793 | cbradney | 998 | void setFirstSectionFromFirstPageNumber(); |
17826 | craig | 999 | /** |
1000 | * @param pageIndex page nr |
||
1001 | * @brief Returns name of section where page is located |
||
1002 | */ |
||
1003 | QString getSectionNameForPageIndex(const uint pageIndex) const; |
||
17371 | fschmid | 1004 | |
5334 | cbradney | 1005 | //! @brief Some internal align tools |
1006 | typedef enum {alignFirst, alignLast, alignPage, alignMargins, alignGuide, alignSelection } AlignTo; |
||
15220 | cbradney | 1007 | typedef enum {alignByMoving, alignByResizing } AlignMethod; |
5334 | cbradney | 1008 | void buildAlignItemList(Selection* customSelection=0); |
1009 | bool startAlign(); |
||
5355 | cbradney | 1010 | void endAlign(); |
3942 | cbradney | 1011 | /** |
4650 | subik | 1012 | * \brief Insert a color into the documents color list |
4010 | cbradney | 1013 | * @param nam Name of the colour |
1014 | * @param c Cyan component |
||
1015 | * @param m Magenta component |
||
1016 | * @param y Yellow component |
||
1017 | * @param k Black component |
||
1018 | */ |
||
1019 | void insertColor(QString nam, double c, double m, double y, double k); |
||
4110 | cbradney | 1020 | |
1021 | QMap<QString, double>& constants() { return m_constants; } |
||
4122 | cbradney | 1022 | /** |
4650 | subik | 1023 | * \brief Get the location of the page on the canvas, ie, left, middle, or right |
4122 | cbradney | 1024 | * Does not give information about middle left, etc. |
4650 | subik | 1025 | * @param pageIndex Index of page to find location for |
4122 | cbradney | 1026 | * @return LeftPage, MiddlePage, RightPage, enum from pagestructs.h |
1027 | */ |
||
10060 | craig | 1028 | PageLocation locationOfPage(int pageIndex) const; |
12487 | cbradney | 1029 | /** |
1030 | * \brief Get the column of the page on the canvas, ie, left, middle, or right |
||
1031 | * @param pageIndex Index of page to find location for |
||
1032 | * @return int of 0,1,2,3 |
||
1033 | */ |
||
1034 | int columnOfPage(int pageIndex) const; |
||
5184 | avox | 1035 | |
17062 | fschmid | 1036 | |
16192 | fschmid | 1037 | QList<PageItem*>* GroupOfItem(QList<PageItem*>* itemList, PageItem* item); |
16105 | fschmid | 1038 | PageItem* groupObjectsSelection(Selection* customSelection=0); |
1039 | PageItem* groupObjectsList(QList<PageItem*> &itemList); |
||
1040 | void groupObjectsToItem(PageItem* groupItem, QList<PageItem*> &itemList); |
||
17644 | craig | 1041 | PageItem * itemSelection_GroupObjects (bool changeLock, bool lock, Selection* customSelection=0); |
9918 | jghali | 1042 | void itemSelection_UnGroupObjects(Selection* customSelection=0); |
16987 | fschmid | 1043 | void addToGroup(PageItem* group, PageItem* item); |
1044 | void removeFromGroup(PageItem* item); |
||
17905 | fschmid | 1045 | void resizeGroupToContents(PageItem* group); |
1046 | void itemSelection_resizeGroupToContents(Selection *customSelection=0); |
||
12779 | cbradney | 1047 | void itemSelection_convertItemsTo(const PageItem::ItemType newType, Selection* restoredSelection=0, Selection* customSelection=0); |
9918 | jghali | 1048 | |
13290 | jghali | 1049 | void itemSelection_ApplyParagraphStyle(const ParagraphStyle & newstyle, Selection* customSelection=0, bool rmDirectFormatting = false); |
7563 | cbradney | 1050 | void itemSelection_SetParagraphStyle(const ParagraphStyle & newstyle, Selection* customSelection=0); |
17646 | craig | 1051 | void itemSelection_ApplyCharStyle(const CharStyle & newstyle, Selection* customSelection=0, QString ETEA = ""); |
7563 | cbradney | 1052 | void itemSelection_SetCharStyle(const CharStyle & newstyle, Selection* customSelection=0); |
8455 | avox | 1053 | void itemSelection_EraseParagraphStyle(Selection* customSelection=0); |
1054 | void itemSelection_EraseCharStyle(Selection* customSelection=0); |
||
5184 | avox | 1055 | |
7563 | cbradney | 1056 | void itemSelection_SetNamedParagraphStyle(const QString & name, Selection* customSelection=0); |
1057 | void itemSelection_SetNamedCharStyle(const QString & name, Selection* customSelection=0); |
||
10367 | jghali | 1058 | void itemSelection_SetNamedLineStyle(const QString & name, Selection* customSelection=0); |
6917 | avox | 1059 | |
18772 | fschmid | 1060 | void itemSelection_SetSoftShadow(bool has, QString color, double dx, double dy, double radius, int shade, double opac, int blend); |
1061 | |||
12420 | cbradney | 1062 | void itemSelection_SetLineWidth(double w); |
1063 | void itemSelection_SetLineArt(Qt::PenStyle w); |
||
1064 | void itemSelection_SetLineJoin(Qt::PenJoinStyle w); |
||
1065 | void itemSelection_SetLineEnd(Qt::PenCapStyle w); |
||
7563 | cbradney | 1066 | void itemSelection_SetAlignment(int w, Selection* customSelection=0); |
1067 | void itemSelection_SetLineSpacing(double w, Selection* customSelection=0); |
||
1068 | void itemSelection_SetLineSpacingMode(int w, Selection* customSelection=0); |
||
4830 | cbradney | 1069 | //void ChLocalXY(double x, double y); |
1070 | //void ChLocalSc(double x, double y); |
||
18008 | craig | 1071 | void itemSetFont(const QString& newFont); |
7563 | cbradney | 1072 | void itemSelection_SetFont(QString fon, Selection* customSelection=0); |
1073 | void itemSelection_SetFillColor(QString farbe, Selection* customSelection=0); |
||
1074 | void itemSelection_SetFillShade(int sha, Selection* customSelection=0); |
||
1075 | void itemSelection_SetStrokeColor(QString farbe, Selection* customSelection=0); |
||
1076 | void itemSelection_SetStrokeShade(int sha, Selection* customSelection=0); |
||
1077 | void itemSelection_SetScaleV(int, Selection* customSelection=0); |
||
1078 | void itemSelection_SetScaleH(int, Selection* customSelection=0); |
||
1079 | void itemSelection_SetBaselineOffset(int, Selection* customSelection=0); |
||
1080 | void itemSelection_SetOutlineWidth(int, Selection* customSelection=0); |
||
1081 | void itemSelection_SetShadowOffsets(int shx, int shy, Selection* customSelection=0); |
||
1082 | void itemSelection_SetUnderline(int pos, int wid, Selection* customSelection=0); |
||
1083 | void itemSelection_SetStrikethru(int pos, int wid, Selection* customSelection=0); |
||
1084 | void itemSelection_SetEffects(int s, Selection* customSelection=0); |
||
8057 | cbradney | 1085 | void itemSelection_SetOpticalMargins(int i, Selection* customSelection=0); |
13298 | cbradney | 1086 | void itemSelection_resetOpticalMargins(Selection* customSelection=0); |
11663 | cbradney | 1087 | void itemSelection_SetColorProfile(const QString& profileName, Selection* customSelection=0); |
1088 | void itemSelection_SetRenderIntent(int intentIndex, Selection* customSelection=0); |
||
14444 | fschmid | 1089 | void itemSelection_SetCompressionMethod(int cmIndex, Selection* customSelection=0); |
1090 | void itemSelection_SetCompressionQuality(int cqIndex, Selection* customSelection=0); |
||
7563 | cbradney | 1091 | void itemSelection_SetTracking(int us, Selection* customSelection=0); |
1092 | void itemSelection_SetFontSize(int size, Selection* customSelection=0); |
||
4699 | cbradney | 1093 | //void FlipImageH(); |
1094 | //void FlipImageV(); |
||
1095 | void MirrorPolyH(PageItem *currItem); |
||
1096 | void MirrorPolyV(PageItem *currItem); |
||
18922 | craig | 1097 | bool getItem(PageItem **currItem, int nr = -1); |
1098 | void setFrameRect(); |
||
1099 | void setFrameRounded(); |
||
1100 | void setFrameOval(); |
||
1101 | |||
4672 | cbradney | 1102 | void setRedrawBounding(PageItem *currItem); |
1103 | void adjustCanvas(FPoint minPos, FPoint maxPos, bool absolute = false); |
||
17376 | fschmid | 1104 | struct PicResMapped |
1105 | { |
||
1106 | PicResMapped(bool applyNewRes, int lowResType) { m_applyNewRes = applyNewRes; m_lowResType = lowResType;} |
||
1107 | |||
1108 | void operator()(PageItem *item) |
||
1109 | { |
||
1110 | QList<PageItem*> allItems; |
||
1111 | if (item->isGroup()) |
||
1112 | allItems = item->asGroupFrame()->getItemList(); |
||
1113 | else |
||
1114 | allItems.append(item); |
||
1115 | for (int ii = 0; ii < allItems.count(); ii++) |
||
1116 | { |
||
1117 | item = allItems.at(ii); |
||
1118 | if (item->PictureIsAvailable) |
||
1119 | { |
||
1120 | bool fho = item->imageFlippedH(); |
||
1121 | bool fvo = item->imageFlippedV(); |
||
1122 | if (m_applyNewRes) |
||
1123 | item->pixm.imgInfo.lowResType = m_lowResType; |
||
1124 | if (item->asLatexFrame()) |
||
1125 | item->asLatexFrame()->rerunApplication(false); |
||
1126 | else |
||
1127 | item->loadImage(item->Pfile, true, -1, false); |
||
1128 | item->setImageFlippedH(fho); |
||
1129 | item->setImageFlippedV(fvo); |
||
1130 | item->AdjustPictScale(); |
||
1131 | } |
||
1132 | } |
||
1133 | allItems.clear(); |
||
1134 | } |
||
1135 | |||
1136 | bool m_applyNewRes; |
||
1137 | int m_lowResType; |
||
1138 | }; |
||
7570 | fschmid | 1139 | void recalcPicturesRes(bool applyNewRes = false); |
19009 | craig | 1140 | int previewQuality(); |
4672 | cbradney | 1141 | void connectDocSignals(); |
18957 | craig | 1142 | void disconnectDocSignals(); |
4713 | cbradney | 1143 | void removeLayer(int l, bool dl = false); //FIXME: Make protected once scripter function no longer uses this directly |
5781 | cbradney | 1144 | /*! \brief We call changed() whenever the document needs to know it has been changed. |
1145 | * If the document is the primary document in a main window, it will signal to enable/disable |
||
1146 | * certain operations. |
||
1147 | */ |
||
4738 | cbradney | 1148 | void changed(); |
5087 | subik | 1149 | /*! \brief Get pointer to the current page |
1150 | \retval Page* current page object */ |
||
16729 | fschmid | 1151 | ScPage* currentPage(); |
5087 | subik | 1152 | /*! \brief Set new current page |
1153 | \param newPage New current page */ |
||
16729 | fschmid | 1154 | void setCurrentPage(ScPage *newPage); |
5823 | cbradney | 1155 | bool hasGUI() const {return m_hasGUI;} |
6137 | cbradney | 1156 | /*! \brief Apply grid to a QPoint, from ScribusView */ |
1157 | QPoint ApplyGrid(const QPoint& in); |
||
1158 | /*! \brief Apply grid to an FPoint, from ScribusView */ |
||
1159 | FPoint ApplyGridF(const FPoint& in); |
||
6565 | cbradney | 1160 | /*! \brief Does this doc have any TOC setups and potentially a TOC to generate */ |
14927 | cbradney | 1161 | bool hasTOCSetup() { return !docPrefsData.tocPrefs.defaultToCSetups.empty(); } |
7736 | cbradney | 1162 | //! \brief Get the closest guide to the given point |
16729 | fschmid | 1163 | void getClosestGuides(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, ScPage* refPage = NULL); |
17744 | craig | 1164 | //! \brief Get the closest border of another element to the given point |
1165 | void getClosestElementBorder(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, ScPage* refPage = NULL); |
||
7736 | cbradney | 1166 | //! \brief Snap an item to the guides |
1167 | void SnapToGuides(PageItem *currItem); |
||
17744 | craig | 1168 | bool ApplyGuides(double *x, double *y, bool elementSnap = false); |
1169 | bool ApplyGuides(FPoint* point, bool elementSnap = false); |
||
7736 | cbradney | 1170 | bool MoveItem(double newX, double newY, PageItem* ite, bool fromMP = false); |
1171 | void RotateItem(double win, PageItem *currItem); |
||
1172 | void MoveRotated(PageItem *currItem, FPoint npv, bool fromMP = false); |
||
1173 | bool SizeItem(double newX, double newY, PageItem *pi, bool fromMP = false, bool DoUpdateClip = true, bool redraw = true); |
||
16122 | fschmid | 1174 | bool MoveSizeItem(FPoint newX, FPoint newY, PageItem* currItem, bool fromMP = false, bool constrainRotation = false); |
16236 | fschmid | 1175 | void AdjustItemSize(PageItem *currItem, bool includeGroup = false, bool moveInGroup = true); |
10532 | avox | 1176 | void moveGroup(double x, double y, bool fromMP = false, Selection* customSelection = 0); |
16546 | jghali | 1177 | void rotateGroup(double angle, Selection* customSelection = 0); |
1178 | void rotateGroup(double angle, FPoint RCenter, Selection* customSelection = 0); |
||
16105 | fschmid | 1179 | void scaleGroup(double scx, double scy, bool scaleText=true, Selection* customSelection = 0, bool scaleLine = false); |
12339 | cbradney | 1180 | //! \brief Get a list of frames of certain type |
1181 | QMap<PageItem*, QString> getDocItemNames(PageItem::ItemType itemType); |
||
13659 | cbradney | 1182 | //! \brief Returns a serializer for this document |
1183 | Serializer *serializer(); |
||
17743 | jghali | 1184 | //! \brief Returns a text serializer for this document, used to paste text chunks |
1185 | Serializer *textSerializer(); |
||
13659 | cbradney | 1186 | |
13799 | pierre | 1187 | //! \brief Get rotation mode |
1188 | int RotMode() const {return rotMode;} |
||
1189 | //! \brief Set rotation mode |
||
1190 | void RotMode(const int& val); |
||
1191 | |||
14405 | jghali | 1192 | //! \brief Fonctions which avoid doc updater and update manager to send too much |
1193 | // unncessary signals when doing updates on multiple items |
||
1194 | void beginUpdate(); |
||
1195 | void endUpdate(); |
||
17407 | fschmid | 1196 | int addToInlineFrames(PageItem *item); |
17789 | fschmid | 1197 | void removeInlineFrame(int fIndex); |
1198 | void checkItemForFrames(PageItem *it, int fIndex); |
||
18485 | craig | 1199 | bool hasPreflightErrors(); |
18719 | craig | 1200 | QFileDevice::Permissions filePermissions() { return docFilePermissions; } |
1201 | void saveFilePermissions(QFileDevice::Permissions p) { docFilePermissions=p; } |
||
14405 | jghali | 1202 | |
168 | Franz | 1203 | protected: |
2891 | cbradney | 1204 | void addSymbols(); |
15096 | cbradney | 1205 | void applyPrefsPageSizingAndMargins(bool resizePages, bool resizeMasterPages, bool resizePageMargins, bool resizeMasterPageMargins); |
18748 | fschmid | 1206 | bool m_hasGUI; |
18719 | craig | 1207 | QFileDevice::Permissions docFilePermissions; |
14871 | cbradney | 1208 | ApplicationPrefs& appPrefsData; |
1209 | ApplicationPrefs docPrefsData; |
||
3983 | craig | 1210 | UndoManager * const undoManager; |
2891 | cbradney | 1211 | bool loading; |
2937 | cbradney | 1212 | bool modified; |
1213 | int ActiveLayer; |
||
2965 | cbradney | 1214 | double docUnitRatio; |
13799 | pierre | 1215 | int rotMode; |
3648 | cbradney | 1216 | bool automaticTextFrames; // Flag for automatic Textframes |
3724 | cbradney | 1217 | bool m_masterPageMode; |
16029 | fschmid | 1218 | bool m_symbolEditMode; |
17410 | fschmid | 1219 | bool m_inlineEditMode; |
16733 | fschmid | 1220 | int m_storedLayerID; |
1221 | bool m_storedLayerLock; |
||
1222 | bool m_storedLayerVis; |
||
4110 | cbradney | 1223 | QMap<QString, double> m_constants; |
5781 | cbradney | 1224 | ScribusMainWindow* m_ScMW; |
1225 | ScribusView* m_View; |
||
7906 | jghali | 1226 | ScGuardedObject<ScribusDoc> m_guardedObject; |
17743 | jghali | 1227 | Serializer *m_serializer, *m_tserializer; |
16029 | fschmid | 1228 | QString currentEditedSymbol; |
17410 | fschmid | 1229 | int currentEditedIFrame; |
17407 | fschmid | 1230 | |
168 | Franz | 1231 | public: // Public attributes |
2937 | cbradney | 1232 | bool is12doc; //public for now, it will be removed later |
1330 | fschmid | 1233 | int NrItems; |
1234 | int First; |
||
1235 | int Last; |
||
1236 | int viewCount; |
||
1237 | int viewID; |
||
18027 | jghali | 1238 | bool SnapGrid; |
3 | paul | 1239 | bool SnapGuides; |
17744 | craig | 1240 | bool SnapElement; |
3 | paul | 1241 | bool GuideLock; |
17245 | fschmid | 1242 | bool dontResize; |
5087 | subik | 1243 | /** \brief Minimum and Maximum Points of Document */ |
2837 | fschmid | 1244 | FPoint minCanvasCoordinate; |
1245 | FPoint maxCanvasCoordinate; |
||
18009 | fschmid | 1246 | FPoint stored_minCanvasCoordinate; |
1247 | FPoint stored_maxCanvasCoordinate; |
||
2867 | fschmid | 1248 | double rulerXoffset; |
1249 | double rulerYoffset; |
||
5087 | subik | 1250 | /** \brief List of Pages */ |
16729 | fschmid | 1251 | QList<ScPage*>* Pages; |
5087 | subik | 1252 | /** \brief List of Master Pages */ |
16729 | fschmid | 1253 | QList<ScPage*> MasterPages; |
5087 | subik | 1254 | /** \brief List of Document Pages */ |
16729 | fschmid | 1255 | QList<ScPage*> DocPages; |
16029 | fschmid | 1256 | /** \brief List for temporary Pages */ |
16729 | fschmid | 1257 | QList<ScPage*> TempPages; |
5087 | subik | 1258 | /** \brief Mapping Master Page Name to Master Page numbers */ |
456 | fschmid | 1259 | QMap<QString,int> MasterNames; |
5087 | subik | 1260 | /** \brief List of Objects */ |
9856 | fschmid | 1261 | QList<PageItem*>* Items; |
1262 | QList<PageItem*> MasterItems; |
||
1263 | QList<PageItem*> DocItems; |
||
17407 | fschmid | 1264 | QHash<int, PageItem*> FrameItems; |
17410 | fschmid | 1265 | QList<PageItem*> EditFrameItems; |
18041 | fschmid | 1266 | PageItem *currentEditedTextframe; |
4847 | cbradney | 1267 | Selection* const m_Selection; |
5087 | subik | 1268 | /** \brief Number of Columns */ |
168 | Franz | 1269 | double PageSp; |
5087 | subik | 1270 | /** \brief Distance of Columns */ |
168 | Franz | 1271 | double PageSpa; |
15407 | craig | 1272 | ///** \brief current Pagelayout */ |
1273 | //int currentPageLayout; |
||
5087 | subik | 1274 | /** \brief Erste Seitennummer im Dokument */ |
3 | paul | 1275 | int FirstPnum; |
5087 | subik | 1276 | /** \brief Im Dokument benutzte Farben */ |
1065 | cbradney | 1277 | ColorList PageColors; |
1278 | int appMode; |
||
123 | Franz | 1279 | int SubMode; |
1280 | double *ShapeValues; |
||
1281 | int ValCount; |
||
168 | Franz | 1282 | QString DocName; |
3544 | avox | 1283 | QMap<QString,int> UsedFonts; |
3983 | craig | 1284 | SCFonts * const AllFonts; |
9767 | cbradney | 1285 | QList<AlignObjs> AObjects; |
168 | Franz | 1286 | int CurrentSel; |
5559 | avox | 1287 | ParagraphStyle currentStyle; |
10532 | avox | 1288 | NodeEditContext nodeEdit; |
5087 | subik | 1289 | /** \brief Letztes Element fuer AutoTextrahmen */ |
168 | Franz | 1290 | PageItem *LastAuto; |
5087 | subik | 1291 | /** \brief Erstes Element fuer AutoTextrahmen */ |
168 | Franz | 1292 | PageItem *FirstAuto; |
1293 | bool DragP; |
||
227 | Franz | 1294 | bool leaveDrag; |
168 | Franz | 1295 | PageItem *DraggedElem; |
1296 | PageItem *ElemToLink; |
||
16943 | fschmid | 1297 | QList<PageItem*> DragElements; |
7442 | avox | 1298 | private: |
5980 | avox | 1299 | StyleSet<ParagraphStyle> docParagraphStyles; |
1300 | StyleSet<CharStyle> docCharStyles; |
||
16856 | craig | 1301 | StyleSet<TableStyle> docTableStyles; |
1302 | StyleSet<CellStyle> docCellStyles; |
||
7442 | avox | 1303 | public: |
10140 | jghali | 1304 | ScLayers Layers; |
14971 | cbradney | 1305 | //bool marginColored; |
168 | Franz | 1306 | int GroupCounter; |
14170 | jghali | 1307 | |
14491 | jghali | 1308 | ScColorMgmtEngine colorEngine; |
14170 | jghali | 1309 | ScColorProfile DocInputImageRGBProf; |
1310 | ScColorProfile DocInputImageCMYKProf; |
||
1311 | ScColorProfile DocInputRGBProf; |
||
1312 | ScColorProfile DocInputCMYKProf; |
||
14281 | jghali | 1313 | ScColorProfile DocDisplayProf; |
14170 | jghali | 1314 | ScColorProfile DocPrinterProf; |
1315 | ScColorTransform stdTransRGBMon; |
||
1316 | ScColorTransform stdTransCMYKMon; |
||
1317 | ScColorTransform stdProof; |
||
1318 | ScColorTransform stdTransImg; |
||
1319 | ScColorTransform stdProofImg; |
||
1320 | ScColorTransform stdProofImgCMYK; |
||
1321 | ScColorTransform stdTransCMYK; |
||
1322 | ScColorTransform stdProofCMYK; |
||
1323 | ScColorTransform stdTransRGB; |
||
1324 | ScColorTransform stdProofGC; |
||
1325 | ScColorTransform stdProofCMYKGC; |
||
10338 | jghali | 1326 | bool BlackPoint; |
1330 | fschmid | 1327 | bool SoftProofing; |
1328 | bool Gamut; |
||
14170 | jghali | 1329 | eRenderIntent IntentColors; |
1330 | eRenderIntent IntentImages; |
||
168 | Franz | 1331 | bool HasCMS; |
3 | paul | 1332 | QMap<QString,QString> JavaScripts; |
1333 | int TotalItems; |
||
7104 | fschmid | 1334 | PrintOptions Print_Options; |
3 | paul | 1335 | bool RePos; |
3201 | subik | 1336 | struct BookMa { |
168 | Franz | 1337 | QString Title; |
1338 | QString Text; |
||
1339 | QString Aktion; |
||
4679 | fschmid | 1340 | PageItem *PageObject; |
168 | Franz | 1341 | int Parent; |
1342 | int ItemNr; |
||
1343 | int First; |
||
1344 | int Last; |
||
1345 | int Prev; |
||
1346 | int Next; |
||
1347 | }; |
||
9803 | fschmid | 1348 | QList<BookMa> BookMarks; |
3 | paul | 1349 | bool OldBM; |
1350 | bool hasName; |
||
17926 | fschmid | 1351 | bool isConverted; |
3984 | craig | 1352 | QTimer * const autoSaveTimer; |
17400 | fschmid | 1353 | QHash<QString,multiLine> MLineStyles; |
1354 | QHash<QString, ScPattern> docPatterns; |
||
1355 | QHash<QString, VGradient> docGradients; |
||
59 | Franz | 1356 | QWidget* WinHan; |
63 | Franz | 1357 | bool DoDrawing; |
16177 | fschmid | 1358 | bool drawAsPreview; |
16241 | fschmid | 1359 | bool viewAsPreview; |
17915 | fschmid | 1360 | bool editOnPreview; |
16241 | fschmid | 1361 | int previewVisual; |
8220 | fschmid | 1362 | struct OpenNodesList |
1363 | { |
||
1364 | int type; |
||
16729 | fschmid | 1365 | ScPage *page; |
8220 | fschmid | 1366 | PageItem *item; |
1367 | }; |
||
9803 | fschmid | 1368 | QList<OpenNodesList> OpenNodes; |
139 | Franz | 1369 | QTimer *CurTimer; |
18485 | craig | 1370 | QMap<int, errorCodes> pageErrors; |
5674 | fschmid | 1371 | QMap<int, errorCodes> docLayerErrors; |
16122 | fschmid | 1372 | QMap<PageItem*, errorCodes> docItemErrors; |
1373 | QMap<PageItem*, errorCodes> masterItemErrors; |
||
2353 | fschmid | 1374 | FPointArray symReturn; |
1375 | FPointArray symNewLine; |
||
1376 | FPointArray symTab; |
||
1377 | FPointArray symNonBreak; |
||
2389 | fschmid | 1378 | FPointArray symNewCol; |
1379 | FPointArray symNewFrame; |
||
3263 | cbradney | 1380 | |
5781 | cbradney | 1381 | Hyphenator * docHyphenator; |
17615 | craig | 1382 | void itemResizeToMargin(PageItem* item, int direction); //direction reflect enum numbers from Canvas::FrameHandle |
1383 | |||
3263 | cbradney | 1384 | private: |
11576 | avox | 1385 | UndoTransaction* m_itemCreationTransaction; |
1386 | UndoTransaction* m_alignTransaction; |
||
1387 | |||
16729 | fschmid | 1388 | ScPage* m_currentPage; |
10532 | avox | 1389 | UpdateManager m_updateManager; |
1390 | MassObservable<PageItem*> m_itemsChanged; |
||
16729 | fschmid | 1391 | MassObservable<ScPage*> m_pagesChanged; |
10701 | avox | 1392 | MassObservable<QRectF> m_regionsChanged; |
10532 | avox | 1393 | DocUpdater* m_docUpdater; |
3695 | cbradney | 1394 | |
1395 | signals: |
||
1396 | //Lets make our doc talk to our GUI rather than confusing all our normal stuff |
||
1397 | /** |
||
4584 | cbradney | 1398 | * @brief Let the document tell whatever is listening that it has changed |
1399 | */ |
||
4738 | cbradney | 1400 | void docChanged(); |
18957 | craig | 1401 | void saved(QString name); |
4688 | cbradney | 1402 | void updateContents(); |
7736 | cbradney | 1403 | void updateContents(const QRect &r); |
4585 | cbradney | 1404 | void refreshItem(PageItem *); |
4672 | cbradney | 1405 | void canvasAdjusted(double width, double height, double dX, double dY); |
4688 | cbradney | 1406 | void firstSelectedItemType(int); |
1407 | void setApplicationMode(int); |
||
4584 | cbradney | 1408 | /** |
3695 | cbradney | 1409 | * @brief A signal for when the outline palette needs to rebuild itself |
1410 | * Emit when: |
||
1411 | * - An item is created or deleted |
||
1412 | * - An item changes page |
||
1413 | * - An page is created or deleted |
||
1414 | * - Some items are grouped or a group is ungrouped |
||
1415 | * This also applies to Master Pages |
||
1416 | */ |
||
1417 | void signalRebuildOutLinePalette(); |
||
7736 | cbradney | 1418 | //! Temporary signal for SizeItem |
1419 | void widthAndHeight(double, double); |
||
13799 | pierre | 1420 | |
1421 | //! Signal a change in rotation mode (aka basepoint) |
||
1422 | void rotationMode(int); |
||
16289 | fschmid | 1423 | void updateEditItem(); |
17797 | fschmid | 1424 | void updateAutoSaveClock(); |
18928 | craig | 1425 | void addBookmark(PageItem *); |
1426 | void deleteBookmark(PageItem *); |
||
18972 | craig | 1427 | void changeLayers(int); |
4688 | cbradney | 1428 | |
1429 | public slots: |
||
16016 | fschmid | 1430 | void selectionChanged(); |
4688 | cbradney | 1431 | void itemSelection_ToggleLock(); |
1432 | void itemSelection_ToggleSizeLock(); |
||
1433 | void itemSelection_ToggleImageShown(); |
||
4698 | cbradney | 1434 | void itemSelection_TogglePrintEnabled(); |
18928 | craig | 1435 | void itemSelection_ToggleBookMark(Selection* customSelection=0); |
1436 | void itemSelection_ToggleAnnotation(Selection* customSelection=0); |
||
15309 | cbradney | 1437 | void itemSelection_Transform(int nrOfCopies, QTransform matrix, int basepoint); |
4705 | cbradney | 1438 | void itemSelection_ChangePreviewResolution(int id); |
13075 | subik | 1439 | |
1440 | /*! \brief Change display quality of all images in document. |
||
1441 | \author OssiLehtinen |
||
1442 | */ |
||
1443 | void allItems_ChangePreviewResolution(int id); |
||
1444 | |||
16546 | jghali | 1445 | //FIXME : change to process a selection |
1446 | void item_setFrameShape(PageItem* item, int frameType, int count, double* points); |
||
1447 | |||
4855 | cbradney | 1448 | void itemSelection_ClearItem(Selection* customSelection=0); |
6601 | cbradney | 1449 | //! Delete the items in the current selection. When force is true, we do not warn the user and make SE happy too. Force is used from @sa Page::restorePageItemCreation |
1450 | void itemSelection_DeleteItem(Selection* customSelection=0, bool forceDeletion=false); |
||
17353 | fschmid | 1451 | void itemSelection_SetItemTextReversed(bool reversed, Selection* customSelection=0); |
4713 | cbradney | 1452 | void itemSelection_SetItemFillTransparency(double t); |
1453 | void itemSelection_SetItemLineTransparency(double t); |
||
5746 | fschmid | 1454 | void itemSelection_SetItemFillBlend(int t); |
1455 | void itemSelection_SetItemLineBlend(int t); |
||
6578 | cbradney | 1456 | void itemSelection_SetLineGradient(VGradient& newGradient, Selection* customSelection=0); |
1457 | void itemSelection_SetFillGradient(VGradient& newGradient, Selection* customSelection=0); |
||
14297 | fschmid | 1458 | void itemSelection_SetMaskGradient(VGradient& newGradient, Selection* customSelection=0); |
10335 | jghali | 1459 | void itemSelection_SetOverprint(bool overprint, Selection* customSelection=0); |
6578 | cbradney | 1460 | void itemSelection_ApplyImageEffects(ScImageEffectList& newEffectList, Selection* customSelection=0); |
4699 | cbradney | 1461 | void itemSelection_FlipH(); |
1462 | void itemSelection_FlipV(); |
||
16546 | jghali | 1463 | void itemSelection_Rotate(double angle, Selection* customSelection = 0); |
4713 | cbradney | 1464 | void itemSelection_DoHyphenate(); |
1465 | void itemSelection_DoDeHyphenate(); |
||
17565 | craig | 1466 | void itemSelection_UnlinkTextFrameWithText(Selection *customSelection=0, bool cutText=false); |
1467 | void itemSelection_UnlinkTextFrameWithTextCut(Selection *customSelection=0); |
||
13875 | jghali | 1468 | void itemSelection_SendToLayer(int layerID); |
4847 | cbradney | 1469 | void itemSelection_SetImageOffset(double x, double y, Selection* customSelection=0); |
1470 | void itemSelection_SetImageScale(double x, double y, Selection* customSelection=0); |
||
1471 | void itemSelection_SetImageScaleAndOffset(double ox, double oy, double sx, double sy, Selection* customSelection=0); |
||
14861 | fschmid | 1472 | void itemSelection_SetImageRotation(double rot, Selection* customSelection=0); |
15220 | cbradney | 1473 | void itemSelection_AlignItemLeft(int i, double newX, AlignMethod how); |
1474 | void itemSelection_AlignItemRight(int i, double newX, AlignMethod how); |
||
1475 | void itemSelection_AlignItemTop(int i, double newY, AlignMethod how); |
||
1476 | void itemSelection_AlignItemBottom(int i, double newY, AlignMethod how); |
||
1477 | void itemSelection_AlignLeftOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition); |
||
1478 | void itemSelection_AlignRightOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition); |
||
1479 | void itemSelection_AlignBottomIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition); |
||
1480 | void itemSelection_AlignRightIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition); |
||
1481 | void itemSelection_AlignBottomOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition); |
||
1482 | void itemSelection_AlignCenterHor(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition); |
||
1483 | void itemSelection_AlignLeftIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition); |
||
1484 | void itemSelection_AlignCenterVer(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition); |
||
1485 | void itemSelection_AlignTopOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition); |
||
1486 | void itemSelection_AlignTopIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition); |
||
1487 | |||
17062 | fschmid | 1488 | void sendItemSelectionToBack(); |
1489 | void bringItemSelectionToFront(); |
||
1490 | void itemSelection_LowerItem(); |
||
1491 | void itemSelection_RaiseItem(); |
||
15237 | cbradney | 1492 | void itemSelection_DistributeDistH(bool usingDistance=false, double distance=0.0, bool reverseDistribute=false); |
6488 | cbradney | 1493 | void itemSelection_DistributeAcrossPage(bool useMargins=false); |
5334 | cbradney | 1494 | void itemSelection_DistributeRight(); |
1495 | void itemSelection_DistributeBottom(); |
||
1496 | void itemSelection_DistributeCenterH(); |
||
15237 | cbradney | 1497 | void itemSelection_DistributeDistV(bool usingDistance=false, double distance=0.0, bool reverseDistribute=false); |
6488 | cbradney | 1498 | void itemSelection_DistributeDownPage(bool useMargins=false); |
5334 | cbradney | 1499 | void itemSelection_DistributeLeft(); |
1500 | void itemSelection_DistributeCenterV(); |
||
1501 | void itemSelection_DistributeTop(); |
||
13772 | cbradney | 1502 | void itemSelection_SwapLeft(); |
1503 | void itemSelection_SwapRight(); |
||
6657 | cbradney | 1504 | void itemSelection_MultipleDuplicate(ItemMultipleDuplicateData&); |
7739 | cbradney | 1505 | void itemSelection_UniteItems(Selection* customSelection=0); |
1506 | void itemSelection_SplitItems(Selection* customSelection=0); |
||
1507 | /** |
||
1508 | * Adjust an image frame's size to fit the size of the image in it |
||
1509 | */ |
||
12420 | cbradney | 1510 | void itemSelection_AdjustFrametoImageSize(Selection* customSelection=0); |
12591 | fschmid | 1511 | /** |
1512 | * Adjust an image size to fit the size of the frame |
||
1513 | */ |
||
1514 | void itemSelection_AdjustImagetoFrameSize(Selection* customSelection=0); |
||
17595 | craig | 1515 | void itemSelection_AdjustFrameHeightToText( Selection *customSelection=0); |
7676 | cbradney | 1516 | //! @brief startArrowID or endArrowID of -1 mean not applying a selection at this point. |
1517 | void itemSelection_ApplyArrowHead(int startArrowID=-1, int endArrowID=-1, Selection* customSelection=0); |
||
15345 | fschmid | 1518 | void itemSelection_ApplyArrowScale(int startArrowSc, int endArrowSc, Selection* customSelection); |
6414 | fschmid | 1519 | |
12420 | cbradney | 1520 | void itemSelection_SetItemPen(QString farbe); |
1521 | void itemSelection_SetItemPenShade(int sha); |
||
14197 | fschmid | 1522 | void itemSelection_SetItemGradStroke(int typ); |
12420 | cbradney | 1523 | void itemSelection_SetItemBrush(QString farbe); |
1524 | void itemSelection_SetItemBrushShade(int sha); |
||
14300 | fschmid | 1525 | void itemSelection_SetItemGradMask(int typ); |
12420 | cbradney | 1526 | void itemSelection_SetItemGradFill(int typ); |
1527 | void itemSelection_SetItemPatternFill(QString pattern); |
||
14276 | fschmid | 1528 | void itemSelection_SetItemPatternProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY); |
14168 | fschmid | 1529 | void itemSelection_SetItemStrokePattern(QString pattern); |
14403 | fschmid | 1530 | void itemSelection_SetItemStrokePatternProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, double space, bool mirrorX, bool mirrorY); |
1531 | void itemSelection_SetItemStrokePatternType(bool type); |
||
14308 | fschmid | 1532 | void itemSelection_SetItemPatternMask(QString pattern); |
1533 | void itemSelection_SetItemPatternMaskProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY); |
||
6414 | fschmid | 1534 | |
16856 | craig | 1535 | // Table related slots. |
1536 | |||
1537 | /** |
||
1538 | * Inserts rows in a table. |
||
1539 | * |
||
1540 | * The user will be prompted by a dialog for the number of rows and where they should |
||
1541 | * be inserted. If in table edit mode, rows may be inserted before or after the active |
||
1542 | * cell. If in normal mode, rows may be inserted at the beginning or end of the selected |
||
1543 | * table. |
||
1544 | * |
||
1545 | * If no table is selected, then this slot does nothing. |
||
1546 | */ |
||
1547 | void itemSelection_InsertTableRows(); |
||
1548 | |||
1549 | /** |
||
1550 | * Inserts columns in a table. |
||
1551 | * |
||
1552 | * The user will be prompted by a dialog for the number of columns and where they should |
||
1553 | * be inserted. If in table edit mode, columns may be inserted before or after the active |
||
1554 | * cell. If in normal mode, columns may be inserted at the beginning or end of the selected |
||
1555 | * table. |
||
1556 | * |
||
1557 | * If no table is selected, then this slot does nothing. |
||
1558 | */ |
||
1559 | void itemSelection_InsertTableColumns(); |
||
1560 | |||
1561 | /** |
||
1562 | * Deletes rows in a table. |
||
1563 | * |
||
1564 | * If the there is a cell selection, all rows spanned by the selection will be deleted. |
||
1565 | * If there is no cell selection, the rows spanned by the active cell will be deleted. |
||
1566 | * |
||
1567 | * If no table is selected, or if the application is not in table edit mode, then this slot |
||
1568 | * does nothing. |
||
1569 | */ |
||
1570 | void itemSelection_DeleteTableRows(); |
||
1571 | |||
1572 | /** |
||
1573 | * Deletes columns in a table. |
||
1574 | * |
||
1575 | * If the there is a cell selection, all columns spanned by the selection will be deleted. |
||
1576 | * If there is no cell selection, the columns spanned by the active cell will be deleted. |
||
1577 | * |
||
1578 | * If no table is selected, or if the application is not in table edit mode, then this slot |
||
1579 | * does nothing. |
||
1580 | */ |
||
1581 | void itemSelection_DeleteTableColumns(); |
||
1582 | |||
1583 | /** |
||
1584 | * Merges the selected cells in a table. |
||
1585 | * |
||
1586 | * The merged area will span from the top left to the bottom right of the selected cells. |
||
1587 | * |
||
1588 | * If no table is selected, or if the application is not in table edit mode, or if less |
||
1589 | * than two cells is selected, then this slot does nothing. |
||
1590 | */ |
||
1591 | void itemSelection_MergeTableCells(); |
||
1592 | |||
1593 | /** |
||
1594 | * Splits cells in a table. |
||
1595 | * |
||
1596 | * TODO: Implement this. |
||
1597 | */ |
||
1598 | void itemSelection_SplitTableCells() {} |
||
1599 | |||
1600 | /** |
||
1601 | * Sets the height of rows in a table. |
||
1602 | * |
||
1603 | * The user will be prompted by a dialog for entering a row height. If in table editing |
||
1604 | * mode, all rows of the table will get their height set. If the there is a cell selection, |
||
1605 | * all rows spanned by the selection will get their height set. If there is no cell |
||
1606 | * selection, the rows spanned by the active cell will get their height set. |
||
1607 | * |
||
1608 | * If no table is selected, then this slot does nothing. |
||
1609 | */ |
||
1610 | void itemSelection_SetTableRowHeights(); |
||
1611 | |||
1612 | /** |
||
1613 | * Sets the width of columns in a table. |
||
1614 | * |
||
1615 | * The user will be prompted by a dialog for entering a column width. If in table editing |
||
1616 | * mode, all columns of the table will get their width set. If the there is a cell selection, |
||
1617 | * all columns spanned by the selection will get their width set. If there is no cell |
||
1618 | * selection, the columns spanned by the active cell will get their width set. |
||
1619 | * |
||
1620 | * If no table is selected, then this slot does nothing. |
||
1621 | */ |
||
1622 | void itemSelection_SetTableColumnWidths(); |
||
1623 | |||
1624 | /** |
||
1625 | * Distributes rows in a table evenly. |
||
1626 | * |
||
1627 | * If in table edit mode and there is a cell selection, each contigous range of selected rows |
||
1628 | * is distributed. If there is no cell selection, all rows in the table are distributed. |
||
1629 | * |
||
1630 | * If there is no table selected, then this slot does nothing. |
||
1631 | */ |
||
1632 | void itemSelection_DistributeTableRowsEvenly(); |
||
1633 | |||
1634 | /** |
||
1635 | * Distributes columns in a table evenly. |
||
1636 | * |
||
1637 | * If in table edit mode and there is a cell selection, each contigous range of selected columns |
||
1638 | * is distributed. If there is no cell selection, all columns in the table are distributed. |
||
1639 | * |
||
1640 | * If there is no table selected, then this slot does nothing. |
||
1641 | */ |
||
1642 | void itemSelection_DistributeTableColumnsEvenly(); |
||
1643 | |||
1644 | /** |
||
1645 | * Adjusts the size of the frames of any selected tables to fit the size of the tables they contain. |
||
1646 | * |
||
1647 | * If there are no tables in the current selection, then this slot does nothing. |
||
1648 | */ |
||
1649 | void itemSelection_AdjustFrameToTable(); |
||
1650 | |||
1651 | /** |
||
1652 | * Adjusts the size of any selected tables to fit the size of their frames. |
||
1653 | * |
||
1654 | * If there are no tables in the current selection, then this slot does nothing. |
||
1655 | */ |
||
1656 | void itemSelection_AdjustTableToFrame(); |
||
1657 | |||
13349 | jghali | 1658 | void undoRedoBegin(); |
1659 | void undoRedoDone(); |
||
1660 | |||
4688 | cbradney | 1661 | void updatePic(); |
1662 | void updatePict(QString name); |
||
12660 | fschmid | 1663 | void updatePictDir(QString name); |
4688 | cbradney | 1664 | void removePict(QString name); |
17826 | craig | 1665 | |
1666 | // Marks and notes |
||
1667 | public: |
||
1668 | /** |
||
1669 | * Explanation |
||
1670 | * master frame - text frame with marks for notes |
||
1671 | * notesframe - frame with notes |
||
1672 | * master & note mark - master is mark in "master" text, note mark is at begining of note in noteframe |
||
1673 | */ |
||
1674 | |||
1675 | //return page where endnotesframe should be located depending of notes style range and location of master mark |
||
1676 | const ScPage* page4EndNotes(NotesStyle* NS, PageItem* item); |
||
1677 | |||
1678 | //data handling structures |
||
1679 | private: |
||
1680 | QList<Mark*> m_docMarksList; |
||
1681 | QList<TextNote*> m_docNotesList; |
||
1682 | //flags used for indicating needs of updates |
||
1683 | bool flag_notesChanged; |
||
1684 | |||
1685 | public: |
||
1686 | const QList<Mark*> marksList() { return m_docMarksList; } |
||
1687 | const QList<TextNote*> notesList() { return m_docNotesList; } |
||
1688 | QList<NotesStyle*> m_docNotesStylesList; |
||
1689 | QMap<PageItem_NoteFrame*, rangeItem> m_docEndNotesFramesMap; |
||
1690 | QList<NotesStyle*> ns2Update; //list of notes styles to update |
||
1691 | |||
1692 | //returns list of notesframes for given Notes Style |
||
1693 | QList<PageItem_NoteFrame*> listNotesFrames(NotesStyle* NS); |
||
1694 | |||
1695 | //flags used for indicating needs of updates |
||
1696 | bool notesChanged() { return flag_notesChanged; } |
||
1697 | void setNotesChanged(bool on) { flag_notesChanged = on; } |
||
1698 | bool flag_restartMarksRenumbering; |
||
1699 | bool flag_updateMarksLabels; |
||
1700 | bool flag_updateEndNotes; |
||
1701 | bool flag_layoutNotesFrames; |
||
1702 | |||
1703 | //returns list of marks labels for given mark type |
||
1704 | QStringList marksLabelsList(MarkType type); |
||
1705 | |||
1706 | //return mark definied with gioven label and given type |
||
1707 | Mark* getMarkDefinied(QString label, MarkType type); //returns mark with label and type (labels are unique only for same type marks) |
||
1708 | Mark* newMark(Mark* mrk = NULL); |
||
1709 | TextNote* newNote(NotesStyle* NS); |
||
1710 | |||
1711 | bool isMarkUsed(Mark* mrk, bool visible = false); |
||
1712 | //set cursor in text where given mark will be found |
||
1713 | void setCursor2MarkPos(Mark* mark); |
||
1714 | //return false if mark was not found |
||
1715 | bool eraseMark(Mark* mrk, bool fromText=false, PageItem* item=NULL, bool force = false); //force is used only for deleting non-unique marks by MarksManager |
||
1716 | void setUndoDelMark(Mark* mrk); |
||
1717 | //invalidate all text frames where given mark will found |
||
1718 | //usefull spacially for varaible text marks after changing its text definition |
||
1719 | //if forceUpdate then found master frames are relayouted |
||
1720 | bool invalidateVariableTextFrames(Mark* mrk, bool forceUpdate = false); //returns if any text was changed |
||
1721 | |||
1722 | //for foot/endnotes |
||
1723 | NotesStyle* newNotesStyle(NotesStyle NS); |
||
1724 | void renameNotesStyle(NotesStyle* NS, QString newName); |
||
1725 | //delete whole notes style with its notesframes and notes |
||
1726 | void deleteNotesStyle(QString nsName); |
||
1727 | void undoSetNotesStyle(SimpleState* ss, NotesStyle* ns); |
||
1728 | NotesStyle* getNotesStyle(QString nsName); |
||
1729 | //delete note, if fromText than marks for given note will be removed |
||
1730 | void deleteNote(TextNote* note); |
||
1731 | void setUndoDelNote(TextNote* note); |
||
1732 | PageItem_NoteFrame* createNoteFrame(PageItem_TextFrame* inFrame, NotesStyle *nStyle, int index = -1); |
||
1733 | PageItem_NoteFrame* createNoteFrame(NotesStyle *nStyle, double x, double y, double w, double h, double w2, QString fill, QString outline); |
||
1734 | //delete noteframe |
||
1735 | void delNoteFrame(PageItem_NoteFrame *nF, bool removeMarks=true, bool forceDeletion = true); |
||
1736 | //renumber notes for given notes style |
||
1737 | //return true if doc needs update after changing numbers of notes |
||
1738 | bool updateNotesNums(NotesStyle* nStyle); |
||
1739 | //set new text styles for notes marks |
||
1740 | void updateNotesFramesStyles(NotesStyle* nStyle); |
||
1741 | //check conflicts beetween notes styles |
||
1742 | bool validateNSet(NotesStyle NS, QString newName = ""); |
||
1743 | //update layout remove empty notesframes |
||
1744 | bool notesFramesUpdate(); |
||
1745 | //update notesframes after changing automatic features of notes style |
||
1746 | void updateNotesFramesSettings(NotesStyle* NS); |
||
1747 | |||
1748 | //search for endnotesframe for given notes style and item holding master mark |
||
1749 | PageItem_NoteFrame* endNoteFrame(NotesStyle* nStyle, PageItem_TextFrame* master); |
||
1750 | // |
||
1751 | void setEndNoteFrame(PageItem_NoteFrame* nF, void* ptr) { rangeItem rI={ptr}; m_docEndNotesFramesMap.insert(nF,rI); } |
||
1752 | void setEndNoteFrame(PageItem_NoteFrame* nF, int section) { rangeItem rI; rI.sectionIndex = section; m_docEndNotesFramesMap.insert(nF, rI); } |
||
1753 | //update all endnotesframes content for given notes style |
||
1754 | void updateEndnotesFrames(NotesStyle* nStyle = NULL, bool invalidate = false); |
||
1755 | //update endnotesframe content |
||
1756 | void updateEndNotesFrameContent(PageItem_NoteFrame* nF, bool invalidate = false); |
||
1757 | //insert noteframe into list of changed |
||
1758 | void endNoteFrameChanged(PageItem_NoteFrame* nF) { m_docEndNotesFramesChanged.append(nF); } |
||
1759 | //update content for changed endnotesframes |
||
1760 | void updateChangedEndNotesFrames(); |
||
1761 | //finds mark position in text |
||
1762 | //return true if mark was found, CPos is set for mark`s position |
||
1763 | //if item==NULL then search in all items and if mark is found than item is set |
||
1764 | int findMarkCPos(Mark* mrk, PageItem* &item, int Start = 0); |
||
1765 | QList<PageItem_NoteFrame*> m_docEndNotesFramesChanged; |
||
1766 | |||
1767 | //finds item which holds given mark, start searching from next to lastItem index in DocItems |
||
1768 | PageItem* findMarkItem(Mark* mrk, int &lastItem); |
||
1769 | |||
1770 | private: |
||
1771 | //QMap<PageItem_NoteFrame*, QList<TextNote *> > map of notesframes and its list of notes |
||
1772 | NotesInFrameMap m_docNotesInFrameMap; |
||
1773 | |||
1774 | PageItem* findFirstMarkItem(Mark* mrk) { int tmp = -1; return findMarkItem(mrk, tmp); } |
||
1775 | |||
1776 | //search for endnotesframe for given notes style and item holding master mark or section number |
||
1777 | PageItem_NoteFrame* endNoteFrame(NotesStyle* nStyle, void* item = NULL); |
||
1778 | PageItem_NoteFrame* endNoteFrame(NotesStyle* nStyle, int sectIndex); |
||
1779 | //clear list of notes for given notesframe |
||
1780 | void clearNotesInFrameList(PageItem_NoteFrame* nF) { m_docNotesInFrameMap.insert(nF, QList<TextNote*>()); } |
||
1781 | //renumber notes with given notes style for given frame starting from number num |
||
1782 | void updateItemNotesNums(PageItem_TextFrame *frame, NotesStyle* nStyle, int &num); |
||
1783 | //update notesframes text styles |
||
1784 | void updateItemNotesFramesStyles(PageItem *item, ParagraphStyle newStyle); |
||
1785 | |||
1786 | //not used? |
||
1787 | bool updateEndNotesNums(); //return true if doc needs update |
||
1788 | void invalidateNoteFrames(NotesStyle* nStyle); |
||
1789 | void invalidateMasterFrames(NotesStyle* nStyle); |
||
1790 | |||
1791 | public slots: |
||
1792 | //update strings (page numbers) for marks |
||
1793 | bool updateMarks(bool updateNotesMarks = false); |
||
1794 | |||
16926 | fschmid | 1795 | //welding two items |
1796 | public slots: |
||
1797 | void itemSelection_UnWeld(); |
||
1798 | void itemSelection_Weld(); |
||
16944 | fschmid | 1799 | void itemSelection_EditWeld(); |
17797 | fschmid | 1800 | void restartAutoSaveTimer(); |
17979 | fschmid | 1801 | |
18957 | craig | 1802 | protected slots: |
1803 | void slotAutoSave(); |
||
1804 | |||
18047 | craig | 1805 | //auto-numerations |
1806 | public: |
||
1807 | QMap<QString, NumStruct*> numerations; |
||
1808 | QStringList orgNumNames; //orgNumerations keeps original settings read from paragraph styles for reset settings overrided localy |
||
1809 | void setupNumerations(); //read styles for used auto-numerations, initialize numCounters |
||
1810 | QString getNumberStr(QString numName, int level, bool reset, ParagraphStyle &style); |
||
1811 | void setNumerationCounter(QString numName, int level, int number); |
||
1812 | bool flag_Renumber; |
||
1813 | bool flag_NumUpdateRequest; |
||
1814 | // for local numeration of paragraphs |
||
1815 | bool updateLocalNums(StoryText& itemText); //return true if any num strings were updated and item need s invalidation |
||
1816 | void updateNumbers(bool updateNumerations = false); |
||
1817 | void itemSelection_ClearBulNumStrings(Selection *customSelection); |
||
17979 | fschmid | 1818 | /* Functions for PDF Form Actions */ |
1819 | |||
1820 | public: |
||
1821 | void SubmitForm(); |
||
1822 | void ImportData(); |
||
1823 | void ResetFormFields(); |
||
18957 | craig | 1824 | |
3 | paul | 1825 | }; |
1826 | |||
13170 | jghali | 1827 | Q_DECLARE_METATYPE(ScribusDoc*); |
1828 | |||
3 | paul | 1829 | #endif |