kspread

KSpreadDocIface.cpp
1/* This file is part of the KDE project
2
3 Copyright 2004 Ariya Hidayat <ariya@kde.org>
4 Copyright 2003 Norbert Andres <nandres@web.de>
5 Copyright 2002 Laurent Montel <montel@kde.org>
6 Copyright 2002 Simon Hausmann <hausmann@kde.org>
7 Copyright 2001-2002 Philipp Mueller <philipp.mueller@gmx.de>
8 Copyright 2000 Stephan Kulow <coolo@kde.org>
9 Copyright 1999-2000 David Faure <faure@kde.org>
10 Copyright 1999 Torben Weis <weis@kde.org>
11
12 This library is free software; you can redistribute it and/or
13 modify it under the terms of the GNU Library General Public
14 License as published by the Free Software Foundation; either
15 version 2 of the License, or (at your option) any later version.
16
17 This library is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Library General Public License for more details.
21
22 You should have received a copy of the GNU Library General Public License
23 along with this library; see the file COPYING.LIB. If not, write to
24 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 * Boston, MA 02110-1301, USA.
26*/
27
28#include "KSpreadDocIface.h"
29#include <KoDocumentIface.h>
30
31#include "kspread_doc.h"
32#include "kspread_map.h"
33
34#include <tdeapplication.h>
35#include <dcopclient.h>
36#include <tqcolor.h>
37#include <kdebug.h>
38
39using namespace KSpread;
40
41DocIface::DocIface( Doc* _doc )
42 : KoDocumentIface( _doc )
43{
44 doc=_doc;
45}
46
47DCOPRef DocIface::map()
48{
49 return DCOPRef( kapp->dcopClient()->appId(),
50 doc->map()->dcopObject()->objId() );
51}
52
53void DocIface::changeDefaultGridPenColor( const TQColor &_col)
54{
55 doc->setGridColor(_col);
56}
57
58TQColor DocIface::pageBorderColor() const
59{
60 return doc->pageBorderColor();
61}
62
63bool DocIface::showFormulaBar()const
64{
65 return doc->getShowFormulaBar();
66}
67
68bool DocIface::showStatusBar()const
69{
70 return doc->getShowStatusBar();
71}
72
73bool DocIface::showTabBar()const
74{
75 return doc->getShowTabBar();
76}
77
78void DocIface::setShowVerticalScrollBar(bool _show)
79{
80 doc->setShowVerticalScrollBar(_show);
81 doc->refreshInterface();
82}
83
84void DocIface::setShowHorizontalScrollBar(bool _show)
85{
86 doc->setShowHorizontalScrollBar(_show);
87 doc->refreshInterface();
88}
89
90void DocIface::setShowColHeader(bool _show)
91{
92 doc->setShowColHeader(_show);
93 doc->refreshInterface();
94}
95
96void DocIface::setShowRowHeader(bool _show)
97{
98 doc->setShowRowHeader(_show);
99 doc->refreshInterface();
100}
101
102void DocIface::setShowTabBar(bool _show)
103{
104 doc->setShowTabBar(_show);
105 doc->refreshInterface();
106}
107
108void DocIface::changePageBorderColor( const TQColor & _color)
109{
110 doc->changePageBorderColor( _color);
111 doc->refreshInterface();
112}
113
114void DocIface::addIgnoreWordAll( const TQString &word)
115{
116 doc->addIgnoreWordAll( word );
117}
118
119void DocIface::clearIgnoreWordAll( )
120{
121 doc->clearIgnoreWordAll();
122}
123
124TQStringList DocIface::spellListIgnoreAll() const
125{
126 return doc->spellListIgnoreAll();
127}
128
129void DocIface::addStringCompletion(const TQString & stringCompletion)
130{
131 doc->addStringCompletion( stringCompletion );
132}
133
134int DocIface::zoom() const
135{
136 return doc->zoom();
137}
138
139
140TQString DocIface::moveToValue()const
141{
142 switch(doc->getMoveToValue())
143 {
144 case Bottom:
145 return TQString("bottom");
146 break;
147 case Left:
148 return TQString("left");
149 break;
150 case Top:
151 return TQString("top");
152 break;
153 case Right:
154 return TQString("right");
155 break;
156 case BottomFirst:
157 return TQString("bottomFirst");
158 break;
159 }
160 return TQString();
161}
162
163void DocIface::setMoveToValue(const TQString & move)
164{
165 if ( move.lower()=="bottom" )
166 doc->setMoveToValue(Bottom);
167 else if ( move.lower()=="top" )
168 doc->setMoveToValue(Top);
169 else if ( move.lower()=="left" )
170 doc->setMoveToValue(Left);
171 else if ( move.lower()=="right" )
172 doc->setMoveToValue(Right);
173 else if ( move.lower()=="bottomfirst" )
174 doc->setMoveToValue(BottomFirst);
175}
176
177void DocIface::setTypeOfCalc( const TQString & calc )
178{
179 if ( calc.lower()=="sum")
180 doc->setTypeOfCalc(SumOfNumber );
181 else if ( calc.lower()=="min")
182 doc->setTypeOfCalc( Min );
183 else if ( calc.lower()=="max")
184 doc->setTypeOfCalc(Max );
185 else if ( calc.lower()=="average")
186 doc->setTypeOfCalc(Average );
187 else if ( calc.lower()=="count")
188 doc->setTypeOfCalc(Count );
189 else if ( calc.lower()=="none")
190 doc->setTypeOfCalc(NoneCalc );
191 else
192 kdDebug()<<"Error in setTypeOfCalc( const TQString & calc ) :"<<calc<<endl;
193 doc->refreshInterface();
194}
195
196TQString DocIface::typeOfCalc() const
197{
198 switch( doc->getTypeOfCalc() )
199 {
200 case SumOfNumber:
201 return TQString("sum");
202 break;
203 case Min:
204 return TQString("min");
205 break;
206 case Max:
207 return TQString("max");
208 break;
209 case Average:
210 return TQString("average");
211 break;
212 case Count:
213 return TQString("count");
214 break;
215 case NoneCalc:
216 default:
217 return TQString("none");
218 break;
219 }
220}
221
This class holds the data that makes up a spreadsheet.
Definition kspread_doc.h:98
The KSpread namespace.
Definition commands.h:39