--- /dev/null
+/*\r
+ * FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
+ * Copyright (C) 2003-2009 Frederico Caldeira Knabben\r
+ *\r
+ * == BEGIN LICENSE ==\r
+ *\r
+ * Licensed under the terms of any of the following licenses at your\r
+ * choice:\r
+ *\r
+ * - GNU General Public License Version 2 or later (the "GPL")\r
+ * http://www.gnu.org/licenses/gpl.html\r
+ *\r
+ * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")\r
+ * http://www.gnu.org/licenses/lgpl.html\r
+ *\r
+ * - Mozilla Public License Version 1.1 or later (the "MPL")\r
+ * http://www.mozilla.org/MPL/MPL-1.1.html\r
+ *\r
+ * == END LICENSE ==\r
+ *\r
+ * FCKCoreStyleCommand Class: controls the execution of a core style. Core\r
+ * styles are usually represented as buttons in the toolbar., like Bold and\r
+ * Italic.\r
+ */\r
+\r
+ var FCKCoreStyleCommand = function( coreStyleName )\r
+ {\r
+ this.Name = 'CoreStyle' ;\r
+ this.StyleName = '_FCK_' + coreStyleName ;\r
+ this.IsActive = false ;\r
+\r
+ FCKStyles.AttachStyleStateChange( this.StyleName, this._OnStyleStateChange, this ) ;\r
+ }\r
+\r
+ FCKCoreStyleCommand.prototype =\r
+ {\r
+ Execute : function()\r
+ {\r
+ FCKUndo.SaveUndoStep() ;\r
+\r
+ if ( this.IsActive )\r
+ FCKStyles.RemoveStyle( this.StyleName ) ;\r
+ else\r
+ FCKStyles.ApplyStyle( this.StyleName ) ;\r
+\r
+ FCK.Focus() ;\r
+ FCK.Events.FireEvent( 'OnSelectionChange' ) ;\r
+ },\r
+\r
+ GetState : function()\r
+ {\r
+ if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG )\r
+ return FCK_TRISTATE_DISABLED ;\r
+ return this.IsActive ? FCK_TRISTATE_ON : FCK_TRISTATE_OFF ;\r
+ },\r
+\r
+ _OnStyleStateChange : function( styleName, isActive )\r
+ {\r
+ this.IsActive = isActive ;\r
+ }\r
+ };\r