diff options
author | Rüdiger Timm <rt@openoffice.org> | 2005-01-31 15:09:40 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2005-01-31 15:09:40 +0000 |
commit | 35e2257506f060d15ca39f873727e64e6e32df37 (patch) | |
tree | 749403bc55cdd79a0250322a2ddd570daa953744 /odk/examples/DevelopersGuide/Charts | |
parent | db4301ab6feb9ed26d13ce19e3237bf251722308 (diff) |
INTEGRATION: CWS sdksample (1.3.124); FILE MERGED
2004/07/26 11:25:36 jsc 1.3.124.1: #i29308# improved, insert factor
Diffstat (limited to 'odk/examples/DevelopersGuide/Charts')
-rw-r--r-- | odk/examples/DevelopersGuide/Charts/CalcHelper.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/odk/examples/DevelopersGuide/Charts/CalcHelper.java b/odk/examples/DevelopersGuide/Charts/CalcHelper.java index 82e4fbb29525..619d890a1732 100644 --- a/odk/examples/DevelopersGuide/Charts/CalcHelper.java +++ b/odk/examples/DevelopersGuide/Charts/CalcHelper.java @@ -2,9 +2,9 @@ * * $RCSfile: CalcHelper.java,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: hr $ $Date: 2003-06-30 15:08:33 $ + * last change: $Author: rt $ $Date: 2005-01-31 16:09:40 $ * * The Contents of this file are made available subject to the terms of * the BSD license. @@ -65,6 +65,7 @@ import com.sun.star.container.*; import com.sun.star.sheet.*; import com.sun.star.table.*; import com.sun.star.chart.*; +import com.sun.star.text.XText; import com.sun.star.document.XEmbeddedObjectSupplier; import com.sun.star.frame.XModel; @@ -308,6 +309,13 @@ public class CalcHelper double fFactor = 2.0 * java.lang.Math.PI / (double)(nRowCount - 1); String aFormula; + // set variable factor for cos formula + int nFactorCol = nColumnCount + 2; + (aSheet.getCellByPosition( nFactorCol - 1, 0 )).setValue( 0.2 ); + + XText xCellText = (XText) UnoRuntime.queryInterface( XText.class, aSheet.getCellByPosition( nFactorCol - 1, 1 ) ); + xCellText.setString( "Change the factor above and\nwatch the changes in the chart" ); + for( nCol = 0; nCol < nColumnCount; nCol++ ) { for( nRow = 0; nRow < nRowCount; nRow++ ) @@ -325,7 +333,7 @@ public class CalcHelper aFormula += "SIN"; else aFormula += "COS"; - aFormula += "(INDIRECT(ADDRESS(" + (nRow + 1) + ";1)))+RAND()*0.2"; + aFormula += "(INDIRECT(ADDRESS(" + (nRow + 1) + ";1)))+RAND()*INDIRECT(ADDRESS(1;" + nFactorCol + "))"; (aSheet.getCellByPosition( nCol, nRow )).setFormula( aFormula ); } } |