[jira] Commented: (COCOON-1703) A patch for caching fonts (fixes GDI issues), vertical text orientation, color code fix, prefered unit for margins and measure unit converter

2008-06-05 Thread Krystian Nowak (JIRA)

[ 
https://issues.apache.org/jira/browse/COCOON-1703?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12602934#action_12602934
 ] 

Krystian Nowak commented on COCOON-1703:


Sorry, this was copied from my other project I was working on by mistake.
You can remove it as well.

Kind regards,
Krystian Nowak



> A patch for caching fonts (fixes GDI issues), vertical text orientation, 
> color code fix, prefered unit for margins and measure unit converter
> -
>
> Key: COCOON-1703
> URL: https://issues.apache.org/jira/browse/COCOON-1703
> Project: Cocoon
>  Issue Type: Bug
>  Components: Blocks: POI
>    Reporter: Krystian Nowak
> Attachments: psnc-v3.1.patch, psnc-v3.patch
>
>
> A patch for caching fonts (fixes GDI issues), vertical text orientation, 
> color code fix, prefered unit for margins and measure unit converter - in 
> attachment

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Commented: (COCOON-1440) [poi] color string normalization

2007-01-08 Thread Krystian Nowak (JIRA)

[ 
https://issues.apache.org/jira/browse/COCOON-1440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12463043
 ] 

Krystian Nowak commented on COCOON-1440:


The second patch (the newest one) is the right one - SEPARATOR constant reused.

> [poi] color string normalization
> 
>
> Key: COCOON-1440
> URL: https://issues.apache.org/jira/browse/COCOON-1440
> Project: Cocoon
>  Issue Type: Improvement
>  Components: Blocks: POI
>Affects Versions: 2.1.6
> Environment: Operating System: All
> Platform: PC
>Reporter: Krystian Nowak
> Assigned To: Cocoon Developers Team
>Priority: Minor
> Attachments: COCOON-1440.patch, COCOON-1440.patch, ColorCodeTest.java
>
>
> In a constructor of ColorCode
> (org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements) there
> could be a normalization check to ensure that even if the color string is in
> form :: it will be normalized to
> org.apache.poi.hssf.util.HSSFColor's form which is :0:0. I've spend a lot 
> on
> debugging to get what's going on...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] Updated: (COCOON-1440) [poi] color string normalization

