Subversion Repositories Scribus

Rev

Rev 19293 | Rev 19422 | 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);
19356 jghali 742
        void restoreMasterPageRenaming(SimpleState *state, bool isUndo);
17213 craig 743
        void restoreCopyPage(SimpleState *state, bool isUndo);
744
        void restoreMovePage(SimpleState *state, bool isUndo);
17640 craig 745
        void restoreAddMasterPage(SimpleState *state, bool isUndo);
3020 cbradney 746
        /**
13194 jghali 747
         * @brief Undo function for grouping/ungrouping
748
         */
749
        void restoreGrouping(SimpleState *state, bool isUndo);
750
        /**
17640 craig 751
         * @brief Undo function for level
752
         */
753
        void restoreLevelDown(SimpleState *state, bool isUndo);
754
        void restoreLevelBottom(SimpleState *state, bool isUndo);
755
        /**
3020 cbradney 756
         * @brief Save function
757
         */
11212 jghali 758
        bool save(const QString& fileName, QString* savedFile = NULL);
3025 cbradney 759
        /**
760
         * @brief Set the page margins. Current code uses current page only, also provide a (currently, TODO) option for this.
761
         */
16509 craig 762
        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 763
        /**
764
         * @brief Recalculate the colors after CMS settings change. Update the items in the doc accordingly.
765
         */
17371 fschmid 766
        void recalculateColorsList(QList<PageItem *> *itemList);
17376 fschmid 767
        static void recalculateColorItem(PageItem *item);
17371 fschmid 768
        void recalculateColors();
3179 cbradney 769
        /**
770
         * @brief Sets up the ScText defaults from the document
771
         */
18987 avox 772
        //void setScTextDefaultsFromDoc(ScText *);
3200 cbradney 773
        /**
774
         * @brief Copies a normal page to be a master pages
775
         */
10833 cbradney 776
        bool copyPageToMasterPage(const int, const int, const int, const QString&, bool);
3263 cbradney 777
 
19116 jghali 778
 
3263 cbradney 779
        /**
19116 jghali 780
         * @brief Just create but don't add to items list and don't create undo record
781
         */
782
        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);
783
 
784
        /**
3263 cbradney 785
         * @brief Add an Item to the document.
786
         * A simple function to create an item of a defined type and add it to the document
787
         * Will need extensive rewriting once we have various classes of PageItems, at a guess.
788
         *
789
         * @param itemFinalised Used to handle item creation for undo while the user is still dragging.
790
         * @return Number of created item, -1 on failure.
4650 subik 791
        \param itemType type
792
        \param frameType frame type
793
        \param x X pos
794
        \param y Y pos
795
        \param b width
796
        \param h height
797
        \param w ?
798
        \param fill fill color name
799
        \param outline outline color name
17826 craig 800
        \param noteFrame optional (default false) indicates that noteframes should be created, not text frame
4650 subik 801
        */
17826 craig 802
        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 803
 
804
        /** Add an item to the page based on the x/y position. Item will be fitted to the closest guides/margins */
805
        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 806
 
6137 cbradney 807
        /**
808
         * @brief Allow the user to create a frame easily with some simple placement and sizing options
12071 subik 809
         * @param iafData a InsertAFrameData structure with params
810
         * @return int item id? FIXME
6137 cbradney 811
         */
6657 cbradney 812
        int itemAddUserFrame(InsertAFrameData &iafData);
5164 tsoots 813
 
3263 cbradney 814
        /**
815
         * @brief Commit item creation when a user has click-drag created an item
816
         * Only called from ScribusView. Note the undo target is the page, so the undo code remains their for now.
817
         * @return If an item was committed and the view must emit its signal, which needs removing from here, TODO.
818
         */
16943 fschmid 819
        bool itemAddCommit(PageItem* item);
3263 cbradney 820
 
821
        /**
822
         * @brief Finalise item creation. Simply split off code from itemAdd
823
         * Only to be called from itemAdd()
824
         */
16943 fschmid 825
        void itemAddDetails(const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, PageItem* newItem);
7068 fschmid 826
 
827
        uint getItemNrfromUniqueID(uint unique);
16926 fschmid 828
        //return pointer to item
829
        PageItem* getItemFromName(QString name);
3263 cbradney 830
        //itemDelete
831
        //itemBlah...
16943 fschmid 832
 
3628 cbradney 833
        /**
10140 jghali 834
         * @brief Rebuild item lists taking into account layer order.
835
         * Utility function used in various places, basically handles keeping items numbered in the way
836
         * they are layered. When layer is a property and not a fuction of storage, this should be removed.
837
         * @sa updateFrameItems();
838
         */
839
        void rebuildItemLists();
840
        /**
3648 cbradney 841
         * @brief Doc uses automatic text frames?
842
         */
3985 cbradney 843
        bool usesAutomaticTextFrames() const;
3648 cbradney 844
        void setUsesAutomaticTextFrames(const bool);
3650 cbradney 845
 
846
        /**
847
         * @brief Load images into an image frame, moved from the view
848
         * @retval Return false on failure
849
         */
16943 fschmid 850
//      bool LoadPict(QString fn, int ItNr, bool reload = false, bool showMsg = false);
3942 cbradney 851
        /**
852
         *
853
         * @param fn
854
         * @param pageItem
855
         * @param reload
856
         * @return
857
         */
5977 jghali 858
        bool loadPict(QString fn, PageItem *pageItem, bool reload = false, bool showMsg = false);
3656 cbradney 859
        /**
4650 subik 860
         * \brief Handle image with color profiles
861
         * @param Pr profile
862
           @param PrCMYK cmyk profile
863
           @param dia optional progress widget
3942 cbradney 864
         */
9953 cbradney 865
        void RecalcPictures(ProfilesL *Pr, ProfilesL *PrCMYK, QProgressBar *dia = 0);
3942 cbradney 866
        /**
14532 jghali 867
         * \brief Handle image with color profiles
868
         * @param items list of page items to update
869
         * @param Pr profile
870
         * @param PrCMYK cmyk profile
871
         * @param dia optional progress widget
872
         */
873
        void RecalcPictures(QList<PageItem*>* items, ProfilesL *Pr, ProfilesL *PrCMYK, QProgressBar *dia = 0);
874
        /**
14535 fschmid 875
         *
3656 cbradney 876
         * @brief Find the minX,MinY and maxX,maxY for the canvas required for the doc
877
         */
878
        void canvasMinMax(FPoint&, FPoint&);
3657 cbradney 879
 
16697 jghali 880
        int  OnPage(double x2, double  y2);
881
        int  OnPage(PageItem *currItem);
3657 cbradney 882
        void GroupOnPage(PageItem *currItem);
17338 jghali 883
 
4672 cbradney 884
        void reformPages(bool moveObjects = true);
17338 jghali 885
        /** @brief Refresh automatic guides once Margin struct has been properly configure by reformPages() */
886
        void refreshGuides();
19089 jghali 887
 
17338 jghali 888
        /** @brief Check and fix if needed PageItem OwnPage member */
16697 jghali 889
        void fixItemPageOwner();
19089 jghali 890
        /** @brief Fix paragraph styles */
891
        void fixParagraphStyles();
892
        /** @brief Fix notes styles */
893
        void fixNotesStyles();
3664 cbradney 894
 
895
        /**
3670 cbradney 896
         * @brief Return the x or y offset for a page on the canvas
897
         * @retval double containing the offset. Returns -1.0 if page not in Pages list (as -ve is not possible).
898
         * Mostly saves bringing in extra includes into files that already have scribusdoc.h
3664 cbradney 899
         */
