Subversion Repositories Scribus

Rev

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

Rev Author Line No. Line
3 paul 1
/***************************************************************************
2
                          pageitem.h  -  description
3
                             -------------------
4
    begin                : Sat Apr 7 2001
5
    copyright            : (C) 2001 by Franz Schmid
6
    email                : Franz.Schmid@altmuehlnet.de
7
 ***************************************************************************/
8
 
9
/***************************************************************************
10
 *                                                                         *
11
 *   This program is free software; you can redistribute it and/or modify  *
12
 *   it under the terms of the GNU General Public License as published by  *
13
 *   the Free Software Foundation; either version 2 of the License, or     *
14
 *   (at your option) any later version.                                   *
15
 *                                                                         *
16
 ***************************************************************************/
17
 
18
#ifndef PAGEITEM_H
19
#define PAGEITEM_H
20
 
21
#include <qobject.h>
22
#include <qwidget.h>
23
#include <qpointarray.h>
24
#include <qptrlist.h>
25
#include <qimage.h>
26
#include <qpixmap.h>
27
#include <qvaluestack.h>
28
#include <qvaluelist.h>
68 Franz 29
#include "scpainter.h"
1204 tsoots 30
#include "undoobject.h"
1644 cbradney 31
#include "pagestructs.h"
838 cbradney 32
class ScribusDoc;
1204 tsoots 33
class UndoManager;
34
class UndoState;
1789 fschmid 35
class Foi;
3 paul 36
/**
37
  *@author Franz Schmid
38
  */
1489 tsoots 39
 
1624 fschmid 40
struct PSDLayer
41
{
42
        QValueList<uint> channelLen;
43
        QValueList<int> channelType;
44
        int xpos;
45
        int ypos;
46
        int width;
47
        int height;
48
        ushort opacity;
49
        uchar clipping;
50
        uchar flags;
51
        QString layerName;
52
        QString blend;
1633 fschmid 53
        QImage thumb;
1624 fschmid 54
};
55
 
1646 fschmid 56
struct LoadRequest
57
{
58
        bool visible;
59
        ushort opacity;
60
        QString blend;
61
};
62
 
1624 fschmid 63
struct ImageInfoRecord
64
{
65
        int xres;
66
        int yres;
1798 fschmid 67
        int colorspace; /* 0 = RGB  1 = CMYK  2 = Grayscale */
1624 fschmid 68
        bool valid;
69
        bool isRequest;
1807 fschmid 70
        bool progressive;
1624 fschmid 71
        QMap<QString, FPointArray> PDSpathData;
1646 fschmid 72
        QMap<int, LoadRequest> RequestProps;
1624 fschmid 73
        QString clipPath;
1633 fschmid 74
        QString usedPath;
1624 fschmid 75
        QValueList<PSDLayer> layerInfo;
76
};
77
 
1204 tsoots 78
class PageItem : public QObject, public UndoObject
270 Franz 79
{
80
        Q_OBJECT
1394 cbradney 81
 
1364 tsoots 82
        // Properties - see http://doc.trolltech.com/3.3/properties.html
1381 cbradney 83
        // See the getters and setters of these properties for details on their use.
1364 tsoots 84
        Q_PROPERTY(QString itemName READ itemName WRITE setItemName DESIGNABLE false)
1381 cbradney 85
        Q_PROPERTY(QString fillColor READ fillColor WRITE setFillColor DESIGNABLE false)
1394 cbradney 86
        Q_PROPERTY(QString lineColor READ lineColor WRITE setLineColor DESIGNABLE false)
1381 cbradney 87
        Q_PROPERTY(int fillShade READ fillShade WRITE setFillShade DESIGNABLE false)
1394 cbradney 88
        Q_PROPERTY(int lineShade READ lineShade WRITE setLineShade DESIGNABLE false)
1381 cbradney 89
        Q_PROPERTY(double fillTransparency READ fillTransparency WRITE setFillTransparency DESIGNABLE false)
90
        Q_PROPERTY(double lineTransparency READ lineTransparency WRITE setLineTransparency DESIGNABLE false)
91
        Q_PROPERTY(bool locked READ locked WRITE setLocked DESIGNABLE false)
92
        Q_PROPERTY(bool sizeLocked READ sizeLocked WRITE setSizeLocked DESIGNABLE false)
1392 cbradney 93
        Q_PROPERTY(bool imageFlippedV READ imageFlippedV WRITE setImageFlippedV DESIGNABLE false)
94
        Q_PROPERTY(bool imageFlippedH READ imageFlippedH WRITE setImageFlippedH DESIGNABLE false)
1394 cbradney 95
        Q_PROPERTY(double lineWidth READ lineWidth WRITE setLineWidth DESIGNABLE false)
96
        Q_PROPERTY(QString customLineStyle READ customLineStyle WRITE setCustomLineStyle DESIGNABLE false)
97
        Q_PROPERTY(int startArrowIndex READ getStartArrowIndex WRITE setStartArrowIndex DESIGNABLE false)
98
        Q_PROPERTY(int endArrowIndex READ getEndArrowIndex WRITE setEndArrowIndex DESIGNABLE false)
1422 tsoots 99
        Q_PROPERTY(QString font READ font WRITE setFont DESIGNABLE false)
100
        Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize DESIGNABLE false)
