KIvioDocIface.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 "KIvioDocIface.h"
21
22#include "kivio_doc.h"
23#include "kivio_map.h"
24#include <dcopclient.h>
25#include <tdeapplication.h>
26#include <tdemainwindow.h>
27#include "kivio_grid_data.h"
28#include "kivio_config.h"
29
30KIvioDocIface::KIvioDocIface( KivioDoc *doc_ )
31 : KoDocumentIface( doc_ )
32{
33 doc = doc_;
34}
35
36DCOPRef KIvioDocIface::map()
37{
38 return DCOPRef( kapp->dcopClient()->appId(),
39 doc->map()->dcopObject()->objId() );
40}
41
42void KIvioDocIface::initConfig()
43{
44 doc->initConfig();
45}
46
47void KIvioDocIface::saveConfig()
48{
49 doc->saveConfig();
50}
51
52void KIvioDocIface::setShowGrid( bool b )
53{
54 Kivio::Config::setShowGrid(b);
55 doc->updateButton();
56 doc->setModified( true );
57}
58
59bool KIvioDocIface::showGrid() const
60{
61 KivioGridData d = doc->grid();
62 return d.isShow;
63}
64
65int KIvioDocIface::undoRedoLimit() const
66{
67 return doc->undoRedoLimit();
68}
69
70void KIvioDocIface::setUndoRedoLimit(int val)
71{
72 doc->setUndoRedoLimit( val );
73}
74
75void KIvioDocIface::snapToGrid( bool b )
76{
77 Kivio::Config::setSnapGrid(b);
78 doc->updateButton();
79 doc->setModified( true );
80}
81
82bool KIvioDocIface::isSnapToGrid() const
83{
84 KivioGridData d = doc->grid();
85 return d.isSnap;
86}