User: hr      
Date: 2007-08-03 09:51:13+0000
Modified:
   
dba/reportdesign/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java

Log:
 INTEGRATION: CWS rpt23fix02 (1.2.4); FILE MERGED
 2007/07/26 14:10:49 tmorgner 1.2.4.1: Issue number:  77494
 
 The engine now creates a derived style if the section-table has a
 defined background that is not transparent. However, if the row
 has an own background that is not transparent, then the row's
 defined background will be preserved.

File Changes:

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

File [changed]: SpreadsheetRawReportTarget.java
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java?r1=1.2&r2=1.3
Delta lines:  +51 -9
--------------------
--- SpreadsheetRawReportTarget.java     2007-07-09 11:56:07+0000        1.2
+++ SpreadsheetRawReportTarget.java     2007-08-03 09:51:10+0000        1.3
@@ -53,6 +53,7 @@
 import com.sun.star.report.pentaho.model.OfficeMasterPage;
 import com.sun.star.report.pentaho.model.OfficeMasterStyles;
 import com.sun.star.report.pentaho.output.OfficeDocumentReportTarget;
+import com.sun.star.report.pentaho.output.StyleUtilities;
 import com.sun.star.report.pentaho.output.text.MasterPageFactory;
 import org.jfree.layouting.util.AttributeMap;
 import org.jfree.layouting.input.style.values.CSSNumericValue;
@@ -81,24 +82,20 @@
  */
 public class SpreadsheetRawReportTarget extends OfficeDocumentReportTarget
 {
+  private String tableBackgroundColor; // null means transparent ...
+
   private static final ColumnBoundary[] EMPTY_COLBOUNDS = new 
ColumnBoundary[0];
 
   private boolean elementBoundaryCollectionPass;
-
   private List columnBoundaryList;
-
   private float currentRowBoundaryMarker;
 
   private ColumnBoundary[] sortedBoundaryArray;
-
   private ColumnBoundary[] boundariesForTableArray;
 
   private int tableCounter;
-
   private int columnCounter;
-
   private int columnSpanCounter;
-
   private String unitsOfMeasure;
 
   public SpreadsheetRawReportTarget(final ReportJob reportJob,
@@ -122,6 +119,7 @@
     {
       return;
     }
+
     final String elementType = 
ReportTargetUtil.getElemenTypeFromAttribute(attrs);
     // if this is the report namespace, write out a table definition ..
     if (OfficeNamespaces.TABLE_NS.equals(namespace) && 
"table".equals(elementType))
@@ -130,6 +128,7 @@
       // this is used to keep tracked of the boundary conditions per table
       tableCounter++;
     }
+
     if (isElementBoundaryCollectionPass())
     {
       collectBoundaryForElement(attrs);
@@ -157,6 +156,25 @@
     {
       // a new table means we must clear our "calculated" table boundary array 
cache
       boundariesForTableArray = null;
+
+      final String tableStyle = (String) 
attrs.getAttribute(OfficeNamespaces.TABLE_NS, "style-name");
+      if (tableStyle == null)
+      {
+        tableBackgroundColor = null;
+      }
+      else
+      {
+        final Object raw = 
StyleUtilities.queryStyle(getPredefinedStylesCollection(), "table", tableStyle,
+            "table-properties", OfficeNamespaces.FO_NS, "background-color");
+        if (raw == null || "transparent".equals(raw))
+        {
+          tableBackgroundColor = null;
+        }
+        else
+        {
+          tableBackgroundColor = String.valueOf(raw);
+        }
+      }
       return;
     }
 
@@ -194,6 +212,30 @@
     {
       // a new row means our column counter gets reset
       columnCounter = 0;
+      // Lets make sure the color of the table is ok ..
+      if (tableBackgroundColor != null)
+      {
+        final String styleName = (String) 
attrs.getAttribute(OfficeNamespaces.TABLE_NS, "style-name");
+        final OfficeStyle style = deriveStyle("table-row", styleName);
+        Element tableRowProperties = style.getTableRowProperties();
+        if (tableRowProperties == null)
+        {
+          tableRowProperties = new Section();
+          tableRowProperties.setNamespace(OfficeNamespaces.STYLE_NS);
+          tableRowProperties.setType("table-row-properties");
+          tableRowProperties.setAttribute(OfficeNamespaces.FO_NS, 
"background-color", tableBackgroundColor);
+          style.addNode(tableRowProperties);
+        }
+        else
+        {
+          final Object oldValue = 
tableRowProperties.getAttribute(OfficeNamespaces.FO_NS, "background-color");
+          if (oldValue == null || "transparent".equals(oldValue))
+          {
+            tableRowProperties.setAttribute(OfficeNamespaces.FO_NS, 
"background-color", tableBackgroundColor);
+          }
+        }
+        attrs.setAttribute(OfficeNamespaces.TABLE_NS, "style-name", 
style.getStyleName());
+      }
     }
     else if (ReportTargetUtil.isElementOfType(OfficeNamespaces.TABLE_NS, 
"table-cell", attrs))
     {




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

Reply via email to