42 Commits
Author SHA1 Message Date
Jos van den Oever b8ad5b3889 Upgrade to Closure Compiler 20150505.
We are now using our own copy of the externs to deal with differences
of opinion on best typing of types.
2015-06-01 08:53:35 +02:00
Philip Peitsch bb56bc684c Convert odf.OdfUtils into a static singleton 2014-09-12 10:33:27 +10:00
Philip Peitsch daff6484cf Enabled direct text styling only if current selection is a text range
Prevents the controller advertising things such as bold and underline
are valid operations for an inline image (they are not!).
2014-09-11 12:00:06 +10:00
Philip Peitsch 1d70ef17db Delay signalling of enabled state changes until the op batch is complete
The internal state is reset immediately so any external calls to disabled
features will be correctly disabled. Delaying the signal however ensures
processing of groups of operations remains performant.
2014-09-11 12:00:06 +10:00
Philip Peitsch 05e23e3814 Introduce a proper CC type to hold style selection information 2014-09-11 12:00:06 +10:00
Philip Peitsch 5445b52a7a Use text style from the selection start when splitting a paragraph 2014-08-14 23:16:45 +10:00
Philip Peitsch 36be9398d9 Fix crash if a split paragraph occurs with no text elements selected 2014-08-14 22:33:30 +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
Friedrich W. H. Kossebau 6570a00096 Hint that code correcly assumes no child elements of style:text-properties 2014-08-06 15:50:07 +02:00
Friedrich W. H. Kossebau d56cef9ac8 more odf.Formatting.StyleData/AppliedStyle typing instead of Object 2014-08-06 15:17:09 +02:00
Philip Peitsch d18d2b5b8a Migrate SelectionMover.createPositionIterator to OdtDocument
Remove the SelectionMover file entirely as it no longer contains any
functionality.
2014-08-05 10:12:17 +10:00
Philip Peitsch eb93117fc6 Fix direct cursor styling behaviour
Recent changes to Formatting.getAppliedStyles return type were not correctly
spread through the DirectFormattingController. Update the CC types and fix
incorrect type usages in this controller.

To help preserve future sanity, some rough unit tests have been added for
the specifically fixed branches ONLY.

Fixes #723.
2014-07-29 20:27:32 +10:00
Satvik Kumar 5775026be8 Added type information to applied styles calculation
The returned object from the applied styles calculation did not have
specific type information for Closure Compiler so I have added some
typedefs that describe the returned object.
2014-07-02 17:09:25 +10:00
Aditya Bhatt ba180c73b7 Rename isEnabled to enabledFeatures inside DirectFormattingController. 2014-06-18 14:00:37 +02:00
Aditya Bhatt 3d1234aa71 Generate and cache style summary for selections that do not
contain text.

This divides the `isEnabled` information of DirectFormattingController
into two parts, `directTextStyling` and `directParagraphStyling`.

The widgets are accordingly updated.
2014-06-18 13:55:49 +02:00
Aditya Bhatt 0335906fcd Attempt to read selection style information even when there
is no text element/node in the selection.
2014-06-18 13:55:49 +02:00
Philip Peitsch 7de8ff00e7 Group up style information changes and report at the end of an op batch
Operation batches that modify a large number of paragraphs (or repeatedly
modify the same paragraph) can cause numerous unnecessary style change
events to be triggered. Rather than reporting these instantly, track them
as they occur and emit the style change summary on batch end.

Related to #610.
2014-06-14 01:28:40 +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 a30858b8c3 Rename SessionContextCache to SessionContext.
Stops caching cursor range.
2014-06-06 15:11:32 +02:00
Aditya Bhatt 3f09a7d3b7 Add a new gui.SessionContextCache convenience class.
It lazily computes required information and caches it
for further use -- an initial method inside it is
isLocalCursorWithinOwnAnnotation, which contains the logic
moved from DirectFormattingController. It would have been
expensive to perform this check separately everytime the
cursor moves in each controller.
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 87339920b9 Fix wrongly displayed style information of selected images.
DirectFormattingController reads only the styling on text nodes
within the selected range. This causes wrong style information
to be communicated via signalling when the selection is an image.

This commit changes this behavior to read the style info of all
character/text elements and text nodes in the selection.

Fixes the issue where all direct and paragraph style buttons
are toggled to 'on'.
2014-06-05 13:58:42 +02:00
Friedrich W. H. Kossebau 1e2a4a8323 Normalize license headers of the webodf.js source files
* remove @license tag (to prevent Closure compiler keeping the comment)
* use copyright@kogmbh.com email address everywhere
* remove "additional permission", to be added only to released webodf.js
* separate license header by empty line from following content
2014-06-02 12:19:05 +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 fa62c38767 remove no more needed returning of the class constructor at end of class files
runtime.loadClass(...) no longer expects that eval(fileContent) yields
the constructor, and a few loaded files rely on that (e.g. all singletons/namespaces),
so let's be consistent
2014-05-22 13:31:51 +02:00
Friedrich W. H. Kossebau 134a9d4c61 Make parsing methods of odf.OdfUtils deal with undefined & null values 2014-04-30 12:02:54 +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
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
Jos van den Oever ff3c396aa6 Add core.Destroyable interface.
Every class that has a destroy() method now implements this interface.
2014-02-11 12:42:41 +01:00
Jos van den Oever bed3b62469 Make DirectFormattingController and SessionController 100% typed. 2014-02-08 14:48:22 +01:00
Jos van den Oever e632ed2ae6 Make a large number of controllers 100% typed. 2014-02-08 13:37:50 +01:00
Jos van den Oever 25fa630f0d Make some operation classes 100% typed. 2014-02-08 10:38:04 +01:00
Jos van den Oever ed7270442f Remove loadClass calls from class files. The load system reads the dependencies from the manifest.json files now. 2014-02-07 15:38:09 +01:00
Philip Peitsch 558a1e3e23 Re-use new styles when applying direct paragraph styling
We only create a new paragraph style once per unique paragraph style
name. This vastly reduces the number of new styles created when
formatting a number of paragraphs that all share the same existing
paragraph style.
2014-02-05 23:41:57 +11:00
Philip Peitsch 8c7de7c698 Refactor how style summary is retrieved to use cached values
When selecting or modifying large areas of content, the multiple
style information lookup becomes quite expensive. These can be greatly
sped up by using a common cached value + associated query object
instead.
2014-01-29 00:46:52 +11:00
Philip Peitsch 689ace79e9 Group direct formatting of multiple paragraphs into a single enqueue 2014-01-23 23:01:26 +11:00
Philip Peitsch 1eb23dc159 Simplify PositionFilterChain to not use named filters
PositionFilterChains no longer have any need to allow adding or removal
of named filters. In practice, filters are only ever added just after
construction, and remain unchanged beyond this point. This allows a
slight simplification of the PositionFilterChain interface.
2014-01-22 23:29:04 +11:00
lli 716e5bdc11 Disable the paragraph related styling methods if directParagraphStylingEnabled is false 2014-01-20 23:01:49 +11:00
lli 32f148930a Preserve the text style when splitting at the end of paragraph.
At the moment, splitting at the end of the following paragraph
<p style-name="standard">hello <span style-name="bold">world|</span></p>
will create a new paragraph like below
<p style-name="standard">|<span style-name="bold"></span></p>

The cursor is moved out of the span due to empty span is not considered as
a valid cursor position in the current design. this causes newly entered
text are not formatted correctly.

Merged DirectTextStyler and DirectParagraphStyler into
DirectFormattingController. These have become closely related concepts as
a result of changes in this patch.
2014-01-20 22:32:24 +11:00