2007-01-08 Thread Krystian Nowak (JIRA)

 [ 
https://issues.apache.org/jira/browse/COCOON-1440?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Krystian Nowak updated COCOON-1440:
---

Attachment: COCOON-1440.patch

> [poi] color string normalization
> 
>
> Key: COCOON-1440
> URL: https://issues.apache.org/jira/browse/COCOON-1440
> Project: Cocoon
>  Issue Type: Improvement
>  Components: Blocks: POI
>Affects Versions: 2.1.6
> Environment: Operating System: All
> Platform: PC
>Reporter: Krystian Nowak
> Assigned To: Cocoon Developers Team
>Priority: Minor
> Attachments: COCOON-1440.patch, COCOON-1440.patch, ColorCodeTest.java
>
>
> In a constructor of ColorCode
> (org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements) there
> could be a normalization check to ensure that even if the color string is in
> form :: it will be normalized to
> org.apache.poi.hssf.util.HSSFColor's form which is :0:0. I've spend a lot 
> on
> debugging to get what's going on...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] Updated: (COCOON-1440) [poi] color string normalization

2007-01-08 Thread Krystian Nowak (JIRA)

 [ 
https://issues.apache.org/jira/browse/COCOON-1440?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Krystian Nowak updated COCOON-1440:
---


Done

> [poi] color string normalization
> 
>
> Key: COCOON-1440
> URL: https://issues.apache.org/jira/browse/COCOON-1440
> Project: Cocoon
>  Issue Type: Improvement
>  Components: Blocks: POI
>Affects Versions: 2.1.6
> Environment: Operating System: All
> Platform: PC
>Reporter: Krystian Nowak
> Assigned To: Cocoon Developers Team
>Priority: Minor
> Attachments: COCOON-1440.patch, ColorCodeTest.java
>
>
> In a constructor of ColorCode
> (org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements) there
> could be a normalization check to ensure that even if the color string is in
> form :: it will be normalized to
> org.apache.poi.hssf.util.HSSFColor's form which is :0:0. I've spend a lot 
> on
> debugging to get what's going on...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] Updated: (COCOON-1440) [poi] color string normalization

2007-01-08 Thread Krystian Nowak (JIRA)

 [ 
https://issues.apache.org/jira/browse/COCOON-1440?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Krystian Nowak updated COCOON-1440:
---


Done, patch file and test file added.

> [poi] color string normalization
> 
>
> Key: COCOON-1440
> URL: https://issues.apache.org/jira/browse/COCOON-1440
> Project: Cocoon
>  Issue Type: Improvement
>  Components: Blocks: POI
>Affects Versions: 2.1.6
> Environment: Operating System: All
> Platform: PC
>Reporter: Krystian Nowak
> Assigned To: Cocoon Developers Team
>Priority: Minor
> Attachments: COCOON-1440.patch, ColorCodeTest.java
>
>
> In a constructor of ColorCode
> (org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements) there
> could be a normalization check to ensure that even if the color string is in
> form :: it will be normalized to
> org.apache.poi.hssf.util.HSSFColor's form which is :0:0. I've spend a lot 
> on
> debugging to get what's going on...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] Updated: (COCOON-1440) [poi] color string normalization

2007-01-08 Thread Krystian Nowak (JIRA)

 [ 
https://issues.apache.org/jira/browse/COCOON-1440?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Krystian Nowak updated COCOON-1440:
---

Attachment: ColorCodeTest.java

> [poi] color string normalization
> 
>
> Key: COCOON-1440
> URL: https://issues.apache.org/jira/browse/COCOON-1440
> Project: Cocoon
>  Issue Type: Improvement
>  Components: Blocks: POI
>Affects Versions: 2.1.6
> Environment: Operating System: All
> Platform: PC
>Reporter: Krystian Nowak
> Assigned To: Cocoon Developers Team
>Priority: Minor
> Attachments: COCOON-1440.patch, ColorCodeTest.java
>
>
> In a constructor of ColorCode
> (org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements) there
> could be a normalization check to ensure that even if the color string is in
> form :: it will be normalized to
> org.apache.poi.hssf.util.HSSFColor's form which is :0:0. I've spend a lot 
> on
> debugging to get what's going on...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] Updated: (COCOON-1440) [poi] color string normalization

2007-01-08 Thread Krystian Nowak (JIRA)

 [ 
https://issues.apache.org/jira/browse/COCOON-1440?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Krystian Nowak updated COCOON-1440:
---

Attachment: COCOON-1440.patch

> [poi] color string normalization
> 
>
> Key: COCOON-1440
> URL: https://issues.apache.org/jira/browse/COCOON-1440
> Project: Cocoon
>  Issue Type: Improvement
>  Components: Blocks: POI
>Affects Versions: 2.1.6
> Environment: Operating System: All
> Platform: PC
>Reporter: Krystian Nowak
> Assigned To: Cocoon Developers Team
>Priority: Minor
> Attachments: COCOON-1440.patch, ColorCodeTest.java
>
>
> In a constructor of ColorCode
> (org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements) there
> could be a normalization check to ensure that even if the color string is in
> form :: it will be normalized to
> org.apache.poi.hssf.util.HSSFColor's form which is :0:0. I've spend a lot 
> on
> debugging to get what's going on...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] Skomentowane: (COCOON-1703) A patch for caching fonts (fixes GDI issues), vertical text orientation, color code fix, prefered unit for margins and measure unit converter

2006-01-17 Thread Krystian Nowak (JIRA)
[ 
http://issues.apache.org/jira/browse/COCOON-1703?page=comments#action_12362952 
] 

Krystian Nowak commented on COCOON-1703:


There were many changes, so it's not so easy for me to reformat the code back. 
If you have a code formatting configuration for Cocoon project, please reformat 
the code after patching it and submit another patch which is formatted 
according to your settings.

Regards,
Krystian

> A patch for caching fonts (fixes GDI issues), vertical text orientation, 
> color code fix, prefered unit for margins and measure unit converter
> -
>
>  Key: COCOON-1703
>  URL: http://issues.apache.org/jira/browse/COCOON-1703
>  Project: Cocoon
> Type: Bug
>   Components: Blocks: POI
> Reporter: Krystian Nowak
>  Attachments: psnc-v3.1.patch, psnc-v3.patch
>
> A patch for caching fonts (fixes GDI issues), vertical text orientation, 
> color code fix, prefered unit for margins and measure unit converter - in 
> attachment

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



[jira] Zaktualizowane: (COCOON-1703) A patch for caching fonts (fixes GDI issues), vertical text orientation, color code fix, prefered unit for margins and measure unit converter

2005-12-05 Thread Krystian Nowak (JIRA)
 [ http://issues.apache.org/jira/browse/COCOON-1703?page=all ]

Krystian Nowak updated COCOON-1703:
---

Attachment: psnc-v3.1.patch

Updated version of the patch - fixes NullPointerException if region size is 
greater than about 2000

> A patch for caching fonts (fixes GDI issues), vertical text orientation, 
> color code fix, prefered unit for margins and measure unit converter
> -
>
>  Key: COCOON-1703
>  URL: http://issues.apache.org/jira/browse/COCOON-1703
>  Project: Cocoon
> Type: Bug
>   Components: Blocks: POI
> Reporter: Krystian Nowak
>  Attachments: psnc-v3.1.patch, psnc-v3.patch
>
> A patch for caching fonts (fixes GDI issues), vertical text orientation, 
> color code fix, prefered unit for margins and measure unit converter - in 
> attachment

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



[jira] Utworzone: (COCOON-1703) A patch for caching fonts (fixes GDI issues), vertical text orientation, color code fix, prefered unit for margins and measure unit converter

2005-12-05 Thread Krystian Nowak (JIRA)
A patch for caching fonts (fixes GDI issues), vertical text orientation, color 
code fix, prefered unit for margins and measure unit converter
-

 Key: COCOON-1703
 URL: http://issues.apache.org/jira/browse/COCOON-1703
 Project: Cocoon
Type: Bug
  Components: Blocks: POI  
Reporter: Krystian Nowak
 Attachments: psnc-v3.patch

A patch for caching fonts (fixes GDI issues), vertical text orientation, color 
code fix, prefered unit for margins and measure unit converter - in attachment

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



[jira] Zamknięte: (COCOON-1701) A patch for caching fonts (fixes GDI issues), vertical text orientation, color code fix, prefered unit for margins and measure unit converter

2005-12-05 Thread Krystian Nowak (JIRA)
 [ http://issues.apache.org/jira/browse/COCOON-1701?page=all ]
 
Krystian Nowak closed COCOON-1701:
--

Resolution: Invalid

> A patch for caching fonts (fixes GDI issues), vertical text orientation, 
> color code fix, prefered unit for margins and measure unit converter
> -
>
>  Key: COCOON-1701
>  URL: http://issues.apache.org/jira/browse/COCOON-1701
>  Project: Cocoon
> Type: Bug
>     Reporter: Krystian Nowak
>  Attachments: psnc-v3.patch
>
> A patch for caching fonts (fixes GDI issues), vertical text orientation, 
> color code fix, prefered unit for margins and measure unit converter (in 
> attachment).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



[jira] Zamknięte: (COCOON-1702) A patch for caching fonts (fixes GDI issues), vertical text orientation, color code fix, prefered unit for margins and measure unit converter

2005-12-05 Thread Krystian Nowak (JIRA)
 [ http://issues.apache.org/jira/browse/COCOON-1702?page=all ]
 
Krystian Nowak closed COCOON-1702:
--

Resolution: Invalid

> A patch for caching fonts (fixes GDI issues), vertical text orientation, 
> color code fix, prefered unit for margins and measure unit converter
> -
>
>  Key: COCOON-1702
>  URL: http://issues.apache.org/jira/browse/COCOON-1702
>  Project: Cocoon
> Type: Bug
>     Reporter: Krystian Nowak

>
> A patch for caching fonts (fixes GDI issues), vertical text orientation, 
> color code fix, prefered unit for margins and measure unit converter (in 
> attachment).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



[jira] Utworzone: (COCOON-1702) A patch for caching fonts (fixes GDI issues), vertical text orientation, color code fix, prefered unit for margins and measure unit converter

2005-12-05 Thread Krystian Nowak (JIRA)
A patch for caching fonts (fixes GDI issues), vertical text orientation, color 
code fix, prefered unit for margins and measure unit converter
-

 Key: COCOON-1702
 URL: http://issues.apache.org/jira/browse/COCOON-1702
 Project: Cocoon
Type: Bug
Reporter: Krystian Nowak


A patch for caching fonts (fixes GDI issues), vertical text orientation, color 
code fix, prefered unit for margins and measure unit converter (in attachment).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



[jira] Utworzone: (COCOON-1701) A patch for caching fonts (fixes GDI issues), vertical text orientation, color code fix, prefered unit for margins and measure unit converter

2005-12-05 Thread Krystian Nowak (JIRA)
A patch for caching fonts (fixes GDI issues), vertical text orientation, color 
code fix, prefered unit for margins and measure unit converter
-

 Key: COCOON-1701
 URL: http://issues.apache.org/jira/browse/COCOON-1701
 Project: Cocoon
Type: Bug
Reporter: Krystian Nowak
 Attachments: psnc-v3.patch

A patch for caching fonts (fixes GDI issues), vertical text orientation, color 
code fix, prefered unit for margins and measure unit converter (in attachment).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



Cocoon-POI enhancements

2005-02-09 Thread Krystian Nowak
In an attachment there is a patch that:
1. Makes vertical text orientation possible.
2. Caches fonts used in workbook, since there could be an error in MS 
Excel that maximal numer of fonts used in workbook is exceeded.

Please, if there is a POI-block developer on the list, could you look at 
that code and think if it is good enough to include it in next Cocoon 
release?

Regards,
Krystian
--
Krystian Nowak
[EMAIL PROTECTED]
===
Poznan Supercomputing and Networking Center
Poland, 60-814 Poznan, Zwierzyniecka 20
tel. (+48 61) 8582159 fax. (+48 61) 8582151
http://www.man.poznan.pl
===
BlueEyes - Human-Operator Monitoring System
http://www.blueeyes.prv.pl
http://www.cs.put.poznan.pl/csidc/2001
===
Index: EPFont.java
===
RCS file: 
/home/cvspublic/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPFont.java,v
retrieving revision 1.6
diff -u -r1.6 EPFont.java
--- EPFont.java 5 Mar 2004 13:02:03 -   1.6
+++ EPFont.java 9 Feb 2005 16:01:00 -
@@ -16,21 +16,14 @@
 
 package org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements;
 
-import org.apache.cocoon.components.elementprocessor.types.Attribute;
-import org.apache.cocoon.components.elementprocessor.ElementProcessor;
+import java.io.*;
+import java.util.*;
 
-import org.apache.cocoon.components.elementprocessor.types.BooleanConverter;
-import org.apache.cocoon.components.elementprocessor.types.BooleanResult;
-import org.apache.cocoon.components.elementprocessor.types.NumericConverter;
-import org.apache.cocoon.components.elementprocessor.types.NumericResult;
-import org.apache.cocoon.components.elementprocessor.types.Validator;
-
-import org.apache.poi.hssf.usermodel.HSSFCellStyle;
-import org.apache.poi.hssf.usermodel.HSSFFont;
-import org.apache.poi.hssf.util.HSSFColor;
-
-import java.io.IOException;
-import java.util.Hashtable;
+import org.apache.cocoon.components.elementprocessor.*;
+import 
org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements.fontcache.*;
+import org.apache.cocoon.components.elementprocessor.types.*;
+import org.apache.poi.hssf.usermodel.*;
+import org.apache.poi.hssf.util.*;
 
 /**
  * No-op implementation of ElementProcessor to handle the "Font" tag
@@ -42,16 +35,19 @@
  *
  * @author Marc Johnson ([EMAIL PROTECTED])
  * @author Andrew C. Oliver ([EMAIL PROTECTED])
+ * @author Krystian Nowak (krystian _a_t_ man _d_o_t_ poznan _d_o_t_ pl) 
  * @version CVS $Id: EPFont.java,v 1.6 2004/03/05 13:02:03 bdelacretaz Exp $
  */
 public class EPFont extends BaseElementProcessor {
+private static final String DEFAULT_EXCEL_FONT = "Arial";
 private NumericResult _unit;
 private BooleanResult _bold;
 private BooleanResult _italic;
 private NumericResult _underline;
 private BooleanResult _strike_through;
 private String _font;
-private HSSFFont hssfFont;
+private HSSFCellStyle _style;
+private Key _fontCacheKey;
 private static final String _unit_attribute = "Unit";
 private static final String _bold_attribute = "Bold";
 private static final String _italic_attribute = "Italic";
@@ -76,6 +72,8 @@
 _underline = null;
 _strike_through = null;
 _font = null;
+_style = null;
+_fontCacheKey = null;
 }
 
 /**
@@ -92,30 +90,24 @@
 if (pstyle.isValid()) {
 Hashtable colorhash = pstyle.getColorHash();
 HSSFColor color = null;
-
-HSSFCellStyle style = pstyle.getStyle();
-//style.setFillForegroundColor(
-Workbook workbook = getWorkbook();
-HSSFFont font = workbook.createFont();
-style.setFont(font);
-font.setFontHeightInPoints((short)getUnit());
-//font.setFontName(getFont());
-font.setItalic(getItalic());
-if (getBold()) {
-font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
-} else {
-font.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
-}
-font.setUnderline((byte)getUnderline());
-font.setStrikeout(getStrikeThrough());
-
+_style = pstyle.getStyle();
+
 color = (HSSFColor)colorhash.get(
 pstyle.getForegroundColor().toString());
 //System.out.println(pstyle.getForegroundColor().toString());
 if (color == null)
 color = new HSSFColor.BLACK();
-font.setColor(color.getIndex());
-hssfFont = font;
+
+//style.setFillForegroundColor(
+
+_fontCacheKey = new Key();
+_fontCacheKey.setUnit((short)getUnit());
+//key.setName(getFont()); // la

Re: Cocoon-POI question

2004-12-17 Thread Krystian Nowak
What do you all think about this simple (_TEMPORARY_) solution (in 
attachment as EPStyle.java.diff)?

Regards,
Krystian
--
Krystian Nowak
[EMAIL PROTECTED]
===
Poznan Supercomputing and Networking Center
Poland, 60-814 Poznan, Zwierzyniecka 20
tel. (+48 61) 8582164 fax. (+48 61) 8582151
http://www.man.poznan.pl
===
BlueEyes - Human-Operator Monitoring System
http://www.blueeyes.prv.pl
http://www.cs.put.poznan.pl/csidc/2001
===
Index: EPStyle.java
===
RCS file: 
/home/cvspublic/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPStyle.java,v
retrieving revision 1.7
diff -u -r1.7 EPStyle.java
--- EPStyle.java5 Mar 2004 13:02:04 -   1.7
+++ EPStyle.java17 Dec 2004 10:12:11 -
@@ -41,6 +41,7 @@
  *
  * @author Marc Johnson ([EMAIL PROTECTED])
  * @author Andrew C. Oliver ([EMAIL PROTECTED])
+ * @author Krystian Nowak (krystian _a_t_ man _d_o_t_ poznan _d_o_t_ pl)
  * @version CVS $Id: EPStyle.java,v 1.7 2004/03/05 13:02:04 bdelacretaz Exp $
  */
 public class EPStyle extends BaseElementProcessor {
@@ -116,6 +117,11 @@
 convertVAlignment(getVerticalAlignment().getCode());
 style.setVerticalAlignment(cnvvalign);
 style.setFillPattern((short)getShade());
+style.setRotation(convertStyleOrientation(
+isStyleOrientationHoriz(),
+isStyleOrientationVertHorizText(),
+isStyleOrientationVertVertText(),
+isStyleOrientationVertVertText2()));
 
 Workbook workbook = getWorkbook();
 HSSFDataFormat dataformat = workbook.createDataFormat();
@@ -547,6 +553,20 @@
 + retval);
 }
 return retval;
+}
+
+/**
+ * deal with mismatch between gnumeric style orientation and Excel cell 
style rotation
+ */
+private short convertStyleOrientation(
+boolean horiz, boolean vert_horiz_text, boolean vert_vert_text,
+boolean vert_vert_text2) {
+
+if(horiz && (!vert_horiz_text) && (!vert_vert_text) && 
(!vert_vert_text2)) {
+return 0;
+} else {
+return 90;
+}
 }
 
 } // end public class EPStyle


Cocoon-POI question

2004-12-16 Thread Krystian Nowak
Hi There!
I saw Victor's modification to Cocoon-POI:
http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Orientation.java?r1=1.5&r2=1.6&diff_format=h
relased in Cocoon 2.1.6
Can you tell me what is the level of activity of block POI right now?
(commits or functional points per month ;)). I am interested in
gmr:Style's Orient attibute ("The text orientation" - accoring to
http://www.jfree.org/jworkbook/gnumeric-xml.pdf) which defaults to "1".
It is a kind of weird attribute:
1) There is a class that represents the attribute:
org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements.StyleOrientation
having following methods:
public boolean isHoriz()
public boolean isVertHorizText()
public boolean isVertVertText()
public boolean isVertVertText2()
2) It is used by:
having methods calling representants in StyleOrientation:
public boolean isStyleOrientationHoriz() throws IOException
{
return getStyleOrientation().isHoriz();
}
public boolean isStyleOrientationVertHorizText() throws IOException
{
return getStyleOrientation().isVertHorizText();
}
public boolean isStyleOrientationVertVertText() throws IOException
{
return getStyleOrientation().isVertVertText();
}
public boolean isStyleOrientationVertVertText2() throws IOException {
   return getStyleOrientation().isVertVertText2();
}
3) It could have been used on org.apache.poi.hssf.usermodel.HSSFCellStyle
calling its setRotation(short rotation) method
4) BUT no one calls those methods!!!
So what the [EMAIL PROTECTED] is going on?
Recent Gnumeric still seems not to implement text rotation:
http://gnomedesktop.org/node/2020#comment-32238
and it was a problem since a while:
http://mail.gnome.org/archives/gnome-office-list/2003-December/msg8.html
so I couldn't find good explanation for "Orient" attibute values.
Also the only value written by Gnumeric in Orient attribute is of course
"1", since there is no option in Gnumeric's menu to rotate cell's text.
According to
org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements.StyleOrientation 

