Commit Graph
125 Commits
Author SHA1 Message Date
Satvik Kumar b02b461e60 Remove style element functions from OdtDocument
Removed getStyleElement, getParagraphStyleElement and
getParagraphStyleAttributes from OdtDocument as these functions simply
redirect to their implementations in odf.Formatting.
2014-08-13 23:20:15 +10:00
Satvik Kumar a714866c52 Removed getParagraphElement from OdtDocument
This function only redirected to the OdfUtils version and many callers
already had an existing instance of OdfUtils to use. Any callers who did
not have an instance of OdfUtils now create one to continue using the
function.
2014-08-13 23:15:50 +10:00
Satvik Kumar 865541a3ed Use core.StepsDirection enum for rounding direction
The rounding direction constants in OdtStepsTranslator overlap with the
existing enum in core.StepsDirection. It makes sense to use that enum here
to specify rounding behaviour in converting DOM points to steps so the
constants have been removed and the enum has been substituted for all
usages.
2014-08-07 23:53:05 +10:00
Satvik Kumar 482e98da74 Remove rounding predicate from step conversion
This removes the option to provide a rounding predicate to decide whether
to round up or down from the convertDomPointToCursorStep method. It is replaced
with an enum that specifies whether to round up or down. The predicate was
removed as all callers supplied the same function to indicate they wanted
round up behaviour and this predicate was being duplicated.

The rounding parameter is optional and defaults to rounding down to the
previous step which is the same as before this commit.
2014-08-07 23:07:57 +10:00
Philip Peitsch c845342406 Extract viewport management logic into standalone system
Simplifies the caret class, and allows more exotic view configurations
to be inserted without breaking core code.

As a bonus, the new Viewport class is able to scroll arbitrary
rectangles into view.
2014-08-05 21:26:27 +10:00
Aditya Bhatt c165702542 Add a const gui.CommonConstraints, which lists
the common constraints that come with and are
respected by WebODF.

Use these constraints in all previous occurrences.
2014-06-06 15:11:32 +02:00
Aditya Bhatt 033bda34a8 Hide annotation removal buttons of other authors
when the edit.annotations.onlyDeleteOwn constraint
is enabled.
2014-06-06 15:11:32 +02:00
Aditya Bhatt 052a3cf04a Move image insertion code from EditorSession to ImageInserter.
This allows access to controllers directly in the widget, as is
the convention.
2014-06-06 15:11:31 +02:00
Aditya Bhatt 1467ea6d2a Introduce "Review Mode".
Let DirectFormattingController obey this "edit.reviewMode"
constraint by not creating any operations or processing any
action to format text when the cursor is not within the local
user's annotation.

Signals are exposed to toolbar widgets so they may
enable/disable themselves on the fly depending on the cursor
context.
2014-06-06 15:11:29 +02:00
Aditya Bhatt 51ee5624c4 Add a constraint to disallow deleting others' annotations.
This introduces SessionConstraints into SessionController
and AnnotationController. The latter comes with a new
permission, namely "edit.annotations.onlyDeleteOwn".

Code is added into AnnotationController to check
for the author name of the annotation node to be deleted,
and do nothing if it matches the name of the current
user.
2014-06-06 14:30:44 +02:00
Friedrich W. H. Kossebau 7f80e8e163 Normalize license headers of editor/benchmark/tests/firefox-addon/viewer source files
* remove @license tag, for consistency with library source files
* use copyright@kogmbh.com email address everywhere
* remove "additional permission", to be added only to released stuff
* separate license header by empty line from following content
2014-06-02 17:49:46 +02:00
Friedrich W. H. Kossebau b91a97c21f add flags to enable/disable all editor (toolbar) action sets 2014-05-27 13:42:28 +02:00
Friedrich W. H. Kossebau 545ece257f Fix: disable annotation creation key combo in collab editor 2014-04-14 13:11:38 +02:00
Friedrich W. H. Kossebau fd020eee3f Use Error objects in callback passed to "destroy" methods
The currently plain undefined objects are not useful at all, because
the properties are undefined.
2014-04-11 13:53:10 +02:00
Philip Peitsch acef143923 Move ODT-specific logic out of StepsCache into the steps translator
This is purely a refactor laying the groundwork for fixing the failing
operations tests. There are no expected functional impacts.
2014-04-09 17:05:32 +10:00
lli cba658f622 Add tooltip support for hyperlink 2014-03-17 22:39:09 +11:00
Philip Peitsch c0d8d41ea2 Expose the SessionController's undo/redo interfaces for the editor
Undo has additional logic to ensure the event trap is restored after
an undo is performed. At some point, this will need to split out of
the SessionController, but for now it is simplest to expose this to
the EditorSession for use.

