Back to index

scribus-ng  1.3.4.dfsg+svn20071115
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.h>
00028 #include <qwidget.h>
00029 #include <qpointarray.h>
00030 #include <qptrlist.h>
00031 #include <qpixmap.h>
00032 #include <qvaluestack.h>
00033 #include <qvaluelist.h>
00034 
00035 #include "scribusapi.h"
00036 #include "annotation.h"
00037 #include "pagestructs.h"
00038 #include "scimage.h"
00039 #include "sctextstruct.h"
00040 #include "undoobject.h"
00041 #include "vgradient.h"
00042 #include "text/nlsconfig.h"
00043 #include "text/storytext.h"
00044 #include "desaxe/saxio.h"
00045 
00046 class ScPainter;
00047 class ScribusDoc;
00048 class UndoManager;
00049 class UndoState;
00050 class ResourceCollection;
00051 
00052 class PageItem_ImageFrame;
00053 class PageItem_Line;
00054 class PageItem_Polygon;
00055 class PageItem_PolyLine;
00056 class PageItem_TextFrame;
00057 class PageItem_PathText;
00058 
00059 struct CopyPasteBuffer;
00064 class SCRIBUS_API PageItem : public QObject, public UndoObject, public SaxIO 
00065 {
00066        Q_OBJECT
00067 
00068        // Properties - see http://doc.trolltech.com/3.3/properties.html
00069        // See the accessors of these properties for details on their use.
00070        Q_PROPERTY(QString itemName READ itemName WRITE setItemName DESIGNABLE false)
00071        Q_PROPERTY(QString fillColor READ fillColor WRITE setFillColor DESIGNABLE false)
00072        Q_PROPERTY(QString lineColor READ lineColor WRITE setLineColor DESIGNABLE false)
00073        Q_PROPERTY(int fillShade READ fillShade WRITE setFillShade DESIGNABLE false)
00074        Q_PROPERTY(int lineShade READ lineShade WRITE setLineShade DESIGNABLE false)
00075        Q_PROPERTY(double fillTransparency READ fillTransparency WRITE setFillTransparency DESIGNABLE false)
00076        Q_PROPERTY(double lineTransparency READ lineTransparency WRITE setLineTransparency DESIGNABLE false)
00077        Q_PROPERTY(bool m_Locked READ locked WRITE setLocked DESIGNABLE false)
00078        Q_PROPERTY(bool m_SizeLocked READ sizeLocked WRITE setSizeLocked DESIGNABLE false)
00079        Q_PROPERTY(bool m_ImageIsFlippedV READ imageFlippedV WRITE setImageFlippedV DESIGNABLE false)
00080        Q_PROPERTY(bool m_ImageIsFlippedH READ imageFlippedH WRITE setImageFlippedH DESIGNABLE false)
00081        Q_PROPERTY(double lineWidth READ lineWidth WRITE setLineWidth DESIGNABLE false)
00082        Q_PROPERTY(QString customLineStyle READ customLineStyle WRITE setCustomLineStyle DESIGNABLE false)
00083        Q_PROPERTY(int startArrowIndex READ startArrowIndex WRITE setStartArrowIndex DESIGNABLE false)
00084        Q_PROPERTY(int endArrowIndex READ endArrowIndex WRITE setEndArrowIndex DESIGNABLE false)
00085 
00086        Q_PROPERTY(bool m_PrintEnabled READ printEnabled WRITE setPrintEnabled DESIGNABLE false)
00087        Q_PROPERTY(double xPos READ xPos WRITE setXPos DESIGNABLE false)
00088        Q_PROPERTY(double yPos READ yPos WRITE setYPos DESIGNABLE false)
00089        Q_PROPERTY(double width READ width WRITE setWidth DESIGNABLE false)
00090        Q_PROPERTY(double height READ height WRITE setHeight DESIGNABLE false)
00091        Q_PROPERTY(double rotation READ rotation WRITE setRotation DESIGNABLE false)
00092        Q_PROPERTY(double imageXScale READ imageXScale WRITE setImageXScale DESIGNABLE false)
00093        Q_PROPERTY(double imageYScale READ imageYScale WRITE setImageYScale DESIGNABLE false)
00094        Q_PROPERTY(double imageXOffset READ imageXOffset WRITE setImageXOffset DESIGNABLE false)
00095        Q_PROPERTY(double imageYOffset READ imageYOffset WRITE setImageYOffset DESIGNABLE false)
00096        Q_PROPERTY(bool reversed READ reversed WRITE setReversed DESIGNABLE false)
00097        Q_PROPERTY(double cornerRadius READ cornerRadius WRITE setCornerRadius DESIGNABLE false)
00098        Q_PROPERTY(double textToFrameDistLeft READ textToFrameDistLeft WRITE setTextToFrameDistLeft DESIGNABLE false)
00099        Q_PROPERTY(double textToFrameDistRight READ textToFrameDistRight WRITE setTextToFrameDistRight DESIGNABLE false)
00100        Q_PROPERTY(double textToFrameDistTop READ textToFrameDistTop WRITE setTextToFrameDistTop DESIGNABLE false)
00101        Q_PROPERTY(double textToFrameDistBottom READ textToFrameDistBottom WRITE setTextToFrameDistBottom DESIGNABLE false)
00102        Q_PROPERTY(double ColGap READ columnGap WRITE setColumnGap DESIGNABLE false)
00103        Q_PROPERTY(int Cols READ columns WRITE setColumns DESIGNABLE false)
00104        // FIXME: QMetaProperty can't translate these to/from enumerator names, probably because the
00105        // properties aren't moc'd in the Qt sources. They work fine in their
00106        // current state as plain integer properties.
00107 //     Q_ENUMS(PenStyle)
00108 //     Q_PROPERTY(PenStyle lineStyle READ lineStyle WRITE setLineStyle DESIGNABLE false)
00109 //     Q_ENUMS(PenCapStyle)
00110 //     Q_PROPERTY(PenCapStyle lineEnd READ lineEnd WRITE setLineEnd DESIGNABLE false)
00111 //     Q_ENUMS(PenJoinStyle)
00112 //     Q_PROPERTY(PenJoinStyle lineJoin READ lineJoin WRITE setLineJoin DESIGNABLE false)
00113 
00114        // This property may not hang around for too long, but should be useful
00115        // when testing out the pageitem refactoring work.  Setting it is unlikely
00116        // to currently have the desired effect.
00121        Q_ENUMS(ItemType)
00122        Q_PROPERTY(ItemType itemType READ itemType WRITE convertTo DESIGNABLE false)
00123 
00124 public:
00125        // Enumerator definitions
00126 
00134        enum ItemType {
00135               ItemType1     = 1,
00136               ImageFrame    = 2,
00137               ItemType3     = 3,
00138               TextFrame     = 4,
00139               Line          = 5,
00140               Polygon              = 6,
00141               PolyLine      = 7,
00142               PathText      = 8,
00143               Multiple      = 99
00144        };
00145 
00150        enum TextFlowMode {
00151               TextFlowDisabled = 0,
00152               TextFlowUsesFrameShape  = 1,
00153               TextFlowUsesBoundingBox = 2,
00154               TextFlowUsesContourLine = 3,
00155               TextFlowUsesImageClipping = 4
00156        };
00157 
00158        /* these do essentially the same as a dynamic cast but might be more readable */
00159        virtual PageItem_ImageFrame * asImageFrame() { return NULL; }
00160        virtual PageItem_Line * asLine() { return NULL; }
00161        virtual PageItem_PathText * asPathText() { return NULL; }
00162        virtual PageItem_Polygon * asPolygon() { return NULL; }
00163        virtual PageItem_PolyLine * asPolyLine() { return NULL; }
00164        virtual PageItem_TextFrame * asTextFrame() { return NULL; }
00165 
00166 
00171        enum ItemFrameType {
00172               Unspecified =-1,
00173               Rectangle     = 0,
00174               Ellipse              = 1,
00175               Round         = 2,
00176               Other         = 3
00177        };
00178 
00179 
00180 protected:
00181        PageItem(const PageItem & other);
00182        
00183 public:
00184        PageItem(ScribusDoc *pa, ItemType newType, double x, double y, double w, double h, double w2, QString fill, QString outline);
00185        ~PageItem() {};
00186 
00187        static const Xml_string saxxDefaultElem;
00188        static void  desaxeRules(const Xml_string& prefixPattern, desaxe::Digester& ruleset, Xml_string elemtag = saxxDefaultElem);
00189        
00190        virtual void saxx(SaxHandler& handler, const Xml_string& elemtag) const;
00191        virtual void saxx(SaxHandler& handler)                     const { saxx(handler, saxxDefaultElem); }
00192        
00198        virtual void clearContents() {};
00199        
00204        void AdjustPictScale();
00205        
00209        QRect getRedrawBounding(const double);
00210        void setRedrawBounding();
00211                      
00215        void updateGradientVectors();
00221        void moveImageInFrame(double newX, double newY);
00222 
00223        ObjAttrVector* getObjectAttributes();
00227        ObjectAttribute getObjectAttribute(QString) const;
00228        void setObjectAttributes(ObjAttrVector*);
00230        void paintObj(QRect e=QRect(), QPixmap *ppX = 0);
00231        void DrawObj(ScPainter *p, QRect e);
00232        void DrawObj_Pre(ScPainter *p, double &sc);
00233        virtual void DrawObj_Post(ScPainter *p);
00234        virtual void DrawObj_Item(ScPainter *p, QRect e, double sc) = 0;
00235        QImage DrawObj_toImage();
00236        QImage DrawObj_toImage(QPtrList<PageItem> &emG);
00237 protected:
00238        void DrawObj_ImageFrame(ScPainter *p, double sc);
00239        //void DrawObj_TextFrame(ScPainter *p, QRect e, double sc);
00240        //void DrawObj_Line(ScPainter *p);
00241        void DrawObj_Polygon(ScPainter *p);
00242        void DrawObj_PolyLine(ScPainter *p);
00243        void DrawObj_PathText(ScPainter *p, double sc);
00244 public:
00245        void DrawObj_Embedded(ScPainter *p, QRect e, const CharStyle& style, PageItem* cembedded);
00246        void SetFrameShape(int count, double *vals);
00247        void SetRectFrame();
00248        void SetOvalFrame();
00249        void SetFrameRound();
00250        void setPolyClip(int up, int down = 0);
00251        void updatePolyClip();
00252        void updateClip();
00253        void convertClip();
00254        //QRect getRedrawBounding(const double);
00255        //void setRedrawBounding();
00256        void getBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
00264        bool pointWithinItem(const int x, const int y) const;
00274        bool mouseWithinItem(QWidget* vport, const int x, const int y, double scale) const;
00275        void copyToCopyPasteBuffer(struct CopyPasteBuffer *Buffer);
00276        
00277        virtual void handleModeEditKey(QKeyEvent *k, bool &keyRepeat);
00278        
00280        virtual void layout() {}
00282        bool frameOverflows() const;
00284        int firstInFrame() const;
00286        int lastInFrame() const;
00288        bool frameDisplays(int textpos) const;
00290        const ParagraphStyle& currentStyle() const;
00292        ParagraphStyle& changeCurrentStyle();
00294        const CharStyle& currentCharStyle() const;
00295        // deprecated:
00296        double layoutGlyphs(const CharStyle& style, const QString chars, GlyphLayout& layout);
00297        void SetFarbe(QColor *tmp, QString farbe, int shad);
00298        void drawGlyphs(ScPainter *p, const CharStyle& style, GlyphLayout& glyphs );
00299        void DrawPolyL(QPainter *p, QPointArray pts);
00300        QString ExpandToken(uint base);
00301        
00302        bool AutoName;       
00303        double gXpos;
00304        double gYpos;
00305        double gWidth;
00306        double gHeight;
00307        int GrType;
00308        double GrStartX;
00309        double GrStartY;
00310        double GrEndX;
00311        double GrEndY;
00312        int Cols;
00313        double ColGap;
00314        double gridOffset_;
00315        double gridValue_;
00316 
00318        Qt::PenStyle PLineArt;
00319        Qt::PenCapStyle PLineEnd;
00320        Qt::PenJoinStyle PLineJoin;
00321        QString NamedLStyle;
00323        QPointArray Clip;
00324        
00325        FPointArray PoLine;
00326        const FPointArray shape() const { return PoLine; }
00327        void setShape(FPointArray val) { PoLine = val; }
00328        
00329        FPointArray ContourLine;
00330        const FPointArray contour() const { return ContourLine; }
00331        void setContour(FPointArray val) { ContourLine = val; }
00332        
00333        FPointArray imageClip;
00334        QValueList<uint> Segments;
00335        ScImageEffectList effectsInUse;
00336        bool PoShow;
00337        double BaseOffs;
00338        int textPathType;
00339        bool textPathFlipped;
00340        bool flipPathText() const { return textPathFlipped; }
00341        void setFlipPathText(bool val) { textPathFlipped = val; }
00342        int pathTextType() const { return textPathType; }
00343        void setPathTextType(int val) { textPathType = val; }
00344        double pathTextBaseOffset() const { return BaseOffs; }
00345        void setPathTextBaseOffset(double val) { BaseOffs = val; }
00346        bool pathTextShowFrame() const { return PoShow; }
00347        void setPathTextShowFrame(bool val) { PoShow = val; }
00348        
00349        bool useEmbeddedImageProfile() const { return UseEmbedded; }
00350        void setUseEmbeddedImageProfile(bool val) { UseEmbedded = val; }
00351        QString embeddedImageProfile() const { return EmProfile; }
00352        void setEmbeddedImageProfile(QString val) { EmProfile = val; }
00353 
00354        
00355        bool ClipEdited;
00356        // Don't know exactly what this is, but it's not the same as itemType
00357        int FrameType;
00359        uint ItemNr;
00361        uint uniqueNr;
00363        bool Frame;
00365        int OwnPage;
00367        int oldOwnPage;
00368        int savedOwnPage;
00370        ScImage pixm;
00372        QString Pfile;
00373        QString Pfile2;
00374        QString Pfile3;
00375        QString externalFile() const { return Pfile; }
00376        void setExternalFile(QString val) { Pfile = val; }
00377        
00378        //FIXME: maybe these should go into annotation?
00379        QString fileIconPressed() const { return Pfile2; }
00380        void setFileIconPressed(QString val) { Pfile2 = val; }
00381        QString fileIconRollover() const { return Pfile3; }
00382        void setFileIconRollover(QString val) { Pfile3 = val; }
00383        
00384        QString IProfile;
00385        bool UseEmbedded;
00386        QString EmProfile;
00387        int IRender;
00388        // some accessor methods:
00389        int cmsRenderingIntent() const { return IRender; }
00390        void setCmsRenderingIntent(int val) { IRender = val; }
00391        QString cmsProfile() const { return IProfile; }
00392        void setCmsProfile(QString val) { IProfile = val; }
00393        
00395        bool PicAvail;
00396        int OrigW;
00397        int OrigH;
00399        double BBoxX;
00401        double BBoxH;
00403        double CurX;
00405        double CurY;
00407        int CPos;
00409        StoryText itemText;
00411        bool isBookmark;
00413        bool Dirty;
00415        bool invalid;
00417        bool HasSel;
00419        bool FrameOnly;
00420        bool isAutoText;
00421        PageItem* prevInChain() { return BackBox; }
00422        PageItem* nextInChain() { return NextBox; }
00423        const PageItem* prevInChain() const { return BackBox; }
00424        const PageItem* nextInChain() const { return NextBox; }
00425        void unlink();
00426        void link(PageItem* nextFrame);
00427        void dropLinks();
00428 
00429 protected:
00430        PageItem *BackBox;
00431        PageItem *NextBox;
00432        uint firstChar;
00433        uint MaxChars;
00434 public:
00435        bool inPdfArticle;
00436        bool isRaster;
00437        double OldB;
00438        double OldH;
00439        double OldB2;
00440        double OldH2;
00441        bool Sizing;
00442        bool toPixmap;
00443        int LayerNr;
00444        bool ScaleType;
00445        bool AspectRatio;
00446        QValueStack<int> Groups;
00447        const QValueStack<int>& groups() const { return Groups; }
00448        QValueStack<int>& groups() { return Groups; }
00449        void setGroups( QValueStack<int> val) { Groups = val; }
00450        
00451        bool controlsGroup() const { return isGroupControl; }
00452        void setControlsGroup(bool val) { isGroupControl = val; }
00453        
00454        QValueList<double> DashValues;
00455        double DashOffset;
00456        const QValueList<double>& dashes() const { return DashValues; }
00457        QValueList<double>& dashes() { return DashValues; }
00458        void setDashes(QValueList<double> val) { DashValues = val; }
00459        double dashOffset() const { return DashOffset; }
00460        void setDashOffset(double val) { DashOffset = val; }
00461        VGradient fill_gradient;
00462        bool fillRule;
00463        bool doOverprint;
00464 /* Additions for Table Support */
00465        PageItem* LeftLink;
00466        PageItem* RightLink;
00467        PageItem* TopLink;
00468        PageItem* BottomLink;
00469        int LeftLinkID;
00470        int RightLinkID;
00471        int TopLinkID;
00472        int BottomLinkID;
00473        bool LeftLine;
00474        bool RightLine;
00475        bool TopLine;
00476        bool BottomLine;
00477        bool isTableItem;
00478        void setIsTableItem(bool val) { isTableItem = val; }
00479        void setHasLeftLine(bool val) { LeftLine = val; }
00480        void setHasRightLine(bool val) { RightLine = val; }
00481        void setHasTopLine(bool val) { TopLine = val; }
00482        void setHasBottomLine(bool val) { BottomLine = val; }
00483        void setLeftLink(PageItem* lnk) { LeftLink = lnk; }
00484        void setRightLink(PageItem* lnk) { RightLink = lnk; }
00485        void setTopLink(PageItem* lnk) { TopLink = lnk; }
00486        void setBottomLink(PageItem* lnk) { BottomLink = lnk; }
00487        bool isSingleSel;
00488        bool isGroupControl;
00489        PageItem *groupsLastItem;
00490        void setGroupsLastItem(PageItem* lnk) { groupsLastItem = lnk; }
00491        double BoundingX;
00492        double BoundingY;
00493        double BoundingW;
00494        double BoundingH;
00495        bool ChangedMasterItem;
00496        QString OnMasterPage;
00497        bool isEmbedded;
00498        
00499        //Position
00500        double xPos() const { return Xpos; }
00501        double yPos() const { return Ypos; }
00502        FPoint xyPos() const { return FPoint(Xpos, Ypos); }
00503        void setXPos(const double, bool drawingOnly=false);
00504        void setYPos(const double, bool drawingOnly=false);
00505        void setXYPos(const double, const double, bool drawingOnly=false);
00506        void moveBy(const double, const double, bool drawingOnly=false);
00507        //Size
00508        double width() const { return Width; }
00509        double height() const { return Height; }
00510        void setWidth(const double);
00511        void setHeight(const double);
00512        void setWidthHeight(const double, const double, bool drawingOnly);
00513        void setWidthHeight(const double, const double);
00514        void resizeBy(const double, const double);
00515        //Rotation
00516        double rotation() const { return Rot; }
00517        void setRotation(const double, bool drawingOnly);
00518        void setRotation(const double r) { setRotation(r, false); }  // needed for deSaXe
00519        void rotateBy(const double);
00520        //Selection
00521        bool isSelected() const { return Select; }
00522        void setSelected(const bool);
00523        //Image Data
00524        double imageXScale() const { return LocalScX; }
00525        double imageYScale() const { return LocalScY; }
00526        void setImageXScale(const double);
00527        void setImageYScale(const double);
00528        void setImageXYScale(const double, const double);
00529        double imageXOffset() const { return LocalX; }
00530        double imageYOffset() const { return LocalY; }
00531        void setImageXOffset(const double);
00532        void setImageYOffset(const double);
00533        void moveImageXYOffsetBy(const double, const double);
00534        void setImageXYOffset(const double, const double);
00535        //Reverse
00536        bool reversed() const { return Reverse; }
00537        void setReversed(bool);
00538        //Rounded Corners
00539        double cornerRadius() const { return RadRect; }
00540        void setCornerRadius(double);
00541        // PDF bookmark
00542        bool isPDFBookmark() const { return isBookmark; }
00543        void setIsPDFBookmark(bool val) { isBookmark = val; }
00544        // 0=none, 1,2,3,4=linear, 5=radial, 6=free linear, 7=free radial, 8=pattern 
00545        int gradientType() const { return GrType; }
00546        void setGradientType(int val) { GrType = val; }
00547        // 
00548        bool fillEvenOdd() const { return fillRule; }
00549        void setFillEvenOdd(bool val) { fillRule = val; }
00550        //
00551        bool overprint() const { return doOverprint; }
00552        void setOverprint(bool val) { doOverprint = val; }
00553        // rect / oval / round / other
00554        int frameType() const { return FrameType; }
00555        void setFrameType(int val) { FrameType = val; }
00556        //
00557        bool hasDefaultShape() const { return !ClipEdited; }
00558        void setHasDefaultShape(bool val) { ClipEdited = !val; }
00559        //
00560        bool isAutoFrame() const { return isAutoText; }
00561        void setIsAutoFrame(bool val) { isAutoText = val; }
00562        //
00563        bool keepAspectRatio() const { return AspectRatio; }
00564        void setKeepAspectRatio(bool val) { AspectRatio = val; }
00565        //
00566        bool fitImageToFrame() const { return ScaleType; }
00567        void setFitImageToFrame(bool val) { ScaleType = val; }
00568        
00569        //Text Data - Move to PageItem_TextFrame at some point? --- no, to FrameStyle, av
00570        double textToFrameDistLeft() const { return Extra; }
00571        double textToFrameDistRight() const { return RExtra; }
00572        double textToFrameDistTop() const { return TExtra; }
00573        double textToFrameDistBottom() const { return BExtra; }
00574        int columns() const { return Cols; }
00575        double columnGap() const { return ColGap; }
00576        double gridOffset() const;
00577        double gridDistance() const;
00578        void setTextToFrameDistLeft(double);
00579        void setTextToFrameDistRight(double);
00580        void setTextToFrameDistTop(double);
00581        void setTextToFrameDistBottom(double);
00582        void setColumns(int);
00583        void setColumnGap(double);
00584        void setGridOffset(double);
00585        void setGridDistance(double);
00593        void setTextToFrameDist(double newLeft, double newRight, double newTop, double newBottom);
00594 
00601        QString itemName() const { return AnName; }
00610        void setItemName(const QString& newName);
00611 
00613        QString pattern() const { return patternVal; }
00614 
00616        void patternTransform(double &scaleX, double &scaleY, double &offsetX, double &offsetY, double &rotation) const;
00617 
00622        void setPattern(const QString &newPattern);
00623        
00628        void setPatternTransform(double scaleX, double scaleY, double offsetX, double offsetY, double rotation);
00629 
00631        QString fillColor() const { return fillColorVal; }
00636        void setFillColor(const QString &newColor);
00637 
00639        int fillShade() const { return fillShadeVal; }
00644        void setFillShade(int newShade);
00645 
00647        double fillTransparency() const { return fillTransparencyVal; }
00652        void setFillTransparency(double newTransparency);
00653 
00655        int fillBlendmode() const { return fillBlendmodeVal; }
00660        void setFillBlendmode(int newBlendmode);
00661 
00663        int lineBlendmode() const { return lineBlendmodeVal; }
00668        void setLineBlendmode(int newBlendmode);
00669 
00671        QString lineColor() const { return lineColorVal; }
00676        void setLineColor(const QString &newColor);
00677 
00679        int lineShade() const { return lineShadeVal; }
00684        void setLineShade(int newShade);
00685 
00687        double lineTransparency() const { return lineTransparencyVal; }
00692        void setLineTransparency(double newTransparency);
00693 
00695        void setLineQColor();
00697        void setFillQColor();
00698 
00700        Qt::PenStyle lineStyle() const { return PLineArt; }
00706        void setLineStyle(Qt::PenStyle newStyle);
00707 
00709        double lineWidth() const { return m_lineWidth; }
00714        void setLineWidth(double newWidth);
00715 
00717        Qt::PenCapStyle lineEnd() const { return PLineEnd; }
00723        void setLineEnd(Qt::PenCapStyle newStyle);
00724 
00726        Qt::PenJoinStyle lineJoin() const { return PLineJoin; }
00732        void setLineJoin(Qt::PenJoinStyle newStyle);
00733 
00735        QString customLineStyle() const { return NamedLStyle; }
00740        void setCustomLineStyle(const QString& newStyle);
00741 
00745        int startArrowIndex() const { return m_startArrowIndex; }
00750        void setStartArrowIndex(int newIndex);
00751 
00755        int endArrowIndex() const { return m_endArrowIndex; }
00760        void setEndArrowIndex(int newIndex);
00761 
00763        bool imageFlippedH() const { return m_ImageIsFlippedH; }
00765        void setImageFlippedH(bool flipped);
00767        void flipImageH();
00768 
00770        bool imageFlippedV() const { return m_ImageIsFlippedV; }
00772        void setImageFlippedV(bool flipped);
00774        void flipImageV();
00775 
00781        void setImageScalingMode(bool freeScale, bool keepRatio);
00782 
00784        void toggleLock();
00786        bool locked() const { return m_Locked; }
00788        void setLocked(bool isLocked);
00789 
00791        void toggleSizeLock();
00793        bool sizeLocked() const { return m_SizeLocked; }
00795        void setSizeLocked(bool isLocked);
00796 
00801        TextFlowMode textFlowMode() const { return textFlowModeVal; }
00802 
00808        void setTextFlowMode(TextFlowMode mode);
00809 
00814        bool textFlowAroundObject() const { return (textFlowModeVal != TextFlowDisabled); }
00815 
00820        bool textFlowUsesFrameShape() const { return (textFlowModeVal == TextFlowUsesFrameShape); }
00821 
00826        bool textFlowUsesBoundingBox() const { return (textFlowModeVal == TextFlowUsesBoundingBox); }
00827 
00832        bool textFlowUsesContourLine() const { return (textFlowModeVal == TextFlowUsesContourLine); }
00833 
00838        bool textFlowUsesImageClipping() const { return (textFlowModeVal == TextFlowUsesImageClipping); }
00839 
00847        ItemType itemType() const { return m_ItemType; }
00852        void convertTo(ItemType newType);
00853 
00858        void setLayer(int layerId);
00859 
00866        void checkChanges(bool force = false);
00873        void moveUndoAction();
00874        void resizeUndoAction();
00875        void rotateUndoAction();
00876        void changeImageOffsetUndoAction();
00877        void changeImageScaleUndoAction();
00880        void restore(UndoState *state, bool isUndo);
00881 
00882        void getNamedResources(ResourceCollection& lists) const;
00883        void replaceNamedResources(ResourceCollection& newNames);
00884 
00893        QString generateUniqueCopyName(const QString originalName) const;
00898        bool printEnabled() const { return m_PrintEnabled; }
00903        void setPrintEnabled(bool toPrint);
00904        
00908        void togglePrintEnabled();
00909        
00914        bool isTagged() const { return tagged; }
00919        void setTagged(bool);
00920 
00925        bool loadImage(const QString& filename, const bool reload, const int gsResolution=-1, bool showMsg = false);
00926        
00927        
00932        bool connectToGUI();
00933        bool disconnectFromGUI();
00937        void emitAllToGUI();
00938        
00942        ScribusDoc* doc() const { return m_Doc; }
00943        
00944        bool isAnnotation() const { return m_isAnnotation; }
00945        void setIsAnnotation(bool);
00946        void setAnnotation(const Annotation& ad);
00947        Annotation& annotation() { return m_annotation; }
00948        const Annotation& annotation() const { return m_annotation; }
00949        
00950        bool imageShown() const { return PicArt; }
00951        void setImageShown(bool);
00952        
00953        void updateConstants();
00954        
00955 protected:
00956 
00957        void drawLockedMarker(ScPainter *p);
00958        
00960        UndoManager * const undoManager;
00967        void restoreMove(SimpleState *state, bool isUndo);
00968        void restoreResize(SimpleState *state, bool isUndo);
00969        void restoreRotate(SimpleState *state, bool isUndo);
00970        void restoreFill(SimpleState *state, bool isUndo);
00971        void restoreShade(SimpleState *state, bool isUndo);
00972        void restoreLineColor(SimpleState *state, bool isUndo);
00973        void restoreLineShade(SimpleState *state, bool isUndo);
00974        void restoreName(SimpleState *state, bool isUndo);
00975        void restoreFillTP(SimpleState *state, bool isUndo);
00976        void restoreLineTP(SimpleState *state, bool isUndo);
00977        void restoreLineStyle(SimpleState *state, bool isUndo);
00978        void restoreLineEnd(SimpleState *state, bool isUndo);
00979        void restoreLineJoin(SimpleState *state, bool isUndo);
00980        void restoreLineWidth(SimpleState *state, bool isUndo);
00981        void restoreCustomLineStyle(SimpleState *state, bool isUndo);
00982        void restoreArrow(SimpleState *state, bool isUndo, bool isStart);
00983 
00984        void restorePStyle(SimpleState *state, bool isUndo);
00985 
00986        void restoreType(SimpleState *state, bool isUndo);
00987        void restoreTextFlowing(SimpleState *state, bool isUndo);
00988        void restoreImageScaleType(SimpleState *state, bool isUndo);
00989        void restoreImageScaleChange(SimpleState *state, bool isUndo);
00990        void restoreImageOffsetChange(SimpleState *state, bool isUndo);
00991        void restorePoly(SimpleState *state, bool isUndo, bool isContour);
00992        void restoreContourLine(SimpleState *state, bool isUndo);
00993        void restoreLayer(SimpleState *state, bool isUndo);
00994        void restoreGetImage(SimpleState *state, bool isUndo);
00995 
00996        void restoreShapeContour(UndoState *state, bool isUndo);
00997        void restoreImageEffects(UndoState *state, bool isUndo);
01009        bool shouldCheck();
01011        void select();
01012 
01013        // Protected members
01014 
01021        ItemType m_ItemType;
01022 
01028        QString AnName; 
01029 
01034        QString patternVal;
01038        double patternScaleX;
01039        double patternScaleY;
01040        double patternOffsetX;
01041        double patternOffsetY;
01042        double patternRotation;
01043 
01048        QString fillColorVal;
01049 
01054        QString lineColorVal;
01055 
01060        int lineShadeVal;
01061 
01066        int fillShadeVal;
01067 
01072        double fillTransparencyVal;
01073 
01078        double lineTransparencyVal;
01079 
01084        int fillBlendmodeVal;
01085 
01090        int lineBlendmodeVal;
01091 
01097        bool m_ImageIsFlippedH;
01098 
01104        bool m_ImageIsFlippedV;
01105 
01110        bool m_Locked;
01111 
01116        bool m_SizeLocked;
01117 
01122        TextFlowMode textFlowModeVal;
01123 
01128        ObjAttrVector pageItemAttributes;
01129 
01134        bool m_PrintEnabled;
01135        
01140        bool tagged;
01141        
01142        QColor fillQColor;
01143        QColor strokeQColor;
01144        
01146        double Xpos;
01148        double Ypos;
01150        double Width;
01152        double Height;
01154        double Rot;
01156        bool Select;
01158        double LocalScX;
01160        double LocalScY;
01162        double LocalX;
01164        double LocalY;
01166        bool Reverse;
01167 
01168        int m_startArrowIndex;
01169        int m_endArrowIndex;
01170 
01171 protected:
01173        double Extra;
01174        double TExtra;
01175        double BExtra;
01176        double RExtra;
01177        
01178 public:
01180        double RadRect;
01181        
01182        //Undo Data
01184        double oldXpos;
01186        double oldYpos;
01188        double oldWidth;
01190        double oldHeight;
01192        double oldRot;
01194        double oldLocalScX;
01196        double oldLocalScY;
01198        double oldLocalX;
01200        double oldLocalY;
01201        
01203        ScribusDoc *m_Doc;
01204        
01206        bool m_isAnnotation;
01207        Annotation m_annotation;
01208        
01210        bool PicArt;
01211        
01213        double m_lineWidth;
01214        double Oldm_lineWidth;
01215        
01216 signals:
01217        //Frame signals
01218        void myself(PageItem *);
01219        void frameType(int);   // not related to Frametype but to m_itemIype :-/
01220        void position(double, double); //X,Y
01221        void widthAndHeight(double, double); //W,H
01222        void rotation(double); //Degrees rotation 
01223        void colors(QString, QString, int, int); //lineColor, fillColor, lineShade, fillShade
01224        void gradientType(int); //Normal, horizontal, vertical, etc.
01225        void patternFill(QString, double, double, double, double, double);
01226        void gradientColorUpdate(double, double, double, double, double, double); //Cpal updatespecialgradient
01227        void transparency(double, double); //fillTransparency, lineTransparency
01228        void blendmode(int, int); //fillBlendmode, lineBlendmode
01229        void frameLocked(bool); //Frame lock
01230        void frameSizeLocked(bool); //Frame size lock
01231        void frameFlippedH(bool); //Frame flipped horizontally
01232        void frameFlippedV(bool); //Frame flipped vertically
01233        void printEnabled(bool); //Frame is set to print or not
01234        //Shape signals
01235        void columns(int, double); //Number, gap
01236        void cornerRadius(double); //Corner radius of the shape
01237        //Line signals
01238        void lineWidth(double);
01239        void lineStyleCapJoin(Qt::PenStyle, Qt::PenCapStyle, Qt::PenJoinStyle);
01240        //Frame text signals
01241        void lineSpacing(double);
01242        void textKerning(int);
01243        void textStyle(int);
01244        void textFont(const QString&);
01245        void textSize(int);
01246        void textWidthScale(int);
01247        void textHeightScale(int);
01248        void textBaseLineOffset(int);
01249        void textOutline(int);
01250        void textShadow(int, int);
01251        void textUnderline(int, int);
01252        void textStrike(int, int);
01253        void textColor(QString, QString, int, int);
01254        void textFormatting(int);
01255        void textToFrameDistances(double, double, double, double); //left, top, bottom, right: Extra, TExtra, BExtra, RExtra
01256        //FIXME: columns, grid ?
01257        //Frame image signals
01258        void imageOffsetScale(double, double, double, double);
01259 };
01260 
01261 #endif