Subversion Repositories Scribus

Rev

Rev 4672 | Rev 4688 | 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
29
#include <qobject.h>
30
#include <qdict.h>
31
#include <qcolor.h>
32
#include <qvaluelist.h>
27 Franz 33
#include <qvaluevector.h>
1179 tsoots 34
#include <qpixmap.h>
3 paul 35
#include <qptrlist.h>
36
#include <qfont.h>
37
#include <qmap.h>
38
#include <qpointarray.h>
39
#include <qstringlist.h>
40
#include <qtimer.h>
838 cbradney 41
 
2969 craig 42
#include "scribusapi.h"
2948 cbradney 43
#include "scribusstructs.h"
2834 cbradney 44
#include "prefsstructs.h"
2016 cbradney 45
#include "documentinformation.h"
1179 tsoots 46
#include "undoobject.h"
3724 cbradney 47
#include "page.h"
3263 cbradney 48
#include "pageitem.h"
3617 cbradney 49
#include "pageitem_line.h"
50
#include "pageitem_textframe.h"
3757 cbradney 51
#include "pagestructs.h"
3179 cbradney 52
 
3903 cbradney 53
 
3 paul 54
#ifdef HAVE_CMS
44 Franz 55
        #include CMS_INC
3 paul 56
#endif
57
 
68 Franz 58
#include <ft2build.h>
59
#include FT_FREETYPE_H
3020 cbradney 60
 
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;
3 paul 67
 
3942 cbradney 68
class QProgressBar;
3 paul 69
 
3942 cbradney 70
 
4650 subik 71
/**! \brief the Document Class
3 paul 72
  */
