Subversion Repositories Scribus

Rev

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