1 /** 2 * Copyright (C) 2013 KO GmbH <copyright@kogmbh.com> 3 * 4 * @licstart 5 * This file is part of WebODF. 6 * 7 * WebODF is free software: you can redistribute it and/or modify it 8 * under the terms of the GNU Affero General Public License (GNU AGPL) 9 * as published by the Free Software Foundation, either version 3 of 10 * the License, or (at your option) any later version. 11 * 12 * WebODF is distributed in the hope that it will be useful, but 13 * WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU Affero General Public License for more details. 16 * 17 * You should have received a copy of the GNU Affero General Public License 18 * along with WebODF. If not, see <http://www.gnu.org/licenses/>. 19 * @licend 20 * 21 * @source: http://www.webodf.org/ 22 * @source: https://github.com/kogmbh/WebODF/ 23 */ 24 25 /*global ops, gui*/ 26 /*jslint emptyblock: true, unparam: true*/ 27 28 /** 29 * @interface 30 */ 31 gui.UndoManager = function UndoManager() {"use strict"; }; 32 33 /** 34 * Subscribe to events related to the undo manager 35 * @param {!string} signal 36 * @param {!Function} callback 37 */ 38 gui.UndoManager.prototype.subscribe = function(signal, callback) {"use strict"; }; 39 40 /** 41 * Unsubscribe to events related to the undo manager 42 * @param {!string} signal 43 * @param {!Function} callback 44 */ 45 gui.UndoManager.prototype.unsubscribe = function(signal, callback) {"use strict"; }; 46 47 /** 48 * Set the Document to operate on 49 * @param {!ops.Document} newDocument 50 */ 51 gui.UndoManager.prototype.setDocument = function (newDocument) {"use strict"; }; 52 53 /** 54 * Sets the initial document state and operation state. This is the earliest point 55 * the document can be undone to. 56 */ 57 gui.UndoManager.prototype.setInitialState = function () {"use strict"; }; 58 59 /** 60 * Initializes the undo manager and creates the initial document 61 * snapshot. If the undo manager has already been previously initialized, 62 * this call will do nothing. 63 */ 64 gui.UndoManager.prototype.initialize = function () {"use strict"; }; 65 66 /** 67 * Purges entire undo stack including the initial state. This is primarily intended 68 * to free up memory and resources when the undo state is no longer required. 69 */ 70 gui.UndoManager.prototype.purgeInitialState = function () {"use strict"; }; 71 72 /** 73 * Sets the playback function to use to re-execute operations from the undo stack. 74 * @param {!function(!Array.<!ops.Operation>)} playback_func 75 */ 76 gui.UndoManager.prototype.setPlaybackFunction = function (playback_func) {"use strict"; }; 77 78 /** 79 * Returns true if there are one or more undo states available 80 * @return {boolean} 81 */ 82 gui.UndoManager.prototype.hasUndoStates = function () {"use strict"; }; 83 84 /** 85 * Returns true if there are one or more redo states available 86 * @return {boolean} 87 */ 88 gui.UndoManager.prototype.hasRedoStates = function () {"use strict"; }; 89 90 /** 91 * Move forward the desired number of states. Will stop when the number of 92 * states is reached, or no more redo states are available. 93 * @param {!number} states 94 * @return {!number} Returns the number of states actually moved 95 */ 96 gui.UndoManager.prototype.moveForward = function (states) {"use strict"; }; 97 98 /** 99 * Move backward the desired number of states. Will stop when the number of 100 * states is reached, or no more undo states are available. 101 * @param {!number} states 102 * @return {!number} Returns the number of states actually moved 103 */ 104 gui.UndoManager.prototype.moveBackward = function (states) {"use strict"; }; 105 106 /** 107 * Track the execution of an operation, and add it to the available undo states 108 * @param {!ops.Operation} op 109 * @return {undefined} 110 */ 111 gui.UndoManager.prototype.onOperationExecuted = function (op) {"use strict"; }; 112 113 /** 114 * Returns if the current state matches the unmodified state. 115 * @return {!boolean} 116 */ 117 gui.UndoManager.prototype.isDocumentModified = function () {"use strict"; }; 118 119 /** 120 * Sets the current state of the document to be either the unmodified state 121 * or a modified state. 122 * @param {!boolean} modified 123 * @return {undefined} 124 */ 125 gui.UndoManager.prototype.setDocumentModified = function(modified) {"use strict"; }; 126 127 /**@const*/gui.UndoManager.signalUndoStackChanged = "undoStackChanged"; 128 /**@const*/gui.UndoManager.signalUndoStateCreated = "undoStateCreated"; 129 /**@const*/gui.UndoManager.signalUndoStateModified = "undoStateModified"; 130 /**@const*/gui.UndoManager.signalDocumentModifiedChanged = "documentModifiedChanged"; 131