User: rt      
Date: 2008-01-29 14:33:53+0000
Modified:
   
dba/reportdesign/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java

Log:
 INTEGRATION: CWS pentaho2_SRC680 (1.3.74); FILE MERGED
 2008/01/21 09:00:24 oj 1.3.74.1: #i79173# #i78502# import changes from pentaho1

File Changes:

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

File [changed]: FormattedTextLayoutController.java
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/layoutprocessor/FormattedTextLayoutController.java?r1=1.3&r2=1.4
Delta lines:  +51 -3
--------------------
--- FormattedTextLayoutController.java  2007-08-03 09:49:15+0000        1.3
+++ FormattedTextLayoutController.java  2008-01-29 14:33:50+0000        1.4
@@ -39,6 +39,8 @@
 
 import com.sun.star.report.pentaho.OfficeNamespaces;
 import com.sun.star.report.pentaho.model.FormattedTextElement;
+import com.sun.star.report.pentaho.model.OfficeDocument;
+import com.sun.star.report.pentaho.model.OfficeStyle;
 import org.jfree.formula.Formula;
 import org.jfree.formula.lvalues.LValue;
 import org.jfree.formula.parser.ParseException;
@@ -101,7 +103,7 @@
     }
     catch (final ParseException e)
     {
-      Log.debug ("Parse Exception" , e);
+      Log.debug("Parse Exception", e);
       return false;
     }
   }
@@ -122,6 +124,13 @@
           Element.NAMESPACE_ATTRIBUTE, OfficeNamespaces.TEXT_NS);
       variablesGet.setAttribute(OfficeNamespaces.TEXT_NS, "name", name);
       //variablesGet.setAttribute(OfficeNamespaces.TEXT_NS, "display", 
"value");
+      
+      final String dataStyleName = computeValueStyle();
+      if (dataStyleName != null)
+      {
+        variablesGet.setAttribute(OfficeNamespaces.STYLE_NS, 
"data-style-name", dataStyleName);
+      }
+
       final String valueType = computeValueType();
       variablesGet.setAttribute(OfficeNamespaces.OFFICE_NS, "value-type", 
valueType);
       target.startElement(variablesGet);
@@ -141,6 +150,22 @@
     return join(getFlowController());
   }
 
+
+  private OfficeDocument getDocument()
+  {
+    LayoutController parent = getParent();
+    while (parent != null)
+    {
+      final Object node = parent.getNode();
+      if (node instanceof OfficeDocument)
+      {
+        return (OfficeDocument) node;
+      }
+      parent = parent.getParent();
+    }
+    return null;
+  }
+
   private Element getParentTableCell()
   {
     LayoutController parent = getParent();
@@ -156,7 +181,30 @@
     return null;
   }
 
-  private String computeValueType ()
+  private String computeValueStyle()
+  {
+    final Element tce = getParentTableCell();
+    if (tce == null)
+    {
+      return null;
+    }
+
+    final String cellStyleName = (String) 
tce.getAttribute(OfficeNamespaces.TABLE_NS, "style-name");
+    if (cellStyleName == null)
+    {
+      return null;
+    }
+    final OfficeDocument document = getDocument();
+    if (document == null)
+    {
+      return null;
+    }
+
+    final OfficeStyle style = 
document.getStylesCollection().getStyle("table-cell", cellStyleName);
+    return (String) style.getAttribute(OfficeNamespaces.STYLE_NS, 
"data-style-name");
+  }
+
+  private String computeValueType()
   {
     final Element tce = getParentTableCell();
     if (tce == null)
@@ -168,7 +216,7 @@
     final String type = (String) tce.getAttribute(OfficeNamespaces.OFFICE_NS, 
"value-type");
     if (type == null)
     {
-      Log.error ("The Table-Cell does not have a office:value attribute 
defined. Your content will be messed up.");
+      Log.error("The Table-Cell does not have a office:value attribute 
defined. Your content will be messed up.");
       return "string";
     }
     return type;




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

Reply via email to