Subversion Repositories Scribus

Rev

Rev 12463 | Rev 12795 | 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>
2969 craig 37
 
38
#include "scribusapi.h"
4772 cbradney 39
#include "annotation.h"
10532 avox 40
#include "observable.h"
4772 cbradney 41
#include "pagestructs.h"
2004 fschmid 42
#include "scimage.h"
4129 cbradney 43
#include "sctextstruct.h"
4772 cbradney 44
#include "undoobject.h"
45
#include "vgradient.h"
5184 avox 46
#include "text/nlsconfig.h"
4670 avox 47
#include "text/storytext.h"
8195 avox 48
#include "desaxe/saxio.h"
4670 avox 49
 
4772 cbradney 50
class ScPainter;
838 cbradney 51
class ScribusDoc;
11168 jghali 52
class SimpleState;
1204 tsoots 53
class UndoManager;
54
class UndoState;
8455 avox 55
class ResourceCollection;
10601 mrdocs 56
class QFrame;
57
class QGridLayout;
3618 avox 58
 
3985 cbradney 59
class PageItem_ImageFrame;
60
class PageItem_Line;
3618 avox 61
class PageItem_Polygon;
62
class PageItem_PolyLine;
63
class PageItem_TextFrame;
3939 cbradney 64
class PageItem_PathText;
10228 avox 65
class PageItem_LatexFrame;
3618 avox 66
 
3030 cbradney 67
struct CopyPasteBuffer;
3 paul 68
/**
69
  *@author Franz Schmid
70
  */
1489 tsoots 71
 