101
        Q_PROPERTY(int fontWidth READ fontWidth WRITE setFontWidth DESIGNABLE false)
102
        Q_PROPERTY(QString fontFillColor READ fontFillColor WRITE setFontFillColor DESIGNABLE false)
103
        Q_PROPERTY(int fontFillShade READ fontFillShade WRITE setFontFillShade DESIGNABLE false)
104
        Q_PROPERTY(QString fontStrokeColor READ fontStrokeColor WRITE setFontStrokeColor DESIGNABLE false)
105
        Q_PROPERTY(int fontStrokeShade READ fontStrokeShade WRITE setFontStrokeShade DESIGNABLE false)
106
        Q_PROPERTY(int fontEffects READ fontEffects WRITE setFontEffects DESIGNABLE false)
107
        Q_PROPERTY(double kerning READ kerning WRITE setKerning  DESIGNABLE false)
108
        Q_PROPERTY(double lineSpacing READ lineSpacing WRITE setLineSpacing DESIGNABLE false)
109
        Q_PROPERTY(QString language READ language WRITE setLanguage DESIGNABLE false)
1651 craig 110
        Q_PROPERTY(bool textFlowsAroundFrame READ textFlowsAroundFrame WRITE setTextFlowsAroundFrame DESIGNABLE false)
1653 craig 111
        Q_PROPERTY(bool textFlowUsesBoundingBox READ textFlowUsesBoundingBox WRITE setTextFlowUsesBoundingBox DESIGNABLE false)
1422 tsoots 112
 
113
        // FIXME: QMetaProperty can't translate these to/from enumerator names, probably because the
114
        // properties aren't moc'd in the Qt sources. They work fine in their
115
        // current state as plain integer properties.
1394 cbradney 116
        Q_ENUMS(PenStyle)
117
        Q_PROPERTY(PenStyle lineStyle READ lineStyle WRITE setLineStyle DESIGNABLE false)
118
        Q_ENUMS(PenCapStyle)
119
        Q_PROPERTY(PenCapStyle lineEnd READ lineEnd WRITE setLineEnd DESIGNABLE false)
120
        Q_ENUMS(PenJoinStyle)
121
        Q_PROPERTY(PenJoinStyle lineJoin READ lineJoin WRITE setLineJoin DESIGNABLE false)
122
 
1422 tsoots 123
        // This property may not hang around for too long, but should be useful
124
        // when testing out the pageitem refactoring work.  Setting it is unlikely
125
        // to currently have the desired effect.
126
        /**
127
         * @brief Frame type.
128
         * @warning Do not set this property except for testing and debug purposes.
129
         */
1460 cbradney 130
        Q_ENUMS(ItemType)
131
        Q_PROPERTY(ItemType itemType READ itemType WRITE convertTo DESIGNABLE false)
1422 tsoots 132
 
1460 cbradney 133
public:
134
        // Enumerator definitions
1489 tsoots 135
 
1460 cbradney 136
        /** @brief Frame Type
137
         *
138
         * Later, frame type will probably go away in favour of using
139
         * subclasses and checking types using more conventional methods
140
         * and using Qt's MetaObject introspection.
141
         */
142
        enum ItemType {
1462 cbradney 143
                FrameType1  = 1,
1460 cbradney 144
                ImageFrame      = 2,
1462 cbradney 145
                FrameType3  = 3,
1460 cbradney 146
                TextFrame       = 4,
147
                Line            = 5,
148
                Polygon         = 6,
149
                PolyLine        = 7,
150
                PathText        = 8
151
        };
152
 
153
 
154
        PageItem(ScribusDoc *pa, ItemType newType, double x, double y, double w, double h, double w2, QString fill, QString outline);
3 paul 155
        ~PageItem() {};
1489 tsoots 156
        struct ZZ {
168 Franz 157
                                double xco;
158
                                double yco;
268 Franz 159
                                double wide;
160
                                double kern;
168 Franz 161
                                int Siz;
162
                                int Style;
163
                                int scale;
268 Franz 164
                                int shade;
165
                                int shade2;
166
                                bool Sele;
167
                                QString Zeich;
168
                                QString Farb;
169
                                QString Farb2;
1789 fschmid 170
                                Foi* ZFo;
168 Franz 171
                          };
1460 cbradney 172
 
1649 cbradney 173
        ObjAttrVector* getObjectAttributes();
1676 cbradney 174
        /*!
175
         * brief Returns a complete ObjectAttribute struct if 1 is found, or ObjectAttribute.name will be QString::null if 0 or >1 are found
176
         */
177
        ObjectAttribute getObjectAttribute(QString);
1649 cbradney 178
        void setObjectAttributes(ObjAttrVector*);
3 paul 179
  /** Zeichnet das Item */
168 Franz 180
        void paintObj(QRect e=QRect(), QPixmap *ppX = 0);
181
        void DrawObj(ScPainter *p, QRect e);
1741 cbradney 182
        void DrawObj_Pre(ScPainter *p, QRect &e, QPainter &pf, double &sc);
183
        void DrawObj_Post(ScPainter *p, QRect &e);
1736 cbradney 184
        void DrawObj_ImageFrame(ScPainter *p, QRect e);
185
        void DrawObj_TextFrame(ScPainter *p, QRect e);
186
        void DrawObj_Line(ScPainter *p, QRect e);
187
        void DrawObj_Polygon(ScPainter *p, QRect e);
