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>
This commit is contained in:
parent
a79d43dcd7
commit
d62425cc27
@ -65,17 +65,17 @@ public final class TestAcquire {
|
||||
WaitUnreachable u;
|
||||
|
||||
u = new WaitUnreachable(new XInterface() {});
|
||||
test.setInterfaceToInterface((XInterface) u.get());
|
||||
test.setInterfaceToInterface(u.get());
|
||||
receive(test.getInterfaceFromInterface());
|
||||
test.clearInterface();
|
||||
u.waitUnreachable();
|
||||
u = new WaitUnreachable(new XBase() {});
|
||||
test.setInterfaceToInterface((XBase) u.get());
|
||||
test.setInterfaceToInterface(u.get());
|
||||
receive(test.getInterfaceFromInterface());
|
||||
test.clearInterface();
|
||||
u.waitUnreachable();
|
||||
u = new WaitUnreachable(new XDerived() {});
|
||||
test.setInterfaceToInterface((XDerived) u.get());
|
||||
test.setInterfaceToInterface(u.get());
|
||||
receive(test.getInterfaceFromInterface());
|
||||
test.clearInterface();
|
||||
u.waitUnreachable();
|
||||
@ -126,13 +126,13 @@ public final class TestAcquire {
|
||||
u.waitUnreachable();
|
||||
|
||||
u = new WaitUnreachable(new XInterface() {});
|
||||
receive(test.roundTripInterfaceToInterface((XInterface) u.get()));
|
||||
receive(test.roundTripInterfaceToInterface(u.get()));
|
||||
u.waitUnreachable();
|
||||
u = new WaitUnreachable(new XBase() {});
|
||||
receive(test.roundTripInterfaceToInterface((XBase) u.get()));
|
||||
receive(test.roundTripInterfaceToInterface(u.get()));
|
||||
u.waitUnreachable();
|
||||
u = new WaitUnreachable(new XDerived() {});
|
||||
receive(test.roundTripInterfaceToInterface((XDerived) u.get()));
|
||||
receive(test.roundTripInterfaceToInterface(u.get()));
|
||||
u.waitUnreachable();
|
||||
|
||||
u = new WaitUnreachable(new XBase() {});
|
||||
|
@ -117,7 +117,7 @@ public class testclient
|
||||
{
|
||||
System.out.println( "after connect" );
|
||||
String rootOid = "OfficeDaemon.Factory";
|
||||
com.sun.star.uno.IBridge bridge = (IBridge ) UnoRuntime.getBridgeByName(
|
||||
com.sun.star.uno.IBridge bridge = UnoRuntime.getBridgeByName(
|
||||
"java",
|
||||
null,
|
||||
"remote",
|
||||
|
@ -113,7 +113,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
else
|
||||
mxChartModel = createChartModel();
|
||||
|
||||
mxOldDoc = (XChartDocument) UnoRuntime.queryInterface(
|
||||
mxOldDoc = UnoRuntime.queryInterface(
|
||||
XChartDocument.class, mxChartModel );
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
|
||||
public void after()
|
||||
{
|
||||
XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(
|
||||
XCloseable xCloseable = UnoRuntime.queryInterface(
|
||||
XCloseable.class, mxChartModel );
|
||||
assure( "document is no XCloseable", xCloseable != null );
|
||||
|
||||
@ -146,7 +146,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
{
|
||||
try
|
||||
{
|
||||
XPropertySet xDocProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet xDocProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, mxOldDoc );
|
||||
assure( "Chart Document is no XPropertySet", xDocProp != null );
|
||||
xDocProp.setPropertyValue( "HasMainTitle", new Boolean( true ));
|
||||
@ -154,7 +154,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
xDocProp.getPropertyValue( "HasMainTitle" )));
|
||||
|
||||
XShape xTitleShape = mxOldDoc.getTitle();
|
||||
XPropertySet xTitleProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet xTitleProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, xTitleShape );
|
||||
|
||||
// set property via old API
|
||||
@ -196,7 +196,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
{
|
||||
try
|
||||
{
|
||||
XPropertySet xDocProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet xDocProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, mxOldDoc );
|
||||
assure( "Chart Document is no XPropertySet", xDocProp != null );
|
||||
xDocProp.setPropertyValue( "HasSubTitle", new Boolean( true ));
|
||||
@ -204,7 +204,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
xDocProp.getPropertyValue( "HasSubTitle" )));
|
||||
|
||||
XShape xTitleShape = mxOldDoc.getSubTitle();
|
||||
XPropertySet xTitleProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet xTitleProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, xTitleShape );
|
||||
|
||||
// set Property via old API
|
||||
@ -245,7 +245,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
XDiagram xDia = mxOldDoc.getDiagram();
|
||||
if( xDia != null )
|
||||
{
|
||||
X3DDisplay xDisp = (X3DDisplay) UnoRuntime.queryInterface(
|
||||
X3DDisplay xDisp = UnoRuntime.queryInterface(
|
||||
X3DDisplay.class, xDia );
|
||||
assure( "X3DDisplay not supported", xDisp != null );
|
||||
|
||||
@ -263,7 +263,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
"com.sun.star.chart.BarDiagram" ));
|
||||
|
||||
// Diagram properties
|
||||
xProp = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, xDia );
|
||||
xProp = UnoRuntime.queryInterface( XPropertySet.class, xDia );
|
||||
assure( "Diagram is no property set", xProp != null );
|
||||
|
||||
// y-axis
|
||||
@ -295,7 +295,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
xProp.getPropertyValue( "HasSecondaryYAxis" ));
|
||||
assure( "Adding a second y-axis does not work", bNewSecYAxisValue == bSecondaryYAxis );
|
||||
|
||||
XTwoAxisYSupplier xSecYAxisSuppl = (XTwoAxisYSupplier) UnoRuntime.queryInterface(
|
||||
XTwoAxisYSupplier xSecYAxisSuppl = UnoRuntime.queryInterface(
|
||||
XTwoAxisYSupplier.class, xDia );
|
||||
assure( "XTwoAxisYSupplier not implemented", xSecYAxisSuppl != null );
|
||||
assure( "No second y-axis found", xSecYAxisSuppl.getSecondaryYAxis() != null );
|
||||
@ -303,7 +303,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
|
||||
// move diagram
|
||||
{
|
||||
XShape xDiagramShape = (XShape) UnoRuntime.queryInterface(
|
||||
XShape xDiagramShape = UnoRuntime.queryInterface(
|
||||
XShape.class, xDia );
|
||||
|
||||
Point aOldPos = xDiagramShape.getPosition();
|
||||
@ -323,7 +323,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
|
||||
// size diagram
|
||||
{
|
||||
XShape xDiagramShape = (XShape) UnoRuntime.queryInterface(
|
||||
XShape xDiagramShape = UnoRuntime.queryInterface(
|
||||
XShape.class, xDia );
|
||||
|
||||
Size aOldSize = xDiagramShape.getSize();
|
||||
@ -354,7 +354,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
{
|
||||
try
|
||||
{
|
||||
XAxisYSupplier xYAxisSuppl = (XAxisYSupplier) UnoRuntime.queryInterface(
|
||||
XAxisYSupplier xYAxisSuppl = UnoRuntime.queryInterface(
|
||||
XAxisYSupplier.class, mxOldDoc.getDiagram() );
|
||||
assure( "Diagram is no y-axis supplier", xYAxisSuppl != null );
|
||||
|
||||
@ -452,7 +452,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
XShape xLegend = mxOldDoc.getLegend();
|
||||
assure( "No Legend returned", xLegend != null );
|
||||
|
||||
XPropertySet xLegendProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet xLegendProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, xLegend );
|
||||
assure( "Legend is no property set", xLegendProp != null );
|
||||
|
||||
@ -532,7 +532,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
|
||||
public void testChartType()
|
||||
{
|
||||
XMultiServiceFactory xFact = (XMultiServiceFactory) UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory xFact = UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory.class, mxOldDoc );
|
||||
assure( "document is no factory", xFact != null );
|
||||
|
||||
@ -553,13 +553,13 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
|
||||
if( bServiceFound )
|
||||
{
|
||||
XDiagram xDia = (XDiagram) UnoRuntime.queryInterface(
|
||||
XDiagram xDia = UnoRuntime.queryInterface(
|
||||
XDiagram.class, xFact.createInstance( aMyServiceName ));
|
||||
assure( aMyServiceName + " could not be created", xDia != null );
|
||||
|
||||
mxOldDoc.setDiagram( xDia );
|
||||
|
||||
XPropertySet xDiaProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet xDiaProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, xDia );
|
||||
assure( "Diagram is no XPropertySet", xDiaProp != null );
|
||||
|
||||
@ -599,11 +599,11 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
public void testAggregation()
|
||||
{
|
||||
// query to new type
|
||||
XChartDocument xDiaProv = (XChartDocument) UnoRuntime.queryInterface(
|
||||
XChartDocument xDiaProv = UnoRuntime.queryInterface(
|
||||
XChartDocument.class, mxOldDoc );
|
||||
assure( "query to new interface failed", xDiaProv != null );
|
||||
|
||||
com.sun.star.chart.XChartDocument xDoc = (com.sun.star.chart.XChartDocument) UnoRuntime.queryInterface(
|
||||
com.sun.star.chart.XChartDocument xDoc = UnoRuntime.queryInterface(
|
||||
com.sun.star.chart.XChartDocument.class, xDiaProv );
|
||||
assure( "querying back to old interface failed", xDoc != null );
|
||||
}
|
||||
@ -616,7 +616,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
{
|
||||
XDiagram xDia = mxOldDoc.getDiagram();
|
||||
assure( "Invalid Diagram", xDia != null );
|
||||
XMultiServiceFactory xFact = (XMultiServiceFactory) UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory xFact = UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory.class, mxOldDoc );
|
||||
assure( "document is no factory", xFact != null );
|
||||
|
||||
@ -632,7 +632,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
|
||||
// note: the FillGradient property is optional, however it was
|
||||
// supported in the old chart's API
|
||||
XNameContainer xGradientTable = (XNameContainer) UnoRuntime.queryInterface(
|
||||
XNameContainer xGradientTable = UnoRuntime.queryInterface(
|
||||
XNameContainer.class,
|
||||
xFact.createInstance( "com.sun.star.drawing.GradientTable" ));
|
||||
assure( "no gradient table", xGradientTable != null );
|
||||
@ -674,7 +674,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
|
||||
// note: the FillHatch property is optional, however it was
|
||||
// supported in the old chart's API
|
||||
XNameContainer xHatchTable = (XNameContainer) UnoRuntime.queryInterface(
|
||||
XNameContainer xHatchTable = UnoRuntime.queryInterface(
|
||||
XNameContainer.class,
|
||||
xFact.createInstance( "com.sun.star.drawing.HatchTable" ));
|
||||
assure( "no hatch table", xHatchTable != null );
|
||||
@ -735,7 +735,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
{
|
||||
try
|
||||
{
|
||||
XPropertySet xDiaProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet xDiaProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, mxOldDoc.getDiagram() );
|
||||
|
||||
ChartDataRowSource eNewSource = ChartDataRowSource.ROWS;
|
||||
@ -766,7 +766,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
|
||||
|
||||
XChartData xData = mxOldDoc.getData();
|
||||
XChartDataArray xDataArray = (XChartDataArray) UnoRuntime.queryInterface(
|
||||
XChartDataArray xDataArray = UnoRuntime.queryInterface(
|
||||
XChartDataArray.class, xData );
|
||||
assure( "document has no XChartDataArray", xDataArray != null );
|
||||
|
||||
@ -791,18 +791,18 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
{
|
||||
setStockData_Type4();
|
||||
|
||||
XMultiServiceFactory xFact = (XMultiServiceFactory) UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory xFact = UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory.class, mxOldDoc );
|
||||
assure( "document is no factory", xFact != null );
|
||||
|
||||
String aMyServiceName = new String( "com.sun.star.chart.StockDiagram" );
|
||||
XDiagram xDia = (XDiagram) UnoRuntime.queryInterface(
|
||||
XDiagram xDia = UnoRuntime.queryInterface(
|
||||
XDiagram.class, xFact.createInstance( aMyServiceName ));
|
||||
assure( aMyServiceName + " could not be created", xDia != null );
|
||||
|
||||
mxOldDoc.setDiagram( xDia );
|
||||
|
||||
XPropertySet xDiaProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet xDiaProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, xDia );
|
||||
assure( "Diagram is no XPropertySet", xDiaProp != null );
|
||||
|
||||
@ -813,7 +813,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
assure( "Has UpDown", AnyConverter.toBoolean( xDiaProp.getPropertyValue( "UpDown" )));
|
||||
|
||||
// MinMaxLine
|
||||
XStatisticDisplay xMinMaxProvider = (XStatisticDisplay) UnoRuntime.queryInterface(
|
||||
XStatisticDisplay xMinMaxProvider = UnoRuntime.queryInterface(
|
||||
XStatisticDisplay.class, xDia );
|
||||
assure( "Diagram is no XStatisticDisplay", xMinMaxProvider != null );
|
||||
XPropertySet xMinMaxProp = xMinMaxProvider.getMinMaxLine();
|
||||
@ -837,7 +837,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
{
|
||||
try
|
||||
{
|
||||
XMultiServiceFactory xFact = (XMultiServiceFactory) UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory xFact = UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory.class, mxOldDoc );
|
||||
assure( "document is no factory", xFact != null );
|
||||
|
||||
@ -873,7 +873,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
"First Row", "Second Row", "Third Row"
|
||||
};
|
||||
|
||||
XPropertySet xDiaProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet xDiaProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, mxOldDoc.getDiagram() );
|
||||
ChartDataRowSource eNewSource = ChartDataRowSource.ROWS;
|
||||
xDiaProp.setPropertyValue( "DataRowSource", eNewSource );
|
||||
@ -883,7 +883,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
xDiaProp.getPropertyValue( "DataRowSource" )) == eNewSource );
|
||||
|
||||
XChartData xData = mxOldDoc.getData();
|
||||
XChartDataArray xDataArray = (XChartDataArray) UnoRuntime.queryInterface(
|
||||
XChartDataArray xDataArray = UnoRuntime.queryInterface(
|
||||
XChartDataArray.class, xData );
|
||||
assure( "document has no XChartDataArray", xDataArray != null );
|
||||
|
||||
@ -900,7 +900,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
|
||||
// refetch data
|
||||
xData = mxOldDoc.getData();
|
||||
xDataArray = (XChartDataArray) UnoRuntime.queryInterface(
|
||||
xDataArray = UnoRuntime.queryInterface(
|
||||
XChartDataArray.class, xData );
|
||||
assure( "document has no XChartDataArray", xDataArray != null );
|
||||
|
||||
@ -945,11 +945,11 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
XModel aResult = null;
|
||||
try
|
||||
{
|
||||
XComponentLoader aLoader = (XComponentLoader) UnoRuntime.queryInterface(
|
||||
XComponentLoader aLoader = UnoRuntime.queryInterface(
|
||||
XComponentLoader.class,
|
||||
((XMultiServiceFactory)param.getMSF()).createInstance( "com.sun.star.frame.Desktop" ) );
|
||||
|
||||
aResult = (XModel) UnoRuntime.queryInterface(
|
||||
aResult = UnoRuntime.queryInterface(
|
||||
XModel.class,
|
||||
aLoader.loadComponentFromURL( "private:factory/" + sDocType,
|
||||
"_blank",
|
||||
@ -972,7 +972,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
XModel aResult = null;
|
||||
try
|
||||
{
|
||||
aResult = (XModel) UnoRuntime.queryInterface(
|
||||
aResult = UnoRuntime.queryInterface(
|
||||
XModel.class,
|
||||
((XMultiServiceFactory)param.getMSF()).createInstance( "com.sun.star.comp.chart2.ChartModel" ) );
|
||||
}
|
||||
@ -991,7 +991,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
|
||||
{
|
||||
XComponentContext xResult = null;
|
||||
|
||||
XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet xProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, xFact );
|
||||
if( xProp != null )
|
||||
try
|
||||
|
@ -97,6 +97,7 @@ public class StorageAccess implements org.hsqldb.lib.Storage {
|
||||
return readonly;
|
||||
}
|
||||
|
||||
@SuppressWarnings("cast")
|
||||
public long readLong() throws java.io.IOException {
|
||||
return (((long) readInt()) << 32) + (((long) readInt()) & 0xFFFFFFFFL);
|
||||
}
|
||||
|
@ -294,7 +294,7 @@ public class PropertyBag extends TestCase
|
||||
{ "BoolValue", Boolean.TRUE },
|
||||
{ "StringValue", "" },
|
||||
{ "IntegerValue", Integer.valueOf( 3 ) },
|
||||
{ "InterfaceValue", (XInterface)m_bag }
|
||||
{ "InterfaceValue", m_bag }
|
||||
};
|
||||
for ( int i=0; i<properties.length; ++i )
|
||||
{
|
||||
|
@ -78,9 +78,9 @@ public class UISettings extends TestCase
|
||||
tableViewController.getCurrentControl().getModel() );
|
||||
|
||||
// verify the properties
|
||||
assertEquals( "wrong font name", "Andale Sans UI", (String)tableControlModel.getPropertyValue( "FontName" ) );
|
||||
assertEquals( "wrong font height", (float)20, ((Float)tableControlModel.getPropertyValue( "FontHeight" )).floatValue(), 0 );
|
||||
assertEquals( "wrong font slant", FontSlant.ITALIC, (FontSlant)tableControlModel.getPropertyValue( "FontSlant" ) );
|
||||
assertEquals( "wrong font name", "Andale Sans UI", tableControlModel.getPropertyValue( "FontName" ) );
|
||||
assertEquals( "wrong font height", 20, ((Float)tableControlModel.getPropertyValue( "FontHeight" )).floatValue(), 0 );
|
||||
assertEquals( "wrong font slant", FontSlant.ITALIC, tableControlModel.getPropertyValue( "FontSlant" ) );
|
||||
|
||||
// close the doc
|
||||
database.saveAndClose();
|
||||
|
@ -89,7 +89,7 @@ public class OptionsEventHandler {
|
||||
//We get the com.sun.star.container.XNameAccess from the instance of
|
||||
//ConfigurationUpdateAccess and save it for later use.
|
||||
try {
|
||||
m_xAccessLeaves = (XNameAccess) UnoRuntime.queryInterface(
|
||||
m_xAccessLeaves = UnoRuntime.queryInterface(
|
||||
XNameAccess.class, xConfig.createInstanceWithArguments(
|
||||
"com.sun.star.configuration.ConfigurationUpdateAccess", args));
|
||||
|
||||
@ -185,7 +185,7 @@ public class OptionsEventHandler {
|
||||
|
||||
//To access the separate controls of the window we need to obtain the
|
||||
//XControlContainer from the window implementation
|
||||
XControlContainer xContainer = (XControlContainer) UnoRuntime.queryInterface(
|
||||
XControlContainer xContainer = UnoRuntime.queryInterface(
|
||||
XControlContainer.class, aWindow);
|
||||
if (xContainer == null)
|
||||
throw new com.sun.star.uno.Exception(
|
||||
@ -209,7 +209,7 @@ public class OptionsEventHandler {
|
||||
//From the control we get the model, which in turn supports the
|
||||
//XPropertySet interface, which we finally use to get the data from
|
||||
//the control.
|
||||
XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet xProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, xControl.getModel());
|
||||
|
||||
if (xProp == null)
|
||||
@ -235,7 +235,7 @@ public class OptionsEventHandler {
|
||||
//com.sun.star.container.XNameAccess. The XNameAccess is used to get the
|
||||
//particular registry node which represents this options page.
|
||||
//Fortunately the name of the window is the same as the registry node.
|
||||
XPropertySet xLeaf = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet xLeaf = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, m_xAccessLeaves.getByName(sWindowName));
|
||||
if (xLeaf == null)
|
||||
throw new com.sun.star.uno.Exception(
|
||||
@ -247,7 +247,7 @@ public class OptionsEventHandler {
|
||||
|
||||
//Committing the changes will cause or changes to be written to the registry.
|
||||
XChangesBatch xUpdateCommit =
|
||||
(XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class, m_xAccessLeaves);
|
||||
UnoRuntime.queryInterface(XChangesBatch.class, m_xAccessLeaves);
|
||||
xUpdateCommit.commitChanges();
|
||||
}
|
||||
|
||||
@ -264,7 +264,7 @@ public class OptionsEventHandler {
|
||||
|
||||
//To acces the separate controls of the window we need to obtain the
|
||||
//XControlContainer from window implementation
|
||||
XControlContainer xContainer = (XControlContainer) UnoRuntime.queryInterface(
|
||||
XControlContainer xContainer = UnoRuntime.queryInterface(
|
||||
XControlContainer.class, aWindow);
|
||||
if (xContainer == null)
|
||||
throw new com.sun.star.uno.Exception(
|
||||
@ -280,7 +280,7 @@ public class OptionsEventHandler {
|
||||
//of com.sun.star.configuration.ConfigurationUpdateAccess which supports
|
||||
//com.sun.star.container.XNameAccess. We obtain now the section
|
||||
//of the registry which is assigned to this options page.
|
||||
XPropertySet xLeaf = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet xLeaf = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, m_xAccessLeaves.getByName(sWindowName));
|
||||
if (xLeaf == null)
|
||||
throw new com.sun.star.uno.Exception(
|
||||
@ -304,7 +304,7 @@ public class OptionsEventHandler {
|
||||
//From the control we get the model, which in turn supports the
|
||||
//XPropertySet interface, which we finally use to set the data at the
|
||||
//control
|
||||
XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet xProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, xControl.getModel());
|
||||
|
||||
if (xProp == null)
|
||||
@ -329,7 +329,7 @@ public class OptionsEventHandler {
|
||||
|
||||
//We need to get the control model of the window. Therefore the first step is
|
||||
//to query for it.
|
||||
XControl xControlDlg = (XControl) UnoRuntime.queryInterface(
|
||||
XControl xControlDlg = UnoRuntime.queryInterface(
|
||||
XControl.class, aWindow);
|
||||
|
||||
if (xControlDlg == null)
|
||||
@ -343,7 +343,7 @@ public class OptionsEventHandler {
|
||||
"Cannot obtain XControlModel from XWindow in method external_event.", this);
|
||||
//The model itself does not provide any information except that its
|
||||
//implementation supports XPropertySet which is used to access the data.
|
||||
XPropertySet xPropDlg = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet xPropDlg = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, xModelDlg);
|
||||
if (xPropDlg == null)
|
||||
throw new com.sun.star.uno.Exception(
|
||||
|
@ -75,7 +75,7 @@ public class ConsoleWait implements com.sun.star.lang.XEventListener
|
||||
public ConsoleWait( Object _disposable )
|
||||
{
|
||||
m_disposable = _disposable;
|
||||
XComponent component = (XComponent)UnoRuntime.queryInterface( XComponent.class, _disposable );
|
||||
XComponent component = UnoRuntime.queryInterface( XComponent.class, _disposable );
|
||||
if ( component != null )
|
||||
component.addEventListener( this );
|
||||
}
|
||||
|
@ -45,12 +45,12 @@ public class Frame implements XFrame,
|
||||
{
|
||||
if ( _frameComponent != null )
|
||||
{
|
||||
m_frame = (XFrame)UnoRuntime.queryInterface( XFrame.class, _frameComponent );
|
||||
m_dispatchProvider = (XDispatchProvider)UnoRuntime.queryInterface( XDispatchProvider.class, _frameComponent );
|
||||
m_dispatchProviderInterception = (XDispatchProviderInterception)UnoRuntime.queryInterface( XDispatchProviderInterception.class, _frameComponent );
|
||||
m_framesSupplier = (XFramesSupplier)UnoRuntime.queryInterface( XFramesSupplier.class, _frameComponent );
|
||||
m_statusIndicatorFactory = (XStatusIndicatorFactory)UnoRuntime.queryInterface( XStatusIndicatorFactory.class, _frameComponent );
|
||||
m_closeable = (XCloseable)UnoRuntime.queryInterface( XCloseable.class, _frameComponent );
|
||||
m_frame = UnoRuntime.queryInterface( XFrame.class, _frameComponent );
|
||||
m_dispatchProvider = UnoRuntime.queryInterface( XDispatchProvider.class, _frameComponent );
|
||||
m_dispatchProviderInterception = UnoRuntime.queryInterface( XDispatchProviderInterception.class, _frameComponent );
|
||||
m_framesSupplier = UnoRuntime.queryInterface( XFramesSupplier.class, _frameComponent );
|
||||
m_statusIndicatorFactory = UnoRuntime.queryInterface( XStatusIndicatorFactory.class, _frameComponent );
|
||||
m_closeable = UnoRuntime.queryInterface( XCloseable.class, _frameComponent );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class MethodHandler implements XPropertyHandler
|
||||
|
||||
try
|
||||
{
|
||||
m_introspection = (XIntrospection)UnoRuntime.queryInterface( XIntrospection.class,
|
||||
m_introspection = UnoRuntime.queryInterface( XIntrospection.class,
|
||||
m_context.getServiceManager().createInstanceWithContext( "com.sun.star.beans.Introspection", m_context )
|
||||
);
|
||||
}
|
||||
@ -92,7 +92,7 @@ public class MethodHandler implements XPropertyHandler
|
||||
descriptor.IndentLevel = 0;
|
||||
try
|
||||
{
|
||||
XPropertyControl control = (XPropertyControl)UnoRuntime.queryInterface(
|
||||
XPropertyControl control = UnoRuntime.queryInterface(
|
||||
XPropertyControl.class, _propertyControlFactory.createPropertyControl(
|
||||
PropertyControlType.TextField, true ) );
|
||||
|
||||
|
@ -59,8 +59,8 @@ public class ObjectInspector extends complexlib.ComplexTestCase
|
||||
public void before() throws com.sun.star.uno.Exception, java.lang.Exception
|
||||
{
|
||||
m_orb = (XMultiServiceFactory)param.getMSF();
|
||||
m_context = (XComponentContext)UnoRuntime.queryInterface( XComponentContext.class,
|
||||
((XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, m_orb )).getPropertyValue( "DefaultContext" ) );
|
||||
m_context = UnoRuntime.queryInterface( XComponentContext.class,
|
||||
UnoRuntime.queryInterface( XPropertySet.class, m_orb ).getPropertyValue( "DefaultContext" ) );
|
||||
m_desktop = new Frame( m_orb.createInstance( "com.sun.star.frame.Desktop" ) );
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ public class ObjectInspector extends complexlib.ComplexTestCase
|
||||
/* ------------------------------------------------------------------ */
|
||||
private com.sun.star.awt.XWindow createFloatingWindow() throws com.sun.star.uno.Exception
|
||||
{
|
||||
com.sun.star.awt.XToolkit toolkit = (com.sun.star.awt.XToolkit)UnoRuntime.queryInterface(
|
||||
com.sun.star.awt.XToolkit toolkit = UnoRuntime.queryInterface(
|
||||
com.sun.star.awt.XToolkit.class, m_orb.createInstance( "com.sun.star.awt.Toolkit" ) );
|
||||
|
||||
com.sun.star.awt.WindowDescriptor windowDescriptor = new com.sun.star.awt.WindowDescriptor();
|
||||
@ -161,7 +161,7 @@ public class ObjectInspector extends complexlib.ComplexTestCase
|
||||
+ com.sun.star.awt.WindowAttribute.CLOSEABLE
|
||||
+ com.sun.star.awt.VclWindowPeerAttribute.CLIPCHILDREN;
|
||||
|
||||
return (com.sun.star.awt.XWindow)UnoRuntime.queryInterface( com.sun.star.awt.XWindow.class,
|
||||
return UnoRuntime.queryInterface( com.sun.star.awt.XWindow.class,
|
||||
toolkit.createWindow( windowDescriptor ) );
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class ServicesHandler implements XPropertyHandler
|
||||
// the OpenHyperlink command, to be dispatched to the Desktop
|
||||
com.sun.star.util.URL dispatchURL[] = { new com.sun.star.util.URL() };
|
||||
dispatchURL[0].Complete = ".uno:OpenHyperlink";
|
||||
com.sun.star.util.XURLTransformer transformer = (com.sun.star.util.XURLTransformer)UnoRuntime.queryInterface(
|
||||
com.sun.star.util.XURLTransformer transformer = UnoRuntime.queryInterface(
|
||||
com.sun.star.util.XURLTransformer.class,
|
||||
m_context.getServiceManager().createInstanceWithContext( "com.sun.star.util.URLTransformer", m_context ) );
|
||||
transformer.parseStrict( dispatchURL );
|
||||
@ -123,7 +123,7 @@ public class ServicesHandler implements XPropertyHandler
|
||||
descriptor.IndentLevel = 0;
|
||||
try
|
||||
{
|
||||
XHyperlinkControl hyperlinkControl = (XHyperlinkControl)UnoRuntime.queryInterface(
|
||||
XHyperlinkControl hyperlinkControl = UnoRuntime.queryInterface(
|
||||
XHyperlinkControl.class, _propertyControlFactory.createPropertyControl( PropertyControlType.HyperlinkField, true ) );
|
||||
hyperlinkControl.addActionListener( new ClickHandler( m_context, _propertyName ) );
|
||||
|
||||
@ -174,7 +174,7 @@ public class ServicesHandler implements XPropertyHandler
|
||||
|
||||
public void inspect(Object _component) throws com.sun.star.lang.NullPointerException
|
||||
{
|
||||
XServiceInfo serviceInfo = (XServiceInfo)UnoRuntime.queryInterface( XServiceInfo.class, _component );
|
||||
XServiceInfo serviceInfo = UnoRuntime.queryInterface( XServiceInfo.class, _component );
|
||||
if ( serviceInfo != null )
|
||||
m_supportedServices = serviceInfo.getSupportedServiceNames();
|
||||
}
|
||||
|
@ -41,18 +41,18 @@ public class TestPGP {
|
||||
|
||||
|
||||
static void doSomething(Object r) throws com.sun.star.uno.Exception, IOException, Exception {
|
||||
XNamingService rName = (XNamingService)UnoRuntime.queryInterface(XNamingService.class, r);
|
||||
XNamingService rName = UnoRuntime.queryInterface(XNamingService.class, r);
|
||||
|
||||
if(rName != null) {
|
||||
System.err.println("got the remote naming service !");
|
||||
Object rXsmgr = rName.getRegisteredObject("StarOffice.ServiceManager");
|
||||
|
||||
XMultiServiceFactory rSmgr = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, rXsmgr);
|
||||
XMultiServiceFactory rSmgr = UnoRuntime.queryInterface(XMultiServiceFactory.class, rXsmgr);
|
||||
if(rSmgr != null) {
|
||||
System.err.println("got the remote service manager !");
|
||||
}
|
||||
|
||||
XSet set= (XSet)UnoRuntime.queryInterface(XSet.class, rSmgr);
|
||||
XSet set= UnoRuntime.queryInterface(XSet.class, rSmgr);
|
||||
if( set == null) {
|
||||
System.err.println(" couldn't get XSet from ServiceFactory");
|
||||
return;
|
||||
|
@ -80,7 +80,7 @@ public class CellBinding extends complexlib.ComplexTestCase
|
||||
// close our document
|
||||
if ( m_document != null )
|
||||
{
|
||||
XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class,
|
||||
XCloseable closeDoc = UnoRuntime.queryInterface( XCloseable.class,
|
||||
m_document.getDocument() );
|
||||
closeDoc.close( true );
|
||||
}
|
||||
@ -385,7 +385,7 @@ public class CellBinding extends complexlib.ComplexTestCase
|
||||
*/
|
||||
private boolean verifyVoidCell( short col, short row, String failErrorMessage ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
XCellRangeData cell = (XCellRangeData)UnoRuntime.queryInterface( XCellRangeData.class,
|
||||
XCellRangeData cell = UnoRuntime.queryInterface( XCellRangeData.class,
|
||||
m_document.getSheet( 0 ).getCellByPosition( col, row )
|
||||
);
|
||||
Object cellContent = cell.getDataArray()[0][0];
|
||||
@ -402,7 +402,7 @@ public class CellBinding extends complexlib.ComplexTestCase
|
||||
*/
|
||||
private boolean verifyNumericCellContent( short col, short row, double value, String failErrorMessage ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
XCell cell = (XCell)UnoRuntime.queryInterface( XCell.class,
|
||||
XCell cell = UnoRuntime.queryInterface( XCell.class,
|
||||
m_document.getSheet( 0 ).getCellByPosition( col, row )
|
||||
);
|
||||
if ( cell.getValue() != value )
|
||||
@ -418,7 +418,7 @@ public class CellBinding extends complexlib.ComplexTestCase
|
||||
*/
|
||||
private boolean verifyStringCellContent( short col, short row, String text, String failErrorMessage ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
XTextRange cell = (XTextRange)UnoRuntime.queryInterface( XTextRange.class,
|
||||
XTextRange cell = UnoRuntime.queryInterface( XTextRange.class,
|
||||
m_document.getSheet( 0 ).getCellByPosition( col, row )
|
||||
);
|
||||
if ( !cell.getString().equals( text ) )
|
||||
@ -434,7 +434,7 @@ public class CellBinding extends complexlib.ComplexTestCase
|
||||
*/
|
||||
private void setCellText( short col, short row, String text ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
XTextRange cell = (XTextRange)UnoRuntime.queryInterface( XTextRange.class,
|
||||
XTextRange cell = UnoRuntime.queryInterface( XTextRange.class,
|
||||
m_document.getSheet( 0 ).getCellByPosition( col, row )
|
||||
);
|
||||
cell.setString( text );
|
||||
@ -445,7 +445,7 @@ public class CellBinding extends complexlib.ComplexTestCase
|
||||
*/
|
||||
private void setCellValue( short col, short row, double value ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
XCell cell = (XCell)UnoRuntime.queryInterface( XCell.class,
|
||||
XCell cell = UnoRuntime.queryInterface( XCell.class,
|
||||
m_document.getSheet( 0 ).getCellByPosition( col, row )
|
||||
);
|
||||
cell.setValue( value );
|
||||
@ -458,7 +458,7 @@ public class CellBinding extends complexlib.ComplexTestCase
|
||||
{
|
||||
// as long as #i29130# is not fixed, we do not set the cell to "empty", but to
|
||||
// an invalid formular, which serves well for our purpose
|
||||
XCellRangeFormula cell = (XCellRangeFormula)UnoRuntime.queryInterface( XCellRangeFormula.class,
|
||||
XCellRangeFormula cell = UnoRuntime.queryInterface( XCellRangeFormula.class,
|
||||
m_document.getSheet( 0 ).getCellByPosition( col, row )
|
||||
);
|
||||
String[][] args = new String[][] { new String[] { "=INVALID_FUNCTION()" } };
|
||||
@ -471,7 +471,7 @@ public class CellBinding extends complexlib.ComplexTestCase
|
||||
*/
|
||||
private void bindToCell( XPropertySet controlModel, short column, short row, String _bindingServiceName ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
XBindableValue bindableModel = (XBindableValue)UnoRuntime.queryInterface( XBindableValue.class,
|
||||
XBindableValue bindableModel = UnoRuntime.queryInterface( XBindableValue.class,
|
||||
controlModel
|
||||
);
|
||||
|
||||
@ -484,7 +484,7 @@ public class CellBinding extends complexlib.ComplexTestCase
|
||||
parameters[0].Name = "BoundCell";
|
||||
parameters[0].Value = address;
|
||||
|
||||
XValueBinding cellBinding = (XValueBinding)UnoRuntime.queryInterface( XValueBinding.class,
|
||||
XValueBinding cellBinding = UnoRuntime.queryInterface( XValueBinding.class,
|
||||
m_document.createInstanceWithArguments( _bindingServiceName, parameters )
|
||||
);
|
||||
|
||||
@ -504,13 +504,13 @@ public class CellBinding extends complexlib.ComplexTestCase
|
||||
*/
|
||||
private void setListSource( XPropertySet _listSink, short _sourceCol, short _rowStart, short _rowEnd ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
CellRangeAddress listSourceAddress = new CellRangeAddress( (short)0, (int)_sourceCol, (int)_rowStart, (int)_sourceCol, (int)_rowEnd );
|
||||
CellRangeAddress listSourceAddress = new CellRangeAddress( (short)0, _sourceCol, _rowStart, _sourceCol, _rowEnd );
|
||||
NamedValue addressParameter = new NamedValue( "CellRange", listSourceAddress );
|
||||
|
||||
XListEntrySource listSource = (XListEntrySource)UnoRuntime.queryInterface( XListEntrySource.class,
|
||||
XListEntrySource listSource = UnoRuntime.queryInterface( XListEntrySource.class,
|
||||
m_document.createInstanceWithArguments( "com.sun.star.table.CellRangeListSource", new NamedValue[]{ addressParameter } )
|
||||
);
|
||||
XListEntrySink listSink = (XListEntrySink)UnoRuntime.queryInterface( XListEntrySink.class,
|
||||
XListEntrySink listSink = UnoRuntime.queryInterface( XListEntrySink.class,
|
||||
_listSink );
|
||||
listSink.setListEntrySource( listSource );
|
||||
}
|
||||
@ -520,10 +520,10 @@ public class CellBinding extends complexlib.ComplexTestCase
|
||||
*/
|
||||
private void simulateUserRadioCheck( XPropertySet radioModel ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
XAccessible accessible = (XAccessible)UnoRuntime.queryInterface(
|
||||
XAccessible accessible = UnoRuntime.queryInterface(
|
||||
XAccessible.class, m_document.getCurrentView().getControl( radioModel ) );
|
||||
|
||||
XAccessibleValue xValue = (XAccessibleValue)UnoRuntime.queryInterface(
|
||||
XAccessibleValue xValue = UnoRuntime.queryInterface(
|
||||
XAccessibleValue.class, accessible.getAccessibleContext() );
|
||||
|
||||
Integer newValue = new Integer( 1 );
|
||||
@ -535,10 +535,10 @@ public class CellBinding extends complexlib.ComplexTestCase
|
||||
*/
|
||||
private void simulateUserCheckBoxCheck( XPropertySet checkBox, short state ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
XAccessible accessible = (XAccessible)UnoRuntime.queryInterface(
|
||||
XAccessible accessible = UnoRuntime.queryInterface(
|
||||
XAccessible.class, m_document.getCurrentView().getControl( checkBox ) );
|
||||
|
||||
XAccessibleValue xValue = (XAccessibleValue)UnoRuntime.queryInterface(
|
||||
XAccessibleValue xValue = UnoRuntime.queryInterface(
|
||||
XAccessibleValue.class, accessible.getAccessibleContext() );
|
||||
|
||||
xValue.setCurrentValue( new Short( state ) );
|
||||
@ -549,7 +549,7 @@ public class CellBinding extends complexlib.ComplexTestCase
|
||||
*/
|
||||
private void simulateUserListBoxSelection( XPropertySet _listBox, String _selectEntry ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
XListBox listBoxControl = (XListBox)UnoRuntime.queryInterface(
|
||||
XListBox listBoxControl = UnoRuntime.queryInterface(
|
||||
XListBox.class, m_document.getCurrentView().getControl( _listBox ) );
|
||||
listBoxControl.selectItem( _selectEntry, true );
|
||||
}
|
||||
@ -559,14 +559,14 @@ public class CellBinding extends complexlib.ComplexTestCase
|
||||
*/
|
||||
private void simulateUserTextInput( XPropertySet controlModel, String text ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
XAccessible accessible = (XAccessible)UnoRuntime.queryInterface(
|
||||
XAccessible accessible = UnoRuntime.queryInterface(
|
||||
XAccessible.class, m_document.getCurrentView().getControl( controlModel ) );
|
||||
|
||||
XAccessibleContext context = accessible.getAccessibleContext();
|
||||
XServiceInfo si = (XServiceInfo)UnoRuntime.queryInterface( XServiceInfo.class,
|
||||
XServiceInfo si = UnoRuntime.queryInterface( XServiceInfo.class,
|
||||
accessible.getAccessibleContext() );
|
||||
|
||||
XAccessibleEditableText textAccess = (XAccessibleEditableText)UnoRuntime.queryInterface(
|
||||
XAccessibleEditableText textAccess = UnoRuntime.queryInterface(
|
||||
XAccessibleEditableText.class, accessible.getAccessibleContext() );
|
||||
|
||||
textAccess.setText( text );
|
||||
|
@ -87,7 +87,7 @@ public class ControlValidation extends complexlib.ComplexTestCase implements com
|
||||
// close our document
|
||||
if ( m_document != null )
|
||||
{
|
||||
XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class,
|
||||
XCloseable closeDoc = UnoRuntime.queryInterface( XCloseable.class,
|
||||
m_document.getDocument() );
|
||||
closeDoc.close( true );
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class DocumentHelper
|
||||
/* ------------------------------------------------------------------ */
|
||||
protected static XComponent implLoadAsComponent( XMultiServiceFactory orb, String documentOrFactoryURL, final PropertyValue[] i_args ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
XComponentLoader aLoader = (XComponentLoader)UnoRuntime.queryInterface(
|
||||
XComponentLoader aLoader = UnoRuntime.queryInterface(
|
||||
XComponentLoader.class,
|
||||
orb.createInstance( "com.sun.star.frame.Desktop" )
|
||||
);
|
||||
@ -89,7 +89,7 @@ public class DocumentHelper
|
||||
{
|
||||
XComponent document = implLoadAsComponent( orb, documentOrFactoryURL, i_args );
|
||||
|
||||
XServiceInfo xSI = (XServiceInfo)UnoRuntime.queryInterface( XServiceInfo.class,
|
||||
XServiceInfo xSI = UnoRuntime.queryInterface( XServiceInfo.class,
|
||||
document );
|
||||
if ( xSI.supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) )
|
||||
return new SpreadsheetDocument( orb, document );
|
||||
@ -157,7 +157,7 @@ public class DocumentHelper
|
||||
public DocumentViewHelper getCurrentView( )
|
||||
{
|
||||
// get the model interface for the document
|
||||
XModel xDocModel = (XModel)UnoRuntime.queryInterface(XModel.class, m_documentComponent );
|
||||
XModel xDocModel = UnoRuntime.queryInterface(XModel.class, m_documentComponent );
|
||||
// get the current controller for the document - as a controller is tied to a view,
|
||||
// this gives us the currently active view for the document.
|
||||
XController xController = xDocModel.getCurrentController();
|
||||
@ -188,7 +188,7 @@ public class DocumentHelper
|
||||
|
||||
getCurrentView().dispatch( ".uno:Reload" );
|
||||
|
||||
m_documentComponent = (XComponent)UnoRuntime.queryInterface( XComponent.class,
|
||||
m_documentComponent = UnoRuntime.queryInterface( XComponent.class,
|
||||
frame.getController().getModel() );
|
||||
|
||||
XModel newModel = getCurrentView().getController().getModel();
|
||||
@ -222,7 +222,7 @@ public class DocumentHelper
|
||||
}
|
||||
|
||||
// outta here
|
||||
return (XIndexContainer)UnoRuntime.queryInterface( XIndexContainer.class, xNewForm );
|
||||
return UnoRuntime.queryInterface( XIndexContainer.class, xNewForm );
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
@ -237,7 +237,7 @@ public class DocumentHelper
|
||||
public XIndexContainer createSubForm( Object aParentContainer, String sInitialName )
|
||||
throws com.sun.star.uno.Exception
|
||||
{
|
||||
XIndexContainer xParentContainer = (XIndexContainer)UnoRuntime.queryInterface(
|
||||
XIndexContainer xParentContainer = UnoRuntime.queryInterface(
|
||||
XIndexContainer.class, aParentContainer );
|
||||
return createSubForm( xParentContainer, sInitialName );
|
||||
}
|
||||
@ -265,13 +265,13 @@ public class DocumentHelper
|
||||
*/
|
||||
static public DocumentHelper getDocumentForComponent( Object aFormComponent, XMultiServiceFactory orb )
|
||||
{
|
||||
XChild xChild = (XChild)UnoRuntime.queryInterface( XChild.class, aFormComponent );
|
||||
XChild xChild = UnoRuntime.queryInterface( XChild.class, aFormComponent );
|
||||
XModel xModel = null;
|
||||
while ( ( null != xChild ) && ( null == xModel ) )
|
||||
{
|
||||
XInterface xParent = (XInterface)xChild.getParent();
|
||||
xModel = (XModel)UnoRuntime.queryInterface( XModel.class, xParent );
|
||||
xChild = (XChild)UnoRuntime.queryInterface( XChild.class, xParent );
|
||||
xModel = UnoRuntime.queryInterface( XModel.class, xParent );
|
||||
xChild = UnoRuntime.queryInterface( XChild.class, xParent );
|
||||
}
|
||||
|
||||
return new DocumentHelper( orb, xModel );
|
||||
@ -298,7 +298,7 @@ public class DocumentHelper
|
||||
*/
|
||||
public DocumentType classify( )
|
||||
{
|
||||
XServiceInfo xSI = (XServiceInfo)UnoRuntime.queryInterface(
|
||||
XServiceInfo xSI = UnoRuntime.queryInterface(
|
||||
XServiceInfo.class, m_documentComponent );
|
||||
|
||||
if ( xSI.supportsService( "com.sun.star.text.TextDocument" ) )
|
||||
@ -321,11 +321,11 @@ public class DocumentHelper
|
||||
*/
|
||||
protected XDrawPage getDrawPage( int index ) throws com.sun.star.lang.IndexOutOfBoundsException, com.sun.star.lang.WrappedTargetException
|
||||
{
|
||||
XDrawPagesSupplier xSuppPages = (XDrawPagesSupplier)UnoRuntime.queryInterface(
|
||||
XDrawPagesSupplier xSuppPages = UnoRuntime.queryInterface(
|
||||
XDrawPagesSupplier.class, getDocument() );
|
||||
XDrawPages xPages = xSuppPages.getDrawPages();
|
||||
|
||||
return (XDrawPage)UnoRuntime.queryInterface( XDrawPage.class, xPages.getByIndex( index ) );
|
||||
return UnoRuntime.queryInterface( XDrawPage.class, xPages.getByIndex( index ) );
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
@ -336,18 +336,18 @@ public class DocumentHelper
|
||||
XDrawPage xReturn;
|
||||
|
||||
// in case of a Writer document, this is rather easy: simply ask the XDrawPageSupplier
|
||||
XDrawPageSupplier xSuppPage = (XDrawPageSupplier)UnoRuntime.queryInterface(
|
||||
XDrawPageSupplier xSuppPage = UnoRuntime.queryInterface(
|
||||
XDrawPageSupplier.class, getDocument() );
|
||||
if ( null != xSuppPage )
|
||||
xReturn = xSuppPage.getDrawPage();
|
||||
else
|
||||
{ // the model itself is no draw page supplier - okay, it may be a Writer or Calc document
|
||||
// (or any other multi-page document)
|
||||
XDrawPagesSupplier xSuppPages = (XDrawPagesSupplier)UnoRuntime.queryInterface(
|
||||
XDrawPagesSupplier xSuppPages = UnoRuntime.queryInterface(
|
||||
XDrawPagesSupplier.class, getDocument() );
|
||||
XDrawPages xPages = xSuppPages.getDrawPages();
|
||||
|
||||
xReturn = (XDrawPage)UnoRuntime.queryInterface( XDrawPage.class, xPages.getByIndex( 0 ) );
|
||||
xReturn = UnoRuntime.queryInterface( XDrawPage.class, xPages.getByIndex( 0 ) );
|
||||
|
||||
// Note that this is no really error-proof code: If the document model does not support the
|
||||
// XDrawPagesSupplier interface, or if the pages collection returned is empty, this will break.
|
||||
@ -361,7 +361,7 @@ public class DocumentHelper
|
||||
*/
|
||||
protected XNameContainer getFormComponentTreeRoot( ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
XFormsSupplier xSuppForms = (XFormsSupplier)UnoRuntime.queryInterface(
|
||||
XFormsSupplier xSuppForms = UnoRuntime.queryInterface(
|
||||
XFormsSupplier.class, getMainDrawPage( ) );
|
||||
|
||||
XNameContainer xFormsCollection = null;
|
||||
@ -377,7 +377,7 @@ public class DocumentHelper
|
||||
*/
|
||||
public XInterface createInstance( String serviceSpecifier ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
XMultiServiceFactory xORB = (XMultiServiceFactory)UnoRuntime.queryInterface( XMultiServiceFactory.class,
|
||||
XMultiServiceFactory xORB = UnoRuntime.queryInterface( XMultiServiceFactory.class,
|
||||
m_documentComponent );
|
||||
return (XInterface)xORB.createInstance( serviceSpecifier );
|
||||
}
|
||||
@ -387,7 +387,7 @@ public class DocumentHelper
|
||||
*/
|
||||
public XInterface createInstanceWithArguments( String serviceSpecifier, Object[] arguments ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
XMultiServiceFactory xORB = (XMultiServiceFactory)UnoRuntime.queryInterface( XMultiServiceFactory.class,
|
||||
XMultiServiceFactory xORB = UnoRuntime.queryInterface( XMultiServiceFactory.class,
|
||||
m_documentComponent );
|
||||
return (XInterface) xORB.createInstanceWithArguments( serviceSpecifier, arguments );
|
||||
}
|
||||
|
@ -94,12 +94,12 @@ public class DocumentViewHelper
|
||||
// go get the current view
|
||||
XController xController = (XController)query( XController.class );
|
||||
// go get the dispatch provider of it's frame
|
||||
XDispatchProvider xProvider = (XDispatchProvider)UnoRuntime.queryInterface(
|
||||
XDispatchProvider xProvider = UnoRuntime.queryInterface(
|
||||
XDispatchProvider.class, xController.getFrame() );
|
||||
if ( null != xProvider )
|
||||
{
|
||||
// need an URLTransformer
|
||||
XURLTransformer xTransformer = (XURLTransformer)UnoRuntime.queryInterface(
|
||||
XURLTransformer xTransformer = UnoRuntime.queryInterface(
|
||||
XURLTransformer.class, m_orb.createInstance( "com.sun.star.util.URLTransformer" ) );
|
||||
xTransformer.parseStrict( aURL );
|
||||
|
||||
@ -155,14 +155,14 @@ public class DocumentViewHelper
|
||||
/* ------------------------------------------------------------------ */
|
||||
public XControl getControl( Object aModel ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
XControlModel xModel = (XControlModel)UnoRuntime.queryInterface( XControlModel.class, aModel );
|
||||
XControlModel xModel = UnoRuntime.queryInterface( XControlModel.class, aModel );
|
||||
return getControl( xModel );
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
public Object getControl( Object aModel, Class aInterfaceClass ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
XControlModel xModel = (XControlModel)UnoRuntime.queryInterface( XControlModel.class, aModel );
|
||||
XControlModel xModel = UnoRuntime.queryInterface( XControlModel.class, aModel );
|
||||
return UnoRuntime.queryInterface( aInterfaceClass, getControl( xModel ) );
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ public class DocumentViewHelper
|
||||
XControl xControl = getControl( xModel );
|
||||
|
||||
// the focus can be set to an XWindow only
|
||||
XWindow xControlWindow = (XWindow)UnoRuntime.queryInterface( XWindow.class,
|
||||
XWindow xControlWindow = UnoRuntime.queryInterface( XWindow.class,
|
||||
xControl );
|
||||
|
||||
// grab the focus
|
||||
@ -229,7 +229,7 @@ public class DocumentViewHelper
|
||||
XPropertySet xControlProps = dbfTools.queryPropertySet( xForm.getByIndex( i ) );
|
||||
if ( FormComponentType.FIXEDTEXT != ((Short)xControlProps.getPropertyValue( "ClassId" )).shortValue() )
|
||||
{
|
||||
XControlModel xControlModel = (XControlModel)UnoRuntime.queryInterface(
|
||||
XControlModel xControlModel = UnoRuntime.queryInterface(
|
||||
XControlModel.class, xControlProps );
|
||||
// set the focus to this control
|
||||
grabControlFocus( xControlModel );
|
||||
|
@ -47,16 +47,16 @@ public class FormComponent
|
||||
/* ------------------------------------------------------------------ */
|
||||
public FormComponent( XDrawPage drawPage )
|
||||
{
|
||||
XFormsSupplier supp = (XFormsSupplier)UnoRuntime.queryInterface(
|
||||
XFormsSupplier supp = UnoRuntime.queryInterface(
|
||||
XFormsSupplier.class, drawPage );
|
||||
m_component = supp.getForms();
|
||||
|
||||
m_nameAccess = (XNameAccess)m_component;
|
||||
m_indexAccess = (XIndexAccess)UnoRuntime.queryInterface(
|
||||
m_indexAccess = UnoRuntime.queryInterface(
|
||||
XIndexAccess.class, m_component );
|
||||
m_child = (XChild)UnoRuntime.queryInterface(
|
||||
m_child = UnoRuntime.queryInterface(
|
||||
XChild.class, m_component );
|
||||
m_named = (XNamed)UnoRuntime.queryInterface(
|
||||
m_named = UnoRuntime.queryInterface(
|
||||
XNamed.class, m_component );
|
||||
}
|
||||
|
||||
@ -64,13 +64,13 @@ public class FormComponent
|
||||
public FormComponent( Object element )
|
||||
{
|
||||
m_component = element;
|
||||
m_nameAccess = (XNameAccess)UnoRuntime.queryInterface(
|
||||
m_nameAccess = UnoRuntime.queryInterface(
|
||||
XNameAccess.class, m_component );
|
||||
m_indexAccess = (XIndexAccess)UnoRuntime.queryInterface(
|
||||
m_indexAccess = UnoRuntime.queryInterface(
|
||||
XIndexAccess.class, m_component );
|
||||
m_child = (XChild)UnoRuntime.queryInterface(
|
||||
m_child = UnoRuntime.queryInterface(
|
||||
XChild.class, m_component );
|
||||
m_named = (XNamed)UnoRuntime.queryInterface(
|
||||
m_named = UnoRuntime.queryInterface(
|
||||
XNamed.class, m_component );
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ public class FormComponent
|
||||
/* ------------------------------------------------------------------ */
|
||||
public String getImplementationName()
|
||||
{
|
||||
XServiceInfo si = (XServiceInfo)UnoRuntime.queryInterface(
|
||||
XServiceInfo si = UnoRuntime.queryInterface(
|
||||
XServiceInfo.class, m_component );
|
||||
if ( si != null )
|
||||
return si.getImplementationName();
|
||||
|
@ -453,7 +453,7 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE
|
||||
// close our document
|
||||
if ( m_document != null )
|
||||
{
|
||||
XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class,
|
||||
XCloseable closeDoc = UnoRuntime.queryInterface( XCloseable.class,
|
||||
m_document.getDocument() );
|
||||
closeDoc.close( true );
|
||||
}
|
||||
@ -465,9 +465,9 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE
|
||||
{
|
||||
m_orb = (XMultiServiceFactory)param.getMSF();
|
||||
|
||||
XNameAccess databaseContext = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class,
|
||||
XNameAccess databaseContext = UnoRuntime.queryInterface( XNameAccess.class,
|
||||
m_orb.createInstance( "com.sun.star.sdb.DatabaseContext" ) );
|
||||
XNamingService namingService = (XNamingService)UnoRuntime.queryInterface( XNamingService.class,
|
||||
XNamingService namingService = UnoRuntime.queryInterface( XNamingService.class,
|
||||
databaseContext );
|
||||
|
||||
// revoke the data source, if it previously existed
|
||||
@ -479,11 +479,11 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE
|
||||
String documentURL = m_databaseDocument.getDocumentURL();
|
||||
namingService.registerObject( m_dataSourceName, databaseContext.getByName( documentURL ) );
|
||||
|
||||
m_dataSource = (XDataSource)UnoRuntime.queryInterface( XDataSource.class,
|
||||
m_dataSource = UnoRuntime.queryInterface( XDataSource.class,
|
||||
databaseContext.getByName( m_dataSourceName ) );
|
||||
m_dataSourceProps = dbfTools.queryPropertySet( m_dataSource );
|
||||
|
||||
XPropertySet dataSourceSettings = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class,
|
||||
XPropertySet dataSourceSettings = UnoRuntime.queryInterface( XPropertySet.class,
|
||||
m_dataSourceProps.getPropertyValue( "Settings" ) );
|
||||
dataSourceSettings.setPropertyValue( "FormsCheckRequiredFields", new Boolean( false ) );
|
||||
|
||||
@ -495,9 +495,9 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE
|
||||
*/
|
||||
private XPropertySet getControlModel( String name ) throws com.sun.star.uno.Exception, java.lang.Exception
|
||||
{
|
||||
XNameAccess nameAccess = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class,
|
||||
XNameAccess nameAccess = UnoRuntime.queryInterface( XNameAccess.class,
|
||||
m_masterForm );
|
||||
return (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class,
|
||||
return UnoRuntime.queryInterface( XPropertySet.class,
|
||||
nameAccess.getByName( name ) );
|
||||
}
|
||||
|
||||
@ -547,7 +547,7 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE
|
||||
m_document.getCurrentView( ).toggleFormDesignMode( );
|
||||
|
||||
m_masterFormController = m_document.getCurrentView().getFormController( m_masterForm );
|
||||
XSQLErrorBroadcaster errorBroadcaster = (XSQLErrorBroadcaster)UnoRuntime.queryInterface( XSQLErrorBroadcaster.class,
|
||||
XSQLErrorBroadcaster errorBroadcaster = UnoRuntime.queryInterface( XSQLErrorBroadcaster.class,
|
||||
m_masterFormController );
|
||||
errorBroadcaster.addSQLErrorListener( this );
|
||||
|
||||
@ -796,21 +796,21 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE
|
||||
/* ------------------------------------------------------------------ */
|
||||
private void moveToInsertRow() throws com.sun.star.uno.Exception, java.lang.Exception
|
||||
{
|
||||
XResultSetUpdate xResultSet = (XResultSetUpdate)UnoRuntime.queryInterface( XResultSetUpdate.class, m_masterForm );
|
||||
XResultSetUpdate xResultSet = UnoRuntime.queryInterface( XResultSetUpdate.class, m_masterForm );
|
||||
xResultSet.moveToInsertRow( );
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
private void moveToFirst() throws com.sun.star.uno.Exception, java.lang.Exception
|
||||
{
|
||||
XResultSet xResultSet = (XResultSet)UnoRuntime.queryInterface( XResultSet.class, m_masterForm );
|
||||
XResultSet xResultSet = UnoRuntime.queryInterface( XResultSet.class, m_masterForm );
|
||||
xResultSet.first( );
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
private void moveToNext() throws com.sun.star.uno.Exception, java.lang.Exception
|
||||
{
|
||||
XResultSet xResultSet = (XResultSet)UnoRuntime.queryInterface( XResultSet.class, m_masterForm );
|
||||
XResultSet xResultSet = UnoRuntime.queryInterface( XResultSet.class, m_masterForm );
|
||||
xResultSet.next( );
|
||||
}
|
||||
|
||||
@ -823,7 +823,7 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE
|
||||
|
||||
URL[] url = new URL[] { new URL() };
|
||||
url[0].Complete = slotURL;
|
||||
XURLTransformer xTransformer = (XURLTransformer)UnoRuntime.queryInterface(
|
||||
XURLTransformer xTransformer = UnoRuntime.queryInterface(
|
||||
XURLTransformer.class, m_orb.createInstance( "com.sun.star.util.URLTransformer" ) );
|
||||
xTransformer.parseStrict( url );
|
||||
|
||||
@ -913,7 +913,7 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE
|
||||
XPropertySet xImageModel = getControlModel( "f_blob" );
|
||||
|
||||
// check if the image control properly says that there currently is no image on the first record
|
||||
XImageProducerSupplier xSuppProducer = (XImageProducerSupplier)UnoRuntime.queryInterface( XImageProducerSupplier.class,
|
||||
XImageProducerSupplier xSuppProducer = UnoRuntime.queryInterface( XImageProducerSupplier.class,
|
||||
xImageModel );
|
||||
XImageProducer xProducer = xSuppProducer.getImageProducer();
|
||||
|
||||
|
@ -310,15 +310,15 @@ public class FormLayer
|
||||
*/
|
||||
public XPropertySet getControlModel( int[] _accessPath ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
XIndexAccess indexAcc = (XIndexAccess)UnoRuntime.queryInterface( XIndexAccess.class,
|
||||
XIndexAccess indexAcc = UnoRuntime.queryInterface( XIndexAccess.class,
|
||||
m_document.getFormComponentTreeRoot() );
|
||||
XPropertySet controlModel = null;
|
||||
int i=0;
|
||||
while ( ( indexAcc != null ) && ( i < _accessPath.length ) )
|
||||
{
|
||||
controlModel = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class,
|
||||
controlModel = UnoRuntime.queryInterface( XPropertySet.class,
|
||||
indexAcc.getByIndex( _accessPath[i] ) );
|
||||
indexAcc = (XIndexAccess)UnoRuntime.queryInterface( XIndexAccess.class,
|
||||
indexAcc = UnoRuntime.queryInterface( XIndexAccess.class,
|
||||
controlModel );
|
||||
++i;
|
||||
}
|
||||
@ -335,9 +335,9 @@ public class FormLayer
|
||||
int i=0;
|
||||
while ( ( nameAcc != null ) && ( i < _accessPath.length ) )
|
||||
{
|
||||
controlModel = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class,
|
||||
controlModel = UnoRuntime.queryInterface( XPropertySet.class,
|
||||
nameAcc.getByName( _accessPath[i] ) );
|
||||
nameAcc = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class,
|
||||
nameAcc = UnoRuntime.queryInterface( XNameAccess.class,
|
||||
controlModel );
|
||||
++i;
|
||||
}
|
||||
|
@ -100,12 +100,12 @@ public class ListSelection extends integration.forms.TestCase
|
||||
XSpreadsheet activeSheet = view.getActiveSheet();
|
||||
|
||||
// Accessibility access to the list box control in this sheet
|
||||
XAccessible accessibleListBox = (XAccessible)UnoRuntime.queryInterface(
|
||||
XAccessible accessibleListBox = UnoRuntime.queryInterface(
|
||||
XAccessible.class, getListBoxControl( activeSheet ) );
|
||||
XAccessibleContext context = accessibleListBox.getAccessibleContext();
|
||||
|
||||
// the first "accessible child" of a list box is its list
|
||||
XAccessibleSelection accessibleList = (XAccessibleSelection)UnoRuntime.queryInterface(
|
||||
XAccessibleSelection accessibleList = UnoRuntime.queryInterface(
|
||||
XAccessibleSelection.class, context.getAccessibleChild( 1 ) );
|
||||
|
||||
int selectPosition = generator.nextInt( 5 );
|
||||
@ -120,7 +120,7 @@ public class ListSelection extends integration.forms.TestCase
|
||||
}
|
||||
catch( java.lang.InterruptedException e ) { }
|
||||
|
||||
XNamed sheetName = (XNamed)UnoRuntime.queryInterface( XNamed.class, view.getActiveSheet() );
|
||||
XNamed sheetName = UnoRuntime.queryInterface( XNamed.class, view.getActiveSheet() );
|
||||
assure( "sheet was not selected as expected!", sheetName.getName().equals( selectSheetName ) );
|
||||
}
|
||||
}
|
||||
@ -137,7 +137,7 @@ public class ListSelection extends integration.forms.TestCase
|
||||
try
|
||||
{
|
||||
XPropertySet docProps = dbfTools.queryPropertySet( m_document.getDocument() );
|
||||
XLibraryContainer basicLibs = (XLibraryContainer)UnoRuntime.queryInterface(
|
||||
XLibraryContainer basicLibs = UnoRuntime.queryInterface(
|
||||
XLibraryContainer.class, docProps.getPropertyValue( "BasicLibraries" ) );
|
||||
XNameContainer basicLib = basicLibs.createLibrary( "default" );
|
||||
|
||||
@ -184,7 +184,7 @@ public class ListSelection extends integration.forms.TestCase
|
||||
{
|
||||
XIndexContainer parentForm = (XIndexContainer)dbfTools.getParent( controlModel, XIndexContainer.class );
|
||||
|
||||
XEventAttacherManager manager = (XEventAttacherManager)UnoRuntime.queryInterface(
|
||||
XEventAttacherManager manager = UnoRuntime.queryInterface(
|
||||
XEventAttacherManager.class, parentForm );
|
||||
|
||||
int containerPosition = -1;
|
||||
@ -230,7 +230,7 @@ public class ListSelection extends integration.forms.TestCase
|
||||
String[] newSheetNames = new String[] { "first", "second", "third", "forth", "fifth" };
|
||||
|
||||
// give the first one the right name
|
||||
XNamed sheet = (XNamed)UnoRuntime.queryInterface( XNamed.class,
|
||||
XNamed sheet = UnoRuntime.queryInterface( XNamed.class,
|
||||
sheets.getByName( sheetNames[ 0 ] )
|
||||
);
|
||||
sheet.setName( newSheetNames[ 0 ] );
|
||||
@ -274,7 +274,7 @@ public class ListSelection extends integration.forms.TestCase
|
||||
/* ------------------------------------------------------------------ */
|
||||
protected XControlModel getListBoxModel( XSpreadsheet sheet )
|
||||
{
|
||||
XDrawPageSupplier suppPage = (XDrawPageSupplier)UnoRuntime.queryInterface(
|
||||
XDrawPageSupplier suppPage = UnoRuntime.queryInterface(
|
||||
XDrawPageSupplier.class, sheet );
|
||||
FormComponent formsRoot = new FormComponent( suppPage.getDrawPage() );
|
||||
XControlModel listBoxModel = (XControlModel)formsRoot.getByIndex( 0 ).
|
||||
@ -285,7 +285,7 @@ public class ListSelection extends integration.forms.TestCase
|
||||
/* ------------------------------------------------------------------ */
|
||||
protected XListBox getListBoxControl( XSpreadsheet sheet ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
return (XListBox)UnoRuntime.queryInterface(
|
||||
return UnoRuntime.queryInterface(
|
||||
XListBox.class, m_document.getCurrentView().getControl( getListBoxModel( sheet ) ) );
|
||||
}
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ public class RadioButtons extends complexlib.ComplexTestCase
|
||||
// close our document
|
||||
if ( m_document != null )
|
||||
{
|
||||
XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class,
|
||||
XCloseable closeDoc = UnoRuntime.queryInterface( XCloseable.class,
|
||||
m_document.getDocument() );
|
||||
closeDoc.close( true );
|
||||
}
|
||||
@ -295,7 +295,7 @@ public class RadioButtons extends complexlib.ComplexTestCase
|
||||
{
|
||||
XPropertySet xRadio = getRadioModel( groupName, refValue, form );
|
||||
|
||||
XRadioButton radioButton = (XRadioButton)UnoRuntime.queryInterface(
|
||||
XRadioButton radioButton = UnoRuntime.queryInterface(
|
||||
XRadioButton.class, m_document.getCurrentView().getControl( xRadio ) );
|
||||
radioButton.setState( true );
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class SingleControlValidation implements XFormComponentValidityListener
|
||||
if ( controls[ i ].getPropertySetInfo().hasPropertyByName( "Border" ) )
|
||||
controls[ i ].setPropertyValue( "Border", new Short( (short)2 ) );
|
||||
|
||||
XValidatableFormComponent xComp = (XValidatableFormComponent)UnoRuntime.queryInterface( XValidatableFormComponent.class,
|
||||
XValidatableFormComponent xComp = UnoRuntime.queryInterface( XValidatableFormComponent.class,
|
||||
controls[ i ] );
|
||||
xComp.addFormComponentValidityListener( this );
|
||||
}
|
||||
@ -122,7 +122,7 @@ public class SingleControlValidation implements XFormComponentValidityListener
|
||||
m_explanationField = m_formLayer.createControlAndShape( "FixedText", columnPos, controlPos, 70, 4, null );
|
||||
m_explanationField.setPropertyValue( "Label", new String( "" ) );
|
||||
|
||||
XValidatable xValidatable = (XValidatable)UnoRuntime.queryInterface( XValidatable.class, m_inputField );
|
||||
XValidatable xValidatable = UnoRuntime.queryInterface( XValidatable.class, m_inputField );
|
||||
xValidatable.setValidator( m_validator );
|
||||
}
|
||||
catch( java.lang.Exception e )
|
||||
@ -148,7 +148,7 @@ public class SingleControlValidation implements XFormComponentValidityListener
|
||||
{
|
||||
if ( m_inputField.equals( eventObject.Source ) )
|
||||
{
|
||||
XValidatableFormComponent xComp = (XValidatableFormComponent)UnoRuntime.queryInterface( XValidatableFormComponent.class,
|
||||
XValidatableFormComponent xComp = UnoRuntime.queryInterface( XValidatableFormComponent.class,
|
||||
eventObject.Source );
|
||||
// the current value
|
||||
Object value = xComp.getCurrentValue();
|
||||
|
@ -49,7 +49,7 @@ public class SpreadsheetDocument extends DocumentHelper
|
||||
*/
|
||||
public XSpreadsheets getSheets() throws com.sun.star.uno.Exception
|
||||
{
|
||||
XSpreadsheetDocument spreadsheetDoc = (XSpreadsheetDocument)UnoRuntime.queryInterface( XSpreadsheetDocument.class,
|
||||
XSpreadsheetDocument spreadsheetDoc = UnoRuntime.queryInterface( XSpreadsheetDocument.class,
|
||||
getDocument()
|
||||
);
|
||||
return spreadsheetDoc.getSheets();
|
||||
@ -60,10 +60,10 @@ public class SpreadsheetDocument extends DocumentHelper
|
||||
*/
|
||||
public XCellRange getSheet( int index ) throws com.sun.star.uno.Exception
|
||||
{
|
||||
XIndexAccess sheets = (XIndexAccess)UnoRuntime.queryInterface( XIndexAccess.class,
|
||||
XIndexAccess sheets = UnoRuntime.queryInterface( XIndexAccess.class,
|
||||
getSheets()
|
||||
);
|
||||
return (XCellRange)UnoRuntime.queryInterface( XCellRange.class,
|
||||
return UnoRuntime.queryInterface( XCellRange.class,
|
||||
sheets.getByIndex( index )
|
||||
);
|
||||
}
|
||||
@ -94,7 +94,7 @@ public class SpreadsheetDocument extends DocumentHelper
|
||||
{
|
||||
CellAddress address = new CellAddress( sheet, column, row );
|
||||
Object[] initParam = new Object[] { new NamedValue( "BoundCell", address ) };
|
||||
cellBinding = (com.sun.star.form.binding.XValueBinding)UnoRuntime.queryInterface(
|
||||
cellBinding = UnoRuntime.queryInterface(
|
||||
com.sun.star.form.binding.XValueBinding.class,
|
||||
createInstanceWithArguments(
|
||||
supportIntegerValues ? "com.sun.star.table.ListPositionCellBinding"
|
||||
@ -123,7 +123,7 @@ public class SpreadsheetDocument extends DocumentHelper
|
||||
CellRangeAddress rangeAddress = new CellRangeAddress( sheet, column,
|
||||
topRow, column, bottomRow );
|
||||
Object[] initParam = new Object[] { new NamedValue( "CellRange", rangeAddress ) };
|
||||
entrySource = (com.sun.star.form.binding.XListEntrySource)UnoRuntime.queryInterface(
|
||||
entrySource = UnoRuntime.queryInterface(
|
||||
com.sun.star.form.binding.XListEntrySource.class,
|
||||
createInstanceWithArguments(
|
||||
"com.sun.star.table.CellRangeListSource", initParam ) );
|
||||
|
@ -47,16 +47,16 @@ public class SpreadsheetView extends integration.forms.DocumentViewHelper
|
||||
try
|
||||
{
|
||||
// get the sheet to activate
|
||||
XSpreadsheetDocument doc = (XSpreadsheetDocument)UnoRuntime.queryInterface(
|
||||
XSpreadsheetDocument doc = UnoRuntime.queryInterface(
|
||||
XSpreadsheetDocument.class, getDocument().getDocument() );
|
||||
XIndexAccess sheets = (XIndexAccess)UnoRuntime.queryInterface(
|
||||
XIndexAccess sheets = UnoRuntime.queryInterface(
|
||||
XIndexAccess.class, doc.getSheets() );
|
||||
|
||||
XSpreadsheet sheet = (XSpreadsheet)UnoRuntime.queryInterface(
|
||||
XSpreadsheet sheet = UnoRuntime.queryInterface(
|
||||
XSpreadsheet.class, sheets.getByIndex( sheetIndex ) );
|
||||
|
||||
// activate
|
||||
XSpreadsheetView view = (XSpreadsheetView)UnoRuntime.queryInterface(
|
||||
XSpreadsheetView view = UnoRuntime.queryInterface(
|
||||
XSpreadsheetView.class, getController() );
|
||||
view.setActiveSheet( sheet );
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class TableCellTextBinding
|
||||
/** Creates a new instance of TableCellTextBinding */
|
||||
public TableCellTextBinding( XCell cell )
|
||||
{
|
||||
m_cellText = (XTextRange)UnoRuntime.queryInterface( XTextRange.class, cell );
|
||||
m_cellText = UnoRuntime.queryInterface( XTextRange.class, cell );
|
||||
|
||||
m_newCellText = new String();
|
||||
m_listeners = new java.util.LinkedList();
|
||||
|
@ -82,11 +82,11 @@ public class ValueBinding extends integration.forms.TestCase
|
||||
|
||||
// insert a table with exactly one cell. The content of this table will be synced with
|
||||
// the content of a form control
|
||||
XTextDocument textDoc = (XTextDocument)UnoRuntime.queryInterface( XTextDocument.class, m_document.getDocument() );
|
||||
XTextDocument textDoc = UnoRuntime.queryInterface( XTextDocument.class, m_document.getDocument() );
|
||||
XText documentText = textDoc.getText();
|
||||
XTextCursor textCursor = documentText.createTextCursor();
|
||||
|
||||
XTextTable table = (XTextTable)UnoRuntime.queryInterface( XTextTable.class,
|
||||
XTextTable table = UnoRuntime.queryInterface( XTextTable.class,
|
||||
m_document.createInstance( "com.sun.star.text.TextTable" )
|
||||
);
|
||||
table.initialize( 1, 1 );
|
||||
@ -98,7 +98,7 @@ public class ValueBinding extends integration.forms.TestCase
|
||||
// create a value binding for the first cell of the table
|
||||
XValueBinding cellBinding = new TableCellTextBinding( table.getCellByName( "A1" ) );
|
||||
// and bind it to the control
|
||||
XBindableValue bindable = (XBindableValue)UnoRuntime.queryInterface(
|
||||
XBindableValue bindable = UnoRuntime.queryInterface(
|
||||
XBindableValue.class, textControl
|
||||
);
|
||||
bindable.setValueBinding( cellBinding );
|
||||
|
@ -101,7 +101,7 @@ public class XMLFormSettings extends complexlib.ComplexTestCase
|
||||
File tempFile = File.createTempFile( "xmlforms", ".odt" );
|
||||
tempFile.deleteOnExit();
|
||||
String fileURL = tempFile.toURI().toURL().toExternalForm();
|
||||
XStorable store = (XStorable)UnoRuntime.queryInterface( XStorable.class,
|
||||
XStorable store = UnoRuntime.queryInterface( XStorable.class,
|
||||
m_document.getDocument() );
|
||||
store.storeAsURL( fileURL, new PropertyValue[] {} );
|
||||
assure( "document still modified after saving it", !m_document.isModified() );
|
||||
@ -118,7 +118,7 @@ public class XMLFormSettings extends complexlib.ComplexTestCase
|
||||
{
|
||||
if ( m_document != null )
|
||||
{
|
||||
XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class,
|
||||
XCloseable closeDoc = UnoRuntime.queryInterface( XCloseable.class,
|
||||
m_document.getDocument() );
|
||||
closeDoc.close( true );
|
||||
}
|
||||
@ -127,9 +127,9 @@ public class XMLFormSettings extends complexlib.ComplexTestCase
|
||||
/* ------------------------------------------------------------------ */
|
||||
private static void impl_bind( XPropertySet _control, XPropertySet _binding ) throws IncompatibleTypesException
|
||||
{
|
||||
XBindableValue bindableControl = (XBindableValue)UnoRuntime.queryInterface(
|
||||
XBindableValue bindableControl = UnoRuntime.queryInterface(
|
||||
XBindableValue.class, _control );
|
||||
XValueBinding binding = (XValueBinding)UnoRuntime.queryInterface(
|
||||
XValueBinding binding = UnoRuntime.queryInterface(
|
||||
XValueBinding.class, _binding );
|
||||
bindableControl.setValueBinding( binding );
|
||||
}
|
||||
@ -209,7 +209,7 @@ public class XMLFormSettings extends complexlib.ComplexTestCase
|
||||
*/
|
||||
private void impl_storeDocument() throws IOException
|
||||
{
|
||||
XStorable store = (XStorable)UnoRuntime.queryInterface( XStorable.class,
|
||||
XStorable store = UnoRuntime.queryInterface( XStorable.class,
|
||||
m_document.getDocument() );
|
||||
store.store();
|
||||
assure( "document still modified after saving it", !m_document.isModified() );
|
||||
|
@ -39,8 +39,8 @@ public class ResultSet implements XResultSet, XRow
|
||||
|
||||
public ResultSet( final Object _resultSet )
|
||||
{
|
||||
m_resultSet = (XResultSet)UnoRuntime.queryInterface( XResultSet.class, _resultSet );
|
||||
m_row = (XRow)UnoRuntime.queryInterface( XRow.class, _resultSet );
|
||||
m_resultSet = UnoRuntime.queryInterface( XResultSet.class, _resultSet );
|
||||
m_row = UnoRuntime.queryInterface( XRow.class, _resultSet );
|
||||
}
|
||||
|
||||
public
|
||||
|
@ -32,9 +32,9 @@ public class Model
|
||||
|
||||
protected Model( Object _model )
|
||||
{
|
||||
m_model = (XModel)UnoRuntime.queryInterface( XModel.class, _model );
|
||||
m_modelProps = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, _model );
|
||||
m_helper = (XFormsUIHelper1)UnoRuntime.queryInterface( XFormsUIHelper1.class,
|
||||
m_model = UnoRuntime.queryInterface( XModel.class, _model );
|
||||
m_modelProps = UnoRuntime.queryInterface( XPropertySet.class, _model );
|
||||
m_helper = UnoRuntime.queryInterface( XFormsUIHelper1.class,
|
||||
m_model );
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class XMLDocument extends integration.forms.DocumentHelper
|
||||
/* ------------------------------------------------------------------ */
|
||||
private void impl_initialize( XComponent _document )
|
||||
{
|
||||
m_formsSupplier = (XFormsSupplier)UnoRuntime.queryInterface( XFormsSupplier.class,
|
||||
m_formsSupplier = UnoRuntime.queryInterface( XFormsSupplier.class,
|
||||
_document );
|
||||
|
||||
if ( m_formsSupplier == null )
|
||||
@ -86,10 +86,10 @@ public class XMLDocument extends integration.forms.DocumentHelper
|
||||
XModel newModel = null;
|
||||
try
|
||||
{
|
||||
newModel = (XModel) UnoRuntime.queryInterface( XModel.class,
|
||||
newModel = UnoRuntime.queryInterface( XModel.class,
|
||||
getOrb().createInstance( "com.sun.star.xforms.Model" ) );
|
||||
newModel.setID(_modelName);
|
||||
XFormsUIHelper1 modelHelper = (XFormsUIHelper1) UnoRuntime.queryInterface(
|
||||
XFormsUIHelper1 modelHelper = UnoRuntime.queryInterface(
|
||||
XFormsUIHelper1.class, newModel );
|
||||
modelHelper.newInstance( "Instance 1", new String(), true );
|
||||
newModel.initialize();
|
||||
|
@ -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
|
||||
|
@ -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];
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -74,13 +74,13 @@ public class CalcHelper
|
||||
|
||||
public XSpreadsheet getChartSheet() throws RuntimeException
|
||||
{
|
||||
XNameAccess aSheetsNA = (XNameAccess) UnoRuntime.queryInterface(
|
||||
XNameAccess aSheetsNA = UnoRuntime.queryInterface(
|
||||
XNameAccess.class, maSpreadSheetDoc.getSheets() );
|
||||
|
||||
XSpreadsheet aSheet = null;
|
||||
try
|
||||
{
|
||||
aSheet = (XSpreadsheet) UnoRuntime.queryInterface(
|
||||
aSheet = UnoRuntime.queryInterface(
|
||||
XSpreadsheet.class, aSheetsNA.getByName( msChartSheetName ) );
|
||||
}
|
||||
catch( NoSuchElementException ex )
|
||||
@ -97,7 +97,7 @@ public class CalcHelper
|
||||
|
||||
public XSpreadsheet getDataSheet() throws RuntimeException
|
||||
{
|
||||
XNameAccess aSheetsNA = (XNameAccess) UnoRuntime.queryInterface(
|
||||
XNameAccess aSheetsNA = UnoRuntime.queryInterface(
|
||||
XNameAccess.class, maSpreadSheetDoc.getSheets() );
|
||||
|
||||
XSpreadsheet aSheet = null;
|
||||
@ -105,7 +105,7 @@ public class CalcHelper
|
||||
{
|
||||
try
|
||||
{
|
||||
aSheet = (XSpreadsheet) UnoRuntime.queryInterface(
|
||||
aSheet = UnoRuntime.queryInterface(
|
||||
XSpreadsheet.class, aSheetsNA.getByName( msDataSheetName ) );
|
||||
}
|
||||
catch( NoSuchElementException ex )
|
||||
@ -141,7 +141,7 @@ public class CalcHelper
|
||||
// get the sheet to insert the chart
|
||||
try
|
||||
{
|
||||
aSheet = (XTableChartsSupplier) UnoRuntime.queryInterface(
|
||||
aSheet = UnoRuntime.queryInterface(
|
||||
XTableChartsSupplier.class, getChartSheet() );
|
||||
}
|
||||
catch( Exception ex )
|
||||
@ -151,7 +151,7 @@ public class CalcHelper
|
||||
}
|
||||
|
||||
XTableCharts aChartCollection = aSheet.getCharts();
|
||||
XNameAccess aChartCollectionNA = (XNameAccess) UnoRuntime.queryInterface(
|
||||
XNameAccess aChartCollectionNA = UnoRuntime.queryInterface(
|
||||
XNameAccess.class, aChartCollection );
|
||||
|
||||
if( aChartCollectionNA != null &&
|
||||
@ -168,23 +168,23 @@ public class CalcHelper
|
||||
|
||||
try
|
||||
{
|
||||
XTableChart aTableChart = (XTableChart) UnoRuntime.queryInterface(
|
||||
XTableChart aTableChart = UnoRuntime.queryInterface(
|
||||
XTableChart.class, aChartCollectionNA.getByName( sChartName ));
|
||||
|
||||
// the table chart is an embedded object which contains the chart document
|
||||
aResult = (XChartDocument) UnoRuntime.queryInterface(
|
||||
aResult = UnoRuntime.queryInterface(
|
||||
XChartDocument.class,
|
||||
((XEmbeddedObjectSupplier) UnoRuntime.queryInterface(
|
||||
UnoRuntime.queryInterface(
|
||||
XEmbeddedObjectSupplier.class,
|
||||
aTableChart )).getEmbeddedObject());
|
||||
aTableChart ).getEmbeddedObject());
|
||||
|
||||
// create a diagram via the factory and set this as new diagram
|
||||
aResult.setDiagram(
|
||||
(XDiagram) UnoRuntime.queryInterface(
|
||||
UnoRuntime.queryInterface(
|
||||
XDiagram.class,
|
||||
((XMultiServiceFactory) UnoRuntime.queryInterface(
|
||||
UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory.class,
|
||||
aResult )).createInstance( sChartServiceName )));
|
||||
aResult ).createInstance( sChartServiceName )));
|
||||
}
|
||||
catch( NoSuchElementException ex )
|
||||
{
|
||||
@ -210,7 +210,7 @@ public class CalcHelper
|
||||
try
|
||||
{
|
||||
XSpreadsheet aSheet = getDataSheet();
|
||||
XCellRange aSheetRange = (XCellRange) UnoRuntime.queryInterface( XCellRange.class, aSheet );
|
||||
XCellRange aSheetRange = UnoRuntime.queryInterface( XCellRange.class, aSheet );
|
||||
|
||||
aRange = aSheetRange.getCellRangeByPosition(
|
||||
0, 0,
|
||||
@ -239,7 +239,7 @@ public class CalcHelper
|
||||
if( 0 == nCol )
|
||||
{
|
||||
// x values: ascending numbers
|
||||
fValue = (double)nRow + aGenerator.nextDouble();
|
||||
fValue = nRow + aGenerator.nextDouble();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -273,7 +273,7 @@ public class CalcHelper
|
||||
try
|
||||
{
|
||||
XSpreadsheet aSheet = getDataSheet();
|
||||
XCellRange aSheetRange = (XCellRange) UnoRuntime.queryInterface( XCellRange.class, aSheet );
|
||||
XCellRange aSheetRange = UnoRuntime.queryInterface( XCellRange.class, aSheet );
|
||||
|
||||
aRange = aSheetRange.getCellRangeByPosition(
|
||||
0, 0,
|
||||
@ -281,14 +281,14 @@ public class CalcHelper
|
||||
|
||||
int nCol, nRow;
|
||||
double fValue;
|
||||
double fFactor = 2.0 * java.lang.Math.PI / (double)(nRowCount - 1);
|
||||
double fFactor = 2.0 * java.lang.Math.PI / (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 ) );
|
||||
XText xCellText = 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++ )
|
||||
@ -298,7 +298,7 @@ public class CalcHelper
|
||||
if( 0 == nCol )
|
||||
{
|
||||
// x values: ascending numbers
|
||||
fValue = (double)nRow * fFactor;
|
||||
fValue = nRow * fFactor;
|
||||
(aSheet.getCellByPosition( nCol, nRow )).setValue( fValue );
|
||||
}
|
||||
else
|
||||
@ -329,11 +329,11 @@ public class CalcHelper
|
||||
*/
|
||||
public void raiseChartSheet()
|
||||
{
|
||||
((XSpreadsheetView) UnoRuntime.queryInterface(
|
||||
UnoRuntime.queryInterface(
|
||||
XSpreadsheetView.class,
|
||||
((XModel) UnoRuntime.queryInterface(
|
||||
UnoRuntime.queryInterface(
|
||||
XModel.class,
|
||||
maSpreadSheetDoc )).getCurrentController()) ).setActiveSheet( getChartSheet() );
|
||||
maSpreadSheetDoc ).getCurrentController()).setActiveSheet( getChartSheet() );
|
||||
}
|
||||
|
||||
|
||||
@ -354,9 +354,9 @@ public class CalcHelper
|
||||
if( maSpreadSheetDoc != null )
|
||||
{
|
||||
XSpreadsheets aSheets = maSpreadSheetDoc.getSheets();
|
||||
XNameContainer aSheetsNC = (XNameContainer) UnoRuntime.queryInterface(
|
||||
XNameContainer aSheetsNC = UnoRuntime.queryInterface(
|
||||
XNameContainer.class, aSheets );
|
||||
XIndexAccess aSheetsIA = (XIndexAccess) UnoRuntime.queryInterface(
|
||||
XIndexAccess aSheetsIA = UnoRuntime.queryInterface(
|
||||
XIndexAccess.class, aSheets );
|
||||
|
||||
if( aSheets != null &&
|
||||
@ -369,11 +369,11 @@ public class CalcHelper
|
||||
for( int i = aSheetsIA.getCount() - 1; i > 0; i-- )
|
||||
{
|
||||
aSheetsNC.removeByName(
|
||||
( (XNamed) UnoRuntime.queryInterface(
|
||||
XNamed.class, aSheetsIA.getByIndex( i ) )).getName() );
|
||||
UnoRuntime.queryInterface(
|
||||
XNamed.class, aSheetsIA.getByIndex( i ) ).getName() );
|
||||
}
|
||||
|
||||
XNamed aFirstSheet = (XNamed) UnoRuntime.queryInterface(
|
||||
XNamed aFirstSheet = UnoRuntime.queryInterface(
|
||||
XNamed.class,
|
||||
aSheetsIA.getByIndex( 0 ));
|
||||
|
||||
|
@ -74,29 +74,27 @@ public class ChartHelper
|
||||
{
|
||||
XChartDocument aResult = null;
|
||||
|
||||
XMultiServiceFactory aFact = (XMultiServiceFactory)
|
||||
UnoRuntime.queryInterface(XMultiServiceFactory.class,
|
||||
maContainerDocument );
|
||||
XMultiServiceFactory aFact = UnoRuntime.queryInterface(XMultiServiceFactory.class,
|
||||
maContainerDocument );
|
||||
|
||||
if( aFact != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
XTextContent xTextContent = (XTextContent)UnoRuntime.queryInterface(
|
||||
XTextContent xTextContent = UnoRuntime.queryInterface(
|
||||
XTextContent.class,
|
||||
aFact.createInstance("com.sun.star.text.TextEmbeddedObject"));
|
||||
|
||||
if ( xTextContent != null )
|
||||
{
|
||||
XPropertySet xPropSet = (XPropertySet)UnoRuntime.queryInterface(
|
||||
XPropertySet xPropSet = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, xTextContent);
|
||||
|
||||
Any aAny = new Any(String.class, msChartClassID);
|
||||
xPropSet.setPropertyValue("CLSID", aAny );
|
||||
|
||||
XTextDocument xTextDoc = (XTextDocument)
|
||||
UnoRuntime.queryInterface(XTextDocument.class,
|
||||
maContainerDocument);
|
||||
XTextDocument xTextDoc = UnoRuntime.queryInterface(XTextDocument.class,
|
||||
maContainerDocument);
|
||||
XText xText = xTextDoc.getText();
|
||||
XTextCursor xCursor = xText.createTextCursor();
|
||||
|
||||
@ -104,7 +102,7 @@ public class ChartHelper
|
||||
xText.insertTextContent( xCursor, xTextContent, true );
|
||||
|
||||
// set size and position
|
||||
XShape xShape = (XShape)UnoRuntime.queryInterface(
|
||||
XShape xShape = UnoRuntime.queryInterface(
|
||||
XShape.class, xTextContent);
|
||||
xShape.setSize( aExtent );
|
||||
|
||||
@ -120,18 +118,18 @@ public class ChartHelper
|
||||
xPropSet.setPropertyValue("HoriOrientPosition", aAny );
|
||||
|
||||
// retrieve the chart document as model of the OLE shape
|
||||
aResult = (XChartDocument) UnoRuntime.queryInterface(
|
||||
aResult = UnoRuntime.queryInterface(
|
||||
XChartDocument.class,
|
||||
xPropSet.getPropertyValue( "Model" ));
|
||||
|
||||
// create a diagram via the factory and set this as
|
||||
// new diagram
|
||||
aResult.setDiagram(
|
||||
(XDiagram) UnoRuntime.queryInterface(
|
||||
UnoRuntime.queryInterface(
|
||||
XDiagram.class,
|
||||
((XMultiServiceFactory) UnoRuntime.queryInterface(
|
||||
UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory.class,
|
||||
aResult )).createInstance(sChartServiceName )));
|
||||
aResult ).createInstance(sChartServiceName )));
|
||||
}
|
||||
} catch( Exception ex)
|
||||
{
|
||||
@ -153,16 +151,15 @@ public class ChartHelper
|
||||
XShapes aPage = null;
|
||||
|
||||
// try interface for multiple pages in a document
|
||||
XDrawPagesSupplier aSupplier = (XDrawPagesSupplier)
|
||||
UnoRuntime.queryInterface(XDrawPagesSupplier.class,
|
||||
maContainerDocument );
|
||||
XDrawPagesSupplier aSupplier = UnoRuntime.queryInterface(XDrawPagesSupplier.class,
|
||||
maContainerDocument );
|
||||
|
||||
if( aSupplier != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
// get first page
|
||||
aPage = (XShapes) UnoRuntime.queryInterface(
|
||||
aPage = UnoRuntime.queryInterface(
|
||||
XShapes.class, aSupplier.getDrawPages().getByIndex( 0 ) );
|
||||
}
|
||||
catch( Exception ex )
|
||||
@ -174,29 +171,27 @@ public class ChartHelper
|
||||
else
|
||||
{
|
||||
// try interface for single draw page (e.g. spreadsheet)
|
||||
XDrawPageSupplier aOnePageSupplier = (XDrawPageSupplier)
|
||||
UnoRuntime.queryInterface(XDrawPageSupplier.class,
|
||||
maContainerDocument );
|
||||
XDrawPageSupplier aOnePageSupplier = UnoRuntime.queryInterface(XDrawPageSupplier.class,
|
||||
maContainerDocument );
|
||||
|
||||
if( aOnePageSupplier != null )
|
||||
{
|
||||
aPage = (XShapes) UnoRuntime.queryInterface(
|
||||
aPage = UnoRuntime.queryInterface(
|
||||
XShapes.class, aOnePageSupplier.getDrawPage());
|
||||
}
|
||||
}
|
||||
|
||||
if( aPage != null )
|
||||
{
|
||||
XMultiServiceFactory aFact = (XMultiServiceFactory)
|
||||
UnoRuntime.queryInterface(XMultiServiceFactory.class,
|
||||
maContainerDocument );
|
||||
XMultiServiceFactory aFact = UnoRuntime.queryInterface(XMultiServiceFactory.class,
|
||||
maContainerDocument );
|
||||
|
||||
if( aFact != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
// create an OLE shape
|
||||
XShape aShape = (XShape) UnoRuntime.queryInterface(
|
||||
XShape aShape = UnoRuntime.queryInterface(
|
||||
XShape.class,
|
||||
aFact.createInstance( "com.sun.star.drawing.OLE2Shape" ));
|
||||
|
||||
@ -206,26 +201,25 @@ public class ChartHelper
|
||||
aShape.setSize( aExtent );
|
||||
|
||||
// make the OLE shape a chart
|
||||
XPropertySet aShapeProp = (XPropertySet)
|
||||
UnoRuntime.queryInterface(XPropertySet.class, aShape );
|
||||
XPropertySet aShapeProp = UnoRuntime.queryInterface(XPropertySet.class, aShape );
|
||||
if( aShapeProp != null )
|
||||
{
|
||||
// set the class id for charts
|
||||
aShapeProp.setPropertyValue( "CLSID", msChartClassID );
|
||||
|
||||
// retrieve the chart document as model of the OLE shape
|
||||
aResult = (XChartDocument) UnoRuntime.queryInterface(
|
||||
aResult = UnoRuntime.queryInterface(
|
||||
XChartDocument.class,
|
||||
aShapeProp.getPropertyValue( "Model" ));
|
||||
|
||||
// create a diagram via the factory and set this as
|
||||
// new diagram
|
||||
aResult.setDiagram(
|
||||
(XDiagram) UnoRuntime.queryInterface(
|
||||
UnoRuntime.queryInterface(
|
||||
XDiagram.class,
|
||||
((XMultiServiceFactory) UnoRuntime.queryInterface(
|
||||
UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory.class,
|
||||
aResult )).createInstance(sChartServiceName )));
|
||||
aResult ).createInstance(sChartServiceName )));
|
||||
}
|
||||
}
|
||||
catch( Exception ex )
|
||||
|
@ -80,8 +80,8 @@ public class ChartInCalc
|
||||
|
||||
// insert a cell range with 4 columns and 24 rows filled with random numbers
|
||||
XCellRange aRange = aCalcHelper.insertRandomRange( 4, 24 );
|
||||
CellRangeAddress aRangeAddress = ((XCellRangeAddressable) UnoRuntime.queryInterface(
|
||||
XCellRangeAddressable.class, aRange)).getRangeAddress();
|
||||
CellRangeAddress aRangeAddress = UnoRuntime.queryInterface(
|
||||
XCellRangeAddressable.class, aRange).getRangeAddress();
|
||||
|
||||
// change view to sheet containing the chart
|
||||
aCalcHelper.raiseChartSheet();
|
||||
@ -150,7 +150,7 @@ public class ChartInCalc
|
||||
public void lockControllers()
|
||||
throws RuntimeException
|
||||
{
|
||||
((XModel) UnoRuntime.queryInterface( XModel.class, maChartDocument )).lockControllers();
|
||||
UnoRuntime.queryInterface( XModel.class, maChartDocument ).lockControllers();
|
||||
}
|
||||
|
||||
// ____________________
|
||||
@ -158,7 +158,7 @@ public class ChartInCalc
|
||||
public void unlockControllers()
|
||||
throws RuntimeException
|
||||
{
|
||||
((XModel) UnoRuntime.queryInterface( XModel.class, maChartDocument )).unlockControllers();
|
||||
UnoRuntime.queryInterface( XModel.class, maChartDocument ).unlockControllers();
|
||||
}
|
||||
|
||||
// ____________________
|
||||
@ -167,7 +167,7 @@ public class ChartInCalc
|
||||
throws RuntimeException, UnknownPropertyException, PropertyVetoException,
|
||||
com.sun.star.lang.IllegalArgumentException, WrappedTargetException
|
||||
{
|
||||
XPropertySet aDiaProp = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, maDiagram );
|
||||
XPropertySet aDiaProp = UnoRuntime.queryInterface( XPropertySet.class, maDiagram );
|
||||
|
||||
if( aDiaProp != null )
|
||||
{
|
||||
@ -237,7 +237,7 @@ public class ChartInCalc
|
||||
// determine the maximum value of the first series
|
||||
int nMaxIndex = 0;
|
||||
|
||||
XChartDataArray aDataArray = (XChartDataArray) UnoRuntime.queryInterface(
|
||||
XChartDataArray aDataArray = UnoRuntime.queryInterface(
|
||||
XChartDataArray.class, maChartDocument.getData());
|
||||
double aData[][] = aDataArray.getData();
|
||||
|
||||
@ -293,8 +293,8 @@ public class ChartInCalc
|
||||
throws RuntimeException, UnknownPropertyException, PropertyVetoException,
|
||||
com.sun.star.lang.IllegalArgumentException, WrappedTargetException
|
||||
{
|
||||
XPropertySet aWall = ((X3DDisplay) UnoRuntime.queryInterface(
|
||||
X3DDisplay.class, maDiagram )).getWall();
|
||||
XPropertySet aWall = UnoRuntime.queryInterface(
|
||||
X3DDisplay.class, maDiagram ).getWall();
|
||||
|
||||
// change background color of area
|
||||
aWall.setPropertyValue( "FillStyle", FillStyle.SOLID );
|
||||
@ -308,12 +308,12 @@ public class ChartInCalc
|
||||
com.sun.star.lang.IllegalArgumentException, WrappedTargetException
|
||||
{
|
||||
// change main title
|
||||
XPropertySet aDocProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet aDocProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, maChartDocument );
|
||||
aDocProp.setPropertyValue( "HasMainTitle", new Boolean( true ));
|
||||
|
||||
XShape aTitle = maChartDocument.getTitle();
|
||||
XPropertySet aTitleProp = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, aTitle );
|
||||
XPropertySet aTitleProp = UnoRuntime.queryInterface( XPropertySet.class, aTitle );
|
||||
|
||||
// set new text
|
||||
if( aTitleProp != null )
|
||||
@ -323,9 +323,9 @@ public class ChartInCalc
|
||||
}
|
||||
|
||||
// align title with y axis
|
||||
XShape aAxis = (XShape) UnoRuntime.queryInterface(
|
||||
XShape.class, ((XAxisYSupplier) UnoRuntime.queryInterface(
|
||||
XAxisYSupplier.class, maDiagram )).getYAxis() );
|
||||
XShape aAxis = UnoRuntime.queryInterface(
|
||||
XShape.class, UnoRuntime.queryInterface(
|
||||
XAxisYSupplier.class, maDiagram ).getYAxis() );
|
||||
|
||||
if( aAxis != null &&
|
||||
aTitle != null )
|
||||
@ -344,8 +344,8 @@ public class ChartInCalc
|
||||
MalformedNumberFormatException
|
||||
{
|
||||
// x axis
|
||||
XPropertySet aAxisProp = ((XAxisXSupplier) UnoRuntime.queryInterface(
|
||||
XAxisXSupplier.class, maDiagram )).getXAxis();
|
||||
XPropertySet aAxisProp = UnoRuntime.queryInterface(
|
||||
XAxisXSupplier.class, maDiagram ).getXAxis();
|
||||
if( aAxisProp != null )
|
||||
{
|
||||
aAxisProp.setPropertyValue( "Max", new Integer( 24 ));
|
||||
@ -353,12 +353,12 @@ public class ChartInCalc
|
||||
}
|
||||
|
||||
// change number format for y axis
|
||||
aAxisProp = ((XAxisYSupplier) UnoRuntime.queryInterface(
|
||||
XAxisYSupplier.class, maDiagram )).getYAxis();
|
||||
aAxisProp = UnoRuntime.queryInterface(
|
||||
XAxisYSupplier.class, maDiagram ).getYAxis();
|
||||
|
||||
// add a new custom number format and get the new key
|
||||
int nNewNumberFormat = 0;
|
||||
XNumberFormatsSupplier aNumFmtSupp = (XNumberFormatsSupplier) UnoRuntime.queryInterface(
|
||||
XNumberFormatsSupplier aNumFmtSupp = UnoRuntime.queryInterface(
|
||||
XNumberFormatsSupplier.class, maChartDocument );
|
||||
|
||||
if( aNumFmtSupp != null )
|
||||
@ -383,10 +383,10 @@ public class ChartInCalc
|
||||
com.sun.star.lang.IllegalArgumentException, WrappedTargetException
|
||||
{
|
||||
// y major grid
|
||||
XPropertySet aGridProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet aGridProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class,
|
||||
( (XAxisYSupplier) UnoRuntime.queryInterface(
|
||||
XAxisYSupplier.class, maDiagram )).getYMainGrid());
|
||||
UnoRuntime.queryInterface(
|
||||
XAxisYSupplier.class, maDiagram ).getYMainGrid());
|
||||
|
||||
if( aGridProp != null )
|
||||
{
|
||||
|
@ -121,7 +121,7 @@ public class ChartInDraw
|
||||
public void lockControllers()
|
||||
throws RuntimeException
|
||||
{
|
||||
((XModel) UnoRuntime.queryInterface( XModel.class, maChartDocument )).lockControllers();
|
||||
UnoRuntime.queryInterface( XModel.class, maChartDocument ).lockControllers();
|
||||
}
|
||||
|
||||
// ____________________
|
||||
@ -129,7 +129,7 @@ public class ChartInDraw
|
||||
public void unlockControllers()
|
||||
throws RuntimeException
|
||||
{
|
||||
((XModel) UnoRuntime.queryInterface( XModel.class, maChartDocument )).unlockControllers();
|
||||
UnoRuntime.queryInterface( XModel.class, maChartDocument ).unlockControllers();
|
||||
}
|
||||
|
||||
// ____________________
|
||||
@ -154,8 +154,8 @@ public class ChartInDraw
|
||||
throws RuntimeException, UnknownPropertyException, PropertyVetoException,
|
||||
com.sun.star.lang.IllegalArgumentException, WrappedTargetException
|
||||
{
|
||||
XPropertySet aWall = ((X3DDisplay) UnoRuntime.queryInterface(
|
||||
X3DDisplay.class, maDiagram )).getWall();
|
||||
XPropertySet aWall = UnoRuntime.queryInterface(
|
||||
X3DDisplay.class, maDiagram ).getWall();
|
||||
|
||||
// change background color of area
|
||||
aWall.setPropertyValue( "FillColor", new Integer( 0xcccccc ));
|
||||
@ -169,12 +169,12 @@ public class ChartInDraw
|
||||
com.sun.star.lang.IllegalArgumentException, WrappedTargetException
|
||||
{
|
||||
// change main title
|
||||
XPropertySet aDocProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet aDocProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, maChartDocument );
|
||||
aDocProp.setPropertyValue( "HasMainTitle", new Boolean( true ));
|
||||
|
||||
XShape aTitle = maChartDocument.getTitle();
|
||||
XPropertySet aTitleProp = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, aTitle );
|
||||
XPropertySet aTitleProp = UnoRuntime.queryInterface( XPropertySet.class, aTitle );
|
||||
|
||||
// set new text
|
||||
if( aTitleProp != null )
|
||||
@ -190,7 +190,7 @@ public class ChartInDraw
|
||||
com.sun.star.lang.IllegalArgumentException, WrappedTargetException
|
||||
{
|
||||
XShape aLegend = maChartDocument.getLegend();
|
||||
XPropertySet aLegendProp = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, aLegend );
|
||||
XPropertySet aLegendProp = UnoRuntime.queryInterface( XPropertySet.class, aLegend );
|
||||
|
||||
aLegendProp.setPropertyValue( "Alignment", ChartLegendPosition.LEFT );
|
||||
aLegendProp.setPropertyValue( "FillStyle", FillStyle.SOLID );
|
||||
@ -204,7 +204,7 @@ public class ChartInDraw
|
||||
com.sun.star.lang.IllegalArgumentException, WrappedTargetException,
|
||||
com.sun.star.lang.IndexOutOfBoundsException
|
||||
{
|
||||
XPropertySet aDiaProp = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, maDiagram );
|
||||
XPropertySet aDiaProp = UnoRuntime.queryInterface( XPropertySet.class, maDiagram );
|
||||
Boolean aTrue = new Boolean( true );
|
||||
|
||||
aDiaProp.setPropertyValue( "Dim3D", aTrue );
|
||||
@ -213,8 +213,8 @@ public class ChartInDraw
|
||||
aDiaProp.setPropertyValue( "SolidType", new Integer( ChartSolidType.CYLINDER ));
|
||||
|
||||
// change floor color to Magenta6
|
||||
XPropertySet aFloor = ((X3DDisplay) UnoRuntime.queryInterface(
|
||||
X3DDisplay.class, maDiagram )).getFloor();
|
||||
XPropertySet aFloor = UnoRuntime.queryInterface(
|
||||
X3DDisplay.class, maDiagram ).getFloor();
|
||||
aFloor.setPropertyValue( "FillColor", new Integer( 0x6b2394 ));
|
||||
|
||||
// apply changes to get a 3d scene
|
||||
|
@ -73,7 +73,7 @@ public class ChartInWriter
|
||||
Helper aHelper = new Helper( args );
|
||||
|
||||
ChartHelper aChartHelper = new ChartHelper(
|
||||
(XModel) UnoRuntime.queryInterface( XModel.class,
|
||||
UnoRuntime.queryInterface( XModel.class,
|
||||
aHelper.createTextDocument()));
|
||||
|
||||
// the unit for measures is 1/100th of a millimeter
|
||||
@ -126,7 +126,7 @@ public class ChartInWriter
|
||||
public void lockControllers()
|
||||
throws RuntimeException
|
||||
{
|
||||
((XModel) UnoRuntime.queryInterface( XModel.class, maChartDocument )).lockControllers();
|
||||
UnoRuntime.queryInterface( XModel.class, maChartDocument ).lockControllers();
|
||||
}
|
||||
|
||||
// ____________________
|
||||
@ -134,7 +134,7 @@ public class ChartInWriter
|
||||
public void unlockControllers()
|
||||
throws RuntimeException
|
||||
{
|
||||
((XModel) UnoRuntime.queryInterface( XModel.class, maChartDocument )).unlockControllers();
|
||||
UnoRuntime.queryInterface( XModel.class, maChartDocument ).unlockControllers();
|
||||
}
|
||||
|
||||
// ____________________
|
||||
@ -143,8 +143,8 @@ public class ChartInWriter
|
||||
throws RuntimeException, UnknownPropertyException, PropertyVetoException,
|
||||
com.sun.star.lang.IllegalArgumentException, WrappedTargetException
|
||||
{
|
||||
XPropertySet aWall = ((X3DDisplay) UnoRuntime.queryInterface(
|
||||
X3DDisplay.class, maDiagram )).getWall();
|
||||
XPropertySet aWall = UnoRuntime.queryInterface(
|
||||
X3DDisplay.class, maDiagram ).getWall();
|
||||
|
||||
// change background color of area
|
||||
aWall.setPropertyValue( "FillColor", new Integer( 0xeecc99 ));
|
||||
|
@ -75,7 +75,7 @@ public class Helper
|
||||
|
||||
public XSpreadsheetDocument createSpreadsheetDocument()
|
||||
{
|
||||
return (XSpreadsheetDocument) UnoRuntime.queryInterface(
|
||||
return UnoRuntime.queryInterface(
|
||||
XSpreadsheetDocument.class, createDocument( "scalc" ));
|
||||
}
|
||||
|
||||
@ -107,12 +107,11 @@ public class Helper
|
||||
XModel aResult = null;
|
||||
try
|
||||
{
|
||||
XComponentLoader aLoader = (XComponentLoader)
|
||||
UnoRuntime.queryInterface(XComponentLoader.class,
|
||||
maMCFactory.createInstanceWithContext("com.sun.star.frame.Desktop",
|
||||
maContext) );
|
||||
XComponentLoader aLoader = UnoRuntime.queryInterface(XComponentLoader.class,
|
||||
maMCFactory.createInstanceWithContext("com.sun.star.frame.Desktop",
|
||||
maContext) );
|
||||
|
||||
aResult = (XModel) UnoRuntime.queryInterface(
|
||||
aResult = UnoRuntime.queryInterface(
|
||||
XModel.class,
|
||||
aLoader.loadComponentFromURL( "private:factory/" + sDocType,
|
||||
"_blank",
|
||||
|
@ -80,10 +80,10 @@ public class JavaSampleChartAddIn extends WeakBase implements
|
||||
{
|
||||
if( aArguments.length > 0 )
|
||||
{
|
||||
maChartDocument = (XChartDocument) UnoRuntime.queryInterface(
|
||||
maChartDocument = UnoRuntime.queryInterface(
|
||||
XChartDocument.class, aArguments[ 0 ]);
|
||||
|
||||
XPropertySet aDocProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet aDocProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, maChartDocument );
|
||||
if( aDocProp != null )
|
||||
{
|
||||
@ -92,14 +92,14 @@ public class JavaSampleChartAddIn extends WeakBase implements
|
||||
}
|
||||
|
||||
// get the draw page
|
||||
XDrawPageSupplier aPageSupp = (XDrawPageSupplier) UnoRuntime.queryInterface(
|
||||
XDrawPageSupplier aPageSupp = UnoRuntime.queryInterface(
|
||||
XDrawPageSupplier.class, maChartDocument );
|
||||
if( aPageSupp != null )
|
||||
maDrawPage = (XDrawPage) UnoRuntime.queryInterface(
|
||||
maDrawPage = UnoRuntime.queryInterface(
|
||||
XDrawPage.class, aPageSupp.getDrawPage() );
|
||||
|
||||
// get a factory for creating shapes
|
||||
maShapeFactory = (XMultiServiceFactory) UnoRuntime.queryInterface(
|
||||
maShapeFactory = UnoRuntime.queryInterface(
|
||||
XMultiServiceFactory.class, maChartDocument );
|
||||
}
|
||||
}
|
||||
@ -112,13 +112,13 @@ public class JavaSampleChartAddIn extends WeakBase implements
|
||||
maTopLine == null )
|
||||
{
|
||||
// try to recycle loaded shapes
|
||||
XPropertySet aDocProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet aDocProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, maChartDocument );
|
||||
if( aDocProp != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
XIndexAccess aShapesIA = (XIndexAccess) UnoRuntime.queryInterface(
|
||||
XIndexAccess aShapesIA = UnoRuntime.queryInterface(
|
||||
XIndexAccess.class, aDocProp.getPropertyValue( "AdditionalShapes" ));
|
||||
if( aShapesIA != null &&
|
||||
aShapesIA.getCount() > 0 )
|
||||
@ -127,11 +127,11 @@ public class JavaSampleChartAddIn extends WeakBase implements
|
||||
String aName;
|
||||
for( int i = aShapesIA.getCount() - 1; i >= 0; --i )
|
||||
{
|
||||
aShape = (XShape) UnoRuntime.queryInterface(
|
||||
aShape = UnoRuntime.queryInterface(
|
||||
XShape.class, aShapesIA.getByIndex( i ));
|
||||
if( aShape != null )
|
||||
{
|
||||
XPropertySet aProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet aProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, aShape );
|
||||
aName = (String) aProp.getPropertyValue( "Name" );
|
||||
|
||||
@ -159,12 +159,12 @@ public class JavaSampleChartAddIn extends WeakBase implements
|
||||
{
|
||||
if( maTopLine == null )
|
||||
{
|
||||
maTopLine = (XShape) UnoRuntime.queryInterface(
|
||||
maTopLine = UnoRuntime.queryInterface(
|
||||
XShape.class, maShapeFactory.createInstance( "com.sun.star.drawing.LineShape" ));
|
||||
maDrawPage.add( maTopLine );
|
||||
|
||||
// make line red and thicker
|
||||
XPropertySet aShapeProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet aShapeProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, maTopLine );
|
||||
|
||||
aShapeProp.setPropertyValue( "LineColor", new Integer( 0xe01010 ));
|
||||
@ -182,12 +182,12 @@ public class JavaSampleChartAddIn extends WeakBase implements
|
||||
{
|
||||
if( maBottomLine == null )
|
||||
{
|
||||
maBottomLine = (XShape) UnoRuntime.queryInterface(
|
||||
maBottomLine = UnoRuntime.queryInterface(
|
||||
XShape.class, maShapeFactory.createInstance( "com.sun.star.drawing.LineShape" ));
|
||||
maDrawPage.add( maBottomLine );
|
||||
|
||||
// make line green and thicker
|
||||
XPropertySet aShapeProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet aShapeProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, maBottomLine );
|
||||
|
||||
aShapeProp.setPropertyValue( "LineColor", new Integer( 0x10e010 ));
|
||||
@ -211,18 +211,18 @@ public class JavaSampleChartAddIn extends WeakBase implements
|
||||
// --------------
|
||||
|
||||
// get data
|
||||
XChartDataArray aDataArray = (XChartDataArray) UnoRuntime.queryInterface(
|
||||
XChartDataArray aDataArray = UnoRuntime.queryInterface(
|
||||
XChartDataArray.class, maChartDocument.getData());
|
||||
double aData[][] = aDataArray.getData();
|
||||
|
||||
// get axes
|
||||
XDiagram aDiagram = maChartDocument.getDiagram();
|
||||
XShape aXAxis = (XShape) UnoRuntime.queryInterface(
|
||||
XShape.class, ((XAxisXSupplier) UnoRuntime.queryInterface(
|
||||
XAxisXSupplier.class, aDiagram )).getXAxis() );
|
||||
XShape aYAxis = (XShape) UnoRuntime.queryInterface(
|
||||
XShape.class, ((XAxisYSupplier) UnoRuntime.queryInterface(
|
||||
XAxisYSupplier.class, aDiagram )).getYAxis() );
|
||||
XShape aXAxis = UnoRuntime.queryInterface(
|
||||
XShape.class, UnoRuntime.queryInterface(
|
||||
XAxisXSupplier.class, aDiagram ).getXAxis() );
|
||||
XShape aYAxis = UnoRuntime.queryInterface(
|
||||
XShape.class, UnoRuntime.queryInterface(
|
||||
XAxisYSupplier.class, aDiagram ).getYAxis() );
|
||||
|
||||
// calculate points for hull
|
||||
final int nLength = aData.length;
|
||||
@ -253,11 +253,11 @@ public class JavaSampleChartAddIn extends WeakBase implements
|
||||
// apply point sequences to lines
|
||||
try
|
||||
{
|
||||
XPropertySet aShapeProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet aShapeProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, maTopLine );
|
||||
aShapeProp.setPropertyValue( "PolyPolygon", aMaxPtSeq );
|
||||
|
||||
aShapeProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
aShapeProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, maBottomLine );
|
||||
aShapeProp.setPropertyValue( "PolyPolygon", aMinPtSeq );
|
||||
}
|
||||
@ -330,20 +330,20 @@ public class JavaSampleChartAddIn extends WeakBase implements
|
||||
// XShape : XDiagram
|
||||
public Size getSize() throws RuntimeException
|
||||
{
|
||||
return ((XShape) UnoRuntime.queryInterface( XShape.class, maChartDocument.getDiagram())).getSize();
|
||||
return UnoRuntime.queryInterface( XShape.class, maChartDocument.getDiagram()).getSize();
|
||||
}
|
||||
public void setSize( Size aSize ) throws RuntimeException, PropertyVetoException
|
||||
{
|
||||
((XShape) UnoRuntime.queryInterface( XShape.class, maChartDocument.getDiagram())).setSize( aSize );
|
||||
UnoRuntime.queryInterface( XShape.class, maChartDocument.getDiagram()).setSize( aSize );
|
||||
}
|
||||
|
||||
public Point getPosition() throws RuntimeException
|
||||
{
|
||||
return ((XShape) UnoRuntime.queryInterface( XShape.class, maChartDocument.getDiagram())).getPosition();
|
||||
return UnoRuntime.queryInterface( XShape.class, maChartDocument.getDiagram()).getPosition();
|
||||
}
|
||||
public void setPosition( Point aPos ) throws RuntimeException
|
||||
{
|
||||
((XShape) UnoRuntime.queryInterface( XShape.class, maChartDocument.getDiagram())).setPosition( aPos );
|
||||
UnoRuntime.queryInterface( XShape.class, maChartDocument.getDiagram()).setPosition( aPos );
|
||||
}
|
||||
|
||||
// XShapeDescriptor : XShape : XDiagram
|
||||
@ -370,7 +370,7 @@ public class JavaSampleChartAddIn extends WeakBase implements
|
||||
|
||||
if( aAxis != null )
|
||||
{
|
||||
XPropertySet aAxisProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet aAxisProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, aAxis );
|
||||
|
||||
try
|
||||
@ -386,13 +386,13 @@ public class JavaSampleChartAddIn extends WeakBase implements
|
||||
if( bVertical )
|
||||
{
|
||||
nResult = aAxis.getPosition().Y +
|
||||
(int)((double)(aAxis.getSize().Height) *
|
||||
(int)((aAxis.getSize().Height) *
|
||||
(1.0 - (( fValue - fMin ) / fRange )));
|
||||
}
|
||||
else
|
||||
{
|
||||
nResult = aAxis.getPosition().X +
|
||||
(int)((double)(aAxis.getSize().Width) *
|
||||
(int)((aAxis.getSize().Width) *
|
||||
(( fValue - fMin ) / fRange ));
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class ListenAtCalcRangeInDraw implements XChartDataChangeEventListener
|
||||
"com.sun.star.chart.XYDiagram" );
|
||||
|
||||
// attach the data coming from the cell range to the chart
|
||||
maChartData = (XChartData) UnoRuntime.queryInterface( XChartData.class, aRange );
|
||||
maChartData = UnoRuntime.queryInterface( XChartData.class, aRange );
|
||||
maChartDocument.attachData( maChartData );
|
||||
}
|
||||
|
||||
@ -105,17 +105,17 @@ public class ListenAtCalcRangeInDraw implements XChartDataChangeEventListener
|
||||
{
|
||||
try
|
||||
{
|
||||
((XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet.class, maChartDocument )).setPropertyValue(
|
||||
UnoRuntime.queryInterface(
|
||||
XPropertySet.class, maChartDocument ).setPropertyValue(
|
||||
"HasSubTitle", new Boolean( true ));
|
||||
|
||||
// start listening for death of spreadsheet
|
||||
((XComponent) UnoRuntime.queryInterface(
|
||||
XComponent.class, maSheetDoc )).addEventListener( this );
|
||||
UnoRuntime.queryInterface(
|
||||
XComponent.class, maSheetDoc ).addEventListener( this );
|
||||
|
||||
// start listening for death of chart
|
||||
((XComponent) UnoRuntime.queryInterface(
|
||||
XComponent.class, maChartDocument )).addEventListener( this );
|
||||
UnoRuntime.queryInterface(
|
||||
XComponent.class, maChartDocument ).addEventListener( this );
|
||||
|
||||
//start listening for change of data
|
||||
maChartData.addChartDataChangeEventListener( this );
|
||||
@ -146,10 +146,10 @@ public class ListenAtCalcRangeInDraw implements XChartDataChangeEventListener
|
||||
maChartData.removeChartDataChangeEventListener( this );
|
||||
|
||||
// remove dispose listeners
|
||||
((XComponent) UnoRuntime.queryInterface(
|
||||
XComponent.class, maSheetDoc )).removeEventListener( this );
|
||||
((XComponent) UnoRuntime.queryInterface(
|
||||
XComponent.class, maChartDocument )).removeEventListener( this );
|
||||
UnoRuntime.queryInterface(
|
||||
XComponent.class, maSheetDoc ).removeEventListener( this );
|
||||
UnoRuntime.queryInterface(
|
||||
XComponent.class, maChartDocument ).removeEventListener( this );
|
||||
|
||||
System.exit( 0 );
|
||||
}
|
||||
@ -164,12 +164,12 @@ public class ListenAtCalcRangeInDraw implements XChartDataChangeEventListener
|
||||
|
||||
try
|
||||
{
|
||||
XPropertySet aDocProp = (XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet aDocProp = UnoRuntime.queryInterface(
|
||||
XPropertySet.class, maChartDocument );
|
||||
aDocProp.setPropertyValue( "HasMainTitle", new Boolean( true ));
|
||||
|
||||
((XPropertySet) UnoRuntime.queryInterface(
|
||||
XPropertySet.class, maChartDocument.getSubTitle())).setPropertyValue(
|
||||
UnoRuntime.queryInterface(
|
||||
XPropertySet.class, maChartDocument.getSubTitle()).setPropertyValue(
|
||||
"String", aTitle );
|
||||
|
||||
maChartDocument.attachData( maChartData );
|
||||
|
@ -83,8 +83,8 @@ public class SelectionChangeListener implements XSelectionChangeListener {
|
||||
|
||||
// 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();
|
||||
CellRangeAddress aRangeAddress = UnoRuntime.queryInterface(
|
||||
XCellRangeAddressable.class, aRange).getRangeAddress();
|
||||
|
||||
// change view to sheet containing the chart
|
||||
aCalcHelper.raiseChartSheet();
|
||||
@ -113,10 +113,10 @@ public class SelectionChangeListener implements XSelectionChangeListener {
|
||||
|
||||
while( bTrying ) {
|
||||
// start listening for selection changes
|
||||
XSelectionSupplier aSelSupp = (XSelectionSupplier) UnoRuntime.queryInterface(
|
||||
XSelectionSupplier aSelSupp = UnoRuntime.queryInterface(
|
||||
XSelectionSupplier.class,
|
||||
(((XModel) UnoRuntime.queryInterface(
|
||||
XModel.class, maChartDocument )).getCurrentController()) );
|
||||
(UnoRuntime.queryInterface(
|
||||
XModel.class, maChartDocument ).getCurrentController()) );
|
||||
if( aSelSupp != null ) {
|
||||
aSelSupp.addSelectionChangeListener( this );
|
||||
System.out.println( "Successfully attached as selection change listener" );
|
||||
@ -124,7 +124,7 @@ public class SelectionChangeListener implements XSelectionChangeListener {
|
||||
}
|
||||
|
||||
// start listening for death of Controller
|
||||
XComponent aComp = (XComponent) UnoRuntime.queryInterface( XComponent.class, aSelSupp );
|
||||
XComponent aComp = UnoRuntime.queryInterface( XComponent.class, aSelSupp );
|
||||
if( aComp != null ) {
|
||||
aComp.addEventListener( this );
|
||||
System.out.println( "Successfully attached as dispose listener" );
|
||||
@ -144,13 +144,13 @@ public class SelectionChangeListener implements XSelectionChangeListener {
|
||||
System.out.println( "disposing called. detaching as listener" );
|
||||
|
||||
// stop listening for selection changes
|
||||
XSelectionSupplier aCtrl = (XSelectionSupplier) UnoRuntime.queryInterface(
|
||||
XSelectionSupplier aCtrl = UnoRuntime.queryInterface(
|
||||
XSelectionSupplier.class, aSourceObj );
|
||||
if( aCtrl != null )
|
||||
aCtrl.removeSelectionChangeListener( this );
|
||||
|
||||
// remove as dispose listener
|
||||
XComponent aComp = (XComponent) UnoRuntime.queryInterface( XComponent.class, aSourceObj );
|
||||
XComponent aComp = UnoRuntime.queryInterface( XComponent.class, aSourceObj );
|
||||
if( aComp != null )
|
||||
aComp.removeEventListener( this );
|
||||
|
||||
@ -162,7 +162,7 @@ public class SelectionChangeListener implements XSelectionChangeListener {
|
||||
|
||||
// XSelectionChangeListener
|
||||
public void selectionChanged( EventObject aEvent ) {
|
||||
XController aCtrl = (XController) UnoRuntime.queryInterface( XController.class, aEvent.Source );
|
||||
XController aCtrl = UnoRuntime.queryInterface( XController.class, aEvent.Source );
|
||||
if( aCtrl != null ) {
|
||||
XMultiComponentFactory mMCF = maContext.getServiceManager();
|
||||
|
||||
@ -195,18 +195,18 @@ public class SelectionChangeListener implements XSelectionChangeListener {
|
||||
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);
|
||||
aDesktop = UnoRuntime.queryInterface(XDesktop.class, oDesktop);
|
||||
aToolKit = UnoRuntime.queryInterface(XInterface.class, oToolKit);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
XWindow xWin = aDesktop.getCurrentFrame().getContainerWindow();
|
||||
XWindowPeer aWinPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xWin);
|
||||
XWindowPeer aWinPeer = 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);
|
||||
XMessageBoxFactory aMBF = UnoRuntime.queryInterface(XMessageBoxFactory.class, aToolKit);
|
||||
XMessageBox xMB = aMBF.createMessageBox(aWinPeer, aRect, "infobox" , button, "Event-Notify", "Listener was called, selcetion has changed");
|
||||
xMB.execute();
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ public class AsyncJob extends WeakBase implements XServiceInfo, XAsyncJob
|
||||
try
|
||||
{
|
||||
// get access to the office toolkit environment
|
||||
com.sun.star.awt.XToolkit xKit = (com.sun.star.awt.XToolkit)UnoRuntime.queryInterface(
|
||||
com.sun.star.awt.XToolkit xKit = UnoRuntime.queryInterface(
|
||||
com.sun.star.awt.XToolkit.class,
|
||||
m_xCmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.awt.Toolkit",
|
||||
m_xCmpCtx));
|
||||
@ -267,13 +267,13 @@ public class AsyncJob extends WeakBase implements XServiceInfo, XAsyncJob
|
||||
com.sun.star.awt.WindowAttribute.CLOSEABLE;
|
||||
aDescriptor.Type = com.sun.star.awt.WindowClass.MODALTOP;
|
||||
aDescriptor.ParentIndex = 1;
|
||||
aDescriptor.Parent = (com.sun.star.awt.XWindowPeer)UnoRuntime.queryInterface(
|
||||
aDescriptor.Parent = UnoRuntime.queryInterface(
|
||||
com.sun.star.awt.XWindowPeer.class,
|
||||
xParent);
|
||||
|
||||
// create the info box window
|
||||
com.sun.star.awt.XWindowPeer xPeer = xKit.createWindow(aDescriptor);
|
||||
com.sun.star.awt.XMessageBox xInfoBox = (com.sun.star.awt.XMessageBox)UnoRuntime.queryInterface(
|
||||
com.sun.star.awt.XMessageBox xInfoBox = UnoRuntime.queryInterface(
|
||||
com.sun.star.awt.XMessageBox.class,
|
||||
xPeer);
|
||||
if (xInfoBox == null)
|
||||
|
Loading…
x
Reference in New Issue
Block a user