Fixes remaining problems causing issue #426.
2014-02-27 13:33:23 +11:00
Jos van den Oever 16220f4507 Move signalMemberUpdated, signalMemberRemoved and signalMemberAdded from ops.OdtDocument to ops.Document. 2014-02-24 15:19:05 +01:00
Jos van den Oever b3c77bf307 Move signals CursorAdded, CursorRemoved and CursorMoved to ops.Document.
This makes SvgSelectionView independent from ops.OdtDocument.
2014-02-24 15:13:13 +01:00
Friedrich W. H. Kossebau 7f20c22627 Set runtime.currentDirectory/libraryPaths in faked webodf.js for out-of-source runs
Frees "production" code from adjustments for out-of-source developer code
2014-02-17 17:19:46 +01:00
Jos van den Oever f376bbfb78 Update EditorSession to the new document API. 2014-02-05 14:24:25 +01:00
Friedrich W. H. Kossebau d2671e2a00 @returns -> @return 2014-01-31 15:33:43 +01:00
Aditya Bhatt 6921bffe71 Rename TextManipulator to TextController 2014-01-15 13:37:47 +05:30
Aditya Bhatt 1c65c0eeec Rename ImageManager to ImageController 2014-01-15 13:37:47 +05:30
Philip Peitsch 3f2b2f0fb9 Support different selection view renderers
In certain cases it is useful to be able to swap out the technique used
to render cursor selections on the document. For example, SVG polygon
based rendering interacts badly with mouse events on the WebKit build
shipped on MacOS X 10.7.5.
2013-12-19 01:55:51 +11:00
lli 353b4b68f1 Added editor buttons for applying or deleting hyperlinks 2013-12-13 17:40:22 +11:00
Philip Peitsch ebb7462022 Extend step translation interface to allow custom rounding
Step translation from a DOM point to a step usually results in some
rounding. The existing interface provided a simple bool flag to control
this, but this does not provide help for a caller that doesn't know
ahead of time which step is "closer" to the desired node (e.g., asking
for steps at paragraph boundaries should round within the paragraph).

This extension now allows a custom delegate that will be called with the
prev and next position to choose between rounding options.
2013-11-28 00:35:36 +11:00
Aditya Bhatt f5883fe47e Apply paragraph style to all paragraphs in the cursor
selection.

* Modify OdtDocument.convertDomPointToCursorStep(),
which takes a node, an offset, and a boolean, and returns the steps to
that position from the root, rounded to the next allowed
position if the boolean is true, otherwise to the previous.

