CVS: jfor/src/org/jfor/jfor/converter ParagraphBuilder.java,1.7,1.8
Marra Roberto <[email protected]> Thu, 22 Aug 2002 12:23:53 -0700
| Newsgroups | gmane.text.xml.jfor.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/jfor/jfor/src/org/jfor/jfor/converter
In directory usw-pr-cvs1:/tmp/cvs-serv30158
Modified Files:
ParagraphBuilder.java
Log Message:
keep-together nested blocks added
Index: ParagraphBuilder.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/converter/ParagraphBuilder.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ParagraphBuilder.java 12 Jul 2002 08:08:31 -0000 1.7
--- ParagraphBuilder.java 22 Aug 2002 19:23:51 -0000 1.8
***************
*** 63,66 ****
--- 63,69 ----
// $Id$
// $Log$
+ // Revision 1.8 2002/08/22 19:23:51 rmarra
+ // keep-together nested blocks added
+ //
// Revision 1.7 2002/07/12 08:08:31 bdelacretaz
// License changed to jfor Apache-style license
***************
*** 120,126 ****
private Attributes m_attrib;
private RtfParagraph m_para;
! private static boolean m_paraKeepOpen=false;
!
/** if this fo:block is nested into another one, this is the builder that
--- 123,140 ----
private Attributes m_attrib;
private RtfParagraph m_para;
!
+ /**
+ * Determine if this block contains the attribute keep-together
+ * If this flag is set all nesteds blocks will be created whith RTF "keepn" attribute
+ *
+ */
+ private static int m_paraKeepTogetherOpen=0;
+
+ /**
+ * Determine if this block is the owner of the keep-together attribute
+ */
+ private boolean m_paraKeepOpenOwner=false;
+
/** if this fo:block is nested into another one, this is the builder that
***************
*** 142,157 ****
}
!
/** called by Converter at the start of an element */
public void start(String rawName, Attributes attrs) throws IOException {
! m_attrib = attrs;
!
if (attrs.getValue(ATTRIBUTE_FO_KEEP_TOGETHER)!=null) {
RtfParagraphKeepTogether paraKeep = startParagraphKeepTogether();
paraKeep.setStatus(RtfParagraphKeepTogether.STATUS_OPEN_PARAGRAPH);
m_context.pushContainer(paraKeep);
! m_paraKeepOpen=true;
! }
m_para = startParagraph(false);
--- 156,175 ----
}
!
/** called by Converter at the start of an element */
public void start(String rawName, Attributes attrs) throws IOException {
!
! m_attrib = attrs;
!
! //The owner open a groupMark
if (attrs.getValue(ATTRIBUTE_FO_KEEP_TOGETHER)!=null) {
+ m_paraKeepOpenOwner=true;
+ m_paraKeepTogetherOpen++;
+
RtfParagraphKeepTogether paraKeep = startParagraphKeepTogether();
paraKeep.setStatus(RtfParagraphKeepTogether.STATUS_OPEN_PARAGRAPH);
m_context.pushContainer(paraKeep);
! }
m_para = startParagraph(false);
***************
*** 164,174 ****
m_context.popContainer();
//close the keep-together paragraph if needed
! if (m_paraKeepOpen) {
! RtfParagraphKeepTogether paraKeep = startParagraphKeepTogether();
paraKeep.setStatus(RtfParagraphKeepTogether.STATUS_CLOSE_PARAGRAPH);
m_context.pushContainer(paraKeep);
! m_paraKeepOpen=false;
! }
if(m_nestedInto!=null) {
--- 182,195 ----
m_context.popContainer();
+
//close the keep-together paragraph if needed
! if (m_paraKeepOpenOwner) {
! RtfParagraphKeepTogether paraKeep = startParagraphKeepTogether();
paraKeep.setStatus(RtfParagraphKeepTogether.STATUS_CLOSE_PARAGRAPH);
m_context.pushContainer(paraKeep);
!
! m_paraKeepOpenOwner=false;
! m_paraKeepTogetherOpen--;
! }
if(m_nestedInto!=null) {
***************
*** 255,261 ****
}
!
final RtfParagraph para = c.newParagraph(TextAttributesConverter.convertAttributes (m_attrib, rtfAttrs, m_context.log));
!
// break page if required
--- 276,285 ----
}
!
final RtfParagraph para = c.newParagraph(TextAttributesConverter.convertAttributes (m_attrib, rtfAttrs, m_context.log));
!
!
! //Test if we are inside a keep-together block
! if (!m_paraKeepOpenOwner && m_paraKeepTogetherOpen>0) para.setKeepn();
// break page if required
***************
*** 278,280 ****
--- 302,310 ----
return para;
}
+
+
+
+
+
+
}
-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone? Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390