edbee - Qt Editor Library
removecommand.h
Go to the documentation of this file.
1 
6 #pragma once
7 
9 
10 namespace edbee {
11 
12 class TextDocument;
13 class TextRangeSet;
14 
28 {
29 public:
30  enum RemoveMode {
34  };
35 
36  enum Direction {
37  Left,
39  };
40 
41 
42  RemoveCommand( int removeMode, int direction );
43 
44  int coalesceId() const;
45  int smartBackspace( TextDocument* doc, int caret );
46 
47  void rangesForRemoveChar( TextEditorController* controller, TextRangeSet* ranges );
48  void rangesForRemoveWord( TextEditorController* controller, TextRangeSet* ranges );
49  void rangesForRemoveLine( TextEditorController* controller, TextRangeSet* ranges );
50 
51  virtual void execute( TextEditorController* controller );
52  virtual QString toString();
53 
54 private:
55  int directionSign() const;
56 
57 
58  int removeMode_;
59  int direction_;
60 };
61 
62 
63 } // edbee
This is the base and abstract class of a text document A TextDocument is the model part of the editor...
Definition: textdocument.h:40
virtual void execute(TextEditorController *controller)
Performs the remove command.
Definition: removecommand.cpp:149
RemoveCommand(int removeMode, int direction)
The remove command constructor.
Definition: removecommand.cpp:25
Remove a line.
Definition: removecommand.h:33
Remove a single word.
Definition: removecommand.h:32
Direction
Definition: removecommand.h:36
int coalesceId() const
This method returns the coalesceId to use Currently all commands in the same direction will get the s...
Definition: removecommand.cpp:35
This is the abstract base class for a textcommand.
Definition: texteditorcommand.h:49
Copyright 2011-2013 - Reliable Bits Software by Blommers IT.
Definition: commentcommand.cpp:22
int smartBackspace(TextDocument *doc, int caret)
Performs a smart backspace by adjusting the textrange so the backspace leads to the start of a column...
Definition: removecommand.cpp:47
The texteditor works via the controller. The controller is the central point/mediater which maps/cont...
Definition: texteditorcontroller.h:37
The basic textrange class. A simple class of textrange with a simple vector implementation.
Definition: textrange.h:198
Remove the item to the left.
Definition: removecommand.h:37
void rangesForRemoveWord(TextEditorController *controller, TextRangeSet *ranges)
Changes the ranges so one word at the left is removed.
Definition: removecommand.cpp:112
Remove the item to ther right.
Definition: removecommand.h:38
RemoveMode
Definition: removecommand.h:30
Remove a single character.
Definition: removecommand.h:31
virtual QString toString()
Converts the command to a string.
Definition: removecommand.cpp:189
void rangesForRemoveChar(TextEditorController *controller, TextRangeSet *ranges)
Changes the ranges so one character on the left is removed This method can switch to smart-backspace ...
Definition: removecommand.cpp:87
void rangesForRemoveLine(TextEditorController *controller, TextRangeSet *ranges)
Changes the ranges so one line at the left is removed.
Definition: removecommand.cpp:126
A delete command. This is a backspace or a delete operation.
Definition: removecommand.h:27