You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
koffice/kspread/KSpreadLayoutIface.cc

416 lines
10 KiB

/* This file is part of the KDE project
Copyright 2002 Laurent Montel <montel@kde.org>
Copyright 2002 Philipp Mueller <philipp.mueller@gmx.de>
Copyright 2002 John Dailey <dailey@vt.edu>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "KSpreadLayoutIface.h"
#include <tqbrush.h>
#include "kspread_format.h"
using namespace KSpread;
LayoutIface::LayoutIface(Format *_layout)
{
tqlayout=_layout;
}
void LayoutIface::setBgColor(const TQString& _c)
{
TQColor c(_c);
tqlayout->setBgColor(c);
}
void LayoutIface::setBgColor(int r,int g,int b)
{
TQColor c(r,g,b);
tqlayout->setBgColor(c);
}
void LayoutIface::setTextColor(int r,int g,int b)
{
TQColor c(r,g,b);
tqlayout->setTextColor(c);
}
void LayoutIface::setTextColor(const TQString& _c)
{
TQColor c(_c);
tqlayout->setTextColor(c);
}
void LayoutIface::setAngle(int angle)
{
tqlayout->setAngle(angle);
}
void LayoutIface::setVerticalText(bool _vertical)
{
tqlayout->setVerticalText(_vertical);
}
void LayoutIface::setMultiRow(bool _multi)
{
tqlayout->setMultiRow( _multi );
}
void LayoutIface::setAlign( const TQString& _Align )
{
Format::Align Align;
if(_Align=="Left")
Align=Format::Left;
else if(_Align=="Right")
Align=Format::Right;
else if(_Align=="Center")
Align=Format::Center;
else
Align=Format::Undefined;
tqlayout->setAlign( Align);
}
void LayoutIface::setAlignY( const TQString& _AlignY )
{
Format::AlignY AlignY;
if(_AlignY=="Top")
AlignY=Format::Top;
else if(_AlignY=="Middle")
AlignY=Format::Middle;
else if(_AlignY=="Bottom")
AlignY=Format::Bottom;
else
AlignY=Format::Middle;
tqlayout->setAlignY( AlignY);
}
void LayoutIface::setPostfix(const TQString &_postfix)
{
tqlayout->setPostfix( _postfix );
}
void LayoutIface::setPrefix(const TQString &_prefix)
{
tqlayout->setPrefix( _prefix );
}
void LayoutIface::setFormatType(const TQString &_formatType)
{
FormatType format;
tqlayout->setPrecision(2);
if (_formatType=="Generic")
format = Generic_format;
else if(_formatType=="Number")
format=Number_format;
else if(_formatType=="Money")
format=Money_format;
else if(_formatType=="Percentage")
format=Percentage_format;
else if(_formatType=="Scientific")
format=Scientific_format;
else if(_formatType=="ShortDate")
format=ShortDate_format;
else if(_formatType=="TextDate")
format=TextDate_format;
else if(_formatType=="Time")
format=Time_format;
else if(_formatType=="SecondeTime")
format=SecondeTime_format;
else if(_formatType=="fraction_half")
format=fraction_half;
else if(_formatType=="fraction_quarter")
format=fraction_quarter;
else if(_formatType=="fraction_eighth")
format=fraction_eighth;
else if(_formatType=="fraction_sixteenth")
format=fraction_sixteenth;
else if(_formatType=="fraction_tenth")
format=fraction_tenth;
else if(_formatType=="fraction_hundredth")
format=fraction_hundredth;
else if(_formatType=="fraction_one_digit")
format=fraction_one_digit;
else if(_formatType=="fraction_two_digits")
format=fraction_two_digits;
else if(_formatType=="fraction_three_digits")
format=fraction_three_digits;
else
format=Generic_format;
tqlayout->setFormatType( format);
}
void LayoutIface::setPrecision(int _p)
{
tqlayout->setPrecision( _p );
}
void LayoutIface::setTextFontBold(bool _b)
{
tqlayout->setTextFontBold( _b );
}
void LayoutIface::setTextFontItalic(bool _b)
{
tqlayout->setTextFontItalic( _b );
}
void LayoutIface::setTextFontUnderline(bool _b)
{
tqlayout->setTextFontUnderline( _b );
}
void LayoutIface::setTextFontStrike(bool _b)
{
tqlayout->setTextFontStrike( _b );
}
void LayoutIface::setTextFontSize( int _size )
{
tqlayout->setTextFontSize( _size );
}
void LayoutIface::setTextFontFamily( const TQString& _font )
{
tqlayout->setTextFontFamily( _font );
}
//border left
void LayoutIface::setLeftBorderStyle( const TQString& _style )
{
if(_style=="DotLine")
tqlayout->setLeftBorderStyle(Qt::DotLine);
else if(_style=="DashLine")
tqlayout->setLeftBorderStyle(Qt::DashLine);
else if(_style=="DashDotLine")
tqlayout->setLeftBorderStyle(Qt::DashDotLine);
else if(_style=="DashDotDotLine")
tqlayout->setLeftBorderStyle(Qt::DashDotDotLine);
else if(_style=="SolidLine")
tqlayout->setLeftBorderStyle(Qt::SolidLine);
else
tqlayout->setLeftBorderStyle(Qt::SolidLine);
}
void LayoutIface::setLeftBorderColor(const TQString& _c)
{
TQColor c(_c);
tqlayout->setLeftBorderColor(c );
}
void LayoutIface::setLeftBorderColor(int r,int g,int b)
{
TQColor c(r,g,b);
tqlayout->setLeftBorderColor(c );
}
void LayoutIface::setLeftBorderWidth( int _size )
{
tqlayout->setLeftBorderWidth( _size );
}
//border right
void LayoutIface::setRightBorderStyle( const TQString& _style )
{
if(_style=="DotLine")
tqlayout->setRightBorderStyle(Qt::DotLine);
else if(_style=="DashLine")
tqlayout->setRightBorderStyle(Qt::DashLine);
else if(_style=="DashDotLine")
tqlayout->setRightBorderStyle(Qt::DashDotLine);
else if(_style=="DashDotDotLine")
tqlayout->setRightBorderStyle(Qt::DashDotDotLine);
else if(_style=="SolidLine")
tqlayout->setRightBorderStyle(Qt::SolidLine);
else
tqlayout->setRightBorderStyle(Qt::SolidLine);
}
void LayoutIface::setRightBorderColor(const TQString& _c)
{
TQColor c(_c);
tqlayout->setRightBorderColor(c );
}
void LayoutIface::setRightBorderColor(int r,int g,int b)
{
TQColor c(r,g,b);
tqlayout->setRightBorderColor(c );
}
void LayoutIface::setRightBorderWidth( int _size )
{
tqlayout->setRightBorderWidth( _size );
}
//border top
void LayoutIface::setTopBorderStyle( const TQString& _style )
{
if(_style=="DotLine")
tqlayout->setTopBorderStyle(Qt::DotLine);
else if(_style=="DashLine")
tqlayout->setTopBorderStyle(Qt::DashLine);
else if(_style=="DashDotLine")
tqlayout->setTopBorderStyle(Qt::DashDotLine);
else if(_style=="DashDotDotLine")
tqlayout->setTopBorderStyle(Qt::DashDotDotLine);
else if(_style=="SolidLine")
tqlayout->setTopBorderStyle(Qt::SolidLine);
else
tqlayout->setTopBorderStyle(Qt::SolidLine);
}
void LayoutIface::setTopBorderColor(const TQString& _c)
{
TQColor c(_c);
tqlayout->setTopBorderColor(c );
}
void LayoutIface::setTopBorderColor(int r,int g,int b)
{
TQColor c(r,g,b);
tqlayout->setTopBorderColor(c );
}
void LayoutIface::setTopBorderWidth( int _size )
{
tqlayout->setTopBorderWidth( _size );
}
//border bottom
void LayoutIface::setBottomBorderStyle( const TQString& _style )
{
if(_style=="DotLine")
tqlayout->setBottomBorderStyle(Qt::DotLine);
else if(_style=="DashLine")
tqlayout->setBottomBorderStyle(Qt::DashLine);
else if(_style=="DashDotLine")
tqlayout->setBottomBorderStyle(Qt::DashDotLine);
else if(_style=="DashDotDotLine")
tqlayout->setBottomBorderStyle(Qt::DashDotDotLine);
else if(_style=="SolidLine")
tqlayout->setBottomBorderStyle(Qt::SolidLine);
else
tqlayout->setBottomBorderStyle(Qt::SolidLine);
}
void LayoutIface::setBottomBorderColor(const TQString& _c)
{
TQColor c(_c);
tqlayout->setBottomBorderColor(c );
}
void LayoutIface::setBottomBorderColor(int r,int g,int b)
{
TQColor c(r,g,b);
tqlayout->setBottomBorderColor(c );
}
void LayoutIface::setBottomBorderWidth( int _size )
{
tqlayout->setBottomBorderWidth( _size );
}
//fall back diagonal
void LayoutIface::setFallDiagonalStyle( const TQString& _style )
{
if(_style=="DotLine")
tqlayout->setFallDiagonalStyle(Qt::DotLine);
else if(_style=="DashLine")
tqlayout->setFallDiagonalStyle(Qt::DashLine);
else if(_style=="DashDotLine")
tqlayout->setFallDiagonalStyle(Qt::DashDotLine);
else if(_style=="DashDotDotLine")
tqlayout->setFallDiagonalStyle(Qt::DashDotDotLine);
else if(_style=="SolidLine")
tqlayout->setFallDiagonalStyle(Qt::SolidLine);
else
tqlayout->setFallDiagonalStyle(Qt::SolidLine);
}
void LayoutIface::setFallDiagonalColor(const TQString& _c)
{
TQColor c(_c);
tqlayout->setFallDiagonalColor(c );
}
void LayoutIface::setFallDiagonalColor(int r,int g,int b)
{
TQColor c(r,g,b);
tqlayout->setFallDiagonalColor(c );
}
void LayoutIface::setFallDiagonalWidth( int _size )
{
tqlayout->setFallDiagonalWidth( _size );
}
//GoUpDiagonal
void LayoutIface::setGoUpDiagonalStyle( const TQString& _style )
{
if(_style=="DotLine")
tqlayout->setGoUpDiagonalStyle(Qt::DotLine);
else if(_style=="DashLine")
tqlayout->setGoUpDiagonalStyle(Qt::DashLine);
else if(_style=="DashDotLine")
tqlayout->setGoUpDiagonalStyle(Qt::DashDotLine);
else if(_style=="DashDotDotLine")
tqlayout->setGoUpDiagonalStyle(Qt::DashDotDotLine);
else if(_style=="SolidLine")
tqlayout->setGoUpDiagonalStyle(Qt::SolidLine);
else
tqlayout->setGoUpDiagonalStyle(Qt::SolidLine);
}
void LayoutIface::setGoUpDiagonalColor(const TQString& _c)
{
TQColor c(_c);
tqlayout->setGoUpDiagonalColor(c );
}
void LayoutIface::setGoUpDiagonalColor(int r,int g,int b)
{
TQColor c(r,g,b);
tqlayout->setGoUpDiagonalColor(c );
}
void LayoutIface::setGoUpDiagonalWidth( int _size )
{
tqlayout->setGoUpDiagonalWidth( _size );
}
void LayoutIface::setIndent( double indent )
{
if( indent >= 0.0 )
tqlayout->setIndent( indent );
else
tqlayout->setIndent( 0.0 );
}
void LayoutIface::setDontPrintText ( bool _print)
{
tqlayout->setDontPrintText ( _print);
}