summaryrefslogtreecommitdiff
path: root/odk/examples/DevelopersGuide/Charts
diff options
context:
space:
mode:
Diffstat (limited to 'odk/examples/DevelopersGuide/Charts')
-rw-r--r--odk/examples/DevelopersGuide/Charts/CalcHelper.java16
-rw-r--r--odk/examples/DevelopersGuide/Charts/ChartHelper.java20
-rw-r--r--odk/examples/DevelopersGuide/Charts/ChartInCalc.java12
-rw-r--r--odk/examples/DevelopersGuide/Charts/ChartInDraw.java12
-rw-r--r--odk/examples/DevelopersGuide/Charts/ChartInWriter.java6
-rw-r--r--odk/examples/DevelopersGuide/Charts/Helper.java12
-rw-r--r--odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.java10
-rw-r--r--odk/examples/DevelopersGuide/Charts/ListenAtCalcRangeInDraw.java8
-rw-r--r--odk/examples/DevelopersGuide/Charts/SelectionChangeListener.java64
9 files changed, 80 insertions, 80 deletions
diff --git a/odk/examples/DevelopersGuide/Charts/CalcHelper.java b/odk/examples/DevelopersGuide/Charts/CalcHelper.java
index c7a82f327118..c9bac59345ab 100644
--- a/odk/examples/DevelopersGuide/Charts/CalcHelper.java
+++ b/odk/examples/DevelopersGuide/Charts/CalcHelper.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
// __________ Imports __________
@@ -108,7 +108,7 @@ public class CalcHelper
}
catch( Exception ex )
{}
-
+
return aSheet;
}
@@ -207,7 +207,7 @@ public class CalcHelper
}
catch( NoSuchElementException ex )
{
- System.out.println( "Couldn't find chart with name " + sChartName + ": " + ex );
+ System.out.println( "Couldn't find chart with name " + sChartName + ": " + ex );
}
catch( Exception ex )
{}
@@ -278,7 +278,7 @@ public class CalcHelper
{
System.out.println( "Sheet not found" + ex );
}
-
+
return aRange;
}
@@ -303,13 +303,13 @@ public class CalcHelper
double fFactor = 2.0 * java.lang.Math.PI / (double)(nRowCount - 1);
String aFormula;
- // set variable factor for cos formula
+ // 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++ )
@@ -338,7 +338,7 @@ public class CalcHelper
{
System.out.println( "Sheet not found" + ex );
}
-
+
return aRange;
}
diff --git a/odk/examples/DevelopersGuide/Charts/ChartHelper.java b/odk/examples/DevelopersGuide/Charts/ChartHelper.java
index 0cffc0e3e954..5d44dc034ebb 100644
--- a/odk/examples/DevelopersGuide/Charts/ChartHelper.java
+++ b/odk/examples/DevelopersGuide/Charts/ChartHelper.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
// __________ Imports __________
@@ -104,7 +104,7 @@ public class ChartHelper
{
XPropertySet xPropSet = (XPropertySet)UnoRuntime.queryInterface(
XPropertySet.class, xTextContent);
-
+
Any aAny = new Any(String.class, msChartClassID);
xPropSet.setPropertyValue("CLSID", aAny );
@@ -116,12 +116,12 @@ public class ChartHelper
//insert embedded object in text -> object will be created
xText.insertTextContent( xCursor, xTextContent, true );
-
+
// set size and position
XShape xShape = (XShape)UnoRuntime.queryInterface(
XShape.class, xTextContent);
xShape.setSize( aExtent );
-
+
aAny = new Any(Short.class,
new Short(com.sun.star.text.VertOrientation.NONE));
xPropSet.setPropertyValue("VertOrient", aAny );
@@ -132,12 +132,12 @@ public class ChartHelper
xPropSet.setPropertyValue("VertOrientPosition", aAny );
aAny = new Any(Integer.class, new Integer(aUpperLeft.X));
xPropSet.setPropertyValue("HoriOrientPosition", aAny );
-
+
// retrieve the chart document as model of the OLE shape
aResult = (XChartDocument) UnoRuntime.queryInterface(
XChartDocument.class,
xPropSet.getPropertyValue( "Model" ));
-
+
// create a diagram via the factory and set this as
// new diagram
aResult.setDiagram(
@@ -150,12 +150,12 @@ public class ChartHelper
} catch( Exception ex)
{
System.out.println( "caught exception: " + ex );
- }
+ }
}
return aResult;
}
-
+
public XChartDocument insertOLEChartInDraw(
String sChartName,
Point aUpperLeft,
@@ -213,7 +213,7 @@ public class ChartHelper
XShape aShape = (XShape) UnoRuntime.queryInterface(
XShape.class,
aFact.createInstance( "com.sun.star.drawing.OLE2Shape" ));
-
+
// insert the shape into the page
aPage.add( aShape );
aShape.setPosition( aUpperLeft );
diff --git a/odk/examples/DevelopersGuide/Charts/ChartInCalc.java b/odk/examples/DevelopersGuide/Charts/ChartInCalc.java
index 06f571bec304..44ae46033389 100644
--- a/odk/examples/DevelopersGuide/Charts/ChartInCalc.java
+++ b/odk/examples/DevelopersGuide/Charts/ChartInCalc.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
// __________ Imports __________
@@ -166,7 +166,7 @@ public class ChartInCalc
public void unlockControllers()
throws RuntimeException
{
- ((XModel) UnoRuntime.queryInterface( XModel.class, maChartDocument )).unlockControllers();
+ ((XModel) UnoRuntime.queryInterface( XModel.class, maChartDocument )).unlockControllers();
}
// ____________________
@@ -259,7 +259,7 @@ public class ChartInCalc
nMaxIndex = i;
}
}
-
+
// first parameter is the index of the point, the second one is the series
XPropertySet aPointProp = maDiagram.getDataPointProperties( 0, 1 );
@@ -276,7 +276,7 @@ public class ChartInCalc
catch( IndexOutOfBoundsException ex )
{
System.out.println( "Oops, there not enough data points or series for setting properties: " + ex );
- }
+ }
}
// ____________________
@@ -319,7 +319,7 @@ public class ChartInCalc
XPropertySet aDocProp = (XPropertySet) UnoRuntime.queryInterface(
XPropertySet.class, maChartDocument );
aDocProp.setPropertyValue( "HasMainTitle", new Boolean( true ));
-
+
XShape aTitle = maChartDocument.getTitle();
XPropertySet aTitleProp = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, aTitle );
diff --git a/odk/examples/DevelopersGuide/Charts/ChartInDraw.java b/odk/examples/DevelopersGuide/Charts/ChartInDraw.java
index 9b206f5f7635..ed21c900aaa5 100644
--- a/odk/examples/DevelopersGuide/Charts/ChartInDraw.java
+++ b/odk/examples/DevelopersGuide/Charts/ChartInDraw.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
// __________ Imports __________
@@ -144,7 +144,7 @@ public class ChartInDraw
public void unlockControllers()
throws RuntimeException
{
- ((XModel) UnoRuntime.queryInterface( XModel.class, maChartDocument )).unlockControllers();
+ ((XModel) UnoRuntime.queryInterface( XModel.class, maChartDocument )).unlockControllers();
}
// ____________________
@@ -226,7 +226,7 @@ public class ChartInDraw
aDiaProp.setPropertyValue( "Deep", aTrue );
// from Chart3DBarProperties:
aDiaProp.setPropertyValue( "SolidType", new Integer( ChartSolidType.CYLINDER ));
-
+
// change floor color to Magenta6
XPropertySet aFloor = ((X3DDisplay) UnoRuntime.queryInterface(
X3DDisplay.class, maDiagram )).getFloor();
@@ -289,13 +289,13 @@ public class ChartInDraw
// set direction
com.sun.star.drawing.Direction3D aDirection = new com.sun.star.drawing.Direction3D();
-
+
aDirection.DirectionX = -0.75;
aDirection.DirectionY = 0.5;
aDirection.DirectionZ = 0.5;
aDiaProp.setPropertyValue( "D3DSceneLightDirection1", aDirection );
- aDiaProp.setPropertyValue( "D3DSceneLightOn1", new Boolean( true ));
+ aDiaProp.setPropertyValue( "D3DSceneLightOn1", new Boolean( true ));
}
// ______________________________
diff --git a/odk/examples/DevelopersGuide/Charts/ChartInWriter.java b/odk/examples/DevelopersGuide/Charts/ChartInWriter.java
index 9f64e1f49c22..22108393f66c 100644
--- a/odk/examples/DevelopersGuide/Charts/ChartInWriter.java
+++ b/odk/examples/DevelopersGuide/Charts/ChartInWriter.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
// __________ Imports __________
@@ -151,7 +151,7 @@ public class ChartInWriter
public void unlockControllers()
throws RuntimeException
{
- ((XModel) UnoRuntime.queryInterface( XModel.class, maChartDocument )).unlockControllers();
+ ((XModel) UnoRuntime.queryInterface( XModel.class, maChartDocument )).unlockControllers();
}
// ____________________
diff --git a/odk/examples/DevelopersGuide/Charts/Helper.java b/odk/examples/DevelopersGuide/Charts/Helper.java
index 13efc37d177a..cae86ca2d5d1 100644
--- a/odk/examples/DevelopersGuide/Charts/Helper.java
+++ b/odk/examples/DevelopersGuide/Charts/Helper.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
// __________ Imports __________
@@ -72,14 +72,14 @@ import com.sun.star.lang.IndexOutOfBoundsException;
// __________ Implementation __________
-/** Helper for creating a calc document adding cell values and charts
+/** Helper for creating a calc document adding cell values and charts
@author Bj&ouml;rn Milcke
*/
public class Helper
{
public Helper( String[] args )
{
- // connect to a running office and get the ServiceManager
+ // connect to a running office and get the ServiceManager
try {
// get the remote office component context
maContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
@@ -152,10 +152,10 @@ public class Helper
return aResult;
}
-
+
public XComponentContext getComponentContext(){
return maContext;
-
+
}
// __________ private members and methods __________
diff --git a/odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.java b/odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.java
index 10a137a316d5..9bb24a81b62b 100644
--- a/odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.java
+++ b/odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
// base classes
@@ -212,7 +212,7 @@ public class JavaSampleChartAddIn extends WeakBase implements
JOptionPane.showMessageDialog( null, "One of the lines is still null", "Assertion", JOptionPane.WARNING_MESSAGE );
return;
}
-
+
// position lines
// --------------
@@ -262,7 +262,7 @@ public class JavaSampleChartAddIn extends WeakBase implements
XPropertySet aShapeProp = (XPropertySet) UnoRuntime.queryInterface(
XPropertySet.class, maTopLine );
aShapeProp.setPropertyValue( "PolyPolygon", aMaxPtSeq );
-
+
aShapeProp = (XPropertySet) UnoRuntime.queryInterface(
XPropertySet.class, maBottomLine );
aShapeProp.setPropertyValue( "PolyPolygon", aMinPtSeq );
@@ -309,7 +309,7 @@ public class JavaSampleChartAddIn extends WeakBase implements
{
return( JavaSampleChartAddIn.class.getName() );
}
-
+
public String[] getSupportedServiceNames()
{
return getSupportedServiceNames_Static();
diff --git a/odk/examples/DevelopersGuide/Charts/ListenAtCalcRangeInDraw.java b/odk/examples/DevelopersGuide/Charts/ListenAtCalcRangeInDraw.java
index 9c37b4d19954..41ee1afb1e96 100644
--- a/odk/examples/DevelopersGuide/Charts/ListenAtCalcRangeInDraw.java
+++ b/odk/examples/DevelopersGuide/Charts/ListenAtCalcRangeInDraw.java
@@ -2,7 +2,7 @@
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
* All rights reserved.
*
@@ -29,7 +29,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
*************************************************************************/
// __________ Imports __________
@@ -121,7 +121,7 @@ public class ListenAtCalcRangeInDraw implements XChartDataChangeEventListener
// ____________________
public void run()
- {
+ {
try
{
((XPropertySet) UnoRuntime.queryInterface(
@@ -186,7 +186,7 @@ public class ListenAtCalcRangeInDraw implements XChartDataChangeEventListener
XPropertySet aDocProp = (XPropertySet) UnoRuntime.queryInterface(
XPropertySet.class, maChartDocument );
aDocProp.setPropertyValue( "HasMainTitle", new Boolean( true ));
-
+
((XPropertySet) UnoRuntime.queryInterface(
XPropertySet.class, maChartDocument.getSubTitle())).setPropertyValue(
"String", aTitle );
diff --git a/odk/examples/DevelopersGuide/Charts/SelectionChangeListener.java b/odk/examples/DevelopersGuide/Charts/SelectionChangeListener.java
index 3a90b2d63313..d895be7df98f 100644
--- a/odk/examples/DevelopersGuide/Charts/SelectionChangeListener.java
+++ b/odk/examples/DevelopersGuide/Charts/SelectionChangeListener.java
@@ -72,32 +72,32 @@ import com.sun.star.awt.XWindow;
public class SelectionChangeListener implements XSelectionChangeListener {
public static void main( String args[] ) {
SelectionChangeListener aMySelf = new SelectionChangeListener( args );
-
+
aMySelf.run();
}
-
+
public SelectionChangeListener( String args[] ) {
Helper aHelper = new Helper( args );
-
+
maContext = aHelper.getComponentContext();
-
+
CalcHelper aCalcHelper = new CalcHelper( aHelper.createSpreadsheetDocument() );
-
+
// insert a cell range with 4 columns and 12 rows filled with random numbers
XCellRange aRange = aCalcHelper.insertRandomRange( 4, 12 );
CellRangeAddress aRangeAddress = ((XCellRangeAddressable) UnoRuntime.queryInterface(
XCellRangeAddressable.class, aRange)).getRangeAddress();
-
+
// change view to sheet containing the chart
aCalcHelper.raiseChartSheet();
-
+
// the unit for measures is 1/100th of a millimeter
// position at (1cm, 1cm)
Point aPos = new Point( 1000, 1000 );
-
+
// size of the chart is 15cm x 9.271cm
Size aExtent = new Size( 15000, 9271 );
-
+
// insert a new chart into the "Chart" sheet of the
// spreadsheet document
maChartDocument = aCalcHelper.insertChart(
@@ -107,12 +107,12 @@ public class SelectionChangeListener implements XSelectionChangeListener {
aExtent,
"com.sun.star.chart.XYDiagram" );
}
-
+
// ____________________
-
+
public void run() {
boolean bTrying = true;
-
+
while( bTrying ) {
// start listening for selection changes
XSelectionSupplier aSelSupp = (XSelectionSupplier) UnoRuntime.queryInterface(
@@ -124,67 +124,67 @@ public class SelectionChangeListener implements XSelectionChangeListener {
System.out.println( "Successfully attached as selection change listener" );
bTrying = false;
}
-
+
// start listening for death of Controller
XComponent aComp = (XComponent) UnoRuntime.queryInterface( XComponent.class, aSelSupp );
if( aComp != null ) {
aComp.addEventListener( this );
System.out.println( "Successfully attached as dispose listener" );
}
-
+
try {
Thread.currentThread().sleep( 500 );
} catch( InterruptedException ex ) {
}
}
}
-
+
// ____________________
-
+
// XEventListener (base of XSelectionChangeListener)
public void disposing( EventObject aSourceObj ) {
System.out.println( "disposing called. detaching as listener" );
-
+
// stop listening for selection changes
XSelectionSupplier aCtrl = (XSelectionSupplier) UnoRuntime.queryInterface(
XSelectionSupplier.class, aSourceObj );
if( aCtrl != null )
aCtrl.removeSelectionChangeListener( this );
-
+
// remove as dispose listener
XComponent aComp = (XComponent) UnoRuntime.queryInterface( XComponent.class, aSourceObj );
if( aComp != null )
aComp.removeEventListener( this );
-
+
// bail out
System.exit( 0 );
}
-
+
// ____________________
-
+
// XSelectionChangeListener
public void selectionChanged( EventObject aEvent ) {
XController aCtrl = (XController) UnoRuntime.queryInterface( XController.class, aEvent.Source );
if( aCtrl != null ) {
XMultiComponentFactory mMCF = maContext.getServiceManager();
-
+
MyMessageBox aMsgBox = new MyMessageBox(mMCF);
-
+
aMsgBox.start();
-
+
System.out.println("Listener finished");
}
}
-
+
// __________ private __________
-
+
private class MyMessageBox extends Thread{
private XMultiComponentFactory mMCF;
-
+
public MyMessageBox(XMultiComponentFactory xMCF){
mMCF = xMCF;
}
-
+
public void run() {
XDesktop aDesktop = null;
XInterface aToolKit = null;
@@ -196,16 +196,16 @@ public class SelectionChangeListener implements XSelectionChangeListener {
try {
Object oDesktop = mMCF.createInstanceWithContext("com.sun.star.frame.Desktop", maContext);
Object oToolKit = mMCF.createInstanceWithContext("com.sun.star.awt.Toolkit", maContext);
-
+
aDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, oDesktop);
aToolKit = (XInterface) UnoRuntime.queryInterface(XInterface.class, oToolKit);
} catch (Exception ex) {
ex.printStackTrace();
}
-
+
XWindow xWin = aDesktop.getCurrentFrame().getContainerWindow();
XWindowPeer aWinPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xWin);
-
+
Rectangle aRect = new Rectangle();
int button = com.sun.star.awt.MessageBoxButtons.BUTTONS_OK;
XMessageBoxFactory aMBF = (XMessageBoxFactory) UnoRuntime.queryInterface(XMessageBoxFactory.class, aToolKit);
@@ -213,7 +213,7 @@ public class SelectionChangeListener implements XSelectionChangeListener {
xMB.execute();
}
}
-
+
private XChartDocument maChartDocument;
private XComponentContext maContext;
}