~ubuntu-branches/ubuntu/vivid/juffed/vivid

« back to all changes in this revision

Viewing changes to src/Document.h

  • Committer: Bazaar Package Importer
  • Author(s): Maia Kozheva
  • Date: 2011-04-30 13:43:26 UTC
  • mfrom: (2.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20110430134326-0bnvvo5z2medbdxi
Tags: 0.9.1137-1
* New upstream release.
* Remove debian/juffed.1, added upstream (in debian.in).
* Remove debian/patches/static.patch: we can now bundle the .so after
  upstream has resolved soname issues.
* debian/control:
  - Bump Standards-Version to 0.9.2.
  - Update homepage.
  - Do not build-depend on chrpath, not needed anymore.
* debian/rules:
  - Remove chrpath rule, not needed anymore.
* Add juffed-dev and juffed-plugins packages.
* Do not install the libkeybindings.so plugin: causes a segfault on my
  amd64 machine.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
JuffEd - An advanced text editor
3
 
Copyright 2007-2009 Mikhail Murzin
4
 
 
5
 
This program is free software; you can redistribute it and/or
6
 
modify it under the terms of the GNU General Public License 
7
 
version 2 as published by the Free Software Foundation.
8
 
 
9
 
This program 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
12
 
GNU General Public License for more details.
13
 
 
14
 
You should have received a copy of the GNU General Public License
15
 
along with this program; if not, write to the Free Software
16
 
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17
 
*/
18
 
 
19
 
#ifndef _JUFF_DOCUMENT_H_
20
 
#define _JUFF_DOCUMENT_H_
21
 
 
22
 
class QWidget;
23
 
 
24
 
#include "Juff.h"
25
 
 
26
 
#include <QtCore/QString>
27
 
#include <QtCore/QDateTime>
28
 
#include <QtCore/QMutex>
29
 
#include <QtCore/QTimer>
30
 
 
31
 
namespace Juff {
32
 
        class DocHandler;
33
 
 
34
 
class Document : public QObject {
35
 
Q_OBJECT
36
 
friend class Juff::DocHandler;
37
 
public:
38
 
        Document(const QString&);
39
 
        virtual ~Document();
40
 
 
41
 
        QString fileName() const;
42
 
        QString type() const;
43
 
 
44
 
        virtual void init() {}
45
 
        virtual bool isModified() const = 0;
46
 
        virtual void setModified(bool) = 0;
47
 
        virtual QWidget* widget() = 0;
48
 
 
49
 
        virtual void setFileName(const QString& fileName);
50
 
        virtual bool save(const QString&, const QString&, QString& err);
51
 
        virtual void print() = 0;
52
 
        virtual void reload() = 0;
53
 
 
54
 
        //      TODO : make the following methods pure virtual
55
 
        virtual void undo() {}
56
 
        virtual void redo() {}
57
 
        virtual void cut() {}
58
 
        virtual void copy() {}
59
 
        virtual void paste() {}
60
 
 
61
 
        virtual void find(const QString&, const DocFindFlags&) {}
62
 
        virtual void replace(const QString&, const QString&, const DocFindFlags&) {}
63
 
 
64
 
        virtual QString text() const { return ""; }
65
 
        virtual QString text(int) const { return ""; }
66
 
        virtual QString wordUnderCursor() const { return ""; }
67
 
        virtual QString selectedText() const { return ""; }
68
 
        virtual void getCursorPos(int&, int&) const {}
69
 
        virtual void setCursorPos(int, int) {}
70
 
        virtual void getSelection(int&, int&, int&, int&) const {}
71
 
        virtual void setSelection(int, int, int, int) {}
72
 
        virtual void insertText(const QString&) {}
73
 
        virtual void removeSelectedText() {}
74
 
        virtual void replaceSelectedText(const QString&) {}
75
 
        virtual int curLine() const { return 0; }
76
 
        virtual void gotoLine(int) {}
77
 
        virtual int curScrollPos() const { return 0; }
78
 
        virtual void setScrollPos(int) {}
79
 
        virtual int lineCount() const { return 0; }
80
 
        virtual QString charset() const { return ""; }
81
 
        virtual void setCharset(const QString&, bool confirm = false) {}
82
 
        
83
 
        virtual void applySettings() {}
84
 
 
85
 
        /**
86
 
        *       Do not reimplement this method anywhere but at NullDoc class!
87
 
        */
88
 
        virtual bool isNull() const;
89
 
        
90
 
        virtual void updateActivated() {}
91
 
        virtual void addContextMenuActions(const ActionList&) {}
92
 
 
93
 
signals:
94
 
        void modified(bool);
95
 
        void fileNameChanged(const QString& oldFileName);
96
 
        void cursorPositionChanged(int, int);
97
 
        void contextMenuCalled(int, int);
98
 
        void linesCountChanged(int);
99
 
 
100
 
protected slots:
101
 
        void checkLastModified();
102
 
 
103
 
protected:
104
 
        QString type_;
105
 
        QString guessCharset() const;
106
 
 
107
 
private:
108
 
        QString fileName_;
109
 
        QDateTime lastModified_;
110
 
        QTimer* modCheckTimer_;
111
 
        QMutex checkingMutex_;
112
 
};
113
 
 
114
 
}       //      namespace Juff
115
 
 
116
 
#endif