188
        void DrawObj_PolyLine(ScPainter *p, QRect e);
189
        void DrawObj_PathText(ScPainter *p, QRect e);
190
 
1065 cbradney 191
        double SetZeichAttr(struct ScText *hl, int *chs, QString *chx);
3 paul 192
        void SetFarbe(QColor *tmp, QString farbe, int shad);
68 Franz 193
        void DrawZeichenS(ScPainter *p, struct ZZ *hl);
3 paul 194
        void DrawPolyL(QPainter *p, QPointArray pts);
195
        QString ExpandToken(uint base);
196
        bool Reverse;
197
  /** X-Position auf der Seite */
168 Franz 198
        double Xpos;
1204 tsoots 199
        /** @brief Stores the old X-position for undo action. Is used to detect move actions.*/
200
        double oldXpos;
3 paul 201
  /** Y-Position auf der Seite */
168 Franz 202
        double Ypos;
1204 tsoots 203
        /** @brief Stores the old Y-position for undo action. Is used to detect move actions. */
204
        double oldYpos;
3 paul 205
  /** Breite des Elements */
168 Franz 206
        double Width;
1206 tsoots 207
        /** @brief Stores the old width for undo action. Is used to detect resize actions. */
208
        double oldWidth;
3 paul 209
  /** Hoehe des Elements */
168 Franz 210
        double Height;
1206 tsoots 211
        /** @brief Stores the old height for undo action. Is used to detect resize actions. */
212
        double oldHeight;
3 paul 213
  /** Eckrundung von Rechtecken */
168 Franz 214
        double RadRect;
3 paul 215
  /** Winkel um den das Item gedreht wird */
168 Franz 216
        double Rot;
1211 tsoots 217
        /** @brief Stores the old rotation value for undo action. Is used to detect rotation actions. */
218
        double oldRot;
3 paul 219
  /** Enthaelt das Dokument */
168 Franz 220
        ScribusDoc *Doc;
3 paul 221
        int GrType;
292 Franz 222
        double GrStartX;
223
        double GrStartY;
224
        double GrEndX;
225
        double GrEndY;
68 Franz 226
        QString TxtStroke;
227
        QString TxtFill;
228
        int ShTxtStroke;
229
        int ShTxtFill;
230
        int TxtScale;
231
        int TxTStyle;
134 Franz 232
        int Cols;
135 Franz 233
        double ColGap;
3 paul 234
  /** Strichstaerke */
168 Franz 235
        double Pwidth;
263 Franz 236
        double OldPwidth;
3 paul 237
  /** Linienart */
168 Franz 238
        PenStyle PLineArt;
239
        PenCapStyle PLineEnd;
240
        PenJoinStyle PLineJoin;
27 Franz 241
        QString NamedLStyle;
3 paul 242
  /** Element selektiert Ja/Nein */
168 Franz 243
        bool Select;
3 paul 244
  /** Definiert die Clipping-Region des Elements; */
168 Franz 245
        QPointArray Clip;
3 paul 246
        FPointArray PoLine;
340 Franz 247
        FPointArray ContourLine;
3 paul 248
        QValueList<uint> Segments;
249
        bool PoShow;
80 Franz 250
        double BaseOffs;
168 Franz 251
        bool ClipEdited;
1460 cbradney 252
        // Don't know exactly what this is, but it's not the same as itemType
168 Franz 253
        int FrameType;
3 paul 254
  /** Interne Item-Nummer */
168 Franz 255
        uint ItemNr;
3 paul 256
  /** Hat Element Rahmen? */
168 Franz 257
        bool Frame;
3 paul 258
  /** Seite zu der das Element gehoert */
456 fschmid 259
        int OwnPage;
1211 tsoots 260
        /** @brief Old page number tracked for the move undo action */
261
        int oldOwnPage;
3 paul 262
  /** Darzustellendes Bild */
168 Franz 263
        QImage pixm;
204 Franz 264
        QImage pixmOrg;
1624 fschmid 265
        ImageInfoRecord imgInfo;
3 paul 266
  /** Dateiname des Bildes */
168 Franz 267
        QString Pfile;
268
        QString Pfile2;
269
        QString Pfile3;
270
        QString IProfile;
271
        bool UseEmbedded;
272
        QString EmProfile;
273
        int IRender;
3 paul 274
  /** Darstellungsart Bild/Titel */
168 Franz 275
        bool PicArt;
3 paul 276
  /** Bild verfuegbar */
168 Franz 277
        bool PicAvail;
3 paul 278
  /** Lokales Scaling x*/
168 Franz 279
        double LocalScX;
80 Franz 280
        double LocalViewX;
3 paul 281
  /** Lokales Scaling y*/
168 Franz 282
        double LocalScY;
80 Franz 283
        double LocalViewY;
3 paul 284
  /** Lokales X */
168 Franz 285
        double LocalX;
3 paul 286
  /** Lokales Y */
168 Franz 287
        double LocalY;
3 paul 288
        int OrigW;
289
        int OrigH;
127 Franz 290
        double dpiX;
291
        double dpiY;
3 paul 292
  /** BoundigBox-X */
168 Franz 293
        double BBoxX;
3 paul 294
  /** BoundingBox-H */
168 Franz 295
        double BBoxH;
3 paul 296
  /** Extra Abstand vom Rand */