2969 craig 73
class SCRIBUS_API ScribusDoc : public QObject, public UndoObject
3 paul 74
{
3082 fschmid 75
        Q_OBJECT
76
 
3 paul 77
public:
2891 cbradney 78
        ScribusDoc();
79
        ~ScribusDoc();
2901 fschmid 80
        void setup(const int, const int, const int, const int, const int, const QString&, const QString&);
2891 cbradney 81
        void setLoading(const bool);
3985 cbradney 82
        bool isLoading() const;
2891 cbradney 83
        void setModified(const bool);
84
        bool isModified() const;
85
/** Setzt die Seitenattribute */
2894 fschmid 86
        void setPage(double b, double h, double t, double l, double r, double bo, double sp, double ab, bool atf, int fp);
87
        void resetPage(double t, double l, double r, double bo, int fp);
4320 cbradney 88
 
89
        /**
90
         * @brief Return the view associated with the document
91
         */
92
        ScribusView* view() const;
3792 cbradney 93
 
2937 cbradney 94
        // Add, delete and move pages
3852 cbradney 95
 
96
        Page* addPage(const int pageNumber, const QString& masterPageName=QString::null, const bool addAutoFrame=false);
4069 craig 97
        void deleteMasterPage(const int);
98
        void deletePage(const int);
3792 cbradney 99
        /**
100
         * @brief Add a master page with this function, do not use addPage
101
         */
3695 cbradney 102
        Page* addMasterPage(const int, const QString&);
3860 cbradney 103
 
3852 cbradney 104
        /**
3860 cbradney 105
         * @brief Add the automatic text frame to the page
4645 subik 106
         * @param pageNumber page number
3860 cbradney 107
         * @return number of frame
3852 cbradney 108
         */
4645 subik 109
        int addAutomaticTextFrame(const int pageNumber);
3531 cbradney 110
        /**
3852 cbradney 111
         * Set the left and right margins based on the location of the page
112
         * @param pageIndex
113
         */
114
        void setLocationBasedPageLRMargins(uint pageIndex);
115
        /**
3531 cbradney 116
         * @brief Move page(s) within the document
4650 subik 117
         * @param from page index
118
         * @param to page index
119
         * @param ziel target to move to (page index)
120
         * @param art Before, After or at the end
3531 cbradney 121
         */
4650 subik 122
        void movePage(const int from, const int to, const int ziel, const int art);
3843 cbradney 123
 
124
        /**
125
         * @brief Copy a page (pageNumberToCopy) copyCount times, whereToInsert(before or after) the existingPage or at the end.
126
         * @param pageNumberToCopy
127
         * @param existingPage
128
         * @param whereToInsert
129
         * @param copyCount
130
         */
131
        void copyPage(int pageNumberToCopy, int existingPage, int whereToInsert, int copyCount);
132
 
2937 cbradney 133
        // Add, delete and move layers
3201 subik 134
        /**
2947 cbradney 135
         * @brief Add a layer to the current document
4645 subik 136
         * @param layerName name of layer
4650 subik 137
         * @param activate the layer active
2947 cbradney 138
         * @return Number of the layer created
139
         */
4645 subik 140
        int addLayer(const QString& layerName=QString::null, const bool activate=false);
3201 subik 141
        /**
2947 cbradney 142
         * @brief Delete a layer from the current document
4645 subik 143
         * @param layerNumber of layer
144
         * @param deleteItems the items on the layer too?
2947 cbradney 145
         * @return Success or failure
146
         */
4645 subik 147
        bool deleteLayer(const int layerNumber, const bool deleteItems);
2947 cbradney 148
        /**
149
         * @brief Return the number of the current layer
150
         * @return Active layer number
151
         */
3985 cbradney 152
        int activeLayer();
3201 subik 153
 
2947 cbradney 154
        /**
155
         * @brief Return the name of the current layer
156
         * @return Name of the layer
157
         */
2937 cbradney 158
        const QString& activeLayerName();
2947 cbradney 159
        /**
160
         * @brief Set the active layer via the layer number
4650 subik 161
         * @param layerToActivate Number of the layer
2947 cbradney 162
         * @return Success or failure
163
         */
4650 subik 164
        bool setActiveLayer(const int layerToActivate);
2947 cbradney 165
        /**
166
         * @brief Set the active layer via the layer name
4650 subik 167
         * @param layerNameToActivate Name of the layer
2947 cbradney 168
         * @return Success or failure
169
         */
4650 subik 170
        bool setActiveLayer(const QString & layerNameToActivate);
2947 cbradney 171
        /**
172
         * @brief Set the layer printable via the layer number
4650 subik 173
         * @param layerNumber Number of the layer
174
         * @param isPrintable bool true = layer is prantable
2947 cbradney 175
         * @return Success or failure
176
         */
4650 subik 177
        bool setLayerPrintable(const int layerNumber, const bool isPrintable);
2947 cbradney 178
        /**
179
         * @brief Is the layer printable
4650 subik 180
         * @param layerNumber Number of the layer
2947 cbradney 181
         * @return Printable or not
182
         */
4650 subik 183
        bool layerPrintable(const int layerNumber);
2947 cbradney 184
        /**
185
         * @brief Set the layer visible via the layer number
4650 subik 186
         * @param layerNumber Number of the layer
187
         * @param isViewable true = layer is visible
2947 cbradney 188
         * @return Success or failure
189
         */
4650 subik 190
        bool setLayerVisible(const int layerNumber, const bool isViewable);
2947 cbradney 191
        /**
192
         * @brief Is the layer visible
4650 subik 193
         * @param layerNumber Number of the layer
2947 cbradney 194
         * @return Visible or not
195
         */
4650 subik 196
        bool layerVisible(const int layerNumber);
2947 cbradney 197
        /**
198
         * @brief Return the level of the requested layer
4650 subik 199
         * @param layerNumber Number of the layer
2947 cbradney 200
         * @return Level of the layer
201
         */
4650 subik 202
        int layerLevelFromNumber(const int layerNumber);
2947 cbradney 203
        /**
204
         * @brief Return the number of the layer at a certain level
4650 subik 205
         * @param layerLevel Layer level
2947 cbradney 206
         * @return Layer number
207
         */
4650 subik 208
        int layerNumberFromLevel(const int layerLevel);
2947 cbradney 209
        /**
210
         * @brief Return the layer count
211
         * @return Number of layers in doc
212
         */
3985 cbradney 213
        int layerCount() const;
2947 cbradney 214
        /**
215
         * @brief Lower a layer
4650 subik 216
         * @param layerNumber Number of the layer
2947 cbradney 217
         * @return Success or failure
218
         */
4650 subik 219
        bool lowerLayer(const int layerNumber);
2947 cbradney 220
        /**
221
         * @brief Lower a layer using the level
4650 subik 222
         * @param layerLevel Level of the layer
2947 cbradney 223
         * @return Success or failure
224
         */
4650 subik 225
        bool lowerLayerByLevel(const int layerLevel);
2947 cbradney 226
        /**
227
         * @brief Raise a layer
4650 subik 228
         * @param layerNumber Number of the layer
2947 cbradney 229
         * @return Success or failure
230
         */
4650 subik 231
        bool raiseLayer(const int layerNumber);
2947 cbradney 232
        /**
233
         * @brief Raise a layer using the level
4650 subik 234
         * @param layerLevel Level of the layer
2947 cbradney 235
         * @return Success or failure
236
         */
4650 subik 237
        bool raiseLayerByLevel(const int layerLevel);
2947 cbradney 238
        /**
239
         * @brief Return the layer name
4650 subik 240
         * @param layerNumber Number of the layer
3201 subik 241
         * @return Name of the layer
2947 cbradney 242
         */
4650 subik 243
        const QString &layerName(const int layerNumber) const;
2947 cbradney 244
        /**
245
         * @brief Change the name of a layer
4645 subik 246
         * @param layerNumber number of the layer
247
         * @param newName new name of the layer
2947 cbradney 248
         * @return Success or failure
249
         */
4645 subik 250
        bool changeLayerName(const int layerNumber, const QString& newName);
2947 cbradney 251
        /**
252
         * @brief Does the layer have items on it?
4650 subik 253
         * @param layerNumber Number of the layer
2947 cbradney 254
         * @return Layer contains items bool
255
         */
4650 subik 256
        bool layerContainsItems(const int layerNumber);
2947 cbradney 257
        /**
258
         * @brief Renumber a layer. Used in particular for reinsertion for undo/redo
4650 subik 259
         * @param layerNumber old layer number
260
         * @param newLayerNumber New layer number
2947 cbradney 261
         * @return Success or failure
262
         */
4650 subik 263
        bool renumberLayer(const int layerNumber, const int newLayerNumber);
2947 cbradney 264
        /**
265
         * @brief Return a list of the layers in their order
4650 subik 266
         * @param list QStringList to insert the layer names into
2947 cbradney 267
         */
4650 subik 268
        void orderedLayerList(QStringList* list);
2937 cbradney 269
        //Items
3985 cbradney 270
        bool deleteTaggedItems();
3201 subik 271
 
3544 avox 272
        bool AddFont(QString name, int fsize = 10);
1330 fschmid 273
        void OpenCMSProfiles(ProfilesL InPo, ProfilesL MoPo, ProfilesL PrPo);
274
        void CloseCMSProfiles();
1065 cbradney 275
        void loadStylesFromFile(QString fileName, QValueList<ParagraphStyle> *tempStyles = NULL);
3201 subik 276
        /**
1179 tsoots 277
         * @brief Should guides be locked or not
278
         * @param isLocked If true guides on pages cannot be moved if false they
279
         * can be dragged to new positions.
280
         * @author Riku Leino
281
         */
282
        void lockGuides(bool isLocked);
1190 tsoots 283
        /**
1179 tsoots 284
         * @brief Method used when an undo/redo is requested.
285
         * @param state State describing the action that is wanted to be undone/redone
286
         * @param isUndo If true undo is wanted else if false redo.
287
         * @author Riku Leino
288
         */
289
        void restore(UndoState* state, bool isUndo);
290
        /**
291
         * @brief Sets the name of the document
292
         * @param name Name for the document
293
         * @author Riku Leino
294
         */
295
        void setName(const QString& name);
1694 cbradney 296
        /*!
297
         * @brief Returns a stringlist of the item attributes within the document
298
         */
299
        QStringList getItemAttributeNames();
3201 subik 300
 
2960 cbradney 301
        /*!
302
         * @brief Returns a qmap of the fonts used within the document
303
         */
3544 avox 304
        void getUsedFonts(QMap<QString,int> *Really);
2960 cbradney 305
        /*!
3057 fschmid 306
        * @brief Builds a qmap of the colours used within the document
307
        */
3068 fschmid 308
        void getUsedColors(ColorList &colorsToUse, bool spot = false);
3057 fschmid 309
        /*!
2960 cbradney 310
         * @brief TODO: Reorganise the fonts.. how? Moved from scribus.cpp
311
         */
312
        void reorganiseFonts();
2965 cbradney 313
        /**
314
         * @brief Set and get the document's unit index
315
         */
316
        void setUnitIndex(const int);
3985 cbradney 317
        int unitIndex() const;
318
        double unitRatio() const;
3004 cbradney 319
        /**
320
         * @brief Apply a master page
321
         */
3985 cbradney 322
        bool applyMasterPage(const QString& in, const int);
3004 cbradney 323
        /**
324
         * @brief Undo function for applying a master page
325
         */
326
        void restoreMasterPageApplying(SimpleState *state, bool isUndo);
3020 cbradney 327
        /**
328
         * @brief Save function
329
         */
3985 cbradney 330
        bool save(const QString&);
3025 cbradney 331
        /**
332
         * @brief Set the page margins. Current code uses current page only, also provide a (currently, TODO) option for this.
333
         */
3985 cbradney 334
        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 335
        /**
336
         * @brief Recalculate the colors after CMS settings change. Update the items in the doc accordingly.
337
         */
338
         void recalculateColors();
3179 cbradney 339
        /**
340
         * @brief Sets up the ScText defaults from the document
341
         */
342
        void setScTextDefaultsFromDoc(ScText *);
3200 cbradney 343
        /**
344
         * @brief Copies a normal page to be a master pages
345
         */
3650 cbradney 346
        const bool copyPageToMasterPage(const int, const int, const int, const QString&);
3263 cbradney 347
        /**
348
         * @brief Paste an item to the document.
349
         * The bulk of a paste item process runs here for want of a better place, but its a better place
350
         * than the view where it used to be.
351
         * TODO Once the pageitem restructure is done, this is probably unnecessary but it removes the
352
         * unnecessary part from the view for now which is overloaded with non ScrollView code.
353
         */
354
        //TODO: void PasteItem(struct CopyPasteBuffer *Buffer, bool loading, bool drag = false);
355
 
356
        /**
357
         * @brief Add an Item to the document.
358
         * A simple function to create an item of a defined type and add it to the document
359
         * Will need extensive rewriting once we have various classes of PageItems, at a guess.
360
         *
361
         * @param itemFinalised Used to handle item creation for undo while the user is still dragging.
362
         * @return Number of created item, -1 on failure.
4650 subik 363
        \param itemType type
364
        \param frameType frame type
365
        \param x X pos
366
        \param y Y pos
367
        \param b width
368
        \param h height
369
        \param w ?
370
        \param fill fill color name
371
        \param outline outline color name
372
        */
3263 cbradney 373
        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);
