summaryrefslogtreecommitdiff
path: root/unotest
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-12-19 16:03:41 +0200
committerNoel Grandin <noel@peralex.com>2015-01-05 08:23:29 +0200
commit43cc8ad33e815522e2b23ac87a4a9c4526cd85c9 (patch)
treeb042266508f8b084bc7bbe9cc57250a971311099 /unotest
parentcfcbe2e44e33f4a60e70006ff5e1cbb9aa2adceb (diff)
java: remove dead code
found by UCDetector Change-Id: I6b0f49529379072da566e927b86815f173e7a90b
Diffstat (limited to 'unotest')
-rw-r--r--unotest/source/java/org/openoffice/test/UnoApiTest.java7
-rw-r--r--unotest/source/java/org/openoffice/test/tools/DocumentType.java18
-rw-r--r--unotest/source/java/org/openoffice/test/tools/OfficeDocument.java112
-rw-r--r--unotest/source/java/org/openoffice/test/tools/OfficeDocumentView.java31
-rw-r--r--unotest/source/java/org/openoffice/test/tools/SpreadsheetView.java28
5 files changed, 4 insertions, 192 deletions
diff --git a/unotest/source/java/org/openoffice/test/UnoApiTest.java b/unotest/source/java/org/openoffice/test/UnoApiTest.java
index 13e5a140218d..b99f4aaf99af 100644
--- a/unotest/source/java/org/openoffice/test/UnoApiTest.java
+++ b/unotest/source/java/org/openoffice/test/UnoApiTest.java
@@ -20,19 +20,20 @@ package org.openoffice.test;
import org.openoffice.Runner;
import static org.junit.Assert.*;
+import org.junit.*;
public final class UnoApiTest {
- @org.junit.Before public void setUp() throws Exception {
+ @Before public void setUp() throws Exception {
connection.setUp();
}
- @org.junit.After public void tearDown()
+ @After public void tearDown()
throws InterruptedException, com.sun.star.uno.Exception
{
connection.tearDown();
}
- @org.junit.Test public void test() {
+ @Test public void test() {
assertTrue(
Runner.run(
"-sce", Argument.get("sce"), "-xcl", Argument.get("xcl"), "-tdoc",
diff --git a/unotest/source/java/org/openoffice/test/tools/DocumentType.java b/unotest/source/java/org/openoffice/test/tools/DocumentType.java
index 6b2e9700024e..bb4745f7b3c7 100644
--- a/unotest/source/java/org/openoffice/test/tools/DocumentType.java
+++ b/unotest/source/java/org/openoffice/test/tools/DocumentType.java
@@ -26,11 +26,6 @@ public class DocumentType extends com.sun.star.uno.Enum
super( value );
}
- public static DocumentType getDefault()
- {
- return WRITER;
- }
-
public static final DocumentType WRITER = new DocumentType(0);
public static final DocumentType CALC = new DocumentType(1);
public static final DocumentType DRAWING = new DocumentType(2);
@@ -39,17 +34,4 @@ public class DocumentType extends com.sun.star.uno.Enum
public static final DocumentType FORMULA = new DocumentType(5);
public static final DocumentType UNKNOWN = new DocumentType(-1);
- public static DocumentType fromInt(int value)
- {
- switch(value)
- {
- case 0: return WRITER;
- case 1: return CALC;
- case 2: return DRAWING;
- case 3: return XMLFORM;
- case 4: return PRESENTATION;
- case 5: return FORMULA;
- default: return UNKNOWN;
- }
- }
}
diff --git a/unotest/source/java/org/openoffice/test/tools/OfficeDocument.java b/unotest/source/java/org/openoffice/test/tools/OfficeDocument.java
index fe3035fcefa1..655d17a9a7bd 100644
--- a/unotest/source/java/org/openoffice/test/tools/OfficeDocument.java
+++ b/unotest/source/java/org/openoffice/test/tools/OfficeDocument.java
@@ -20,13 +20,8 @@ package org.openoffice.test.tools;
import com.sun.star.beans.PropertyState;
import com.sun.star.beans.PropertyValue;
import com.sun.star.document.MacroExecMode;
-import com.sun.star.drawing.XDrawPage;
-import com.sun.star.drawing.XDrawPageSupplier;
-import com.sun.star.drawing.XDrawPages;
-import com.sun.star.drawing.XDrawPagesSupplier;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.frame.XController;
-import com.sun.star.frame.XFrame;
import com.sun.star.frame.XModel;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
@@ -35,7 +30,6 @@ import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
import com.sun.star.util.CloseVetoException;
import com.sun.star.util.XCloseable;
-import com.sun.star.util.XModifiable;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -73,12 +67,6 @@ public class OfficeDocument
}
/* ------------------------------------------------------------------ */
- private static OfficeDocument implLoadDocument( XMultiServiceFactory orb, String documentOrFactoryURL ) throws com.sun.star.uno.Exception
- {
- return implLoadDocument( orb, documentOrFactoryURL, new PropertyValue[0] );
- }
-
- /* ------------------------------------------------------------------ */
private static OfficeDocument implLoadDocument( XMultiServiceFactory orb, String documentOrFactoryURL, final PropertyValue[] i_args ) throws com.sun.star.uno.Exception
{
XComponent document = implLoadAsComponent( orb, documentOrFactoryURL, i_args );
@@ -90,24 +78,12 @@ public class OfficeDocument
}
/* ------------------------------------------------------------------ */
- public static OfficeDocument loadDocument( XMultiServiceFactory orb, String documentURL ) throws com.sun.star.uno.Exception
- {
- return implLoadDocument( orb, documentURL );
- }
-
- /* ------------------------------------------------------------------ */
public static OfficeDocument blankTextDocument( XMultiServiceFactory orb ) throws com.sun.star.uno.Exception
{
return blankDocument( orb, DocumentType.WRITER );
}
/* ------------------------------------------------------------------ */
- public static OfficeDocument blankXMLForm( XMultiServiceFactory orb ) throws com.sun.star.uno.Exception
- {
- return blankDocument( orb, DocumentType.XMLFORM );
- }
-
- /* ------------------------------------------------------------------ */
public static OfficeDocument blankDocument( XMultiServiceFactory orb, DocumentType eType ) throws com.sun.star.uno.Exception
{
final PropertyValue[] args = new PropertyValue[] {
@@ -140,25 +116,6 @@ public class OfficeDocument
}
/* ------------------------------------------------------------------ */
- public boolean isModified()
- {
- XModifiable modify = query( XModifiable.class );
- return modify.isModified();
- }
-
- /* ------------------------------------------------------------------ */
- private <T> T query( Class<T> aInterfaceClass )
- {
- return UnoRuntime.queryInterface( aInterfaceClass, m_documentComponent );
- }
-
- /* ------------------------------------------------------------------ */
- public XMultiServiceFactory getOrb( )
- {
- return m_orb;
- }
-
- /* ------------------------------------------------------------------ */
/** retrieves the current view of the document
@return
the view component, queried for the interface described by aInterfaceClass
@@ -178,33 +135,6 @@ public class OfficeDocument
}
/* ------------------------------------------------------------------ */
- /** reloads the document
- *
- * The reload is done by dispatching the respective URL at a frame of the document.
- * As a consequence, if you have references to a view of the document, or any interface
- * of the document, they will become invalid.
- * The Model instance itself, at which you called reload, will still be valid, it will
- * automatically update its internal state after the reload.
- *
- * Another consequence is that if the document does not have a view at all, it cannot
- * be reloaded.
- */
- public void reload() throws Exception
- {
- OfficeDocumentView view = getCurrentView();
- XFrame frame = view.getController().getFrame();
- XModel oldModel = frame.getController().getModel();
-
- getCurrentView().dispatch( ".uno:Reload" );
-
- m_documentComponent = UnoRuntime.queryInterface( XComponent.class, frame.getController().getModel() );
-
- XModel newModel = getCurrentView().getController().getModel();
- if ( UnoRuntime.areSame( oldModel, newModel ) )
- throw new java.lang.IllegalStateException( "reload failed" );
- }
-
- /* ------------------------------------------------------------------ */
/** returns a URL which can be used to create a document of a certain type
*/
private static String getDocumentFactoryURL( DocumentType eType )
@@ -246,48 +176,6 @@ public class OfficeDocument
}
/* ------------------------------------------------------------------ */
- /** retrieves a com.sun.star.drawing.DrawPage of the document, denoted by index
- * @param index
- * the index of the draw page
- * @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 = UnoRuntime.queryInterface( XDrawPagesSupplier.class, getDocument() );
- XDrawPages xPages = xSuppPages.getDrawPages();
-
- return UnoRuntime.queryInterface( XDrawPage.class, xPages.getByIndex( index ) );
- }
-
- /* ------------------------------------------------------------------ */
- /** retrieves the <type scope="com.sun.star.drawing">DrawPage</type> of the document
- */
- protected XDrawPage getMainDrawPage( ) throws com.sun.star.uno.Exception
- {
- XDrawPage xReturn;
-
- // in case of a Writer document, this is rather easy: simply ask the XDrawPageSupplier
- XDrawPageSupplier xSuppPage = UnoRuntime.queryInterface( XDrawPageSupplier.class, getDocument() );
- if ( null != xSuppPage )
- xReturn = xSuppPage.getDrawPage();
- else
- { // the model itself is no draw page supplier - okay, it may be a Writer or Calc document
- // (or any other multi-page document)
- XDrawPagesSupplier xSuppPages = UnoRuntime.queryInterface( XDrawPagesSupplier.class, getDocument() );
- XDrawPages xPages = xSuppPages.getDrawPages();
-
- xReturn = UnoRuntime.queryInterface( XDrawPage.class, xPages.getByIndex( 0 ) );
-
- // Note that this is no really error-proof code: If the document model does not support the
- // XDrawPagesSupplier interface, or if the pages collection returned is empty, this will break.
- }
-
- return xReturn;
- }
-
- /* ------------------------------------------------------------------ */
/** creates a component at the service factory provided by the document
*/
public XInterface createInstance( String serviceSpecifier ) throws com.sun.star.uno.Exception
diff --git a/unotest/source/java/org/openoffice/test/tools/OfficeDocumentView.java b/unotest/source/java/org/openoffice/test/tools/OfficeDocumentView.java
index fee1da989688..5f89df726718 100644
--- a/unotest/source/java/org/openoffice/test/tools/OfficeDocumentView.java
+++ b/unotest/source/java/org/openoffice/test/tools/OfficeDocumentView.java
@@ -19,8 +19,6 @@ package org.openoffice.test.tools;
/**************************************************************************/
-import com.sun.star.beans.NamedValue;
-import com.sun.star.beans.PropertyState;
import com.sun.star.beans.PropertyValue;
import com.sun.star.frame.XController;
import com.sun.star.frame.XDispatch;
@@ -37,7 +35,6 @@ public class OfficeDocumentView
{
private final XMultiServiceFactory m_orb;
private final XController m_controller;
- private final OfficeDocument m_document;
/* ------------------------------------------------------------------ */
final public XController getController()
@@ -46,16 +43,9 @@ public class OfficeDocumentView
}
/* ------------------------------------------------------------------ */
- final protected OfficeDocument getDocument()
- {
- return m_document;
- }
-
- /* ------------------------------------------------------------------ */
public OfficeDocumentView( XMultiServiceFactory orb, OfficeDocument document, XController controller )
{
m_orb = orb;
- m_document = document;
m_controller = controller;
}
@@ -88,16 +78,6 @@ public class OfficeDocumentView
/* ------------------------------------------------------------------ */
- /** retrieves a dispatcher for the given URL, obtained at the current view of the document
- */
- public XDispatch getDispatcher( String url ) throws com.sun.star.uno.Exception
- {
- URL[] aURL = new URL[] { new URL() };
- aURL[0].Complete = url;
- return getDispatcher( aURL );
- }
-
- /* ------------------------------------------------------------------ */
/** dispatches the given URL into the view, if there's a dispatcher for it
@return
@@ -121,15 +101,4 @@ public class OfficeDocumentView
return true;
}
- /* ------------------------------------------------------------------ */
- public boolean dispatch( final String i_url, final NamedValue[] i_arguments ) throws com.sun.star.uno.Exception
- {
- final PropertyValue[] dispatchArgs = new PropertyValue[ i_arguments.length ];
- for ( int i=0; i<i_arguments.length; ++i )
- {
- dispatchArgs[i] = new PropertyValue( i_arguments[i].Name, -1, i_arguments[i].Value, PropertyState.DIRECT_VALUE );
- }
- return dispatch( i_url, dispatchArgs );
- }
}
-
diff --git a/unotest/source/java/org/openoffice/test/tools/SpreadsheetView.java b/unotest/source/java/org/openoffice/test/tools/SpreadsheetView.java
index f935b1f91880..b6e32a9beb72 100644
--- a/unotest/source/java/org/openoffice/test/tools/SpreadsheetView.java
+++ b/unotest/source/java/org/openoffice/test/tools/SpreadsheetView.java
@@ -17,15 +17,8 @@
*/
package org.openoffice.test.tools;
-import com.sun.star.container.XIndexAccess;
import com.sun.star.frame.XController;
import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.sheet.XSpreadsheet;
-import com.sun.star.sheet.XSpreadsheetDocument;
-import com.sun.star.sheet.XSpreadsheetView;
-import com.sun.star.uno.UnoRuntime;
-import java.util.logging.Level;
-import java.util.logging.Logger;
public class SpreadsheetView extends OfficeDocumentView
{
@@ -36,25 +29,4 @@ public class SpreadsheetView extends OfficeDocumentView
super( orb, document, controller );
}
- /** activates the sheet with the given index
- */
- void activateSheet( int sheetIndex )
- {
- try
- {
- // get the sheet to activate
- XSpreadsheetDocument doc = UnoRuntime.queryInterface( XSpreadsheetDocument.class, getDocument().getDocument() );
- XIndexAccess sheets = UnoRuntime.queryInterface( XIndexAccess.class, doc.getSheets() );
-
- XSpreadsheet sheet = UnoRuntime.queryInterface( XSpreadsheet.class, sheets.getByIndex( sheetIndex ) );
-
- // activate
- XSpreadsheetView view = UnoRuntime.queryInterface( XSpreadsheetView.class, getController() );
- view.setActiveSheet( sheet );
- }
- catch( com.sun.star.uno.Exception e )
- {
- Logger.getLogger( SpreadsheetView.class.getName() ).log( Level.SEVERE, "unable to activate the given sheet", e );
- }
- }
}