* Use this method in EditorSession.setCurrentParagraphStyle().
2013-11-26 14:02:36 +01:00
Aditya Bhatt e16cc38edb == Op-ify member data handling ==
* New operations: OpAddMember, OpRemoveMember,
OpUpdateMember.
* Member data is now handled in a memberDataManager
instance inside OdtDocument.
* Any operations must be executed only if a member
is present within this model.
* All polling code for member data has been removed;
colors, names, and images now instantly update
whenever a member data operation is executed.
* Added relevant entries to the OT Matrix.
2013-11-20 18:56:47 +01:00
Friedrich W. H. Kossebau db0ecac6ee Make directTextStyler no longer optional, now that it works also in collab mode 2013-11-15 15:30:32 +01:00
Aditya Bhatt 2dcd55205b Have dedicated Editor.closeDocument and Editor.closeSession
methods to correspond to openDocument and openSession.
Remove unused EditorSession.close method, not sure what it was
used for.
2013-11-14 21:47:26 +01:00
Friedrich W. H. Kossebau c2a795e668 Update link to repo: now https://github.com/kogmbh/WebODF/ 2013-10-23 18:20:30 +02:00
Friedrich W. H. Kossebau 508570dab8 Add copy of the AGPL3 to sources (+ add to created zip files) 2013-10-21 17:55:16 +02:00
Friedrich W. H. Kossebau f9249c08b8 Fix regression: fonts listed in resources/fonts/fonts.css became ignored
fixup for b426aab73f
2013-10-18 15:38:26 +02:00
Friedrich W. H. Kossebau 80e75c6b73 Separate annotation handling logic into a tool class AnnotationManager and UI into a editor/widgets/annotation.js
Also enable "Add annotation" button only if not inside annotations
2013-10-16 17:20:14 +02:00
Philip Peitsch 1ff4d6f9ec Upgrade from magical empty-string to const for shadow cursor memberId
In various parts of the code, the magical empty-string cursor id is used
to determine whether the object is a shadow cursor or not. Converting
this into a constant instead and removing the constructor arg prevents
some mistakes being made with this.
2013-10-16 21:43:00 +11:00
Aditya Bhatt aae55aca50 * Add a new ShadowCursor class. This class is meant, for now, to only
hold the 'selected range' fed to it, like with any other OdtCursor. It
provides a minimal OdtCursor-like interface, with only the methods
absolutely required to make it work. It does not modify the DOM in any
way.
* Make the shadowCursor object an instance of ShadowCursor, not
OdtCursor. This is ideal because ShadowCursor does not modify anything
in the DOM, and therefore is safer and faster to use for tracking
browser selections. This makes backwards-selections work finally,
because now there are no anchor nodes to interfere with the selection
whilst dragging.
* With the introduction of the ShadowCursor, we no longer have the
selection range's endpoints coinciding the with beginning and end of the
respective startContainer and endContainer. Therefore, modify
getExtremeRanges to reflect this. If an endpoint of the selection range
does not lie within a TextNode, we latch on to the nearest text node
within.
* In the SessionController, call maintainShadowSelection() if the
selection might leak outside the allowed local root, so that the
window selection object remains root-confined.
* Clone ranges if they may be later modified.
Properly detach ranges once they are used in SelectionView, less
memory leaks.
2013-10-15 11:44:24 +02:00
Aditya Bhatt b426aab73f Add a SelectionView class that can be initialized with a cursor, a
SelectionViewManager that maintains SelectionView instances, and a
shadow cursor object that is an invisible caret-less cursor, fed to both
SessionController and SessionView, which follows the selection as it
changes.
Selections by each cursor are colored according to their memberid
2013-10-15 11:44:23 +02:00
Friedrich W. H. Kossebau 55e6322bf7 Little fixes in editor code that closure compiler did not like 2013-10-07 10:45:41 +02:00
Friedrich W. H. Kossebau f46bb9e502 Change ops.OperationRouter.push to take a sequence of ops
Taking a sequence of ops also enables to give the guarantee that all
contained operations will be executed directly after each other,
in the given order. So creator of the ops can calculate the spec of each op
by relying on the known effect of the other ops.
2013-10-02 19:29:52 +02:00
Philip Peitsch 3f6790ef5f Add insert image button to the editor 2013-10-02 16:37:49 +10:00
Friedrich W. H. Kossebau 297562afb3 Consistency: "named" style -> "common" style 2013-09-20 18:50:29 +02:00
Lu Li bbb5ecef8a Refactoring: changed Op(Add|Remove)ParagraphStyle to Op(Add|Remove)Style, so they can handle all style families NOT just paragraph 2013-09-20 17:36:41 +02:00
Aditya Bhatt 57c8e6c462 Handle default styles properly in the editor.
* EditorSession gets a bit of abstraction which allows smoothly
using the same functions to handle paragraph styles, where an empty
styleName means the default style.
* The paragraphStyles widget now names the default style as ":default"
internally, because dojo could not handle "" properly as an entry value.
* OpUpdateParagraphStyle now knows to treat "" as default style.
* Translations for defaultStyle
2013-09-17 16:27:29 +02:00
Friedrich W. H. Kossebau de1103fcfe Add gui.DirectParagraphStyler, a UI-less tool specialized on direct styling of paragraphs 2013-09-10 15:52:39 +02:00
Friedrich W. H. Kossebau eb57ef2def Add gui.DirectTextStyler, a UI-less tool specialized on direct styling of text 2013-09-10 13:02:28 +02:00
Philip Peitsch 15f4bba862 Clarified document signals (common style created/deleted)
Creating an automatic style was firing signalStyleCreated/Deleted events
unexpectedly. Renamed these to signalCommonParagraphStyle* instead to
clarify that this signal only fires when "common" styles are created.

Terminology was taken from ODF specs:
http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1415058_253892949
2013-09-09 19:58:44 +10:00
Philip Peitsch d1cdcfb2cb Add direct font family and size styling support to Editor
* tweak fontPicker wrapper to be a little easier to use within other
  widgets
* keep annotation button stays in same position
2013-09-09 09:16:04 +02:00
Philip Peitsch 0d7aa91424 Forward on paragraph change events for all paragraphs within the user's selection 2013-09-06 18:30:53 +02:00
Philip Peitsch c7eac5bd5e Added buttons to editor for modifying paragraph alignment and indentation 2013-09-06 18:30:53 +02:00