Subversion Repositories Scribus

Rev

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