10508 cbradney 900
        double getXOffsetForPage(const int);
901
        double getYOffsetForPage(const int);
12419 cbradney 902
        void getBleeds(int pageNumber, MarginStruct& bleedData);
16729 fschmid 903
        void getBleeds(const ScPage* page, MarginStruct& bleedData);
904
        void getBleeds(const ScPage* page, const MarginStruct& baseValues, MarginStruct& bleedData);
3670 cbradney 905
 
906
        /**
907
         * @brief Item type conversion functions
908
         */
3676 cbradney 909
        PageItem* convertItemTo(PageItem *currItem, PageItem::ItemType newType, PageItem* secondaryItem=NULL);
3670 cbradney 910
 
911
        /**
912
         * @brief The page number of the current page
913
         */
10508 cbradney 914
        int currentPageNumber();
3689 cbradney 915
 
916
        /**
917
         * @brief Return true iff the passed name is not used by any existing PageItem
918
         *        in the same document as this PageItem.
919
         * @author Craig Ringer
920
         ** CB Moved from PageItem
921
         */
922
        bool itemNameExists(const QString itemName);
3724 cbradney 923
 
924
        /**
925
         * @brief Set the doc into Master page mode
926
         * Do we need to return if the move to master page mode was successful?
927
         */
4738 cbradney 928
        void setMasterPageMode(bool);
4061 craig 929
 
930
        /*** Is the document in master page mode? */
931
        bool masterPageMode() const { return m_masterPageMode; }
16029 fschmid 932
        /**
933
         * @brief Set the doc into symbol edit mode
934
         */
935
        void setSymbolEditMode(bool mode, QString symbolName = "");
936
 
937
        /*** Is the document in symbol edit mode? */
938
        bool symbolEditMode() const { return m_symbolEditMode; }
3757 cbradney 939
 
16740 fschmid 940
        /*** get the name of the symbol currently in editing */
941
        QString getEditedSymbol() const { return currentEditedSymbol; }
17410 fschmid 942
        /**
943
         * @brief Set the doc into inline edit mode
944
         */
945
        void setInlineEditMode(bool mode, int id = -1);
16740 fschmid 946
 
17410 fschmid 947
        /*** Is the document in symbol edit mode? */
948
        bool inlineEditMode() const { return m_inlineEditMode; }
949
 
3757 cbradney 950
        /**
951
         * @brief Add a section to the document sections list
3776 cbradney 952
         * Set number to -1 to add in the default section if the map is empty
3757 cbradney 953
         */
18047 craig 954
        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 955
        /**
956
         * @brief Delete a section from the document sections list
957
         */
3985 cbradney 958
        bool deleteSection(const uint);
3757 cbradney 959
        /**
960
         * @brief Gets the page number to be printed based on the section it is in.
961
         * Returns QString::null on failure to find the pageIndex
962
         */
963
        const QString getSectionPageNumberForPageIndex(const uint) const;
3776 cbradney 964
        /**
15534 craig 965
         * @brief Gets the page number fill character to be printed based on the section it is in.
966
         * Returns QString::null on failure to find the pageIndex
967
         */
968
        const QChar getSectionPageNumberFillCharForPageIndex(const uint) const;
969
        /**
970
         * @brief Gets the page number fill character to be printed based on the section it is in.
971
         * Returns QString::null on failure to find the pageIndex
972
         */
973
        int getSectionPageNumberWidthForPageIndex(const uint) const;
974
        /**
3776 cbradney 975
         * @brief Gets the key of the sections map based on the section the page index is in.
976
         * Returns -1 on failure to find the pageIndex
977
         */
3985 cbradney 978
        int getSectionKeyForPageIndex(const uint pageIndex) const;
3778 cbradney 979
        /**
980
         *
981
         *
982
         */
983
        void updateSectionPageNumbersToPages();
3792 cbradney 984
        /**
3894 cbradney 985
         *
986
         * @param otherPageIndex
987
         * @param location
988
         * @param count
989
         */
3792 cbradney 990
        void addPageToSection(const uint otherPageIndex, const uint location, const uint count=1);
3894 cbradney 991
        /**
992
         *
993
         * @param pageIndex
994
         */
3793 cbradney 995
        void removePageFromSection(const uint pageIndex);
3894 cbradney 996
        /**
997
         *
998
         */
3793 cbradney 999
        void setFirstSectionFromFirstPageNumber();
17826 craig 1000
        /**
1001
         * @param pageIndex page nr
1002
         * @brief Returns name of section where page is located
1003
         */
1004
        QString getSectionNameForPageIndex(const uint pageIndex) const;
17371 fschmid 1005
 
5334 cbradney 1006
        //! @brief Some internal align tools
1007
        typedef enum {alignFirst, alignLast, alignPage, alignMargins, alignGuide, alignSelection } AlignTo;
15220 cbradney 1008
        typedef enum {alignByMoving, alignByResizing } AlignMethod;
5334 cbradney 1009
        void buildAlignItemList(Selection* customSelection=0);
1010
        bool startAlign();
5355 cbradney 1011
        void endAlign();
3942 cbradney 1012
        /**
4650 subik 1013
         * \brief Insert a color into the documents color list
4010 cbradney 1014
         * @param nam Name of the colour
1015
         * @param c Cyan component
1016
         * @param m Magenta component
1017
         * @param y Yellow component
1018
         * @param k Black component
1019
         */
1020
        void insertColor(QString nam, double c, double m, double y, double k);
4110 cbradney 1021
 
1022
        QMap<QString, double>& constants() { return m_constants; }
4122 cbradney 1023
        /**
4650 subik 1024
         * \brief Get the location of the page on the canvas, ie, left, middle, or right
4122 cbradney 1025
         * Does not give information about middle left, etc.
4650 subik 1026
         * @param pageIndex Index of page to find location for
4122 cbradney 1027
         * @return LeftPage, MiddlePage, RightPage, enum from pagestructs.h
1028
         */
10060 craig 1029
        PageLocation locationOfPage(int pageIndex) const;
12487 cbradney 1030
        /**
1031
         * \brief Get the column of the page on the canvas, ie, left, middle, or right
1032
         * @param pageIndex Index of page to find location for
1033
         * @return int of 0,1,2,3
1034
         */
1035
        int columnOfPage(int pageIndex) const;
5184 avox 1036
 
17062 fschmid 1037
 
16192 fschmid 1038
        QList<PageItem*>* GroupOfItem(QList<PageItem*>* itemList, PageItem* item);
16105 fschmid 1039
        PageItem* groupObjectsSelection(Selection* customSelection=0);
1040
        PageItem* groupObjectsList(QList<PageItem*> &itemList);
1041
        void groupObjectsToItem(PageItem* groupItem, QList<PageItem*> &itemList);
17644 craig 1042
        PageItem * itemSelection_GroupObjects  (bool changeLock, bool lock, Selection* customSelection=0);
9918 jghali 1043
        void itemSelection_UnGroupObjects(Selection* customSelection=0);
16987 fschmid 1044
        void addToGroup(PageItem* group, PageItem* item);
1045
        void removeFromGroup(PageItem* item);
17905 fschmid 1046
        void resizeGroupToContents(PageItem* group);
1047
        void itemSelection_resizeGroupToContents(Selection *customSelection=0);
12779 cbradney 1048
        void itemSelection_convertItemsTo(const PageItem::ItemType newType, Selection* restoredSelection=0, Selection* customSelection=0);
9918 jghali 1049
 
