Sync with webodf 379ba3bfff4a7d736109f48c8ab72ea649a77918

* enables initial support for integrating into OC-Docs translation system
* fixes broken paragraphstyle dialog on 2nd and later editor start with the same OC-App page-life-cycle
* showing selections of other users, not just the cursor
* lots of small fixes with cursor/selection
pull/1/head
Friedrich W. H. Kossebau 11 years ago
parent ad6cb61b3b
commit 47c0cbc5e8

@ -661,7 +661,7 @@ a;this._set("title",a)},postCreate:function(){this.inherited(arguments);this.con
"-"+c];j.replace(this.domNode,a,this._currentOrientClass||"");this._currentOrientClass=a},focus:function(){this._getFocusItems(this.containerNode);g.focus(this._firstFocusItem)},onOpen:function(a){this.orient(this.domNode,a.aroundCorner,a.corner);var b=a.aroundNodePos;if("M"==a.corner.charAt(0)&&"M"==a.aroundCorner.charAt(0))this.connectorNode.style.top=b.y+(b.h-this.connectorNode.offsetHeight>>1)-a.y+"px",this.connectorNode.style.left="";else if("M"==a.corner.charAt(1)&&"M"==a.aroundCorner.charAt(1))this.connectorNode.style.left=
b.x+(b.w-this.connectorNode.offsetWidth>>1)-a.x+"px";this._onShow()},onClose:function(){this.onHide()},_onKey:function(a){var b=a.target;a.charOrCode===l.TAB&&this._getFocusItems(this.containerNode);var c=this._firstFocusItem==this._lastFocusItem;a.charOrCode==l.ESCAPE?(this.defer("onCancel"),i.stop(a)):b==this._firstFocusItem&&a.shiftKey&&a.charOrCode===l.TAB?(c||g.focus(this._lastFocusItem),i.stop(a)):b==this._lastFocusItem&&a.charOrCode===l.TAB&&!a.shiftKey?(c||g.focus(this._firstFocusItem),i.stop(a)):
a.charOrCode===l.TAB&&a.stopPropagation()}})})},"url:dijit/templates/TooltipDialog.html":'<div role="presentation" tabIndex="-1">\n\t<div class="dijitTooltipContainer" role="presentation">\n\t\t<div class ="dijitTooltipContents dijitTooltipFocusNode" data-dojo-attach-point="containerNode" role="dialog"></div>\n\t</div>\n\t<div class="dijitTooltipConnector" role="presentation" data-dojo-attach-point="connectorNode"></div>\n</div>\n',"*now":function(e){e(['dojo/i18n!*preload*dojo/nls/dojo*["ar","ca","cs","da","de","el","en-gb","en-us","es-es","fi-fi","fr-fr","he-il","hu","it-it","ja-jp","ko-kr","nl-nl","nb","pl","pt-br","pt-pt","ru","sk","sl","sv","th","tr","zh-tw","zh-cn","ROOT"]'])}}});
// START OF nls/dojobundle.js
// START OF dojobundle.js
/* START OF NLS BUNDLE ENTRY [dojo-deps/dist/dijit/_editor/nls/FontChoice.js] */
//>>built
define("dijit/_editor/nls/FontChoice",{root:{fontSize:"Size",fontName:"Font",formatBlock:"Format",serif:"serif","sans-serif":"sans-serif",monospace:"monospace",cursive:"cursive",fantasy:"fantasy",noFormat:"None",p:"Paragraph",h1:"Heading",h2:"Subheading",h3:"Sub-subheading",pre:"Pre-formatted",1:"xx-small",2:"x-small",3:"small",4:"medium",5:"large",6:"x-large",7:"xx-large"},zh:!0,"zh-tw":!0,tr:!0,th:!0,sv:!0,sl:!0,sk:!0,ru:!0,ro:!0,pt:!0,"pt-pt":!0,pl:!0,nl:!0,nb:!0,ko:!0,kk:!0,ja:!0,it:!0,hu:!0,
@ -1706,6 +1706,6 @@ define("dojox/widget/nls/ru/FilePicker",{name:"\u0418\u043c\u044f",path:"\u041f\
define("dojox/widget/nls/ru/Wizard",{next:"\u0414\u0430\u043b\u0435\u0435",previous:"\u041d\u0430\u0437\u0430\u0434",done:"\u0413\u043e\u0442\u043e\u0432\u043e"});
/* END OF NLS BUNDLE ENTRY [dojo-deps/dist/dojox/widget/nls/ru/Wizard.js] */
// END OF nls/dojobundle.js
// END OF dojobundle.js
(function(){var e=this.require;e({cache:{}});!e.async&&e(["dojo"]);e.boot&&e.apply(null,e.boot)})();

@ -10,6 +10,9 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
@ -30,21 +33,19 @@
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global runtime, define, document, odf, ops, window, gui, alert, saveAs, Blob */
define("webodf/editor/Editor", [
"dojo/i18n!webodf/editor/nls/myResources",
"webodf/editor/EditorSession",
"webodf/editor/MemberListView",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"webodf/editor/Tools"],
function (myResources,
EditorSession,
function (EditorSession,
MemberListView,
BorderContainer,
ContentPane,
@ -55,11 +56,11 @@ define("webodf/editor/Editor", [
/**
* @constructor
* @param {{unstableFeaturesEnabled:boolean=,
* loadCallback:function()=,
* saveCallback:function()=,
* closeCallback:function()=,
* @param {!ops.Server=} server
* @param {{unstableFeaturesEnabled:boolean,
* loadCallback:function(),
* saveCallback:function(),
* closeCallback:function()}}
* param {!ops.Server=} server
* @param {!ServerFactory=} serverFactory
*/
function Editor(args, server, serverFactory) {
@ -273,8 +274,6 @@ define("webodf/editor/Editor", [
if (err) {
callback(err);
} else {
document.translator = null;
document.translateContent = null;
callback();
}
});
@ -285,9 +284,7 @@ define("webodf/editor/Editor", [
};
function setFocusToOdfCanvas() {
if (odfCanvas) {
odfCanvas.getElement().focus();
}
editorSession.sessionController.getEventManager().focus();
}
// init
@ -298,29 +295,15 @@ define("webodf/editor/Editor", [
memberListElement = document.getElementById('memberList'),
collabEditing = Boolean(server),
directStylingEnabled = (! collabEditing) || args.unstableFeaturesEnabled,
imageInsertingEnabled = (! collabEditing) || args.unstableFeaturesEnabled,
// annotations not yet properly supported for OT
annotationsEnabled = (! collabEditing) || args.unstableFeaturesEnabled,
// undo manager is not yet integrated with collaboration
undoRedoEnabled = (! collabEditing),
closeCallback;
if (collabEditing) {
runtime.assert(memberListElement, 'missing "memberList" div in HTML');
}
runtime.assert(canvasElement, 'missing "canvas" div in HTML');
// setup translations
// TODO: move from document instance into webodf namespace
function translator(key, context) {
if (undefined === myResources[key]) {
return "translation missing: " + key;
}
return myResources[key];
}
document.translator = translator;
function translateContent(node) {
// Extend runtime with a convenient translation function
runtime.translateContent = function (node) {
var i,
element,
tag,
@ -334,11 +317,16 @@ define("webodf/editor/Editor", [
if (tag === "label"
|| tag === "span"
|| /h\d/i.test(tag)) {
element.textContent = document.translator(placeholder);
element.textContent = runtime.tr(placeholder);
}
}
};
if (collabEditing) {
runtime.assert(memberListElement, 'missing "memberList" div in HTML');
}
document.translateContent = translateContent;
runtime.assert(canvasElement, 'missing "canvas" div in HTML');
// App Widgets
mainContainer = new BorderContainer({}, 'mainContainer');
@ -351,7 +339,7 @@ define("webodf/editor/Editor", [
if (collabEditing) {
memberListPane = new ContentPane({
region: 'right',
title: translator("members")
title: runtime.tr("Members")
}, 'members');
mainContainer.addChild(memberListPane);
memberListView = new MemberListView(memberListElement);
@ -362,7 +350,7 @@ define("webodf/editor/Editor", [
if (window.inviteButtonProxy) {
inviteButton = document.getElementById('inviteButton');
runtime.assert(inviteButton, 'missing "inviteButton" div in HTML');
inviteButton.innerText = translator("inviteMembers");
inviteButton.innerText = runtime.tr("Invite Members");
inviteButton.style.display = "block";
inviteButton.onclick = window.inviteButtonProxy.clicked;
}
@ -373,6 +361,7 @@ define("webodf/editor/Editor", [
saveOdtFile: saveOdtFile,
close: close,
directStylingEnabled: directStylingEnabled,
imageInsertingEnabled: imageInsertingEnabled,
annotationsEnabled: annotationsEnabled,
undoRedoEnabled: undoRedoEnabled
});
@ -391,7 +380,8 @@ define("webodf/editor/Editor", [
session = new ops.Session(odfCanvas);
editorSession = new EditorSession(session, pendingMemberId, {
viewOptions: viewOptions,
directStylingEnabled: directStylingEnabled
directStylingEnabled: directStylingEnabled,
imageInsertingEnabled: imageInsertingEnabled
});
if (undoRedoEnabled) {
editorSession.sessionController.setUndoManager(new gui.TrivialUndoManager());

@ -10,6 +10,9 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
@ -30,7 +33,7 @@
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global define, runtime, core, gui, ops, document */
@ -54,7 +57,9 @@ define("webodf/editor/EditorSession", [
runtime.loadClass("gui.SessionController");
runtime.loadClass("gui.SessionView");
runtime.loadClass("gui.TrivialUndoManager");
runtime.loadClass("gui.SelectionViewManager");
runtime.loadClass("core.EventNotifier");
runtime.loadClass("gui.ShadowCursor");
/**
* Instantiate a new editor session attached to an existing operation session
@ -69,6 +74,7 @@ define("webodf/editor/EditorSession", [
currentCommonStyleName = null,
currentStyleName = null,
caretManager,
selectionViewManager,
odtDocument = session.getOdtDocument(),
textns = odf.Namespaces.textns,
fontStyles = document.createElement('style'),
@ -82,16 +88,11 @@ define("webodf/editor/EditorSession", [
EditorSession.signalCommonStyleCreated,
EditorSession.signalCommonStyleDeleted,
EditorSession.signalParagraphStyleModified,
EditorSession.signalUndoStackChanged]);
this.sessionController = new gui.SessionController(session, localMemberId, {directStylingEnabled: config.directStylingEnabled});
caretManager = new gui.CaretManager(self.sessionController);
this.sessionView = new gui.SessionView(config.viewOptions, session, caretManager);
this.availableFonts = [];
EditorSession.signalUndoStackChanged]),
shadowCursor = new gui.ShadowCursor(odtDocument);
/*
* @return {Array.{!string}}
/**
* @return {Array.<!string>}
*/
function getAvailableFonts() {
var availableFonts, regex, matches;
@ -109,7 +110,6 @@ define("webodf/editor/EditorSession", [
return availableFonts;
}
this.availableFonts = getAvailableFonts();
function checkParagraphStyleName() {
var newStyleName,
@ -299,28 +299,6 @@ define("webodf/editor/EditorSession", [
return currentCommonStyleName;
};
/**
* Adds an annotation to the document based on the current selection
* @return {undefined}
*/
this.addAnnotation = function () {
var op = new ops.OpAddAnnotation(),
selection = self.getCursorSelection(),
length = selection.length,
position = selection.position;
position = length >= 0 ? position : position + length;
length = Math.abs(length);
op.init({
memberid: localMemberId,
position: position,
length: length,
name: localMemberId + Date.now()
});
session.enqueue(op);
};
this.setCurrentParagraphStyle = function (value) {
var op;
if (currentCommonStyleName !== value) {
@ -330,7 +308,7 @@ define("webodf/editor/EditorSession", [
position: self.getCursorPosition(),
styleName: value
});
session.enqueue(op);
session.enqueue([op]);
}
};
@ -345,7 +323,7 @@ define("webodf/editor/EditorSession", [
tableColumnStyleName: tableColumnStyleName,
tableCellStyleMatrix: tableCellStyleMatrix
});
session.enqueue(op);
session.enqueue([op]);
};
/**
@ -409,7 +387,7 @@ define("webodf/editor/EditorSession", [
setProperties: setProperties,
removedProperties: (!removedProperties) ? {} : removedProperties
});
session.enqueue(op);
session.enqueue([op]);
};
/**
@ -447,7 +425,7 @@ define("webodf/editor/EditorSession", [
styleFamily: 'paragraph',
setProperties: setProperties
});
session.enqueue(op);
session.enqueue([op]);
return newStyleName;
};
@ -460,7 +438,7 @@ define("webodf/editor/EditorSession", [
styleName: styleName,
styleFamily: 'paragraph'
});
session.enqueue(op);
session.enqueue([op]);
};
/**
@ -469,7 +447,7 @@ define("webodf/editor/EditorSession", [
* first font name for any given family is kept.
* The elements of the array are objects containing the font's name and
* the family.
* @return {Array.{Object}}
* @return {Array.<!Object>}
*/
this.getDeclaredFonts = function () {
var fontMap = formatting.getFontMap(),
@ -523,6 +501,17 @@ define("webodf/editor/EditorSession", [
undoManager.moveForward(1);
};
/**
*
* @param {!string} mimetype
* @param {!string} content base64 encoded string
* @param {!number} width
* @param {!number} height
*/
this.insertImage = function (mimetype, content, width, height) {
self.sessionController.getTextManipulator().removeCurrentSelection();
self.sessionController.getImageManager().insertImage(mimetype, content, width, height);
};
/**
* @param {!function(!Object=)} callback, passing an error object in case of error
* @return {undefined}
@ -573,12 +562,18 @@ define("webodf/editor/EditorSession", [
if (err) {
callback(err);
} else {
self.sessionController.destroy(function(err) {
selectionViewManager.destroy(function(err) {
if (err) {
callback(err);
} else {
delete self.sessionController;
callback();
self.sessionController.destroy(function(err) {
if (err) {
callback(err);
} else {
delete self.sessionController;
callback();
}
});
}
});
}
@ -596,6 +591,14 @@ define("webodf/editor/EditorSession", [
fontStyles.appendChild(document.createTextNode(fontsCSS));
head.appendChild(fontStyles);
self.sessionController = new gui.SessionController(session, localMemberId, shadowCursor, {
directStylingEnabled: config.directStylingEnabled
});
caretManager = new gui.CaretManager(self.sessionController);
selectionViewManager = new gui.SelectionViewManager();
self.sessionView = new gui.SessionView(config.viewOptions, localMemberId, session, caretManager, selectionViewManager);
self.availableFonts = getAvailableFonts();
selectionViewManager.registerCursor(shadowCursor, true);
// Custom signals, that make sense in the Editor context. We do not want to expose webodf's ops signals to random bits of the editor UI.
odtDocument.subscribe(ops.OdtDocument.signalCursorAdded, onCursorAdded);
odtDocument.subscribe(ops.OdtDocument.signalCursorRemoved, onCursorRemoved);

@ -10,6 +10,9 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
@ -30,7 +33,7 @@
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global define,runtime */

@ -9,6 +9,9 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
@ -29,10 +32,10 @@
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global define,document,require */
/*global define,document,require,ops */
define("webodf/editor/Tools", [
"dojo/ready",
@ -45,29 +48,48 @@ define("webodf/editor/Tools", [
"webodf/editor/widgets/simpleStyles",
"webodf/editor/widgets/undoRedoMenu",
"webodf/editor/widgets/toolbarWidgets/currentStyle",
"webodf/editor/widgets/annotation",
"webodf/editor/widgets/paragraphStylesDialog",
"webodf/editor/widgets/zoomSlider"],
function (ready, MenuItem, DropDownMenu, Button, DropDownButton, Toolbar, ParagraphAlignment, SimpleStyles, UndoRedoMenu, CurrentStyle, ParagraphStylesDialog, ZoomSlider) {
"webodf/editor/widgets/imageInserter",
"webodf/editor/widgets/zoomSlider",
"webodf/editor/EditorSession"],
function (ready, MenuItem, DropDownMenu, Button, DropDownButton, Toolbar, ParagraphAlignment, SimpleStyles, UndoRedoMenu, CurrentStyle, AnnotationControl, ParagraphStylesDialog, ImageInserter, ZoomSlider, EditorSession) {
"use strict";
return function Tools(args) {
var translator = document.translator,
var tr = runtime.tr,
onToolDone = args.onToolDone,
loadOdtFile = args.loadOdtFile,
saveOdtFile = args.saveOdtFile,
close = args.close,
toolbar,
loadButton, saveButton, annotateButton, closeButton,
loadButton, saveButton, closeButton,
formatDropDownMenu, formatMenuButton,
paragraphStylesMenuItem, paragraphStylesDialog, simpleStyles, currentStyle,
zoomSlider,
undoRedoMenu,
editorSession,
paragraphAlignment,
imageInserter,
annotationControl,
sessionSubscribers = [];
function handleCursorMoved(cursor) {
var disabled = cursor.getSelectionType() === ops.OdtCursor.RegionSelection;
if (formatMenuButton) {
formatMenuButton.setAttribute('disabled', disabled);
}
}
function setEditorSession(session) {
if (editorSession) {
editorSession.unsubscribe(EditorSession.signalCursorMoved, handleCursorMoved);
}
editorSession = session;
if (editorSession) {
editorSession.subscribe(EditorSession.signalCursorMoved, handleCursorMoved);
}
sessionSubscribers.forEach(function (subscriber) {
subscriber.setEditorSession(editorSession);
});
@ -80,8 +102,18 @@ define("webodf/editor/Tools", [
* @return {undefined}
*/
this.destroy = function (callback) {
// TODO: investigate what else needs to be done
toolbar.destroyRecursive(true);
// TODO:
// 1. We don't want to use `document`
// 2. We would like to avoid deleting all widgets
// under document.body because this might interfere with
// other apps that use the editor not-in-an-iframe,
// but dojo always puts its dialogs below the body,
// so this works for now. Perhaps will be obsoleted
// once we move to a better widget toolkit
var widgets = dijit.findWidgets(document.body);
dojo.forEach(widgets, function(w) {
w.destroyRecursive(false);
});
callback();
};
@ -100,18 +132,12 @@ define("webodf/editor/Tools", [
// Add annotation
if (args.annotationsEnabled) {
annotateButton = new Button({
label: translator('annotate'),
showLabel: false,
iconClass: 'dijitIconBookmark',
onClick: function () {
if (editorSession) {
editorSession.addAnnotation();
onToolDone();
}
}
annotationControl = new AnnotationControl(function (widget) {
widget.placeAt(toolbar);
widget.startup();
});
annotateButton.placeAt(toolbar);
sessionSubscribers.push(annotationControl);
annotationControl.onToolDone = onToolDone;
}
// Simple Style Selector [B, I, U, S]
@ -154,7 +180,7 @@ define("webodf/editor/Tools", [
// Load
if (loadOdtFile) {
loadButton = new Button({
label: translator('open'),
label: tr('Open'),
showLabel: false,
iconClass: 'dijitIcon dijitIconFolderOpen',
style: {
@ -170,7 +196,7 @@ define("webodf/editor/Tools", [
// Save
if (saveOdtFile) {
saveButton = new Button({
label: translator('save'),
label: tr('Save'),
showLabel: false,
iconClass: 'dijitEditorIcon dijitEditorIconSave',
style: {
@ -187,7 +213,7 @@ define("webodf/editor/Tools", [
// Format menu
formatDropDownMenu = new DropDownMenu({});
paragraphStylesMenuItem = new MenuItem({
label: translator("paragraph_DDD")
label: tr("Paragraph...")
});
formatDropDownMenu.addChild(paragraphStylesMenuItem);
@ -204,7 +230,7 @@ define("webodf/editor/Tools", [
formatMenuButton = new DropDownButton({
dropDown: formatDropDownMenu,
label: translator('format'),
label: tr('Format'),
iconClass: "dijitIconEditTask",
style: {
float: 'left'
@ -212,9 +238,18 @@ define("webodf/editor/Tools", [
});
formatMenuButton.placeAt(toolbar);
if (args.imageInsertingEnabled) {
imageInserter = new ImageInserter(function (widget) {
widget.placeAt(toolbar);
widget.startup();
});
sessionSubscribers.push(imageInserter);
imageInserter.onToolDone = onToolDone;
}
if (close) {
closeButton = new Button({
label: translator('close'),
label: tr('Close'),
showLabel: false,
iconClass: 'dijitEditorIcon dijitEditorIconCancel',
style: {

@ -10,6 +10,9 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
@ -30,7 +33,7 @@
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
define({

@ -9,6 +9,9 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
@ -29,7 +32,7 @@
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
define({
root: {
@ -91,7 +94,8 @@ define({
color: "Color",
text: "Text",
background: "Background",
defaultStyle: "Default Style"
defaultStyle: "Default Style",
insertImage: "Insert Image"
},
de: true,

@ -9,6 +9,9 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
@ -29,7 +32,7 @@
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
define({
file: 'досье',

@ -10,6 +10,9 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
@ -30,7 +33,7 @@
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global ops, SessionList*/
@ -38,7 +41,7 @@
/**
* @interface
*/
ServerFactory = function Server() {"use strict"; };
function ServerFactory() {"use strict"; };
/**
* @return {!ops.Server}

@ -3,34 +3,24 @@
* Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* The JavaScript code in this page is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* (GNU AGPL) as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. The code is distributed
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
* This file is part of WebODF.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
* WebODF is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License (GNU AGPL)
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* As a special exception to the AGPL, any HTML file which merely makes function
* calls to this code, and for that purpose includes it by reference shall be
* deemed a separate work for copyright law purposes. In addition, the copyright
* holders of this code give you permission to combine this code with free
* software libraries that are released under the GNU LGPL. You may copy and
* distribute such a system following the terms of the GNU AGPL for this code
* and the LGPL for the libraries. If you modify this code, you may extend this
* exception to your version of the code, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your
* version.
* WebODF is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* This license applies to this entire compilation.
* You should have received a copy of the GNU Affero General Public License
* along with WebODF. If not, see <http://www.gnu.org/licenses/>.
* @licend
*
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global define, require, OC*/

@ -3,34 +3,24 @@
* Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* The JavaScript code in this page is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* (GNU AGPL) as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. The code is distributed
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
* This file is part of WebODF.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
* WebODF is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License (GNU AGPL)
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* As a special exception to the AGPL, any HTML file which merely makes function
* calls to this code, and for that purpose includes it by reference shall be
* deemed a separate work for copyright law purposes. In addition, the copyright
* holders of this code give you permission to combine this code with free
* software libraries that are released under the GNU LGPL. You may copy and
* distribute such a system following the terms of the GNU AGPL for this code
* and the LGPL for the libraries. If you modify this code, you may extend this
* exception to your version of the code, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your
* version.
* WebODF is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* This license applies to this entire compilation.
* You should have received a copy of the GNU Affero General Public License
* along with WebODF. If not, see <http://www.gnu.org/licenses/>.
* @licend
*
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global runtime, ops*/

@ -3,34 +3,24 @@
* Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* The JavaScript code in this page is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* (GNU AGPL) as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. The code is distributed
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
* This file is part of WebODF.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
* WebODF is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License (GNU AGPL)
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* As a special exception to the AGPL, any HTML file which merely makes function
* calls to this code, and for that purpose includes it by reference shall be
* deemed a separate work for copyright law purposes. In addition, the copyright
* holders of this code give you permission to combine this code with free
* software libraries that are released under the GNU LGPL. You may copy and
* distribute such a system following the terms of the GNU AGPL for this code
* and the LGPL for the libraries. If you modify this code, you may extend this
* exception to your version of the code, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your
* version.
* WebODF is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* This license applies to this entire compilation.
* You should have received a copy of the GNU Affero General Public License
* along with WebODF. If not, see <http://www.gnu.org/licenses/>.
* @licend
*
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global runtime, ops*/
@ -81,8 +71,6 @@ define("webodf/editor/server/pullbox/OperationRouter", [], function () {
unplayedServerOpspecQueue = [],
/** @type {!Array.<!Function>} sync request callbacks which should be called after the received ops have been applied server */
uncalledSyncRequestCallbacksQueue = [],
/** @type {!Array.<!function(!boolean):undefined>} ops created since the last sync call to the server */
hasLocalUnsyncedOpsStateSubscribers = [],
/**@type{!boolean}*/
hasLocalUnsyncedOps = false,
/**@type{!boolean} tells if any local ops have been modifying ops */
@ -92,10 +80,11 @@ define("webodf/editor/server/pullbox/OperationRouter", [], function () {
/**@const*/syncOpsDelay = 3000,
/**@const*/idleDelay = 5000;
/**
* @return {undefined}
*/
function updateHasLocalUnsyncedOpsState() {
var i,
hasLocalUnsyncedOpsNow = (unsyncedClientOpspecQueue.length > 0);
var hasLocalUnsyncedOpsNow = (unsyncedClientOpspecQueue.length > 0);
// no change?
if (hasLocalUnsyncedOps === hasLocalUnsyncedOpsNow) {
@ -103,45 +92,6 @@ define("webodf/editor/server/pullbox/OperationRouter", [], function () {
}
hasLocalUnsyncedOps = hasLocalUnsyncedOpsNow;
for (i=0; i<hasLocalUnsyncedOpsStateSubscribers.length; i+=1) {
hasLocalUnsyncedOpsStateSubscribers[i](hasLocalUnsyncedOps);
}
}
/**
* @param {!Array.<!Object>} opspecs
* @return {!Array.<!Object>}
*/
function compressOpSpecs(opspecs) {
var i, j, op,
result = [];
i = 0;
while (i < opspecs.length) {
// use factory to create an instance, and playback!
op = operationFactory.create(opspecs[i]);
// is known op and can do merge?
if (op !== null && op.merge) {
// go over the following and try to merge them
for (j = i+1; j < opspecs.length; j += 1) {
if (!op.merge(opspecs[j])) {
break;
}
runtime.log("Merged: "+opspecs[i].optype+" with "+opspecs[j].optype);
}
// add the resulting op to the results
result.push(op.spec());
// and continue with the one which could not be merged, or behind end
i = j;
} else {
// just pass on
result.push(opspecs[i]);
i += 1;
}
}
runtime.log("Merged: from "+opspecs.length+" to "+result.length+" specs");
return result;
}
/**
@ -307,12 +257,12 @@ runtime.log("OperationRouter: sending sync_ops call");
if (response.ops.length > 0) {
// no new locally in the meantime?
if (unsyncedClientOpspecQueue.length === 0) {
receiveOpSpecsFromNetwork(compressOpSpecs(response.ops), syncRequestCallbacksArray);
receiveOpSpecsFromNetwork(response.ops, syncRequestCallbacksArray);
} else {
// transform server ops against new local ones and apply,
// transform and send new local ops to server
runtime.log("meh, have new ops locally meanwhile, have to do transformations.");
hasUnresolvableConflict = !handleOpsSyncConflict(compressOpSpecs(response.ops));
hasUnresolvableConflict = !handleOpsSyncConflict(response.ops);
syncRequestCallbacksQueue = syncRequestCallbacksArray.concat(syncRequestCallbacksQueue);
}
// and note server state
@ -333,7 +283,7 @@ runtime.log("OperationRouter: sending sync_ops call");
// transform server ops against new local ones and apply,
// transform and request new send new local ops to server
runtime.log("meh, server has new ops meanwhile, have to do transformations.");
hasUnresolvableConflict = !handleOpsSyncConflict(compressOpSpecs(response.ops));
hasUnresolvableConflict = !handleOpsSyncConflict(response.ops);
// and note server state
lastServerSeq = response.head_seq;
// try again instantly
@ -441,13 +391,10 @@ runtime.log("OperationRouter: instant opsSync requested");
/**
* Brings the locally created operations into the game.
*
* @param {!ops.Operation} op
* @param {!Array.<!ops.Operation>} operations
* @return {undefined}
*/
this.push = function (op) {
var timedOp,
opspec = op.spec();
this.push = function (operations) {
if (hasUnresolvableConflict) {
return;
}
@ -459,17 +406,22 @@ runtime.log("OperationRouter: instant opsSync requested");
return;
}
// note if any local ops modified TODO: find less fragile way, perhaps have the operationFactory check it?
hasPushedModificationOps = hasPushedModificationOps || !/^(AddCursor|MoveCursor|RemoveCursor)$/.test(opspec.optype);
operations.forEach(function(op) {
var timedOp,
opspec = op.spec();
// note if any local ops modified TODO: find less fragile way, perhaps have the operationFactory check it?
hasPushedModificationOps = hasPushedModificationOps || !/^(AddCursor|MoveCursor|RemoveCursor)$/.test(opspec.optype);
// apply locally
opspec.timestamp = (new Date()).getTime();
timedOp = operationFactory.create(opspec);
// apply locally
opspec.timestamp = (new Date()).getTime();
timedOp = operationFactory.create(opspec);
playbackFunction(timedOp);
playbackFunction(timedOp);
// send to server
unsyncedClientOpspecQueue.push(opspec);
// send to server
unsyncedClientOpspecQueue.push(opspec);
});
triggerPushingOps();
@ -502,40 +454,5 @@ runtime.log("OperationRouter: instant opsSync requested");
}
};
this.getHasLocalUnsyncedOpsAndUpdates = function (subscriber) {
var i;
// detect double subscription
for (i=0; i<hasLocalUnsyncedOpsStateSubscribers.length; i+=1) {
if (subscribers[i] === subscriber) {
break;
}
}
if (i < hasLocalUnsyncedOpsStateSubscribers.length) {
// already subscribed
runtime.log("double subscription request in PullBoxMemberModel::getHasLocalUnsyncedOpsAndUpdates");
} else {
// subscribe
hasLocalUnsyncedOpsStateSubscribers.push(subscriber);
}
subscriber(hasLocalUnsyncedOps);
};
/*jslint emptyblock: true, unparam: true*/
this.unsubscribeHasLocalUnsyncedOpsUpdates = function (subscriber) {
var i;
for (i=0; i<hasLocalUnsyncedOpsStateSubscribers.length; i+=1) {
if (hasLocalUnsyncedOpsStateSubscribers[i] === subscriber) {
break;
}
}
runtime.assert((i < hasLocalUnsyncedOpsStateSubscribers.length),
"tried to unsubscribe when not subscribed in PullBoxMemberModel::getHasLocalUnsyncedOpsAndUpdates");
hasLocalUnsyncedOpsStateSubscribers.splice(i,1);
};
};
});

@ -3,34 +3,24 @@
* Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* The JavaScript code in this page is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* (GNU AGPL) as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. The code is distributed
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
* This file is part of WebODF.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
* WebODF is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License (GNU AGPL)
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* As a special exception to the AGPL, any HTML file which merely makes function
* calls to this code, and for that purpose includes it by reference shall be
* deemed a separate work for copyright law purposes. In addition, the copyright
* holders of this code give you permission to combine this code with free
* software libraries that are released under the GNU LGPL. You may copy and
* distribute such a system following the terms of the GNU AGPL for this code
* and the LGPL for the libraries. If you modify this code, you may extend this
* exception to your version of the code, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your
* version.
* WebODF is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* This license applies to this entire compilation.
* You should have received a copy of the GNU Affero General Public License
* along with WebODF. If not, see <http://www.gnu.org/licenses/>.
* @licend
*
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global XMLHttpRequest, runtime, core, ops*/

@ -3,34 +3,24 @@
* Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* The JavaScript code in this page is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* (GNU AGPL) as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. The code is distributed
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
* This file is part of WebODF.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
* WebODF is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License (GNU AGPL)
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* As a special exception to the AGPL, any HTML file which merely makes function
* calls to this code, and for that purpose includes it by reference shall be
* deemed a separate work for copyright law purposes. In addition, the copyright
* holders of this code give you permission to combine this code with free
* software libraries that are released under the GNU LGPL. You may copy and
* distribute such a system following the terms of the GNU AGPL for this code
* and the LGPL for the libraries. If you modify this code, you may extend this
* exception to your version of the code, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your
* version.
* WebODF is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* This license applies to this entire compilation.
* You should have received a copy of the GNU Affero General Public License
* along with WebODF. If not, see <http://www.gnu.org/licenses/>.
* @licend
*
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global define, document, require, runtime, ops */

@ -3,34 +3,24 @@
* Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* The JavaScript code in this page is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* (GNU AGPL) as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. The code is distributed
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
* This file is part of WebODF.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
* WebODF is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License (GNU AGPL)
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* As a special exception to the AGPL, any HTML file which merely makes function
* calls to this code, and for that purpose includes it by reference shall be
* deemed a separate work for copyright law purposes. In addition, the copyright
* holders of this code give you permission to combine this code with free
* software libraries that are released under the GNU LGPL. You may copy and
* distribute such a system following the terms of the GNU AGPL for this code
* and the LGPL for the libraries. If you modify this code, you may extend this
* exception to your version of the code, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your
* version.
* WebODF is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* This license applies to this entire compilation.
* You should have received a copy of the GNU Affero General Public License
* along with WebODF. If not, see <http://www.gnu.org/licenses/>.
* @licend
*
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global define, ops, runtime */

@ -0,0 +1,103 @@
/**
* @license
* Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* The JavaScript code in this page is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* (GNU AGPL) as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. The code is distributed
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* As a special exception to the AGPL, any HTML file which merely makes function
* calls to this code, and for that purpose includes it by reference shall be
* deemed a separate work for copyright law purposes. In addition, the copyright
* holders of this code give you permission to combine this code with free
* software libraries that are released under the GNU LGPL. You may copy and
* distribute such a system following the terms of the GNU AGPL for this code
* and the LGPL for the libraries. If you modify this code, you may extend this
* exception to your version of the code, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your
* version.
*
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global define, require */
define("webodf/editor/widgets/annotation", [
"dijit/form/Button"],
function (Button) {
"use strict";
var AnnotationControl = function (callback) {
var self = this,
widget = {},
addAnnotationButton,
annotationManager;
addAnnotationButton = new Button({
label: runtime.tr('Annotate'),
disabled: true,
showLabel: false,
iconClass: 'dijitIconBookmark',
onClick: function () {
if (annotationManager) {
annotationManager.addAnnotation();
self.onToolDone();
}
}
});
widget.children = [addAnnotationButton];
widget.startup = function () {
widget.children.forEach(function (element) {
element.startup();
});
};
widget.placeAt = function (container) {
widget.children.forEach(function (element) {
element.placeAt(container);
});
return widget;
};
function onAnnotatableChanged(isAnnotatable) {
addAnnotationButton.setAttribute('disabled', !isAnnotatable);
}
this.setEditorSession = function (session) {
if (annotationManager) {
annotationManager.unsubscribe(gui.AnnotationManager.annotatableChanged, onAnnotatableChanged);
}
annotationManager = session && session.sessionController.getAnnotationManager();
if (annotationManager) {
annotationManager.subscribe(gui.AnnotationManager.annotatableChanged, onAnnotatableChanged);
}
onAnnotatableChanged(annotationManager && annotationManager.isAnnotatable());
};
this.onToolDone = function () {};
callback(widget);
};
return AnnotationControl;
}
);

@ -4,22 +4,22 @@
<body>
<div data-dojo-type="dijit/form/Form" id="alignmentPaneForm" data-dojo-id="alignmentPaneForm">
<h3 text-i18n="options">Options</h3>
<h3 text-i18n="Options">Options</h3>
<input type="radio" data-dojo-type="dijit/form/RadioButton" name="textAlign" id="radioLeft" checked value="left"/>
<label text-i18n="left" for="radioLeft">Left</label> <br/>
<label text-i18n="Left" for="radioLeft"></label> <br/>
<input type="radio" data-dojo-type="dijit/form/RadioButton" name="textAlign" id="radioCenter" value="center"/>
<label text-i18n="center" for="radioCenter">Center</label> <br/>
<label text-i18n="Center" for="radioCenter"></label> <br/>
<input type="radio" data-dojo-type="dijit/form/RadioButton" name="textAlign" id="radioRight" value="right"/>
<label text-i18n="right" for="radioRight">Right</label> <br/>
<label text-i18n="Right" for="radioRight"></label> <br/>
<input type="radio" data-dojo-type="dijit/form/RadioButton" name="textAlign" id="radioJustified" value="justify"/>
<label text-i18n="justified" for="radioJustified">Justified</label> <br/>
<label text-i18n="Justified" for="radioJustified"></label> <br/>
<h3><span text-i18n="spacing">Spacing</span> <small>(mm)</small></h3>
<h3><span text-i18n="Spacing"></span> <small>(mm)</small></h3>
<div style = "margin-top: 10px;">
<div style = "float: right; margin-right: 200px;">
<label text-i18n="top" for="topMargin">Top</label>
<label text-i18n="Top" for="topMargin"></label>
<input data-dojo-type="dijit/form/NumberSpinner" id="topMargin"
value="0"
data-dojo-props="smallDelta:1, constraints:{min:0,max:100}"
@ -28,7 +28,7 @@
</div>
<br><br>
<div style = "float: left;">
<label text-i18n="left" for="leftMargin">Left</label>
<label text-i18n="Left" for="leftMargin"></label>
<input data-dojo-type="dijit/form/NumberSpinner" id="leftMargin"
value="0"
data-dojo-props="smallDelta:1, constraints:{min:0,max:100}"
@ -36,7 +36,7 @@
/>
</div>
<div style = "float: right; margin-right: 50px;">
<label text-i18n="right" for="rightMargin">Right</label>
<label text-i18n="Right" for="rightMargin"></label>
<input data-dojo-type="dijit/form/NumberSpinner" id="rightMargin"
value="0"
data-dojo-props="smallDelta:1, constraints:{min:0,max:100}"
@ -45,7 +45,7 @@
</div>
<br/><br>
<div style = "float: right; margin-right: 200px;">
<label text-i18n="bottom" for="bottomMargin">Bottom</label>
<label text-i18n="Bottom" for="bottomMargin"></label>
<input data-dojo-type="dijit/form/NumberSpinner" id="bottomMargin"
value="0"
data-dojo-props="smallDelta:1, constraints:{min:0,max:100}"

@ -10,6 +10,9 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
@ -30,10 +33,10 @@
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global runtime,core,define,require,document,dijit */
/*global runtime,core,define,require,dijit */
runtime.loadClass("core.CSSUnits");
@ -103,13 +106,13 @@ define("webodf/editor/widgets/dialogWidgets/alignmentPane", [], function () {
runtime.assert(editorBase, "webodf/editor path not defined in dojoConfig");
ready(function () {
contentPane = new ContentPane({
title: document.translator("alignment"),
title: runtime.tr("Alignment"),
href: editorBase+"/widgets/dialogWidgets/alignmentPane.html",
preload: true
});
contentPane.onLoad = function () {
form = dijit.byId('alignmentPaneForm');
document.translateContent(form.domNode);
runtime.translateContent(form.domNode);
};
return cb();
});

@ -4,23 +4,23 @@
<body>
<div data-dojo-type="dijit/form/Form" id="fontEffectsPaneForm" data-dojo-id="fontEffectsPaneForm">
<h3 text-i18n="style">Style</h3>
<h3 text-i18n="Style"></h3>
<input data-dojo-type="dijit/form/CheckBox" name="textStyle" id="radioBold" value="bold"/>
<label text-i18n="bold" for="radioBold">Bold</label> <br/>
<label text-i18n="Bold" for="radioBold"></label> <br/>
<input data-dojo-type="dijit/form/CheckBox" name="textStyle" id="radioItalic" value="italic"/>
<label text-i18n="italic" for="radioItalic">Italic</label> <br/>
<label text-i18n="Italic" for="radioItalic"></label> <br/>
<input data-dojo-type="dijit/form/CheckBox" name="textStyle" id="radioUnderline" value="underline"/>
<label text-i18n="underline" for="radioUnderline">Underline</label> <br/>
<label text-i18n="Underline" for="radioUnderline"></label> <br/>
<h3 text-i18n="font">Font</h3>
<h3 text-i18n="Font"></h3>
<br>
<div id = 'fontPicker' class="labeledSelect" style = "float: left;">
<label text-i18n="family" for="fontName">Family:</label>
<label text-i18n="Family" for="fontName"></label>
</div>
<div style = "float: left; margin-left: 30px;">
<label for="fontSize"><span text-i18n="size">Size</span> (pt) </label>
<label for="fontSize"><span text-i18n="Size"></span> (pt) </label>
<input data-dojo-type="dijit/form/NumberSpinner" id="fontSize"
value="12"
data-dojo-props="smallDelta:1, constraints:{min:6,max:96}"
@ -29,13 +29,11 @@
</div>
<br /><br />
<h3 text-i18n="color">Color</h3>
<h3 text-i18n="Color"></h3>
<br>
<input data-dojo-type="dijit/form/TextBox" name = "color" id = "textColorTB" style="display: none;"/>
<div data-dojo-type="dijit/form/DropDownButton">
<span><span text-i18n="text" id = "textColor">
Text
</span></span>
<span><span text-i18n="Text" id = "textColor"></span></span>
<div data-dojo-type="dijit/TooltipDialog">
<div data-dojo-type="dojox.widget.ColorPicker" id="textColorPicker"></div>
</div>
@ -43,9 +41,7 @@
<input data-dojo-type="dijit/form/TextBox" name = "backgroundColor" id = "backgroundColorTB" style="display: none;"/>
<div data-dojo-type="dijit/form/DropDownButton">
<span><span text-i18n="background" id = "backgroundColor">
Background
</span></span>
<span><span text-i18n="Background" id = "backgroundColor"></span></span>
<div data-dojo-type="dijit/TooltipDialog">
<div data-dojo-type="dojox.widget.ColorPicker" id="backgroundColorPicker"></div>
</div>

@ -10,6 +10,9 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
@ -30,7 +33,7 @@
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global runtime,define,require,document,dijit */
@ -123,13 +126,12 @@ define("webodf/editor/widgets/dialogWidgets/fontEffectsPane", [], function () {
"dojox/widget/ColorPicker",
"webodf/editor/widgets/fontPicker"
], function (dojo, ready, domConstruct, ContentPane, ColorPicker, FontPicker) {
var translator = document.translator,
editorBase = dojo.config && dojo.config.paths &&
var editorBase = dojo.config && dojo.config.paths &&
dojo.config.paths['webodf/editor'];
runtime.assert(editorBase, "webodf/editor path not defined in dojoConfig");
ready(function () {
contentPane = new ContentPane({
title: translator("fontEffects"),
title: runtime.tr("Font Effects"),
href: editorBase+"/widgets/dialogWidgets/fontEffectsPane.html",
preload: true
});
@ -139,7 +141,7 @@ define("webodf/editor/widgets/dialogWidgets/fontEffectsPane", [], function () {
backgroundColorTB = dijit.byId('backgroundColorTB');
form = dijit.byId('fontEffectsPaneForm');
document.translateContent(form.domNode);
runtime.translateContent(form.domNode);
preview = document.getElementById('previewText');
textColorPicker = dijit.byId('textColorPicker');

@ -9,6 +9,9 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
@ -29,7 +32,7 @@
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global define,require,document */
define("webodf/editor/widgets/fontPicker", [

@ -0,0 +1,166 @@
/**
* @license
* Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* The JavaScript code in this page is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* (GNU AGPL) as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. The code is distributed
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* As a special exception to the AGPL, any HTML file which merely makes function
* calls to this code, and for that purpose includes it by reference shall be
* deemed a separate work for copyright law purposes. In addition, the copyright
* holders of this code give you permission to combine this code with free
* software libraries that are released under the GNU LGPL. You may copy and
* distribute such a system following the terms of the GNU AGPL for this code
* and the LGPL for the libraries. If you modify this code, you may extend this
* exception to your version of the code, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your
* version.
*
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global define,require,document,Image,FileReader,window,runtime,ops */
define("webodf/editor/widgets/imageInserter", [
"dijit/form/Button",
"webodf/editor/EditorSession"],
function (Button, EditorSession) {
"use strict";
var ImageInserter = function (callback) {
var self = this,
widget = {},
insertImageButton,
editorSession,
fileLoader;
/**
* @param {!string} content as datauri
* @param {!string} mimetype
* @return {undefined}
*/
function insertImageOnceLoaded(mimetype, content) {
var hiddenImage = new Image();
hiddenImage.style.position = "absolute";
hiddenImage.style.left = "-99999px";
document.body.appendChild(hiddenImage);
hiddenImage.onload = function () {
// remove the data:image/jpg;base64, bit
content = content.substring(content.indexOf(",") + 1);
if (editorSession) {
editorSession.insertImage(mimetype, content, hiddenImage.width, hiddenImage.height);
}
// clean up
document.body.removeChild(hiddenImage);
self.onToolDone();
};
hiddenImage.src = content;
}
function fileSelectHandler(evt) {
var file, files, reader;
files = (evt.target && evt.target.files) || (evt.dataTransfer && evt.dataTransfer.files);
if (files && files.length === 1) {
file = files[0];
reader = new FileReader();
reader.onloadend = function () {
if (reader.readyState === 2) {
insertImageOnceLoaded(file.type, reader.result);
} else {
runtime.log("Image could not be loaded");
self.onToolDone();
}
};
reader.readAsDataURL(file);
}
}
function createFileLoader() {
var form = document.createElement("form"),
input = document.createElement("input");
form.appendChild(input);
form.id = "imageForm";
form.style.display = "none";
input.id = "imageLoader";
input.setAttribute("type", "file");
input.setAttribute("accept", "image/*");
input.addEventListener("change", fileSelectHandler, false);
document.body.appendChild(form);
return {input: input, form: form};
}
insertImageButton = new Button({
label: runtime.tr("Insert Image"),
disabled: true,
showLabel: false,
iconClass: "dijitEditorIcon dijitEditorIconInsertImage",
onClick: function () {
if (!fileLoader) {
fileLoader = createFileLoader();
}
fileLoader.form.reset();
fileLoader.input.click();
}
});
widget.children = [insertImageButton];
widget.startup = function () {
widget.children.forEach(function (element) {
element.startup();
});
};
widget.placeAt = function (container) {
widget.children.forEach(function (element) {
element.placeAt(container);
});
return widget;
};
function handleCursorMoved(cursor) {
var disabled = cursor.getSelectionType() === ops.OdtCursor.RegionSelection;
// LO/AOO pops up the picture/frame option dialog if image is selected when pressing the button
// Since we only support inline images, disable the button for now.
insertImageButton.setAttribute('disabled', disabled);
}
this.setEditorSession = function (session) {
if (editorSession) {
editorSession.unsubscribe(EditorSession.signalCursorMoved, handleCursorMoved);
}
editorSession = session;
if (editorSession) {
editorSession.subscribe(EditorSession.signalCursorMoved, handleCursorMoved);
}
widget.children.forEach(function (element) {
element.setAttribute("disabled", !session);
});
};
this.onToolDone = function () {};
callback(widget);
};
return ImageInserter;
});

@ -10,6 +10,9 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
@ -30,20 +33,22 @@
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global define,require,document */
/*global define,require,ops,gui */
define("webodf/editor/widgets/paragraphAlignment", [
"dijit/form/ToggleButton",
"dijit/form/Button"],
"dijit/form/Button",
"webodf/editor/EditorSession"],
function (ToggleButton, Button) {
function (ToggleButton, Button, EditorSession) {
"use strict";
var ParagraphAlignment = function (callback) {
var self = this,
editorSession,
widget = {},
directParagraphStyler,
justifyLeft,
@ -54,7 +59,7 @@ define("webodf/editor/widgets/paragraphAlignment", [
outdent;
justifyLeft = new ToggleButton({
label: document.translator('justifyLeft'),
label: runtime.tr('Align Left'),
disabled: true,
showLabel: false,
checked: false,
@ -66,7 +71,7 @@ define("webodf/editor/widgets/paragraphAlignment", [
});
justifyCenter = new ToggleButton({
label: document.translator('justifyCenter'),
label: runtime.tr('Center'),
disabled: true,
showLabel: false,
checked: false,
@ -78,7 +83,7 @@ define("webodf/editor/widgets/paragraphAlignment", [
});
justifyRight = new ToggleButton({
label: document.translator('justifyRight'),
label: runtime.tr('Align Right'),
disabled: true,
showLabel: false,
checked: false,
@ -90,7 +95,7 @@ define("webodf/editor/widgets/paragraphAlignment", [
});
justifyFull = new ToggleButton({
label: document.translator('justifyFull'),
label: runtime.tr('Justify'),
disabled: true,
showLabel: false,
checked: false,
@ -102,7 +107,7 @@ define("webodf/editor/widgets/paragraphAlignment", [
});
outdent = new Button({
label: document.translator('outdent'),
label: runtime.tr('Decrease Indent'),
disabled: true,
showLabel: false,
iconClass: "dijitEditorIcon dijitEditorIconOutdent",
@ -113,7 +118,7 @@ define("webodf/editor/widgets/paragraphAlignment", [
});
indent = new Button({
label: document.translator('indent'),
label: runtime.tr('Increase Indent'),
disabled: true,
showLabel: false,
iconClass: "dijitEditorIcon dijitEditorIconIndent",
@ -161,7 +166,14 @@ define("webodf/editor/widgets/paragraphAlignment", [
});
}
this.setEditorSession = function(session) {
function handleCursorMoved(cursor) {
var disabled = cursor.getSelectionType() === ops.OdtCursor.RegionSelection;
widget.children.forEach(function (element) {
element.setAttribute('disabled', disabled);
});
}
this.setEditorSession = function (session) {
if (directParagraphStyler) {
directParagraphStyler.unsubscribe(gui.DirectParagraphStyler.paragraphStylingChanged, updateStyleButtons);
}
@ -178,6 +190,14 @@ define("webodf/editor/widgets/paragraphAlignment", [
isAlignedRight: directParagraphStyler ? directParagraphStyler.isAlignedRight() : false,
isAlignedJustified: directParagraphStyler ? directParagraphStyler.isAlignedJustified() : false
});
if (editorSession) {
editorSession.unsubscribe(EditorSession.signalCursorMoved, handleCursorMoved);
}
editorSession = session;
if (editorSession) {
editorSession.subscribe(EditorSession.signalCursorMoved, handleCursorMoved);
}
};
this.onToolDone = function () {};

@ -10,6 +10,9 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
@ -30,7 +33,7 @@
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global define,require */
@ -38,7 +41,7 @@
define("webodf/editor/widgets/paragraphStyles",
["webodf/editor/EditorSession"],
function (EditorSession) {
function (EditorSession) {
"use strict";
/**
* @constructor
@ -47,7 +50,6 @@ define("webodf/editor/widgets/paragraphStyles",
var self = this,
editorSession,
select,
translator = document.translator,
defaultStyleUIId = ":default";
this.widget = function () {
@ -90,7 +92,7 @@ define("webodf/editor/widgets/paragraphStyles",
// Populate the Default Style always
selectionList = [{
label: translator("defaultStyle"),
label: runtime.tr("Default Style"),
value: defaultStyleUIId
}];
availableStyles = editorSession ? editorSession.getAvailableParagraphStyles() : [];
@ -166,15 +168,24 @@ define("webodf/editor/widgets/paragraphStyles",
});
}
function handleCursorMoved(cursor) {
var disabled = cursor.getSelectionType() === ops.OdtCursor.RegionSelection;
if (select) {
select.setAttribute('disabled', disabled);
}
}
this.setEditorSession = function(session) {
if (editorSession) {
editorSession.unsubscribe(EditorSession.signalCommonStyleCreated, addStyle);
editorSession.unsubscribe(EditorSession.signalCommonStyleDeleted, removeStyle);
editorSession.unsubscribe(EditorSession.signalCursorMoved, handleCursorMoved);
}
editorSession = session;
if (editorSession) {
editorSession.subscribe(EditorSession.signalCommonStyleCreated, addStyle);
editorSession.subscribe(EditorSession.signalCommonStyleDeleted, removeStyle);
editorSession.subscribe(EditorSession.signalCursorMoved, handleCursorMoved);
populateStyles();
}
};

@ -10,6 +10,9 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
@ -30,10 +33,10 @@
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global define,require,document,dojo,dijit */
/*global define,require,dojo,dijit */
define("webodf/editor/widgets/paragraphStylesDialog", [], function () {
"use strict";
@ -54,7 +57,7 @@ define("webodf/editor/widgets/paragraphStylesDialog", [], function () {
"dijit/form/DropDownButton",
"dijit/form/RadioButton"], function (Dialog, TooltipDialog, popup, TabContainer, ContentPane, Button, DropDownButton, RadioButton) {
var i,
translator = document.translator,
tr = runtime.tr,
tabContainer,
flowPane,
numberingPane,
@ -179,17 +182,17 @@ define("webodf/editor/widgets/paragraphStylesDialog", [], function () {
}
// Dialog
dialog = new Dialog({
title: translator("paragraphStyles")
title: tr("Paragraph Styles")
});
cloneTooltip = new TooltipDialog({
content:
'<h2 style="margin: 0;">'+translator("cloneThisStyle")+'</h2><br/>' +
'<label for="name">'+translator("newName_C")+'</label> <input data-dojo-type="dijit/form/TextBox" id="name" name="name"><br/><br/>',
'<h2 style="margin: 0;">'+tr("Clone this Style")+'</h2><br/>' +
'<label for="name">'+tr("New Name:")+'</label> <input data-dojo-type="dijit/form/TextBox" id="name" name="name"><br/><br/>',
style: "width: 300px;"
});
cloneButton = new Button({
label: translator("create"),
label: tr("Create"),
onClick: function () {
cloneStyle(stylePicker.value(), cloneTooltip.get('value').name);
cloneTooltip.reset();
@ -198,7 +201,7 @@ define("webodf/editor/widgets/paragraphStylesDialog", [], function () {
});
cloneTooltip.addChild(cloneButton);
cloneDropDown = new DropDownButton({
label: translator("clone"),
label: tr("Clone"),
showLabel: false,
iconClass: 'dijitEditorIcon dijitEditorIconCopy',
dropDown: cloneTooltip,
@ -207,7 +210,7 @@ define("webodf/editor/widgets/paragraphStylesDialog", [], function () {
dialog.addChild(cloneDropDown, 1);
deleteButton = new Button({
label: translator("delete"),
label: tr("Delete"),
showLabel: false,
iconClass: 'dijitEditorIcon dijitEditorIconDelete',
style: "float: right; margin-bottom: 5px;",
@ -227,11 +230,11 @@ define("webodf/editor/widgets/paragraphStylesDialog", [], function () {
"class": "dijitDialogPaneActionBar"
});
okButton = new dijit.form.Button({
label: translator("ok"),
label: tr("OK"),
onClick: accept
}).placeAt(actionBar);
cancelButton = new dijit.form.Button({
label: translator("cancel"),
label: tr("Cancel"),
onClick: cancel
}).placeAt(actionBar);
dialog.domNode.appendChild(actionBar);

@ -10,6 +10,9 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
@ -30,21 +33,23 @@
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global define,require,document */
/*global define,require,gui,ops */
define("webodf/editor/widgets/simpleStyles", [
"webodf/editor/widgets/fontPicker",
"dijit/form/ToggleButton",
"dijit/form/NumberSpinner"],
"dijit/form/NumberSpinner",
"webodf/editor/EditorSession"],
function (FontPicker, ToggleButton, NumberSpinner) {
function (FontPicker, ToggleButton, NumberSpinner, EditorSession) {
"use strict";
var SimpleStyles = function(callback) {
var self = this,
editorSession,
widget = {},
directTextStyler,
boldButton,
@ -56,7 +61,7 @@ define("webodf/editor/widgets/simpleStyles", [
fontPickerWidget;
boldButton = new ToggleButton({
label: document.translator('bold'),
label: runtime.tr('Bold'),
disabled: true,
showLabel: false,
checked: false,
@ -68,7 +73,7 @@ define("webodf/editor/widgets/simpleStyles", [
});
italicButton = new ToggleButton({
label: document.translator('italic'),
label: runtime.tr('Italic'),
disabled: true,
showLabel: false,
checked: false,
@ -80,7 +85,7 @@ define("webodf/editor/widgets/simpleStyles", [
});
underlineButton = new ToggleButton({
label: document.translator('underline'),
label: runtime.tr('Underline'),
disabled: true,
showLabel: false,
checked: false,
@ -92,7 +97,7 @@ define("webodf/editor/widgets/simpleStyles", [
});
strikethroughButton = new ToggleButton({
label: document.translator('strikethrough'),
label: runtime.tr('Strikethrough'),
disabled: true,
showLabel: false,
checked: false,
@ -104,7 +109,7 @@ define("webodf/editor/widgets/simpleStyles", [
});
fontSizeSpinner = new NumberSpinner({
label: document.translator('size'),
label: runtime.tr('Size'),
disabled: true,
showLabel: false,
value: 12,
@ -170,6 +175,13 @@ define("webodf/editor/widgets/simpleStyles", [
});
}
function handleCursorMoved(cursor) {
var disabled = cursor.getSelectionType() === ops.OdtCursor.RegionSelection;
widget.children.forEach(function (element) {
element.setAttribute('disabled', disabled);
});
}
this.setEditorSession = function(session) {
if (directTextStyler) {
directTextStyler.unsubscribe(gui.DirectTextStyler.textStylingChanged, updateStyleButtons);
@ -190,6 +202,14 @@ define("webodf/editor/widgets/simpleStyles", [
fontSize: directTextStyler ? directTextStyler.fontSize() : undefined,
fontName: directTextStyler ? directTextStyler.fontName() : undefined
});
if (editorSession) {
editorSession.unsubscribe(EditorSession.signalCursorMoved, handleCursorMoved);
}
editorSession = session;
if (editorSession) {
editorSession.subscribe(EditorSession.signalCursorMoved, handleCursorMoved);
}
};
this.onToolDone = function () {};

@ -10,6 +10,9 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
@ -30,7 +33,7 @@
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global define, require */

@ -10,6 +10,9 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
@ -30,10 +33,10 @@
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global define,require,document */
/*global define,require*/
define("webodf/editor/widgets/undoRedoMenu",
["webodf/editor/EditorSession"],
@ -51,7 +54,7 @@ define("webodf/editor/widgets/undoRedoMenu",
var widget = {};
undoButton = new Button({
label: document.translator('undo'),
label: runtime.tr('Undo'),
showLabel: false,
disabled: true, // TODO: get current session state
iconClass: "dijitEditorIcon dijitEditorIconUndo",
@ -63,7 +66,7 @@ define("webodf/editor/widgets/undoRedoMenu",
});
redoButton = new Button({
label: document.translator('redo'),
label: runtime.tr('Redo'),
showLabel: false,
disabled: true, // TODO: get current session state
iconClass: "dijitEditorIcon dijitEditorIconRedo",

@ -10,6 +10,9 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
@ -30,10 +33,10 @@
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: http://gitorious.org/webodf/webodf/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global define,require,document */
/*global define,require*/
define("webodf/editor/widgets/zoomSlider", [], function () {
"use strict";

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -167,7 +167,9 @@ var documentsMain = {
var serverFactory = new ServerFactory();
documentsMain.esId = response.es_id;
documentsMain.memberId = response.member_id;
// TODO: set webodf translation system, by passing a proper function translate(!string):!string in "runtime.setTranslator(translate);"
documentsMain.webodfServerInstance = serverFactory.createServer();
documentsMain.webodfServerInstance.setToken(oc_requesttoken);
documentsMain.webodfEditorInstance = new Editor({unstableFeaturesEnabled: documentsMain.useUnstable}, documentsMain.webodfServerInstance, serverFactory);

Loading…
Cancel
Save