kivio
KIvioDocIface.cc
00001 /* This file is part of the KDE project 00002 Copyright (C) 2001 Laurent MONTEL <lmontel@mandrakesoft.com> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #include "KIvioDocIface.h" 00021 00022 #include "kivio_doc.h" 00023 #include "kivio_map.h" 00024 #include <dcopclient.h> 00025 #include <kapplication.h> 00026 #include <kmainwindow.h> 00027 #include "kivio_grid_data.h" 00028 #include "kivio_config.h" 00029 00030 KIvioDocIface::KIvioDocIface( KivioDoc *doc_ ) 00031 : KoDocumentIface( doc_ ) 00032 { 00033 doc = doc_; 00034 } 00035 00036 DCOPRef KIvioDocIface::map() 00037 { 00038 return DCOPRef( kapp->dcopClient()->appId(), 00039 doc->map()->dcopObject()->objId() ); 00040 } 00041 00042 void KIvioDocIface::initConfig() 00043 { 00044 doc->initConfig(); 00045 } 00046 00047 void KIvioDocIface::saveConfig() 00048 { 00049 doc->saveConfig(); 00050 } 00051 00052 void KIvioDocIface::setShowGrid( bool b ) 00053 { 00054 Kivio::Config::setShowGrid(b); 00055 doc->updateButton(); 00056 doc->setModified( true ); 00057 } 00058 00059 bool KIvioDocIface::showGrid() const 00060 { 00061 KivioGridData d = doc->grid(); 00062 return d.isShow; 00063 } 00064 00065 int KIvioDocIface::undoRedoLimit() const 00066 { 00067 return doc->undoRedoLimit(); 00068 } 00069 00070 void KIvioDocIface::setUndoRedoLimit(int val) 00071 { 00072 doc->setUndoRedoLimit( val ); 00073 } 00074 00075 void KIvioDocIface::snapToGrid( bool b ) 00076 { 00077 Kivio::Config::setSnapGrid(b); 00078 doc->updateButton(); 00079 doc->setModified( true ); 00080 } 00081 00082 bool KIvioDocIface::isSnapToGrid() const 00083 { 00084 KivioGridData d = doc->grid(); 00085 return d.isSnap; 00086 }