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 8 #include "textlayoutpainter.h" 9 TextLayoutPainter()10TextLayoutPainter::TextLayoutPainter() 11 { 12 m_stack.push(State()); 13 } 14 ~TextLayoutPainter()15TextLayoutPainter::~TextLayoutPainter() 16 { } 17 setFont(const ScFace & font)18void TextLayoutPainter::setFont(const ScFace& font) 19 { 20 if (m_stack.top().font != font) 21 m_stack.top().font = font; 22 } 23 font() const24const ScFace& TextLayoutPainter::font() const 25 { 26 return m_stack.top().font; 27 } 28 setFontSize(double size)29void TextLayoutPainter::setFontSize(double size) 30 { 31 m_stack.top().fontSize = size; 32 } 33 fontSize() const34double TextLayoutPainter::fontSize() const 35 { 36 return m_stack.top().fontSize; 37 } 38 setStrokeColor(const TextLayoutColor & color)39void TextLayoutPainter::setStrokeColor(const TextLayoutColor& color) 40 { 41 m_stack.top().strokeColor = color; 42 } 43 strokeColor() const44const TextLayoutColor& TextLayoutPainter::strokeColor() const 45 { 46 return m_stack.top().strokeColor; 47 } 48 setFillColor(const TextLayoutColor & color)49void TextLayoutPainter::setFillColor(const TextLayoutColor& color) 50 { 51 m_stack.top().fillColor = color; 52 } 53 fillColor() const54const TextLayoutColor& TextLayoutPainter::fillColor() const 55 { 56 return m_stack.top().fillColor; 57 } 58 setStrokeWidth(double w)59void TextLayoutPainter::setStrokeWidth(double w) 60 { 61 m_stack.top().strokeWidth = w; 62 } 63 strokeWidth() const64double TextLayoutPainter::strokeWidth() const 65 { 66 return m_stack.top().strokeWidth; 67 } 68 translate(double x,double y)69void TextLayoutPainter::translate(double x, double y) 70 { 71 m_stack.top().x += x; 72 m_stack.top().y += y; 73 } 74 x() const75double TextLayoutPainter::x() const 76 { 77 return m_stack.top().x; 78 } 79 y() const80double TextLayoutPainter::y() const 81 { 82 return m_stack.top().y; 83 } 84 setScale(double h,double v)85void TextLayoutPainter::setScale(double h, double v) 86 { 87 m_stack.top().scaleH = h; 88 m_stack.top().scaleV = v; 89 } 90 scaleV() const91double TextLayoutPainter::scaleV() const 92 { 93 return m_stack.top().scaleV; 94 } 95 scaleH() const96double TextLayoutPainter::scaleH() const 97 { 98 return m_stack.top().scaleH; 99 } 100 setSelected(bool s)101void TextLayoutPainter::setSelected(bool s) 102 { 103 m_stack.top().selected = s; 104 } 105 selected() const106bool TextLayoutPainter::selected() const 107 { 108 return m_stack.top().selected; 109 } 110 setMatrix(const QTransform & matrix)111void TextLayoutPainter::setMatrix(const QTransform& matrix) 112 { 113 m_stack.top().matrix = matrix; 114 } 115 matrix() const116const QTransform& TextLayoutPainter::matrix() const 117 { 118 return m_stack.top().matrix; 119 } 120 save()121void TextLayoutPainter::save() 122 { 123 m_stack.push(m_stack.top()); 124 } 125 restore()126void TextLayoutPainter::restore() 127 { 128 m_stack.pop(); 129 } 130