Subversion Repositories Scribus

Rev

Rev 19162 | Rev 20496 | 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>
33
#include <QObject>
34
#include <QPixmap>
10701 avox 35
#include <QRectF>
10220 cbradney 36
#include <QStringList>
37
#include <QTimer>
838 cbradney 38
 
10220 cbradney 39
 
6132 cbradney 40
#include "gtgettext.h" //CB For the ImportSetup struct and itemadduserframe
2969 craig 41
#include "scribusapi.h"
19162 craig 42
#include "undostate.h"
10532 avox 43
#include "observable.h"
2834 cbradney 44
#include "prefsstructs.h"
2016 cbradney 45
#include "documentinformation.h"
1179 tsoots 46
#include "undoobject.h"
3724 cbradney 47
#include "page.h"
3263 cbradney 48
#include "pageitem.h"
3757 cbradney 49
#include "pagestructs.h"
6403 cbradney 50
#include "usertaskstructs.h"
5980 avox 51
#include "styles/styleset.h"
7906 jghali 52
#include "scguardedptr.h"
10532 avox 53
#include "updatemanager.h"
10140 jghali 54
#include "sclayer.h"
3179 cbradney 55
 
15706 jghali 56
#include "colormgmt/sccolorprofile.h"
57
#include "colormgmt/sccolortransform.h"
3 paul 58
 
68 Franz 59
#include <ft2build.h>
60
#include FT_FREETYPE_H
3020 cbradney 61
 
10532 avox 62
class DocUpdater;
1190 tsoots 63
class UndoManager;
64
class UndoState;
1972 craig 65
class PDFOptions;
3252 craig 66
class Hyphenator;
3903 cbradney 67
class Selection;
4320 cbradney 68
class ScribusView;
5781 cbradney 69
class ScribusMainWindow;
8455 avox 70
class ResourceCollection;
10601 mrdocs 71
class PageSize;
72
class ScPattern;
11576 avox 73
class UndoTransaction;
3 paul 74
 
9953 cbradney 75
class QProgressBar;
3 paul 76
 
10532 avox 77
struct SCRIBUS_API NodeEditContext : public MassObservable<QPointF>
78
{
79
        enum SubMode { MOVE_POINT = 0, ADD_POINT = 1, DEL_POINT = 2, SPLIT_PATH = 3 };
80
        int submode;
81
        bool isContourLine;
82
        FPointArray *oldClip;
11576 avox 83
        UndoTransaction* nodeTransaction;
10532 avox 84
        double oldItemX;
85
        double oldItemY;
86
 
87
        int ClRe;
88
        int ClRe2;
89
        int SegP1;
90
        int SegP2;
91
        bool EdPoints;
92
        bool MoveSym;
93
        QList<int> SelNode;    
94
 
11576 avox 95
        NodeEditContext();
10532 avox 96
 
11576 avox 97
        bool hasNodeSelected();
98
        void deselect();
10532 avox 99
 
11576 avox 100
        void reset();
10532 avox 101
 
102
        void reset1Control(PageItem* currItem);
103
        void resetControl(PageItem* currItem);
104
        FPointArray beginTransaction(PageItem* currItem);
105
        void finishTransaction(PageItem* currItem);
106
        ItemState<QPair<FPointArray, FPointArray> >* finishTransaction1(PageItem* currItem);
107
        void finishTransaction2(PageItem* currItem, ItemState<QPair<FPointArray, FPointArray> >* state);
108
        void moveClipPoint(PageItem *currItem, FPoint ip);
109
};
3942 cbradney 110
 
10532 avox 111
 
4650 subik 112
/**! \brief the Document Class
3 paul 113
  */