13290 jghali 1050
        void itemSelection_ApplyParagraphStyle(const ParagraphStyle & newstyle, Selection* customSelection=0, bool rmDirectFormatting = false);
7563 cbradney 1051
        void itemSelection_SetParagraphStyle(const ParagraphStyle & newstyle, Selection* customSelection=0);
17646 craig 1052
        void itemSelection_ApplyCharStyle(const CharStyle & newstyle, Selection* customSelection=0, QString ETEA = "");
7563 cbradney 1053
        void itemSelection_SetCharStyle(const CharStyle & newstyle, Selection* customSelection=0);
8455 avox 1054
        void itemSelection_EraseParagraphStyle(Selection* customSelection=0);
1055
        void itemSelection_EraseCharStyle(Selection* customSelection=0);
5184 avox 1056
 
7563 cbradney 1057
        void itemSelection_SetNamedParagraphStyle(const QString & name, Selection* customSelection=0);
1058
        void itemSelection_SetNamedCharStyle(const QString & name, Selection* customSelection=0);
10367 jghali 1059
        void itemSelection_SetNamedLineStyle(const QString & name, Selection* customSelection=0);
6917 avox 1060
 
18772 fschmid 1061
        void itemSelection_SetSoftShadow(bool has, QString color, double dx, double dy, double radius, int shade, double opac, int blend);
1062
 
12420 cbradney 1063
        void itemSelection_SetLineWidth(double w);
1064
        void itemSelection_SetLineArt(Qt::PenStyle w);
1065
        void itemSelection_SetLineJoin(Qt::PenJoinStyle w);
1066
        void itemSelection_SetLineEnd(Qt::PenCapStyle w);
7563 cbradney 1067
        void itemSelection_SetAlignment(int w, Selection* customSelection=0);
1068
        void itemSelection_SetLineSpacing(double w, Selection* customSelection=0);
1069
        void itemSelection_SetLineSpacingMode(int w, Selection* customSelection=0);
4830 cbradney 1070
        //void ChLocalXY(double x, double y);
1071
        //void ChLocalSc(double x, double y);
18008 craig 1072
        void itemSetFont(const QString& newFont);
7563 cbradney 1073
        void itemSelection_SetFont(QString fon, Selection* customSelection=0);
1074
        void itemSelection_SetFillColor(QString farbe, Selection* customSelection=0);
1075
        void itemSelection_SetFillShade(int sha, Selection* customSelection=0);
1076
        void itemSelection_SetStrokeColor(QString farbe, Selection* customSelection=0);
1077
        void itemSelection_SetStrokeShade(int sha, Selection* customSelection=0);
1078
        void itemSelection_SetScaleV(int, Selection* customSelection=0);
1079
        void itemSelection_SetScaleH(int, Selection* customSelection=0);
1080
        void itemSelection_SetBaselineOffset(int, Selection* customSelection=0);
1081
        void itemSelection_SetOutlineWidth(int, Selection* customSelection=0);
1082
        void itemSelection_SetShadowOffsets(int shx, int shy, Selection* customSelection=0);
1083
        void itemSelection_SetUnderline(int pos, int wid, Selection* customSelection=0);
1084
        void itemSelection_SetStrikethru(int pos, int wid, Selection* customSelection=0);
1085
        void itemSelection_SetEffects(int s, Selection* customSelection=0);
8057 cbradney 1086
        void itemSelection_SetOpticalMargins(int i, Selection* customSelection=0);
13298 cbradney 1087
        void itemSelection_resetOpticalMargins(Selection* customSelection=0);
11663 cbradney 1088
        void itemSelection_SetColorProfile(const QString& profileName, Selection* customSelection=0);
1089
        void itemSelection_SetRenderIntent(int intentIndex, Selection* customSelection=0);
14444 fschmid 1090
        void itemSelection_SetCompressionMethod(int cmIndex, Selection* customSelection=0);
1091
        void itemSelection_SetCompressionQuality(int cqIndex, Selection* customSelection=0);
7563 cbradney 1092
        void itemSelection_SetTracking(int us, Selection* customSelection=0);
1093
        void itemSelection_SetFontSize(int size, Selection* customSelection=0);
4699 cbradney 1094
        //void FlipImageH();
1095
        //void FlipImageV();
1096
        void MirrorPolyH(PageItem *currItem);
1097
        void MirrorPolyV(PageItem *currItem);
18922 craig 1098
        bool getItem(PageItem **currItem, int nr = -1);
1099
        void setFrameRect();
1100
        void setFrameRounded();
1101
        void setFrameOval();
1102
 
4672 cbradney 1103
        void setRedrawBounding(PageItem *currItem);
1104
        void adjustCanvas(FPoint minPos, FPoint maxPos, bool absolute = false);
17376 fschmid 1105
        struct PicResMapped
1106
        {
1107
                PicResMapped(bool applyNewRes, int lowResType) { m_applyNewRes = applyNewRes; m_lowResType = lowResType;}
1108
 
1109
                void operator()(PageItem *item)
1110
                {
1111
                        QList<PageItem*> allItems;
1112
                        if (item->isGroup())
1113
                                allItems = item->asGroupFrame()->getItemList();
1114
                        else
1115
                                allItems.append(item);
1116
                        for (int ii = 0; ii < allItems.count(); ii++)
1117
                        {
1118
                                item = allItems.at(ii);
1119
                                if (item->PictureIsAvailable)
1120
                                {
1121
                                        bool fho = item->imageFlippedH();
1122
                                        bool fvo = item->imageFlippedV();
1123
                                        if (m_applyNewRes)
1124
                                                item->pixm.imgInfo.lowResType = m_lowResType;
1125
                                        if (item->asLatexFrame())
1126
                                                item->asLatexFrame()->rerunApplication(false);
1127
                                        else
1128
                                                item->loadImage(item->Pfile, true, -1, false);
1129
                                        item->setImageFlippedH(fho);
1130
                                        item->setImageFlippedV(fvo);
1131
                                        item->AdjustPictScale();
1132
                                }
1133
                        }
1134
                        allItems.clear();
1135
                }
1136
 
1137
                bool m_applyNewRes;
1138
                int m_lowResType;
1139
        };
7570 fschmid 1140
        void recalcPicturesRes(bool applyNewRes = false);
19009 craig 1141
        int previewQuality();
4672 cbradney 1142
        void connectDocSignals();
18957 craig 1143
        void disconnectDocSignals();
4713 cbradney 1144
        void removeLayer(int l, bool dl = false); //FIXME: Make protected once scripter function no longer uses this directly
5781 cbradney 1145
        /*! \brief We call changed() whenever the document needs to know it has been changed.
1146
         *  If the document is the primary document in a main window, it will signal to enable/disable
1147
         * certain operations.
1148
         */
4738 cbradney 1149
        void changed();
5087 subik 1150
        /*! \brief Get pointer to the current page
1151
        \retval Page* current page object */
16729 fschmid 1152
        ScPage* currentPage();
5087 subik 1153
        /*! \brief Set new current page
1154
        \param newPage New current page */
16729 fschmid 1155
        void setCurrentPage(ScPage *newPage);
5823 cbradney 1156
        bool hasGUI() const {return m_hasGUI;}
6137 cbradney 1157
        /*! \brief Apply grid to a QPoint, from ScribusView */
1158
        QPoint ApplyGrid(const QPoint& in);
1159
        /*! \brief Apply grid to an FPoint, from ScribusView */
1160
        FPoint ApplyGridF(const FPoint& in);
6565 cbradney 1161
        /*! \brief Does this doc have any TOC setups and potentially a TOC to generate */
