Subversion Repositories Scribus

Rev

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