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.
7
/***************************************************************************
8
scribusdoc.h - description
10
begin : Fre Apr 6 21:47:55 CEST 2001
11
copyright : (C) 2001 by Franz Schmid
12
email : Franz.Schmid@altmuehlnet.de
13
***************************************************************************/
15
/***************************************************************************
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. *
22
***************************************************************************/
28
// include files for QT
36
#include <QStringList>
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"
48
#include "pagestructs.h"
49
#include "usertaskstructs.h"
50
#include "styles/styleset.h"
51
#include "scguardedptr.h"
52
#include "updatemanager.h"
55
#include "colormgmt/sccolorprofile.h"
56
#include "colormgmt/sccolortransform.h"
59
#include FT_FREETYPE_H
68
class ScribusMainWindow;
69
class ResourceCollection;
72
class UndoTransaction;
76
struct SCRIBUS_API NodeEditContext : public MassObservable<QPointF>
78
enum SubMode { MOVE_POINT = 0, ADD_POINT = 1, DEL_POINT = 2, SPLIT_PATH = 3 };
82
UndoTransaction* nodeTransaction;
96
bool hasNodeSelected();
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);
111
/**! \brief the Document Class
113
class SCRIBUS_API ScribusDoc : public QObject, public UndoObject, public Observable<ScribusDoc>
119
ScribusDoc(const QString& docName, int unitIndex, const PageSize& pagesize, const MarginStruct& margins, const DocPagesSetup& pagesSetup);
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);
132
* @brief Return the view associated with the document
134
ScribusView* view() const;
135
ScribusMainWindow* scMW() const {return m_ScMW;}
136
void setGUI(bool hasgui, ScribusMainWindow* mw, ScribusView* view);
139
* @brief Return the guarded object associated with the document
141
const ScGuardedPtr<ScribusDoc>& guardedPtr() const;
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; }
148
void invalidateAll();
149
void invalidateLayer(int layerID);
150
void invalidateRegion(QRectF region);
152
// Add, delete and move pages
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);
170
* @brief Add the automatic text frame to the page
171
* @param pageNumber page number
172
* @return number of frame
174
int addAutomaticTextFrame(const int pageNumber);
176
* Set the left and right margins based on the location of the page
179
void setLocationBasedPageLRMargins(uint pageIndex);
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
187
void movePage(const int fromPage, const int toPage, const int dest, const int position);
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
196
void copyPage(int pageNumberToCopy, int existingPage, int whereToInsert, int copyCount);
198
// Add, delete and move layers
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
205
int addLayer(const QString& layerName=QString::null, const bool activate=false);
207
* @brief Copies a layer from the current document
208
* @param layerNumberToCopy source layer
209
* @param whereToInsert target layer
210
* @return Success or failure
212
void copyLayer(int layerNumberToCopy, int whereToInsert);
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
219
bool deleteLayer(const int layerNumber, const bool deleteItems);
221
* @brief Return the number of the current layer
222
* @return Active layer number
227
* @brief Return the name of the current layer
228
* @return Name of the layer
230
const QString& activeLayerName();
232
* @brief Set the active layer via the layer number
233
* @param layerToActivate Number of the layer
234
* @return Success or failure
236
bool setActiveLayer(const int layerToActivate);
238
* @brief Set the active layer via the layer name
239
* @param layerNameToActivate Name of the layer
240
* @return Success or failure
242
bool setActiveLayer(const QString & layerNameToActivate);
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
249
bool setLayerPrintable(const int layerNumber, const bool isPrintable);
251
* @brief Is the layer printable
252
* @param layerNumber Number of the layer
253
* @return Printable or not
255
bool layerPrintable(const int layerNumber);
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
262
bool setLayerVisible(const int layerNumber, const bool isViewable);
264
* @brief Is the layer visible
265
* @param layerNumber Number of the layer
266
* @return Visible or not
268
bool layerVisible(const int layerNumber);
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
275
bool setLayerLocked(const int layerNumber, const bool isLocked);
277
* @brief Is the layer locked
278
* @param layerNumber Number of the layer
279
* @return Locked or not
281
bool layerLocked(const int layerNumber);
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
288
bool setLayerFlow(const int layerNumber, const bool flow);
290
* @brief does text flow around objects on this layer
291
* @param layerNumber Number of the layer
292
* @return flow or not
294
bool layerFlow(const int layerNumber);
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
301
bool setLayerTransparency(const int layerNumber, double trans);
303
* @brief returns the layer transparency
304
* @param layerNumber Number of the layer
305
* @return transparency value 0.0 - 1.0
307
double layerTransparency(const int layerNumber);
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
314
bool setLayerBlendMode(const int layerNumber, int blend);
316
* @brief returns the layer BlendMode
317
* @param layerNumber Number of the layer
318
* @return layerBlendMode
320
int layerBlendMode(const int layerNumber);
322
* @brief Return the level of the requested layer
323
* @param layerNumber Number of the layer
324
* @return Level of the layer
326
int layerLevelFromNumber(const int layerNumber);
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
333
bool setLayerMarker(const int layerNumber, QColor color);
335
* @brief returns the layer marker color
336
* @param layerNumber Number of the layer
337
* @return marker color
339
QColor layerMarker(const int layerNumber);
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
346
bool setLayerOutline(const int layerNumber, const bool outline);
348
* @brief is this layer in outline mode
349
* @param layerNumber Number of the layer
350
* @return outline or not
352
bool layerOutline(const int layerNumber);
354
* @brief Return the number of the layer at a certain level
355
* @param layerLevel Layer level
356
* @return Layer number
358
int layerNumberFromLevel(const int layerLevel);
360
* @brief Return the layer count
361
* @return Number of layers in doc
363
int layerCount() const;
365
* @brief Lower a layer
366
* @param layerNumber Number of the layer
367
* @return Success or failure
369
bool lowerLayer(const int layerNumber);
371
* @brief Lower a layer using the level
372
* @param layerLevel Level of the layer
373
* @return Success or failure
375
bool lowerLayerByLevel(const int layerLevel);
377
* @brief Raise a layer
378
* @param layerNumber Number of the layer
379
* @return Success or failure
381
bool raiseLayer(const int layerNumber);
383
* @brief Raise a layer using the level
384
* @param layerLevel Level of the layer
385
* @return Success or failure
387
bool raiseLayerByLevel(const int layerLevel);
389
* @brief Return the layer name
390
* @param layerNumber Number of the layer
391
* @return Name of the layer
393
QString layerName(const int layerNumber) const;
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
400
bool changeLayerName(const int layerNumber, const QString& newName);
402
* @brief Does the layer have items on it?
403
* @param layerNumber Number of the layer
404
* @return Layer contains items bool
406
bool layerContainsItems(const int layerNumber);
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
413
bool renumberLayer(const int layerNumber, const int newLayerNumber);
415
* @brief Return a list of the layers in their order
416
* @param list QStringList to insert the layer names into
418
void orderedLayerList(QStringList* list);
420
bool deleteTaggedItems();
423
* @brief Builds a qmap of the icc profiles used within the document
425
void getUsedProfiles(ProfilesL& usedProfiles);
426
bool OpenCMSProfiles(ProfilesL InPo, ProfilesL InPoCMYK, ProfilesL MoPo, ProfilesL PrPo);
427
void CloseCMSProfiles();
428
void SetDefaultCMSParams();
430
* @brief Switch Colormanagement on or of
431
* @param enable bool, if true Colormanagement is switched on, else off
433
void enableCMS(bool enable);
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......; }
441
void getNamedResources(ResourceCollection& lists) const;
442
void replaceNamedResources(ResourceCollection& newNames);
443
bool styleExists(QString styleName);
445
QList<int> getSortedStyleList();
446
QList<int> getSortedCharStyleList();
448
void redefineStyles(const StyleSet<ParagraphStyle>& newStyles, bool removeUnused=false);
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
454
void replaceStyles(const QMap<QString,QString>& newNameForOld);
456
* @brief Insert styles from another document in this document.
458
* @param fileName The path of the document we want to extract its styles
460
void loadStylesFromFile(QString fileName);
462
* @brief Gather styles from another document.
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
469
void loadStylesFromFile(QString fileName, StyleSet<ParagraphStyle> *tempStyles,
470
StyleSet<CharStyle> *tempCharStyles,
471
QMap<QString, multiLine> *tempLineStyles);
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);
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
481
void replaceCharStyles(const QMap<QString,QString>& newNameForOld);
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.
489
void lockGuides(bool isLocked);
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.
496
void restore(UndoState* state, bool isUndo);
498
* @brief Sets the name of the document
499
* @param name Name for the document
502
void setName(const QString& name);
504
* @brief Returns a stringlist of the item attributes within the document
506
QStringList getItemAttributeNames();
508
bool AddFont(QString name, int fsize = 10);
510
* @brief TODO: Reorganise the fonts.. how? Moved from scribus.cpp
511
* CB: almost the same as getUsedFonts???
513
QMap<QString,int> reorganiseFonts();
515
* @brief Returns a qmap of the fonts and their glyphs used within the document
517
void getUsedFonts(QMap<QString,QMap<uint, FPointArray> > &Really);
518
void checkItemForFonts(PageItem *it, QMap<QString, QMap<uint, FPointArray> > & Really, uint lc);
521
* @brief Replace line style colors
523
void replaceLineStyleColors(const QMap<QString, QString>& colorMap);
525
* @brief Builds a qmap of the colours used within the document
527
void getUsedColors(ColorList &colorsToUse, bool spot = false);
529
* @brief Return if a specific color is used by line styles
531
bool lineStylesUseColor(const QString& colorName);
533
* @brief Set the patterns for a document
535
bool addPattern(QString &name, ScPattern& pattern);
536
void setPatterns(QMap<QString, ScPattern> &patterns);
538
* @brief Builds a QStringList of the patterns used within the document
540
QStringList getUsedPatterns();
541
QStringList getUsedPatternsSelection(Selection* customSelection);
542
QStringList getUsedPatternsHelper(QString pattern, QStringList &results);
544
* @brief Set and get the document's unit index
546
void setUnitIndex(const int);
547
int unitIndex() const;
548
double unitRatio() const;
550
* @brief Apply a master page
552
bool applyMasterPage(const QString& pageName, const int pageNumber);
554
* @brief Undo function for applying a master page
556
void restoreMasterPageApplying(SimpleState *state, bool isUndo);
557
void restoreCopyPage(SimpleState *state, bool isUndo);
558
void restoreMovePage(SimpleState *state, bool isUndo);
560
* @brief Undo function for grouping/ungrouping
562
void restoreGrouping(SimpleState *state, bool isUndo);
563
void restoreUngrouping(SimpleState *state, bool isUndo);
565
* @brief Save function
567
bool save(const QString& fileName, QString* savedFile = NULL);
569
* @brief Set the page margins. Current code uses current page only, also provide a (currently, TODO) option for this.
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);
573
* @brief Recalculate the colors after CMS settings change. Update the items in the doc accordingly.
575
void recalculateColors();
577
* @brief Sets up the ScText defaults from the document
579
void setScTextDefaultsFromDoc(ScText *);
581
* @brief Copies a normal page to be a master pages
583
bool copyPageToMasterPage(const int, const int, const int, const QString&, bool);
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.
591
//TODO: void PasteItem(struct CopyPasteBuffer *Buffer, bool loading, bool drag = false);
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.
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.
601
\param frameType frame type
607
\param fill fill color name
608
\param outline outline color name
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);
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);
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
620
int itemAddUserFrame(InsertAFrameData &iafData);
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.
627
bool itemAddCommit(const int itemNumber);
630
* @brief Finalise item creation. Simply split off code from itemAdd
631
* Only to be called from itemAdd()
633
void itemAddDetails(const PageItem::ItemType itemType, const PageItem::ItemFrameType frameType, const int itemNumber);
635
uint getItemNrfromUniqueID(uint unique);
640
* @brief Run this common frame item update code
642
void updateFrameItems();
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();
650
void renumberItemsInListOrder();
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();
657
void rebuildItemLists();
659
* @brief Doc uses automatic text frames?
661
bool usesAutomaticTextFrames() const;
662
void setUsesAutomaticTextFrames(const bool);
665
* @brief Load images into an image frame, moved from the view
666
* @retval Return false on failure
668
bool LoadPict(QString fn, int ItNr, bool reload = false, bool showMsg = false);
676
bool loadPict(QString fn, PageItem *pageItem, bool reload = false, bool showMsg = false);
678
* \brief Handle image with color profiles
680
@param PrCMYK cmyk profile
681
@param dia optional progress widget
683
void RecalcPictures(ProfilesL *Pr, ProfilesL *PrCMYK, QProgressBar *dia = 0);
685
* \brief Handle image with color profiles
686
* @param items list of page items to update
688
* @param PrCMYK cmyk profile
689
* @param dia optional progress widget
691
void RecalcPictures(QList<PageItem*>* items, ProfilesL *Pr, ProfilesL *PrCMYK, QProgressBar *dia = 0);
693
* @brief Find the minX,MinY and maxX,maxY for the canvas required for the doc
695
void canvasMinMax(FPoint&, FPoint&);
697
int OnPage(double x2, double y2);
698
int OnPage(PageItem *currItem);
699
void GroupOnPage(PageItem *currItem);
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();
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
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);
719
* @brief Item type conversion functions
721
PageItem* convertItemTo(PageItem *currItem, PageItem::ItemType newType, PageItem* secondaryItem=NULL);
724
* @brief The page number of the current page
726
int currentPageNumber();
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
734
bool itemNameExists(const QString itemName);
737
* @brief Set the doc into Master page mode
738
* Do we need to return if the move to master page mode was successful?
740
void setMasterPageMode(bool);
742
/*** Is the document in master page mode? */
743
bool masterPageMode() const { return m_masterPageMode; }
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
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);
751
* @brief Delete a section from the document sections list
753
bool deleteSection(const uint);
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
758
const QString getSectionPageNumberForPageIndex(const uint) const;
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
763
int getSectionKeyForPageIndex(const uint pageIndex) const;
768
void updateSectionPageNumbersToPages();
771
* @param otherPageIndex
775
void addPageToSection(const uint otherPageIndex, const uint location, const uint count=1);
780
void removePageFromSection(const uint pageIndex);
784
void setFirstSectionFromFirstPageNumber();
786
* @brief Update the fill and line QColors for all items in the doc
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);
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
803
void insertColor(QString nam, double c, double m, double y, double k);
805
QMap<QString, double>& constants() { return m_constants; }
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
812
PageLocation locationOfPage(int pageIndex) const;
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
818
int columnOfPage(int pageIndex) const;
820
bool sendItemSelectionToBack();
821
bool bringItemSelectionToFront();
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);
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);
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);
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);
865
// void chAbStyle(PageItem *currItem, int s);
867
void itemSelection_SetTracking(int us, Selection* customSelection=0);
868
void itemSelection_SetFontSize(int size, Selection* customSelection=0);
871
void MirrorPolyH(PageItem *currItem);
872
void MirrorPolyV(PageItem *currItem);
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.
884
/*! \brief Get pointer to the current page
885
\retval Page* current page object */
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);
916
//! \brief Fonctions which avoid doc updater and update manager to send too much
917
// unncessary signals when doing updates on multiple items
924
ApplicationPrefs& prefsData;
925
UndoManager * const undoManager;
931
bool automaticTextFrames; // Flag for automatic Textframes
932
bool m_masterPageMode;
933
QMap<QString, double> m_constants;
934
ScribusMainWindow* m_ScMW;
936
ScGuardedObject<ScribusDoc> m_guardedObject;
938
public: // Public attributes
939
bool is12doc; //public for now, it will be removed later
947
/** \brief Scratch space around Pages */
948
MarginStruct scratch;
949
double GapHorizontal;
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;
960
/** \brief List of 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 */
976
/** \brief Pageheight */
978
/* Number of Pages */
979
// int pageCount; Disabled CR no longer required
980
/** \brief Margins */
981
MarginStruct pageMargins;
983
QList<PageSet> pageSets;
987
// double BleedRight;
988
// double BleedBottom;
989
/** \brief Number of Columns */
991
/** \brief Distance of Columns */
993
/** \brief current Pagelayout */
994
int currentPageLayout;
995
/** \brief Flag fuer Hoch- oder Querformat 0 = Hochformat */
998
/** \brief Erste Seitennummer im Dokument */
1000
/** \brief Flag fuer Rasterbenutzung */
1002
/** \brief Im Dokument benutzte Farben */
1003
ColorList PageColors;
1004
/** \brief InfoStrings fuer das aktuelle Dokument */
1005
DocumentInformation documentInfo;
1008
double *ShapeValues;
1011
QMap<QString,int> UsedFonts;
1012
SCFonts * const AllFonts;
1013
QList<AlignObjs> AObjects;
1016
ParagraphStyle currentStyle;
1018
NodeEditContext nodeEdit;
1020
typoPrefs typographicSettings;
1021
guidesPrefs guidesSettings;
1022
toolPrefs toolSettings;
1023
QMap<QString, checkerPrefs> checkerProfiles;
1024
QString curCheckProfile;
1025
/** \brief Letztes Element fuer AutoTextrahmen */
1027
/** \brief Erstes Element fuer AutoTextrahmen */
1028
PageItem *FirstAuto;
1031
PageItem *DraggedElem;
1032
PageItem *ElemToLink;
1033
QList<uint> DragElements;
1035
StyleSet<ParagraphStyle> docParagraphStyles;
1036
StyleSet<CharStyle> docCharStyles;
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;
1062
eRenderIntent IntentColors;
1063
eRenderIntent IntentImages;
1065
QMap<QString,QString> JavaScripts;
1072
PDFOptions PDF_Options;
1073
PrintOptions Print_Options;
1079
PageItem *PageObject;
1087
QList<BookMa> BookMarks;
1093
QTimer * const autoSaveTimer;
1094
QMap<QString,multiLine> MLineStyles;
1095
QList<ArrowDesc> arrowStyles;
1096
QMap<QString, ScPattern> docPatterns;
1099
struct OpenNodesList
1105
QList<OpenNodesList> OpenNodes;
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;
1117
FPointArray symNonBreak;
1118
FPointArray symNewCol;
1119
FPointArray symNewFrame;
1121
Hyphenator * docHyphenator;
1123
UndoTransaction* m_itemCreationTransaction;
1124
UndoTransaction* m_alignTransaction;
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;
1134
//Lets make our doc talk to our GUI rather than confusing all our normal stuff
1136
* @brief Let the document tell whatever is listening that it has changed
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);
1146
* @brief A signal for when the outline palette needs to rebuild itself
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
1154
void signalRebuildOutLinePalette();
1155
//! Temporary signal for SizeItem
1156
void widthAndHeight(double, double);
1159
void itemSelection_ToggleLock();
1160
void itemSelection_ToggleSizeLock();
1161
void itemSelection_ToggleImageShown();
1162
void itemSelection_TogglePrintEnabled();
1163
void itemSelection_ChangePreviewResolution(int id);
1165
/*! \brief Change display quality of all images in document.
1166
\author OssiLehtinen
1168
void allItems_ChangePreviewResolution(int id);
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);
1218
* Adjust an image frame's size to fit the size of the image in it
1220
void itemSelection_AdjustFrametoImageSize(Selection* customSelection=0);
1222
* Adjust an image size to fit the size of the frame
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);
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);
1236
void undoRedoBegin();
1237
void undoRedoDone();
1240
void updatePict(QString name);
1241
void updatePictDir(QString name);
1242
void removePict(QString name);
1245
Q_DECLARE_METATYPE(ScribusDoc*);