10532 avox 114
class SCRIBUS_API ScribusDoc : public QObject, public UndoObject, public Observable<ScribusDoc>
3 paul 115
{
3082 fschmid 116
        Q_OBJECT
117
 
3 paul 118
public:
2891 cbradney 119
        ScribusDoc();
5789 cbradney 120
        ScribusDoc(const QString& docName, int unitIndex, const PageSize& pagesize, const MarginStruct& margins, const DocPagesSetup& pagesSetup);
2891 cbradney 121
        ~ScribusDoc();
5789 cbradney 122
        void init();
2901 fschmid 123
        void setup(const int, const int, const int, const int, const int, const QString&, const QString&);
2891 cbradney 124
        void setLoading(const bool);
3985 cbradney 125
        bool isLoading() const;
2891 cbradney 126
        void setModified(const bool);
127
        bool isModified() const;
128
/** Setzt die Seitenattribute */
2894 fschmid 129
        void setPage(double b, double h, double t, double l, double r, double bo, double sp, double ab, bool atf, int fp);
12326 cbradney 130
        void resetPage(MarginStruct& newMargins, int fp);
4320 cbradney 131
 
132
        /**
133
         * @brief Return the view associated with the document
134
         */
135
        ScribusView* view() const;
5781 cbradney 136
        ScribusMainWindow* scMW() const {return m_ScMW;}
5824 cbradney 137
        void setGUI(bool hasgui, ScribusMainWindow* mw, ScribusView* view);
7906 jghali 138
 
139
        /**
140
         * @brief Return the guarded object associated with the document
141
         */
142
        const ScGuardedPtr<ScribusDoc>& guardedPtr() const;
3792 cbradney 143
 
10532 avox 144
        UpdateManager* updateManager() { return &m_updateManager; }
145
        MassObservable<PageItem*> * itemsChanged() { return &m_itemsChanged; }
146
        MassObservable<Page*>     * pagesChanged() { return &m_pagesChanged; }
10701 avox 147
        MassObservable<QRectF>    * regionsChanged() { return &m_regionsChanged; }
15234 jghali 148
 
15306 jghali 149
        void invalidateAll();
15234 jghali 150
        void invalidateLayer(int layerID);
11046 avox 151
        void invalidateRegion(QRectF region);
10532 avox 152
 
2937 cbradney 153
        // Add, delete and move pages
3852 cbradney 154
 
155
        Page* addPage(const int pageNumber, const QString& masterPageName=QString::null, const bool addAutoFrame=false);
4069 craig 156
        void deletePage(const int);
6715 cbradney 157
        //! @brief Add a master page with this function, do not use addPage
3695 cbradney 158
        Page* addMasterPage(const int, const QString&);
6715 cbradney 159
        void deleteMasterPage(const int);
10155 jghali 160
        //! @brief Rebuild master name list
161
        void rebuildMasterNames(void);
162
        //! @brief Replace a master page by default one
163
        void replaceMasterPage(const QString& oldMasterPage);
5685 cbradney 164
        //! @brief Rename a master page
165
        bool renameMasterPage(const QString& oldPageName, const QString& newPageName);
6715 cbradney 166
        //! @brief Create the default master pages based on the layout selected by the user, ie, Normal, Normal Left, etc.
167
        void createDefaultMasterPages();
168
        //! @brief Create the requested pages in a new document, run after createDefaultMasterPages()
169
        void createNewDocPages(int pageCount);
3852 cbradney 170
        /**
3860 cbradney 171
         * @brief Add the automatic text frame to the page
4645 subik 172
         * @param pageNumber page number
3860 cbradney 173
         * @return number of frame
3852 cbradney 174
         */
4645 subik 175
        int addAutomaticTextFrame(const int pageNumber);
3531 cbradney 176
        /**
3852 cbradney 177
         * Set the left and right margins based on the location of the page
178
         * @param pageIndex
179
         */
180
        void setLocationBasedPageLRMargins(uint pageIndex);
181
        /**
3531 cbradney 182
         * @brief Move page(s) within the document
17212 craig 183
         * @param fromPage page index
184
         * @param toPage page index
185
         * @param count target to move to (page index)
186
         * @param position Before, After or at the end
3531 cbradney 187
         */
17212 craig 188
        void movePage(const int fromPage, const int toPage, const int dest, const int position);
3843 cbradney 189
 
190
        /**
191
         * @brief Copy a page (pageNumberToCopy) copyCount times, whereToInsert(before or after) the existingPage or at the end.
192
         * @param pageNumberToCopy
193
         * @param existingPage
194
         * @param whereToInsert
195
         * @param copyCount
196
         */
197
        void copyPage(int pageNumberToCopy, int existingPage, int whereToInsert, int copyCount);
198
 
2937 cbradney 199
        // Add, delete and move layers
3201 subik 200
        /**
2947 cbradney 201
         * @brief Add a layer to the current document
4645 subik 202
         * @param layerName name of layer
4650 subik 203
         * @param activate the layer active
2947 cbradney 204
         * @return Number of the layer created
205
         */
4645 subik 206
        int addLayer(const QString& layerName=QString::null, const bool activate=false);
3201 subik 207
        /**
6290 fschmid 208
         * @brief Copies a layer from the current document
209
         * @param layerNumberToCopy source layer
210
         * @param whereToInsert target layer
211
         * @return Success or failure
212
         */
213
        void copyLayer(int layerNumberToCopy, int whereToInsert);
214
        /**
2947 cbradney 215
         * @brief Delete a layer from the current document
4645 subik 216
         * @param layerNumber of layer
217
         * @param deleteItems the items on the layer too?
2947 cbradney 218
         * @return Success or failure
219
         */
4645 subik 220
        bool deleteLayer(const int layerNumber, const bool deleteItems);
2947 cbradney 221
        /**
222
         * @brief Return the number of the current layer
223
         * @return Active layer number
224
         */
3985 cbradney 225
        int activeLayer();
3201 subik 226
 
2947 cbradney 227
        /**
228
         * @brief Return the name of the current layer
229
         * @return Name of the layer
230
         */
2937 cbradney 231
        const QString& activeLayerName();
2947 cbradney 232
        /**
233
         * @brief Set the active layer via the layer number
4650 subik 234
         * @param layerToActivate Number of the layer
2947 cbradney 235
         * @return Success or failure
236
         */
4650 subik 237
        bool setActiveLayer(const int layerToActivate);
2947 cbradney 238
        /**
239
         * @brief Set the active layer via the layer name
4650 subik 240
         * @param layerNameToActivate Name of the layer
2947 cbradney 241
         * @return Success or failure
242
         */
4650 subik 243
        bool setActiveLayer(const QString & layerNameToActivate);
2947 cbradney 244
        /**
245
         * @brief Set the layer printable via the layer number
4650 subik 246
         * @param layerNumber Number of the layer
247
         * @param isPrintable bool true = layer is prantable
2947 cbradney 248
         * @return Success or failure
249
         */
4650 subik 250
        bool setLayerPrintable(const int layerNumber, const bool isPrintable);
2947 cbradney 251
        /**
252
         * @brief Is the layer printable
4650 subik 253
         * @param layerNumber Number of the layer
2947 cbradney 254
         * @return Printable or not
255
         */
4650 subik 256
        bool layerPrintable(const int layerNumber);
2947 cbradney 257
        /**
258
         * @brief Set the layer visible via the layer number
4650 subik 259
         * @param layerNumber Number of the layer
260
         * @param isViewable true = layer is visible
2947 cbradney 261
         * @return Success or failure
262
         */
4650 subik 263
        bool setLayerVisible(const int layerNumber, const bool isViewable);
2947 cbradney 264
        /**
265
         * @brief Is the layer visible
4650 subik 266
         * @param layerNumber Number of the layer
2947 cbradney 267
         * @return Visible or not
268
         */
4650 subik 269
        bool layerVisible(const int layerNumber);
2947 cbradney 270
        /**
4832 fschmid 271
         * @brief Set the layer locked via the layer number
272
         * @param layerNumber Number of the layer
12071 subik 273
         * @param isLocked true = layer is locked
4832 fschmid 274
         * @return Success or failure
275
         */
10146 jghali 276
        bool setLayerLocked(const int layerNumber, const bool isLocked);
4832 fschmid 277
        /**
278
         * @brief Is the layer locked
279
         * @param layerNumber Number of the layer
280
         * @return Locked or not
281
         */
282
        bool layerLocked(const int layerNumber);
283
        /**
5359 fschmid 284
         * @brief Set the layer flow via the layer number
285
         * @param layerNumber Number of the layer
286
         * @param flow true = Text flows around objects on this layer
287
         * @return Success or failure
288
         */
289
        bool setLayerFlow(const int layerNumber, const bool flow);
290
        /**
291
         * @brief does text flow around objects on this layer
292
         * @param layerNumber Number of the layer
293
         * @return flow or not
294
         */
295
        bool layerFlow(const int layerNumber);
296
        /**
5373 fschmid 297
         * @brief Set the layer transparency via the layer number
298
         * @param layerNumber Number of the layer
299
         * @param trans transparency value 0.0 - 1.0
300
         * @return Success or failure
301
         */
302
        bool setLayerTransparency(const int layerNumber, double trans);
303
        /**
304
         * @brief returns the layer transparency
305
         * @param layerNumber Number of the layer
306
         * @return transparency value 0.0 - 1.0
307
         */
308
        double layerTransparency(const int layerNumber);
309
        /**
5375 fschmid 310
         * @brief Set the layer layerBlendMode via the layer number
311
         * @param layerNumber Number of the layer
12071 subik 312
         * @param blend layerBlendMode
5375 fschmid 313
         * @return Success or failure
314
         */
315
        bool setLayerBlendMode(const int layerNumber, int blend);
316
        /**
317
         * @brief returns the layer BlendMode
318
         * @param layerNumber Number of the layer
319
         * @return layerBlendMode
320
         */
321
        int layerBlendMode(const int layerNumber);
322
        /**
2947 cbradney 323
         * @brief Return the level of the requested layer
4650 subik 324
         * @param layerNumber Number of the layer
2947 cbradney 325
         * @return Level of the layer
326
         */
4650 subik 327
        int layerLevelFromNumber(const int layerNumber);
2947 cbradney 328
        /**
5572 fschmid 329
         * @brief Set the layer marker color
330
         * @param layerNumber Number of the layer
331
         * @param color color of the marker
332
         * @return Success or failure
333
         */
334
        bool setLayerMarker(const int layerNumber, QColor color);
335
        /**
336
         * @brief returns the layer marker color
337
         * @param layerNumber Number of the layer
338
         * @return marker color
339
         */
340
        QColor layerMarker(const int layerNumber);
341
        /**
342
         * @brief Set the layer outline mode via the layer number
343
         * @param layerNumber Number of the layer
344
         * @param outline true = layer is displayed in outlines only
345
         * @return Success or failure
346
         */
347
        bool setLayerOutline(const int layerNumber, const bool outline);
348
        /**
349
         * @brief is this layer in outline mode
350
         * @param layerNumber Number of the layer
351
         * @return outline or not
352
         */
353
        bool layerOutline(const int layerNumber);
354
        /**
2947 cbradney 355
         * @brief Return the number of the layer at a certain level
4650 subik 356
         * @param layerLevel Layer level
2947 cbradney 357
         * @return Layer number
358
         */
4650 subik 359
        int layerNumberFromLevel(const int layerLevel);
2947 cbradney 360
        /**
361
         * @brief Return the layer count
362
         * @return Number of layers in doc
363
         */
3985 cbradney 364
        int layerCount() const;
2947 cbradney 365
        /**
366
         * @brief Lower a layer
4650 subik 367
         * @param layerNumber Number of the layer
2947 cbradney 368
         * @return Success or failure
369
         */
4650 subik 370
        bool lowerLayer(const int layerNumber);
2947 cbradney 371
        /**
372
         * @brief Lower a layer using the level
4650 subik 373
         * @param layerLevel Level of the layer
2947 cbradney 374
         * @return Success or failure
375
         */
4650 subik 376
        bool lowerLayerByLevel(const int layerLevel);
2947 cbradney 377
        /**
378
         * @brief Raise a layer
4650 subik 379
         * @param layerNumber Number of the layer
2947 cbradney 380
         * @return Success or failure
381
         */
4650 subik 382
        bool raiseLayer(const int layerNumber);
2947 cbradney 383
        /**
384
         * @brief Raise a layer using the level
4650 subik 385
         * @param layerLevel Level of the layer
2947 cbradney 386
         * @return Success or failure
387
         */
4650 subik 388
        bool raiseLayerByLevel(const int layerLevel);
2947 cbradney 389
        /**
390
         * @brief Return the layer name
4650 subik 391
         * @param layerNumber Number of the layer
3201 subik 392
         * @return Name of the layer
2947 cbradney 393
         */
8638 cbradney 394
        QString layerName(const int layerNumber) const;
2947 cbradney 395
        /**
396
         * @brief Change the name of a layer
4645 subik 397
         * @param layerNumber number of the layer
398
         * @param newName new name of the layer
2947 cbradney 399
         * @return Success or failure
400
         */
4645 subik 401
        bool changeLayerName(const int layerNumber, const QString& newName);
2947 cbradney 402
        /**
403
         * @brief Does the layer have items on it?
4650 subik 404
         * @param layerNumber Number of the layer
2947 cbradney 405
         * @return Layer contains items bool
406
         */
4650 subik 407
        bool layerContainsItems(const int layerNumber);
2947 cbradney 408
        /**
409
         * @brief Renumber a layer. Used in particular for reinsertion for undo/redo
4650 subik 410
         * @param layerNumber old layer number
411
         * @param newLayerNumber New layer number
2947 cbradney 412
         * @return Success or failure
413
         */
4650 subik 414
        bool renumberLayer(const int layerNumber, const int newLayerNumber);
2947 cbradney 415
        /**
416
         * @brief Return a list of the layers in their order
4650 subik 417
         * @param list QStringList to insert the layer names into
2947 cbradney 418
         */
4650 subik 419
        void orderedLayerList(QStringList* list);
2937 cbradney 420
        //Items
3985 cbradney 421
        bool deleteTaggedItems();
3201 subik 422
 
7442 avox 423
        /*!
424
                * @brief Builds a qmap of the icc profiles used within the document
425
         */
426
        void getUsedProfiles(ProfilesL& usedProfiles);
5345 mrdocs 427
        bool OpenCMSProfiles(ProfilesL InPo, ProfilesL InPoCMYK, ProfilesL MoPo, ProfilesL PrPo);
1330 fschmid 428
        void CloseCMSProfiles();
10338 jghali 429
        void SetDefaultCMSParams();
6726 fschmid 430
        /**
7442 avox 431
         * @brief Switch Colormanagement on or of
6726 fschmid 432
         * @param enable bool, if true Colormanagement is switched on, else off
433
         */
434
        void enableCMS(bool enable);
7442 avox 435
 
8521 cbradney 436
        const ParagraphStyle& paragraphStyle(QString name) { return docParagraphStyles.get(name); }
7442 avox 437
        const StyleSet<ParagraphStyle>& paragraphStyles()   { return docParagraphStyles; }
7944 cbradney 438
        bool isDefaultStyle( const ParagraphStyle& p ) const { return docParagraphStyles.isDefault(p); }
439
        bool isDefaultStyle( const CharStyle& c ) const { return docCharStyles.isDefault(c); }
440
//      bool isDefaultStyle( LineStyle& l ) const { return MLineStyles......; }
8455 avox 441
 
442
        void getNamedResources(ResourceCollection& lists) const;
16385 fschmid 443
        void replaceNamedResources(ResourceCollection& newNames);
444
        bool styleExists(QString styleName);
16660 jghali 445
 
446
        QList<int> getSortedStyleList();
447
        QList<int> getSortedCharStyleList();
8455 avox 448
 
7595 avox 449
        void redefineStyles(const StyleSet<ParagraphStyle>& newStyles, bool removeUnused=false);
7442 avox 450
        /**
451
         * @brief Remove any reference to old styles and replace with new name. This needs to be
452
         *        called when a style was removed. New name may be "".
453
         * @param newNameForOld a map which maps the name of any style to remove to a new stylename
454
         */
7944 cbradney 455
        void replaceStyles(const QMap<QString,QString>& newNameForOld);
12548 pierre 456
        /**
457
         * @brief Insert styles from another document in this document.
458
         *        
459
         * @param fileName The path of the document we want to extract its styles
460
         */
461
        void loadStylesFromFile(QString fileName);
462
        /**
463
         * @brief Gather styles from another document.
464
         *        
465
         * @param fileName The path of the document we want to extract its styles
466
         * @param tempStyles A pointer to a StyleSet which will be filled by paragraph styles
467
         * @param tempCharStyles A pointer to a StyleSet which will be filled by character styles
468
         * @param tempLineStyles A map which will be filled by line styles
469
         */
470
        void loadStylesFromFile(QString fileName, StyleSet<ParagraphStyle> *tempStyles,
471
                                                  StyleSet<CharStyle> *tempCharStyles,
472
                                                  QMap<QString, multiLine> *tempLineStyles);
7442 avox 473
 
8521 cbradney 474
        const CharStyle& charStyle(QString name) { return docCharStyles.get(name); }
7442 avox 475
        const StyleSet<CharStyle>& charStyles()  { return docCharStyles; }
7595 avox 476
        void redefineCharStyles(const StyleSet<CharStyle>& newStyles, bool removeUnused=false);
3201 subik 477
        /**
7442 avox 478
         * @brief Remove any reference to old styles and replace with new name. This needs to be
479
         *        called when a style was removed. New name may be "".
480
         * @param newNameForOld a map which maps the name of any style to remove to a new stylename
481
         */
7944 cbradney 482
        void replaceCharStyles(const QMap<QString,QString>& newNameForOld);
7442 avox 483
 
484
        /**
1179 tsoots 485
         * @brief Should guides be locked or not
486
         * @param isLocked If true guides on pages cannot be moved if false they
487
         * can be dragged to new positions.
488
         * @author Riku Leino
489
         */
490
        void lockGuides(bool isLocked);
1190 tsoots 491
        /**
1179 tsoots 492
         * @brief Method used when an undo/redo is requested.
493
         * @param state State describing the action that is wanted to be undone/redone
494
         * @param isUndo If true undo is wanted else if false redo.
495
         * @author Riku Leino
496
         */
497
        void restore(UndoState* state, bool isUndo);
498
        /**
499
         * @brief Sets the name of the document
500
         * @param name Name for the document
501
         * @author Riku Leino
502
         */
503
        void setName(const QString& name);
1694 cbradney 504
        /*!
505
         * @brief Returns a stringlist of the item attributes within the document
506
         */
507
        QStringList getItemAttributeNames();
3201 subik 508
 
7442 avox 509
        bool AddFont(QString name, int fsize = 10);
2960 cbradney 510
        /*!
12319 cbradney 511
         * @brief TODO: Reorganise the fonts.. how? Moved from scribus.cpp
512
         * CB: almost the same as getUsedFonts???
513
         */
12953 fschmid 514
        QMap<QString,int> reorganiseFonts();
12319 cbradney 515
        /*!
5387 avox 516
         * @brief Returns a qmap of the fonts and  their glyphs used within the document
2960 cbradney 517
         */
5387 avox 518
        void getUsedFonts(QMap<QString,QMap<uint, FPointArray> > &Really);
6407 fschmid 519
        void checkItemForFonts(PageItem *it, QMap<QString, QMap<uint, FPointArray> > & Really, uint lc);
8985 jghali 520
 
2960 cbradney 521
        /*!
8985 jghali 522
         * @brief Replace line style colors
523
         */
524
        void replaceLineStyleColors(const QMap<QString, QString>& colorMap);
525
        /*!
3057 fschmid 526
        * @brief Builds a qmap of the colours used within the document
527
        */
3068 fschmid 528
        void getUsedColors(ColorList &colorsToUse, bool spot = false);
3057 fschmid 529
        /*!
8950 jghali 530
        * @brief Return if a specific color is used by line styles
531
        */
532
        bool lineStylesUseColor(const QString& colorName);
533
        /*!
6517 cbradney 534
        * @brief Set the patterns for a document
535
        */
536
        bool addPattern(QString &name, ScPattern& pattern);
537
        void setPatterns(QMap<QString, ScPattern> &patterns);
538
        /*!
6400 fschmid 539
        * @brief Builds a QStringList of the patterns used within the document
540
        */
541
        QStringList getUsedPatterns();
12744 fschmid 542
        QStringList getUsedPatternsSelection(Selection* customSelection);
6400 fschmid 543
        QStringList getUsedPatternsHelper(QString pattern, QStringList &results);
2965 cbradney 544
        /**
545
         * @brief Set and get the document's unit index
546
         */
547
        void setUnitIndex(const int);
3985 cbradney 548
        int unitIndex() const;
549
        double unitRatio() const;
3004 cbradney 550
        /**
551
         * @brief Apply a master page
552
         */
6578 cbradney 553
        bool applyMasterPage(const QString& pageName, const int pageNumber);
3004 cbradney 554
        /**
555
         * @brief Undo function for applying a master page
556
         */
557
        void restoreMasterPageApplying(SimpleState *state, bool isUndo);
17212 craig 558
        void restoreCopyPage(SimpleState *state, bool isUndo);
559
        void restoreMovePage(SimpleState *state, bool isUndo);
3020 cbradney 560
        /**
13194 jghali 561
         * @brief Undo function for grouping/ungrouping
562
         */
563
        void restoreGrouping(SimpleState *state, bool isUndo);
564
        void restoreUngrouping(SimpleState *state, bool isUndo);
565
        /**
3020 cbradney 566
         * @brief Save function
567
         */
11212 jghali 568
        bool save(const QString& fileName, QString* savedFile = NULL);
3025 cbradney 569
        /**
570
         * @brief Set the page margins. Current code uses current page only, also provide a (currently, TODO) option for this.
571
         */
16507 craig 572
        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 573
        /**
574
         * @brief Recalculate the colors after CMS settings change. Update the items in the doc accordingly.
575
         */
576
         void recalculateColors();
3179 cbradney 577
        /**
578
         * @brief Sets up the ScText defaults from the document
579
         */
580
        void setScTextDefaultsFromDoc(ScText *);
3200 cbradney 581
        /**
582
         * @brief Copies a normal page to be a master pages
583
         */
10833 cbradney 584
        bool copyPageToMasterPage(const int, const int, const int, const QString&, bool);
3263 cbradney 585
        /**
586
         * @brief Paste an item to the document.
587
         * The bulk of a paste item process runs here for want of a better place, but its a better place
588
         * than the view where it used to be.
589
         * TODO Once the pageitem restructure is done, this is probably unnecessary but it removes the
590
         * unnecessary part from the view for now which is overloaded with non ScrollView code.
591
         */
592
        //TODO: void PasteItem(struct CopyPasteBuffer *Buffer, bool loading, bool drag = false);
593
 
594
        /**
595
         * @brief Add an Item to the document.
596
         * A simple function to create an item of a defined type and add it to the document
597
         * Will need extensive rewriting once we have various classes of PageItems, at a guess.
598
         *
599
         * @param itemFinalised Used to handle item creation for undo while the user is still dragging.
600
         * @return Number of created item, -1 on failure.
4650 subik 601
        \param itemType type
602
        \param frameType frame type
603
        \param x X pos
604
        \param y Y pos
605
        \param b width
606
        \param h height
607
        \param w ?
608
        \param fill fill color name
609
        \param outline outline color name
610
        */
3263 cbradney 611
        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);
