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.cocoon.components.elementprocessor.impl.poi.hssf.elements;
19:
20: import org.apache.cocoon.components.elementprocessor.types.NumericResult;
21:
22: import java.io.IOException;
23:
24: /**
25: * No-op implementation of ElementProcessor to handle the
26: * "orientation" tag
27: *
28: * This element has no attributes and contains a string describing the
29: * print orientation (landscape or portrait)
30: *
31: *
32: * @author Marc Johnson (marc_johnson27591@hotmail.com)
33: * @author Victor Skladovs (skladov@his.de)
34: * @version CVS $Id: EP_Orientation.java 433543 2006-08-22 06:22:54Z crossley $
35: */
36: public class EP_Orientation extends BaseElementProcessor {
37: private NumericResult _print_orientation;
38:
39: /**
40: * constructor
41: */
42: public EP_Orientation() {
43: super (null);
44: _print_orientation = null;
45: }
46:
47: /**
48: * @return print orientation (always one of the values in
49: * PrintOrientation)
50: *
51: * @exception IOException
52: */
53: int getPrintOrientation() throws IOException {
54: if (_print_orientation == null) {
55: _print_orientation = PrintOrientation
56: .extractPrintOrientation(this .getData());
57: }
58: return _print_orientation.intValue();
59: }
60:
61: /**
62: * Setup the orientation:
63: * @exception IOException
64: */
65: public void endProcessing() throws IOException {
66: this .getSheet().setOrientation(
67: getPrintOrientation() == 1 ? false : true);
68: }
69:
70: } // end public class EP_Orientation
|