summaryrefslogtreecommitdiffstats
path: root/src/kbibtex_part.h
blob: eab599d8eb4e2916db2c422ceecd11250707ce7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/***************************************************************************
*   Copyright (C) 2004-2006 by Thomas Fischer                             *
*   [email protected]                                             *
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
*                                                                         *
*   This program is distributed in the hope that it will be useful,       *
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
*   GNU General Public License for more details.                          *
*                                                                         *
*   You should have received a copy of the GNU General Public License     *
*   along with this program; if not, write to the                         *
*   Free Software Foundation, Inc.,                                       *
*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
***************************************************************************/

#ifndef _KBIBTEXPART_H_
#define _KBIBTEXPART_H_

#include <tdeparts/part.h>
#include <tdeparts/factory.h>

#include <element.h>
#include <xsltransform.h>
#include <documentwidget.h>
#include <settingsdlg.h>

class TQWidget;
class TQTextEdit;
class TQFile;
class TQLabel;
class TQTabWidget;
class TQPainter;
class TQListViewItem;
class TQProgressDialog;
class KURL;
class TDEListView;
class TDEAction;
class TDEActionMenu;
class TDEToggleAction;
class TDEMainWindow;

class KBibTeXPart : public KParts::ReadWritePart
{
    Q_OBJECT

public:
    KBibTeXPart( TQWidget *parentWidget, const char *widgetName,
                 TQObject *parent, const char *name );

    virtual ~KBibTeXPart();

    void setReadWrite( bool rw );

    void setModified( bool modified );

    bool saveAs();
    bool queryClose();
    virtual bool closeURL();

public slots:
    virtual bool save();

signals:
    void signalAddRecentURL( const KURL& );

protected:
    virtual bool openFile();
    virtual bool saveFile();

protected slots:
    void slotFileSaveAs();
    void slotFileMerge();
    void slotFileExport();
    void slotFileStatistics();
    void slotFileFindDups();
    void slotPreferences();

private slots:
    bool slotNewElement();
    void slotSearchWebsites( int id );
    void slotToggleShowSpecialElements();
    void slotDeferredInitialization();
    void slotUpdateMenu( int numSelectedItems );
    void slotUndoChanged( bool undoAvailable );
    void slotUseInPipe();

private:
    enum SearchDirection
    {
        sdForward, sdBackward
    };
    enum SaveStatus
    {
        ssSave, ssExport, ssFailed
    };

    int m_defInitCounter;
    TQLabel *m_preview;
    TQProgressDialog *m_progressDialog;
    KBibTeX::DocumentWidget *m_documentWidget;
    KBibTeX::SettingsDlg *m_settingsDlg;
    TDEAction *m_actionFileMerge;
    TDEAction *m_actionFileExport;
    TDEAction *m_actionFileStatistics;
    TDEAction *m_actionFileFindDups;
    TDEAction *m_actionEditUndo;
    TDEAction *m_actionElementSendToLyX;
    TDEAction *m_actionEditElement;
    TDEAction *m_actionDeleteElement;
    TDEAction *m_actionEditCut;
    TDEAction *m_actionEditCopy;
    TDEAction *m_actionEditCopyRef;
    TDEAction *m_actionEditPaste;
    TDEAction *m_actionEditSelectAll;
    TDEAction *m_actionEditFind;
    TDEAction *m_actionEditFindNext;
    TDEAction *m_actionPreferences;
    TDEAction *m_actionSearchOnlineDatabases;
    TDEActionMenu *m_actionViewDocument;
    TDEAction *m_actionViewFirstDocument;
    TDEAction *m_actionViewDocumentOnlineRef;
    TDEActionMenu *m_actionAssignKeywords;
    TDEAction *m_actionNormalizeIds;
    TDEActionMenu *m_actionMenuSearchWebsites;
    TDEActionMenu *m_actionViewShowColumns;
    TDEAction *m_actionSearchNCBI;
    TDEToggleAction *m_actionUseInPipe;
    TDEToggleAction *m_actionShowComments;
    TDEToggleAction *m_actionShowMacros;
    TDEMainWindow *m_mainWindow;
    TQValueList<KBibTeX::WebQuery*> webQueryList;
    bool m_initializationDone;
    TQFile *m_inPipe;

    void readSettings();
    void writeSettings();

    void setupGUI( TQWidget *parentWidget, const char *name );
    void setupActions();

signals:
    void progressCancel();
};

class TDEInstance;
class TDEAboutData;

class KBibTeXPartFactory : public KParts::Factory
{
    Q_OBJECT
public:
    KBibTeXPartFactory();
    virtual ~KBibTeXPartFactory();
    virtual KParts::Part* createPartObject( TQWidget * parentWidget, const char * widgetName,
                                            TQObject * parent, const char * name,
                                            const char * classname, const TQStringList & /* args */ );
    static TDEInstance* instance();

private:
    static TDEInstance* s_instance;
    static TDEAboutData* s_about;
};

#endif // _KBIBTEXPART_H_