1
/* This file is part of the KDE libraries
2
* Copyright (C) 2005 Christoph Cullmann <cullmann@kde.org>
3
* Copyright (C) 2005 Dominik Haumann (dhdev@gmx.de) (documentation)
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Library General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Library General Public License for more details.
15
* You should have received a copy of the GNU Library General Public License
16
* along with this library; see the file COPYING.LIB. If not, write to
17
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
* Boston, MA 02110-1301, USA.
21
#ifndef KDELIBS_KTEXTEDITOR_FACTORY_H
22
#define KDELIBS_KTEXTEDITOR_FACTORY_H
24
#include <ktexteditor/ktexteditor_export.h>
25
// our main baseclass of the KTextEditor::Document
26
#include <kparts/factory.h>
29
* Namespace for the KDE Text Editor Interfaces.
30
* These interfaces provide easy access to editor parts for the
31
* applications embedding them. At the moment they are at least
32
* supported by both the Kate Part and the Yzis Part.
40
* \brief Accessor to the Editor implementation.
43
* - \ref factory_intro
44
* - \ref factory_example
45
* - \ref factory_notes
47
* \section factory_intro Introduction
49
* The Factory provides access to the chosen Editor (selected with
50
* KTextEditor::EditorChooser). The Editor itself then provides methods
51
* to handle documents and config options.
53
* To access the Editor use editor().
55
* Each KTextEditor implementation must reimplement this factory to allow
56
* access to the editor object.
58
* \section factory_example Creating an Editor Part
59
* To get a kate part the following code snippet can be used:
61
* KLibFactory* factory = KLibLoader::self()->factory("katepart");
62
* KTextEditor::Factory* kte_factory =
63
* qobject_cast<KTextEditor::Factory*>(factory);
66
* // valid editor factory, it is possible to access the editor now
67
* KTextEditor::Editor* editor = kte_factory->editor();
72
* If another editor part is desired substitue the string "katepart" with the
73
* corresponding library name.
75
* However, if you are only interested in getting the editor part (which is
76
* usually the case) a simple call of
78
* KTextEditor::Editor* editor = KTextEditor::editor("katepart");
82
* \section factory_notes Notes
83
* It is recommend to use the EditorChooser to get the used editor part. This
84
* way the user can choose the editor implementation. The Factory itself is
85
* not needed to get the Editor with the help of the EditorChooser.
87
* \see KParts::Factory, KTextEditor::Editor
88
* \author Christoph Cullmann \<cullmann@kde.org\>
90
class KTEXTEDITOR_EXPORT Factory : public KParts::Factory
98
* Create a new Factory with \p parent.
99
* \param parent parent object
101
Factory ( QObject *parent );
104
* Virtual destructor.
109
* Get the global Editor object. The editor part implementation \e must
110
* ensure that this object lives as long as any factory or document
112
* \return global KTextEditor::Editor object
114
virtual Editor *editor () = 0;
117
class FactoryPrivate* const d;
124
// kate: space-indent on; indent-width 2; replace-tabs on;