5164 tsoots 612
 
613
        /** Add an item to the page based on the x/y position. Item will be fitted to the closest guides/margins */
614
        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 615
 
6137 cbradney 616
        /**
617
         * @brief Allow the user to create a frame easily with some simple placement and sizing options
12071 subik 618
         * @param iafData a InsertAFrameData structure with params
619
         * @return int item id? FIXME
6137 cbradney 620
         */
6657 cbradney 621
        int itemAddUserFrame(InsertAFrameData &iafData);
5164 tsoots 622
 
3263 cbradney 623
        /**
624
         * @brief Commit item creation when a user has click-drag created an item
625
         * Only called from ScribusView. Note the undo target is the page, so the undo code remains their for now.
626
         * @return If an item was committed and the view must emit its signal, which needs removing from here, TODO.
627
         */
628
        bool itemAddCommit(const int itemNumber);
629
 
630
        /**
631
         * @brief Finalise item creation. Simply split off code from itemAdd
632
         * Only to be called from itemAdd()
633
         */
634
        void itemAddDetails(const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, const int itemNumber);
7068 fschmid 635
 
636
        uint getItemNrfromUniqueID(uint unique);
3263 cbradney 637
        //itemDelete
638
        //itemBlah...
3628 cbradney 639
 
640
        /**
641
         * @brief Run this common frame item update code
642
         */