374
 
375
        /**
376
         * @brief Commit item creation when a user has click-drag created an item
377
         * Only called from ScribusView. Note the undo target is the page, so the undo code remains their for now.
378
         * @return If an item was committed and the view must emit its signal, which needs removing from here, TODO.
379
         */
380
        bool itemAddCommit(const int itemNumber);
381
 
382
        /**
383
         * @brief Finalise item creation. Simply split off code from itemAdd
384
         * Only to be called from itemAdd()
385
         */
386
        void itemAddDetails(const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, const int itemNumber);
387
 
388
        //itemDelete
389
        //itemBlah...
3628 cbradney 390
 
391
        /**
392
         * @brief Run this common frame item update code
393
         */
394
        void updateFrameItems();
3648 cbradney 395
 
396
        /**
397
         * @brief Doc uses automatic text frames?
398
         */
3985 cbradney 399
        bool usesAutomaticTextFrames() const;
3648 cbradney 400
        void setUsesAutomaticTextFrames(const bool);
3650 cbradney 401
 
402
        /**
403
         * @brief Load images into an image frame, moved from the view
404
         * @retval Return false on failure
405
         */
3985 cbradney 406
        bool LoadPict(QString fn, int ItNr, bool reload = false);
3942 cbradney 407
        /**
408
         *
409
         * @param fn
410
         * @param pageItem
411
         * @param reload
412
         * @return
413
         */
