Source Code Cross Referenced for RtfSection.java in  » Graphic-Library » fop » org » apache » fop » render » rtf » rtflib » rtfdoc » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Graphic Library » fop » org.apache.fop.render.rtf.rtflib.rtfdoc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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: RtfSection.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:        /**  Models a section in an RTF document
033:         *  @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
034:         */
035:
036:        public class RtfSection extends RtfContainer implements 
037:                IRtfParagraphContainer, IRtfTableContainer, IRtfListContainer,
038:                IRtfExternalGraphicContainer, IRtfBeforeContainer,
039:                IRtfParagraphKeepTogetherContainer, IRtfAfterContainer,
040:                IRtfJforCmdContainer, IRtfTextrunContainer {
041:            private RtfParagraph paragraph;
042:            private RtfTable table;
043:            private RtfList list;
044:            private RtfExternalGraphic externalGraphic;
045:            private RtfBefore before;
046:            private RtfAfter after;
047:            private RtfJforCmd jforCmd;
048:
049:            /** Create an RTF container as a child of given container */
050:            RtfSection(RtfDocumentArea parent, Writer w) throws IOException {
051:                super (parent, w);
052:            }
053:
054:            /**
055:             * Start a new external graphic after closing current paragraph, list and table
056:             * @return new RtfExternalGraphic object
057:             * @throws IOException for I/O problems
058:             */
059:            public RtfExternalGraphic newImage() throws IOException {
060:                closeAll();
061:                externalGraphic = new RtfExternalGraphic(this , writer);
062:                return externalGraphic;
063:            }
064:
065:            /**
066:             * Start a new paragraph after closing current paragraph, list and table
067:             * @param attrs attributes for new RtfParagraph
068:             * @return new RtfParagraph object
069:             * @throws IOException for I/O problems
070:             */
071:            public RtfParagraph newParagraph(RtfAttributes attrs)
072:                    throws IOException {
073:                closeAll();
074:                paragraph = new RtfParagraph(this , writer, attrs);
075:                return paragraph;
076:            }
077:
078:            /**
079:             * Close current paragraph if any and start a new one with default attributes
080:             * @return new RtfParagraph
081:             * @throws IOException for I/O problems
082:             */
083:            public RtfParagraph newParagraph() throws IOException {
084:                return newParagraph(null);
085:            }
086:
087:            /**
088:             * Close current paragraph if any and start a new one
089:             * @return new RtfParagraphKeepTogether
090:             * @throws IOException for I/O problems
091:             */
092:            public RtfParagraphKeepTogether newParagraphKeepTogether()
093:                    throws IOException {
094:                return new RtfParagraphKeepTogether(this , writer);
095:            }
096:
097:            /**
098:             * Start a new table after closing current paragraph, list and table
099:             * @param tc Table context used for number-columns-spanned attribute (added by
100:             * Boris Poudérous on july 2002)
101:             * @return new RtfTable object
102:             * @throws IOException for I/O problems
103:             */
104:            public RtfTable newTable(ITableColumnsInfo tc) throws IOException {
105:                closeAll();
106:                table = new RtfTable(this , writer, tc);
107:                return table;
108:            }
109:
110:            /**
111:             * Start a new table after closing current paragraph, list and table
112:             * @param attrs attributes of new RtfTable
113:             * @param tc Table context used for number-columns-spanned attribute (added by
114:             * Boris Poudérous on july 2002)
115:             * @return new RtfTable object
116:             * @throws IOException for I/O problems
117:             */
118:            public RtfTable newTable(RtfAttributes attrs, ITableColumnsInfo tc)
119:                    throws IOException {
120:                closeAll();
121:                table = new RtfTable(this , writer, attrs, tc);
122:                return table;
123:            }
124:
125:            /**
126:             * Start a new list after closing current paragraph, list and table
127:             * @param attrs attributes of new RftList object
128:             * @return new RtfList
129:             * @throws IOException for I/O problems
130:             */
131:            public RtfList newList(RtfAttributes attrs) throws IOException {
132:                closeAll();
133:                list = new RtfList(this , writer, attrs);
134:                return list;
135:            }
136:
137:            /**
138:             * IRtfBeforeContainer
139:             * @param attrs attributes of new RtfBefore object
140:             * @return new RtfBefore object
141:             * @throws IOException for I/O problems
142:             */
143:            public RtfBefore newBefore(RtfAttributes attrs) throws IOException {
144:                closeAll();
145:                before = new RtfBefore(this , writer, attrs);
146:                return before;
147:            }
148:
149:            /**
150:             * IRtfAfterContainer
151:             * @param attrs attributes of new RtfAfter object
152:             * @return new RtfAfter object
153:             * @throws IOException for I/O problems
154:             */
155:            public RtfAfter newAfter(RtfAttributes attrs) throws IOException {
156:                closeAll();
157:                after = new RtfAfter(this , writer, attrs);
158:                return after;
159:            }
160:
161:            /**
162:             *
163:             * @param attrs attributes of new RtfJforCmd
164:             * @return the new RtfJforCmd
165:             * @throws IOException for I/O problems
166:             */
167:            public RtfJforCmd newJforCmd(RtfAttributes attrs)
168:                    throws IOException {
169:                jforCmd = new RtfJforCmd(this , writer, attrs);
170:                return jforCmd;
171:            }
172:
173:            /**
174:             * Can be overridden to write RTF prefix code, what comes before our children
175:             * @throws IOException for I/O problems
176:             */
177:            protected void writeRtfPrefix() throws IOException {
178:                writeAttributes(attrib, RtfPage.PAGE_ATTR);
179:                newLine();
180:                writeControlWord("sectd");
181:            }
182:
183:            /**
184:             * Can be overridden to write RTF suffix code, what comes after our children
185:             * @throws IOException for I/O problems
186:             */
187:            protected void writeRtfSuffix() throws IOException {
188:                writeControlWord("sect");
189:            }
190:
191:            private void closeCurrentTable() throws IOException {
192:                if (table != null) {
193:                    table.close();
194:                }
195:            }
196:
197:            private void closeCurrentParagraph() throws IOException {
198:                if (paragraph != null) {
199:                    paragraph.close();
200:                }
201:            }
202:
203:            private void closeCurrentList() throws IOException {
204:                if (list != null) {
205:                    list.close();
206:                }
207:            }
208:
209:            private void closeCurrentExternalGraphic() throws IOException {
210:                if (externalGraphic != null) {
211:                    externalGraphic.close();
212:                }
213:            }
214:
215:            private void closeCurrentBefore() throws IOException {
216:                if (before != null) {
217:                    before.close();
218:                }
219:            }
220:
221:            private void closeAll() throws IOException {
222:                closeCurrentTable();
223:                closeCurrentParagraph();
224:                closeCurrentList();
225:                closeCurrentExternalGraphic();
226:                closeCurrentBefore();
227:            }
228:
229:            /**
230:             * Returns the current RtfTextrun.
231:             * @return Current RtfTextrun
232:             * @throws IOException Thrown when an IO-problem occurs.
233:             */
234:            public RtfTextrun getTextrun() throws IOException {
235:                return RtfTextrun.getTextrun(this, writer, null);
236:            }
237:        }
w___ww.___ja__v___a___2___s.c_o_m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.