168 Franz 297
        double Extra;
298
        double TExtra;
299
        double BExtra;
300
        double RExtra;
3 paul 301
  /** Linespacing */
168 Franz 302
        double LineSp;
3 paul 303
  /** Zeichen X-Position */
168 Franz 304
        double CurX;
3 paul 305
  /** Zeichen Y-Position */
168 Franz 306
        double CurY;
3 paul 307
  /** Cursorposition */
168 Franz 308
        int CPos;
3 paul 309
  /** Text des Elements */
1065 cbradney 310
        QPtrList<ScText> itemText;
3 paul 311
  /** Flag ob Element gedruckt wird */
168 Franz 312
        bool isPrintable;
3 paul 313
  /** Flag fuer PDF-Bookmark */
168 Franz 314
        bool isBookmark;
315
        int BMnr;
3 paul 316
  /** Flag fuer PDF-Annotation */
168 Franz 317
        bool isAnnotation;
318
        int AnType;
3 paul 319
        int AnActType;
168 Franz 320
        QString AnAction;
3 paul 321
        QString An_E_act;
322
        QString An_X_act;
323
        QString An_D_act;
324
        QString An_Fo_act;
325
        QString An_Bl_act;
326
        QString An_K_act;
327
        QString An_F_act;
328
        QString An_V_act;
329
        QString An_C_act;
88 Franz 330
        bool AutoName;
3 paul 331
        QString AnToolTip;
332
        QString AnRollOver;
333
        QString AnDown;
334
        QString AnBColor;
19 Franz 335
        QString An_Extern;
3 paul 336
        int AnBsty;
337
        int AnBwid;
338
        int AnFeed;
168 Franz 339
        int AnZiel;
3 paul 340
        int AnFlag;
341
        int AnMaxChar;
342
        int AnVis;
343
        int AnChkStil;
344
        int AnFont;
345
        bool AnIsChk;
346
        bool AnAAact;
347
        bool AnHTML;
348
        bool AnUseIcons;
349
        int AnIPlace;
350
        int AnScaleW;
351
        int AnFormat;
352
  /** Flag fuer neuzeichnen im EditMode */
168 Franz 353
        bool Dirty;
3 paul 354
  /** Item Font */
168 Franz 355
        QString IFont;
3 paul 356
  /** Item Fontgroesse */
168 Franz 357
        int ISize;
3 paul 358
  /** Flag fuer Auswahl */
168 Franz 359
        bool HasSel;
3 paul 360
  /** Flag fuer Textfluss */
168 Franz 361
        bool FrameOnly;
362
        PageItem *BackBox;
363
        PageItem *NextBox;
364
        int NextIt;
365
        int NextPg;
366
        bool Tinput;
367
        bool isAutoText;
1065 cbradney 368
        int textAlignment;
168 Franz 369
        uint MaxChars;
370
        bool Redrawn;
371
        double ExtraV;
372
        bool isRaster;
373
        double OldB;
374
        double OldH;
375
        double OldB2;
376
        double OldH2;
377
        bool Sizing;
378
        bool toPixmap;
3 paul 379
        int LayerNr;
380
        bool ScaleType;
381
        bool AspectRatio;
168 Franz 382
        QValueStack<int> Groups;
20 Franz 383
        bool InvPict;
80 Franz 384
        QValueList<double> DashValues;
139 Franz 385
        QValueList<double> TabValues;
80 Franz 386
        double DashOffset;
68 Franz 387
        VGradient fill_gradient;
388
        QString Language;
232 Franz 389
/* Additions for Table Support */
390
        PageItem* LeftLink;
391
        PageItem* RightLink;
392
        PageItem* TopLink;
393
        PageItem* BottomLink;
234 Franz 394
        int LeftLinkID;
395
        int RightLinkID;
396
        int TopLinkID;
397
        int BottomLinkID;
232 Franz 398
        bool LeftLine;
399
        bool RightLine;
400
        bool TopLine;
401
        bool BottomLine;
402
        bool isTableItem;
403
        bool isSingleSel;
456 fschmid 404
        double BoundingX;
405
        double BoundingY;
406
        double BoundingW;
407
        double BoundingH;
408
        bool ChangedMasterItem;
537 fschmid 409
        QString OnMasterPage;
740 fschmid 410
        int startArrowIndex;
411
        int endArrowIndex;
1250 tsoots 412
 
1211 tsoots 413
        /** @brief Manages undostack and is where all undo actions/states are sent. */
1204 tsoots 414
        UndoManager *undoManager;
1361 tsoots 415
        /**  @brief Get name of the item
416
         *
417
         * This is unrelated to QObject::name(); the pageItem's name is independent
418
         * of its Qt name.
419
         * See also PageItem::setItemName()
420
         */
1371 tsoots 421
        QString itemName() const;
1361 tsoots 422
        /**
1204 tsoots 423
         * @brief Set name of the item
424
         * @param newName name for the item
425
         * @author Riku Leino
1361 tsoots 426
         *
427
         * Note that this is unrelated to QObject::setName()
428
         * See also PageItem::itemName()
1204 tsoots 429
         */
1361 tsoots 430
        void setItemName(const QString& newName);
1381 cbradney 431
 
432
        /** @brief Get the (name of the) fill color of the object */
433
        QString fillColor() const;
