poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ye...@apache.org
Subject svn commit: r811998 - in /poi/trunk/src: documentation/content/xdocs/ java/org/apache/poi/hssf/record/ java/org/apache/poi/hssf/usermodel/ java/org/apache/poi/ss/usermodel/ testcases/org/apache/poi/ss/usermodel/
Date Mon, 07 Sep 2009 05:17:25 GMT
Author: yegor
Date: Mon Sep  7 05:17:23 2009
New Revision: 811998

URL: http://svn.apache.org/viewvc?rev=811998&view=rev
Log:
Added method setFunction(boolean) for defined names

Modified:
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/java/org/apache/poi/hssf/record/NameRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFName.java
    poi/trunk/src/java/org/apache/poi/ss/usermodel/Name.java
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestNamedRange.java

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=811998&r1=811997&r2=811998&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Mon Sep  7 05:17:23 2009
@@ -33,6 +33,7 @@
 
     <changes>
         <release version="3.5-beta7" date="2009-??-??">
+           <action dev="POI-DEVELOPERS" type="add">47771 - Added method setFunction(boolean)
for defined names</action>
            <action dev="POI-DEVELOPERS" type="add">47768 - Implementation of Excel
"Days360" and "Npv" functions</action>
            <action dev="POI-DEVELOPERS" type="fix">47751 - Do not allow HSSF's cell
text longer than 32,767 characters</action>
            <action dev="POI-DEVELOPERS" type="add">47757 - Added an example demonstrating
how to convert an XLSX workbook to CSV</action>

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/NameRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/NameRecord.java?rev=811998&r1=811997&r2=811998&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/NameRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/NameRecord.java Mon Sep  7 05:17:23 2009
@@ -34,6 +34,8 @@
  * @author  Sergei Kozello (sergeikozello at mail.ru)
  * @author Glen Stampoultzis (glens at apache.org)
  * @version 1.0-pre
+ *  
+ * Modified 8/31/09 by Petr Udalau - added method setFunction(boolean)
  */
 public final class NameRecord extends StandardRecord {
     public final static short sid = 0x0018;
@@ -237,6 +239,20 @@
 	public boolean isFunctionName() {
 		return (field_1_option_flag & Option.OPT_FUNCTION_NAME) != 0;
 	}
+	
+    /**
+     * Indicates that the defined name refers to a user-defined function.
+     * This attribute is used when there is an add-in or other code project associated with
the file.
+     *
+     * @param value <code>true</code> indicates the name refers to a function.
+     */
+	public void setFunction(boolean function){
+		if (function) {
+			field_1_option_flag |= Option.OPT_FUNCTION_NAME;
+		} else {
+			field_1_option_flag &= (~Option.OPT_FUNCTION_NAME);
+		}
+	}
 
 	/**
 	 * @return <code>true</code> if name has a formula (named range or defined value)

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFName.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFName.java?rev=811998&r1=811997&r2=811998&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFName.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFName.java Mon Sep  7 05:17:23 2009
@@ -243,4 +243,15 @@
         _definedNameRec.setDescriptionText(comment);
     }
 
+    /**
+     * Indicates that the defined name refers to a user-defined function.
+     * This attribute is used when there is an add-in or other code project associated with
the file.
+     *
+     * @param value <code>true</code> indicates the name refers to a function.
+     */
+	public void setFunction(boolean value) {
+		_definedNameRec.setFunction(value);
+		
+	}
+
 }

Modified: poi/trunk/src/java/org/apache/poi/ss/usermodel/Name.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/Name.java?rev=811998&r1=811997&r2=811998&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/usermodel/Name.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/Name.java Mon Sep  7 05:17:23 2009
@@ -49,6 +49,8 @@
  *  name.setRefersToFormula("IF(Loan_Amount*Interest_Rate>0,1,0)");
  *
  * </blockquote></pre>
+ *  
+ * Modified 8/31/09 by Petr Udalau - added method setFunction(boolean)
  */
 public interface Name {
 
@@ -181,4 +183,12 @@
      * @param comment the user comment for this named range
      */
     public void setComment(String comment);
+
+    /**
+     * Indicates that the defined name refers to a user-defined function.
+     * This attribute is used when there is an add-in or other code project associated with
the file.
+     *
+     * @param value <code>true</code> indicates the name refers to a function.
+     */
+    void setFunction(boolean value);
 }

Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestNamedRange.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestNamedRange.java?rev=811998&r1=811997&r2=811998&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestNamedRange.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestNamedRange.java Mon Sep  7
05:17:23 2009
@@ -544,4 +544,19 @@
         }
 
     }
+
+    public void testFunctionNames() {
+        Workbook wb = getTestDataProvider().createWorkbook();
+        Name n = wb.createName();
+        assertFalse(n.isFunctionName());
+
+        n.setFunction(false);
+        assertFalse(n.isFunctionName());
+
+        n.setFunction(true);
+        assertTrue(n.isFunctionName());
+
+        n.setFunction(false);
+        assertFalse(n.isFunctionName());
+    }
 }
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message