diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-13 10:08:31 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-08-13 10:24:10 +0200 |
commit | 34bcf9b498bccb5c924f4cec850ff15d88df6f07 (patch) | |
tree | 4d9604ec8c3b73639338ec45a0618b5daa5cf0ed /odk | |
parent | 347926e8e57c1825261daa46c1886aa2ebf9571b (diff) |
java: remove dead methods
found by UCDetector
Change-Id: I219caa8e680dba5a395541a778df6144841c4dde
Diffstat (limited to 'odk')
31 files changed, 50 insertions, 771 deletions
diff --git a/odk/examples/DevelopersGuide/Charts/Helper.java b/odk/examples/DevelopersGuide/Charts/Helper.java index 0bad5c5e7588..003fd3398c2d 100644 --- a/odk/examples/DevelopersGuide/Charts/Helper.java +++ b/odk/examples/DevelopersGuide/Charts/Helper.java @@ -81,10 +81,7 @@ public class Helper - public XModel createPresentationDocument() - { - return createDocument( "simpress" ); - } + diff --git a/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java index 6c4bdf287926..6fc9d90e62d4 100644 --- a/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java +++ b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java @@ -91,79 +91,13 @@ public class DialogComponent { } } - // XTestDialogHandler - public String createDialog( String DialogURL, XModel xModel, XFrame xFrame ) { - m_xFrame = xFrame; - try { - XMultiComponentFactory xMCF = m_xCmpCtx.getServiceManager(); - Object obj; - - // If valid we must pass the XModel when creating a DialogProvider object - if( xModel != null ) { - Object[] args = new Object[1]; - args[0] = xModel; - - obj = xMCF.createInstanceWithArgumentsAndContext( - "com.sun.star.awt.DialogProvider2", args, m_xCmpCtx ); - } - else { - obj = xMCF.createInstanceWithContext( - "com.sun.star.awt.DialogProvider2", m_xCmpCtx ); - } - - XDialogProvider2 xDialogProvider = UnoRuntime.queryInterface( XDialogProvider2.class, obj ); - XDialog xDialog = xDialogProvider.createDialogWithHandler( DialogURL, this ); - if( xDialog != null ) - xDialog.execute(); - } - catch (Exception e) { - e.printStackTrace(); - } - return "Created dialog \"" + DialogURL + "\""; - } - public void copyText( XDialog xDialog ) { - XControlContainer xControlContainer = UnoRuntime.queryInterface( - XControlContainer.class, xDialog ); - String aTextPropertyStr = "Text"; - String aText = ""; - XControl xTextField1Control = xControlContainer.getControl( "TextField1" ); - XControlModel xControlModel1 = xTextField1Control.getModel(); - XPropertySet xPropertySet1 = UnoRuntime.queryInterface( - XPropertySet.class, xControlModel1 ); - try - { - aText = (String)xPropertySet1.getPropertyValue( aTextPropertyStr ); - } - catch (Exception e) { - e.printStackTrace(); - } - XControl xTextField2Control = xControlContainer.getControl( "TextField2" ); - XControlModel xControlModel2 = xTextField2Control.getModel(); - XPropertySet xPropertySet2 = UnoRuntime.queryInterface( - XPropertySet.class, xControlModel2 ); - try - { - xPropertySet2.setPropertyValue( aTextPropertyStr, aText ); - } - catch (Exception e) { - e.printStackTrace(); - } - showMessageBox( "DialogComponent", "copyText() called" ); - } - public void handleEvent() { - showMessageBox( "DialogComponent", "handleEvent() called" ); - } - public void handleEventWithArguments( XDialog xDialog, Object aEventObject ) { - showMessageBox( "DialogComponent", "handleEventWithArguments() called\n\n" + - "Event Object = " + aEventObject ); - } private final String aHandlerMethod1 = "doit1"; private final String aHandlerMethod2 = "doit2"; diff --git a/odk/examples/DevelopersGuide/Database/RowSet.java b/odk/examples/DevelopersGuide/Database/RowSet.java index 9b67a5078613..4c783bf965f1 100644 --- a/odk/examples/DevelopersGuide/Database/RowSet.java +++ b/odk/examples/DevelopersGuide/Database/RowSet.java @@ -74,17 +74,7 @@ public class RowSet System.exit(0); } - public static void printDataSources() throws com.sun.star.uno.Exception - { - // create a DatabaseContext and print all DataSource names - XNameAccess xNameAccess = UnoRuntime.queryInterface( - XNameAccess.class, - xMCF.createInstanceWithContext("com.sun.star.sdb.DatabaseContext", - xContext)); - String aNames [] = xNameAccess.getElementNames(); - for(int i=0;i<aNames.length;++i) - System.out.println(aNames[i]); - } + private static void useRowSet() throws com.sun.star.uno.Exception { diff --git a/odk/examples/DevelopersGuide/Database/Sales.java b/odk/examples/DevelopersGuide/Database/Sales.java index a18b0cd85745..ef1be66ae4f2 100644 --- a/odk/examples/DevelopersGuide/Database/Sales.java +++ b/odk/examples/DevelopersGuide/Database/Sales.java @@ -106,40 +106,7 @@ public class Sales } } - // create a scrollable resultset. - public void retrieveSalesData2() throws com.sun.star.uno.Exception - { - // example for a programmatic way to do updates. - XStatement stmt = con.createStatement(); - XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,stmt); - - xProp.setPropertyValue("ResultSetType", new java.lang.Integer(ResultSetType.SCROLL_INSENSITIVE)); - xProp.setPropertyValue("ResultSetConcurrency", new java.lang.Integer(ResultSetConcurrency.UPDATABLE)); - XResultSet srs = stmt.executeQuery("SELECT NAME, PRICE FROM SALES"); - XRow row = UnoRuntime.queryInterface(XRow.class,srs); - - srs.afterLast(); - while (srs.previous()) { - String name = row.getString(1); - float price = row.getFloat(2); - System.out.println(name + " " + price); - } - - srs.last(); - XRowUpdate updateRow = UnoRuntime.queryInterface(XRowUpdate.class,srs); - updateRow.updateFloat(2, (float)0.69); - - XResultSetUpdate updateRs = UnoRuntime.queryInterface( - XResultSetUpdate.class,srs); - updateRs.updateRow(); // this call updates the data in DBMS - - srs.last(); - updateRow.updateFloat(2, (float)0.99); - updateRs.cancelRowUpdates(); - updateRow.updateFloat(2, (float)0.79); - updateRs.updateRow(); - } // inserts a row programmatically. private void insertRow() throws com.sun.star.uno.Exception @@ -186,38 +153,7 @@ public class Sales updateRs.deleteRow(); } - // refresh a row - public void refreshRow() throws com.sun.star.uno.Exception - { - // example for a programmatic way to do updates. - // first we need the 4 row - insertRow(); - XStatement stmt = con.createStatement(); - XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class,stmt); - xProp.setPropertyValue("ResultSetType", new java.lang.Integer(ResultSetType.SCROLL_INSENSITIVE)); - xProp.setPropertyValue("ResultSetConcurrency", new java.lang.Integer(ResultSetConcurrency.READ_ONLY)); - XResultSet rs = stmt.executeQuery("SELECT NAME, PRICE FROM SALES"); - XRow row = UnoRuntime.queryInterface(XRow.class, rs); - rs.absolute(4); - float price1 = row.getFloat(2); - - // modifiy the 4 row - XRowUpdate updateRow = UnoRuntime.queryInterface(XRowUpdate.class,rs); - XResultSetUpdate updateRs = UnoRuntime. queryInterface(XResultSetUpdate.class,rs); - updateRow.updateFloat(2, 150); - updateRs.updateRow(); - // repositioning - rs.absolute(4); - rs.refreshRow(); - float price2 = row.getFloat(2); - if (price2 != price1) { - System.out.println("Prices are different."); - } - else - System.out.println("Prices are equal."); - deleteRow(); - } // displays the column names public void displayColumnNames() throws com.sun.star.uno.Exception diff --git a/odk/examples/DevelopersGuide/Drawing/PageHelper.java b/odk/examples/DevelopersGuide/Drawing/PageHelper.java index b6bb684453ed..cbf8d9cdcfd3 100644 --- a/odk/examples/DevelopersGuide/Drawing/PageHelper.java +++ b/odk/examples/DevelopersGuide/Drawing/PageHelper.java @@ -95,16 +95,7 @@ public class PageHelper return xDrawPages.insertNewByIndex( nIndex ); } - /** removes the given page - */ - static public void removeDrawPage( XComponent xComponent, XDrawPage xDrawPage ) - { - XDrawPagesSupplier xDrawPagesSupplier = - UnoRuntime.queryInterface( - XDrawPagesSupplier.class, xComponent ); - XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages(); - xDrawPages.remove( xDrawPage ); - } + /** get size of the given page */ @@ -156,26 +147,9 @@ public class PageHelper return xDrawPages.insertNewByIndex( nIndex ); } - /** removes the given page - */ - static public void removeMasterPage( XComponent xComponent, XDrawPage xDrawPage ) - { - XMasterPagesSupplier xMasterPagesSupplier = - UnoRuntime.queryInterface( - XMasterPagesSupplier.class, xComponent ); - XDrawPages xDrawPages = xMasterPagesSupplier.getMasterPages(); - xDrawPages.remove( xDrawPage ); - } - /** return the corresponding masterpage for the giving drawpage - */ - static public XDrawPage getMasterPage( XDrawPage xDrawPage ) - { - XMasterPageTarget xMasterPageTarget = - UnoRuntime.queryInterface( - XMasterPageTarget.class, xDrawPage ); - return xMasterPageTarget.getMasterPage(); - } + + /** sets given masterpage at the drawpage */ diff --git a/odk/examples/DevelopersGuide/Forms/DocumentHelper.java b/odk/examples/DevelopersGuide/Forms/DocumentHelper.java index ec772949cfc4..3bae7b154847 100644 --- a/odk/examples/DevelopersGuide/Forms/DocumentHelper.java +++ b/odk/examples/DevelopersGuide/Forms/DocumentHelper.java @@ -76,11 +76,7 @@ public class DocumentHelper ); } - /* ------------------------------------------------------------------ */ - public static DocumentHelper blankTextDocument( XComponentContext xCtx ) throws com.sun.star.uno.Exception - { - return blankDocument( xCtx, DocumentType.WRITER ); - } + /* ------------------------------------------------------------------ */ public static DocumentHelper blankDocument( XComponentContext xCtx, DocumentType eType ) throws com.sun.star.uno.Exception diff --git a/odk/examples/DevelopersGuide/Forms/DocumentType.java b/odk/examples/DevelopersGuide/Forms/DocumentType.java index b5c943306ee7..9835a26cabe7 100644 --- a/odk/examples/DevelopersGuide/Forms/DocumentType.java +++ b/odk/examples/DevelopersGuide/Forms/DocumentType.java @@ -26,25 +26,13 @@ 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); 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; - default: return UNKNOWN; - } - } + } diff --git a/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java b/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java index 75948937b448..9cac2a864ca7 100644 --- a/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java +++ b/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java @@ -104,15 +104,7 @@ class DocumentViewHelper return xReturn; } - /* ------------------------------------------------------------------ */ - /** retrieves a dispatcher for the given URL, obtained at the current view of the document - */ - public XDispatch getDispatcher( String sURL ) throws java.lang.Exception - { - URL[] aURL = new URL[] { new URL() }; - aURL[0].Complete = sURL; - return getDispatcher( aURL ); - } + /* ------------------------------------------------------------------ */ /* retrieves the form controller belonging to a given logical form diff --git a/odk/examples/DevelopersGuide/Forms/FLTools.java b/odk/examples/DevelopersGuide/Forms/FLTools.java index 614d72790d27..e15c454de4c8 100644 --- a/odk/examples/DevelopersGuide/Forms/FLTools.java +++ b/odk/examples/DevelopersGuide/Forms/FLTools.java @@ -45,33 +45,9 @@ import com.sun.star.form.*; */ public class FLTools { - /* ------------------------------------------------------------------ */ - static void dump_Object( Object aObject ) - { - XServiceInfo xSI = UNO.queryServiceInfo( aObject ); - if ( null != xSI ) - System.out.println( "dumping object with name \"" + xSI.getImplementationName() + "\"" ); - else - System.out.println( "object has no service info!" ); - } - /* ------------------------------------------------------------------ */ - /** translates a string containing an URL into a complete - <type scope="com.sun.star.util">URL</type> object. - */ - static public URL parseURL( String sURL, XComponentContext xCtx ) throws java.lang.Exception - { - URL[] aURL = new URL[] { new URL() }; - aURL[0].Complete = sURL; - // need an URLTransformer - XURLTransformer xTransformer = UnoRuntime.queryInterface( - XURLTransformer.class, - xCtx.getServiceManager().createInstanceWithContext( - "com.sun.star.util.URLTransformer", xCtx ) ); - xTransformer.parseStrict( aURL ); - return aURL[0]; - } + /* ------------------------------------------------------------------ */ /** returns the name of the given form component @@ -122,39 +98,7 @@ public class FLTools return sLabel; } - /* ------------------------------------------------------------------ */ - /** retrieves the index of a form component within its parent - */ - static public int getIndexInParent( Object aContainer, Object aElement ) throws com.sun.star.uno.Exception - { - int nIndex = -1; - - // norm the element - XInterface xElement = UnoRuntime.queryInterface( - XInterface.class, aElement ); - - // get the container - XIndexContainer xIndexCont = UNO.queryIndexContainer( aContainer ); - if ( null != xIndexCont ) - { - // loop through all children - int nCount = xIndexCont.getCount(); - for ( int i = 0; i < nCount; ++i ) - { - // compare with the element - XInterface xCurrent = UnoRuntime.queryInterface( - XInterface.class, xIndexCont.getByIndex( 0 ) ); - if ( xCurrent.equals( xElement ) ) - { // found - nIndex = i; - break; - } - } - } - // outta here - return nIndex; - } /* ------------------------------------------------------------------ */ /** retrieves the parent of the given object diff --git a/odk/examples/DevelopersGuide/Forms/FormLayer.java b/odk/examples/DevelopersGuide/Forms/FormLayer.java index 1bd48667d75b..b582ee4fe701 100644 --- a/odk/examples/DevelopersGuide/Forms/FormLayer.java +++ b/odk/examples/DevelopersGuide/Forms/FormLayer.java @@ -43,21 +43,9 @@ public class FormLayer m_insertPage = -1; } - /* ------------------------------------------------------------------ */ - /** sets the page which is to be used for subsequent insertions of controls/shapes - */ - void setInsertPage( int page ) - { - m_insertPage = page; - } - /* ------------------------------------------------------------------ */ - /** retrieves the page which is to be used for subsequent insertions of controls/shapes - */ - final int getInsertPage( ) - { - return m_insertPage; - } + + /* ------------------------------------------------------------------ */ /** creates a control in the document diff --git a/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java b/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java index 29593b04cbae..df2c1b53ec5b 100644 --- a/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java +++ b/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java @@ -106,25 +106,9 @@ public class HsqlDatabase return m_connection; } - /** executes the given SQL statement via the defaultConnection - */ - public void executeSQL( String statementString ) throws SQLException - { - XStatement statement = defaultConnection().createStatement(); - statement.execute( statementString ); - } - /** stores the database document - */ - public void store() throws IOException - { - if ( m_databaseDocument != null ) - { - XStorable storeDoc = UnoRuntime.queryInterface( XStorable.class, - m_databaseDocument ); - storeDoc.store(); - } - } + + /** closes the database document * @@ -198,12 +182,7 @@ public class HsqlDatabase return m_databaseDocument.getDataSource(); } - /** returns the model interface of the underlying database document - */ - XModel getModel() - { - return UnoRuntime.queryInterface( XModel.class, m_databaseDocument ); - } + /** returns the URL of the ODB document represented by this instance */ @@ -212,12 +191,7 @@ public class HsqlDatabase return m_databaseDocumentFile; } - /** creates a row set operating the database, with a given command/type - */ - public RowSet createRowSet( int _commandType, String _command ) - { - return new RowSet( m_context, getDocumentURL(), _commandType, _command ); - } + @Override protected void finalize() throws Throwable diff --git a/odk/examples/DevelopersGuide/Forms/InteractionRequest.java b/odk/examples/DevelopersGuide/Forms/InteractionRequest.java index 8239e9410359..e961fc8b8a3a 100644 --- a/odk/examples/DevelopersGuide/Forms/InteractionRequest.java +++ b/odk/examples/DevelopersGuide/Forms/InteractionRequest.java @@ -52,12 +52,7 @@ class InteractionRequest implements XInteractionRequest m_aContinuations = new ArrayList<XInteractionContinuation>(); } - /* ------------------------------------------------------------------ */ - public void addContinuation( XInteractionContinuation xCont ) - { - if ( null != xCont ) - m_aContinuations.add( xCont ); - } + /* ------------------------------------------------------------------ */ public Object getRequest( ) diff --git a/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java b/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java index 21dfb947d048..402ffe2e7fb8 100644 --- a/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java +++ b/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java @@ -36,28 +36,5 @@ public class SpreadsheetView extends DocumentViewHelper 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 ) - { - } - } } diff --git a/odk/examples/DevelopersGuide/Forms/UNO.java b/odk/examples/DevelopersGuide/Forms/UNO.java index f777c769cb88..cd292499edc2 100644 --- a/odk/examples/DevelopersGuide/Forms/UNO.java +++ b/odk/examples/DevelopersGuide/Forms/UNO.java @@ -73,10 +73,7 @@ public class UNO return UnoRuntime.queryInterface( XComponent.class, aObject ); } - public static XTablesSupplier queryTablesSupplier( Object aObject ) - { - return UnoRuntime.queryInterface( XTablesSupplier.class, aObject ); - } + /* replace Foo with the identifier of your choice. diff --git a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java index 27df9513b953..d332979d2559 100644 --- a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java +++ b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java @@ -205,37 +205,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } - /** - * @param _sRegistryPath the path a registryNode - * @param _sImageName the name of the image - */ - public String getImageUrl(String _sRegistryPath, String _sImageName) { - String sImageUrl = ""; - try { - // retrieve the configuration node of the extension - XNameAccess xNameAccess = getRegistryKeyContent(_sRegistryPath); - if (xNameAccess != null){ - if (xNameAccess.hasByName(_sImageName)){ - // get the Image Url and process the Url by the macroexpander... - sImageUrl = (String) xNameAccess.getByName(_sImageName); - Object oMacroExpander = this.m_xContext.getValueByName("/singletons/com.sun.star.util.theMacroExpander"); - XMacroExpander xMacroExpander = UnoRuntime.queryInterface(XMacroExpander.class, oMacroExpander); - sImageUrl = xMacroExpander.expandMacros(sImageUrl); - sImageUrl = sImageUrl.substring(new String("vnd.sun.star.expand:").length(), sImageUrl.length()); - sImageUrl = sImageUrl.trim(); - sImageUrl += "/" + _sImageName; - } - } - } catch (Exception ex) { - /* perform individual exception handling here. - * Possible exception types are: - * com.sun.star.lang.IllegalArgumentException, - * com.sun.star.lang.WrappedTargetException, - */ - ex.printStackTrace(System.err); - } - return sImageUrl; - } + protected void createDialog(XMultiComponentFactory _xMCF) { try { @@ -266,16 +236,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis - public short executeDialogWithembeddedExampleSnippets() { - if (m_xWindowPeer == null){ - createWindowPeer(); - } - addRoadmap(); - insertRoadmapItem(0, true, "Introduction", 1); - insertRoadmapItem(1, true, "Documents", 2); - xDialog = UnoRuntime.queryInterface(XDialog.class, m_xDialogControl); - return xDialog.execute(); - } + public short executeDialog() { @@ -329,17 +290,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } - public void calculateDialogPosition(XWindow _xWindow) { - Rectangle aFramePosSize = m_xModel.getCurrentController().getFrame().getComponentWindow().getPosSize(); - Rectangle CurPosSize = _xWindow.getPosSize(); - int WindowHeight = aFramePosSize.Height; - int WindowWidth = aFramePosSize.Width; - int DialogWidth = CurPosSize.Width; - int DialogHeight = CurPosSize.Height; - int iXPos = ((WindowWidth / 2) - (DialogWidth / 2)); - int iYPos = ((WindowHeight / 2) - (DialogHeight / 2)); - _xWindow.setPosSize(iXPos, iYPos, DialogWidth, DialogHeight, PosSize.POS); - } + @@ -352,23 +303,10 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis return createWindowPeer(null); } - public void endExecute() { - xDialog.endExecute(); - } - public Object insertControlModel(String ServiceName, String sName, String[] sProperties, Object[] sValues) { - try { - Object oControlModel = m_xMSFDialogModel.createInstance(ServiceName); - XMultiPropertySet xControlMultiPropertySet = UnoRuntime.queryInterface(XMultiPropertySet.class, oControlModel); - xControlMultiPropertySet.setPropertyValues(sProperties, sValues); - m_xDlgModelNameContainer.insertByName(sName, oControlModel); - return oControlModel; - } catch (com.sun.star.uno.Exception exception) { - exception.printStackTrace(System.err); - return null; - } - } + + private XFixedText insertFixedText(XMouseListener _xMouseListener, int _nPosX, int _nPosY, int _nWidth, int _nStep, String _sLabel){ @@ -1094,9 +1032,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis return xFFModelPSet; } - public void convertUnits(){ - // iXPixelFactor = (int) (100000/xDevice.getInfo().PixelPerMeterX); - } + private XTextComponent insertFileControl(XTextListener _xTextListener, int _nPosX, int _nPosY, int _nWidth){ @@ -1184,17 +1120,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis return xButton; } - /** gets the WindowPeer of a frame - * @param _xTextDocument the instance of a textdocument - * @return the windowpeer of the frame - */ - public XWindowPeer getWindowPeer(XTextDocument _xTextDocument){ - XModel xModel = UnoRuntime.queryInterface(XModel.class, _xTextDocument); - XFrame xFrame = xModel.getCurrentController().getFrame(); - XWindow xWindow = xFrame.getContainerWindow(); - XWindowPeer xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xWindow); - return xWindowPeer; - } + public XFrame getCurrentFrame(){ XFrame xRetFrame = null; diff --git a/odk/examples/DevelopersGuide/GUI/UnoMenu.java b/odk/examples/DevelopersGuide/GUI/UnoMenu.java index dcedef25482c..5dbb0154484c 100644 --- a/odk/examples/DevelopersGuide/GUI/UnoMenu.java +++ b/odk/examples/DevelopersGuide/GUI/UnoMenu.java @@ -152,10 +152,7 @@ public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { return xTopWindow; } - public void addMenuBar(XWindow _xWindow){ - XTopWindow xTopWindow = UnoRuntime.queryInterface(XTopWindow.class, _xWindow); - addMenuBar(xTopWindow, this); - } + public void itemSelected(MenuEvent menuEvent){ // find out which menu item has been triggered, diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java index 44159959398d..7439b31fe898 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java @@ -490,50 +490,7 @@ public class FunctionHelper - /** - * Dispatch an URL to given frame. - * Caller can register himself for following result events for dispatched - * URL too. Notifications are guaranteed (instead of dispatch()) - * Returning of the dispatch object isn't necessary. - * Nobody must hold it alive longer the dispatch needs. - * - * @param xFrame frame which should be the target of this dispatch - * @param aURL full parsed and converted office URL for dispatch - * @param lProperties optional arguments for dispatch - * @param xListener optional listener which is registered automatically for status events - * (Note: Deregistration is not supported. Dispatcher does it automatically.) - */ - public static void executeWithNotification(com.sun.star.frame.XFrame xFrame , - com.sun.star.util.URL aURL , - com.sun.star.beans.PropertyValue[] lProperties, - com.sun.star.frame.XDispatchResultListener xListener ) - { - try - { - // Query the frame for right interface which provides access to all available dispatch objects. - com.sun.star.frame.XDispatchProvider xProvider = UnoRuntime.queryInterface( - com.sun.star.frame.XDispatchProvider.class, - xFrame); - // Ask himn for right dispatch object for given URL. - // Force THIS frame as target for following dispatch. - // Attention: The interface XNotifyingDispatch is an optional one! - com.sun.star.frame.XDispatch xDispatcher = xProvider.queryDispatch(aURL,"",0); - com.sun.star.frame.XNotifyingDispatch xNotifyingDispatcher = UnoRuntime.queryInterface( - com.sun.star.frame.XNotifyingDispatch.class, - xDispatcher); - - // Dispatch the URL. - if(xNotifyingDispatcher!=null) - xNotifyingDispatcher.dispatchWithNotification(aURL,lProperties,xListener); - } - catch(com.sun.star.uno.RuntimeException exUno) - { - // Any UNO method of this scope can throw this exception. - // But there is nothing we can do then. - exUno.printStackTrace(); - } - } @@ -782,78 +739,7 @@ public class FunctionHelper - /** - * Try to close the document without any saving of modifications. - * We can try it only! Controller and/or model of this document - * can disagree with that. But mostly they doesn't do so. - * - * @param xDocument document which should be clcosed - */ - public static void closeDocument(com.sun.star.lang.XComponent xDocument) - { - try - { - // Check supported functionality of the document (model or controller). - com.sun.star.frame.XModel xModel = - UnoRuntime.queryInterface( - com.sun.star.frame.XModel.class, xDocument); - if(xModel!=null) - { - // It's a full featured office document. - // Reset the modify state of it and close it. - // Note: Model can disgree by throwing a veto exception. - com.sun.star.util.XModifiable xModify = - UnoRuntime.queryInterface( - com.sun.star.util.XModifiable.class, xModel); - - xModify.setModified(false); - xDocument.dispose(); - } - else - { - // It's a document which supports a controller .. or may by a pure - // window only. If it's at least a controller - we can try to - // suspend him. But - he can disagree with that! - com.sun.star.frame.XController xController = - UnoRuntime.queryInterface( - com.sun.star.frame.XController.class, xDocument); - - if(xController!=null) - { - if(xController.suspend(true)==true) - { - // Note: Don't dispose the controller - destroy the frame - // to make it right! - com.sun.star.frame.XFrame xFrame = xController.getFrame(); - xFrame.dispose(); - } - } - } - } - catch(com.sun.star.beans.PropertyVetoException exVeto) - { - // Can be thrown by "setModified()" call on model. - // He disagree with our request. - // But there is nothing to do then. Following "dispose()" call wasn't - // never called (because we catch it before). Closing failed -that's it. - exVeto.printStackTrace(); - } - catch(com.sun.star.lang.DisposedException exDisposed) - { - // If an UNO object was already disposed before - he throw this special - // runtime exception. Of course every UNO call must be look for that - - // but it's a question of error handling. - // For demonstration this exception is handled here. - exDisposed.printStackTrace(); - } - catch(com.sun.star.uno.RuntimeException exRuntime) - { - // Every uno call can throw that. - // Do nothing - closing failed - that's it. - exRuntime.printStackTrace(); - } - } diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java index d6e0563359ef..782a3d2d6d11 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java @@ -67,18 +67,7 @@ public class OfficeConnect - /** - * close connection to remote office if it exist - */ - public static synchronized void disconnect() - { - if(maConnection!=null) - { - mxServiceManager=null; - mxOfficeContext=null; - maConnection=null; - } - } + @@ -112,69 +101,7 @@ public class OfficeConnect - /** - * create uno components inside remote office process - * After connection of these process to a running office we have access to - * remote service manager of it. - * So we can use it to create all existing services. Use this method to create - * components by name and get her interface. Casting of it to right target - * interface is part of your implementation. - * - * @param aType describe class type of created service - * Returned object can be casted directly to this one. - * Uno query was done by this method automatically. - * @param sServiceSpecifier name of service which should be created - * @return the new created service object - */ - public static synchronized <T> T createRemoteInstance( - Class<T> aType, String sServiceSpecifier) - { - T aResult = null; - try - { - aResult = UnoRuntime.queryInterface(aType, - mxServiceManager.createInstanceWithContext( - sServiceSpecifier, mxOfficeContext)); - } - catch (com.sun.star.uno.Exception ex) - { - System.err.println("Couldn't create Service of type " - + sServiceSpecifier + ": " + ex); - System.exit(0); - } - return aResult; - } - - - /** - * same as "createRemoteInstance()" but supports additional parameter for - * initializing created object - * - * @param lArguments optional arguments - * They are used to initialize new created service. - * @param aType Description of Parameter - * @param sServiceSpecifier Description of Parameter - * @return the new create service object - */ - public static synchronized <T> T createRemoteInstanceWithArguments( - Class<T> aType, String sServiceSpecifier, Any[] lArguments) - { - T aResult = null; - try - { - aResult = UnoRuntime.queryInterface(aType, - mxServiceManager.createInstanceWithArgumentsAndContext( - sServiceSpecifier, lArguments, mxOfficeContext)); - } - catch (com.sun.star.uno.Exception ex) - { - System.err.println("Couldn't create Service of type " - + sServiceSpecifier + ": " + ex); - System.exit(0); - } - return aResult; - } diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java index c1ab8438467b..45b2d04d04f7 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java @@ -72,10 +72,7 @@ public class PropChgHelper implements return xPropSet; } - public String[] GetPropNames() - { - return aPropNames; - } + public void LaunchEvent( LinguServiceEvent aEvt ) { diff --git a/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java b/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java index faecbe5e6513..f49e6a1d314e 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java +++ b/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java @@ -71,10 +71,7 @@ public class OfficeConnect - public static synchronized OfficeConnect getConnection() - { - return maConnection; - } + @@ -127,32 +124,7 @@ public class OfficeConnect - /** - * same as "createRemoteInstance()" but supports additional parameter for initializing created object - * - * @param lArguments optional arguments - * They are used to initialize new created service. - * @param aType Description of Parameter - * @param sServiceSpecifier Description of Parameter - * @return Description of the Returned Value - */ - public <T> T createRemoteInstanceWithArguments(Class<T> aType, String sServiceSpecifier, Any[] lArguments) - { - T aResult = null; - try - { - aResult = UnoRuntime.queryInterface( - aType, mxServiceManager.createInstanceWithArgumentsAndContext( - sServiceSpecifier, lArguments, mxOfficeContext)); - } - catch (com.sun.star.uno.Exception ex) - { - System.err.println("Couldn't create Service of type " + sServiceSpecifier + ": " + ex); - ex.printStackTrace(); - System.exit(0); - } - return aResult; - } + diff --git a/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java b/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java index b0092d9d123f..a289359e51b6 100644 --- a/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java +++ b/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java @@ -274,25 +274,9 @@ class ScriptSelectorPanel extends JPanel { add(textField, BorderLayout.SOUTH); } - public void removeNode(DefaultMutableTreeNode node) { - MutableTreeNode parent = (MutableTreeNode)(node.getParent()); - if (parent != null) { - treeModel.removeNodeFromParent(node); - } - } - public void addNode(DefaultMutableTreeNode parent, XBrowseNode xbn) { - DefaultMutableTreeNode newNode = - new DefaultMutableTreeNode(xbn) { - @Override - public String toString() { - return ((XBrowseNode)getUserObject()).getName(); - } - }; - treeModel.insertNodeInto(newNode, parent, parent.getChildCount()); - tree.scrollPathToVisible(new TreePath(newNode.getPath())); - } + private void initNodes(XBrowseNode parent, DefaultMutableTreeNode top) { if ( parent == null || parent.hasChildNodes() == false ) diff --git a/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java b/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java index 109335f3cbea..513bfa1517d4 100644 --- a/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java +++ b/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java @@ -163,30 +163,9 @@ public class ExampleAddIn // XExampleAddIn - public int getIncremented( int nValue ) - { - return nValue + 1; - } - public com.sun.star.sheet.XVolatileResult getCounter(String aName) - { - if ( aResults == null ) - { - // create the table of results, and start a thread to increment - // all counters - aResults = new java.util.HashMap<String, ExampleAddInResult>(); - ExampleAddInThread aThread = new ExampleAddInThread( aResults ); - aThread.start(); - } - ExampleAddInResult aResult = aResults.get(aName); - if ( aResult == null ) - { - aResult = new ExampleAddInResult(aName); - aResults.put( aName, aResult ); - } - return aResult; - } + // XAddIn diff --git a/odk/examples/java/Inspector/HideableTreeModel.java b/odk/examples/java/Inspector/HideableTreeModel.java index 7add3d723cd7..6fea28681b7b 100644 --- a/odk/examples/java/Inspector/HideableTreeModel.java +++ b/odk/examples/java/Inspector/HideableTreeModel.java @@ -84,9 +84,7 @@ public class HideableTreeModel implements TreeModel { } - public void reload() { - reload(getRoot()); - } + private void reload(Object node) { @@ -101,9 +99,7 @@ public class HideableTreeModel implements TreeModel { nodeChanged(path.getLastPathComponent()); } - public void nodeInserted(Object node, Object child) { - nodeInserted(node, child, -1); - } + public void nodeInserted(Object node, Object child, int index) { @@ -164,11 +160,7 @@ public class HideableTreeModel implements TreeModel { } - public ArrayList<TreePath> getExpandedPaths(JTree tree) { - ArrayList<TreePath> expandedPaths = new ArrayList<TreePath>(); - addExpandedPaths(tree, tree.getPathForRow(0), expandedPaths); - return expandedPaths; - } + private void addExpandedPaths(JTree tree, TreePath path, ArrayList<TreePath> pathlist) { @@ -181,11 +173,7 @@ public class HideableTreeModel implements TreeModel { } - public void expandPaths(JTree tree, ArrayList<TreePath> pathlist) { - for(int i = 0; i < pathlist.size(); i++) { - tree.expandPath(pathlist.get(i)); - } - } + public boolean isLeaf(Object _oNode) { @@ -241,23 +229,10 @@ public class HideableTreeModel implements TreeModel { } - public boolean isPathToNodeVisible(Object node) { - Object[] path = getPathToRoot(node); - for(int i = 0; i < path.length; i++) { - if(!isNodeVisible(path[i])) { - return false; - } - } - return true; - } - public void ensurePathToNodeVisible(Object node) { - Object[] path = getPathToRoot(node); - for(int i = 0; i < path.length; i++) { - setNodeVisible(path[i], true); - } - } + + public Object getChild(Object parent, int index) { diff --git a/odk/examples/java/Inspector/Inspector.java b/odk/examples/java/Inspector/Inspector.java index a537d9c77941..e28ca5f8a624 100644 --- a/odk/examples/java/Inspector/Inspector.java +++ b/odk/examples/java/Inspector/Inspector.java @@ -441,17 +441,6 @@ public class Inspector{ return xFactory; } - /** - * Writes the service information into the given registry key. - * This method is called by the <code>JavaLoader</code> - * <p> - * @return returns true if the operation succeeded - * @param regKey the registryKey - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return (Factory.writeRegistryServiceInfo(_Inspector.class.getName(), _Inspector.getServiceNames(), regKey) - && InspectorAddon.__writeRegistryServiceInfo(regKey)); - } + } diff --git a/odk/examples/java/Inspector/Introspector.java b/odk/examples/java/Inspector/Introspector.java index e3cfc97e47d6..db4c40b2fecb 100644 --- a/odk/examples/java/Inspector/Introspector.java +++ b/odk/examples/java/Inspector/Introspector.java @@ -201,15 +201,7 @@ public class Introspector extends WeakBase{ }} - protected XIdlField[] getFieldsOfType(Type _aType){ - try{ - XIdlClass xIdlClass = mxIdlReflection.forName(_aType.getTypeName()); - return xIdlClass.getFields(); - } - catch( Exception e ) { - System.err.println( e ); - return null; - }} + public boolean hasMethods(Object _oUnoObject){ @@ -552,12 +544,7 @@ public class Introspector extends WeakBase{ } - public static boolean isValid(Object _oObject){ - if (_oObject != null){ - return (!AnyConverter.isVoid(_oObject)); - } - return false; - } + public static boolean isArray(Object _oObject){ diff --git a/odk/examples/java/Inspector/SourceCodeGenerator.java b/odk/examples/java/Inspector/SourceCodeGenerator.java index edd7c7eb8abb..de41566c6081 100644 --- a/odk/examples/java/Inspector/SourceCodeGenerator.java +++ b/odk/examples/java/Inspector/SourceCodeGenerator.java @@ -659,13 +659,7 @@ private class UnoObjectDefinition{ } - public boolean hasParameterObjects(){ - boolean breturn = false; - if (m_oParameterObjects != null){ - breturn = m_oParameterObjects.length > 0; - } - return breturn; - } + private String getVariableStemName(TypeClass _aTypeClass){ diff --git a/odk/examples/java/Inspector/UnoNode.java b/odk/examples/java/Inspector/UnoNode.java index 0439554e0108..51e99324ccad 100644 --- a/odk/examples/java/Inspector/UnoNode.java +++ b/odk/examples/java/Inspector/UnoNode.java @@ -324,9 +324,7 @@ public class UnoNode{ } - public static String getNodeDescription(Object _oUnoObject, int _nIndex){ - return getNodeDescription(_oUnoObject) + "[" + (_nIndex + 1) + "]"; - } + public static String getNodeDescription(Object _oUnoObject){ diff --git a/odk/examples/java/Inspector/XDialogProvider.java b/odk/examples/java/Inspector/XDialogProvider.java index e8bfadc1873f..4bcc8e8baf1a 100644 --- a/odk/examples/java/Inspector/XDialogProvider.java +++ b/odk/examples/java/Inspector/XDialogProvider.java @@ -56,7 +56,7 @@ public interface XDialogProvider { public void selectSourceCodeLanguage(int _nLanguage); - public void paint(); + // returns one of the constants defined in XLanguageSourceCodeGenerator public int getLanguage(); diff --git a/odk/examples/java/Inspector/XLanguageSourceCodeGenerator.java b/odk/examples/java/Inspector/XLanguageSourceCodeGenerator.java index 630f3d9626c1..6f5f9f46daae 100644 --- a/odk/examples/java/Inspector/XLanguageSourceCodeGenerator.java +++ b/odk/examples/java/Inspector/XLanguageSourceCodeGenerator.java @@ -67,7 +67,7 @@ public interface XLanguageSourceCodeGenerator { public String getshortTypeDescription(); - public String getunsignedshortTypeDescription(); + public String getlongTypeDescription(); @@ -85,11 +85,11 @@ public interface XLanguageSourceCodeGenerator { public String getstringTypeDescription(boolean _bAsHeaderSourceCode); - public String gettypeTypeDescription(boolean _bAsHeaderSourceCode); + public String getanyTypeDescription(boolean _bAsHeaderSourceCode); - public String getArrayDeclaration(String sVariableDeclaration); + public String getVariableDeclaration(String _sTypeString, String _sVariableName, boolean _bIsArray, TypeClass aTypeClass, boolean _bInitialize); diff --git a/odk/examples/java/Inspector/XTreePathProvider.java b/odk/examples/java/Inspector/XTreePathProvider.java index fc29af5eb8c2..37a51b18918d 100644 --- a/odk/examples/java/Inspector/XTreePathProvider.java +++ b/odk/examples/java/Inspector/XTreePathProvider.java @@ -26,5 +26,5 @@ public interface XTreePathProvider { public XTreePathProvider getParentPath(); - public XTreePathProvider pathByAddingChild(XUnoNode _oUnoNode); + } diff --git a/odk/examples/java/Spreadsheet/CalcAddins.java b/odk/examples/java/Spreadsheet/CalcAddins.java index b044eac50e2a..afe636e13611 100644 --- a/odk/examples/java/Spreadsheet/CalcAddins.java +++ b/odk/examples/java/Spreadsheet/CalcAddins.java @@ -90,23 +90,9 @@ public class CalcAddins { private static final short shortGETMYSECONDVALUE = 1; -/** TO DO: - * This is where you implement all methods of your interface. The parameters have to - * be the same as in your IDL file and their types have to be the correct - * IDL-to-Java mappings of their types in the IDL file. - */ - public int getMyFirstValue( - com.sun.star.beans.XPropertySet xOptions - ) { - return 1; - } - public int getMySecondValue( - com.sun.star.beans.XPropertySet xOptions, - int intDummy - ) { - return( 2 + intDummy ); - } + + // Implement method from interface XServiceName |