1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 package com.sun.star.report.pentaho.model;
24 
25 import com.sun.star.report.OfficeToken;
26 import com.sun.star.report.pentaho.OfficeNamespaces;
27 
28 import org.jfree.report.structure.Element;
29 import org.jfree.report.structure.Section;
30 
31 /**
32  * Represents an automatic or manual style definition.
33  *
34  * @author Thomas Morgner
35  * @since 02.03.2007
36  */
37 public class OfficeStyle extends Section
38 {
39 
OfficeStyle()40     public OfficeStyle()
41     {
42         setNamespace(OfficeNamespaces.STYLE_NS);
43         setType("style");
44     }
45 
getStyleName()46     public String getStyleName()
47     {
48         return (String) getAttribute(OfficeNamespaces.STYLE_NS, "name");
49     }
50 
setStyleName(final String name)51     public void setStyleName(final String name)
52     {
53         setAttribute(OfficeNamespaces.STYLE_NS, "name", name);
54     }
55 
56     /**
57      * A parent style name must be a common style (it cannot be an automatic
58      * style) and has to exist. If no parent style is given, an implementation
59      * specific default style is used.
60      *
61      * @return
62      */
getStyleParent()63     public String getStyleParent()
64     {
65         return (String) getAttribute(OfficeNamespaces.STYLE_NS, "parent-style-name");
66     }
67 
setStyleParent(final String parentName)68     public void setStyleParent(final String parentName)
69     {
70         setAttribute(OfficeNamespaces.STYLE_NS, "parent-style-name", parentName);
71     }
72 
getStyleFamily()73     public String getStyleFamily()
74     {
75         return (String) getAttribute(OfficeNamespaces.STYLE_NS, "family");
76     }
77 
setStyleFamily(final String family)78     public void setStyleFamily(final String family)
79     {
80         setAttribute(OfficeNamespaces.STYLE_NS, "family", family);
81     }
82 
83 //  public String getMasterPageName()
84 //  {
85 //    return (String) getAttribute(OfficeNamespaces.STYLE_NS, "master-page-name");
86 //  }
getParagraphProperties()87     public Element getParagraphProperties()
88     {
89         return findFirstChild(OfficeNamespaces.STYLE_NS, "paragraph-properties");
90     }
91 
getTextProperties()92     public Element getTextProperties()
93     {
94         return findFirstChild(OfficeNamespaces.STYLE_NS, "text-properties");
95     }
96 
getTableRowProperties()97     public Element getTableRowProperties()
98     {
99         return findFirstChild(OfficeNamespaces.STYLE_NS, "table-row-properties");
100     }
101 
getTableProperties()102     public Element getTableProperties()
103     {
104         return findFirstChild(OfficeNamespaces.STYLE_NS, "table-properties");
105     }
106 
getTableColumnProperties()107     public Element getTableColumnProperties()
108     {
109         return findFirstChild(OfficeNamespaces.STYLE_NS, "table-column-properties");
110     }
111 
getSectionProperties()112     public Element getSectionProperties()
113     {
114         return findFirstChild(OfficeNamespaces.STYLE_NS, "section-properties");
115     }
116 
getTableCellProperties()117     public Element getTableCellProperties()
118     {
119         return findFirstChild(OfficeNamespaces.STYLE_NS, "table-cell-properties");
120     }
121 
getGraphicProperties()122     public Element getGraphicProperties()
123     {
124         return findFirstChild(OfficeNamespaces.STYLE_NS, OfficeToken.GRAPHIC_PROPERTIES);
125     }
126 }
127