summaryrefslogtreecommitdiff
path: root/nlpsolver
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-04-17 13:54:28 +0200
committerFridrich Strba <fridrich@documentfoundation.org>2013-04-19 07:51:41 +0000
commitd62425cc27e04a3237cfec2ea2663b8b11284ec8 (patch)
treebc96f74a3460377c4d368ba2d3cbd56b2e8baa89 /nlpsolver
parenta79d43dcd7989ee927de1b8c69ebc2981cc7166e (diff)
Java cleanup, remove unnecessary casts
Change-Id: Id12089bc7df16631737e6acaee0973fb91dd953f Reviewed-on: https://gerrit.libreoffice.org/3431 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'nlpsolver')
-rw-r--r--nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java30
-rw-r--r--nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/ResourceManager.java4
-rw-r--r--nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/BaseDialog.java20
-rw-r--r--nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/EvolutionarySolverStatusUno.java2
-rw-r--r--nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/controls/BaseControl.java8
-rw-r--r--nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/controls/Button.java2
-rw-r--r--nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/controls/ProgressBar.java2
7 files changed, 34 insertions, 34 deletions
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java
index 520a4eaa3654..60bdcf9f7272 100644
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java
@@ -86,7 +86,7 @@ public abstract class BaseNLPSolver extends WeakBase
m_componentFactory = xContext.getServiceManager();
try {
Object toolkit = m_componentFactory.createInstanceWithContext("com.sun.star.awt.Toolkit", xContext);
- m_xReschedule = (XReschedule) UnoRuntime.queryInterface(XReschedule.class, toolkit);
+ m_xReschedule = UnoRuntime.queryInterface(XReschedule.class, toolkit);
} catch (Exception ex) {
Logger.getLogger(BaseNLPSolver.class.getName()).log(Level.SEVERE, null, ex);
}
@@ -145,7 +145,7 @@ public abstract class BaseNLPSolver extends WeakBase
public void setDocument(XSpreadsheetDocument document) {
m_document = document;
- m_xModel = (XModel) UnoRuntime.queryInterface(XModel.class, m_document);
+ m_xModel = UnoRuntime.queryInterface(XModel.class, m_document);
}
public CellAddress getObjective() {
@@ -348,8 +348,8 @@ public abstract class BaseNLPSolver extends WeakBase
protected XCell getCell(int col, int row, int sheet) {
try {
XSpreadsheets xSpreadsheets = m_document.getSheets();
- XIndexAccess xSheetIndex = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
- XSpreadsheet xSpreadsheet = (XSpreadsheet) UnoRuntime.queryInterface(XSpreadsheet.class, xSheetIndex.getByIndex(sheet));
+ XIndexAccess xSheetIndex = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ XSpreadsheet xSpreadsheet = UnoRuntime.queryInterface(XSpreadsheet.class, xSheetIndex.getByIndex(sheet));
return xSpreadsheet.getCellByPosition(col, row);
} catch (IndexOutOfBoundsException ex) {
Logger.getLogger(BaseNLPSolver.class.getName()).log(Level.SEVERE, null, ex);
@@ -368,9 +368,9 @@ public abstract class BaseNLPSolver extends WeakBase
protected XCellRangeData getCellRangeData(int sheet, int startCol, int startRow, int endCol, int endRow) {
try {
XSpreadsheets xSpreadsheets = m_document.getSheets();
- XIndexAccess xSheetIndex = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
- XSpreadsheet xSpreadsheet = (XSpreadsheet) UnoRuntime.queryInterface(XSpreadsheet.class, xSheetIndex.getByIndex(sheet));
- return (XCellRangeData) UnoRuntime.queryInterface(XCellRangeData.class, xSpreadsheet.getCellRangeByPosition(startCol, startRow, endCol, endRow));
+ XIndexAccess xSheetIndex = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ XSpreadsheet xSpreadsheet = UnoRuntime.queryInterface(XSpreadsheet.class, xSheetIndex.getByIndex(sheet));
+ return UnoRuntime.queryInterface(XCellRangeData.class, xSpreadsheet.getCellRangeByPosition(startCol, startRow, endCol, endRow));
} catch (IndexOutOfBoundsException ex) {
Logger.getLogger(BaseNLPSolver.class.getName()).log(Level.SEVERE, null, ex);
} catch (WrappedTargetException ex) {
@@ -388,9 +388,9 @@ public abstract class BaseNLPSolver extends WeakBase
protected XChartDataArray getChartDataArray(int sheet, int startCol, int startRow, int endCol, int endRow) {
try {
XSpreadsheets xSpreadsheets = m_document.getSheets();
- XIndexAccess xSheetIndex = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
- XSpreadsheet xSpreadsheet = (XSpreadsheet) UnoRuntime.queryInterface(XSpreadsheet.class, xSheetIndex.getByIndex(sheet));
- return (XChartDataArray) UnoRuntime.queryInterface(XChartDataArray.class, xSpreadsheet.getCellRangeByPosition(startCol, startRow, endCol, endRow));
+ XIndexAccess xSheetIndex = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ XSpreadsheet xSpreadsheet = UnoRuntime.queryInterface(XSpreadsheet.class, xSheetIndex.getByIndex(sheet));
+ return UnoRuntime.queryInterface(XChartDataArray.class, xSpreadsheet.getCellRangeByPosition(startCol, startRow, endCol, endRow));
} catch (IndexOutOfBoundsException ex) {
Logger.getLogger(BaseNLPSolver.class.getName()).log(Level.SEVERE, null, ex);
} catch (WrappedTargetException ex) {
@@ -494,17 +494,17 @@ public abstract class BaseNLPSolver extends WeakBase
m_xModel.unlockControllers();
try {
- XIndexAccess xSpreadsheets = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, m_document.getSheets());
+ XIndexAccess xSpreadsheets = UnoRuntime.queryInterface(XIndexAccess.class, m_document.getSheets());
int sheets = xSpreadsheets.getCount();
for (int i = 0; i < sheets; i++) {
Object sheet = xSpreadsheets.getByIndex(i);
- XTableChartsSupplier xTableChartsSupplier = (XTableChartsSupplier) UnoRuntime.queryInterface(XTableChartsSupplier.class, sheet);
- XIndexAccess xCharts = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTableChartsSupplier.getCharts());
+ XTableChartsSupplier xTableChartsSupplier = UnoRuntime.queryInterface(XTableChartsSupplier.class, sheet);
+ XIndexAccess xCharts = UnoRuntime.queryInterface(XIndexAccess.class, xTableChartsSupplier.getCharts());
int charts = xCharts.getCount();
for (int j = 0; j < charts; j++) {
Object chart = xCharts.getByIndex(j);
- XEmbeddedObjectSupplier xChartObjects = (XEmbeddedObjectSupplier) UnoRuntime.queryInterface(XEmbeddedObjectSupplier.class, chart);
- XModel xChartModel = (XModel) UnoRuntime.queryInterface(XModel.class, xChartObjects.getEmbeddedObject());
+ XEmbeddedObjectSupplier xChartObjects = UnoRuntime.queryInterface(XEmbeddedObjectSupplier.class, chart);
+ XModel xChartModel = UnoRuntime.queryInterface(XModel.class, xChartObjects.getEmbeddedObject());
if (lock)
xChartModel.lockControllers();
else
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/ResourceManager.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/ResourceManager.java
index 61935d28e63a..6780826a43ff 100644
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/ResourceManager.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/ResourceManager.java
@@ -60,12 +60,12 @@ public class ResourceManager {
m_resourceBaseUrl = m_oxtRoot + relativeResourceBaseUrl;
try {
- XMultiServiceFactory xConfig = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class,
+ XMultiServiceFactory xConfig = UnoRuntime.queryInterface(XMultiServiceFactory.class,
m_context.getServiceManager().createInstanceWithContext("com.sun.star.configuration.ConfigurationProvider", m_context));
Object[] args = new Object[1];
args[0] = new PropertyValue("nodepath", 0, "/org.openoffice.Setup/L10N", PropertyState.DIRECT_VALUE);
- XPropertySet xConfigProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,
+ XPropertySet xConfigProps = UnoRuntime.queryInterface(XPropertySet.class,
xConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", args));
String[] locale = AnyConverter.toString(xConfigProps.getPropertyValue("ooLocale")).split("-");
String lang = locale[0];
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/BaseDialog.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/BaseDialog.java
index 45ec08c6fe0f..b0a1ebd303ea 100644
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/BaseDialog.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/BaseDialog.java
@@ -76,9 +76,9 @@ public abstract class BaseDialog extends BaseControl {
public XFrame getCurrentFrame() {
try {
Object oDesktop = xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", context);
- XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, oDesktop);
+ XDesktop xDesktop = UnoRuntime.queryInterface(XDesktop.class, oDesktop);
XComponent xComponent = xDesktop.getCurrentComponent();
- XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xComponent);
+ XModel xModel = UnoRuntime.queryInterface(XModel.class, xComponent);
XController xController = xModel.getCurrentController();
return xController.getFrame();
} catch (Exception e) {
@@ -96,26 +96,26 @@ public abstract class BaseDialog extends BaseControl {
try {
xMCF = context.getServiceManager();
setUnoModel(xMCF.createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", context));
- xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, getUnoModel());
+ xMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, getUnoModel());
setProperty("Title", title);
setPosition(x, y);
setSize(width, height);
unoControl = xMCF.createInstanceWithContext("com.sun.star.awt.UnoControlDialog", context);
- XControl xControl = (XControl)UnoRuntime.queryInterface(XControl.class, unoControl);
- XControlModel xControlModel = (XControlModel)UnoRuntime.queryInterface(XControlModel.class, getUnoModel());
+ XControl xControl = UnoRuntime.queryInterface(XControl.class, unoControl);
+ XControlModel xControlModel = UnoRuntime.queryInterface(XControlModel.class, getUnoModel());
xControl.setModel(xControlModel);
toolkit = xMCF.createInstanceWithContext("com.sun.star.awt.Toolkit", context);
- XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, toolkit);
- xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, unoControl);
+ XToolkit xToolkit = UnoRuntime.queryInterface(XToolkit.class, toolkit);
+ xWindow = UnoRuntime.queryInterface(XWindow.class, unoControl);
xWindow.setVisible(false);
- XWindowPeer xParentWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, getCurrentFrame().getComponentWindow());
+ XWindowPeer xParentWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, getCurrentFrame().getComponentWindow());
xControl.createPeer(xToolkit, xParentWindowPeer);
xWindowPeer = xControl.getPeer();
- xDialog = (XDialog) UnoRuntime.queryInterface(XDialog.class, unoControl);
+ xDialog = UnoRuntime.queryInterface(XDialog.class, unoControl);
//center if necessary
if (x < 0 || y < 0) {
@@ -137,7 +137,7 @@ public abstract class BaseDialog extends BaseControl {
@Override
protected void finalize() throws Throwable {
- XComponent xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, unoControl);
+ XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, unoControl);
xComponent.dispose();
super.finalize();
}
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/EvolutionarySolverStatusUno.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/EvolutionarySolverStatusUno.java
index 8cf665299379..6cb8adfaaf9a 100644
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/EvolutionarySolverStatusUno.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/EvolutionarySolverStatusUno.java
@@ -274,7 +274,7 @@ public class EvolutionarySolverStatusUno extends BaseDialog
}
public void dispose() {
- XComponent component = (XComponent) UnoRuntime.queryInterface(XComponent.class, xDialog);
+ XComponent component = UnoRuntime.queryInterface(XComponent.class, xDialog);
component.dispose();
}
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/controls/BaseControl.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/controls/BaseControl.java
index d5c395c5b846..84c38d66e7fd 100644
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/controls/BaseControl.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/controls/BaseControl.java
@@ -62,7 +62,7 @@ public abstract class BaseControl {
*/
protected void setUnoModel(Object unoModel) {
this.unoModel = unoModel;
- properties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, unoModel);
+ properties = UnoRuntime.queryInterface(XPropertySet.class, unoModel);
}
public Object getUnoControl() {
@@ -73,10 +73,10 @@ public abstract class BaseControl {
//TODO : remove from existing parentControl
try {
String name = getName();
- XNameContainer nameContainer = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, parentControl.unoModel);
+ XNameContainer nameContainer = UnoRuntime.queryInterface(XNameContainer.class, parentControl.unoModel);
nameContainer.insertByName(name, unoModel);
- XControlContainer controlContainer = (XControlContainer) UnoRuntime.queryInterface(XControlContainer.class, parentControl.unoControl);
+ XControlContainer controlContainer = UnoRuntime.queryInterface(XControlContainer.class, parentControl.unoControl);
unoControl = controlContainer.getControl(name);
this.parentControl = parentControl;
@@ -138,7 +138,7 @@ public abstract class BaseControl {
}
public void setVisible(boolean visible) {
- XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, unoControl);
+ XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, unoControl);
xWindow.setVisible(visible);
}
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/controls/Button.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/controls/Button.java
index 46f60f380097..bf59d5210bdc 100644
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/controls/Button.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/controls/Button.java
@@ -59,7 +59,7 @@ public class Button extends LabeledControl {
@Override
public void setParentControl(BaseControl parentControl) {
super.setParentControl(parentControl);
- xButton = (XButton) UnoRuntime.queryInterface(XButton.class, unoControl);
+ xButton = UnoRuntime.queryInterface(XButton.class, unoControl);
}
public void addActionListener(XActionListener actionListener) {
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/controls/ProgressBar.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/controls/ProgressBar.java
index 8b17a597a6f5..a62ea7d9fab3 100644
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/controls/ProgressBar.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/dialogs/controls/ProgressBar.java
@@ -57,7 +57,7 @@ public class ProgressBar extends BaseControl {
@Override
public void setParentControl(BaseControl parentControl) {
super.setParentControl(parentControl);
- m_progressBar = (XProgressBar) UnoRuntime.queryInterface(XProgressBar.class, unoControl);
+ m_progressBar = UnoRuntime.queryInterface(XProgressBar.class, unoControl);
}
public void setRange(int min, int max) {