summaryrefslogtreecommitdiff
path: root/odk/examples/java/Spreadsheet/ChartTypeChange.java
diff options
context:
space:
mode:
Diffstat (limited to 'odk/examples/java/Spreadsheet/ChartTypeChange.java')
-rw-r--r--odk/examples/java/Spreadsheet/ChartTypeChange.java65
1 files changed, 28 insertions, 37 deletions
diff --git a/odk/examples/java/Spreadsheet/ChartTypeChange.java b/odk/examples/java/Spreadsheet/ChartTypeChange.java
index 7b14ab3716f9..98a143762cab 100644
--- a/odk/examples/java/Spreadsheet/ChartTypeChange.java
+++ b/odk/examples/java/Spreadsheet/ChartTypeChange.java
@@ -151,19 +151,17 @@ public class ChartTypeChange {
*/
public void changeChartType( String stringType, boolean booleanIs3D )
throws Exception {
- XEmbeddedObjectSupplier xEmbeddedObjSupplier = (XEmbeddedObjectSupplier)
- UnoRuntime.queryInterface(XEmbeddedObjectSupplier.class, xtablechart);
+ XEmbeddedObjectSupplier xEmbeddedObjSupplier = UnoRuntime.queryInterface(XEmbeddedObjectSupplier.class, xtablechart);
XInterface xInterface = xEmbeddedObjSupplier.getEmbeddedObject();
- XChartDocument xChartDoc = (XChartDocument)UnoRuntime.queryInterface(
+ XChartDocument xChartDoc = UnoRuntime.queryInterface(
XChartDocument.class, xInterface);
- XDiagram xDiagram = (XDiagram) xChartDoc.getDiagram();
- XMultiServiceFactory xMSF = (XMultiServiceFactory)
- UnoRuntime.queryInterface( XMultiServiceFactory.class, xChartDoc );
+ XDiagram xDiagram = xChartDoc.getDiagram();
+ XMultiServiceFactory xMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, xChartDoc );
Object object = xMSF.createInstance( stringType );
- xDiagram = (XDiagram) UnoRuntime.queryInterface(XDiagram.class, object);
+ xDiagram = UnoRuntime.queryInterface(XDiagram.class, object);
- XPropertySet xPropSet = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet xPropSet = UnoRuntime.queryInterface(
XPropertySet.class, xDiagram );
xPropSet.setPropertyValue( "Dim3D", new Boolean( booleanIs3D ) );
@@ -181,10 +179,9 @@ public class ChartTypeChange {
frames in which components can be loaded. Desktop is the
environment for components which can instanciate within
frames. */
- XComponentLoader xComponentloader = (XComponentLoader)
- UnoRuntime.queryInterface( XComponentLoader.class,
- xMCF.createInstanceWithContext("com.sun.star.frame.Desktop",
- xCompContext ) );
+ XComponentLoader xComponentloader = UnoRuntime.queryInterface( XComponentLoader.class,
+ xMCF.createInstanceWithContext("com.sun.star.frame.Desktop",
+ xCompContext ) );
// Load a Writer document, which will be automaticly displayed
XComponent xComponent = xComponentloader.loadComponentFromURL(
@@ -192,24 +189,21 @@ public class ChartTypeChange {
new PropertyValue[0] );
// Query for the interface XSpreadsheetDocument
- XSpreadsheetDocument xSpreadSheetDocument = ( XSpreadsheetDocument )
- UnoRuntime.queryInterface( XSpreadsheetDocument.class, xComponent );
+ XSpreadsheetDocument xSpreadSheetDocument = UnoRuntime.queryInterface( XSpreadsheetDocument.class, xComponent );
XSpreadsheets xSpreadsheets = xSpreadSheetDocument.getSheets() ;
- XIndexAccess xIndexAccess = (XIndexAccess)
- UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets );
+ XIndexAccess xIndexAccess = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets );
- XSpreadsheet xSpreadsheet = (XSpreadsheet) UnoRuntime.queryInterface(
+ XSpreadsheet xSpreadsheet = UnoRuntime.queryInterface(
XSpreadsheet.class, xIndexAccess.getByIndex(0));
- XTableChartsSupplier xTableChartsSupplier = ( XTableChartsSupplier )
- UnoRuntime.queryInterface( XTableChartsSupplier.class, xSpreadsheet );
+ XTableChartsSupplier xTableChartsSupplier = UnoRuntime.queryInterface( XTableChartsSupplier.class, xSpreadsheet );
- xIndexAccess = (XIndexAccess) UnoRuntime.queryInterface(
+ xIndexAccess = UnoRuntime.queryInterface(
XIndexAccess.class, xTableChartsSupplier.getCharts() );
- this.xtablechart = (XTableChart) UnoRuntime.queryInterface(
+ this.xtablechart = UnoRuntime.queryInterface(
XTableChart.class, xIndexAccess.getByIndex( 0 ) );
}
catch( Exception exception ) {
@@ -227,11 +221,10 @@ public class ChartTypeChange {
frames in which components can be loaded. Desktop is the
environment for components which can instanciate within
frames. */
- XComponentLoader xcomponentloader = ( XComponentLoader )
- UnoRuntime.queryInterface( XComponentLoader.class,
- xMCF.createInstanceWithContext(
- "com.sun.star.frame.Desktop",
- xCompContext ) );
+ XComponentLoader xcomponentloader = UnoRuntime.queryInterface( XComponentLoader.class,
+ xMCF.createInstanceWithContext(
+ "com.sun.star.frame.Desktop",
+ xCompContext ) );
// Create an empty calc document, which will be automaticly displayed
XComponent xComponent = xcomponentloader.loadComponentFromURL(
@@ -239,18 +232,17 @@ public class ChartTypeChange {
new PropertyValue[0] );
// Query for the interface XSpreadsheetDocument
- XSpreadsheetDocument xspreadsheetdocument = ( XSpreadsheetDocument )
- UnoRuntime.queryInterface( XSpreadsheetDocument.class, xComponent );
+ XSpreadsheetDocument xspreadsheetdocument = UnoRuntime.queryInterface( XSpreadsheetDocument.class, xComponent );
// Get all sheets of the spreadsheet document.
XSpreadsheets xspreadsheets = xspreadsheetdocument.getSheets() ;
// Get the index of the spreadsheet document.
- XIndexAccess xindexaccess = (XIndexAccess) UnoRuntime.queryInterface(
+ XIndexAccess xindexaccess = UnoRuntime.queryInterface(
XIndexAccess.class, xspreadsheets );
// Get the first spreadsheet.
- XSpreadsheet xspreadsheet = (XSpreadsheet) UnoRuntime.queryInterface(
+ XSpreadsheet xspreadsheet = UnoRuntime.queryInterface(
XSpreadsheet.class, xindexaccess.getByIndex(0));
// The double array will written to the spreadsheet
@@ -271,7 +263,7 @@ public class ChartTypeChange {
rectangle.Height = 11000;
// Get the cell range of the spreadsheet.
- XCellRange xcellrange = ( XCellRange ) UnoRuntime.queryInterface(
+ XCellRange xcellrange = UnoRuntime.queryInterface(
XCellRange.class, xspreadsheet );
// Create the Unicode of the character for the column name.
@@ -291,7 +283,7 @@ public class ChartTypeChange {
// Get the addressable cell range.
XCellRangeAddressable xcellrangeaddressable =
- ( XCellRangeAddressable ) UnoRuntime.queryInterface(
+ UnoRuntime.queryInterface(
XCellRangeAddressable.class, xcellrangeChart );
// Get the cell range address.
@@ -303,8 +295,7 @@ public class ChartTypeChange {
cellrangeaddressChart[ 0 ] = cellrangeaddress;
// Get the table charts supplier of the spreadsheet.
- XTableChartsSupplier xtablechartssupplier = ( XTableChartsSupplier )
- UnoRuntime.queryInterface( XTableChartsSupplier.class, xspreadsheet );
+ XTableChartsSupplier xtablechartssupplier = UnoRuntime.queryInterface( XTableChartsSupplier.class, xspreadsheet );
// Get all table charts of the spreadsheet.
XTableCharts xtablecharts = xtablechartssupplier.getCharts();
@@ -314,9 +305,9 @@ public class ChartTypeChange {
cellrangeaddressChart, true, true );
// Get the created table chart.
- this.xtablechart = ( XTableChart ) UnoRuntime.queryInterface(
- XTableChart.class, (( XNameAccess ) UnoRuntime.queryInterface(
- XNameAccess.class, xtablecharts ) ).getByName( "Example" ));
+ this.xtablechart = UnoRuntime.queryInterface(
+ XTableChart.class, UnoRuntime.queryInterface(
+ XNameAccess.class, xtablecharts ).getByName( "Example" ));
}
catch( Exception exception ) {
System.err.println( exception );