14927 cbradney 1162
        bool hasTOCSetup() { return !docPrefsData.tocPrefs.defaultToCSetups.empty(); }
7736 cbradney 1163
        //! \brief Get the closest guide to the given point
16729 fschmid 1164
        void getClosestGuides(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, ScPage* refPage = NULL);
17744 craig 1165
        //! \brief Get the closest border of another element to the given point
1166
        void getClosestElementBorder(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, ScPage* refPage = NULL);
7736 cbradney 1167
        //! \brief Snap an item to the guides
1168
        void SnapToGuides(PageItem *currItem);
17744 craig 1169
        bool ApplyGuides(double *x, double *y, bool elementSnap = false);
1170
        bool ApplyGuides(FPoint* point, bool elementSnap = false);
19219 jghali 1171
        bool MoveItem(double newX, double newY, PageItem* ite);
7736 cbradney 1172
        void RotateItem(double win, PageItem *currItem);
19219 jghali 1173
        void MoveRotated(PageItem *currItem, FPoint npv);
7736 cbradney 1174
        bool SizeItem(double newX, double newY, PageItem *pi, bool fromMP = false, bool DoUpdateClip = true, bool redraw = true);
16122 fschmid 1175
        bool MoveSizeItem(FPoint newX, FPoint newY, PageItem* currItem, bool fromMP = false, bool constrainRotation = false);
16236 fschmid 1176
        void AdjustItemSize(PageItem *currItem, bool includeGroup = false, bool moveInGroup = true);
19219 jghali 1177
        void moveGroup(double x, double y, Selection* customSelection = 0);
16546 jghali 1178
        void rotateGroup(double angle, Selection* customSelection = 0);
1179
        void rotateGroup(double angle, FPoint RCenter, Selection* customSelection = 0);
16105 fschmid 1180
        void scaleGroup(double scx, double scy, bool scaleText=true, Selection* customSelection = 0, bool scaleLine = false);
12339 cbradney 1181
        //! \brief Get a list of frames of certain type
1182
        QMap<PageItem*, QString> getDocItemNames(PageItem::ItemType itemType);
13659 cbradney 1183
        //! \brief Returns a serializer for this document
1184
        Serializer *serializer();
17743 jghali 1185
        //! \brief Returns a text serializer for this document, used to paste text chunks
1186
        Serializer *textSerializer();
13659 cbradney 1187
 
13799 pierre 1188
        //! \brief Get rotation mode
1189
        int RotMode() const {return rotMode;}
1190
        //! \brief Set rotation mode
1191
        void RotMode(const int& val);
1192
 
14405 jghali 1193
        //! \brief Fonctions which avoid doc updater and update manager to send too much
1194
        // unncessary signals when doing updates on multiple items
1195
        void beginUpdate();
1196
        void endUpdate();
17407 fschmid 1197
        int addToInlineFrames(PageItem *item);
17789 fschmid 1198
        void removeInlineFrame(int fIndex);
1199
        void checkItemForFrames(PageItem *it, int fIndex);
18485 craig 1200
        bool hasPreflightErrors();
18719 craig 1201
        QFileDevice::Permissions filePermissions() { return docFilePermissions; }
1202
        void saveFilePermissions(QFileDevice::Permissions p) { docFilePermissions=p; }
14405 jghali 1203
 
168 Franz 1204
protected:
2891 cbradney 1205
        void addSymbols();
15096 cbradney 1206
        void applyPrefsPageSizingAndMargins(bool resizePages, bool resizeMasterPages, bool resizePageMargins, bool resizeMasterPageMargins);
18748 fschmid 1207
        bool m_hasGUI;
18719 craig 1208
        QFileDevice::Permissions docFilePermissions;
14871 cbradney 1209
        ApplicationPrefs& appPrefsData;
1210
        ApplicationPrefs docPrefsData;
3983 craig 1211
        UndoManager * const undoManager;
2891 cbradney 1212
        bool loading;
2937 cbradney 1213
        bool modified;
1214
        int ActiveLayer;
2965 cbradney 1215
        double docUnitRatio;
13799 pierre 1216
        int rotMode;
3648 cbradney 1217
        bool automaticTextFrames; // Flag for automatic Textframes
3724 cbradney 1218
        bool m_masterPageMode;
16029 fschmid 1219
        bool m_symbolEditMode;
17410 fschmid 1220
        bool m_inlineEditMode;
16733 fschmid 1221
        int  m_storedLayerID;
1222
        bool m_storedLayerLock;
1223
        bool m_storedLayerVis;
4110 cbradney 1224
        QMap<QString, double> m_constants;
5781 cbradney 1225
        ScribusMainWindow* m_ScMW;
1226
        ScribusView* m_View;
7906 jghali 1227
        ScGuardedObject<ScribusDoc> m_guardedObject;
17743 jghali 1228
        Serializer *m_serializer, *m_tserializer;
16029 fschmid 1229
        QString currentEditedSymbol;
17410 fschmid 1230
        int currentEditedIFrame;
17407 fschmid 1231
 
168 Franz 1232
public: // Public attributes
2937 cbradney 1233
        bool is12doc; //public for now, it will be removed later
1330 fschmid 1234
        int NrItems;
1235
        int First;
1236
        int Last;
1237
        int viewCount;
1238
        int viewID;
18027 jghali 1239
        bool SnapGrid;
3 paul 1240
        bool SnapGuides;
17744 craig 1241
        bool SnapElement;
3 paul 1242
        bool GuideLock;
17245 fschmid 1243
        bool dontResize;
5087 subik 1244
        /** \brief Minimum and Maximum Points of Document */
2837 fschmid 1245
        FPoint minCanvasCoordinate;
1246
        FPoint maxCanvasCoordinate;
18009 fschmid 1247
        FPoint stored_minCanvasCoordinate;
1248
        FPoint stored_maxCanvasCoordinate;
2867 fschmid 1249
        double rulerXoffset;
1250
        double rulerYoffset;
5087 subik 1251
        /** \brief List of Pages */
16729 fschmid 1252
        QList<ScPage*>* Pages;
5087 subik 1253
        /** \brief List of Master Pages */
16729 fschmid 1254
        QList<ScPage*> MasterPages;
5087 subik 1255
        /** \brief List of Document Pages */
16729 fschmid 1256
        QList<ScPage*> DocPages;
16029 fschmid 1257
        /** \brief List for temporary Pages */
16729 fschmid 1258
        QList<ScPage*> TempPages;
5087 subik 1259
        /** \brief Mapping Master Page Name to Master Page numbers */
456 fschmid 1260
        QMap<QString,int> MasterNames;
5087 subik 1261
        /** \brief List of Objects */
9856 fschmid 1262
        QList<PageItem*>* Items;
1263
        QList<PageItem*> MasterItems;
1264
        QList<PageItem*> DocItems;
17407 fschmid 1265
        QHash<int, PageItem*> FrameItems;
17410 fschmid 1266
        QList<PageItem*> EditFrameItems;
18041 fschmid 1267
        PageItem *currentEditedTextframe;
4847 cbradney 1268
        Selection* const m_Selection;
5087 subik 1269
        /** \brief Number of Columns */
168 Franz 1270
        double PageSp;
5087 subik 1271
        /** \brief Distance of Columns */
168 Franz 1272
        double PageSpa;
15407 craig 1273
        ///** \brief current Pagelayout */
1274
        //int currentPageLayout;
5087 subik 1275
        /** \brief Erste Seitennummer im Dokument */
3 paul 1276
        int FirstPnum;
5087 subik 1277
        /** \brief Im Dokument benutzte Farben */
