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 java.util.HashMap;
26 import java.util.Map;
27 
28 import org.jfree.report.structure.Element;
29 import org.jfree.report.structure.Section;
30 
31 
32 /**
33  * The master-styles section can have either a master-page, handout-master
34  * or draw-layer-set. (The latter ones are ignored for the reporting purposes,
35  * they are PowerPoint related.)
36  *
37  * There is no documentation how the system selects a master-page if there is
38  * no master-page assigned to the paragraph. However, it seems as if the
39  * master-page called 'Standard' is used as initial default.
40  *
41  * @author Thomas Morgner
42  * @since 13.03.2007
43  */
44 public class OfficeMasterStyles extends Element
45 {
46 
47     private final Map masterPages;
48     private final Section otherNodes;
49 
OfficeMasterStyles()50     public OfficeMasterStyles()
51     {
52         masterPages = new HashMap();
53         otherNodes = new Section();
54     }
55 
addMasterPage(final OfficeMasterPage masterPage)56     public void addMasterPage(final OfficeMasterPage masterPage)
57     {
58         if (masterPage == null)
59         {
60             throw new NullPointerException();
61         }
62         this.masterPages.put(masterPage.getStyleName(), masterPage);
63     }
64 
getMasterPage(final String name)65     public OfficeMasterPage getMasterPage(final String name)
66     {
67         return (OfficeMasterPage) masterPages.get(name);
68     }
69 
getAllMasterPages()70     public OfficeMasterPage[] getAllMasterPages()
71     {
72         return (OfficeMasterPage[]) masterPages.values().toArray(new OfficeMasterPage[masterPages.size()]);
73     }
74 
getOtherNodes()75     public Section getOtherNodes()
76     {
77         return otherNodes;
78     }
79 }
80