~ubuntu-branches/ubuntu/vivid/kate/vivid-updates

« back to all changes in this revision

Viewing changes to ktexteditor/factory.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2014-12-04 16:49:41 UTC
  • mfrom: (1.6.6)
  • Revision ID: package-import@ubuntu.com-20141204164941-l3qbvsly83hhlw2v
Tags: 4:14.11.97-0ubuntu1
* New upstream release
* Update build-deps and use pkg-kde v3 for Qt 5 build
* kate-data now kate5-data for co-installability

Show diffs side-by-side

added added

removed removed

Lines of Context:
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)
4
 
 *
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.
9
 
 *
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.
14
 
 *
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.
19
 
 */
20
 
 
21
 
#ifndef KDELIBS_KTEXTEDITOR_FACTORY_H
22
 
#define KDELIBS_KTEXTEDITOR_FACTORY_H
23
 
 
24
 
#include <ktexteditor/ktexteditor_export.h>
25
 
// our main baseclass of the KTextEditor::Document
26
 
#include <kparts/factory.h>
27
 
 
28
 
/**
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.
33
 
 */
34
 
namespace KTextEditor
35
 
{
36
 
 
37
 
class Editor;
38
 
 
39
 
/**
40
 
 * \brief Accessor to the Editor implementation.
41
 
 *
42
 
 * Topics:
43
 
 *  - \ref factory_intro
44
 
 *  - \ref factory_example
45
 
 *  - \ref factory_notes
46
 
 *
47
 
 * \section factory_intro Introduction
48
 
 *
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.
52
 
 *
53
 
 * To access the Editor use editor().
54
 
 *
55
 
 * Each KTextEditor implementation must reimplement this factory to allow
56
 
 * access to the editor object.
57
 
 *
58
 
 * \section factory_example Creating an Editor Part
59
 
 * To get a kate part the following code snippet can be used:
60
 
 * \code
61
 
 * KLibFactory* factory = KLibLoader::self()->factory("katepart");
62
 
 * KTextEditor::Factory* kte_factory =
63
 
 *     qobject_cast<KTextEditor::Factory*>(factory);
64
 
 *
65
 
 * if(kte_factory) {
66
 
 *     // valid editor factory, it is possible to access the editor now
67
 
 *     KTextEditor::Editor* editor = kte_factory->editor();
68
 
 * } else {
69
 
 *     // error
70
 
 * }
71
 
 * \endcode
72
 
 * If another editor part is desired substitue the string "katepart" with the
73
 
 * corresponding library name.
74
 
 *
75
 
 * However, if you are only interested in getting the editor part (which is
76
 
 * usually the case) a simple call of
77
 
 * \code
78
 
 * KTextEditor::Editor* editor = KTextEditor::editor("katepart");
79
 
 * \endcode
80
 
 * is enough.
81
 
 *
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.
86
 
 *
87
 
 * \see KParts::Factory, KTextEditor::Editor
88
 
 * \author Christoph Cullmann \<cullmann@kde.org\>
89
 
 */
90
 
class KTEXTEDITOR_EXPORT Factory : public KParts::Factory
91
 
{
92
 
  Q_OBJECT
93
 
 
94
 
  public:
95
 
    /**
96
 
     * Constructor.
97
 
     *
98
 
     * Create a new Factory with \p parent.
99
 
     * \param parent parent object
100
 
     */
101
 
    Factory ( QObject *parent );
102
 
 
103
 
    /**
104
 
     * Virtual destructor.
105
 
     */
106
 
    virtual ~Factory ();
107
 
 
108
 
    /**
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
111
 
     * object exists.
112
 
     * \return global KTextEditor::Editor object
113
 
     */
114
 
    virtual Editor *editor () = 0;
115
 
 
116
 
  private:
117
 
    class FactoryPrivate* const d;
118
 
};
119
 
 
120
 
}
121
 
 
122
 
#endif
123
 
 
124
 
// kate: space-indent on; indent-width 2; replace-tabs on;