1065 cbradney 1278
        ColorList PageColors;
1279
        int appMode;
123 Franz 1280
        int SubMode;
1281
        double *ShapeValues;
1282
        int ValCount;
168 Franz 1283
        QString DocName;
3544 avox 1284
        QMap<QString,int> UsedFonts;
3983 craig 1285
        SCFonts * const AllFonts;
9767 cbradney 1286
        QList<AlignObjs> AObjects;
168 Franz 1287
        int CurrentSel;
5559 avox 1288
        ParagraphStyle currentStyle;
10532 avox 1289
        NodeEditContext nodeEdit;
5087 subik 1290
        /** \brief Letztes Element fuer AutoTextrahmen */
168 Franz 1291
        PageItem *LastAuto;
5087 subik 1292
        /** \brief Erstes Element fuer AutoTextrahmen */
168 Franz 1293
        PageItem *FirstAuto;
1294
        bool DragP;
227 Franz 1295
        bool leaveDrag;
168 Franz 1296
        PageItem *DraggedElem;
1297
        PageItem *ElemToLink;
16943 fschmid 1298
        QList<PageItem*> DragElements;
7442 avox 1299
private:
5980 avox 1300
        StyleSet<ParagraphStyle> docParagraphStyles;
1301
        StyleSet<CharStyle> docCharStyles;
16856 craig 1302
        StyleSet<TableStyle> docTableStyles;
1303
        StyleSet<CellStyle> docCellStyles;
7442 avox 1304
public:
10140 jghali 1305
        ScLayers Layers;
14971 cbradney 1306
        //bool marginColored;
168 Franz 1307
        int GroupCounter;
14170 jghali 1308
 
14491 jghali 1309
        ScColorMgmtEngine colorEngine;
14170 jghali 1310
        ScColorProfile DocInputImageRGBProf;
1311
        ScColorProfile DocInputImageCMYKProf;
1312
        ScColorProfile DocInputRGBProf;
1313
        ScColorProfile DocInputCMYKProf;
14281 jghali 1314
        ScColorProfile DocDisplayProf;
14170 jghali 1315
        ScColorProfile DocPrinterProf;
1316
        ScColorTransform stdTransRGBMon;
1317
        ScColorTransform stdTransCMYKMon;
1318
        ScColorTransform stdProof;
1319
        ScColorTransform stdTransImg;
1320
        ScColorTransform stdProofImg;
1321
        ScColorTransform stdProofImgCMYK;
1322
        ScColorTransform stdTransCMYK;
1323
        ScColorTransform stdProofCMYK;
1324
        ScColorTransform stdTransRGB;
1325
        ScColorTransform stdProofGC;
1326
        ScColorTransform stdProofCMYKGC;
10338 jghali 1327
        bool BlackPoint;
1330 fschmid 1328
        bool SoftProofing;
1329
        bool Gamut;
14170 jghali 1330
        eRenderIntent IntentColors;
1331
        eRenderIntent IntentImages;
168 Franz 1332
        bool HasCMS;
3 paul 1333
        QMap<QString,QString> JavaScripts;
1334
        int TotalItems;
7104 fschmid 1335
        PrintOptions Print_Options;
3 paul 1336
        bool RePos;
3201 subik 1337
        struct BookMa {
168 Franz 1338
                                        QString Title;
1339
                                        QString Text;
1340
                                        QString Aktion;
4679 fschmid 1341
                                        PageItem *PageObject;
168 Franz 1342
                                        int Parent;
1343
                                        int ItemNr;
1344
                                        int First;
1345
                                        int Last;
1346
                                        int Prev;
1347
                                        int Next;
1348
                                        };
9803 fschmid 1349
        QList<BookMa> BookMarks;
3 paul 1350
        bool OldBM;
1351
        bool hasName;
17926 fschmid 1352
        bool isConverted;
3984 craig 1353
        QTimer * const autoSaveTimer;
17400 fschmid 1354
        QHash<QString,multiLine> MLineStyles;
1355
        QHash<QString, ScPattern> docPatterns;
1356
        QHash<QString, VGradient> docGradients;
59 Franz 1357
        QWidget* WinHan;
63 Franz 1358
        bool DoDrawing;
16177 fschmid 1359
        bool drawAsPreview;
16241 fschmid 1360
        bool viewAsPreview;
17915 fschmid 1361
        bool editOnPreview;
16241 fschmid 1362
        int previewVisual;
8220 fschmid 1363
        struct OpenNodesList
1364
        {
1365
                int type;
16729 fschmid 1366
                ScPage *page;
8220 fschmid 1367
                PageItem *item;
1368
        };
9803 fschmid 1369
        QList<OpenNodesList> OpenNodes;
139 Franz 1370
        QTimer *CurTimer;
18485 craig 1371
        QMap<int, errorCodes> pageErrors;
5674 fschmid 1372
        QMap<int, errorCodes> docLayerErrors;
16122 fschmid 1373
        QMap<PageItem*, errorCodes> docItemErrors;
1374
        QMap<PageItem*, errorCodes> masterItemErrors;
2353 fschmid 1375
        FPointArray symReturn;
1376
        FPointArray symNewLine;
1377
        FPointArray symTab;
1378
        FPointArray symNonBreak;
2389 fschmid 1379
        FPointArray symNewCol;
1380
        FPointArray symNewFrame;
3263 cbradney 1381
 
5781 cbradney 1382
        Hyphenator * docHyphenator;
17615 craig 1383
        void itemResizeToMargin(PageItem* item, int direction); //direction reflect enum numbers from Canvas::FrameHandle
1384
 
3263 cbradney 1385
private:
11576 avox 1386
        UndoTransaction* m_itemCreationTransaction;
1387
        UndoTransaction* m_alignTransaction;
1388
 
16729 fschmid 1389
        ScPage* m_currentPage;
10532 avox 1390
        UpdateManager m_updateManager;
1391
        MassObservable<PageItem*> m_itemsChanged;
16729 fschmid 1392
        MassObservable<ScPage*> m_pagesChanged;
10701 avox 1393
        MassObservable<QRectF> m_regionsChanged;
10532 avox 1394
        DocUpdater* m_docUpdater;
3695 cbradney 1395
 
1396
signals:
1397
        //Lets make our doc talk to our GUI rather than confusing all our normal stuff
1398
        /**
4584 cbradney 1399
         * @brief Let the document tell whatever is listening that it has changed
1400
         */
4738 cbradney 1401
        void docChanged();
18957 craig 1402
        void saved(QString name);
4688 cbradney 1403
        void updateContents();
7736 cbradney 1404
        void updateContents(const QRect &r);
4585 cbradney 1405
        void refreshItem(PageItem *);
4672 cbradney 1406
        void canvasAdjusted(double width, double height, double dX, double dY);
4688 cbradney 1407
        void firstSelectedItemType(int);
1408
        void setApplicationMode(int);
4584 cbradney 1409
        /**
3695 cbradney 1410
         * @brief A signal for when the outline palette needs to rebuild itself
1411
         * Emit when:
1412
         * - An item is created or deleted
1413
         * - An item changes page
1414
         * - An page is created or deleted
1415
         * - Some items are grouped or a group is ungrouped
1416
         * This also applies to Master Pages
1417
         */
1418
        void signalRebuildOutLinePalette();
7736 cbradney 1419
        //! Temporary signal for SizeItem
1420
        void widthAndHeight(double, double);
13799 pierre 1421
 
1422
        //! Signal a change in rotation mode (aka basepoint)
1423
        void rotationMode(int);
16289 fschmid 1424
        void updateEditItem();
