~ubuntu-branches/debian/sid/scribus/sid

« back to all changes in this revision

Viewing changes to .pc/qreal_double.patch/scribus/scribusdoc.h

  • Committer: Package Import Robot
  • Author(s): Mattia Rizzolo
  • Date: 2013-12-21 16:13:37 UTC
  • Revision ID: package-import@ubuntu.com-20131221161337-6pseqv3sa41puz12
Tags: 1.4.2.dfsg+r18267-1.1
* Non-maintainer upload.
* debian/patch/qreal_double.patch: Avoid qreal/double clashes on ARM
  (imported from Ubuntu). (Closes: #707882)

Show diffs side-by-side

added added

removed removed

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