Index: /CKEditor/branches/versions/3.2.x/CHANGES.html
===================================================================
--- /CKEditor/branches/versions/3.2.x/CHANGES.html	(revision 5049)
+++ /CKEditor/branches/versions/3.2.x/CHANGES.html	(revision 5050)
@@ -43,4 +43,5 @@
 		<li><a href="http://dev.fckeditor.net/ticket/4612">#4612</a> : Update text view when user changes protocol.</li>
 		<li><a href="http://dev.fckeditor.net/ticket/4936">#4936</a> : New localization support for the Welsh language.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4973">#4973</a> : The style combo in Div dialog is now utilizing the default styleset defined by Styles Combo.</li>
 	</ul>
 	<p>
Index: /CKEditor/branches/versions/3.2.x/_source/core/resourcemanager.js
===================================================================
--- /CKEditor/branches/versions/3.2.x/_source/core/resourcemanager.js	(revision 5049)
+++ /CKEditor/branches/versions/3.2.x/_source/core/resourcemanager.js	(revision 5050)
@@ -128,5 +128,5 @@
 		return CKEDITOR.getUrl(
 				this.getPath( name ) +
-				( ( external && external.file ) || ( this.fileName + '.js' ) ) );
+				( ( external && external.file != null ) ? external.file : this.fileName + '.js' ) );
 	},
 
@@ -137,5 +137,6 @@
 	 * @param {String} path The path of the folder containing the resource.
 	 * @param {String} [fileName] The resource file name. If not provided, the
-	 *		default name is used.
+	 *		default name is used; If provided with a empty string, will implicitly indicates that {@param path}
+	 * 		is already the full path.
 	 * @example
 	 * // Loads a plugin from '/myplugin/samples/plugin.js'.
@@ -144,4 +145,7 @@
 	 * // Loads a plugin from '/myplugin/samples/my_plugin.js'.
 	 * CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/', 'my_plugin.js' );
+	 * @example
+	 * // Loads a plugin from '/myplugin/samples/my_plugin.js'.
+	 * CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/my_plugin.js', '' );
 	 */
 	addExternal : function( names, path, fileName )
Index: /CKEditor/branches/versions/3.2.x/_source/plugins/div/dialogs/div.js
===================================================================
--- /CKEditor/branches/versions/3.2.x/_source/plugins/div/dialogs/div.js	(revision 5049)
+++ /CKEditor/branches/versions/3.2.x/_source/plugins/div/dialogs/div.js	(revision 5050)
@@ -260,4 +260,27 @@
 		}
 
