Index: /CKEditor/branches/features/pasting/_source/plugins/pastefromword/plugin.js
===================================================================
--- /CKEditor/branches/features/pasting/_source/plugins/pastefromword/plugin.js	(revision 4274)
+++ /CKEditor/branches/features/pasting/_source/plugins/pastefromword/plugin.js	(revision 4275)
@@ -59,5 +59,10 @@
 
 				// TODO: Support more list style type from MS-Word.
-				if ( bulletStyle[ 2 ] )
+				if( !bulletStyle )
+				{
+					bulletStyle = 'decimal';
+					listType = 'ol';
+				}
+				else if ( bulletStyle[ 2 ] )
 				{
 					if ( !isNaN( bulletStyle[ 1 ] ) )
@@ -74,9 +79,9 @@
 				else
 				{
-					if ( bulletStyle[ 1 ].search(/[l·•]/) != -1 )
+					if ( bulletStyle[ 1 ].search(/[l\u00B7\u2002]/) != -1 ) //l·•
 						bulletStyle = 'disc';
-					else if ( bulletStyle[ 1 ].search(/[oØ]/) != -1 )
+					else if ( bulletStyle[ 1 ].search(/[\u006F\u00D8]/) != -1 )  //oØ
 						bulletStyle = 'circle';
-					else if ( bulletStyle[ 1 ].search(/[n◆]/) != -1 )
+					else if ( bulletStyle[ 1 ].search(/[\u006E\u25C6]/) != -1 ) //n◆
 						bulletStyle = 'square';
 					else
@@ -101,4 +106,36 @@
 				if( /mso-list:\s*Ignore/i.test( styleText ) )
 					return true;
+			},
+
+			resolveList : function( element )
+			{
+				// <cke:listbullet> lies inside indicate a list item.
+				var children = element.children,
+					attrs = element.attributes,
+					listMarker;
+				if( ( listMarker = element.anyChildWithName( 'cke:listbullet' ) )
+					  && listMarker.length
+					  && ( listMarker = listMarker[ 0 ] ) )
+				{
+					element.name = 'cke:li';
+					attrs.style = CKEDITOR.plugins.pastefromword.filters.stylesFilter(
+					[
+						[ 'text-indent' ],
+						[ 'margin-left', null, function( value )
+						{
+							// Resolve indent level from 'margin-left' style.
+							attrs[ 'cke:indent' ] = parseInt( value );
+						} ]
+					] )( attrs.style, element ) || '' ;
+
+					// Inherit list-type-style from bullet.
+					var listBulletAttrs = listMarker.attributes,
+						listBulletStyle = listBulletAttrs.style;
+
+					attrs.style += listBulletStyle;
+					CKEDITOR.tools.extend( attrs, listBulletAttrs );
+					children.splice( 0, 1 );
+					return true;
+				}
 			}
 
@@ -185,6 +222,5 @@
 						element.name = styleDef.element;
 						CKEDITOR.tools.extend( element.attributes, CKEDITOR.tools.clone( styleDef.attributes ) );
-						var attrs = element.attributes;
-						attrs.style = ( attrs.style || '' ) + CKEDITOR.style.getStyleText( styleDef );
+						element.addStyle( CKEDITOR.style.getStyleText( styleDef ) );
 					}
 				},
@@ -235,4 +271,5 @@
 				createListBulletMarker = this.utils.createListBulletMarker,
 				isListBulletIndicator = this.utils.isListBulletIndicator,
+				resolveList = this.utils.resolveList,
 				listDtdParents = CKEDITOR.dtd.parentOf( 'ol' ),
 				config = editor.config,
@@ -257,10 +294,8 @@
 						{
 							element.filterChildren();
-							var onlyChild = element.onlyChild();
-							// Remove empty headings.
-							if( onlyChild && onlyChild.value
-								&& !CKEDITOR.tools.trim( onlyChild.value ) )
-								return false;
-							delete element.attributes;
+							// Heading might be a list.
+							if( resolveList( element ) )
+								return;
+
 							// Migrate heading formatting to editor configured ones.
 							elementMigrateFilter( config[ 'format_' + tagName ] )( element );
@@ -274,5 +309,5 @@
 								delete element.name;
 						}
-						// Remove namespaced element while preserving the content.
+						// Remove ms-office namespaced element while preserving the content.
 						else if( tagName.indexOf( ':' ) != -1
 								 && tagName.indexOf( 'cke' ) == -1 )
@@ -391,34 +426,13 @@
 						{
 							if( attrs && attrs.style )
-								parent.attributes.style += ( attrs.style + ';' );
+								parent.addStyle( attrs.style  );
+
 							delete element.name;
 							return;
 						}
