Index: CKEditor/branches/versions/3.4.x/CHANGES.html
===================================================================
--- CKEditor/branches/versions/3.4.x/CHANGES.html	(revision 5752)
+++ CKEditor/branches/versions/3.4.x/CHANGES.html	(revision 5753)
@@ -45,4 +45,5 @@
 		<li><a href="http://dev.fckeditor.net/ticket/4606">#4606</a> : Port 'AutoGrow' plugin from FCKEditor 2.x.</li>
 		<li><a href="http://dev.fckeditor.net/ticket/5737">#5737</a> : Added support for the <a href="http://www.w3.org/TR/html5/editing.html#contenteditable">HTML5 contenteditable attribute</a>, making it possible to define read only regions into the editor contents.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/5418">#5418</a> : New "Advanced" tab introduced for tables. It's based on the new dialogadvtab plugin.</li>
 	</ul>
 	<p>
Index: CKEditor/branches/versions/3.4.x/_source/core/config.js
===================================================================
--- CKEditor/branches/versions/3.4.x/_source/core/config.js	(revision 5752)
+++ CKEditor/branches/versions/3.4.x/_source/core/config.js	(revision 5753)
@@ -244,5 +244,5 @@
 	 * @example
 	 */
-	plugins : 'about,a11yhelp,basicstyles,bidi,blockquote,button,clipboard,colorbutton,colordialog,contextmenu,div,elementspath,enterkey,entities,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,liststyle,maximize,newpage,pagebreak,pastefromword,pastetext,popup,preview,print,removeformat,resize,save,scayt,smiley,showblocks,showborders,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
+	plugins : 'about,a11yhelp,basicstyles,bidi,blockquote,button,clipboard,colorbutton,colordialog,contextmenu,dialogadvtab,div,elementspath,enterkey,entities,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,liststyle,maximize,newpage,pagebreak,pastefromword,pastetext,popup,preview,print,removeformat,resize,save,scayt,smiley,showblocks,showborders,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
 
 	/**
Index: CKEditor/branches/versions/3.4.x/_source/lang/en.js
===================================================================
--- CKEditor/branches/versions/3.4.x/_source/lang/en.js	(revision 5752)
+++ CKEditor/branches/versions/3.4.x/_source/lang/en.js	(revision 5753)
@@ -106,4 +106,9 @@
 		targetSelf		: 'Same Window (_self)',
 		targetParent	: 'Parent Window (_parent)',
+		advanced		: 'Advanced',
+		langDirLTR		: 'Left to Right (LTR)',
+		langDirRTL		: 'Right to Left (RTL)',
+		styles			: 'Style',
+		cssClasses		: 'Stylesheet Classes',
 
 		// Put the voice-only part of the label in the span.
Index: CKEditor/branches/versions/3.4.x/_source/plugins/dialog/plugin.js
===================================================================
--- CKEditor/branches/versions/3.4.x/_source/plugins/dialog/plugin.js	(revision 5752)
+++ CKEditor/branches/versions/3.4.x/_source/plugins/dialog/plugin.js	(revision 5753)
@@ -473,5 +473,8 @@
 		// Insert the tabs and contents.
 		for ( var i = 0 ; i < definition.contents.length ; i++ )
-			this.addPage( definition.contents[i] );
+		{
+			var page = definition.contents[i];
+			page && this.addPage( page );
+		}
 
 		this.parts['tabs'].on( 'click', function( evt )
@@ -1387,5 +1390,5 @@
 		var contents = dialogDefinition.contents;
 		for ( var i = 0, content ; ( content = contents[i] ) ; i++ )
-			contents[ i ] = new contentObject( dialog, content );
+			contents[ i ] = content && new contentObject( dialog, content );
 
 		CKEDITOR.tools.extend( this, dialogDefinition );
Index: CKEditor/branches/versions/3.4.x/_source/plugins/dialogadvtab/plugin.js
===================================================================
--- CKEditor/branches/versions/3.4.x/_source/plugins/dialogadvtab/plugin.js	(revision 5753)
+++ CKEditor/branches/versions/3.4.x/_source/plugins/dialogadvtab/plugin.js	(revision 5753)
@@ -0,0 +1,216 @@
+/*
+Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+For licensing, see LICENSE.html or http://ckeditor.com/license
+*/
+
+(function()
+{
+	
+function setupAdvParams( element )
+{
+	var attrName = this.att;
+
+	var value = element && element.hasAttribute( attrName ) && element.getAttribute( attrName ) || '';
+
+	if ( value !== undefined )
+		this.setValue( value );
+}
+
+function commitAdvParams()
+{
+	// Dialogs may use different parameters in the commit list, so, by
+	// definition, we take the first CKEDITOR.dom.element available.
+	var element;
+	
+	for ( var i = 0 ; i < arguments.length ; i++ )
+	{
+		if ( arguments[ i ] instanceof CKEDITOR.dom.element )
+		{
+			element = arguments[ i ];
+			break;
+		}
+	}
+
+	if ( element )
+	{
+		var attrName = this.att,
+			value = this.getValue();
+
+		if ( value )
+			element.setAttribute( attrName, value );
+		else
+			element.removeAttribute( attrName, value );
+	}
+}
+
+var isUpdating;
+
+CKEDITOR.plugins.add( 'dialogadvtab',
+{
+	/**
+	 *
+	 * @param tabConfig
+	 * id, dir, classes, styles
+	 */
+	createAdvancedTab : function( editor, tabConfig )
+	{
+		if ( !tabConfig )
+			tabConfig = { id:1, dir:1, classes:1, styles:1 };
+
+		var lang = editor.lang.common;
+
+		var result =
+		{
+			id : 'advanced',
+			label : lang.advanced,
+			title : lang.advanced,
+			elements :
+				[
+					{
+						type : 'vbox',
+						padding : 1,
+						children : []
+					}
+				]
+		};
+
+		var contents = [];
+
+		if ( tabConfig.id || tabConfig.dir )
+		{
+			if ( tabConfig.id )
+			{
+				contents.push(
+					{
+						id : 'advId',
+						att : 'id',
+						type : 'text',
+						label : lang.id,
+						setup : setupAdvParams,
+						commit : commitAdvParams
+					});
+			}
+
+			if ( tabConfig.dir )
+			{
+				contents.push(
+					{
+						id : 'advLangDir',
+						att : 'dir',
+						type : 'select',
+						label : lang.langDir,
+						'default' : '',
+						style : 'width:110px',
+						items :
+						[
+							[ lang.notSet, '' ],
+							[ lang.langDirLTR, 'ltr' ],
+							[ lang.langDirRTL, 'rtl' ]
+						],
+						setup : setupAdvParams,
+						commit : commitAdvParams
+					});
+			}
+
+			result.elements[ 0 ].children.push(
+				{
+					type : 'hbox',
+					widths : [ '50%', '50%' ],
+					children : [].concat( contents )
+				});
+		}
+
+		if ( tabConfig.styles || tabConfig.classes )
+		{
+			contents = [];
+
+			if ( tabConfig.id )
+			{
+				contents.push(
+					{
+						id : 'advStyles',
+						att : 'style',
+						type : 'text',
+						label : lang.styles,
+						'default' : '',
+						
+						onChange : function(){},
+
+						getStyle : function( name, defaultValue )
+						{
+							var match = this.getValue().match( new RegExp( name + '\\s*:\s*([^;]*)', 'i') );
+							return match ? match[ 1 ] : defaultValue;
+						},
+						
+						updateStyle : function( name, value )
+						{
+							if ( isUpdating )
+								return;
+							
+							// Flag to avoid recursion.
+							isUpdating = 1;
+
+							var styles = this.getValue();
+
+							// Remove the current value.
+							if ( styles )
+							{
+								styles = styles
+									.replace( new RegExp( '\\s*' + name + '\s*:[^;]*(?:$|;\s*)', 'i' ), '' )
+									.replace( /^[;\s]+/, '' )
+									.replace( /\s+$/, '' );
+							}
+
+							if ( value )
+							{
+								styles && !(/;\s*$/).test( styles ) && ( styles += '; ' );
+								styles += name + ': ' + value;
+							}
+							
+							this.setValue( styles );
+							
+							isUpdating = 0;
+						},
+
+						setup : setupAdvParams,
+
+						commit : commitAdvParams
+
+					});
+			}
+
+			if ( tabConfig.classes )
+			{
+				contents.push(
+					{
+						type : 'hbox',
+						widths : [ '45%', '55%' ],
+						children :
+						[
+							{
+								id : 'advCSSClasses',
+								att : 'class',
+								type : 'text',
+								label : lang.cssClasses,
+								'default' : '',
+								setup : setupAdvParams,
+								commit : commitAdvParams
+
+							}
+						]
+					});
+			}
+
+			result.elements[ 0 ].children.push(
+				{
+					type : 'hbox',
+					widths : [ '50%', '50%' ],
+					children : [].concat( contents )
+				});
+		}
+
+		return result;
+	}
+});
+
+})();
Index: CKEditor/branches/versions/3.4.x/_source/plugins/filebrowser/plugin.js
===================================================================
--- CKEditor/branches/versions/3.4.x/_source/plugins/filebrowser/plugin.js	(revision 5752)
+++ CKEditor/branches/versions/3.4.x/_source/plugins/filebrowser/plugin.js	(revision 5753)
@@ -389,9 +389,11 @@
 		for ( var i in definition.contents )
 		{
-			element = definition.contents[ i ] ;
-			attachFileBrowser( evt.editor, evt.data.name, definition, element.elements );
-			if ( element.hidden && element.filebrowser )
-			{
-				element.hidden = !isConfigured( definition, element[ 'id' ], element.filebrowser );
+			if ( ( element = definition.contents[ i ] ) )
+			{
+				attachFileBrowser( evt.editor, evt.data.name, definition, element.elements );
+				if ( element.hidden && element.filebrowser )
+				{
+					element.hidden = !isConfigured( definition, element[ 'id' ], element.filebrowser );
+				}
 			}
 		}
Index: CKEditor/branches/versions/3.4.x/_source/plugins/showborders/plugin.js
===================================================================
--- CKEditor/branches/versions/3.4.x/_source/plugins/showborders/plugin.js	(revision 5752)
+++ CKEditor/branches/versions/3.4.x/_source/plugins/showborders/plugin.js	(revision 5753)
@@ -154,4 +154,30 @@
 					};
 			} );
