001 /*
002 * Copyright (c) 2005 Einar Pehrson
003 *
004 * This file is part of
005 * CleanSheets Extension for Style
006 *
007 * CleanSheets Extension for Style is free software; you can
008 * redistribute it and/or modify it under the terms of the GNU General Public
009 * License as published by the Free Software Foundation; either version 2 of
010 * the License, or (at your option) any later version.
011 *
012 * CleanSheets Extension for Style is distributed in the hope that
013 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
014 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
015 * See the GNU General Public License for more details.
016 *
017 * You should have received a copy of the GNU General Public License
018 * along with CleanSheets Extension for Style; if not, write to the
019 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
020 * Boston, MA 02111-1307 USA
021 */
022 package csheets.ext.style;
023
024 import csheets.core.Cell;
025 import csheets.core.Spreadsheet;
026 import csheets.ext.Extension;
027 import csheets.ext.style.ui.StyleUIExtension;
028 import csheets.ui.ctrl.UIController;
029 import csheets.ui.ext.UIExtension;
030
031 /**
032 * The extension for style.
033 * @author Einar Pehrson
034 */
035 public class StyleExtension extends Extension {
036
037 /** The name of the extension */
038 public static final String NAME = "Style";
039
040 /**
041 * Creates a new style extension.
042 */
043 public StyleExtension() {
044 super(NAME);
045 }
046
047 /**
048 * Makes the given spreadsheet stylable.
049 * @param spreadsheet the spreadsheet to extend
050 * @return a stylable spreadsheet
051 */
052 public StylableSpreadsheet extend(Spreadsheet spreadsheet) {
053 return new StylableSpreadsheet(spreadsheet);
054 }
055
056 /**
057 * Makes the given cell stylable.
058 * @param cell the cell to extend
059 * @return a stylable cell
060 */
061 public StylableCell extend(Cell cell) {
062 return new StylableCell(cell);
063 }
064
065 /**
066 * Returns a user interface extension for style.
067 * @param uiController the user interface controller
068 * @return a user interface extension for style
069 */
070 public UIExtension getUIExtension(UIController uiController) {
071 return new StyleUIExtension(this, uiController);
072 }
073 }