Subversion Repositories Scribus

Rev

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