1286 tsoots 434
        /**
435
         * @brief Set the fill color of the object.
436
         * @param newColor fill color for the object
437
         */
438
        void setFillColor(const QString &newColor);
1381 cbradney 439
 
440
        /** @brief Get the shade of the fill color */
441
        int fillShade() const;
1286 tsoots 442
        /**
443
         * @brief Set the fill color shade.
444
         * @param newShade shade for the fill color
445
         */
446
        void setFillShade(int newShade);
1381 cbradney 447
 
448
        /** @brief Get the transparency of the fill color */
449
        double fillTransparency() const;
1286 tsoots 450
        /**
1371 tsoots 451
         * @brief Set the transparency of the fill color.
452
         * @param newTransparency transparency of the fill color
453
         */
454
        void setFillTransparency(double newTransparency);
1381 cbradney 455
 
456
        /** @brief Get the line color of the object */
457
        QString lineColor() const;
1371 tsoots 458
        /**
1286 tsoots 459
         * @brief Set the line color of the object.
460
         * @param newFill line color for the object
461
         */
462
        void setLineColor(const QString &newColor);
1381 cbradney 463
 
464
        /** @brief Get the line color shade */
465
        int lineShade() const;
1286 tsoots 466
        /**
467
         * @brief Set the line color shade.
468
         * @param newColor shade for the line color
469
         */
470
        void setLineShade(int newShade);
1381 cbradney 471
 
472
        /** @brief Get the line transparency */
473
        double lineTransparency() const;
1371 tsoots 474
        /**
475
         * @brief Set the transparency of the line color.
476
         * @param newTransparency transparency of the line color
477
         */
478
        void setLineTransparency(double newTransparency);
1394 cbradney 479
 
480
        /** @brief Get the style of line */
481
        PenStyle lineStyle() const;
1383 tsoots 482
        /**
483
         * @brief Set the style of line.
484
         * @param newStyle style of line
485
         * @sa Qt::PenStyle
486
         */
487
        void setLineStyle(PenStyle newStyle);
1394 cbradney 488
 
489
        /** @brief Get the width of the line */
490
        double lineWidth() const;
1385 tsoots 491
        /**
492
         * @brief Set the width of line
493
         * @param newWidth width of line
494
         */
495
        void setLineWidth(double newWidth);
1394 cbradney 496
 
497
        /** @brief Get the end cap style of the line */
498
        PenCapStyle lineEnd() const;
1385 tsoots 499
        /**
500
         * @brief Set the end style of line
501
         * @param newStyle end style of line
502
         * @sa Qt::PenCapStyle
503
         */
504
        void setLineEnd(PenCapStyle newStyle);
1394 cbradney 505
 
506
        /** @brief Get the join style of multi-segment lines */
507
        PenJoinStyle lineJoin() const;
1385 tsoots 508
        /**
509
         * @brief Set the join style of line
510
         * @param newStyle join style of line
511
         * @sa Qt::PenJoinStyle
512
         */
513
        void setLineJoin(PenJoinStyle newStyle);
1392 cbradney 514
 
1394 cbradney 515
        /** @brief Get name of active custom line style */
516
        QString customLineStyle() const;
1489 tsoots 517
        /**
1386 tsoots 518
         * @brief Set custom line style
519
         * @param newStyle name of the custom style
520
         */
521
        void setCustomLineStyle(const QString& newStyle);
1392 cbradney 522
 
1394 cbradney 523
        /** @brief Get start arrow index
524
         * @sa PageItem::getEndArrowIndex(), PageItem::setStartArrowIndex()
525
         */
526
        int getStartArrowIndex() const;
1391 tsoots 527
        /**
528
         * @brief Set start arrow index
529
         * @param newIndex index for start arrow
530
         */
531
        void setStartArrowIndex(int newIndex);
1394 cbradney 532
 
533
        /** @brief Get end arrow index
534
         * @sa PageItem::getStartArrowIndex(), PageItem::setEndArrowIndex()
535
         */
536
        int getEndArrowIndex() const;
1391 tsoots 537
        /**
538
         * @brief Set end arrow index
539
         * @param newIndex index for end arrow
540
         */
541
        void setEndArrowIndex(int newIndex);
1392 cbradney 542
 
1394 cbradney 543
        /** @brief Is the image flipped horizontally? */
544
        bool imageFlippedH() const;
545
        /** @brief Horizontally flip / unflip the image */
546
        void setImageFlippedH(bool flipped);
1287 tsoots 547
        /** @brief Flip an image horizontally. */
548
        void flipImageH();
1392 cbradney 549
 
550
        /** @brief Is the image flipped vertically? */
551
        bool imageFlippedV() const;
552
        /** @brief Vertically flip / unflip the image */
553
        void setImageFlippedV(bool flipped);
1287 tsoots 554
        /** @brief Flip an image vertically */
555
        void flipImageV();
1381 cbradney 556
 
1495 tsoots 557
        /**
558
         * @brief Set the image scaling mode.
559
         * @param freeScale is the scaling free (not forced to frame size)
560
         * @param keepRatio should the image's aspect ratio be respected
561
         */
562
        void setImageScalingMode(bool freeScale, bool keepRatio);
563
 
1290 tsoots 564
        /** @brief Lock or unlock this pageitem. */
565
        void toggleLock();
1381 cbradney 566
        /** @brief is the item locked ? */