3985 cbradney 414
        bool loadPict(QString fn, PageItem *pageItem, bool reload = false);
3656 cbradney 415
        /**
4650 subik 416
         * \brief Handle image with color profiles
417
         * @param Pr profile
418
           @param PrCMYK cmyk profile
419
           @param dia optional progress widget
3942 cbradney 420
         */
421
        void RecalcPictures(ProfilesL *Pr, ProfilesL *PrCMYK, QProgressBar *dia = 0);
422
        /**
3656 cbradney 423
         * @brief Find the minX,MinY and maxX,maxY for the canvas required for the doc
424
         */
425
        void canvasMinMax(FPoint&, FPoint&);
3657 cbradney 426
 
427
        int OnPage(double x2, double  y2);
428
        int OnPage(PageItem *currItem);
429
        void GroupOnPage(PageItem *currItem);
4672 cbradney 430
        //void reformPages(double& maxX, double& maxY, bool moveObjects = true);
431
        void reformPages(bool moveObjects = true);
3664 cbradney 432
 
433
        /**
3670 cbradney 434
         * @brief Return the x or y offset for a page on the canvas
435
         * @retval double containing the offset. Returns -1.0 if page not in Pages list (as -ve is not possible).
436
         * Mostly saves bringing in extra includes into files that already have scribusdoc.h
3664 cbradney 437
         */
