/usr/include/KF5/KParts/kparts/textextension.h is in libkf5parts-dev 5.18.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | /* This file is part of the KDE project
Copyright (C) 2010 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KPARTS_TEXTEXTENSION_H
#define KPARTS_TEXTEXTENSION_H
#include <kparts/kparts_export.h>
#include <kfind.h>
#include <QObject>
namespace KParts
{
class ReadOnlyPart;
class TextExtensionPrivate;
/**
* @short an extension for KParts that allows to retrieve text from the part.
*
* For instance, the text-to-speech plugin uses this to speak the whole text
* from the part or the selected text. The translation plugin uses it for
* translating the selected text, and so on.
*
* @since 4.6
*/
class KPARTS_EXPORT TextExtension : public QObject
{
Q_OBJECT
public:
TextExtension(KParts::ReadOnlyPart *parent);
~TextExtension();
/**
* Queries @p obj for a child object which inherits from this
* TextExtension class.
*/
static TextExtension *childObject(QObject *obj);
enum Format { PlainText, HTML };
/**
* Returns true if the user selected text in the part.
*/
virtual bool hasSelection() const;
/**
* Returns the selected text, in the requested format.
* If the format is not supported, the part must return an empty string.
*/
virtual QString selectedText(Format format) const;
/**
* Returns the complete text shown in the part, in the requested format.
* If the format is not supported, the part must return an empty string.
*/
virtual QString completeText(Format format) const;
/**
* Returns the number of pages, for parts who support the concept of pages.
* Otherwise returns 0.
*/
virtual int pageCount() const;
/**
* Returns the current page (between 0 and pageCount()-1),
* for parts who support the concept of pages.
* Otherwise returns 0.
*/
virtual int currentPage() const;
/**
* Returns the text in a given page, in the requested format.
*/
virtual QString pageText(Format format) const;
/**
* Returns true if @p string is found using the given @p options.
*
* If any text matches @p string, then it will be selected/highlighted.
* To find the next matching text, simply call this function again with the
* same search text until it returns false.
*
* To clear a selection, just pass an empty string.
*
* Note that parts that implement this extension might not support all the
* options available in @ref KFind::SearchOptions.
*/
virtual bool findText(const QString &string, KFind::SearchOptions options) const;
// for future extensions can be made via slots
Q_SIGNALS:
/**
* This signal is emitted when the selection changes.
*/
void selectionChanged();
private:
// for future extensions
TextExtensionPrivate *const d;
};
}
#endif /* KPARTS_TEXTEXTENSION_H */
|