kspread

KSpreadDocIface.cc

00001 /* This file is part of the KDE project
00002 
00003    Copyright 2004 Ariya Hidayat <ariya@kde.org>
00004    Copyright 2003 Norbert Andres <nandres@web.de>
00005    Copyright 2002 Laurent Montel <montel@kde.org>
00006    Copyright 2002 Simon Hausmann <hausmann@kde.org>
00007    Copyright 2001-2002 Philipp Mueller <philipp.mueller@gmx.de>
00008    Copyright 2000 Stephan Kulow <coolo@kde.org>
00009    Copyright 1999-2000 David Faure <faure@kde.org>
00010    Copyright 1999 Torben Weis <weis@kde.org>
00011 
00012    This library is free software; you can redistribute it and/or
00013    modify it under the terms of the GNU Library General Public
00014    License as published by the Free Software Foundation; either
00015    version 2 of the License, or (at your option) any later version.
00016 
00017    This library is distributed in the hope that it will be useful,
00018    but WITHOUT ANY WARRANTY; without even the implied warranty of
00019    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020    Library General Public License for more details.
00021 
00022    You should have received a copy of the GNU Library General Public License
00023    along with this library; see the file COPYING.LIB.  If not, write to
00024    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00025  * Boston, MA 02110-1301, USA.
00026 */
00027 
00028 #include "KSpreadDocIface.h"
00029 #include <KoDocumentIface.h>
00030 
00031 #include "kspread_doc.h"
00032 #include "kspread_map.h"
00033 
00034 #include <kapplication.h>
00035 #include <dcopclient.h>
00036 #include <qcolor.h>
00037 #include <kdebug.h>
00038 
00039 using namespace KSpread;
00040 
00041 DocIface::DocIface( Doc* _doc )
00042     : KoDocumentIface( _doc )
00043 {
00044     doc=_doc;
00045 }
00046 
00047 DCOPRef DocIface::map()
00048 {
00049     return DCOPRef( kapp->dcopClient()->appId(),
00050                     doc->map()->dcopObject()->objId() );
00051 }
00052 
00053 void DocIface::changeDefaultGridPenColor( const QColor &_col)
00054 {
00055     doc->setGridColor(_col);
00056 }
00057 
00058 QColor DocIface::pageBorderColor() const
00059 {
00060     return doc->pageBorderColor();
00061 }
00062 
00063 bool DocIface::showFormulaBar()const
00064 {
00065     return doc->getShowFormulaBar();
00066 }
00067 
00068 bool DocIface::showStatusBar()const
00069 {
00070     return doc->getShowStatusBar();
00071 }
00072 
00073 bool DocIface::showTabBar()const
00074 {
00075     return doc->getShowTabBar();
00076 }
00077 
00078 void DocIface::setShowVerticalScrollBar(bool _show)
00079 {
00080     doc->setShowVerticalScrollBar(_show);
00081     doc->refreshInterface();
00082 }
00083 
00084 void DocIface::setShowHorizontalScrollBar(bool _show)
00085 {
00086     doc->setShowHorizontalScrollBar(_show);
00087     doc->refreshInterface();
00088 }
00089 
00090 void DocIface::setShowColHeader(bool _show)
00091 {
00092     doc->setShowColHeader(_show);
00093     doc->refreshInterface();
00094 }
00095 
00096 void DocIface::setShowRowHeader(bool _show)
00097 {
00098     doc->setShowRowHeader(_show);
00099     doc->refreshInterface();
00100 }
00101 
00102 void DocIface::setShowTabBar(bool _show)
00103 {
00104     doc->setShowTabBar(_show);
00105     doc->refreshInterface();
00106 }
00107 
00108 void DocIface::changePageBorderColor( const QColor & _color)
00109 {
00110     doc->changePageBorderColor( _color);
00111     doc->refreshInterface();
00112 }
00113 
00114 void DocIface::addIgnoreWordAll( const QString &word)
00115 {
00116     doc->addIgnoreWordAll( word );
00117 }
00118 
00119 void DocIface::clearIgnoreWordAll( )
00120 {
00121     doc->clearIgnoreWordAll();
00122 }
00123 
00124 QStringList DocIface::spellListIgnoreAll() const
00125 {
00126     return doc->spellListIgnoreAll();
00127 }
00128 
00129 void DocIface::addStringCompletion(const QString & stringCompletion)
00130 {
00131     doc->addStringCompletion( stringCompletion );
00132 }
00133 
00134 int DocIface::zoom() const
00135 {
00136     return doc->zoom();
00137 }
00138 
00139 
00140 QString DocIface::moveToValue()const
00141 {
00142     switch(doc->getMoveToValue())
00143     {
00144     case Bottom:
00145         return QString("bottom");
00146         break;
00147     case Left:
00148         return QString("left");
00149         break;
00150     case Top:
00151         return QString("top");
00152         break;
00153     case Right:
00154         return QString("right");
00155         break;
00156     case BottomFirst:
00157         return QString("bottomFirst");
00158         break;
00159     }
00160     return QString::null;
00161 }
00162 
00163 void DocIface::setMoveToValue(const QString & move)
00164 {
00165     if ( move.lower()=="bottom" )
00166         doc->setMoveToValue(Bottom);
00167     else if ( move.lower()=="top" )
00168         doc->setMoveToValue(Top);
00169     else if ( move.lower()=="left" )
00170         doc->setMoveToValue(Left);
00171     else if ( move.lower()=="right" )
00172         doc->setMoveToValue(Right);
00173     else if ( move.lower()=="bottomfirst" )
00174         doc->setMoveToValue(BottomFirst);
00175 }
00176 
00177 void DocIface::setTypeOfCalc( const QString & calc )
00178 {
00179     if ( calc.lower()=="sum")
00180         doc->setTypeOfCalc(SumOfNumber );
00181     else if ( calc.lower()=="min")
00182         doc->setTypeOfCalc( Min );
00183     else if ( calc.lower()=="max")
00184         doc->setTypeOfCalc(Max );
00185     else if ( calc.lower()=="average")
00186         doc->setTypeOfCalc(Average );
00187     else if ( calc.lower()=="count")
00188         doc->setTypeOfCalc(Count );
00189     else if ( calc.lower()=="none")
00190         doc->setTypeOfCalc(NoneCalc );
00191     else
00192         kdDebug()<<"Error in setTypeOfCalc( const QString & calc ) :"<<calc<<endl;
00193     doc->refreshInterface();
00194 }
00195 
00196 QString DocIface::typeOfCalc() const
00197 {
00198     switch( doc->getTypeOfCalc() )
00199     {
00200     case SumOfNumber:
00201         return QString("sum");
00202         break;
00203     case Min:
00204         return QString("min");
00205         break;
00206     case Max:
00207         return QString("max");
00208         break;
00209     case Average:
00210         return QString("average");
00211         break;
00212     case Count:
00213         return QString("count");
00214         break;
00215     case NoneCalc:
00216     default:
00217        return QString("none");
00218        break;
00219     }
00220 }
00221 
KDE Home | KDE Accessibility Home | Description of Access Keys