editors/nedit/document.h
Go to the documentation of this file.00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2001 Harald Fernengel <harry@kdevelop.org> 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 version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00016 Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef _KNEDIT_DOCUMENT_INCLUDE_ 00020 #define _KNEDIT_DOCUMENT_INCLUDE_ 00021 00022 #include <qptrlist.h> 00023 #include <kaction.h> 00024 00025 #include <ktexteditor/document.h> 00026 #include <ktexteditor/view.h> 00027 #include <ktexteditor/editinterface.h> 00028 #include <ktexteditor/undointerface.h> 00029 #include <ktexteditor/cursorinterface.h> 00030 #include <ktexteditor/selectioninterface.h> 00031 #include <ktexteditor/blockselectioninterface.h> 00032 #include <ktexteditor/searchinterface.h> 00033 #include <ktexteditor/highlightinginterface.h> 00034 #include <ktexteditor/configinterface.h> 00035 #include <ktexteditor/markinterface.h> 00036 #include <ktexteditor/wordwrapinterface.h> 00037 #include <ktexteditor/printinterface.h> 00038 00039 class QProcess; 00040 class QTimer; 00041 class KWinModule; 00042 00043 namespace KNEdit 00044 { 00045 00046 class View; 00047 00050 class Document : public KTextEditor::Document, KTextEditor::HighlightingInterface 00051 { 00052 Q_OBJECT 00053 00054 public: 00055 Document(bool bReadOnly=false, bool bSingleView=false, QWidget *parentWidget = 0, const char *widgetName = 0, QObject *parent = 0, const char *name = 0); 00056 virtual ~Document(); 00057 00058 // KTextEditor stuff 00059 KTextEditor::View *createView( QWidget *parent, const char *name ); 00060 QPtrList<KTextEditor::View> views() const { return _views; } 00061 00062 // KParts::ReadWrite stuff 00063 bool openFile(); 00064 bool saveFile(); 00065 00066 QString filename() const { return m_file; } 00067 QString serverName() const { return m_serverName; } 00068 bool isReady() const { return m_isReady; } 00069 void invokeNC( const QString& command, bool appendFilename = true ); 00070 void addView(KTextEditor::View *view); 00071 void removeView(KTextEditor::View *view); 00072 00073 // KTextEditor::HighlightingInterface stuff 00074 uint hlMode (); 00075 bool setHlMode (uint mode); 00076 uint hlModeCount (); 00077 QString hlModeName (uint mode); 00078 QString hlModeSectionName (uint mode); 00079 00080 public slots: 00081 void processExited(); 00082 void launchFinished(WId); 00083 00084 signals: 00085 void hlChanged(); 00086 00087 private slots: 00088 void checkForNEditServer(); 00089 00090 private: 00091 void processCommands(); 00092 void serverReady( WId wid ); 00093 00094 private: 00095 QValueList<WId> m_widCache; 00096 QPtrList<KTextEditor::View> _views; 00097 KTextEditor::View *activeView; 00098 QProcess *proc; 00099 bool m_singleView, m_readOnly; 00100 bool m_isReady; 00101 QString m_serverName; 00102 KWinModule *m_kwm; 00103 WId m_wid; 00104 QStringList m_commands; 00105 QTimer *m_timer; 00106 }; 00107 00108 }; 00109 00110 #endif 00111