1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 /***************************************************************************
8                           pageitem.h  -  description
9                              -------------------
10     begin                : Sat Apr 7 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 
24 #ifndef PAGEITEM_H
25 #define PAGEITEM_H
26 
27 #include <QObject>
28 #include <QWidget>
29 #include <QPolygon>
30 #include <QStack>
31 #include <QList>
32 #include <QKeyEvent>
33 #include <QMenu>
34 #include <QPointF>
35 #include <QRect>
36 #include <QRectF>
37 #include <QString>
38 #include <QVector>
39 #include <QTemporaryFile>
40 
41 #include "scribusapi.h"
42 #include "annotation.h"
43 #include "commonstrings.h"
44 #include "colormgmt/sccolormgmtstructs.h"
45 #include "desaxe/saxio.h"
46 #include "observable.h"
47 #include "pagestructs.h"
48 #include "scimage.h"
49 #include "margins.h"
50 #include "sctextstruct.h"
51 #include "text/storytext.h"
52 #include "text/textlayout.h"
53 #include "text/textcontext.h"
54 #include "undoobject.h"
55 #include "vgradient.h"
56 #include "mesh.h"
57 #ifdef HAVE_CONFIG_H
58 #include "scconfig.h"
59 #endif
60 
61 class QFrame;
62 class QGridLayout;
63 class QRegion;
64 class ResourceCollection;
65 class ScPainter;
66 class ScribusDoc;
67 class SimpleState;
68 class UndoManager;
69 class UndoState;
70 
71 
72 class PageItem_Arc;
73 class PageItem_Group;
74 class PageItem_ImageFrame;
75 class PageItem_LatexFrame;
76 class PageItem_Line;
77 class PageItem_NoteFrame;
78 class PageItem_OSGFrame;
79 class PageItem_PathText;
80 class PageItem_PolyLine;
81 class PageItem_Polygon;
82 class PageItem_RegularPolygon;
83 class PageItem_Spiral;
84 class PageItem_Symbol;
85 class PageItem_Table;
86 class PageItem_TextFrame;
87 
88 /**
89   *@author Franz Schmid
90   */
91 
92 #if defined(_MSC_VER)
93 #define _unlink unlink
94 #endif
95 
96 class SCRIBUS_API PageItem : public QObject, public UndoObject, public SaxIO, public SingleObservable<PageItem>, public TextContext
97 {
98 	Q_OBJECT
99 
100 	// Properties - see http://doc.trolltech.com/3.3/properties.html
101 	// See the accessors of these properties for details on their use.
102 	Q_PROPERTY(QString itemName READ itemName WRITE setItemName DESIGNABLE false)
103 	Q_PROPERTY(QString fillColor READ fillColor WRITE setFillColor DESIGNABLE false)
104 	Q_PROPERTY(QString lineColor READ lineColor WRITE setLineColor DESIGNABLE false)
105 	Q_PROPERTY(double fillShade READ fillShade WRITE setFillShade DESIGNABLE false)
106 	Q_PROPERTY(double lineShade READ lineShade WRITE setLineShade DESIGNABLE false)
107 	Q_PROPERTY(double fillTransparency READ fillTransparency WRITE setFillTransparency DESIGNABLE false)
108 	Q_PROPERTY(double lineTransparency READ lineTransparency WRITE setLineTransparency DESIGNABLE false)
109 	Q_PROPERTY(bool locked READ locked WRITE setLocked DESIGNABLE false)
110 	Q_PROPERTY(bool sizeLocked READ sizeLocked WRITE setSizeLocked DESIGNABLE false)
111 	//used for notes frames
112 	Q_PROPERTY(bool sizeHLocked READ sizeHLocked WRITE setSizeHLocked DESIGNABLE false)
113 	Q_PROPERTY(bool sizeVLocked READ sizeVLocked WRITE setSizeVLocked DESIGNABLE false)
114 	Q_PROPERTY(bool imageFlippedV READ imageFlippedV WRITE setImageFlippedV DESIGNABLE false)
115 	Q_PROPERTY(bool imageFlippedH READ imageFlippedH WRITE setImageFlippedH DESIGNABLE false)
116 	Q_PROPERTY(double lineWidth READ lineWidth WRITE setLineWidth DESIGNABLE false)
117 	Q_PROPERTY(QString customLineStyle READ customLineStyle WRITE setCustomLineStyle DESIGNABLE false)
118 	Q_PROPERTY(int startArrowIndex READ startArrowIndex WRITE setStartArrowIndex DESIGNABLE false)
119 	Q_PROPERTY(int endArrowIndex READ endArrowIndex WRITE setEndArrowIndex DESIGNABLE false)
120 
121 	Q_PROPERTY(bool printEnabled READ printEnabled WRITE setPrintEnabled DESIGNABLE false)
122 	Q_PROPERTY(double xPos READ xPos WRITE setXPos DESIGNABLE false)
123 	Q_PROPERTY(double yPos READ yPos WRITE setYPos DESIGNABLE false)
124 	Q_PROPERTY(double width READ width WRITE setWidth DESIGNABLE false)
125 	Q_PROPERTY(double height READ height WRITE setHeight DESIGNABLE false)
126 	Q_PROPERTY(double rotation READ rotation WRITE setRotation DESIGNABLE false)
127 	Q_PROPERTY(double imageXScale READ imageXScale WRITE setImageXScale DESIGNABLE false)
128 	Q_PROPERTY(double imageYScale READ imageYScale WRITE setImageYScale DESIGNABLE false)
129 	Q_PROPERTY(double imageXOffset READ imageXOffset WRITE setImageXOffset DESIGNABLE false)
130 	Q_PROPERTY(double imageYOffset READ imageYOffset WRITE setImageYOffset DESIGNABLE false)
131 	Q_PROPERTY(double cornerRadius READ cornerRadius WRITE setCornerRadius DESIGNABLE false)
132 	Q_PROPERTY(double textToFrameDistLeft READ textToFrameDistLeft WRITE setTextToFrameDistLeft DESIGNABLE false)
133 	Q_PROPERTY(double textToFrameDistRight READ textToFrameDistRight WRITE setTextToFrameDistRight DESIGNABLE false)
134 	Q_PROPERTY(double textToFrameDistTop READ textToFrameDistTop WRITE setTextToFrameDistTop DESIGNABLE false)
135 	Q_PROPERTY(double textToFrameDistBottom READ textToFrameDistBottom WRITE setTextToFrameDistBottom DESIGNABLE false)
136 	Q_PROPERTY(double columnGap READ columnGap WRITE setColumnGap DESIGNABLE false)
137 	Q_PROPERTY(int columns READ columns WRITE setColumns DESIGNABLE false)
138 	Q_ENUM(FirstLineOffsetPolicy)
139 	Q_PROPERTY(FirstLineOffsetPolicy firstLineOffset READ firstLineOffset WRITE setFirstLineOffset DESIGNABLE false)
140 	// FIXME: QMetaProperty can't translate these to/from enumerator names, probably because the
141 	// properties aren't moc'd in the Qt sources. They work fine in their
142 	// current state as plain integer properties.
143 //  	Q_ENUMS(PenStyle)
144 // 	Q_PROPERTY(PenStyle lineStyle READ lineStyle WRITE setLineStyle DESIGNABLE false)
145 // 	Q_ENUMS(PenCapStyle)
146 // 	Q_PROPERTY(PenCapStyle lineEnd READ lineEnd WRITE setLineEnd DESIGNABLE false)
147 // 	Q_ENUMS(PenJoinStyle)
148 // 	Q_PROPERTY(PenJoinStyle lineJoin READ lineJoin WRITE setLineJoin DESIGNABLE false)
149 
150 
151 
152 public:	// Start enumerator definitions
153 
154 	/** @brief Draw options for DrawObj_toImage()
155 	 *
156 	 */
157 	enum DrawOption {
158 		NoRotation = 1, // Draw as if item was not rotated
159 		NoSoftShadow = 2
160 	};
161 
162 	/** @brief Item Type
163 	 *
164 	 * Soon, item type will probably go away in favour of using
165 	 * subclasses and checking types using more conventional methods
166 	 * and using Qt's MetaObject introspection.
167 	 * Multiple is used for checking in @sa Selection for all same type of items
168 	 */
169 	enum ItemType {
170 		ItemType1		= 1,
171 		ImageFrame		= 2,
172 		ItemType3		= 3,
173 		TextFrame		= 4,
174 		Line			= 5,
175 		Polygon			= 6,
176 		PolyLine		= 7,
177 		PathText		= 8,
178 		LatexFrame  	= 9,
179 		OSGFrame    	= 10,
180 		Symbol			= 11,
181 		Group			= 12,
182 		RegularPolygon	= 13,
183 		Arc				= 14,
184 		Spiral			= 15,
185 		Table			= 16,
186 		NoteFrame		= 17,
187 		Multiple		= 99
188 	};
189 
190 	/**
191 	 * @brief Item kind
192 	 *
193 	 * Describe in which kind of list the item is placed.
194 	 */
195 	enum ItemKind {
196 		StandardItem = 0,
197 		InlineItem   = 1,
198 		PatternItem  = 2
199 	};
200 
201 	/** @brief Text flow mode
202 	 *
203 	 * Describe if and how text flow around object
204 	 */
205 	enum TextFlowMode {
206 		TextFlowDisabled			= 0,
207 		TextFlowUsesFrameShape		= 1,
208 		TextFlowUsesBoundingBox		= 2,
209 		TextFlowUsesContourLine		= 3,
210 		TextFlowUsesImageClipping	= 4
211 	};
212 
213 	/** @brief Frame Type
214 	 */
215 	enum ItemFrameType {
216 		Unspecified =-1,
217 		Rectangle	= 0,
218 		Ellipse		= 1,
219 		Round		= 2,
220 		Other		= 3
221 	};
222 		//End enumerator definitions
223 
224 	// This property may not hang around for too long, but should be useful
225 	// when testing out the pageitem refactoring work.  Setting it is unlikely
226 	// to currently have the desired effect.
227 	/**
228 	 * @brief Item type.
229 	 * @warning Do not set this property except for testing and debug purposes.
230 	 */
231 	Q_ENUM(ItemType)
232 	Q_PROPERTY(ItemType itemType READ itemType WRITE convertTo DESIGNABLE false)
233 
234 public: // Start public functions
235 
236 	PageItem(ScribusDoc *doc, ItemType newType, double x, double y, double w, double h, double w2, const QString& fill, const QString& outline);
237 	~PageItem() override;
238 
239 	/* these do essentially the same as a dynamic cast but might be more readable */
asArc()240 	virtual PageItem_Arc * asArc()							{ return nullptr; } ///< Return self if Arc item, otherwise null
asGroupFrame()241 	virtual PageItem_Group * asGroupFrame()					{ return nullptr; } ///< Return self if Group item, otherwise null
asImageFrame()242 	virtual PageItem_ImageFrame * asImageFrame()			{ return nullptr; } ///< Return self if Image item, otherwise null
asLatexFrame()243 	virtual PageItem_LatexFrame * asLatexFrame()			{ return nullptr; } ///< Return self if Render frame item, otherwise null
asLine()244 	virtual PageItem_Line * asLine()						{ return nullptr; } ///< Return self if Line item, otherwise null
asNoteFrame()245 	virtual PageItem_NoteFrame * asNoteFrame()				{ return nullptr; } ///< Return self if Note item, otherwise null
asOSGFrame()246 	virtual PageItem_OSGFrame * asOSGFrame()				{ return nullptr; } ///< Return self if OSG item, otherwise null
asPathText()247 	virtual PageItem_PathText * asPathText()				{ return nullptr; } ///< Return self if Path Text item, otherwise null
asPolyLine()248 	virtual PageItem_PolyLine * asPolyLine()				{ return nullptr; } ///< Return self if Poly Line item, otherwise null
asPolygon()249 	virtual PageItem_Polygon * asPolygon()					{ return nullptr; } ///< Return self if Polygon item, otherwise null
asRegularPolygon()250 	virtual PageItem_RegularPolygon * asRegularPolygon()	{ return nullptr; } ///< Return self if Regular Polygon item, otherwise null
asSpiral()251 	virtual PageItem_Spiral * asSpiral()					{ return nullptr; } ///< Return self if Spiral item, otherwise null
asSymbol()252 	virtual PageItem_Symbol * asSymbol()					{ return nullptr; } ///< Return self if Symbol item, otherwise null
asTable()253 	virtual PageItem_Table * asTable()						{ return nullptr; } ///< Return self if Table item, otherwise null
asTextFrame()254 	virtual PageItem_TextFrame * asTextFrame()				{ return nullptr; } ///< Return self if Text item, otherwise null
255 
isArc()256 	virtual bool isArc()			const { return false; } ///< Return true if Arc item, otherwise false
isAutoNoteFrame()257 	virtual bool isAutoNoteFrame()	const { return false; } ///< Return true if Auto Note item, otherwise false
isGroup()258 	virtual bool isGroup()			const { return false; } ///< Return true if Group item, otherwise false
isImageFrame()259 	virtual bool isImageFrame()		const { return false; } ///< Return true if Image item, otherwise false
isLatexFrame()260 	virtual bool isLatexFrame()		const { return false; } ///< Return true if Render frame item, otherwise false
isLine()261 	virtual bool isLine()			const { return false; } ///< Return true if Line item, otherwise false
isNoteFrame()262 	virtual bool isNoteFrame()		const { return false; } ///< Return true if Note item, otherwise false
isOSGFrame()263 	virtual bool isOSGFrame()		const { return false; } ///< Return true if OSG item, otherwise false
isPathText()264 	virtual bool isPathText()		const { return false; } ///< Return true if Text Path Text, otherwise false
isPolyLine()265 	virtual bool isPolyLine()		const { return false; } ///< Return true if Poly Line item, otherwise false
isPolygon()266 	virtual bool isPolygon()		const { return false; } ///< Return true if Polygon item, otherwise false
isRegularPolygon()267 	virtual bool isRegularPolygon()	const { return false; } ///< Return true if Regular Polygon item, otherwise false
isSpiral()268 	virtual bool isSpiral()			const { return false; } ///< Return true if Spiral item, otherwise false
isSymbol()269 	virtual bool isSymbol()			const { return false; } ///< Return true if Symbol item, otherwise false
isTable()270 	virtual bool isTable()			const { return false; } ///< Return true if Table item, otherwise false
isTextFrame()271 	virtual bool isTextFrame()		const { return false; } ///< Return true if Text item, otherwise false
272 
273 	virtual bool isMasterItem() const; ///< Return true if item is placed on a master page
274 	virtual bool isGroupChild() const;
275 	virtual bool isTableCell() const;
isTextContainer()276 	virtual bool isTextContainer() const { return false; } ///< Return true if item is susceptible to display text in a way or another
277 
parentGroup()278 	PageItem_Group* parentGroup() const { return (Parent ? Parent->asGroupFrame() : nullptr); }
parentTable()279 	PageItem_Table* parentTable() const { return (Parent ? Parent->asTable() : nullptr); }
280 
281 	virtual void applicableActions(QStringList& actionList) = 0;
282 	virtual QString infoDescription() const;
createInfoGroup(QFrame *,QGridLayout *)283 	virtual bool createInfoGroup(QFrame *, QGridLayout *) {return false;}
284 
285 	//<< ********* Functions related to drawing the item *********
286 
287 	void DrawObj(ScPainter *p, QRectF cullingArea);
288 	void DrawObj_Pre(ScPainter *p);
289 	virtual void DrawObj_Post(ScPainter *p);
290 	virtual void DrawObj_Decoration(ScPainter *p);
291 	virtual void DrawObj_Item(ScPainter *p, QRectF e) = 0;
292 	QImage DrawObj_toImage(double maxSize, int options = 0);
293 	QImage DrawObj_toImage(QList<PageItem*> &emG, double scaling);
294 	void DrawObj_Embedded(ScPainter *p, QRectF cullingArea, const CharStyle& style, PageItem* cembedded);
295 	void DrawStrokePattern(ScPainter *p, QPainterPath &path);
296 	void DrawSoftShadow(ScPainter *p);
297 	/**
298 	 * @brief Set or get the redraw bounding box of the item, moved from the View
299 	 */
300 	QRect getRedrawBounding(double viewScale) const;
301 	void setRedrawBounding();
302 	void setPolyClip(int up, int down = 0);
303 	void updatePolyClip();
304 	//added switch for not updating welded items - used by notes frames with automatic size adjusted
305 	void updateClip(bool updateWelded = true);
306 	void convertClip();
307 
308 	QRectF getBoundingRect() const;
309 	QRectF getCurrentBoundingRect(double moreSpace = 0.0) const;
310 	QRectF getOldBoundingRect() const;
311 	QRectF getVisualBoundingRect() const;
312 
313 	virtual void getBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
314 	virtual void getOldBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
315 	virtual void getVisualBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
316 
317 	virtual QRectF getStartArrowBoundingRect() const;
318 	virtual QRectF getStartArrowOldBoundingRect() const;
319 
320 	virtual QRectF getEndArrowBoundingRect() const;
321 	virtual QRectF getEndArrowOldBoundingRect() const;
322 
323 	virtual QRegion textInteractionRegion(double xOffset, double yOffset) const;
324 
325 	//>> ********* Functions related to drawing the item *********
326 
327 
328 
329 	//<< ********* Functions to work on the contents of the items *********
330 
331 	/**
332 	 * @brief Clear the contents of a frame.
333 	 * WARNING: Currently *they* do not check if the user wants this.
334 	 * The view does when these are called.
335 	 */
clearContents()336 	virtual void clearContents() {}
truncateContents()337 	virtual void truncateContents() {}
338 
339 	//>> ********* Functions to work on the contents of the items *********
340 
341 	//<< ********* Functions for user interaction with the item **********
342 
343 	/**
344 	   * @brief Check if a QPoint is within the items boundaries
345 	   * No coordinates transformation is performed
346 	   * @param x X position
347 		  @param y Y position
348 	   * @return bool true if x, i in the item
349 	   */
350 	bool pointWithinItem(int x, int y) const;
351 	/**
352 	   * @brief Check if the mouse is within the items boundaries
353 	   * This method performs necessary page to device transformations
354 		  @param x X position
355 		  @param y Y position
356 		  @param scale scale of the vport
357 	   * @return bool true if the x, y is in the bounds
358 	   */
359 	bool mouseWithinItem(int x, int y, double scale) const;
360 
361 	virtual void handleModeEditKey(QKeyEvent *k, bool &keyRepeat);
362 
363 	//>> ********* Functions for user interaction with the item **********
364 
365 
366 	int level() const; ///< Get item level relative to its parent doc or group
saxx(SaxHandler & handler,const Xml_string & elemtag)367 	void saxx(SaxHandler& handler, const Xml_string& elemtag) const override {}
saxx(SaxHandler & handler)368 	void saxx(SaxHandler& handler) const override {}
369 
370 
371 	/**
372 	 * @brief Adjust the picture scale, moved from the view, no view code here
373 	 * FIXME: Move to PageItem_TextFrame
374 	 */
375 	void adjustPictScale();
376 
377 
378 
379 	void updateGradientVectors(); //!< Update the gradient vectors, moved from the View
380 	/**
381 	 * @brief Move the image within the frame
382 	 * Old ScribusView::MoveItemI
383 	 * @todo Move to PageItem_ImageFrame
384 	 */
385 	void moveImageInFrame(double newX, double newY);
386 	ObjAttrVector* getObjectAttributes();
387 	/*!
388 	 * brief Returns a list of attributes with specified name
389 	 */
390 	QList<ObjectAttribute> getObjectAttributes(const QString& attributeName) const;
391 	/*!
392 	 * brief Returns a complete ObjectAttribute struct if 1 is found, or ObjectAttribute.name will be QString::null if 0 or >1 are found
393 	 */
394 	ObjectAttribute getObjectAttribute(const QString&) const;
395 	void setObjectAttributes(ObjAttrVector*);
396 
397 	void SetFrameShape(int count, const double *vals);
398 	void SetRectFrame();
399 	void SetOvalFrame();
400 	void SetFrameRound();
401 	QTransform getGroupTransform() const;
402 	void getTransform(QTransform& mat) const;
403 	QTransform getTransform() const;
404 	QTransform getTransform(double deltaX, double deltaY) const;
405 
406 	/// invalidates current layout information
invalidateLayout()407 	virtual void invalidateLayout() { invalid = true; }
408 	/// creates valid layout information
layout()409 	virtual void layout() {}
410 	 ///< tests if a character is displayed by this frame
411 	bool frameDisplays(int textpos) const;
412 	/// get frame where is displayed text char in a chain
413 	PageItem* frameOfChar(int textPos);
414 	/// returns frame where is text end
415 	PageItem * frameTextEnd();
416 	/// returns true if text overflows
417 	bool frameOverflows() const;
418 	bool frameUnderflows() const;
419 	int frameOverflowCount() const;
420 	int frameOverflowBlankCount() const;
421 	/// Draws the overflow marker.
422 	void drawOverflowMarker(ScPainter *p);
423 	/// returns index of first char displayed in this frame, used to be 0
424 	int firstInFrame() const;
425 	/// returns index of last char displayed in this frame, used to be MaxChars-1
426 	int lastInFrame() const;
427 
428 
429 	const ParagraphStyle& currentStyle() const; ///< returns the style at the current charpos
430 	ParagraphStyle& changeCurrentStyle(); ///< returns the style at the current charpos
431 	/// returns the style at the current charpos
432 	const CharStyle& currentCharStyle() const;
433 	/// Return current text properties (current char + paragraph properties)
434 	virtual void currentTextProps(ParagraphStyle& parStyle) const;
435 	void SetQColor(QColor *tmp, const QString& farbe, double shad);
436 	void DrawPolyL(QPainter *p, const QPolygon& pts);
shape()437 	FPointArray shape() const { return PoLine; }
setShape(const FPointArray & val)438 	void setShape(const FPointArray& val) { PoLine = val; }
contour()439 	FPointArray contour() const { return ContourLine; }
setContour(const FPointArray & val)440 	void setContour(const FPointArray& val) { ContourLine = val; }
flipPathText()441 	bool flipPathText() const { return textPathFlipped; }
setFlipPathText(bool val)442 	void setFlipPathText(bool val) { textPathFlipped = val; }
pathTextType()443 	int pathTextType() const { return textPathType; }
setPathTextType(int val)444 	void setPathTextType(int val) { textPathType = val; }
pathTextBaseOffset()445 	double pathTextBaseOffset() const { return BaseOffs; }
setPathTextBaseOffset(double val)446 	void setPathTextBaseOffset(double val) { BaseOffs = val; }
pathTextShowFrame()447 	bool pathTextShowFrame() const { return PoShow; }
setPathTextShowFrame(bool val)448 	void setPathTextShowFrame(bool val) { PoShow = val; }
449 
useEmbeddedImageProfile()450 	bool useEmbeddedImageProfile() const { return UseEmbedded; }
setUseEmbeddedImageProfile(bool val)451 	void setUseEmbeddedImageProfile(bool val) { UseEmbedded = val; }
embeddedImageProfile()452 	QString embeddedImageProfile() const { return EmbeddedProfile; }
setEmbeddedImageProfile(const QString & val)453 	void setEmbeddedImageProfile(const QString& val) { EmbeddedProfile = val; }
drawFrame()454 	bool drawFrame() { return ((m_itemType == TextFrame && !m_sampleItem) || (m_itemType == ImageFrame) || (m_itemType == PathText)); }
externalFile()455 	QString externalFile() const { return Pfile; }
456 	void setExternalFile(const QString& filename, const QString& baseDir = QString());
setImagePagenumber(int num)457 	void setImagePagenumber(int num) { pixm.imgInfo.actualPageNumber = num; }
458 	void setResolution(int);
459 
460 	//FIXME: maybe these should go into annotation?
fileIconPressed()461 	QString fileIconPressed() const { return Pfile2; }
462 	void setFileIconPressed(const QString& filename, const QString& baseDir = QString());
fileIconRollover()463 	QString fileIconRollover() const { return Pfile3; }
464 	void setFileIconRollover(const QString& filename, const QString& baseDir = QString());
465 
cmsRenderingIntent()466 	int  cmsRenderingIntent() const { return ImageIntent; }
setCmsRenderingIntent(eRenderIntent val)467 	void setCmsRenderingIntent(eRenderIntent val) { ImageIntent = val; }
cmsProfile()468 	QString cmsProfile() const { return ImageProfile; }
setCmsProfile(const QString & val)469 	void setCmsProfile(const QString& val) { ImageProfile = val; }
setOverrideCompressionMethod(bool val)470 	void setOverrideCompressionMethod(bool val) { OverrideCompressionMethod = val; }
setCompressionMethodIndex(int val)471 	void setCompressionMethodIndex(int val) { CompressionMethodIndex = val; }
setOverrideCompressionQuality(bool val)472 	void setOverrideCompressionQuality(bool val) { OverrideCompressionQuality = val; }
setCompressionQualityIndex(int val)473 	void setCompressionQualityIndex(int val) { CompressionQualityIndex = val; }
474 
475 	//you can change all code for search first or last item in chain
476 	PageItem* firstInChain();
477 	PageItem* lastInChain();
478 	PageItem* lastInChainSamePage();
prevInChain()479 	PageItem* prevInChain() { return m_backBox; }
nextInChain()480 	PageItem* nextInChain() { return m_nextBox; }
prevInChain()481 	const PageItem* prevInChain() const { return m_backBox; }
nextInChain()482 	const PageItem* nextInChain() const { return m_nextBox; }
isInChain()483 	bool isInChain() const { return ((m_backBox != nullptr) || (m_nextBox != nullptr)); }
484 
485 	bool canBeLinkedTo(const PageItem* nextFrame) const;
486 	void unlink(bool createUndo = true);
487 	void link(PageItem* nextFrame, bool addPARSEP = true);
488 	void dropLinks();
489 	void unlinkWithText();
490 
setSampleItem(bool b)491 	void setSampleItem(bool b) {m_sampleItem=b;}
dashes()492 	const QVector<double>& dashes() const { return DashValues; }
dashes()493 	QVector<double>& dashes() { return DashValues; }
setDashes(const QVector<double> & val)494 	void setDashes(const QVector<double>& val) { DashValues = val; }
dashOffset()495 	double dashOffset() const { return DashOffset; }
setDashOffset(double val)496 	void setDashOffset(double val) { DashOffset = val; }
497 
498 	/// Retrieve child items of this item
499 	virtual QList<PageItem*> getChildren() const;
500 	/// Retrieve all children of item, including children of children
501 	virtual QList<PageItem*> getAllChildren() const;
502 
503 	//<< ********* Attributes of the item *********
504 	//Position
xPos()505 	double xPos() const { return m_xPos; }
yPos()506 	double yPos() const { return m_yPos; }
507 	virtual double visualXPos() const;
508 	virtual double visualYPos() const;
xyPos()509 	FPoint xyPos() const { return FPoint(m_xPos, m_yPos); }
510 	void setXPos(double, bool drawingOnly=false);
511 	void setYPos(double, bool drawingOnly=false);
512 	void setXYPos(double, double, bool drawingOnly=false);
513 	void moveBy(double, double, bool drawingOnly=false);
514 	//Size
width()515 	double width() const override { return m_width; }
height()516 	double height() const override { return m_height; }
517 	virtual double visualWidth() const;
518 	virtual double visualHeight() const;
519 	double visualLineWidth() const;
520 	void setWidth(double);
521 	void setHeight(double);
522 	void setWidthHeight(double, double, bool drawingOnly);
523 	void setWidthHeight(double, double);
524 	void resizeBy(double, double);
525 	//Rotation
rotation()526 	double rotation() const { return m_rotation; }
527 	void setRotation(double, bool drawingOnly);
setRotation(double r)528 	void setRotation(double r) { setRotation(r, false); }  ///< needed for deSaXe
529 	void rotateBy(double);
530 	//Selection
isSelected()531 	bool isSelected() const { return m_isSelected; }
532 	void setSelected(bool);
533 	//Image Data
imageXScale()534 	double imageXScale() const { return m_imageXScale; }
imageYScale()535 	double imageYScale() const { return m_imageYScale; }
536 	void setImageXScale(double);
537 	void setImageYScale(double);
538 	void setImageXYScale(double, double);
imageXOffset()539 	double imageXOffset() const { return m_imageXOffset; }
imageYOffset()540 	double imageYOffset() const { return m_imageYOffset; }
541 	void setImageXOffset(double);
542 	void setImageYOffset(double);
543 	void moveImageXYOffsetBy(double, double);
544 	void setImageXYOffset(double, double);
imageRotation()545 	double imageRotation() const { return m_imageRotation; }
546 	void setImageRotation(double newRotation);
547 	//Rounded Corners
cornerRadius()548 	double cornerRadius() const { return m_roundedCornerRadius; }
549 	void setCornerRadius(double);
550 	// PDF bookmark
isPDFBookmark()551 	bool isPDFBookmark() const { return isBookmark; }
setIsPDFBookmark(bool val)552 	void setIsPDFBookmark(bool val) { isBookmark = val; }
553 
gradientType()554 	int gradientType() const { return GrType; } ///< 0=none, 1,2,3,4=linear, 5=radial, 6=free linear, 7=free radial, 8=pattern
555 	void setGradientType(int val);
556 
gradientStart()557 	QPointF gradientStart() const { return QPointF(GrStartX, GrStartY); }
gradientStartX()558 	double gradientStartX() const { return GrStartX; }
gradientStartY()559 	double gradientStartY() const { return GrStartY; }
560 	void setGradientStart(double x, double y);
561 
gradientEnd()562 	QPointF gradientEnd() const { return QPointF(GrEndX, GrEndY); }
gradientEndX()563 	double gradientEndX() const { return GrEndX; }
gradientEndY()564 	double gradientEndY() const { return GrEndY; }
565 	void setGradientEnd(double x, double y);
566 
gradientFocal()567 	QPointF gradientFocal() const { return QPointF(GrFocalX, GrFocalY); }
gradientFocalX()568 	double gradientFocalX() const { return GrFocalX; }
gradientFocalY()569 	double gradientFocalY() const { return GrFocalY; }
570 	void setGradientFocal(double x, double y);
571 
gradientScale()572 	double gradientScale() const { return GrScale; }
573 	void setGradientScale(double val);
gradientSkew()574 	double gradientSkew() const { return GrSkew; }
575 	void setGradientSkew(double val);
576 
gradientMaskStart()577 	QPointF gradientMaskStart() const { return QPointF(GrMaskStartX, GrMaskStartY); }
gradientMaskStartX()578 	double  gradientMaskStartX() const { return GrMaskStartX; }
gradientMaskStartY()579 	double  gradientMaskStartY() const { return GrMaskStartY; }
580 	void setGradientMaskStart(double x, double y);
581 
gradientMaskEnd()582 	QPointF gradientMaskEnd() const { return QPointF(GrMaskEndX, GrMaskEndY); }
gradientMaskEndX()583 	double gradientMaskEndX() const { return GrMaskEndX; }
gradientMaskEndY()584 	double gradientMaskEndY() const { return GrMaskEndY; }
585 	void setGradientMaskEnd(double x, double y);
586 
gradientMaskFocal()587 	QPointF gradientMaskFocal() const { return QPointF(GrMaskFocalX, GrMaskFocalY); }
gradientMaskFocalX()588 	double gradientMaskFocalX() const { return GrMaskFocalX; }
gradientMaskFocalY()589 	double gradientMaskFocalY() const { return GrMaskFocalY; }
590 	void setGradientMaskFocal(double x, double y);
591 
gradientMaskScale()592 	double gradientMaskScale() const { return GrMaskScale; }
593 	void setGradientMaskScale(double val);
gradientMaskSkew()594 	double gradientMaskSkew() const { return GrMaskSkew; }
595 	void setGradientMaskSkew(double val);
596 
gradientControl1()597 	FPoint gradientControl1() const { return GrControl1; }
598 	void setGradientControl1(const FPoint& val);
gradientControl2()599 	FPoint gradientControl2() const { return GrControl2; }
600 	void setGradientControl2(const FPoint& val);
gradientControl3()601 	FPoint gradientControl3() const { return GrControl3; }
602 	void setGradientControl3(const FPoint& val);
gradientControl4()603 	FPoint gradientControl4() const { return GrControl4; }
604 	void setGradientControl4(const FPoint& val);
gradientControl5()605 	FPoint gradientControl5() const { return GrControl5; }
606 	void setGradientControl5(const FPoint& val);
607 
gradientStrokeScale()608 	double gradientStrokeScale() const { return GrStrokeScale; }
609 	void setGradientStrokeScale(double val);
gradientStrokeSkew()610 	double gradientStrokeSkew() const { return GrStrokeSkew; }
611 	void setGradientStrokeSkew(double val);
612 
gradientStrokeFocal()613 	QPointF gradientStrokeFocal() const { return QPointF(GrStrokeFocalX, GrStrokeFocalY); }
gradientStrokeFocalX()614 	double gradientStrokeFocalX() const { return GrStrokeFocalX; }
gradientStrokeFocalY()615 	double gradientStrokeFocalY() const { return GrStrokeFocalY; }
616 	void setGradientStrokeFocal(double x, double y);
617 
gradientStrokeStart()618 	QPointF gradientStrokeStart() const { return QPointF(GrStrokeStartX, GrStrokeStartY); }
gradientStrokeStartX()619 	double gradientStrokeStartX() const { return GrStrokeStartX; }
gradientStrokeStartY()620 	double gradientStrokeStartY() const { return GrStrokeStartY; }
621 	void setGradientStrokeStart(double x, double y);
622 
gradientStrokeEnd()623 	QPointF gradientStrokeEnd() const { return QPointF(GrStrokeEndX, GrStrokeEndY); }
gradientStrokeEndX()624 	double gradientStrokeEndX() const { return GrStrokeEndX; }
gradientStrokeEndY()625 	double gradientStrokeEndY() const { return GrStrokeEndY; }
626 	void setGradientStrokeEnd(double x, double y);
627 
gradientCol1()628 	QString gradientCol1() const { return GrColorP1; }
629 	void setGradientCol1(const QString& val);
gradientCol2()630 	QString gradientCol2() const { return GrColorP2; }
631 	void setGradientCol2(const QString& val);
gradientCol3()632 	QString gradientCol3() const { return GrColorP3; }
633 	void setGradientCol3(const QString& val);
gradientCol4()634 	QString gradientCol4() const { return GrColorP4; }
635 	void setGradientCol4(const QString& val);
636 
gradientTransp1()637 	double gradientTransp1() const { return GrCol1transp; }
638 	void setGradientTransp1(double val);
gradientTransp2()639 	double gradientTransp2() const { return GrCol2transp; }
640 	void setGradientTransp2(double val);
gradientTransp3()641 	double gradientTransp3() const { return GrCol3transp; }
642 	void setGradientTransp3(double val);
gradientTransp4()643 	double gradientTransp4() const { return GrCol4transp; }
644 	void setGradientTransp4(double val);
645 
gradientShade1()646 	int gradientShade1() const { return GrCol1Shade; }
647 	void setGradientShade1(int val);
gradientShade2()648 	int gradientShade2() const { return GrCol2Shade; }
649 	void setGradientShade2(int val);
gradientShade3()650 	int gradientShade3() const { return GrCol3Shade; }
651 	void setGradientShade3(int val);
gradientShade4()652 	int gradientShade4() const { return GrCol4Shade; }
653 	void setGradientShade4(int val);
654 
gradientColor1()655 	QColor gradientColor1() const { return m_grQColorP1; }
656 	void setGradientColor1(const QColor& val);
gradientColor2()657 	QColor gradientColor2() const { return m_grQColorP2; }
658 	void setGradientColor2(const QColor& val);
gradientColor3()659 	QColor gradientColor3() const { return m_grQColorP3; }
660 	void setGradientColor3(const QColor& val);
gradientColor4()661 	QColor gradientColor4() const { return m_grQColorP4; }
662 	void setGradientColor4(const QColor& val);
663 
664 	void setGradientExtend(VGradient::VGradientRepeatMethod val);
665 	void setStrokeGradientExtend(VGradient::VGradientRepeatMethod val);
666 	VGradient::VGradientRepeatMethod getGradientExtend();
667 	VGradient::VGradientRepeatMethod getStrokeGradientExtend();
668 
669 	//>> ********* Attributes of the item *********
670 
getSnapToPatchGrid()671 	bool getSnapToPatchGrid() const { return snapToPatchGrid; }
672 	void setSnapToPatchGrid(bool val);
673 	void setMaskGradient(const VGradient& grad);
674 	void setFillGradient(const VGradient& grad);
675 	void setStrokeGradient(const VGradient& grad);
676 	void set4ColorGeometry(FPoint c1, FPoint c2, FPoint c3, FPoint c4);
677 	void set4ColorTransparency(double t1, double t2, double t3, double t4);
678 	void set4ColorShade(int t1, int t2, int t3, int t4);
679 	void set4ColorColors(const QString& col1, const QString& col2, const QString& col3, const QString& col4);
680 	void get4ColorGeometry(FPoint& c1, FPoint& c2, FPoint& c3, FPoint& c4);
681 	void setDiamondGeometry(const FPoint& c1, const FPoint& c2, const FPoint& c3, const FPoint& c4, const FPoint& c5);
682 	void get4ColorTransparency(double &t1, double &t2, double &t3, double &t4);
683 	void get4ColorColors(QString &col1, QString &col2, QString &col3, QString &col4);
684 	void setMeshPointColor(int x, int y, const QString& color, int shade, double transparency, bool forPatch = false);
685 	void createGradientMesh(int rows, int cols);
686 	void resetGradientMesh();
687 	void meshToShape();
688 	void createConicalMesh();
689 	VColorStop computeInBetweenStop(VColorStop* last, VColorStop* actual, double t);
690 	void gradientVector(double& startX, double& startY, double& endX, double& endY, double &focalX, double &focalY, double &scale, double &skew) const;
691 	void setGradientVector(double startX, double startY, double endX, double endY, double focalX, double focalY, double scale, double skew);
692 
strokeGradientType()693 	int strokeGradientType() const { return GrTypeStroke; }
694 	void setStrokeGradientType(int val);
695 	void strokeGradientVector(double& startX, double& startY, double& endX, double& endY, double &focalX, double &focalY, double &scale, double &skew) const;
696 	void setStrokeGradientVector(double startX, double startY, double endX, double endY, double focalX, double focalY, double scale, double skew);
697 
maskType()698 	int maskType() const { return GrMask; }
699 	void setMaskType(int val);
700 	void setGradientMask(const QString &newMask);
701 	void setPatternMask(const QString &newMask);
gradientMask()702 	QString gradientMask() const { return gradientMaskVal; }
patternMask()703 	QString patternMask() const { return patternMaskVal; }
704 	void maskVector(double& startX, double& startY, double& endX, double& endY, double &focalX, double &focalY, double &scale, double &skew) const;
705 	void setMaskVector(double startX, double startY, double endX, double endY, double focalX, double focalY, double scale, double skew);
706 	void maskTransform(double &scaleX, double &scaleY, double &offsetX, double &offsetY, double &rotation, double &skewX, double &skewY) const;
707 	void setMaskTransform(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY);
708 	void setMaskFlip(bool flipX, bool flipY);
709 	void maskFlip(bool &flipX, bool &flipY);
710 	//
fillEvenOdd()711 	bool fillEvenOdd() const { return fillRule; }
setFillEvenOdd(bool val)712 	void setFillEvenOdd(bool val) { fillRule = val; }
713 	//
overprint()714 	bool overprint() const { return doOverprint; }
715 	void setOverprint(bool val);
716 
717 	// soft shadow
718 	void setHasSoftShadow(bool val);
hasSoftShadow()719 	bool hasSoftShadow() const { return m_hasSoftShadow; }
720 
721 	void setSoftShadowColor(const QString &val);
softShadowColor()722 	QString softShadowColor() const { return m_softShadowColor; }
723 
724 	void setSoftShadowShade(int val);
softShadowShade()725 	int softShadowShade() const { return m_softShadowShade; }
726 
727 	void setSoftShadowBlurRadius(double val);
softShadowBlurRadius()728 	double softShadowBlurRadius() const { return m_softShadowBlurRadius; }
729 
730 	void setSoftShadowXOffset(double val);
softShadowXOffset()731 	double softShadowXOffset() const { return m_softShadowXOffset; }
732 
733 	void setSoftShadowYOffset(double val);
softShadowYOffset()734 	double softShadowYOffset() const { return m_softShadowYOffset; }
735 
736 	void setSoftShadowOpacity(double val);
softShadowOpacity()737 	double softShadowOpacity() const { return m_softShadowOpacity; }
738 
739 	void setSoftShadowBlendMode(int val);
softShadowBlendMode()740 	double softShadowBlendMode() const { return m_softShadowBlendMode; }
741 
742 	void setSoftShadowErasedByObject(bool val);
softShadowErasedByObject()743 	bool softShadowErasedByObject() const { return m_softShadowErasedByObject; }
744 
745 	void setSoftShadowHasObjectTransparency(bool val);
softShadowHasObjectTransparency()746 	bool softShadowHasObjectTransparency() { return m_softShadowHasObjectTransparency; }
747 
frameType()748 	int frameType() const { return FrameType; } ///< rect / oval / round / other
setFrameType(int val)749 	void setFrameType(int val) { FrameType = val; }
750 	//
hasDefaultShape()751 	bool hasDefaultShape() const { return !ClipEdited; }
setHasDefaultShape(bool val)752 	void setHasDefaultShape(bool val) { ClipEdited = !val; }
753 	//
isAutoFrame()754 	bool isAutoFrame() const { return isAutoText; }
setIsAutoFrame(bool val)755 	void setIsAutoFrame(bool val) { isAutoText = val; }
756 	//
keepAspectRatio()757 	bool keepAspectRatio() const { return AspectRatio; }
setKeepAspectRatio(bool val)758 	void setKeepAspectRatio(bool val) { AspectRatio = val; }
759 	//
fitImageToFrame()760 	bool fitImageToFrame() const { return !ScaleType; }
setFitImageToFrame(bool val)761 	void setFitImageToFrame(bool val) { ScaleType = !val; }
isImageInline()762 	bool isImageInline() const { return isInlineImage; }
setImageInline(bool val)763 	void setImageInline(bool val) { isInlineImage = val; }
setInlineExt(const QString & val)764 	void setInlineExt(const QString& val) { inlineExt = val; }
765 	void setInlineData(const QString& data);
766 	void makeImageInline();
767 	void makeImageExternal(const QString& path);
768 
769 	//Text Data - Move to PageItem_TextFrame at some point? --- no, to FrameStyle, av
textToFrameDistLeft()770 	double textToFrameDistLeft() const { return m_textDistanceMargins.left(); }
textToFrameDistRight()771 	double textToFrameDistRight() const { return m_textDistanceMargins.right(); }
textToFrameDistTop()772 	double textToFrameDistTop() const { return m_textDistanceMargins.top(); }
textToFrameDistBottom()773 	double textToFrameDistBottom() const { return m_textDistanceMargins.bottom(); }
columns()774 	int columns() const { return m_columns; }
columnGap()775 	double columnGap() const { return m_columnGap; }
776 	double gridOffset() const;
777 	double gridDistance() const;
778 	int verticalAlignment();
779 	void setTextToFrameDistLeft(double);
780 	void setTextToFrameDistRight(double);
781 	void setTextToFrameDistTop(double);
782 	void setTextToFrameDistBottom(double);
783 	void setColumns(int);
784 	void setColumnGap(double);
785 	void setGridOffset(double);
786 	void setGridDistance(double);
787 	void setVerticalAlignment(int);
788 	FirstLineOffsetPolicy firstLineOffset()const;
789 	void setFirstLineOffset(FirstLineOffsetPolicy);
790 	/**
791 	 * \brief Set the text to frame distances all at once
792 	 * @param newLeft left distance
793 	 * @param newRight right distance
794 	 * @param newTop top distance
795 	 * @param newBottom bottom distance
796 	 */
797 	void setTextToFrameDist(double newLeft, double newRight, double newTop, double newBottom);
798 
799 	/**  @brief Get name of the item
800 	 *
801 	 * This is unrelated to QObject::name(); the pageItem's name is independent
802 	 * of its Qt name.
803 	 * See also PageItem::setItemName()
804 	 */
itemName()805 	QString itemName() const { return m_itemName; }
806 	/**
807 	 * @brief Set name of the item
808 	 * @param newName name for the item
809 	 * @author Riku Leino
810 	 *
811 	 * Note that this is unrelated to QObject::setName()
812 	 * See also PageItem::itemName()
813 	 */
814 	void setItemName(const QString& newName);
815 
816 	/**
817 	* @brief Set the masterpage the object is on
818 	* @param mpName name of the master page
819 	*/
setMasterPage(int page,const QString & mpName)820 	virtual void setMasterPage(int page, const QString& mpName) { OwnPage = page; OnMasterPage = mpName; }
821 
822 	/**
823 	 * @brief Set the masterpage the object is on
824 	 * @param mpName name of the master page
825 	 */
setMasterPageName(const QString & mpName)826 	virtual void setMasterPageName(const QString& mpName) { OnMasterPage = mpName; }
827 
828 	/**
829 	* @brief Set the page "owning" the object
830 	* @param page index of the page
831 	*/
setOwnerPage(int page)832 	virtual void setOwnerPage(int page) { OwnPage = page; }
833 
834 	/**
835 	 * @brief Get the name of the gradient of the object
836 	 */
gradient()837 	QString gradient() const { return m_gradientName; }
838 
839 	/**
840 	 * @brief Set the fill gradient of the object.
841 	 * @param newGradient fill gradient for the object
842 	 */
843 	void setGradient(const QString &newGradient);
844 
845 	/** @brief Get the name of the stroke gradient of the object */
strokeGradient()846 	QString strokeGradient() const { return gradientStrokeVal; }
847 
848 	/**
849 	 * @brief Set the stroke gradient of the object.
850 	 * @param newGradient stroke gradient for the object
851 	 */
852 	void setStrokeGradient(const QString &newGradient);
853 
854 	/** @brief Get the name of the pattern of the object */
pattern()855 	QString pattern() const { return m_patternName; }
856 
857 	/** @brief Get the pattern transformation matrix of the object */
858 	void patternTransform(double &scaleX, double &scaleY, double &offsetX, double &offsetY, double &rotation, double &skewX, double &skewY) const;
859 
860 	/**
861 	 * @brief Set the fill pattern of the object.
862 	 * @param newPattern fill pattern for the object
863 	 */
864 	void setPattern(const QString &newPattern);
865 
866 	/**
867 	 * @brief Set the fill pattern transformation of the object.
868 	 */
869 	void setPatternTransform(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY);
870 	void setPatternFlip(bool flipX, bool flipY);
871 	void patternFlip(bool &flipX, bool &flipY);
872 
873 	/** @brief Get the (name of the) fill color of the object */
fillColor()874 	QString fillColor() const { return m_fillColor; }
875 	/**
876 	 * @brief Set the fill color of the object.
877 	 * @param newColor fill color for the object
878 	 */
879 	void setFillColor(const QString &newColor);
880 
881 	/** @brief Get the shade of the fill color */
fillShade()882 	double fillShade() const { return m_fillShade; }
883 	/**
884 	 * @brief Set the fill color shade.
885 	 * @param newShade shade for the fill color
886 	 */
887 	void setFillShade(double newShade);
888 
889 	/** @brief Get the transparency of the fill color */
fillTransparency()890 	double fillTransparency() const { return m_fillTransparency; }
891 	/**
892 	 * @brief Set the transparency of the fill color.
893 	 * @param newTransparency transparency of the fill color
894 	 */
895 	void setFillTransparency(double newTransparency);
896 
897 	/** @brief Get the blendmode of the fill color */
fillBlendmode()898 	int fillBlendmode() const { return m_fillBlendMode; }
899 	/**
900 	 * @brief Set the blendmode of the fill color.
901 	 * @param newBlendmode blendmode of the fill color
902 	 */
903 	void setFillBlendmode(int newBlendmode);
904 
905 	/** @brief Get the blendmode of the stroke color */
lineBlendmode()906 	int lineBlendmode() const { return m_lineBlendMode; }
907 	/**
908 	 * @brief Set the blendmode of the stroke color.
909 	 * @param newBlendmode blendmode of the stroke color
910 	 */
911 	void setLineBlendmode(int newBlendmode);
912 
913 	/** @brief Get the line color of the object */
lineColor()914 	QString lineColor() const { return m_lineColor; }
915 	/**
916 	 * @brief Set the line color of the object.
917 	 * @param newColor line color for the object
918 	 */
919 	void setLineColor(const QString &newColor);
920 
921 	/** @brief Get the line color shade */
lineShade()922 	double lineShade() const { return m_lineShade; }
923 	/**
924 	 * @brief Set the line color shade.
925 	 * @param newShade shade for the line color
926 	 */
927 	void setLineShade(double newShade);
928 
929 	/** @brief Get the line transparency */
lineTransparency()930 	double lineTransparency() const { return m_lineTransparency; }
931 	/**
932 	 * @brief Set the transparency of the line color.
933 	 * @param newTransparency transparency of the line color
934 	 */
935 	void setLineTransparency(double newTransparency);
936 
937 	void setHatchParameters(int mode, double distance, double angle, bool useBackground, const QString& background, const QString& foreground);
938 
939 	/** @brief Get the name of the stroke pattern of the object */
strokePattern()940 	QString strokePattern() const { return patternStrokeVal; }
941 
942 	/** @brief Get the stroke pattern transformation matrix of the object */
943 	void strokePatternTransform(double &scaleX, double &scaleY, double &offsetX, double &offsetY, double &rotation, double &skewX, double &skewY, double &space) const;
944 
945 	/**
946 	 * @brief Set the stroke pattern of the object.
947 	 * @param newPattern stroke pattern for the object
948 	 */
949 	void setStrokePattern(const QString &newPattern);
950 
951 	/**
952 	 * @brief Set the stroke pattern transformation of the object.
953 	 */
954 	void setStrokePatternTransform(double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, double space);
955 	void setStrokePatternFlip(bool flipX, bool flipY);
956 	void strokePatternFlip(bool &flipX, bool &flipY);
957 	void setStrokePatternToPath(bool enable);
958 	bool isStrokePatternToPath();
959 
960 	/** @brief Set the QColor for the line */
961 	void setLineQColor();
962 	/** @brief Set the QColor for the fill */
963 	void setFillQColor();
964 
965 	/** @brief Get the style of line */
lineStyle()966 	Qt::PenStyle lineStyle() const { return PLineArt; }
967 	/**
968 	 * @brief Set the style of line.
969 	 * @param newStyle style of line
970 	 * @sa Qt::PenStyle
971 	 */
972 	void setLineStyle(Qt::PenStyle newStyle);
973 
974 	/** @brief Get the width of the line */
lineWidth()975 	double lineWidth() const { return m_lineWidth; }
976 	/**
977 	 * @brief Set the width of line
978 	 * @param newWidth width of line
979 	 */
980 	void setLineWidth(double newWidth);
981 
982 	/** @brief Get the end cap style of the line */
lineEnd()983 	Qt::PenCapStyle lineEnd() const { return PLineEnd; }
984 	/**
985 	 * @brief Set the end style of line
986 	 * @param newStyle end style of line
987 	 * @sa Qt::PenCapStyle
988 	 */
989 	void setLineEnd(Qt::PenCapStyle newStyle);
990 
991 	/** @brief Get the join style of multi-segment lines */
lineJoin()992 	Qt::PenJoinStyle lineJoin() const { return PLineJoin; }
993 	/**
994 	 * @brief Set the join style of line
995 	 * @param newStyle join style of line
996 	 * @sa Qt::PenJoinStyle
997 	 */
998 	void setLineJoin(Qt::PenJoinStyle newStyle);
999 
1000 	/** @brief Get name of active custom line style */
customLineStyle()1001 	QString customLineStyle() const { return NamedLStyle; }
1002 	/**
1003 	 * @brief Set custom line style
1004 	 * @param newStyle name of the custom style
1005 	 */
1006 	void setCustomLineStyle(const QString& newStyle);
1007 
1008 	/** @brief Get start arrow index
1009 	 * @sa PageItem::endArrowIndex(), PageItem::setStartArrowIndex()
1010 	 */
startArrowIndex()1011 	int startArrowIndex() const { return m_startArrowIndex; }
1012 	/**
1013 	 * @brief Set start arrow index
1014 	 * @param newIndex index for start arrow
1015 	 */
1016 	void setStartArrowIndex(int newIndex);
1017 
1018 	/** @brief Get end arrow index
1019 	 * @sa PageItem::startArrowIndex(), PageItem::setEndArrowIndex()
1020 	 */
endArrowIndex()1021 	int endArrowIndex() const { return m_endArrowIndex; }
1022 	/**
1023 	 * @brief Set end arrow index
1024 	 * @param newIndex index for end arrow
1025 	 */
1026 	void setEndArrowIndex(int newIndex);
1027 
1028 	/** @brief Get start arrow scale
1029 	 * @sa PageItem::endArrowIndex(), PageItem::setStartArrowIndex()
1030 	 */
startArrowScale()1031 	int startArrowScale() const { return m_startArrowScale; }
1032 	/**
1033 	 * @brief Set start arrow scale
1034 	 * @param newIndex scale for start arrow
1035 	 */
1036 	void setStartArrowScale(int newScale);
1037 
1038 	/** @brief Get end arrow scale
1039 	 * @sa PageItem::startArrowIndex(), PageItem::setEndArrowIndex()
1040 	 */
endArrowScale()1041 	int endArrowScale() const { return m_endArrowScale; }
1042 	/**
1043 	 * @brief Set end arrow scale
1044 	 * @param newIndex scale for end arrow
1045 	 */
1046 	void setEndArrowScale(int newScale);
1047 
1048 	/** @brief Is the image flipped horizontally? */
imageFlippedH()1049 	bool imageFlippedH() const { return m_ImageIsFlippedH; }
1050 	/** @brief Horizontally flip / unflip the image */
1051 	void setImageFlippedH(bool flipped);
1052 	/** @brief Flip an image horizontally. */
1053 	void flipImageH();
1054 
1055 	/** @brief Is the image flipped vertically? */
imageFlippedV()1056 	bool imageFlippedV() const { return m_ImageIsFlippedV; }
1057 	/** @brief Vertically flip / unflip the image */
1058 	void setImageFlippedV(bool flipped);
1059 	/** @brief Flip an image vertically */
1060 	void flipImageV();
1061 
1062 	/**
1063 	 * @brief Set the image scaling mode.
1064 	 * @param freeScale is the scaling free (not forced to frame size)
1065 	 * @param keepRatio should the image's aspect ratio be respected
1066 	 */
1067 	void setImageScalingMode(bool freeScale, bool keepRatio);
1068 
1069 	/** @brief Lock or unlock this pageitem. */
1070 	void toggleLock();
1071 	/** @brief is the item locked ? */
locked()1072 	bool locked() const { return m_Locked; }
1073 	/** @brief Lock or unlock this pageitem */
1074 	void setLocked(bool isLocked);
1075 
1076 	/** @brief Toggle lock for resizing */
1077 	void toggleSizeLock();
1078 	/** @brief Is the item's size locked? */
sizeLocked()1079 	bool sizeLocked() const { return m_SizeLocked; }
sizeHLocked()1080 	bool sizeHLocked() const { return m_SizeHLocked || m_SizeLocked; }
sizeVLocked()1081 	bool sizeVLocked() const { return m_SizeVLocked || m_SizeLocked; }
1082 	/** @brief set lock for resizing */
1083 	void setSizeLocked(bool isLocked);
setSizeHLocked(bool isLocked)1084 	void setSizeHLocked(bool isLocked) { m_SizeHLocked = isLocked; }
setSizeVLocked(bool isLocked)1085 	void setSizeVLocked(bool isLocked) { m_SizeVLocked = isLocked; }
1086 
1087 	/**
1088 	 * @brief Does text flow around this object and how
1089 	 * @sa setTextFlowMode()
1090 	 */
textFlowMode()1091 	TextFlowMode textFlowMode() const { return m_textFlowMode; }
1092 
1093 	/**
1094 	 * @brief Changes the way text flows around this item
1095 	 * @param mode true if text is wanted to flow around this object or false if not
1096 	 * @sa textFlowMode()
1097 	 */
1098 	void setTextFlowMode(TextFlowMode mode);
1099 
1100 	/**
1101 	 * @brief If text should flow around object frame
1102 	 * @sa PageItem::setTextFlowMode()
1103 	 */
textFlowAroundObject()1104 	bool textFlowAroundObject() const { return (m_textFlowMode != TextFlowDisabled); }
1105 
1106 	/**
1107 	 * @brief If text should flow around object frame
1108 	 * @sa PageItem::setTextFlowMode()
1109 	 */
textFlowUsesFrameShape()1110 	bool textFlowUsesFrameShape() const { return (m_textFlowMode == TextFlowUsesFrameShape); }
1111 
1112 	/**
1113 	 * @brief If text should flow around bounding box
1114 	 * @sa PageItem::setTextFlowMode()
1115 	 */
textFlowUsesBoundingBox()1116 	bool textFlowUsesBoundingBox() const { return (m_textFlowMode == TextFlowUsesBoundingBox); }
1117 
1118 	/**
1119 	 * @brief If text should flow around contour line
1120 	 * @sa PageItem::setTextFlowMode()
1121 	 */
textFlowUsesContourLine()1122 	bool textFlowUsesContourLine() const { return (m_textFlowMode == TextFlowUsesContourLine); }
1123 
1124 	/**
1125 	 * @brief If text should flow around image clipping path
1126 	 * @sa PageItem::setTextFlowMode()
1127 	 */
textFlowUsesImageClipping()1128 	bool textFlowUsesImageClipping() const { return (m_textFlowMode == TextFlowUsesImageClipping); }
1129 
1130 	/**
1131 	 * @brief To be called carefully because it eventually triggers a relayout of long text frames strings, but necessarily when you change the document.
1132 	 * @param allItems While you generally want to check for items below, it can happen that you want to update full range of text frames (e.g. when shuffle items order). Default to false.
1133 	 */
1134 	void checkTextFlowInteractions(bool allItems = false);
1135 
1136 	/**
1137 	 * @brief To be called carefully because it eventually triggers a relayout of long text frames strings, but necessarily when you change the document.
1138 	 * @param baseRect The area over which text flow interactions should be checked
1139 	 * @param allItems While you generally want to check for items below, it can happen that you want to update full range of text frames (e.g. when shuffle items order). Default to false.
1140 	 */
1141 	void checkTextFlowInteractions(const QRectF& baseRect, bool allItems = false);
1142 
1143 	/** @brief Get the frame type
1144 	 *
1145 	 * @attention The whole concept of frame types is due for some radical
1146 	 *            re-working, so don't rely on this interface staying stable.
1147 	 *            It's here as an interim step to eliminate direct member access
1148 	 *            on PageItems.
1149 	 */
itemType()1150 	ItemType itemType() const { return m_itemType; }
1151 	/** @brief Get the subclass item type
1152 	 *
1153 	 * This function should be used everywhere, where a itemType is required, but
1154 	 * no C++ type informations is available. e.g. when saving files, etc.
1155 	 * It returns the same type as itemType() for the standard classes, but
1156 	 * subclasses override it.
1157 	 */
realItemType()1158 	virtual ItemType realItemType() const { return m_itemType; }
1159 	/**
1160 	 * @brief Convert this PageItem to PageItem type <code>newType</code>
1161 	 * @param newType PageItem type for conversion
1162 	 */
1163 	void convertTo(ItemType newType);
1164 
1165 	/**
1166 	 * Set the layer for the item
1167 	 * @param layerId layer where this item is moved
1168 	 */
1169 	virtual void setLayer(int layerId);
1170 
1171 	/**
1172 	 * @brief Check the changes to the item and add undo actions for them.
1173 	 * @param force Force the check. Do not care if mouse button or arrow key is down
1174 	 * check anyway.
1175 	 * @author Riku Leino
1176 	 */
1177 	void checkChanges(bool force = false);
1178 	/**
1179 	 * @name Store undo actions
1180 	 * @brief Add an undo action to the undo guis
1181 	 * @author Riku Leino
1182 	 */
1183 	/*@{*/
1184 	void moveUndoAction();
1185 	void resizeUndoAction();
1186 	void rotateUndoAction();
1187 	void changeImageOffsetUndoAction();
1188 	void changeImageScaleUndoAction();
1189 	/*@}*/
1190 	/** @brief Required by the UndoObject */
1191 	void restore(UndoState *state, bool isUndo) override;
1192 
1193 	virtual void getNamedResources(ResourceCollection& lists) const;
1194 	virtual void replaceNamedResources(ResourceCollection& newNames);
1195 
1196 	/**
1197 	 * @brief Return a variant of `originalName' that is guaranteed to be unique
1198 	 *        in the same document as this PageItem.  If the passed name is not
1199 	 *        in use it is returned unchanged.
1200 	 * @author Craig Ringer
1201 	 *
1202 	 * Usually of the form 'Copy of [name]' or 'Copy of [name] (n)'
1203 	 * cezaryece: if prependCopy is false then form '[name] (n)' is generated
1204 	 */
1205 	QString generateUniqueCopyName(const QString& originalName, bool prependCopy = true) const;
1206 	/**
1207 	 * @brief Is this item printed?
1208 	 * @sa setPrintEnabled()
1209 	 */
printEnabled()1210 	bool printEnabled() const { return m_PrintEnabled; }
1211 	/**
1212 	 * @brief Tells if the frame is set to be printed or not
1213 	 * @sa printable()
1214 	 */
1215 	void setPrintEnabled(bool toPrint);
1216 
1217 	/** @brief Toggle printable
1218 	 * @sa setPrintable()
1219 	 */
1220 	void togglePrintEnabled();
1221 
1222 	/**
1223 	 * @brief Load an image into an image frame, moved from ScribusView
1224 	 * @return True if load succeeded
1225 	 */
1226 	virtual bool loadImage(const QString& filename, bool reload, int gsResolution=-1, bool showMsg = false);
1227 
1228 	/**
1229 	 * @brief Connect the item's signals to the GUI, primarily the Properties palette, also some to ScMW
1230 	 * @return
1231 	 */
1232 	bool connectToGUI();
1233 	bool disconnectFromGUI();
1234 	/**
1235 	 * @brief Emit the items properties to the GUI in one go
1236 	 */
1237 	void emitAllToGUI();
1238 
1239 	/**
1240 	 * @brief Get the document that this item belongs to
1241 	 */
doc()1242 	ScribusDoc* doc() const { return m_Doc; }
1243 
isAnnotation()1244 	bool isAnnotation() const { return m_isAnnotation; }
1245 	void setIsAnnotation(bool);
1246 	void setIsBookMark(bool);
1247 	void setAnnotation(const Annotation& ad);
annotation()1248 	Annotation& annotation() { return m_annotation; }
annotation()1249 	const Annotation& annotation() const { return m_annotation; }
1250 
imageVisible()1251 	bool imageVisible() const { return m_imageVisible; }
1252 	void setImageVisible(bool);
1253 
1254 	void updateConstants();
isWelded()1255 	bool isWelded()  {return !weldList.isEmpty(); }  //true if to this item some other items are welded (weldList is list of these items)
1256 	void weldTo(PageItem* item);
1257 	QList<PageItem*> itemsWeldedTo(PageItem* except = nullptr);
1258 	void unWeld();
1259 	void addWelded(PageItem* item);
1260 	void moveWelded(double dX, double dY, int weld);
1261 	void moveWelded(double dX, double dY, PageItem* except = nullptr);
1262 	void rotateWelded(double dR, double oldRot);
1263 	void setWeldPoint(double dX, double dY, PageItem *pItem); 	///< added for autowelding feature of notes frames, setting welding point with given pItem to given coords
1264 	QString getItemTextSaxed(int selStart, int selLength); ///< used by notes frames to get content of notes from itemText
groupClipping()1265 	bool groupClipping() { return m_groupClips; }
setGroupClipping(bool val)1266 	void setGroupClipping(bool val) { m_groupClips = val; }
hasFill()1267 	bool hasFill() { return ((fillColor() != CommonStrings::None) || (GrType != 0)); }
hasStroke()1268 	bool hasStroke() { return ((lineColor() != CommonStrings::None) || (GrTypeStroke != 0) || (!NamedLStyle.isEmpty()) || (!patternStrokeVal.isEmpty())); }
1269 
1270 		// End public functions
1271 
1272 public:	// Start public variables
1273 	int maxCharsInFrame();
1274 	bool AutoName {true};
1275 	double gXpos {0.0};
1276 	double gYpos {0.0};
1277 	double gWidth {0.0};
1278 	double gHeight {0.0};
1279 	int GrType {0}; ///< used values 6 = linear, 7 = radial, 8 = pattern, 9 = 4 color gradient, 10 = diamond, 11,12,13 = mesh gradient, 14 = hatch
1280 	double GrStartX {0.0};
1281 	double GrStartY {0.0};
1282 	double GrEndX {0.0};
1283 	double GrEndY {0.0};
1284 	double GrFocalX {0.0};
1285 	double GrFocalY {0.0};
1286 	double GrScale {1.0};
1287 	double GrSkew {0.0};
1288 	VGradient::VGradientRepeatMethod GrExtend {VGradient::pad};
1289 	FPoint GrControl1;
1290 	FPoint GrControl2;
1291 	FPoint GrControl3;
1292 	FPoint GrControl4;
1293 	FPoint GrControl5;
1294 	QString GrColorP1;
1295 	QString GrColorP2;
1296 	QString GrColorP3;
1297 	QString GrColorP4;
1298 	double GrCol1transp {1.0};
1299 	double GrCol2transp {1.0};
1300 	double GrCol3transp {1.0};
1301 	double GrCol4transp {1.0};
1302 	int GrCol1Shade {100};
1303 	int GrCol2Shade {100};
1304 	int GrCol3Shade {100};
1305 	int GrCol4Shade {100};
1306 	QList<meshGradientPatch> meshGradientPatches;
1307 	QList<QList<MeshPoint> > meshGradientArray;
1308 	int selectedMeshPointX {-1};
1309 	int selectedMeshPointY {-1};
1310 	int selectedMeshControlPoint {0};
1311 	bool snapToPatchGrid {false};
1312 	int m_columns;
1313 	double m_columnGap;
1314 	Qt::PenStyle PLineArt; ///< Linestyle
1315 	Qt::PenCapStyle PLineEnd;
1316 	Qt::PenJoinStyle PLineJoin;
1317 	QString NamedLStyle;
1318 	QPolygon Clip; ///< Defines clipping region of the elements
1319 
1320 	FPointArray PoLine;
1321 	FPointArray ContourLine;
1322 	FPointArray imageClip;
1323 	QList<uint> Segments;
1324 	ScImageEffectList effectsInUse;
1325 	bool PoShow {false};
1326 	double BaseOffs {0.0};
1327 	int textPathType {0};
1328 	bool textPathFlipped {false};
1329 	bool ClipEdited {false};
1330 	int FrameType {0}; ///< Don't know exactly what this is, but it's not the same as itemType
1331 	uint uniqueNr; ///< Internal unique Item-Number, used for the undo system
1332 	int OwnPage; ///< page this element belongs to
1333 	int oldOwnPage; ///< Old page number tracked for the move undo action
1334 	int savedOwnPage;
1335 	ScImage pixm; ///< Darzustellendes Bild
1336 	QString Pfile; ///< Dateiname des Bildes
1337 	QString Pfile2;
1338 	QString Pfile3;
1339 	QString ImageProfile;
1340 	bool UseEmbedded {true};
1341 	QString EmbeddedProfile;
1342 	eRenderIntent ImageIntent;
1343 	bool OverrideCompressionMethod {false};
1344 	int CompressionMethodIndex {0};
1345 	bool OverrideCompressionQuality {false};
1346 	int CompressionQualityIndex {0};
1347 	bool imageIsAvailable {false}; ///< Flag to hold image file availability
1348 	int OrigW {0};
1349 	int OrigH {0};
1350 	double BBoxX {0.0}; ///< Bounding Box-X
1351 	double BBoxH {0.0}; ///< Bounding Box-H
1352 	double CurX {0.0}; ///< Zeichen X-Position
1353 	double CurY {0.0}; ///< Zeichen Y-Position
1354 	StoryText itemText; ///< Text of element
1355 	TextLayout textLayout;
1356 	bool isBookmark {false}; ///< Flag for PDF Bookmark
1357 	bool invalid {true}; ///< Flag indicates that layout has changed (eg. for textlayout)
1358 	bool HasSel {false}; ///< Flag for text selection
1359 	bool FrameOnly {false}; ///< avoid artefacts while moving
1360 	bool isAutoText {false};
1361 	PageItem *Parent {nullptr};
1362 	bool inPdfArticle {false};
1363 	bool isRaster {false};
1364 	double OldB;
1365 	double OldH;
1366 	double OldB2;
1367 	double OldH2;
1368 	bool Sizing {false};
1369 	int  m_layerID;
1370 	bool ScaleType {true};
1371 	bool AspectRatio {true};
1372 	QVector<double> DashValues;
1373 	double DashOffset {0.0};
1374 	VGradient fill_gradient;
1375 	bool fillRule {true};
1376 	bool doOverprint {false};
1377 
1378 	/* Additions for Table Support */
1379 	/* now deprecated with the new PageItem_Table */
1380 	PageItem* m_leftLink {nullptr};
1381 	PageItem* m_rightLink {nullptr};
1382 	PageItem* m_topLink {nullptr};
1383 	PageItem* m_bottomLink {nullptr};
1384 	int LeftLinkID {0};
1385 	int RightLinkID {0};
1386 	int TopLinkID{0};
1387 	int BottomLinkID{0};
1388 	bool LeftLine {false};
1389 	bool RightLine {false};
1390 	bool TopLine {false};
1391 	bool BottomLine {false};
1392 	bool isTableItem {false};
1393 
1394 	/* end deprecated vars */
1395 	bool isSingleSel {false};
1396 	QList<PageItem*> groupItemList;
1397 	double groupWidth {1.0};
1398 	double groupHeight {1.0};
1399 	double BoundingX;
1400 	double BoundingY;
1401 	double BoundingW;
1402 	double BoundingH;
1403 	bool ChangedMasterItem {false};
1404 	QString OnMasterPage;
1405 	bool isEmbedded {false};
1406 	int inlineCharID {0};
1407 	QString inlineExt;
1408 	/** Radius of rounded corners */
1409 	double m_roundedCornerRadius {0.0};
1410 
1411 	//Undo Data
1412 	double oldXpos {0.0}; ///< Stores the old X-position for undo action. Is used to detect move actions.
1413 	double oldYpos {0.0}; ///< Stores the old Y-position for undo action. Is used to detect move actions.
1414 	double oldWidth {0.0}; ///< Stores the old width for undo action. Is used to detect resize actions.
1415 	double oldHeight {0.0}; ///< Stores the old height for undo action. Is used to detect resize actions.
1416 	double oldRot {0.0}; ///< Stores the old rotation value for undo action. Is used to detect rotation actions.
1417 	double oldLocalScX {1.0}; ///< Stores the old LocalScX value for undo action. Is used to detect image scale actions.
1418 	double oldLocalScY {1.0}; ///< Stores the old LocalScY value for undo action. Is used to detect image scale actions.
1419 	double oldLocalX {0.0}; ///< Stores the old LocalX value for undo action. Is used to detect image offset actions.lo j
1420 	double oldLocalY {0.0}; ///< Stores the old LocalY value for undo action. Is used to detect image offset actions.
1421 
1422 	ScribusDoc *m_Doc; ///< Document this item belongs to
1423 
1424 	double m_lineWidth; //< Line width
1425 	double m_oldLineWidth;
1426 
1427 	/**
1428 		* @brief Stroke pattern name
1429 		* @sa PageItem::strokePattern(), PageItem::setStrokePattern()
1430 		*/
1431 	QString patternStrokeVal;
1432 	/**
1433 		* @brief Stroke pattern transformation matrix
1434 		*/
1435 	double patternStrokeScaleX {100.0};
1436 	double patternStrokeScaleY {100.0};
1437 	double patternStrokeOffsetX {0};
1438 	double patternStrokeOffsetY {0};
1439 	double patternStrokeRotation {0};
1440 	double patternStrokeSkewX {0};
1441 	double patternStrokeSkewY {0};
1442 	double patternStrokeSpace {1.0};
1443 	bool patternStrokeMirrorX {false};
1444 	bool patternStrokeMirrorY {false};
1445 	bool patternStrokePath {false};
1446 
1447 	/**
1448 		* @brief Stroke gradient name
1449 		* @sa PageItem::strokeGradient(), PageItem::setStrokeGradient()
1450 		*/
1451 	QString gradientStrokeVal;
1452 	VGradient stroke_gradient;
1453 
1454 	/**
1455 	* @brief Stroke gradient variables
1456 	*/
1457 	int GrTypeStroke {0};
1458 	double GrStrokeStartX {0.0};
1459 	double GrStrokeStartY {0.0};
1460 	double GrStrokeEndX {0.0};
1461 	double GrStrokeEndY {0.0};
1462 	double GrStrokeFocalX {0.0};
1463 	double GrStrokeFocalY {0.0};
1464 	double GrStrokeScale {1.0};
1465 	double GrStrokeSkew {0.0};
1466 	VGradient::VGradientRepeatMethod GrStrokeExtend {VGradient::none};
1467 
1468 	/**
1469 	* @brief Mask gradient variables
1470 	*/
1471 	int GrMask {0};
1472 	double GrMaskStartX {0.0};
1473 	double GrMaskStartY {0.0};
1474 	double GrMaskEndX {0.0};
1475 	double GrMaskEndY {0.0};
1476 	double GrMaskFocalX {0.0};
1477 	double GrMaskFocalY {0.0};
1478 	double GrMaskScale {1.0};
1479 	double GrMaskSkew {0.0};
1480 	double patternMaskScaleX {100.0};
1481 	double patternMaskScaleY {100.0};
1482 	double patternMaskOffsetX {0.0};
1483 	double patternMaskOffsetY {0.0};
1484 	double patternMaskRotation {0.0};
1485 	double patternMaskSkewX {0.0};
1486 	double patternMaskSkewY {0.0};
1487 	bool patternMaskMirrorX {false};
1488 	bool patternMaskMirrorY {false};
1489 	QString patternMaskVal;
1490 	QString gradientMaskVal;
1491 	VGradient mask_gradient;
1492 
1493 	/** Inline Image */
1494 	bool isInlineImage {false};
1495 	bool isTempFile {false};
1496 	//items welding (item follows while item moves which they are connected with)
1497 	struct WeldingInfo
1498 	{
1499 		PageItem *weldItem {nullptr};
1500 		FPoint weldPoint;
1501 		int weldID {0};
1502 	};
1503 	QList<WeldingInfo> weldList;
1504 	double hatchAngle {0.0};
1505 	double hatchDistance {2.0};
1506 	int hatchType {0};				// 0 = single 1 = double 2 = triple
1507 	bool hatchUseBackground {false};
1508 	QString hatchBackground;
1509 	QString hatchForeground;
1510 	QColor  hatchBackgroundQ;
1511 	QColor  hatchForegroundQ;
1512 
1513 	// End public variables
1514 
1515 protected: // Start protected functions
1516 	PageItem(const PageItem & other);
1517 	void DrawObj_ImageFrame(ScPainter *p, double sc);
1518 	void DrawObj_Polygon(ScPainter *p);
1519 	void DrawObj_PolyLine(ScPainter *p);
1520 	void DrawObj_PathText(ScPainter *p, double sc);
1521 	void drawLockedMarker(ScPainter *p);
1522 	void drawArrow(ScPainter *p, QTransform &arrowTrans, int arrowIndex);
1523 
1524 	/** @brief Manages undostack and is where all undo actions/states are sent. */
1525 	UndoManager * const undoManager;
1526 
1527 	/** Split the restore methods */
1528 	bool checkGradientUndoRedo(SimpleState *state, bool isUndo);
1529 
1530 	/**
1531 	 * @name Restore helper methods
1532 	 * Split the restore method for easier handling.
1533 	 * @author Riku Leino
1534 	 */
1535 	/*@{*/
1536 	void restoreAppMode(SimpleState *state, bool isUndo);
1537 	void restoreArc(SimpleState *state,bool isUndo);
1538 	void restoreArrow(SimpleState *state, bool isUndo, bool isStart);
1539 	void restoreBottomTextFrameDist(SimpleState *state, bool isUndo);
1540 	void restoreCharStyle(SimpleState *state, bool isUndo);
1541 	void restoreClearImage(UndoState *state, bool isUndo);
1542 	void restoreColumns(SimpleState *state, bool isUndo);
1543 	void restoreColumnsGap(SimpleState *state, bool isUndo);
1544 	void restoreConnectPath(SimpleState *state, bool isUndo);
1545 	void restoreContourLine(SimpleState *state, bool isUndo);
1546 	void restoreCornerRadius(SimpleState *state, bool isUndo);
1547 	void restoreCreateMeshGrad(SimpleState *state, bool isUndo);
1548 	void restoreCustomLineStyle(SimpleState *state, bool isUndo);
1549 	void restoreDefaultParagraphStyle(SimpleState *state, bool isUndo);
1550 	void restoreDeleteFrameText(SimpleState *state, bool isUndo);
1551 	void restoreDeleteFrameParagraph(SimpleState *state, bool isUndo);
1552 	void restoreDropLinks(UndoState *state, bool isUndo);
1553 	void restoreEndArrowScale(SimpleState *state, bool isUndo);
1554 	void restoreFill(SimpleState *state, bool isUndo);
1555 	void restoreFillGradient(SimpleState *state, bool isUndo);
1556 	void restoreFillTP(SimpleState *state, bool isUndo);
1557 	void restoreFirstLineOffset(SimpleState *state, bool isUndo);
1558 	void restoreGetImage(UndoState *state, bool isUndo);
1559 	void restoreGradPos(SimpleState *state,bool isUndo);
1560 	void restoreGradientCol1(SimpleState *state, bool isUndo);
1561 	void restoreGradientCol2(SimpleState *state, bool isUndo);
1562 	void restoreGradientCol3(SimpleState *state, bool isUndo);
1563 	void restoreGradientCol4(SimpleState *state, bool isUndo);
1564 	void restoreGradientColor1(SimpleState *state, bool isUndo);
1565 	void restoreGradientColor2(SimpleState *state, bool isUndo);
1566 	void restoreGradientColor3(SimpleState *state, bool isUndo);
1567 	void restoreGradientColor4(SimpleState *state, bool isUndo);
1568 	void restoreGradientControl1(SimpleState *state, bool isUndo);
1569 	void restoreGradientControl2(SimpleState *state, bool isUndo);
1570 	void restoreGradientControl3(SimpleState *state, bool isUndo);
1571 	void restoreGradientControl4(SimpleState *state, bool isUndo);
1572 	void restoreGradientControl5(SimpleState *state, bool isUndo);
1573 	void restoreGradientEnd(SimpleState *state, bool isUndo);
1574 	void restoreGradientFocal(SimpleState *state, bool isUndo);
1575 	void restoreGradientMaskEnd(SimpleState *state, bool isUndo);
1576 	void restoreGradientMaskFocal(SimpleState *state, bool isUndo);
1577 	void restoreGradientMaskScale(SimpleState *state, bool isUndo);
1578 	void restoreGradientMaskSkew(SimpleState *state, bool isUndo);
1579 	void restoreGradientMaskStart(SimpleState *state, bool isUndo);
1580 	void restoreGradientMeshColor(SimpleState *state, bool isUndo);
1581 	void restoreGradientScale(SimpleState *state, bool isUndo);
1582 	void restoreGradientShade1(SimpleState *state, bool isUndo);
1583 	void restoreGradientShade2(SimpleState *state, bool isUndo);
1584 	void restoreGradientShade3(SimpleState *state, bool isUndo);
1585 	void restoreGradientShade4(SimpleState *state, bool isUndo);
1586 	void restoreGradientSkew(SimpleState *state, bool isUndo);
1587 	void restoreGradientStart(SimpleState *state, bool isUndo);
1588 	void restoreGradientStrokeEnd(SimpleState *state, bool isUndo);
1589 	void restoreGradientStrokeFocal(SimpleState *state, bool isUndo);
1590 	void restoreGradientStrokeScale(SimpleState *state, bool isUndo);
1591 	void restoreGradientStrokeSkew(SimpleState *state, bool isUndo);
1592 	void restoreGradientStrokeStart(SimpleState *state, bool isUndo);
1593 	void restoreGradientTrans1(SimpleState *state, bool isUndo);
1594 	void restoreGradientTrans2(SimpleState *state, bool isUndo);
1595 	void restoreGradientTrans3(SimpleState *state, bool isUndo);
1596 	void restoreGradientTrans4(SimpleState *state, bool isUndo);
1597 	void restoreGradientType(SimpleState *state, bool isUndo);
1598 	void restoreGradientTypeStroke(SimpleState *state, bool isUndo);
1599 	void restoreImageEffects(UndoState *state, bool isUndo);
1600 	void restoreImageNbr(SimpleState *state,bool isUndo);
1601 	void restoreImageOffsetChange(SimpleState *state, bool isUndo);
1602 	void restoreImageRotation(SimpleState *state, bool isUndo);
1603 	void restoreImageScaleChange(SimpleState *state, bool isUndo);
1604 	void restoreImageScaleMode(SimpleState *state, bool isUndo);
1605 	void restoreInsertFrameText(SimpleState *state, bool isUndo);
1606 	void restoreInsertFrameParagraph(SimpleState *state, bool isUndo);
1607 	void restoreLayer(SimpleState *state, bool isUndo);
1608 	void restoreLeftTextFrameDist(SimpleState *state, bool isUndo);
1609 	void restoreLineColor(SimpleState *state, bool isUndo);
1610 	void restoreLineEnd(SimpleState *state, bool isUndo);
1611 	void restoreLineJoin(SimpleState *state, bool isUndo);
1612 	void restoreLineShade(SimpleState *state, bool isUndo);
1613 	void restoreLineStyle(SimpleState *state, bool isUndo);
1614 	void restoreLineTP(SimpleState *state, bool isUndo);
1615 	void restoreLineWidth(SimpleState *state, bool isUndo);
1616 	void restoreLinkTextFrame(UndoState *state, bool isUndo);
1617 	void restoreMarkString(SimpleState *state, bool isUndo);
1618 	void restoreMaskGradient(SimpleState *state, bool isUndo);
1619 	void restoreMaskType(SimpleState *state,bool isUndo);
1620 	void restoreMove(SimpleState *state, bool isUndo);
1621 	void restoreMoveMeshGrad(SimpleState *state, bool isUndo);
1622 	void restoreMoveMeshPatch(SimpleState *state, bool isUndo);
1623 	void restoreName(SimpleState *state, bool isUndo);
1624 	void restorePStyle(SimpleState *state, bool isUndo);
1625 	void restoreParagraphStyle(SimpleState *state, bool isUndo);
1626 	void restorePasteInline(SimpleState *state, bool isUndo);
1627 	void restorePastePlainText(SimpleState *state, bool isUndo);
1628 	void restorePasteText(SimpleState *state, bool isUndo);
1629 	void restorePathOperation(UndoState *state, bool isUndo);
1630 	void restorePoly(SimpleState *state, bool isUndo, bool isContour);
1631 	void restorePolygon(SimpleState *state,bool isUndo);
1632 	void restoreRemoveMeshPatch(SimpleState *state, bool isUndo);
1633 	void restoreResTyp(SimpleState *state, bool isUndo);
1634 	void restoreResetMeshGrad(SimpleState *state, bool isUndo);
1635 	void restoreResize(SimpleState *state, bool isUndo);
1636 	void restoreRightTextFrameDist(SimpleState *state, bool isUndo);
1637 	void restoreRotate(SimpleState *state, bool isUndo);
1638 	void restoreSetCharStyle(SimpleState *state, bool isUndo);
1639 	void restoreSetParagraphStyle(SimpleState *state, bool isUndo);
1640 	void restoreShade(SimpleState *state, bool isUndo);
1641 	void restoreShapeContour(UndoState *state, bool isUndo);
1642 	void restoreShapeType(SimpleState *state, bool isUndo);
1643 	void restoreShowImage(SimpleState *state, bool isUndo);
1644 	void restoreSnapToPatchGrid(SimpleState *state, bool isUndo);
1645 	void restoreSpiral(SimpleState *state, bool isUndo);
1646 	void restoreSplitItem(SimpleState *state, bool isUndo);
1647 	void restoreStartArrowScale(SimpleState *state, bool isUndo);
1648 	void restoreStrokeGradient(SimpleState *state, bool isUndo);
1649 	void restoreTextFlowing(SimpleState *state, bool isUndo);
1650 	void restoreTopTextFrameDist(SimpleState *state, bool isUndo);
1651 	void restoreTransform(SimpleState *state,bool isUndo);
1652 	void restoreType(SimpleState *state, bool isUndo);
1653 	void restoreUnWeldItem(SimpleState *state, bool isUndo);
1654 	void restoreUniteItem(SimpleState *state, bool isUndo);
1655 	void restoreUnlinkTextFrame(UndoState *state, bool isUndo);
1656 	void restoreVerticalAlign(SimpleState *state, bool isUndo);
1657 	void restoreWeldItems(SimpleState *state, bool isUndo);
1658 	void restoreSoftShadow(SimpleState *state, bool isUndo);
1659 	void restoreSoftShadowColor(SimpleState *state, bool isUndo);
1660 	void restoreSoftShadowShade(SimpleState *state, bool isUndo);
1661 	void restoreSoftShadowBlurRadius(SimpleState *state, bool isUndo);
1662 	void restoreSoftShadowXOffset(SimpleState *state, bool isUndo);
1663 	void restoreSoftShadowYOffset(SimpleState *state, bool isUndo);
1664 	void restoreSoftShadowOpacity(SimpleState *state, bool isUndo);
1665 	void restoreSoftShadowBlendMode(SimpleState *state, bool isUndo);
1666 	void restoreSoftShadowErasedByObject(SimpleState *state, bool isUndo);
1667 	void restoreSoftShadowHasObjectTransparency(SimpleState *state, bool isUndo);
1668 
1669 
1670 	/*@}*/
1671 
1672 	/**
1673 	 * @brief Returns true if the actions should be sent to the UndoManager.
1674 	 *
1675 	 * Checks the state of the arrow keys and mouse buttons. If a key or a
1676 	 * mouse button is down PageItem is under some action which should only be
1677 	 * stored after the action has been finished (to get a single undo action).
1678 	 * @return true if the actions should be sent to the UndoManager based on the
1679 	 * state of arrow keys and mouse buttons else returns false.
1680 	 */
1681 	bool shouldCheck();
1682 	void select(); ///< Clears the current selection and selects this PageItem.
1683 
1684 		// End protected functions
1685 
1686 protected: // Start protected variables
1687 	PageItem *m_backBox {nullptr};
1688 	PageItem *m_nextBox {nullptr};
1689 	int  firstChar {0};
1690 	int  m_maxChars {0};
1691 	bool m_sampleItem {false}; ///< Used to not draw the frame for sample items
1692 	MarginStruct m_textDistanceMargins; ///< Left, Top, Bottom, Right distances of text from the frame
1693 	int verticalAlign {0};
1694 	/**
1695 	 * @brief Frame Type, eg line, text frame, etc.
1696 	 *
1697 	 * This will probably go away when pageitem is split into
1698 	 * subclasses.
1699 	 */
1700 	ItemType m_itemType;
1701 
1702 	/**
1703 	 * @brief Item name. Unicode. User visible (outline, property palette, etc).
1704 	 * @todo This is Annotation Name.. not item name, needs splitting up.
1705 	 * @sa PageItem::itemName(), PageItem::setItemName()
1706 	 */
1707 	QString m_itemName;
1708 
1709 	/**
1710 	 * Flag to tell if this item is a PDF annotation item
1711 	 */
1712 	bool m_isAnnotation {false};
1713 
1714 	/**
1715 	 * PDF annotation data
1716 	 */
1717 	Annotation m_annotation;
1718 
1719 	/**
1720 	 * @brief Fill gradient name
1721 	 * @sa PageItem::gradient(), PageItem::setGradient()
1722 	 */
1723 	QString m_gradientName;
1724 
1725 	/**
1726 	 * @brief Fill pattern name
1727 	 * @sa PageItem::pattern(), PageItem::setPattern()
1728 	 */
1729 	QString m_patternName;
1730 	/**
1731 	 * @brief Fill pattern transformation matrix
1732 	 */
1733 	double patternScaleX {100.0};
1734 	double patternScaleY {100.0};
1735 	double patternOffsetX {0.0};
1736 	double patternOffsetY {0.0};
1737 	double patternRotation {0.0};
1738 	double patternSkewX {0.0};
1739 	double patternSkewY {0.0};
1740 	bool   patternMirrorX {false};
1741 	bool   patternMirrorY {false};
1742 
1743 	/**
1744 	 * @brief Fill color name
1745 	 * @sa PageItem::fillColor(), PageItem::setFillColor()
1746 	 */
1747 	QString m_fillColor;
1748 
1749 	/**
1750 	 * @brief Line color name
1751 	 * @sa PageItem::lineColor(), PageItem::setLineColor()
1752 	 */
1753 	QString m_lineColor;
1754 
1755 	/**
1756 	 * @brief Line shade
1757 	 * @sa PageItem::lineShade, PageItem::setLineShade()
1758 	 */
1759 	double m_lineShade;
1760 
1761 	/**
1762 	 * @brief Fill shade
1763 	 * @sa PageItem::fillShade, PageItem::setFillShade()
1764 	 */
1765 	double m_fillShade;
1766 
1767 	/**
1768 	 * @brief Fill transparency
1769 	 * @sa PageItem::fillTransparency(), PageItem::setFillTransparency()
1770 	 */
1771 	double m_fillTransparency {0.0};
1772 
1773 	/**
1774 	 * @brief Line stroke transparency.
1775 	 * @sa PageItem::lineTransparency(), PageItem::setLineTransparency()
1776 	 */
1777 	double m_lineTransparency {0.0};
1778 
1779 	/**
1780 	 * @brief Fill transparency blendmode
1781 	 * @sa PageItem::fillBlendmode(), PageItem::setFillBlendmode()
1782 	 */
1783 	int m_fillBlendMode {0};
1784 
1785 	/**
1786 	 * @brief Line stroke transparency blendmode.
1787 	 * @sa PageItem::lineBlendmode(), PageItem::setLineBlendmode()
1788 	 */
1789 	int m_lineBlendMode {0};
1790 
1791 	/**
1792 	 * @brief Is the image in this image item flipped horizontally?
1793 	 * @sa PageItem::isImageFlippedH(), PageItem::setImageFlippedH(),
1794 	 *     PageItem::flipImageH(), PageItem::flippedV
1795 	 */
1796 	bool m_ImageIsFlippedH {false};
1797 
1798 	/**
1799 	 * @brief Is the image in this image item flipped vertically?
1800 	 * @sa PageItem::isImageFlippedV(), PageItem::setImageFlippedV(),
1801 	 *     PageItem::flipImageV(), PageItem::flippedH
1802 	 */
1803 	bool m_ImageIsFlippedV {false};
1804 
1805 	/**
1806 	 * @brief Is the item locked (cannot be moved, resized, etc)?
1807 	 * @sa PageItem::locked(), PageItem::setLocked(), PageItem::toggleLock()
1808 	 */
1809 	bool m_Locked {false};
1810 
1811 	/**
1812 	 * @brief Is the item's size locked?
1813 	 * @sa PageItem::sizeLocked(), PageItem::setSizeLocked(), PageItem::toggleSizeLock()
1814 	 */
1815 	bool m_SizeLocked {false};
1816 
1817 	/**
1818 	 * @for notes frames - locking horizontal or vertical size
1819 	**/
1820 	bool m_SizeHLocked {false};
1821 	bool m_SizeVLocked {false};
1822 	/**
1823 	 * @brief Should text flow around the item
1824 	 * @sa PageItem::textFlowMode(), PateItem::setTextFlowMode()
1825 	 */
1826 	TextFlowMode m_textFlowMode {TextFlowDisabled};
1827 
1828 	/**
1829 	 * @brief Stores the attributes of the pageitem (NOT properties, the user defined ATTRIBUTES)
1830 	 * @sa
1831 	 */
1832 	ObjAttrVector pageItemAttributes;
1833 
1834 	/**
1835 	 * @brief Is this item set to be printed/exported
1836 	 * @sa PageItem::printable(), PageItem::setPrintable()
1837 	 */
1838 	bool m_PrintEnabled {true};
1839 
1840 	bool no_fill {false};
1841 	bool no_stroke {false};
1842 
1843 	QColor m_fillQColor;
1844 	QColor m_strokeQColor;
1845 	QColor m_grQColorP1;
1846 	QColor m_grQColorP2;
1847 	QColor m_grQColorP3;
1848 	QColor m_grQColorP4;
1849 
1850 	double m_xPos {0.0}; ///< X position on the page
1851 	double m_yPos {0.0}; ///< Y position on the page
1852 	double m_width {0.0}; ///< Width of the item
1853 	double m_height {0.0}; ///<  Height of the item
1854 	double m_rotation {0.0}; ///< Rotation of the item
1855 	bool   m_isSelected {false}; ///< Is the item selected?
1856 	bool   m_imageVisible {true}; ///< Darstellungsart Bild/Titel
1857 	double m_imageXScale {1.0}; ///< Scaling X Factor for images
1858 	double m_imageYScale {1.0}; ///< Scaling Y Factor for images
1859 	double m_imageXOffset {0.0}; ///< Image X Offset to frame
1860 	double m_imageYOffset {0.0}; ///< Image Y Offset to frame
1861 	double m_imageRotation {0.0}; ///< Image rotation in frame
1862 	FirstLineOffsetPolicy m_firstLineOffset;
1863 	bool m_groupClips {true};
1864 
1865 	int m_startArrowIndex {0};
1866 	int m_endArrowIndex {0};
1867 	int m_startArrowScale {100};
1868 	int m_endArrowScale {100};
1869 
1870 	bool    m_hasSoftShadow {false};
1871 	QString m_softShadowColor {"Black"};
1872 	int     m_softShadowShade {100};
1873 	double  m_softShadowBlurRadius {5.0};
1874 	double  m_softShadowXOffset {5.0};
1875 	double  m_softShadowYOffset {5.0};
1876 	double  m_softShadowOpacity {0.0};
1877 	int     m_softShadowBlendMode {0};
1878 	bool    m_softShadowErasedByObject {false};
1879 	bool    m_softShadowHasObjectTransparency {false};
1880 
1881 	// End protected variables
1882 
1883 private:	// Start private functions
1884 	/**
1885 	 * @brief Helper method to create a modifier string from the current image effects list.
1886 	 * @sa loadImage()
1887 	 */
1888 	QString getImageEffectsModifier() const;
1889 
1890 			// End private functions
1891 
1892 private:	// Start private variables
1893 			// End private variables
1894 
1895 
1896 
1897 signals:
1898 	//Frame signals
1899 	void myself(PageItem *);
1900 	void frameType(int);   ///< not related to Frametype but to m_itemIype
1901 	//void frameLocked(bool); ///< Frame lock
1902 	//void frameSizeLocked(bool); ///< Frame size lock
1903 	//Shape signals
1904 	//void cornerRadius(double); ///< Corner radius of the shape
1905 	//Frame text signals
1906 	//void lineSpacing(double);
1907 	//void textKerning(double);
1908 	void textStyle(int);
1909 	//void textFont(const QString&);
1910 	//void textSize(double);
1911 	//void textToFrameDistances(double, double, double, double); //left, top, bottom, right: Extra, TExtra, BExtra, RExtra
1912 	//FIXME: columns, grid ?
1913 
1914 
1915 };
1916 
1917 Q_DECLARE_METATYPE(PageItem*)
1918 
1919 bool compareItemLevel(const PageItem* item1, const PageItem* item2);
1920 
1921 #endif
1922