643
        void updateFrameItems();
3648 cbradney 644
        /**
7697 cbradney 645
         * @brief Renumbers the items into the order they are stored in in the lists.
646
         * Utility function used in various places, basically handles keeping items numbered in the way
647
         * they are layered. When layer is a property and not a fuction of storage, this should be removed.
648
         * Depends on the Items pointer pointing to the correct item list (doc, master, etc).
649
         * @sa updateFrameItems();
650
         */
651
        void renumberItemsInListOrder();
652
        /**
10140 jghali 653
         * @brief Rebuild item lists taking into account layer order.
654
         * Utility function used in various places, basically handles keeping items numbered in the way
655
         * they are layered. When layer is a property and not a fuction of storage, this should be removed.
656
         * @sa updateFrameItems();
657
         */
658
        void rebuildItemLists();
659
        /**
3648 cbradney 660
         * @brief Doc uses automatic text frames?
661
         */
3985 cbradney 662
        bool usesAutomaticTextFrames() const;
3648 cbradney 663
        void setUsesAutomaticTextFrames(const bool);
3650 cbradney 664
 
665
        /**
666
         * @brief Load images into an image frame, moved from the view
667
         * @retval Return false on failure
668
         */
5977 jghali 669
        bool LoadPict(QString fn, int ItNr, bool reload = false, bool showMsg = false);
3942 cbradney 670
        /**
671
         *
672
         * @param fn
673
         * @param pageItem
674
         * @param reload
675
         * @return
676
         */
5977 jghali 677
        bool loadPict(QString fn, PageItem *pageItem, bool reload = false, bool showMsg = false);
3656 cbradney 678
        /**
4650 subik 679
         * \brief Handle image with color profiles
680
         * @param Pr profile
681
           @param PrCMYK cmyk profile
682
           @param dia optional progress widget
3942 cbradney 683
         */
9953 cbradney 684
        void RecalcPictures(ProfilesL *Pr, ProfilesL *PrCMYK, QProgressBar *dia = 0);
3942 cbradney 685
        /**
14531 jghali 686
         * \brief Handle image with color profiles
687
         * @param items list of page items to update
688
         * @param Pr profile
689
         * @param PrCMYK cmyk profile
690
         * @param dia optional progress widget
691
         */
692
        void RecalcPictures(QList<PageItem*>* items, ProfilesL *Pr, ProfilesL *PrCMYK, QProgressBar *dia = 0);
693
        /**
3656 cbradney 694
         * @brief Find the minX,MinY and maxX,maxY for the canvas required for the doc
695
         */
696
        void canvasMinMax(FPoint&, FPoint&);
3657 cbradney 697
 
