aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Document.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Document.h')
-rw-r--r--src/Document.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Document.h b/src/Document.h
index 4751cd2c8..240d59e39 100644
--- a/src/Document.h
+++ b/src/Document.h
@@ -320,6 +320,27 @@ private:
void NotifyModified(DocModification mh);
};
+class UndoGroup {
+ Document *pdoc;
+ bool groupNeeded;
+public:
+ UndoGroup(Document *pdoc_, bool groupNeeded_=true) :
+ pdoc(pdoc_), groupNeeded(groupNeeded_) {
+ if (groupNeeded) {
+ pdoc->BeginUndoAction();
+ }
+ }
+ ~UndoGroup() {
+ if (groupNeeded) {
+ pdoc->EndUndoAction();
+ }
+ }
+ bool Needed() const {
+ return groupNeeded;
+ }
+};
+
+
/**
* To optimise processing of document modifications by DocWatchers, a hint is passed indicating the
* scope of the change.