438
        const double getXOffsetForPage(const int);
439
        const double getYOffsetForPage(const int);
3670 cbradney 440
 
441
        /**
442
         * @brief Item type conversion functions
443
         */
3676 cbradney 444
        PageItem* convertItemTo(PageItem *currItem, PageItem::ItemType newType, PageItem* secondaryItem=NULL);
3670 cbradney 445
 
446
        /**
447
         * @brief The page number of the current page
448
         */
449
        const int currentPageNumber();
3689 cbradney 450
 
451
        /**
452
         * @brief Return true iff the passed name is not used by any existing PageItem
453
         *        in the same document as this PageItem.
454
         * @author Craig Ringer
455
         ** CB Moved from PageItem
456
         */
457
        bool itemNameExists(const QString itemName);
3724 cbradney 458
 
459
        /**
460
         * @brief Set the doc into Master page mode
461
         * Do we need to return if the move to master page mode was successful?
462
         */
463
        void setMasterPageMode(const bool);
4061 craig 464
 
465
        /*** Is the document in master page mode? */
466
        bool masterPageMode() const { return m_masterPageMode; }
3757 cbradney 467
 
468
        /**
469
         * @brief Add a section to the document sections list
3776 cbradney 470
         * Set number to -1 to add in the default section if the map is empty
3757 cbradney 471
         */
3776 cbradney 472
        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 473
        /**
474
         * @brief Delete a section from the document sections list
475
         */
3985 cbradney 476
        bool deleteSection(const uint);
3757 cbradney 477
        /**
478
         * @brief Gets the page number to be printed based on the section it is in.
479
         * Returns QString::null on failure to find the pageIndex
480
         */
481
        const QString getSectionPageNumberForPageIndex(const uint) const;
3776 cbradney 482
        /**
483
         * @brief Gets the key of the sections map based on the section the page index is in.
484
         * Returns -1 on failure to find the pageIndex
485
         */
3985 cbradney 486
        int getSectionKeyForPageIndex(const uint pageIndex) const;
3778 cbradney 487
        /**
488
         *
489
         *
490
         */
491
        void updateSectionPageNumbersToPages();
3792 cbradney 492
        /**
493
         *
494
         *
495
         */
3894 cbradney 496
        /**
497
         *
498
         * @param otherPageIndex
499
         * @param location
500
         * @param count
501
         */
3792 cbradney 502
        void addPageToSection(const uint otherPageIndex, const uint location, const uint count=1);
3894 cbradney 503
        /**
504
         *
505
         * @param pageIndex
506
         */
3793 cbradney 507
        void removePageFromSection(const uint pageIndex);
3894 cbradney 508
        /**
509
         *
510
         */
3793 cbradney 511
        void setFirstSectionFromFirstPageNumber();
3894 cbradney 512
        /**
513
         * @brief Update the fill and line QColors for all items in the doc
514
         */
515
        void updateAllItemQColors();
3942 cbradney 516
        /**
517
         *
518
         */
519
        void buildAlignItemList();
4010 cbradney 520
        /**
4650 subik 521
         * \brief Insert a color into the documents color list
4010 cbradney 522
         * @param nam Name of the colour
523
         * @param c Cyan component
524
         * @param m Magenta component
525
         * @param y Yellow component
526
         * @param k Black component
527
         */
528
        void insertColor(QString nam, double c, double m, double y, double k);