17797 fschmid 1425
        void updateAutoSaveClock();
18928 craig 1426
        void addBookmark(PageItem *);
1427
        void deleteBookmark(PageItem *);
18972 craig 1428
        void changeLayers(int);
4688 cbradney 1429
 
1430
public slots:
16016 fschmid 1431
        void selectionChanged();
4688 cbradney 1432
        void itemSelection_ToggleLock();
1433
        void itemSelection_ToggleSizeLock();
1434
        void itemSelection_ToggleImageShown();
4698 cbradney 1435
        void itemSelection_TogglePrintEnabled();
18928 craig 1436
        void itemSelection_ToggleBookMark(Selection* customSelection=0);
1437
        void itemSelection_ToggleAnnotation(Selection* customSelection=0);
15309 cbradney 1438
        void itemSelection_Transform(int nrOfCopies, QTransform matrix, int basepoint);
4705 cbradney 1439
        void itemSelection_ChangePreviewResolution(int id);
13075 subik 1440
 
1441
        /*! \brief Change display quality of all images in document.
1442
        \author  OssiLehtinen
1443
        */
1444
        void allItems_ChangePreviewResolution(int id);
1445
 
16546 jghali 1446
        //FIXME : change to process a selection
1447
        void item_setFrameShape(PageItem* item, int frameType, int count, double* points);
1448
 
19293 craig 1449
        void itemSelection_ClearItem(Selection* customSelection=0, bool useWarning=false);
19188 craig 1450
        void itemSelection_TruncateItem(Selection* customSelection=0);
6601 cbradney 1451
        //! 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
1452
        void itemSelection_DeleteItem(Selection* customSelection=0, bool forceDeletion=false);
17353 fschmid 1453
        void itemSelection_SetItemTextReversed(bool reversed, Selection* customSelection=0);
4713 cbradney 1454
        void itemSelection_SetItemFillTransparency(double t);
1455
        void itemSelection_SetItemLineTransparency(double t);
5746 fschmid 1456
        void itemSelection_SetItemFillBlend(int t);
1457
        void itemSelection_SetItemLineBlend(int t);
6578 cbradney 1458
        void itemSelection_SetLineGradient(VGradient& newGradient, Selection* customSelection=0);
1459
        void itemSelection_SetFillGradient(VGradient& newGradient, Selection* customSelection=0);
14297 fschmid 1460
        void itemSelection_SetMaskGradient(VGradient& newGradient, Selection* customSelection=0);
10335 jghali 1461
        void itemSelection_SetOverprint(bool overprint, Selection* customSelection=0);
6578 cbradney 1462
        void itemSelection_ApplyImageEffects(ScImageEffectList& newEffectList, Selection* customSelection=0);
4699 cbradney 1463
        void itemSelection_FlipH();
1464
        void itemSelection_FlipV();
16546 jghali 1465
        void itemSelection_Rotate(double angle, Selection* customSelection = 0);
4713 cbradney 1466
        void itemSelection_DoHyphenate();
1467
        void itemSelection_DoDeHyphenate();
17565 craig 1468
        void itemSelection_UnlinkTextFrameWithText(Selection *customSelection=0, bool cutText=false);
1469
        void itemSelection_UnlinkTextFrameWithTextCut(Selection *customSelection=0);
13875 jghali 1470
        void itemSelection_SendToLayer(int layerID);
4847 cbradney 1471
        void itemSelection_SetImageOffset(double x, double y, Selection* customSelection=0);
1472
        void itemSelection_SetImageScale(double x, double y, Selection* customSelection=0);
1473
        void itemSelection_SetImageScaleAndOffset(double ox, double oy, double sx, double sy, Selection* customSelection=0);
14861 fschmid 1474
        void itemSelection_SetImageRotation(double rot, Selection* customSelection=0);
15220 cbradney 1475
        void itemSelection_AlignItemLeft(int i, double newX, AlignMethod how);
1476
        void itemSelection_AlignItemRight(int i, double newX, AlignMethod how);
1477
        void itemSelection_AlignItemTop(int i, double newY, AlignMethod how);
1478
        void itemSelection_AlignItemBottom(int i, double newY, AlignMethod how);
