Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

sctextstruct.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 #ifndef SCTEXTSTRUCT_H
00008 #define SCTEXTSTRUCT_H
00009 
00010 #ifdef HAVE_CONFIG_H
00011 #include "scconfig.h"
00012 #endif
00013 
00014 #include "scribusapi.h"
00015 #include "text/nlsconfig.h"
00016 
00017 #ifdef NLS_CONFORMANCE
00018 #define NLS_PRIVATE private
00019 #else
00020 #define NLS_PRIVATE public
00021 #endif
00022 
00023 #include <QString>
00024 
00025 #include "scfonts.h"
00026 #include "style.h"
00027 #include "styles/charstyle.h"
00028 #include "styles/paragraphstyle.h"
00029 
00030 class PageItem;
00031 
00032 /* Struktur fuer Pageitem Text */
00033 
00034 
00035 /*
00036  *  sctext.h
00037  *  Scribus
00038  *
00039  *  Created by Andreas Vox on 29.07.05.
00040  *  Copyright 2005 under GPL2. All rights reserved.
00041  *
00042  */
00043 
00044 
00045 
00050 struct SCRIBUS_API GlyphLayout {
00051     float xadvance;
00052     float yadvance;
00053     float xoffset;
00054     float yoffset;
00055     double scaleV;
00056     double scaleH;
00057     uint glyph;
00058     GlyphLayout* more;
00059     
00060     GlyphLayout() : xadvance(0.0f), yadvance(0.0f), xoffset(0.0f), yoffset(0.0f),
00061         scaleV(1.0), scaleH(1.0), glyph(0), more(NULL) 
00062     { }
00063     double wide() const 
00064     { 
00065         double ret = 0; 
00066         for(const GlyphLayout* p=this; p; p=p->more) 
00067             ret += p->xadvance; 
00068         return ret; 
00069     }
00070     GlyphLayout* last() 
00071     { 
00072         if (more) 
00073             return more->last();
00074         else 
00075             return this;
00076     }
00077     void shrink()
00078     {
00079         if (more) {
00080             more->shrink();
00081             delete more;
00082             more = NULL;
00083         }
00084     }
00085     void grow()
00086     {
00087         if (!more) {
00088             more = new GlyphLayout();
00089         }
00090     }
00091     
00092 };
00093 
00094 struct InlineFrameData;
00095 
00096 class SCRIBUS_API InlineFrame
00097 {
00098 public:
00099     InlineFrame(PageItem* item);
00100     InlineFrame(const InlineFrame& other);
00101     InlineFrame& operator= (const InlineFrame& other);
00102     virtual ~InlineFrame();
00103     
00104     bool hasItem();
00105     bool isShared();
00106     PageItem* getItem();
00107     QList<PageItem*> getGroupedItems();
00108 private:
00109     InlineFrameData* d;
00110 };
00111 
00112 
00113 #ifndef NLS_PROTO
00114 class SCRIBUS_API ScText : public CharStyle
00115 {
00116 public:
00117     ParagraphStyle* parstyle; // only for parseps
00118     GlyphLayout glyph;
00119     float PtransX;
00120     float PtransY;
00121     float PRot;
00122     InlineFrame embedded;
00123     QChar ch;
00124     ScText() : 
00125         CharStyle(),
00126         parstyle(NULL), glyph(), 
00127         PtransX(0.0f), PtransY(0.0f), PRot(0.0f), embedded(NULL), ch() {}
00128     ScText(const ScText& other) : 
00129         CharStyle(other),
00130         parstyle(NULL), glyph(other.glyph), 
00131         PtransX(other.PtransX), PtransY(other.PtransY), PRot(other.PRot), 
00132         embedded(other.embedded), ch(other.ch)
00133     {
00134         if (other.parstyle)
00135             parstyle = new ParagraphStyle(*other.parstyle);
00136     }
00137     ~ScText();
00138 };
00139 #endif
00140 
00141 #endif // SCTEXTSTRUCT_H
00142 
Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.