13#include <ktexteditor/linerange.h>
14#include <ktexteditor/mainwindow.h>
15#include <ktexteditor/view.h>
17#include <QJsonDocument>
23#include "katetextfolding.h"
24#include "katetextrange.h"
30class InlineNoteProvider;
39class KateRendererConfig;
42class KateSpellCheckDialog;
44class KateViewInternal;
48class KateDictionaryBar;
49class KateSpellingMenu;
53class KateViewEncodingAction;
55class KateAbstractInputMode;
80 friend class ::KateViewInternal;
81 friend class ::KateIconBorder;
82 friend class ::KateTextPreview;
83 friend MulticursorTest;
87 ~ViewPrivate()
override;
100 ViewMode viewMode()
const override;
101 QString viewModeHuman()
const override;
102 InputMode viewInputMode()
const override;
103 QString viewInputModeHuman()
const override;
105 void setViewInputMode(InputMode mode)
override
110 void setInputMode(InputMode mode,
const bool rememberInConfig =
true);
113 KateViewInternal *getViewInternal()
115 return m_viewInternal;
137 void swapWithClipboard();
143 void applyWordWrap();
149 void setContextMenu(
QMenu *menu)
override;
150 QMenu *contextMenu()
const override;
151 QMenu *defaultContextMenu(
QMenu *menu =
nullptr)
const override;
154 void aboutToShowContextMenu();
155 void aboutToHideContextMenu();
174 QPoint cursorPositionCoordinates()
const override;
178 QScrollBar *verticalScrollBar()
const override;
179 QScrollBar *horizontalScrollBar()
const override;
186 int virtualCursorColumn()
const;
188 bool mouseTrackingEnabled()
const override;
189 bool setMouseTrackingEnabled(
bool enable)
override;
196 struct PlainSecondaryCursor {
199 friend bool operator<(
const PlainSecondaryCursor &l,
const PlainSecondaryCursor &r)
201 return l.pos < r.pos;
204 struct SecondaryCursor {
205 std::unique_ptr<Kate::TextCursor> pos;
206 std::unique_ptr<Kate::TextRange> range;
211 return pos->toCursor();
214 friend bool operator<(
const SecondaryCursor &l,
const SecondaryCursor &r)
216 return l.cursor() < r.cursor();
221 return l.cursor() < r;
224 friend bool operator==(
const SecondaryCursor &l,
const SecondaryCursor &r)
226 return l.cursor() == r.cursor();
229 void clearSelection()
237 bool isMulticursorNotAllowed()
const;
243 const std::vector<SecondaryCursor> &secondaryCursors()
const;
247 void clearSecondaryCursors();
248 void clearSecondarySelections();
252 void ensureUniqueCursors(
bool matchLine =
false);
262 bool hasSelections()
const;
265 KTEXTEDITOR_NO_EXPORT
266 bool removeSecondaryCursors(
const std::vector<KTextEditor::Cursor> &cursorToRemove,
bool removeIfOverlapsSelection =
false);
267 KTEXTEDITOR_NO_EXPORT
269 KTEXTEDITOR_NO_EXPORT
271 KTEXTEDITOR_NO_EXPORT
274 std::vector<SecondaryCursor> m_secondaryCursors;
275 bool m_skipCurrentSelection =
false;
277 void addSecondaryCursorDown();
279 void addSecondaryCursorUp();
283 KTEXTEDITOR_NO_EXPORT
288 bool setCursorPositionInternal(
const KTextEditor::Cursor position, uint tabwidth = 1,
bool calledExternally =
false);
296 void setConfigValue(
const QString &key,
const QVariant &value)
override;
309 bool unfoldLine(
int line);
315 bool toggleFoldingOfLine(
int line);
325 bool toggleFoldingsInRange(
int line);
329 bool isCompletionActive()
const override;
331 void startCompletion(
const Range &word,
333 KTextEditor::CodeCompletionModel::InvocationType invocationType = KTextEditor::CodeCompletionModel::ManualInvocation)
override;
334 void abortCompletion()
override;
335 void forceCompletion()
override;
340 bool isAutomaticInvocationEnabled()
const override;
341 void setAutomaticInvocationEnabled(
bool enabled =
true)
override;
348 void userInvokedCompletion();
354 void sendCompletionAborted();
362 void setTextHintDelay(
int delay)
override;
363 int textHintDelay()
const override;
366 bool dynWordWrap()
const
382 std::vector<KTextEditor::InlineNoteProvider *> m_inlineNoteProviders;
385 void inlineNotesReset();
386 void inlineNotesLineChanged(
int line);
394 bool removeSelection()
override
396 return clearSelection();
399 bool removeSelectionText()
override
401 return removeSelectedText();
404 bool setBlockSelection(
bool on)
override;
405 bool toggleBlockSelection();
407 bool clearSelection();
408 bool clearSelection(
bool redraw,
bool finishedChangingSelection =
true);
410 bool removeSelectedText();
415 bool selection()
const override;
416 QString selectionText()
const override;
417 bool blockSelection()
const override;
427 void deactivateEditActions();
428 void activateEditActions();
435 bool wrapCursor()
const;
439 bool lineSelected(
int line);
441 bool lineHasSelected(
int line);
442 bool lineIsSelection(
int line);
444 void ensureCursorColumnValid();
454 void editEnd(
int editTagLineStart,
int editTagLineEnd,
bool tagFrom);
472 void repaintText(
bool paintOnlyDirty =
false);
474 void updateView(
bool changed =
false);
483 void setAnnotationBorderVisible(
bool visible)
override;
484 bool isAnnotationBorderVisible()
const override;
487 void setAnnotationUniformItemSizes(
bool enable)
override;
488 bool uniformAnnotationItemSizes()
const override;
492 void navigateRight();
495 void navigateAccept();
505 void emitNavigateLeft()
507 Q_EMIT navigateLeft();
509 void emitNavigateRight()
511 Q_EMIT navigateRight();
513 void emitNavigateUp()
517 void emitNavigateDown()
519 Q_EMIT navigateDown();
521 void emitNavigateAccept()
523 Q_EMIT navigateAccept();
525 void emitNavigateBack()
527 Q_EMIT navigateBack();
532 bool isOverwriteMode()
const;
534 bool isLineRTL(
int line)
const;
547 void toggleComment();
553 void goToPreviousEditingPosition();
558 void goToNextEditingPosition();
603 void noIndentNewline();
619 void deleteWordLeft();
634 void deleteWordRight();
650 void transposeWord();
652 void shiftCursorLeft();
654 void shiftCursorRight();
656 void shiftWordLeft();
658 void shiftWordRight();
659 void markSelection();
671 void shiftTopOfView();
673 void shiftBottomOfView();
677 void shiftPageDown();
682 void toMatchingBracket();
683 void shiftToMatchingBracket();
684 void toPrevModifiedLine();
685 void toNextModifiedLine();
721 void setEol(
int eol);
722 void setAddBom(
bool enabled);
724 void findSelectedForwards();
725 void findSelectedBackwards();
726 void findNextOccurunceAndSelect();
727 void findAllOccuruncesAndSelect();
728 void skipCurrentOccurunceSelection();
732 void showSearchWrappedHint(
bool isReverseSearch);
733 void createMultiCursorsFromSelection();
734 void removeCursorsFromEmptyLines();
736 void setFoldingMarkersOn(
bool enable);
737 void setIconBorder(
bool enable);
738 void setLineNumbersOn(
bool enable);
739 void setScrollBarMarks(
bool enable);
740 void setScrollBarMiniMap(
bool enable);
741 void setScrollBarMiniMapAll(
bool enable);
742 void setScrollBarMiniMapWidth(
int width);
743 void toggleFoldingMarkers();
744 void toggleIconBorder();
745 void toggleLineNumbersOn();
746 void toggleScrollBarMarks();
747 void toggleScrollBarMiniMap();
748 void toggleScrollBarMiniMapAll();
749 void toggleDynWordWrap();
750 void setDynWrapIndicators(
int mode);
758 KateRendererConfig *rendererConfig();
761 bool lineNumbersOn();
762 bool scrollBarMarks();
763 bool scrollBarMiniMap();
764 bool scrollBarMiniMapAll();
765 int dynWrapIndicators();
766 bool foldingMarkersOn();
767 bool forceRTLDirection()
const;
773 void slotSelectionChanged();
775 void toggleInputMode();
776 void cycleInputMode();
783 KTextEditor::DocumentPrivate *doc()
787 const KTextEditor::DocumentPrivate *doc()
const
793 void slotUpdateUndo();
796 void toggleWWMarker();
797 void toggleNPSpaces();
798 void toggleWordCount(
bool on);
799 void toggleWriteLock();
800 void switchToCmdLine();
801 void slotReadWriteChanged();
802 void toggleCamelCaseCursor();
814 return m_textFolding;
820 void exportHtmlToFile(
const QString &file);
823 void slotDocumentReloaded();
824 void slotDocumentAboutToReload();
826 void slotLostFocus();
827 void slotSaveCanceled(
const QString &error);
828 void slotConfigDialog();
829 void exportHtmlToClipboard();
830 void exportHtmlToFile();
833 void slotFoldToplevelNodes();
834 void slotExpandToplevelNodes();
835 void slotToggleFolding();
836 void slotToggleFoldingsInRange();
839 KTEXTEDITOR_NO_EXPORT
841 KTEXTEDITOR_NO_EXPORT
842 void setupConnections();
843 KTEXTEDITOR_NO_EXPORT
845 KTEXTEDITOR_NO_EXPORT
846 void setupEditActions();
847 KTEXTEDITOR_NO_EXPORT
848 void setupCodeFolding();
849 KTEXTEDITOR_NO_EXPORT
850 void setupSpeechActions();
852 std::vector<QAction *> m_editActions;
855 bool m_gotoBottomAfterReload;
856 bool m_markedSelection;
880 QAction *m_pasteSelection =
nullptr;
884 QAction *m_screenshotSelection =
nullptr;
894 bool m_forceRTL =
false;
895 bool m_accessibilityEnabled =
false;
897 KTextEditor::DocumentPrivate *
const m_doc;
899 KateViewConfig *
const m_config;
901 KateViewInternal *
const m_viewInternal;
902 KateSpellCheckDialog *m_spell;
903 KateBookmarks *
const m_bookmarks;
912 void slotHlChanged();
918 inline KateViewConfig *config()
925 void updateDocumentConfig();
927 void updateRendererConfig();
930 void updateFoldingConfig();
934 bool m_updatingDocumentConfig;
950 KateViewBar *bottomViewBar()
const;
951 KateDictionaryBar *dictionaryBar();
954 KTEXTEDITOR_NO_EXPORT
955 KateGotoBar *gotoBar();
963 KateViewBar *m_bottomViewBar;
966 KateGotoBar *m_gotoBar;
967 KateDictionaryBar *m_dictionaryBar;
971 KateAbstractInputMode *currentInputMode()
const;
977 void displayRangeChanged(KTextEditor::ViewPrivate *view);
983 KateSpellingMenu *m_spellingMenu;
986 void toggleOnTheFlySpellCheck(
bool b);
989 void changeDictionary();
990 void reflectOnTheFlySpellCheckStatus(
bool enabled);
993 KateSpellingMenu *spellingMenu();
996 bool m_userContextMenuSet;
1002 void saveFoldingState();
1007 void applyFoldingState();
1013 void clearFoldingState();
1016 KTEXTEDITOR_NO_EXPORT
1017 void clearHighlights();
1018 KTEXTEDITOR_NO_EXPORT
1019 void createHighlights();
1022 KTEXTEDITOR_NO_EXPORT
1023 void selectionChangedForHighlights();
1030 QString m_currentTextForHighlights;
1032 std::vector<std::unique_ptr<KTextEditor::MovingRange>> m_rangesForHighlights;
1046 void slotDelayedUpdateOfView();
1052 void delayedUpdateOfView();
1067 return &m_rangesMouseIn;
1076 return &m_rangesCaretIn;
1092 QTimer m_delayedUpdateTimer;
1123 std::array<KateMessageWidget *, 5> m_messageWidgets{{
nullptr}};
1141 bool print()
override;
1149 KateStatusBar *statusBar()
const
1157 void toggleStatusBar();
1163 KateViewEncodingAction *encodingAction()
const
1165 return m_encodingAction;
1172 KateModeMenu *modeAction()
const
1174 return m_modeAction;
1181 KateStatusBar *m_statusBar;
1186 KateViewEncodingAction *m_encodingAction;
1191 KateModeMenu *m_modeAction;
1196 bool m_temporaryAutomaticInvocationDisabled;
1214 bool m_autoFoldedFirstLine;
1219 void setHorizontalScrollPositionInternal(
int x);
1223 int firstDisplayedLineInternal(LineType lineType)
const;
1225 int lastDisplayedLineInternal(LineType lineType)
const;
1227 QRect textAreaRectInternal()
const;
1235 std::unique_ptr<KateScriptActionMenu> m_scriptActionMenu;
1239 bool m_isLastSearchReversed =
false;
A delegate for rendering line annotation information and handling events.
An model for providing line annotation information.
ActivationType
Several automatic activation mechanisms exist for associated attributes.
An item model for providing code completion, and meta information for enhanced presentation.
The Cursor represents a position in a Document.
static constexpr Cursor invalid() noexcept
Returns an invalid cursor.
A KParts derived class representing a text document.
A source of inline notes for a document.
An object representing lines from a start line to an end line.
This class allows the application that embeds the KTextEditor component to allow it to access parts o...
This class holds a Message to display in Views.
An object representing a section of text, from one Cursor to another.
Class to provide text hints for a View.
A text widget with KXMLGUIClient that represents a Document.
Internal data container for KTextEditor::InlineNote interface.
Class to layout KTextEditor::Messages in KateView.
Handles all of the work of rendering the text (used for the views and printing)
Class representing the folding information for a TextBuffer.
Q_SCRIPTABLE Q_NOREPLY void start()
AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item)
QAction * printPreview(const QObject *recvr, const char *slot, QObject *parent)
const QList< QKeySequence > & cut()
const QList< QKeySequence > & print()
const QList< QKeySequence > & find()
const QList< QKeySequence > & paste()
const QList< QKeySequence > & end()
const QList< QKeySequence > & home()
const QList< QKeySequence > & copy()
const QList< QKeySequence > & up()
const QList< QKeySequence > & findNext()
const QList< QKeySequence > & selectAll()
const QList< QKeySequence > & replace()
const QList< QKeySequence > & gotoLine()
const QList< QKeySequence > & pasteSelection()
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
bool operator==(const QGraphicsApiFilter &reference, const QGraphicsApiFilter &sample)