4110 cbradney 529
 
530
        QMap<QString, double>& constants() { return m_constants; }
4122 cbradney 531
        /**
4650 subik 532
         * \brief Get the location of the page on the canvas, ie, left, middle, or right
4122 cbradney 533
         * Does not give information about middle left, etc.
4650 subik 534
         * @param pageIndex Index of page to find location for
4122 cbradney 535
         * @return LeftPage, MiddlePage, RightPage, enum from pagestructs.h
536
         */
4650 subik 537
        PageLocation locationOfPage(int pageIndex);
4301 cbradney 538
 
539
        bool sendItemSelectionToBack();
540
        bool bringItemSelectionToFront();
4584 cbradney 541
 
542
        void ChLineWidth(double w);
543
        void ChLineArt(PenStyle w);
544
        void ChLineJoin(PenJoinStyle w);
545
        void ChLineEnd(PenCapStyle w);
546
        void ChLineSpa(double w);
547
        void ChLineSpaMode(int w);
548
        void ChLocalXY(double x, double y);
549
        void ChLocalSc(double x, double y);
550
        void ItemFont(QString fon);
551
        void ItemPen(QString farbe);
552
        void ItemTextBrush(QString farbe);
553
        void ItemTextBrushS(int sha);
554
        void ItemTextPen(QString farbe);
555
        void ItemTextPenS(int sha);
556
        void ItemTextScaleV(int sha);
557
        void ItemTextScale(int sha);
558
        void setItemTextBase(int sha);
559
        void setItemTextOutline(int sha);
560
        void setItemTextShadow(int shx, int shy);
561
        void setItemTextUnderline(int pos, int wid);
562
        void setItemTextStrike(int pos, int wid);
563
        void ItemBrush(QString farbe);
564
        void ItemBrushShade(int sha);
565
        void ItemPenShade(int sha);
566
        void ItemGradFill(int typ);
567
        void chTyStyle(int s);
568
        void SetAbStyle(int s);
569
        void chAbStyle(PageItem *currItem, int s);
570
        void chKerning(int us);
571
        void chFSize(int size);
572
        void FlipImageH();
573
        void FlipImageV();
574
        void MirrorPolyH();
575
        void MirrorPolyV();
576
 
4672 cbradney 577
        void setRedrawBounding(PageItem *currItem);
578
        void adjustCanvas(FPoint minPos, FPoint maxPos, bool absolute = false);
579
 
580
        void connectDocSignals();
581
 
168 Franz 582
protected:
2891 cbradney 583
        void addSymbols();
3983 craig 584
        ApplicationPrefs& prefsData;
585
        UndoManager * const undoManager;
2891 cbradney 586
        bool loading;
2937 cbradney 587
        bool modified;
588
        int ActiveLayer;
2965 cbradney 589
        int docUnitIndex;
590
        double docUnitRatio;
3648 cbradney 591
        bool automaticTextFrames; // Flag for automatic Textframes
3724 cbradney 592
        bool m_masterPageMode;
4110 cbradney 593
        QMap<QString, double> m_constants;
3757 cbradney 594
 
168 Franz 595
public: // Public attributes
2937 cbradney 596
        bool is12doc; //public for now, it will be removed later
1330 fschmid 597
        int NrItems;
598
        int First;
599
        int Last;
600
        int viewCount;
601
        int viewID;
3 paul 602
        bool SnapGuides;
603
        bool GuideLock;
456 fschmid 604
        /** Scratch space around Pages */
605
        double ScratchLeft;
606
        double ScratchRight;
607
        double ScratchTop;
608
        double ScratchBottom;
2837 fschmid 609
/** Minimum and Maximum Points of Document */
610
        FPoint minCanvasCoordinate;
611
        FPoint maxCanvasCoordinate;
2867 fschmid 612
        double rulerXoffset;
613
        double rulerYoffset;
456 fschmid 614
  /** List of Pages */
3724 cbradney 615
        QPtrList<Page>* Pages;
2093 cbradney 616
  /** List of Master Pages */
456 fschmid 617
        QPtrList<Page> MasterPages;
618
  /** List of Document Pages */
619
        QPtrList<Page> DocPages;
2093 cbradney 620
  /** Mapping Master Page Name to Master Page numbers */