16696 jghali 698
        int  OnPage(double x2, double  y2);
699
        int  OnPage(PageItem *currItem);
3657 cbradney 700
        void GroupOnPage(PageItem *currItem);
17337 jghali 701
 
4672 cbradney 702
        void reformPages(bool moveObjects = true);
17337 jghali 703
        /** @brief Refresh automatic guides once Margin struct has been properly configure by reformPages() */
704
        void refreshGuides();
705
        /** @brief Check and fix if needed PageItem OwnPage member */
16696 jghali 706
        void fixItemPageOwner();
3664 cbradney 707
 
708
        /**
3670 cbradney 709
         * @brief Return the x or y offset for a page on the canvas
710
         * @retval double containing the offset. Returns -1.0 if page not in Pages list (as -ve is not possible).
711
         * Mostly saves bringing in extra includes into files that already have scribusdoc.h
3664 cbradney 712
         */
10508 cbradney 713
        double getXOffsetForPage(const int);
714
        double getYOffsetForPage(const int);
12419 cbradney 715
        void getBleeds(int pageNumber, MarginStruct& bleedData);
14079 jghali 716
        void getBleeds(const Page* page, MarginStruct& bleedData);
717
        void getBleeds(const Page* page, const MarginStruct& baseValues, MarginStruct& bleedData);
3670 cbradney 718
 
719
        /**
720
         * @brief Item type conversion functions
721
         */
3676 cbradney 722
        PageItem* convertItemTo(PageItem *currItem, PageItem::ItemType newType, PageItem* secondaryItem=NULL);
3670 cbradney 723
 
724
        /**
725
         * @brief The page number of the current page
726
         */
10508 cbradney 727
        int currentPageNumber();
3689 cbradney 728
 
729
        /**
730
         * @brief Return true iff the passed name is not used by any existing PageItem
731
         *        in the same document as this PageItem.
732
         * @author Craig Ringer
733
         ** CB Moved from PageItem
734
         */
735
        bool itemNameExists(const QString itemName);
3724 cbradney 736
 
737
        /**
738
         * @brief Set the doc into Master page mode
739
         * Do we need to return if the move to master page mode was successful?
740
         */
4738 cbradney 741
        void setMasterPageMode(bool);
4061 craig 742
 
743
        /*** Is the document in master page mode? */
744
        bool masterPageMode() const { return m_masterPageMode; }
3757 cbradney 745
 
746
        /**
747
         * @brief Add a section to the document sections list
3776 cbradney 748
         * Set number to -1 to add in the default section if the map is empty
3757 cbradney 749
         */
3776 cbradney 750
        void addSection(const int number=0, const QString& name=QString::null, const uint fromindex=0, const uint toindex=0, const  DocumentSectionType type=Type_1_2_3, const uint sectionstartindex=0, const bool reversed=false, const bool active=true);
3757 cbradney 751
        /**
752
         * @brief Delete a section from the document sections list
753
         */
3985 cbradney 754
        bool deleteSection(const uint);
3757 cbradney 755
        /**
756
         * @brief Gets the page number to be printed based on the section it is in.
757
         * Returns QString::null on failure to find the pageIndex
758
         */
759
        const QString getSectionPageNumberForPageIndex(const uint) const;
3776 cbradney 760
        /**
761
         * @brief Gets the key of the sections map based on the section the page index is in.
762
         * Returns -1 on failure to find the pageIndex
763
         */
3985 cbradney 764
        int getSectionKeyForPageIndex(const uint pageIndex) const;
3778 cbradney 765
        /**
766
         *
767
         *
768
         */
769
        void updateSectionPageNumbersToPages();
3792 cbradney 770
        /**
3894 cbradney 771
         *
772
         * @param otherPageIndex
773
         * @param location
774
         * @param count
775
         */
3792 cbradney 776
        void addPageToSection(const uint otherPageIndex, const uint location, const uint count=1);
3894 cbradney 777
        /**
778
         *
779
         * @param pageIndex
780
         */
3793 cbradney 781
        void removePageFromSection(const uint pageIndex);
3894 cbradney 782
        /**
783
         *
784
         */
3793 cbradney 785
        void setFirstSectionFromFirstPageNumber();
3894 cbradney 786
        /**
787
         * @brief Update the fill and line QColors for all items in the doc
788
         */
789
        void updateAllItemQColors();
5334 cbradney 790
        //! @brief Some internal align tools
791
        typedef enum {alignFirst, alignLast, alignPage, alignMargins, alignGuide, alignSelection } AlignTo;
15219 cbradney 792
        typedef enum {alignByMoving, alignByResizing } AlignMethod;
5334 cbradney 793
        void buildAlignItemList(Selection* customSelection=0);
19755 jghali 794
        bool startAlign(uint minObjects = 1);
5355 cbradney 795
        void endAlign();
3942 cbradney 796
        /**
4650 subik 797
         * \brief Insert a color into the documents color list
4010 cbradney 798
         * @param nam Name of the colour
799
         * @param c Cyan component
800
         * @param m Magenta component
801
         * @param y Yellow component
802
         * @param k Black component
803
         */
804
        void insertColor(QString nam, double c, double m, double y, double k);
4110 cbradney 805
 
806
        QMap<QString, double>& constants() { return m_constants; }
4122 cbradney 807
        /**
4650 subik 808
         * \brief Get the location of the page on the canvas, ie, left, middle, or right
4122 cbradney 809
         * Does not give information about middle left, etc.
4650 subik 810
         * @param pageIndex Index of page to find location for
4122 cbradney 811
         * @return LeftPage, MiddlePage, RightPage, enum from pagestructs.h
812
         */
10060 craig 813
        PageLocation locationOfPage(int pageIndex) const;
12487 cbradney 814
        /**
815
         * \brief Get the column of the page on the canvas, ie, left, middle, or right
816
         * @param pageIndex Index of page to find location for
817
         * @return int of 0,1,2,3
818
         */
819
        int columnOfPage(int pageIndex) const;
4301 cbradney 820
 
821
        bool sendItemSelectionToBack();
822
        bool bringItemSelectionToFront();
5184 avox 823
 
9918 jghali 824
        void itemSelection_GroupObjects  (bool changeLock, bool lock, Selection* customSelection=0);
825
        void itemSelection_UnGroupObjects(Selection* customSelection=0);
12779 cbradney 826
        void itemSelection_convertItemsTo(const PageItem::ItemType newType, Selection* restoredSelection=0, Selection* customSelection=0);
9918 jghali 827
 
13290 jghali 828
        void itemSelection_ApplyParagraphStyle(const ParagraphStyle & newstyle, Selection* customSelection=0, bool rmDirectFormatting = false);
7563 cbradney 829
        void itemSelection_SetParagraphStyle(const ParagraphStyle & newstyle, Selection* customSelection=0);
830
        void itemSelection_ApplyCharStyle(const CharStyle & newstyle, Selection* customSelection=0);
831
        void itemSelection_SetCharStyle(const CharStyle & newstyle, Selection* customSelection=0);
8455 avox 832
        void itemSelection_EraseParagraphStyle(Selection* customSelection=0);
833
        void itemSelection_EraseCharStyle(Selection* customSelection=0);
5184 avox 834
 
7563 cbradney 835
        void itemSelection_SetNamedParagraphStyle(const QString & name, Selection* customSelection=0);
836
        void itemSelection_SetNamedCharStyle(const QString & name, Selection* customSelection=0);
10367 jghali 837
        void itemSelection_SetNamedLineStyle(const QString & name, Selection* customSelection=0);
6917 avox 838
 
12420 cbradney 839
        void itemSelection_SetLineWidth(double w);
840
        void itemSelection_SetLineArt(Qt::PenStyle w);
841
        void itemSelection_SetLineJoin(Qt::PenJoinStyle w);
842
        void itemSelection_SetLineEnd(Qt::PenCapStyle w);
