You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ha...@apache.org on 2017/03/16 13:37:45 UTC
[25/42] flex-asjs git commit: And here’s TLF…
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd08d137/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/ElementRange.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/ElementRange.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/ElementRange.as
new file mode 100644
index 0000000..f29f776
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/ElementRange.as
@@ -0,0 +1,426 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.textLayout.edit
+{
+ import org.apache.flex.textLayout.container.IContainerController;
+ import org.apache.flex.textLayout.elements.IFlowLeafElement;
+ import org.apache.flex.textLayout.property.PropertyUtil;
+
+/**
+ * The ElementRange class represents the range of objects selected within a text flow.
+ *
+ * <p>The beginning elements
+ * (such as <code>firstLeaf</code>) are always less than or equal to the end elements (in this case, <code>lastLeaf</code>)
+ * for each pair of values in an element range.</p>
+ *
+ * @see org.apache.flex.textLayout.elements.TextFlow
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+public class ElementRange
+{
+ import org.apache.flex.textLayout.compose.IFlowComposer;
+ import org.apache.flex.textLayout.elements.IFlowLeafElement;
+ import org.apache.flex.textLayout.elements.IParagraphElement;
+ import org.apache.flex.textLayout.elements.ISubParagraphGroupElementBase;
+ import org.apache.flex.textLayout.elements.ITextFlow;
+ import org.apache.flex.textLayout.formats.Category;
+ import org.apache.flex.textLayout.formats.ITextLayoutFormat;
+ import org.apache.flex.textLayout.formats.TextLayoutFormat;
+ import org.apache.flex.textLayout.property.Property;
+
+
+
+
+ private var _absoluteStart:int;
+ private var _absoluteEnd:int;
+ private var _firstLeaf:IFlowLeafElement;
+ private var _lastLeaf:IFlowLeafElement;
+ private var _firstParagraph:IParagraphElement;
+ private var _lastParagraph:IParagraphElement;
+ private var _textFlow:ITextFlow;
+
+ /**
+ * The absolute text position of the IFlowLeafElement object that contains the start of the range.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public function get absoluteStart():int
+ {
+ return _absoluteStart;
+ }
+ public function set absoluteStart(value:int):void
+ {
+ _absoluteStart = value;
+ }
+
+ /**
+ * The absolute text position of the IFlowLeafElement object that contains the end of the range.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public function get absoluteEnd():int
+ {
+ return _absoluteEnd;
+ }
+ public function set absoluteEnd(value:int):void
+ {
+ _absoluteEnd = value;
+ }
+
+ /**
+ * The IFlowLeafElement object that contains the start of the range.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public function get firstLeaf():IFlowLeafElement
+ {
+ return _firstLeaf;
+ }
+ public function set firstLeaf(value:IFlowLeafElement):void
+ {
+ _firstLeaf = value;
+ }
+
+ /**
+ * The IFlowLeafElement object that contains the end of the range.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public function get lastLeaf():IFlowLeafElement
+ {
+ return _lastLeaf;
+ }
+ public function set lastLeaf(value:IFlowLeafElement):void
+ {
+ _lastLeaf = value;
+ }
+
+ /**
+ * The IParagraphElement object that contains the start of the range.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public function get firstParagraph():IParagraphElement
+ {
+ return _firstParagraph;
+ }
+ public function set firstParagraph(value:IParagraphElement):void
+ {
+ _firstParagraph = value;
+ }
+
+ /**
+ * The IParagraphElement object that contains the end of the range.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public function get lastParagraph():IParagraphElement
+ {
+ return _lastParagraph;
+ }
+ public function set lastParagraph(value:IParagraphElement):void
+ {
+ _lastParagraph = value;
+ }
+
+ /**
+ * The TextFlow object that contains the range.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public function get textFlow():ITextFlow
+ {
+ return _textFlow;
+ }
+ public function set textFlow(value:ITextFlow):void
+ {
+ _textFlow = value;
+ }
+
+ // This constructor function is here just to silence a compile warning in Eclipse. There
+ // appears to be no way to turn the warning off selectively.
+ /** @private */
+ CONFIG::debug public function ElementRange()
+ {
+ super();
+ }
+
+ // NOTE: We've been back and forth on this - should a range selection show null attributes or beginning of range attributes?
+ // After looking at this for a while I want it to show beginning of range attributes. Two main reasons
+ // 1. If the range contains different objects but homogoneous settings we should show the attributes.
+ // 2. If we show null attributes on a range selection there's no way to, for example, turn BOLD off.
+ // Try this at home - restore the old code. Select the entire text. Turn Bold on. Can't turn bold off.
+ // Please don't revert this without further discussion.
+ // Ideally we would have a way of figuring out which attributes are homogoneous over the selection range
+ // and which were not and showing, for example, a "half-checked" bold item. We'd have to work this out for all the properties.
+
+ // OLD CODE that shows null attribute settings on a range selection
+ // var charAttr:ICharacterFormat = selRange.begElem == selRange.endElem ? selRange.begElem.computedCharacterFormat : new CharacterFormat();
+ // var paraAttr:IParagraphFormat = selRange.begPara == selRange.endPara ? selRange.begPara.computedParagraphFormat : new ParagraphFormat();
+
+
+ /**
+ * The format attributes of the container displaying the range.
+ *
+ * <p>If the range spans more than one container, the format of the first container is returned.</p>
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public function get containerFormat():ITextLayoutFormat
+ {
+ // see NOTE above before changing!!
+ var container:IContainerController;
+ var flowComposer:IFlowComposer = _textFlow.flowComposer;
+ if (flowComposer)
+ {
+ var idx:int = flowComposer.findControllerIndexAtPosition(absoluteStart);
+ if (idx != -1)
+ container = flowComposer.getControllerAt(idx);
+ }
+ return container ? container.computedFormat : _textFlow.computedFormat;
+ }
+
+ /**
+ * The format attributes of the paragraph containing the range.
+ *
+ * <p>If the range spans more than one paragraph, the format of the first paragraph is returned.</p>
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public function get paragraphFormat():ITextLayoutFormat
+ {
+ // see NOTE above before changing!!
+ return firstParagraph.computedFormat;
+ }
+
+ /**
+ * The format attributes of the characters in the range.
+ *
+ * <p>If the range spans more than one FlowElement object, which means that more than one
+ * character format may exist within the range, the format of the first FlowElement object is returned.</p>
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public function get characterFormat():ITextLayoutFormat
+ {
+ // see NOTE above before changing!!
+ return firstLeaf.computedFormat;
+ }
+
+ /**
+ * Gets the character format attributes that are common to all characters in the text range or current selection.
+ *
+ * <p>Format attributes that do not have the same value for all characters in the element range are set to
+ * <code>null</code> in the returned TextLayoutFormat instance.</p>
+ *
+ * @return The common character style settings
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public function getCommonCharacterFormat():TextLayoutFormat
+ {
+ var leaf:IFlowLeafElement = firstLeaf;
+ var attr:TextLayoutFormat = new TextLayoutFormat(leaf.computedFormat);
+
+ for (;;)
+ {
+ if (leaf == lastLeaf)
+ break;
+ leaf = leaf.getNextLeaf();
+ attr.removeClashing(leaf.computedFormat);
+ }
+
+ return PropertyUtil.extractInCategory(TextLayoutFormat, TextLayoutFormat.description, attr, Category.CHARACTER, false) as TextLayoutFormat;
+ }
+
+ /**
+ * Gets the paragraph format attributes that are common to all paragraphs in the element range.
+ *
+ * <p>Format attributes that do not have the same value for all paragraphs in the element range are set to
+ * <code>null</code> in the returned TextLayoutFormat instance.</p>
+ *
+ * @return The common paragraph style settings
+ *
+ * @see org.apache.flex.textLayout.edit.ISelectionManager#getCommonParagraphFormat
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public function getCommonParagraphFormat():TextLayoutFormat
+ {
+ var para:IParagraphElement = firstParagraph;
+ var attr:TextLayoutFormat = new TextLayoutFormat(para.computedFormat);
+ for (;;)
+ {
+ if (para == lastParagraph)
+ break;
+ para = _textFlow.findAbsoluteParagraph(para.getAbsoluteStart()+para.textLength);
+ attr.removeClashing(para.computedFormat);
+ }
+ return PropertyUtil.extractInCategory(TextLayoutFormat,TextLayoutFormat.description,attr,Category.PARAGRAPH, false) as TextLayoutFormat;
+ }
+
+ /**
+ * Gets the container format attributes that are common to all containers in the element range.
+ *
+ * <p>Format attributes that do not have the same value for all containers in the element range are set to
+ * <code>null</code> in the returned TextLayoutFormat instance.</p>
+ *
+ * @return The common paragraph style settings
+ *
+ * @see org.apache.flex.textLayout.edit.ISelectionManager#getCommonParagraphFormat *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public function getCommonContainerFormat():TextLayoutFormat
+ {
+ var flowComposer:IFlowComposer = _textFlow.flowComposer;
+ if (!flowComposer)
+ return null;
+
+ var index:int = flowComposer.findControllerIndexAtPosition(this.absoluteStart);
+ if (index == -1)
+ return null;
+ var controller:IContainerController = flowComposer.getControllerAt(index);
+ var attr:TextLayoutFormat = new TextLayoutFormat(controller.computedFormat);
+ while (controller.absoluteStart+controller.textLength < absoluteEnd)
+ {
+ index++;
+ if (index == flowComposer.numControllers)
+ break;
+ controller = flowComposer.getControllerAt(index);
+ attr.removeClashing(controller.computedFormat);
+ }
+
+ return PropertyUtil.extractInCategory(TextLayoutFormat,TextLayoutFormat.description,attr,Category.CONTAINER, false) as TextLayoutFormat;
+ }
+
+ /**
+ * Creates an ElementRange object.
+ *
+ * @param textFlow the text flow
+ * @param beginIndex absolute text position of the first character in the text range
+ * @param endIndex one beyond the absolute text position of the last character in the text range
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ static public function createElementRange(textFlow:ITextFlow, absoluteStart:int, absoluteEnd:int):ElementRange
+ {
+ var rslt:ElementRange = new ElementRange();
+ if (absoluteStart == absoluteEnd)
+ {
+ rslt.absoluteStart = rslt.absoluteEnd = absoluteStart;
+ rslt.firstLeaf = textFlow.findLeaf(rslt.absoluteStart);
+ rslt.firstParagraph = rslt.firstLeaf.getParagraph();
+ // rslt.begContainer = rslt.endContainer = selState.textFlow.findAbsoluteContainer(rslt.begElemIdx);
+ adjustForLeanLeft(rslt);
+ rslt.lastLeaf = rslt.firstLeaf;
+ rslt.lastParagraph = rslt.firstParagraph;
+ }
+ else
+ {
+ // order the selection points
+ if (absoluteStart < absoluteEnd)
+ {
+ rslt.absoluteStart = absoluteStart;
+ rslt.absoluteEnd = absoluteEnd;
+ }
+ else
+ {
+ rslt.absoluteStart = absoluteEnd;
+ rslt.absoluteEnd = absoluteStart;
+ }
+ rslt.firstLeaf = textFlow.findLeaf(rslt.absoluteStart);
+ rslt.lastLeaf = textFlow.findLeaf(rslt.absoluteEnd);
+ // back up one element if the end of the selection is the start of an element
+ // otherwise a block selection of a span looks like it includes discreet selection ranges
+ if (((rslt.lastLeaf == null) && (rslt.absoluteEnd == textFlow.textLength)) || (rslt.absoluteEnd == rslt.lastLeaf.getAbsoluteStart()))
+ rslt.lastLeaf = textFlow.findLeaf(rslt.absoluteEnd-1);
+
+ rslt.firstParagraph = rslt.firstLeaf.getParagraph();
+ rslt.lastParagraph = rslt.lastLeaf.getParagraph();
+
+ // rslt.begContainer = selState.textFlow.findAbsoluteContainer(rslt.begElemIdx);
+ // rslt.endContainer = selState.textFlow.findAbsoluteContainer(rslt.endElemIdx);
+ // if (rslt.endElemIdx == rslt.endContainer.relativeStart)
+ // rslt.endContainer = rslt.endContainer.preventextContainer;
+
+ // if the end of the range includes the next to last character in a paragraph
+ // expand it to include the paragraph teriminate character
+ if (rslt.absoluteEnd == rslt.lastParagraph.getAbsoluteStart() + rslt.lastParagraph.textLength - 1)
+ {
+ rslt.absoluteEnd++;
+ rslt.lastLeaf = rslt.lastParagraph.getLastLeaf();
+ }
+
+ }
+ rslt.textFlow = textFlow;
+
+ return rslt;
+ }
+
+ static private function adjustForLeanLeft(rslt:ElementRange):void
+ {
+ // If we're at the start of a leaf element, look to the previous leaf element and see if it shares the same
+ // parent. If so, we're going to move the selection to the end of the previous element so it takes on
+ // the formatting of the character to the left. We don't want to do this if the previous element is in
+ // a different character, across link or tcy boundaries, etc.
+ if (rslt.firstLeaf.getAbsoluteStart() == rslt.absoluteStart)
+ {
+ var previousNode:IFlowLeafElement = rslt.firstLeaf.getPreviousLeaf(rslt.firstParagraph);
+ if (previousNode && previousNode.getParagraph() == rslt.firstLeaf.getParagraph())
+ {
+ if((!(previousNode.parent is ISubParagraphGroupElementBase) || (previousNode.parent as ISubParagraphGroupElementBase).acceptTextAfter())
+ && (!(rslt.firstLeaf.parent is ISubParagraphGroupElementBase) || previousNode.parent === rslt.firstLeaf.parent))
+ rslt.firstLeaf = previousNode;
+ }
+
+ }
+ }
+}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd08d137/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/IEditManager.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/IEditManager.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/IEditManager.as
new file mode 100644
index 0000000..7c99be5
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/IEditManager.as
@@ -0,0 +1,778 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.textLayout.edit
+{
+ import org.apache.flex.textLayout.elements.IDivElement;
+ import org.apache.flex.textLayout.elements.IFlowElement;
+ import org.apache.flex.textLayout.elements.IFlowGroupElement;
+ import org.apache.flex.textLayout.elements.IInlineGraphicElement;
+ import org.apache.flex.textLayout.elements.ILinkElement;
+ import org.apache.flex.textLayout.elements.IListElement;
+ import org.apache.flex.textLayout.elements.IParagraphElement;
+ import org.apache.flex.textLayout.elements.ISubParagraphGroupElement;
+ import org.apache.flex.textLayout.elements.ITCYElement;
+ import org.apache.flex.textLayout.elements.ITableElement;
+ import org.apache.flex.textLayout.formats.ITextLayoutFormat;
+ import org.apache.flex.textLayout.operations.FlowOperation;
+ import org.apache.flex.utils.undo.IOperation;
+ import org.apache.flex.utils.undo.IUndoManager;
+
+ [Exclude(name="delayedOperations",kind="property")]
+ /**
+ * IEditManager defines the interface for handling edit operations of a text flow.
+ *
+ * <p>To enable text flow editing, assign an IEditManager instance to the <code>interactionManager</code>
+ * property of the TextFlow object. The edit manager handles changes to the text (such as insertions,
+ * deletions, and format changes). Changes are reversible if the edit manager has an undo manager. The edit
+ * manager triggers the recomposition and display of the text flow, as necessary.</p>
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ *
+ * @see EditManager
+ * @see org.apache.flex.textLayout.elements.TextFlow
+ * @see flashx.undo.UndoManager
+ *
+ */
+ public interface IEditManager extends ISelectionManager
+ {
+
+ /**
+ * The UndoManager object assigned to this EditManager instance, if there is one.
+ *
+ * <p>An undo manager handles undo and redo operations.</p>
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function get undoManager():IUndoManager
+
+ /**
+ * Changes the formats of the specified (or current) selection.
+ *
+ * <p>Executes an undoable operation that applies the new formats.
+ * Only style attributes set for the TextLayoutFormat objects are applied.
+ * Undefined attributes in the format objects are not changed.
+ * </p>
+ *
+ * @param leafFormat The format to apply to leaf elements such as spans and inline graphics.
+ * @param paragraphFormat The format to apply to paragraph elements.
+ * @param containerFormat The format to apply to the containers.
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ *
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function applyFormat(leafFormat:ITextLayoutFormat, paragraphFormat:ITextLayoutFormat, containerFormat:ITextLayoutFormat, operationState:SelectionState = null):void
+
+
+ /**
+ * Undefines formats of the specified (or current) selection.
+ *
+ * <p>Executes an undoable operation that undefines the specified formats.
+ * Only style attributes set for the TextLayoutFormat objects are applied.
+ * Undefined attributes in the format objects are not changed.
+ * </p>
+ *
+ * @param leafFormat The format whose set values indicate properties to undefine to LeafFlowElement objects in the selected range.
+ * @param paragraphFormat The format whose set values indicate properties to undefine to ParagraphElement objects in the selected range.
+ * @param containerFormat The format whose set values indicate properties to undefine to ContainerController objects in the selected range.
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function clearFormat(leafFormat:ITextLayoutFormat, paragraphFormat:ITextLayoutFormat, containerFormat:ITextLayoutFormat, operationState:SelectionState = null):void
+
+ /**
+ * Changes the format applied to the leaf elements in the
+ * specified (or current) selection.
+ *
+ * <p>Executes an undoable operation that applies the new format to leaf elements such as
+ * SpanElement and InlineGraphicElement objects.
+ * Only style attributes set for the TextLayoutFormat objects are applied.
+ * Undefined attributes in the format object are changed.</p>
+ *
+ * @param format The format to apply.
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ *
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function applyLeafFormat(format:ITextLayoutFormat, operationState:SelectionState = null):void;
+
+ /**
+ * Transforms text into a TCY run, or a TCY run into non-TCY text.
+ *
+ * <p>TCY, or tate-chu-yoko, causes text to draw horizontally within a vertical line, and is
+ * used to make small blocks of non-Japanese text or numbers, such as dates, more readable in vertical text.</p>
+ *
+ * @param tcyOn Set to <code>true</code> to apply TCY to a text range, <code>false</code> to remove TCY.
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ * @return The TCYElement that was created.
+ *
+ * @see org.apache.flex.textLayout.elements.TCYElement
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function applyTCY(tcyOn:Boolean, operationState:SelectionState = null):ITCYElement;
+
+ /**
+ * Transforms a selection into a link, or a link into normal text.
+ *
+ * <p>Executes an undoable operation that creates or removes the link.</p>
+ *
+ * <p>If a <code>target</code> parameter is specified, it must be one of the following values:</p>
+ * <ul>
+ * <li>"_self"</li>
+ * <li>"_blank"</li>
+ * <li>"_parent"</li>
+ * <li>"_top"</li>
+ * </ul>
+ * <p>In browser-hosted runtimes, a target of "_self" replaces the current html page.
+ * So, if the SWF content containing the link is in a page within
+ * a frame or frameset, the linked content loads within that frame. If the page
+ * is at the top level, the linked content opens to replace the original page.
+ * A target of "_blank" opens a new browser window with no name.
+ * A target of "_parent" replaces the parent of the html page containing the SWF content.
+ * A target of "_top" replaces the top-level page in the current browser window.</p>
+ *
+ * <p>In other runtimes, such as Adobe AIR, the link opens in the user's default browser and the
+ * <code>target</code> parameter is ignored.</p>
+ *
+ * <p>The <code>extendToLinkBoundary</code> parameter determines how the edit manager
+ * treats a selection that intersects with one or more existing links. If the parameter is
+ * <code>true</code>, then the operation is applied as a unit to the selection and the
+ * whole text of the existing links. Thus, a single link is created that spans from
+ * the beginning of the first link intersected to the end of the last link intersected.
+ * In contrast, if <code>extendToLinkBoundary</code> were <code>false</code> in this situation,
+ * the existing partially selected links would be split into two links.</p>
+ *
+ * @param href The uri referenced by the link.
+ * @param target The target browser window of the link.
+ * @param extendToLinkBoundary Specifies whether to consolidate selection with any overlapping existing links, and then apply the change.
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ * @return The LinkElement that was created.
+ *
+ * @see org.apache.flex.textLayout.elements.LinkElement
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function applyLink(href:String, target:String = null, extendToLinkBoundary:Boolean = false, operationState:SelectionState = null):ILinkElement;
+
+ /**
+ * Changes the ID of an element.
+ *
+ * <p>If the <code>relativeStart</code> or <code>relativeEnd</code> parameters are set (to
+ * anything other than the default values), then the element is split. The parts of the element
+ * outside this range retain the original ID. Setting both the <code>relativeStart</code> and
+ * <code>relativeEnd</code> parameters creates elements with duplicate IDs.</p>
+ *
+ * @param newID The new ID value.
+ * @param targetElement The element to modify.
+ * @param relativeStart An offset from the beginning of the element at which to split the element when assigning the new ID.
+ * @param relativeEnd An offset from the beginning of the element at which to split the element when assigning the new ID.
+ * @param operationState Specifies the selection to restore when undoing this operation;
+ * if <code>null</code>, the operation saves the current selection.
+ *
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function changeElementID(newID:String, targetElement:IFlowElement, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void;
+
+ [Deprecated(replacement="applyFormatToElement", deprecatedSince="2.0")]
+ /**
+ * Changes the styleName of an element or part of an element.
+ *
+ * <p>If the <code>relativeStart</code> or <code>relativeEnd</code> parameters are set (to
+ * anything other than the default values), then the element is split. The parts of the element
+ * outside this range retain the original style.</p>
+ *
+ * @param newName The name of the new style.
+ * @param targetElement Specifies the element to change.
+ * @param relativeStart An offset from the beginning of the element at which to split the element when assigning the new style.
+ * @param relativeEnd An offset from the end of the element at which to split the element when assigning the new style.
+ * @param operationState Specifies the selection to restore when undoing this operation;
+ * if <code>null</code>, the operation saves the current selection.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function changeStyleName(newName:String, targetElement:IFlowElement, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void;
+
+ /**
+ * Changes the typeName of an element or part of an element.
+ *
+ * <p>If the <code>relativeStart</code> or <code>relativeEnd</code> parameters are set (to
+ * anything other than the default values), then the element is split. The parts of the element
+ * outside this range retain the original style.</p>
+ *
+ * @param newName The name of the new type.
+ * @param targetElement Specifies the element to change.
+ * @param relativeStart An offset from the beginning of the element at which to split the element when assigning the new style
+ * @param relativeEnd An offset from the end of the element at which to split the element when assigning the new style
+ * @param operationState Specifies the selection to restore when undoing this operation;
+ * if <code>null</code>, the operation saves the current selection.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function changeTypeName(newName:String, targetElement:IFlowElement, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void;
+
+ /**
+ * Deletes a range of text, or, if a point selection is given, deletes the next character.
+ *
+ * @param operationState specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ *
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function deleteNextCharacter(operationState:SelectionState = null):void;
+
+ /**
+ * Deletes a range of text, or, if a point selection is given, deletes the previous character.
+ *
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ *
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function deletePreviousCharacter(operationState:SelectionState = null):void;
+
+ /**
+ * Deletes the next word.
+ *
+ * <p>If a range is selected, the first word of the range is deleted.</p>
+ *
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ *
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function deleteNextWord(operationState:SelectionState = null):void;
+
+ /**
+ * Deletes the previous word.
+ *
+ * <p>If a range is selected, the first word of the range is deleted.</p>
+ *
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ *
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function deletePreviousWord(operationState:SelectionState = null):void;
+
+ /**
+ * Deletes a range of text.
+ *
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ *
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function deleteText(operationState:SelectionState = null):void
+
+ /**
+ * Inserts an image.
+ *
+ * <p>The source of the image can be a string containing a URI, URLRequest object, a Class object representing an embedded asset,
+ * or a DisplayObject instance.</p>
+ *
+ * <p>The width and height values can be the number of pixels, a percent, or the string, 'auto',
+ * in which case the actual dimension of the graphic is used.</p>
+ *
+ * <p>Set the <code>float</code> to one of the constants defined in the Float class to specify whether
+ * the image should be displayed to the left or right of any text or inline with the text.</p>
+ *
+ * @param source Can be either a String interpreted as a uri, a Class interpreted as the class of an Embed DisplayObject,
+ * a DisplayObject instance or a URLRequest.
+ * @param width The width of the image to insert (number, percent, or 'auto').
+ * @param height The height of the image to insert (number, percent, or 'auto').
+ * @param options None supported.
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ *
+ *
+ * @see org.apache.flex.textLayout.elements.InlineGraphicElement
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function insertInlineGraphic(source:Object, width:Object, height:Object, options:Object = null, operationState:SelectionState = null):IInlineGraphicElement;
+
+ function insertTableElement(table:ITableElement, operationState:SelectionState = null):void;
+
+ /**
+ * Modifies an existing inline graphic.
+ *
+ * <p>Set unchanging properties to the values in the original graphic. (Modifying an existing graphic object
+ * is typically more efficient than deleting and recreating one.)</p>
+ *
+ * @param source Can be either a String interpreted as a uri, a Class interpreted as the class of an Embed DisplayObject,
+ * a DisplayObject instance or a URLRequest.
+ * @param width The new width for the image (number or percent).
+ * @param height The new height for the image (number or percent).
+ * @param options None supported.
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ *
+ *
+ * @see org.apache.flex.textLayout.elements.InlineGraphicElement
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function modifyInlineGraphic(source:Object, width:Object, height:Object, options:Object = null, operationState:SelectionState = null):void;
+
+ /**
+ * Inserts text.
+ *
+ * <p>Inserts the text at a position or range in the text. If the location supplied in the
+ * <code>operationState</code> parameter is a range (or the parameter is <code>null</code> and the
+ * current selection is a range), then the text currently in the range
+ * is replaced by the inserted text.</p>
+ *
+ * @param text The string to insert.
+ * @param operationState Specifies the text in the flow to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ *
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function insertText(text:String, operationState:SelectionState = null):void;
+
+ /**
+ * Overwrites the selected text.
+ *
+ * <p>If the selection is a point selection, the first character is overwritten by the new text.</p>
+ *
+ * @param text The string to insert.
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ *
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function overwriteText(text:String, operationState:SelectionState = null):void;
+
+ /**
+ * Applies paragraph styles to any paragraphs in the selection.
+ *
+ * <p>Any style properties in the format object that are <code>null</code> are left unchanged.</p>
+ *
+ * @param format The format to apply to the selected paragraphs.
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ *
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function applyParagraphFormat(format:ITextLayoutFormat, operationState:SelectionState = null):void;
+
+ /**
+ * Applies container styles to any containers in the selection.
+ *
+ * <p>Any style properties in the format object that are <code>null</code> are left unchanged.</p>
+ *
+ * @param format The format to apply to the containers in the range
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ *
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function applyContainerFormat(format:ITextLayoutFormat, operationState:SelectionState = null):void;
+
+ /**
+ * Applies styles to the specified element.
+ *
+ * <p>Any style properties in the format object that are <code>null</code> are left unchanged.
+ * Only styles that are relevant to the specified element are applied.</p>
+ *
+ * @param targetElement The element to which the styles are applied.
+ * @param format The format containing the styles to apply.
+ * @param relativeStart An offset from the beginning of the element at which to split the element when assigning the new formatting.
+ * @param relativeEnd An offset from the beginning of the element at which to split the element when applying the new formatting.
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ *
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function applyFormatToElement(targetElement:IFlowElement, format:ITextLayoutFormat, relativeStart:int = 0, relativeEnd:int = -1, operationState:SelectionState = null):void;
+
+ /**
+ * Undefines styles to the specified element.
+ *
+ * <p>Any style properties in the format object that are <code>undefined</code> are left unchanged.
+ * Any styles that are defined in the specififed format are undefined on the specified element.</p>
+ *
+ * @param targetElement The element to which the styles are applied.
+ * @param format The format containing the styles to undefine.
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function clearFormatOnElement(targetElement:IFlowElement, format:ITextLayoutFormat, operationState:SelectionState = null):void;
+
+ /**
+ * Splits the paragraph at the current position, creating a new paragraph after the current one.
+ *
+ * <p>If a range of text is specified, the text
+ * in the range is deleted.</p>
+ *
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ *
+ * @return The new paragraph that was created.
+ *
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function splitParagraph(operationState:SelectionState = null):IParagraphElement;
+
+ /** Splits the target element at the location specified, creating a new element after the current one.
+ * If the operationState is a range, the text within the range is deleted. The new element is created
+ * after the text position specified by operationState. Note that splitting a SubParagraphGroupElement
+ * will have no effect because they will automatically remerge with the adejacent elements.
+ *
+ * <p>An example where you might want to use this is if you have a list, and you want to divide it into two lists.</p>
+ *
+ * @param target The element to be split.
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ * @return The new paragraph that was created.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function splitElement(target : IFlowGroupElement, operationState : SelectionState = null) : IFlowGroupElement;
+
+ /** Creates a new IDivElement that contains the entire range specified in the operationState at the lowest
+ * common parent element that contains both the start and end points of the range. If the start and end
+ * points are the same, a new IDivElement is created at that position with a single child paragraph.
+ *
+ * @param parent Specifies a parent element for the new IDivElement.
+ * If <code>null</code> the new parent will be lowest level that contains the SelectionState.
+ * @param format Formatting attributes to apply to the new IDivElement.
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ * @return The new IDivElement that was created.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function createDiv(parent:IFlowGroupElement = null, format:ITextLayoutFormat = null, operationState:SelectionState = null):IDivElement;
+
+ /** Creates a new ListElement that contains the entire range specified in the operationState at the lowest
+ * common parent element that contains both the start and end points of the range. Each paragraph within the
+ * range will become a ListItemElement in the new ListElement. If the start and end
+ * points are the same, a new ListElement is created at that position with a single ListItemElement child.
+ *
+ * @param parent Optionally specifies a parent element for the new ListElement.
+ * If <code>null</code> the new parent will be lowest level that contains the SelectionState.
+ * @param format Formatting attributes to apply to the new ListElement.
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ * @return The new ListElement that was created.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function createList(parent:IFlowGroupElement = null, format:ITextLayoutFormat = null, operationState:SelectionState = null):IListElement;
+
+ /** Move a set of FlowElements from one IFlowGroupElement to another. The desinationElement must be a legal parent type for the children being moved,
+ * or an exception is thrown.
+ *
+ * @param source The orginal parent of the elements to be moved.
+ * @param sourceIndex The child index within the source of the first element to be moved.
+ * @param numChildren The number of children being moved.
+ * @param destination The new parent of elements after move.
+ * @param destinationIndex The child index within the destination to where elements are moved to.
+ * @param operationState Specifies the text to which this operation applies, and to which selection returns to upon undo.
+ * If <code>null</code>, the operation applies to the current selection. If there is no current selection, this parameter must be non-null.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function moveChildren(source:IFlowGroupElement, sourceIndex:int, numChildren:int, destination:IFlowGroupElement, destinationIndex:int, operationState:SelectionState = null):void
+
+ /** Creates a new SubParagraphGroupElement that contains the entire range specified in the operationState at the lowest
+ * common parent element that contains both the start and end points of the range. If the start and end
+ * points are the same, nothing is done.
+ *
+ * @param parent Specifies a parent element for the new SubParagraphGroupElement element.
+ * If <code>null</code> the new parent will be lowest level that contains the SelectionState.
+ * @param format Formatting attributes to apply to the new SubParagraphGroupElement
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ * @return The new SubParagraphGroupElement that was created.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function createSubParagraphGroup(parent:IFlowGroupElement = null, format:ITextLayoutFormat = null, operationState:SelectionState = null):ISubParagraphGroupElement;
+
+ /**
+ * Deletes the selected area and returns the deleted area in a TextScrap object.
+ *
+ * <p>The resulting TextScrap can be posted to the system clipboard or used in a
+ * subsequent <code>pasteTextOperation()</code> operation.</p>
+ *
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ * @return The TextScrap that was cut.
+ *
+ *
+ * @see org.apache.flex.textLayout.edit.IEditManager.pasteTextScrap
+ * @see org.apache.flex.textLayout.edit.TextClipboard.setContents
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function cutTextScrap(operationState:SelectionState = null):TextScrap;
+
+ /**
+ * Pastes the TextScrap into the selected area.
+ *
+ * <p>If a range of text is specified, the text
+ * in the range is deleted.</p>
+ *
+ * @param scrapToPaste The TextScrap to paste.
+ * @param operationState Specifies the text to which this operation applies;
+ * if <code>null</code>, the operation applies to the current selection.
+ *
+ *
+ * @see org.apache.flex.textLayout.edit.IEditManager.cutTextScrap
+ * @see org.apache.flex.textLayout.edit.TextClipboard.getContents
+ * @see org.apache.flex.textLayout.edit.TextScrap
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function pasteTextScrap(scrapToPaste:TextScrap, operationState:SelectionState = null):void;
+
+ /**
+ * Begins a new group of operations.
+ *
+ * <p>All operations executed after the call to <code>beginCompositeOperation()</code>, and before the
+ * matching call to <code>endCompositeOperation()</code> are executed and grouped together as a single
+ * operation that can be undone as a unit.</p>
+ *
+ * <p>A <code>beginCompositeOperation</code>/<code>endCompositeOperation</code> block can be nested inside another
+ * <code>beginCompositeOperation</code>/<code>endCompositeOperation</code> block.</p>
+ *
+ *
+ * @see org.apache.flex.textLayout.edit.IEditManager.endCompositeOperation
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function beginCompositeOperation():void;
+
+ /**
+ * Ends a group of operations.
+ *
+ * <p>All operations executed since the last call to <code>beginCompositeOperation()</code> are
+ * grouped as a CompositeOperation that is then completed. This CompositeOperation object is added
+ * to the undo stack or, if this composite operation is nested inside another composite operation,
+ * added to the parent operation.</p>
+ *
+ * @see org.apache.flex.textLayout.edit.IEditManager.beginCompositeOperation
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function endCompositeOperation():void;
+
+ /**
+ * Executes a FlowOperation.
+ *
+ * <p>The <code>doOperation()</code> method is called by IEditManager functions that
+ * update the text flow. You do not typically need to call this function directly unless
+ * you create your own custom operations.</p>
+ *
+ * <p>This function proceeds in the following steps:</p>
+ * <ol>
+ * <li>Flush any pending operations before performing this operation.</li>
+ * <li>Send a cancelable flowOperationBegin event. If canceled this method returns immediately.</li>
+ * <li>Execute the operation. The operation returns <code>true</code> or <code>false</code>.
+ * <code>False</code> indicates that no changes were made.</li>
+ * <li>Push the operation onto the undo stack.</li>
+ * <li>Clear the redo stack.</li>
+ * <li>Update the display.</li>
+ * <li>Send a cancelable flowOperationEnd event.</li>
+ * </ol>
+ * <p>Exception handling: If the operation throws an exception, it is caught and the error is
+ * attached to the flowOperationEnd event. If the event is not canceled the error is rethrown.</p>
+ *
+ * @param operation a FlowOperation object
+ *
+
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function doOperation(operation:FlowOperation):void;
+
+ /**
+ * Reverses the previous operation.
+ *
+ * <p><b>Note:</b> If the IUndoManager associated with this IEditManager is also associated with
+ * another IEditManager, then it is possible that the undo operation associated with the other
+ * IEditManager is the one undone. This can happen if the FlowOperation of another IEditManager
+ * is on top of the undo stack.</p>
+ *
+ * <p>This function does nothing if undo is not turned on.</p>
+ *
+ *
+ * @see flashx.undo.IUndoManager#undo()
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function undo():void;
+
+ /**
+ * Reperforms the previous undone operation.
+ *
+ * <p><b>Note:</b> If the IUndoManager associated with this IEditManager is also associated with
+ * another IEditManager, then it is possible that the redo operation associated with the other
+ * IEditManager is the one redone. This can happen if the FlowOperation of another IEditManager
+ * is on top of the redo stack.</p>
+ *
+ * <p>This function does nothing if undo is not turned on.</p>
+ *
+ *
+ * @see flashx.undo.IUndoManager#redo()
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function redo():void;
+
+ /** @private */
+ function performUndo(operation:IOperation):void;
+
+ /** @private */
+ function performRedo(operation:IOperation):void;
+
+ /**
+ * By default, calls into IEditManager handle updates synchronously, so the requested change is made and the text recomposed
+ * and added to the display list within the IEditManager method. To get a delayed redraw, set <code>delayUpdates</code> to <code>true</code>. This
+ * causes the IEditManager to only update the model, and recompose and redraw on the next <code>enter_frame</code> event.
+ *
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.0
+ * @langversion 3.0
+ */
+ function get delayUpdates():Boolean;
+ function set delayUpdates(value:Boolean):void;
+
+ /** Controls whether operations can be queued up for later execution.
+ *
+ * <p>Execution of some operations might be delayed as a performance optimization. For example, it is
+ * convenient to be able to combine multiple keystrokes into a single insert operation. If
+ * <code>allowDelayedOperations</code> is <code>true</code>, then operations may be queued up. If <code>false</code>, all operations are
+ * executed immediately. By default, it is <code>true</code>.</p>
+ *
+ * @see flashx.edit.ISelectionManager#flushPendingOperations
+ *
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.0
+ * @langversion 3.0
+ */
+ function get allowDelayedOperations():Boolean;
+ function set allowDelayedOperations(value:Boolean):void;
+
+ /** Updates the display after an operation has modified it. Normally this is handled automatically, but call
+ * this method if <code>delayUpdates</code> is on, and the display should be updated before the next <code>enter_frame</code> event.
+ *
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.0
+ * @langversion 3.0
+ */
+ function updateAllControllers():void;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd08d137/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/IInteractionEventHandler.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/IInteractionEventHandler.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/IInteractionEventHandler.as
new file mode 100644
index 0000000..c2e374c
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/IInteractionEventHandler.as
@@ -0,0 +1,220 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.textLayout.edit
+{
+ import org.apache.flex.text.events.TextEvent;
+ import org.apache.flex.text.events.IMEEvent;
+ import org.apache.flex.textLayout.events.ContextMenuEvent;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.KeyboardEvent;
+ import org.apache.flex.events.MouseEvent;
+
+ /**
+ * The IInteractionEventHandler interface defines the event handler functions that
+ * are handled by a Text Layout Framework selection or edit manager.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public interface IInteractionEventHandler
+ {
+ /**
+ * Processes an edit event.
+ *
+ * <p>Edit events are dispatched for cut, copy, paste, and selectAll commands.</p>
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function editHandler(event:Event):void;
+
+ /**
+ * Processes a keyDown event.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function keyDownHandler(event:KeyboardEvent):void;
+
+ /**
+ * Processes a keyUp event.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function keyUpHandler(event:KeyboardEvent):void;
+
+ /**
+ * Processes a keyFocusChange event.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function keyFocusChangeHandler(event:Event):void;
+
+ /**
+ * Processes a TextEvent.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function textInputHandler(event:TextEvent):void;
+
+ /**
+ * Processes an imeStartComposition event
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function imeStartCompositionHandler(event:IMEEvent):void;
+
+ /**
+ * Processes an softKeyboardActivating event
+ *
+ * @playerversion Flash 10.2
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function softKeyboardActivatingHandler(event:Event):void;
+
+ /**
+ * Processes a mouseDown event.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function mouseDownHandler(event:MouseEvent):void;
+
+ /**
+ * Processes a mouseMove event.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function mouseMoveHandler(event:MouseEvent):void;
+
+ /**
+ * Processes a mouseUp event.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function mouseUpHandler(event:MouseEvent):void;
+
+ /**
+ * Processes a mouseDoubleClick event.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function mouseDoubleClickHandler(event:MouseEvent):void;
+
+ /**
+ * Processes a mouseOver event.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function mouseOverHandler(event:MouseEvent):void;
+
+ /**
+ * Processes a mouseOut event.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function mouseOutHandler(event:MouseEvent):void;
+
+ /**
+ * Processes a focusIn event.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function focusInHandler(event:Event):void;
+
+ /**
+ * Processes a focusOut event.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function focusOutHandler(event:Event):void;
+
+ /**
+ * Processes an activate event.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function activateHandler(event:Event):void;
+
+ /**
+ * Processes a deactivate event.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function deactivateHandler(event:Event):void;
+
+ /**
+ * Processes a focusChange event.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function focusChangeHandler(event:Event):void
+
+ /**
+ * Processes a menuSelect event.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function menuSelectHandler(event:ContextMenuEvent):void
+
+ /**
+ * Processes a mouseWheel event.
+ *
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ function mouseWheelHandler(event:MouseEvent):void
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd08d137/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/IMEClient.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/IMEClient.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/IMEClient.as
new file mode 100644
index 0000000..4986273
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/IMEClient.as
@@ -0,0 +1,434 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.textLayout.edit {
+ import org.apache.flex.textLayout.elements.IFlowLeafElement;
+ import org.apache.flex.utils.PointUtils;
+ import org.apache.flex.utils.undo.UndoManager;
+ import org.apache.flex.utils.undo.IOperation;
+ import org.apache.flex.text.ime.IIMEClient;
+ import org.apache.flex.geom.Point;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.text.ime.IME;
+ import org.apache.flex.text.engine.ITextLine;
+ import org.apache.flex.text.ime.CompositionAttributeRange;
+
+ import org.apache.flex.textLayout.compose.IFlowComposer;
+ import org.apache.flex.textLayout.compose.ITextFlowLine;
+ import org.apache.flex.textLayout.container.IContainerController;
+ import org.apache.flex.textLayout.debug.assert;
+ import org.apache.flex.textLayout.elements.FlowLeafElement;
+ import org.apache.flex.textLayout.elements.ITextFlow;
+ import org.apache.flex.textLayout.elements.TextRange;
+ import org.apache.flex.textLayout.formats.BlockProgression;
+ import org.apache.flex.textLayout.formats.IMEStatus;
+ import org.apache.flex.textLayout.formats.ITextLayoutFormat;
+ import org.apache.flex.textLayout.formats.TextLayoutFormat;
+ import org.apache.flex.textLayout.operations.ApplyFormatToElementOperation;
+ import org.apache.flex.textLayout.operations.FlowOperation;
+ import org.apache.flex.textLayout.operations.InsertTextOperation;
+
+ import org.apache.flex.textLayout.utils.GeometryUtil;
+
+
+
+ internal class IMEClient implements IIMEClient
+ {
+ private var _editManager:EditManager;
+ private var _undoManager:UndoManager;
+
+ /** Maintain position of text we've inserted while in the middle of processing IME. */
+ private var _imeAnchorPosition:int; // start of IME text
+ private var _imeLength:int; // length of IME text
+ private var _controller:IContainerController; // controller that had focus at the start of the IME session -- we want this one to keep focus
+ private var _closing:Boolean;
+ CONFIG::debug {
+ private var _imeOperation:IOperation; // IME in-progress edits - used for debugging to confirm that operation we're undoing is the one we did via IME
+ }
+
+ public function IMEClient(editManager:EditManager)
+ {
+ _editManager = editManager;
+ _imeAnchorPosition = _editManager.absoluteStart;
+ if (_editManager.textFlow)
+ {
+ var flowComposer:IFlowComposer = _editManager.textFlow.flowComposer;
+ if (flowComposer)
+ {
+ var controllerIndex:int = flowComposer.findControllerIndexAtPosition(_imeAnchorPosition);
+ _controller = flowComposer.getControllerAt(controllerIndex);
+ if (_controller)
+ _controller.setFocus();
+ }
+ }
+ _closing = false;
+ if (_editManager.undoManager == null)
+ {
+ _undoManager = new UndoManager();
+ _editManager.setUndoManager(_undoManager);
+ }
+ }
+
+ /** @private
+ * Handler function called when the selection has been changed.
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public function selectionChanged():void
+ {
+ // trace("IMEClient.selectionChanged", _editManager.anchorPosition, _editManager.activePosition);
+
+ // If we change the selection to something outside the session, abort the
+ // session. If we just moved the selection within the session, we tell the IME about the changes.
+ if (_editManager.absoluteStart > _imeAnchorPosition + _imeLength || _editManager.absoluteEnd < _imeAnchorPosition)
+ {
+ //trace("selection changed to out of IME session");
+ compositionAbandoned();
+ }
+ else
+ {
+ // This code doesn't with current version of Argo, but should work in future
+ //trace("selection changed within IME session");
+ // var imeCompositionSelectionChanged:Function = IME["compositionSelectionChanged"];
+ // if (IME["compositionSelectionChanged"] !== undefined)
+ // imeCompositionSelectionChanged(_editManager.absoluteStart - _imeAnchorPosition, _editManager.absoluteEnd - (_imeAnchorPosition + _imeLength));
+ }
+ }
+
+ private function doIMEClauseOperation(selState:SelectionState, clause:int):void
+ {
+ var leaf:IFlowLeafElement = _editManager.textFlow.findLeaf(selState.absoluteStart);;
+ var leafAbsoluteStart:int = leaf.getAbsoluteStart();
+ var format:TextLayoutFormat = new TextLayoutFormat();
+ format.setStyle(IMEStatus.IME_CLAUSE, clause.toString());
+ _editManager.doOperation(new ApplyFormatToElementOperation(selState, leaf, format, selState.absoluteStart - leafAbsoluteStart, selState.absoluteEnd - leafAbsoluteStart));
+ }
+
+ private function doIMEStatusOperation(selState:SelectionState, attrRange:CompositionAttributeRange):void
+ {
+ var imeStatus:String;
+
+ // Get the IME status from the converted & selected flags
+ if (attrRange == null)
+ imeStatus = IMEStatus.DEAD_KEY_INPUT_STATE;
+ else if (!attrRange.converted)
+ {
+ if(!attrRange.selected)
+ imeStatus = IMEStatus.NOT_SELECTED_RAW;
+ else
+ imeStatus = IMEStatus.SELECTED_RAW;
+ }
+ else
+ {
+ if (!attrRange.selected)
+ imeStatus = IMEStatus.NOT_SELECTED_CONVERTED;
+ else
+ imeStatus = IMEStatus.SELECTED_CONVERTED;
+ }
+
+
+ // refind since the previous operation changed the spans
+ var leaf:IFlowLeafElement = _editManager.textFlow.findLeaf(selState.absoluteStart);
+ CONFIG::debug { assert( leaf != null, "found null FlowLeafELement at" + (selState.absoluteStart).toString()); }
+ var leafAbsoluteStart:int = leaf.getAbsoluteStart();
+
+ var format:TextLayoutFormat = new TextLayoutFormat();
+ format.setStyle(IMEStatus.IME_STATUS, imeStatus);
+
+ _editManager.doOperation(new ApplyFormatToElementOperation(selState, leaf, format, selState.absoluteStart - leafAbsoluteStart, selState.absoluteEnd - leafAbsoluteStart));
+ }
+
+ private function deleteIMEText(textFlow:ITextFlow):void
+ {
+ // Delete any leaves that have IME attributes applied
+ var leaf:IFlowLeafElement = textFlow.getFirstLeaf();
+ while (leaf)
+ {
+ if (leaf.getStyle(IMEStatus.IME_STATUS) !== undefined || leaf.getStyle(IMEStatus.IME_CLAUSE) !== undefined)
+ {
+ var leafFormat:TextLayoutFormat = new TextLayoutFormat(leaf.format);
+ leafFormat.setStyle(IMEStatus.IME_STATUS, undefined);
+ leafFormat.setStyle(IMEStatus.IME_CLAUSE, undefined);
+ leaf.format = leafFormat;
+ var absoluteStart:int = leaf.getAbsoluteStart();
+ ModelEdit.deleteText(textFlow, absoluteStart, absoluteStart + leaf.textLength, false);
+ leaf = textFlow.findLeaf(absoluteStart);
+ }
+ else
+ leaf = leaf.getNextLeaf();
+ }
+ }
+
+ private function rollBackIMEChanges():void
+ {
+ // Undo the previous interim ime operation, if there is one. This deletes any text that came in a previous updateComposition call.
+ // Doing it via undo keeps the undo stack in sync. But if there's been an intervening direct model change, just delete the IME text
+ // directly. It won't restore what we selected at the beginning of the IME session, but it's the best we can do.
+ var previousIMEOperation:FlowOperation = _editManager.undoManager.peekUndo() as FlowOperation;
+ if (_imeLength > 0 && previousIMEOperation && previousIMEOperation.endGeneration == _editManager.textFlow.generation && previousIMEOperation.canUndo())
+ {
+ CONFIG::debug { assert(_editManager.undoManager.peekUndo() == _imeOperation, "Unexpected operation in undo stack at end of IME update"); }
+ if (_editManager.undoManager)
+ _editManager.undoManager.undo();
+ CONFIG::debug { assert(_editManager.undoManager.peekRedo() == _imeOperation, "Unexpected operation in redo stack at end of IME session"); }
+ _editManager.undoManager.popRedo();
+ }
+ else // there's been a model change since the last IME change that blocks undo, just find IME text and delete it.
+ {
+ _editManager.undoManager.popUndo(); // remove the operation we can't undo
+ deleteIMEText(_editManager.textFlow);
+ }
+ _imeLength = 0; // prevent double deletion
+ CONFIG::debug { _imeOperation = null; }
+ }
+
+ // IME-related functions
+ public function updateComposition(text:String, attributes:Vector.<CompositionAttributeRange>, compositionStartIndex:int, compositionEndIndex:int):void
+ {
+ // CONFIG::debug { Debugging.traceOut("updateComposition ", compositionStartIndex, compositionEndIndex, text.length); }
+ // CONFIG::debug { Debugging.traceOut("updateComposition selection ", _editManager.absoluteStart, _editManager.absoluteEnd); }
+
+ // Undo the previous interim ime operation, if there is one. This deletes any text that came in a previous updateComposition call.
+ // Doing it via undo keeps the undo stack in sync.
+ if (_imeLength > 0)
+ rollBackIMEChanges();
+
+ if (text.length > 0)
+ {
+ // Insert the supplied string, using the current editing format.
+ var pointFormat:ITextLayoutFormat = _editManager.getSelectionState().pointFormat;
+ var selState:SelectionState = new SelectionState(_editManager.textFlow, _imeAnchorPosition, _imeAnchorPosition + _imeLength, pointFormat);
+
+ _editManager.beginIMEOperation();
+
+ if (_editManager.absoluteStart != _editManager.absoluteEnd)
+ _editManager.deleteText(); // delete current selection
+
+ var insertOp:InsertTextOperation = new InsertTextOperation(selState, text);
+ _imeLength = text.length;
+ _editManager.doOperation(insertOp);
+
+ if (attributes && attributes.length > 0)
+ {
+ var attrLen:int = attributes.length;
+ for (var i:int = 0; i < attrLen; i++)
+ {
+ var attrRange:CompositionAttributeRange = attributes[i];
+ var clauseSelState:SelectionState = new SelectionState(_editManager.textFlow, _imeAnchorPosition + attrRange.relativeStart, _imeAnchorPosition + attrRange.relativeEnd);
+
+ doIMEClauseOperation(clauseSelState, i);
+ doIMEStatusOperation(clauseSelState, attrRange);
+ }
+ }
+ else // composing accented characters
+ {
+ clauseSelState = new SelectionState(_editManager.textFlow, _imeAnchorPosition, _imeAnchorPosition + _imeLength, pointFormat);
+ doIMEClauseOperation(clauseSelState, 0);
+ doIMEStatusOperation(clauseSelState, null);
+ }
+
+ var newSelectionStart:int = _imeAnchorPosition + compositionStartIndex;
+ var newSelectionEnd:int = _imeAnchorPosition + compositionEndIndex;
+ if (_editManager.absoluteStart != newSelectionStart || _editManager.absoluteEnd != newSelectionEnd)
+ {
+ _editManager.selectRange(_imeAnchorPosition + compositionStartIndex, _imeAnchorPosition + compositionEndIndex);
+ }
+
+ CONFIG::debug { _imeOperation = null; }
+ _editManager.endIMEOperation();
+ CONFIG::debug { _imeOperation = _editManager.undoManager.peekUndo(); }
+ }
+ }
+
+ public function confirmComposition(text:String = null, preserveSelection:Boolean = false):void
+ {
+ // trace("confirmComposition", text, preserveSelection);
+ endIMESession();
+ }
+
+ public function compositionAbandoned():void
+ {
+ // trace("compositionAbandoned");
+
+ // In Argo we could just do this:
+ // IME.compositionAbandoned();
+ // but for support in Astro/Squirt where this API is undefined we do this:
+ var imeCompositionAbandoned:Function = IME["compositionAbandoned"];
+ if (IME["compositionAbandoned"] !== undefined)
+ imeCompositionAbandoned();
+ }
+
+ private function endIMESession():void
+ {
+ if (!_editManager || _closing)
+ return;
+
+ // trace("end IME session");
+
+ _closing = true;
+
+ // Undo the IME operation. We're going to re-add the text, without all the special attributes, as part of handling
+ // the textInput event that comes next.
+ if (_imeLength > 0)
+ rollBackIMEChanges();
+
+ if (_undoManager)
+ _editManager.setUndoManager(null);
+
+ // Clear IME state - tell EditManager to release IMEClient to finally close session
+ _editManager.endIMESession();
+ _editManager = null;
+ }
+
+ // CONFIG::debug
+ // { // debugging code for displaying IME bounds rectangle
+
+ // private function displayRectInContainer(container:Sprite, r:Rectangle):void
+ // {
+ // var g:Graphics = container.graphics;
+ // g.beginFill(0xff0000);
+ // g.moveTo(r.x, r.y);
+ // g.lineTo(r.right, r.y);
+ // g.lineTo(r.right, r.bottom);
+ // g.lineTo(r.x, r.bottom);
+ // g.lineTo(r.x, r.y);
+ // g.endFill();
+ // }
+ // }
+
+ public function getTextBounds(startIndex:int, endIndex:int):Rectangle
+ {
+ if(startIndex >= 0 && startIndex < _editManager.textFlow.textLength && endIndex >= 0 && endIndex < _editManager.textFlow.textLength)
+ {
+ if (startIndex != endIndex)
+ {
+ var boundsResult:Array = GeometryUtil.getHighlightBounds(new TextRange(_editManager.textFlow, startIndex, endIndex));
+ //bail out if we don't have any results to show
+ if (boundsResult.length > 0)
+ {
+ var bounds:Rectangle = boundsResult[0].rect;
+ var textLine:ITextLine = boundsResult[0].textLine;
+ var resultTopLeft:Point = PointUtils.localToGlobal(bounds.topLeft, textLine);// textLine.localToGlobal(bounds.topLeft);
+ var resultBottomRight:Point = PointUtils.localToGlobal(bounds.bottomRight, textLine);// textLine.localToGlobal(bounds.bottomRight);
+ if (textLine.parent)
+ {
+ var containerTopLeft:Point = PointUtils.globalToLocal(resultTopLeft, textLine.parent);// textLine.parent.globalToLocal(resultTopLeft);
+ var containerBottomLeft:Point = PointUtils.globalToLocal(resultBottomRight, textLine.parent);// textLine.parent.globalToLocal(resultBottomRight);
+ // CONFIG::debug { displayRectInContainer(Sprite(textLine.parent), new Rectangle(containerTopLeft.x, containerTopLeft.y, containerBottomLeft.x - containerTopLeft.x, containerBottomLeft.y - containerTopLeft.y));}
+ return new Rectangle(containerTopLeft.x, containerTopLeft.y, containerBottomLeft.x - containerTopLeft.x, containerBottomLeft.y - containerTopLeft.y);
+ }
+ }
+ }
+ else
+ {
+ var flowComposer:IFlowComposer = _editManager.textFlow.flowComposer;
+ var lineIndex:int = flowComposer.findLineIndexAtPosition(startIndex);
+
+ // Stick to the end of the last line
+ if (lineIndex == flowComposer.numLines)
+ lineIndex--;
+ if (flowComposer.getLineAt(lineIndex).controller == _controller)
+ {
+ var line:ITextFlowLine = flowComposer.getLineAt(lineIndex);
+ var previousLine:ITextFlowLine = lineIndex != 0 ? flowComposer.getLineAt(lineIndex-1) : null;
+ var nextLine:ITextFlowLine = lineIndex != flowComposer.numLines-1 ? flowComposer.getLineAt(lineIndex+1) : null;
+ // CONFIG::debug { displayRectInContainer(_controller.container, line.computePointSelectionRectangle(startIndex, _controller.container, previousLine, nextLine, true));}
+ return line.computePointSelectionRectangle(startIndex, _controller.container, previousLine, nextLine, true);
+ }
+ }
+ }
+
+ return new Rectangle(0,0,0,0);
+ }
+
+ public function get compositionStartIndex():int
+ {
+ // trace("compositionStartIndex");
+ return _imeAnchorPosition;
+ }
+
+ public function get compositionEndIndex():int
+ {
+ // trace("compositionEndIndex");
+ return _imeAnchorPosition + _imeLength;
+ }
+
+ public function get verticalTextLayout():Boolean
+ {
+ // trace("verticalTextLayout ", _editManager.textFlow.computedFormat.blockProgression == BlockProgression.RL ? "true" : "false");
+ return _editManager.textFlow.computedFormat.blockProgression == BlockProgression.RL;
+ }
+
+ public function get selectionActiveIndex():int
+ {
+ //trace("selectionActiveIndex");
+ return _editManager.activePosition;
+ }
+
+ public function get selectionAnchorIndex():int
+ {
+ //trace("selectionAnchorIndex");
+ return _editManager.anchorPosition;
+ }
+
+ public function selectRange(anchorIndex:int, activeIndex:int):void
+ {
+ _editManager.selectRange(anchorIndex, activeIndex);
+ }
+
+ public function setFocus():void
+ {
+//TODO deal with stage and focus
+// if (_controller && _controller.container && _controller.container.stage && _controller.container.stage.focus != _controller.container)
+// _controller.setFocus();
+ }
+
+ /**
+ * Gets the specified range of text from a component implementing ITextSupport.
+ * To retrieve all text in the component, do not specify values for <code>startIndex</code> and <code>endIndex</code>.
+ * Components which wish to support inline IME or web searchability should call into this method.
+ * Components overriding this method should ensure that the default values of <code>-1</code>
+ * for <code>startIndex</code> and <code>endIndex</code> are supported.
+ *
+ * @playerversion Flash 10.0
+ * @langversion 3.0
+ */
+ public function getTextInRange(startIndex:int, endIndex:int):String
+ {
+ //trace("getTextInRange");
+ // Check for valid indices
+ var textFlow:ITextFlow = _editManager.textFlow;
+ if (startIndex < -1 || endIndex < -1 || startIndex > (textFlow.textLength - 1) || endIndex > (textFlow.textLength - 1))
+ return null;
+
+ // Make sure they're in the right order
+ if (endIndex < startIndex)
+ {
+ var tempIndex:int = endIndex;
+ endIndex = startIndex;
+ startIndex = tempIndex;
+ }
+
+ if (startIndex == -1)
+ startIndex = 0;
+
+ return textFlow.getText(startIndex, endIndex);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd08d137/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/IMemento.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/IMemento.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/IMemento.as
new file mode 100644
index 0000000..fdb31ff
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/edit/IMemento.as
@@ -0,0 +1,34 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.textLayout.edit
+{
+ // [ExcludeClass]
+ /**
+ * The IMemento interface is returned by ModelEdit for undo of a specific action that represents part of an operation.
+ * @prviate
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @langversion 3.0
+ */
+ public interface IMemento
+ {
+ function undo():*;
+ function redo():*;
+ }
+}