Subversion Repositories Scribus

Rev

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