7563 cbradney 843
        void itemSelection_SetAlignment(int w, Selection* customSelection=0);
844
        void itemSelection_SetLineSpacing(double w, Selection* customSelection=0);
845
        void itemSelection_SetLineSpacingMode(int w, Selection* customSelection=0);
4830 cbradney 846
        //void ChLocalXY(double x, double y);
847
        //void ChLocalSc(double x, double y);
7563 cbradney 848
        void itemSelection_SetFont(QString fon, Selection* customSelection=0);
849
        void itemSelection_SetFillColor(QString farbe, Selection* customSelection=0);
850
        void itemSelection_SetFillShade(int sha, Selection* customSelection=0);
851
        void itemSelection_SetStrokeColor(QString farbe, Selection* customSelection=0);
852
        void itemSelection_SetStrokeShade(int sha, Selection* customSelection=0);
853
        void itemSelection_SetScaleV(int, Selection* customSelection=0);
854
        void itemSelection_SetScaleH(int, Selection* customSelection=0);
855
        void itemSelection_SetBaselineOffset(int, Selection* customSelection=0);
856
        void itemSelection_SetOutlineWidth(int, Selection* customSelection=0);
857
        void itemSelection_SetShadowOffsets(int shx, int shy, Selection* customSelection=0);
858
        void itemSelection_SetUnderline(int pos, int wid, Selection* customSelection=0);
859
        void itemSelection_SetStrikethru(int pos, int wid, Selection* customSelection=0);
860
        void itemSelection_SetEffects(int s, Selection* customSelection=0);
8057 cbradney 861
        void itemSelection_SetOpticalMargins(int i, Selection* customSelection=0);
13298 cbradney 862
        void itemSelection_resetOpticalMargins(Selection* customSelection=0);
11663 cbradney 863
        void itemSelection_SetColorProfile(const QString& profileName, Selection* customSelection=0);
864
        void itemSelection_SetRenderIntent(int intentIndex, Selection* customSelection=0);
6733 avox 865
 
866
//      void chAbStyle(PageItem *currItem, int s);
867
 
7563 cbradney 868
        void itemSelection_SetTracking(int us, Selection* customSelection=0);
869
        void itemSelection_SetFontSize(int size, Selection* customSelection=0);
4699 cbradney 870
        //void FlipImageH();
871
        //void FlipImageV();
872
        void MirrorPolyH(PageItem *currItem);
873
        void MirrorPolyV(PageItem *currItem);
4584 cbradney 874
 
4672 cbradney 875
        void setRedrawBounding(PageItem *currItem);
876
        void adjustCanvas(FPoint minPos, FPoint maxPos, bool absolute = false);
7570 fschmid 877
        void recalcPicturesRes(bool applyNewRes = false);
4672 cbradney 878
        void connectDocSignals();
4713 cbradney 879
        void removeLayer(int l, bool dl = false); //FIXME: Make protected once scripter function no longer uses this directly
5781 cbradney 880
        /*! \brief We call changed() whenever the document needs to know it has been changed.
881
         *  If the document is the primary document in a main window, it will signal to enable/disable
882
         * certain operations.
883
         */
4738 cbradney 884
        void changed();
5087 subik 885
        /*! \brief Get pointer to the current page
886
        \retval Page* current page object */
887
        Page* currentPage();
888
        /*! \brief Set new current page
889
        \param newPage New current page */
890
        void setCurrentPage(Page *newPage);
5823 cbradney 891
        bool hasGUI() const {return m_hasGUI;}
6137 cbradney 892
        /*! \brief Apply grid to a QPoint, from ScribusView */
893
        QPoint ApplyGrid(const QPoint& in);
894
        /*! \brief Apply grid to an FPoint, from ScribusView */
895
        FPoint ApplyGridF(const FPoint& in);
6565 cbradney 896
        /*! \brief Does this doc have any TOC setups and potentially a TOC to generate */
897
        bool hasTOCSetup() { return !docToCSetups.empty(); }
7736 cbradney 898
        //! \brief Get the closest guide to the given point
15300 jghali 899
        void getClosestGuides(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM, Page* pg = NULL);
7736 cbradney 900
        //! \brief Snap an item to the guides
901
        void SnapToGuides(PageItem *currItem);
902
        bool ApplyGuides(double *x, double *y);
903
        bool MoveItem(double newX, double newY, PageItem* ite, bool fromMP = false);
904
        void RotateItem(double win, int ite);
905
        void RotateItem(double win, PageItem *currItem);
906
        void MoveRotated(PageItem *currItem, FPoint npv, bool fromMP = false);
907
        bool SizeItem(double newX, double newY, int ite, bool fromMP = false, bool DoUpdateClip = true, bool redraw = true);
908
        bool SizeItem(double newX, double newY, PageItem *pi, bool fromMP = false, bool DoUpdateClip = true, bool redraw = true);
909
        bool MoveSizeItem(FPoint newX, FPoint newY, int ite, bool fromMP = false, bool constrainRotation=false);
910
        void AdjustItemSize(PageItem *currItem);
10532 avox 911
        void moveGroup(double x, double y, bool fromMP = false, Selection* customSelection = 0);
912
        void rotateGroup(double angle, FPoint RCenter);
913
        void scaleGroup(double scx, double scy, bool scaleText=true, Selection* customSelection = 0);
12339 cbradney 914
        //! \brief Get a list of frames of certain type
915
        QMap<PageItem*, QString> getDocItemNames(PageItem::ItemType itemType);
14404 jghali 916
 
917
        //! \brief Fonctions which avoid doc updater and update manager to send too much
918
        // unncessary signals when doing updates on multiple items
919
        void beginUpdate();
920
        void endUpdate();
4672 cbradney 921
 
168 Franz 922
protected:
2891 cbradney 923
        void addSymbols();
5823 cbradney 924
        bool m_hasGUI;
3983 craig 925
        ApplicationPrefs& prefsData;
926
        UndoManager * const undoManager;
2891 cbradney 927
        bool loading;
2937 cbradney 928
        bool modified;
929
        int ActiveLayer;
2965 cbradney 930
        int docUnitIndex;
931
        double docUnitRatio;
3648 cbradney 932
        bool automaticTextFrames; // Flag for automatic Textframes
3724 cbradney 933
        bool m_masterPageMode;
4110 cbradney 934
        QMap<QString, double> m_constants;
5781 cbradney 935
        ScribusMainWindow* m_ScMW;
936
        ScribusView* m_View;
7906 jghali 937
        ScGuardedObject<ScribusDoc> m_guardedObject;
3757 cbradney 938
 
168 Franz 939
public: // Public attributes
2937 cbradney 940
        bool is12doc; //public for now, it will be removed later
1330 fschmid 941
        int NrItems;
942
        int First;
943
        int Last;
944
        int viewCount;
945
        int viewID;
3 paul 946
        bool SnapGuides;
947
        bool GuideLock;
5087 subik 948
        /** \brief Scratch space around Pages */
8012 cbradney 949
        MarginStruct scratch;
11349 fschmid 950
        double GapHorizontal;
951
        double GapVertical;
8012 cbradney 952
//      double ScratchLeft;
953
//      double ScratchRight;
954
//      double ScratchTop;
955
//      double ScratchBottom;
5087 subik 956
        /** \brief Minimum and Maximum Points of Document */
2837 fschmid 957
        FPoint minCanvasCoordinate;
958
        FPoint maxCanvasCoordinate;
2867 fschmid 959
        double rulerXoffset;
960
        double rulerYoffset;
5087 subik 961
        /** \brief List of Pages */
10013 cbradney 962
        QList<Page*>* Pages;
5087 subik 963
        /** \brief List of Master Pages */
10013 cbradney 964
        QList<Page*> MasterPages;
5087 subik 965
        /** \brief List of Document Pages */
10013 cbradney 966
        QList<Page*> DocPages;
5087 subik 967
        /** \brief Mapping Master Page Name to Master Page numbers */