456 fschmid 621
        QMap<QString,int> MasterNames;
622
  /** List of Objects */
3727 cbradney 623
        QPtrList<PageItem>* Items;
456 fschmid 624
        QPtrList<PageItem> MasterItems;
625
        QPtrList<PageItem> DocItems;
2447 fschmid 626
        QPtrList<PageItem> FrameItems;
3942 cbradney 627
        /**List of objects for alignment purposes*/
4174 craig 628
        Selection * const selection;
456 fschmid 629
  /** Pagewidth  */
2142 cbradney 630
        double pageWidth;
456 fschmid 631
  /** Pageheight */
2142 cbradney 632
        double pageHeight;
456 fschmid 633
  /** Number of Pages */
4069 craig 634
        // int pageCount; Disabled CR no longer required
456 fschmid 635
  /** Margins */
2142 cbradney 636
        MarginStruct pageMargins;
3016 fschmid 637
        QValueList<PageSet> pageSets;
456 fschmid 638
  /** Number of Columns */
168 Franz 639
        double PageSp;
456 fschmid 640
  /** Distance of Columns */
168 Franz 641
        double PageSpa;
3032 fschmid 642
 /** current Pagelayout */
643
        int currentPageLayout;
3 paul 644
        /** Flag fuer Hoch- oder Querformat 0 = Hochformat */
3032 fschmid 645
        int PageOri;
519 cbradney 646
        QString PageSize;
3 paul 647
        /** Erste Seitennummer im Dokument */
648
        int FirstPnum;
649
  /** Flag fuer Rasterbenutzung */
168 Franz 650
        bool useRaster;
3 paul 651
  /** Im Dokument benutzte Farben */
1065 cbradney 652
        ColorList PageColors;
653
        Page* currentPage;
3 paul 654
  /** InfoStrings fuer das aktuelle Dokument */
2016 cbradney 655
        DocumentInformation documentInfo;
1065 cbradney 656
        int appMode;
123 Franz 657
        int SubMode;
658
        double *ShapeValues;
659
        int ValCount;
168 Franz 660
        QString DocName;
3544 avox 661
        QMap<QString,int> UsedFonts;
3983 craig 662
        SCFonts * const AllFonts;
663
        QValueList<AlignObjs> AObjects;
168 Franz 664
        QColor papColor;
665
        int CurrentSel;
666
        int CurrentStyle;
1065 cbradney 667
        int currentParaStyle;
68 Franz 668
        QString CurrFont;
669
        int CurrFontSize;
670
        QString CurrTextFill;
671
        int CurrTextFillSh;
672
        QString CurrTextStroke;
673
        int CurrTextStrokeSh;
674
        int CurrTextScale;
2230 fschmid 675
        int CurrTextScaleV;
2234 fschmid 676
        int CurrTextBase;
2247 fschmid 677
        int CurrTextShadowX;
678
        int CurrTextShadowY;
2257 fschmid 679
        int CurrTextOutline;
2262 fschmid 680
        int CurrTextUnderPos;
681
        int CurrTextUnderWidth;
2272 fschmid 682
        int CurrTextStrikePos;
683
        int CurrTextStrikeWidth;
168 Franz 684
        bool EditClip;
685
        int EditClipMode;
2889 cbradney 686
        typoPrefs typographicSettings;
1065 cbradney 687
        guidesPrefs guidesSettings;
1194 fschmid 688
        toolPrefs toolSettings;
3097 cbradney 689
        QMap<QString, checkerPrefs> checkerProfiles;
1261 fschmid 690
        QString curCheckProfile;
3 paul 691
  /** Letztes Element fuer AutoTextrahmen */
168 Franz 692
        PageItem *LastAuto;
3 paul 693
  /** Erstes Element fuer AutoTextrahmen */
168 Franz 694
        PageItem *FirstAuto;
695
        bool DragP;
227 Franz 696
        bool leaveDrag;
168 Franz 697
        PageItem *DraggedElem;
698
        PageItem *ElemToLink;
699
        QValueList<uint> DragElements;
1065 cbradney 700
        QValueList<ParagraphStyle> docParagraphStyles;
3 paul 701
        QValueList<Layer> Layers;
1065 cbradney 702
        bool marginColored;
168 Franz 703
        int GroupCounter;
1065 cbradney 704
        CMSData CMSSettings;
