JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
48a6bcd26ef8972e89da8bd4c72efccb5480745c
[ckeditor.git] / _source / skins / office2003 / skin.js
1 /*\r
2 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
3 For licensing, see LICENSE.html or http://ckeditor.com/license\r
4 */\r
5 \r
6 CKEDITOR.skins.add( 'office2003', (function()\r
7 {\r
8         var preload = [];\r
9 \r
10         if ( CKEDITOR.env.ie && CKEDITOR.env.version < 7 )\r
11         {\r
12                 // For IE6, we need to preload some images, otherwhise they will be\r
13                 // downloaded several times (CSS background bug).\r
14                 preload.push( 'icons.png', 'images/sprites_ie6.png', 'images/dialog_sides.gif' );\r
15         }\r
16 \r
17         return {\r
18                 preload         : preload,\r
19                 editor          : { css : [ 'editor.css' ] },\r
20                 dialog          : { css : [ 'dialog.css' ] },\r
21                 templates       : { css : [ 'templates.css' ] },\r
22                 margins         : [ 0, 14, 18, 14 ]\r
23         };\r
24 })() );\r
25 \r
26 if ( CKEDITOR.dialog )\r
27 {\r
28         CKEDITOR.dialog.on( 'resize', function( evt )\r
29                 {\r
30                         var data = evt.data,\r
31                                 width = data.width,\r
32                                 height = data.height,\r
33                                 dialog = data.dialog,\r
34                                 contents = dialog.parts.contents;\r
35 \r
36                         if ( data.skin != 'office2003' )\r
37                                 return;\r
38 \r
39                         contents.setStyles(\r
40                                 {\r
41                                         width : width + 'px',\r
42                                         height : height + 'px'\r
43                                 });\r
44 \r
45                         if ( !CKEDITOR.env.ie )\r
46                                 return;\r
47 \r
48                         // Fix the size of the elements which have flexible lengths.\r
49                         var fixSize = function()\r
50                                 {\r
51                                         var innerDialog = dialog.parts.dialog.getChild( [ 0, 0, 0 ] ),\r
52                                                 body = innerDialog.getChild( 0 );\r
53 \r
54                                         // tc\r
55                                         var el = innerDialog.getChild( 2 );\r
56                                         el.setStyle( 'width', ( body.$.offsetWidth ) + 'px' );\r
57 \r
58                                         // bc\r
59                                         el = innerDialog.getChild( 7 );\r
60                                         el.setStyle( 'width', ( body.$.offsetWidth - 28 ) + 'px' );\r
61 \r
62                                         // ml\r
63                                         el = innerDialog.getChild( 4 );\r
64                                         el.setStyle( 'height', ( body.$.offsetHeight - 31 - 14 ) + 'px' );\r
65 \r
66                                         // mr\r
67                                         el = innerDialog.getChild( 5 );\r
68                                         el.setStyle( 'height', ( body.$.offsetHeight - 31 - 14 ) + 'px' );\r
69                                 };\r
70                         setTimeout( fixSize, 100 );\r
71 \r
72                         // Ensure size is correct for RTL mode. (#4003)\r
73                         if ( evt.editor.lang.dir == 'rtl' )\r
74                                 setTimeout( fixSize, 1000 );\r
75                 });\r
76 }\r