Subversion Repositories Scribus

Rev

Rev 18357 | Rev 18772 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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