Tag: cws_src680_rpt23fix02
User: tmorgner
Date: 2007-07-26 12:27:38+0000
Modified:
   
dba/reportdesign/java/com/sun/star/report/pentaho/output/text/TextRawReportTarget.java

Log:
 Issue number:  77610
 
 Now the keep-together is working. We apply the keep-together to the first
 paragraph in every table-row (most of the time in the first-cell, but if
 the first cell is a covered cell, we choose the next cell until we find
 a paragraph in that row). Along with the "TableRowKeep" compatiblity mode,
 this makes the keep-together setting work.
 
 Keep-together will be silently ignored on older versions of 
OpenOffice/StarOffice,
 as they did not implement the 'TableRowKeep' compatibility mode.
 
 

File Changes:

Directory: /dba/reportdesign/java/com/sun/star/report/pentaho/output/text/
==========================================================================

File [changed]: TextRawReportTarget.java
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/output/text/TextRawReportTarget.java?r1=1.2.4.3&r2=1.2.4.4
Delta lines:  +40 -15
---------------------
--- TextRawReportTarget.java    2007-07-26 11:10:37+0000        1.2.4.3
+++ TextRawReportTarget.java    2007-07-26 12:27:36+0000        1.2.4.4
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: TextRawReportTarget.java,v $
  *
- *  $Revision: 1.2.4.3 $
+ *  $Revision: 1.2.4.4 $
  *
- *  last change: $Author: tmorgner $ $Date: 2007/07/26 11:10:37 $
+ *  last change: $Author: tmorgner $ $Date: 2007/07/26 12:27:36 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -632,7 +632,33 @@
       variables = null;
     }
 
-    // todo: If keep-together is active and the modify the paragraph's style ..
+    if (firstCellSeen == false && sectionKeepTogether &&
+        ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, 
"table-cell", attrs))
+    {
+      final String styleName = (String) 
attrs.getAttribute(OfficeNamespaces.TEXT_NS, "style-name");
+      final OfficeStyle style = deriveStyle("paragraph", styleName);
+      // Lets set the 'keep-together' flag..
+
+      Element paragraphProps = style.getParagraphProperties();
+      if (paragraphProps == null)
+      {
+        paragraphProps = new Section();
+        paragraphProps.setNamespace(OfficeNamespaces.STYLE_NS);
+        paragraphProps.setType("paragraph-properties");
+        style.addNode(paragraphProps);
+      }
+      paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "keep-together", 
"always");
+      final int keepTogetherState = getCurrentContext().getKeepTogether();
+      // We prevent pagebreaks within the two adjacent rows (this one and the 
next one) if
+      // either a group-wide keep-together is defined or if we haven't reached 
the end of the
+      // current section yet.
+      if (keepTogetherState == PageContext.KEEP_TOGETHER_GROUP || 
expectedTableRowCount > 0)
+      {
+        paragraphProps.setAttribute(OfficeNamespaces.FO_NS, "keep-with-next", 
"always");
+      }
+
+      attrs.setAttribute(OfficeNamespaces.TABLE_NS, "style-name", 
style.getStyleName());
+    }
 
     // process the styles as usual
     performStyleProcessing(attrs);
@@ -664,17 +690,17 @@
     // Log.debug("Adding row-Style: " + rowStyle + " " + rowHeight);
     sectionHeight.add(rowHeight);
 
-    if (expectedTableRowCount > 0)
-    {
-      // Some other row. Create a keep-together
-
-    }
-    else
-    {
-      // This is the last row before the section will end.
-      // or (in some weird cases) There is no information when the row will 
end.
-      // Anyway, if we are here, we do not create a keep-together style on the 
table-row ..
-    }
+//    if (expectedTableRowCount > 0)
+//    {
+//      // Some other row. Create a keep-together
+//
+//    }
+//    else
+//    {
+//      // This is the last row before the section will end.
+//      // or (in some weird cases) There is no information when the row will 
end.
+//      // Anyway, if we are here, we do not create a keep-together style on 
the table-row ..
+//    }
     // process the styles as usual
     performStyleProcessing(attrs);
 
@@ -682,7 +708,6 @@
     getXmlWriter().writeTag(OfficeNamespaces.TABLE_NS, "table-row", attrList, 
XmlWriterSupport.OPEN);
   }
 
-  // todo
   private void startTable(final AttributeMap attrs)
       throws ReportProcessingException, IOException
   {




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to