+
+			var advTab = dialogDefinition.getContents( 'advanced' ),
+				classField = advTab && advTab.get( 'advCSSClasses' );
+
+			if ( classField )
+			{
+				classField.setup = CKEDITOR.tools.override( classField.setup, function( originalSetup )
+					{
+						return function()
+							{
+								originalSetup.apply( this, arguments );
+								this.setValue( this.getValue().replace( /cke_show_border/, '' ) );
+							};
+					});
+
+				classField.commit = CKEDITOR.tools.override( classField.commit, function( originalCommit )
+					{
+						return function( data, element )
+							{
+								originalCommit.apply( this, arguments );
+								
+								if ( !parseInt( element.getAttribute( 'border' ), 10 ) )
+									element.addClass( 'cke_show_border' );
+							};
+					});
+			}
 		}
 	});
Index: CKEditor/branches/versions/3.4.x/_source/plugins/table/dialogs/table.js
===================================================================
--- CKEditor/branches/versions/3.4.x/_source/plugins/table/dialogs/table.js	(revision 5752)
+++ CKEditor/branches/versions/3.4.x/_source/plugins/table/dialogs/table.js	(revision 5753)
@@ -19,5 +19,10 @@
 	function tableDialog( editor, command )
 	{
-		var makeElement = function( name ){ return new CKEDITOR.dom.element( name, editor.document ); };
+		var makeElement = function( name )
+			{
+				return new CKEDITOR.dom.element( name, editor.document );
+			};
+
+		var dialogadvtab = editor.plugins.dialogadvtab;
 
 		return {
@@ -25,4 +30,50 @@
 			minWidth : 310,
 			minHeight : CKEDITOR.env.ie ? 310 : 280,
+
+			onLoad : function()
+			{
+				var dialog = this,
+					isUpdating;
+					
+				var styles = dialog.getContentElement( 'advanced', 'advStyles' );
+
+				if ( styles )
+				{
+					styles.on( 'change', function( evt )
+						{
+							if ( isUpdating )
+								return;
+							
+							// Flag to avoid recursion.
+							isUpdating = 1;
+							
+							// Synchronize width value.
+							var width = this.getStyle( 'width', '' ),
+								txtWidth = dialog.getContentElement( 'info', 'txtWidth' ),
+								cmbWidthType = dialog.getContentElement( 'info', 'cmbWidthType' );
+
+								isPx = 1;
+
+							if ( width )
+							{
+								isPx = ( width.length < 3 || width.substr( width.length - 1 ) != '%' );
+								width = parseInt( width, 10 );
+							}
+
+							txtWidth && txtWidth.setValue( width );
+							cmbWidthType && cmbWidthType.setValue( isPx ? 'pixels' : 'percents' );
+							
+							// Synchronize height value.
+							var height = this.getStyle( 'height', '' ),
+								txtHeight = dialog.getContentElement( 'info', 'txtHeight' );
+
+							height && ( height = parseInt( height, 10 ) );
+							txtHeight && txtHeight.setValue( height );
+
+							isUpdating = 0;
+						});
+				}
+			},
+
 			onShow : function()
 			{
@@ -34,5 +85,7 @@
 				var rowsInput = this.getContentElement( 'info', 'txtRows' ),
 					colsInput = this.getContentElement( 'info', 'txtCols' ),
-					widthInput = this.getContentElement( 'info', 'txtWidth' );
+					widthInput = this.getContentElement( 'info', 'txtWidth' ),
+					heightInput = this.getContentElement( 'info', 'txtHeight' );
+
 				if ( command == 'tableProperties' )
 				{
@@ -71,4 +124,9 @@
 					rowsInput && rowsInput.select();
 				}
+
+				// Call the onChange method for the widht and height fields so
+				// they get reflected into the Advanced tab.
+				widthInput && widthInput.onChange();
+				heightInput && heightInput.onChange();
 			},
 			onOk : function()
@@ -379,5 +437,5 @@
 													style : 'width:5em',
 													label : editor.lang.table.width,
-													'default' : 200,
+													'default' : 500,
 													validate : CKEDITOR.dialog.validate['number']( editor.lang.table.invalidWidth ),
 
@@ -391,4 +449,19 @@
 
 														inputElement.setAttribute( 'aria-labelledby', [ ariaLabelledByAttr, labelElement.$.id ].join( ' ' ) );
+													},
+
+													onChange : function()
+													{
+														var styles = this.getDialog().getContentElement( 'advanced', 'advStyles' );
+
+														if ( styles )
+														{
+															var value = this.getValue();
+															
+															if ( value )
+																value += this.getDialog().getContentElement( 'info', 'cmbWidthType' ).getValue() == 'percents' ? '%' : 'px';
+
+															styles.updateStyle( 'width', value );
+														}
 													},
 
@@ -420,4 +493,8 @@
 															this.setValue( widthMatch[2] == 'px' ? 'pixels' : 'percents' );
 													},
+													onChange : function()
+													{
+														this.getDialog().getContentElement( 'info', 'txtWidth' ).onChange();
+													},
 													commit : commitValue
 												}
@@ -446,4 +523,15 @@
 
 														inputElement.setAttribute( 'aria-labelledby', [ ariaLabelledByAttr, labelElement.$.id ].join( ' ' ) );
+													},
+
+													onChange : function()
+													{
+														var styles = this.getDialog().getContentElement( 'advanced', 'advStyles' );
+														
+														if ( styles )
+														{
+															var value = this.getValue();
+															styles.updateStyle( 'height', value && ( value + 'px' ) );
+														}
 													},
 
@@ -581,5 +669,6 @@
 						}
 					]
-				}
+				},
+				dialogadvtab && dialogadvtab.createAdvancedTab( editor )
 			]
 		};
