kspread

KSpreadLayoutIface.cc

00001 /* This file is part of the KDE project
00002    
00003    Copyright 2002 Laurent Montel <montel@kde.org>
00004    Copyright 2002 Philipp Mueller <philipp.mueller@gmx.de>
00005    Copyright 2002 John Dailey <dailey@vt.edu>
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public License
00018    along with this library; see the file COPYING.LIB.  If not, write to
00019    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020  * Boston, MA 02110-1301, USA.
00021 */
00022 
00023 #include "KSpreadLayoutIface.h"
00024 #include <qbrush.h>
00025 #include "kspread_format.h"
00026 
00027 using namespace KSpread;
00028 
00029 LayoutIface::LayoutIface(Format *_layout)
00030 {
00031     layout=_layout;
00032 }
00033 
00034 void LayoutIface::setBgColor(const QString& _c)
00035 {
00036     QColor c(_c);
00037     layout->setBgColor(c);
00038 }
00039 
00040 void LayoutIface::setBgColor(int r,int g,int b)
00041 {
00042     QColor c(r,g,b);
00043     layout->setBgColor(c);
00044 }
00045 
00046 
00047 void LayoutIface::setTextColor(int r,int g,int b)
00048 {
00049     QColor c(r,g,b);
00050     layout->setTextColor(c);
00051 }
00052 
00053 void LayoutIface::setTextColor(const QString& _c)
00054 {
00055     QColor c(_c);
00056     layout->setTextColor(c);
00057 }
00058 
00059 void LayoutIface::setAngle(int angle)
00060 {
00061     layout->setAngle(angle);
00062 }
00063 
00064 void LayoutIface::setVerticalText(bool _vertical)
00065 {
00066     layout->setVerticalText(_vertical);
00067 }
00068 
00069 void LayoutIface::setMultiRow(bool _multi)
00070 {
00071     layout->setMultiRow( _multi );
00072 }
00073 
00074 void LayoutIface::setAlign( const QString& _Align )
00075 {
00076     Format::Align Align;
00077     if(_Align=="Left")
00078         Align=Format::Left;
00079     else if(_Align=="Right")
00080         Align=Format::Right;
00081     else if(_Align=="Center")
00082         Align=Format::Center;
00083     else
00084         Align=Format::Undefined;
00085     layout->setAlign( Align);
00086 }
00087 
00088 void LayoutIface::setAlignY( const QString& _AlignY )
00089 {
00090     Format::AlignY AlignY;
00091     if(_AlignY=="Top")
00092         AlignY=Format::Top;
00093     else if(_AlignY=="Middle")
00094         AlignY=Format::Middle;
00095     else if(_AlignY=="Bottom")
00096         AlignY=Format::Bottom;
00097     else
00098         AlignY=Format::Middle;
00099     layout->setAlignY( AlignY);
00100 }
00101 
00102 void LayoutIface::setPostfix(const QString &_postfix)
00103 {
00104     layout->setPostfix( _postfix );
00105 }
00106 
00107 void LayoutIface::setPrefix(const QString &_prefix)
00108 {
00109     layout->setPrefix( _prefix );
00110 }
00111 
00112 void LayoutIface::setFormatType(const QString &_formatType)
00113 {
00114     FormatType format;
00115     layout->setPrecision(2);
00116     if (_formatType=="Generic")
00117         format = Generic_format;
00118     else if(_formatType=="Number")
00119         format=Number_format;
00120     else if(_formatType=="Money")
00121         format=Money_format;
00122     else if(_formatType=="Percentage")
00123         format=Percentage_format;
00124     else if(_formatType=="Scientific")
00125         format=Scientific_format;
00126     else if(_formatType=="ShortDate")
00127         format=ShortDate_format;
00128     else if(_formatType=="TextDate")
00129         format=TextDate_format;
00130     else if(_formatType=="Time")
00131         format=Time_format;
00132     else if(_formatType=="SecondeTime")
00133         format=SecondeTime_format;
00134     else if(_formatType=="fraction_half")
00135         format=fraction_half;
00136     else if(_formatType=="fraction_quarter")
00137         format=fraction_quarter;
00138     else if(_formatType=="fraction_eighth")
00139         format=fraction_eighth;
00140     else if(_formatType=="fraction_sixteenth")
00141         format=fraction_sixteenth;
00142     else if(_formatType=="fraction_tenth")
00143         format=fraction_tenth;
00144     else if(_formatType=="fraction_hundredth")
00145         format=fraction_hundredth;
00146     else if(_formatType=="fraction_one_digit")
00147         format=fraction_one_digit;
00148     else if(_formatType=="fraction_two_digits")
00149         format=fraction_two_digits;
00150     else if(_formatType=="fraction_three_digits")
00151         format=fraction_three_digits;
00152     else
00153         format=Generic_format;
00154     layout->setFormatType( format);
00155 }
00156 
00157 
00158 void LayoutIface::setPrecision(int _p)
00159 {
00160     layout->setPrecision( _p );
00161 }
00162 
00163 void LayoutIface::setTextFontBold(bool _b)
00164 {
00165     layout->setTextFontBold( _b );
00166 }
00167 
00168 void LayoutIface::setTextFontItalic(bool _b)
00169 {
00170     layout->setTextFontItalic( _b );
00171 }
00172 
00173 void LayoutIface::setTextFontUnderline(bool _b)
00174 {
00175     layout->setTextFontUnderline( _b );
00176 }
00177 
00178 void LayoutIface::setTextFontStrike(bool _b)
00179 {
00180     layout->setTextFontStrike( _b );
00181 }
00182 
00183 void LayoutIface::setTextFontSize( int _size )
00184 {
00185     layout->setTextFontSize( _size );
00186 }
00187 
00188 void LayoutIface::setTextFontFamily( const QString& _font )
00189 {
00190     layout->setTextFontFamily( _font );
00191 }
00192 
00193 
00194 //border left
00195 void LayoutIface::setLeftBorderStyle( const QString& _style )
00196 {
00197     if(_style=="DotLine")
00198         layout->setLeftBorderStyle(Qt::DotLine);
00199     else if(_style=="DashLine")
00200         layout->setLeftBorderStyle(Qt::DashLine);
00201     else if(_style=="DashDotLine")
00202         layout->setLeftBorderStyle(Qt::DashDotLine);
00203     else if(_style=="DashDotDotLine")
00204         layout->setLeftBorderStyle(Qt::DashDotDotLine);
00205     else if(_style=="SolidLine")
00206         layout->setLeftBorderStyle(Qt::SolidLine);
00207     else
00208         layout->setLeftBorderStyle(Qt::SolidLine);
00209 }
00210 
00211 void LayoutIface::setLeftBorderColor(const QString& _c)
00212 {
00213     QColor c(_c);
00214     layout->setLeftBorderColor(c );
00215 }
00216 
00217 void LayoutIface::setLeftBorderColor(int r,int g,int b)
00218 {
00219     QColor c(r,g,b);
00220     layout->setLeftBorderColor(c );
00221 }
00222 
00223 void LayoutIface::setLeftBorderWidth( int _size )
00224 {
00225     layout->setLeftBorderWidth( _size );
00226 }
00227 
00228 
00229 //border right
00230 void LayoutIface::setRightBorderStyle( const QString& _style )
00231 {
00232     if(_style=="DotLine")
00233         layout->setRightBorderStyle(Qt::DotLine);
00234     else if(_style=="DashLine")
00235         layout->setRightBorderStyle(Qt::DashLine);
00236     else if(_style=="DashDotLine")
00237         layout->setRightBorderStyle(Qt::DashDotLine);
00238     else if(_style=="DashDotDotLine")
00239         layout->setRightBorderStyle(Qt::DashDotDotLine);
00240     else if(_style=="SolidLine")
00241         layout->setRightBorderStyle(Qt::SolidLine);
00242     else
00243         layout->setRightBorderStyle(Qt::SolidLine);
00244 }
00245 
00246 void LayoutIface::setRightBorderColor(const QString& _c)
00247 {
00248     QColor c(_c);
00249     layout->setRightBorderColor(c );
00250 }
00251 
00252 void LayoutIface::setRightBorderColor(int r,int g,int b)
00253 {
00254     QColor c(r,g,b);
00255     layout->setRightBorderColor(c );
00256 }
00257 
00258 void LayoutIface::setRightBorderWidth( int _size )
00259 {
00260     layout->setRightBorderWidth( _size );
00261 }
00262 
00263 
00264 //border top
00265 void LayoutIface::setTopBorderStyle( const QString& _style )
00266 {
00267     if(_style=="DotLine")
00268         layout->setTopBorderStyle(Qt::DotLine);
00269     else if(_style=="DashLine")
00270         layout->setTopBorderStyle(Qt::DashLine);
00271     else if(_style=="DashDotLine")
00272         layout->setTopBorderStyle(Qt::DashDotLine);
00273     else if(_style=="DashDotDotLine")
00274         layout->setTopBorderStyle(Qt::DashDotDotLine);
00275     else if(_style=="SolidLine")
00276         layout->setTopBorderStyle(Qt::SolidLine);
00277     else
00278         layout->setTopBorderStyle(Qt::SolidLine);
00279 }
00280 
00281 void LayoutIface::setTopBorderColor(const QString& _c)
00282 {
00283     QColor c(_c);
00284     layout->setTopBorderColor(c );
00285 }
00286 
00287 void LayoutIface::setTopBorderColor(int r,int g,int b)
00288 {
00289     QColor c(r,g,b);
00290     layout->setTopBorderColor(c );
00291 }
00292 
00293 void LayoutIface::setTopBorderWidth( int _size )
00294 {
00295     layout->setTopBorderWidth( _size );
00296 }
00297 
00298 
00299 //border bottom
00300 void LayoutIface::setBottomBorderStyle( const QString& _style )
00301 {
00302     if(_style=="DotLine")
00303         layout->setBottomBorderStyle(Qt::DotLine);
00304     else if(_style=="DashLine")
00305         layout->setBottomBorderStyle(Qt::DashLine);
00306     else if(_style=="DashDotLine")
00307         layout->setBottomBorderStyle(Qt::DashDotLine);
00308     else if(_style=="DashDotDotLine")
00309         layout->setBottomBorderStyle(Qt::DashDotDotLine);
00310     else if(_style=="SolidLine")
00311         layout->setBottomBorderStyle(Qt::SolidLine);
00312     else
00313         layout->setBottomBorderStyle(Qt::SolidLine);
00314 }
00315 
00316 void LayoutIface::setBottomBorderColor(const QString& _c)
00317 {
00318     QColor c(_c);
00319     layout->setBottomBorderColor(c );
00320 }
00321 void LayoutIface::setBottomBorderColor(int r,int g,int b)
00322 {
00323     QColor c(r,g,b);
00324     layout->setBottomBorderColor(c );
00325 }
00326 
00327 void LayoutIface::setBottomBorderWidth( int _size )
00328 {
00329     layout->setBottomBorderWidth( _size );
00330 }
00331 
00332 
00333 //fall back diagonal
00334 void LayoutIface::setFallDiagonalStyle( const QString& _style )
00335 {
00336     if(_style=="DotLine")
00337         layout->setFallDiagonalStyle(Qt::DotLine);
00338     else if(_style=="DashLine")
00339         layout->setFallDiagonalStyle(Qt::DashLine);
00340     else if(_style=="DashDotLine")
00341         layout->setFallDiagonalStyle(Qt::DashDotLine);
00342     else if(_style=="DashDotDotLine")
00343         layout->setFallDiagonalStyle(Qt::DashDotDotLine);
00344     else if(_style=="SolidLine")
00345         layout->setFallDiagonalStyle(Qt::SolidLine);
00346     else
00347         layout->setFallDiagonalStyle(Qt::SolidLine);
00348 }
00349 
00350 void LayoutIface::setFallDiagonalColor(const QString& _c)
00351 {
00352     QColor c(_c);
00353     layout->setFallDiagonalColor(c );
00354 }
00355 void LayoutIface::setFallDiagonalColor(int r,int g,int b)
00356 {
00357     QColor c(r,g,b);
00358     layout->setFallDiagonalColor(c );
00359 }
00360 
00361 void LayoutIface::setFallDiagonalWidth( int _size )
00362 {
00363     layout->setFallDiagonalWidth( _size );
00364 }
00365 
00366 
00367 
00368 //GoUpDiagonal
00369 void LayoutIface::setGoUpDiagonalStyle( const QString& _style )
00370 {
00371     if(_style=="DotLine")
00372         layout->setGoUpDiagonalStyle(Qt::DotLine);
00373     else if(_style=="DashLine")
00374         layout->setGoUpDiagonalStyle(Qt::DashLine);
00375     else if(_style=="DashDotLine")
00376         layout->setGoUpDiagonalStyle(Qt::DashDotLine);
00377     else if(_style=="DashDotDotLine")
00378         layout->setGoUpDiagonalStyle(Qt::DashDotDotLine);
00379     else if(_style=="SolidLine")
00380         layout->setGoUpDiagonalStyle(Qt::SolidLine);
00381     else
00382         layout->setGoUpDiagonalStyle(Qt::SolidLine);
00383 }
00384 
00385 void LayoutIface::setGoUpDiagonalColor(const QString& _c)
00386 {
00387     QColor c(_c);
00388     layout->setGoUpDiagonalColor(c );
00389 }
00390 void LayoutIface::setGoUpDiagonalColor(int r,int g,int b)
00391 {
00392     QColor c(r,g,b);
00393     layout->setGoUpDiagonalColor(c );
00394 }
00395 
00396 void LayoutIface::setGoUpDiagonalWidth( int _size )
00397 {
00398     layout->setGoUpDiagonalWidth( _size );
00399 }
00400 
00401 
00402 void LayoutIface::setIndent( double indent )
00403 {
00404     if( indent >= 0.0 )
00405         layout->setIndent( indent );
00406     else
00407         layout->setIndent( 0.0 );
00408 }
00409 
00410 
00411 void LayoutIface::setDontPrintText ( bool _print)
00412 {
00413     layout->setDontPrintText ( _print);
00414 }
00415 
KDE Home | KDE Accessibility Home | Description of Access Keys