kword

KWordViewIface.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2001 Laurent Montel <lmontel@mandrakesoft.com>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#include "KWordViewIface.h"
21
22#include <kurl.h>
23
24#include "KWView.h"
25#include "KWCanvas.h"
26#include "KWDocument.h"
27#include "KWFrameSet.h"
28
29#include <dcopclient.h>
30
31KWordViewIface::KWordViewIface( KWView *view_ )
32 : KoViewIface( view_ )
33{
34 view = view_;
35}
36
37void KWordViewIface::fileStatistics()
38{
39 view->fileStatistics();
40}
41
42void KWordViewIface::editFind()
43{
44 view->editFind();
45}
46
47void KWordViewIface::editReplace()
48{
49 view->editReplace();
50}
51
52void KWordViewIface::editCustomVars()
53{
54 view->editCustomVars();
55}
56
57void KWordViewIface::editMailMergeDataBase()
58{
59 view->editMailMergeDataBase();
60}
61
62void KWordViewIface::viewPageMode()
63{
64 view->viewPageMode();
65}
66
67void KWordViewIface::viewPreviewMode()
68{
69 view->viewPreviewMode();
70}
71
72void KWordViewIface::configure()
73{
74 view->configure();
75}
76
77void KWordViewIface::spelling()
78{
79 view->slotSpellCheck();
80}
81
82void KWordViewIface::autoFormat()
83{
84 view->extraAutoFormat();
85}
86
87void KWordViewIface::stylist()
88{
89 view->extraStylist();
90}
91
92void KWordViewIface::createTemplate()
93{
94 view->extraCreateTemplate();
95}
96
97void KWordViewIface::insertTable()
98{
99 view->insertTable();
100}
101
102void KWordViewIface::insertPicture()
103{
104 view->insertPicture();
105}
106
107static KoPicture picture( const TQString& fileName )
108{
109 KoPicture picture;
110 KoPictureKey key;
111 key.setKeyFromFile( fileName );
112 picture.setKey( key );
113 picture.loadFromFile( fileName );
114 return picture;
115}
116
117void KWordViewIface::insertPictureFromFile( TQString fileName, double x, double y, int w, int h )
118{
119 view->getGUI()->canvasWidget()->insertPictureDirect( picture( fileName ), KoPoint( x, y ), TQSize(w, h) );
120}
121
122void KWordViewIface::insertInlinePicture( TQString fileName, int w, int h )
123{
124 view->insertPicture( picture( fileName ), true /*makeInline*/, true /*keepRatio*/, w, h );
125 view->getGUI()->canvasWidget()->insertInlinePicture();
126}
127
128void KWordViewIface::formatPage()
129{
130 view->formatPage();
131}
132
133void KWordViewIface::toolsPart()
134{
135 view->toolsPart();
136}
137
138double KWordViewIface::zoom()
139{
140 return view->kWordDocument()->zoom();
141}
142
143
144void KWordViewIface::setZoom( int zoom)
145{
146 view->showZoom( zoom ); // share the same zoom
147 view->setZoom( zoom,true);
148 view->kWordDocument()->updateZoomRuler();
149}
150
151void KWordViewIface::editPersonalExpression()
152{
153 view->editPersonalExpr();
154}
155
156void KWordViewIface::insertLink()
157{
158 view->insertLink();
159}
160
161void KWordViewIface::insertFormula()
162{
163 view->insertFormula();
164}
165
166void KWordViewIface::formatFont()
167{
168 view->formatFont();
169}
170
171void KWordViewIface::formatParagraph()
172{
173 view->formatParagraph();
174}
175
176void KWordViewIface::raiseFrame()
177{
178 view->raiseFrame();
179}
180
181void KWordViewIface::lowerFrame()
182{
183 view->lowerFrame();
184}
185
186void KWordViewIface::bringToFront()
187{
188 view->bringToFront();
189}
190
191void KWordViewIface::sendToBack()
192{
193 view->sendToBack();
194}
195
196
197void KWordViewIface::applyAutoFormat()
198{
199 view->applyAutoFormat();
200}
201
202
203void KWordViewIface::createStyleFromSelection()
204{
205 view->createStyleFromSelection();
206}
207
208int KWordViewIface::tableSelectCell(const TQString &name, uint row, uint col)
209{
210 return view->tableSelectCell(name, row, col);
211}
212
213void KWordViewIface::tableInsertRow()
214{
215 view->tableInsertRow();
216}
217
218void KWordViewIface::tableInsertRow(uint row)
219{
220 view->tableInsertRow(row);
221}
222
223void KWordViewIface::tableInsertCol()
224{
225 view->tableInsertCol();
226}
227
228void KWordViewIface::tableInsertCol(uint col)
229{
230 view->tableInsertCol(col);
231}
232
233void KWordViewIface::tableResizeCol()
234{
235 view->tableResizeCol();
236}
237
238void KWordViewIface::tableDeleteRow()
239{
240 view->tableDeleteRow();
241}
242
243int KWordViewIface::tableDeleteRow(uint row)
244{
245 TQValueList<uint> list;
246 list.append(row);
247 return view->tableDeleteRow(list);
248}
249
250void KWordViewIface::tableDeleteCol()
251{
252 view->tableDeleteCol();
253}
254
255int KWordViewIface::tableDeleteCol(uint col)
256{
257 TQValueList<uint> list;
258 list.append(col);
259 return view->tableDeleteCol(list);
260}
261
262void KWordViewIface::tableJoinCells()
263{
264 view->tableJoinCells();
265}
266
267void KWordViewIface::tableSplitCells()
268{
269 view->tableSplitCells();
270}
271
272void KWordViewIface::tableSplitCells(uint rows, uint cols)
273{
274 view->tableSplitCells(cols, rows);
275}
276
277void KWordViewIface::tableUngroupTable()
278{
279 view->tableUngroupTable();
280}
281
282void KWordViewIface::insertFootNote()
283{
284 view->insertFootNote();
285}
286
287int KWordViewIface::configTableRows() const
288{
289 return (int)view->getGUI()->canvasWidget()->tableRows();
290}
291
292int KWordViewIface::configTableCols() const
293{
294 return (int)view->getGUI()->canvasWidget()->tableCols();
295}
296
297bool KWordViewIface::configTableIsFloating() const
298{
299 return view->getGUI()->canvasWidget()->tableIsFloating();
300}
301
302TQString KWordViewIface::configTableTemplateName() const
303{
304 return view->getGUI()->canvasWidget()->tableTemplateName();
305}
306
307void KWordViewIface::setConfigTableTemplateName(const TQString &_name)
308{
309 view->getGUI()->canvasWidget()->setTableTemplateName( _name );
310}
311
312void KWordViewIface::selectAllFrames()
313{
314 view->getGUI()->canvasWidget()->selectAllFrames(true);
315}
316
317void KWordViewIface::unSelectAllFrames()
318{
319 view->getGUI()->canvasWidget()->selectAllFrames(false);
320}
321
322
323void KWordViewIface::editFootEndNote()
324{
325 view->editFootEndNote();
326}
327
328void KWordViewIface::savePicture()
329{
330 view->savePicture();
331}
332
333void KWordViewIface::insertFile()
334{
335 view->insertFile();
336}
337
338void KWordViewIface::tableStylist()
339{
340 view->tableStylist();
341}
342
343void KWordViewIface::addBookmark()
344{
345 view->addBookmark();
346}
347
348void KWordViewIface::selectBookmark()
349{
350 view->selectBookmark();
351}
352
353void KWordViewIface::tableProperties()
354{
355 view->tableProperties();
356}
357
358void KWordViewIface::importStyle()
359{
360 view->importStyle();
361}
362
363// ### TODO: network transparency
364void KWordViewIface::insertFile(const TQString & path)
365{
366
367 KURL url;
368 url.setPath( path );
369 view->insertFile( url );
370}
371
372void KWordViewIface::createFrameStyle()
373{
374 view->createFrameStyle();
375}
376
377void KWordViewIface::setPictureInline( bool _inline)
378{
379 view->getGUI()->canvasWidget()->setPictureInline( _inline);
380}
381
382bool KWordViewIface::pictureInline() const
383{
384 return view->getGUI()->canvasWidget()->pictureInline();
385}
386
387void KWordViewIface::setPictureKeepRatio( bool _keep)
388{
389 view->getGUI()->canvasWidget()->setPictureKeepRatio( _keep);
390}
391
392bool KWordViewIface::pictureKeepRatio() const
393{
394 return view->getGUI()->canvasWidget()->pictureKeepRatio();
395}
396
397void KWordViewIface::changeAutoSpellCheckStatus(bool b)
398{
399 view->autoSpellCheck(b);
400}
401
402void KWordViewIface::deselectAllFrames()
403{
404 view->deselectAllFrames();
405}
406
407int KWordViewIface::currentPage()
408{
409 return view->currentPage();
410}
411
412void KWordViewIface::convertTableToText()
413{
414 view->convertTableToText();
415}
416
417void KWordViewIface::convertToTextBox()
418{
419 view->convertToTextBox();
420}
421
422void KWordViewIface::addIgnoreAllWord()
423{
424 view->slotAddIgnoreAllWord();
425}
426
427void KWordViewIface::addPersonalExpression()
428{
429 view->addPersonalExpression();
430}
431
432void KWordViewIface::addWordToDictionary()
433{
434 view->addWordToDictionary();
435}
436
437void KWordViewIface::sortText()
438{
439 view->sortText();
440}
441
442void KWordViewIface::insertPage()
443{
444 view->insertPage();
445}
446
447void KWordViewIface::createLinkedFrame()
448{
449 view->createLinkedFrame();
450}
451
452
453void KWordViewIface::lineBreak()
454{
455 view->slotLineBreak();
456}
457
458void KWordViewIface::increaseNumberingLevel()
459{
460 view->slotIncreaseNumberingLevel();
461}
462
463void KWordViewIface::decreaseNumberingLevel()
464{
465 view->slotDecreaseNumberingLevel();
466}