456 fschmid 968
        QMap<QString,int> MasterNames;
5087 subik 969
        /** \brief List of Objects */
9856 fschmid 970
        QList<PageItem*>* Items;
971
        QList<PageItem*> MasterItems;
972
        QList<PageItem*> DocItems;
973
        QList<PageItem*> FrameItems;
4847 cbradney 974
        Selection* const m_Selection;
5087 subik 975
        /** \brief Pagewidth  */
2142 cbradney 976
        double pageWidth;
5087 subik 977
        /** \brief Pageheight */
2142 cbradney 978
        double pageHeight;
5087 subik 979
        /* Number of Pages */
4069 craig 980
        // int pageCount; Disabled CR no longer required
5087 subik 981
        /** \brief Margins */
2142 cbradney 982
        MarginStruct pageMargins;
12334 fschmid 983
        int marginPreset;
9803 fschmid 984
        QList<PageSet> pageSets;
7225 cbradney 985
        MarginStruct bleeds;
986
//      double BleedTop;
987
//      double BleedLeft;
988
//      double BleedRight;
989
//      double BleedBottom;
5087 subik 990
        /** \brief Number of Columns */
168 Franz 991
        double PageSp;
5087 subik 992
        /** \brief Distance of Columns */
168 Franz 993
        double PageSpa;
5087 subik 994
        /** \brief current Pagelayout */
3032 fschmid 995
        int currentPageLayout;
5087 subik 996
        /** \brief Flag fuer Hoch- oder Querformat 0 = Hochformat */
3032 fschmid 997
        int PageOri;
5789 cbradney 998
        QString m_pageSize;
5087 subik 999
        /** \brief Erste Seitennummer im Dokument */
3 paul 1000
        int FirstPnum;
5087 subik 1001
        /** \brief Flag fuer Rasterbenutzung */
168 Franz 1002
        bool useRaster;
5087 subik 1003
        /** \brief Im Dokument benutzte Farben */
1065 cbradney 1004
        ColorList PageColors;
5087 subik 1005
        /** \brief InfoStrings fuer das aktuelle Dokument */
2016 cbradney 1006
        DocumentInformation documentInfo;
1065 cbradney 1007
        int appMode;
123 Franz 1008
        int SubMode;
1009
        double *ShapeValues;
1010
        int ValCount;
168 Franz 1011
        QString DocName;
3544 avox 1012
        QMap<QString,int> UsedFonts;
3983 craig 1013
        SCFonts * const AllFonts;
9767 cbradney 1014
        QList<AlignObjs> AObjects;
168 Franz 1015
        QColor papColor;
1016
        int CurrentSel;
5559 avox 1017
        ParagraphStyle currentStyle;
1018
 
10532 avox 1019
        NodeEditContext nodeEdit;
1020
 
2889 cbradney 1021
        typoPrefs typographicSettings;
1065 cbradney 1022
        guidesPrefs guidesSettings;
1194 fschmid 1023
        toolPrefs toolSettings;
3097 cbradney 1024
        QMap<QString, checkerPrefs> checkerProfiles;
1261 fschmid 1025
        QString curCheckProfile;
5087 subik 1026
        /** \brief Letztes Element fuer AutoTextrahmen */
168 Franz 1027
        PageItem *LastAuto;
5087 subik 1028
        /** \brief Erstes Element fuer AutoTextrahmen */
168 Franz 1029
        PageItem *FirstAuto;
1030
        bool DragP;
227 Franz 1031
        bool leaveDrag;
168 Franz 1032
        PageItem *DraggedElem;
1033
        PageItem *ElemToLink;
9803 fschmid 1034
        QList<uint> DragElements;
7442 avox 1035
private:
5980 avox 1036
        StyleSet<ParagraphStyle> docParagraphStyles;
1037
        StyleSet<CharStyle> docCharStyles;
7442 avox 1038
public:
10140 jghali 1039
        ScLayers Layers;
1065 cbradney 1040
        bool marginColored;
168 Franz 1041
        int GroupCounter;
1065 cbradney 1042
        CMSData CMSSettings;
15706 jghali 1043
        ScColorProfile DocInputImageRGBProf;
1044
        ScColorProfile DocInputImageCMYKProf;
1045
        ScColorProfile DocInputRGBProf;
1046
        ScColorProfile DocInputCMYKProf;
1047
        ScColorProfile DocOutputProf;
1048
        ScColorProfile DocPrinterProf;
1049
        ScColorTransform stdTransRGBMon;
1050
        ScColorTransform stdTransCMYKMon;
1051
        ScColorTransform stdProof;
1052
        ScColorTransform stdTransImg;
1053
        ScColorTransform stdProofImg;
1054
        ScColorTransform stdProofImgCMYK;
1055
        ScColorTransform stdTransCMYK;
1056
        ScColorTransform stdProofCMYK;
1057
        ScColorTransform stdTransRGB;
1058
        ScColorTransform stdProofGC;
1059
        ScColorTransform stdProofCMYKGC;
10338 jghali 1060
        bool BlackPoint;
1330 fschmid 1061
        bool SoftProofing;
1062
        bool Gamut;
15706 jghali 1063
        eRenderIntent IntentColors;
1064
        eRenderIntent IntentImages;
168 Franz 1065
        bool HasCMS;
3 paul 1066
        QMap<QString,QString> JavaScripts;
1067
        int TotalItems;
1068
        int MinWordLen;
249 Franz 1069
        int HyCount;
3 paul 1070
        QString Language;
1071
        bool Automatic;
1072
        bool AutoCheck;
1545 cbradney 1073
        PDFOptions PDF_Options;
7104 fschmid 1074
        PrintOptions Print_Options;
3 paul 1075
        bool RePos;
3201 subik 1076
        struct BookMa {
168 Franz 1077
                                        QString Title;
1078
                                        QString Text;
1079
                                        QString Aktion;
4679 fschmid 1080
                                        PageItem *PageObject;
168 Franz 1081
                                        int Parent;
1082
                                        int ItemNr;
1083
                                        int First;
1084
                                        int Last;
1085
                                        int Prev;
1086
                                        int Next;
1087
                                        };
9803 fschmid 1088
        QList<BookMa> BookMarks;
3 paul 1089
        bool OldBM;
1090
        bool hasName;
1091
        int RotMode;
1092
        bool AutoSave;
734 fschmid 1093
        int AutoSaveTime;
3984 craig 1094
        QTimer * const autoSaveTimer;
27 Franz 1095
        QMap<QString,multiLine> MLineStyles;
9803 fschmid 1096
        QList<ArrowDesc> arrowStyles;
6368 fschmid 1097
        QMap<QString, ScPattern> docPatterns;
59 Franz 1098
        QWidget* WinHan;
63 Franz 1099
        bool DoDrawing;
8220 fschmid 1100
        struct OpenNodesList
1101
        {
1102
                int type;
1103
                Page *page;
1104
                PageItem *item;
1105
        };
9803 fschmid 1106
        QList<OpenNodesList> OpenNodes;
139 Franz 1107
        QTimer *CurTimer;
5674 fschmid 1108
        QMap<int, errorCodes> docLayerErrors;
1229 fschmid 1109
        QMap<int, errorCodes> docItemErrors;
1232 fschmid 1110
        QMap<int, errorCodes> masterItemErrors;
1641 cbradney 1111
        //Attributes to be applied to frames
1649 cbradney 1112
        ObjAttrVector docItemAttributes;
1694 cbradney 1113
        ToCSetupVector docToCSetups;
3757 cbradney 1114
        DocumentSectionMap sections;
2353 fschmid 1115
        FPointArray symReturn;
1116
        FPointArray symNewLine;
1117
        FPointArray symTab;
1118
        FPointArray symNonBreak;
2389 fschmid 1119
        FPointArray symNewCol;
1120
        FPointArray symNewFrame;
3263 cbradney 1121
 
