Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

pageitem.h

Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /***************************************************************************
00008                           pageitem.h  -  description
00009                              -------------------
00010     begin                : Sat Apr 7 2001
00011     copyright            : (C) 2001 by Franz Schmid
00012     email                : Franz.Schmid@altmuehlnet.de
00013  ***************************************************************************/
00014 
00015 /***************************************************************************
00016  *                                                                         *
00017  *   This program is free software; you can redistribute it and/or modify  *
00018  *   it under the terms of the GNU General Public License as published by  *
00019  *   the Free Software Foundation; either version 2 of the License, or     *
00020  *   (at your option) any later version.                                   *
00021  *                                                                         *
00022  ***************************************************************************/
00023 
00024 #ifndef PAGEITEM_H
00025 #define PAGEITEM_H
00026 
00027 #include <QObject>
00028 #include <QWidget>
00029 #include <QPolygon>
00030 #include <QStack>
00031 #include <QList>
00032 #include <QKeyEvent>
00033 #include <QMenu>
00034 #include <QRect>
00035 #include <QRectF>
00036 
00037 #include "scribusapi.h"
00038 #include "annotation.h"
00039 #include "observable.h"
00040 #include "pagestructs.h"
00041 #include "scimage.h"
00042 #include "sctextstruct.h"
00043 #include "undoobject.h"
00044 #include "vgradient.h"
00045 #include "text/nlsconfig.h"
00046 #include "text/storytext.h"
00047 #include "desaxe/saxio.h"
00048 
00049 class ScPainter;
00050 class ScribusDoc;
00051 class SimpleState;
00052 class UndoManager;
00053 class UndoState;
00054 class ResourceCollection;
00055 class QFrame;
00056 class QGridLayout;
00057 
00058 class PageItem_ImageFrame;
00059 class PageItem_Line;
00060 class PageItem_Polygon;
00061 class PageItem_PolyLine;
00062 class PageItem_TextFrame;
00063 class PageItem_PathText;
00064 class PageItem_LatexFrame;
00065 
00066 struct CopyPasteBuffer;
00071 class SCRIBUS_API PageItem : public QObject, public UndoObject, public SaxIO, public SingleObservable<PageItem>
00072 {
00073     Q_OBJECT
00074 
00075     // Properties - see http://doc.trolltech.com/3.3/properties.html
00076     // See the accessors of these properties for details on their use.
00077     Q_PROPERTY(QString itemName READ itemName WRITE setItemName DESIGNABLE false)
00078     Q_PROPERTY(QString fillColor READ fillColor WRITE setFillColor DESIGNABLE false)
00079     Q_PROPERTY(QString lineColor READ lineColor WRITE setLineColor DESIGNABLE false)
00080     Q_PROPERTY(double fillShade READ fillShade WRITE setFillShade DESIGNABLE false)
00081     Q_PROPERTY(double lineShade READ lineShade WRITE setLineShade DESIGNABLE false)
00082     Q_PROPERTY(double fillTransparency READ fillTransparency WRITE setFillTransparency DESIGNABLE false)
00083     Q_PROPERTY(double lineTransparency READ lineTransparency WRITE setLineTransparency DESIGNABLE false)
00084     Q_PROPERTY(bool m_Locked READ locked WRITE setLocked DESIGNABLE false)
00085     Q_PROPERTY(bool m_SizeLocked READ sizeLocked WRITE setSizeLocked DESIGNABLE false)
00086     Q_PROPERTY(bool m_ImageIsFlippedV READ imageFlippedV WRITE setImageFlippedV DESIGNABLE false)
00087     Q_PROPERTY(bool m_ImageIsFlippedH READ imageFlippedH WRITE setImageFlippedH DESIGNABLE false)
00088     Q_PROPERTY(double lineWidth READ lineWidth WRITE setLineWidth DESIGNABLE false)
00089     Q_PROPERTY(QString customLineStyle READ customLineStyle WRITE setCustomLineStyle DESIGNABLE false)
00090     Q_PROPERTY(int startArrowIndex READ startArrowIndex WRITE setStartArrowIndex DESIGNABLE false)
00091     Q_PROPERTY(int endArrowIndex READ endArrowIndex WRITE setEndArrowIndex DESIGNABLE false)
00092 
00093     Q_PROPERTY(bool m_PrintEnabled READ printEnabled WRITE setPrintEnabled DESIGNABLE false)
00094     Q_PROPERTY(double xPos READ xPos WRITE setXPos DESIGNABLE false)
00095     Q_PROPERTY(double yPos READ yPos WRITE setYPos DESIGNABLE false)
00096     Q_PROPERTY(double width READ width WRITE setWidth DESIGNABLE false)
00097     Q_PROPERTY(double height READ height WRITE setHeight DESIGNABLE false)
00098     Q_PROPERTY(double rotation READ rotation WRITE setRotation DESIGNABLE false)
00099     Q_PROPERTY(double imageXScale READ imageXScale WRITE setImageXScale DESIGNABLE false)
00100     Q_PROPERTY(double imageYScale READ imageYScale WRITE setImageYScale DESIGNABLE false)
00101     Q_PROPERTY(double imageXOffset READ imageXOffset WRITE setImageXOffset DESIGNABLE false)
00102     Q_PROPERTY(double imageYOffset READ imageYOffset WRITE setImageYOffset DESIGNABLE false)
00103     Q_PROPERTY(bool reversed READ reversed WRITE setReversed DESIGNABLE false)
00104     Q_PROPERTY(double cornerRadius READ cornerRadius WRITE setCornerRadius DESIGNABLE false)
00105     Q_PROPERTY(double textToFrameDistLeft READ textToFrameDistLeft WRITE setTextToFrameDistLeft DESIGNABLE false)
00106     Q_PROPERTY(double textToFrameDistRight READ textToFrameDistRight WRITE setTextToFrameDistRight DESIGNABLE false)
00107     Q_PROPERTY(double textToFrameDistTop READ textToFrameDistTop WRITE setTextToFrameDistTop DESIGNABLE false)
00108     Q_PROPERTY(double textToFrameDistBottom READ textToFrameDistBottom WRITE setTextToFrameDistBottom DESIGNABLE false)
00109     Q_PROPERTY(double ColGap READ columnGap WRITE setColumnGap DESIGNABLE false)
00110     Q_PROPERTY(int Cols READ columns WRITE setColumns DESIGNABLE false)
00111     // FIXME: QMetaProperty can't translate these to/from enumerator names, probably because the
00112     // properties aren't moc'd in the Qt sources. They work fine in their
00113     // current state as plain integer properties.
00114 //      Q_ENUMS(PenStyle)
00115 //  Q_PROPERTY(PenStyle lineStyle READ lineStyle WRITE setLineStyle DESIGNABLE false)
00116 //  Q_ENUMS(PenCapStyle)
00117 //  Q_PROPERTY(PenCapStyle lineEnd READ lineEnd WRITE setLineEnd DESIGNABLE false)
00118 //  Q_ENUMS(PenJoinStyle)
00119 //  Q_PROPERTY(PenJoinStyle lineJoin READ lineJoin WRITE setLineJoin DESIGNABLE false)
00120 
00121     // This property may not hang around for too long, but should be useful
00122     // when testing out the pageitem refactoring work.  Setting it is unlikely
00123     // to currently have the desired effect.
00128     Q_ENUMS(ItemType)
00129     Q_PROPERTY(ItemType itemType READ itemType WRITE convertTo DESIGNABLE false)
00130 
00131 public:
00132     // Enumerator definitions
00133 
00141     enum ItemType {
00142         ItemType1   = 1,
00143         ImageFrame  = 2,
00144         ItemType3   = 3,
00145         TextFrame   = 4,
00146         Line        = 5,
00147         Polygon     = 6,
00148         PolyLine    = 7,
00149         PathText    = 8,
00150         LatexFrame  = 9,
00151         Multiple    = 99
00152     };
00153 
00158     enum TextFlowMode {
00159         TextFlowDisabled = 0,
00160         TextFlowUsesFrameShape  = 1,
00161         TextFlowUsesBoundingBox = 2,
00162         TextFlowUsesContourLine = 3,
00163         TextFlowUsesImageClipping = 4
00164     };
00165 
00166     /* these do essentially the same as a dynamic cast but might be more readable */
00167     virtual PageItem_ImageFrame * asImageFrame() { return NULL; }
00168     virtual PageItem_Line * asLine() { return NULL; }
00169     virtual PageItem_PathText * asPathText() { return NULL; }
00170     virtual PageItem_Polygon * asPolygon() { return NULL; }
00171     virtual PageItem_PolyLine * asPolyLine() { return NULL; }
00172     virtual PageItem_TextFrame * asTextFrame() { return NULL; }
00173     virtual PageItem_LatexFrame * asLatexFrame() { return NULL; }
00174 
00175 
00180     enum ItemFrameType {
00181         Unspecified =-1,
00182         Rectangle   = 0,
00183         Ellipse     = 1,
00184         Round       = 2,
00185         Other       = 3
00186     };
00187 
00188 
00189 protected:
00190     PageItem(const PageItem & other);
00191     
00192 public:
00193     PageItem(ScribusDoc *pa, ItemType newType, double x, double y, double w, double h, double w2, QString fill, QString outline);
00194     ~PageItem() {};
00195 
00196     static const Xml_string saxxDefaultElem;
00197     static void  desaxeRules(const Xml_string& prefixPattern, desaxe::Digester& ruleset, Xml_string elemtag = saxxDefaultElem);
00198     
00199     virtual void saxx(SaxHandler& handler, const Xml_string& elemtag) const;
00200     virtual void saxx(SaxHandler& handler)                     const { saxx(handler, saxxDefaultElem); }
00201     
00207     virtual void clearContents() {};
00208     
00213     void AdjustPictScale();
00214     
00218     QRect getRedrawBounding(const double);
00219     void setRedrawBounding();
00220             
00224     void updateGradientVectors();
00230     void moveImageInFrame(double newX, double newY);
00231 
00232     ObjAttrVector* getObjectAttributes();
00236     ObjectAttribute getObjectAttribute(QString) const;
00237     void setObjectAttributes(ObjAttrVector*);
00238     
00239     virtual bool createInfoGroup(QFrame *, QGridLayout *) {return false;}
00240     virtual bool createContextMenu(QMenu *, int step) {return false;}
00241     
00243     void paintObj(QPainter *p);
00244     void DrawObj(ScPainter *p, QRectF e);
00245     void DrawObj_Pre(ScPainter *p, double &sc);
00246     virtual void DrawObj_Post(ScPainter *p);
00247     virtual void DrawObj_Item(ScPainter *p, QRectF e, double sc) = 0;
00248     QImage DrawObj_toImage();
00249     QImage DrawObj_toImage(QList<PageItem*> &emG);
00250     
00251     virtual void applicableActions(QStringList& actionList) = 0;
00252     virtual QString infoDescription();
00253             
00254 protected:
00255     void DrawObj_ImageFrame(ScPainter *p, double sc);
00256     //void DrawObj_TextFrame(ScPainter *p, QRectF e, double sc);
00257     //void DrawObj_Line(ScPainter *p);
00258     void DrawObj_Polygon(ScPainter *p);
00259     void DrawObj_PolyLine(ScPainter *p);
00260     void DrawObj_PathText(ScPainter *p, double sc);
00261 public:
00262     void DrawObj_Embedded(ScPainter *p, QRectF e, const CharStyle& style, PageItem* cembedded);
00263     void SetFrameShape(int count, double *vals);
00264     void SetRectFrame();
00265     void SetOvalFrame();
00266     void SetFrameRound();
00267     void setPolyClip(int up, int down = 0);
00268     void updatePolyClip();
00269     void updateClip();
00270     void convertClip();
00271     //QRect getRedrawBounding(const double);
00272     //void setRedrawBounding();
00273     void getBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
00274     QRectF getBoundingRect() const;
00275     void getTransform(QMatrix& mat) const;
00276     QMatrix getTransform() const;
00284     bool pointWithinItem(const int x, const int y) const;
00293     bool mouseWithinItem(const int x, const int y, double scale) const;
00294     void copyToCopyPasteBuffer(struct CopyPasteBuffer *Buffer);
00295     
00296     virtual void handleModeEditKey(QKeyEvent *k, bool &keyRepeat);
00297     
00299     virtual void invalidateLayout() { invalid = true; }
00301     virtual void layout() {}
00303     bool frameOverflows() const;
00305     int firstInFrame() const;
00307     int lastInFrame() const;
00309     bool frameDisplays(int textpos) const;
00311     const ParagraphStyle& currentStyle() const;
00313     ParagraphStyle& changeCurrentStyle();
00315     const CharStyle& currentCharStyle() const;
00316     // deprecated:
00317     double layoutGlyphs(const CharStyle& style, const QString chars, GlyphLayout& layout);
00318     void SetQColor(QColor *tmp, QString farbe, double shad);
00319     void drawGlyphs(ScPainter *p, const CharStyle& style, GlyphLayout& glyphs );
00320     void DrawPolyL(QPainter *p, QPolygon pts);
00321     QString ExpandToken(uint base);
00322     
00323     bool AutoName;  
00324     double gXpos;
00325     double gYpos;
00326     double gWidth;
00327     double gHeight;
00328     int GrType;
00329     double GrStartX;
00330     double GrStartY;
00331     double GrEndX;
00332     double GrEndY;
00333     int Cols;
00334     double ColGap;
00335     double gridOffset_;
00336     double gridValue_;
00337 
00339     Qt::PenStyle PLineArt;
00340     Qt::PenCapStyle PLineEnd;
00341     Qt::PenJoinStyle PLineJoin;
00342     QString NamedLStyle;
00344     QPolygon Clip;
00345     
00346     FPointArray PoLine;
00347     const FPointArray shape() const { return PoLine; }
00348     void setShape(FPointArray val) { PoLine = val; }
00349     
00350     FPointArray ContourLine;
00351     const FPointArray contour() const { return ContourLine; }
00352     void setContour(FPointArray val) { ContourLine = val; }
00353     
00354     FPointArray imageClip;
00355     QList<uint> Segments;
00356     ScImageEffectList effectsInUse;
00357     bool PoShow;
00358     double BaseOffs;
00359     int textPathType;
00360     bool textPathFlipped;
00361     bool flipPathText() const { return textPathFlipped; }
00362     void setFlipPathText(bool val) { textPathFlipped = val; }
00363     int pathTextType() const { return textPathType; }
00364     void setPathTextType(int val) { textPathType = val; }
00365     double pathTextBaseOffset() const { return BaseOffs; }
00366     void setPathTextBaseOffset(double val) { BaseOffs = val; }
00367     bool pathTextShowFrame() const { return PoShow; }
00368     void setPathTextShowFrame(bool val) { PoShow = val; }
00369     
00370     bool useEmbeddedImageProfile() const { return UseEmbedded; }
00371     void setUseEmbeddedImageProfile(bool val) { UseEmbedded = val; }
00372     QString embeddedImageProfile() const { return EmProfile; }
00373     void setEmbeddedImageProfile(QString val) { EmProfile = val; }
00374 
00375     
00376     bool ClipEdited;
00377     // Don't know exactly what this is, but it's not the same as itemType
00378     int FrameType;
00380     uint ItemNr;
00382     uint uniqueNr;
00384     bool Frame;
00386     int OwnPage;
00388     int oldOwnPage;
00389     int savedOwnPage;
00391     ScImage pixm;
00393     QString Pfile;
00394     QString Pfile2;
00395     QString Pfile3;
00396     QString externalFile() const { return Pfile; }
00397     void setExternalFile(QString val) { Pfile = val; }
00398     
00399     //FIXME: maybe these should go into annotation?
00400     QString fileIconPressed() const { return Pfile2; }
00401     void setFileIconPressed(QString val) { Pfile2 = val; }
00402     QString fileIconRollover() const { return Pfile3; }
00403     void setFileIconRollover(QString val) { Pfile3 = val; }
00404     
00405     QString IProfile;
00406     bool UseEmbedded;
00407     QString EmProfile;
00408     int IRender;
00409     // some accessor methods:
00410     int cmsRenderingIntent() const { return IRender; }
00411     void setCmsRenderingIntent(int val) { IRender = val; }
00412     QString cmsProfile() const { return IProfile; }
00413     void setCmsProfile(QString val) { IProfile = val; }
00414     
00416     bool PicAvail;
00417     int OrigW;
00418     int OrigH;
00420     double BBoxX;
00422     double BBoxH;
00424     double CurX;
00426     double CurY;
00428     int CPos;
00430     StoryText itemText;
00432     bool isBookmark;
00434     bool Dirty;
00436     bool invalid;
00438     bool HasSel;
00440     bool FrameOnly;
00441     bool isAutoText;
00442     PageItem* prevInChain() { return BackBox; }
00443     PageItem* nextInChain() { return NextBox; }
00444     const PageItem* prevInChain() const { return BackBox; }
00445     const PageItem* nextInChain() const { return NextBox; }
00446     void unlink();
00447     void link(PageItem* nextFrame);
00448     void dropLinks();
00449 
00450 protected:
00451     PageItem *BackBox;
00452     PageItem *NextBox;
00453     uint firstChar;
00454     uint MaxChars;
00455 public:
00456     bool inPdfArticle;
00457     bool isRaster;
00458     double OldB;
00459     double OldH;
00460     double OldB2;
00461     double OldH2;
00462     bool Sizing;
00463     bool toPixmap;
00464     int LayerNr;
00465     bool ScaleType;
00466     bool AspectRatio;
00467     QStack<int> Groups;
00468     const QStack<int>& groups() const { return Groups; }
00469     QStack<int>& groups() { return Groups; }
00470     void setGroups( QStack<int> val) { Groups = val; }
00471     
00472     bool controlsGroup() const { return isGroupControl; }
00473     void setControlsGroup(bool val) { isGroupControl = val; }
00474     
00475     QList<double> DashValues;
00476     double DashOffset;
00477     const QList<double>& dashes() const { return DashValues; }
00478     QList<double>& dashes() { return DashValues; }
00479     void setDashes(QList<double> val) { DashValues = val; }
00480     double dashOffset() const { return DashOffset; }
00481     void setDashOffset(double val) { DashOffset = val; }
00482     VGradient fill_gradient;
00483     bool fillRule;
00484     bool doOverprint;
00485 /* Additions for Table Support */
00486     PageItem* LeftLink;
00487     PageItem* RightLink;
00488     PageItem* TopLink;
00489     PageItem* BottomLink;
00490     int LeftLinkID;
00491     int RightLinkID;
00492     int TopLinkID;
00493     int BottomLinkID;
00494     bool LeftLine;
00495     bool RightLine;
00496     bool TopLine;
00497     bool BottomLine;
00498     bool isTableItem;
00499     void setIsTableItem(bool val) { isTableItem = val; }
00500     void setHasLeftLine(bool val) { LeftLine = val; }
00501     void setHasRightLine(bool val) { RightLine = val; }
00502     void setHasTopLine(bool val) { TopLine = val; }
00503     void setHasBottomLine(bool val) { BottomLine = val; }
00504     void setLeftLink(PageItem* lnk) { LeftLink = lnk; }
00505     void setRightLink(PageItem* lnk) { RightLink = lnk; }
00506     void setTopLink(PageItem* lnk) { TopLink = lnk; }
00507     void setBottomLink(PageItem* lnk) { BottomLink = lnk; }
00508     bool isSingleSel;
00509     bool isGroupControl;
00510     PageItem *groupsLastItem;
00511     void setGroupsLastItem(PageItem* lnk) { groupsLastItem = lnk; }
00512     double BoundingX;
00513     double BoundingY;
00514     double BoundingW;
00515     double BoundingH;
00516     bool ChangedMasterItem;
00517     QString OnMasterPage;
00518     bool isEmbedded;
00519     
00520     //Position
00521     double xPos() const { return Xpos; }
00522     double yPos() const { return Ypos; }
00523     FPoint xyPos() const { return FPoint(Xpos, Ypos); }
00524     void setXPos(const double, bool drawingOnly=false);
00525     void setYPos(const double, bool drawingOnly=false);
00526     void setXYPos(const double, const double, bool drawingOnly=false);
00527     void moveBy(const double, const double, bool drawingOnly=false);
00528     //Size
00529     double width() const { return Width; }
00530     double height() const { return Height; }
00531     void setWidth(const double);
00532     void setHeight(const double);
00533     void setWidthHeight(const double, const double, bool drawingOnly);
00534     void setWidthHeight(const double, const double);
00535     void resizeBy(const double, const double);
00536     //Rotation
00537     double rotation() const { return Rot; }
00538     void setRotation(const double, bool drawingOnly);
00539     void setRotation(const double r) { setRotation(r, false); }  // needed for deSaXe
00540     void rotateBy(const double);
00541     //Selection
00542     bool isSelected() const { return Select; }
00543     void setSelected(const bool);
00544     //Image Data
00545     double imageXScale() const { return LocalScX; }
00546     double imageYScale() const { return LocalScY; }
00547     void setImageXScale(const double);
00548     void setImageYScale(const double);
00549     void setImageXYScale(const double, const double);
00550     double imageXOffset() const { return LocalX; }
00551     double imageYOffset() const { return LocalY; }
00552     void setImageXOffset(const double);
00553     void setImageYOffset(const double);
00554     void moveImageXYOffsetBy(const double, const double);
00555     void setImageXYOffset(const double, const double);
00556     //Reverse
00557     bool reversed() const { return Reverse; }
00558     void setReversed(bool);
00559     //Rounded Corners
00560     double cornerRadius() const { return RadRect; }
00561     void setCornerRadius(double);
00562     // PDF bookmark
00563     bool isPDFBookmark() const { return isBookmark; }
00564     void setIsPDFBookmark(bool val) { isBookmark = val; }
00565     // 0=none, 1,2,3,4=linear, 5=radial, 6=free linear, 7=free radial, 8=pattern 
00566     int gradientType() const { return GrType; }
00567     void setGradientType(int val) { GrType = val; }
00568     void gradientVector(double& startX, double& startY, double& endX, double& endY) const;
00569     void setGradientVector(double startX, double startY, double endX, double endY);
00570     // 
00571     bool fillEvenOdd() const { return fillRule; }
00572     void setFillEvenOdd(bool val) { fillRule = val; }
00573     //
00574     bool overprint() const { return doOverprint; }
00575     void setOverprint(bool val) { doOverprint = val; }
00576     // rect / oval / round / other
00577     int frameType() const { return FrameType; }
00578     void setFrameType(int val) { FrameType = val; }
00579     //
00580     bool hasDefaultShape() const { return !ClipEdited; }
00581     void setHasDefaultShape(bool val) { ClipEdited = !val; }
00582     //
00583     bool isAutoFrame() const { return isAutoText; }
00584     void setIsAutoFrame(bool val) { isAutoText = val; }
00585     //
00586     bool keepAspectRatio() const { return AspectRatio; }
00587     void setKeepAspectRatio(bool val) { AspectRatio = val; }
00588     //
00589     bool fitImageToFrame() const { return !ScaleType; }
00590     void setFitImageToFrame(bool val) { ScaleType = !val; }
00591     
00592     //Text Data - Move to PageItem_TextFrame at some point? --- no, to FrameStyle, av
00593     double textToFrameDistLeft() const { return Extra; }
00594     double textToFrameDistRight() const { return RExtra; }
00595     double textToFrameDistTop() const { return TExtra; }
00596     double textToFrameDistBottom() const { return BExtra; }
00597     int columns() const { return Cols; }
00598     double columnGap() const { return ColGap; }
00599     double gridOffset() const;
00600     double gridDistance() const;
00601     void setTextToFrameDistLeft(double);
00602     void setTextToFrameDistRight(double);
00603     void setTextToFrameDistTop(double);
00604     void setTextToFrameDistBottom(double);
00605     void setColumns(int);
00606     void setColumnGap(double);
00607     void setGridOffset(double);
00608     void setGridDistance(double);
00616     void setTextToFrameDist(double newLeft, double newRight, double newTop, double newBottom);
00617 
00624     QString itemName() const { return AnName; }
00633     void setItemName(const QString& newName);
00634 
00636     QString pattern() const { return patternVal; }
00637 
00639     void patternTransform(double &scaleX, double &scaleY, double &offsetX, double &offsetY, double &rotation) const;
00640 
00645     void setPattern(const QString &newPattern);
00646     
00651     void setPatternTransform(double scaleX, double scaleY, double offsetX, double offsetY, double rotation);
00652 
00654     QString fillColor() const { return fillColorVal; }
00659     void setFillColor(const QString &newColor);
00660 
00662     double fillShade() const { return fillShadeVal; }
00667     void setFillShade(double newShade);
00668 
00670     double fillTransparency() const { return fillTransparencyVal; }
00675     void setFillTransparency(double newTransparency);
00676 
00678     int fillBlendmode() const { return fillBlendmodeVal; }
00683     void setFillBlendmode(int newBlendmode);
00684 
00686     int lineBlendmode() const { return lineBlendmodeVal; }
00691     void setLineBlendmode(int newBlendmode);
00692 
00694     QString lineColor() const { return lineColorVal; }
00699     void setLineColor(const QString &newColor);
00700 
00702     double lineShade() const { return lineShadeVal; }
00707     void setLineShade(double newShade);
00708 
00710     double lineTransparency() const { return lineTransparencyVal; }
00715     void setLineTransparency(double newTransparency);
00716 
00718     void setLineQColor();
00720     void setFillQColor();
00721 
00723     Qt::PenStyle lineStyle() const { return PLineArt; }
00729     void setLineStyle(Qt::PenStyle newStyle);
00730 
00732     double lineWidth() const { return m_lineWidth; }
00737     void setLineWidth(double newWidth);
00738 
00740     Qt::PenCapStyle lineEnd() const { return PLineEnd; }
00746     void setLineEnd(Qt::PenCapStyle newStyle);
00747 
00749     Qt::PenJoinStyle lineJoin() const { return PLineJoin; }
00755     void setLineJoin(Qt::PenJoinStyle newStyle);
00756 
00758     QString customLineStyle() const { return NamedLStyle; }
00763     void setCustomLineStyle(const QString& newStyle);
00764 
00768     int startArrowIndex() const { return m_startArrowIndex; }
00773     void setStartArrowIndex(int newIndex);
00774 
00778     int endArrowIndex() const { return m_endArrowIndex; }
00783     void setEndArrowIndex(int newIndex);
00784 
00786     bool imageFlippedH() const { return m_ImageIsFlippedH; }
00788     void setImageFlippedH(bool flipped);
00790     void flipImageH();
00791 
00793     bool imageFlippedV() const { return m_ImageIsFlippedV; }
00795     void setImageFlippedV(bool flipped);
00797     void flipImageV();
00798 
00804     void setImageScalingMode(bool freeScale, bool keepRatio);
00805 
00807     void toggleLock();
00809     bool locked() const { return m_Locked; }
00811     void setLocked(bool isLocked);
00812 
00814     void toggleSizeLock();
00816     bool sizeLocked() const { return m_SizeLocked; }
00818     void setSizeLocked(bool isLocked);
00819 
00824     TextFlowMode textFlowMode() const { return textFlowModeVal; }
00825 
00831     void setTextFlowMode(TextFlowMode mode);
00832 
00837     bool textFlowAroundObject() const { return (textFlowModeVal != TextFlowDisabled); }
00838 
00843     bool textFlowUsesFrameShape() const { return (textFlowModeVal == TextFlowUsesFrameShape); }
00844 
00849     bool textFlowUsesBoundingBox() const { return (textFlowModeVal == TextFlowUsesBoundingBox); }
00850 
00855     bool textFlowUsesContourLine() const { return (textFlowModeVal == TextFlowUsesContourLine); }
00856 
00861     bool textFlowUsesImageClipping() const { return (textFlowModeVal == TextFlowUsesImageClipping); }
00862 
00870     ItemType itemType() const { return m_ItemType; }
00878     virtual ItemType realItemType() const { return m_ItemType; }
00883     void convertTo(ItemType newType);
00884 
00889     void setLayer(int layerId);
00890 
00897     void checkChanges(bool force = false);
00904     void moveUndoAction();
00905     void resizeUndoAction();
00906     void rotateUndoAction();
00907     void changeImageOffsetUndoAction();
00908     void changeImageScaleUndoAction();
00911     void restore(UndoState *state, bool isUndo);
00912 
00913     void getNamedResources(ResourceCollection& lists) const;
00914     void replaceNamedResources(ResourceCollection& newNames);
00915 
00924     QString generateUniqueCopyName(const QString originalName) const;
00929     bool printEnabled() const { return m_PrintEnabled; }
00934     void setPrintEnabled(bool toPrint);
00935     
00939     void togglePrintEnabled();
00940     
00945     bool isTagged() const { return tagged; }
00950     void setTagged(bool);
00951 
00956     bool loadImage(const QString& filename, const bool reload, const int gsResolution=-1, bool showMsg = false);
00957     
00958     
00963     bool connectToGUI();
00964     bool disconnectFromGUI();
00968     void emitAllToGUI();
00969     
00973     ScribusDoc* doc() const { return m_Doc; }
00974     
00975     bool isAnnotation() const { return m_isAnnotation; }
00976     void setIsAnnotation(bool);
00977     void setAnnotation(const Annotation& ad);
00978     Annotation& annotation() { return m_annotation; }
00979     const Annotation& annotation() const { return m_annotation; }
00980     
00981     bool imageShown() const { return PicArt; }
00982     void setImageShown(bool);
00983     
00984     void updateConstants();
00985     
00986 protected:
00987 
00988     void drawLockedMarker(ScPainter *p);
00989     
00991     UndoManager * const undoManager;
00998     void restoreMove(SimpleState *state, bool isUndo);
00999     void restoreResize(SimpleState *state, bool isUndo);
01000     void restoreRotate(SimpleState *state, bool isUndo);
01001     void restoreFill(SimpleState *state, bool isUndo);
01002     void restoreShade(SimpleState *state, bool isUndo);
01003     void restoreLineColor(SimpleState *state, bool isUndo);
01004     void restoreLineShade(SimpleState *state, bool isUndo);
01005     void restoreName(SimpleState *state, bool isUndo);
01006     void restoreFillTP(SimpleState *state, bool isUndo);
01007     void restoreLineTP(SimpleState *state, bool isUndo);
01008     void restoreLineStyle(SimpleState *state, bool isUndo);
01009     void restoreLineEnd(SimpleState *state, bool isUndo);
01010     void restoreLineJoin(SimpleState *state, bool isUndo);
01011     void restoreLineWidth(SimpleState *state, bool isUndo);
01012     void restoreCustomLineStyle(SimpleState *state, bool isUndo);
01013     void restoreArrow(SimpleState *state, bool isUndo, bool isStart);
01014 
01015     void restorePStyle(SimpleState *state, bool isUndo);
01016 
01017     void restoreType(SimpleState *state, bool isUndo);
01018     void restoreTextFlowing(SimpleState *state, bool isUndo);
01019     void restoreImageScaleType(SimpleState *state, bool isUndo);
01020     void restoreImageScaleChange(SimpleState *state, bool isUndo);
01021     void restoreImageOffsetChange(SimpleState *state, bool isUndo);
01022     void restorePoly(SimpleState *state, bool isUndo, bool isContour);
01023     void restoreContourLine(SimpleState *state, bool isUndo);
01024     void restoreLayer(SimpleState *state, bool isUndo);
01025     void restoreGetImage(SimpleState *state, bool isUndo);
01026 
01027     void restoreShapeContour(UndoState *state, bool isUndo);
01028     void restoreImageEffects(UndoState *state, bool isUndo);
01040     bool shouldCheck();
01042     void select();
01043 
01044     // Protected members
01045 
01052     ItemType m_ItemType;
01053 
01059     QString AnName; 
01060 
01065     QString patternVal;
01069     double patternScaleX;
01070     double patternScaleY;
01071     double patternOffsetX;
01072     double patternOffsetY;
01073     double patternRotation;
01074 
01079     QString fillColorVal;
01080 
01085     QString lineColorVal;
01086 
01091     double lineShadeVal;
01092 
01097     double fillShadeVal;
01098 
01103     double fillTransparencyVal;
01104 
01109     double lineTransparencyVal;
01110 
01115     int fillBlendmodeVal;
01116 
01121     int lineBlendmodeVal;
01122 
01128     bool m_ImageIsFlippedH;
01129 
01135     bool m_ImageIsFlippedV;
01136 
01141     bool m_Locked;
01142 
01147     bool m_SizeLocked;
01148 
01153     TextFlowMode textFlowModeVal;
01154 
01159     ObjAttrVector pageItemAttributes;
01160 
01165     bool m_PrintEnabled;
01166     
01171     bool tagged;
01172     
01173     QColor fillQColor;
01174     QColor strokeQColor;
01175     
01177     double Xpos;
01179     double Ypos;
01181     double Width;
01183     double Height;
01185     double Rot;
01187     bool Select;
01189     double LocalScX;
01191     double LocalScY;
01193     double LocalX;
01195     double LocalY;
01197     bool Reverse;
01198 
01199     int m_startArrowIndex;
01200     int m_endArrowIndex;
01201 
01202 protected:
01204     double Extra;
01205     double TExtra;
01206     double BExtra;
01207     double RExtra;
01208     
01209 public:
01211     double RadRect;
01212     
01213     //Undo Data
01215     double oldXpos;
01217     double oldYpos;
01219     double oldWidth;
01221     double oldHeight;
01223     double oldRot;
01225     double oldLocalScX;
01227     double oldLocalScY;
01229     double oldLocalX;
01231     double oldLocalY;
01232     
01234     ScribusDoc *m_Doc;
01235     
01237     bool m_isAnnotation;
01238     Annotation m_annotation;
01239     
01241     bool PicArt;
01242     
01244     double m_lineWidth;
01245     double Oldm_lineWidth;
01246     
01247 signals:
01248     //Frame signals
01249     void myself(PageItem *);
01250     void frameType(int);   // not related to Frametype but to m_itemIype :-/
01251     void position(double, double); //X,Y
01252     void widthAndHeight(double, double); //W,H
01253     void rotation(double); //Degrees rotation   
01254     void colors(QString, QString, double, double); //lineColor, fillColor, lineShade, fillShade
01255     void gradientType(int); //Normal, horizontal, vertical, etc.
01256     void patternFill(QString, double, double, double, double, double);
01257     void gradientColorUpdate(double, double, double, double, double, double); //Cpal updatespecialgradient
01258     void transparency(double, double); //fillTransparency, lineTransparency
01259     void blendmode(int, int); //fillBlendmode, lineBlendmode
01260     void frameLocked(bool); //Frame lock
01261     void frameSizeLocked(bool); //Frame size lock
01262     void frameFlippedH(bool); //Frame flipped horizontally
01263     void frameFlippedV(bool); //Frame flipped vertically
01264     void printEnabled(bool); //Frame is set to print or not
01265     //Shape signals
01266     void columns(int, double); //Number, gap
01267     void cornerRadius(double); //Corner radius of the shape
01268     //Line signals
01269     void lineWidth(double);
01270     void lineStyleCapJoin(Qt::PenStyle, Qt::PenCapStyle, Qt::PenJoinStyle);
01271     //Frame text signals
01272     void lineSpacing(double);
01273     void textKerning(double);
01274