flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject [05/42] flex-asjs git commit: And here’s TLF…
Date Thu, 16 Mar 2017 13:37:25 GMT
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd08d137/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/formats/VerticalAlign.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/formats/VerticalAlign.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/formats/VerticalAlign.as
new file mode 100644
index 0000000..56708bd
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/formats/VerticalAlign.as
@@ -0,0 +1,68 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.formats
+{
+	/**
+	 *  Defines values for the <code>verticalAlign</code> property of the TextLayoutFormat class. Specifies how 
+	 *  TextFlow elements align with their containers.  
+	 *
+	 * @playerversion Flash 10
+	 * @playerversion AIR 1.5
+	 * @langversion 3.0 
+	 *  @see TextLayoutFormat#verticalAlign
+	 */
+	public final class VerticalAlign
+	{
+		/** Specifies alignment with the top edge of the frame. 
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+		 * @langversion 3.0 
+		 */
+		 
+		public static const TOP:String = "top";
+		
+		/** Specifies alignment with the bottom edge of the frame. 
+		 *
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+		 * @langversion 3.0 
+		 */
+		 
+		public static const BOTTOM:String = "bottom";
+		
+		/** Specifies alignment with the middle of the frame. 
+		 *
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+		 * @langversion 3.0 
+		 */
+		 
+		public static const MIDDLE:String = "middle";
+		
+		/** Specifies vertical line justification within the frame 
+		 *
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+		 * @langversion 3.0 
+		 */
+		
+		public static const JUSTIFY:String = "justify";		
+	}
+}
\ 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/formats/WhiteSpaceCollapse.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/formats/WhiteSpaceCollapse.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/formats/WhiteSpaceCollapse.as
new file mode 100644
index 0000000..a5e6d9e
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/formats/WhiteSpaceCollapse.as
@@ -0,0 +1,51 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.formats
+{
+	/**
+	 *  Defines values for setting the <code>whiteSpaceCollapse</code> property
+	 *  of the <code>TextLayoutFormat</code> class. 
+	 *
+	 * @playerversion Flash 10
+	 * @playerversion AIR 1.5
+	 * @langversion 3.0 
+	 *  
+	 *  @see TextLayoutFormat#whiteSpaceCollapse
+	 */
+	public final class WhiteSpaceCollapse
+	{
+		/** 
+		 * Collapse whitespace when importing text (default).
+		 * Within a block of imported text, removes newlines, tabs, and leading and trailing
+		 * spaces. Retains line break tags (br/) and Unicode line
+		 * separator characters.
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+		 * @langversion 3.0
+		 */
+		public static const COLLAPSE:String = "collapse";
+		
+		/** Preserves whitespace when importing text. 
+		* @playerversion Flash 10
+		* @playerversion AIR 1.5
+		* @langversion 3.0
+		*/ 
+		public static const PRESERVE:String = "preserve";
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd08d137/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyElementIDOperation.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyElementIDOperation.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyElementIDOperation.as
new file mode 100644
index 0000000..edecec7
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyElementIDOperation.as
@@ -0,0 +1,103 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.operations
+{
+	import org.apache.flex.textLayout.edit.SelectionState;
+	import org.apache.flex.textLayout.elements.IFlowElement;
+	import org.apache.flex.textLayout.elements.IFlowElement;
+
+
+
+	
+	/**
+	 * The ChangeElementIDOperation class encapsulates an element ID change.
+	 *
+	 * @see org.apache.flex.textLayout.elements.FlowElement
+	 * @see org.apache.flex.textLayout.edit.EditManager
+	 * @see org.apache.flex.textLayout.events.FlowOperationEvent
+	 * 
+	 * @playerversion Flash 10
+	 * @playerversion AIR 1.5
+	 * @langversion 3.0 
+	 */
+	public class ApplyElementIDOperation extends FlowElementOperation
+	{	
+		private var _origID:String;
+		private var _newID:String;
+		
+		/** 
+		 * Creates a ChangeElementIDOperation object. 
+		 * 
+		 * <p>If the <code>relativeStart</code> or <code>relativeEnd</code> parameters are set, then the existing
+		 * element is split into two elements, one using the existing ID and the other
+		 * using the new ID. If both parameters are set, then the existing element is split into three elements.
+		 * The first and last elements of the set are both assigned the original ID.</p>
+		 * 
+		 * @param operationState Specifies the selection state before the operation
+		 * @param targetElement Specifies the element to change
+		 * @param newID The ID to assign
+		 * @param relativeStart An offset from the beginning of the target element.
+		 * @param relativeEnd An offset from the end of the target element.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		*/
+		public function ApplyElementIDOperation(operationState:SelectionState, targetElement:IFlowElement, newID:String, relativeStart:int = 0, relativeEnd:int = -1)
+		{
+			_newID = newID;
+			super(operationState,targetElement,relativeStart,relativeEnd);
+		}
+		
+		/** 
+		 * The ID assigned by this operation.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		 */
+		public function get newID():String
+		{ return _newID; }
+		public function set newID(val:String):void
+		{ _newID = val; }
+
+		/** @private */
+		public override function doOperation():Boolean
+		{
+			var targetElement:IFlowElement = getTargetElement();
+			_origID = targetElement.id;
+
+			adjustForDoOperation(targetElement);
+			
+			targetElement.id = _newID;
+			return true;
+		}	
+		
+		/** @private */
+		public override function undo():SelectionState
+		{
+			var targetElement:IFlowElement = getTargetElement();
+			targetElement.id = _origID;
+			
+			adjustForUndoOperation(targetElement);
+			
+			return originalSelectionState;
+		}
+	}
+}
\ 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/operations/ApplyElementStyleNameOperation.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyElementStyleNameOperation.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyElementStyleNameOperation.as
new file mode 100644
index 0000000..f50e84b
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyElementStyleNameOperation.as
@@ -0,0 +1,98 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.operations
+{
+	import org.apache.flex.textLayout.edit.SelectionState;
+	import org.apache.flex.textLayout.elements.IFlowElement;
+	
+	/**
+	 * The ApplyElementStyleNameOperation class encapsulates a style name change.
+	 *
+	 * @see org.apache.flex.textLayout.elements.FlowElement#styleName
+	 * @see org.apache.flex.textLayout.edit.EditManager
+	 * @see org.apache.flex.textLayout.events.FlowOperationEvent
+	 * 
+	 * @playerversion Flash 10
+	 * @playerversion AIR 1.5
+	 * @langversion 3.0 
+	 */
+	public class ApplyElementStyleNameOperation extends FlowElementOperation
+	{	
+		private var _origStyleName:String;
+		private var _newStyleName:String;
+		
+		/** 
+		 * Creates a ApplyElementStyleNameOperation object. 
+		 * 
+		 * <p>If the <code>relativeStart</code> and <code>relativeEnd</code> parameters are set, then the existing
+		 * element is split into multiple elements, the selected portion using the new 
+		 * style name and the rest using the existing style name.</p>
+		 * 
+		 * @param operationState Describes the current selection.
+		 * @param targetElement Specifies the element to change.
+		 * @param newStyleName The style name to assign.
+		 * @param relativeStart An offset from the beginning of the target element.
+		 * @param relativeEnd An offset from the end of the target element.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		*/
+		public function ApplyElementStyleNameOperation(operationState:SelectionState, targetElement:IFlowElement, newStyleName:String, relativeStart:int = 0, relativeEnd:int = -1)
+		{
+			_newStyleName = newStyleName;
+			super(operationState,targetElement,relativeStart,relativeEnd);
+		}
+		
+		/** 
+		 * The style name assigned by this operation.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		 */
+		public function get newStyleName():String
+		{ return _newStyleName; }
+		public function set newStyleName(val:String):void
+		{ _newStyleName = val; }
+
+		/** @private */
+		public override function doOperation():Boolean
+		{
+			var targetElement:IFlowElement = getTargetElement();
+			_origStyleName = targetElement.styleName;
+			
+			adjustForDoOperation(targetElement);
+			
+			targetElement.styleName = _newStyleName;
+			return true;
+		}	
+		
+		/** @private */
+		public override function undo():SelectionState
+		{
+			var targetElement:IFlowElement = getTargetElement();
+			targetElement.styleName = _origStyleName;
+			
+			adjustForUndoOperation(targetElement);
+			
+			return originalSelectionState;
+		}
+	}
+}
\ 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/operations/ApplyElementTypeNameOperation.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyElementTypeNameOperation.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyElementTypeNameOperation.as
new file mode 100644
index 0000000..82d20a8
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyElementTypeNameOperation.as
@@ -0,0 +1,101 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.operations {
+	import org.apache.flex.textLayout.edit.SelectionState;
+	import org.apache.flex.textLayout.elements.IFlowElement;
+	import org.apache.flex.textLayout.elements.IFlowElement;
+
+
+
+	
+	/**
+	 * The ApplyElementTypeNameOperation class encapsulates a type name change.
+	 *
+	 * @see org.apache.flex.textLayout.elements.FlowElement#typeName
+	 * @see org.apache.flex.textLayout.edit.EditManager
+	 * @see org.apache.flex.textLayout.events.FlowOperationEvent
+	 * 
+	 * @playerversion Flash 10
+	 * @playerversion AIR 1.5
+	 * @langversion 3.0 
+	 */
+	public class ApplyElementTypeNameOperation extends FlowElementOperation
+	{	
+		private var _undoTypeName:String;
+		private var _typeName:String;
+		
+		/** 
+		 * Creates a ApplyElementTypeNameOperation object. 
+		 * 
+		 * <p>If the <code>relativeStart</code> and <code>relativeEnd</code> parameters are set, then the existing
+		 * element is split into multiple elements, the selected portion using the new 
+		 * type name and the rest using the existing type name.</p>
+		 * 
+		 * @param operationState Describes the current selection.
+		 * @param targetElement Specifies the element to change.
+		 * @param newTypeName The type name to assign.
+		 * @param relativeStart An offset from the beginning of the target element.
+		 * @param relativeEnd An offset from the end of the target element.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		*/
+		public function ApplyElementTypeNameOperation(operationState:SelectionState, targetElement:IFlowElement, typeName:String, relativeStart:int = 0, relativeEnd:int = -1)
+		{
+			_typeName = typeName;
+			super(operationState,targetElement,relativeStart,relativeEnd);
+		}
+		
+		/** 
+		 * The type name assigned by this operation.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		 */
+		public function get typeName():String
+		{ return _typeName; }
+		public function set typeName(val:String):void
+		{ _typeName = val; }
+
+		/** @private */
+		public override function doOperation():Boolean
+		{
+			var targetElement:IFlowElement = getTargetElement();
+			_undoTypeName = targetElement.typeName;
+			
+			adjustForDoOperation(targetElement);
+			
+			targetElement.typeName = _typeName;
+			return true;
+		}	
+		
+		/** @private */
+		public override function undo():SelectionState
+		{
+			var targetElement:IFlowElement = getTargetElement();
+			targetElement.typeName = _undoTypeName;
+			
+			adjustForUndoOperation(targetElement);
+			
+			return originalSelectionState;
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd08d137/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyElementUserStyleOperation.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyElementUserStyleOperation.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyElementUserStyleOperation.as
new file mode 100644
index 0000000..cf9c918
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyElementUserStyleOperation.as
@@ -0,0 +1,118 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.operations {
+	import org.apache.flex.textLayout.edit.SelectionState;
+	import org.apache.flex.textLayout.elements.IFlowElement;
+	import org.apache.flex.textLayout.elements.IFlowElement;
+
+
+
+	
+	/**
+	 * The ApplyElementUserStyleOperation class encapsulates a change in a style value of an element.
+	 *
+	 * @see org.apache.flex.textLayout.elements.FlowElement#userStyles
+	 * @see org.apache.flex.textLayout.edit.EditManager
+	 * @see org.apache.flex.textLayout.events.FlowOperationEvent
+	 * 
+	 * @playerversion Flash 10
+	 * @playerversion AIR 1.5
+	 * @langversion 3.0 
+	 */
+	public class ApplyElementUserStyleOperation extends FlowElementOperation
+	{	
+		private var _styleName:String;
+		
+		private var _origValue:*;
+		private var _newValue:*;
+		
+		/** 
+		 * Creates a ApplyElementUserStyleOperation object.
+		 * 
+		 * <p>If the <code>relativeStart</code> and <code>relativeEnd</code> parameters are set, then the existing
+		 * element is split into multiple elements, the selected portion using the new 
+		 * style value and the rest using the existing style value.</p>
+		 * 
+		 * @param operationState Describes the range of text to style.
+		 * @param targetElement Specifies the element to change.
+		 * @param styleName The name of the style to change.
+		 * @param value The new style value.
+		 * @param relativeStart An offset from the beginning of the target element.
+		 * @param relativeEnd An offset from the end of the target element.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		*/
+		public function ApplyElementUserStyleOperation(operationState:SelectionState, targetElement:IFlowElement, styleName:String, value:*, relativeStart:int = 0, relativeEnd:int = -1)
+		{
+			_styleName = styleName;
+			_newValue = value;
+			
+			super(operationState,targetElement,relativeStart,relativeEnd);
+		}
+		
+		/** 
+		 * The name of the style changed. 
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		 */
+		public function get styleName():String
+		{ return _styleName; }
+		public function set styleName(val:String):void
+		{ _styleName = val; }
+		
+		/** 
+		 * The new style value.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		 */
+		public function get newValue():*
+		{ return _newValue; }
+		public function set newValue(val:*):void
+		{ _newValue = val; }
+
+		/** @private */
+		public override function doOperation():Boolean
+		{
+			var targetElement:IFlowElement = getTargetElement();
+			_origValue = targetElement.getStyle(_styleName);
+			
+			adjustForDoOperation(targetElement);
+			
+			targetElement.setStyle(_styleName,_newValue);
+			return true;
+		}	
+		
+		/** @private */
+		public override function undo():SelectionState
+		{
+			var targetElement:IFlowElement = getTargetElement();
+			targetElement.setStyle(_styleName,_origValue);
+			
+			adjustForUndoOperation(targetElement);
+			
+			return originalSelectionState;
+		}
+	}
+}
\ 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/operations/ApplyFormatOperation.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyFormatOperation.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyFormatOperation.as
new file mode 100644
index 0000000..ea9fcfa
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyFormatOperation.as
@@ -0,0 +1,249 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.operations
+{
+	import org.apache.flex.textLayout.elements.IParagraphElement;
+	import org.apache.flex.textLayout.edit.ElementRange;
+	import org.apache.flex.textLayout.edit.ParaEdit;
+	import org.apache.flex.textLayout.edit.PointFormat;
+	import org.apache.flex.textLayout.edit.SelectionState;
+	import org.apache.flex.textLayout.elements.ParagraphElement;
+	import org.apache.flex.textLayout.formats.ITextLayoutFormat;
+	import org.apache.flex.textLayout.formats.TextLayoutFormat;
+
+
+
+		
+	/**
+	 * The ApplyFormatOperation class encapsulates a style change.
+	 * 
+	 * <p>An ApplyFormatOperation applies the leaf format to the text in the 
+	 * specified range (no change is made if the specified range is a single point). 
+	 * It applies the paragraph format to any paragraphs at least partially within the range 
+	 * (or a single paragraph if the range is a single point). 
+	 * And it applies the container format to any containers at least partially within the range 
+	 * (or a single container if the range is a single point).</p>
+	 *
+	 * @see org.apache.flex.textLayout.edit.EditManager
+	 * @see org.apache.flex.textLayout.events.FlowOperationEvent
+	 * 
+	 * @playerversion Flash 10
+	 * @playerversion AIR 1.5
+	 * @langversion 3.0 
+	 */
+	public class ApplyFormatOperation extends FlowTextOperation
+	{
+		private var applyLeafFormat:ITextLayoutFormat;
+		private var applyParagraphFormat:ITextLayoutFormat;
+		private var applyContainerFormat:ITextLayoutFormat;
+
+		// helper array of styles to revert
+		// each entry has a begIdx, endIdx, ContainerFormat
+		private var undoLeafArray:Array;	
+		private var undoParagraphArray:Array;	
+		private var undoContainerArray:Array;	
+		
+		/** 
+		 * Creates an ApplyFormatOperation object.
+		 *
+		 *  @param operationState	Defines the text range to which the format is applied.
+		 *  @param leafFormat	 The format to apply to LeafFlowElement objects in the selected range.
+		 *  @param paragraphFormat The format to apply to ParagraphElement objects in the selected range.
+		 *  @param containerFormat The format to apply to containers in the selected range.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		 */		
+		public function ApplyFormatOperation(operationState:SelectionState, leafFormat:ITextLayoutFormat, paragraphFormat:ITextLayoutFormat, containerFormat:ITextLayoutFormat = null)
+		{
+			super(operationState);
+			this.leafFormat = leafFormat;
+			this.paragraphFormat = paragraphFormat;
+			this.containerFormat = containerFormat;
+		}
+
+		/** 
+		 * The format properties to apply to the leaf elements in the range.
+		 * 
+		 * <p>If the range of this operation is a point, or if <code>leafFormat</code> is <code>null</code>,
+		 * then no leaf element formats are changed.</p>
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		*/
+		public function get leafFormat():ITextLayoutFormat
+		{
+			return applyLeafFormat;
+		}
+		public function set leafFormat(value:ITextLayoutFormat):void
+		{
+			applyLeafFormat = value ? new TextLayoutFormat(value) : null;
+		}
+		
+		/** 
+		 * The format properties to apply to the paragraphs in the range.
+		 * 
+		 * <p>The formats of any paragraphs at least partially within the range are updated. 
+		 * If the range of this operation is a point, then a single paragraph is updated.
+		 * If <code>paragraphFormat</code> is <code>null</code>, then no paragraph formats are changed.</p>
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		*/
+		public function get paragraphFormat():ITextLayoutFormat
+		{
+			return applyParagraphFormat;
+		}
+		public function set paragraphFormat(value:ITextLayoutFormat):void
+		{
+			applyParagraphFormat = value ? new TextLayoutFormat(value) : null;
+		}
+		
+		/** 
+		 * The format properties to apply to the containers in the range.
+		 * 
+		 * <p>The formats of any containers at least partially within the range are updated. 
+		 * If the range of this operation is a point, then a single container is updated.
+		 * If <code>containerFormat</code> is <code>null</code>, then no container formats are changed.</p>
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		*/
+		public function get containerFormat():ITextLayoutFormat
+		{
+			return applyContainerFormat;
+		}
+		public function set containerFormat(value:ITextLayoutFormat):void
+		{
+			applyContainerFormat = value ? new TextLayoutFormat(value) : null;
+		}
+		
+		private function doInternal():SelectionState
+		{
+			var anyNewSelectionState:SelectionState;
+			
+			// Apply character format
+			if (applyLeafFormat)
+			{
+				var begSel:int = absoluteStart;
+				var endSel:int = absoluteEnd;
+				
+				if (absoluteStart == absoluteEnd)
+				{
+					// On a caret selection, apply the leaf format to the SelectionManager's pointFormat, so it will be applied to the next insert.
+					// But if the paragraph is empty, go ahead and apply it now to the paragraph terminator.
+					var paragraph:IParagraphElement = textFlow.findLeaf(absoluteStart).getParagraph();
+					if (paragraph.textLength <= 1)
+					{
+						endSel++;
+						anyNewSelectionState = originalSelectionState.clone();
+						anyNewSelectionState.pointFormat = null;
+					}
+					else if (originalSelectionState.selectionManagerOperationState && textFlow.interactionManager)
+					{
+						// on point selection remember pendling leaf formats for next char typed
+						
+						anyNewSelectionState = originalSelectionState.clone();
+						var newFormat:PointFormat = new PointFormat(anyNewSelectionState.pointFormat);
+						newFormat.apply(applyLeafFormat);
+						anyNewSelectionState.pointFormat = newFormat;
+					}
+				}
+				if (begSel != endSel)
+				{
+					var range:ElementRange = ElementRange.createElementRange(textFlow, begSel,endSel);
+					
+					begSel = range.absoluteStart;
+					endSel = range.absoluteEnd;
+					if(endSel == textFlow.textLength - 1)
+						++endSel;
+						
+				//	CONFIG::debug { if (begSel != absoluteStart || endSel != absoluteEnd) trace("found mismatch ApplyFormatOperation"); }
+					if (!undoLeafArray)
+					{
+						undoLeafArray = new Array();
+						ParaEdit.cacheStyleInformation(textFlow,begSel,endSel,undoLeafArray);
+					}
+					ParaEdit.applyTextStyleChange(textFlow,begSel,endSel,applyLeafFormat,null);
+				}
+			}
+
+			if (applyParagraphFormat)
+			{
+				if (!undoParagraphArray)
+				{
+					undoParagraphArray = new Array();
+					ParaEdit.cacheParagraphStyleInformation(textFlow,absoluteStart, absoluteEnd,undoParagraphArray);
+				}
+				ParaEdit.applyParagraphStyleChange(textFlow,absoluteStart, absoluteEnd,applyParagraphFormat,null);
+			}
+			if (applyContainerFormat)
+			{
+				if (!undoContainerArray)
+				{
+					undoContainerArray = new Array();
+					ParaEdit.cacheContainerStyleInformation(textFlow,absoluteStart,absoluteEnd,undoContainerArray);
+				}
+				ParaEdit.applyContainerStyleChange(textFlow,absoluteStart,absoluteEnd,applyContainerFormat,null);
+			}
+			return anyNewSelectionState;
+		}
+		
+		/** @private */
+		public override function doOperation():Boolean
+		{ 
+			var newSelectionState:SelectionState = doInternal();
+			if (newSelectionState && textFlow.interactionManager)
+				textFlow.interactionManager.setSelectionState(newSelectionState);
+			return true;
+		}	
+		
+		/** @private */
+		override public function redo():SelectionState
+		{
+			var newSelectionState:SelectionState = doInternal();
+			return newSelectionState? newSelectionState : originalSelectionState;
+		}
+		
+		/** @private */
+		public override function undo():SelectionState
+		{ 
+			var obj:Object;
+			
+			// Undo character format changes
+			for each (obj in undoLeafArray)
+				ParaEdit.setTextStyleChange(textFlow,obj.begIdx,obj.endIdx,obj.style);
+
+			// Undo paragraph format changes
+			for each (obj in undoParagraphArray)
+				ParaEdit.setParagraphStyleChange(textFlow,obj.begIdx,obj.endIdx,obj.attributes);
+
+			// Undo container format changes
+			for each (obj in undoContainerArray)
+				ParaEdit.setContainerStyleChange(obj);
+
+			return originalSelectionState;
+		}
+		
+	}
+}
\ 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/operations/ApplyFormatToElementOperation.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyFormatToElementOperation.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyFormatToElementOperation.as
new file mode 100644
index 0000000..cb70533
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyFormatToElementOperation.as
@@ -0,0 +1,115 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.operations {
+	import org.apache.flex.textLayout.edit.SelectionState;
+	import org.apache.flex.textLayout.elements.IFlowElement;
+	import org.apache.flex.textLayout.formats.ITextLayoutFormat;
+	import org.apache.flex.textLayout.formats.TextLayoutFormat;
+
+
+
+	
+	/**
+	 * The ApplyFormatToElementOperation class encapsulates a style change to an element.
+	 *
+	 * <p>This operation applies one or more formats to a flow element.</p>
+	 * 
+	 * @see org.apache.flex.textLayout.edit.EditManager
+	 * @see org.apache.flex.textLayout.formats.TextLayoutFormat
+	 * @see org.apache.flex.textLayout.events.FlowOperationEvent
+	 * 
+	 * @playerversion Flash 10
+	 * @playerversion AIR 1.5
+	 * @langversion 3.0 
+	 */
+	public class ApplyFormatToElementOperation extends FlowElementOperation
+	{
+		private var _format:ITextLayoutFormat;
+		
+		private var _undoStyles:TextLayoutFormat;
+				
+		/** 
+		* Creates an ApplyFormatToElementOperation object. 
+		* 
+		* @param operationState Specifies the text flow containing the element to which this operation is applied.
+		* @param targetElement specifies the element to which this operation is applied.
+		* @param format The formats to apply in this operation.
+		 * 
+		* @playerversion Flash 10
+		* @playerversion AIR 1.5
+	 	* @langversion 3.0 
+		*/
+		public function ApplyFormatToElementOperation(operationState:SelectionState, targetElement:IFlowElement, format:ITextLayoutFormat, relativeStart:int = 0, relativeEnd:int = -1)
+		{
+			super(operationState,targetElement,relativeStart,relativeEnd);
+				
+			// split up the properties by category
+			_format = format;
+		}
+				
+		/** 
+		 * The character formats applied in this operation.
+		 * 
+		 * <p>If <code>null</code> no character formats are changed.</p> 
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		*/
+		public function get format():ITextLayoutFormat
+		{
+			return _format;
+		}
+		public function set format(value:ITextLayoutFormat):void
+		{
+			_format = value;
+		}
+		
+		/** @private */
+		public override function doOperation():Boolean
+		{
+			var targetElement:IFlowElement = getTargetElement();
+			
+			adjustForDoOperation(targetElement);
+			
+			_undoStyles = new TextLayoutFormat(targetElement.format);
+			
+			if (_format)
+			{
+				var newFormat:TextLayoutFormat = new TextLayoutFormat(targetElement.format);
+				newFormat.apply(_format);
+				targetElement.format = newFormat;
+			}
+			
+			return true;
+		}	
+		
+		/** @private */
+		public override function undo():SelectionState
+		{
+			var targetElement:IFlowElement = getTargetElement();
+			
+			targetElement.format = new TextLayoutFormat(_undoStyles);
+			
+			adjustForUndoOperation(targetElement);
+			
+			return originalSelectionState;
+		}
+	}
+}
\ 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/operations/ApplyLinkOperation.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyLinkOperation.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyLinkOperation.as
new file mode 100644
index 0000000..b2c3c6d
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyLinkOperation.as
@@ -0,0 +1,206 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.operations
+{
+	import org.apache.flex.textLayout.edit.IMemento;
+	import org.apache.flex.textLayout.edit.ModelEdit;
+	import org.apache.flex.textLayout.edit.SelectionState;
+	import org.apache.flex.textLayout.edit.TextFlowEdit;
+	import org.apache.flex.textLayout.elements.IFlowLeafElement;
+	import org.apache.flex.textLayout.elements.LinkElement;
+	
+	/**
+	 * The ApplyLinkOperation class encapsulates a link creation or modification operation.
+	 *
+	 * @see org.apache.flex.textLayout.elements.LinkElement
+	 * @see org.apache.flex.textLayout.edit.EditManager
+	 * @see org.apache.flex.textLayout.events.FlowOperationEvent
+	 * 
+	 * @playerversion Flash 10
+	 * @playerversion AIR 1.5
+	 * @langversion 3.0 
+	 */			
+	public class ApplyLinkOperation extends FlowTextOperation
+	{
+		private var _hrefString:String;
+		private var _target:String;
+		private var _extendToLinkBoundary:Boolean;
+		private var _memento:IMemento;
+		private var _linkElement:LinkElement;
+
+		/** 
+		 * Creates an ApplyLinkOperation object.
+		 * 
+		 * @param operationState	The text range to which the operation is applied.
+		 * @param href The URI to be associated with the link.  If href is an empty string, 
+		 * the URI of links in the selection are removed.
+		 * @param target The target of the link.
+		 * @param extendToLinkBoundary Whether to extend the selection to include the entire 
+		 * text of any existing links overlapped by the selection, and then apply the change.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		 */
+		function ApplyLinkOperation(operationState:SelectionState, href:String, target:String, extendToLinkBoundary:Boolean)
+		{
+			super(operationState);
+		
+			_hrefString = href;
+			_target = target;
+			_extendToLinkBoundary = extendToLinkBoundary;
+		}
+		
+		/** 
+		 * The URI to be associated with the link.  If href is an empty string, 
+		 * the URI of links in the selection are removed.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		*/
+		public function get href():String
+		{
+			return _hrefString;
+		}
+		public function set href(value:String):void
+		{
+			_hrefString = value;
+		}
+		
+		/**
+		 * The target of the link.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		*/
+		public function get target():String
+		{
+			return _target;
+		}
+		public function set target(value:String):void
+		{
+			_target = value;
+		}
+		
+		/**
+		 * Whether to extend the selection to include the entire 
+		 * text of any existing links overlapped by the selection, and then apply the change.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		*/
+		public function get extendToLinkBoundary():Boolean
+		{
+			return _extendToLinkBoundary;
+		}
+		public function set extendToLinkBoundary(value:Boolean):void
+		{
+			_extendToLinkBoundary = value;
+		}
+
+		/** 
+		 * The LinkElement that was created by doOperation.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 2.0
+		 * @langversion 3.0 
+		 */
+		public function get newLinkElement():LinkElement
+		{
+			return _linkElement;
+		}
+		
+
+		
+		/** @private */
+		public override function doOperation():Boolean
+		{
+			var leaf:IFlowLeafElement;
+			if (absoluteStart == absoluteEnd)
+				return false;
+			
+			if (_extendToLinkBoundary)
+			{
+				leaf = textFlow.findLeaf(absoluteStart);
+				var link:LinkElement = leaf.getParentByType("LinkElement") as LinkElement;
+				if (link)
+				{
+					absoluteStart = link.getAbsoluteStart();
+				}
+				
+				leaf = textFlow.findLeaf(absoluteEnd-1);
+				link = leaf.getParentByType("LinkElement") as LinkElement;
+				if (link)
+				{
+					absoluteEnd = link.getAbsoluteStart() + link.textLength;
+				}
+			}
+			//save off so that we can restore the flow on undo			
+			_memento = ModelEdit.saveCurrentState(textFlow, absoluteStart, absoluteEnd);
+				
+			if (_hrefString && _hrefString != "")
+			{
+				var madeLink:Boolean = TextFlowEdit.makeLink(textFlow, absoluteStart, absoluteEnd, _hrefString, _target);
+				if (!madeLink) 
+				{
+					_memento = null;
+					return false;
+				}
+				else
+				{
+					leaf = textFlow.findLeaf(absoluteStart);
+					_linkElement = leaf.getParentByType("LinkElement") as LinkElement;
+				}
+			}
+			else
+			{
+				TextFlowEdit.removeLink(textFlow, absoluteStart, absoluteEnd);				
+			} 
+			return true;
+		}
+		
+		/** @private */
+		public override function undo():SelectionState
+		{
+			if (_memento)
+				_memento.undo();
+			return originalSelectionState;				
+		}
+	
+		/** @private */
+		public override function redo():SelectionState
+		{
+			if (absoluteStart != absoluteEnd && _memento)
+			{
+				if (_hrefString != "")
+				{
+					TextFlowEdit.makeLink(textFlow, absoluteStart, absoluteEnd, _hrefString, _target);
+				}
+				else
+				{
+					TextFlowEdit.removeLink(textFlow, absoluteStart, absoluteEnd);				
+				} 
+			}
+			return originalSelectionState;	
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd08d137/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyTCYOperation.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyTCYOperation.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyTCYOperation.as
new file mode 100644
index 0000000..c6a17a9
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ApplyTCYOperation.as
@@ -0,0 +1,190 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.operations
+{
+	import org.apache.flex.textLayout.elements.IFlowLeafElement;
+	import org.apache.flex.textLayout.debug.assert;
+	import org.apache.flex.textLayout.edit.IMemento;
+	import org.apache.flex.textLayout.edit.ModelEdit;
+	import org.apache.flex.textLayout.edit.SelectionState;
+	import org.apache.flex.textLayout.edit.TextFlowEdit;
+	import org.apache.flex.textLayout.elements.FlowLeafElement;
+	import org.apache.flex.textLayout.elements.TCYElement;
+
+	
+
+	
+	/** 
+	 * The ApplyTCYOperation class encapsulates a TCY transformation.
+	 *
+	 * @see org.apache.flex.textLayout.elements.TCYElement
+	 * @see org.apache.flex.textLayout.edit.EditManager
+	 * @see org.apache.flex.textLayout.events.FlowOperationEvent
+	 * 
+	 * @playerversion Flash 10
+	 * @playerversion AIR 1.5
+	 * @langversion 3.0 
+	 */
+	public class ApplyTCYOperation extends FlowTextOperation
+	{
+		
+		private var makeBegIdx:int;
+		private var makeEndIdx:int;
+		private var removeBegIdx:int;
+		private var removeEndIdx:int;
+		private var removeRedoBegIdx:int;
+		private var removeRedoEndIdx:int;
+		
+		private var _memento:IMemento;
+		private var _tcyOn:Boolean;
+		private var _tcyElement:TCYElement;
+
+		/** 
+		 * Creates an ApplyTCYOperation object.
+		 * 
+		 * @param operationState Describes the range of text to which the operation is applied.
+		 * @param tcyValue Specifies whether to apply TCY (<code>true</code>), or remove TCY (<code>false</code>).
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		 */
+		public function ApplyTCYOperation(operationState:SelectionState, tcyOn:Boolean)
+		{
+			super(operationState);
+			
+			if(tcyOn)
+			{
+				makeBegIdx = operationState.absoluteStart;
+				makeEndIdx = operationState.absoluteEnd;
+			}
+			else
+			{
+				removeBegIdx = operationState.absoluteStart;
+				removeEndIdx = operationState.absoluteEnd;
+			}
+			
+			_tcyOn = tcyOn;
+		}
+
+		/** 
+		 * Indicates whether the operation applies or removes TCY formatting.
+		 * 
+		 * <p>If <code>true</code>, then the operation transforms the range into a 
+		 * TCY element. If <code>false</code>, then the operation removes TCY formatting from
+		 * the first TCY element in the range.</p>
+		 * 
+		 * @see org.apache.flex.textLayout.elements.TCYElement
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		 */
+		public function get tcyOn():Boolean
+		{
+			return _tcyOn;
+		}
+		
+		public function set tcyOn(val:Boolean):void
+		{
+			_tcyOn = val;
+		}
+		
+		/** 
+		 * The TCYElement that was created by doOperation.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 2.0
+		 * @langversion 3.0 
+		 */
+		public function get newTCYElement():TCYElement
+		{
+			return _tcyElement;
+		}
+		
+		/** @private */
+		public override function doOperation():Boolean
+		{
+			var leaf:IFlowLeafElement;
+			var tcyElem:TCYElement;
+			if (_tcyOn && makeEndIdx <= makeBegIdx)
+			{
+				return false;
+			}
+			else if(!_tcyOn && removeEndIdx <= removeBegIdx)
+			{
+				return false;
+			}
+			
+			if (_tcyOn)
+			{
+				//save it off so that we can restore the flow on undo - make and remove need different scraps		
+				_memento = ModelEdit.saveCurrentState(textFlow, makeBegIdx, makeEndIdx);
+				if (TextFlowEdit.makeTCY(textFlow, makeBegIdx, makeEndIdx))
+				{
+					leaf = textFlow.findLeaf(makeBegIdx);
+					_tcyElement = leaf.getParentByType("TCYElement") as TCYElement;
+				}
+			}
+			else
+			{
+				leaf = textFlow.findLeaf(removeBegIdx);
+				tcyElem = leaf.getParentByType("TCYElement") as TCYElement;
+				CONFIG::debug{ assert(tcyElem != null, "Trying to remove TCY from a non-TCY element!"); }
+				
+				//collect the bounds for redo of removal - redo bounds are only the selection, while do bounds are the whole
+				//tcyElement
+				removeRedoBegIdx = removeBegIdx;
+				removeRedoEndIdx = removeEndIdx;
+				
+				//now reset the beg and end idx's	
+				removeBegIdx = tcyElem.getAbsoluteStart();
+				removeEndIdx = removeBegIdx + tcyElem.textLength;
+				
+				//create the scrap of the whole TCY element
+				_memento = ModelEdit.saveCurrentState(textFlow, removeBegIdx, removeEndIdx);
+			
+				//use the removeRedoBegIdx/removeRedoEndIdx
+				TextFlowEdit.removeTCY(textFlow, removeRedoBegIdx, removeRedoEndIdx);
+			} 
+			return true;				
+		}
+		
+		/** @private */
+		public override function undo():SelectionState
+		{
+			_memento.undo();
+			return originalSelectionState;				
+		}
+	
+		/** @private */
+		public override function redo():SelectionState
+		{
+			if (_tcyOn)
+			{
+				TextFlowEdit.makeTCY(textFlow, makeBegIdx, makeEndIdx);
+			}
+			else
+			{
+				TextFlowEdit.removeTCY(textFlow, removeRedoBegIdx, removeRedoEndIdx);				
+			} 
+			return originalSelectionState;
+		}
+	}
+}
\ 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/operations/ClearFormatOnElementOperation.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ClearFormatOnElementOperation.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ClearFormatOnElementOperation.as
new file mode 100644
index 0000000..3ef67e2
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ClearFormatOnElementOperation.as
@@ -0,0 +1,123 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.operations {
+	import org.apache.flex.textLayout.edit.SelectionState;
+	import org.apache.flex.textLayout.elements.FlowElement;
+	import org.apache.flex.textLayout.elements.IFlowElement;
+	import org.apache.flex.textLayout.formats.ITextLayoutFormat;
+	import org.apache.flex.textLayout.formats.TextLayoutFormat;
+
+
+
+	
+	/**
+	 * The ClearFormatOnElementOperation class encapsulates a style change to an element.
+	 *
+	 * <p>This operation undefines one or more formats to a flow element.</p>
+	 * 
+	 * @see org.apache.flex.textLayout.edit.EditManager
+	 * @see org.apache.flex.textLayout.formats.TextLayoutFormat
+	 * @see org.apache.flex.textLayout.events.FlowOperationEvent
+
+	 * @see ApplyFormatToElementOperation
+	 * 
+	 * @playerversion Flash 10
+	 * @playerversion AIR 1.5
+	 * @langversion 3.0 
+	 */
+	public class ClearFormatOnElementOperation extends FlowElementOperation
+	{
+		private var _format:ITextLayoutFormat;
+		
+		private var _undoStyles:TextLayoutFormat;
+				
+		/** 
+		* Creates an ClearFormatOnElementOperation object. 
+		* 
+		* @param operationState Specifies the text flow containing the element to which this operation is applied.
+		* @param targetElement specifies the element to which this operation is applied.
+		* @param format The formats to apply in this operation.
+		 * 
+		* @playerversion Flash 10
+		* @playerversion AIR 1.5
+	 	* @langversion 3.0 
+		*/
+		public function ClearFormatOnElementOperation(operationState:SelectionState, targetElement:IFlowElement, format:ITextLayoutFormat, relativeStart:int = 0, relativeEnd:int = -1)
+		{
+			super(operationState,targetElement,relativeStart,relativeEnd);
+				
+			// split up the properties by category
+			_format = format;
+		}
+				
+		/** 
+		 * The character formats applied in this operation.
+		 * 
+		 * <p>If <code>null</code> no character formats are changed.</p> 
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		*/
+		public function get format():ITextLayoutFormat
+		{
+			return _format;
+		}
+		public function set format(value:ITextLayoutFormat):void
+		{
+			_format = value;
+		}
+		
+		/** @private */
+		public override function doOperation():Boolean
+		{
+			var targetElement:IFlowElement = getTargetElement();
+			
+			adjustForDoOperation(targetElement);
+			
+			_undoStyles = new TextLayoutFormat(targetElement.format);
+			
+			if (_format)
+			{
+				var newFormat:TextLayoutFormat = new TextLayoutFormat(targetElement.format);
+				// this is fairly rare so this operation is not optimizied
+				for (var prop:String in TextLayoutFormat.description)
+				{
+					if (_format[prop] !== undefined)
+						newFormat[prop] = undefined;
+				} 
+				targetElement.format = newFormat;
+			}
+			
+			return true;
+		}	
+		
+		/** @private */
+		public override function undo():SelectionState
+		{
+			var targetElement:IFlowElement = getTargetElement();
+			
+			targetElement.format = new TextLayoutFormat(_undoStyles);
+			
+			adjustForUndoOperation(targetElement);
+			
+			return originalSelectionState;
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd08d137/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ClearFormatOperation.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ClearFormatOperation.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ClearFormatOperation.as
new file mode 100644
index 0000000..092359c
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/ClearFormatOperation.as
@@ -0,0 +1,237 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.operations
+{
+	import org.apache.flex.textLayout.edit.ElementRange;
+	import org.apache.flex.textLayout.edit.ParaEdit;
+	import org.apache.flex.textLayout.edit.PointFormat;
+	import org.apache.flex.textLayout.edit.SelectionState;
+	import org.apache.flex.textLayout.formats.ITextLayoutFormat;
+	import org.apache.flex.textLayout.formats.TextLayoutFormat;
+
+
+		
+	/**
+	 * The ClearFormatOperation class encapsulates a way to undefine formats.
+	 * 
+	 * <p>An UndefineFormatOperation undefines properties set in the leaf format to the text in the 
+	 * specified range (no change is made if the specified range is a single point). 
+	 * It undefines properties set in the paragraph format to any paragraphs at least partially within the range 
+	 * (or a single paragraph if the range is a single point). 
+	 * And it undefines properties set in the container format to any containers at least partially within the range 
+	 * (or a single container if the range is a single point).</p>
+	 *
+	 * @see org.apache.flex.textLayout.edit.EditManager
+	 * @see org.apache.flex.textLayout.events.FlowOperationEvent
+	 * 
+	 * @playerversion Flash 10
+	 * @playerversion AIR 1.5
+	 * @langversion 3.0 
+	 */
+	public class ClearFormatOperation extends FlowTextOperation
+	{
+		private var applyLeafFormat:ITextLayoutFormat;
+		private var applyParagraphFormat:ITextLayoutFormat;
+		private var applyContainerFormat:ITextLayoutFormat;
+
+		// helper array of styles to revert
+		// each entry has a begIdx, endIdx, ContainerFormat
+		private var undoLeafArray:Array;	
+		private var undoParagraphArray:Array;	
+		private var undoContainerArray:Array;	
+		
+		/** 
+		 * Creates an ClearFormatOperation object.
+		 *
+		 *  @param operationState	Defines the text range to which the format is applied.
+		 *  @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.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		 */		
+		public function ClearFormatOperation(operationState:SelectionState, leafFormat:ITextLayoutFormat, paragraphFormat:ITextLayoutFormat, containerFormat:ITextLayoutFormat = null)
+		{
+			super(operationState);
+			this.leafFormat = leafFormat;
+			this.paragraphFormat = paragraphFormat;
+			this.containerFormat = containerFormat;
+		}
+
+		/** 
+		 * The format properties to undefine on the leaf elements in the range.
+		 * 
+		 * <p>If the range of this operation is a point, or if <code>leafFormat</code> is <code>null</code>,
+		 * then no leaf element formats are changed.</p>
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		*/
+		public function get leafFormat():ITextLayoutFormat
+		{
+			return applyLeafFormat;
+		}
+		public function set leafFormat(value:ITextLayoutFormat):void
+		{
+			applyLeafFormat = value ? new TextLayoutFormat(value) : null;
+		}
+		
+		/** 
+		 * The format properties to undefine on the paragraphs in the range.
+		 * 
+		 * <p>The formats of any paragraphs at least partially within the range are updated. 
+		 * If the range of this operation is a point, then a single paragraph is updated.
+		 * If <code>paragraphFormat</code> is <code>null</code>, then no paragraph formats are changed.</p>
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		*/
+		public function get paragraphFormat():ITextLayoutFormat
+		{
+			return applyParagraphFormat;
+		}
+		public function set paragraphFormat(value:ITextLayoutFormat):void
+		{
+			applyParagraphFormat = value ? new TextLayoutFormat(value) : null;
+		}
+		
+		/** 
+		 * The format properties to undefine on the containers in the range.
+		 * 
+		 * <p>The formats of any containers at least partially within the range are updated. 
+		 * If the range of this operation is a point, then a single container is updated.
+		 * If <code>containerFormat</code> is <code>null</code>, then no container formats are changed.</p>
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		*/
+		public function get containerFormat():ITextLayoutFormat
+		{
+			return applyContainerFormat;
+		}
+		public function set containerFormat(value:ITextLayoutFormat):void
+		{
+			applyContainerFormat = value ? new TextLayoutFormat(value) : null;
+		}
+		
+		private function doInternal():SelectionState
+		{
+			var anyNewSelectionState:SelectionState;
+
+			// Apply character format
+			if (applyLeafFormat)
+			{
+				if (absoluteStart != absoluteEnd)
+				{
+					var range:ElementRange = ElementRange.createElementRange(textFlow, absoluteStart,absoluteEnd);
+					
+					var begSel:int = range.absoluteStart;
+					var endSel:int = range.absoluteEnd;
+					if(endSel == textFlow.textLength - 1)
+						++endSel;
+						
+				//	CONFIG::debug { if (begSel != absoluteStart || endSel != absoluteEnd) trace("found mismatch ApplyFormatOperation"); }
+					if (!undoLeafArray)
+					{
+						undoLeafArray = new Array();
+						ParaEdit.cacheStyleInformation(textFlow,begSel,endSel,undoLeafArray);
+					}
+					ParaEdit.applyTextStyleChange(textFlow,begSel,endSel,null,applyLeafFormat);
+				}
+				else if (originalSelectionState.selectionManagerOperationState && textFlow.interactionManager)
+				{
+					// on point selection remember pendling leaf formats for next char typed
+					
+					anyNewSelectionState = originalSelectionState.clone();
+					// This is only a partial implementation - see watson bug 
+					// here if the format is pending we can clear it
+					// The bug is that we don't remember any pending clear that's not set in pointFormat on the next character typed
+					var newFormat:PointFormat = new PointFormat(anyNewSelectionState.pointFormat);
+					for (var prop:String in TextLayoutFormat.description)
+					{
+						if (applyLeafFormat[prop] !== undefined)
+							newFormat[prop] = undefined;
+					}
+					anyNewSelectionState.pointFormat = newFormat;
+				}				
+			}
+
+			if (applyParagraphFormat)
+			{
+				if (!undoParagraphArray)
+				{
+					undoParagraphArray = new Array();
+					ParaEdit.cacheParagraphStyleInformation(textFlow,absoluteStart, absoluteEnd,undoParagraphArray);
+				}
+				ParaEdit.applyParagraphStyleChange(textFlow,absoluteStart, absoluteEnd, null, applyParagraphFormat);
+			}
+			if (applyContainerFormat)
+			{
+				if (!undoContainerArray)
+				{
+					undoContainerArray = new Array();
+					ParaEdit.cacheContainerStyleInformation(textFlow,absoluteStart,absoluteEnd,undoContainerArray);
+				}
+				ParaEdit.applyContainerStyleChange(textFlow,absoluteStart,absoluteEnd, null, applyContainerFormat);
+			}
+			return anyNewSelectionState;
+		}
+		
+		/** @private */
+		public override function doOperation():Boolean
+		{ 
+			var newSelectionState:SelectionState = doInternal();
+			if (newSelectionState && textFlow.interactionManager)
+				textFlow.interactionManager.setSelectionState(newSelectionState);
+			return true;
+		}
+
+		override public function redo():SelectionState
+		{
+			var newSelectionState:SelectionState = doInternal();
+			return newSelectionState? newSelectionState : originalSelectionState;
+		}		
+
+		/** @private */
+		public override function undo():SelectionState
+		{ 
+			var obj:Object;
+			
+			// Undo character format changes
+			for each (obj in undoLeafArray)
+				ParaEdit.setTextStyleChange(textFlow,obj.begIdx,obj.endIdx,obj.style);
+
+			// Undo paragraph format changes
+			for each (obj in undoParagraphArray)
+				ParaEdit.setParagraphStyleChange(textFlow,obj.begIdx,obj.endIdx,obj.attributes);
+
+			// Undo container format changes
+			for each (obj in undoContainerArray)
+				ParaEdit.setContainerStyleChange(obj);
+
+			return originalSelectionState;
+		}
+		
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd08d137/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/CompositeOperation.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/CompositeOperation.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/CompositeOperation.as
new file mode 100644
index 0000000..9c5f9ed
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/CompositeOperation.as
@@ -0,0 +1,221 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.operations
+{
+	import org.apache.flex.textLayout.edit.SelectionState;
+
+	import org.apache.flex.textLayout.elements.ITextFlow;
+	import org.apache.flex.textLayout.debug.assert;
+
+
+
+	/**
+	 * The CompositeOperation class encapsulates a group of transformations managed as a unit.
+	 *
+	 * <p>The CompositeOperation class provides a grouping mechanism for combining multiple FlowOperations 
+	 * into a single atomic operation. Grouping operations allows them to be undone and redone as a unit. 
+	 * For example, several single character inserts followed by several backspaces can be undone together as if 
+	 * they were a single operation. Grouping also provides a mechanism for representing
+	 * complex operations. For example, a replace operation that modifies more than one text ranges
+	 * can be represented and managed as a single composite operation.</p>
+	 * 
+	 * <p><b>Note:</b> It can be more efficient to merge individual atomic operations
+	 *  rather than to combine separate operations into a group. For example, several sequential
+	 *  character inserts can easily be represented as a single insert operation,
+	 *  and undoing or redoing that single operation is more efficient than
+	 *  undoing or redoing a group of insert operations.</p>
+	 * 
+	 * @see org.apache.flex.textLayout.edit.EditManager
+	 * @see org.apache.flex.textLayout.events.FlowOperationEvent
+	 * 
+	 * @playerversion Flash 10
+	 * @playerversion AIR 1.5
+	 * @langversion 3.0 
+	 */
+	public class CompositeOperation extends FlowOperation
+	{
+		private var _operations:Array;
+		
+		/** 
+		 * Creates a CompositeOperation object.
+		 * 
+		 * @param operations The operations to group.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		 */
+		public function CompositeOperation(operations:Array = null)
+		{
+			super(null);
+			this.operations = operations;
+			if (_operations.length)
+				setGenerations(_operations[0].beginGeneration,_operations[_operations.length-1].endGeneration);
+		}
+
+		/** @private */
+		override public function get textFlow():ITextFlow
+		{ return _operations.length > 0 ? _operations[0].textFlow : null; }
+		
+		/**
+		 * An array containing the operations grouped by this composite operation.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		 */
+		public function get operations():Array
+		{
+			return _operations;
+		}
+		public function set operations(value:Array):void
+		{
+			_operations = value ? value.slice() : [];	// make a copy
+		}
+		
+		/** 
+		 * Adds an additional operation to the end of the list. 
+		 * 
+		 * <p>The new operation must operate on the same TextFlow object as 
+		 * the other operations in the list.</p>
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		 */
+		public function addOperation(operation:FlowOperation):void
+		{
+			// Can't handle operations from other TextFlows
+			if (_operations.length > 0 && operation.textFlow != textFlow)
+				return;
+				
+			CONFIG::debug { assert(_operations.length <= 0 || operation.beginGeneration == _operations[_operations.length - 1].endGeneration,
+				"adding non-contiguous operation to composite operation"); }
+			_operations.push(operation);
+		}
+		
+		/** @private */
+		public override function doOperation():Boolean
+		{
+			// execute all the operations in order
+			var success:Boolean = true;
+			for (var i:int = 0; i < _operations.length; i++)
+				success = success && FlowOperation(_operations[i]).doOperation();
+			
+			// return selectionState from last operation
+			return true;
+		}
+		
+		/** @private */
+		public override function undo():SelectionState
+		{
+			// undo all the operations in reverse order
+			var selState:SelectionState;
+			for (var i:int = _operations.length - 1; i >= 0; i--)
+				selState = FlowOperation(_operations[i]).undo();
+			
+			// return selectionState from last performed
+			// (i.e., the first in the set of operations)
+			return selState;
+		}
+		
+		/** @private */
+		public override function redo():SelectionState
+		{
+			// execute all the operations in order
+			var selState:SelectionState;
+			for (var i:int = 0; i < _operations.length; i++)
+				selState = FlowOperation(_operations[i]).redo();
+			
+			// return selectionState from last operation
+			return selState;
+		}		
+		
+		/** @private */
+		public override function canUndo():Boolean
+		{ 
+			// All operations within the CompositeOperation must have matching generation numbers, and be undoable
+			var undoable:Boolean = true;
+			var generation:int = beginGeneration;
+			var opCount:int = _operations.length;
+			for (var i:int = 0; i < opCount && undoable; i++)
+			{
+				var op:FlowOperation = _operations[i];
+				if (op.beginGeneration != generation || !op.canUndo())
+					undoable = false;
+				generation = op.endGeneration;
+			}
+			if (opCount > 0 && _operations[opCount - 1].endGeneration != endGeneration)
+				undoable = false;
+			
+			return undoable; 
+		}
+		
+		
+		/** @private */
+		public override function merge(operation:FlowOperation):FlowOperation
+		{
+			if (operation is InsertTextOperation || operation is SplitParagraphOperation || operation is DeleteTextOperation)
+			{
+				if (this.endGeneration != operation.beginGeneration)
+					return null;
+				// For efficiency, try to combine the last low-level operation
+				// with the new operation. If that's not possible, we just add it 
+				// as an additional operation.
+				// Note that we are making various assumptions here about the technical
+				// feasability and appropriateness of merging the individual operations (e.g.,
+				// that the selection hasn't changed), relying on SelectionManager to
+				// guarantee that these are satisfied.
+				var mergedOp:FlowOperation;
+				var lastOp:FlowOperation = (_operations && _operations.length) ? 
+										FlowOperation(_operations[_operations.length - 1]) :
+										null;
+				if (lastOp) 
+					mergedOp = lastOp.merge(operation);
+				
+				if (mergedOp && !(mergedOp is CompositeOperation))
+					_operations[_operations.length - 1] = mergedOp;
+				else
+					_operations.push(operation);
+				setGenerations(beginGeneration,operation.endGeneration);
+				return this;
+			}
+			return null;
+		}
+		
+//		/**
+//		 *  Add an additional operation to the end of this operation.
+//		 *  If the additional operation is itself a CompositeOperation, 
+//		 *  its child operations are just added to this operation's 
+//		 *  set of child operations.
+//		 * 	
+//		 * @param operation The operation to be merged.
+//		 * 
+//		 */
+//		private function mergeOperationViaConcatenation(operation:FlowOperation):void
+//		{
+//			var compositeOp:CompositeOperation = operation as CompositeOperation;
+//			if (compositeOp)
+//				operations = operations.concat(compositeOp.operations);
+//			else
+//				operations.push(operation);
+//		}
+
+	}
+}
\ 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/operations/CopyOperation.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/CopyOperation.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/CopyOperation.as
new file mode 100644
index 0000000..d6b0be3
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/CopyOperation.as
@@ -0,0 +1,86 @@
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.operations
+{
+	import org.apache.flex.textLayout.edit.SelectionState;
+	import org.apache.flex.textLayout.edit.TextClipboard;
+	import org.apache.flex.textLayout.edit.TextScrap;
+
+
+
+
+	
+	/**
+	 * The CopyOperation class encapsulates a copy operation.
+	 * 
+	 * <p><b>Note:</b> The operation is responsible for copying the 
+	 * text scrap to the clipboard. Undonig a copy operation does not restore
+	 * the original clipboard state.</p>
+	 * 
+	 * @see org.apache.flex.textLayout.edit.EditManager
+	 * @see org.apache.flex.textLayout.events.FlowOperationEvent
+	 * 
+	 * @playerversion Flash 10
+	 * @playerversion AIR 1.5
+	 * @langversion 3.0 
+	 */
+	public class CopyOperation extends FlowTextOperation
+	{		
+		/** 
+		 * Creates a CopyOperation object.
+		 * 
+		 * @param operationState The range of text to be copied.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		 */
+		public function CopyOperation(operationState:SelectionState)
+		{
+			super(operationState);
+		}
+		
+		
+		/** @private */
+		public override function doOperation():Boolean
+		{
+			if (originalSelectionState.activePosition != originalSelectionState.anchorPosition)
+				TextClipboard.setContents(TextScrap.createTextScrap(originalSelectionState));		
+			return true;
+		}
+		
+		/** @private */
+		public override function undo():SelectionState
+		{				
+			return originalSelectionState;	
+		}
+	
+		/** @private */
+		public override function redo():SelectionState
+		{
+			return originalSelectionState;	
+
+		}		
+		
+		/** @private */
+		public override function canUndo():Boolean
+		{ return false; }
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fd08d137/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/CreateDivOperation.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/CreateDivOperation.as b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/CreateDivOperation.as
new file mode 100644
index 0000000..48c48ca
--- /dev/null
+++ b/frameworks/projects/TLF/src/main/flex/org/apache/flex/textLayout/operations/CreateDivOperation.as
@@ -0,0 +1,263 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.operations
+{
+	import org.apache.flex.textLayout.debug.assert;
+	import org.apache.flex.textLayout.edit.ElementMark;
+	import org.apache.flex.textLayout.edit.MementoList;
+	import org.apache.flex.textLayout.edit.ModelEdit;
+	import org.apache.flex.textLayout.edit.SelectionState;
+	import org.apache.flex.textLayout.elements.DivElement;
+	import org.apache.flex.textLayout.elements.IDivElement;
+	import org.apache.flex.textLayout.elements.ElementHelper;
+	import org.apache.flex.textLayout.elements.IFlowGroupElement;
+	import org.apache.flex.textLayout.elements.IListItemElement;
+	import org.apache.flex.textLayout.elements.IParagraphElement;
+	import org.apache.flex.textLayout.elements.ISubParagraphGroupElementBase;
+	import org.apache.flex.textLayout.formats.ITextLayoutFormat;
+
+	/**
+	 * The CreateDivOperation class encapsulates creating IDivElement
+	 *
+	 * @playerversion Flash 10
+	 * @playerversion AIR 1.5
+	 * @langversion 3.0 
+	 */
+	public class CreateDivOperation extends FlowTextOperation
+	{
+		// describes the target
+		private var _divParentMarker:ElementMark;
+		private var _mementoList:MementoList;
+
+		private var _format:ITextLayoutFormat;
+		private var _divElement:IDivElement;		// the element that gets created
+		
+		private var _postOpSelectionState:SelectionState;
+		
+		/** 
+		 * Creates an CreateDivOperation object.
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+	 	 * @langversion 3.0 
+		 */
+		public function CreateDivOperation(operationState:SelectionState, parent:IFlowGroupElement = null, format:ITextLayoutFormat = null)
+		{
+			super(operationState);
+			
+			this.parent = parent;
+			_format = format;
+			_mementoList = new MementoList(operationState.textFlow);
+		}
+		
+		/** 
+		 * Specifies the parent element for the new IDivElement
+		 * 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+		 * @langversion 3.0 
+		 * @flexjsignorecoercion org.apache.flex.textLayout.elements.IFlowGroupElement
+		 */
+		public function get parent():IFlowGroupElement
+		{
+			return _divParentMarker ? _divParentMarker.findElement(originalSelectionState.textFlow) as IFlowGroupElement : null;
+		}
+		
+		/**
+		 * @flexjsignorecoercion org.apache.flex.textLayout.elements.IFlowGroupElement
+		 */
+		public function set parent(value:IFlowGroupElement):void
+		{
+			if (!value)
+			{
+				// descend to the lowest level non-paragraph element that contains both positions
+				// effectively make the new div as close to the spans as possible
+				value = textFlow;
+				
+				var begPos:int = this.absoluteStart;
+				var endPos:int = this.absoluteEnd;
+				for (;;)
+				{
+					var begChildIdx:int = value.findChildIndexAtPosition(begPos);
+					var elem:IFlowGroupElement = value.getChildAt(begChildIdx) as IFlowGroupElement;
+					if (elem is IParagraphElement)
+						break;
+					begPos -= elem.parentRelativeStart;
+					endPos -= elem.parentRelativeStart;
+					if (endPos >= elem.textLength)	// end pos is in the next element
+						break;
+					value = elem;
+				}
+			}
+			else if (value is ISubParagraphGroupElementBase)
+				value = value.getParagraph().parent;
+			
+			_divParentMarker = new ElementMark(value,0);
+		}
+		
+		/** TextLayoutFormat to be applied to the new IDivElement. 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+		 * @langversion 3.0 
+		 */	
+		public function get format():ITextLayoutFormat
+		{ return _format; }
+		public function set format(value:ITextLayoutFormat):void
+		{ _format = value; }
+		
+		/** The new IDivElement. 
+		 * @playerversion Flash 10
+		 * @playerversion AIR 1.5
+		 * @langversion 3.0 
+		 */	
+		public function get newDivElement():IDivElement
+		{ return _divElement; }
+		
+		/**
+		 *  @private
+		 * @flexjsignorecoercion org.apache.flex.textLayout.elements.IFlowGroupElement
+		 */
+		public override function doOperation():Boolean
+		{
+			var target:IFlowGroupElement = parent;
+			
+			// do nothing if target is a paragraphElement or below
+			if (!target || (target is IParagraphElement) || (target is ISubParagraphGroupElementBase))
+				return false;
+			
+			// find the starting child that's going to be in the div and 
+			var begChildIndex:int = 0;
+			var begStart:int = absoluteStart - target.getAbsoluteStart();
+			CONFIG::debug { assert(begStart >= 0 && begStart < target.textLength,"CreateDivOperation: bad target"); }
+			
+			var endChildIndex:int;
+			var endStart:int = absoluteEnd - target.getAbsoluteStart();
+			CONFIG::debug { assert(endStart >= 0 && endStart <= target.textLength,"CreateDivOperation: bad target"); }
+			
+			// scratch vars
+			var child:IFlowGroupElement;
+			
+			if (begStart > 0)
+			{
+				// figure out the starting child
+				begChildIndex = target.findChildIndexAtPosition(begStart);
+				child = target.getChildAt(begChildIndex) as IFlowGroupElement;
+				if (child.parentRelativeStart != begStart)
+				{					
+					_mementoList.push(ModelEdit.splitElement(textFlow,child,begStart-child.parentRelativeStart));
+					
+					if (child is IParagraphElement)
+						endStart++;
+					begChildIndex++;
+				}
+			}
+			
+			if (endStart >= 0)
+			{
+				if (endStart >= target.textLength - 1)
+					endChildIndex = target.numChildren;
+				else
+				{
+					// figure out the starting child
+					endChildIndex = target.findChildIndexAtPosition(endStart);
+					child = target.getChildAt(endChildIndex) as IFlowGroupElement;
+					if (child.parentRelativeStart != endStart)			
+					{
+						_mementoList.push(ModelEdit.splitElement(textFlow,child,endStart-child.parentRelativeStart));
+						endChildIndex++;
+					}
+				}
+			}
+			else
+				endChildIndex = begChildIndex+1;
+			
+			_divElement = new DivElement();
+			_divElement.format = format;
+						
+			if (begChildIndex == target.numChildren)
+			{
+				// new div at the end of target
+				child = target.getChildAt(target.numChildren-1) as IFlowGroupElement;
+				
+				_mementoList.push(ModelEdit.splitElement(textFlow,child,child.textLength));
+				_mementoList.push(ModelEdit.addElement(textFlow,_divElement,target,target.numChildren));
+
+
+				_mementoList.push(ModelEdit.moveElement(textFlow,child,_divElement,_divElement.numChildren));
+			}
+			else
+			{
+				_mementoList.push(ModelEdit.addElement(textFlow,_divElement,target,endChildIndex));
+
+
+				if (begChildIndex == endChildIndex)
+				{
+					_mementoList.push(ModelEdit.addElement(textFlow,ElementHelper.getParagraph(),_divElement,0));					
+				}
+				else
+				{
+					while (begChildIndex < endChildIndex)
+					{
+						child = target.getChildAt(begChildIndex) as IFlowGroupElement;
+						if (child is IListItemElement)
+						{
+							// move all the children up and delete the IListItemElement
+							while (child.numChildren)
+								_mementoList.push(ModelEdit.moveElement(textFlow,child.getChildAt(0),_divElement,_divElement.numChildren));
+							_mementoList.push(ModelEdit.removeElements(textFlow,target,begChildIndex,1));
+						}
+						else
+						{
+							_mementoList.push(ModelEdit.moveElement(textFlow,child,_divElement,_divElement.numChildren));
+							child.normalizeRange(0,child.textLength);
+						}
+						endChildIndex--;
+					}
+				}
+				// normalize does this
+				if ((target is IListItemElement) && (target as IListItemElement).normalizeNeedsInitialParagraph())
+					_mementoList.push(ModelEdit.addElement(textFlow,ElementHelper.getParagraph(),target,0));
+			}
+			
+			if (originalSelectionState.selectionManagerOperationState && textFlow.interactionManager)
+			{
+				textFlow.normalize();
+				_postOpSelectionState = new SelectionState(textFlow,_divElement.getAbsoluteStart(),_divElement.getAbsoluteStart()+_divElement.textLength-1);
+				textFlow.interactionManager.setSelectionState(_postOpSelectionState);
+			}
+			
+			return true;
+		}
+
+		/** @private */
+		public override function undo():SelectionState
+		{
+			_mementoList.undo();
+			return originalSelectionState; 
+		}
+		
+		/** @private */
+		public override function redo():SelectionState
+		{
+			_mementoList.redo();
+			return _postOpSelectionState; 
+			
+		}
+	}
+}


Mime
View raw message