diff --git a/src/findreplace/kfinddialog.h b/src/findreplace/kfinddialog.h index e672fbf..88f064a 100644 --- a/src/findreplace/kfinddialog.h +++ b/src/findreplace/kfinddialog.h @@ -1,234 +1,234 @@ /* Copyright (C) 2001, S.R.Haque . Copyright (C) 2002, David Faure This file is part of the KDE project This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2, as published by the Free Software Foundation. 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.LGPL-2. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KFINDDIALOG_H #define KFINDDIALOG_H #include "ktextwidgets_export.h" #include /** * @class KFindDialog kfinddialog.h * * @brief A generic "find" dialog. * * @author S.R.Haque * * \b Detail: * * This widget inherits from KDialog and implements * the following additional functionalities: a find string * object and an area for a user-defined widget to extend the dialog. * * \b Example: * * To use the basic modal find dialog, and then run the search: * * \code * KFindDialog dlg(....) * if ( dlg.exec() != QDialog::Accepted ) * return; * * // proceed with KFind from here * \endcode * * To create a non-modal find dialog: * \code * if ( m_findDia ) * KWindowSystem::activateWindow( m_findDia->winId() ); * else * { * m_findDia = new KFindDialog(false,...); * connect( m_findDia, SIGNAL(okClicked()), this, SLOT(findTextNext()) ); * } * \endcode * Don't forget to delete and reset m_findDia when closed. * (But do NOT delete your KFind object at that point, it's needed for "Find Next".) * * To use your own extensions: see findExtension(). * - * \image html kfinddialog.png "KDE Find Dialog" + * \image html kfinddialog.png "KFindDialog Widget" */ class KTEXTWIDGETS_EXPORT KFindDialog : public QDialog { Q_OBJECT public: /** * Construct a modal find dialog * * @param parent The parent object of this widget. * @param options A bitfield of the Options to be checked. * @param findStrings The find history, see findHistory() * @param hasSelection Whether a selection exists */ explicit KFindDialog(QWidget *parent = nullptr, long options = 0, const QStringList &findStrings = QStringList(), bool hasSelection = false, bool replaceDialog = false); /** * Destructor. */ virtual ~KFindDialog(); /** * Provide the list of @p strings to be displayed as the history * of find strings. @p strings might get truncated if it is * too long. * * @param history The find history. * @see findHistory */ void setFindHistory(const QStringList &history); /** * Returns the list of history items. * * @see setFindHistory */ QStringList findHistory() const; /** * Enable/disable the 'search in selection' option, depending * on whether there actually is a selection. * * @param hasSelection true if a selection exists */ void setHasSelection(bool hasSelection); /** * Hide/show the 'from cursor' option, depending * on whether the application implements a cursor. * * @param hasCursor true if the application features a cursor * This is assumed to be the case by default. */ void setHasCursor(bool hasCursor); /** * Enable/disable the 'Find backwards' option, depending * on whether the application supports it. * * @param supports true if the application supports backwards find * This is assumed to be the case by default. */ void setSupportsBackwardsFind(bool supports); /** * Enable/disable the 'Case sensitive' option, depending * on whether the application supports it. * * @param supports true if the application supports case sensitive find * This is assumed to be the case by default. */ void setSupportsCaseSensitiveFind(bool supports); /** * Enable/disable the 'Whole words only' option, depending * on whether the application supports it. * * @param supports true if the application supports whole words only find * This is assumed to be the case by default. */ void setSupportsWholeWordsFind(bool supports); /** * Enable/disable the 'Regular expression' option, depending * on whether the application supports it. * * @param supports true if the application supports regular expression find * This is assumed to be the case by default. */ void setSupportsRegularExpressionFind(bool supports); /** * Set the options which are checked. * * @param options The setting of the Options. * * @see options() * @see KFind::Options */ void setOptions(long options); /** * Returns the state of the options. Disabled options may be returned in * an indeterminate state. * * @see setOptions() * @see KFind::Options */ long options() const; /** * Returns the pattern to find. */ QString pattern() const; /** * Sets the pattern to find */ void setPattern(const QString &pattern); /** * Returns an empty widget which the user may fill with additional UI * elements as required. The widget occupies the width of the dialog, * and is positioned immediately below the regular expression support * widgets for the pattern string. */ QWidget *findExtension() const; Q_SIGNALS: /** * This signal is sent whenever one of the option checkboxes is toggled. * Call options() to get the new state of the checkboxes. */ void optionsChanged(); /** * This signal is sent when the user clicks on Ok button. */ void okClicked(); /** * This signal is sent when the user clicks on Cancel button. */ void cancelClicked(); protected: void showEvent(QShowEvent *) Q_DECL_OVERRIDE; private: friend class KReplaceDialog; friend class KReplaceDialogPrivate; class KFindDialogPrivate; KFindDialogPrivate *const d; Q_PRIVATE_SLOT(d, void _k_slotPlaceholdersAboutToShow()) Q_PRIVATE_SLOT(d, void _k_slotOk()) Q_PRIVATE_SLOT(d, void _k_slotReject()) Q_PRIVATE_SLOT(d, void _k_slotSelectedTextToggled(bool)) Q_PRIVATE_SLOT(d, void _k_showPatterns()) Q_PRIVATE_SLOT(d, void _k_showPlaceholders()) Q_PRIVATE_SLOT(d, void _k_textSearchChanged(const QString &)) }; #endif // KFINDDIALOG_H diff --git a/src/findreplace/kreplacedialog.h b/src/findreplace/kreplacedialog.h index 5f6b485..f4b76d2 100644 --- a/src/findreplace/kreplacedialog.h +++ b/src/findreplace/kreplacedialog.h @@ -1,148 +1,148 @@ /* Copyright (C) 2001, S.R.Haque . Copyright (C) 2002, David Faure This file is part of the KDE project This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2, as published by the Free Software Foundation. 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.LGPL-2. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KREPLACEDIALOG_H #define KREPLACEDIALOG_H #include "ktextwidgets_export.h" #include "kfinddialog.h" class KReplaceDialogPrivate; /** * @class KReplaceDialog kreplace.h * * @short A generic "replace" dialog. * * @author S.R.Haque * * \b Detail: * * This widget inherits from KFindDialog and implements * the following additional functionalities: a replacement string * object and an area for a user-defined widget to extend the dialog. * * \b Example: * * To use the basic replace dialog: * * \code * \endcode * * To use your own extensions: * * \code * \endcode * - * \image html kreplacedialog.png "KDE Replace Dialog" + * \image html kreplacedialog.png "KReplaceDialog Widget" */ class KTEXTWIDGETS_EXPORT KReplaceDialog: public KFindDialog { Q_OBJECT public: /// Options. enum Options { /// Should the user be prompted before the replace operation? PromptOnReplace = 256, BackReference = 512 }; /** * Construct a replace dialog.read-only or rather select-only combo box with a * parent object and a name. * * @param parent The parent object of this widget * @param options A bitfield of the Options to be enabled. * @param findStrings A QStringList to insert in the combo box of text to find * @param replaceStrings A QStringList to insert in the combo box of text to * replace with * @param hasSelection Whether a selection exists */ explicit KReplaceDialog(QWidget *parent = nullptr, long options = 0, const QStringList &findStrings = QStringList(), const QStringList &replaceStrings = QStringList(), bool hasSelection = true); /** * Destructor. */ virtual ~KReplaceDialog(); /** * Provide the list of @p strings to be displayed as the history * of replacement strings. @p strings might get truncated if it is * too long. * * @param history The replacement history. * @see replacementHistory */ void setReplacementHistory(const QStringList &history); /** * Returns the list of history items. * * @see setReplacementHistory */ QStringList replacementHistory() const; /** * Set the options which are enabled. * * @param options The setting of the Options. */ void setOptions(long options); /** * Returns the state of the options. Disabled options may be returned in * an indeterminate state. * * @see setOptions */ long options() const; /** * Returns the replacement string. */ QString replacement() const; /** * Returns an empty widget which the user may fill with additional UI * elements as required. The widget occupies the width of the dialog, * and is positioned immediately the regular expression support widgets * for the replacement string. */ QWidget *replaceExtension() const; protected: void showEvent(QShowEvent *) Q_DECL_OVERRIDE; private: KReplaceDialogPrivate *const d; Q_PRIVATE_SLOT(d, void _k_slotOk()) }; #endif // KREPLACEDIALOG_H diff --git a/src/widgets/krichtextedit.h b/src/widgets/krichtextedit.h index 63ff324..7f932e3 100644 --- a/src/widgets/krichtextedit.h +++ b/src/widgets/krichtextedit.h @@ -1,381 +1,381 @@ /** * krichtextedit.h * * Copyright 2007 Laurent Montel * Copyright 2008 Thomas McGuire * Copyright 2008 Stephen Kelly * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA */ #ifndef KRICHTEXTEDIT_H #define KRICHTEXTEDIT_H #include class QKeyEvent; class KRichTextEditPrivate; #include /** * @class KRichTextEdit krichtextedit.h * * The KRichTextEdit class provides a widget to edit and display rich text. * * It offers several additional rich text editing functions to KTextEdit and makes * them easier to access including: * * @li Changing fonts, sizes. * @li Font formatting, such as bold, underline, italic, foreground and * background color. * @li Paragraph alignment * @li Ability to edit and remove hyperlinks * @li Nested list handling * @li Simple actions to insert tables. TODO * * The KRichTextEdit can be in two modes: Rich text mode and plain text mode. * Calling functions which modify the format/style of the text will automatically * enable the rich text mode. Rich text mode is sometimes also referred to as * HTML mode. * * Do not call setAcceptRichText() or acceptRichText() yourself. Instead simply * connect to the slots which insert the rich text, use switchToPlainText() or * enableRichTextMode(). * - * \image html krichtextedit.png "KDE Rich Text Edit Widget" + * \image html krichtextedit.png "KRichTextEdit Widget" * * @since 4.1 */ class KTEXTWIDGETS_EXPORT KRichTextEdit : public KTextEdit { Q_OBJECT public: /** * The mode the edit widget is in. */ enum Mode { Plain, ///< Plain text mode Rich ///< Rich text mode }; /** * Constructs a KRichTextEdit object * * @param text The initial text of the text edit, which is interpreted as * HTML. * @param parent The parent widget */ explicit KRichTextEdit(const QString &text, QWidget *parent = nullptr); /** * Constructs a KRichTextEdit object. * * @param parent The parent widget */ explicit KRichTextEdit(QWidget *parent = nullptr); /** * Destructor. */ virtual ~KRichTextEdit(); /** * This enables rich text mode. Nothing is done except changing the internal * mode and allowing rich text pastes. */ void enableRichTextMode(); /** * @return The current text mode */ Mode textMode() const; /** * @return The plain text string if in plain text mode or the HTML code * if in rich text mode. The text is not word-wrapped. */ QString textOrHtml() const; /** * Replaces all the content of the text edit with the given string. * If the string is in rich text format, the text is inserted as rich text, * otherwise it is inserted as plain text. * * @param text The text to insert */ void setTextOrHtml(const QString &text); /** * Returns the text of the link at the current position or an empty string * if the cursor is not on a link. * * @sa currentLinkUrl * @return The link text */ QString currentLinkText() const; /** * Returns the URL target (href) of the link at the current position or an * empty string if the cursor is not on a link. * * @sa currentLinkText * @return The link target URL */ QString currentLinkUrl() const; /** * If the cursor is on a link, sets the @a cursor to a selection of the * text of the link. If the @a cursor is not on a link, selects the current word * or existing selection. * * @param cursor The cursor to use to select the text. * @sa updateLink */ void selectLinkText(QTextCursor *cursor) const; /** * Convenience function to select the link text using the active cursor. * * @sa selectLinkText */ void selectLinkText() const; /** * Replaces the current selection with a hyperlink with the link URL @a linkUrl * and the link text @a linkText. * * @sa selectLinkText * @sa currentLinkUrl * @sa currentLinkText * @param linkUrl The link will get this URL as href (target) * @param linkText The link will get this alternative text, which is the * text displayed in the text edit. */ void updateLink(const QString &linkUrl, const QString &linkText); /** * Returns true if the list item at the current position can be indented. * * @sa canDedentList */ bool canIndentList() const; /** * Returns true if the list item at the current position can be dedented. * * @sa canIndentList */ bool canDedentList() const; public Q_SLOTS: /** * Sets the alignment of the current block to Left Aligned */ void alignLeft(); /** * Sets the alignment of the current block to Centered */ void alignCenter(); /** * Sets the alignment of the current block to Right Aligned */ void alignRight(); /** * Sets the alignment of the current block to Justified */ void alignJustify(); /** * Sets the direction of the current block to Right-To-Left * * @since 4.6 */ void makeRightToLeft(); /** * Sets the direction of the current block to Left-To-Right * * @since 4.6 */ void makeLeftToRight(); /** * Sets the list style of the current list, or creates a new list using the * current block. The @a _styleindex corresponds to the QTextListFormat::Style * * @param _styleIndex The list will get this style */ void setListStyle(int _styleIndex); /** * Increases the nesting level of the current block or selected blocks. * * @sa canIndentList */ void indentListMore(); /** * Decreases the nesting level of the current block or selected blocks. * * @sa canDedentList */ void indentListLess(); /** * Sets the current word or selection to the font family @a fontFamily * * @param fontFamily The text's font family will be changed to this one */ void setFontFamily(const QString &fontFamily); /** * Sets the current word or selection to the font size @a size * * @param size The text's font will get this size */ void setFontSize(int size); /** * Sets the current word or selection to the font @a font * * @param font the font of the text will be set to this font */ void setFont(const QFont &font); /** * Toggles the bold formatting of the current word or selection at the current * cursor position. * * @param bold If true, the text will be set to bold */ void setTextBold(bool bold); /** * Toggles the italic formatting of the current word or selection at the current * cursor position. * * @param italic If true, the text will be set to italic */ void setTextItalic(bool italic); /** * Toggles the underline formatting of the current word or selection at the current * cursor position. * * @param underline If true, the text will be underlined */ void setTextUnderline(bool underline); /** * Toggles the strikeout formatting of the current word or selection at the current * cursor position. * * @param strikeOut If true, the text will be struck out */ void setTextStrikeOut(bool strikeOut); /** * Sets the foreground color of the current word or selection to @a color. * * @param color The text will get this background color */ void setTextForegroundColor(const QColor &color); /** * Sets the background color of the current word or selection to @a color. * * @param color The text will get this foreground color */ void setTextBackgroundColor(const QColor &color); /** * Inserts a horizontal rule below the current block. */ void insertHorizontalRule(); /** * This will switch the editor to plain text mode. * All rich text formatting will be destroyed. */ void switchToPlainText(); /** * This will clean some of the bad html produced by the underlying QTextEdit * It walks over all lines and cleans up a bit. Should be improved to produce * our own Html. */ QString toCleanHtml() const; /** * Toggles the superscript formatting of the current word or selection at the current * cursor position. * * @param superscript If true, the text will be set to superscript */ void setTextSuperScript(bool superscript); /** * Toggles the subscript formatting of the current word or selection at the current * cursor position. * * @param subscript If true, the text will be set to subscript */ void setTextSubScript(bool subscript); /** * @since 4.10 * Because of binary compatibility constraints, insertPlainText * is not virtual. Therefore it must dynamically detect and call this slot. */ void insertPlainTextImplementation(); Q_SIGNALS: /** * Emitted whenever the text mode is changed. * * @param mode The new text mode */ void textModeChanged(KRichTextEdit::Mode mode); /** * Emitted whenever the user has finished making a selection. (on mouse up) */ void selectionFinished(); protected: /** * Reimplemented. * Catches key press events. Used to handle some key presses on lists. */ void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE; private: //@cond PRIVATE KRichTextEditPrivate *const d; friend class KRichTextEditPrivate; //@endcond }; #endif diff --git a/src/widgets/krichtextwidget.h b/src/widgets/krichtextwidget.h index 437b2c4..8dcbeea 100644 --- a/src/widgets/krichtextwidget.h +++ b/src/widgets/krichtextwidget.h @@ -1,364 +1,364 @@ /* This file is part of the KDE libraries Copyright 2008 Stephen Kelly Copyright 2008 Thomas McGuire This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. 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.LGPL-2. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KRICHTEXTWIDGET_H #define KRICHTEXTWIDGET_H #include "krichtextedit.h" #include "ktextwidgets_export.h" class QAction; /** * @class KRichTextWidget krichtextwidget.h * * @brief A KRichTextEdit with common actions * * This class implements common actions which are often used with KRichTextEdit. * All you need to do is to call createActions(), and the actions will be * added to your KXMLGUIWindow. Remember to also add the chosen actions to * your application ui.rc file. * * See the KRichTextWidget::RichTextSupportValues enum for an overview of * supported actions. * * @author Stephen Kelly * @author Thomas McGuire * - * \image html krichtextedit.png "KDE Rich Text Widget" + * \image html krichtextedit.png "KRichTextWidget Widget" * * @since 4.1 */ class KTEXTWIDGETS_EXPORT KRichTextWidget : public KRichTextEdit { Q_OBJECT Q_PROPERTY(RichTextSupport richTextSupport READ richTextSupport WRITE setRichTextSupport) public: /** * These flags describe what actions will be created by createActions() after * passing a combination of these flags to setRichTextSupport(). */ enum RichTextSupportValues { /** * No rich text support at all, no actions will be created. Do not use * in combination with other flags. */ DisableRichText = 0x00, /** * Action to format the selected text as bold. If no text is selected, * the word under the cursor is formatted bold. * This is a KToggleAction. The status is automatically updated when * the text cursor is moved. */ SupportBold = 0x01, /** * Action to format the selected text as italic. If no text is selected, * the word under the cursor is formatted italic. * This is a KToggleAction. The status is automatically updated when * the text cursor is moved. */ SupportItalic = 0x02, /** * Action to underline the selected text. If no text is selected, * the word under the cursor is underlined. * This is a KToggleAction. The status is automatically updated when * the text cursor is moved. */ SupportUnderline = 0x04, /** * Action to strike out the selected text. If no text is selected, * the word under the cursor is struck out. * This is a KToggleAction. The status is automatically updated when * the text cursor is moved. */ SupportStrikeOut = 0x08, /** * Action to change the font family of the currently selected text. If * no text is selected, the font family of the word under the cursor is * changed. * Displayed as a combobox when inserted into the toolbar. * This is a KFontAction. The status is automatically updated when * the text cursor is moved. */ SupportFontFamily = 0x10, /** * Action to change the font size of the currently selected text. If no * text is selected, the font size of the word under the cursor is changed. * Displayed as a combobox when inserted into the toolbar. * This is a KFontSizeAction. The status is automatically updated when * the text cursor is moved. */ SupportFontSize = 0x20, /** * Action to change the text color of the currently selected text. If no * text is selected, the text color of the word under the cursor is * changed. * Opens a QColorDialog to select the color. */ SupportTextForegroundColor = 0x40, /** * Action to change the background color of the currently selected text. If no * text is selected, the backgound color of the word under the cursor is * changed. * Opens a QColorDialog to select the color. */ SupportTextBackgroundColor = 0x80, /** * A combination of all the flags above. * Includes all actions that change the format of the text. */ FullTextFormattingSupport = 0xff, /** * Action to make the current line a list element, change the * list style or remove list formatting. * Displayed as a combobox when inserted into a toolbar. * This is a KSelectAction. The status is automatically updated when * the text cursor is moved. */ SupportChangeListStyle = 0x100, /** * Action to increase the current list nesting level. This makes it * possible to create nested lists. */ SupportIndentLists = 0x200, /** * Action to decrease the current list nesting level. */ SupportDedentLists = 0x400, /** * All of the three list actions above. * Includes all list-related actions. */ FullListSupport = 0xf00, // Not implemented yet. // SupportCreateTables = 0x1000, // SupportChangeCellMargin = 0x2000, // SupportChangeCellPadding = 0x4000, // SupportChangeTableBorderWidth = 0x8000, // SupportChangeTableBorderColor = 0x10000, // SupportChangeTableBorderStyle = 0x20000, // SupportChangeCellBackground = 0x40000, // SupportCellFillPatterns = 0x80000, // // FullTableSupport = 0xff000, /** * Actions to align the current paragraph left, righ, center or justify. * These actions are KToogleActions. The status is automatically updated when * the text cursor is moved. */ SupportAlignment = 0x100000, // Not yet implemented SupportImages = 0x200000, /** * Action to insert a horizontal line. */ SupportRuleLine = 0x400000, /** * Action to convert the current text to a hyperlink. If no text is selected, * the word under the cursor is converted. * This action opens a dialog where the user can enter the link target. */ SupportHyperlinks = 0x800000, /** * Action to make the mouse cursor a format painter. The user can select * text with that painter. The selected text gets the same format as the * text that was previously selected. */ SupportFormatPainting = 0x1000000, /** * Action to change the text of the whole text edit to plain text. * All rich text formatting will get lost. */ SupportToPlainText = 0x2000000, /** * Actions to format text as superscript or subscript. If no text is selected, * the word under the cursor is formatted as selected. * This is a KToggleAction. The status is automatically updated when * the text cursor is moved. */ SupportSuperScriptAndSubScript = 0x4000000, // SupportChangeParagraphSpacing = 0x200000, /** * Action to change direction of text to Right-To-Left or Left-To-Right. */ SupportDirection = 0x8000000, /** * Includes all above actions for full rich text support */ FullSupport = 0xffffffff }; Q_DECLARE_FLAGS(RichTextSupport, RichTextSupportValues) Q_FLAG(RichTextSupport) /** * @brief Constructor * @param parent the parent widget */ explicit KRichTextWidget(QWidget *parent); /** * Constructs a KRichTextWidget object * * @param text The initial text of the text edit, which is interpreted as * HTML. * @param parent The parent widget */ explicit KRichTextWidget(const QString &text, QWidget *parent = nullptr); /** * @brief Destructor */ ~KRichTextWidget(); /** * @brief Creates the actions and adds them to the given action collection. * * Call this before calling setupGUI() in your application, but after * calling setRichTextSupport(). * * The XML file of your KXmlGuiWindow needs to have the action names in * them, so that the actions actually appear in the menu and in the toolbars. * * Below is a list of actions that are created,depending on the supported rich text * subset set by setRichTextSupport(). The list contains action names. * Those names need to be the same in your XML file. * * See the KRichTextWidget::RichTextSupportValues enum documentation for a * detailed explaination of each action. * * * * * * * * * * * * * * * * * * * * * * * * * *
XML NameRichTextSupportValues flag
format_text_foreground_colorSupportTextForegroundColor
format_text_background_colorSupportTextBackgroundColor
format_font_familySupportFontFamily
format_font_sizeSupportFontSize
format_text_boldSupportBold
format_text_italicSupportItalic
format_text_underlineSupportUnderline
format_text_strikeoutSupportStrikeOut
format_align_leftSupportAlignment
format_align_centerSupportAlignment
format_align_rightSupportAlignment
format_align_justifySupportAlignment
direction_ltrSupportDirection
direction_rtlSupportDirection
format_list_styleSupportChangeListStyle
format_list_indent_moreSupportIndentLists
format_list_indent_lessSupportDedentLists
insert_horizontal_ruleSupportRuleLine
manage_linkSupportHyperlinks
format_painterSupportFormatPainting
action_to_plain_textSupportToPlainText
format_text_subscript & format_text_superscriptSupportSuperScriptAndSubScript
* * @since 5.0 */ virtual QList createActions(); /** * @brief Sets the supported rich text subset available. * * The default is KRichTextWidget::FullSupport and will be set in the * constructor. * * You need to call createActions() afterwards. * * @param support The supported subset. */ void setRichTextSupport(const KRichTextWidget::RichTextSupport &support); /** * @brief Returns the supported rich text subset available. * @return The supported subset. */ RichTextSupport richTextSupport() const; /** * Tells KRichTextWidget to update the state of the actions created by * createActions(). * This is normally automatically done, but there might be a few cases where * you'll need to manually call this function. * * Call this function only after calling createActions(). */ void updateActionStates(); public Q_SLOTS: /** * Disables or enables all of the actions created by * createActions(). * This may be useful in cases where rich text mode may be set on or off. * * @param enabled Whether to enable or disable the actions. */ void setActionsEnabled(bool enabled); protected: /** * Reimplemented. * Catches mouse release events. Used to know when a selection has been completed. */ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; private: //@cond PRIVATE class Private; friend class Private; Private *const d; Q_PRIVATE_SLOT(d, void _k_setTextForegroundColor()) Q_PRIVATE_SLOT(d, void _k_setTextBackgroundColor()) Q_PRIVATE_SLOT(d, void _k_manageLink()) Q_PRIVATE_SLOT(d, void _k_formatPainter(bool)) Q_PRIVATE_SLOT(d, void _k_updateCharFormatActions(const QTextCharFormat &)) Q_PRIVATE_SLOT(d, void _k_updateMiscActions()) Q_PRIVATE_SLOT(d, void _k_setListStyle(int)) //@endcond }; Q_DECLARE_OPERATORS_FOR_FLAGS(KRichTextWidget::RichTextSupport) #endif diff --git a/src/widgets/ktextedit.h b/src/widgets/ktextedit.h index 7724d05..caa89cf 100644 --- a/src/widgets/ktextedit.h +++ b/src/widgets/ktextedit.h @@ -1,402 +1,402 @@ /* This file is part of the KDE libraries Copyright (C) 2002 Carsten Pfeiffer 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 KTEXTEDIT_H #define KTEXTEDIT_H #include "ktextwidgets_export.h" #include #include namespace Sonnet { class SpellCheckDecorator; } /** * @class KTextEdit ktextedit.h * * @short A KDE'ified QTextEdit * * This is just a little subclass of QTextEdit, implementing * some standard KDE features, like cursor auto-hiding, configurable * wheelscrolling (fast-scroll or zoom), spell checking and deleting of entire * words with Ctrl-Backspace or Ctrl-Delete. * * This text edit provides two ways of spell checking: background checking, * which will mark incorrectly spelled words red, and a spell check dialog, * which lets the user check and correct all incorrectly spelled words. * * Basic rule: whenever you want to use QTextEdit, use KTextEdit! * - * \image html ktextedit.png "KDE Text Edit Widget" + * \image html ktextedit.png "KTextEdit Widget" * * @see QTextEdit * @author Carsten Pfeiffer */ class KTEXTWIDGETS_EXPORT KTextEdit : public QTextEdit //krazy:exclude=qclasses { Q_OBJECT #ifndef KTEXTWIDGETS_NO_DEPRECATED Q_PROPERTY(QString clickMessage READ clickMessage WRITE setClickMessage) #endif Q_PROPERTY(bool checkSpellingEnabled READ checkSpellingEnabled WRITE setCheckSpellingEnabled) Q_PROPERTY(QString spellCheckingLanguage READ spellCheckingLanguage WRITE setSpellCheckingLanguage) public: /** * Constructs a KTextEdit object. See QTextEdit::QTextEdit * for details. */ explicit KTextEdit(const QString &text, QWidget *parent = nullptr); /** * Constructs a KTextEdit object. See QTextEdit::QTextEdit * for details. */ explicit KTextEdit(QWidget *parent = nullptr); /** * Destroys the KTextEdit object. */ ~KTextEdit(); /** * Reimplemented to set a proper "deactivated" background color. */ virtual void setReadOnly(bool readOnly); /** * Turns background spell checking for this text edit on or off. * Note that spell checking is only available in read-writable KTextEdits. * * Enabling spell checking will set back the current highlighter to the one * returned by createHighlighter(). * * @see checkSpellingEnabled() * @see isReadOnly() * @see setReadOnly() */ virtual void setCheckSpellingEnabled(bool check); /** * Returns true if background spell checking is enabled for this text edit. * Note that it even returns true if this is a read-only KTextEdit, * where spell checking is actually disabled. * By default spell checking is disabled. * * @see setCheckSpellingEnabled() */ virtual bool checkSpellingEnabled() const; /** * Returns true if the given paragraph or block should be spellcheck. * For example, a mail client does not want to check quoted text, and * would return false here (by checking whether the block starts with a * quote sign). * * Always returns true by default. * */ virtual bool shouldBlockBeSpellChecked(const QString &block) const; /** * Selects the characters at the specified position. Any previous * selection will be lost. The cursor is moved to the first character * of the new selection. * * @param length The length of the selection, in number of characters * @param pos The position of the first character of the selection */ void highlightWord(int length, int pos); /** * Allows to create a specific highlighter if reimplemented. * * By default, it creates a normal highlighter, based on the config * file given to setSpellCheckingConfigFileName(). * * This highlighter is set each time spell checking is toggled on by * calling setCheckSpellingEnabled(), but can later be overridden by calling * setHighlighter(). * * @see setHighlighter() * @see highlighter() * @see setSpellCheckingConfigFileName() */ virtual void createHighlighter(); /** * Returns the current highlighter, which is 0 if spell checking is disabled. * The default highlighter is the one created by createHighlighter(), but * might be overridden by setHighlighter(). * * @see setHighlighter() * @see createHighlighter() */ Sonnet::Highlighter *highlighter() const; /** * Sets a custom backgound spell highlighter for this text edit. * Normally, the highlighter returned by createHighlighter() will be * used to detect and highlight incorrectly spelled words, but this * function allows to set a custom highlighter. * * This has to be called after enabling spell checking with * setCheckSpellingEnabled(), otherwise it has no effect. * * Ownership is transferred to the KTextEdit * * @see highlighter() * @see createHighlighter() * @param highLighter the new highlighter which will be used now */ void setHighlighter(Sonnet::Highlighter *_highLighter); /** * Return standard KTextEdit popupMenu * @since 4.1 */ virtual QMenu *mousePopupMenu(); /** * Enable find replace action. * @since 4.1 */ void enableFindReplace(bool enabled); /** * @return the spell checking language which was set by * setSpellCheckingLanguage(), the spellcheck dialog or the spellcheck * config dialog, or an empty string if that has never been called. * @since 4.2 */ const QString &spellCheckingLanguage() const; /** * This makes the text edit display a grayed-out hinting text as long as * the user didn't enter any text. It is often used as indication about * the purpose of the text edit. * @deprecated since 5.0, use QTextEdit::setPlaceholderText instead */ #ifndef KTEXTWIDGETS_NO_DEPRECATED inline KTEXTWIDGETS_DEPRECATED void setClickMessage(const QString &msg) {setPlaceholderText(msg);} #endif /** * @return the message set with setClickMessage * @deprecated since 5.0, use QTextEdit::placeholderText instead */ #ifndef KTEXTWIDGETS_NO_DEPRECATED inline KTEXTWIDGETS_DEPRECATED QString clickMessage() const {return placeholderText();} #endif /** * @since 4.10 */ void showTabAction(bool show); /** * @since 4.10 */ void showAutoCorrectButton(bool show); /** * @since 4.10 * create a modal spellcheck dialogbox and spellCheckingFinished signal we sent when * we finish spell checking or spellCheckingCanceled signal when we cancel spell checking */ void forceSpellChecking(); Q_SIGNALS: /** * emit signal when we activate or not autospellchecking * * @since 4.1 */ void checkSpellingChanged(bool); /** * Signal sends when spell checking is finished/stopped/completed * @since 4.1 */ void spellCheckStatus(const QString &); /** * Emitted when the user changes the language in the spellcheck dialog * shown by checkSpelling() or when calling setSpellCheckingLanguage(). * * @param language the new language the user selected * @since 4.1 */ void languageChanged(const QString &language); /** * Emitted before the context menu is displayed. * * The signal allows you to add your own entries into the * the context menu that is created on demand. * * NOTE: Do not store the pointer to the QMenu * provided through since it is created and deleted * on demand. * * @param p the context menu about to be displayed * @since 4.5 */ void aboutToShowContextMenu(QMenu *menu); /** * @since 4.10 */ void spellCheckerAutoCorrect(const QString ¤tWord, const QString &autoCorrectWord); /** * signal spellCheckingFinished is sent when we finish spell check or we click on "Terminate" button in sonnet dialogbox * @since 4.10 */ void spellCheckingFinished(); /** * signal spellCheckingCanceled is sent when we cancel spell checking. * @since 4.10 */ void spellCheckingCanceled(); public Q_SLOTS: /** * Set the spell check language which will be used for highlighting spelling * mistakes and for the spellcheck dialog. * The languageChanged() signal will be emitted when the new language is * different from the old one. * * @since 4.1 */ void setSpellCheckingLanguage(const QString &language); /** * Show a dialog to check the spelling. The spellCheckStatus() signal * will be emitted when the spell checking dialog is closed. */ void checkSpelling(); /** * Opens a Sonnet::ConfigDialog for this text edit. * The spellcheck language of the config dialog is set to the current spellcheck * language of the textedit. If the user changes the language in that dialog, * the languageChanged() signal is emitted. * * @param configFileName The file which is used to store and load the config * settings * @param windowIcon the icon which is used for the titlebar of the spell dialog * window. Can be empty, then no icon is set. * * @since 4.2 */ void showSpellConfigDialog(const QString &windowIcon = QString()); /** * Create replace dialogbox * @since 4.1 */ void replace(); /** * Add custom spell checker decorator * @since 5.11 */ void addTextDecorator(Sonnet::SpellCheckDecorator *decorator); /** * @brief clearDecorator clear the spellcheckerdecorator * @since 5.11 */ void clearDecorator(); protected Q_SLOTS: /** * @since 4.1 */ void slotDoReplace(); void slotReplaceNext(); void slotDoFind(); void slotFind(); void slotFindNext(); /** * @since 5.11 */ void slotFindPrevious(); void slotReplace(); /** * @since 4.3 */ void slotSpeakText(); protected: /** * Reimplemented to catch "delete word" shortcut events. */ bool event(QEvent *) Q_DECL_OVERRIDE; /** * Reimplemented for internal reasons */ void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE; /** * Reimplemented to instantiate a KDictSpellingHighlighter, if * spellchecking is enabled. */ void focusInEvent(QFocusEvent *) Q_DECL_OVERRIDE; /** * Deletes a word backwards from the current cursor position, * if available. */ virtual void deleteWordBack(); /** * Deletes a word forwards from the current cursor position, * if available. */ virtual void deleteWordForward(); /** * Reimplemented from QTextEdit to add spelling related items * when appropriate. */ void contextMenuEvent(QContextMenuEvent *) Q_DECL_OVERRIDE; private: class Private; Private *const d; Q_PRIVATE_SLOT(d, void spellCheckerMisspelling(const QString &, int)) Q_PRIVATE_SLOT(d, void spellCheckerCorrected(const QString &, int, const QString &)) Q_PRIVATE_SLOT(d, void spellCheckerCanceled()) Q_PRIVATE_SLOT(d, void spellCheckerAutoCorrect(const QString &, const QString &)) Q_PRIVATE_SLOT(d, void spellCheckerFinished()) Q_PRIVATE_SLOT(d, void undoableClear()) Q_PRIVATE_SLOT(d, void toggleAutoSpellCheck()) Q_PRIVATE_SLOT(d, void slotAllowTab()) Q_PRIVATE_SLOT(d, void menuActivated(QAction *)) Q_PRIVATE_SLOT(d, void slotFindHighlight(const QString &, int, int)) Q_PRIVATE_SLOT(d, void slotReplaceText(const QString &, int, int, int)) }; #endif // KTEXTEDIT_H