567
        bool locked() const;
1293 tsoots 568
        /** @brief Lock or unlock this pageitem */
569
        void setLocked(bool isLocked);
1381 cbradney 570
 
1290 tsoots 571
        /** @brief Toggle lock for resizing */
572
        void toggleSizeLock();
1381 cbradney 573
        /** @brief Is the item's size locked? */
574
        bool sizeLocked() const;
575
        /** @brief set lock for resizing */
1298 fschmid 576
        void setSizeLocked(bool isLocked);
1381 cbradney 577
 
1422 tsoots 578
        /** @brief Get the PageItem-wide font name */
579
        QString font() const;
1399 tsoots 580
        /**
581
         * @brief Set font for the PageItem.
582
         * @param newFont name of the font
583
         */
584
        void setFont(const QString& newFont);
1422 tsoots 585
 
586
        /** @brief Get the PageItem-wide font size */
587
        int fontSize() const;
1400 tsoots 588
        /**
589
         * @brief Set the font size of the frame
590
         * @param newSize font size
591
         */
592
        void setFontSize(int newSize);
1422 tsoots 593
 
594
        /** @brief Get the PageItem-wide character width scaling percentage */
595
        int fontWidth() const;
1400 tsoots 596
        /**
597
         * @brief Set scaling width of character
598
         * @param newWidth width of character
599
         */
600
        void setFontWidth(int newWidth);
1422 tsoots 601
 
602
        /** @brief Get the name of the PageItem-wide font fill color */
603
        QString fontFillColor() const;
1489 tsoots 604
        /**
1401 tsoots 605
         * @brief Set font fill color
606
         * @param newColor font fill color
607
         */
608
        void setFontFillColor(const QString& newColor);
1422 tsoots 609
 
610
        /** @brief Get the PageItem-wide font fill shade */
611
        int fontFillShade() const;
1402 tsoots 612
        /**
613
         * @brief Set the shade of font fill color
614
         * @param newShade shade of font fill color
615
         */
616
        void setFontFillShade(int newShade);
1422 tsoots 617
 
618
        /** @brief Get the PageItem-wide font stroke color */
619
        QString fontStrokeColor() const;
1489 tsoots 620
        /**
1401 tsoots 621
         * @brief Set the color of font stroke
622
         * @param newColor color of font stroke
623
         */
624
        void setFontStrokeColor(const QString& newColor);
1422 tsoots 625
 
626
        /** @brief Get the PageItem-wide font stroke shade */
627
        int fontStrokeShade() const;
1402 tsoots 628
        /**
629
         * @brief Set the shade of font stroke color
630
         * @param newShade shade of font stroke color
631
         */
632
        void setFontStrokeShade(int newShade);
1422 tsoots 633
 
634
        /** @brief Get the PageItem-wide font effects flags
635
         *
636
         * TODO This should probably be an enum set
637
         */
638
        int fontEffects() const;
1403 tsoots 639
        /**
1415 tsoots 640
         * @brief Set font effects
641
         * @param newEffects font effects
642
         */
643
        void setFontEffects(int newEffects);
1422 tsoots 644
 
645
        /** @brief Get PageItem-wide text kerning */
646
        double kerning() const;
1415 tsoots 647
        /**
1403 tsoots 648
         * @brief Set kerning for the text
649
         * @param newKerning kerning for the text
650
         */
651
        void setKerning(double newKerning);
1422 tsoots 652
 
653
        /** @brief Get the PageItem-wide line spacing */
654
        double lineSpacing() const;
1403 tsoots 655
        /**
656
         * @brief Set a line spacing for the frame
657
         * @param newSpacing line spacing for the frame
658
         */
659
        void setLineSpacing(double newSpacing);
1422 tsoots 660
 
661
        /** @brief Get the hyphenation language for the frame */
662
        QString language() const;
1403 tsoots 663
        /**
664
         * @brief Set the hyphenation language for the frame
665
         * @param newLanguage hyphenation language for the frame
666
         */
667
        void setLanguage(const QString& newLanguage);
1399 tsoots 668
 
1489 tsoots 669
        /**
1651 craig 670
         * @brief Does text flow around this object
1656 craig 671
         * @sa setTextFlowsAroundFrame()
1651 craig 672
         */
673
        bool textFlowsAroundFrame() const;
674
        /**
675
         * @brief Enable/disable text flowing around this item
1489 tsoots 676
         * @param isFlowing true if text is wanted to flow around this object or false if not
1656 craig 677
         * @sa textFlowsAroundFrame()
1489 tsoots 678
         */
1651 craig 679
        void setTextFlowsAroundFrame(bool isFlowing);
1489 tsoots 680
 
681
        /**
1653 craig 682
         * @brief Should text flow around the object's bounding box if text flow is enabled?
683
         * @sa PageItem::setTextFlowUsesBoundingBox()
684
         */
685
        bool textFlowUsesBoundingBox() const;
686
        /**
1489 tsoots 687
         * @brief Tells if the text flow should follow the square frame border if <code>useBounding</code>
688
         * @brief is true, if it is set false text fill flow around the object border rather than frame.
689
         *
690
         * Setting this to true will unset contour line to false. Bounding box and contour line cannot
691
         * be used at the same time.
692
         * @param useBounding true if text should flow around the frame border false if it should follow
693
         * the actual shape of the object.
1656 craig 694
         * @sa setTextFlowsAroundFrame()
695
         * @sa setTextFlowUsesContourLine()
696
         * @sa textFlowUsesBoundingBox()
1489 tsoots 697
         */
