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