01: /* ====================================================================
02: Licensed to the Apache Software Foundation (ASF) under one or more
03: contributor license agreements. See the NOTICE file distributed with
04: this work for additional information regarding copyright ownership.
05: The ASF licenses this file to You under the Apache License, Version 2.0
06: (the "License"); you may not use this file except in compliance with
07: the License. You may obtain a copy of the License at
08:
09: http://www.apache.org/licenses/LICENSE-2.0
10:
11: Unless required by applicable law or agreed to in writing, software
12: distributed under the License is distributed on an "AS IS" BASIS,
13: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: See the License for the specific language governing permissions and
15: limitations under the License.
16: ==================================================================== */
17:
18: package org.apache.poi.hslf.model;
19:
20: import org.apache.poi.hslf.model.textproperties.TextProp;
21: import org.apache.poi.hslf.record.*;
22:
23: /**
24: * Title masters define the design template for slides with a Title Slide layout.
25: *
26: * @author Yegor Kozlov
27: */
28: public class TitleMaster extends MasterSheet {
29: private TextRun[] _runs;
30:
31: /**
32: * Constructs a TitleMaster
33: *
34: */
35: public TitleMaster(org.apache.poi.hslf.record.Slide record,
36: int sheetNo) {
37: super (record, sheetNo);
38:
39: _runs = findTextRuns(getPPDrawing());
40: for (int i = 0; i < _runs.length; i++)
41: _runs[i].setSheet(this );
42: }
43:
44: /**
45: * Returns an array of all the TextRuns found
46: */
47: public TextRun[] getTextRuns() {
48: return _runs;
49: }
50:
51: /**
52: * Delegate the call to the underlying slide master.
53: */
54: public TextProp getStyleAttribute(int txtype, int level,
55: String name, boolean isCharacter) {
56: MasterSheet master = getMasterSheet();
57: return master == null ? null : master.getStyleAttribute(txtype,
58: level, name, isCharacter);
59: }
60:
61: /**
62: * Returns the slide master for this title master.
63: */
64: public MasterSheet getMasterSheet() {
65: SlideMaster[] master = getSlideShow().getSlidesMasters();
66: SlideAtom sa = ((org.apache.poi.hslf.record.Slide) getSheetContainer())
67: .getSlideAtom();
68: int masterId = sa.getMasterID();
69: for (int i = 0; i < master.length; i++) {
70: if (masterId == master[i]._getSheetNumber())
71: return master[i];
72: }
73: return null;
74: }
75: }
|