-						// <cke:listbullet> lies inside any paragraph indicate a list item.
-						var childs;
-						if( ( childs = element.anyChildWithName( 'cke:listbullet' ) )
-							 && childs.length )
-						{
-							var listMaker = childs[ 0 ];
-							element.name = 'cke:li';
-							attrs.style = stylesFilter(
-							[
-								[ 'text-indent' ],
-								[ 'margin-left', null, function( value )
-								{
-									// Resolve indent level from 'margin-left' style.
-									attrs[ 'cke:indent' ] = parseInt( value );
-								} ]
-							] )( attrs.style, element ) || '' ;
-
-							// Inherit list-type-style from bullet. 
-							var listBulletAttrs = listMaker.attributes,
-								listBulletStyle = listBulletAttrs.style;
-
-							attrs.style += listBulletStyle;
-							CKEDITOR.tools.extend( attrs, listBulletAttrs );
-							children.splice( 0, 1 );
+
+						// Paragraph might be a list.
+						if( resolveList( element ) )
 							return;
-						}
 
 						// Migrate paragraph formatting based on editor's enter-mode.
@@ -510,10 +524,10 @@
 						attrs.style = stylesFilter(
 									[
-										[ 'font-family', null, styleMigrateFilter( config[ 'font_style' ], 'family' ) ],
+										[ /^font-family$/, null, styleMigrateFilter( config[ 'font_style' ], 'family' ) ],
 										// TODO: Convert 'pt' length unit into 'px'.
-										[ 'font-size', null, styleMigrateFilter( config[ 'fontSize_style' ], 'size' ) ],
+										[ /^font-size$/, null, styleMigrateFilter( config[ 'fontSize_style' ], 'size' ) ],
 										// TODO: Convert 'rgb' and 'descriptive' color into 'hexadecimal'. 
 										[ /^color$/, null, styleMigrateFilter( config[ 'colorButton_foreStyle' ], 'color' ) ],
-										[ 'background-color', null, styleMigrateFilter( config[ 'colorButton_backStyle' ], 'color' ) ]
+										[ /^background-color$/, null, styleMigrateFilter( config[ 'colorButton_backStyle' ], 'color' ) ]
 									] )( styleText, element ) || '';
 					},
@@ -556,12 +570,12 @@
 						[ /mso-/ ],
 						[ /-moz-/ ],
-						// Replace verbose background color style.
-						[ /^background$/, null, function( value )
-						{
-							return value.match( /^[^\s]+/ )[ 0 ];
-						}, 'background-color' ],
 						[ 'background-color', 'transparent' ],
-						// Remove verbose border-color style within Firefox.
-						CKEDITOR.env.gecko ? [ 'border-color', /(:?windowtext|-moz-use-text-color|\s)*/ ] : null,
+						// Firefox: replacing Mozilla-specific color value.
+						CKEDITOR.env.gecko ? [ '-color', null, function( value, element )
+						{
+							return value.replace( /-moz-use-text-color/g, 'transparent' );	
+						} ]: null,
+						// Remove default border style.
+						[ /^border$/, /^(:?medium\s*)?none\s*$/ ],
 						// 'Indent' format migration(to use editor's indent unit).
 						[ /margin-?/, null, function( value, element )
@@ -569,9 +583,10 @@
 							if( element.name == 'p' )
 							{
+								//TODO: Migrate to 'indentClasses' based indenting format.  
 								value = value.replace( /\d*\.?\d+pt/g, function( length )
 								{
 									var pt = parseInt( length );
-									// Assume MS-Word indent unit length as '11pt'.
-									return ( pt / 11 * config.indentOffset ) + config.indentUnit;
+									// MS-Word indent unit is roughly 11pt.
+									return Math.round( pt / 11 * config.indentOffset ) + config.indentUnit;
 								} );
 							}
@@ -599,7 +614,24 @@
 					},
 
-					// We always have both 'text-align' style company with
-					// 'align' attribute, drop the attribute.
-					'align' : falsyFilter
+					// MS-Word always generate both 'text-align' along with
+					// 'align' attribute( 'background-color' along with 'bgcolor'),
+					// simply drop the deprecated attributes.
+					'align' : falsyFilter,
+					'bgcolor' : falsyFilter,
+					// Deprecate 'valign' attribute in favor of 'vertical-align'.
+					'valign' : function( value, element )
+					{
+						// TODO: The style chang doesn't work now because of filtering system. 
+						if( value != 'top' )
+							element.addStyle( 'vertical-align', value );
+						return false;
+					},
+
+					// Avoid table 'border' attribute in favor of cell border styles.
+					'border' : function( value, element )
+					{
+						if( element.name == 'table' )
+							return false;
+					}
 				},
 
@@ -660,4 +692,35 @@
 		return childs;
 	};
+
+	// Adding a (set) of styles to the element's attributes.
+	elementPrototype.addStyle = function( name, value )
+	{
+		var styleText, addingStyleText = '';
+		// style literal.
+		if( typeof name == 'object' )
+		{
+			for( var style in name )
+			{
+				if( name.hasOwnProperty( style) )
+					addingStyleText += style + ':' + name[ style ] + ';';
+			}
+		}
+		// name/value pair.
+		else if( value )
+			addingStyleText += name + ':' + value + ';';
+		// raw style text form.
+		else
+			addingStyleText += name;
+
+		if( !this.attributes )
+			this.attributes = {};
+		styleText = this.attributes.style;
+		if( !styleText )
+			this.attributes.style = "";
+		else if( !/;$/.test( styleText ) )
+			this.attributes.style = styleText + ';';
+
+		this.attributes.style += addingStyleText;
+	}
 
 	fragmentPrototype.firstTextChild = elementPrototype.firstTextChild = function()