1653 craig 698
        void setTextFlowUsesBoundingBox(bool useBounding);
1489 tsoots 699
 
700
        /**
1656 craig 701
         * @brief Should text flow around the contour line of the frame?
702
         * @sa setTextFlowUsesContourLine()
703
         */
704
        bool textFlowUsesContourLine() const;
705
        /**
1489 tsoots 706
         * @brief Tells if the text flow should follow the contour line of the frame.
707
         *
708
         * Setting this to true will unset bounding box to false. Contour line and bounding box cannot
709
         * be used at the same time.
710
         * @param useContour true if text should flow around the contour line of the frame false if
711
         * it should flow around the actual shap of the object.
1656 craig 712
         * @sa setTextFlowsAroundFrame()
713
         * @sa setTextFlowUsesBoundingBox()
714
         * @sa textFlowUsesContourLine()
1489 tsoots 715
         */
1656 craig 716
        void setTextFlowUsesContourLine(bool useContour);
1489 tsoots 717
 
1422 tsoots 718
        /** @brief Get the frame type
719
         *
720
         * @attention The whole concept of frame types is due for some radical
721
         *            re-working, so don't rely on this interface staying stable.
722
         *            It's here as an interim step to eliminate direct member access
723
         *            on PageItems.
724
         */
1460 cbradney 725
        ItemType itemType() const;
1416 tsoots 726
        /**
727
         * @brief Convert this PageItem to PageItem type <code>newType</code>
728
         * @param newType PageItem type for conversion
729
         */
1460 cbradney 730
        void convertTo(ItemType newType);
1416 tsoots 731
 
1489 tsoots 732
        /**
1688 tsoots 733
        * Set the layer for the item
734
        * @param layerId layer where this item is moved
735
        */
736
        void setLayer(int layerId);
737
 
738
        /**
1211 tsoots 739
         * @brief Check the changes to the item and add undo actions for them.
740
         * @param force Force the check. Do not care if mouse button or arrow key is down
741
         * check anyway.
742
         * @author Riku Leino
743
         */
744
        void checkChanges(bool force = false);
1204 tsoots 745
        /**
1211 tsoots 746
         * @name Store undo actions
1204 tsoots 747
         * @brief Add an undo action to the undo guis
748
         * @author Riku Leino
749
         */
1211 tsoots 750
        /*@{*/
1204 tsoots 751
        void moveUndoAction();
1211 tsoots 752
        void resizeUndoAction();
753
        void rotateUndoAction();
754
        /*@}*/
755
        /** @brief Required by the UndoObject */
756
        void restore(UndoState *state, bool isUndo);
1818 cbradney 757
 
758
        bool LoremIpsum();
1361 tsoots 759
 
760
protected:
1206 tsoots 761
        /**
1211 tsoots 762
         * @name Restore helper methods
763
         * Split the restore method for easier handling.
1206 tsoots 764
         * @author Riku Leino
765
         */
1211 tsoots 766
        /*@{*/
767
        void restoreMove(SimpleState *state, bool isUndo);
768
        void restoreResize(SimpleState *state, bool isUndo);
769
        void restoreRotate(SimpleState *state, bool isUndo);
1286 tsoots 770
        void restoreFill(SimpleState *state, bool isUndo);
771
        void restoreShade(SimpleState *state, bool isUndo);
772
        void restoreLineColor(SimpleState *state, bool isUndo);
773
        void restoreLineShade(SimpleState *state, bool isUndo);
1357 tsoots 774
        void restoreName(SimpleState *state, bool isUndo);
1371 tsoots 775
        void restoreFillTP(SimpleState *state, bool isUndo);
776
        void restoreLineTP(SimpleState *state, bool isUndo);
1383 tsoots 777
        void restoreLineStyle(SimpleState *state, bool isUndo);
1385 tsoots 778
        void restoreLineEnd(SimpleState *state, bool isUndo);
779
        void restoreLineJoin(SimpleState *state, bool isUndo);
780
        void restoreLineWidth(SimpleState *state, bool isUndo);
1386 tsoots 781
        void restoreCustomLineStyle(SimpleState *state, bool isUndo);
1391 tsoots 782
        void restoreArrow(SimpleState *state, bool isUndo, bool isStart);
1399 tsoots 783
        void restoreFont(SimpleState *state, bool isUndo);
1400 tsoots 784
        void restoreFontSize(SimpleState *state, bool isUndo);
785
        void restoreFontWidth(SimpleState *state, bool isUndo);
1401 tsoots 786
        void restoreFontFill(SimpleState *state, bool isUndo);
787
        void restoreFontStroke(SimpleState *state, bool isUndo);
1402 tsoots 788
        void restoreFontFillShade(SimpleState *state, bool isUndo);
789
        void restoreFontStrokeShade(SimpleState *state, bool isUndo);
1403 tsoots 790
        void restoreKerning(SimpleState *state, bool isUndo);
791
        void restoreLineSpacing(SimpleState *state, bool isUndo);
792
        void restoreLanguage(SimpleState *state, bool isUndo);
1404 tsoots 793
        void restorePStyle(SimpleState *state, bool isUndo);