3 paul 705
#ifdef HAVE_CMS
706
        cmsHPROFILE DocInputProf;
707
        cmsHPROFILE DocOutputProf;
708
        cmsHPROFILE DocPrinterProf;
1330 fschmid 709
        cmsHTRANSFORM stdTrans;
710
        cmsHTRANSFORM stdProof;
711
        cmsHTRANSFORM stdTransImg;
712
        cmsHTRANSFORM stdProofImg;
1488 fschmid 713
        cmsHTRANSFORM stdTransCMYK;
714
        cmsHTRANSFORM stdProofCMYK;
715
        cmsHTRANSFORM stdTransRGB;
3046 fschmid 716
        cmsHTRANSFORM stdProofGC;
717
        cmsHTRANSFORM stdProofCMYKGC;
1330 fschmid 718
        bool SoftProofing;
719
        bool Gamut;
720
        int IntentMonitor;
721
        int IntentPrinter;
3 paul 722
#endif
168 Franz 723
        bool HasCMS;
3 paul 724
        QMap<QString,QString> JavaScripts;
725
        int TotalItems;
726
        int MinWordLen;
249 Franz 727
        int HyCount;
3 paul 728
        QString Language;
729
        bool Automatic;
730
        bool AutoCheck;
3724 cbradney 731
 
1545 cbradney 732
        PDFOptions PDF_Options;
3 paul 733
        bool RePos;
3201 subik 734
        struct BookMa {
168 Franz 735
                                        QString Title;
736
                                        QString Text;
737
                                        QString Aktion;
4679 fschmid 738
                                        PageItem *PageObject;
168 Franz 739
                                        int Parent;
740
                                        int ItemNr;
741
                                        int First;
742
                                        int Last;
743
                                        int Prev;
744
                                        int Next;
745
                                        };
3 paul 746
        QValueList<BookMa> BookMarks;
747
        bool OldBM;
748
        bool hasName;
749
        int RotMode;
750
        bool AutoSave;
734 fschmid 751
        int AutoSaveTime;
3984 craig 752
        QTimer * const autoSaveTimer;
3 paul 753
        FT_Library   library;
168 Franz 754
        QMap<QString,FT_Face> FFonts;
27 Franz 755
        QMap<QString,multiLine> MLineStyles;
1065 cbradney 756
        QValueList<ArrowDesc> arrowStyles;
59 Franz 757
        QWidget* WinHan;
63 Franz 758
        bool DoDrawing;
168 Franz 759
        QValueList<int> OpenNodes;
139 Franz 760
        QTimer *CurTimer;
1229 fschmid 761
        QMap<int, errorCodes> docItemErrors;
1232 fschmid 762
        QMap<int, errorCodes> masterItemErrors;
1641 cbradney 763
        //Attributes to be applied to frames
1649 cbradney 764
        ObjAttrVector docItemAttributes;
1694 cbradney 765
        ToCSetupVector docToCSetups;
3757 cbradney 766
        DocumentSectionMap sections;
2353 fschmid 767
        FPointArray symReturn;
768
        FPointArray symNewLine;
769
        FPointArray symTab;
770
        FPointArray symNonBreak;
2389 fschmid 771
        FPointArray symNewCol;
772
        FPointArray symNewFrame;
3263 cbradney 773
 
3987 craig 774
        Hyphenator * const docHyphenator;
3263 cbradney 775
private:
776
        bool _itemCreationTransactionStarted;
3695 cbradney 777
 
778
signals:
779
        //Lets make our doc talk to our GUI rather than confusing all our normal stuff
780
        /**
4584 cbradney 781
         * @brief Let the document tell whatever is listening that it has changed
782
         */
783
        void changed();
4585 cbradney 784
        void refreshItem(PageItem *);
4672 cbradney 785
        void canvasAdjusted(double width, double height, double dX, double dY);
4584 cbradney 786
        /**
3695 cbradney 787
         * @brief A signal for when the outline palette needs to rebuild itself
788
         * Emit when:
789
         * - An item is created or deleted
790
         * - An item changes page
791
         * - An page is created or deleted
792
         * - Some items are grouped or a group is ungrouped
793
         * This also applies to Master Pages
794
         */
795
        void signalRebuildOutLinePalette();
3 paul 796
};
797
 
798
#endif