Tag: cws_src680_oj14
User: fs      
Date: 2007-06-12 20:54:05+0000
Modified:
   
dba/reportdesign/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java

Log:
 (provided by [EMAIL PROTECTED]) image scaling problems

File Changes:

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

File [changed]: OfficeDocumentReportTarget.java
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/output/OfficeDocumentReportTarget.java?r1=1.1.2.6&r2=1.1.2.7
Delta lines:  +11 -16
---------------------
--- OfficeDocumentReportTarget.java     2007-06-11 19:29:07+0000        1.1.2.6
+++ OfficeDocumentReportTarget.java     2007-06-12 20:54:02+0000        1.1.2.7
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: OfficeDocumentReportTarget.java,v $
  *
- *  $Revision: 1.1.2.6 $
+ *  $Revision: 1.1.2.7 $
  *
- *  last change: $Author: fs $ $Date: 2007/06/11 19:29:07 $
+ *  last change: $Author: fs $ $Date: 2007/06/12 20:54:02 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -246,7 +246,9 @@
   private AttributeNameGenerator imageNames;
   private ImageProducer imageProducer;
   private GroupContext groupContext;
-  private static final boolean DEBUG_ELEMENTS = false;
+  private static final boolean DEBUG_ELEMENTS =
+      JFreeReportBoot.getInstance().getExtendedConfig().getBoolProperty
+      ("com.sun.star.report.pentaho.output.DebugElements");
 
   protected OfficeDocumentReportTarget(final ReportJob reportJob,
                                        final ResourceManager resourceManager,
@@ -1134,7 +1136,6 @@
   {
     final Object imageData = attrs.getAttribute(OfficeNamespaces.INTERNAL_NS, 
"image-data");
     final boolean preserveIRI = 
"true".equals(attrs.getAttribute(OfficeNamespaces.INTERNAL_NS, "preserve-IRI"));
-    String styleName = null;
 
     // for the first shot, do nothing fancy ..
     final ImageProducer.OfficeImage image = 
imageProducer.produceImage(imageData, preserveIRI);
@@ -1151,6 +1152,7 @@
 
       CSSNumericValue imageAreaWidthVal;
       CSSNumericValue imageAreaHeightVal;
+      String styleName = null;
       if (imageContext != null)
       {
         imageAreaWidthVal = computeImageWidth(imageContext);
@@ -1163,7 +1165,7 @@
             CSSValueResolverUtility.convertLength(height, 
imageAreaHeightVal.getType());
 
         final boolean scale = 
"true".equals(attrs.getAttribute(OfficeNamespaces.INTERNAL_NS, "scale"));
-        if (scale == false)
+        if (scale == false && normalizedImageWidth.getValue() > 0 && 
normalizedImageHeight.getValue() > 0)
         {
           final double clipWidth = normalizedImageWidth.getValue() - 
imageAreaWidthVal.getValue();
           final double clipHeight = normalizedImageHeight.getValue() - 
imageAreaHeightVal.getValue();
@@ -1232,20 +1234,13 @@
             imageAreaHeightVal = normalizedImageHeight;
           }
         }
-        else
-        {
-          if (normalizedImageWidth.getValue() < imageAreaWidthVal.getValue())
-          {
-            imageAreaWidthVal = normalizedImageWidth;
-          }
-          if (normalizedImageHeight.getValue() < imageAreaHeightVal.getValue())
-          {
-            imageAreaHeightVal = normalizedImageHeight;
-          }
-        }
+        // If we do scale, then we simply use the given image-area-size as 
valid image size and dont
+        // care about the image itself ..
       }
       else
       {
+        Log.debug ("There is no image-context, so we have to rely on the 
image's natural bounds. " +
+            "This may go awfully wrong.");
         imageAreaWidthVal = image.getWidth();
         imageAreaHeightVal = image.getHeight();
       }




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

Reply via email to