1415 tsoots 794
        void restoreFontEffect(SimpleState *state, bool isUndo);
1416 tsoots 795
        void restoreType(SimpleState *state, bool isUndo);
1489 tsoots 796
        void restoreTextFlowing(SimpleState *state, bool isUndo);
1495 tsoots 797
        void restoreImageScaling(SimpleState *state, bool isUndo);
1509 tsoots 798
        void restorePoly(SimpleState *state, bool isUndo, bool isContour);
1518 tsoots 799
        void restoreContourLine(SimpleState *state, bool isUndo);
1688 tsoots 800
        void restoreLayer(SimpleState *state, bool isUndo);
1832 tsoots 801
        void restoreGetImage(SimpleState *state, bool isUndo);
1211 tsoots 802
        /*@}*/
1238 tsoots 803
 
804
        /**
805
         * @brief Returns true if the actions should be sent to the UndoManager.
806
         *
807
         * Checks the state of the arrow keys and mouse buttons. If a key or a
808
         * mouse button is down PageItem is under some action which should only be
809
         * stored after the action has been finished (to get a single undo action).
810
         * @return true if the actions should be sent to the UndoManager based on the
811
         * state of arrow keys and mouse buttons else returns false.
812
         */
813
        bool shouldCheck();
1290 tsoots 814
        /** @brief Clears the current selection and selects this PageItem. */
815
        void select();
1361 tsoots 816
 
817
        // Protected members
818
 
819
        /**
1460 cbradney 820
         * @brief Frame Type, eg line, text frame, etc.
821
         *
822
         * This will probably go away when pageitem is split into
823
         * subclasses.
824
         */
825
        ItemType itemTypeVal;
826
 
827
        /**
1361 tsoots 828
         * @brief Item name. Unicode. User visible (outline, property palette, etc).
1392 cbradney 829
         * @sa PageItem::itemName(), PageItem::setItemName()
830
         */
1361 tsoots 831
        QString AnName;
1392 cbradney 832
 
833
        /**
1394 cbradney 834
         * @brief Fill color name
835
         * @sa PageItem::fillColor(), PageItem::setFillColor()
836
         */
837
        QString fillColorVal;
838
 
839
        /**
840
         * @brief Line color name
841
         * @sa PageItem::lineColor(), PageItem::setLineColor()
842
         */
843
        QString lineColorVal;
844
 
845
        /**
846
         * @brief Line shade
847
         * @sa PageItem::lineShade, PageItem::setLineShade()
848
         */
849
        int lineShadeVal;
850
 
851
        /**
852
         * @brief Fill shade
853
         * @sa PageItem::fillShade, PageItem::setFillShade()
854
         */
855
        int fillShadeVal;
856
 
857
        /**
858
         * @brief Fill transparency
859
         * @sa PageItem::fillTransparency(), PageItem::setFillTransparency()
860
         */
861
        double fillTransparencyVal;
862
 
863
        /**
864
         * @brief Line stroke transparency.
865
         * @sa PageItem::lineTransparency(), PageItem::setLineTransparency()
866
         */
867
        double lineTransparencyVal;
868
 
869
        /**
1392 cbradney 870
         * @brief Is the image in this image item flipped horizontally?
871
         * @sa PageItem::isImageFlippedH(), PageItem::setImageFlippedH(),
872
         *     PageItem::flipImageH(), PageItem::flippedV
873
         */
874
        bool imageIsFlippedH;
875
 
876
        /**
877
         * @brief Is the image in this image item flipped vertically?
878
         * @sa PageItem::isImageFlippedV(), PageItem::setImageFlippedV(),
879
         *     PageItem::flipImageV(), PageItem::flippedH
880
         */
881
        bool imageIsFlippedV;
882
 
883
        /**
884
         * @brief Is the item locked (cannot be moved, resized, etc)?
885
         * @sa PageItem::locked(), PageItem::setLocked(), PageItem::toggleLock()
886
         */
887
        bool Locked;
888
 
889
        /**
890
         * @brief Is the item's size locked?
891
         * @sa PageItem::sizeLocked(), PageItem::setSizeLocked(), PageItem::toggleSizeLock()
892
         */
893
        bool LockRes;
1653 craig 894
 
1644 cbradney 895
        /**
1653 craig 896
         * @brief Should text flow around the item
897
         * @sa PageItem::textFlowsAroundFrame(), PateItem::setTextFlowsAroundFrame()
898
         */
899
        bool textFlowsAroundFrameVal;
900
 
901
        /**
902
         * @brief Should text flow around the item's bounding box?
1656 craig 903
         * @sa PageItem::textFlowUsesBoundingBox(), PageItem::setTextFlowUsesBoundingBox()
1653 craig 904
         */
905
        bool textFlowUsesBoundingBoxVal;
906
 
907
        /**
1656 craig 908
         * @brief Should text flow around the item's contour line?
909
         * @sa PageItem::textFlowUsesContourLine(), PageItem::setTextFlowUsesContourLine
910
         */
911
        bool textFlowUsesContourLineVal;
912
 
913
        /**
1644 cbradney 914
         * @brief Stores the attributes of the pageitem (NOT properties, the user defined ATTRIBUTES)
915
         * @sa
916
         */              
1649 cbradney 917
        ObjAttrVector pageItemAttributes;
3 paul 918
};
919
 
920
#endif