001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: /* $Id: RtfBookmarkContainerImpl.java 426576 2006-07-28 15:44:37Z jeremias $ */
019:
020: package org.apache.fop.render.rtf.rtflib.rtfdoc;
021:
022: /*
023: * This file is part of the RTF library of the FOP project, which was originally
024: * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other
025: * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to
026: * the FOP project.
027: */
028:
029: import java.io.Writer;
030: import java.io.IOException;
031:
032: /**
033: * RTF Bookmark container implementation.
034: * Nearly all containers or elements can have a bookmark, that is why the bookmark container is
035: * implemented as stand alone.
036: * @author <a href="mailto:a.putz@skynamics.com">Andreas Putz</a>
037: */
038: public class RtfBookmarkContainerImpl extends RtfContainer implements
039: IRtfBookmarkContainer {
040: //////////////////////////////////////////////////
041: // @@ Members
042: //////////////////////////////////////////////////
043:
044: /** Rtf bookmark */
045: private RtfBookmark mBookmark = null;
046:
047: //////////////////////////////////////////////////
048: // @@ Construction
049: //////////////////////////////////////////////////
050:
051: /**
052: * Constructor.
053: * Create an RTF container as a child of given container.
054: *
055: * @param parent The parent container
056: * @param w Writer
057: *
058: * @exception IOException On error
059: */
060: RtfBookmarkContainerImpl(RtfContainer parent, Writer w)
061: throws IOException {
062: super (parent, w, null);
063: }
064:
065: /**
066: * Constructor.
067: * Create an RTF container as a child of given container.
068: *
069: * @param parent The parent container
070: * @param w Writer
071: * @param attr Rtf attributes
072: *
073: * @exception IOException On error
074: */
075: RtfBookmarkContainerImpl(RtfContainer parent, Writer w,
076: RtfAttributes attr) throws IOException {
077: super (parent, w, attr);
078: }
079:
080: //////////////////////////////////////////////////
081: // @@ Public methods
082: //////////////////////////////////////////////////
083:
084: /**
085: * Create a new RTF bookmark.
086: *
087: * @param bookmark Name of the bookmark
088: *
089: * @return RTF bookmark
090: *
091: * @throws IOException On eror
092: */
093: public RtfBookmark newBookmark(String bookmark) throws IOException {
094: if (mBookmark != null) {
095: mBookmark.close();
096: }
097:
098: mBookmark = new RtfBookmark(this, writer, bookmark);
099:
100: return mBookmark;
101: }
102: }
|