5781 cbradney 1122
        Hyphenator * docHyphenator;
3263 cbradney 1123
private:
11576 avox 1124
        UndoTransaction* m_itemCreationTransaction;
1125
        UndoTransaction* m_alignTransaction;
1126
 
11625 jghali 1127
        Page* m_currentPage;
10532 avox 1128
        UpdateManager m_updateManager;
1129
        MassObservable<PageItem*> m_itemsChanged;
1130
        MassObservable<Page*> m_pagesChanged;
10701 avox 1131
        MassObservable<QRectF> m_regionsChanged;
10532 avox 1132
        DocUpdater* m_docUpdater;
3695 cbradney 1133
 
1134
signals:
1135
        //Lets make our doc talk to our GUI rather than confusing all our normal stuff
1136
        /**
4584 cbradney 1137
         * @brief Let the document tell whatever is listening that it has changed
1138
         */
4738 cbradney 1139
        void docChanged();
4688 cbradney 1140
        void updateContents();
7736 cbradney 1141
        void updateContents(const QRect &r);
4585 cbradney 1142
        void refreshItem(PageItem *);
4672 cbradney 1143
        void canvasAdjusted(double width, double height, double dX, double dY);
4688 cbradney 1144
        void firstSelectedItemType(int);
1145
        void setApplicationMode(int);
4584 cbradney 1146
        /**
3695 cbradney 1147
         * @brief A signal for when the outline palette needs to rebuild itself
1148
         * Emit when:
1149
         * - An item is created or deleted
1150
         * - An item changes page
1151
         * - An page is created or deleted
1152
         * - Some items are grouped or a group is ungrouped
1153
         * This also applies to Master Pages
1154
         */
1155
        void signalRebuildOutLinePalette();
7736 cbradney 1156
        //! Temporary signal for SizeItem
1157
        void widthAndHeight(double, double);
4688 cbradney 1158
 
1159
public slots:
1160
        void itemSelection_ToggleLock();
1161
        void itemSelection_ToggleSizeLock();
1162
        void itemSelection_ToggleImageShown();
4698 cbradney 1163
        void itemSelection_TogglePrintEnabled();
4705 cbradney 1164
        void itemSelection_ChangePreviewResolution(int id);
13075 subik 1165
 
1166
        /*! \brief Change display quality of all images in document.
1167
        \author  OssiLehtinen
1168
        */
1169
        void allItems_ChangePreviewResolution(int id);
1170
 
4855 cbradney 1171
        void itemSelection_ClearItem(Selection* customSelection=0);
6601 cbradney 1172
        //! 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
1173
        void itemSelection_DeleteItem(Selection* customSelection=0, bool forceDeletion=false);
16608 craig 1174
        void itemSelection_SetItemTextReversed(bool reversed);
4713 cbradney 1175
        void itemSelection_SetItemFillTransparency(double t);
1176
        void itemSelection_SetItemLineTransparency(double t);
5746 fschmid 1177
        void itemSelection_SetItemFillBlend(int t);
1178
        void itemSelection_SetItemLineBlend(int t);
6578 cbradney 1179
        void itemSelection_SetLineGradient(VGradient& newGradient, Selection* customSelection=0);
1180
        void itemSelection_SetFillGradient(VGradient& newGradient, Selection* customSelection=0);
10335 jghali 1181
        void itemSelection_SetOverprint(bool overprint, Selection* customSelection=0);
6578 cbradney 1182
        void itemSelection_ApplyImageEffects(ScImageEffectList& newEffectList, Selection* customSelection=0);
4699 cbradney 1183
        void itemSelection_FlipH();
1184
        void itemSelection_FlipV();
4713 cbradney 1185
        void itemSelection_DoHyphenate();
1186
        void itemSelection_DoDeHyphenate();
1187
        void itemSelection_SendToLayer(int layerNumber);
4847 cbradney 1188
        void itemSelection_SetImageOffset(double x, double y, Selection* customSelection=0);
1189
        void itemSelection_SetImageScale(double x, double y, Selection* customSelection=0);
1190
        void itemSelection_SetImageScaleAndOffset(double ox, double oy, double sx, double sy, Selection* customSelection=0);
15219 cbradney 1191
        void itemSelection_AlignItemLeft(int i, double newX, AlignMethod how);
1192
        void itemSelection_AlignItemRight(int i, double newX, AlignMethod how);
1193
        void itemSelection_AlignItemTop(int i, double newY, AlignMethod how);
1194
        void itemSelection_AlignItemBottom(int i, double newY, AlignMethod how);
1195
        void itemSelection_AlignLeftOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1196
        void itemSelection_AlignRightOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1197
        void itemSelection_AlignBottomIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1198
        void itemSelection_AlignRightIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1199
        void itemSelection_AlignBottomOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1200
        void itemSelection_AlignCenterHor(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1201
        void itemSelection_AlignLeftIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1202
        void itemSelection_AlignCenterVer(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1203
        void itemSelection_AlignTopOut(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
1204
        void itemSelection_AlignTopIn(AlignTo currAlignTo, AlignMethod currAlignMethod, double guidePosition);
15236 cbradney 1205
        void itemSelection_DistributeDistH(bool usingDistance=false, double distance=0.0, bool reverseDistribute=false);
6488 cbradney 1206
        void itemSelection_DistributeAcrossPage(bool useMargins=false);
5334 cbradney 1207
        void itemSelection_DistributeRight();
1208
        void itemSelection_DistributeBottom();
1209
        void itemSelection_DistributeCenterH();
15236 cbradney 1210
        void itemSelection_DistributeDistV(bool usingDistance=false, double distance=0.0, bool reverseDistribute=false);
6488 cbradney 1211
        void itemSelection_DistributeDownPage(bool useMargins=false);
5334 cbradney 1212
        void itemSelection_DistributeLeft();
1213
        void itemSelection_DistributeCenterV();
1214
        void itemSelection_DistributeTop();
6657 cbradney 1215
        void itemSelection_MultipleDuplicate(ItemMultipleDuplicateData&);
7739 cbradney 1216
        void itemSelection_UniteItems(Selection* customSelection=0);
1217
        void itemSelection_SplitItems(Selection* customSelection=0);
1218
        /**
1219
         * Adjust an image frame's size to fit the size of the image in it
1220
         */
12420 cbradney 1221
        void itemSelection_AdjustFrametoImageSize(Selection* customSelection=0);
12591 fschmid 1222
        /**
1223
         * Adjust an image size to fit the size of the frame
1224
         */
1225
        void itemSelection_AdjustImagetoFrameSize(Selection* customSelection=0);
7676 cbradney 1226
        //! @brief startArrowID or endArrowID of -1 mean not applying a selection at this point.
1227
        void itemSelection_ApplyArrowHead(int startArrowID=-1, int endArrowID=-1, Selection* customSelection=0);
6414 fschmid 1228
 
12420 cbradney 1229
        void itemSelection_SetItemPen(QString farbe);
1230
        void itemSelection_SetItemPenShade(int sha);
1231
        void itemSelection_SetItemBrush(QString farbe);
1232
        void itemSelection_SetItemBrushShade(int sha);
1233
        void itemSelection_SetItemGradFill(int typ);
1234
        void itemSelection_SetItemPatternFill(QString pattern);
1235
        void itemSelection_SetItemPatternProps(double scaleX, double scaleY, double offsetX, double offsetY, double rotation);
6414 fschmid 1236
 
13349 jghali 1237
        void undoRedoBegin();
1238
        void undoRedoDone();
1239
 
4688 cbradney 1240
        void updatePic();
1241
        void updatePict(QString name);
12660 fschmid 1242
        void updatePictDir(QString name);
4688 cbradney 1243
        void removePict(QString name);
3 paul 1244
};
1245
 
13170 jghali 1246
Q_DECLARE_METATYPE(ScribusDoc*);
1247
 
3 paul 1248
#endif