Style.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769
  1. // Permission is hereby granted, free of charge, to any person obtaining
  2. // a copy of this software and associated documentation files (the
  3. // "Software"), to deal in the Software without restriction, including
  4. // without limitation the rights to use, copy, modify, merge, publish,
  5. // distribute, sublicense, and/or sell copies of the Software, and to
  6. // permit persons to whom the Software is furnished to do so, subject to
  7. // the following conditions:
  8. //
  9. // The above copyright notice and this permission notice shall be
  10. // included in all copies or substantial portions of the Software.
  11. //
  12. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  15. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  16. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  17. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  18. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  19. //
  20. // Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
  21. //
  22. // Authors:
  23. // Peter Dennis Bartok ([email protected])
  24. //
  25. //
  26. using System;
  27. using System.ComponentModel;
  28. using System.Drawing;
  29. namespace System.Web.UI.WebControls
  30. {
  31. [TypeConverter(typeof(System.ComponentModel.ExpandableObjectConverter))]
  32. [ToolboxItem("")]
  33. public class Style : System.ComponentModel.Component, System.Web.UI.IStateManager
  34. {
  35. [Flags]
  36. internal enum Styles
  37. {
  38. None = 0,
  39. BackColor = 0x00000001,
  40. BorderColor = 0x00000002,
  41. BorderStyle = 0x00000004,
  42. BorderWidth = 0x00000008,
  43. CssClass = 0x00000010,
  44. Font = 0x00000020,
  45. ForeColor = 0x00000040,
  46. Height = 0x00000080,
  47. Width = 0x00000100,
  48. // from TableStyle (which doesn't override IsEmpty)
  49. BackImageUrl = 0x00000200,
  50. CellPadding = 0x00000400,
  51. CellSpacing = 0x00000800,
  52. GridLines = 0x00001000,
  53. HorizontalAlign = 0x00002000,
  54. // from TableItemStyle (which doesn't override IsEmpty neither)
  55. VerticalAlign = 0x00004000,
  56. Wrap = 0x00008000,
  57. // from DataGridPagerStyle (and, once again, no IsEmpty override)
  58. Mode = 0x00010000,
  59. NextPageText = 0x00020000,
  60. PageButtonCount = 0x00040000,
  61. Position = 0x00080000,
  62. PrevPageText = 0x00100000,
  63. Visible = 0x00200000
  64. }
  65. #region Fields
  66. internal Styles styles;
  67. internal StateBag viewstate;
  68. private FontInfo fontinfo;
  69. private bool tracking;
  70. #if NET_2_0
  71. private string registered_class;
  72. #endif
  73. #endregion // Fields
  74. #region Public Constructors
  75. public Style() : this(new StateBag())
  76. {
  77. }
  78. public Style(System.Web.UI.StateBag bag)
  79. {
  80. if (bag != null) {
  81. viewstate = bag;
  82. } else {
  83. viewstate = new StateBag();
  84. }
  85. tracking = false;
  86. }
  87. #endregion // Public Constructors
  88. #region Public Instance Properties
  89. [Bindable(true)]
  90. [DefaultValue(typeof (Color), "")]
  91. [NotifyParentProperty(true)]
  92. [TypeConverter(typeof(System.Web.UI.WebControls.WebColorConverter))]
  93. [WebSysDescription ("")]
  94. [WebCategory ("Appearance")]
  95. public Color BackColor
  96. {
  97. get
  98. {
  99. if ((styles & Styles.BackColor) == 0)
  100. {
  101. return Color.Empty;
  102. }
  103. return (Color)viewstate["BackColor"];
  104. }
  105. set
  106. {
  107. viewstate["BackColor"] = value;
  108. styles |= Styles.BackColor;
  109. }
  110. }
  111. [Bindable(true)]
  112. [DefaultValue(typeof (Color), "")]
  113. [NotifyParentProperty(true)]
  114. [TypeConverter(typeof(System.Web.UI.WebControls.WebColorConverter))]
  115. [WebSysDescription ("")]
  116. [WebCategory ("Appearance")]
  117. public Color BorderColor
  118. {
  119. get
  120. {
  121. if ((styles & Styles.BorderColor) == 0)
  122. {
  123. return Color.Empty;
  124. }
  125. return (Color)viewstate["BorderColor"];
  126. }
  127. set
  128. {
  129. viewstate["BorderColor"] = value;
  130. styles |= Styles.BorderColor;
  131. }
  132. }
  133. [Bindable(true)]
  134. [DefaultValue(BorderStyle.NotSet)]
  135. [NotifyParentProperty(true)]
  136. [WebSysDescription ("")]
  137. [WebCategory ("Appearance")]
  138. public BorderStyle BorderStyle
  139. {
  140. get
  141. {
  142. if ((styles & Styles.BorderStyle) == 0)
  143. {
  144. return BorderStyle.NotSet;
  145. }
  146. return (BorderStyle)viewstate["BorderStyle"];
  147. }
  148. set
  149. {
  150. viewstate["BorderStyle"] = value;
  151. styles |= Styles.BorderStyle;
  152. }
  153. }
  154. [Bindable(true)]
  155. [DefaultValue(typeof (Unit), "")]
  156. [NotifyParentProperty(true)]
  157. [WebSysDescription ("")]
  158. [WebCategory ("Appearance")]
  159. public Unit BorderWidth
  160. {
  161. get
  162. {
  163. if ((styles & Styles.BorderWidth) == 0)
  164. {
  165. return Unit.Empty;
  166. }
  167. return (Unit)viewstate["BorderWidth"];
  168. }
  169. set
  170. {
  171. if (value.Value < 0)
  172. {
  173. throw new ArgumentOutOfRangeException("Value", value.Value, "BorderWidth must not be negative");
  174. }
  175. viewstate["BorderWidth"] = value;
  176. styles |= Styles.BorderWidth;
  177. }
  178. }
  179. [DefaultValue("")]
  180. [NotifyParentProperty(true)]
  181. [WebSysDescription ("")]
  182. [WebCategory ("Appearance")]
  183. public string CssClass
  184. {
  185. get
  186. {
  187. if ((styles & Styles.CssClass) == 0)
  188. {
  189. return string.Empty;
  190. }
  191. return (string)viewstate["CssClass"];
  192. }
  193. set
  194. {
  195. viewstate["CssClass"] = value;
  196. styles |= Styles.CssClass;
  197. }
  198. }
  199. [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
  200. [NotifyParentProperty(true)]
  201. [WebSysDescription ("")]
  202. [WebCategory ("Appearance")]
  203. public FontInfo Font
  204. {
  205. get
  206. {
  207. if (fontinfo == null)
  208. {
  209. fontinfo = new FontInfo(this);
  210. }
  211. return fontinfo;
  212. }
  213. }
  214. [Bindable(true)]
  215. [DefaultValue(typeof (Color), "")]
  216. [NotifyParentProperty(true)]
  217. [TypeConverter(typeof(System.Web.UI.WebControls.WebColorConverter))]
  218. [WebSysDescription ("")]
  219. [WebCategory ("Appearance")]
  220. public Color ForeColor
  221. {
  222. get
  223. {
  224. if ((styles & Styles.ForeColor) == 0)
  225. {
  226. return Color.Empty;
  227. }
  228. return (Color)viewstate["ForeColor"];
  229. }
  230. set
  231. {
  232. viewstate["ForeColor"] = value;
  233. styles |= Styles.ForeColor;
  234. }
  235. }
  236. [Bindable(true)]
  237. [DefaultValue(typeof (Unit), "")]
  238. [NotifyParentProperty(true)]
  239. [WebSysDescription ("")]
  240. [WebCategory ("Appearance")]
  241. public Unit Height
  242. {
  243. get
  244. {
  245. if ((styles & Styles.Height) == 0)
  246. {
  247. return Unit.Empty;
  248. }
  249. return (Unit)viewstate["Height"];
  250. }
  251. set
  252. {
  253. if (value.Value < 0)
  254. {
  255. throw new ArgumentOutOfRangeException("Value", value.Value, "Height must not be negative");
  256. }
  257. viewstate["Height"] = value;
  258. styles |= Styles.Height;
  259. }
  260. }
  261. [Bindable(true)]
  262. [DefaultValue(typeof (Unit), "")]
  263. [NotifyParentProperty(true)]
  264. [WebSysDescription ("")]
  265. [WebCategory ("Appearance")]
  266. public Unit Width
  267. {
  268. get
  269. {
  270. if ((styles & Styles.Width) == 0)
  271. {
  272. return Unit.Empty;
  273. }
  274. return (Unit)viewstate["Width"];
  275. }
  276. set
  277. {
  278. if (value.Value < 0)
  279. {
  280. throw new ArgumentOutOfRangeException("Value", value.Value, "Width must not be negative");
  281. }
  282. viewstate["Width"] = value;
  283. styles |= Styles.Width;
  284. }
  285. }
  286. #endregion // Public Instance Properties
  287. #region Protected Instance Properties
  288. protected internal virtual bool IsEmpty
  289. {
  290. get
  291. {
  292. return (styles == 0);
  293. }
  294. }
  295. protected bool IsTrackingViewState
  296. {
  297. get
  298. {
  299. return tracking;
  300. }
  301. }
  302. [Browsable(false)]
  303. [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
  304. protected internal StateBag ViewState
  305. {
  306. get
  307. {
  308. return viewstate;
  309. }
  310. }
  311. #endregion // Protected Instance Properties
  312. #region Public Instance Methods
  313. public void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
  314. {
  315. AddAttributesToRender(writer, null);
  316. }
  317. public virtual void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer, WebControl owner)
  318. {
  319. if ((styles & Styles.CssClass) != 0)
  320. {
  321. string s = (string)viewstate["CssClass"];
  322. if (s != string.Empty)
  323. writer.AddAttribute (HtmlTextWriterAttribute.Class, s);
  324. }
  325. CssStyleCollection attributes = new CssStyleCollection ();
  326. FillStyleAttributes (attributes);
  327. foreach (string attr in attributes.Keys)
  328. writer.AddStyleAttribute (attr, attributes [attr]);
  329. }
  330. void FillStyleAttributes (CssStyleCollection attributes)
  331. {
  332. string s;
  333. Color color;
  334. BorderStyle bs;
  335. Unit u;
  336. if ((styles & Styles.BackColor) != 0)
  337. {
  338. color = (Color)viewstate["BackColor"];
  339. if (!color.IsEmpty)
  340. attributes.Add (HtmlTextWriterStyle.BackgroundColor, ColorTranslator.ToHtml(color));
  341. }
  342. if ((styles & Styles.BorderColor) != 0)
  343. {
  344. color = (Color)viewstate["BorderColor"];
  345. if (!color.IsEmpty)
  346. attributes.Add (HtmlTextWriterStyle.BorderColor, ColorTranslator.ToHtml(color));
  347. }
  348. if ((styles & Styles.BorderStyle) != 0)
  349. {
  350. bs = (BorderStyle)viewstate["BorderStyle"];
  351. if (bs != BorderStyle.NotSet)
  352. attributes.Add (HtmlTextWriterStyle.BorderStyle, bs.ToString());
  353. }
  354. if ((styles & Styles.BorderWidth) != 0)
  355. {
  356. u = (Unit)viewstate["BorderWidth"];
  357. if (!u.IsEmpty)
  358. attributes.Add (HtmlTextWriterStyle.BorderWidth, u.ToString());
  359. }
  360. if ((styles & Styles.ForeColor) != 0)
  361. {
  362. color = (Color)viewstate["ForeColor"];
  363. if (!color.IsEmpty)
  364. attributes.Add (HtmlTextWriterStyle.Color, ColorTranslator.ToHtml(color));
  365. }
  366. if ((styles & Styles.Height) != 0)
  367. {
  368. u = (Unit)viewstate["Height"];
  369. if (!u.IsEmpty)
  370. attributes.Add (HtmlTextWriterStyle.Height, u.ToString());
  371. }
  372. if ((styles & Styles.Width) != 0)
  373. {
  374. u = (Unit)viewstate["Width"];
  375. if (!u.IsEmpty)
  376. attributes.Add (HtmlTextWriterStyle.Width, u.ToString());
  377. }
  378. if (fontinfo != null) {
  379. // Fonts are a bit weird
  380. if (fontinfo.Name != string.Empty)
  381. {
  382. s = fontinfo.Names[0];
  383. for (int i = 1; i < fontinfo.Names.Length; i++)
  384. {
  385. s += "," + fontinfo.Names[i];
  386. }
  387. attributes.Add (HtmlTextWriterStyle.FontFamily, s);
  388. }
  389. if (fontinfo.Bold)
  390. {
  391. attributes.Add (HtmlTextWriterStyle.FontWeight, "bold");
  392. }
  393. if (fontinfo.Italic)
  394. {
  395. attributes.Add (HtmlTextWriterStyle.FontStyle, "italic");
  396. }
  397. if (!fontinfo.Size.IsEmpty)
  398. {
  399. attributes.Add (HtmlTextWriterStyle.FontSize, fontinfo.Size.ToString());
  400. }
  401. // These styles are munged into a attribute decoration
  402. s = string.Empty;
  403. if (fontinfo.Overline)
  404. {
  405. s += "overline ";
  406. }
  407. if (fontinfo.Strikeout)
  408. {
  409. s += "line-through ";
  410. }
  411. if (fontinfo.Underline)
  412. {
  413. s += "underline ";
  414. }
  415. if (s != string.Empty)
  416. {
  417. attributes.Add (HtmlTextWriterStyle.TextDecoration, s);
  418. }
  419. }
  420. }
  421. public virtual void CopyFrom(Style s)
  422. {
  423. if ((s == null) || s.IsEmpty)
  424. {
  425. return;
  426. }
  427. if (s.fontinfo != null)
  428. {
  429. Font.CopyFrom(s.fontinfo);
  430. }
  431. if (((s.styles & Styles.BackColor) != 0) && (s.BackColor != Color.Empty))
  432. {
  433. this.BackColor = s.BackColor;
  434. }
  435. if (((s.styles & Styles.BorderColor) != 0) && (s.BorderColor != Color.Empty))
  436. {
  437. this.BorderColor = s.BorderColor;
  438. }
  439. if (((s.styles & Styles.BorderStyle) != 0) && (s.BorderStyle != BorderStyle.NotSet))
  440. {
  441. this.BorderStyle = s.BorderStyle;
  442. }
  443. if (((s.styles & Styles.BorderWidth) != 0) && (s.BorderWidth != Unit.Empty))
  444. {
  445. this.BorderWidth = s.BorderWidth;
  446. }
  447. if (((s.styles & Styles.CssClass) != 0) && (s.CssClass != string.Empty))
  448. {
  449. this.CssClass = s.CssClass;
  450. }
  451. if (((s.styles & Styles.ForeColor) != 0) && (s.ForeColor != Color.Empty))
  452. {
  453. this.ForeColor = s.ForeColor;
  454. }
  455. if (((s.styles & Styles.Height) != 0) && (s.Height != Unit.Empty))
  456. {
  457. this.Height = s.Height;
  458. }
  459. if (((s.styles & Styles.Width) != 0) && (s.Width != Unit.Empty))
  460. {
  461. this.Width = s.Width;
  462. }
  463. }
  464. public virtual void MergeWith(Style s)
  465. {
  466. if ((s == null) || (s.IsEmpty))
  467. {
  468. return;
  469. }
  470. if (s.fontinfo != null)
  471. {
  472. Font.MergeWith(s.fontinfo);
  473. }
  474. if (((styles & Styles.BackColor) == 0) && ((s.styles & Styles.BackColor) != 0) && (s.BackColor != Color.Empty))
  475. {
  476. this.BackColor = s.BackColor;
  477. }
  478. if (((styles & Styles.BorderColor) == 0) && ((s.styles & Styles.BorderColor) != 0) && (s.BorderColor != Color.Empty))
  479. {
  480. this.BorderColor = s.BorderColor;
  481. }
  482. if (((styles & Styles.BorderStyle) == 0) && ((s.styles & Styles.BorderStyle) != 0) && (s.BorderStyle != BorderStyle.NotSet))
  483. {
  484. this.BorderStyle = s.BorderStyle;
  485. }
  486. if (((styles & Styles.BorderWidth) == 0) && ((s.styles & Styles.BorderWidth) != 0) && (s.BorderWidth != Unit.Empty))
  487. {
  488. this.BorderWidth = s.BorderWidth;
  489. }
  490. if (((styles & Styles.CssClass) == 0) && ((s.styles & Styles.CssClass) != 0) && (s.CssClass != string.Empty))
  491. {
  492. this.CssClass = s.CssClass;
  493. }
  494. if (((styles & Styles.ForeColor) == 0) && ((s.styles & Styles.ForeColor) != 0) && (s.ForeColor != Color.Empty))
  495. {
  496. this.ForeColor = s.ForeColor;
  497. }
  498. if (((styles & Styles.Height) == 0) && ((s.styles & Styles.Height) != 0) && (s.Height != Unit.Empty))
  499. {
  500. this.Height = s.Height;
  501. }
  502. if (((styles & Styles.Width) == 0) && ((s.styles & Styles.Width) != 0) && (s.Width != Unit.Empty))
  503. {
  504. this.Width = s.Width;
  505. }
  506. }
  507. public virtual void Reset()
  508. {
  509. viewstate.Remove("BackColor");
  510. viewstate.Remove("BorderColor");
  511. viewstate.Remove("BorderStyle");
  512. viewstate.Remove("BorderWidth");
  513. viewstate.Remove("CssClass");
  514. viewstate.Remove("ForeColor");
  515. viewstate.Remove("Height");
  516. viewstate.Remove("Width");
  517. if (fontinfo != null)
  518. {
  519. fontinfo.Reset();
  520. }
  521. styles = Styles.None;
  522. }
  523. public override string ToString()
  524. {
  525. return string.Empty;
  526. }
  527. #endregion // Public Instance Methods
  528. #region Protected Instance Methods
  529. protected internal void LoadViewState(object state)
  530. {
  531. viewstate.LoadViewState(state);
  532. // Update our style
  533. this.styles = Styles.None;
  534. if (viewstate["BackColor"] != null)
  535. {
  536. styles |= Styles.BackColor;
  537. }
  538. if (viewstate["BorderColor"] != null)
  539. {
  540. styles |= Styles.BorderColor;
  541. }
  542. if (viewstate["BorderStyle"] != null)
  543. {
  544. styles |= Styles.BorderStyle;
  545. }
  546. if (viewstate["BorderWidth"] != null)
  547. {
  548. styles |= Styles.BorderWidth;
  549. }
  550. if (viewstate["CssClass"] != null)
  551. {
  552. styles |= Styles.CssClass;
  553. }
  554. if (viewstate["ForeColor"] != null)
  555. {
  556. styles |= Styles.ForeColor;
  557. }
  558. if (viewstate["Height"] != null)
  559. {
  560. styles |= Styles.Height;
  561. }
  562. if (viewstate["Width"] != null)
  563. {
  564. styles |= Styles.Width;
  565. }
  566. if (fontinfo != null) {
  567. fontinfo.LoadViewState();
  568. }
  569. LoadViewStateInternal();
  570. }
  571. internal virtual void LoadViewStateInternal()
  572. {
  573. // Override me
  574. }
  575. protected internal virtual object SaveViewState ()
  576. {
  577. if (styles != Styles.None)
  578. {
  579. return viewstate.SaveViewState();
  580. }
  581. return null;
  582. }
  583. [MonoTODO]
  584. protected internal virtual void SetBit( int bit )
  585. {
  586. throw new NotImplementedException();
  587. }
  588. protected internal virtual void TrackViewState()
  589. {
  590. tracking = true;
  591. viewstate.TrackViewState();
  592. }
  593. #endregion // Protected Instance Methods
  594. #region IStateManager Properties & Methods
  595. void IStateManager.LoadViewState(object state)
  596. {
  597. LoadViewState(state);
  598. }
  599. object IStateManager.SaveViewState()
  600. {
  601. return SaveViewState();
  602. }
  603. void IStateManager.TrackViewState()
  604. {
  605. TrackViewState();
  606. }
  607. bool IStateManager.IsTrackingViewState
  608. {
  609. get
  610. {
  611. return this.IsTrackingViewState;
  612. }
  613. }
  614. #endregion // IStateManager Properties & Methods
  615. #region REMOVE ME
  616. internal static int BORDERWIDTH = 0xeadbeef;
  617. internal static int FORECOLOR = 0xeadbeef;
  618. [Obsolete ("This method will be removed in Fresh")]
  619. internal bool IsSet(int blah)
  620. {
  621. if (blah == BORDERWIDTH)
  622. return ((styles & Styles.BorderWidth) != 0);
  623. if (blah == FORECOLOR)
  624. return ((styles & Styles.ForeColor) != 0);
  625. return false;
  626. }
  627. [Obsolete ("This method will be removed in Fresh")]
  628. internal void Set(int blah)
  629. {
  630. }
  631. #endregion // REMOVE ME
  632. #if NET_2_0
  633. protected virtual void FillStyleAttributes (CssStyleCollection attributes, IUrlResolutionService urlResolver)
  634. {
  635. FillStyleAttributes (attributes);
  636. }
  637. internal void SetRegisteredCssClass (string name)
  638. {
  639. registered_class = name;
  640. }
  641. public CssStyleCollection GetStyleAttributes (IUrlResolutionService resolver)
  642. {
  643. CssStyleCollection col = new CssStyleCollection ();
  644. FillStyleAttributes (col, resolver);
  645. return col;
  646. }
  647. [MonoTODO]
  648. public string RegisteredCssClass {
  649. get {
  650. return registered_class;
  651. }
  652. }
  653. internal virtual void CopyTextStylesFrom (Style source)
  654. {
  655. // Need to ask lluis if we need fonts, too
  656. if ((styles & Styles.ForeColor) != 0) {
  657. ForeColor = source.ForeColor;
  658. }
  659. if ((styles & Styles.BackColor) != 0) {
  660. BackColor = source.BackColor;
  661. }
  662. }
  663. public void SetDirty ()
  664. {
  665. if (viewstate != null)
  666. viewstate.SetDirty ();
  667. }
  668. public static bool IsStyleEmpty (Style s)
  669. {
  670. if (s == null)
  671. return true;
  672. return s.IsEmpty;
  673. }
  674. #endif
  675. }
  676. }