1479
        void itemSelection_AlignLeftOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1480
        void itemSelection_AlignRightOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1481
        void itemSelection_AlignBottomIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1482
        void itemSelection_AlignRightIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1483
        void itemSelection_AlignBottomOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1484
        void itemSelection_AlignCenterHor(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1485
        void itemSelection_AlignLeftIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1486
        void itemSelection_AlignCenterVer(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1487
        void itemSelection_AlignTopOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1488
        void itemSelection_AlignTopIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1489
 
17062 fschmid 1490
        void sendItemSelectionToBack();
1491
        void bringItemSelectionToFront();
1492
        void itemSelection_LowerItem();
1493
        void itemSelection_RaiseItem();
15237 cbradney 1494
        void itemSelection_DistributeDistH(bool usingDistance=false, double distance=0.0, bool reverseDistribute=false);
6488 cbradney 1495
        void itemSelection_DistributeAcrossPage(bool useMargins=false);
5334 cbradney 1496
        void itemSelection_DistributeRight();
1497
        void itemSelection_DistributeBottom();
1498
        void itemSelection_DistributeCenterH();
15237 cbradney 1499
        void itemSelection_DistributeDistV(bool usingDistance=false, double distance=0.0, bool reverseDistribute=false);
6488 cbradney 1500
        void itemSelection_DistributeDownPage(bool useMargins=false);
5334 cbradney 1501
        void itemSelection_DistributeLeft();
1502
        void itemSelection_DistributeCenterV();
1503
        void itemSelection_DistributeTop();
13772 cbradney 1504
        void itemSelection_SwapLeft();
1505
        void itemSelection_SwapRight();
6657 cbradney 1506
        void itemSelection_MultipleDuplicate(ItemMultipleDuplicateData&);
7739 cbradney 1507
        void itemSelection_UniteItems(Selection* customSelection=0);
1508
        void itemSelection_SplitItems(Selection* customSelection=0);
1509
        /**
1510
         * Adjust an image frame's size to fit the size of the image in it
1511
         */
12420 cbradney 1512
        void itemSelection_AdjustFrametoImageSize(Selection* customSelection=0);
12591 fschmid 1513
        /**
1514
         * Adjust an image size to fit the size of the frame
1515
         */
1516
        void itemSelection_AdjustImagetoFrameSize(Selection* customSelection=0);
17595 craig 1517
        void itemSelection_AdjustFrameHeightToText( Selection *customSelection=0);
7676 cbradney 1518
        //! @brief startArrowID or endArrowID of -1 mean not applying a selection at this point.
1519
        void itemSelection_ApplyArrowHead(int startArrowID=-1, int endArrowID=-1, Selection* customSelection=0);
15345 fschmid 1520
        void itemSelection_ApplyArrowScale(int startArrowSc, int endArrowSc, Selection* customSelection);
6414 fschmid 1521
 
12420 cbradney 1522
        void itemSelection_SetItemPen(QString farbe);
1523
        void itemSelection_SetItemPenShade(int sha);
14197 fschmid 1524
        void itemSelection_SetItemGradStroke(int typ);
12420 cbradney 1525
        void itemSelection_SetItemBrush(QString farbe);
1526
        void itemSelection_SetItemBrushShade(int sha);
14300 fschmid 1527
        void itemSelection_SetItemGradMask(int typ);
12420 cbradney 1528
        void itemSelection_SetItemGradFill(int typ);
1529
        void itemSelection_SetItemPatternFill(QString pattern);
14276 fschmid 1530
        void itemSelection_SetItemPatternProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
14168 fschmid 1531
        void itemSelection_SetItemStrokePattern(QString pattern);
14403 fschmid 1532
        void itemSelection_SetItemStrokePatternProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, double space, bool mirrorX, bool mirrorY);
1533
        void itemSelection_SetItemStrokePatternType(bool type);
14308 fschmid 1534
        void itemSelection_SetItemPatternMask(QString pattern);
1535
        void itemSelection_SetItemPatternMaskProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
6414 fschmid 1536
 
16856 craig 1537
        // Table related slots.
1538
 
1539
        /**
1540
         * Inserts rows in a table.
1541
         *
1542
         * The user will be prompted by a dialog for the number of rows and where they should
1543
         * be inserted. If in table edit mode, rows may be inserted before or after the active
1544
         * cell. If in normal mode, rows may be inserted at the beginning or end of the selected
1545
         * table.
1546
         *
1547
         * If no table is selected, then this slot does nothing.
1548
         */
1549
        void itemSelection_InsertTableRows();
1550
 
1551
        /**
1552
         * Inserts columns in a table.
1553
         *
1554
         * The user will be prompted by a dialog for the number of columns and where they should
1555
         * be inserted. If in table edit mode, columns may be inserted before or after the active
1556
         * cell. If in normal mode, columns may be inserted at the beginning or end of the selected
1557
         * table.
1558
         *
1559
         * If no table is selected, then this slot does nothing.
1560
         */
1561
        void itemSelection_InsertTableColumns();
1562
 
1563
        /**
1564
         * Deletes rows in a table.
1565
         *
1566
         * If the there is a cell selection, all rows spanned by the selection will be deleted.
1567
         * If there is no cell selection, the rows spanned by the active cell will be deleted.
1568
         *
1569
         * If no table is selected, or if the application is not in table edit mode, then this slot
1570
         * does nothing.
1571
         */
1572
        void itemSelection_DeleteTableRows();
1573
 
1574
        /**
1575
         * Deletes columns in a table.
1576
         *
1577
         * If the there is a cell selection, all columns spanned by the selection will be deleted.
1578
         * If there is no cell selection, the columns spanned by the active cell will be deleted.
1579
         *
1580
         * If no table is selected, or if the application is not in table edit mode, then this slot
1581
         * does nothing.
1582
         */
1583
        void itemSelection_DeleteTableColumns();
1584
 
1585
        /**
1586
         * Merges the selected cells in a table.
1587
         *
1588
         * The merged area will span from the top left to the bottom right of the selected cells.
1589
         *
1590
         * If no table is selected, or if the application is not in table edit mode, or if less
1591
         * than two cells is selected, then this slot does nothing.
1592
         */
1593
        void itemSelection_MergeTableCells();
1594
 
1595
        /**
1596
         * Splits cells in a table.
1597
         *
1598
         * TODO: Implement this.
1599
         */
1600
        void itemSelection_SplitTableCells() {}
1601
 
1602
        /**
1603
         * Sets the height of rows in a table.
1604
         *
1605
         * The user will be prompted by a dialog for entering a row height. If in table editing
1606
         * mode, all rows of the table will get their height set. If the there is a cell selection,
1607
         * all rows spanned by the selection will get their height set. If there is no cell
1608
         * selection, the rows spanned by the active cell will get their height set.
1609
         *
1610
         * If no table is selected, then this slot does nothing.
1611
         */
1612
        void itemSelection_SetTableRowHeights();
1613
 
1614
        /**
1615
         * Sets the width of columns in a table.
1616
         *
1617
         * The user will be prompted by a dialog for entering a column width. If in table editing
1618
         * mode, all columns of the table will get their width set. If the there is a cell selection,
1619
         * all columns spanned by the selection will get their width set. If there is no cell
1620
         * selection, the columns spanned by the active cell will get their width set.
1621
         *
1622
         * If no table is selected, then this slot does nothing.
1623
         */
1624
        void itemSelection_SetTableColumnWidths();
1625
 
1626
        /**
1627
         * Distributes rows in a table evenly.
1628
         *
1629
         * If in table edit mode and there is a cell selection, each contigous range of selected rows
1630
         * is distributed. If there is no cell selection, all rows in the table are distributed.
1631
         *
1632
         * If there is no table selected, then this slot does nothing.
1633
         */
1634
        void itemSelection_DistributeTableRowsEvenly();
1635
 
1636
        /**
1637
         * Distributes columns in a table evenly.
1638
         *
1639
         * If in table edit mode and there is a cell selection, each contigous range of selected columns
1640
         * is distributed. If there is no cell selection, all columns in the table are distributed.
1641
         *
1642
         * If there is no table selected, then this slot does nothing.
1643
         */
1644
        void itemSelection_DistributeTableColumnsEvenly();
1645
 
1646
        /**
1647
         * Adjusts the size of the frames of any selected tables to fit the size of the tables they contain.
1648
         *
1649
         * If there are no tables in the current selection, then this slot does nothing.
1650
         */
1651
        void itemSelection_AdjustFrameToTable();
1652
 
1653
        /**
1654
         * Adjusts the size of any selected tables to fit the size of their frames.
1655
         *
1656
         * If there are no tables in the current selection, then this slot does nothing.
1657
         */
1658
        void itemSelection_AdjustTableToFrame();
1659
 
13349 jghali 1660
        void undoRedoBegin();
1661
        void undoRedoDone();
1662
 
4688 cbradney 1663
        void updatePic();
1664
        void updatePict(QString name);
12660 fschmid 1665
        void updatePictDir(QString name);
4688 cbradney 1666
        void removePict(QString name);
17826 craig 1667
 
1668
// Marks and notes
1669
public:
1670
        /**
1671
         * Explanation
1672
         * master frame - text frame with marks for notes
1673
         * notesframe - frame with notes
1674
         * master & note mark - master is mark in "master" text, note mark is at begining of note in noteframe
1675
         */
1676
 
1677
        //return page where endnotesframe should be located depending of notes style range and location of master mark
1678
        const ScPage* page4EndNotes(NotesStyle* NS, PageItem* item);
1679
 
1680
        //data handling structures
1681
private:
1682
        QList<Mark*> m_docMarksList;
1683
        QList<TextNote*> m_docNotesList;
1684
        //flags used for indicating needs of updates
1685
        bool flag_notesChanged;
1686
 
1687
public:
1688
        const QList<Mark*> marksList() { return m_docMarksList; }
1689
        const QList<TextNote*> notesList() { return m_docNotesList; }
1690
        QList<NotesStyle*> m_docNotesStylesList;
1691
        QMap<PageItem_NoteFrame*, rangeItem> m_docEndNotesFramesMap;
1692
        QList<NotesStyle*> ns2Update; //list of notes styles to update
1693
 
1694
        //returns list of notesframes for given Notes Style
1695
        QList<PageItem_NoteFrame*> listNotesFrames(NotesStyle* NS);
1696
 
1697
        //flags used for indicating needs of updates
1698
        bool notesChanged() { return flag_notesChanged; }
1699
        void setNotesChanged(bool on) { flag_notesChanged = on; }
1700
        bool flag_restartMarksRenumbering;
1701
        bool flag_updateMarksLabels;
1702
        bool flag_updateEndNotes;
1703
        bool flag_layoutNotesFrames;
1704
 
1705
        //returns list of marks labels for given mark type
1706
        QStringList marksLabelsList(MarkType type);
1707
 
1708
        //return mark definied with gioven label and given type
1709
        Mark* getMarkDefinied(QString label, MarkType type); //returns mark with label and type (labels are unique only for same type marks)
1710
        Mark* newMark(Mark* mrk = NULL);
1711
        TextNote* newNote(NotesStyle* NS);
1712
 
1713
        bool isMarkUsed(Mark* mrk, bool visible = false);
1714
        //set cursor in text where given mark will be found
1715
        void setCursor2MarkPos(Mark* mark);
1716
        //return false if mark was not found
1717
        bool eraseMark(Mark* mrk, bool fromText=false, PageItem* item=NULL, bool force = false); //force is used only for deleting non-unique marks by MarksManager
1718
        void setUndoDelMark(Mark* mrk);
1719
        //invalidate all text frames where given mark will found
1720
        //usefull spacially for varaible text marks after changing its text definition
1721
        //if forceUpdate then found master frames are relayouted
1722
        bool invalidateVariableTextFrames(Mark* mrk, bool forceUpdate = false); //returns if any text was changed
1723
 
1724
        //for foot/endnotes
1725
        NotesStyle* newNotesStyle(NotesStyle NS);
1726
        void renameNotesStyle(NotesStyle* NS, QString newName);
1727
        //delete whole notes style with its notesframes and notes
1728
        void deleteNotesStyle(QString nsName);
1729
        void undoSetNotesStyle(SimpleState* ss, NotesStyle* ns);
1730
        NotesStyle* getNotesStyle(QString nsName);
1731
        //delete note, if fromText than marks for given note will be removed
1732
        void deleteNote(TextNote* note);
1733
        void setUndoDelNote(TextNote* note);
1734
        PageItem_NoteFrame* createNoteFrame(PageItem_TextFrame* inFrame, NotesStyle *nStyle, int index = -1);
1735
        PageItem_NoteFrame* createNoteFrame(NotesStyle *nStyle, double x, double y, double w, double h, double w2, QString fill, QString outline);
1736
        //delete noteframe
1737
        void delNoteFrame(PageItem_NoteFrame *nF, bool removeMarks=true, bool forceDeletion = true);
1738
        //renumber notes for given notes style
1739
        //return true if doc needs update after changing numbers of notes
1740
        bool updateNotesNums(NotesStyle* nStyle);
1741
        //set new text styles for notes marks
1742
        void updateNotesFramesStyles(NotesStyle* nStyle);
1743
        //check conflicts beetween notes styles
1744
        bool validateNSet(NotesStyle NS, QString newName = "");
1745
        //update layout remove empty notesframes
1746
        bool notesFramesUpdate();
1747
        //update notesframes after changing automatic features of notes style
1748
        void updateNotesFramesSettings(NotesStyle* NS);
1749
 
1750
        //search for endnotesframe for given notes style and item holding master mark
1751
        PageItem_NoteFrame* endNoteFrame(NotesStyle* nStyle, PageItem_TextFrame* master);
1752
        //
1753
        void setEndNoteFrame(PageItem_NoteFrame* nF, void* ptr)   { rangeItem rI={ptr}; m_docEndNotesFramesMap.insert(nF,rI); }
1754
        void setEndNoteFrame(PageItem_NoteFrame* nF, int section)   { rangeItem rI; rI.sectionIndex = section; m_docEndNotesFramesMap.insert(nF, rI); }
1755
        //update all endnotesframes content for given notes style
1756
        void updateEndnotesFrames(NotesStyle* nStyle = NULL, bool invalidate = false);
1757
        //update endnotesframe content
1758
        void updateEndNotesFrameContent(PageItem_NoteFrame* nF, bool invalidate = false);
1759
        //insert noteframe into list of changed
1760
        void endNoteFrameChanged(PageItem_NoteFrame* nF) { m_docEndNotesFramesChanged.append(nF); }
1761
        //update content for changed endnotesframes
1762
        void updateChangedEndNotesFrames();
1763
        //finds mark position in text
1764
        //return true if mark was found, CPos is set for mark`s position
1765
        //if item==NULL then search in all items and if mark is found than item is set
1766
        int findMarkCPos(Mark* mrk, PageItem* &item, int Start = 0);
1767
        QList<PageItem_NoteFrame*> m_docEndNotesFramesChanged;
1768
 
1769
        //finds item which holds given mark, start searching from next to lastItem index in DocItems
1770
        PageItem* findMarkItem(Mark* mrk, int &lastItem);
1771
 
1772
private:
1773
        //QMap<PageItem_NoteFrame*, QList<TextNote *> > map of notesframes and its list of notes
1774
        NotesInFrameMap m_docNotesInFrameMap;
1775
 
1776
        PageItem* findFirstMarkItem(Mark* mrk) { int tmp = -1; return findMarkItem(mrk, tmp); }
1777
 
1778
        //search for endnotesframe for given notes style and item holding master mark or section number
1779
        PageItem_NoteFrame* endNoteFrame(NotesStyle* nStyle, void* item = NULL);
1780
        PageItem_NoteFrame* endNoteFrame(NotesStyle* nStyle, int sectIndex);
1781
        //clear list of notes for given notesframe
1782
        void clearNotesInFrameList(PageItem_NoteFrame* nF) { m_docNotesInFrameMap.insert(nF, QList<TextNote*>()); }
1783
        //renumber notes with given notes style for given frame starting from number num
1784
        void updateItemNotesNums(PageItem_TextFrame *frame, NotesStyle* nStyle, int &num);
1785
        //update notesframes text styles
1786
        void updateItemNotesFramesStyles(PageItem *item, ParagraphStyle newStyle);
1787
 
1788
        //not used?
1789
        bool updateEndNotesNums(); //return true if doc needs update
1790
        void invalidateNoteFrames(NotesStyle* nStyle);
1791
        void invalidateMasterFrames(NotesStyle* nStyle);
1792
 
1793
public slots:
1794
        //update strings (page numbers) for marks
1795
        bool updateMarks(bool updateNotesMarks = false);
1796
 
16926 fschmid 1797
//welding two items
1798
public slots:
1799
        void itemSelection_UnWeld();
1800
        void itemSelection_Weld();
16944 fschmid 1801
        void itemSelection_EditWeld();
17797 fschmid 1802
        void restartAutoSaveTimer();
17979 fschmid 1803
 
18957 craig 1804
protected slots:
1805
        void slotAutoSave();
1806
 
18047 craig 1807
//auto-numerations
1808
public:
1809
        QMap<QString, NumStruct*> numerations;
1810
        QStringList orgNumNames; //orgNumerations keeps original settings read from paragraph styles for reset settings overrided localy
1811
        void setupNumerations(); //read styles for used auto-numerations, initialize numCounters
1812
        QString getNumberStr(QString numName, int level, bool reset, ParagraphStyle &style);
1813
        void setNumerationCounter(QString numName, int level, int number);
1814
        bool flag_Renumber;
1815
        bool flag_NumUpdateRequest;
1816
        // for local numeration of paragraphs
1817
        bool updateLocalNums(StoryText& itemText); //return true if any num strings were updated and item need s invalidation
1818
        void updateNumbers(bool updateNumerations = false);
1819
        void itemSelection_ClearBulNumStrings(Selection *customSelection);
17979 fschmid 1820
/* Functions for PDF Form Actions */
1821
 
1822
public:
1823
        void SubmitForm();
1824
        void ImportData();
1825
        void ResetFormFields();
18957 craig 1826
 
3 paul 1827
};
1828
 
13170 jghali 1829
Q_DECLARE_METATYPE(ScribusDoc*);
1830
 
3 paul 1831
#endif