10532 avox 72
class SCRIBUS_API PageItem : public QObject, public UndoObject, public SaxIO, public SingleObservable<PageItem>
270 Franz 73
{
74
        Q_OBJECT
1394 cbradney 75
 
1364 tsoots 76
        // Properties - see http://doc.trolltech.com/3.3/properties.html
4061 craig 77
        // See the accessors of these properties for details on their use.
1364 tsoots 78
        Q_PROPERTY(QString itemName READ itemName WRITE setItemName DESIGNABLE false)
1381 cbradney 79
        Q_PROPERTY(QString fillColor READ fillColor WRITE setFillColor DESIGNABLE false)
1394 cbradney 80
        Q_PROPERTY(QString lineColor READ lineColor WRITE setLineColor DESIGNABLE false)
9920 fschmid 81
        Q_PROPERTY(double fillShade READ fillShade WRITE setFillShade DESIGNABLE false)
82
        Q_PROPERTY(double lineShade READ lineShade WRITE setLineShade DESIGNABLE false)
1381 cbradney 83
        Q_PROPERTY(double fillTransparency READ fillTransparency WRITE setFillTransparency DESIGNABLE false)
84
        Q_PROPERTY(double lineTransparency READ lineTransparency WRITE setLineTransparency DESIGNABLE false)
4699 cbradney 85
        Q_PROPERTY(bool m_Locked READ locked WRITE setLocked DESIGNABLE false)
86
        Q_PROPERTY(bool m_SizeLocked READ sizeLocked WRITE setSizeLocked DESIGNABLE false)
87
        Q_PROPERTY(bool m_ImageIsFlippedV READ imageFlippedV WRITE setImageFlippedV DESIGNABLE false)
88
        Q_PROPERTY(bool m_ImageIsFlippedH READ imageFlippedH WRITE setImageFlippedH DESIGNABLE false)
1394 cbradney 89
        Q_PROPERTY(double lineWidth READ lineWidth WRITE setLineWidth DESIGNABLE false)
90
        Q_PROPERTY(QString customLineStyle READ customLineStyle WRITE setCustomLineStyle DESIGNABLE false)
4061 craig 91
        Q_PROPERTY(int startArrowIndex READ startArrowIndex WRITE setStartArrowIndex DESIGNABLE false)
92
        Q_PROPERTY(int endArrowIndex READ endArrowIndex WRITE setEndArrowIndex DESIGNABLE false)
5559 avox 93
 
4698 cbradney 94
        Q_PROPERTY(bool m_PrintEnabled READ printEnabled WRITE setPrintEnabled DESIGNABLE false)
4061 craig 95
        Q_PROPERTY(double xPos READ xPos WRITE setXPos DESIGNABLE false)
96
        Q_PROPERTY(double yPos READ yPos WRITE setYPos DESIGNABLE false)
97
        Q_PROPERTY(double width READ width WRITE setWidth DESIGNABLE false)
98
        Q_PROPERTY(double height READ height WRITE setHeight DESIGNABLE false)
99
        Q_PROPERTY(double rotation READ rotation WRITE setRotation DESIGNABLE false)
100
        Q_PROPERTY(double imageXScale READ imageXScale WRITE setImageXScale DESIGNABLE false)
101
        Q_PROPERTY(double imageYScale READ imageYScale WRITE setImageYScale DESIGNABLE false)
102
        Q_PROPERTY(double imageXOffset READ imageXOffset WRITE setImageXOffset DESIGNABLE false)
103
        Q_PROPERTY(double imageYOffset READ imageYOffset WRITE setImageYOffset DESIGNABLE false)
104
        Q_PROPERTY(bool reversed READ reversed WRITE setReversed DESIGNABLE false)
105
        Q_PROPERTY(double cornerRadius READ cornerRadius WRITE setCornerRadius DESIGNABLE false)
106
        Q_PROPERTY(double textToFrameDistLeft READ textToFrameDistLeft WRITE setTextToFrameDistLeft DESIGNABLE false)
107
        Q_PROPERTY(double textToFrameDistRight READ textToFrameDistRight WRITE setTextToFrameDistRight DESIGNABLE false)
108
        Q_PROPERTY(double textToFrameDistTop READ textToFrameDistTop WRITE setTextToFrameDistTop DESIGNABLE false)
109
        Q_PROPERTY(double textToFrameDistBottom READ textToFrameDistBottom WRITE setTextToFrameDistBottom DESIGNABLE false)
5559 avox 110
        Q_PROPERTY(double ColGap READ columnGap WRITE setColumnGap DESIGNABLE false)
111
        Q_PROPERTY(int Cols READ columns WRITE setColumns DESIGNABLE false)
12269 cbradney 112
        Q_ENUMS(FirstLineOffsetPolicy)
113
        Q_PROPERTY(FirstLineOffsetPolicy firstLineOffset READ firstLineOffset WRITE setFirstLineOffset DESIGNABLE false)
1422 tsoots 114
        // FIXME: QMetaProperty can't translate these to/from enumerator names, probably because the
115
        // properties aren't moc'd in the Qt sources. They work fine in their
116
        // current state as plain integer properties.
6398 cbradney 117
//      Q_ENUMS(PenStyle)
118
//      Q_PROPERTY(PenStyle lineStyle READ lineStyle WRITE setLineStyle DESIGNABLE false)
119
//      Q_ENUMS(PenCapStyle)
120
//      Q_PROPERTY(PenCapStyle lineEnd READ lineEnd WRITE setLineEnd DESIGNABLE false)
121
//      Q_ENUMS(PenJoinStyle)
122
//      Q_PROPERTY(PenJoinStyle lineJoin READ lineJoin WRITE setLineJoin DESIGNABLE false)
1394 cbradney 123
 
1422 tsoots 124
        // This property may not hang around for too long, but should be useful
125
        // when testing out the pageitem refactoring work.  Setting it is unlikely
126
        // to currently have the desired effect.
127
        /**
3232 cbradney 128
         * @brief Item type.
1422 tsoots 129
         * @warning Do not set this property except for testing and debug purposes.
130
         */
1460 cbradney 131
        Q_ENUMS(ItemType)
132
        Q_PROPERTY(ItemType itemType READ itemType WRITE convertTo DESIGNABLE false)
1422 tsoots 133
 
1460 cbradney 134
public:
135
        // Enumerator definitions
1489 tsoots 136
 
3232 cbradney 137
        /** @brief Item Type
1460 cbradney 138
         *
3618 avox 139
         * Soon, item type will probably go away in favour of using
1460 cbradney 140
         * subclasses and checking types using more conventional methods
141
         * and using Qt's MetaObject introspection.
7686 cbradney 142
         * Multiple is used for checking in @sa Selection for all same type of items
1460 cbradney 143
         */
144
        enum ItemType {
3232 cbradney 145
                ItemType1       = 1,
1460 cbradney 146
                ImageFrame      = 2,
3232 cbradney 147
                ItemType3       = 3,
1460 cbradney 148
                TextFrame       = 4,
149
                Line            = 5,
150
                Polygon         = 6,
151
                PolyLine        = 7,
7686 cbradney 152
                PathText        = 8,
10228 avox 153
                LatexFrame  = 9,
7686 cbradney 154
                Multiple        = 99
1460 cbradney 155
        };
3618 avox 156
 
5620 jghali 157
        /** @brief Text flow mode
158
         *
159
         * Describe if and how text flow around object
160
         */
161
        enum TextFlowMode {
162
                TextFlowDisabled = 0,
163
                TextFlowUsesFrameShape  = 1,
164
                TextFlowUsesBoundingBox = 2,
8445 fschmid 165
                TextFlowUsesContourLine = 3,
166
                TextFlowUsesImageClipping = 4
5620 jghali 167
        };
168
 
3618 avox 169
        /* these do essentially the same as a dynamic cast but might be more readable */
170
        virtual PageItem_ImageFrame * asImageFrame() { return NULL; }
171
        virtual PageItem_Line * asLine() { return NULL; }
172
        virtual PageItem_PathText * asPathText() { return NULL; }
173
        virtual PageItem_Polygon * asPolygon() { return NULL; }
174
        virtual PageItem_PolyLine * asPolyLine() { return NULL; }
175
        virtual PageItem_TextFrame * asTextFrame() { return NULL; }
10228 avox 176
        virtual PageItem_LatexFrame * asLatexFrame() { return NULL; }
3618 avox 177
 
178
 
3232 cbradney 179
        /** @brief Frame Type
180
         *
181
         *
182
         */
3233 cbradney 183
        enum ItemFrameType {
184
                Unspecified =-1,
185
                Rectangle       = 0,
3232 cbradney 186
                Ellipse         = 1,
3233 cbradney 187
                Round           = 2,
188
                Other           = 3
3232 cbradney 189
        };
1460 cbradney 190
 
3625 avox 191
protected:
192
        PageItem(const PageItem & other);
193
 
194
public:
1460 cbradney 195
        PageItem(ScribusDoc *pa, ItemType newType, double x, double y, double w, double h, double w2, QString fill, QString outline);
3 paul 196
        ~PageItem() {};
8195 avox 197
 
8266 avox 198
        static const Xml_string saxxDefaultElem;
8834 cbradney 199
        static void  desaxeRules(const Xml_string& prefixPattern, desaxe::Digester& ruleset, Xml_string elemtag = saxxDefaultElem);
8195 avox 200
 
8800 jghali 201
        virtual void saxx(SaxHandler& handler, const Xml_string& elemtag) const;
8266 avox 202
        virtual void saxx(SaxHandler& handler)                     const { saxx(handler, saxxDefaultElem); }
203
 
3627 cbradney 204
        /**
205
         * @brief Clear the contents of a frame.
206
         * WARNING: Currently *they* do not check if the user wants this.
207
         * The view does when these are called.
208
         */    
209
        virtual void clearContents() {};
3651 cbradney 210
 
211
        /**
212
         * @brief Adjust the picture scale, moved from the view, no view code here
213
         * FIXME: Move to PageItem_TextFrame
214
         */
215
        void AdjustPictScale();
3656 cbradney 216
 
217
        /**
218
         * @brief Set or get the redraw bounding box of the item, moved from the View
219
         */
220
        QRect getRedrawBounding(const double);
221
        void setRedrawBounding();
3627 cbradney 222
 
3657 cbradney 223
        /**
224
         * @brief Update the gradient vectors, moved from the View
225
         */            
226
        void updateGradientVectors();
4593 cbradney 227
        /**
228
         * @brief Move the image within the frame
229
         * Old ScribusView::MoveItemI
230
         * @todo Move to PageItem_ImageFrame
231
         */
232
        void moveImageInFrame(double newX, double newY);
1460 cbradney 233
 
1649 cbradney 234
        ObjAttrVector* getObjectAttributes();
1676 cbradney 235
        /*!
236
         * brief Returns a complete ObjectAttribute struct if 1 is found, or ObjectAttribute.name will be QString::null if 0 or >1 are found
237
         */
8195 avox 238
        ObjectAttribute getObjectAttribute(QString) const;
1649 cbradney 239
        void setObjectAttributes(ObjAttrVector*);
10601 mrdocs 240
 
241
        virtual bool createInfoGroup(QFrame *, QGridLayout *) {return false;}
242
        virtual bool createContextMenu(QMenu *, int step) {return false;}
243
 
3 paul 244
  /** Zeichnet das Item */
9343 fschmid 245
        void paintObj(QPainter *p);
11052 avox 246
        void DrawObj(ScPainter *p, QRectF e);
2434 fschmid 247
        void DrawObj_Pre(ScPainter *p, double &sc);
4142 cbradney 248
        virtual void DrawObj_Post(ScPainter *p);
11052 avox 249
        virtual void DrawObj_Item(ScPainter *p, QRectF e, double sc) = 0;
6368 fschmid 250
        QImage DrawObj_toImage();
9856 fschmid 251
        QImage DrawObj_toImage(QList<PageItem*> &emG);
10934 cbradney 252
 
253
        virtual void applicableActions(QStringList& actionList) = 0;
10941 cbradney 254
        virtual QString infoDescription();
10934 cbradney 255
 
5350 avox 256
protected:
2434 fschmid 257
        void DrawObj_ImageFrame(ScPainter *p, double sc);
11052 avox 258
        //void DrawObj_TextFrame(ScPainter *p, QRectF e, double sc);
3617 cbradney 259
        //void DrawObj_Line(ScPainter *p);
2434 fschmid 260
        void DrawObj_Polygon(ScPainter *p);
261
        void DrawObj_PolyLine(ScPainter *p);
262
        void DrawObj_PathText(ScPainter *p, double sc);
5350 avox 263
public:
11052 avox 264
        void DrawObj_Embedded(ScPainter *p, QRectF e, const CharStyle& style, PageItem* cembedded);
3242 cbradney 265
        void SetFrameShape(int count, double *vals);
266
        void SetRectFrame();
267
        void SetOvalFrame();
268
        void SetFrameRound();
8108 fschmid 269
        void setPolyClip(int up, int down = 0);
4688 cbradney 270
        void updatePolyClip();
271
        void updateClip();
272
        void convertClip();
3242 cbradney 273
        //QRect getRedrawBounding(const double);
274
        //void setRedrawBounding();
8195 avox 275
        void getBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
12467 pierre 276
        void getVisualBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
10701 avox 277
        QRectF getBoundingRect() const;
12467 pierre 278
        QRectF getVisualBoundingRect() const;
10701 avox 279
        void getTransform(QMatrix& mat) const;
280
        QMatrix getTransform() const;
4019 cbradney 281
        /**
282
         * @brief Check if a QPoint is within the items boundaries
4476 cbradney 283
         * No coordinates transformation is performed
4645 subik 284
         * @param x X position
285
                @param y Y position
286
         * @return bool true if x, i in the item
4019 cbradney 287
         */
8195 avox 288
        bool pointWithinItem(const int x, const int y) const;
4476 cbradney 289
        /**
290
         * @brief Check if the mouse is within the items boundaries
291
         * This method performs necessary page to device transformations
4645 subik 292
                @param x X position
293
                @param y Y position
294
                @param scale scale of the vport
295
         * @return bool true if the x, y is in the bounds
4476 cbradney 296
         */
10553 fschmid 297
        bool mouseWithinItem(const int x, const int y, double scale) const;
3030 cbradney 298
        void copyToCopyPasteBuffer(struct CopyPasteBuffer *Buffer);
3242 cbradney 299
 
3829 cbradney 300
        virtual void handleModeEditKey(QKeyEvent *k, bool &keyRepeat);
3680 cbradney 301
 
11046 avox 302
        /// invalidates current layout information
303
        virtual void invalidateLayout() { invalid = true; }
7994 avox 304
        /// creates valid layout information
305
        virtual void layout() {}
5559 avox 306
        /// returns true if text overflows
307
        bool frameOverflows() const;
308
        /// returns index of first char displayed in this frame, used to be 0
309
        int firstInFrame() const;
310
        /// returns index of last char displayed in this frame, used to be MaxChars-1
311
        int lastInFrame() const;
312
        /// tests if a character is displayed by this frame
313
        bool frameDisplays(int textpos) const;
314
        /// returns the style at the current charpos
315
        const ParagraphStyle& currentStyle() const;
316
        /// returns the style at the current charpos
5569 avox 317
        ParagraphStyle& changeCurrentStyle();
318
        /// returns the style at the current charpos
5559 avox 319
        const CharStyle& currentCharStyle() const;
320
        // deprecated:
11744 jghali 321
        double layoutGlyphs(const CharStyle& style, const QString& chars, GlyphLayout& layout);
11333 jghali 322
        void SetQColor(QColor *tmp, QString farbe, double shad);
5980 avox 323
        void drawGlyphs(ScPainter *p, const CharStyle& style, GlyphLayout& glyphs );
10284 fschmid 324
        void DrawPolyL(QPainter *p, QPolygon pts);
3 paul 325
        QString ExpandToken(uint base);
4084 cbradney 326
 
327
        bool AutoName; 
2955 fschmid 328
        double gXpos;
329
        double gYpos;
330
        double gWidth;
331
        double gHeight;
3 paul 332
        int GrType;
292 Franz 333
        double GrStartX;
334
        double GrStartY;
335
        double GrEndX;
336
        double GrEndY;
134 Franz 337
        int Cols;
135 Franz 338
        double ColGap;
5559 avox 339
        double gridOffset_;
340
        double gridValue_;
341
 
342
        /** Linestyle */
6398 cbradney 343
        Qt::PenStyle PLineArt;
344
        Qt::PenCapStyle PLineEnd;
345
        Qt::PenJoinStyle PLineJoin;
27 Franz 346
        QString NamedLStyle;
5559 avox 347
  /** Defines clipping region of the elements; */
10284 fschmid 348
        QPolygon Clip;
8229 avox 349
 
3 paul 350
        FPointArray PoLine;
8229 avox 351
        const FPointArray shape() const { return PoLine; }
352
        void setShape(FPointArray val) { PoLine = val; }
353
 
340 Franz 354
        FPointArray ContourLine;
8229 avox 355
        const FPointArray contour() const { return ContourLine; }
356
        void setContour(FPointArray val) { ContourLine = val; }
357
 
2040 fschmid 358
        FPointArray imageClip;
9803 fschmid 359
        QList<uint> Segments;
6578 cbradney 360
        ScImageEffectList effectsInUse;
3 paul 361
        bool PoShow;
80 Franz 362
        double BaseOffs;
7926 fschmid 363
        int textPathType;
364
        bool textPathFlipped;
8229 avox 365
        bool flipPathText() const { return textPathFlipped; }
366
        void setFlipPathText(bool val) { textPathFlipped = val; }
367
        int pathTextType() const { return textPathType; }
368
        void setPathTextType(int val) { textPathType = val; }
369
        double pathTextBaseOffset() const { return BaseOffs; }
370
        void setPathTextBaseOffset(double val) { BaseOffs = val; }
371
        bool pathTextShowFrame() const { return PoShow; }
372
        void setPathTextShowFrame(bool val) { PoShow = val; }
373
 
374
        bool useEmbeddedImageProfile() const { return UseEmbedded; }
375
        void setUseEmbeddedImageProfile(bool val) { UseEmbedded = val; }
376
        QString embeddedImageProfile() const { return EmProfile; }
377
        void setEmbeddedImageProfile(QString val) { EmProfile = val; }
378
 
379
 
168 Franz 380
        bool ClipEdited;
1460 cbradney 381
        // Don't know exactly what this is, but it's not the same as itemType
168 Franz 382
        int FrameType;
3 paul 383
  /** Interne Item-Nummer */
168 Franz 384
        uint ItemNr;
7068 fschmid 385
  /** Internal unique Item-Number, used for the undo system */
386
        uint uniqueNr;
8229 avox 387
  /** Hat Element Rahmen? FIXME: still used? - in DrawObject_Post */
168 Franz 388
        bool Frame;
8229 avox 389
  /** page this element belongs to */
456 fschmid 390
        int OwnPage;
1211 tsoots 391
        /** @brief Old page number tracked for the move undo action */
392
        int oldOwnPage;
4401 fschmid 393
        int savedOwnPage;
3 paul 394
  /** Darzustellendes Bild */
2004 fschmid 395
        ScImage pixm;
3 paul 396
  /** Dateiname des Bildes */
168 Franz 397
        QString Pfile;
398
        QString Pfile2;
399
        QString Pfile3;
8229 avox 400
        QString externalFile() const { return Pfile; }
12309 fschmid 401
        void setExternalFile(QString val);
8229 avox 402
 
403
        //FIXME: maybe these should go into annotation?
404
        QString fileIconPressed() const { return Pfile2; }
12309 fschmid 405
        void setFileIconPressed(QString val);
8229 avox 406
        QString fileIconRollover() const { return Pfile3; }
12309 fschmid 407
        void setFileIconRollover(QString val);
8229 avox 408
 
168 Franz 409
        QString IProfile;
410
        bool UseEmbedded;
411
        QString EmProfile;
412
        int IRender;
8229 avox 413
        // some accessor methods:
414
        int cmsRenderingIntent() const { return IRender; }
415
        void setCmsRenderingIntent(int val) { IRender = val; }
416
        QString cmsProfile() const { return IProfile; }
417
        void setCmsProfile(QString val) { IProfile = val; }
418
 
3 paul 419
  /** Bild verfuegbar */
168 Franz 420
        bool PicAvail;
3 paul 421
        int OrigW;
422
        int OrigH;
423
  /** BoundigBox-X */
168 Franz 424
        double BBoxX;
3 paul 425
  /** BoundingBox-H */
168 Franz 426
        double BBoxH;
3 paul 427
  /** Zeichen X-Position */
168 Franz 428
        double CurX;
3 paul 429
  /** Zeichen Y-Position */
168 Franz 430
        double CurY;
3 paul 431
  /** Cursorposition */
168 Franz 432
        int CPos;
3 paul 433
  /** Text des Elements */
4670 avox 434
        StoryText itemText;
3 paul 435
  /** Flag fuer PDF-Bookmark */
168 Franz 436
        bool isBookmark;
5362 avox 437
  /** Flag for redraw in EditMode */
168 Franz 438
        bool Dirty;
5362 avox 439
        /** Flag indicates that layout has changed (eg. for textlayout) */
440
        bool invalid;
3 paul 441
  /** Flag fuer Auswahl */
168 Franz 442
        bool HasSel;
8229 avox 443
        /** avoid artefacts while moving */
8179 fschmid 444
        bool FrameOnly;
168 Franz 445
        bool isAutoText;
7994 avox 446
        PageItem* prevInChain() { return BackBox; }
447
        PageItem* nextInChain() { return NextBox; }
8195 avox 448
        const PageItem* prevInChain() const { return BackBox; }
449
        const PageItem* nextInChain() const { return NextBox; }
7994 avox 450
        void unlink();
451
        void link(PageItem* nextFrame);
8325 avox 452
        void dropLinks();
7994 avox 453
 
5559 avox 454
protected:
7994 avox 455
        PageItem *BackBox;
456
        PageItem *NextBox;
5721 avox 457
        uint firstChar;
168 Franz 458
        uint MaxChars;
5559 avox 459
public:
5362 avox 460
        bool inPdfArticle;
168 Franz 461
        bool isRaster;
462
        double OldB;
463
        double OldH;
464
        double OldB2;
465
        double OldH2;
466
        bool Sizing;
467
        bool toPixmap;
3 paul 468
        int LayerNr;
469
        bool ScaleType;
470
        bool AspectRatio;
9919 jghali 471
        QStack<int> Groups;
472
        const QStack<int>& groups() const { return Groups; }
473
        QStack<int>& groups() { return Groups; }
474
        void setGroups( QStack<int> val) { Groups = val; }
8229 avox 475
 
476
        bool controlsGroup() const { return isGroupControl; }
477
        void setControlsGroup(bool val) { isGroupControl = val; }
478
 
12055 jghali 479
        QVector<double> DashValues;
80 Franz 480
        double DashOffset;
12055 jghali 481
        const QVector<double>& dashes() const { return DashValues; }
482
        QVector<double>& dashes() { return DashValues; }
483
        void setDashes(QVector<double> val) { DashValues = val; }
8229 avox 484
        double dashOffset() const { return DashOffset; }
485
        void setDashOffset(double val) { DashOffset = val; }
68 Franz 486
        VGradient fill_gradient;
1905 fschmid 487
        bool fillRule;
5320 fschmid 488
        bool doOverprint;
232 Franz 489
/* Additions for Table Support */
490
        PageItem* LeftLink;
491
        PageItem* RightLink;
492
        PageItem* TopLink;
493
        PageItem* BottomLink;
234 Franz 494
        int LeftLinkID;
495
        int RightLinkID;
496
        int TopLinkID;
497
        int BottomLinkID;
232 Franz 498
        bool LeftLine;
499
        bool RightLine;
500
        bool TopLine;
501
        bool BottomLine;
502
        bool isTableItem;
8289 avox 503
        void setIsTableItem(bool val) { isTableItem = val; }
504
        void setHasLeftLine(bool val) { LeftLine = val; }
505
        void setHasRightLine(bool val) { RightLine = val; }
506
        void setHasTopLine(bool val) { TopLine = val; }
507
        void setHasBottomLine(bool val) { BottomLine = val; }
508
        void setLeftLink(PageItem* lnk) { LeftLink = lnk; }
509
        void setRightLink(PageItem* lnk) { RightLink = lnk; }
510
        void setTopLink(PageItem* lnk) { TopLink = lnk; }
511
        void setBottomLink(PageItem* lnk) { BottomLink = lnk; }
232 Franz 512
        bool isSingleSel;
6451 fschmid 513
        bool isGroupControl;
514
        PageItem *groupsLastItem;
8289 avox 515
        void setGroupsLastItem(PageItem* lnk) { groupsLastItem = lnk; }
456 fschmid 516
        double BoundingX;
517
        double BoundingY;
518
        double BoundingW;
519
        double BoundingH;
520
        bool ChangedMasterItem;
537 fschmid 521
        QString OnMasterPage;
2434 fschmid 522
        bool isEmbedded;
3903 cbradney 523
 
3934 cbradney 524
        //Position
4061 craig 525
        double xPos() const { return Xpos; }
526
        double yPos() const { return Ypos; }
12463 pierre 527
        double visualXPos() const { return Xpos - (m_lineWidth / 2.0); }
528
        double visualYPos() const { return Ypos - (m_lineWidth / 2.0); }
4061 craig 529
        FPoint xyPos() const { return FPoint(Xpos, Ypos); }
4644 cbradney 530
        void setXPos(const double, bool drawingOnly=false);
531
        void setYPos(const double, bool drawingOnly=false);
532
        void setXYPos(const double, const double, bool drawingOnly=false);
533
        void moveBy(const double, const double, bool drawingOnly=false);
3934 cbradney 534
        //Size
4061 craig 535
        double width() const { return Width; }
536
        double height() const { return Height; }
12463 pierre 537
        double visualWidth() const { return Width + m_lineWidth; }
538
        double visualHeight() const { return Height + m_lineWidth; }
3934 cbradney 539
        void setWidth(const double);
540
        void setHeight(const double);
8418 fschmid 541
        void setWidthHeight(const double, const double, bool drawingOnly);
3934 cbradney 542
        void setWidthHeight(const double, const double);
543
        void resizeBy(const double, const double);
544
        //Rotation
4061 craig 545
        double rotation() const { return Rot; }
8229 avox 546
        void setRotation(const double, bool drawingOnly);
547
        void setRotation(const double r) { setRotation(r, false); }  // needed for deSaXe
3934 cbradney 548
        void rotateBy(const double);
549
        //Selection
4061 craig 550
        bool isSelected() const { return Select; }
3934 cbradney 551
        void setSelected(const bool);
3985 cbradney 552
        //Image Data
4061 craig 553
        double imageXScale() const { return LocalScX; }
554
        double imageYScale() const { return LocalScY; }
3985 cbradney 555
        void setImageXScale(const double);
556
        void setImageYScale(const double);
557
        void setImageXYScale(const double, const double);
4061 craig 558
        double imageXOffset() const { return LocalX; }
559
        double imageYOffset() const { return LocalY; }
3985 cbradney 560
        void setImageXOffset(const double);
561
        void setImageYOffset(const double);
562
        void moveImageXYOffsetBy(const double, const double);
563
        void setImageXYOffset(const double, const double);
3988 cbradney 564
        //Reverse
4061 craig 565
        bool reversed() const { return Reverse; }
3988 cbradney 566
        void setReversed(bool);
3989 cbradney 567
        //Rounded Corners
4061 craig 568
        double cornerRadius() const { return RadRect; }
3989 cbradney 569
        void setCornerRadius(double);
8229 avox 570
        // PDF bookmark
571
        bool isPDFBookmark() const { return isBookmark; }
572
        void setIsPDFBookmark(bool val) { isBookmark = val; }
573
        // 0=none, 1,2,3,4=linear, 5=radial, 6=free linear, 7=free radial, 8=pattern 
574
        int gradientType() const { return GrType; }
575
        void setGradientType(int val) { GrType = val; }
10385 jghali 576
        void gradientVector(double& startX, double& startY, double& endX, double& endY) const;
577
        void setGradientVector(double startX, double startY, double endX, double endY);
8229 avox 578
        // 
579
        bool fillEvenOdd() const { return fillRule; }
580
        void setFillEvenOdd(bool val) { fillRule = val; }
581
        //
582
        bool overprint() const { return doOverprint; }
583
        void setOverprint(bool val) { doOverprint = val; }
584
        // rect / oval / round / other
585
        int frameType() const { return FrameType; }
586
        void setFrameType(int val) { FrameType = val; }
587
        //
588
        bool hasDefaultShape() const { return !ClipEdited; }
589
        void setHasDefaultShape(bool val) { ClipEdited = !val; }
590
        //
591
        bool isAutoFrame() const { return isAutoText; }
592
        void setIsAutoFrame(bool val) { isAutoText = val; }
593
        //
594
        bool keepAspectRatio() const { return AspectRatio; }
595
        void setKeepAspectRatio(bool val) { AspectRatio = val; }
596
        //
11409 jghali 597
        bool fitImageToFrame() const { return !ScaleType; }
598
        void setFitImageToFrame(bool val) { ScaleType = !val; }
8229 avox 599
 
5559 avox 600
        //Text Data - Move to PageItem_TextFrame at some point? --- no, to FrameStyle, av
4061 craig 601
        double textToFrameDistLeft() const { return Extra; }
602
        double textToFrameDistRight() const { return RExtra; }
603
        double textToFrameDistTop() const { return TExtra; }
604
        double textToFrameDistBottom() const { return BExtra; }
5559 avox 605
        int columns() const { return Cols; }
606
        double columnGap() const { return ColGap; }
607
        double gridOffset() const;
608
        double gridDistance() const;
3988 cbradney 609
        void setTextToFrameDistLeft(double);
610
        void setTextToFrameDistRight(double);
611
        void setTextToFrameDistTop(double);
612
        void setTextToFrameDistBottom(double);
5559 avox 613
        void setColumns(int);
614
        void setColumnGap(double);
615
        void setGridOffset(double);
616
        void setGridDistance(double);
12269 cbradney 617
        FirstLineOffsetPolicy firstLineOffset()const;
618
        void setFirstLineOffset(FirstLineOffsetPolicy);
3988 cbradney 619
        /**
4645 subik 620
         * \brief Set the text to frame distances all at once
621
         * @param newLeft left distance
622
         * @param newRight right distance
623
         * @param newTop top distance
624
         * @param newBottom bottom distance
3988 cbradney 625
         */
626
        void setTextToFrameDist(double newLeft, double newRight, double newTop, double newBottom);
627
 
1361 tsoots 628
        /**  @brief Get name of the item
629
         *
630
         * This is unrelated to QObject::name(); the pageItem's name is independent
631
         * of its Qt name.
632
         * See also PageItem::setItemName()
633
         */
4061 craig 634
        QString itemName() const { return AnName; }
1361 tsoots 635
        /**
1204 tsoots 636
         * @brief Set name of the item
637
         * @param newName name for the item
638
         * @author Riku Leino
1361 tsoots 639
         *
640
         * Note that this is unrelated to QObject::setName()
641
         * See also PageItem::itemName()
1204 tsoots 642
         */
1361 tsoots 643
        void setItemName(const QString& newName);
1381 cbradney 644
 
6414 fschmid 645
        /** @brief Get the name of the pattern of the object */
6368 fschmid 646
        QString pattern() const { return patternVal; }
6414 fschmid 647
 
648
        /** @brief Get the pattern transformation matrix of the object */
8195 avox 649
        void patternTransform(double &scaleX, double &scaleY, double &offsetX, double &offsetY, double &rotation) const;
6414 fschmid 650
 
6368 fschmid 651
        /**
652
         * @brief Set the fill pattern of the object.
653
         * @param newPattern fill pattern for the object
654
         */
655
        void setPattern(const QString &newPattern);
656
 
6414 fschmid 657
        /**
658
         * @brief Set the fill pattern transformation of the object.
659
         */
660
        void setPatternTransform(double scaleX, double scaleY, double offsetX, double offsetY, double rotation);
661
 
1381 cbradney 662
        /** @brief Get the (name of the) fill color of the object */
4061 craig 663
        QString fillColor() const { return fillColorVal; }
1286 tsoots 664
        /**
665
         * @brief Set the fill color of the object.
666
         * @param newColor fill color for the object
667
         */
668
        void setFillColor(const QString &newColor);
1381 cbradney 669
 
670
        /** @brief Get the shade of the fill color */
9920 fschmid 671
        double fillShade() const { return fillShadeVal; }
1286 tsoots 672
        /**
673
         * @brief Set the fill color shade.
674
         * @param newShade shade for the fill color
675
         */
9920 fschmid 676
        void setFillShade(double newShade);
1381 cbradney 677
 
678
        /** @brief Get the transparency of the fill color */
4061 craig 679
        double fillTransparency() const { return fillTransparencyVal; }
1286 tsoots 680
        /**
1371 tsoots 681
         * @brief Set the transparency of the fill color.
682
         * @param newTransparency transparency of the fill color
683
         */
684
        void setFillTransparency(double newTransparency);
1381 cbradney 685
 
5746 fschmid 686
        /** @brief Get the blendmode of the fill color */
687
        int fillBlendmode() const { return fillBlendmodeVal; }
688
        /**
689
         * @brief Set the blendmode of the fill color.
690
         * @param newBlendmode blendmode of the fill color
691
         */
692
        void setFillBlendmode(int newBlendmode);
693
 
694
        /** @brief Get the blendmode of the stroke color */
695
        int lineBlendmode() const { return lineBlendmodeVal; }
696
        /**
697
         * @brief Set the blendmode of the stroke color.
698
         * @param newBlendmode blendmode of the stroke color
699
         */
700
        void setLineBlendmode(int newBlendmode);
701
 
1381 cbradney 702
        /** @brief Get the line color of the object */
4061 craig 703
        QString lineColor() const { return lineColorVal; }
1371 tsoots 704
        /**
1286 tsoots 705
         * @brief Set the line color of the object.
4645 subik 706
         * @param newColor line color for the object
1286 tsoots 707
         */
708
        void setLineColor(const QString &newColor);
1381 cbradney 709
 
710
        /** @brief Get the line color shade */
9920 fschmid 711
        double lineShade() const { return lineShadeVal; }
1286 tsoots 712
        /**
713
         * @brief Set the line color shade.
4645 subik 714
         * @param newShade shade for the line color
1286 tsoots 715
         */
9920 fschmid 716
        void setLineShade(double newShade);
1381 cbradney 717
 
718
        /** @brief Get the line transparency */
4061 craig 719
        double lineTransparency() const { return lineTransparencyVal; }
1371 tsoots 720
        /**
721
         * @brief Set the transparency of the line color.
722
         * @param newTransparency transparency of the line color
723
         */
724
        void setLineTransparency(double newTransparency);
1394 cbradney 725
 
3894 cbradney 726
        /** @brief Set the QColor for the line */
727
        void setLineQColor();
728
        /** @brief Set the QColor for the fill */
729
        void setFillQColor();
730
 
1394 cbradney 731
        /** @brief Get the style of line */
6398 cbradney 732
        Qt::PenStyle lineStyle() const { return PLineArt; }
1383 tsoots 733
        /**
734
         * @brief Set the style of line.
735
         * @param newStyle style of line
736
         * @sa Qt::PenStyle
737
         */
6398 cbradney 738
        void setLineStyle(Qt::PenStyle newStyle);
1394 cbradney 739
 
740
        /** @brief Get the width of the line */
4580 cbradney 741
        double lineWidth() const { return m_lineWidth; }
1385 tsoots 742
        /**
743
         * @brief Set the width of line
744
         * @param newWidth width of line
745
         */
746
        void setLineWidth(double newWidth);
1394 cbradney 747
 
748
        /** @brief Get the end cap style of the line */
6398 cbradney 749
        Qt::PenCapStyle lineEnd() const { return PLineEnd; }
1385 tsoots 750
        /**
751
         * @brief Set the end style of line
752
         * @param newStyle end style of line
753
         * @sa Qt::PenCapStyle
754
         */
6398 cbradney 755
        void setLineEnd(Qt::PenCapStyle newStyle);
1394 cbradney 756
 
757
        /** @brief Get the join style of multi-segment lines */
6398 cbradney 758
        Qt::PenJoinStyle lineJoin() const { return PLineJoin; }
1385 tsoots 759
        /**
760
         * @brief Set the join style of line
761
         * @param newStyle join style of line
762
         * @sa Qt::PenJoinStyle
763
         */
6398 cbradney 764
        void setLineJoin(Qt::PenJoinStyle newStyle);
1392 cbradney 765
 
1394 cbradney 766
        /** @brief Get name of active custom line style */
4061 craig 767
        QString customLineStyle() const { return NamedLStyle; }
1489 tsoots 768
        /**
1386 tsoots 769
         * @brief Set custom line style
770
         * @param newStyle name of the custom style
771
         */
772
        void setCustomLineStyle(const QString& newStyle);
1392 cbradney 773
 
1394 cbradney 774
        /** @brief Get start arrow index
4061 craig 775
         * @sa PageItem::endArrowIndex(), PageItem::setStartArrowIndex()
1394 cbradney 776
         */
4061 craig 777
        int startArrowIndex() const { return m_startArrowIndex; }
1391 tsoots 778
        /**
779
         * @brief Set start arrow index
780
         * @param newIndex index for start arrow
781
         */
782
        void setStartArrowIndex(int newIndex);
1394 cbradney 783
 
784
        /** @brief Get end arrow index
4061 craig 785
         * @sa PageItem::startArrowIndex(), PageItem::setEndArrowIndex()
1394 cbradney 786
         */
4061 craig 787
        int endArrowIndex() const { return m_endArrowIndex; }
1391 tsoots 788
        /**
789
         * @brief Set end arrow index
790
         * @param newIndex index for end arrow
791
         */
792
        void setEndArrowIndex(int newIndex);
1392 cbradney 793
 
1394 cbradney 794
        /** @brief Is the image flipped horizontally? */
4699 cbradney 795
        bool imageFlippedH() const { return m_ImageIsFlippedH; }
1394 cbradney 796
        /** @brief Horizontally flip / unflip the image */
797
        void setImageFlippedH(bool flipped);
1287 tsoots 798
        /** @brief Flip an image horizontally. */
799
        void flipImageH();
1392 cbradney 800
 
801
        /** @brief Is the image flipped vertically? */
4699 cbradney 802
        bool imageFlippedV() const { return m_ImageIsFlippedV; }
1392 cbradney 803
        /** @brief Vertically flip / unflip the image */
804
        void setImageFlippedV(bool flipped);
1287 tsoots 805
        /** @brief Flip an image vertically */
806
        void flipImageV();
1381 cbradney 807
 
1495 tsoots 808
        /**
809
         * @brief Set the image scaling mode.
810
         * @param freeScale is the scaling free (not forced to frame size)
811
         * @param keepRatio should the image's aspect ratio be respected
812
         */
813
        void setImageScalingMode(bool freeScale, bool keepRatio);
814
 
1290 tsoots 815
        /** @brief Lock or unlock this pageitem. */
816
        void toggleLock();
1381 cbradney 817
        /** @brief is the item locked ? */
4695 cbradney 818
        bool locked() const { return m_Locked; }
1293 tsoots 819
        /** @brief Lock or unlock this pageitem */
820
        void setLocked(bool isLocked);
1381 cbradney 821
 
1290 tsoots 822
        /** @brief Toggle lock for resizing */
823
        void toggleSizeLock();
1381 cbradney 824
        /** @brief Is the item's size locked? */
4695 cbradney 825
        bool sizeLocked() const { return m_SizeLocked; }
1381 cbradney 826
        /** @brief set lock for resizing */
1298 fschmid 827
        void setSizeLocked(bool isLocked);
1381 cbradney 828
 
1400 tsoots 829
        /**
5620 jghali 830
         * @brief Does text flow around this object and how
831
         * @sa setTextFlowMode()
1651 craig 832
         */
5620 jghali 833
        TextFlowMode textFlowMode() const { return textFlowModeVal; }
834
 
1651 craig 835
        /**
5620 jghali 836
         * @brief Changes the way text flows around this item
837
         * @param mode true if text is wanted to flow around this object or false if not
838
         * @sa textFlowMode()
1489 tsoots 839
         */
5620 jghali 840
        void setTextFlowMode(TextFlowMode mode);
1489 tsoots 841
 
842
        /**
5620 jghali 843
         * @brief If text should flow around object frame
844
         * @sa PageItem::setTextFlowMode()
1653 craig 845
         */
5620 jghali 846
        bool textFlowAroundObject() const { return (textFlowModeVal != TextFlowDisabled); }
847
 
1653 craig 848
        /**
5620 jghali 849
         * @brief If text should flow around object frame
850
         * @sa PageItem::setTextFlowMode()
1489 tsoots 851
         */
5620 jghali 852
        bool textFlowUsesFrameShape() const { return (textFlowModeVal == TextFlowUsesFrameShape); }
1489 tsoots 853
 
854
        /**
5620 jghali 855
         * @brief If text should flow around bounding box
856
         * @sa PageItem::setTextFlowMode()
1656 craig 857
         */
5620 jghali 858
        bool textFlowUsesBoundingBox() const { return (textFlowModeVal == TextFlowUsesBoundingBox); }
859
 
1656 craig 860
        /**
5620 jghali 861
         * @brief If text should flow around contour line
862
         * @sa PageItem::setTextFlowMode()
1489 tsoots 863
         */
5620 jghali 864
        bool textFlowUsesContourLine() const { return (textFlowModeVal == TextFlowUsesContourLine); }
1489 tsoots 865
 
8445 fschmid 866
        /**
867
         * @brief If text should flow around image clipping path
868
         * @sa PageItem::setTextFlowMode()
869
         */
870
        bool textFlowUsesImageClipping() const { return (textFlowModeVal == TextFlowUsesImageClipping); }
871
 
1422 tsoots 872
        /** @brief Get the frame type
873
         *
874
         * @attention The whole concept of frame types is due for some radical
875
         *            re-working, so don't rely on this interface staying stable.
876
         *            It's here as an interim step to eliminate direct member access
877
         *            on PageItems.
878
         */
4593 cbradney 879
        ItemType itemType() const { return m_ItemType; }
10660 cbradney 880
        /** @brief Get the subclass item type
881
         *
882
         * This function should be used everywhere, where a itemType is required, but
883
         * no C++ type informations is available. e.g. when saving files, etc.
884
         * It returns the same type as itemType() for the standard classes, but
885
         * subclasses override it.
886
         */
887
        virtual ItemType realItemType() const { return m_ItemType; }
1416 tsoots 888
        /**
889
         * @brief Convert this PageItem to PageItem type <code>newType</code>
890
         * @param newType PageItem type for conversion
891
         */
1460 cbradney 892
        void convertTo(ItemType newType);
1416 tsoots 893
 
1489 tsoots 894
        /**
1688 tsoots 895
        * Set the layer for the item
896
        * @param layerId layer where this item is moved
897
        */
898
        void setLayer(int layerId);
899
 
900
        /**
1211 tsoots 901
         * @brief Check the changes to the item and add undo actions for them.
902
         * @param force Force the check. Do not care if mouse button or arrow key is down
903
         * check anyway.
904
         * @author Riku Leino
905
         */
906
        void checkChanges(bool force = false);
1204 tsoots 907
        /**
1211 tsoots 908
         * @name Store undo actions
1204 tsoots 909
         * @brief Add an undo action to the undo guis
910
         * @author Riku Leino
911
         */
1211 tsoots 912
        /*@{*/
1204 tsoots 913
        void moveUndoAction();
1211 tsoots 914
        void resizeUndoAction();
915
        void rotateUndoAction();
4821 cbradney 916
        void changeImageOffsetUndoAction();
917
        void changeImageScaleUndoAction();
1211 tsoots 918
        /*@}*/
919
        /** @brief Required by the UndoObject */
920
        void restore(UndoState *state, bool isUndo);
1361 tsoots 921
 
8455 avox 922
        void getNamedResources(ResourceCollection& lists) const;
923
        void replaceNamedResources(ResourceCollection& newNames);
924
 
2058 craig 925
        /**
926
         * @brief Return a variant of `originalName' that is guaranteed to be unique
927
         *        in the same document as this PageItem.  If the passed name is not
928
         *        in use it is returned unchanged.
929
         * @author Craig Ringer
930
         *
4645 subik 931
         * Usually of the form 'Copy of [name]' or 'Copy of [name] (n)'
2058 craig 932
         */
933
        QString generateUniqueCopyName(const QString originalName) const;
2449 cbradney 934
        /**
935
         * @brief Is this item printed?
4698 cbradney 936
         * @sa setPrintEnabled()
2449 cbradney 937
         */
4698 cbradney 938
        bool printEnabled() const { return m_PrintEnabled; }
2449 cbradney 939
        /**
940
         * @brief Tells if the frame is set to be printed or not
941
         * @sa printable()
942
         */
4698 cbradney 943
        void setPrintEnabled(bool toPrint);
2937 cbradney 944
 
4698 cbradney 945
        /** @brief Toggle printable
946
         * @sa setPrintable()
947
         */
948
        void togglePrintEnabled();
949
 
2937 cbradney 950
        /**
4061 craig 951
         * @brief Tells if the frame is tagged or not
952
         * @sa isTagged()
953
         */
954
        bool isTagged() const { return tagged; }
955
        /**
2937 cbradney 956
         * @brief Set the tagged member for use when deleting items, instead of reselecting them.
957
         * @sa setTagged()
958
         */
959
        void setTagged(bool);
4061 craig 960
 
3302 cbradney 961
        /**
962
         * @brief Load an image into an image frame, moved from ScribusView
963
         * @return True if load succeeded
964
         */
5977 jghali 965
        bool loadImage(const QString& filename, const bool reload, const int gsResolution=-1, bool showMsg = false);
2937 cbradney 966
 
3903 cbradney 967
 
3936 cbradney 968
        /**
4026 craig 969
         * @brief Connect the item's signals to the GUI, primarily the Properties palette, also some to ScMW
3936 cbradney 970
         * @return
971
         */
3903 cbradney 972
        bool connectToGUI();
973
        bool disconnectFromGUI();
3936 cbradney 974
        /**
975
         * @brief Emit the items properties to the GUI in one go
976
         */
977
        void emitAllToGUI();
3903 cbradney 978
 
4084 cbradney 979
        /**
980
         * @brief Get the document that this item belongs to
981
         */
5781 cbradney 982
        ScribusDoc* doc() const { return m_Doc; }
4084 cbradney 983
 
984
        bool isAnnotation() const { return m_isAnnotation; }
985
        void setIsAnnotation(bool);
986
        void setAnnotation(const Annotation& ad);
987
        Annotation& annotation() { return m_annotation; }
8195 avox 988
        const Annotation& annotation() const { return m_annotation; }
4084 cbradney 989
 
4492 cbradney 990
        bool imageShown() const { return PicArt; }
991
        void setImageShown(bool);
992
 
4110 cbradney 993
        void updateConstants();
994
 
1361 tsoots 995
protected:
4142 cbradney 996
 
997
        void drawLockedMarker(ScPainter *p);
998
 
4061 craig 999
        /** @brief Manages undostack and is where all undo actions/states are sent. */
1000
        UndoManager * const undoManager;
1206 tsoots 1001
        /**
1211 tsoots 1002
         * @name Restore helper methods
1003
         * Split the restore method for easier handling.
1206 tsoots 1004
         * @author Riku Leino
1005
         */
1211 tsoots 1006
        /*@{*/
1007
        void restoreMove(SimpleState *state, bool isUndo);
1008
        void restoreResize(SimpleState *state, bool isUndo);
1009
        void restoreRotate(SimpleState *state, bool isUndo);
1286 tsoots 1010
        void restoreFill(SimpleState *state, bool isUndo);
1011
        void restoreShade(SimpleState *state, bool isUndo);
1012
        void restoreLineColor(SimpleState *state, bool isUndo);
1013
        void restoreLineShade(SimpleState *state, bool isUndo);
1357 tsoots 1014
        void restoreName(SimpleState *state, bool isUndo);
1371 tsoots 1015
        void restoreFillTP(SimpleState *state, bool isUndo);
1016
        void restoreLineTP(SimpleState *state, bool isUndo);
1383 tsoots 1017
        void restoreLineStyle(SimpleState *state, bool isUndo);
1385 tsoots 1018
        void restoreLineEnd(SimpleState *state, bool isUndo);
1019
        void restoreLineJoin(SimpleState *state, bool isUndo);
1020
        void restoreLineWidth(SimpleState *state, bool isUndo);
1386 tsoots 1021
        void restoreCustomLineStyle(SimpleState *state, bool isUndo);
1391 tsoots 1022
        void restoreArrow(SimpleState *state, bool isUndo, bool isStart);
5559 avox 1023
 
1404 tsoots 1024
        void restorePStyle(SimpleState *state, bool isUndo);
5559 avox 1025
 
1416 tsoots 1026
        void restoreType(SimpleState *state, bool isUndo);
1489 tsoots 1027
        void restoreTextFlowing(SimpleState *state, bool isUndo);
4821 cbradney 1028
        void restoreImageScaleType(SimpleState *state, bool isUndo);
1029
        void restoreImageScaleChange(SimpleState *state, bool isUndo);
1030
        void restoreImageOffsetChange(SimpleState *state, bool isUndo);
1509 tsoots 1031
        void restorePoly(SimpleState *state, bool isUndo, bool isContour);
1518 tsoots 1032
        void restoreContourLine(SimpleState *state, bool isUndo);
1688 tsoots 1033
        void restoreLayer(SimpleState *state, bool isUndo);
1832 tsoots 1034
        void restoreGetImage(SimpleState *state, bool isUndo);
6139 tsoots 1035
 
1036
        void restoreShapeContour(UndoState *state, bool isUndo);
6266 tsoots 1037
        void restoreImageEffects(UndoState *state, bool isUndo);
1211 tsoots 1038
        /*@}*/
1238 tsoots 1039
 
1040
        /**
1041
         * @brief Returns true if the actions should be sent to the UndoManager.
1042
         *
1043
         * Checks the state of the arrow keys and mouse buttons. If a key or a
1044
         * mouse button is down PageItem is under some action which should only be
1045
         * stored after the action has been finished (to get a single undo action).
1046
         * @return true if the actions should be sent to the UndoManager based on the
1047
         * state of arrow keys and mouse buttons else returns false.
1048
         */
1049
        bool shouldCheck();
1290 tsoots 1050
        /** @brief Clears the current selection and selects this PageItem. */
1051
        void select();
1361 tsoots 1052
 
1053
        // Protected members
1054
 
1055
        /**
1460 cbradney 1056
         * @brief Frame Type, eg line, text frame, etc.
1057
         *
1058
         * This will probably go away when pageitem is split into
1059
         * subclasses.
1060
         */
4593 cbradney 1061
        ItemType m_ItemType;
1460 cbradney 1062
 
1063
        /**
1361 tsoots 1064
         * @brief Item name. Unicode. User visible (outline, property palette, etc).
4084 cbradney 1065
         * @todo This is Annotation Name.. not item name, needs splitting up.
1392 cbradney 1066
         * @sa PageItem::itemName(), PageItem::setItemName()
1067
         */
4084 cbradney 1068
        QString AnName;
1392 cbradney 1069
 
1070
        /**
6368 fschmid 1071
         * @brief Fill pattern name
1072
         * @sa PageItem::pattern(), PageItem::setPattern()
1073
         */
1074
        QString patternVal;
6414 fschmid 1075
        /**
1076
         * @brief Fill pattern transformation matrix
1077
         */
1078
        double patternScaleX;
1079
        double patternScaleY;
1080
        double patternOffsetX;
1081
        double patternOffsetY;
1082
        double patternRotation;
6368 fschmid 1083
 
1084
        /**
1394 cbradney 1085
         * @brief Fill color name
1086
         * @sa PageItem::fillColor(), PageItem::setFillColor()
1087
         */
1088
        QString fillColorVal;
1089
 
1090
        /**
1091
         * @brief Line color name
1092
         * @sa PageItem::lineColor(), PageItem::setLineColor()
1093
         */
1094
        QString lineColorVal;
1095
 
1096
        /**
1097
         * @brief Line shade
1098
         * @sa PageItem::lineShade, PageItem::setLineShade()
1099
         */
9920 fschmid 1100
        double lineShadeVal;
1394 cbradney 1101
 
1102
        /**
1103
         * @brief Fill shade
1104
         * @sa PageItem::fillShade, PageItem::setFillShade()
1105
         */
9920 fschmid 1106
        double fillShadeVal;
1394 cbradney 1107
 
1108
        /**
1109
         * @brief Fill transparency
1110
         * @sa PageItem::fillTransparency(), PageItem::setFillTransparency()
1111
         */
1112
        double fillTransparencyVal;
1113
 
1114
        /**
1115
         * @brief Line stroke transparency.
1116
         * @sa PageItem::lineTransparency(), PageItem::setLineTransparency()
1117
         */
1118
        double lineTransparencyVal;
1119
 
1120
        /**
5746 fschmid 1121
         * @brief Fill transparency blendmode
1122
         * @sa PageItem::fillBlendmode(), PageItem::setFillBlendmode()
1123
         */
1124
        int fillBlendmodeVal;
1125
 
1126
        /**
1127
         * @brief Line stroke transparency blendmode.
1128
         * @sa PageItem::lineBlendmode(), PageItem::setLineBlendmode()
1129
         */
1130
        int lineBlendmodeVal;
1131
 
1132
        /**
1392 cbradney 1133
         * @brief Is the image in this image item flipped horizontally?
1134
         * @sa PageItem::isImageFlippedH(), PageItem::setImageFlippedH(),
1135
         *     PageItem::flipImageH(), PageItem::flippedV
1136
         */
4699 cbradney 1137
        bool m_ImageIsFlippedH;
1392 cbradney 1138
 
1139
        /**
1140
         * @brief Is the image in this image item flipped vertically?
1141
         * @sa PageItem::isImageFlippedV(), PageItem::setImageFlippedV(),
1142
         *     PageItem::flipImageV(), PageItem::flippedH
1143
         */
4699 cbradney 1144
        bool m_ImageIsFlippedV;
1392 cbradney 1145
 
1146
        /**
1147
         * @brief Is the item locked (cannot be moved, resized, etc)?
1148
         * @sa PageItem::locked(), PageItem::setLocked(), PageItem::toggleLock()
1149
         */
4695 cbradney 1150
        bool m_Locked;
1392 cbradney 1151
 
1152
        /**
1153
         * @brief Is the item's size locked?
1154
         * @sa PageItem::sizeLocked(), PageItem::setSizeLocked(), PageItem::toggleSizeLock()
1155
         */
4695 cbradney 1156
        bool m_SizeLocked;
1653 craig 1157
 
1644 cbradney 1158
        /**
1653 craig 1159
         * @brief Should text flow around the item
5620 jghali 1160
         * @sa PageItem::textFlowMode(), PateItem::setTextFlowMode()
1653 craig 1161
         */
5620 jghali 1162
        TextFlowMode textFlowModeVal;
1653 craig 1163
 
1164
        /**
1644 cbradney 1165
         * @brief Stores the attributes of the pageitem (NOT properties, the user defined ATTRIBUTES)
2707 subik 1166
         * @sa
1167
         */
1649 cbradney 1168
        ObjAttrVector pageItemAttributes;
2707 subik 1169
 
2449 cbradney 1170
        /**
1171
         * @brief Is this item set to be printed/exported
1172
         * @sa PageItem::printable(), PageItem::setPrintable()
2707 subik 1173
         */
4698 cbradney 1174
        bool m_PrintEnabled;
2937 cbradney 1175
 
1176
        /**
1177
         * @brief Is this item set to have an action done to it, eg deleted
1178
         * @sa PageItem::isTagged(), PageItem::setTagged()
1179
         */
1180
        bool tagged;
3894 cbradney 1181
 
1182
        QColor fillQColor;
1183
        QColor strokeQColor;
3903 cbradney 1184
 
1185
        /** X position on the page */
1186
        double Xpos;
1187
        /** Y position on the page */
1188
        double Ypos;
3934 cbradney 1189
        /** Width of the item */
1190
        double Width;
1191
        /** Height of the item */
1192
        double Height;
1193
        /** Rotation of the item */
1194
        double Rot;
1195
        /** Element selected? */
1196
        bool Select;
3985 cbradney 1197
        /** Scaling X Factor for images */
1198
        double LocalScX;
1199
        /** Scaling Y Factor for images*/
1200
        double LocalScY;
1201
        /** Image X Offset to frame */
1202
        double LocalX;
1203
        /** Image Y Offset to frame */
1204
        double LocalY;
3988 cbradney 1205
        /** If the frame is reversed */
1206
        bool Reverse;
4061 craig 1207
 
1208
        int m_startArrowIndex;
1209
        int m_endArrowIndex;
7994 avox 1210
 
1211
protected:
3988 cbradney 1212
        /** Left, Top, Bottom, Right distances of text from the frame */
1213
        double Extra;
1214
        double TExtra;
1215
        double BExtra;
1216
        double RExtra;
7994 avox 1217
 
12269 cbradney 1218
        FirstLineOffsetPolicy firstLineOffsetP;
1219
 
7994 avox 1220
public:
3989 cbradney 1221
        /** Radius of rounded corners */
1222
        double RadRect;
3985 cbradney 1223
 
1224
        //Undo Data
1225
        /** @brief Stores the old X-position for undo action. Is used to detect move actions.*/
1226
        double oldXpos;
1227
        /** @brief Stores the old Y-position for undo action. Is used to detect move actions. */
1228
        double oldYpos;
1229
        /** @brief Stores the old width for undo action. Is used to detect resize actions. */
1230
        double oldWidth;
1231
        /** @brief Stores the old height for undo action. Is used to detect resize actions. */
1232
        double oldHeight;
3988 cbradney 1233
        /** @brief Stores the old rotation value for undo action. Is used to detect rotation actions. */
1234
        double oldRot;
4821 cbradney 1235
        /** @brief Stores the old LocalScX value for undo action. Is used to detect image scale actions. */
1236
        double oldLocalScX;
1237
        /** @brief Stores the old LocalScY value for undo action. Is used to detect image scale actions. */
1238
        double oldLocalScY;
1239
        /** @brief Stores the old LocalX value for undo action. Is used to detect image offset actions. */
1240
        double oldLocalX;
1241
        /** @brief Stores the old LocalY value for undo action. Is used to detect image offset actions. */
1242
        double oldLocalY;
3985 cbradney 1243
 
4084 cbradney 1244
        /** Document this item belongs to */
1245
        ScribusDoc *m_Doc;
3985 cbradney 1246
 
4084 cbradney 1247
        /** Flags and data for PDF Annotations */
1248
        bool m_isAnnotation;
1249
        Annotation m_annotation;
4492 cbradney 1250
 
1251
        /** Darstellungsart Bild/Titel */
1252
        bool PicArt;
4580 cbradney 1253
 
1254
         /** Line width */
1255
        double m_lineWidth;
1256
        double Oldm_lineWidth;
4584 cbradney 1257
 
3903 cbradney 1258
signals:
1259
        //Frame signals
3946 cbradney 1260
        void myself(PageItem *);
8229 avox 1261
        void frameType(int);   // not related to Frametype but to m_itemIype :-/
3903 cbradney 1262
        void position(double, double); //X,Y
1263
        void widthAndHeight(double, double); //W,H
3934 cbradney 1264
        void rotation(double); //Degrees rotation       
9920 fschmid 1265
        void colors(QString, QString, double, double); //lineColor, fillColor, lineShade, fillShade
3903 cbradney 1266
        void gradientType(int); //Normal, horizontal, vertical, etc.
6414 fschmid 1267
        void patternFill(QString, double, double, double, double, double);
3941 cbradney 1268
        void gradientColorUpdate(double, double, double, double, double, double); //Cpal updatespecialgradient
3903 cbradney 1269
        void transparency(double, double); //fillTransparency, lineTransparency
5746 fschmid 1270
        void blendmode(int, int); //fillBlendmode, lineBlendmode
4695 cbradney 1271
        void frameLocked(bool); //Frame lock
1272
        void frameSizeLocked(bool); //Frame size lock
4698 cbradney 1273
        void frameFlippedH(bool); //Frame flipped horizontally
1274
        void frameFlippedV(bool); //Frame flipped vertically
1275
        void printEnabled(bool); //Frame is set to print or not
3903 cbradney 1276
        //Shape signals
1277
        void columns(int, double); //Number, gap
1278
        void cornerRadius(double); //Corner radius of the shape
1279
        //Line signals
1280
        void lineWidth(double);
3934 cbradney 1281
        void lineStyleCapJoin(Qt::PenStyle, Qt::PenCapStyle, Qt::PenJoinStyle);
3903 cbradney 1282
        //Frame text signals
1283
        void lineSpacing(double);
9920 fschmid 1284
        void textKerning(double);
5559 avox 1285
        void textStyle(int);
8998 cbradney 1286
        void textFont(const QString&);
9920 fschmid 1287
        void textSize(double);
1288
        void textWidthScale(double);
1289
        void textHeightScale(double);
1290
        void textBaseLineOffset(double);
1291
        void textOutline(double);
1292
        void textShadow(double, double);
1293
        void textUnderline(double, double);
1294
        void textStrike(double, double);
1295
        void textColor(QString, QString, double, double);
5559 avox 1296
        void textFormatting(int);
3903 cbradney 1297
        void textToFrameDistances(double, double, double, double); //left, top, bottom, right: Extra, TExtra, BExtra, RExtra
5559 avox 1298
        //FIXME: columns, grid ?
3903 cbradney 1299
        //Frame image signals
1300
        void imageOffsetScale(double, double, double, double);
3 paul 1301
};
1302
 
1303
#endif