+		// Synchronous field values to other impacted fields is required, e.g. div styles
+		// change should also alter inline-style text.
+		function commitInternally( targetFields )
+		{
+			var dialog = this.getDialog(),
+				 element = dialog._element && dialog._element.clone()
+						 || new CKEDITOR.dom.element( 'div', editor.document );
+
+			// Commit this field and broadcast to target fields.
+			this.commit( element, true );
+
+			targetFields = [].concat( targetFields );
+			var length = targetFields.length, field;
+			for ( var i = 0; i < length; i++ )
+			{
+				field = dialog.getContentElement.apply( dialog, targetFields[ i ].split( ':' ) );
+				field && field.setup && field.setup( element, true );
+			}
+		}
+
+
+		// Registered 'CKEDITOR.style' instances.
+		var styles = {} ;
 		/**
 		 * Hold a collection of created block container elements.
@@ -290,15 +313,23 @@
 								label :editor.lang.div.styleSelectLabel,
 								'default' : '',
-								items : [],
+								// Options are loaded dynamically.
+								items :
+								[
+									[ editor.lang.common.notSet , '' ]
+								],
+								onChange : function()
+								{
+									commitInternally.call( this, [ 'info:class', 'advanced:dir', 'advanced:style' ] );
+								},
 								setup : function( element )
 								{
-									this.setValue( element.$.style.cssText || '' );
+									for ( var name in styles )
+										styles[ name ].checkElementRemovable( element, true ) && this.setValue( name );
 								},
 								commit: function( element )
 								{
-									if ( this.getValue() )
-										element.$.style.cssText = this.getValue();
-									else
-										element.removeAttribute( 'style' );
+									var styleName;
+									if ( styleName = this.getValue() )
+										styles[ styleName ].applyToObject( element )
 								}
 							},
@@ -352,5 +383,12 @@
 											style :'width: 100%;',
 											label :editor.lang.common.cssStyle,
-											'default' : ''
+											'default' : '',
+											commit : function( element )
+											{
+												// Merge with 'elementStyle', which is of higher priority.
+												var value = this.getValue(),
+														merged = [ value, element.getAttribute( 'style' ) ].join( ';' );
+												value && element.setAttribute( 'style', merged );
+											}
 										}
 								]
@@ -377,4 +415,5 @@
 								items :
 								[
+									[ editor.lang.common.notSet , '' ],
 									[
 										editor.lang.common.langDirLtr,
@@ -395,4 +434,47 @@
 			{
 				setupFields.call(this);
+
+				// Preparing for the 'elementStyle' field.
+				var dialog = this,
+					 stylesField = this.getContentElement( 'info', 'elementStyle' ),
+					 // Reuse the 'stylescombo' plugin's styles definition.
+					 customStylesConfig =  editor.config.stylesCombo_stylesSet,
+					 stylesSetName = customStylesConfig && customStylesConfig.split( ':' )[ 0 ];
+				
+				if( stylesSetName )
+				{
+					CKEDITOR.stylesSet.load( stylesSetName,
+						function( stylesSet )
+						{
+							var stylesDefinitions = stylesSet[ stylesSetName ],
+								styleName;
+
+							if ( stylesDefinitions )
+							{
+								// Digg only those styles that apply to 'div'.
+								for ( var i = 0 ; i < stylesDefinitions.length ; i++ )
+								{
+									var styleDefinition = stylesDefinitions[ i ];
+									if( styleDefinition.element && styleDefinition.element == 'div' )
+									{
+										styleName = styleDefinition.name;
+										styles[ styleName ] = new CKEDITOR.style( styleDefinition );
+
+										// Populate the styles field options with style name.
+										stylesField.items.push( [ styleName, styleName ] );
+										stylesField.add( styleName, styleName );
+									}
+								}
+							}
+
+
+							// We should disable the content element
+							// it if no options are available at all.
+							stylesField[ stylesField.items.length > 1 ? 'enable' : 'disable' ]();
+
+							// Now setup the field value manually.
+							setTimeout( function() { stylesField.setup( dialog._element ); }, 0 );
+						} );
+				}
 			},
 			onShow : function()
@@ -417,7 +499,18 @@
 
 				// Update elements attributes
-				for( var i = 0 ; i < containers.length ; i++ )
+				var size = containers.length;
+				for ( var i = 0; i < size; i++ )
+				{
 					this.commitContent( containers[ i ] );
+
+					// Remove empty 'style' attribute.
+					!containers[ i ].getAttribute( 'style' ) && containers[ i ].removeAttribute( 'style' );
+				}
+
 				this.hide();
+			},
+			onHide : function()
+			{
+				delete this._element;
 			}
 		};
Index: /CKEditor/branches/versions/3.2.x/_source/plugins/div/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.2.x/_source/plugins/div/plugin.js	(revision 5049)
+++ /CKEditor/branches/versions/3.2.x/_source/plugins/div/plugin.js	(revision 5050)
@@ -13,5 +13,5 @@
 	CKEDITOR.plugins.add( 'div',
 	{
-		requires : [ 'editingblock', 'domiterator' ],
+		requires : [ 'editingblock', 'domiterator', 'styles' ],
 
 		init : function( editor )
Index: /CKEditor/branches/versions/3.2.x/_source/plugins/styles/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.2.x/_source/plugins/styles/plugin.js	(revision 5049)
+++ /CKEditor/branches/versions/3.2.x/_source/plugins/styles/plugin.js	(revision 5050)
@@ -1247,2 +1247,4 @@
 	return !!doc;
 };
+
+CKEDITOR.stylesSet = new CKEDITOR.resourceManager( '', 'stylesSet' );
Index: /CKEditor/branches/versions/3.2.x/_source/plugins/stylescombo/plugin.js
===================================================================
--- /CKEditor/branches/versions/3.2.x/_source/plugins/stylescombo/plugin.js	(revision 5049)
+++ /CKEditor/branches/versions/3.2.x/_source/plugins/stylescombo/plugin.js	(revision 5050)
@@ -6,4 +6,6 @@
 (function()
 {
+	var stylesManager;
+
 	CKEDITOR.plugins.add( 'stylescombo',
 	{
@@ -16,4 +18,26 @@
 				pluginPath = this.path,
 				styles;
+
+			if ( !stylesManager )
+			{
+				stylesManager = CKEDITOR.stylesSet;
+
+				// Backward compatibilities (#5025).
+				CKEDITOR.addStylesSet = CKEDITOR.tools.bind( stylesManager.add, stylesManager );
+				CKEDITOR.loadStylesSet = function( name, url, callback )
+					{
+						stylesManager.addExternal( name, url, '' );
+						CKEDITOR.stylesSet.load( name, callback );
+					};
+			}
+			
+			var comboStylesSet = config.stylesCombo_stylesSet.split( ':' ),
+				styleSetName = comboStylesSet[ 0 ],
+				externalPath = comboStylesSet[ 1 ];
+
+			stylesManager.addExternal( styleSetName,
+					externalPath ?
+						comboStylesSet.slice( 1 ).join( ':' ) :
+						pluginPath + 'styles/' + styleSetName + '.js', '' );
 
 			editor.ui.addRichCombo( 'Styles',
@@ -33,16 +57,10 @@
 					init : function()
 					{
-						var combo = this,
-							stylesSet = config.stylesCombo_stylesSet.split( ':' );
-
-						var stylesSetPath = stylesSet[ 1 ] ?
-								stylesSet.slice( 1 ).join( ':' ) :		// #4481
-								CKEDITOR.getUrl( pluginPath + 'styles/' + stylesSet[ 0 ] + '.js' ) ;
-
-						stylesSet = stylesSet[ 0 ];
-
-						CKEDITOR.loadStylesSet( stylesSet, stylesSetPath, function( stylesDefinitions )
-							{
-								var style,
+						var combo = this;
+
+						CKEDITOR.stylesSet.load( styleSetName, function( stylesSet )
+							{
+								var stylesDefinitions = stylesSet[ styleSetName ],
+									style,
 									styleName,
 									stylesList = [];
@@ -207,27 +225,4 @@
 		}
 	});
-
-	var stylesSets = {};
-
-	CKEDITOR.addStylesSet = function( name, styles )
-	{
-		stylesSets[ name ] = styles;
-	};
-
-	CKEDITOR.loadStylesSet = function( name, url, callback )
-	{
-		var stylesSet = stylesSets[ name ];
-
-		if ( stylesSet )
-		{
-			callback( stylesSet );
-			return ;
-		}
-
-		CKEDITOR.scriptLoader.load( url, function()
-			{
-				callback( stylesSets[ name ] );
-			});
-	};
 
 	function buildPreview( styleDefinition )
Index: /CKEditor/branches/versions/3.2.x/_source/plugins/stylescombo/styles/default.js
===================================================================
--- /CKEditor/branches/versions/3.2.x/_source/plugins/stylescombo/styles/default.js	(revision 5049)
+++ /CKEditor/branches/versions/3.2.x/_source/plugins/stylescombo/styles/default.js	(revision 5050)
@@ -4,5 +4,5 @@
 */
 
-CKEDITOR.addStylesSet( 'default',
+CKEDITOR.stylesSet.add( 'default',
 [
 	/* Block Styles */
