home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / include / scribus-ng / sctextstruct.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-01  |  3.1 KB  |  163 lines

  1. /*
  2. For general Scribus (>=1.3.2) copyright and licensing information please refer
  3. to the COPYING file provided with the program. Following this notice may exist
  4. a copyright and/or license notice that predates the release of Scribus 1.3.2
  5. for which a new license (GPL+exception) is in place.
  6. */
  7. #ifndef SCTEXTSTRUCT_H
  8. #define SCTEXTSTRUCT_H
  9.  
  10. #ifdef HAVE_CONFIG_H
  11. #include "scconfig.h"
  12. #endif
  13.  
  14. #include "scribusapi.h"
  15. #include "text/nlsconfig.h"
  16.  
  17. #ifdef NLS_CONFORMANCE
  18. #define NLS_PRIVATE private
  19. #else
  20. #define NLS_PRIVATE public
  21. #endif
  22.  
  23. #include <QString>
  24.  
  25. #include "scfonts.h"
  26. #include "style.h"
  27. #include "styles/charstyle.h"
  28. #include "styles/paragraphstyle.h"
  29.  
  30. class PageItem;
  31.  
  32. /* Struktur fuer Pageitem Text */
  33.  
  34.  
  35. /*
  36.  *  sctext.h
  37.  *  Scribus
  38.  *
  39.  *  Created by Andreas Vox on 29.07.05.
  40.  *  Copyright 2005 under GPL2. All rights reserved.
  41.  *
  42.  */
  43.  
  44.  
  45.  
  46. /**
  47.  * This struct stores a positioned glyph. This is the result of the layout process.
  48.  * If a char gets translated to more than one glyph, a linked list is built.
  49.  */
  50. struct SCRIBUS_API GlyphLayout {
  51.     float xadvance;
  52.     float yadvance;
  53.     float xoffset;
  54.     float yoffset;
  55.     double scaleV;
  56.     double scaleH;
  57.     uint glyph;
  58.     GlyphLayout* more;
  59.     
  60.     GlyphLayout() : xadvance(0.0f), yadvance(0.0f), xoffset(0.0f), yoffset(0.0f),
  61.         scaleV(1.0), scaleH(1.0), glyph(0), more(NULL) 
  62.     { }
  63.     double wide() const 
  64.     { 
  65.         double ret = 0; 
  66.         for(const GlyphLayout* p=this; p; p=p->more) 
  67.             ret += p->xadvance; 
  68.         return ret; 
  69.     }
  70.     GlyphLayout* last() 
  71.     { 
  72.         if (more) 
  73.             return more->last();
  74.         else 
  75.             return this;
  76.     }
  77.     void shrink()
  78.     {
  79.         if (more) {
  80.             more->shrink();
  81.             delete more;
  82.             more = NULL;
  83.         }
  84.     }
  85.     void grow()
  86.     {
  87.         if (!more) {
  88.             more = new GlyphLayout();
  89.         }
  90.     }
  91.     virtual void growWithTabLayout();
  92. };
  93.  
  94. struct SCRIBUS_API TabLayout : public GlyphLayout
  95. {
  96.     QChar fillChar;
  97. };
  98.  
  99. struct InlineFrameData;
  100.  
  101. class SCRIBUS_API InlineFrame
  102. {
  103. public:
  104.     InlineFrame(PageItem* item);
  105.     InlineFrame(const InlineFrame& other);
  106.     InlineFrame& operator= (const InlineFrame& other);
  107.     virtual ~InlineFrame();
  108.     
  109.     bool hasItem();
  110.     bool isShared();
  111.     PageItem* getItem();
  112.     QList<PageItem*> getGroupedItems();
  113. private:
  114.     InlineFrameData* d;
  115. };
  116.  
  117.  
  118. #ifndef NLS_PROTO
  119. class SCRIBUS_API ScText : public CharStyle
  120. {
  121. public:
  122.     ParagraphStyle* parstyle; // only for parseps
  123.     GlyphLayout glyph;
  124.     float PtransX;
  125.     float PtransY;
  126.     float PRot;
  127.     float PDx;
  128.     InlineFrame embedded;
  129.     QChar ch;
  130.     ScText() : 
  131.         CharStyle(),
  132.         parstyle(NULL), glyph(), 
  133.         PtransX(0.0f), PtransY(0.0f), PRot(0.0f), PDx(0.0f), embedded(NULL), ch() {}
  134.     ScText(const ScText& other) : 
  135.         CharStyle(other),
  136.         parstyle(NULL), glyph(other.glyph), 
  137.         PtransX(other.PtransX), PtransY(other.PtransY), PRot(other.PRot), PDx(other.PDx), 
  138.         embedded(other.embedded), ch(other.ch)
  139.     {
  140.         if (other.parstyle)
  141.             parstyle = new ParagraphStyle(*other.parstyle);
  142.     }
  143.     ~ScText();
  144. };
  145. #endif
  146.  
  147.  
  148. /** @brief First Line Offset Policy
  149.  * Set wether the first line offset is based on max glyph height
  150.  * or some of predefined height.
  151.  * I put a prefix because it could easily conflict 
  152.  */
  153. enum FirstLineOffsetPolicy
  154. {
  155.     FLOPRealGlyphHeight = 0, // Historical
  156.     FLOPFontAscent    = 1,
  157.     FLOPLineSpacing    = 2
  158. };
  159.  
  160.  
  161. #endif // SCTEXTSTRUCT_H
  162.  
  163.