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();
148 void copyFileLocation()
const;
154 void setContextMenu(
QMenu *menu)
override;
155 QMenu *contextMenu()
const override;
156 QMenu *defaultContextMenu(
QMenu *menu =
nullptr)
const override;
159 void aboutToShowContextMenu();
160 void aboutToHideContextMenu();
179 QPoint cursorPositionCoordinates()
const override;
183 QScrollBar *verticalScrollBar()
const override;
184 QScrollBar *horizontalScrollBar()
const override;
191 int virtualCursorColumn()
const;
193 bool mouseTrackingEnabled()
const override;
194 bool setMouseTrackingEnabled(
bool enable)
override;
201 struct PlainSecondaryCursor {
204 friend bool operator<(
const PlainSecondaryCursor &l,
const PlainSecondaryCursor &r)
206 return l.pos < r.pos;
209 struct SecondaryCursor {
210 std::unique_ptr<Kate::TextCursor> pos;
211 std::unique_ptr<Kate::TextRange> range;
216 return pos->toCursor();
219 friend bool operator<(
const SecondaryCursor &l,
const SecondaryCursor &r)
221 return l.cursor() < r.cursor();
226 return l.cursor() < r;
229 friend bool operator==(
const SecondaryCursor &l,
const SecondaryCursor &r)
231 return l.cursor() == r.cursor();
234 void clearSelection()
242 bool isMulticursorNotAllowed()
const;
248 const std::vector<SecondaryCursor> &secondaryCursors()
const;
252 void clearSecondaryCursors();
253 void clearSecondarySelections();
257 void ensureUniqueCursors(
bool matchLine =
false);
267 bool hasSelections()
const;
270 KTEXTEDITOR_NO_EXPORT
271 bool removeSecondaryCursors(
const std::vector<KTextEditor::Cursor> &cursorToRemove,
bool removeIfOverlapsSelection =
false);
272 KTEXTEDITOR_NO_EXPORT
274 KTEXTEDITOR_NO_EXPORT
276 KTEXTEDITOR_NO_EXPORT
279 std::vector<SecondaryCursor> m_secondaryCursors;
280 bool m_skipCurrentSelection =
false;
282 void addSecondaryCursorDown();
284 void addSecondaryCursorUp();
288 KTEXTEDITOR_NO_EXPORT
293 bool setCursorPositionInternal(
const KTextEditor::Cursor position, uint tabwidth = 1,
bool calledExternally =
false);
301 void setConfigValue(
const QString &key,
const QVariant &value)
override;
314 bool unfoldLine(
int line);
320 bool toggleFoldingOfLine(
int line);
330 bool toggleFoldingsInRange(
int line);
334 bool isCompletionActive()
const override;
336 void startCompletion(
const Range &word,
338 KTextEditor::CodeCompletionModel::InvocationType invocationType = KTextEditor::CodeCompletionModel::ManualInvocation)
override;
339 void abortCompletion()
override;
340 void forceCompletion()
override;
345 bool isAutomaticInvocationEnabled()
const override;
346 void setAutomaticInvocationEnabled(
bool enabled =
true)
override;
353 void userInvokedCompletion();
359 void sendCompletionAborted();
367 void setTextHintDelay(
int delay)
override;
368 int textHintDelay()
const override;
371 bool dynWordWrap()
const
387 std::vector<KTextEditor::InlineNoteProvider *> m_inlineNoteProviders;
390 void inlineNotesReset();
391 void inlineNotesLineChanged(
int line);
399 bool removeSelection()
override
401 return clearSelection();
404 bool removeSelectionText()
override
406 return removeSelectedText();
409 bool setBlockSelection(
bool on)
override;
410 bool toggleBlockSelection();
412 bool clearSelection();
413 bool clearSelection(
bool redraw,
bool finishedChangingSelection =
true);
415 bool removeSelectedText();
420 bool selection()
const override;
421 QString selectionText()
const override;
422 bool blockSelection()
const override;
432 void deactivateEditActions();
433 void activateEditActions();
440 bool wrapCursor()
const;
444 bool lineSelected(
int line);
446 bool lineHasSelected(
int line);
447 bool lineIsSelection(
int line);
449 void ensureCursorColumnValid();
459 void editEnd(
int editTagLineStart,
int editTagLineEnd,
bool tagFrom);
477 void repaintText(
bool paintOnlyDirty =
false);
479 void updateView(
bool changed =
false);
488 void setAnnotationBorderVisible(
bool visible)
override;
489 bool isAnnotationBorderVisible()
const override;
492 void setAnnotationUniformItemSizes(
bool enable)
override;
493 bool uniformAnnotationItemSizes()
const override;
497 void navigateRight();
500 void navigateAccept();
510 void emitNavigateLeft()
512 Q_EMIT navigateLeft();
514 void emitNavigateRight()
516 Q_EMIT navigateRight();
518 void emitNavigateUp()
522 void emitNavigateDown()
524 Q_EMIT navigateDown();
526 void emitNavigateAccept()
528 Q_EMIT navigateAccept();
530 void emitNavigateBack()
532 Q_EMIT navigateBack();
537 bool isOverwriteMode()
const;
539 bool isLineRTL(
int line)
const;
552 void toggleComment();
558 void goToPreviousEditingPosition();
563 void goToNextEditingPosition();
608 void noIndentNewline();
624 void deleteWordLeft();
639 void deleteWordRight();
655 void transposeWord();
657 void shiftCursorLeft();
659 void shiftCursorRight();
661 void shiftWordLeft();
663 void shiftWordRight();
664 void markSelection();
676 void shiftTopOfView();
678 void shiftBottomOfView();
682 void shiftPageDown();
687 void toMatchingBracket();
688 void shiftToMatchingBracket();
689 void toPrevModifiedLine();
690 void toNextModifiedLine();
726 void setEol(
int eol);
727 void setAddBom(
bool enabled);
729 void findSelectedForwards();
730 void findSelectedBackwards();
731 void findNextOccurunceAndSelect();
732 void findAllOccuruncesAndSelect();
733 void skipCurrentOccurunceSelection();
737 void showSearchWrappedHint(
bool isReverseSearch);
738 void createMultiCursorsFromSelection();
739 void removeCursorsFromEmptyLines();
741 void setFoldingMarkersOn(
bool enable);
742 void setIconBorder(
bool enable);
743 void setLineNumbersOn(
bool enable);
744 void setScrollBarMarks(
bool enable);
745 void setScrollBarMiniMap(
bool enable);
746 void setScrollBarMiniMapAll(
bool enable);
747 void setScrollBarMiniMapWidth(
int width);
748 void toggleFoldingMarkers();
749 void toggleIconBorder();
750 void toggleLineNumbersOn();
751 void toggleScrollBarMarks();
752 void toggleScrollBarMiniMap();
753 void toggleScrollBarMiniMapAll();
754 void toggleShowSpaces();
755 void toggleDynWordWrap();
756 void setDynWrapIndicators(
int mode);
764 KateRendererConfig *rendererConfig();
767 bool lineNumbersOn();
768 bool scrollBarMarks();
769 bool scrollBarMiniMap();
770 bool scrollBarMiniMapAll();
771 int dynWrapIndicators();
772 bool foldingMarkersOn();
773 bool forceRTLDirection()
const;
779 void slotSelectionChanged();
781 void toggleInputMode();
782 void cycleInputMode();
799 void slotUpdateUndo();
802 void toggleWWMarker();
803 void toggleNPSpaces();
804 void toggleWordCount(
bool on);
805 void toggleWriteLock();
806 void switchToCmdLine();
807 void slotReadWriteChanged();
808 void toggleCamelCaseCursor();
820 return m_textFolding;
826 void exportHtmlToFile(
const QString &file);
829 void slotDocumentReloaded();
830 void slotDocumentAboutToReload();
832 void slotLostFocus();
833 void slotSaveCanceled(
const QString &error);
834 void slotConfigDialog();
835 void exportHtmlToClipboard();
836 void exportHtmlToFile();
839 void slotFoldToplevelNodes();
840 void slotExpandToplevelNodes();
841 void slotToggleFolding();
842 void slotToggleFoldingsInRange();
845 KTEXTEDITOR_NO_EXPORT
847 KTEXTEDITOR_NO_EXPORT
848 void setupConnections();
849 KTEXTEDITOR_NO_EXPORT
851 KTEXTEDITOR_NO_EXPORT
852 void setupEditActions();
853 KTEXTEDITOR_NO_EXPORT
854 void setupCodeFolding();
855 KTEXTEDITOR_NO_EXPORT
856 void setupSpeechActions();
858 std::vector<QAction *> m_editActions;
861 bool m_gotoBottomAfterReload;
862 bool m_markedSelection;
887 QAction *m_pasteSelection =
nullptr;
891 QAction *m_screenshotSelection =
nullptr;
901 bool m_forceRTL =
false;
902 bool m_accessibilityEnabled =
false;
906 KateViewConfig *
const m_config;
908 KateViewInternal *
const m_viewInternal;
909 KateSpellCheckDialog *m_spell;
910 KateBookmarks *
const m_bookmarks;
919 void slotHlChanged();
925 inline KateViewConfig *config()
932 void updateDocumentConfig();
934 void updateRendererConfig();
937 void updateFoldingConfig();
941 bool m_updatingDocumentConfig;
957 KateViewBar *bottomViewBar()
const;
958 KateDictionaryBar *dictionaryBar();
961 KTEXTEDITOR_NO_EXPORT
962 KateGotoBar *gotoBar();
970 KateViewBar *m_bottomViewBar;
973 KateGotoBar *m_gotoBar;
974 KateDictionaryBar *m_dictionaryBar;
978 KateAbstractInputMode *currentInputMode()
const;
984 void displayRangeChanged(KTextEditor::ViewPrivate *view);
990 KateSpellingMenu *m_spellingMenu;
993 void toggleOnTheFlySpellCheck(
bool b);
996 void changeDictionary();
997 void reflectOnTheFlySpellCheckStatus(
bool enabled);
1000 KateSpellingMenu *spellingMenu();
1003 bool m_userContextMenuSet;
1009 void saveFoldingState();
1014 void applyFoldingState();
1020 void clearFoldingState();
1023 KTEXTEDITOR_NO_EXPORT
1024 void clearHighlights();
1025 KTEXTEDITOR_NO_EXPORT
1026 void createHighlights();
1029 KTEXTEDITOR_NO_EXPORT
1030 void selectionChangedForHighlights();
1037 QString m_currentTextForHighlights;
1039 std::vector<std::unique_ptr<KTextEditor::MovingRange>> m_rangesForHighlights;
1053 void slotDelayedUpdateOfView();
1059 void delayedUpdateOfView();
1074 return &m_rangesMouseIn;
1083 return &m_rangesCaretIn;
1099 QTimer m_delayedUpdateTimer;
1130 std::array<KateMessageWidget *, 5> m_messageWidgets{{
nullptr}};
1148 bool print()
override;
1156 KateStatusBar *statusBar()
const
1164 void toggleStatusBar();
1170 KateViewEncodingAction *encodingAction()
const
1172 return m_encodingAction;
1179 KateModeMenu *modeAction()
const
1181 return m_modeAction;
1188 KateStatusBar *m_statusBar;
1193 KateViewEncodingAction *m_encodingAction;
1198 KateModeMenu *m_modeAction;
1203 bool m_temporaryAutomaticInvocationDisabled;
1221 bool m_autoFoldedFirstLine;
1226 void setHorizontalScrollPositionInternal(
int x);
1230 int firstDisplayedLineInternal(LineType lineType)
const;
1232 int lastDisplayedLineInternal(LineType lineType)
const;
1234 QRect textAreaRectInternal()
const;
1242 std::unique_ptr<KateScriptActionMenu> m_scriptActionMenu;
1246 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.
Backend of KTextEditor::Document related public KTextEditor interfaces.
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 * end(const QObject *recvr, const char *slot, QObject *parent)
KIOCORE_EXPORT CopyJob * copy(const QList< QUrl > &src, const QUrl &dest, JobFlags flags=DefaultFlags)
KIOWIDGETS_EXPORT PasteJob * paste(const QMimeData *mimeData, const QUrl &destDir, JobFlags flags=DefaultFlags)
QAction * up(const QObject *recvr, const char *slot, QObject *parent)
QAction * home(const QObject *recvr, const char *slot, QObject *parent)
QAction * replace(const QObject *recvr, const char *slot, QObject *parent)
QAction * cut(const QObject *recvr, const char *slot, QObject *parent)
QAction * selectAll(const QObject *recvr, const char *slot, QObject *parent)
QAction * printPreview(const QObject *recvr, const char *slot, QObject *parent)
QAction * findNext(const QObject *recvr, const char *slot, QObject *parent)
QAction * gotoLine(const QObject *recvr, const char *slot, QObject *parent)
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)