class it seems to be a 4-bit number:
"Style orientation is written as an integer, and each bit in the
integer specifies a particular boolean attribute. This class deals
with all that information in an easily digested form"
So there are the bits:
0-bit is horiz - default value ( == 1 )
1-bit is vert_horiz_text
2-bit is vert_vert_text
3-bit is vert_vert_text2
What do the three upper bits mean?
Those bits are also mentioned in
http://cvs.gnome.org/viewcvs/gnumeric/gnumeric.xsd?rev=1.11&view=markup
as:








I guess that to set cell text orientation/rotation there is enough to
code it like that:
public abstract class EPStyle
extends
org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements.EPStyle
{
public void initialize(Attribute[] attributes, ElementProcessor parent)
throws IOException
{
super.initialize(attributes, parent);
EPStyleRegion sregion = (EPStyleRegion)parent;
if (sregion.isValid()) {
HSSFCellStyle style = sregion.getStyle();
boolean horiz = isStyleOrientationHoriz();
boolean vert_horiz_text = isStyleOrientationVertHorizText();
boolean vert_vert_text = isStyleOrientationVertVertText();
boolean vert_vert_text2 = isStyleOrientationVertVertText2();
short rotation = magicallMetodCreatingRotationValue(
horiz, vert_horiz_text, vert_vert_text,
vert_vert_text2);
style.setRotation(rotation);
}
}
public abstract short magicallMetodCreatingRotationValue(
boolean horiz, boolean vert_horiz_text, boolean vert_vert_text,
boolean vert_vert_text2);
}
But I need to know how to write magicallMetodCreatingRotationValue!!!
Do you know what can help me?

BTW - what is http://cvs.apache.org/viewcvs.cgi/cocoon-2.2/ repository
points to? There are no blocks - especially my beloved poi one ;)

Regards,
Krystian
--
Krystian Nowak
[EMAIL PROTECTED]
===
Poznan Supercomputing and Networking Center
Poland, 60-814 Poznan, Zwierzyniecka 20
tel. (+48 61) 8582164 fax. (+48 61) 8582151
http://www.man.poznan.pl
===
BlueEyes - Human-Operator Monitoring System
http://www.blueeyes.prv.pl
http://www.cs.put.poznan.pl/csidc/2001
===