Back to index

scribus-ng  1.3.4.dfsg+svn20071115
gtparagraphstyle.cpp
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  *   Copyright (C) 2004 by Riku Leino                                      *
00009  *   tsoots@gmail.com                                                      *
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  *   This program is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00019  *   GNU General Public License for more details.                          *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU General Public License     *
00022  *   along with this program; if not, write to the                         *
00023  *   Free Software Foundation, Inc.,                                       *
00024  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00025  ***************************************************************************/
00026 
00027 #include "gtparagraphstyle.h"
00028 #include "scribusstructs.h"
00029 
00030 gtParagraphStyle::gtParagraphStyle(QString name) : gtStyle(name) 
00031 {
00032        init();
00033 }
00034 
00035 gtParagraphStyle::gtParagraphStyle(const gtParagraphStyle& p) : gtStyle(p)
00036 {
00037        lineSpacing     = p.lineSpacing;
00038        alignment       = p.alignment;
00039        indent          = p.indent;
00040        firstLineIndent = p.firstLineIndent;
00041        spaceAbove      = p.spaceAbove;
00042        spaceBelow      = p.spaceBelow;
00043        dropCap         = p.dropCap;
00044        dropCapHeight   = p.dropCapHeight;
00045        adjToBaseline   = p.adjToBaseline;
00046        autoLineSpacing = p.autoLineSpacing;
00047        isVisible       = p.isVisible;
00048 }
00049 
00050 gtParagraphStyle::gtParagraphStyle(const gtStyle& s) : gtStyle(s)
00051 {
00052        init();
00053 }
00054 
00055 void gtParagraphStyle::init()
00056 {
00057        lineSpacing     = 15;
00058        alignment       = LEFT;
00059        indent          = 0;
00060        firstLineIndent = 0;
00061        spaceAbove      = 0;
00062        spaceBelow      = 0;
00063        dropCap         = false;
00064        dropCapHeight   = 2;
00065        adjToBaseline   = false;
00066        autoLineSpacing = false;
00067        isVisible       = true;
00068 }
00069 
00070 QString gtParagraphStyle::target()
00071 {
00072        return QString("paragraph");
00073 }
00074 
00075 double gtParagraphStyle::getLineSpacing()
00076 {
00077        return lineSpacing;
00078 }
00079 
00080 void gtParagraphStyle::setLineSpacing(double newLineSpacing)
00081 {
00082        lineSpacing = newLineSpacing;
00083 }
00084 
00085 bool gtParagraphStyle::getAutoLineSpacing()
00086 {
00087        return autoLineSpacing;
00088 }
00089 
00090 void gtParagraphStyle::setAutoLineSpacing(bool newALS)
00091 {
00092        autoLineSpacing = newALS;
00093 }
00094 
00095 int gtParagraphStyle::getAlignment()
00096 {
00097        return alignment;
00098 }
00099 
00100 void gtParagraphStyle::setAlignment(Alignment newAlignment)
00101 {
00102        alignment = newAlignment;
00103 }
00104 
00105 void gtParagraphStyle::setAlignment(int newAlignment)
00106 {
00107        if ((newAlignment > -1) && (newAlignment < AlignmentMAX))
00108               alignment = newAlignment;
00109 }
00110 
00111 double gtParagraphStyle::getIndent()
00112 {
00113        return indent;
00114 }
00115 
00116 void gtParagraphStyle::setIndent(double newIndent)
00117 {
00118        indent = newIndent;
00119 }
00120 
00121 double gtParagraphStyle::getFirstLineIndent()
00122 {
00123        return firstLineIndent;
00124 }
00125 
00126 void gtParagraphStyle::setFirstLineIndent(double newFirstLineIndent)
00127 {
00128        firstLineIndent = newFirstLineIndent;
00129 }
00130 
00131 double gtParagraphStyle::getSpaceAbove()
00132 {
00133        return spaceAbove;
00134 }
00135 
00136 void gtParagraphStyle::setSpaceAbove(double newSpaceAbove)
00137 {
00138        spaceAbove = newSpaceAbove;
00139 }
00140 
00141 double gtParagraphStyle::getSpaceBelow()
00142 {
00143        return spaceBelow;
00144 }
00145 
00146 void gtParagraphStyle::setSpaceBelow(double newSpaceBelow)
00147 {
00148        spaceBelow = newSpaceBelow;
00149 }
00150 
00151 QValueList<ParagraphStyle::TabRecord>* gtParagraphStyle::getTabValues()
00152 {
00153        return &tabValues;
00154 }
00155 
00156 void gtParagraphStyle::setTabValue(double newTabValue, TabType ttype)
00157 {
00158        ParagraphStyle::TabRecord tb;
00159        tb.tabPosition = newTabValue;
00160        tb.tabType = ttype;
00161        tb.tabFillChar =  QChar();
00162        tabValues.append(tb);
00163 }
00164 
00165 bool gtParagraphStyle::hasDropCap()
00166 {
00167        return dropCap;
00168 }
00169 
00170 void gtParagraphStyle::setDropCap(bool newDropCap)
00171 {
00172        dropCap = newDropCap;
00173 }
00174 
00175 void gtParagraphStyle::setDropCap(int newHeight)
00176 {
00177        setDropCap(true);
00178        dropCapHeight = newHeight;
00179 }
00180 
00181 int gtParagraphStyle::getDropCapHeight()
00182 {
00183        return dropCapHeight;
00184 }
00185 
00186 void   gtParagraphStyle::setDropCapHeight(int newHeight)
00187 {
00188        dropCapHeight = newHeight;
00189 }
00190 
00191 bool gtParagraphStyle::isAdjToBaseline()
00192 {
00193        return adjToBaseline;
00194 }
00195 
00196 void gtParagraphStyle::setAdjToBaseline(bool newAdjToBaseline)
00197 {
00198        adjToBaseline = newAdjToBaseline;
00199 }
00200 
00201 void gtParagraphStyle::getStyle(gtStyle* style)
00202 {
00203        *style = gtStyle(*this);
00204 }
00205 
00206 gtParagraphStyle::~gtParagraphStyle()
00207 {
00208 
00209 }