diff options
Diffstat (limited to 'odk/examples/DevelopersGuide')
218 files changed, 2972 insertions, 2972 deletions
diff --git a/odk/examples/DevelopersGuide/Accessibility/ConnectionTask.java b/odk/examples/DevelopersGuide/Accessibility/ConnectionTask.java index 7bf9bdb88cd5..56016c07aca6 100644 --- a/odk/examples/DevelopersGuide/Accessibility/ConnectionTask.java +++ b/odk/examples/DevelopersGuide/Accessibility/ConnectionTask.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import java.awt.event.ActionListener; @@ -48,7 +48,7 @@ import com.sun.star.awt.XExtendedToolkit; /** This timer task tries to connect to a running Office application in regular intervals until a connection can be successfully established. */ -class ConnectionTask +class ConnectionTask extends TimerTask { public ConnectionTask (EventListenerProxy xListener) @@ -67,7 +67,7 @@ class ConnectionTask /** This method is run every time the task is executed. It tries to - connect to and register the listener at an Office application. If it + connect to and register the listener at an Office application. If it can establish a connection it terminates the timer task. Otherwise it waits until the next activation. */ @@ -168,7 +168,7 @@ class ConnectionTask try { com.sun.star.uno.XComponentContext xCmpContext = null; - + // get the remote office component context xCmpContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); if( xCmpContext != null ) @@ -193,7 +193,7 @@ class ConnectionTask return null; } - /** Time in milliseconds between two attempts to connect to an Office + /** Time in milliseconds between two attempts to connect to an Office application. */ private int mnPeriod = 1000; diff --git a/odk/examples/DevelopersGuide/Accessibility/EventHandler.java b/odk/examples/DevelopersGuide/Accessibility/EventHandler.java index 61395bba7d70..611d0d198e1b 100644 --- a/odk/examples/DevelopersGuide/Accessibility/EventHandler.java +++ b/odk/examples/DevelopersGuide/Accessibility/EventHandler.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import java.util.Vector; @@ -93,7 +93,7 @@ public class EventHandler XAccessibleContext xContext = xAccessible.getAccessibleContext(); if (xContext != null) { - MessageArea.println ("new top level window has accessible name " + MessageArea.println ("new top level window has accessible name " + xContext.getAccessibleName()); // Register at all accessible objects of the new window. @@ -141,14 +141,14 @@ public class EventHandler { if (xContext != null) { - MessageArea.println ("focusGained: " + xContext.getAccessibleName() + MessageArea.println ("focusGained: " + xContext.getAccessibleName() + " with role " + NameProvider.getRoleName (xContext.getAccessibleRole())); // Tell the object displays to update their views. for (int i=0; i<maObjectDisplays.size(); i++) { - IAccessibleObjectDisplay aDisplay = + IAccessibleObjectDisplay aDisplay = (IAccessibleObjectDisplay)maObjectDisplays.get(i); if (aDisplay != null) aDisplay.setAccessibleObject (xContext); @@ -163,7 +163,7 @@ public class EventHandler - + /** Print a message that the given object just lost the focus. Call all accessible object diplays and tell them to update. */ @@ -171,15 +171,15 @@ public class EventHandler { if (xContext != null) { - MessageArea.println ("focusLost: " - + xContext.getAccessibleName() + MessageArea.println ("focusLost: " + + xContext.getAccessibleName() + " with role " + NameProvider.getRoleName (xContext.getAccessibleRole())); // Tell the object displays to update their views. for (int i=0; i<maObjectDisplays.size(); i++) { - IAccessibleObjectDisplay aDisplay = + IAccessibleObjectDisplay aDisplay = (IAccessibleObjectDisplay)maObjectDisplays.get(i); if (aDisplay != null) aDisplay.setAccessibleObject (null); @@ -196,7 +196,7 @@ public class EventHandler /** Handle a change of the caret position. Ignore this on all objects but the one currently focused. */ - private void handleCaretEvent (XAccessibleContext xContext, + private void handleCaretEvent (XAccessibleContext xContext, long nOldPosition, long nNewPosition) { if (xContext == mxFocusedObject) @@ -231,7 +231,7 @@ public class EventHandler } // Print a message about the changed state. - MessageArea.print ("setting state " + NameProvider.getStateName(nState) + MessageArea.print ("setting state " + NameProvider.getStateName(nState) + " to " + aNewValue); if (xContext != null) { @@ -241,7 +241,7 @@ public class EventHandler else MessageArea.println (" at null"); - // Further handling of some states + // Further handling of some states switch (nState) { case AccessibleStateType.FOCUSED: @@ -259,7 +259,7 @@ public class EventHandler single child. */ private void handleChildEvent ( - XAccessibleContext aOldChild, + XAccessibleContext aOldChild, XAccessibleContext aNewChild) { if (aOldChild != null) @@ -285,7 +285,7 @@ public class EventHandler if (mxFocusedObject != null) for (int i=0; i<maObjectDisplays.size(); i++) { - IAccessibleObjectDisplay aDisplay = + IAccessibleObjectDisplay aDisplay = (IAccessibleObjectDisplay)maObjectDisplays.get(i); if (aDisplay != null) aDisplay.updateAccessibleObject (mxFocusedObject); @@ -300,19 +300,19 @@ public class EventHandler */ private void handleGenericEvent ( int nEventId, - Object aSource, - Object aOldValue, + Object aSource, + Object aOldValue, Object aNewValue) { // Print event to message area. - MessageArea.print ("received event " + MessageArea.print ("received event " + NameProvider.getEventName (nEventId) + " from "); XAccessibleContext xContext = objectToContext (aSource); if (xContext != null) MessageArea.print (xContext.getAccessibleName()); else MessageArea.print ("null"); - MessageArea.println (" / " + MessageArea.println (" / " + NameProvider.getRoleName(xContext.getAccessibleRole())); } @@ -339,14 +339,14 @@ public class EventHandler { short nOldState = -1; short nNewState = -1; - try + try { if (AnyConverter.isShort (aEvent.NewValue)) nNewState = AnyConverter.toShort (aEvent.NewValue); if (AnyConverter.isShort (aEvent.OldValue)) nOldState = AnyConverter.toShort (aEvent.OldValue); } - catch (com.sun.star.lang.IllegalArgumentException e) + catch (com.sun.star.lang.IllegalArgumentException e) {} handleStateChange ( objectToContext (aEvent.Source), @@ -359,7 +359,7 @@ public class EventHandler case AccessibleEventId.BOUNDRECT_CHANGED: handleVisibleDataEvent (objectToContext (aEvent.Source)); break; - + case AccessibleEventId.CARET_CHANGED: try { @@ -368,7 +368,7 @@ public class EventHandler AnyConverter.toLong(aEvent.OldValue), AnyConverter.toLong(aEvent.NewValue)); } - catch (com.sun.star.lang.IllegalArgumentException e) + catch (com.sun.star.lang.IllegalArgumentException e) {} break; diff --git a/odk/examples/DevelopersGuide/Accessibility/EventListenerProxy.java b/odk/examples/DevelopersGuide/Accessibility/EventListenerProxy.java index 273f6146a6cc..526ebdc7d1ff 100644 --- a/odk/examples/DevelopersGuide/Accessibility/EventListenerProxy.java +++ b/odk/examples/DevelopersGuide/Accessibility/EventListenerProxy.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.accessibility.XAccessible; @@ -42,16 +42,16 @@ import com.sun.star.uno.UnoRuntime; import java.util.LinkedList; /** This class acts as a proxy for the simple screen reader. It waits for - two types of events: + two types of events: 1. Accessibility events signal modifications concerning accessibility objects. 2. Top window events inform the listener about new or removed windows. This class exists because events had to be handled in a seperate thread to avoid dead locks: The thread that receives an event must no call back - to the Office directly. + to the Office directly. - Soon this should not be necessary anymore. There is now a flag which + Soon this should not be necessary anymore. There is now a flag which switches between synchronous and asynchronous callbacks. All reveived events are eventually forwarded to the actual listener. In @@ -109,7 +109,7 @@ class EventListenerProxy else aEvent = null; } - + if (aEvent != null) { try @@ -118,7 +118,7 @@ class EventListenerProxy } catch (Throwable aException) { - MessageArea.println( + MessageArea.println( "Exception during event delivery: " + aException); aException.printStackTrace(); } @@ -136,7 +136,7 @@ class EventListenerProxy } catch (Exception aException) { - // Ignore this exception since there is not much + // Ignore this exception since there is not much // that we can do about it. } } @@ -145,9 +145,9 @@ class EventListenerProxy public void disposing( final EventObject aEvent) { - addEvent (new Runnable() + addEvent (new Runnable() { - public void run() + public void run() { maListener.disposing (aEvent); } diff --git a/odk/examples/DevelopersGuide/Accessibility/GraphicalDisplay.java b/odk/examples/DevelopersGuide/Accessibility/GraphicalDisplay.java index 37579e1c3242..b3645353c2d9 100644 --- a/odk/examples/DevelopersGuide/Accessibility/GraphicalDisplay.java +++ b/odk/examples/DevelopersGuide/Accessibility/GraphicalDisplay.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import javax.swing.*; @@ -112,10 +112,10 @@ public class GraphicalDisplay XAccessible xParent = xContext.getAccessibleParent(); if (xParent != null) drawAccessibleObject (g, xParent.getAccessibleContext(), Color.GRAY); - + // When the context supports the XAccessibleComponent interface // then draw its outline. - XAccessibleComponent xComponent = + XAccessibleComponent xComponent = (XAccessibleComponent)UnoRuntime.queryInterface( XAccessibleComponent.class, xContext); if (xComponent != null) diff --git a/odk/examples/DevelopersGuide/Accessibility/IAccessibleObjectDisplay.java b/odk/examples/DevelopersGuide/Accessibility/IAccessibleObjectDisplay.java index 5e8eb3a2655c..ae6fd896361c 100644 --- a/odk/examples/DevelopersGuide/Accessibility/IAccessibleObjectDisplay.java +++ b/odk/examples/DevelopersGuide/Accessibility/IAccessibleObjectDisplay.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.accessibility.XAccessibleContext; diff --git a/odk/examples/DevelopersGuide/Accessibility/MessageArea.java b/odk/examples/DevelopersGuide/Accessibility/MessageArea.java index 9f3280a591a1..d71fc0966cca 100644 --- a/odk/examples/DevelopersGuide/Accessibility/MessageArea.java +++ b/odk/examples/DevelopersGuide/Accessibility/MessageArea.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import java.awt.Font; @@ -43,7 +43,7 @@ import javax.swing.JScrollBar; /** A message area displays text in a scrollable text widget. It is a - singleton. Other objects can access it directly to display messages. + singleton. Other objects can access it directly to display messages. */ public class MessageArea extends JScrollPane diff --git a/odk/examples/DevelopersGuide/Accessibility/NameProvider.java b/odk/examples/DevelopersGuide/Accessibility/NameProvider.java index 9eeba18f83fd..5d4c134002d6 100644 --- a/odk/examples/DevelopersGuide/Accessibility/NameProvider.java +++ b/odk/examples/DevelopersGuide/Accessibility/NameProvider.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import java.util.HashMap; @@ -129,7 +129,7 @@ public class NameProvider maStateMap.put (new Integer (AccessibleStateType.OPAQUE), "OPAQUE"); maStateMap.put (new Integer (AccessibleStateType.PRESSED), "PRESSED"); maStateMap.put (new Integer (AccessibleStateType.RESIZABLE), "RESIZABLE"); - maStateMap.put (new Integer (AccessibleStateType.SELECTABLE), "SELECTABLE"); + maStateMap.put (new Integer (AccessibleStateType.SELECTABLE), "SELECTABLE"); maStateMap.put (new Integer (AccessibleStateType.SELECTED), "SELECTED"); maStateMap.put (new Integer (AccessibleStateType.SENSITIVE), "SENSITIVE"); maStateMap.put (new Integer (AccessibleStateType.SHOWING), "SHOWING"); diff --git a/odk/examples/DevelopersGuide/Accessibility/RegistrationThread.java b/odk/examples/DevelopersGuide/Accessibility/RegistrationThread.java index 092941b323a7..9d574c9d7f46 100644 --- a/odk/examples/DevelopersGuide/Accessibility/RegistrationThread.java +++ b/odk/examples/DevelopersGuide/Accessibility/RegistrationThread.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import java.awt.event.ActionListener; @@ -44,7 +44,7 @@ import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.accessibility.*; import com.sun.star.awt.XExtendedToolkit; -/** This class is used as a thread and registers or unregsiters a listener +/** This class is used as a thread and registers or unregsiters a listener given the constructor at all nodes of a tree of accessibility objects. */ public class RegistrationThread @@ -61,8 +61,8 @@ public class RegistrationThread This flag decides whether to add or remove the listener. */ public RegistrationThread ( - EventListenerProxy aListener, - XAccessibleContext xRoot, + EventListenerProxy aListener, + XAccessibleContext xRoot, boolean bRegister, boolean bShowMessages) { @@ -90,7 +90,7 @@ public class RegistrationThread { if ( ! mbRegister) MessageArea.print ("un"); - MessageArea.println ("registered at " + nNodeCount + MessageArea.println ("registered at " + nNodeCount + " objects in accessibility tree of " + mxRoot.getAccessibleName()); } } @@ -111,7 +111,7 @@ public class RegistrationThread // Register the root node. XAccessibleEventBroadcaster xBroadcaster = (XAccessibleEventBroadcaster) UnoRuntime.queryInterface ( - XAccessibleEventBroadcaster.class, + XAccessibleEventBroadcaster.class, xRoot); if (xBroadcaster != null) { @@ -121,7 +121,7 @@ public class RegistrationThread xBroadcaster.removeEventListener (maListener); nNodeCount += 1; } - + // Call this method recursively to register all sub-trees. try { diff --git a/odk/examples/DevelopersGuide/Accessibility/SSR.java b/odk/examples/DevelopersGuide/Accessibility/SSR.java index e1830cfa2630..f3b0720869a9 100644 --- a/odk/examples/DevelopersGuide/Accessibility/SSR.java +++ b/odk/examples/DevelopersGuide/Accessibility/SSR.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import java.awt.event.ActionListener; @@ -72,9 +72,9 @@ public class SSR /** Setup the GUI. It is divided into three areas. The lower half is ocupied by a message area that logs all the events received from - accessibility objects. The upper half is shared by two different + accessibility objects. The upper half is shared by two different displays of the currently focused object. On left there is a textual - representation. On the right there is a graphical view of the + representation. On the right there is a graphical view of the objects's outline. */ private void Layout () @@ -89,7 +89,7 @@ public class SSR mFrame.setContentPane(aPanel); mFrame.setSize (600,400); - + addComponent (new JLabel ("Focused Object:"), 0,0, 1,1, 0,0, GridBagConstraints.WEST, GridBagConstraints.NONE); @@ -116,7 +116,7 @@ public class SSR mFrame.show(); } - + @@ -136,7 +136,7 @@ public class SSR aConstraints.weighty = weighty; aConstraints.anchor = anchor; aConstraints.fill = fill; - + mFrame.getContentPane().add (aComponent, aConstraints); return aComponent; diff --git a/odk/examples/DevelopersGuide/Accessibility/TextualDisplay.java b/odk/examples/DevelopersGuide/Accessibility/TextualDisplay.java index 0d8ce96d978d..3776d635eeaf 100644 --- a/odk/examples/DevelopersGuide/Accessibility/TextualDisplay.java +++ b/odk/examples/DevelopersGuide/Accessibility/TextualDisplay.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import java.awt.Color; @@ -112,7 +112,7 @@ class TextualDisplay private void showContextInfo (XAccessibleContext xContext, String sIndentation) { // Show the description. - msTextContent += sIndentation + "Description: " + msTextContent += sIndentation + "Description: " + xContext.getAccessibleDescription() + "\n"; showStates (xContext, sIndentation); @@ -120,7 +120,7 @@ class TextualDisplay - + /** Show a list of all of the the given object's states. Use the NameConverter class to transform the numerical state ids into human readable names. @@ -147,7 +147,7 @@ class TextualDisplay - + /** When the given object supports the XAccessibleComponent interface then show its size and location on the screen. */ @@ -155,17 +155,17 @@ class TextualDisplay { // Try to cast the given accessible context to the // XAccessibleComponent interface. - XAccessibleComponent xComponent = + XAccessibleComponent xComponent = (XAccessibleComponent)UnoRuntime.queryInterface( XAccessibleComponent.class, xContext); if (xComponent != null) { Point aLocation = xComponent.getLocationOnScreen(); - msTextContent += sIndentation + "Position : " + msTextContent += sIndentation + "Position : " + aLocation.X + ", " + aLocation.Y + "\n"; - + Size aSize = xComponent.getSize(); - msTextContent += sIndentation + "Size : " + msTextContent += sIndentation + "Size : " + aSize.Width + ", " + aSize.Height + "\n"; } } @@ -208,7 +208,7 @@ class TextualDisplay XAccessibleContext xParentContext = (XAccessibleContext)aPathToRoot.get(i); String sParentName = xParentContext.getAccessibleName(); if (sParentName.length() == 0) - sParentName = "<unnamed> / Role " + sParentName = "<unnamed> / Role " + NameProvider.getRoleName(xParentContext.getAccessibleRole()); msTextContent += sIndentation + sParentName + "\n"; sIndentation += msIndentation; diff --git a/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java b/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java index 27a97ec40345..6145a3c49949 100644 --- a/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java +++ b/odk/examples/DevelopersGuide/BasicAndDialogs/CreatingDialogs/SampleDialog.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ package com.sun.star.comp.sdk.examples; @@ -73,20 +73,20 @@ import com.sun.star.uno.XComponentContext; */ public class SampleDialog extends WeakBase implements XServiceInfo, XJobExecutor { - + static final String __serviceName = "com.sun.star.examples.SampleDialog"; private static final String _buttonName = "Button1"; private static final String _cancelButtonName = "CancelButton"; private static final String _labelName = "Label1"; private static final String _labelPrefix = "Number of button clicks: "; - + private XComponentContext _xComponentContext; - + public SampleDialog( XComponentContext xComponentContext ) { _xComponentContext = xComponentContext; } - + // static component operations public static XSingleServiceFactory __getServiceFactory( String implName, XMultiServiceFactory multiFactory, @@ -95,7 +95,7 @@ public class SampleDialog extends WeakBase implements XServiceInfo, XJobExecutor if ( implName.equals( SampleDialog.class.getName() ) ) { xSingleServiceFactory = FactoryHelper.getServiceFactory( SampleDialog.class, SampleDialog.__serviceName, multiFactory, regKey ); - } + } return xSingleServiceFactory; } @@ -103,7 +103,7 @@ public class SampleDialog extends WeakBase implements XServiceInfo, XJobExecutor return FactoryHelper.writeRegistryServiceInfo( SampleDialog.class.getName(), SampleDialog.__serviceName, regKey ); } - + // XServiceInfo public String getImplementationName( ) { return getClass().getName(); @@ -111,11 +111,11 @@ public class SampleDialog extends WeakBase implements XServiceInfo, XJobExecutor // XServiceInfo public boolean supportsService( /*IN*/String serviceName ) { - if ( serviceName.equals( __serviceName)) + if ( serviceName.equals( __serviceName)) return true; return false; } - + // XServiceInfo public String[] getSupportedServiceNames( ) { String[] retValue= new String[0]; @@ -132,7 +132,7 @@ public class SampleDialog extends WeakBase implements XServiceInfo, XJobExecutor catch ( Exception e ) { throw new com.sun.star.lang.WrappedTargetRuntimeException( e.getMessage(), this, e ); } - } + } } /** method for creating a dialog at runtime @@ -141,12 +141,12 @@ public class SampleDialog extends WeakBase implements XServiceInfo, XJobExecutor // get the service manager from the component context XMultiComponentFactory xMultiComponentFactory = _xComponentContext.getServiceManager(); - + // create the dialog model and set the properties Object dialogModel = xMultiComponentFactory.createInstanceWithContext( "com.sun.star.awt.UnoControlDialogModel", _xComponentContext ); XPropertySet xPSetDialog = ( XPropertySet )UnoRuntime.queryInterface( - XPropertySet.class, dialogModel ); + XPropertySet.class, dialogModel ); xPSetDialog.setPropertyValue( "PositionX", new Integer( 100 ) ); xPSetDialog.setPropertyValue( "PositionY", new Integer( 100 ) ); xPSetDialog.setPropertyValue( "Width", new Integer( 150 ) ); @@ -156,7 +156,7 @@ public class SampleDialog extends WeakBase implements XServiceInfo, XJobExecutor // get the service manager from the dialog model XMultiServiceFactory xMultiServiceFactory = ( XMultiServiceFactory )UnoRuntime.queryInterface( XMultiServiceFactory.class, dialogModel ); - + // create the button model and set the properties Object buttonModel = xMultiServiceFactory.createInstance( "com.sun.star.awt.UnoControlButtonModel" ); @@ -167,9 +167,9 @@ public class SampleDialog extends WeakBase implements XServiceInfo, XJobExecutor xPSetButton.setPropertyValue( "Width", new Integer( 50 ) ); xPSetButton.setPropertyValue( "Height", new Integer( 14 ) ); xPSetButton.setPropertyValue( "Name", _buttonName ); - xPSetButton.setPropertyValue( "TabIndex", new Short( (short)0 ) ); + xPSetButton.setPropertyValue( "TabIndex", new Short( (short)0 ) ); xPSetButton.setPropertyValue( "Label", new String( "Click Me" ) ); - + // create the label model and set the properties Object labelModel = xMultiServiceFactory.createInstance( "com.sun.star.awt.UnoControlFixedTextModel" ); @@ -180,7 +180,7 @@ public class SampleDialog extends WeakBase implements XServiceInfo, XJobExecutor xPSetLabel.setPropertyValue( "Width", new Integer( 100 ) ); xPSetLabel.setPropertyValue( "Height", new Integer( 14 ) ); xPSetLabel.setPropertyValue( "Name", _labelName ); - xPSetLabel.setPropertyValue( "TabIndex", new Short( (short)1 ) ); + xPSetLabel.setPropertyValue( "TabIndex", new Short( (short)1 ) ); xPSetLabel.setPropertyValue( "Label", _labelPrefix ); // create a Cancel button model and set the properties @@ -193,49 +193,49 @@ public class SampleDialog extends WeakBase implements XServiceInfo, XJobExecutor xPSetCancelButton.setPropertyValue( "Width", new Integer( 50 ) ); xPSetCancelButton.setPropertyValue( "Height", new Integer( 14 ) ); xPSetCancelButton.setPropertyValue( "Name", _cancelButtonName ); - xPSetCancelButton.setPropertyValue( "TabIndex", new Short( (short)2 ) ); + xPSetCancelButton.setPropertyValue( "TabIndex", new Short( (short)2 ) ); xPSetCancelButton.setPropertyValue( "PushButtonType", new Short( (short)2 ) ); xPSetCancelButton.setPropertyValue( "Label", new String( "Cancel" ) ); - + // insert the control models into the dialog model XNameContainer xNameCont = ( XNameContainer )UnoRuntime.queryInterface( XNameContainer.class, dialogModel ); xNameCont.insertByName( _buttonName, buttonModel ); xNameCont.insertByName( _labelName, labelModel ); xNameCont.insertByName( _cancelButtonName, cancelButtonModel ); - + // create the dialog control and set the model Object dialog = xMultiComponentFactory.createInstanceWithContext( "com.sun.star.awt.UnoControlDialog", _xComponentContext ); XControl xControl = ( XControl )UnoRuntime.queryInterface( XControl.class, dialog ); XControlModel xControlModel = ( XControlModel )UnoRuntime.queryInterface( - XControlModel.class, dialogModel ); + XControlModel.class, dialogModel ); xControl.setModel( xControlModel ); - + // add an action listener to the button control XControlContainer xControlCont = ( XControlContainer )UnoRuntime.queryInterface( - XControlContainer.class, dialog ); + XControlContainer.class, dialog ); Object objectButton = xControlCont.getControl( "Button1" ); XButton xButton = ( XButton )UnoRuntime.queryInterface( XButton.class, objectButton ); xButton.addActionListener( new ActionListenerImpl( xControlCont ) ); - + // create a peer Object toolkit = xMultiComponentFactory.createInstanceWithContext( - "com.sun.star.awt.ExtToolkit", _xComponentContext ); + "com.sun.star.awt.ExtToolkit", _xComponentContext ); XToolkit xToolkit = ( XToolkit )UnoRuntime.queryInterface( XToolkit.class, toolkit ); XWindow xWindow = ( XWindow )UnoRuntime.queryInterface( XWindow.class, xControl ); - xWindow.setVisible( false ); + xWindow.setVisible( false ); xControl.createPeer( xToolkit, null ); - + // execute the dialog XDialog xDialog = ( XDialog )UnoRuntime.queryInterface( XDialog.class, dialog ); xDialog.execute(); - + // dispose the dialog XComponent xComponent = ( XComponent )UnoRuntime.queryInterface( XComponent.class, dialog ); @@ -253,23 +253,23 @@ public class SampleDialog extends WeakBase implements XServiceInfo, XJobExecutor public ActionListenerImpl( XControlContainer xControlCont ) { _xControlCont = xControlCont; } - + // XEventListener public void disposing( EventObject eventObject ) { _xControlCont = null; } - + // XActionListener public void actionPerformed( ActionEvent actionEvent ) { // increase click counter _nCounts++; - + // set label text Object label = _xControlCont.getControl( "Label1" ); XFixedText xLabel = ( XFixedText )UnoRuntime.queryInterface( - XFixedText.class, label ); + XFixedText.class, label ); xLabel.setText( _labelPrefix + _nCounts ); - } - } + } + } } diff --git a/odk/examples/DevelopersGuide/Charts/CalcHelper.java b/odk/examples/DevelopersGuide/Charts/CalcHelper.java index c7a82f327118..c9bac59345ab 100644 --- a/odk/examples/DevelopersGuide/Charts/CalcHelper.java +++ b/odk/examples/DevelopersGuide/Charts/CalcHelper.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -108,7 +108,7 @@ public class CalcHelper } catch( Exception ex ) {} - + return aSheet; } @@ -207,7 +207,7 @@ public class CalcHelper } catch( NoSuchElementException ex ) { - System.out.println( "Couldn't find chart with name " + sChartName + ": " + ex ); + System.out.println( "Couldn't find chart with name " + sChartName + ": " + ex ); } catch( Exception ex ) {} @@ -278,7 +278,7 @@ public class CalcHelper { System.out.println( "Sheet not found" + ex ); } - + return aRange; } @@ -303,13 +303,13 @@ public class CalcHelper double fFactor = 2.0 * java.lang.Math.PI / (double)(nRowCount - 1); String aFormula; - // set variable factor for cos formula + // set variable factor for cos formula int nFactorCol = nColumnCount + 2; (aSheet.getCellByPosition( nFactorCol - 1, 0 )).setValue( 0.2 ); XText xCellText = (XText) UnoRuntime.queryInterface( XText.class, aSheet.getCellByPosition( nFactorCol - 1, 1 ) ); xCellText.setString( "Change the factor above and\nwatch the changes in the chart" ); - + for( nCol = 0; nCol < nColumnCount; nCol++ ) { for( nRow = 0; nRow < nRowCount; nRow++ ) @@ -338,7 +338,7 @@ public class CalcHelper { System.out.println( "Sheet not found" + ex ); } - + return aRange; } diff --git a/odk/examples/DevelopersGuide/Charts/ChartHelper.java b/odk/examples/DevelopersGuide/Charts/ChartHelper.java index 0cffc0e3e954..5d44dc034ebb 100644 --- a/odk/examples/DevelopersGuide/Charts/ChartHelper.java +++ b/odk/examples/DevelopersGuide/Charts/ChartHelper.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -104,7 +104,7 @@ public class ChartHelper { XPropertySet xPropSet = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xTextContent); - + Any aAny = new Any(String.class, msChartClassID); xPropSet.setPropertyValue("CLSID", aAny ); @@ -116,12 +116,12 @@ public class ChartHelper //insert embedded object in text -> object will be created xText.insertTextContent( xCursor, xTextContent, true ); - + // set size and position XShape xShape = (XShape)UnoRuntime.queryInterface( XShape.class, xTextContent); xShape.setSize( aExtent ); - + aAny = new Any(Short.class, new Short(com.sun.star.text.VertOrientation.NONE)); xPropSet.setPropertyValue("VertOrient", aAny ); @@ -132,12 +132,12 @@ public class ChartHelper xPropSet.setPropertyValue("VertOrientPosition", aAny ); aAny = new Any(Integer.class, new Integer(aUpperLeft.X)); xPropSet.setPropertyValue("HoriOrientPosition", aAny ); - + // retrieve the chart document as model of the OLE shape aResult = (XChartDocument) UnoRuntime.queryInterface( XChartDocument.class, xPropSet.getPropertyValue( "Model" )); - + // create a diagram via the factory and set this as // new diagram aResult.setDiagram( @@ -150,12 +150,12 @@ public class ChartHelper } catch( Exception ex) { System.out.println( "caught exception: " + ex ); - } + } } return aResult; } - + public XChartDocument insertOLEChartInDraw( String sChartName, Point aUpperLeft, @@ -213,7 +213,7 @@ public class ChartHelper XShape aShape = (XShape) UnoRuntime.queryInterface( XShape.class, aFact.createInstance( "com.sun.star.drawing.OLE2Shape" )); - + // insert the shape into the page aPage.add( aShape ); aShape.setPosition( aUpperLeft ); diff --git a/odk/examples/DevelopersGuide/Charts/ChartInCalc.java b/odk/examples/DevelopersGuide/Charts/ChartInCalc.java index 06f571bec304..44ae46033389 100644 --- a/odk/examples/DevelopersGuide/Charts/ChartInCalc.java +++ b/odk/examples/DevelopersGuide/Charts/ChartInCalc.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -166,7 +166,7 @@ public class ChartInCalc public void unlockControllers() throws RuntimeException { - ((XModel) UnoRuntime.queryInterface( XModel.class, maChartDocument )).unlockControllers(); + ((XModel) UnoRuntime.queryInterface( XModel.class, maChartDocument )).unlockControllers(); } // ____________________ @@ -259,7 +259,7 @@ public class ChartInCalc nMaxIndex = i; } } - + // first parameter is the index of the point, the second one is the series XPropertySet aPointProp = maDiagram.getDataPointProperties( 0, 1 ); @@ -276,7 +276,7 @@ public class ChartInCalc catch( IndexOutOfBoundsException ex ) { System.out.println( "Oops, there not enough data points or series for setting properties: " + ex ); - } + } } // ____________________ @@ -319,7 +319,7 @@ public class ChartInCalc XPropertySet aDocProp = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, maChartDocument ); aDocProp.setPropertyValue( "HasMainTitle", new Boolean( true )); - + XShape aTitle = maChartDocument.getTitle(); XPropertySet aTitleProp = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, aTitle ); diff --git a/odk/examples/DevelopersGuide/Charts/ChartInDraw.java b/odk/examples/DevelopersGuide/Charts/ChartInDraw.java index 9b206f5f7635..ed21c900aaa5 100644 --- a/odk/examples/DevelopersGuide/Charts/ChartInDraw.java +++ b/odk/examples/DevelopersGuide/Charts/ChartInDraw.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -144,7 +144,7 @@ public class ChartInDraw public void unlockControllers() throws RuntimeException { - ((XModel) UnoRuntime.queryInterface( XModel.class, maChartDocument )).unlockControllers(); + ((XModel) UnoRuntime.queryInterface( XModel.class, maChartDocument )).unlockControllers(); } // ____________________ @@ -226,7 +226,7 @@ public class ChartInDraw aDiaProp.setPropertyValue( "Deep", aTrue ); // from Chart3DBarProperties: aDiaProp.setPropertyValue( "SolidType", new Integer( ChartSolidType.CYLINDER )); - + // change floor color to Magenta6 XPropertySet aFloor = ((X3DDisplay) UnoRuntime.queryInterface( X3DDisplay.class, maDiagram )).getFloor(); @@ -289,13 +289,13 @@ public class ChartInDraw // set direction com.sun.star.drawing.Direction3D aDirection = new com.sun.star.drawing.Direction3D(); - + aDirection.DirectionX = -0.75; aDirection.DirectionY = 0.5; aDirection.DirectionZ = 0.5; aDiaProp.setPropertyValue( "D3DSceneLightDirection1", aDirection ); - aDiaProp.setPropertyValue( "D3DSceneLightOn1", new Boolean( true )); + aDiaProp.setPropertyValue( "D3DSceneLightOn1", new Boolean( true )); } // ______________________________ diff --git a/odk/examples/DevelopersGuide/Charts/ChartInWriter.java b/odk/examples/DevelopersGuide/Charts/ChartInWriter.java index 9f64e1f49c22..22108393f66c 100644 --- a/odk/examples/DevelopersGuide/Charts/ChartInWriter.java +++ b/odk/examples/DevelopersGuide/Charts/ChartInWriter.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -151,7 +151,7 @@ public class ChartInWriter public void unlockControllers() throws RuntimeException { - ((XModel) UnoRuntime.queryInterface( XModel.class, maChartDocument )).unlockControllers(); + ((XModel) UnoRuntime.queryInterface( XModel.class, maChartDocument )).unlockControllers(); } // ____________________ diff --git a/odk/examples/DevelopersGuide/Charts/Helper.java b/odk/examples/DevelopersGuide/Charts/Helper.java index 13efc37d177a..cae86ca2d5d1 100644 --- a/odk/examples/DevelopersGuide/Charts/Helper.java +++ b/odk/examples/DevelopersGuide/Charts/Helper.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -72,14 +72,14 @@ import com.sun.star.lang.IndexOutOfBoundsException; // __________ Implementation __________ -/** Helper for creating a calc document adding cell values and charts +/** Helper for creating a calc document adding cell values and charts @author Björn Milcke */ public class Helper { public Helper( String[] args ) { - // connect to a running office and get the ServiceManager + // connect to a running office and get the ServiceManager try { // get the remote office component context maContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); @@ -152,10 +152,10 @@ public class Helper return aResult; } - + public XComponentContext getComponentContext(){ return maContext; - + } // __________ private members and methods __________ diff --git a/odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.java b/odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.java index 10a137a316d5..9bb24a81b62b 100644 --- a/odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.java +++ b/odk/examples/DevelopersGuide/Charts/JavaSampleChartAddIn.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // base classes @@ -212,7 +212,7 @@ public class JavaSampleChartAddIn extends WeakBase implements JOptionPane.showMessageDialog( null, "One of the lines is still null", "Assertion", JOptionPane.WARNING_MESSAGE ); return; } - + // position lines // -------------- @@ -262,7 +262,7 @@ public class JavaSampleChartAddIn extends WeakBase implements XPropertySet aShapeProp = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, maTopLine ); aShapeProp.setPropertyValue( "PolyPolygon", aMaxPtSeq ); - + aShapeProp = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, maBottomLine ); aShapeProp.setPropertyValue( "PolyPolygon", aMinPtSeq ); @@ -309,7 +309,7 @@ public class JavaSampleChartAddIn extends WeakBase implements { return( JavaSampleChartAddIn.class.getName() ); } - + public String[] getSupportedServiceNames() { return getSupportedServiceNames_Static(); diff --git a/odk/examples/DevelopersGuide/Charts/ListenAtCalcRangeInDraw.java b/odk/examples/DevelopersGuide/Charts/ListenAtCalcRangeInDraw.java index 9c37b4d19954..41ee1afb1e96 100644 --- a/odk/examples/DevelopersGuide/Charts/ListenAtCalcRangeInDraw.java +++ b/odk/examples/DevelopersGuide/Charts/ListenAtCalcRangeInDraw.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -121,7 +121,7 @@ public class ListenAtCalcRangeInDraw implements XChartDataChangeEventListener // ____________________ public void run() - { + { try { ((XPropertySet) UnoRuntime.queryInterface( @@ -186,7 +186,7 @@ public class ListenAtCalcRangeInDraw implements XChartDataChangeEventListener XPropertySet aDocProp = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, maChartDocument ); aDocProp.setPropertyValue( "HasMainTitle", new Boolean( true )); - + ((XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, maChartDocument.getSubTitle())).setPropertyValue( "String", aTitle ); diff --git a/odk/examples/DevelopersGuide/Charts/SelectionChangeListener.java b/odk/examples/DevelopersGuide/Charts/SelectionChangeListener.java index 3a90b2d63313..d895be7df98f 100644 --- a/odk/examples/DevelopersGuide/Charts/SelectionChangeListener.java +++ b/odk/examples/DevelopersGuide/Charts/SelectionChangeListener.java @@ -72,32 +72,32 @@ import com.sun.star.awt.XWindow; public class SelectionChangeListener implements XSelectionChangeListener { public static void main( String args[] ) { SelectionChangeListener aMySelf = new SelectionChangeListener( args ); - + aMySelf.run(); } - + public SelectionChangeListener( String args[] ) { Helper aHelper = new Helper( args ); - + maContext = aHelper.getComponentContext(); - + CalcHelper aCalcHelper = new CalcHelper( aHelper.createSpreadsheetDocument() ); - + // insert a cell range with 4 columns and 12 rows filled with random numbers XCellRange aRange = aCalcHelper.insertRandomRange( 4, 12 ); CellRangeAddress aRangeAddress = ((XCellRangeAddressable) UnoRuntime.queryInterface( XCellRangeAddressable.class, aRange)).getRangeAddress(); - + // change view to sheet containing the chart aCalcHelper.raiseChartSheet(); - + // the unit for measures is 1/100th of a millimeter // position at (1cm, 1cm) Point aPos = new Point( 1000, 1000 ); - + // size of the chart is 15cm x 9.271cm Size aExtent = new Size( 15000, 9271 ); - + // insert a new chart into the "Chart" sheet of the // spreadsheet document maChartDocument = aCalcHelper.insertChart( @@ -107,12 +107,12 @@ public class SelectionChangeListener implements XSelectionChangeListener { aExtent, "com.sun.star.chart.XYDiagram" ); } - + // ____________________ - + public void run() { boolean bTrying = true; - + while( bTrying ) { // start listening for selection changes XSelectionSupplier aSelSupp = (XSelectionSupplier) UnoRuntime.queryInterface( @@ -124,67 +124,67 @@ public class SelectionChangeListener implements XSelectionChangeListener { System.out.println( "Successfully attached as selection change listener" ); bTrying = false; } - + // start listening for death of Controller XComponent aComp = (XComponent) UnoRuntime.queryInterface( XComponent.class, aSelSupp ); if( aComp != null ) { aComp.addEventListener( this ); System.out.println( "Successfully attached as dispose listener" ); } - + try { Thread.currentThread().sleep( 500 ); } catch( InterruptedException ex ) { } } } - + // ____________________ - + // XEventListener (base of XSelectionChangeListener) public void disposing( EventObject aSourceObj ) { System.out.println( "disposing called. detaching as listener" ); - + // stop listening for selection changes XSelectionSupplier aCtrl = (XSelectionSupplier) UnoRuntime.queryInterface( XSelectionSupplier.class, aSourceObj ); if( aCtrl != null ) aCtrl.removeSelectionChangeListener( this ); - + // remove as dispose listener XComponent aComp = (XComponent) UnoRuntime.queryInterface( XComponent.class, aSourceObj ); if( aComp != null ) aComp.removeEventListener( this ); - + // bail out System.exit( 0 ); } - + // ____________________ - + // XSelectionChangeListener public void selectionChanged( EventObject aEvent ) { XController aCtrl = (XController) UnoRuntime.queryInterface( XController.class, aEvent.Source ); if( aCtrl != null ) { XMultiComponentFactory mMCF = maContext.getServiceManager(); - + MyMessageBox aMsgBox = new MyMessageBox(mMCF); - + aMsgBox.start(); - + System.out.println("Listener finished"); } } - + // __________ private __________ - + private class MyMessageBox extends Thread{ private XMultiComponentFactory mMCF; - + public MyMessageBox(XMultiComponentFactory xMCF){ mMCF = xMCF; } - + public void run() { XDesktop aDesktop = null; XInterface aToolKit = null; @@ -196,16 +196,16 @@ public class SelectionChangeListener implements XSelectionChangeListener { try { Object oDesktop = mMCF.createInstanceWithContext("com.sun.star.frame.Desktop", maContext); Object oToolKit = mMCF.createInstanceWithContext("com.sun.star.awt.Toolkit", maContext); - + aDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, oDesktop); aToolKit = (XInterface) UnoRuntime.queryInterface(XInterface.class, oToolKit); } catch (Exception ex) { ex.printStackTrace(); } - + XWindow xWin = aDesktop.getCurrentFrame().getContainerWindow(); XWindowPeer aWinPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xWin); - + Rectangle aRect = new Rectangle(); int button = com.sun.star.awt.MessageBoxButtons.BUTTONS_OK; XMessageBoxFactory aMBF = (XMessageBoxFactory) UnoRuntime.queryInterface(XMessageBoxFactory.class, aToolKit); @@ -213,7 +213,7 @@ public class SelectionChangeListener implements XSelectionChangeListener { xMB.execute(); } } - + private XChartDocument maChartDocument; private XComponentContext maContext; } diff --git a/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Addons.xcu b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Addons.xcu index d3d8d7411ed2..b97762510429 100644 --- a/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Addons.xcu +++ b/odk/examples/DevelopersGuide/Components/Addons/JobsAddon/Addons.xcu @@ -1,22 +1,22 @@ <?xml version='1.0' encoding='UTF-8'?> <oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Addons" oor:package="org.openoffice.Office"> <node oor:name="AddonUI"> - + <node oor:name="AddonMenu"> - + <node oor:name="myAsyncJobAlias" oor:op="replace"> - + <prop oor:name="URL" oor:type="xs:string"> - + <value>vnd.sun.star.job:alias=AsyncJob</value> - + </prop> - + <prop oor:name="ImageIdentifier" oor:type="xs:string"> <value>private:image/3216</value> - + </prop> - + <prop oor:name="Title" oor:type="xs:string"> <!-- The x-no-translate entry is a marker to prevent l10n tooling from translation. It it is not necessary. --> <value xml:lang="x-no-translate"></value> @@ -27,20 +27,20 @@ <value>_self</value> </prop> </node> - + <node oor:name="myAsyncJobEvent" oor:op="replace"> - + <prop oor:name="URL" oor:type="xs:string"> - + <value>vnd.sun.star.job:event=onMyOwnJobEvent</value> - + </prop> - + <prop oor:name="ImageIdentifier" oor:type="xs:string"> <value>private:image/3216</value> - + </prop> - + <prop oor:name="Title" oor:type="xs:string"> <!-- The x-no-translate entry is a marker to prevent l10n tooling from translation. It it is not necessary. --> <value xml:lang="x-no-translate"></value> @@ -51,20 +51,20 @@ <value>_self</value> </prop> </node> - + <node oor:name="myAsyncJobService" oor:op="replace"> - + <prop oor:name="URL" oor:type="xs:string"> - + <value>vnd.sun.star.job:service=com.sun.star.comp.framework.java.services.AsyncJob</value> - + </prop> - + <prop oor:name="ImageIdentifier" oor:type="xs:string"> <value>private:image/3216</value> - + </prop> - + <prop oor:name="Title" oor:type="xs:string"> <!-- The x-no-translate entry is a marker to prevent l10n tooling from translation. It it is not necessary. --> <value xml:lang="x-no-translate"></value> @@ -74,7 +74,7 @@ <prop oor:name="Target" oor:type="xs:string"> <value>_self</value> </prop> - </node> + </node> </node> </node> </oor:component-data> diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx index dbf2d548d7f3..de478e6711f6 100644 --- a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx +++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include <addon.hxx> diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.hxx b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.hxx index f2e4a0f4a08e..63f90f2312d2 100644 --- a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.hxx +++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.hxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef _Addon_HXX @@ -80,7 +80,7 @@ public: // XDispatchProvider virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > - SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, + SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& sTargetFrameName, sal_Int32 nSearchFlags ) throw( ::com::sun::star::uno::RuntimeException ); virtual ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/component.cxx b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/component.cxx index 19553b282926..3f8596026f7d 100644 --- a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/component.cxx +++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/component.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include <stdio.h> @@ -45,13 +45,13 @@ // include our specific addon header to get access to functions and definitions #include <addon.hxx> - + using namespace ::rtl; using namespace ::osl; using namespace ::cppu; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; +using namespace ::com::sun::star::registry; //################################################################################################## //#### EXPORTED #################################################################################### @@ -84,13 +84,13 @@ extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void * Reference< XRegistryKey > xNewKey( reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM("/" IMPLEMENTATION_NAME "/UNO/SERVICES") ) ) ); - + const Sequence< OUString > & rSNL = Addon_getSupportedServiceNames(); const OUString * pArray = rSNL.getConstArray(); for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) xNewKey->createKey( pArray[nPos] ); - + return sal_True; } catch (InvalidRegistryException &) @@ -107,12 +107,12 @@ extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, void * * @param pImplName name of implementation * @param pServiceManager a service manager, need for component creation * @param pRegistryKey the registry key for this component, need for persistent data - * @return a component factory + * @return a component factory */ extern "C" void * SAL_CALL component_getFactory(const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey) { void * pRet = 0; - + if (rtl_str_compare( pImplName, IMPLEMENTATION_NAME ) == 0) { Reference< XSingleServiceFactory > xFactory( createSingleFactory( @@ -120,15 +120,15 @@ extern "C" void * SAL_CALL component_getFactory(const sal_Char * pImplName, void OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATION_NAME ) ), Addon_createInstance, Addon_getSupportedServiceNames() ) ); - + if (xFactory.is()) { xFactory->acquire(); pRet = xFactory.get(); } } - + return pRet; -} +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java index ad3b0efe8747..2844d25e3def 100644 --- a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java +++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.uno.XComponentContext; @@ -42,12 +42,12 @@ import com.sun.star.lang.XInitialization; import com.sun.star.lang.XTypeProvider; import com.sun.star.lang.XServiceInfo; import com.sun.star.uno.Type; -import com.sun.star.frame.XStatusListener; -import com.sun.star.frame.XDispatchProvider; -import com.sun.star.frame.XDispatch; -import com.sun.star.frame.XModel; -import com.sun.star.frame.XFrame; -import com.sun.star.frame.DispatchDescriptor; +import com.sun.star.frame.XStatusListener; +import com.sun.star.frame.XDispatchProvider; +import com.sun.star.frame.XDispatch; +import com.sun.star.frame.XModel; +import com.sun.star.frame.XFrame; +import com.sun.star.frame.DispatchDescriptor; import com.sun.star.awt.XToolkit; import com.sun.star.awt.XWindowPeer; import com.sun.star.awt.XMessageBox; @@ -62,14 +62,14 @@ public class ProtocolHandlerAddon { */ public static class ProtocolHandlerAddonImpl extends WeakBase implements XDispatchProvider, - XDispatch, + XDispatch, XInitialization, XServiceInfo { /** The service name, that must be used to get an instance of this service. */ static private final String[] m_serviceNames = { "com.sun.star.frame.ProtocolHandler" }; - + /** The component context, that gives access to the service manager and all registered services. */ private XComponentContext m_xCmpCtx; @@ -83,7 +83,7 @@ public class ProtocolHandlerAddon { private XFrame m_xFrame; private XStatusListener m_xStatusListener; - + /** The constructor of the inner class has a XMultiServiceFactory parameter. * @param xmultiservicefactoryInitialization A special service factory * could be introduced while initializing. @@ -91,7 +91,7 @@ public class ProtocolHandlerAddon { public ProtocolHandlerAddonImpl( XComponentContext xComponentContext ) { m_xCmpCtx = xComponentContext; } - + /** This method is a member of the interface for initializing an object * directly after its creation. * @param object This array of arbitrary objects will be passed to the @@ -114,7 +114,7 @@ public class ProtocolHandlerAddon { m_xCmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.awt.Toolkit", m_xCmpCtx)); } - + /** This method returns an array of all supported service names. * @return Array of supported service names. */ @@ -125,7 +125,7 @@ public class ProtocolHandlerAddon { public static String[] getServiceNames() { return m_serviceNames; } - + /** This method returns true, if the given service will be * supported by the component. * @param stringService Service name. @@ -133,22 +133,22 @@ public class ProtocolHandlerAddon { */ public boolean supportsService( String sService ) { int len = m_serviceNames.length; - + for( int i=0; i < len; i++) { if ( sService.equals( m_serviceNames[i] ) ) return true; } - + return false; } - + /** Return the class name of the component. * @return Class name of the component. */ public String getImplementationName() { return ProtocolHandlerAddonImpl.class.getName(); } - + // XDispatchProvider public XDispatch queryDispatch( /*IN*/com.sun.star.util.URL aURL, /*IN*/String sTargetFrameName, @@ -164,23 +164,23 @@ public class ProtocolHandlerAddon { } return xRet; } - + public XDispatch[] queryDispatches( /*IN*/DispatchDescriptor[] seqDescripts ) { int nCount = seqDescripts.length; XDispatch[] lDispatcher = new XDispatch[nCount]; - + for( int i=0; i<nCount; ++i ) lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL, seqDescripts[i].FrameName, seqDescripts[i].SearchFlags ); - - return lDispatcher; + + return lDispatcher; } // XDispatch public void dispatch( /*IN*/com.sun.star.util.URL aURL, /*IN*/com.sun.star.beans.PropertyValue[] aArguments ) { - + if ( aURL.Protocol.compareTo("org.openoffice.Office.addon.example:") == 0 ) { if ( aURL.Path.compareTo( "Function1" ) == 0 ) @@ -197,11 +197,11 @@ public class ProtocolHandlerAddon { } } } - + public void addStatusListener( /*IN*/XStatusListener xControl, /*IN*/com.sun.star.util.URL aURL ) { } - + public void removeStatusListener( /*IN*/XStatusListener xControl, /*IN*/com.sun.star.util.URL aURL ) { } @@ -221,7 +221,7 @@ public class ProtocolHandlerAddon { aDescriptor.WindowAttributes = WindowAttribute.BORDER | WindowAttribute.MOVEABLE | WindowAttribute.CLOSEABLE; - + XWindowPeer xPeer = m_xToolkit.createWindow( aDescriptor ); if ( null != xPeer ) { XMessageBox xMsgBox = (XMessageBox)UnoRuntime.queryInterface( @@ -235,12 +235,12 @@ public class ProtocolHandlerAddon { } } } catch ( com.sun.star.uno.Exception e) { - // do your error handling + // do your error handling } } } - - + + /** Gives a factory for creating the service. * This method is called by the <code>JavaLoader</code> * <p> @@ -256,14 +256,14 @@ public class ProtocolHandlerAddon { */ public static XSingleComponentFactory __getComponentFactory( String sImplementationName ) { XSingleComponentFactory xFactory = null; - + if ( sImplementationName.equals( ProtocolHandlerAddonImpl.class.getName() ) ) xFactory = Factory.createComponentFactory(ProtocolHandlerAddonImpl.class, ProtocolHandlerAddonImpl.getServiceNames()); - + return xFactory; } - + /** Writes the service information into the given registry key. * This method is called by the <code>JavaLoader</code>. * @return returns true if the operation succeeded diff --git a/odk/examples/DevelopersGuide/Components/CppComponent/TestCppComponent.cxx b/odk/examples/DevelopersGuide/Components/CppComponent/TestCppComponent.cxx index c377cdb1ebb7..31436a26e7ed 100644 --- a/odk/examples/DevelopersGuide/Components/CppComponent/TestCppComponent.cxx +++ b/odk/examples/DevelopersGuide/Components/CppComponent/TestCppComponent.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include <stdio.h> @@ -52,7 +52,7 @@ SAL_IMPLEMENT_MAIN() try { // get the remote office component context - Reference< XComponentContext > xContext( ::cppu::bootstrap() ); + Reference< XComponentContext > xContext( ::cppu::bootstrap() ); fprintf(stdout, "\nconnected to a running office...\n"); // create a new instance of MyService1 diff --git a/odk/examples/DevelopersGuide/Components/CppComponent/service1_impl.cxx b/odk/examples/DevelopersGuide/Components/CppComponent/service1_impl.cxx index 23c2cd4a38c9..a6933ce63304 100644 --- a/odk/examples/DevelopersGuide/Components/CppComponent/service1_impl.cxx +++ b/odk/examples/DevelopersGuide/Components/CppComponent/service1_impl.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include <osl/interlck.h> @@ -63,7 +63,7 @@ OUString SAL_CALL getImplementationName_MyService1Impl() "my_module.my_sc_implementation.MyService1") ); } - + class MyService1Impl : public ::my_module::XSomething , public lang::XServiceInfo @@ -81,7 +81,7 @@ public: {} virtual ~MyService1Impl() {} - + // XInterface virtual Any SAL_CALL queryInterface( Type const & type ) throw (RuntimeException); diff --git a/odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx b/odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx index 81401ede482b..5ed74abbc710 100644 --- a/odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx +++ b/odk/examples/DevelopersGuide/Components/CppComponent/service2_impl.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include <cppuhelper/implbase3.hxx> // "3" implementing three interfaces @@ -56,7 +56,7 @@ extern OUString SAL_CALL getImplementationName_MyService1Impl(); extern Reference< XInterface > SAL_CALL create_MyService1Impl( Reference< XComponentContext > const & xContext ) SAL_THROW( () ); - + static Sequence< OUString > getSupportedServiceNames_MyService2Impl() { Sequence<OUString> names(1); @@ -69,7 +69,7 @@ static OUString getImplementationName_MyService2Impl() return OUString( RTL_CONSTASCII_USTRINGPARAM( "my_module.my_sc_implementation.MyService2") ); } - + class MyService2Impl : public ::cppu::WeakImplHelper3< ::my_module::XSomething, lang::XServiceInfo, lang::XInitialization > { @@ -86,7 +86,7 @@ public: // focus on three given interfaces, // no need to implement XInterface, XTypeProvider, XWeak - + // XInitialization will be called upon // createInstanceWithArguments[AndContext]() virtual void SAL_CALL initialize( Sequence< Any > const & args ) diff --git a/odk/examples/DevelopersGuide/Components/CppComponent/some.idl b/odk/examples/DevelopersGuide/Components/CppComponent/some.idl index 342f03560a93..d08cc64318c6 100644 --- a/odk/examples/DevelopersGuide/Components/CppComponent/some.idl +++ b/odk/examples/DevelopersGuide/Components/CppComponent/some.idl @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include <com/sun/star/uno/XInterface.idl> @@ -46,7 +46,7 @@ module my_module service MyService1 : XSomething; - service MyService2 : XSomething + service MyService2 : XSomething { create([in]string sArgument) raises (::com::sun::star::lang::IllegalArgumentException); diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/SomethingA.idl b/odk/examples/DevelopersGuide/Components/JavaComponent/SomethingA.idl index a98a3047dba6..769a03e58852 100644 --- a/odk/examples/DevelopersGuide/Components/JavaComponent/SomethingA.idl +++ b/odk/examples/DevelopersGuide/Components/JavaComponent/SomethingA.idl @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,18 +29,18 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef INCLUDED_COM_SUN_STAR_TEST_SOMETHINGA_IDL #define INCLUDED_COM_SUN_STAR_TEST_SOMETHINGA_IDL - + #include <XSomethingA.idl> module com { module sun { module star { module test { service SomethingA: XSomethingA; -}; }; }; }; - -#endif - - +}; }; }; }; + +#endif + + diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/SomethingB.idl b/odk/examples/DevelopersGuide/Components/JavaComponent/SomethingB.idl index 0281ba751794..0a6bd9444fa9 100644 --- a/odk/examples/DevelopersGuide/Components/JavaComponent/SomethingB.idl +++ b/odk/examples/DevelopersGuide/Components/JavaComponent/SomethingB.idl @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,18 +29,18 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef INCLUDED_COM_SUN_STAR_TEST_SOMETHINGB_IDL #define INCLUDED_COM_SUN_STAR_TEST_SOMETHINGB_IDL -#include <XSomethingB.idl> +#include <XSomethingB.idl> module com { module sun { module star { module test { service SomethingB : XSomethingB; -}; }; }; }; - -#endif - - +}; }; }; }; + +#endif + + diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/TestComponentA.java b/odk/examples/DevelopersGuide/Components/JavaComponent/TestComponentA.java index 540328e2bff2..ed81b0f707cc 100644 --- a/odk/examples/DevelopersGuide/Components/JavaComponent/TestComponentA.java +++ b/odk/examples/DevelopersGuide/Components/JavaComponent/TestComponentA.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lib.uno.helper.WeakBase; @@ -42,7 +42,7 @@ public class TestComponentA extends WeakBase implements XServiceInfo, XSomething static final String __serviceName= "com.sun.star.test.SomethingA"; static byte[] _implementationId; - + public TestComponentA() { } @@ -57,7 +57,7 @@ public class TestComponentA extends WeakBase implements XServiceInfo, XSomething } // XServiceInfo public boolean supportsService( /*IN*/String serviceName ) { - if ( serviceName.equals( __serviceName)) + if ( serviceName.equals( __serviceName)) return true; return false; } @@ -67,5 +67,5 @@ public class TestComponentA extends WeakBase implements XServiceInfo, XSomething retValue[0]= __serviceName; return retValue; } - + } diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/TestComponentB.java b/odk/examples/DevelopersGuide/Components/JavaComponent/TestComponentB.java index 006cdceedb2c..848c9b45795d 100644 --- a/odk/examples/DevelopersGuide/Components/JavaComponent/TestComponentB.java +++ b/odk/examples/DevelopersGuide/Components/JavaComponent/TestComponentB.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.uno.XComponentContext; import com.sun.star.lang.XTypeProvider; @@ -51,7 +51,7 @@ public class TestComponentB implements XTypeProvider, XServiceInfo, XSomethingB this.context= context; this.args= args; } - + // XSomethingB public String methodTwo(String val) { if (args.length > 0 && args[0] instanceof String ) @@ -87,7 +87,7 @@ public class TestComponentB implements XTypeProvider, XServiceInfo, XSomethingB // XServiceInfo public boolean supportsService( /*IN*/String serviceName ) { - if ( serviceName.equals( __serviceName)) + if ( serviceName.equals( __serviceName)) return true; return false; } @@ -96,5 +96,5 @@ public class TestComponentB implements XTypeProvider, XServiceInfo, XSomethingB String[] retValue= new String[0]; retValue[0]= __serviceName; return retValue; - } + } } diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/TestJavaComponent.java b/odk/examples/DevelopersGuide/Components/JavaComponent/TestJavaComponent.java index ab07ccc4564e..50fff36ba0b1 100644 --- a/odk/examples/DevelopersGuide/Components/JavaComponent/TestJavaComponent.java +++ b/odk/examples/DevelopersGuide/Components/JavaComponent/TestJavaComponent.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.uno.XComponentContext; import com.sun.star.comp.helper.Bootstrap; @@ -43,13 +43,13 @@ import com.sun.star.container.XSet; // sample starbasic code, you can execute it after you have connected to the office. // Sub Main -// o = createUnoService( "com.sun.star.test.SomethingB" ) -// msgbox o.methodOne( "from the office !" ) +// o = createUnoService( "com.sun.star.test.SomethingB" ) +// msgbox o.methodOne( "from the office !" ) // End Sub public class TestJavaComponent { - + public static void insertIntoServiceManager( XMultiComponentFactory serviceManager, Object singleFactory ) throws com.sun.star.uno.Exception @@ -64,14 +64,14 @@ public class TestJavaComponent { XSet set = (XSet ) UnoRuntime.queryInterface( XSet.class, serviceManager ); set.remove( singleFactory ); - + } - + public static void main(String[] args) throws java.lang.Exception { try { boolean bLocal = false; - + XMultiComponentFactory xUsedServiceManager = null; XComponentContext xUsedComponentContext = null; @@ -79,22 +79,22 @@ public class TestJavaComponent { XComponentContext xLocalComponentContext = Bootstrap.createInitialComponentContext( null ); - + // initial serviceManager XMultiComponentFactory xLocalServiceManager = xLocalComponentContext.getServiceManager(); - + bLocal = true; xUsedServiceManager = xLocalServiceManager; xUsedComponentContext = xLocalComponentContext; - + System.out.println( "Using local servicemanager" ); - } else { + } else { // get the remote office component context xUsedComponentContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); System.out.println("Connected to a running office ..."); - + xUsedServiceManager = xUsedComponentContext.getServiceManager(); System.out.println( "Using remote servicemanager" ); } @@ -102,7 +102,7 @@ public class TestJavaComponent if ( xUsedServiceManager == null ) { System.out.println( "ERROR: no service manager" ); - System.exit(0); + System.exit(0); } Object factory = new Object(); @@ -111,23 +111,23 @@ public class TestJavaComponent // retrieve the factory for the component implementation factory = TestServiceProvider.__getServiceFactory( "TestComponentB", null, null); - + // insert the factory into the local servicemanager // From now on, the service can be instantiated ! insertIntoServiceManager( xUsedServiceManager, factory ); - } - + } + XSomethingB xSomethingB = SomethingB.create(xUsedComponentContext); - + // and call the test method. String s= xSomethingB.methodTwo("Hello World!"); System.out.println(s); - + if ( bLocal ) { - // remove it again from the servicemanager, + // remove it again from the servicemanager, removeFromServiceManager( xUsedServiceManager, factory ); - } + } } catch ( Exception e ) @@ -138,6 +138,6 @@ public class TestJavaComponent } // quit, even when a remote bridge is running - System.exit(0); + System.exit(0); } } diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/TestServiceProvider.java b/odk/examples/DevelopersGuide/Components/JavaComponent/TestServiceProvider.java index dee8899510e4..1653a76594bf 100644 --- a/odk/examples/DevelopersGuide/Components/JavaComponent/TestServiceProvider.java +++ b/odk/examples/DevelopersGuide/Components/JavaComponent/TestServiceProvider.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XSingleServiceFactory; @@ -49,14 +49,14 @@ public class TestServiceProvider if (implName.equals( TestComponentA.class.getName()) ) xSingleServiceFactory = FactoryHelper.getServiceFactory( TestComponentA.class, TestComponentA.__serviceName, - multiFactory, regKey); + multiFactory, regKey); else if (implName.equals(TestComponentB.class.getName())) xSingleServiceFactory= FactoryHelper.getServiceFactory( TestComponentB.class, TestComponentB.__serviceName, multiFactory, regKey); return xSingleServiceFactory; } - + public static boolean __writeRegistryServiceInfo(XRegistryKey regKey){ boolean bregA= FactoryHelper.writeRegistryServiceInfo( TestComponentA.class.getName(), @@ -65,7 +65,7 @@ public class TestServiceProvider TestComponentB.class.getName(), TestComponentB.__serviceName, regKey); return bregA && bregB; - } + } } diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/XSomethingA.idl b/odk/examples/DevelopersGuide/Components/JavaComponent/XSomethingA.idl index f353cd3c7d98..15096be85138 100644 --- a/odk/examples/DevelopersGuide/Components/JavaComponent/XSomethingA.idl +++ b/odk/examples/DevelopersGuide/Components/JavaComponent/XSomethingA.idl @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,20 +29,20 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef INCLUDED_COM_SUN_STAR_TEST_XSOMETHINGA_IDL #define INCLUDED_COM_SUN_STAR_TEST_XSOMETHINGA_IDL - -#include <com/sun/star/uno/XInterface.idl> + +#include <com/sun/star/uno/XInterface.idl> module com { module sun { module star { module test { - interface XSomethingA { + interface XSomethingA { string methodOne([in]string value); - }; -}; }; }; }; - -#endif - - + }; +}; }; }; }; + +#endif + + diff --git a/odk/examples/DevelopersGuide/Components/JavaComponent/XSomethingB.idl b/odk/examples/DevelopersGuide/Components/JavaComponent/XSomethingB.idl index a06532c3ad48..c328bafd2e1e 100644 --- a/odk/examples/DevelopersGuide/Components/JavaComponent/XSomethingB.idl +++ b/odk/examples/DevelopersGuide/Components/JavaComponent/XSomethingB.idl @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,20 +29,20 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef INCLUDED_COM_SUN_STAR_TEST_XSOMETHINGB_IDL #define INCLUDED_COM_SUN_STAR_TEST_XSOMETHINGB_IDL - -#include <com/sun/star/uno/XInterface.idl> + +#include <com/sun/star/uno/XInterface.idl> module com { module sun { module star { module test { - interface XSomethingB { + interface XSomethingB { string methodTwo([in]string value); - }; -}; }; }; }; - -#endif - - + }; +}; }; }; }; + +#endif + + diff --git a/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.idl b/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.idl index f93cb2279358..6f42dd8e0b02 100644 --- a/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.idl +++ b/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.idl @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,22 +29,22 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ -#ifndef _org_openoffice_LicenseTest_idl_ -#define _org_openoffice_LicenseTest_idl_ - -#include <com/sun/star/lang/XServiceInfo.idl> - +#ifndef _org_openoffice_LicenseTest_idl_ +#define _org_openoffice_LicenseTest_idl_ + +#include <com/sun/star/lang/XServiceInfo.idl> + // org module org { // openoffice module openoffice { // example service, XServiceInfo is implemented here for demonstration - // issues. XServiceInfo must be implemented by all components. + // issues. XServiceInfo must be implemented by all components. service LicenseTest: ::com::sun::star::lang::XServiceInfo; }; }; -#endif +#endif diff --git a/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.java b/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.java index 211638c46c58..37ad00c593a6 100644 --- a/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.java +++ b/odk/examples/DevelopersGuide/Components/SimpleLicense/LicenseTest.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.lib.uno.helper.Factory; @@ -59,7 +59,7 @@ public class LicenseTest { */ static private final String __serviceName = "org.openoffice.LicenseTest"; - + /** The initial component contextr, that gives access to * the service manager, supported singletons, ... * It's often later used @@ -70,7 +70,7 @@ public class LicenseTest { * It's often later used */ private XMultiComponentFactory m_xMCF; - + /** The constructor of the inner class has a XMultiServiceFactory parameter. * @param xmultiservicefactoryInitialization A special service factory * could be introduced while initializing. @@ -78,13 +78,13 @@ public class LicenseTest { public _LicenseTest(XComponentContext xCompContext) { try { m_cmpCtx = xCompContext; - m_xMCF = m_cmpCtx.getServiceManager(); + m_xMCF = m_cmpCtx.getServiceManager(); } catch( Exception e ) { e.printStackTrace(); } } - + /** This method returns an array of all supported service names. * @return Array of supported service names. */ @@ -100,7 +100,7 @@ public class LicenseTest { String[] sSupportedServiceNames = { __serviceName }; return sSupportedServiceNames; } - + /** This method returns true, if the given service will be * supported by the component. * @param sServiceName Service name. @@ -109,16 +109,16 @@ public class LicenseTest { public boolean supportsService( String sServiceName ) { return sServiceName.equals( __serviceName ); } - + /** Return the class name of the component. * @return Class name of the component. */ public String getImplementationName() { return _LicenseTest.class.getName(); - } + } } - - + + /** * Gives a factory for creating the service. * This method is called by the <code>JavaLoader</code> @@ -132,11 +132,11 @@ public class LicenseTest { public static XSingleComponentFactory __getComponentFactory(String sImplName) { XSingleComponentFactory xFactory = null; - + if ( sImplName.equals( _LicenseTest.class.getName() ) ) xFactory = Factory.createComponentFactory(_LicenseTest.class, _LicenseTest.getServiceNames()); - + return xFactory; } @@ -167,5 +167,5 @@ public class LicenseTest { * your component using these objects. */ } - + } diff --git a/odk/examples/DevelopersGuide/Components/SimpleLicense/description.xml b/odk/examples/DevelopersGuide/Components/SimpleLicense/description.xml index aa465ab8d288..aef2e4d71970 100644 --- a/odk/examples/DevelopersGuide/Components/SimpleLicense/description.xml +++ b/odk/examples/DevelopersGuide/Components/SimpleLicense/description.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <description xmlns="http://openoffice.org/extensions/description/2006" xmlns:xlink="http://www.w3.org/1999/xlink"> - + <registration> <simple-license accept-by="admin" default-license-id="de"> <license-text xlink:href="registration/license_de.txt" lang="de" license-id="de" /> diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.java b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.java index 7fe4307d8a80..8a5f13a38a15 100644 --- a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.java +++ b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/ImageShrink.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ package org.openoffice.comp.test; @@ -53,13 +53,13 @@ import com.sun.star.registry.XRegistryKey; import com.sun.star.comp.loader.FactoryHelper; import com.sun.star.lib.uno.helper.WeakBase; -public class ImageShrink extends WeakBase +public class ImageShrink extends WeakBase implements com.sun.star.lang.XServiceInfo, org.openoffice.test.XImageShrinkFilter { com.sun.star.uno.XComponentContext xComponentContext = null; - + // maintain a static implementation id for all instances of ImageShrink // initialized by the first call to getImplementationId() static byte[] _implementationId; @@ -67,8 +67,8 @@ public class ImageShrink extends WeakBase // hold the service name in a private static member variable of the class protected static final String __serviceName = "org.openoffice.test.ImageShrink"; - - + + String destDir = ""; String sourceDir = ""; boolean cancel = false; @@ -83,7 +83,7 @@ public class ImageShrink extends WeakBase public static XSingleServiceFactory __getServiceFactory(String implName, XMultiServiceFactory multiFactory, com.sun.star.registry.XRegistryKey regKey) { - + com.sun.star.lang.XSingleServiceFactory xSingleServiceFactory = null; if (implName.equals( ImageShrink.class.getName()) ) xSingleServiceFactory = FactoryHelper.getServiceFactory( ImageShrink.class, @@ -92,25 +92,25 @@ public class ImageShrink extends WeakBase regKey); return xSingleServiceFactory; - } + } public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { //System.out.println(ImageShrink.class.getName()); return FactoryHelper.writeRegistryServiceInfo( ImageShrink.class.getName(), __serviceName, regKey); - } - + } + // XFilter implementation (a sub-interface of XImageShrinkFilter) public void cancel() { cancel = true; } - + public boolean filter(com.sun.star.beans.PropertyValue[] propertyValue) { - // while cancel = false, - // scale images found in sourceDir according to dimension and - // write them to destDir, using the image file format given in - - + // while cancel = false, + // scale images found in sourceDir according to dimension and + // write them to destDir, using the image file format given in + + // []propertyValue return true; } @@ -119,23 +119,23 @@ public class ImageShrink extends WeakBase public String getDestinationDirectory() { return destDir; } - + public com.sun.star.awt.Size getDimension() { return dimension; } - + public String getSourceDirectory() { return sourceDir; } - + public void setDestinationDirectory(String str) { destDir = str; } - + public void setDimension(com.sun.star.awt.Size size) { dimension = size; } - + public void setSourceDirectory(String str) { sourceDir = str; } @@ -146,13 +146,13 @@ public class ImageShrink extends WeakBase } public boolean supportsService(String serviceName) { - if ( serviceName.equals( __serviceName)) + if ( serviceName.equals( __serviceName)) return true; return false; } public String[] getSupportedServiceNames( ) { return new String[] { __serviceName }; - } - + } + } diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/Thumbs.java b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/Thumbs.java index 3ef79b89e9c0..7dbc23fc9f68 100644 --- a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/Thumbs.java +++ b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/comp/test/Thumbs.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ package org.openoffice.comp.test; @@ -41,7 +41,7 @@ import com.sun.star.uno.UnoRuntime; * Note: the image shrink functionality is not implemented */ public class Thumbs { - + /** * @param args the command line arguments */ @@ -57,13 +57,13 @@ public class Thumbs { // new ImageShrink object org.openoffice.test.XImageShrinkFilter xImageShrinkFilter = org.openoffice.test.ImageShrink.create(xRemoteContext); - + System.out.println("ImageShrink component succesfully instantiated"); - java.io.File f = new java.io.File("."); - System.out.println("set SourceDrectory ..."); + java.io.File f = new java.io.File("."); + System.out.println("set SourceDrectory ..."); xImageShrinkFilter.setSourceDirectory(f.getCanonicalPath()); - + System.out.println("source Directory = " + xImageShrinkFilter.getSourceDirectory()); } diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/ImageShrink.idl b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/ImageShrink.idl index b891982f5133..56f89f0ea42c 100644 --- a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/ImageShrink.idl +++ b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/ImageShrink.idl @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef _org_openoffice_test_ImageShrink_idl_ diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/XImageShrink.idl b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/XImageShrink.idl index 361e9914e10e..8b00132112a5 100644 --- a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/XImageShrink.idl +++ b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/XImageShrink.idl @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef _org_openoffice_test_XImageShrink_idl_ @@ -41,7 +41,7 @@ module org { module openoffice { module test { interface XImageShrink { - + [attribute] string SourceDirectory; [attribute] string DestinationDirectory; [attribute] com::sun::star::awt::Size Dimension; diff --git a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/XImageShrinkFilter.idl b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/XImageShrinkFilter.idl index 18a59aa667c4..23bbacb23f49 100644 --- a/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/XImageShrinkFilter.idl +++ b/odk/examples/DevelopersGuide/Components/Thumbs/org/openoffice/test/XImageShrinkFilter.idl @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef _org_openoffice_test_XImageShrinkFilter_idl_ diff --git a/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java index f7ad9ad4b7c8..ba5c168672b6 100644 --- a/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java +++ b/odk/examples/DevelopersGuide/Components/dialogcomponent/DialogComponent.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,11 +29,11 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.uno.Type; -import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; import com.sun.star.registry.XRegistryKey; import com.sun.star.lang.XTypeProvider; @@ -61,7 +61,7 @@ import com.sun.star.awt.WindowAttribute; import com.sun.star.awt.WindowClass; import com.sun.star.awt.WindowDescriptor; import com.sun.star.awt.Rectangle; - + import com.sun.star.test.XTestDialogHandler; // DialogComponent implements all necessary interfaces self, this is only @@ -69,15 +69,15 @@ import com.sun.star.test.XTestDialogHandler; // ComponentBase, see implementation of TestComponentA. public class DialogComponent { - // public static class _DialogComponent extends WeakBase + // public static class _DialogComponent extends WeakBase public static class _DialogComponent implements XTypeProvider, XServiceInfo, XTestDialogHandler, XDialogEventHandler { static final String __serviceName= "com.sun.star.test.TestDialogHandler"; - + static byte[] _implementationId; private XComponentContext m_xCmpCtx; - + private XFrame m_xFrame; private XToolkit m_xToolkit; @@ -89,17 +89,17 @@ public class DialogComponent { m_xToolkit = (XToolkit) UnoRuntime.queryInterface( XToolkit.class, m_xCmpCtx.getServiceManager().createInstanceWithContext("com.sun.star.awt.Toolkit", - m_xCmpCtx)); + m_xCmpCtx)); } catch (Exception e) { e.printStackTrace(); } } - + // XTestDialogHandler public String createDialog( String DialogURL, XModel xModel, XFrame xFrame ) { m_xFrame = xFrame; - + try { XMultiComponentFactory xMCF = m_xCmpCtx.getServiceManager(); Object obj; @@ -108,7 +108,7 @@ public class DialogComponent { if( xModel != null ) { Object[] args = new Object[1]; args[0] = xModel; - + obj = xMCF.createInstanceWithArgumentsAndContext( "com.sun.star.awt.DialogProvider2", args, m_xCmpCtx ); } @@ -119,7 +119,7 @@ public class DialogComponent { XDialogProvider2 xDialogProvider = (XDialogProvider2) UnoRuntime.queryInterface( XDialogProvider2.class, obj ); - + XDialog xDialog = xDialogProvider.createDialogWithHandler( DialogURL, this ); if( xDialog != null ) xDialog.execute(); @@ -129,13 +129,13 @@ public class DialogComponent { } return "Created dialog \"" + DialogURL + "\""; } - + public void copyText( XDialog xDialog, Object aEventObject ) { XControlContainer xControlContainer = (XControlContainer)UnoRuntime.queryInterface( XControlContainer.class, xDialog ); String aTextPropertyStr = "Text"; String aText = ""; - XControl xTextField1Control = xControlContainer.getControl( "TextField1" ); + XControl xTextField1Control = xControlContainer.getControl( "TextField1" ); XControlModel xControlModel1 = xTextField1Control.getModel(); XPropertySet xPropertySet1 = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xControlModel1 ); @@ -146,8 +146,8 @@ public class DialogComponent { catch (Exception e) { e.printStackTrace(); } - - XControl xTextField2Control = xControlContainer.getControl( "TextField2" ); + + XControl xTextField2Control = xControlContainer.getControl( "TextField2" ); XControlModel xControlModel2 = xTextField2Control.getModel(); XPropertySet xPropertySet2 = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xControlModel2 ); @@ -165,7 +165,7 @@ public class DialogComponent { public void handleEvent() { showMessageBox( "DialogComponent", "handleEvent() called" ); } - + public void handleEventWithArguments( XDialog xDialog, Object aEventObject ) { showMessageBox( "DialogComponent", "handleEventWithArguments() called\n\n" + "Event Object = " + aEventObject ); @@ -236,7 +236,7 @@ public class DialogComponent { String[] sSupportedServiceNames = { __serviceName }; return sSupportedServiceNames; } - + //XServiceInfo public String[] getSupportedServiceNames() { return getServiceNames(); @@ -246,12 +246,12 @@ public class DialogComponent { public boolean supportsService( String sServiceName ) { return sServiceName.equals( __serviceName ); } - + //XServiceInfo public String getImplementationName() { // return DialogComponent.class.getName(); return _DialogComponent.class.getName(); - } + } public void showMessageBox(String sTitle, String sMessage) { try { @@ -268,7 +268,7 @@ public class DialogComponent { aDescriptor.WindowAttributes = WindowAttribute.BORDER | WindowAttribute.MOVEABLE | WindowAttribute.CLOSEABLE; - + XWindowPeer xPeer = m_xToolkit.createWindow( aDescriptor ); if ( null != xPeer ) { XMessageBox xMsgBox = (XMessageBox)UnoRuntime.queryInterface( @@ -282,9 +282,9 @@ public class DialogComponent { } } } catch ( com.sun.star.uno.Exception e) { - // do your error handling + // do your error handling } - } + } } /** @@ -300,11 +300,11 @@ public class DialogComponent { public static XSingleComponentFactory __getComponentFactory(String sImplName) { XSingleComponentFactory xFactory = null; - + if ( sImplName.equals( _DialogComponent.class.getName() ) ) xFactory = Factory.createComponentFactory(_DialogComponent.class, _DialogComponent.getServiceNames()); - + return xFactory; } diff --git a/odk/examples/DevelopersGuide/Components/dialogcomponent/TestDialogHandler.idl b/odk/examples/DevelopersGuide/Components/dialogcomponent/TestDialogHandler.idl index 7196b173b4fa..b465d8c6da11 100644 --- a/odk/examples/DevelopersGuide/Components/dialogcomponent/TestDialogHandler.idl +++ b/odk/examples/DevelopersGuide/Components/dialogcomponent/TestDialogHandler.idl @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef INCLUDED_COM_SUN_STAR_TEST_TESTDIALOGHANDLER_IDL #define INCLUDED_COM_SUN_STAR_TEST_TESTDIALOGHANDLER_IDL @@ -43,5 +43,5 @@ module com { module sun { module star { module test { #endif - - + + diff --git a/odk/examples/DevelopersGuide/Components/dialogcomponent/XTestDialogHandler.idl b/odk/examples/DevelopersGuide/Components/dialogcomponent/XTestDialogHandler.idl index aa968917d5c9..5952d314ec8d 100644 --- a/odk/examples/DevelopersGuide/Components/dialogcomponent/XTestDialogHandler.idl +++ b/odk/examples/DevelopersGuide/Components/dialogcomponent/XTestDialogHandler.idl @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,25 +29,25 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef INCLUDED_COM_SUN_STAR_TEST_XTESTDIALOGHANDLER_IDL #define INCLUDED_COM_SUN_STAR_TEST_XTESTDIALOGHANDLER_IDL - -#include <com/sun/star/uno/XInterface.idl> -#include <com/sun/star/awt/XDialog.idl> + +#include <com/sun/star/uno/XInterface.idl> +#include <com/sun/star/awt/XDialog.idl> #include <com/sun/star/frame/XModel.idl> #include <com/sun/star/frame/XFrame.idl> module com { module sun { module star { module test { - interface XTestDialogHandler { + interface XTestDialogHandler { string createDialog( [in] string DialogURL, [in] ::com::sun::star::frame::XModel xModel, [in] ::com::sun::star::frame::XFrame xFrame ); void copyText( [in] ::com::sun::star::awt::XDialog xDialog, [in] any aEventObject ); - void handleEvent(); - void handleEventWithArguments( [in] ::com::sun::star::awt::XDialog xDialog, [in] any aEventObject ); - }; -}; }; }; }; - + void handleEvent(); + void handleEventWithArguments( [in] ::com::sun::star::awt::XDialog xDialog, [in] any aEventObject ); + }; +}; }; }; }; + #endif diff --git a/odk/examples/DevelopersGuide/Config/ConfigExamples.java b/odk/examples/DevelopersGuide/Config/ConfigExamples.java index a88127ef1053..d978cf19a60f 100644 --- a/odk/examples/DevelopersGuide/Config/ConfigExamples.java +++ b/odk/examples/DevelopersGuide/Config/ConfigExamples.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // Import everything we use @@ -84,8 +84,8 @@ import com.sun.star.util.ChangesEvent; o Resetting data to their defaults Each example is in a separate method call. -*/ -public class ConfigExamples +*/ +public class ConfigExamples { // The ComponentContext interface of the remote component context private XComponentContext mxContext = null; @@ -96,27 +96,27 @@ public class ConfigExamples // The MultiServiceFactory interface of the ConfigurationProvider private XMultiServiceFactory mxProvider = null; - public static void main( String args[] ) + public static void main( String args[] ) { try { // get the remote office component context com.sun.star.uno.XComponentContext xContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); - + if( xContext != null ) System.out.println("Connected to a running office ..."); else System.out.println( "ERROR: Cannot connect - no remote component context available." ); - + // Create an instance of the class and call it's run method ConfigExamples aExample = new ConfigExamples(xContext); aExample.run( ); - - // if you own the service manager dispose it here - // to ensure that the default provider is properly disposed and flushed + + // if you own the service manager dispose it here + // to ensure that the default provider is properly disposed and flushed System.exit(0); - } - catch( Exception e ) + } + catch( Exception e ) { e.printStackTrace(); System.exit(-1); @@ -133,10 +133,10 @@ public class ConfigExamples /** Run the examples with a default ConfigurationProvider */ - public void run() + public void run() throws com.sun.star.uno.Exception { - mxProvider = createProvider(); + mxProvider = createProvider(); runExamples( ); @@ -146,7 +146,7 @@ public class ConfigExamples /** Run the examples with an AdministrationProvider */ - public void runForAdmin(Object [] aAdminArgs) + public void runForAdmin(Object [] aAdminArgs) throws com.sun.star.uno.Exception { mxProvider = createAdminProvider(aAdminArgs); @@ -160,7 +160,7 @@ public class ConfigExamples /** Run the examples with a given ConfigurationProvider */ - public void runExamples( ) + public void runExamples( ) { if (checkProvider(mxProvider)) { @@ -181,7 +181,7 @@ public class ConfigExamples else System.out.println("ERROR: Cannot run examples without ConfigurationProvider."); - } + } /** Do some simple checks, if tehre is a valid ConfigurationProvider */ @@ -198,10 +198,10 @@ public class ConfigExamples try { // check the provider implementation - XServiceInfo xProviderServices = + XServiceInfo xProviderServices = (XServiceInfo) UnoRuntime.queryInterface( XServiceInfo.class, xProvider ); - if (xProviderServices == null || + if (xProviderServices == null || !xProviderServices.supportsService("com.sun.star.configuration.ConfigurationProvider")) { System.out.println("WARNING: The provider is not a com.sun.star.configuration.ConfigurationProvider"); @@ -221,15 +221,15 @@ public class ConfigExamples return false; } } - - /** Get the provider we have + + /** Get the provider we have */ public XMultiServiceFactory getProvider( ) { return mxProvider; } - /** Create a default configuration provider + /** Create a default configuration provider */ public XMultiServiceFactory createProvider( ) throws com.sun.star.uno.Exception @@ -238,14 +238,14 @@ public class ConfigExamples // create the provider and return it as a XMultiServiceFactory XMultiServiceFactory xProvider = (XMultiServiceFactory) - UnoRuntime.queryInterface(XMultiServiceFactory.class, + UnoRuntime.queryInterface(XMultiServiceFactory.class, mxServiceManager.createInstanceWithContext(sProviderService, - mxContext)); + mxContext)); return xProvider; } - /** Create an administration provider + /** Create an administration provider @param aAdminArguments An array of extra arguments to be used to create the provider @@ -259,7 +259,7 @@ public class ConfigExamples XMultiServiceFactory xAdminProvider = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, mxServiceManager.createInstanceWithArgumentsAndContext( - sAdminService, aAdminArguments, mxContext)); + sAdminService, aAdminArguments, mxContext)); return xAdminProvider; } @@ -274,7 +274,7 @@ public class ConfigExamples // The service name: Need only read access: final String sReadOnlyView = "com.sun.star.configuration.ConfigurationAccess"; - // creation arguments: nodepath + // creation arguments: nodepath com.sun.star.beans.PropertyValue aPathArgument = new com.sun.star.beans.PropertyValue(); aPathArgument.Name = "nodepath"; aPathArgument.Value = sPath; @@ -298,7 +298,7 @@ public class ConfigExamples // The service name: Need update access: final String cUpdatableView = "com.sun.star.configuration.ConfigurationUpdateAccess"; - // creation arguments: nodepath + // creation arguments: nodepath com.sun.star.beans.PropertyValue aPathArgument = new com.sun.star.beans.PropertyValue(); aPathArgument.Name = "nodepath"; aPathArgument.Value = sPath; @@ -322,12 +322,12 @@ public class ConfigExamples // The service name: Need update access: final String cUpdatableView = "com.sun.star.configuration.ConfigurationUpdateAccess"; - // creation arguments: nodepath + // creation arguments: nodepath com.sun.star.beans.PropertyValue aPathArgument = new com.sun.star.beans.PropertyValue(); aPathArgument.Name = "nodepath"; aPathArgument.Value = sPath; - // creation arguments: commit mode - write-through or write-back + // creation arguments: commit mode - write-through or write-back com.sun.star.beans.PropertyValue aModeArgument = new com.sun.star.beans.PropertyValue(); aModeArgument.Name = "lazywrite"; aModeArgument.Value = new Boolean(bAsync); @@ -382,7 +382,7 @@ public class ConfigExamples { System.out.println("\n--- starting example: update group data synchronously --------------"); editGridOptions( ); - } + } catch ( Exception e ) { e.printStackTrace(); @@ -401,7 +401,7 @@ public class ConfigExamples Object aNewData = readGridConfiguration( ); System.out.println("Before reset: user grid options: " + aOldData); System.out.println("After reset: default grid options: " + aNewData); - } + } catch ( Exception e ) { e.printStackTrace(); @@ -447,7 +447,7 @@ public class ConfigExamples protected GridOptions readGridConfiguration() throws com.sun.star.uno.Exception { - // The path to the root element + // The path to the root element final String cGridOptionsPath = "/org.openoffice.Office.Calc/Grid"; // create the view @@ -455,9 +455,9 @@ public class ConfigExamples // the result structure GridOptions options = new GridOptions(); - + // accessing a single nested value - XHierarchicalPropertySet xProperties = + XHierarchicalPropertySet xProperties = (XHierarchicalPropertySet)UnoRuntime.queryInterface(XHierarchicalPropertySet.class, xViewRoot); Object aVisible = xProperties.getHierarchicalPropertyValue("Option/VisibleGrid"); @@ -468,8 +468,8 @@ public class ConfigExamples XMultiPropertySet xSubdivProperties = (XMultiPropertySet)UnoRuntime.queryInterface(XMultiPropertySet.class, xSubdivision); - - // variables for multi-element access + + // variables for multi-element access String[] aElementNames = new String[2]; aElementNames[0] = "XAxis"; @@ -483,10 +483,10 @@ public class ConfigExamples // accessing deeply nested subproperties Object xResolution = xProperties.getHierarchicalPropertyValue("Resolution"); - XMultiHierarchicalPropertySet xResolutionProperties = + XMultiHierarchicalPropertySet xResolutionProperties = (XMultiHierarchicalPropertySet) UnoRuntime.queryInterface(XMultiHierarchicalPropertySet.class, xResolution); - + aElementNames[0] = "XAxis/Metric"; aElementNames[1] = "YAxis/Metric"; @@ -496,7 +496,7 @@ public class ConfigExamples options.resolution_y = ((Integer) aElementValues[1]).intValue(); // all options have been retrieved - clean up and return - // we are done with the view - dispose it + // we are done with the view - dispose it ((XComponent)UnoRuntime.queryInterface(XComponent.class, xViewRoot)).dispose(); @@ -518,7 +518,7 @@ public class ConfigExamples throws com.sun.star.uno.Exception { // First process this as an element (preorder traversal) - XHierarchicalName xElementPath = + XHierarchicalName xElementPath = (XHierarchicalName) UnoRuntime.queryInterface(XHierarchicalName.class, xElement); String sPath = xElementPath.getHierarchicalName(); @@ -528,7 +528,7 @@ public class ConfigExamples // now process this as a container XNameAccess xChildAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xElement); - + // get a list of child elements String[] aElementNames = xChildAccess.getElementNames(); @@ -540,7 +540,7 @@ public class ConfigExamples // is it a structural element (object) ... if ( aAnyConv.isObject(aChild) && !aAnyConv.isArray(aChild) ) { - // then get an interface + // then get an interface XInterface xChildElement = (XInterface)UnoRuntime.queryInterface(XInterface.class, aChild); // and continue processing child elements recursively @@ -549,10 +549,10 @@ public class ConfigExamples // ... or is it a simple value else { - // Build the path to it from the path of + // Build the path to it from the path of // the element and the name of the child String sChildPath; - sChildPath = + sChildPath = xElementPath.composeHierarchicalName(aElementNames[i]); // and process the value @@ -561,7 +561,7 @@ public class ConfigExamples } } - /** Method to browse the part rooted at sRootPath + /** Method to browse the part rooted at sRootPath of the configuration that the Provider provides. All nodes will be processed by the IConfigurationProcessor passed. @@ -571,12 +571,12 @@ public class ConfigExamples { // create the root element XInterface xViewRoot = (XInterface)createConfigurationView( sRootPath ); - + // now do the processing browseElementRecursively( xViewRoot, aProcessor ); - // we are done with the view - dispose it - // This assumes that the processor + // we are done with the view - dispose it + // This assumes that the processor // does not keep a reference to the elements in processStructuralElement ((XComponent) UnoRuntime.queryInterface(XComponent.class,xViewRoot)).dispose(); @@ -594,14 +594,14 @@ public class ConfigExamples final String sFilterKey = "/org.openoffice.TypeDetection.Filter/Filters"; // browse the configuration, dumping filter information - browseConfiguration( sFilterKey, + browseConfiguration( sFilterKey, new IConfigurationProcessor () { /// prints Path and Value of properties public void processValueElement( String sPath_, Object aValue_ ) { if (new AnyConverter().isArray(aValue_)) { final Object [] aArray = (Object [])aValue_; - + System.out.print("\tValue: " + sPath_ + " = { "); for (int i=0; i<aArray.length; ++i) { @@ -613,14 +613,14 @@ public class ConfigExamples else System.out.println("\tValue: " + sPath_ + " = " + aValue_); } - + /// prints the Filter entries public void processStructuralElement( String sPath_, XInterface xElement_) { // get template information, to detect instances of the 'Filter' template - XTemplateInstance xInstance = + XTemplateInstance xInstance = ( XTemplateInstance )UnoRuntime.queryInterface( XTemplateInstance .class,xElement_); - // only select the Filter entries + // only select the Filter entries if (xInstance != null && xInstance.getTemplateName().endsWith("Filter")) { XNamed xNamed = (XNamed)UnoRuntime.queryInterface(XNamed.class,xElement_); System.out.println("Filter " + xNamed.getName() + " (" + sPath_ + ")"); @@ -631,12 +631,12 @@ public class ConfigExamples // GROUP UPDATE example - /** This method simulates editing configuration data using a GridEditor dialog class + /** This method simulates editing configuration data using a GridEditor dialog class */ public void editGridOptions( ) throws com.sun.star.uno.Exception { - // The path to the root element + // The path to the root element final String cGridOptionsPath = "/org.openoffice.Office.Calc/Grid"; // create the SYNCHRONOUS view for better error handling @@ -646,7 +646,7 @@ public class ConfigExamples GridOptionsEditor dialog = new GridOptionsEditor(); // set up the initial values and register listeners - // get a data access interface, to supply the view with a model + // get a data access interface, to supply the view with a model XMultiHierarchicalPropertySet xProperties = (XMultiHierarchicalPropertySet) UnoRuntime.queryInterface(XMultiHierarchicalPropertySet.class, xViewRoot); @@ -654,10 +654,10 @@ public class ConfigExamples dialog.setModel( xProperties ); // get a listener object (probably an adapter) that notifies - // the dialog of external changes to its model + // the dialog of external changes to its model XChangesListener xListener = dialog.createChangesListener( ); - - XChangesNotifier xNotifier = + + XChangesNotifier xNotifier = (XChangesNotifier)UnoRuntime.queryInterface(XChangesNotifier.class, xViewRoot); xNotifier.addChangesListener( xListener ); @@ -668,9 +668,9 @@ public class ConfigExamples if (dialog.execute() == GridOptionsEditor.SAVE_SETTINGS) { // changes have been applied to the view here - XChangesBatch xUpdateControl = + XChangesBatch xUpdateControl = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class,xViewRoot); - + try { xUpdateControl.commitChanges(); @@ -680,12 +680,12 @@ public class ConfigExamples dialog.informUserOfError( e ); } } - + // all changes have been handled - clean up and return // listener is done now xNotifier.removeChangesListener( xListener ); - // we are done with the view - dispose it + // we are done with the view - dispose it ((XComponent)UnoRuntime.queryInterface(XComponent.class, xViewRoot)).dispose(); } @@ -747,7 +747,7 @@ public class ConfigExamples }); } /// this method is called when data has changed to display the updated data - private void updateDisplay() { + private void updateDisplay() { if (mxModel != null) System.out.println("Grid options editor: data=" + readModel()); else @@ -755,7 +755,7 @@ public class ConfigExamples } // this method is used to read all relevant data from the model - private GridOptions readModel() + private GridOptions readModel() { try { @@ -789,7 +789,7 @@ public class ConfigExamples { try { - XHierarchicalPropertySet xHPS = + XHierarchicalPropertySet xHPS = (XHierarchicalPropertySet)UnoRuntime.queryInterface(XHierarchicalPropertySet.class, mxModel); final String sSetting = "Option/VisibleGrid"; @@ -799,7 +799,7 @@ public class ConfigExamples Boolean bOldValue = (Boolean)xHPS.getHierarchicalPropertyValue(sSetting); Boolean bNewValue = new Boolean( ! bOldValue.booleanValue() ); - + xHPS.setHierarchicalPropertyValue(sSetting,bNewValue); } catch (Exception e) @@ -809,10 +809,10 @@ public class ConfigExamples } } - /** This method creates an extra updatable view to change some data - and trigger the listener of the GridEditor + /** This method creates an extra updatable view to change some data + and trigger the listener of the GridEditor */ - void changeSomeData(String xKey) + void changeSomeData(String xKey) { try { @@ -846,12 +846,12 @@ public class ConfigExamples } // commit the changes - XChangesBatch xUpdateControl = + XChangesBatch xUpdateControl = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class,xOtherViewRoot); - + xUpdateControl.commitChanges(); - // we are done with the view - dispose it + // we are done with the view - dispose it ((XComponent)UnoRuntime.queryInterface(XComponent.class, xOtherViewRoot)).dispose(); } catch (Exception e) @@ -866,20 +866,20 @@ public class ConfigExamples protected void resetGridConfiguration() throws com.sun.star.uno.Exception { - // The path to the root element + // The path to the root element final String cGridOptionsPath = "/org.openoffice.Office.Calc/Grid"; // create the view Object xViewRoot = createUpdatableView(cGridOptionsPath); // resetting a single nested value - XHierarchicalNameAccess xHierarchicalAccess = + XHierarchicalNameAccess xHierarchicalAccess = (XHierarchicalNameAccess)UnoRuntime.queryInterface(XHierarchicalNameAccess.class, xViewRoot); // get using absolute name Object xOptions = xHierarchicalAccess.getByHierarchicalName(cGridOptionsPath + "/Option"); - XPropertyState xOptionState = + XPropertyState xOptionState = (XPropertyState)UnoRuntime.queryInterface(XPropertyState.class, xOptions); xOptionState.setPropertyToDefault("VisibleGrid"); @@ -888,9 +888,9 @@ public class ConfigExamples Object xResolutionX = xHierarchicalAccess.getByHierarchicalName("Resolution/XAxis"); Object xResolutionY = xHierarchicalAccess.getByHierarchicalName("Resolution/YAxis"); - XPropertyState xResolutionStateX = + XPropertyState xResolutionStateX = (XPropertyState)UnoRuntime.queryInterface(XPropertyState.class, xResolutionX); - XPropertyState xResolutionStateY = + XPropertyState xResolutionStateY = (XPropertyState)UnoRuntime.queryInterface(XPropertyState.class, xResolutionY); xResolutionStateX.setPropertyToDefault("Metric"); @@ -901,16 +901,16 @@ public class ConfigExamples XMultiPropertyStates xSubdivisionStates = (XMultiPropertyStates)UnoRuntime.queryInterface(XMultiPropertyStates.class, xSubdivision); - + xSubdivisionStates.setAllPropertiesToDefault(); // commit the changes - XChangesBatch xUpdateControl = + XChangesBatch xUpdateControl = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class,xViewRoot); - + xUpdateControl.commitChanges(); - // we are done with the view - dispose it + // we are done with the view - dispose it ((XComponent)UnoRuntime.queryInterface(XComponent.class, xViewRoot)).dispose(); } @@ -920,7 +920,7 @@ public class ConfigExamples /** This method stores a sample data source given some connection data. - ATTENTION: This example requires an older version of the + ATTENTION: This example requires an older version of the org.openoffice.Office.DataAccess schema. It does not work with the current schema. Because of this, the method currenty does nothing. @@ -929,12 +929,12 @@ public class ConfigExamples void storeSampleDataSource() throws com.sun.star.uno.Exception { - if (SET_EXAMPLE_BROKEN_IN_THIS_RELEASE) + if (SET_EXAMPLE_BROKEN_IN_THIS_RELEASE) { System.out.println("- DISABLED: (the existing example does not work with this version) -"); return; // this function does not work } - + String sSampleDataSourceName = "SampleTextDatabase"; String sSampleDataSourceURL = "sdbc:flat:$(userurl)/database/SampleTextDatabase"; @@ -964,10 +964,10 @@ public class ConfigExamples ) throws com.sun.star.uno.Exception { - // create the view and get the data source element + // create the view and get the data source element Object xDataSource = createDataSourceDescription(getProvider(),sDataSourceName); - // set the values + // set the values XPropertySet xDataSourceProperties = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xDataSource); @@ -978,7 +978,7 @@ public class ConfigExamples if ( aTableFilter != null ) xDataSourceProperties.setPropertyValue("TableFilter", aTableFilter ); - + // store the driver-specific settings if (aDriverSettings != null) { @@ -991,9 +991,9 @@ public class ConfigExamples Object xViewRoot = getViewRoot(xDataSource); // commit the changes - XChangesBatch xUpdateControl = + XChangesBatch xUpdateControl = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class,xViewRoot); - + xUpdateControl.commitChanges(); // now clean up @@ -1012,20 +1012,20 @@ public class ConfigExamples // The service name: Need an update access: final String cUpdatableView = "com.sun.star.configuration.ConfigurationUpdateAccess"; - // The path to the DataSources set node + // The path to the DataSources set node final String cDataSourcesPath = "/org.openoffice.Office.DataAccess/DataSources"; - // creation arguments: nodepath + // creation arguments: nodepath com.sun.star.beans.PropertyValue aPathArgument = new com.sun.star.beans.PropertyValue(); aPathArgument.Name = "nodepath"; aPathArgument.Value = cDataSourcesPath ; - // creation arguments: commit mode + // creation arguments: commit mode com.sun.star.beans.PropertyValue aModeArgument = new com.sun.star.beans.PropertyValue(); aModeArgument.Name = "lazywrite"; aModeArgument.Value = new Boolean( true ); - // creation arguments: depth + // creation arguments: depth com.sun.star.beans.PropertyValue aDepthArgument = new com.sun.star.beans.PropertyValue(); aDepthArgument.Name = "depth"; aDepthArgument.Value = new Integer( 1 ); @@ -1036,7 +1036,7 @@ public class ConfigExamples aArguments[2] = aDepthArgument; // create the view: asynchronously updatable, with depth 1 - Object xViewRoot = + Object xViewRoot = xProvider.createInstanceWithArguments(cUpdatableView, aArguments); XNameAccess xSetOfDataSources = @@ -1046,12 +1046,12 @@ public class ConfigExamples if ( xSetOfDataSources .hasByName( sDataSourceName )) { // the element is there, but it is loaded only with depth zero ! - try + try { // the view should point to the element directly, so we need to extend the path XHierarchicalName xComposePath = (XHierarchicalName) UnoRuntime.queryInterface(XHierarchicalName.class, xSetOfDataSources ); - + String sElementPath = xComposePath.composeHierarchicalName( sDataSourceName ); // use the name of the element now @@ -1063,19 +1063,19 @@ public class ConfigExamples aDeepArguments[1] = aModeArgument; // create the view: asynchronously updatable, with unlimited depth - xDataSourceDescriptor = + xDataSourceDescriptor = xProvider.createInstanceWithArguments(cUpdatableView, aDeepArguments); - if ( xDataSourceDescriptor != null) // all went fine + if ( xDataSourceDescriptor != null) // all went fine { // dispose the other view ((XComponent)UnoRuntime.queryInterface(XComponent.class, xViewRoot)).dispose(); xViewRoot = null; } } - catch (Exception e) + catch (Exception e) { - // something went wrong, we retry with a new element + // something went wrong, we retry with a new element System.err.println("WARNING: An exception occurred while creating a view for an existing data source: " + e); xDataSourceDescriptor = null; } @@ -1084,8 +1084,8 @@ public class ConfigExamples // do we have a result element yet ? if ( xDataSourceDescriptor == null) { - // get the container - XNameContainer xSetUpdate = + // get the container + XNameContainer xSetUpdate = (XNameContainer)UnoRuntime.queryInterface(XNameContainer.class, xViewRoot); // create a new detached set element (instance of DataSourceDescription) @@ -1095,7 +1095,7 @@ public class ConfigExamples // the new element is the result ! xDataSourceDescriptor = xElementFactory.createInstance(); - // insert it - this also names the element + // insert it - this also names the element xSetUpdate.insertByName( sDataSourceName , xDataSourceDescriptor ); } @@ -1106,21 +1106,21 @@ public class ConfigExamples void storeSettings(Object xSettingsSet, com.sun.star.beans.NamedValue [] aSettings ) throws com.sun.star.uno.Exception { - if (aSettings == null) + if (aSettings == null) return; // get the settings set as a container - XNameContainer xSettingsContainer = + XNameContainer xSettingsContainer = (XNameContainer) UnoRuntime.queryInterface( XNameContainer.class, xSettingsSet); // and get a factory interface for creating the entries - XSingleServiceFactory xSettingsFactory = + XSingleServiceFactory xSettingsFactory = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, xSettingsSet); // now insert the individual settings for (int i = 0; i < aSettings.length; ++i) { // create a DataSourceSetting object - XPropertySet xSetting = (XPropertySet) + XPropertySet xSetting = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, xSettingsFactory.createInstance() ); // can set the value before inserting @@ -1139,9 +1139,9 @@ public class ConfigExamples /// This method get the view root node given an interface to any node in the view public static Object getViewRoot(Object xElement) { - Object xResult = xElement; - - // set the result to its parent until that would be null + Object xResult = xElement; + + // set the result to its parent until that would be null Object xParent; do { @@ -1164,13 +1164,13 @@ public class ConfigExamples // workaround methods for unimplemented functionality /// WORKAROUND: does the same as xNamedItem.setName(sNewName) should do - void renameSetItem(XNamed xNamedItem, String sNewName) + void renameSetItem(XNamed xNamedItem, String sNewName) throws com.sun.star.uno.Exception { - XChild xChildItem = (XChild) + XChild xChildItem = (XChild) UnoRuntime.queryInterface(XChild.class, xNamedItem); - XNameContainer xParentSet = (XNameContainer) + XNameContainer xParentSet = (XNameContainer) UnoRuntime.queryInterface( XNameContainer.class, xChildItem.getParent() ); String sOldName = xNamedItem.getName(); @@ -1178,16 +1178,16 @@ public class ConfigExamples // now rename the item xParentSet.removeByName(sOldName); xParentSet.insertByName(sNewName,xNamedItem); - } + } /// WORKAROUND: does the same as xChildItem.setParent( xNewParent ) should do - void moveSetItem(XChild xChildItem, XNameContainer xNewParent) + void moveSetItem(XChild xChildItem, XNameContainer xNewParent) throws com.sun.star.uno.Exception { - XNamed xNamedItem = (XNamed) + XNamed xNamedItem = (XNamed) UnoRuntime.queryInterface(XNamed.class, xChildItem); - XNameContainer xOldParent = (XNameContainer) + XNameContainer xOldParent = (XNameContainer) UnoRuntime.queryInterface( XNameContainer.class, xChildItem.getParent() ); String sItemName = xNamedItem.getName(); diff --git a/odk/examples/DevelopersGuide/Database/CodeSamples.java b/odk/examples/DevelopersGuide/Database/CodeSamples.java index 79b3405a4602..0980055a0c0b 100644 --- a/odk/examples/DevelopersGuide/Database/CodeSamples.java +++ b/odk/examples/DevelopersGuide/Database/CodeSamples.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import java.io.*; @@ -50,12 +50,12 @@ import com.sun.star.sdbc.*; import com.sun.star.sdb.*; import com.sun.star.sdbcx.*; import com.sun.star.frame.*; - + public class CodeSamples { public static XComponentContext xContext; public static XMultiComponentFactory xMCF; - + public static void main(String argv[]) throws java.lang.Exception { try { @@ -108,7 +108,7 @@ public class CodeSamples } displayTableStructure( con ); } - // printDataSources(); + // printDataSources(); } catch(Exception e) { @@ -136,7 +136,7 @@ public class CodeSamples else System.out.println("Connection could not be created!"); } - + // uses the driver manager to create a new connection and dispose it. public static XConnection openConnectionWithDriverManager() throws com.sun.star.uno.Exception { @@ -302,11 +302,11 @@ public class CodeSamples xContext)); // we use the first datasource XQueryDefinitionsSupplier xQuerySup = (XQueryDefinitionsSupplier) - UnoRuntime.queryInterface(XQueryDefinitionsSupplier.class, - xNameAccess.getByName( "Bibliography" )); + UnoRuntime.queryInterface(XQueryDefinitionsSupplier.class, + xNameAccess.getByName( "Bibliography" )); XNameAccess xQDefs = xQuerySup.getQueryDefinitions(); // create new query definition - XSingleServiceFactory xSingleFac = (XSingleServiceFactory) + XSingleServiceFactory xSingleFac = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, xQDefs); XPropertySet xProp = (XPropertySet) UnoRuntime.queryInterface( @@ -324,7 +324,7 @@ public class CodeSamples {} xCont.insertByName("Query1",xProp); XDocumentDataSource xDs = (XDocumentDataSource)UnoRuntime.queryInterface(XDocumentDataSource.class, xQuerySup); - + XStorable xStore = (XStorable)UnoRuntime.queryInterface(XStorable.class,xDs.getDatabaseDocument()); xStore.store(); } @@ -338,13 +338,13 @@ public class CodeSamples xContext)); // we use the first datasource XDataSource xDS = (XDataSource)UnoRuntime.queryInterface( - XDataSource.class, xNameAccess.getByName( "Bibliography" )); + XDataSource.class, xNameAccess.getByName( "Bibliography" )); XConnection con = xDS.getConnection("",""); XQueriesSupplier xQuerySup = (XQueriesSupplier) - UnoRuntime.queryInterface(XQueriesSupplier.class, con); - + UnoRuntime.queryInterface(XQueriesSupplier.class, con); + XNameAccess xQDefs = xQuerySup.getQueries(); - + XColumnsSupplier xColsSup = (XColumnsSupplier) UnoRuntime.queryInterface( XColumnsSupplier.class,xQDefs.getByName("Query1")); XNameAccess xCols = xColsSup.getColumns(); diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/OSubComponent.hxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/OSubComponent.hxx index 2de4fbecab35..4d728611b18f 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/OSubComponent.hxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/OSubComponent.hxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef _CONNECTIVITY_OSUBCOMPONENT_HXX_ @@ -79,7 +79,7 @@ namespace connectivity protected: // the parent must support the tunnel implementation ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent; - SELF* m_pDerivedImplementation; + SELF* m_pDerivedImplementation; public: OSubComponent( @@ -112,14 +112,14 @@ namespace connectivity class OPropertyArrayUsageHelper { protected: - static sal_Int32 s_nRefCount; - static ::cppu::IPropertyArrayHelper* s_pProps; - static ::osl::Mutex s_aMutex; + static sal_Int32 s_nRefCount; + static ::cppu::IPropertyArrayHelper* s_pProps; + static ::osl::Mutex s_aMutex; public: OPropertyArrayUsageHelper(); virtual ~OPropertyArrayUsageHelper() - { // ARGHHHHHHH ..... would like to implement this in proparrhlp_impl.hxx (as we do with all other methods) + { // ARGHHHHHHH ..... would like to implement this in proparrhlp_impl.hxx (as we do with all other methods) // but SUNPRO 5 compiler (linker) doesn't like this ::osl::MutexGuard aGuard(s_aMutex); OSL_ENSURE(s_nRefCount > 0, "OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper : suspicious call : have a refcount of 0 !"); @@ -133,7 +133,7 @@ namespace connectivity /** call this in the getInfoHelper method of your derived class. The method returns the array helper of the class, which is created if neccessary. */ - ::cppu::IPropertyArrayHelper* getArrayHelper(); + ::cppu::IPropertyArrayHelper* getArrayHelper(); protected: /** used to implement the creation of the array helper which is shared amongst all instances of the class. @@ -143,19 +143,19 @@ namespace connectivity <BR> as long as IPropertyArrayHelper has no virtual destructor, the implementation of ~OPropertyArrayUsageHelper assumes that you created an ::cppu::OPropertyArrayHelper when deleting s_pProps. - @return an pointer to the newly created array helper. Must not be NULL. + @return an pointer to the newly created array helper. Must not be NULL. */ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const = 0; }; - template<class TYPE> - sal_Int32 OPropertyArrayUsageHelper< TYPE >::s_nRefCount = 0; + template<class TYPE> + sal_Int32 OPropertyArrayUsageHelper< TYPE >::s_nRefCount = 0; - template<class TYPE> - ::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper< TYPE >::s_pProps = NULL; + template<class TYPE> + ::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper< TYPE >::s_pProps = NULL; - template<class TYPE> - ::osl::Mutex OPropertyArrayUsageHelper< TYPE >::s_aMutex; + template<class TYPE> + ::osl::Mutex OPropertyArrayUsageHelper< TYPE >::s_aMutex; //------------------------------------------------------------------ template <class TYPE> @@ -219,32 +219,32 @@ namespace connectivity } -#define DECLARE_SERVICE_INFO() \ - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); \ - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); \ - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) \ - -#define IMPLEMENT_SERVICE_INFO(classname, implasciiname, serviceasciiname) \ - ::rtl::OUString SAL_CALL classname::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) \ - { \ - return ::rtl::OUString::createFromAscii(implasciiname); \ - } \ - ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) \ - { \ - ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1); \ - aSupported[0] = ::rtl::OUString::createFromAscii(serviceasciiname); \ - return aSupported; \ - } \ - sal_Bool SAL_CALL classname::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) \ - { \ - Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); \ - const ::rtl::OUString* pSupported = aSupported.getConstArray(); \ - const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); \ - for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) \ - ; \ +#define DECLARE_SERVICE_INFO() \ + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); \ + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); \ + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) \ + +#define IMPLEMENT_SERVICE_INFO(classname, implasciiname, serviceasciiname) \ + ::rtl::OUString SAL_CALL classname::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) \ + { \ + return ::rtl::OUString::createFromAscii(implasciiname); \ + } \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL classname::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) \ + { \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1); \ + aSupported[0] = ::rtl::OUString::createFromAscii(serviceasciiname); \ + return aSupported; \ + } \ + sal_Bool SAL_CALL classname::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) \ + { \ + Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); \ + const ::rtl::OUString* pSupported = aSupported.getConstArray(); \ + const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); \ + for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) \ + ; \ \ - return pSupported != pEnd; \ - } \ + return pSupported != pEnd; \ + } \ } diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/OTypeInfo.hxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/OTypeInfo.hxx index 912f07bb64d7..4a28333adc35 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/OTypeInfo.hxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/OTypeInfo.hxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef _CONNECTIVITY_OTYPEINFO_HXX_ @@ -43,28 +43,28 @@ namespace connectivity { struct OTypeInfo { - ::rtl::OUString aTypeName; // Name des Types in der Datenbank - ::rtl::OUString aLiteralPrefix; // Prefix zum Quoten - ::rtl::OUString aLiteralSuffix; // Suffix zum Quoten - ::rtl::OUString aCreateParams; // Parameter zum Erstellen - ::rtl::OUString aLocalTypeName; - - sal_Int32 nPrecision; // Laenge des Types - - sal_Int16 nMaximumScale; // Nachkommastellen - sal_Int16 nMinimumScale; // Min Nachkommastellen - - sal_Int16 nType; // Datenbanktyp - sal_Int16 nSearchType; // kann nach dem Typen gesucht werden - sal_Int16 nNumPrecRadix; // indicating the radix, which is usually 2 or 10 - - sal_Bool bCurrency : 1, // Waehrung - bAutoIncrement : 1, // Ist es ein automatisch incrementierendes Feld - bNullable : 1, // Kann das Feld NULL annehmen - bCaseSensitive : 1, // Ist der Type Casesensitive - bUnsigned : 1, // Ist der Type Unsigned - bEmpty_1 : 1, // for later use - bEmpty_2 : 1; + ::rtl::OUString aTypeName; // Name des Types in der Datenbank + ::rtl::OUString aLiteralPrefix; // Prefix zum Quoten + ::rtl::OUString aLiteralSuffix; // Suffix zum Quoten + ::rtl::OUString aCreateParams; // Parameter zum Erstellen + ::rtl::OUString aLocalTypeName; + + sal_Int32 nPrecision; // Laenge des Types + + sal_Int16 nMaximumScale; // Nachkommastellen + sal_Int16 nMinimumScale; // Min Nachkommastellen + + sal_Int16 nType; // Datenbanktyp + sal_Int16 nSearchType; // kann nach dem Typen gesucht werden + sal_Int16 nNumPrecRadix; // indicating the radix, which is usually 2 or 10 + + sal_Bool bCurrency : 1, // Waehrung + bAutoIncrement : 1, // Ist es ein automatisch incrementierendes Feld + bNullable : 1, // Kann das Feld NULL annehmen + bCaseSensitive : 1, // Ist der Type Casesensitive + bUnsigned : 1, // Ist der Type Unsigned + bEmpty_1 : 1, // for later use + bEmpty_2 : 1; OTypeInfo() :bCurrency(sal_False) diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SConnection.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SConnection.cxx index 1e52822705b8..62c70353b9f2 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SConnection.cxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SConnection.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include "SConnection.hxx" @@ -52,7 +52,7 @@ using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::sdbc; // -------------------------------------------------------------------------------- -OConnection::OConnection(SkeletonDriver* _pDriver) +OConnection::OConnection(SkeletonDriver* _pDriver) : OSubComponent<OConnection, OConnection_BASE>((::cppu::OWeakObject*)_pDriver, this), OMetaConnection_BASE(m_aMutex), m_pDriver(_pDriver), @@ -81,7 +81,7 @@ void SAL_CALL OConnection::release() throw() void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyValue >& info) throw(SQLException) { osl_incrementInterlockedCount( &m_refCount ); - + // some example code how to get the information out of the sequence sal_Int32 nLen = url.indexOf(':'); @@ -89,17 +89,17 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV ::rtl::OUString aDSN(RTL_CONSTASCII_USTRINGPARAM("DSN=")), aUID, aPWD, aSysDrvSettings; aDSN += url.copy(nLen+1); - const char* pUser = "user"; - const char* pTimeout = "Timeout"; - const char* pSilent = "Silent"; - const char* pPwd = "password"; + const char* pUser = "user"; + const char* pTimeout = "Timeout"; + const char* pSilent = "Silent"; + const char* pPwd = "password"; const char* pUseCatalog = "UseCatalog"; - const char* pSysDrv = "SystemDriverSettings"; + const char* pSysDrv = "SystemDriverSettings"; sal_Int32 nTimeout = 20; sal_Bool bSilent = sal_True; - const PropertyValue *pBegin = info.getConstArray(); - const PropertyValue *pEnd = pBegin + info.getLength(); + const PropertyValue *pBegin = info.getConstArray(); + const PropertyValue *pEnd = pBegin + info.getLength(); for(;pBegin != pEnd;++pBegin) { if(!pBegin->Name.compareToAscii(pTimeout)) @@ -140,7 +140,7 @@ Reference< XStatement > SAL_CALL OConnection::createStatement( ) throw(SQLExcep { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); - + // create a statement // the statement can only be executed once Reference< XStatement > xReturn = new OStatement(this); @@ -152,7 +152,7 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareStatement( const :: { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); - + // the pre if(m_aTypeInfo.empty()) buildTypeInfo(); @@ -168,8 +168,8 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl:: { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); - - // not implemented yet :-) a task to do + + // not implemented yet :-) a task to do return NULL; } // -------------------------------------------------------------------------------- @@ -177,7 +177,7 @@ Reference< XPreparedStatement > SAL_CALL OConnection::prepareCall( const ::rtl:: { ::osl::MutexGuard aGuard( m_aMutex ); // when you need to transform SQL92 to you driver specific you can do it here - + return _sSql; } // -------------------------------------------------------------------------------- @@ -210,7 +210,7 @@ void SAL_CALL OConnection::rollback( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); - + // same as commit but for the other case } @@ -218,7 +218,7 @@ void SAL_CALL OConnection::rollback( ) throw(SQLException, RuntimeException) sal_Bool SAL_CALL OConnection::isClosed( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); - + // just simple -> we are close when we are disposed taht means someone called dispose(); (XComponent) return OConnection_BASE::rBHelper.bDisposed; } @@ -227,7 +227,7 @@ Reference< XDatabaseMetaData > SAL_CALL OConnection::getMetaData( ) throw(SQLEx { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); - + // here we have to create the class with biggest interface // The answer is 42 :-) Reference< XDatabaseMetaData > xMetaData = m_xMetaData; @@ -244,15 +244,15 @@ void SAL_CALL OConnection::setReadOnly( sal_Bool readOnly ) throw(SQLException, { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); - + // set you connection to readonly } // -------------------------------------------------------------------------------- sal_Bool SAL_CALL OConnection::isReadOnly( ) throw(SQLException, RuntimeException) -{ +{ ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); - + // return if your connection to readonly return sal_False; } @@ -269,7 +269,7 @@ void SAL_CALL OConnection::setCatalog( const ::rtl::OUString& catalog ) throw(SQ { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); - + // return your current catalog return ::rtl::OUString(); @@ -288,7 +288,7 @@ sal_Int32 SAL_CALL OConnection::getTransactionIsolation( ) throw(SQLException, { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); - + // please have a look at @see com.sun.star.sdbc.TransactionIsolation return TransactionIsolation::NONE; @@ -298,7 +298,7 @@ Reference< ::com::sun::star::container::XNameAccess > SAL_CALL OConnection::getT { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); - + // if your driver has special database types you can return it here return NULL; @@ -316,7 +316,7 @@ void SAL_CALL OConnection::close( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); - + } dispose(); } @@ -340,30 +340,30 @@ void OConnection::buildTypeInfo() throw( SQLException) Reference< XResultSet> xRs = getMetaData ()->getTypeInfo (); Reference< XRow> xRow(xRs,UNO_QUERY); // Information for a single SQL type - + // Loop on the result set until we reach end of file - while (xRs->next ()) + while (xRs->next ()) { OTypeInfo aInfo; - aInfo.aTypeName = xRow->getString (1); - aInfo.nType = xRow->getShort (2); - aInfo.nPrecision = xRow->getInt (3); - aInfo.aLiteralPrefix = xRow->getString (4); - aInfo.aLiteralSuffix = xRow->getString (5); - aInfo.aCreateParams = xRow->getString (6); - aInfo.bNullable = xRow->getBoolean (7) == ColumnValue::NULLABLE; - aInfo.bCaseSensitive = xRow->getBoolean (8); - aInfo.nSearchType = xRow->getShort (9); - aInfo.bUnsigned = xRow->getBoolean (10); - aInfo.bCurrency = xRow->getBoolean (11); - aInfo.bAutoIncrement = xRow->getBoolean (12); - aInfo.aLocalTypeName = xRow->getString (13); - aInfo.nMinimumScale = xRow->getShort (14); - aInfo.nMaximumScale = xRow->getShort (15); - aInfo.nNumPrecRadix = (sal_Int16)xRow->getInt(18); - - + aInfo.aTypeName = xRow->getString (1); + aInfo.nType = xRow->getShort (2); + aInfo.nPrecision = xRow->getInt (3); + aInfo.aLiteralPrefix = xRow->getString (4); + aInfo.aLiteralSuffix = xRow->getString (5); + aInfo.aCreateParams = xRow->getString (6); + aInfo.bNullable = xRow->getBoolean (7) == ColumnValue::NULLABLE; + aInfo.bCaseSensitive = xRow->getBoolean (8); + aInfo.nSearchType = xRow->getShort (9); + aInfo.bUnsigned = xRow->getBoolean (10); + aInfo.bCurrency = xRow->getBoolean (11); + aInfo.bAutoIncrement = xRow->getBoolean (12); + aInfo.aLocalTypeName = xRow->getString (13); + aInfo.nMinimumScale = xRow->getShort (14); + aInfo.nMaximumScale = xRow->getShort (15); + aInfo.nNumPrecRadix = (sal_Int16)xRow->getInt(18); + + // Now that we have the type info, save it // in the Hashtable if we don't already have an @@ -382,7 +382,7 @@ void OConnection::disposing() { // we noticed that we should be destroied in near future so we have to dispose our statements ::osl::MutexGuard aGuard(m_aMutex); - + for (OWeakRefArray::iterator i = m_aStatements.begin(); m_aStatements.end() != i; ++i) { Reference< XComponent > xComp(i->get(), UNO_QUERY); @@ -391,7 +391,7 @@ void OConnection::disposing() } m_aStatements.clear(); - m_bClosed = sal_True; + m_bClosed = sal_True; m_xMetaData = ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData>(); dispose_ChildImpl(); diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SConnection.hxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SConnection.hxx index 8072094d7346..8961cf49bfa4 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SConnection.hxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SConnection.hxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef CONNECTIVITY_SCONNECTION_HXX @@ -64,8 +64,8 @@ namespace connectivity class SkeletonDriver; class ODatabaseMetaData; - typedef OMetaConnection_BASE OConnection_BASE; // implements basics and text encoding - typedef ::std::vector< ::connectivity::OTypeInfo> TTypeInfoVector; + typedef OMetaConnection_BASE OConnection_BASE; // implements basics and text encoding + typedef ::std::vector< ::connectivity::OTypeInfo> TTypeInfoVector; typedef std::vector< ::com::sun::star::uno::WeakReferenceHelper > OWeakRefArray; class OConnection : public OBase_Mutex, @@ -75,38 +75,38 @@ namespace connectivity friend class connectivity::skeleton::OSubComponent<OConnection, OConnection_BASE>; protected: - - rtl_TextEncoding m_nTextEncoding; // the encoding which is used for all text conversions + + rtl_TextEncoding m_nTextEncoding; // the encoding which is used for all text conversions //==================================================================== // Data attributes //==================================================================== - TTypeInfoVector m_aTypeInfo; // vector containing an entry + TTypeInfoVector m_aTypeInfo; // vector containing an entry // for each row returned by // DatabaseMetaData.getTypeInfo. ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; - OWeakRefArray m_aStatements; // vector containing a list + OWeakRefArray m_aStatements; // vector containing a list // of all the Statement objects // for this Connection ::com::sun::star::sdbc::SQLWarning m_aLastWarning; // Last SQLWarning generated by // an operation - ::rtl::OUString m_aURL; // URL of connection - ::rtl::OUString m_sUser; // the user name - SkeletonDriver* m_pDriver; // Pointer to the owning + ::rtl::OUString m_aURL; // URL of connection + ::rtl::OUString m_sUser; // the user name + SkeletonDriver* m_pDriver; // Pointer to the owning // driver object - - sal_Bool m_bClosed; - sal_Bool m_bUseCatalog; // should we use the catalog on filebased databases - sal_Bool m_bUseOldDateFormat; + + sal_Bool m_bClosed; + sal_Bool m_bUseCatalog; // should we use the catalog on filebased databases + sal_Bool m_bUseOldDateFormat; void buildTypeInfo() throw( ::com::sun::star::sdbc::SQLException); - + public: virtual void construct( const ::rtl::OUString& url,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& info) throw(::com::sun::star::sdbc::SQLException); - OConnection(SkeletonDriver* _pDriver); + OConnection(SkeletonDriver* _pDriver); virtual ~OConnection(); void closeAllStatements () throw( ::com::sun::star::sdbc::SQLException); @@ -143,12 +143,12 @@ namespace connectivity virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); // - + // should we use the catalog on filebased databases - inline sal_Bool isCatalogUsed() const { return m_bUseCatalog; } - inline ::rtl::OUString getUserName() const { return m_sUser; } - inline SkeletonDriver* getDriver() const { return m_pDriver;} - inline rtl_TextEncoding getTextEncoding() const { return m_nTextEncoding; } + inline sal_Bool isCatalogUsed() const { return m_bUseCatalog; } + inline ::rtl::OUString getUserName() const { return m_sUser; } + inline SkeletonDriver* getDriver() const { return m_pDriver;} + inline rtl_TextEncoding getTextEncoding() const { return m_nTextEncoding; } }; } } diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDatabaseMetaData.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDatabaseMetaData.cxx index 0a8bf55cbed1..b17b8053e9b0 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDatabaseMetaData.cxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDatabaseMetaData.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include "SDatabaseMetaData.hxx" @@ -45,7 +45,7 @@ using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::sdbc; -ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon) +ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon) : m_pConnection(_pCon) , m_bUseCatalog(sal_True) { @@ -53,7 +53,7 @@ ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon) if(!m_pConnection->isCatalogUsed()) { osl_incrementInterlockedCount( &m_refCount ); - m_bUseCatalog = !(usesLocalFiles() || usesLocalFilePerTable()); + m_bUseCatalog = !(usesLocalFiles() || usesLocalFilePerTable()); osl_decrementInterlockedCount( &m_refCount ); } } @@ -789,88 +789,88 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas( ) throw(SQLExce return NULL; } // ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges( - const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) { return NULL; } // ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns( - const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) { return NULL; } // ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( - const Any& catalog, const ::rtl::OUString& schemaPattern, +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException) { return NULL; } // ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns( - const Any& catalog, const ::rtl::OUString& schemaPattern, +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) { return NULL; } // ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures( - const Any& catalog, const ::rtl::OUString& schemaPattern, +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures( + const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& procedureNamePattern ) throw(SQLException, RuntimeException) { return NULL; } // ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns( +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns( const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) { return NULL; } // ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys( +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys( const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) { return NULL; } // ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys( +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys( const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) { return NULL; } // ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys( +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys( const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) { return NULL; } // ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo( - const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException) { return NULL; } // ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier( - const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier( + const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope, sal_Bool nullable ) throw(SQLException, RuntimeException) { return NULL; } // ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException) { return NULL; } // ------------------------------------------------------------------------- -Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference( - const Any& primaryCatalog, const ::rtl::OUString& primarySchema, - const ::rtl::OUString& primaryTable, const Any& foreignCatalog, +Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference( + const Any& primaryCatalog, const ::rtl::OUString& primarySchema, + const ::rtl::OUString& primaryTable, const Any& foreignCatalog, const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException) { return NULL; diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDatabaseMetaData.hxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDatabaseMetaData.hxx index bdd3ac439796..4e62def377fd 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDatabaseMetaData.hxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDatabaseMetaData.hxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef CONNECTIVITY_SDATABASEMETADATA_HXX @@ -52,8 +52,8 @@ namespace connectivity class ODatabaseMetaData : public ODatabaseMetaData_BASE { - OConnection* m_pConnection; - sal_Bool m_bUseCatalog; + OConnection* m_pConnection; + sal_Bool m_bUseCatalog; public: inline OConnection* getOwnConnection() const { return m_pConnection; } diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.cxx index 6e3521d8b878..d0f435effe60 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.cxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include "SDriver.hxx" @@ -54,7 +54,7 @@ namespace connectivity } } // -------------------------------------------------------------------------------- -SkeletonDriver::SkeletonDriver() +SkeletonDriver::SkeletonDriver() : ODriver_BASE(m_aMutex) { } @@ -62,7 +62,7 @@ SkeletonDriver::SkeletonDriver() void SkeletonDriver::disposing() { ::osl::MutexGuard aGuard(m_aMutex); - + // when driver will be destroied so all our connections have to be destroied as well for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i) { @@ -86,7 +86,7 @@ rtl::OUString SkeletonDriver::getImplementationName_Static( ) throw(RuntimeExce //------------------------------------------------------------------------------ Sequence< ::rtl::OUString > SkeletonDriver::getSupportedServiceNames_Static( ) throw (RuntimeException) { - // which service is supported + // which service is supported // for more information @see com.sun.star.sdbc.Driver Sequence< ::rtl::OUString > aSNS( 1 ); aSNS[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.Driver"); @@ -122,14 +122,14 @@ Reference< XConnection > SAL_CALL SkeletonDriver::connect( const ::rtl::OUString { // create a new connection with the given properties and append it to our vector OConnection* pCon = new OConnection(this); - Reference< XConnection > xCon = pCon; // important here because otherwise the connection could be deleted inside (refcount goes -> 0) - pCon->construct(url,info); // late constructor call which can throw exception and allows a correct dtor call when so + Reference< XConnection > xCon = pCon; // important here because otherwise the connection could be deleted inside (refcount goes -> 0) + pCon->construct(url,info); // late constructor call which can throw exception and allows a correct dtor call when so m_xConnections.push_back(WeakReferenceHelper(*pCon)); - + return xCon; } // -------------------------------------------------------------------------------- -sal_Bool SAL_CALL SkeletonDriver::acceptsURL( const ::rtl::OUString& url ) +sal_Bool SAL_CALL SkeletonDriver::acceptsURL( const ::rtl::OUString& url ) throw(SQLException, RuntimeException) { // here we have to look if we support this url format @@ -202,7 +202,7 @@ void checkDisposed(sal_Bool _bThrow) throw ( DisposedException ) { if (_bThrow) throw DisposedException(); - + } //......................................................................... } diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.hxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.hxx index 36d50a486b6d..2c1cb2cc50ee 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.hxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.hxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef CONNECTIVITY_SDRIVER_HXX @@ -47,14 +47,14 @@ namespace connectivity { ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SkeletonDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ); - typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::sdbc::XDriver, + typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::sdbc::XDriver, ::com::sun::star::lang::XServiceInfo > ODriver_BASE; class SkeletonDriver : public ODriver_BASE { protected: - ::osl::Mutex m_aMutex; // mutex is need to control member access - OWeakRefArray m_xConnections; // vector containing a list + ::osl::Mutex m_aMutex; // mutex is need to control member access + OWeakRefArray m_xConnections; // vector containing a list // of all the Connection objects // for this Driver public: diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SPreparedStatement.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SPreparedStatement.cxx index 17217402462f..f896abb13e98 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SPreparedStatement.cxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SPreparedStatement.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include <stdio.h> @@ -95,7 +95,7 @@ Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( ) thr { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + if(!m_xMetaData.is()) m_xMetaData = new OResultSetMetaData(getOwnConnection()); return m_xMetaData; @@ -106,7 +106,7 @@ void SAL_CALL OPreparedStatement::close( ) throw(SQLException, RuntimeException { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + // Reset last warning message @@ -127,7 +127,7 @@ sal_Bool SAL_CALL OPreparedStatement::execute( ) throw(SQLException, RuntimeExc { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + // same as in statement with the difference that this statement also can contain parameter return sal_False; @@ -138,7 +138,7 @@ sal_Int32 SAL_CALL OPreparedStatement::executeUpdate( ) throw(SQLException, Run { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + // same as in statement with the difference that this statement also can contain parameter return 0; } @@ -155,7 +155,7 @@ Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQ { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + return (Reference< XConnection >)m_pConnection; } // ------------------------------------------------------------------------- @@ -164,10 +164,10 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( ) throw(SQLE { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + Reference< XResultSet > rs = NULL; - + return rs; } // ------------------------------------------------------------------------- @@ -176,14 +176,14 @@ void SAL_CALL OPreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -192,7 +192,7 @@ void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date& { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -201,7 +201,7 @@ void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -209,7 +209,7 @@ void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -217,7 +217,7 @@ void SAL_CALL OPreparedStatement::setDouble( sal_Int32 parameterIndex, double x { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -226,7 +226,7 @@ void SAL_CALL OPreparedStatement::setFloat( sal_Int32 parameterIndex, float x ) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -234,7 +234,7 @@ void SAL_CALL OPreparedStatement::setInt( sal_Int32 parameterIndex, sal_Int32 x { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -242,7 +242,7 @@ void SAL_CALL OPreparedStatement::setLong( sal_Int32 parameterIndex, sal_Int64 a { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -250,7 +250,7 @@ void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 s { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -258,7 +258,7 @@ void SAL_CALL OPreparedStatement::setClob( sal_Int32 parameterIndex, const Refer { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -266,7 +266,7 @@ void SAL_CALL OPreparedStatement::setBlob( sal_Int32 parameterIndex, const Refer { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -274,7 +274,7 @@ void SAL_CALL OPreparedStatement::setArray( sal_Int32 parameterIndex, const Refe { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -282,14 +282,14 @@ void SAL_CALL OPreparedStatement::setRef( sal_Int32 parameterIndex, const Refere { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- void SAL_CALL OPreparedStatement::setObjectWithInfo( sal_Int32 parameterIndex, const Any& x, sal_Int32 sqlType, sal_Int32 scale ) throw(SQLException, RuntimeException) { checkDisposed(OStatement_BASE::rBHelper.bDisposed); - ::osl::MutexGuard aGuard( m_aMutex ); + ::osl::MutexGuard aGuard( m_aMutex ); } // ------------------------------------------------------------------------- @@ -298,7 +298,7 @@ void SAL_CALL OPreparedStatement::setObjectNull( sal_Int32 parameterIndex, sal_I { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -306,7 +306,7 @@ void SAL_CALL OPreparedStatement::setObject( sal_Int32 parameterIndex, const Any { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -314,7 +314,7 @@ void SAL_CALL OPreparedStatement::setShort( sal_Int32 parameterIndex, sal_Int16 { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -322,7 +322,7 @@ void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequ { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -331,7 +331,7 @@ void SAL_CALL OPreparedStatement::setCharacterStream( sal_Int32 parameterIndex, { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -339,7 +339,7 @@ void SAL_CALL OPreparedStatement::setBinaryStream( sal_Int32 parameterIndex, con { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -381,7 +381,7 @@ void OPreparedStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,cons // ----------------------------------------------------------------------------- void OPreparedStatement::checkParameterIndex(sal_Int32 _parameterIndex) { - if( !_parameterIndex || _parameterIndex > m_nNumParams) + if( !_parameterIndex || _parameterIndex > m_nNumParams) throw SQLException(); } // ----------------------------------------------------------------------------- diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SPreparedStatement.hxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SPreparedStatement.hxx index b01823f76a64..709d676db9bb 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SPreparedStatement.hxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SPreparedStatement.hxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef CONNECTIVITY_SPREPAREDSTATEMENT_HXX @@ -48,42 +48,42 @@ namespace connectivity { class OBoundParam; - typedef ::cppu::ImplHelper5< ::com::sun::star::sdbc::XPreparedStatement, + typedef ::cppu::ImplHelper5< ::com::sun::star::sdbc::XPreparedStatement, ::com::sun::star::sdbc::XParameters, ::com::sun::star::sdbc::XPreparedBatchExecution, ::com::sun::star::sdbc::XResultSetMetaDataSupplier, ::com::sun::star::lang::XServiceInfo> OPreparedStatement_BASE; - class OPreparedStatement : public OStatement_BASE2, + class OPreparedStatement : public OStatement_BASE2, public OPreparedStatement_BASE { protected: struct Parameter { - ::com::sun::star::uno::Any aValue; - sal_Int32 nDataType; + ::com::sun::star::uno::Any aValue; + sal_Int32 nDataType; - Parameter(const ::com::sun::star::uno::Any& rValue, - sal_Int32 rDataType) : aValue(rValue),nDataType(rDataType) + Parameter(const ::com::sun::star::uno::Any& rValue, + sal_Int32 rDataType) : aValue(rValue),nDataType(rDataType) { } }; - ::std::vector< Parameter> m_aParameters; + ::std::vector< Parameter> m_aParameters; //==================================================================== // Data attributes //==================================================================== - TTypeInfoVector m_aTypeInfo; // Hashtable containing an entry + TTypeInfoVector m_aTypeInfo; // Hashtable containing an entry // for each row returned by // DatabaseMetaData.getTypeInfo. - sal_Int32 m_nNumParams; // Number of parameter markers + sal_Int32 m_nNumParams; // Number of parameter markers // for the prepared statement - ::rtl::OUString m_sSqlStatement; - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData; - sal_Bool m_bPrepared; + ::rtl::OUString m_sSqlStatement; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > m_xMetaData; + sal_Bool m_bPrepared; void checkParameterIndex(sal_Int32 _parameterIndex); diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.cxx index 985ddb032fc5..72c23a44667b 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.cxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include "SResultSet.hxx" @@ -54,8 +54,8 @@ using namespace com::sun::star::io; using namespace com::sun::star::util; //------------------------------------------------------------------------------ -// IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet"); -::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw ( RuntimeException) \ +// IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet"); +::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw ( RuntimeException) \ { return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.skeleton.ResultSet"); } @@ -80,7 +80,7 @@ sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceN } // ------------------------------------------------------------------------- -OResultSet::OResultSet(OStatement_Base* pStmt) +OResultSet::OResultSet(OStatement_Base* pStmt) : OResultSet_BASE(m_aMutex) ,OPropertySetHelper(OResultSet_BASE::rBHelper) ,m_aStatement((OWeakObject*)pStmt) @@ -101,8 +101,8 @@ void OResultSet::disposing(void) ::osl::MutexGuard aGuard(m_aMutex); - m_aStatement = NULL; - m_xMetaData = NULL; + m_aStatement = NULL; + m_xMetaData = NULL; } // ------------------------------------------------------------------------- Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException) @@ -126,10 +126,10 @@ Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeExcep sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException) { - + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - // find the first column with the name columnName + // find the first column with the name columnName ::osl::MutexGuard aGuard( m_aMutex ); @@ -137,7 +137,7 @@ sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) t sal_Int32 nLen = xMeta->getColumnCount(); sal_Int32 i = 1; for(;i<=nLen;++i) - if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : + if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) break; return i; @@ -147,7 +147,7 @@ Reference< XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 column { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return NULL; } @@ -156,7 +156,7 @@ Reference< XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 col { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return NULL; } @@ -166,7 +166,7 @@ sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLExcep { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return sal_False; } // ------------------------------------------------------------------------- @@ -175,7 +175,7 @@ sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLExceptio { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + sal_Int8 nRet = 0; return nRet; @@ -184,10 +184,10 @@ sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLExceptio Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { - + checkDisposed(OResultSet_BASE::rBHelper.bDisposed); ::osl::MutexGuard aGuard( m_aMutex ); - + return Sequence< sal_Int8 >(); } // ------------------------------------------------------------------------- @@ -196,7 +196,7 @@ Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, R { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + Date nRet; return nRet; @@ -207,7 +207,7 @@ double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLExceptio { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + double nRet = 0; return nRet; @@ -218,7 +218,7 @@ float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + float nVal(0); return nVal; @@ -229,7 +229,7 @@ sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLExceptio { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + sal_Int32 nRet=0; return nRet; } @@ -239,7 +239,7 @@ sal_Int32 SAL_CALL OResultSet::getRow( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + sal_Int32 nValue = 0; return nValue; } @@ -249,7 +249,7 @@ sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 columnIndex ) throw(SQLExcepti { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return sal_Int64(); } // ------------------------------------------------------------------------- @@ -258,7 +258,7 @@ Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData( ) throw(SQLEx { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + if(!m_xMetaData.is()) m_xMetaData = new OResultSetMetaData(m_pStatement->getOwnConnection()); @@ -269,7 +269,7 @@ Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 columnIndex ) throw { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return NULL; } @@ -279,7 +279,7 @@ Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 columnIndex ) throw(S { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return NULL; } // ------------------------------------------------------------------------- @@ -287,7 +287,7 @@ Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 columnIndex ) throw(S { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return NULL; } // ------------------------------------------------------------------------- @@ -296,7 +296,7 @@ Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 columnIndex ) throw(SQL { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return NULL; } // ------------------------------------------------------------------------- @@ -305,7 +305,7 @@ Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::co { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return Any(); } // ------------------------------------------------------------------------- @@ -314,7 +314,7 @@ sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLExcept { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + sal_Int16 nRet=0; return nRet; @@ -326,8 +326,8 @@ sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLExcept { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - - + + ::rtl::OUString nRet; return nRet; } @@ -348,7 +348,7 @@ Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, R DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) { checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + ::osl::MutexGuard aGuard( m_aMutex ); @@ -361,7 +361,7 @@ sal_Bool SAL_CALL OResultSet::isBeforeFirst( ) throw(SQLException, RuntimeExcep { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + // here you have to implement your movements // return true means there is no data @@ -372,7 +372,7 @@ sal_Bool SAL_CALL OResultSet::isAfterLast( ) throw(SQLException, RuntimeExcepti { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return sal_True; } // ------------------------------------------------------------------------- @@ -380,7 +380,7 @@ sal_Bool SAL_CALL OResultSet::isFirst( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return sal_False; } @@ -389,7 +389,7 @@ sal_Bool SAL_CALL OResultSet::isLast( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return sal_False; } @@ -398,7 +398,7 @@ void SAL_CALL OResultSet::beforeFirst( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + // move before the first row so that isBeforeFirst returns false // the smae for other movement methods } @@ -415,7 +415,7 @@ void SAL_CALL OResultSet::close( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + } dispose(); } @@ -425,7 +425,7 @@ sal_Bool SAL_CALL OResultSet::first( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return sal_False; } // ------------------------------------------------------------------------- @@ -442,7 +442,7 @@ sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, Runt { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return sal_False; } // ------------------------------------------------------------------------- @@ -466,7 +466,7 @@ Reference< XInterface > SAL_CALL OResultSet::getStatement( ) throw(SQLException { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return m_aStatement.get(); } @@ -476,16 +476,16 @@ sal_Bool SAL_CALL OResultSet::rowDeleted( ) throw(SQLException, RuntimeExceptio { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return sal_False; } // ------------------------------------------------------------------------- sal_Bool SAL_CALL OResultSet::rowInserted( ) throw(SQLException, RuntimeException) -{ +{ ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return sal_False; } @@ -494,7 +494,7 @@ sal_Bool SAL_CALL OResultSet::rowUpdated( ) throw(SQLException, RuntimeExceptio { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return sal_False; } @@ -504,7 +504,7 @@ sal_Bool SAL_CALL OResultSet::next( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return sal_False; } @@ -514,7 +514,7 @@ sal_Bool SAL_CALL OResultSet::wasNull( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return m_bWasNull; } @@ -524,7 +524,7 @@ void SAL_CALL OResultSet::cancel( ) throw(RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::clearWarnings( ) throw(SQLException, RuntimeException) @@ -548,7 +548,7 @@ void SAL_CALL OResultSet::updateRow( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + // only when you allow updates } @@ -571,7 +571,7 @@ void SAL_CALL OResultSet::moveToInsertRow( ) throw(SQLException, RuntimeExcepti { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + // only when you allow insert's } @@ -595,7 +595,7 @@ void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) thr { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException) @@ -610,7 +610,7 @@ void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) thro { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException) @@ -624,14 +624,14 @@ void SAL_CALL OResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + } // ----------------------------------------------------------------------- void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -639,28 +639,28 @@ void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw( { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const Date& x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -668,7 +668,7 @@ void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const Time& x ) thr { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -676,7 +676,7 @@ void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const DateTime { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -684,28 +684,28 @@ void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Refer { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::refreshRow( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- @@ -713,7 +713,7 @@ void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + } // ------------------------------------------------------------------------- // XRowLocate @@ -747,7 +747,7 @@ sal_Int32 SAL_CALL OResultSet::compareBookmarks( const Any& first, const Any& { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return CompareBookmark::NOT_EQUAL; } @@ -767,7 +767,7 @@ Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OResultSet_BASE::rBHelper.bDisposed); - + return Sequence< sal_Int32 >(); } // ------------------------------------------------------------------------- @@ -776,12 +776,12 @@ IPropertyArrayHelper* OResultSet::createArrayHelper( ) const Sequence< Property > aProps(6); Property* pProperties = aProps.getArray(); sal_Int32 nPos = 0; - DECL_PROP1IMPL(CURSORNAME, ::rtl::OUString) PropertyAttribute::READONLY); - DECL_PROP0(FETCHDIRECTION, sal_Int32); - DECL_PROP0(FETCHSIZE, sal_Int32); + DECL_PROP1IMPL(CURSORNAME, ::rtl::OUString) PropertyAttribute::READONLY); + DECL_PROP0(FETCHDIRECTION, sal_Int32); + DECL_PROP0(FETCHSIZE, sal_Int32); DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY); DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY); - DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY); + DECL_PROP1IMPL(RESULTSETTYPE, sal_Int32) PropertyAttribute::READONLY); return new OPropertyArrayHelper(aProps); } diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.hxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.hxx index 9a102418bd99..b626a56a60df 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.hxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.hxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef CONNECTIVITY_SRESULTSET_HXX @@ -57,7 +57,7 @@ namespace connectivity { /* - ** OResultSet + ** OResultSet */ typedef ::cppu::WeakComponentImplHelper12< ::com::sun::star::sdbc::XResultSet, ::com::sun::star::sdbc::XRow, @@ -72,17 +72,17 @@ namespace connectivity ::com::sun::star::sdbc::XColumnLocate, ::com::sun::star::lang::XServiceInfo> OResultSet_BASE; - class OResultSet : public OBase_Mutex, - public OResultSet_BASE, - public ::cppu::OPropertySetHelper, - public OPropertyArrayUsageHelper<OResultSet> + class OResultSet : public OBase_Mutex, + public OResultSet_BASE, + public ::cppu::OPropertySetHelper, + public OPropertyArrayUsageHelper<OResultSet> { protected: - OStatement_Base* m_pStatement; - ::com::sun::star::uno::WeakReferenceHelper m_aStatement; + OStatement_Base* m_pStatement; + ::com::sun::star::uno::WeakReferenceHelper m_aStatement; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xMetaData; - rtl_TextEncoding m_nTextEncoding; - sal_Bool m_bWasNull; + rtl_TextEncoding m_nTextEncoding; + sal_Bool m_bWasNull; // OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; @@ -109,9 +109,9 @@ namespace connectivity virtual ~OResultSet(); public: DECLARE_SERVICE_INFO(); - + OResultSet( OStatement_Base* pStmt); - + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *() { diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSetMetaData.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSetMetaData.cxx index 86ec005351ae..0f7af1fc60c3 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSetMetaData.cxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSetMetaData.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include "SResultSetMetaData.hxx" diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSetMetaData.hxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSetMetaData.hxx index 1560801b4391..92418de6f96d 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSetMetaData.hxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSetMetaData.hxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef CONNECTIVITY_SRESULSETMETADATA_HXX @@ -49,15 +49,15 @@ namespace connectivity //************************************************************** typedef ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XResultSetMetaData> OResultSetMetaData_BASE; - class OResultSetMetaData : public OResultSetMetaData_BASE + class OResultSetMetaData : public OResultSetMetaData_BASE { - OConnection* m_pConnection; + OConnection* m_pConnection; protected: virtual ~OResultSetMetaData(); public: // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird: - OResultSetMetaData(OConnection* _pConnection) : m_pConnection(_pConnection){} + OResultSetMetaData(OConnection* _pConnection) : m_pConnection(_pConnection){} /// Avoid ambigous cast error from the compiler. inline operator ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > () throw() diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SServices.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SServices.cxx index fdfedd684766..2de009ddb86d 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SServices.cxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SServices.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include "SDriver.hxx" @@ -48,7 +48,7 @@ using ::com::sun::star::lang::XMultiServiceFactory; typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) ( const Reference< XMultiServiceFactory > & rServiceManager, - const OUString & rComponentName, + const OUString & rComponentName, ::cppu::ComponentInstantiation pCreateFunction, const Sequence< OUString > & rServiceNames, rtl_ModuleCount* _pTemp @@ -62,8 +62,8 @@ typedef Reference< XSingleServiceFactory > (SAL_CALL *createFactoryFunc) //--------------------------------------------------------------------------------------- void REGISTER_PROVIDER( - const OUString& aServiceImplName, - const Sequence< OUString>& Services, + const OUString& aServiceImplName, + const Sequence< OUString>& Services, const Reference< ::com::sun::star::registry::XRegistryKey > & xKey) { OUString aMainKeyName; @@ -97,31 +97,31 @@ struct ProviderRequest inline sal_Bool CREATE_PROVIDER( - const OUString& Implname, - const Sequence< OUString > & Services, + const OUString& Implname, + const Sequence< OUString > & Services, ::cppu::ComponentInstantiation Factory, createFactoryFunc creator ) { if (!xRet.is() && (Implname == sImplementationName)) - try - { - xRet = creator( xServiceManager, sImplementationName,Factory, Services,0); + try + { + xRet = creator( xServiceManager, sImplementationName,Factory, Services,0); } catch(...) { } return xRet.is(); } - + void* getProvider() const { return xRet.get(); } }; //--------------------------------------------------------------------------------------- extern "C" void SAL_CALL component_getImplementationEnvironment( - const sal_Char **ppEnvTypeName, - uno_Environment **ppEnv + const sal_Char **ppEnvTypeName, + uno_Environment **ppEnv ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; @@ -133,14 +133,14 @@ extern "C" sal_Bool SAL_CALL component_writeInfo( void* pRegistryKey ) { - if (pRegistryKey) - try + if (pRegistryKey) + try { Reference< ::com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast< ::com::sun::star::registry::XRegistryKey*>(pRegistryKey)); REGISTER_PROVIDER( - SkeletonDriver::getImplementationName_Static(), - SkeletonDriver::getSupportedServiceNames_Static(), xKey); + SkeletonDriver::getImplementationName_Static(), + SkeletonDriver::getSupportedServiceNames_Static(), xKey); return sal_True; } @@ -164,9 +164,9 @@ extern "C" void* SAL_CALL component_getFactory( ProviderRequest aReq(pServiceManager,pImplementationName); aReq.CREATE_PROVIDER( - SkeletonDriver::getImplementationName_Static(), + SkeletonDriver::getImplementationName_Static(), SkeletonDriver::getSupportedServiceNames_Static(), - SkeletonDriver_CreateInstance, ::cppu::createSingleFactory) + SkeletonDriver_CreateInstance, ::cppu::createSingleFactory) ; if(aReq.xRet.is()) diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SStatement.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SStatement.cxx index ea1bf91b644e..5e1bee3d5d32 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SStatement.cxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SStatement.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include <stdio.h> @@ -57,7 +57,7 @@ using namespace com::sun::star::container; using namespace com::sun::star::io; using namespace com::sun::star::util; //------------------------------------------------------------------------------ -OStatement_Base::OStatement_Base(OConnection* _pConnection ) +OStatement_Base::OStatement_Base(OConnection* _pConnection ) : OStatement_BASE(m_aMutex), OPropertySetHelper(OStatement_BASE::rBHelper), rBHelper(OStatement_BASE::rBHelper), @@ -130,7 +130,7 @@ void SAL_CALL OStatement_Base::close( ) throw(SQLException, RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + } dispose(); } @@ -145,7 +145,7 @@ sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(S { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + // returns true when a resultset is available return sal_False; } @@ -155,7 +155,7 @@ Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUS { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + Reference< XResultSet > xRS = NULL; // create a resultset as result of executing the sql statement @@ -169,7 +169,7 @@ Reference< XConnection > SAL_CALL OStatement_Base::getConnection( ) throw(SQLEx { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + // just return our connection here return (Reference< XConnection >)m_pConnection; } @@ -193,7 +193,7 @@ void SAL_CALL OStatement::addBatch( const ::rtl::OUString& sql ) throw(SQLExcept { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + m_aBatchList.push_back(sql); } @@ -202,7 +202,7 @@ Sequence< sal_Int32 > SAL_CALL OStatement::executeBatch( ) throw(SQLException, { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + return Sequence< sal_Int32 >(); } // ------------------------------------------------------------------------- @@ -212,8 +212,8 @@ sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const ::rtl::OUString& sql ) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - - // the return values gives information about how many rows are affected by executing the sql statement + + // the return values gives information about how many rows are affected by executing the sql statement return 0; } @@ -223,8 +223,8 @@ Reference< XResultSet > SAL_CALL OStatement_Base::getResultSet( ) throw(SQLExce { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - -// return our save resultset here + +// return our save resultset here return m_xResultSet; } // ------------------------------------------------------------------------- @@ -234,7 +234,7 @@ sal_Bool SAL_CALL OStatement_Base::getMoreResults( ) throw(SQLException, Runtim ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - // if your driver supports more than only one resultset + // if your driver supports more than only one resultset // and has one more at this moment return true return sal_False; } @@ -245,7 +245,7 @@ Any SAL_CALL OStatement_Base::getWarnings( ) throw(SQLException, RuntimeExcepti { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + return makeAny(m_aLastWarning); } @@ -256,7 +256,7 @@ void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeExce { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatement_BASE::rBHelper.bDisposed); - + m_aLastWarning = SQLWarning(); } @@ -268,12 +268,12 @@ void SAL_CALL OStatement_Base::clearWarnings( ) throw(SQLException, RuntimeExce Sequence< Property > aProps(10); Property* pProperties = aProps.getArray(); sal_Int32 nPos = 0; - DECL_PROP0(CURSORNAME, ::rtl::OUString); + DECL_PROP0(CURSORNAME, ::rtl::OUString); DECL_BOOL_PROP0(ESCAPEPROCESSING); DECL_PROP0(FETCHDIRECTION,sal_Int32); - DECL_PROP0(FETCHSIZE, sal_Int32); + DECL_PROP0(FETCHSIZE, sal_Int32); DECL_PROP0(MAXFIELDSIZE,sal_Int32); - DECL_PROP0(MAXROWS, sal_Int32); + DECL_PROP0(MAXROWS, sal_Int32); DECL_PROP0(QUERYTIMEOUT,sal_Int32); DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32); DECL_PROP0(RESULTSETTYPE,sal_Int32); @@ -296,7 +296,7 @@ sal_Bool OStatement_Base::convertFastPropertyValue( throw (::com::sun::star::lang::IllegalArgumentException) { sal_Bool bConverted = sal_False; - // here we have to try to convert + // here we have to try to convert return bConverted; } // ------------------------------------------------------------------------- diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SStatement.hxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SStatement.hxx index 7dc260c32b6b..d8d32a4aa5b5 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SStatement.hxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SStatement.hxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef CONNECTIVITY_SSTATEMENT_HXX @@ -54,7 +54,7 @@ namespace connectivity namespace skeleton { - typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::sdbc::XStatement, + typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::sdbc::XStatement, ::com::sun::star::sdbc::XWarningsSupplier, ::com::sun::star::util::XCancellable, ::com::sun::star::sdbc::XCloseable, @@ -64,10 +64,10 @@ namespace connectivity //************ Class: OStatement_Base // is a base class for the normal statement and for the prepared statement //************************************************************** - class OStatement_Base : public OBase_Mutex, - public OStatement_BASE, - public ::cppu::OPropertySetHelper, - public OPropertyArrayUsageHelper<OStatement_Base> + class OStatement_Base : public OBase_Mutex, + public OStatement_BASE, + public ::cppu::OPropertySetHelper, + public OPropertyArrayUsageHelper<OStatement_Base> { ::com::sun::star::sdbc::SQLWarning m_aLastWarning; @@ -75,9 +75,9 @@ namespace connectivity ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created // for this Statement - ::std::list< ::rtl::OUString> m_aBatchList; + ::std::list< ::rtl::OUString> m_aBatchList; - OConnection* m_pConnection; // The owning Connection object + OConnection* m_pConnection; // The owning Connection object protected: void disposeResultSet(); @@ -94,7 +94,7 @@ namespace connectivity throw (::com::sun::star::lang::IllegalArgumentException); virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, - const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception); + const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception); virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const; @@ -138,7 +138,7 @@ namespace connectivity OConnection* getOwnConnection() const { return m_pConnection;} }; - class OStatement_BASE2 :public OStatement_Base + class OStatement_BASE2 :public OStatement_Base ,public OSubComponent<OStatement_BASE2, OStatement_BASE> { @@ -152,7 +152,7 @@ namespace connectivity virtual void SAL_CALL release() throw(); }; - class OStatement : public OStatement_BASE2, + class OStatement : public OStatement_BASE2, public ::com::sun::star::sdbc::XBatchExecution, public ::com::sun::star::lang::XServiceInfo { diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/propertyids.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/propertyids.cxx index 832f59757f34..9cd66a47a34b 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/propertyids.cxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/propertyids.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include <osl/diagnose.h> @@ -39,64 +39,64 @@ namespace connectivity { namespace skeleton { - const sal_Char* getPROPERTY_QUERYTIMEOUT() { return "QueryTimeOut"; } - const sal_Char* getPROPERTY_MAXFIELDSIZE() { return "MaxFieldSize"; } - const sal_Char* getPROPERTY_MAXROWS() { return "MaxRows"; } - const sal_Char* getPROPERTY_CURSORNAME() { return "CursorName"; } - const sal_Char* getPROPERTY_RESULTSETCONCURRENCY() { return "ResultSetConcurrency"; } - const sal_Char* getPROPERTY_RESULTSETTYPE() { return "ResultSetType"; } - const sal_Char* getPROPERTY_FETCHDIRECTION() { return "FetchDirection"; } - const sal_Char* getPROPERTY_FETCHSIZE() { return "FetchSize"; } - const sal_Char* getPROPERTY_ESCAPEPROCESSING() { return "EscapeProcessing"; } - const sal_Char* getPROPERTY_USEBOOKMARKS() { return "UseBookmarks"; } - - const sal_Char* getPROPERTY_NAME() { return "Name"; } - const sal_Char* getPROPERTY_TYPE() { return "Type"; } - const sal_Char* getPROPERTY_TYPENAME() { return "TypeName"; } - const sal_Char* getPROPERTY_PRECISION() { return "Precision"; } - const sal_Char* getPROPERTY_SCALE() { return "Scale"; } - const sal_Char* getPROPERTY_ISNULLABLE() { return "IsNullable"; } - const sal_Char* getPROPERTY_ISAUTOINCREMENT() { return "IsAutoIncrement"; } - const sal_Char* getPROPERTY_ISROWVERSION() { return "IsRowVersion"; } - const sal_Char* getPROPERTY_DESCRIPTION() { return "Description"; } - const sal_Char* getPROPERTY_DEFAULTVALUE() { return "DefaultValue"; } - - const sal_Char* getPROPERTY_REFERENCEDTABLE() { return "ReferencedTable"; } - const sal_Char* getPROPERTY_UPDATERULE() { return "UpdateRule"; } - const sal_Char* getPROPERTY_DELETERULE() { return "DeleteRule"; } - const sal_Char* getPROPERTY_CATALOG() { return "Catalog"; } - const sal_Char* getPROPERTY_ISUNIQUE() { return "IsUnique"; } - const sal_Char* getPROPERTY_ISPRIMARYKEYINDEX() { return "IsPrimaryKeyIndex"; } - const sal_Char* getPROPERTY_ISCLUSTERED() { return "IsClustered"; } - const sal_Char* getPROPERTY_ISASCENDING() { return "IsAscending"; } - const sal_Char* getPROPERTY_SCHEMANAME() { return "SchemaName"; } - const sal_Char* getPROPERTY_CATALOGNAME() { return "CatalogName"; } - const sal_Char* getPROPERTY_COMMAND() { return "Command"; } - const sal_Char* getPROPERTY_CHECKOPTION() { return "CheckOption"; } - const sal_Char* getPROPERTY_PASSWORD() { return "Password"; } - const sal_Char* getPROPERTY_RELATEDCOLUMN() { return "RelatedColumn"; } - - const sal_Char* getSTAT_INVALID_INDEX() { return "Invalid descriptor index"; } + const sal_Char* getPROPERTY_QUERYTIMEOUT() { return "QueryTimeOut"; } + const sal_Char* getPROPERTY_MAXFIELDSIZE() { return "MaxFieldSize"; } + const sal_Char* getPROPERTY_MAXROWS() { return "MaxRows"; } + const sal_Char* getPROPERTY_CURSORNAME() { return "CursorName"; } + const sal_Char* getPROPERTY_RESULTSETCONCURRENCY() { return "ResultSetConcurrency"; } + const sal_Char* getPROPERTY_RESULTSETTYPE() { return "ResultSetType"; } + const sal_Char* getPROPERTY_FETCHDIRECTION() { return "FetchDirection"; } + const sal_Char* getPROPERTY_FETCHSIZE() { return "FetchSize"; } + const sal_Char* getPROPERTY_ESCAPEPROCESSING() { return "EscapeProcessing"; } + const sal_Char* getPROPERTY_USEBOOKMARKS() { return "UseBookmarks"; } + + const sal_Char* getPROPERTY_NAME() { return "Name"; } + const sal_Char* getPROPERTY_TYPE() { return "Type"; } + const sal_Char* getPROPERTY_TYPENAME() { return "TypeName"; } + const sal_Char* getPROPERTY_PRECISION() { return "Precision"; } + const sal_Char* getPROPERTY_SCALE() { return "Scale"; } + const sal_Char* getPROPERTY_ISNULLABLE() { return "IsNullable"; } + const sal_Char* getPROPERTY_ISAUTOINCREMENT() { return "IsAutoIncrement"; } + const sal_Char* getPROPERTY_ISROWVERSION() { return "IsRowVersion"; } + const sal_Char* getPROPERTY_DESCRIPTION() { return "Description"; } + const sal_Char* getPROPERTY_DEFAULTVALUE() { return "DefaultValue"; } + + const sal_Char* getPROPERTY_REFERENCEDTABLE() { return "ReferencedTable"; } + const sal_Char* getPROPERTY_UPDATERULE() { return "UpdateRule"; } + const sal_Char* getPROPERTY_DELETERULE() { return "DeleteRule"; } + const sal_Char* getPROPERTY_CATALOG() { return "Catalog"; } + const sal_Char* getPROPERTY_ISUNIQUE() { return "IsUnique"; } + const sal_Char* getPROPERTY_ISPRIMARYKEYINDEX() { return "IsPrimaryKeyIndex"; } + const sal_Char* getPROPERTY_ISCLUSTERED() { return "IsClustered"; } + const sal_Char* getPROPERTY_ISASCENDING() { return "IsAscending"; } + const sal_Char* getPROPERTY_SCHEMANAME() { return "SchemaName"; } + const sal_Char* getPROPERTY_CATALOGNAME() { return "CatalogName"; } + const sal_Char* getPROPERTY_COMMAND() { return "Command"; } + const sal_Char* getPROPERTY_CHECKOPTION() { return "CheckOption"; } + const sal_Char* getPROPERTY_PASSWORD() { return "Password"; } + const sal_Char* getPROPERTY_RELATEDCOLUMN() { return "RelatedColumn"; } + + const sal_Char* getSTAT_INVALID_INDEX() { return "Invalid descriptor index"; } + + const sal_Char* getPROPERTY_FUNCTION() { return "Function"; } + const sal_Char* getPROPERTY_TABLENAME() { return "TableName"; } + const sal_Char* getPROPERTY_REALNAME() { return "RealName"; } + const sal_Char* getPROPERTY_DBASEPRECISIONCHANGED() { return "DbasePrecisionChanged"; } + const sal_Char* getPROPERTY_ISCURRENCY() { return "IsCurrency"; } + const sal_Char* getPROPERTY_ISBOOKMARKABLE() { return "IsBookmarkable"; } - const sal_Char* getPROPERTY_FUNCTION() { return "Function"; } - const sal_Char* getPROPERTY_TABLENAME() { return "TableName"; } - const sal_Char* getPROPERTY_REALNAME() { return "RealName"; } - const sal_Char* getPROPERTY_DBASEPRECISIONCHANGED() { return "DbasePrecisionChanged"; } - const sal_Char* getPROPERTY_ISCURRENCY() { return "IsCurrency"; } - const sal_Char* getPROPERTY_ISBOOKMARKABLE() { return "IsBookmarkable"; } + const sal_Char* getPROPERTY_FORMATKEY() { return "FormatKey"; } + const sal_Char* getPROPERTY_LOCALE() { return "Locale"; } - const sal_Char* getPROPERTY_FORMATKEY() { return "FormatKey"; } - const sal_Char* getPROPERTY_LOCALE() { return "Locale"; } - - const sal_Char* getPROPERTY_AUTOINCREMENTCREATION() { return "AutoIncrementCreation"; } - const sal_Char* getPROPERTY_PRIVILEGES() { return "Privileges"; } + const sal_Char* getPROPERTY_AUTOINCREMENTCREATION() { return "AutoIncrementCreation"; } + const sal_Char* getPROPERTY_PRIVILEGES() { return "Privileges"; } //============================================================ //= error messages //============================================================ - const sal_Char* getERRORMSG_SEQUENCE() { return "Function sequence error"; } - const sal_Char* getSQLSTATE_SEQUENCE() { return "HY010"; } - const sal_Char* getSQLSTATE_GENERAL() { return "HY0000"; } - const sal_Char* getSTR_DELIMITER() { return "/"; } + const sal_Char* getERRORMSG_SEQUENCE() { return "Function sequence error"; } + const sal_Char* getSQLSTATE_SEQUENCE() { return "HY010"; } + const sal_Char* getSQLSTATE_GENERAL() { return "HY0000"; } + const sal_Char* getSTR_DELIMITER() { return "/"; } OPropertyMap::~OPropertyMap() { @@ -122,59 +122,59 @@ namespace skeleton rtl_uString* pStr = NULL; switch(_nIndex) { - case PROPERTY_ID_QUERYTIMEOUT: { rtl_uString_newFromAscii(&pStr,getPROPERTY_QUERYTIMEOUT() ); break; } - case PROPERTY_ID_MAXFIELDSIZE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_MAXFIELDSIZE() ); break; } - case PROPERTY_ID_MAXROWS: { rtl_uString_newFromAscii(&pStr,getPROPERTY_MAXROWS() ); break; } - case PROPERTY_ID_CURSORNAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_CURSORNAME() ); break; } - case PROPERTY_ID_RESULTSETCONCURRENCY: { rtl_uString_newFromAscii(&pStr,getPROPERTY_RESULTSETCONCURRENCY() ); break; } - case PROPERTY_ID_RESULTSETTYPE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_RESULTSETTYPE() ); break; } - case PROPERTY_ID_FETCHDIRECTION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_FETCHDIRECTION() ); break; } - case PROPERTY_ID_FETCHSIZE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_FETCHSIZE() ); break; } - case PROPERTY_ID_ESCAPEPROCESSING: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ESCAPEPROCESSING() ); break; } - case PROPERTY_ID_USEBOOKMARKS: { rtl_uString_newFromAscii(&pStr,getPROPERTY_USEBOOKMARKS() ); break; } - // Column - case PROPERTY_ID_NAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_NAME() ); break; } - case PROPERTY_ID_TYPE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_TYPE() ); break; } - case PROPERTY_ID_TYPENAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_TYPENAME() ); break; } - case PROPERTY_ID_PRECISION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_PRECISION() ); break; } - case PROPERTY_ID_SCALE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_SCALE() ); break; } - case PROPERTY_ID_ISNULLABLE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISNULLABLE() ); break; } - case PROPERTY_ID_ISAUTOINCREMENT: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISAUTOINCREMENT() ); break; } - case PROPERTY_ID_ISROWVERSION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISROWVERSION() ); break; } - case PROPERTY_ID_DESCRIPTION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_DESCRIPTION() ); break; } - case PROPERTY_ID_DEFAULTVALUE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_DEFAULTVALUE() ); break; } - - case PROPERTY_ID_REFERENCEDTABLE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_REFERENCEDTABLE() ); break; } - case PROPERTY_ID_UPDATERULE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_UPDATERULE() ); break; } - case PROPERTY_ID_DELETERULE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_DELETERULE() ); break; } - case PROPERTY_ID_CATALOG: { rtl_uString_newFromAscii(&pStr,getPROPERTY_CATALOG() ); break; } - case PROPERTY_ID_ISUNIQUE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISUNIQUE() ); break; } - case PROPERTY_ID_ISPRIMARYKEYINDEX: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISPRIMARYKEYINDEX() ); break; } - case PROPERTY_ID_ISCLUSTERED: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISCLUSTERED() ); break; } - case PROPERTY_ID_ISASCENDING: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISASCENDING() ); break; } - case PROPERTY_ID_SCHEMANAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_SCHEMANAME() ); break; } - case PROPERTY_ID_CATALOGNAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_CATALOGNAME() ); break; } - - case PROPERTY_ID_COMMAND: { rtl_uString_newFromAscii(&pStr,getPROPERTY_COMMAND() ); break; } - case PROPERTY_ID_CHECKOPTION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_CHECKOPTION() ); break; } - case PROPERTY_ID_PASSWORD: { rtl_uString_newFromAscii(&pStr,getPROPERTY_PASSWORD() ); break; } - case PROPERTY_ID_RELATEDCOLUMN: { rtl_uString_newFromAscii(&pStr,getPROPERTY_RELATEDCOLUMN() ); break; } - - case PROPERTY_ID_FUNCTION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_FUNCTION() ); break; } - case PROPERTY_ID_TABLENAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_TABLENAME() ); break; } - case PROPERTY_ID_REALNAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_REALNAME() ); break; } - case PROPERTY_ID_DBASEPRECISIONCHANGED: { rtl_uString_newFromAscii(&pStr,getPROPERTY_DBASEPRECISIONCHANGED() ); break; } - case PROPERTY_ID_ISCURRENCY: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISCURRENCY() ); break; } - case PROPERTY_ID_ISBOOKMARKABLE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISBOOKMARKABLE() ); break; } - case PROPERTY_ID_INVALID_INDEX: { rtl_uString_newFromAscii(&pStr,getSTAT_INVALID_INDEX() ); break; } - case PROPERTY_ID_ERRORMSG_SEQUENCE: { rtl_uString_newFromAscii(&pStr,getERRORMSG_SEQUENCE() ); break; } - case PROPERTY_ID_HY010: { rtl_uString_newFromAscii(&pStr,getSQLSTATE_SEQUENCE() ); break; } - case PROPERTY_ID_HY0000: { rtl_uString_newFromAscii(&pStr,getSQLSTATE_GENERAL() ); break; } - case PROPERTY_ID_DELIMITER: { rtl_uString_newFromAscii(&pStr,getSTR_DELIMITER() ); break; } - case PROPERTY_ID_FORMATKEY: { rtl_uString_newFromAscii(&pStr,getPROPERTY_FORMATKEY() ); break; } - case PROPERTY_ID_LOCALE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_LOCALE() ); break; } - case PROPERTY_ID_AUTOINCREMENTCREATION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_AUTOINCREMENTCREATION() ); break; } - case PROPERTY_ID_PRIVILEGES: { rtl_uString_newFromAscii(&pStr,getPROPERTY_PRIVILEGES() ); break; } + case PROPERTY_ID_QUERYTIMEOUT: { rtl_uString_newFromAscii(&pStr,getPROPERTY_QUERYTIMEOUT() ); break; } + case PROPERTY_ID_MAXFIELDSIZE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_MAXFIELDSIZE() ); break; } + case PROPERTY_ID_MAXROWS: { rtl_uString_newFromAscii(&pStr,getPROPERTY_MAXROWS() ); break; } + case PROPERTY_ID_CURSORNAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_CURSORNAME() ); break; } + case PROPERTY_ID_RESULTSETCONCURRENCY: { rtl_uString_newFromAscii(&pStr,getPROPERTY_RESULTSETCONCURRENCY() ); break; } + case PROPERTY_ID_RESULTSETTYPE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_RESULTSETTYPE() ); break; } + case PROPERTY_ID_FETCHDIRECTION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_FETCHDIRECTION() ); break; } + case PROPERTY_ID_FETCHSIZE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_FETCHSIZE() ); break; } + case PROPERTY_ID_ESCAPEPROCESSING: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ESCAPEPROCESSING() ); break; } + case PROPERTY_ID_USEBOOKMARKS: { rtl_uString_newFromAscii(&pStr,getPROPERTY_USEBOOKMARKS() ); break; } + // Column + case PROPERTY_ID_NAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_NAME() ); break; } + case PROPERTY_ID_TYPE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_TYPE() ); break; } + case PROPERTY_ID_TYPENAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_TYPENAME() ); break; } + case PROPERTY_ID_PRECISION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_PRECISION() ); break; } + case PROPERTY_ID_SCALE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_SCALE() ); break; } + case PROPERTY_ID_ISNULLABLE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISNULLABLE() ); break; } + case PROPERTY_ID_ISAUTOINCREMENT: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISAUTOINCREMENT() ); break; } + case PROPERTY_ID_ISROWVERSION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISROWVERSION() ); break; } + case PROPERTY_ID_DESCRIPTION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_DESCRIPTION() ); break; } + case PROPERTY_ID_DEFAULTVALUE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_DEFAULTVALUE() ); break; } + + case PROPERTY_ID_REFERENCEDTABLE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_REFERENCEDTABLE() ); break; } + case PROPERTY_ID_UPDATERULE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_UPDATERULE() ); break; } + case PROPERTY_ID_DELETERULE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_DELETERULE() ); break; } + case PROPERTY_ID_CATALOG: { rtl_uString_newFromAscii(&pStr,getPROPERTY_CATALOG() ); break; } + case PROPERTY_ID_ISUNIQUE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISUNIQUE() ); break; } + case PROPERTY_ID_ISPRIMARYKEYINDEX: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISPRIMARYKEYINDEX() ); break; } + case PROPERTY_ID_ISCLUSTERED: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISCLUSTERED() ); break; } + case PROPERTY_ID_ISASCENDING: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISASCENDING() ); break; } + case PROPERTY_ID_SCHEMANAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_SCHEMANAME() ); break; } + case PROPERTY_ID_CATALOGNAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_CATALOGNAME() ); break; } + + case PROPERTY_ID_COMMAND: { rtl_uString_newFromAscii(&pStr,getPROPERTY_COMMAND() ); break; } + case PROPERTY_ID_CHECKOPTION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_CHECKOPTION() ); break; } + case PROPERTY_ID_PASSWORD: { rtl_uString_newFromAscii(&pStr,getPROPERTY_PASSWORD() ); break; } + case PROPERTY_ID_RELATEDCOLUMN: { rtl_uString_newFromAscii(&pStr,getPROPERTY_RELATEDCOLUMN() ); break; } + + case PROPERTY_ID_FUNCTION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_FUNCTION() ); break; } + case PROPERTY_ID_TABLENAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_TABLENAME() ); break; } + case PROPERTY_ID_REALNAME: { rtl_uString_newFromAscii(&pStr,getPROPERTY_REALNAME() ); break; } + case PROPERTY_ID_DBASEPRECISIONCHANGED: { rtl_uString_newFromAscii(&pStr,getPROPERTY_DBASEPRECISIONCHANGED() ); break; } + case PROPERTY_ID_ISCURRENCY: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISCURRENCY() ); break; } + case PROPERTY_ID_ISBOOKMARKABLE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_ISBOOKMARKABLE() ); break; } + case PROPERTY_ID_INVALID_INDEX: { rtl_uString_newFromAscii(&pStr,getSTAT_INVALID_INDEX() ); break; } + case PROPERTY_ID_ERRORMSG_SEQUENCE: { rtl_uString_newFromAscii(&pStr,getERRORMSG_SEQUENCE() ); break; } + case PROPERTY_ID_HY010: { rtl_uString_newFromAscii(&pStr,getSQLSTATE_SEQUENCE() ); break; } + case PROPERTY_ID_HY0000: { rtl_uString_newFromAscii(&pStr,getSQLSTATE_GENERAL() ); break; } + case PROPERTY_ID_DELIMITER: { rtl_uString_newFromAscii(&pStr,getSTR_DELIMITER() ); break; } + case PROPERTY_ID_FORMATKEY: { rtl_uString_newFromAscii(&pStr,getPROPERTY_FORMATKEY() ); break; } + case PROPERTY_ID_LOCALE: { rtl_uString_newFromAscii(&pStr,getPROPERTY_LOCALE() ); break; } + case PROPERTY_ID_AUTOINCREMENTCREATION: { rtl_uString_newFromAscii(&pStr,getPROPERTY_AUTOINCREMENTCREATION() ); break; } + case PROPERTY_ID_PRIVILEGES: { rtl_uString_newFromAscii(&pStr,getPROPERTY_PRIVILEGES() ); break; } } m_aPropertyMap[_nIndex] = pStr; return pStr; diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/propertyids.hxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/propertyids.hxx index c10aa5dc7db6..ca0d5bf27633 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/propertyids.hxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/propertyids.hxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef _CONNECTIVITY_PROPERTYIDS_HXX_ @@ -49,7 +49,7 @@ namespace skeleton { class OPropertyMap { - ::std::map<sal_Int32 , rtl_uString*> m_aPropertyMap; + ::std::map<sal_Int32 , rtl_uString*> m_aPropertyMap; ::rtl::OUString fillValue(sal_Int32 _nIndex); public: @@ -67,15 +67,15 @@ namespace skeleton }; - + typedef const sal_Char* (*PVFN)(); struct UStringDescription { - const sal_Char* pZeroTerminatedName; + const sal_Char* pZeroTerminatedName; sal_Int32 nLength; - UStringDescription(PVFN _fCharFkt); + UStringDescription(PVFN _fCharFkt); operator ::rtl::OUString() const { return ::rtl::OUString(pZeroTerminatedName,nLength,RTL_TEXTENCODING_ASCII_US); } ~UStringDescription(); private: @@ -89,73 +89,73 @@ namespace skeleton #define DECL_PROP1IMPL(varname, type) \ pProperties[nPos++] = ::com::sun::star::beans::Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_##varname), PROPERTY_ID_##varname, ::cppu::UnoType< type >::get(), //------------------------------------------------------------------------------ -#define DECL_PROP0(varname, type) \ +#define DECL_PROP0(varname, type) \ DECL_PROP1IMPL(varname, type) 0) //------------------------------------------------------------------------------ #define DECL_BOOL_PROP1IMPL(varname) \ pProperties[nPos++] = ::com::sun::star::beans::Property(OPropertyMap::getPropMap().getNameByIndex(PROPERTY_ID_##varname), PROPERTY_ID_##varname, ::getBooleanCppuType(), //------------------------------------------------------------------------------ -#define DECL_BOOL_PROP0(varname) \ +#define DECL_BOOL_PROP0(varname) \ DECL_BOOL_PROP1IMPL(varname) 0) -#define PROPERTY_ID_QUERYTIMEOUT 1 -#define PROPERTY_ID_MAXFIELDSIZE 2 -#define PROPERTY_ID_MAXROWS 3 -#define PROPERTY_ID_CURSORNAME 4 -#define PROPERTY_ID_RESULTSETCONCURRENCY 5 -#define PROPERTY_ID_RESULTSETTYPE 6 -#define PROPERTY_ID_FETCHDIRECTION 7 -#define PROPERTY_ID_FETCHSIZE 8 -#define PROPERTY_ID_ESCAPEPROCESSING 9 -#define PROPERTY_ID_USEBOOKMARKS 10 +#define PROPERTY_ID_QUERYTIMEOUT 1 +#define PROPERTY_ID_MAXFIELDSIZE 2 +#define PROPERTY_ID_MAXROWS 3 +#define PROPERTY_ID_CURSORNAME 4 +#define PROPERTY_ID_RESULTSETCONCURRENCY 5 +#define PROPERTY_ID_RESULTSETTYPE 6 +#define PROPERTY_ID_FETCHDIRECTION 7 +#define PROPERTY_ID_FETCHSIZE 8 +#define PROPERTY_ID_ESCAPEPROCESSING 9 +#define PROPERTY_ID_USEBOOKMARKS 10 // Column -#define PROPERTY_ID_NAME 11 -#define PROPERTY_ID_TYPE 12 -#define PROPERTY_ID_TYPENAME 13 -#define PROPERTY_ID_PRECISION 14 -#define PROPERTY_ID_SCALE 15 -#define PROPERTY_ID_ISNULLABLE 16 -#define PROPERTY_ID_ISAUTOINCREMENT 17 -#define PROPERTY_ID_ISROWVERSION 18 -#define PROPERTY_ID_DESCRIPTION 19 -#define PROPERTY_ID_DEFAULTVALUE 20 - -#define PROPERTY_ID_REFERENCEDTABLE 21 -#define PROPERTY_ID_UPDATERULE 22 -#define PROPERTY_ID_DELETERULE 23 -#define PROPERTY_ID_CATALOG 24 -#define PROPERTY_ID_ISUNIQUE 25 -#define PROPERTY_ID_ISPRIMARYKEYINDEX 26 -#define PROPERTY_ID_ISCLUSTERED 27 -#define PROPERTY_ID_ISASCENDING 28 -#define PROPERTY_ID_SCHEMANAME 29 -#define PROPERTY_ID_CATALOGNAME 30 - -#define PROPERTY_ID_COMMAND 31 -#define PROPERTY_ID_CHECKOPTION 32 -#define PROPERTY_ID_PASSWORD 33 -#define PROPERTY_ID_RELATEDCOLUMN 34 - -#define PROPERTY_ID_FUNCTION 35 -#define PROPERTY_ID_TABLENAME 36 -#define PROPERTY_ID_REALNAME 37 -#define PROPERTY_ID_DBASEPRECISIONCHANGED 38 -#define PROPERTY_ID_ISCURRENCY 39 -#define PROPERTY_ID_ISBOOKMARKABLE 40 - -#define PROPERTY_ID_INVALID_INDEX 41 -#define PROPERTY_ID_ERRORMSG_SEQUENCE 42 -#define PROPERTY_ID_HY010 43 -#define PROPERTY_ID_HY0000 44 -#define PROPERTY_ID_DELIMITER 45 -#define PROPERTY_ID_FORMATKEY 46 -#define PROPERTY_ID_LOCALE 47 -#define PROPERTY_ID_IM001 48 - -#define PROPERTY_ID_AUTOINCREMENTCREATION 49 - -#define PROPERTY_ID_PRIVILEGES 50 +#define PROPERTY_ID_NAME 11 +#define PROPERTY_ID_TYPE 12 +#define PROPERTY_ID_TYPENAME 13 +#define PROPERTY_ID_PRECISION 14 +#define PROPERTY_ID_SCALE 15 +#define PROPERTY_ID_ISNULLABLE 16 +#define PROPERTY_ID_ISAUTOINCREMENT 17 +#define PROPERTY_ID_ISROWVERSION 18 +#define PROPERTY_ID_DESCRIPTION 19 +#define PROPERTY_ID_DEFAULTVALUE 20 + +#define PROPERTY_ID_REFERENCEDTABLE 21 +#define PROPERTY_ID_UPDATERULE 22 +#define PROPERTY_ID_DELETERULE 23 +#define PROPERTY_ID_CATALOG 24 +#define PROPERTY_ID_ISUNIQUE 25 +#define PROPERTY_ID_ISPRIMARYKEYINDEX 26 +#define PROPERTY_ID_ISCLUSTERED 27 +#define PROPERTY_ID_ISASCENDING 28 +#define PROPERTY_ID_SCHEMANAME 29 +#define PROPERTY_ID_CATALOGNAME 30 + +#define PROPERTY_ID_COMMAND 31 +#define PROPERTY_ID_CHECKOPTION 32 +#define PROPERTY_ID_PASSWORD 33 +#define PROPERTY_ID_RELATEDCOLUMN 34 + +#define PROPERTY_ID_FUNCTION 35 +#define PROPERTY_ID_TABLENAME 36 +#define PROPERTY_ID_REALNAME 37 +#define PROPERTY_ID_DBASEPRECISIONCHANGED 38 +#define PROPERTY_ID_ISCURRENCY 39 +#define PROPERTY_ID_ISBOOKMARKABLE 40 + +#define PROPERTY_ID_INVALID_INDEX 41 +#define PROPERTY_ID_ERRORMSG_SEQUENCE 42 +#define PROPERTY_ID_HY010 43 +#define PROPERTY_ID_HY0000 44 +#define PROPERTY_ID_DELIMITER 45 +#define PROPERTY_ID_FORMATKEY 46 +#define PROPERTY_ID_LOCALE 47 +#define PROPERTY_ID_IM001 48 + +#define PROPERTY_ID_AUTOINCREMENTCREATION 49 + +#define PROPERTY_ID_PRIVILEGES 50 #endif // _CONNECTIVITY_PROPERTYIDS_HXX_ diff --git a/odk/examples/DevelopersGuide/Database/OpenQuery.java b/odk/examples/DevelopersGuide/Database/OpenQuery.java index c62d560039f0..3f63651cc7c2 100644 --- a/odk/examples/DevelopersGuide/Database/OpenQuery.java +++ b/odk/examples/DevelopersGuide/Database/OpenQuery.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.bridge.XUnoUrlResolver; @@ -54,11 +54,11 @@ public class OpenQuery { private XComponentContext xContext = null; private XMultiComponentFactory xMCF = null; - + /** Creates a new instance of OpenQuery */ public OpenQuery() { } - + /** * @param args the command line arguments */ @@ -87,12 +87,12 @@ public class OpenQuery { e.printStackTrace(); System.exit(1); } - + // first we create our RowSet object and get its XRowSet interface Object rowSet = xMCF.createInstanceWithContext( "com.sun.star.sdb.RowSet", xContext); - com.sun.star.sdbc.XRowSet xRowSet = (com.sun.star.sdbc.XRowSet) + com.sun.star.sdbc.XRowSet xRowSet = (com.sun.star.sdbc.XRowSet) UnoRuntime.queryInterface(com.sun.star.sdbc.XRowSet.class, rowSet); // set the properties needed to connect to a database @@ -137,26 +137,26 @@ public class OpenQuery { com.sun.star.sdbc.XResultSetUpdate xResultSetUpdate = (com.sun.star.sdbc.XResultSetUpdate) UnoRuntime.queryInterface( com.sun.star.sdbc.XResultSetUpdate.class, xRowSet); - + // XRowUpdate for row updates com.sun.star.sdbc.XRowUpdate xRowUpdate = (com.sun.star.sdbc.XRowUpdate) UnoRuntime.queryInterface( com.sun.star.sdbc.XRowUpdate.class, xRowSet); - + // move to insertRow buffer xResultSetUpdate.moveToInsertRow(); - + // edit insertRow buffer xRowUpdate.updateString(xLoc.findColumn("IDENTIFIER"), "GOF95"); - xRowUpdate.updateString(xLoc.findColumn("AUTHOR"), "Gamma, Helm, Johnson, Vlissides"); - + xRowUpdate.updateString(xLoc.findColumn("AUTHOR"), "Gamma, Helm, Johnson, Vlissides"); + // write buffer to database xResultSetUpdate.insertRow(); - + // throw away the row set com.sun.star.lang.XComponent xComp = (com.sun.star.lang.XComponent)UnoRuntime.queryInterface( com.sun.star.lang.XComponent.class, xRowSet); xComp.dispose(); - } - + } + } diff --git a/odk/examples/DevelopersGuide/Database/RowSet.java b/odk/examples/DevelopersGuide/Database/RowSet.java index bffcca51b663..9907b1659c18 100644 --- a/odk/examples/DevelopersGuide/Database/RowSet.java +++ b/odk/examples/DevelopersGuide/Database/RowSet.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import java.io.*; @@ -48,7 +48,7 @@ import com.sun.star.sdbc.*; import com.sun.star.sdbcx.Privilege; import com.sun.star.sdb.CommandType; import com.sun.star.sdb.XRowSetApproveBroadcaster; - + public class RowSet { private static XComponentContext xContext = null; @@ -209,8 +209,8 @@ public class RowSet // do some movements to check if we got all notifications XResultSet xRes = (XResultSet)UnoRuntime.queryInterface(XResultSet.class,xRowRes); System.out.println("beforeFirst"); - xRes.beforeFirst(); - // this should lead to no notifications because + xRes.beforeFirst(); + // this should lead to no notifications because // we should stand before the first row at the beginning System.out.println("We stand before the first row: " + xRes.isBeforeFirst()); diff --git a/odk/examples/DevelopersGuide/Database/RowSetEventListener.java b/odk/examples/DevelopersGuide/Database/RowSetEventListener.java index ba0f03f2cc02..aed05e5391c7 100644 --- a/odk/examples/DevelopersGuide/Database/RowSetEventListener.java +++ b/odk/examples/DevelopersGuide/Database/RowSetEventListener.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.sdb.XRowSetApproveListener; diff --git a/odk/examples/DevelopersGuide/Database/Sales.java b/odk/examples/DevelopersGuide/Database/Sales.java index efa3422e21f2..92716578dfa2 100644 --- a/odk/examples/DevelopersGuide/Database/Sales.java +++ b/odk/examples/DevelopersGuide/Database/Sales.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,23 +29,23 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import java.io.*; -// import com.sun.star.comp.helper.RegistryServiceFactory; -// import com.sun.star.comp.servicemanager.ServiceManager; -// import com.sun.star.lang.XMultiServiceFactory; -// import com.sun.star.lang.XServiceInfo; +// import com.sun.star.comp.helper.RegistryServiceFactory; +// import com.sun.star.comp.servicemanager.ServiceManager; +// import com.sun.star.lang.XMultiServiceFactory; +// import com.sun.star.lang.XServiceInfo; import com.sun.star.lang.XComponent; -// import com.sun.star.bridge.XUnoUrlResolver; +// import com.sun.star.bridge.XUnoUrlResolver; import com.sun.star.uno.*; import com.sun.star.util.Date; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XNameAccess; import com.sun.star.sdbc.*; - + public class Sales { private XConnection con; @@ -82,7 +82,7 @@ public class Sales public void insertDataIntoSales() throws com.sun.star.uno.Exception { XStatement stmt = con.createStatement(); - stmt.executeUpdate("INSERT INTO SALES " + + stmt.executeUpdate("INSERT INTO SALES " + "VALUES (1, '100', '1','Linux','2001-02-12',15)"); stmt.executeUpdate("INSERT INTO SALES " + "VALUES (2, '101', '2','Beef','2001-10-18',15.78)"); @@ -94,8 +94,8 @@ public class Sales public void updateSales() throws com.sun.star.uno.Exception { XStatement stmt = con.createStatement(); - String updateString = "UPDATE SALES " + - "SET PRICE = 30 " + + String updateString = "UPDATE SALES " + + "SET PRICE = 30 " + "WHERE SALENR = 1"; stmt.executeUpdate(updateString); } @@ -104,7 +104,7 @@ public class Sales public void retrieveSalesData() throws com.sun.star.uno.Exception { XStatement stmt = con.createStatement(); - String query = "SELECT NAME, PRICE FROM SALES " + + String query = "SELECT NAME, PRICE FROM SALES " + "WHERE SALENR = 1"; XResultSet rs = stmt.executeQuery(query); XRow row = (XRow)UnoRuntime.queryInterface(XRow.class, rs); @@ -155,10 +155,10 @@ public class Sales { // example for a programmatic way to do updates. This doesn't work with adabas. XStatement stmt = con.createStatement(); -// stmt.executeUpdate("INSERT INTO SALES " + +// stmt.executeUpdate("INSERT INTO SALES " + // "VALUES (4, 102, 5, 'FTOP Darjeeling tea', '2002-01-02',150)"); // -// stmt = con.createStatement(); +// stmt = con.createStatement(); XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,stmt); xProp.setPropertyValue("ResultSetType", new java.lang.Integer(ResultSetType.SCROLL_INSENSITIVE)); xProp.setPropertyValue("ResultSetConcurrency", new java.lang.Integer(ResultSetConcurrency.UPDATABLE)); @@ -167,7 +167,7 @@ public class Sales // insert a new row XRowUpdate updateRow = (XRowUpdate)UnoRuntime.queryInterface(XRowUpdate.class,rs); - XResultSetUpdate updateRs = ( XResultSetUpdate )UnoRuntime. queryInterface(XResultSetUpdate.class,rs); + XResultSetUpdate updateRs = ( XResultSetUpdate )UnoRuntime. queryInterface(XResultSetUpdate.class,rs); updateRs.moveToInsertRow(); updateRow.updateInt(1, 4); updateRow.updateInt(2, 102); @@ -189,7 +189,7 @@ public class Sales XResultSet rs = stmt.executeQuery("SELECT * FROM SALES"); XRow row = (XRow)UnoRuntime.queryInterface(XRow.class,rs); - XResultSetUpdate updateRs = ( XResultSetUpdate )UnoRuntime. queryInterface(XResultSetUpdate.class,rs); + XResultSetUpdate updateRs = ( XResultSetUpdate )UnoRuntime. queryInterface(XResultSetUpdate.class,rs); // move to the inserted row rs.absolute(4); updateRs.deleteRow(); @@ -213,7 +213,7 @@ public class Sales // modifiy the 4 row XRowUpdate updateRow = (XRowUpdate)UnoRuntime.queryInterface(XRowUpdate.class,rs); - XResultSetUpdate updateRs = ( XResultSetUpdate )UnoRuntime. queryInterface(XResultSetUpdate.class,rs); + XResultSetUpdate updateRs = ( XResultSetUpdate )UnoRuntime. queryInterface(XResultSetUpdate.class,rs); updateRow.updateFloat(2, 150); updateRs.updateRow(); // repositioning diff --git a/odk/examples/DevelopersGuide/Database/SalesMan.java b/odk/examples/DevelopersGuide/Database/SalesMan.java index e19bca758bdd..2e0e870923ee 100644 --- a/odk/examples/DevelopersGuide/Database/SalesMan.java +++ b/odk/examples/DevelopersGuide/Database/SalesMan.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,23 +29,23 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import java.io.*; -// import com.sun.star.comp.helper.RegistryServiceFactory; -// import com.sun.star.comp.servicemanager.ServiceManager; -// import com.sun.star.lang.XMultiServiceFactory; -// import com.sun.star.lang.XServiceInfo; +// import com.sun.star.comp.helper.RegistryServiceFactory; +// import com.sun.star.comp.servicemanager.ServiceManager; +// import com.sun.star.lang.XMultiServiceFactory; +// import com.sun.star.lang.XServiceInfo; import com.sun.star.lang.XComponent; -// import com.sun.star.bridge.XUnoUrlResolver; +// import com.sun.star.bridge.XUnoUrlResolver; import com.sun.star.uno.*; import com.sun.star.util.Date; import com.sun.star.beans.XPropertySet; import com.sun.star.container.XNameAccess; import com.sun.star.sdbc.*; - + public class SalesMan { private XConnection con; @@ -83,20 +83,20 @@ public class SalesMan public void insertDataIntoSalesMan() throws com.sun.star.uno.Exception { XStatement stmt = con.createStatement(); - stmt.executeUpdate("INSERT INTO SALESMAN " + - "VALUES (1, 'Joseph', 'Smith','Bond Street','CA',95460," + stmt.executeUpdate("INSERT INTO SALESMAN " + + "VALUES (1, 'Joseph', 'Smith','Bond Street','CA',95460," + "'1946-07-02')"); stmt.executeUpdate("INSERT INTO SALESMAN " + - "VALUES (2, 'Frank', 'Jones','Lake Silver','CA',95460," + "VALUES (2, 'Frank', 'Jones','Lake Silver','CA',95460," + "'1963-12-24')"); stmt.executeUpdate("INSERT INTO SALESMAN " + - "VALUES (3, 'Jane', 'Esperansa','23 Hollywood drive','CA',95460," + "VALUES (3, 'Jane', 'Esperansa','23 Hollywood drive','CA',95460," + "'1972-04-01')"); stmt.executeUpdate("INSERT INTO SALESMAN " + - "VALUES (4, 'George', 'Flint','12 Washington street','CA',95460," + "VALUES (4, 'George', 'Flint','12 Washington street','CA',95460," + "'1953-02-13')"); stmt.executeUpdate("INSERT INTO SALESMAN " + - "VALUES (5, 'Bob', 'Meyers','2 Moon way','CA',95460," + "VALUES (5, 'Bob', 'Meyers','2 Moon way','CA',95460," + "'1949-09-07')"); } @@ -110,19 +110,19 @@ public class SalesMan setPara.setInt(2, 1); updateStreet.executeUpdate(); - setPara.setString(1, "Marryland"); + setPara.setString(1, "Marryland"); setPara.setInt(2, 4); - updateStreet.executeUpdate(); + updateStreet.executeUpdate(); // changes STREET column of salesman George to Marryland setPara.setString(1, "Michigan road"); - updateStreet.executeUpdate(); - // changes again STREET column of salesman George to - // Michigan road + updateStreet.executeUpdate(); + // changes again STREET column of salesman George to + // Michigan road // parameter 2 stayed 4, and the first parameter was reset // to "Michigan road") - setPara.setString(1, "Bond Street"); - setPara.setInt(2, 3); + setPara.setString(1, "Bond Street"); + setPara.setInt(2, 3); int n = updateStreet.executeUpdate(); System.out.println("executeUpdate returns: " + n); // n = 1 because one row had a change in it @@ -132,7 +132,7 @@ public class SalesMan public void retrieveSalesManData() throws com.sun.star.uno.Exception { XStatement stmt = con.createStatement(); - XResultSet rs = stmt.executeQuery("SELECT FIRSTNAME, LASTNAME, BIRTHDATE FROM SALESMAN"); + XResultSet rs = stmt.executeQuery("SELECT FIRSTNAME, LASTNAME, BIRTHDATE FROM SALESMAN"); XRow row = (XRow)UnoRuntime.queryInterface(XRow.class,rs); while ( rs != null && rs.next() ) { String fn = row.getString( 1 ); diff --git a/odk/examples/DevelopersGuide/Database/sdbcx.java b/odk/examples/DevelopersGuide/Database/sdbcx.java index 62a4f7007fe6..e446ed5dc994 100644 --- a/odk/examples/DevelopersGuide/Database/sdbcx.java +++ b/odk/examples/DevelopersGuide/Database/sdbcx.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import java.io.*; @@ -43,13 +43,13 @@ import com.sun.star.container.XIndexAccess; import com.sun.star.sdbc.*; import com.sun.star.sdbcx.*; import com.sun.star.lang.XMultiServiceFactory; - + public class sdbcx { private XMultiServiceFactory xORB; private static XConnection con; private XTablesSupplier xTabSup; - + public static XMultiServiceFactory rSmgr; public static void main(String argv[]) throws java.lang.Exception { @@ -108,7 +108,7 @@ public class sdbcx { xORB = rSmgr; } - + public void createConnection() throws com.sun.star.uno.Exception { // create the Driver with the implementation name @@ -126,8 +126,8 @@ public class sdbcx new com.sun.star.beans.PropertyValue("user",0,"test1",com.sun.star.beans.PropertyState.DIRECT_VALUE), new com.sun.star.beans.PropertyValue("password",0,"test1",com.sun.star.beans.PropertyState.DIRECT_VALUE) }; - // - + // + // now create a connection to adabas con = xDriver.connect(adabasURL,adabasProps); if(con != null) @@ -176,7 +176,7 @@ public class sdbcx } //########################################################### - // 15. example + // 15. example // print all columns of a XColumnsSupplier //########################################################### public static void printColumns(XColumnsSupplier xColumnsSup) throws com.sun.star.uno.Exception,SQLException @@ -190,7 +190,7 @@ public class sdbcx System.out.println(" " + aColumnNames[i]); } //########################################################### - // 16. example + // 16. example // print all keys inclusive the columns of a key //########################################################### public static void printKeys(XColumnsSupplier xColumnsSup) throws com.sun.star.uno.Exception,SQLException @@ -207,12 +207,12 @@ public class sdbcx XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,key); System.out.println(" " + xProp.getPropertyValue("Name")); XColumnsSupplier xKeyColumnsSup = ( XColumnsSupplier ) UnoRuntime.queryInterface(XColumnsSupplier.class,xProp); - printColumns(xKeyColumnsSup); + printColumns(xKeyColumnsSup); } } } //########################################################### - // 17. example + // 17. example // print all keys inclusive the columns of a key //########################################################### public static void printIndexes(XColumnsSupplier xColumnsSup) throws com.sun.star.uno.Exception,SQLException @@ -229,13 +229,13 @@ public class sdbcx System.out.println(" " + aIndexNames[i]); Object index = xIndexs.getByName(aIndexNames[i]); XColumnsSupplier xIndexColumnsSup = (XColumnsSupplier)UnoRuntime.queryInterface(XColumnsSupplier.class,index); - printColumns(xIndexColumnsSup); + printColumns(xIndexColumnsSup); } } } //########################################################### - // 18. example + // 18. example // column properties //########################################################### public static void printColumnProperties(Object column) throws com.sun.star.uno.Exception,SQLException @@ -260,7 +260,7 @@ public class sdbcx } //########################################################### - // 19. example + // 19. example // index properties //########################################################### public static void printIndexProperties(Object index) throws com.sun.star.uno.Exception,SQLException @@ -275,7 +275,7 @@ public class sdbcx } //########################################################### - // 20. example + // 20. example // key properties //########################################################### public static void printKeyProperties(Object key) throws com.sun.star.uno.Exception,SQLException @@ -290,7 +290,7 @@ public class sdbcx } //########################################################### - // 21. example + // 21. example // print all groups and the users with their privileges who belong to this group //########################################################### public static void printGroups(XTablesSupplier xTabSup) throws com.sun.star.uno.Exception,SQLException @@ -324,7 +324,7 @@ public class sdbcx } //########################################################### - // 22. example + // 22. example // create the table salesmen //########################################################### public static void createTableSalesMen(XNameAccess xTables) throws com.sun.star.uno.Exception,SQLException @@ -399,7 +399,7 @@ public class sdbcx } //########################################################### - // 23. example + // 23. example // create a user //########################################################### public static void createUser(XNameAccess xUsers) throws com.sun.star.uno.Exception,SQLException diff --git a/odk/examples/DevelopersGuide/Drawing/ChangeOrderDemo.java b/odk/examples/DevelopersGuide/Drawing/ChangeOrderDemo.java index 7adbd41ba6a0..12ae3f20ff88 100644 --- a/odk/examples/DevelopersGuide/Drawing/ChangeOrderDemo.java +++ b/odk/examples/DevelopersGuide/Drawing/ChangeOrderDemo.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -89,12 +89,12 @@ public class ChangeOrderDemo XShape xShape2 = ShapeHelper.createShape( xDrawDoc, new Point( 2000, 2000 ), new Size( 5000, 5000 ), "com.sun.star.drawing.EllipseShape" ); - + xShapes.add( xShape1 ); ShapeHelper.addPortion( xShape1, " this shape was inserted first", false ); ShapeHelper.addPortion( xShape1, "by changing the ZOrder it lie now on top", true ); xShapes.add( xShape2 ); - + XPropertySet xPropSet1 = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, xShape1 ); XPropertySet xPropSet2 = (XPropertySet) @@ -102,7 +102,7 @@ public class ChangeOrderDemo int nOrderOfShape1 = ((Integer)xPropSet1.getPropertyValue( "ZOrder" )).intValue(); int nOrderOfShape2 = ((Integer)xPropSet2.getPropertyValue( "ZOrder" )).intValue(); - + xPropSet1.setPropertyValue( "ZOrder", new Integer( nOrderOfShape2 ) ); xPropSet2.setPropertyValue( "ZOrder", new Integer( nOrderOfShape1 ) ); } diff --git a/odk/examples/DevelopersGuide/Drawing/ControlAndSelectDemo.java b/odk/examples/DevelopersGuide/Drawing/ControlAndSelectDemo.java index 1628f0c59ff8..3a6bfee22e7a 100644 --- a/odk/examples/DevelopersGuide/Drawing/ControlAndSelectDemo.java +++ b/odk/examples/DevelopersGuide/Drawing/ControlAndSelectDemo.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -91,7 +91,7 @@ public class ControlAndSelectDemo XMultiServiceFactory xFactory = (XMultiServiceFactory )UnoRuntime.queryInterface( XMultiServiceFactory.class, xComponent ); - + XDrawPagesSupplier xDrawPagesSupplier = (XDrawPagesSupplier)UnoRuntime.queryInterface( XDrawPagesSupplier.class, xComponent ); diff --git a/odk/examples/DevelopersGuide/Drawing/CustomShowDemo.java b/odk/examples/DevelopersGuide/Drawing/CustomShowDemo.java index de42d7ce426e..46020dfac470 100644 --- a/odk/examples/DevelopersGuide/Drawing/CustomShowDemo.java +++ b/odk/examples/DevelopersGuide/Drawing/CustomShowDemo.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -97,7 +97,7 @@ public class CustomShowDemo (XDrawPagesSupplier)UnoRuntime.queryInterface( XDrawPagesSupplier.class, xDrawDoc ); XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages(); - + // take care that this document has ten pages while ( xDrawPages.getCount() < 10 ) xDrawPages.insertNewByIndex( 0 ); @@ -107,13 +107,13 @@ public class CustomShowDemo "page five", "page six", "page seven", "page eight", "page nine" }; int i; for ( i = 0; i < 10; i++ ) - { + { XDrawPage xDrawPage = (XDrawPage)UnoRuntime.queryInterface( XDrawPage.class, xDrawPages.getByIndex( i )); XNamed xPageName = (XNamed)UnoRuntime.queryInterface( - XNamed.class, xDrawPage ); + XNamed.class, xDrawPage ); xPageName.setName( aNameArray[ i ] ); - + // now we will create and insert the text object XShape xTextObj = ShapeHelper.createShape( xDrawDoc, new Point( 10000, 9000 ), new Size( 10000, 5000 ), @@ -135,7 +135,7 @@ public class CustomShowDemo XSingleServiceFactory xFactory = (XSingleServiceFactory) UnoRuntime.queryInterface( XSingleServiceFactory.class, xNameContainer ); - Object xObj; + Object xObj; XIndexContainer xContainer; /* instanciate an IndexContainer that will take diff --git a/odk/examples/DevelopersGuide/Drawing/DrawViewDemo.java b/odk/examples/DevelopersGuide/Drawing/DrawViewDemo.java index 43fbe81f1713..1b806d78d0c6 100644 --- a/odk/examples/DevelopersGuide/Drawing/DrawViewDemo.java +++ b/odk/examples/DevelopersGuide/Drawing/DrawViewDemo.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -73,7 +73,7 @@ public class DrawViewDemo // get the remote office context of a running office (a new office // instance is started if necessary) com.sun.star.uno.XComponentContext xOfficeContext = Helper.connect(); - + // suppress Presentation Autopilot when opening the document // properties are the same as described for // com.sun.star.document.MediaDescriptor @@ -81,19 +81,19 @@ public class DrawViewDemo pPropValues[ 0 ] = new PropertyValue(); pPropValues[ 0 ].Name = "Silent"; pPropValues[ 0 ].Value = new Boolean( true ); - + java.io.File sourceFile = new java.io.File(args[0]); StringBuffer sUrl = new StringBuffer("file:///"); sUrl.append(sourceFile.getCanonicalPath().replace('\\', '/')); - + xComponent = Helper.createDocument( xOfficeContext, sUrl.toString(), "_blank", 0, pPropValues ); XModel xModel = (XModel)UnoRuntime.queryInterface( XModel.class, xComponent ); - - + + // print all available properties of first view System.out.println("*** print all available properties of first view"); XViewDataSupplier xViewDataSupplier = @@ -104,15 +104,15 @@ public class DrawViewDemo { PropertyValue[] aPropSeq = (PropertyValue[]) xIndexAccess.getByIndex( 0 ); - + for( int i = 0; i < aPropSeq.length; i++ ) { System.out.println( aPropSeq[ i ].Name + " = " + aPropSeq[ i ].Value ); } } - - + + // print all properties that are supported by the controller // and change into masterpage mode System.out.println("*** print all properties that are supported by the controller"); @@ -128,7 +128,7 @@ public class DrawViewDemo } System.out.println("*** change into masterpage mode"); xPropSet.setPropertyValue( "IsMasterPageMode", new Boolean( true ) ); - + } catch( Exception ex ) { diff --git a/odk/examples/DevelopersGuide/Drawing/DrawingDemo.java b/odk/examples/DevelopersGuide/Drawing/DrawingDemo.java index 78b4b981da7c..6d34da14e986 100644 --- a/odk/examples/DevelopersGuide/Drawing/DrawingDemo.java +++ b/odk/examples/DevelopersGuide/Drawing/DrawingDemo.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -112,10 +112,10 @@ public class DrawingDemo System.exit( 0 ); } - + Demo_PageCreation( xDrawDoc, 10 ); Demo_PageNaming( xDrawDoc, "this page is called: LastPage" ); - Demo_ShapeCreation( xDrawDoc ); + Demo_ShapeCreation( xDrawDoc ); Demo_PolyPolygonBezier( xDrawDoc ); Demo_Group1( xDrawDoc ); Demo_Group2( xDrawDoc ); @@ -141,8 +141,8 @@ public class DrawingDemo nMasterPages < ( ( nDrawPages + 1 ) / 2 ); nMasterPages++ ) PageHelper.insertNewMasterPageByIndex( xDrawDoc, nMasterPages ); - // Now connect master page 1 to draw page 1 and 2, - // master page 2 to draw page 3 and 4 and so on. + // Now connect master page 1 to draw page 1 and 2, + // master page 2 to draw page 3 and 4 and so on. for ( i = 0; i < nDrawPages; i++ ) { XDrawPage xDrawPage = PageHelper.getDrawPageByIndex( xDrawDoc, i ); @@ -247,13 +247,13 @@ public class DrawingDemo int nRndObjWidth = aRndGen.nextInt( nHalfWidth ); int nRndObjHeight = aRndGen.nextInt( nHalfHeight ); - int nRndObjPosX = aRndGen.nextInt( nHalfWidth - nRndObjWidth ); + int nRndObjPosX = aRndGen.nextInt( nHalfWidth - nRndObjWidth ); int nRndObjPosY = aRndGen.nextInt( nHalfHeight - nRndObjHeight ) + nHalfHeight; XShapes xShapes = (XShapes) UnoRuntime.queryInterface( XShapes.class, pPages[ i ] ); - ShapeHelper.createAndInsertShape( xDrawDoc, xShapes, + ShapeHelper.createAndInsertShape( xDrawDoc, xShapes, new Point( nRndObjPosX, nRndObjPosY ), new Size( nRndObjWidth, nRndObjHeight ), "com.sun.star.drawing.RectangleShape" ); @@ -275,7 +275,7 @@ public class DrawingDemo new Point( 0, 0 ), new Size( 0, 0 ), "com.sun.star.drawing.ClosedBezierShape" ); - + // the fact that the shape must have been added to the page before // it is possible to apply changes to the PropertySet, it is a good // proceeding to add the shape as soon as possible @@ -301,7 +301,7 @@ public class DrawingDemo PolyPolygonBezierCoords aCoords = new PolyPolygonBezierCoords(); // allocating the outer sequence int nPolygonCount = 50; - aCoords.Coordinates = new Point[ nPolygonCount ][ ]; + aCoords.Coordinates = new Point[ nPolygonCount ][ ]; aCoords.Flags = new PolygonFlags[ nPolygonCount ][ ]; int i, n, nY; // fill the inner point sequence now @@ -310,8 +310,8 @@ public class DrawingDemo // create a polygon using two normal and two control points // allocating the inner sequence int nPointCount = 8; - Point[] pPolyPoints = new Point[ nPointCount ]; - PolygonFlags[] pPolyFlags = new PolygonFlags[ nPointCount ]; + Point[] pPolyPoints = new Point[ nPointCount ]; + PolygonFlags[] pPolyFlags = new PolygonFlags[ nPointCount ]; for ( n = 0; n < nPointCount; n++ ) pPolyPoints[ n ] = new Point(); @@ -343,7 +343,7 @@ public class DrawingDemo pPolyFlags[ 7 ] = PolygonFlags.NORMAL; aCoords.Coordinates[ i ]= pPolyPoints; - aCoords.Flags[ i ] = pPolyFlags; + aCoords.Flags[ i ] = pPolyFlags; } xShapeProperties.setPropertyValue( "PolyPolygonBezier", aCoords ); @@ -356,7 +356,7 @@ public class DrawingDemo } } - // This method will create a group containing two ellipses + // This method will create a group containing two ellipses // the shapes will be added into the top right corner of the first // draw page public static void Demo_Group1( XComponent xDrawDoc ) @@ -380,7 +380,7 @@ public class DrawingDemo Size aPageSize = PageHelper.getPageSize( xDrawPage ); - int nWidth = 4000; + int nWidth = 4000; int nHeight = 2000; int nPosX = ( aPageSize.Width * 3 ) / 4 - nWidth / 2; int nPosY1 = 2000; diff --git a/odk/examples/DevelopersGuide/Drawing/FillAndLineStyleDemo.java b/odk/examples/DevelopersGuide/Drawing/FillAndLineStyleDemo.java index 132338870fee..9380ffd2a004 100644 --- a/odk/examples/DevelopersGuide/Drawing/FillAndLineStyleDemo.java +++ b/odk/examples/DevelopersGuide/Drawing/FillAndLineStyleDemo.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -80,20 +80,20 @@ public class FillAndLineStyleDemo "private:factory/sdraw", "_blank", 0, pPropValues ); XDrawPage xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 ); - + XShape xRectangle = ShapeHelper.createShape( xDrawDoc, new Point( 0, 0 ), new Size( 15000, 12000 ), "com.sun.star.drawing.RectangleShape" ); - + XShapes xShapes = (XShapes) UnoRuntime.queryInterface( XShapes.class, xPage ); xShapes.add( xRectangle ); XPropertySet xPropSet = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, xRectangle ); - - /* apply a gradient fill style that goes from top left to bottom + + /* apply a gradient fill style that goes from top left to bottom right and is changing its color from green to yellow */ xPropSet.setPropertyValue( "FillStyle", com.sun.star.drawing.FillStyle.GRADIENT ); @@ -121,7 +121,7 @@ public class FillAndLineStyleDemo aLineDash.Distance = 150; xPropSet.setPropertyValue( "LineDash", aLineDash ); xPropSet.setPropertyValue( "LineColor", new Integer( 0x0000ff ) ); - xPropSet.setPropertyValue( "LineWidth", new Integer( 200 ) ); + xPropSet.setPropertyValue( "LineWidth", new Integer( 200 ) ); } catch( Exception ex ) diff --git a/odk/examples/DevelopersGuide/Drawing/GluePointDemo.java b/odk/examples/DevelopersGuide/Drawing/GluePointDemo.java index 2835770e2ae5..43765dec8ea1 100644 --- a/odk/examples/DevelopersGuide/Drawing/GluePointDemo.java +++ b/odk/examples/DevelopersGuide/Drawing/GluePointDemo.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -107,15 +107,15 @@ public class GluePointDemo xShapes.add( xShape1 ); xShapes.add( xShape2 ); xShapes.add( xConnector ); - + XPropertySet xConnectorPropSet = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, xConnector ); -// Index value of 0 : the shape is connected at the top -// Index value of 1 : the shape is connected at the left -// Index value of 2 : the shape is connected at the bottom -// Index value of 3 : the shape is connected at the right - +// Index value of 0 : the shape is connected at the top +// Index value of 1 : the shape is connected at the left +// Index value of 2 : the shape is connected at the bottom +// Index value of 3 : the shape is connected at the right + int nStartIndex = 3; int nEndIndex = 1; @@ -130,7 +130,7 @@ public class GluePointDemo new Integer( nEndIndex ) ); XGluePointsSupplier xGluePointsSupplier; - XIndexContainer xIndexContainer; + XIndexContainer xIndexContainer; XIdentifierContainer xIdentifierContainer; GluePoint2 aGluePoint = new GluePoint2(); diff --git a/odk/examples/DevelopersGuide/Drawing/GraphicExportDemo.java b/odk/examples/DevelopersGuide/Drawing/GraphicExportDemo.java index 65c9ecf99b4f..63901b901f1c 100644 --- a/odk/examples/DevelopersGuide/Drawing/GraphicExportDemo.java +++ b/odk/examples/DevelopersGuide/Drawing/GraphicExportDemo.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -66,7 +66,7 @@ public class GraphicExportDemo // get the remote office context of a running office (a new office // instance is started if necessary) com.sun.star.uno.XComponentContext xOfficeContext = Helper.connect(); - + // suppress Presentation Autopilot when opening the document // properties are the same as described for // com.sun.star.document.MediaDescriptor @@ -74,38 +74,38 @@ public class GraphicExportDemo pPropValues[ 0 ] = new PropertyValue(); pPropValues[ 0 ].Name = "Silent"; pPropValues[ 0 ].Value = new Boolean( true ); - + java.io.File sourceFile = new java.io.File(args[0]); StringBuffer sUrl = new StringBuffer("file:///"); sUrl.append(sourceFile.getCanonicalPath().replace('\\', '/')); - + xComponent = Helper.createDocument( xOfficeContext, sUrl.toString(), "_blank", 0, pPropValues ); - + Object GraphicExportFilter = xOfficeContext.getServiceManager().createInstanceWithContext( "com.sun.star.drawing.GraphicExportFilter", xOfficeContext); XExporter xExporter = (XExporter) UnoRuntime.queryInterface( XExporter.class, GraphicExportFilter ); - + PropertyValue aProps[] = new PropertyValue[2]; aProps[0] = new PropertyValue(); aProps[0].Name = "MediaType"; aProps[0].Value = "image/gif"; - + /* some graphics e.g. the Windows Metafile does not have a Media Type, for this case - aProps[0].Name = "FilterName"; // it is possible to set a FilterName + aProps[0].Name = "FilterName"; // it is possible to set a FilterName aProps[0].Value = "WMF"; */ java.io.File destFile = new java.io.File(args[1]); java.net.URL destUrl = destFile.toURL(); - + aProps[1] = new PropertyValue(); aProps[1].Name = "URL"; aProps[1].Value = destUrl.toString();//args[ 1 ]; - + int nPageIndex = Integer.parseInt( args[ 2 ] ); if ( nPageIndex < PageHelper.getDrawPageCount( xComponent ) && nPageIndex > 1 ) @@ -115,19 +115,19 @@ public class GraphicExportDemo XComponent xComp = (XComponent) UnoRuntime.queryInterface( XComponent.class, xPage ); xExporter.setSourceDocument( xComp ); - XFilter xFilter = (XFilter) + XFilter xFilter = (XFilter) UnoRuntime.queryInterface( XFilter.class, xExporter ); xFilter.filter( aProps ); System.out.println( "*** graphics on page \"" + nPageIndex + "\" from file \"" + args[0] - + "\" exported under the name \"" + + "\" exported under the name \"" + args[1] + "\" in the local directory" ); } else { System.out.println( "page index not in range" ); } - - + + // close the document com.sun.star.util.XCloseable xCloseable = (com.sun.star.util.XCloseable) UnoRuntime.queryInterface(com.sun.star.util.XCloseable.class, @@ -138,15 +138,15 @@ public class GraphicExportDemo else xComponent.dispose(); - System.out.println("*** document closed!"); + System.out.println("*** document closed!"); } catch( Exception ex ) { System.out.println( ex ); } - + System.exit( 0 ); } } - + diff --git a/odk/examples/DevelopersGuide/Drawing/Helper.java b/odk/examples/DevelopersGuide/Drawing/Helper.java index efd952ac0ce9..e9d316ee7ec2 100644 --- a/odk/examples/DevelopersGuide/Drawing/Helper.java +++ b/odk/examples/DevelopersGuide/Drawing/Helper.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -53,7 +53,7 @@ public class Helper // if connection fails an exception is thrown System.out.println("Connected to a running office ..."); - + return xOfficeContext; } @@ -75,7 +75,7 @@ public class Helper xComponent = (com.sun.star.lang.XComponent)UnoRuntime.queryInterface( com.sun.star.lang.XComponent.class, aLoader.loadComponentFromURL( sURL, sTargetFrame, nSearchFlags, aArgs ) ); - + if ( xComponent == null ) throw new Exception( "could not create document: " + sURL ); return xComponent; diff --git a/odk/examples/DevelopersGuide/Drawing/LayerDemo.java b/odk/examples/DevelopersGuide/Drawing/LayerDemo.java index 005468ed037f..47fc964432d8 100644 --- a/odk/examples/DevelopersGuide/Drawing/LayerDemo.java +++ b/odk/examples/DevelopersGuide/Drawing/LayerDemo.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -117,13 +117,13 @@ public class LayerDemo XNameAccess xNameAccess = xLayerSupplier.getLayerManager(); XLayerManager xLayerManager = (XLayerManager) (XLayerManager)UnoRuntime.queryInterface( - XLayerManager.class, xNameAccess ); + XLayerManager.class, xNameAccess ); // create a layer and set its properties XPropertySet xLayerPropSet; XLayer xNotVisibleAndEditable = xLayerManager.insertNewByIndex( xLayerManager.getCount() ); - + xLayerPropSet = (XPropertySet) (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xNotVisibleAndEditable ); @@ -134,7 +134,7 @@ public class LayerDemo // create a second layer XLayer xNotEditable = xLayerManager.insertNewByIndex( xLayerManager.getCount() ); - + xLayerPropSet = (XPropertySet) (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xNotEditable ); diff --git a/odk/examples/DevelopersGuide/Drawing/ObjectTransformationDemo.java b/odk/examples/DevelopersGuide/Drawing/ObjectTransformationDemo.java index 787c0434be7f..56b5e80625cf 100644 --- a/odk/examples/DevelopersGuide/Drawing/ObjectTransformationDemo.java +++ b/odk/examples/DevelopersGuide/Drawing/ObjectTransformationDemo.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -90,13 +90,13 @@ public class ObjectTransformationDemo new Point( 0, 0 ), new Size( 10000, 2500 ), "com.sun.star.drawing.RectangleShape" ); xShapes.add( xShape ); - + XPropertySet xPropSet = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, xShape ); - + HomogenMatrix3 aHomogenMatrix3 = (HomogenMatrix3) xPropSet.getPropertyValue( "Transformation" ); - + java.awt.geom.AffineTransform aOriginalMatrix = new java.awt.geom.AffineTransform( aHomogenMatrix3.Line1.Column1, aHomogenMatrix3.Line2.Column1, diff --git a/odk/examples/DevelopersGuide/Drawing/Organigram.java b/odk/examples/DevelopersGuide/Drawing/Organigram.java index c564fd273178..caa390dce6fc 100644 --- a/odk/examples/DevelopersGuide/Drawing/Organigram.java +++ b/odk/examples/DevelopersGuide/Drawing/Organigram.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.beans.PropertyValue; @@ -58,14 +58,14 @@ import com.sun.star.uno.XComponentContext; * @author dschulten */ public class Organigram { - + private XComponentContext xRemoteContext = null; private XMultiComponentFactory xRemoteServiceManager = null; - + /** Creates a new instance of OpenQuery */ public Organigram() { } - + /** * @param args the command line arguments */ @@ -84,7 +84,7 @@ public class Organigram { public void drawOrganigram() throws java.lang.Exception { // get the remote office component context xRemoteContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); - System.out.println("Connected to a running office ..."); + System.out.println("Connected to a running office ..."); // get the remote service manager xRemoteServiceManager = xRemoteContext.getServiceManager(); @@ -96,7 +96,7 @@ public class Organigram { PropertyValue[] loadProps = new PropertyValue[0]; XComponent xDrawComponent = xComponentLoader.loadComponentFromURL( "private:factory/sdraw", "_blank", 0, loadProps); - + // get draw page by index com.sun.star.drawing.XDrawPagesSupplier xDrawPagesSupplier = (com.sun.star.drawing.XDrawPagesSupplier)UnoRuntime.queryInterface( @@ -107,15 +107,15 @@ public class Organigram { com.sun.star.drawing.XDrawPage xDrawPage = (com.sun.star.drawing.XDrawPage) UnoRuntime.queryInterface(com.sun.star.drawing.XDrawPage.class, drawPage); - + com.sun.star.lang.XMultiServiceFactory xDocumentFactory = (com.sun.star.lang.XMultiServiceFactory)UnoRuntime.queryInterface( com.sun.star.lang.XMultiServiceFactory.class, xDrawComponent); - + com.sun.star.beans.XPropertySet xPageProps = (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface( com.sun.star.beans.XPropertySet.class, xDrawPage); - + int pageWidth = AnyConverter.toInt(xPageProps.getPropertyValue("Width")); int pageHeight = AnyConverter.toInt(xPageProps.getPropertyValue("Height")); int pageBorderTop = AnyConverter.toInt(xPageProps.getPropertyValue("BorderTop")); @@ -131,7 +131,7 @@ public class Organigram { orgUnits[1][2] = "IT Services"; orgUnits[1][3] = "Sales"; int[] levelCount = {1, 4}; - + int horSpace = 300; int verSpace = 3000; @@ -139,12 +139,12 @@ public class Organigram { int shapeHeight = pageHeight / 20; int shapeX = pageWidth / 2 - shapeWidth / 2; int shapeY = pageBorderTop; - + int levelY; int levelX; - + com.sun.star.drawing.XShape xStartShape = null; - + for (int level = 0; level <= 1; level++) { levelY = pageBorderTop + 2000 + level * (shapeHeight + verSpace); for (int i = levelCount[level] - 1; i > -1; i--) { @@ -156,19 +156,19 @@ public class Organigram { UnoRuntime.queryInterface( com.sun.star.drawing.XShape.class, shape); xShape.setPosition(new com.sun.star.awt.Point(shapeX, levelY)); - xShape.setSize(new com.sun.star.awt.Size(shapeWidth, shapeHeight)); + xShape.setSize(new com.sun.star.awt.Size(shapeWidth, shapeHeight)); xDrawPage.add(xShape); - + com.sun.star.text.XText xText = (com.sun.star.text.XText) UnoRuntime.queryInterface( com.sun.star.text.XText.class, xShape); - - xText.setString(orgUnits[level][i]); + + xText.setString(orgUnits[level][i]); // memorize the root shape if (level == 0 && i == 0) - xStartShape = xShape; - + xStartShape = xShape; + if (level == 1) { Object connector = xDocumentFactory.createInstance("com.sun.star.drawing.ConnectorShape"); com.sun.star.beans.XPropertySet xConnectorProps = @@ -184,7 +184,7 @@ public class Organigram { new Integer(2)); // 2 = bottom glue point xConnectorProps.setPropertyValue("EndGluePointIndex", new Integer(0)); // 0 = top glue point - } + } } } } diff --git a/odk/examples/DevelopersGuide/Drawing/PageHelper.java b/odk/examples/DevelopersGuide/Drawing/PageHelper.java index c612afa4e61b..103916686b5c 100644 --- a/odk/examples/DevelopersGuide/Drawing/PageHelper.java +++ b/odk/examples/DevelopersGuide/Drawing/PageHelper.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -190,14 +190,14 @@ public class PageHelper // __________ presentation pages __________ - /** test if a Presentation Document is supported. + /** test if a Presentation Document is supported. This is important, because only presentation documents have notes and handout pages */ static public boolean isImpressDocument( XComponent xComponent ) { XServiceInfo xInfo = (XServiceInfo)UnoRuntime.queryInterface( - XServiceInfo.class, xComponent ); + XServiceInfo.class, xComponent ); return xInfo.supportsService( "com.sun.star.presentation.PresentationDocument" ); } @@ -205,7 +205,7 @@ public class PageHelper */ static public XDrawPage getNotesPage( XDrawPage xDrawPage ) { - XPresentationPage aPresentationPage = + XPresentationPage aPresentationPage = (XPresentationPage)UnoRuntime.queryInterface( XPresentationPage.class, xDrawPage ); return aPresentationPage.getNotesPage(); @@ -215,7 +215,7 @@ public class PageHelper */ static public XDrawPage getHandoutMasterPage( XComponent xComponent ) { - XHandoutMasterSupplier aHandoutMasterSupplier = + XHandoutMasterSupplier aHandoutMasterSupplier = (XHandoutMasterSupplier)UnoRuntime.queryInterface( XHandoutMasterSupplier.class, xComponent ); return aHandoutMasterSupplier.getHandoutMasterPage(); diff --git a/odk/examples/DevelopersGuide/Drawing/PresentationDemo.java b/odk/examples/DevelopersGuide/Drawing/PresentationDemo.java index 88c100e877f3..6a4113362b26 100644 --- a/odk/examples/DevelopersGuide/Drawing/PresentationDemo.java +++ b/odk/examples/DevelopersGuide/Drawing/PresentationDemo.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -61,7 +61,7 @@ import com.sun.star.presentation.XPresentationSupplier; @author Sven Jacobi */ -// This demo will demonstrate how to create a presentation using the Office API +// This demo will demonstrate how to create a presentation using the Office API // The first parameter describes the connection that is to use. If there is no parameter // "uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager" is used. @@ -90,8 +90,8 @@ public class PresentationDemo "private:factory/simpress", "_blank", 0, pPropValues ); - XDrawPage xPage; - XShapes xShapes; + XDrawPage xPage; + XShapes xShapes; XPropertySet xShapePropSet; // create pages, so that three are available @@ -108,7 +108,7 @@ public class PresentationDemo com.sun.star.presentation.FadeEffect.FADE_FROM_RIGHT, com.sun.star.presentation.AnimationSpeed.FAST, 1, 0 ); // automatic object and slide transition - + // create a rectangle that is placed on the top left of the page xShapePropSet = ShapeHelper.createAndInsertShape( xDrawDoc, xShapes,new Point( 1000, 1000 ), new Size( 5000, 5000 ), @@ -117,7 +117,7 @@ public class PresentationDemo com.sun.star.presentation.AnimationEffect.WAVYLINE_FROM_BOTTOM ); /* the following three properties provokes that the shape is dimmed - to red + to red after the animation has been finished */ xShapePropSet.setPropertyValue( "DimHide", new Boolean( false ) ); xShapePropSet.setPropertyValue( "DimPrevious", new Boolean( true ) ); @@ -177,7 +177,7 @@ public class PresentationDemo UnoRuntime.queryInterface( XPropertySet.class, xShape ); xShapePropSet.setPropertyValue("Effect", com.sun.star.presentation.AnimationEffect.FADE_FROM_BOTTOM ); - + xShapePropSet.setPropertyValue( "OnClick", com.sun.star.presentation.ClickAction.BOOKMARK ); // set the name of page two, and use it with the bookmark action @@ -219,7 +219,7 @@ public class PresentationDemo // what type of page xPage is, for this purpose it can been tested // if the com.sun.star.presentation.DrawPage service is supported XServiceInfo xInfo = (XServiceInfo)UnoRuntime.queryInterface( - XServiceInfo.class, xPage ); + XServiceInfo.class, xPage ); if ( xInfo.supportsService( "com.sun.star.presentation.DrawPage" ) == true ) { try diff --git a/odk/examples/DevelopersGuide/Drawing/ShapeHelper.java b/odk/examples/DevelopersGuide/Drawing/ShapeHelper.java index 7959b642fe0f..72647f4fb680 100644 --- a/odk/examples/DevelopersGuide/Drawing/ShapeHelper.java +++ b/odk/examples/DevelopersGuide/Drawing/ShapeHelper.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -59,7 +59,7 @@ import com.sun.star.text.XTextRange; public class ShapeHelper { // __________ static helper methods __________ - // + // public static XPropertySet createAndInsertShape( XComponent xDrawDoc, XShapes xShapes, Point aPos, Size aSize, String sShapeType ) throws java.lang.Exception diff --git a/odk/examples/DevelopersGuide/Drawing/StyleDemo.java b/odk/examples/DevelopersGuide/Drawing/StyleDemo.java index 452526c1fcec..c5a3ad39ff1e 100644 --- a/odk/examples/DevelopersGuide/Drawing/StyleDemo.java +++ b/odk/examples/DevelopersGuide/Drawing/StyleDemo.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -97,7 +97,7 @@ public class StyleDemo (com.sun.star.style.XStyleFamiliesSupplier) UnoRuntime.queryInterface( com.sun.star.style.XStyleFamiliesSupplier.class, xModel ); - + com.sun.star.container.XNameAccess xFamilies = xSFS.getStyleFamilies(); // the element should now contain at least two Styles. The first is @@ -107,7 +107,7 @@ public class StyleDemo { // this is the family System.out.println( "\n" + Families[ i ] ); - + // and now all available styles Object aFamilyObj = xFamilies.getByName( Families[ i ] ); com.sun.star.container.XNameAccess xStyles = diff --git a/odk/examples/DevelopersGuide/Drawing/TextDemo.java b/odk/examples/DevelopersGuide/Drawing/TextDemo.java index 579f2167da09..cbc87a34d446 100644 --- a/odk/examples/DevelopersGuide/Drawing/TextDemo.java +++ b/odk/examples/DevelopersGuide/Drawing/TextDemo.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -82,12 +82,12 @@ public class TextDemo xDrawDoc = Helper.createDocument( xOfficeContext, "private:factory/sdraw", "_blank", 0, pPropValues ); - XDrawPage xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 ); + XDrawPage xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 ); XShapes xShapes = (XShapes) UnoRuntime.queryInterface( XShapes.class, xPage ); - XShape xRectangle; + XShape xRectangle; XPropertySet xTextPropSet, xShapePropSet; LineSpacing aLineSpacing = new LineSpacing(); aLineSpacing.Mode = LineSpacingMode.PROP; @@ -126,7 +126,7 @@ public class TextDemo xRectangle = ShapeHelper.createShape( xDrawDoc, new Point( 0, 10000 ), new Size( 21000, 12500 ), - "com.sun.star.drawing.RectangleShape" ); + "com.sun.star.drawing.RectangleShape" ); xShapes.add( xRectangle ); xShapePropSet = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, xRectangle ); diff --git a/odk/examples/DevelopersGuide/FirstSteps/FirstConnection.java b/odk/examples/DevelopersGuide/FirstSteps/FirstConnection.java index d38357fe4574..c965c6641512 100644 --- a/odk/examples/DevelopersGuide/FirstSteps/FirstConnection.java +++ b/odk/examples/DevelopersGuide/FirstSteps/FirstConnection.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ public class FirstConnection extends java.lang.Object { @@ -41,7 +41,7 @@ public class FirstConnection extends java.lang.Object { com.sun.star.comp.helper.Bootstrap.bootstrap(); System.out.println("Connected to a running office ..."); - + com.sun.star.lang.XMultiComponentFactory xMCF = xContext.getServiceManager(); diff --git a/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent.java b/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent.java index 6382c600a143..f4ef0922b8df 100644 --- a/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent.java +++ b/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; @@ -51,13 +51,13 @@ import com.sun.star.sheet.XSpreadsheetView; import com.sun.star.sheet.XSpreadsheets; import com.sun.star.table.XCell; import com.sun.star.uno.UnoRuntime; - + public class FirstLoadComponent { - + /** Creates a new instance of FirstLoadComponent */ public FirstLoadComponent() { } - + /** * @param args the command line arguments */ @@ -68,41 +68,41 @@ public class FirstLoadComponent { if (xRemoteContext == null) { System.err.println("ERROR: Could not bootstrap default Office."); } - + XMultiComponentFactory xRemoteServiceManager = xRemoteContext.getServiceManager(); - + Object desktop = xRemoteServiceManager.createInstanceWithContext( "com.sun.star.frame.Desktop", xRemoteContext); XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktop); - + PropertyValue[] loadProps = new PropertyValue[0]; XComponent xSpreadsheetComponent = xComponentLoader.loadComponentFromURL("private:factory/scalc", "_blank", 0, loadProps); - + XSpreadsheetDocument xSpreadsheetDocument = (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, xSpreadsheetComponent); - + XSpreadsheets xSpreadsheets = xSpreadsheetDocument.getSheets(); xSpreadsheets.insertNewByName("MySheet", (short)0); com.sun.star.uno.Type elemType = xSpreadsheets.getElementType(); - + System.out.println(elemType.getTypeName()); Object sheet = xSpreadsheets.getByName("MySheet"); XSpreadsheet xSpreadsheet = (XSpreadsheet)UnoRuntime.queryInterface( XSpreadsheet.class, sheet); - + XCell xCell = xSpreadsheet.getCellByPosition(0, 0); xCell.setValue(21); xCell = xSpreadsheet.getCellByPosition(0, 1); xCell.setValue(21); xCell = xSpreadsheet.getCellByPosition(0, 2); xCell.setFormula("=sum(A1:A2)"); - + XPropertySet xCellProps = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xCell); xCellProps.setPropertyValue("CellStyle", "Result"); - + XModel xSpreadsheetModel = (XModel)UnoRuntime.queryInterface( XModel.class, xSpreadsheetComponent); XController xSpreadsheetController = xSpreadsheetModel.getCurrentController(); @@ -110,32 +110,32 @@ public class FirstLoadComponent { UnoRuntime.queryInterface(XSpreadsheetView.class, xSpreadsheetController); xSpreadsheetView.setActiveSheet(xSpreadsheet); - + // ********************************************************* // example for use of enum types xCellProps.setPropertyValue("VertJustify", com.sun.star.table.CellVertJustify.TOP); - - + + // ********************************************************* // example for a sequence of PropertyValue structs // create an array with one PropertyValue struct, it contains // references only loadProps = new PropertyValue[1]; - + // instantiate PropertyValue struct and set its member fields PropertyValue asTemplate = new PropertyValue(); asTemplate.Name = "AsTemplate"; asTemplate.Value = new Boolean(true); - + // assign PropertyValue struct to array of references for PropertyValue // structs loadProps[0] = asTemplate; - + // load calc file as template //xSpreadsheetComponent = xComponentLoader.loadComponentFromURL( // "file:///c:/temp/DataAnalysys.ods", "_blank", 0, loadProps); - + // ********************************************************* // example for use of XEnumerationAccess XCellRangesQuery xCellQuery = (XCellRangesQuery) @@ -144,7 +144,7 @@ public class FirstLoadComponent { (short)com.sun.star.sheet.CellFlags.FORMULA); XEnumerationAccess xFormulas = xFormulaCells.getCells(); XEnumeration xFormulaEnum = xFormulas.createEnumeration(); - + while (xFormulaEnum.hasMoreElements()) { Object formulaCell = xFormulaEnum.nextElement(); xCell = (XCell)UnoRuntime.queryInterface(XCell.class, formulaCell); @@ -155,7 +155,7 @@ public class FirstLoadComponent { + ", row " + xCellAddress.getCellAddress().Row + " contains " + xCell.getFormula()); } - + } catch (java.lang.Exception e){ e.printStackTrace(); @@ -164,7 +164,7 @@ public class FirstLoadComponent { System.exit( 0 ); } } - + } @@ -196,17 +196,17 @@ public class FirstLoadComponent { // * @author dschulten // */ // public class FirstLoadComponent { - + // /** Creates a new instance of FirstLoadComponent */ // public FirstLoadComponent() { // } - + // /** // * @param args the command line arguments // */ // private XComponentContext xRemoteContext = null; // private XMultiComponentFactory xRemoteServiceManager = null; - + // public static void main(String[] args) { // FirstLoadComponent firstLoadComponent1 = new FirstLoadComponent(); // try { @@ -220,13 +220,13 @@ public class FirstLoadComponent { // System.exit(0); // } // } - + // private void useConnection() throws java.lang.Exception { // try { // // get the remote office component context // xRemoteContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); // System.out.println("Connected to a running office ..."); - + // xRemoteServiceManager = xRemoteContext.getServiceManager(); // } // catch( Exception e) { @@ -242,7 +242,7 @@ public class FirstLoadComponent { // PropertyValue[] loadProps = new PropertyValue[0]; // XComponent xSpreadsheetComponent = xComponentLoader.loadComponentFromURL("private:factory/scalc", "_blank", 0, loadProps); - + // XSpreadsheetDocument xSpreadsheetDocument = (XSpreadsheetDocument) // UnoRuntime.queryInterface(XSpreadsheetDocument.class, // xSpreadsheetComponent); @@ -250,7 +250,7 @@ public class FirstLoadComponent { // XSpreadsheets xSpreadsheets = xSpreadsheetDocument.getSheets(); // xSpreadsheets.insertNewByName("MySheet", (short)0); // com.sun.star.uno.Type elemType = xSpreadsheets.getElementType(); - + // System.out.println(elemType.getTypeName()); // Object sheet = xSpreadsheets.getByName("MySheet"); // XSpreadsheet xSpreadsheet = (XSpreadsheet)UnoRuntime.queryInterface( @@ -266,21 +266,21 @@ public class FirstLoadComponent { // XPropertySet xCellProps = (XPropertySet)UnoRuntime.queryInterface( // XPropertySet.class, xCell); // xCellProps.setPropertyValue("CellStyle", "Result"); - + // XModel xSpreadsheetModel = (XModel)UnoRuntime.queryInterface( // XModel.class, xSpreadsheetComponent); // XController xSpreadsheetController = xSpreadsheetModel.getCurrentController(); // XSpreadsheetView xSpreadsheetView = (XSpreadsheetView) // UnoRuntime.queryInterface(XSpreadsheetView.class, // xSpreadsheetController); -// xSpreadsheetView.setActiveSheet(xSpreadsheet); - +// xSpreadsheetView.setActiveSheet(xSpreadsheet); + // // ********************************************************* // // example for use of enum types // xCellProps.setPropertyValue("VertJustify", // com.sun.star.table.CellVertJustify.TOP); - + // // ********************************************************* // // example for a sequence of PropertyValue structs // // create an array with one PropertyValue struct, it contains @@ -299,7 +299,7 @@ public class FirstLoadComponent { // // load calc file as template // //xSpreadsheetComponent = xComponentLoader.loadComponentFromURL( // // "file:///c:/temp/DataAnalysys.ods", "_blank", 0, loadProps); - + // // ********************************************************* // // example for use of XEnumerationAccess // XCellRangesQuery xCellQuery = (XCellRangesQuery) @@ -308,7 +308,7 @@ public class FirstLoadComponent { // (short)com.sun.star.sheet.CellFlags.FORMULA); // XEnumerationAccess xFormulas = xFormulaCells.getCells(); // XEnumeration xFormulaEnum = xFormulas.createEnumeration(); - + // while (xFormulaEnum.hasMoreElements()) { // Object formulaCell = xFormulaEnum.nextElement(); // xCell = (XCell)UnoRuntime.queryInterface(XCell.class, formulaCell); @@ -319,11 +319,11 @@ public class FirstLoadComponent { // + ", row " + xCellAddress.getCellAddress().Row // + " contains " + xCell.getFormula()); // } - + // } // catch( com.sun.star.lang.DisposedException e ) { //works from Patch 1 // xRemoteContext = null; // throw e; -// } -// } +// } +// } // } diff --git a/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact.java b/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact.java index 24a5efa32154..4c8dd0966a16 100644 --- a/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact.java +++ b/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ public class FirstUnoContact { diff --git a/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape.java b/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape.java index 7c40da707d2d..047747e5bba5 100644 --- a/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape.java +++ b/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.lang.XComponent; @@ -418,7 +418,7 @@ public class HelloTextTableShape { int col = theLine.Color; System.out.println(col); } - + protected void manipulateShape(XShape xShape) throws com.sun.star.uno.Exception { XPropertySet xShapeProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xShape); xShapeProps.setPropertyValue("FillColor", new Integer(0x99CCFF)); @@ -428,7 +428,7 @@ public class HelloTextTableShape { xShapeProps.setPropertyValue("TextLeftDistance", new Integer(0)); xShapeProps.setPropertyValue("TextRightDistance", new Integer(0)); xShapeProps.setPropertyValue("TextUpperDistance", new Integer(0)); - xShapeProps.setPropertyValue("TextLowerDistance", new Integer(0)); + xShapeProps.setPropertyValue("TextLowerDistance", new Integer(0)); } @@ -449,13 +449,13 @@ public class HelloTextTableShape { // First step: get the remote office component context xRemoteContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); System.out.println("Connected to a running office ..."); - + xRemoteServiceManager = xRemoteContext.getServiceManager(); } catch( Exception e) { e.printStackTrace(); System.exit(1); - } + } } return xRemoteServiceManager; } diff --git a/odk/examples/DevelopersGuide/FirstSteps/build_FirstUnoContact.xml b/odk/examples/DevelopersGuide/FirstSteps/build_FirstUnoContact.xml index 15184aba7e4d..e2b534f8b498 100644 --- a/odk/examples/DevelopersGuide/FirstSteps/build_FirstUnoContact.xml +++ b/odk/examples/DevelopersGuide/FirstSteps/build_FirstUnoContact.xml @@ -4,23 +4,23 @@ <property environment="env"/> <property name="OFFICE_HOME" value="${env.OFFICE_HOME}"/> <property name="OO_SDK_HOME" value="${env.OO_SDK_HOME}"/> - + <target name="init"> <property name="OUTDIR" value="${OO_SDK_HOME}/WINExample.out/class/FirstUnoContact"/> </target> - <path id="office.class.path"> + <path id="office.class.path"> <filelist dir="${OFFICE_HOME}/program/classes" files="jurt.jar,unoil.jar,ridl.jar,juh.jar"/> - </path> - + </path> + <fileset id="bootstrap.glue.code" dir="${OO_SDK_HOME}/classes"> <patternset> <include name="com/sun/star/lib/loader/*.class"/> <include name="win/unowinreg.dll"/> </patternset> - </fileset> - + </fileset> + <target name="compile" depends="init"> <mkdir dir="${OUTDIR}"/> <javac debug="true" deprecation="true" destdir="${OUTDIR}" srcdir="."> @@ -29,7 +29,7 @@ </target> <target name="jar" depends="init,compile"> - <jar basedir="${OUTDIR}" compress="true" + <jar basedir="${OUTDIR}" compress="true" jarfile="${OUTDIR}/FirstUnoContact.jar"> <exclude name="**/*.java"/> <exclude name="*.jar"/> diff --git a/odk/examples/DevelopersGuide/Forms/ButtonOperator.java b/odk/examples/DevelopersGuide/Forms/ButtonOperator.java index 3b792e28ea22..b07b6e804137 100644 --- a/odk/examples/DevelopersGuide/Forms/ButtonOperator.java +++ b/odk/examples/DevelopersGuide/Forms/ButtonOperator.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // java base stuff import com.sun.star.awt.ActionEvent; @@ -50,12 +50,12 @@ import java.util.Vector; */ public class ButtonOperator implements XActionListener, XFeatureInvalidation { - private XComponentContext m_componentContext; - private DocumentHelper m_aDocument; + private XComponentContext m_componentContext; + private DocumentHelper m_aDocument; private XPropertySet m_form; private XFormOperations m_formOperations; - private Vector m_aButtons; + private Vector m_aButtons; /* ------------------------------------------------------------------ */ /** ctor diff --git a/odk/examples/DevelopersGuide/Forms/ComponentTreeTraversal.java b/odk/examples/DevelopersGuide/Forms/ComponentTreeTraversal.java index 60f46b54eca1..6501120d82f2 100644 --- a/odk/examples/DevelopersGuide/Forms/ComponentTreeTraversal.java +++ b/odk/examples/DevelopersGuide/Forms/ComponentTreeTraversal.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.uno.*; @@ -60,9 +60,9 @@ class ComponentTreeTraversal implements IFormComponentAction { // step down the tree, if possible XServiceInfo xSI = UNO.queryServiceInfo( xContainer ); - if ( null != xSI - && ( xSI.supportsService( "com.sun.star.form.FormComponents" ) - || xSI.supportsService( "com.sun.star.form.component.GridControl" ) + if ( null != xSI + && ( xSI.supportsService( "com.sun.star.form.FormComponents" ) + || xSI.supportsService( "com.sun.star.form.component.GridControl" ) ) ) { @@ -77,8 +77,8 @@ class ComponentTreeTraversal implements IFormComponentAction public void handle( Object aFormComponent ) throws com.sun.star.uno.Exception { XIndexContainer xCont = UNO.queryIndexContainer( aFormComponent ); - if ( ( null != xCont ) - && shouldStepInto( xCont ) + if ( ( null != xCont ) + && shouldStepInto( xCont ) ) { for ( int i=0; i<xCont.getCount(); ++i ) diff --git a/odk/examples/DevelopersGuide/Forms/ControlLock.java b/odk/examples/DevelopersGuide/Forms/ControlLock.java index 5dada0d8fca7..85cf988d9ae8 100644 --- a/odk/examples/DevelopersGuide/Forms/ControlLock.java +++ b/odk/examples/DevelopersGuide/Forms/ControlLock.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.uno.*; @@ -48,9 +48,9 @@ import com.sun.star.sdbc.*; class LockControlModels extends ComponentTreeTraversal { - private String m_sDataField; - private Boolean m_aLockIt; - private int m_nLevel; // nesting level relative to the form we started with + private String m_sDataField; + private Boolean m_aLockIt; + private int m_nLevel; // nesting level relative to the form we started with /* ------------------------------------------------------------------ */ public LockControlModels( String sDataField, boolean bLockIt ) @@ -64,7 +64,7 @@ class LockControlModels extends ComponentTreeTraversal protected boolean shouldStepInto( XIndexContainer xContainer ) throws com.sun.star.uno.Exception { if ( !super.shouldStepInto( xContainer ) ) - return false; // don't try to be more clever than our base class + return false; // don't try to be more clever than our base class XForm xForm = (XForm)UnoRuntime.queryInterface( XForm.class, xContainer ); if ( ( null != xForm ) && ( m_nLevel > 1 ) ) @@ -88,10 +88,10 @@ class LockControlModels extends ComponentTreeTraversal xPSI = xCompProps.getPropertySetInfo(); if ( ( null != xPSI ) && xPSI.hasPropertyByName( "DataField" ) ) - { // indeed it has .... + { // indeed it has .... String sDataField = (String)xCompProps.getPropertyValue( "DataField" ); if ( sDataField.equals( m_sDataField ) ) - { // we found a control model which is bound to what we're looking for + { // we found a control model which is bound to what we're looking for xCompProps.setPropertyValue( "ReadOnly", m_aLockIt ); } } @@ -112,10 +112,10 @@ class LockControlModels extends ComponentTreeTraversal */ class ControlLock implements XRowSetListener { - private XPropertySet m_xForm; - private String m_sDataField; - private boolean m_bLockingEnabled; - private boolean m_bPreviousRoundLock; + private XPropertySet m_xForm; + private String m_sDataField; + private boolean m_bLockingEnabled; + private boolean m_bPreviousRoundLock; /* ------------------------------------------------------------------ */ ControlLock( XPropertySet xForm, String sBoundDataField ) diff --git a/odk/examples/DevelopersGuide/Forms/ControlValidation.java b/odk/examples/DevelopersGuide/Forms/ControlValidation.java index 38e019ea72b0..f5aa1b087b7e 100644 --- a/odk/examples/DevelopersGuide/Forms/ControlValidation.java +++ b/odk/examples/DevelopersGuide/Forms/ControlValidation.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/odk/examples/DevelopersGuide/Forms/ControlValidator.java b/odk/examples/DevelopersGuide/Forms/ControlValidator.java index 0ce594633590..e4be47b3e8c3 100644 --- a/odk/examples/DevelopersGuide/Forms/ControlValidator.java +++ b/odk/examples/DevelopersGuide/Forms/ControlValidator.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/odk/examples/DevelopersGuide/Forms/DataAwareness.java b/odk/examples/DevelopersGuide/Forms/DataAwareness.java index 1bbe299872d0..bedf0b499cb9 100644 --- a/odk/examples/DevelopersGuide/Forms/DataAwareness.java +++ b/odk/examples/DevelopersGuide/Forms/DataAwareness.java @@ -149,19 +149,19 @@ public class DataAwareness extends DocumentBasedExample implements XPropertyChan private static final String s_tableNameCustomers = "CUSTOMERS"; private static final String s_tableNameSales = "SALES"; - private XPropertySet m_xMasterForm; - private ButtonOperator m_aOperator; - private SalesFilter m_aSalesFilter; + private XPropertySet m_xMasterForm; + private ButtonOperator m_aOperator; + private SalesFilter m_aSalesFilter; - private KeyGenerator m_aSalesmanKeyGenerator; - private KeyGenerator m_aSalesKeyGenerator; - private ControlLock m_aSalesmenLocker; - private ControlLock m_aSalesLocker; - private GridFieldValidator m_aSalesNameValidator; + private KeyGenerator m_aSalesmanKeyGenerator; + private KeyGenerator m_aSalesKeyGenerator; + private ControlLock m_aSalesmenLocker; + private ControlLock m_aSalesLocker; + private GridFieldValidator m_aSalesNameValidator; - private boolean m_bDefaultSalesDate; - private boolean m_bProtectKeyFields; - private boolean m_bAllowEmptySales; + private boolean m_bDefaultSalesDate; + private boolean m_bProtectKeyFields; + private boolean m_bAllowEmptySales; /* ------------------------------------------------------------------ */ public DataAwareness() @@ -225,10 +225,10 @@ public class DataAwareness extends DocumentBasedExample implements XPropertyChan { Boolean aIsNew = (Boolean)xFormProps.getPropertyValue( "IsNew" ); if ( aIsNew.booleanValue() ) - { // yepp + { // yepp if ( !m_bDefaultSalesDate ) - { // we're interested to do all this only if the user told us to default the sales date + { // we're interested to do all this only if the user told us to default the sales date // to "today" // As date fields do this defaulting automatically, the semantics is inverted here: // If we're told to default, we must do nothing, if we should not default, we must @@ -276,7 +276,7 @@ public class DataAwareness extends DocumentBasedExample implements XPropertyChan { // did it come from a radio button or checkbox? if ( aEvent.PropertyName.equals( "State" ) ) - { // yep + { // yep Short aNewState = (Short)aEvent.NewValue; XPropertySet xModel = UNO.queryPropertySet( aEvent.Source ); @@ -292,7 +292,7 @@ public class DataAwareness extends DocumentBasedExample implements XPropertyChan { // it's one of the options for key generation if ( sRefValue.equals( "none" ) ) - { // no automatic generation at all + { // no automatic generation at all m_aSalesmanKeyGenerator.stopGenerator( ); m_aSalesKeyGenerator.stopGenerator( ); } @@ -300,11 +300,11 @@ public class DataAwareness extends DocumentBasedExample implements XPropertyChan { boolean bGenerateOnReset = true; if ( sRefValue.equals( "update" ) ) - { // generate on update + { // generate on update bGenerateOnReset = ( 0 == nNewValue ); } else if ( sRefValue.equals( "reset" ) ) - { // generat on reset + { // generat on reset bGenerateOnReset = ( 0 != nNewValue ); } m_aSalesmanKeyGenerator.activateKeyGenerator( bGenerateOnReset ); @@ -413,7 +413,7 @@ public class DataAwareness extends DocumentBasedExample implements XPropertyChan String[] aCurrentFilter = (String[])xDSP.getPropertyValue( "TableFilter" ); // check if the table name is already part of it - String sAllTables = "*"; // all tables + String sAllTables = "*"; // all tables for ( int i=0; i<aCurrentFilter.length; ++i ) { @@ -692,7 +692,7 @@ public class DataAwareness extends DocumentBasedExample implements XPropertyChan // -------------------------------------------------------------- /* create some shapes */ - XPropertySet xSNRField = m_formLayer.insertControlLine( "NumericField", "SNR", "", 3 ); + XPropertySet xSNRField = m_formLayer.insertControlLine( "NumericField", "SNR", "", 3 ); m_formLayer.insertControlLine( "TextField", "FIRSTNAME", "", 11); m_formLayer.insertControlLine( "TextField", "LASTNAME", "", 19 ); m_formLayer.insertControlLine( "TextField", "STREET", "", 27 ); @@ -748,17 +748,17 @@ public class DataAwareness extends DocumentBasedExample implements XPropertyChan xSalesFormProps.setPropertyValue( "Command", sCommand ); // the master-details connection - String[] aMasterFields = new String[] { "SNR" }; // the field in the master form - String[] aDetailFields = new String[] { "salesmen" }; // the name in the detail form + String[] aMasterFields = new String[] { "SNR" }; // the field in the master form + String[] aDetailFields = new String[] { "salesmen" }; // the name in the detail form xSalesFormProps.setPropertyValue( "MasterFields", aMasterFields ); xSalesFormProps.setPropertyValue( "DetailFields", aDetailFields ); // the create thr grid model XPropertySet xSalesGridModel = m_formLayer.createControlAndShape( "GridControl", 2, 80, 162, 40, xSalesForm ); xSalesGridModel.setPropertyValue( "Name", "SalesTable" ); - XPropertySet xKeyColumn = createGridColumn( xSalesGridModel, "NumericField", "SALENR", 12 ); - XPropertySet xCustomerColumn = createGridColumn( xSalesGridModel, "ListBox", "COS_NR", 40 ); - XPropertySet xSalesNameColumn = createGridColumn( xSalesGridModel, "TextField", "NAME", 25 ); + XPropertySet xKeyColumn = createGridColumn( xSalesGridModel, "NumericField", "SALENR", 12 ); + XPropertySet xCustomerColumn = createGridColumn( xSalesGridModel, "ListBox", "COS_NR", 40 ); + XPropertySet xSalesNameColumn = createGridColumn( xSalesGridModel, "TextField", "NAME", 25 ); createGridColumn( xSalesGridModel, "DateField", "SALEDATE", 24 ); createGridColumn( xSalesGridModel, "CurrencyField", "PRICE", 16 ); diff --git a/odk/examples/DevelopersGuide/Forms/DateValidator.java b/odk/examples/DevelopersGuide/Forms/DateValidator.java index daa60523bffa..69ba9fd43b9b 100644 --- a/odk/examples/DevelopersGuide/Forms/DateValidator.java +++ b/odk/examples/DevelopersGuide/Forms/DateValidator.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/odk/examples/DevelopersGuide/Forms/DocumentBasedExample.java b/odk/examples/DevelopersGuide/Forms/DocumentBasedExample.java index fe055575bba5..9b572bf0735c 100644 --- a/odk/examples/DevelopersGuide/Forms/DocumentBasedExample.java +++ b/odk/examples/DevelopersGuide/Forms/DocumentBasedExample.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -69,7 +69,7 @@ public abstract class DocumentBasedExample implements com.sun.star.lang.XEventLi // get the remote office component context m_xCtx = com.sun.star.comp.helper.Bootstrap.bootstrap(); - System.out.println("Connected to a running office ..."); + System.out.println("Connected to a running office ..."); } catch (java.lang.Exception e) { @@ -190,7 +190,7 @@ public abstract class DocumentBasedExample implements com.sun.star.lang.XEventLi /* ------------------------------------------------------------------ */ /** waits for the user to press a key (on the console where she started the java program) or the document to be closed by the user. - + @return <TRUE/> if the user pressed a key on the console, <FALSE/> if she closed the document */ diff --git a/odk/examples/DevelopersGuide/Forms/DocumentHelper.java b/odk/examples/DevelopersGuide/Forms/DocumentHelper.java index 85aab025d7bd..6ec184e9c08b 100644 --- a/odk/examples/DevelopersGuide/Forms/DocumentHelper.java +++ b/odk/examples/DevelopersGuide/Forms/DocumentHelper.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/odk/examples/DevelopersGuide/Forms/DocumentType.java b/odk/examples/DevelopersGuide/Forms/DocumentType.java index 5ac8e3e1c5c3..6eea1e02256a 100644 --- a/odk/examples/DevelopersGuide/Forms/DocumentType.java +++ b/odk/examples/DevelopersGuide/Forms/DocumentType.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java b/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java index d95fbe452ce5..d5e9d145b33c 100644 --- a/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java +++ b/odk/examples/DevelopersGuide/Forms/DocumentViewHelper.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -49,9 +49,9 @@ import com.sun.star.view.XFormLayerAccess; */ class DocumentViewHelper { - private XMultiServiceFactory m_orb; + private XMultiServiceFactory m_orb; private XController m_controller; - private DocumentHelper m_document; + private DocumentHelper m_document; /* ------------------------------------------------------------------ */ final protected XController getController() diff --git a/odk/examples/DevelopersGuide/Forms/FLTools.java b/odk/examples/DevelopersGuide/Forms/FLTools.java index 3f87e77e1bd6..c50eb99149ba 100644 --- a/odk/examples/DevelopersGuide/Forms/FLTools.java +++ b/odk/examples/DevelopersGuide/Forms/FLTools.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.uno.*; @@ -96,7 +96,7 @@ public class FLTools XPropertySet xProps = UNO.queryPropertySet( aFormComponent ); XPropertySetInfo xPSI = ( null != xProps ) ? xProps.getPropertySetInfo() : null; if ( null == xPSI ) - { // no property set or no property set info + { // no property set or no property set info // can't do anything except falling back to the name return getName( aFormComponent ); } @@ -113,7 +113,7 @@ public class FLTools sLabel = (String)xProps.getPropertyValue( "Label" ); if ( 0 == sLabel.length() ) - { // no Label property or no label set + { // no Label property or no label set // -> fallback to the component name sLabel = getName( aFormComponent ); } @@ -145,7 +145,7 @@ public class FLTools XInterface xCurrent = (XInterface)UnoRuntime.queryInterface( XInterface.class, xIndexCont.getByIndex( 0 ) ); if ( xCurrent.equals( xElement ) ) - { // found + { // found nIndex = i; break; } @@ -225,24 +225,24 @@ public class FLTools switch ( nClassId.intValue() ) { case FormComponentType.COMMANDBUTTON: sType = "Command button"; break; - case FormComponentType.RADIOBUTTON : sType = "Radio button"; break; - case FormComponentType.IMAGEBUTTON : sType = "Image button"; break; - case FormComponentType.CHECKBOX : sType = "Check Box"; break; - case FormComponentType.LISTBOX : sType = "List Box"; break; - case FormComponentType.COMBOBOX : sType = "Combo Box"; break; - case FormComponentType.GROUPBOX : sType = "Group Box"; break; - case FormComponentType.FIXEDTEXT : sType = "Fixed Text"; break; - case FormComponentType.GRIDCONTROL : sType = "Grid Control"; break; - case FormComponentType.FILECONTROL : sType = "File Control"; break; + case FormComponentType.RADIOBUTTON : sType = "Radio button"; break; + case FormComponentType.IMAGEBUTTON : sType = "Image button"; break; + case FormComponentType.CHECKBOX : sType = "Check Box"; break; + case FormComponentType.LISTBOX : sType = "List Box"; break; + case FormComponentType.COMBOBOX : sType = "Combo Box"; break; + case FormComponentType.GROUPBOX : sType = "Group Box"; break; + case FormComponentType.FIXEDTEXT : sType = "Fixed Text"; break; + case FormComponentType.GRIDCONTROL : sType = "Grid Control"; break; + case FormComponentType.FILECONTROL : sType = "File Control"; break; case FormComponentType.HIDDENCONTROL: sType = "Hidden Control"; break; case FormComponentType.IMAGECONTROL : sType = "Image Control"; break; - case FormComponentType.DATEFIELD : sType = "Date Field"; break; - case FormComponentType.TIMEFIELD : sType = "Time Field"; break; + case FormComponentType.DATEFIELD : sType = "Date Field"; break; + case FormComponentType.TIMEFIELD : sType = "Time Field"; break; case FormComponentType.NUMERICFIELD : sType = "Numeric Field"; break; case FormComponentType.CURRENCYFIELD: sType = "Currency Field"; break; case FormComponentType.PATTERNFIELD : sType = "Pattern Field"; break; - case FormComponentType.TEXTFIELD : + case FormComponentType.TEXTFIELD : // there are two known services with this class id: the usual text field, // and the formatted field sType = "Text Field"; diff --git a/odk/examples/DevelopersGuide/Forms/FormLayer.java b/odk/examples/DevelopersGuide/Forms/FormLayer.java index 468937aacb83..e143e9e12546 100644 --- a/odk/examples/DevelopersGuide/Forms/FormLayer.java +++ b/odk/examples/DevelopersGuide/Forms/FormLayer.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java b/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java index 03e8a931d528..c50ae50f9582 100644 --- a/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java +++ b/odk/examples/DevelopersGuide/Forms/GridFieldValidator.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ /**************************************************************************/ @@ -52,11 +52,11 @@ import com.sun.star.task.*; */ class GridFieldValidator implements XUpdateListener { - private DocumentHelper m_aDocument; - private XComponentContext m_xCtx; - private XPropertySet m_xWatchedColumn; + private DocumentHelper m_aDocument; + private XComponentContext m_xCtx; + private XPropertySet m_xWatchedColumn; - private boolean m_bWatching; + private boolean m_bWatching; /* ------------------------------------------------------------------ */ public GridFieldValidator( XComponentContext xCtx, XPropertySet xWatchedGridColumn ) diff --git a/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java b/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java index 2d1ba453d914..9c5fbb7259d6 100644 --- a/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java +++ b/odk/examples/DevelopersGuide/Forms/HsqlDatabase.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/odk/examples/DevelopersGuide/Forms/InteractionRequest.java b/odk/examples/DevelopersGuide/Forms/InteractionRequest.java index 31b31c9ebd92..8547fdfcf5ab 100644 --- a/odk/examples/DevelopersGuide/Forms/InteractionRequest.java +++ b/odk/examples/DevelopersGuide/Forms/InteractionRequest.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.uno.*; @@ -41,8 +41,8 @@ import java.util.Vector; */ class InteractionRequest implements XInteractionRequest { - private Object m_aRequest; - private Vector m_aContinuations; + private Object m_aRequest; + private Vector m_aContinuations; /* ------------------------------------------------------------------ */ public InteractionRequest( Object aRequest ) diff --git a/odk/examples/DevelopersGuide/Forms/KeyGenerator.java b/odk/examples/DevelopersGuide/Forms/KeyGenerator.java index 21012abb046e..324090ef9109 100644 --- a/odk/examples/DevelopersGuide/Forms/KeyGenerator.java +++ b/odk/examples/DevelopersGuide/Forms/KeyGenerator.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.uno.*; @@ -182,8 +182,8 @@ class UniqueColumnValue class KeyGeneratorForReset extends UniqueColumnValue implements XResetListener { /* ------------------------------------------------------------------ */ - private DocumentViewHelper m_aView; - private String m_sFieldName; + private DocumentViewHelper m_aView; + private String m_sFieldName; /* ------------------------------------------------------------------ */ /** ctor @@ -255,7 +255,7 @@ class KeyGeneratorForReset extends UniqueColumnValue implements XResetListener { Boolean aIsNew = (Boolean)xFormProps.getPropertyValue( "IsNew" ); if ( aIsNew.booleanValue() ) - { // yepp + { // yepp // we're going to modify the record, though after that, to the user, it should look // like it has not been modified @@ -295,7 +295,7 @@ class KeyGeneratorForReset extends UniqueColumnValue implements XResetListener class KeyGeneratorForUpdate extends UniqueColumnValue implements XRowSetApproveListener { /* ------------------------------------------------------------------ */ - private String m_sFieldName; + private String m_sFieldName; /* ------------------------------------------------------------------ */ public KeyGeneratorForUpdate( String sFieldName ) @@ -354,13 +354,13 @@ class KeyGeneratorForUpdate extends UniqueColumnValue implements XRowSetApproveL public class KeyGenerator { /* ------------------------------------------------------------------ */ - private KeyGeneratorForReset m_aResetKeyGenerator; - private KeyGeneratorForUpdate m_aUpdateKeyGenerator; - private boolean m_bResetListening; - private boolean m_bUpdateListening; + private KeyGeneratorForReset m_aResetKeyGenerator; + private KeyGeneratorForUpdate m_aUpdateKeyGenerator; + private boolean m_bResetListening; + private boolean m_bUpdateListening; - private DocumentHelper m_aDocument; - private XPropertySet m_xForm; + private DocumentHelper m_aDocument; + private XPropertySet m_xForm; /* ------------------------------------------------------------------ */ /** ctor diff --git a/odk/examples/DevelopersGuide/Forms/ListSelectionValidator.java b/odk/examples/DevelopersGuide/Forms/ListSelectionValidator.java index 6f605eaa3592..845d68025fc2 100644 --- a/odk/examples/DevelopersGuide/Forms/ListSelectionValidator.java +++ b/odk/examples/DevelopersGuide/Forms/ListSelectionValidator.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/odk/examples/DevelopersGuide/Forms/NumericValidator.java b/odk/examples/DevelopersGuide/Forms/NumericValidator.java index 220996666e95..350d776d0e0a 100644 --- a/odk/examples/DevelopersGuide/Forms/NumericValidator.java +++ b/odk/examples/DevelopersGuide/Forms/NumericValidator.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/odk/examples/DevelopersGuide/Forms/RowSet.java b/odk/examples/DevelopersGuide/Forms/RowSet.java index f21b26b4d7f8..f123ae6a8cfe 100644 --- a/odk/examples/DevelopersGuide/Forms/RowSet.java +++ b/odk/examples/DevelopersGuide/Forms/RowSet.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/odk/examples/DevelopersGuide/Forms/SalesFilter.java b/odk/examples/DevelopersGuide/Forms/SalesFilter.java index fa6e9d19abc7..c461d5cac007 100644 --- a/odk/examples/DevelopersGuide/Forms/SalesFilter.java +++ b/odk/examples/DevelopersGuide/Forms/SalesFilter.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.uno.*; @@ -51,18 +51,18 @@ import java.util.GregorianCalendar; */ class SalesFilter implements XActionListener, XPropertyChangeListener, XResetListener { - private DocumentHelper m_aDocument; - private XPropertySet m_xSalesForm; + private DocumentHelper m_aDocument; + private XPropertySet m_xSalesForm; - private XPropertySet m_xFilterList; - private XPropertySet m_xManualFilter; - private XPropertySet m_xApplyFilter; + private XPropertySet m_xFilterList; + private XPropertySet m_xManualFilter; + private XPropertySet m_xApplyFilter; - private boolean m_bSettingsDirty; - private boolean m_bSettingDate; - private boolean m_bAdjustingFilterList; - private short m_nPreviousFilterIndex; - private java.util.Vector m_aFilterDates; + private boolean m_bSettingsDirty; + private boolean m_bSettingDate; + private boolean m_bAdjustingFilterList; + private short m_nPreviousFilterIndex; + private java.util.Vector m_aFilterDates; /* ------------------------------------------------------------------ */ public SalesFilter( DocumentHelper aDocument, XPropertySet xSalesForm, @@ -298,7 +298,7 @@ class SalesFilter implements XActionListener, XPropertyChangeListener, XResetLis try { if ( isManualFilter( m_nPreviousFilterIndex ) ) - { // previously, the "custom" filter date was selected + { // previously, the "custom" filter date was selected // -> remember the date entered Object aDate = translateDate( m_xManualFilter.getPropertyValue( "Date" ) ); m_aFilterDates.set( m_nPreviousFilterIndex, aDate ); @@ -351,9 +351,9 @@ class SalesFilter implements XActionListener, XPropertyChangeListener, XResetLis // both are null return true; - return ( aLHS.get( Calendar.YEAR ) == aRHS.get( Calendar.YEAR ) ) - && ( aLHS.get( Calendar.MONTH ) == aRHS.get( Calendar.MONTH ) ) - && ( aLHS.get( Calendar.DAY_OF_MONTH ) == aRHS.get( Calendar.DAY_OF_MONTH ) ); + return ( aLHS.get( Calendar.YEAR ) == aRHS.get( Calendar.YEAR ) ) + && ( aLHS.get( Calendar.MONTH ) == aRHS.get( Calendar.MONTH ) ) + && ( aLHS.get( Calendar.DAY_OF_MONTH ) == aRHS.get( Calendar.DAY_OF_MONTH ) ); } /* ------------------------------------------------------------------ */ @@ -377,7 +377,7 @@ class SalesFilter implements XActionListener, XPropertyChangeListener, XResetLis // check if this date is already present in the list of user defined dates for ( int i=0; i<m_aFilterDates.size(); ++i ) { - if ( !isManualFilter( (short)i ) ) // do not compare with the manual filter + if ( !isManualFilter( (short)i ) ) // do not compare with the manual filter { GregorianCalendar aCheckCal = getCalendarObject( (java.util.Date)m_aFilterDates.elementAt( i ) ); if ( equalDate( aDateCal, aCheckCal ) ) @@ -386,7 +386,7 @@ class SalesFilter implements XActionListener, XPropertyChangeListener, XResetLis } System.out.println( ); - if ( aFilterItems.size() > 10 ) // (6 standard items + 5 user defined items) + if ( aFilterItems.size() > 10 ) // (6 standard items + 5 user defined items) { // the first (and thus oldes) user defined item aFilterItems.removeElementAt( 6 ); @@ -442,7 +442,7 @@ class SalesFilter implements XActionListener, XPropertyChangeListener, XResetLis XLoadable.class, m_xSalesForm ); xLoad.reload(); - m_aDocument.getCurrentView().grabControlFocus( m_xFilterList ); + m_aDocument.getCurrentView().grabControlFocus( m_xFilterList ); } catch ( java.lang.Exception e ) { diff --git a/odk/examples/DevelopersGuide/Forms/SingleControlValidation.java b/odk/examples/DevelopersGuide/Forms/SingleControlValidation.java index f12d813f9a9c..56bcd46372f1 100644 --- a/odk/examples/DevelopersGuide/Forms/SingleControlValidation.java +++ b/odk/examples/DevelopersGuide/Forms/SingleControlValidation.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/odk/examples/DevelopersGuide/Forms/SpreadsheetDocument.java b/odk/examples/DevelopersGuide/Forms/SpreadsheetDocument.java index b0abe5139c30..38f1c490abec 100644 --- a/odk/examples/DevelopersGuide/Forms/SpreadsheetDocument.java +++ b/odk/examples/DevelopersGuide/Forms/SpreadsheetDocument.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/odk/examples/DevelopersGuide/Forms/SpreadsheetValueBinding.java b/odk/examples/DevelopersGuide/Forms/SpreadsheetValueBinding.java index 716cc72dc2f4..23215c80bf03 100644 --- a/odk/examples/DevelopersGuide/Forms/SpreadsheetValueBinding.java +++ b/odk/examples/DevelopersGuide/Forms/SpreadsheetValueBinding.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java b/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java index 77b37e3b2258..c92af746781f 100644 --- a/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java +++ b/odk/examples/DevelopersGuide/Forms/SpreadsheetView.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -42,7 +42,7 @@ import com.sun.star.container.*; */ public class SpreadsheetView extends DocumentViewHelper { - + /** Creates a new instance of SpreadsheetView */ public SpreadsheetView( XMultiServiceFactory orb, DocumentHelper document, XController controller ) { diff --git a/odk/examples/DevelopersGuide/Forms/TableCellTextBinding.java b/odk/examples/DevelopersGuide/Forms/TableCellTextBinding.java index 40bd460ad2b8..e95e02a7e452 100644 --- a/odk/examples/DevelopersGuide/Forms/TableCellTextBinding.java +++ b/odk/examples/DevelopersGuide/Forms/TableCellTextBinding.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/odk/examples/DevelopersGuide/Forms/TextValidator.java b/odk/examples/DevelopersGuide/Forms/TextValidator.java index 6ca0528137cc..f304a1f6a596 100644 --- a/odk/examples/DevelopersGuide/Forms/TextValidator.java +++ b/odk/examples/DevelopersGuide/Forms/TextValidator.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/odk/examples/DevelopersGuide/Forms/TimeValidator.java b/odk/examples/DevelopersGuide/Forms/TimeValidator.java index d98b66b19416..45135392a2ec 100644 --- a/odk/examples/DevelopersGuide/Forms/TimeValidator.java +++ b/odk/examples/DevelopersGuide/Forms/TimeValidator.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/odk/examples/DevelopersGuide/Forms/UNO.java b/odk/examples/DevelopersGuide/Forms/UNO.java index 39540613d478..55152172b37f 100644 --- a/odk/examples/DevelopersGuide/Forms/UNO.java +++ b/odk/examples/DevelopersGuide/Forms/UNO.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.uno.*; @@ -78,7 +78,7 @@ public class UNO return (XTablesSupplier)UnoRuntime.queryInterface( XTablesSupplier.class, aObject ); } -/* replace Foo with the identifier of your choice. +/* replace Foo with the identifier of your choice. Why does Java not have templates? diff --git a/odk/examples/DevelopersGuide/Forms/URLHelper.java b/odk/examples/DevelopersGuide/Forms/URLHelper.java index 97c9a6bb8403..7099dd96a96d 100644 --- a/odk/examples/DevelopersGuide/Forms/URLHelper.java +++ b/odk/examples/DevelopersGuide/Forms/URLHelper.java @@ -1,23 +1,23 @@ /* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. - * + * * OpenOffice.org - a multi-platform office productivity suite - * + * * This file is part of OpenOffice.org. - * + * * OpenOffice.org is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 * only, as published by the Free Software Foundation. - * + * * OpenOffice.org is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License version 3 for more details * (a copy is included in the LICENSE file that accompanied this code). - * + * * You should have received a copy of the GNU Lesser General Public License * version 3 along with OpenOffice.org. If not, see * <http://www.openoffice.org/license.html> diff --git a/odk/examples/DevelopersGuide/Forms/ValueBinding.java b/odk/examples/DevelopersGuide/Forms/ValueBinding.java index 0446ba313f37..f577e64ce221 100644 --- a/odk/examples/DevelopersGuide/Forms/ValueBinding.java +++ b/odk/examples/DevelopersGuide/Forms/ValueBinding.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/odk/examples/DevelopersGuide/Forms/WaitForInput.java b/odk/examples/DevelopersGuide/Forms/WaitForInput.java index 4017906f1bcb..e74dc39b942a 100644 --- a/odk/examples/DevelopersGuide/Forms/WaitForInput.java +++ b/odk/examples/DevelopersGuide/Forms/WaitForInput.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -26,8 +26,8 @@ ************************************************************************/ class WaitForInput extends java.lang.Thread { - private Object m_aToNotify; - private boolean m_bDone; + private Object m_aToNotify; + private boolean m_bDone; public WaitForInput( Object aToNotify ) { diff --git a/odk/examples/DevelopersGuide/GUI/DialogDocument.java b/odk/examples/DevelopersGuide/GUI/DialogDocument.java index 5edefb8b118e..0d6f29d2a1ed 100644 --- a/odk/examples/DevelopersGuide/GUI/DialogDocument.java +++ b/odk/examples/DevelopersGuide/GUI/DialogDocument.java @@ -51,11 +51,11 @@ import com.sun.star.uno.XComponentContext; public class DialogDocument extends UnoDialogSample { - + public DialogDocument(XComponentContext _xContext, XMultiComponentFactory _xMCF) { super(_xContext, _xMCF); } - + public static void main(String args[]){ DialogDocument oDialogDocument = null; try { @@ -75,8 +75,8 @@ public class DialogDocument extends UnoDialogSample { // add the model to the NameContainer of the dialog model oDialogDocument.m_xDlgModelNameContainer.insertByName("Headerlabel", oFTHeaderModel); oDialogDocument.showDocumentinDialogWindow(oDialogDocument.m_xWindowPeer, new Rectangle(40, 50, 420, 550), "private:factory/swriter"); - - oDialogDocument.insertButton(oDialogDocument, 126, 370, 50, "~Close dialog", (short) PushButtonType.OK_value); + + oDialogDocument.insertButton(oDialogDocument, 126, 370, 50, "~Close dialog", (short) PushButtonType.OK_value); oDialogDocument.executeDialog(); }catch( Exception ex ) { ex.printStackTrace(System.out); @@ -88,16 +88,16 @@ public class DialogDocument extends UnoDialogSample { } } } - + System.exit( 0 ); } - + public void showDocumentinDialogWindow(XWindowPeer _xParentWindowPeer, Rectangle _aRectangle, String _sUrl){ try { // The Toolkit is the creator of all windows... Object oToolkit = m_xMCF.createInstanceWithContext("com.sun.star.awt.Toolkit", m_xContext); XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, oToolkit); - + // set up a window description and create the window. A parent window is always necessary for this... com.sun.star.awt.WindowDescriptor aWindowDescriptor = new com.sun.star.awt.WindowDescriptor(); // a simple window is enough for this purpose... @@ -107,20 +107,20 @@ public class DialogDocument extends UnoDialogSample { aWindowDescriptor.Parent = _xParentWindowPeer; aWindowDescriptor.ParentIndex = 1; aWindowDescriptor.Bounds = _aRectangle; - + // set the window attributes... // The attribute CLIPCHILDREN causes the parent to not repaint the areas of the children... aWindowDescriptor.WindowAttributes = VclWindowPeerAttribute.CLIPCHILDREN + WindowAttribute.BORDER + WindowAttribute.SHOW; XWindowPeer xWindowPeer = xToolkit.createWindow(aWindowDescriptor); XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xWindowPeer); XView xView = (XView) UnoRuntime.queryInterface(XView.class, xWindow); - + // create a frame and initialize it with the created window... Object oFrame = m_xMCF.createInstanceWithContext("com.sun.star.frame.Frame", m_xContext); // The frame should be of global scope because it's within the responsibility to dispose it after usage m_xFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, oFrame); m_xFrame.initialize(xWindow); - + // load the document and open it in preview mode XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, m_xFrame); PropertyValue[] aPropertyValues = new PropertyValue[2]; @@ -141,5 +141,5 @@ public class DialogDocument extends UnoDialogSample { throw new java.lang.RuntimeException("cannot happen..."); } } - + } diff --git a/odk/examples/DevelopersGuide/GUI/ImageControlSample.java b/odk/examples/DevelopersGuide/GUI/ImageControlSample.java index 024894ae840b..0a875152cffe 100644 --- a/odk/examples/DevelopersGuide/GUI/ImageControlSample.java +++ b/odk/examples/DevelopersGuide/GUI/ImageControlSample.java @@ -53,7 +53,7 @@ public class ImageControlSample extends UnoDialogSample{ super(_xContext, _xMCF); super.createDialog(_xMCF); } - + // to start this script pass a parameter denoting the system path to a graphic to be displayed public static void main(String args[]) { ImageControlSample oImageControlSample = null; @@ -78,7 +78,7 @@ public class ImageControlSample extends UnoDialogSample{ // add the model to the NameContainer of the dialog model oImageControlSample.m_xDlgModelNameContainer.insertByName("Headerlabel", oFTHeaderModel); XPropertySet xICModelPropertySet = oImageControlSample.insertImageControl(xMCF, 68, 30, 32, 90); - oImageControlSample.insertButton(oImageControlSample, 90, 75, 50, "~Close dialog", (short) PushButtonType.OK_value); + oImageControlSample.insertButton(oImageControlSample, 90, 75, 50, "~Close dialog", (short) PushButtonType.OK_value); oImageControlSample.createWindowPeer(); // note: due to issue i76718 ("Setting graphic at a controlmodel required dialog peer") the graphic of the image control // may not be set before the peer of the dialog has been created. @@ -99,15 +99,15 @@ public class ImageControlSample extends UnoDialogSample{ } System.exit( 0 ); } - - + + public XPropertySet insertImageControl(XMultiComponentFactory _xMCF, int _nPosX, int _nPosY, int _nHeight, int _nWidth){ XPropertySet xICModelPropertySet = null; try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "ImageControl"); // convert the system path to the image to a FileUrl - + // create a controlmodel at the multiservicefactory of the dialog model... Object oICModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlImageControlModel"); XMultiPropertySet xICModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oICModel); @@ -117,7 +117,7 @@ public class ImageControlSample extends UnoDialogSample{ xICModelMPSet.setPropertyValues( new String[] {"Border", "Height", "Name", "PositionX", "PositionY", "ScaleImage", "Width"}, new Object[] { new Short((short) 1), new Integer(_nHeight), sName, new Integer(_nPosX), new Integer(_nPosY), Boolean.FALSE, new Integer(_nWidth)}); - + // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oICModel); }catch (com.sun.star.uno.Exception ex){ @@ -134,8 +134,8 @@ public class ImageControlSample extends UnoDialogSample{ } return xICModelPropertySet; } - - + + // creates a UNO graphic object that can be used to be assigned // to the property "Graphic" of a controlmodel public XGraphic getGraphic(XMultiComponentFactory _xMCF, String _sImageSystemPath){ @@ -145,7 +145,7 @@ public class ImageControlSample extends UnoDialogSample{ Object oFCProvider = _xMCF.createInstanceWithContext("com.sun.star.ucb.FileContentProvider", this.m_xContext); XFileIdentifierConverter xFileIdentifierConverter = (XFileIdentifierConverter) UnoRuntime.queryInterface(XFileIdentifierConverter.class, oFCProvider); String sImageUrl = xFileIdentifierConverter.getFileURLFromSystemPath(_sImageSystemPath, oFile.getAbsolutePath()); - + // create a GraphicProvider at the global service manager... Object oGraphicProvider = m_xMCF.createInstanceWithContext("com.sun.star.graphic.GraphicProvider", m_xContext); XGraphicProvider xGraphicProvider = (XGraphicProvider) UnoRuntime.queryInterface(XGraphicProvider.class, oGraphicProvider); diff --git a/odk/examples/DevelopersGuide/GUI/MessageBox.java b/odk/examples/DevelopersGuide/GUI/MessageBox.java index 745b25951cd5..1fec55b801ca 100644 --- a/odk/examples/DevelopersGuide/GUI/MessageBox.java +++ b/odk/examples/DevelopersGuide/GUI/MessageBox.java @@ -53,29 +53,29 @@ import com.sun.star.uno.XComponentContext; public class MessageBox { - + protected XComponentContext m_xContext = null; protected com.sun.star.lang.XMultiComponentFactory m_xMCF; - + /** Creates a new instance of MessageBox */ public MessageBox(XComponentContext _xContext, XMultiComponentFactory _xMCF){ m_xContext = _xContext; m_xMCF = _xMCF; } - + public static void main(String args[]) { XComponent xComp = null; try { XComponentContext xContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); if(xContext != null ) System.out.println("Connected to a running office ..."); - XMultiComponentFactory xMCF = xContext.getServiceManager(); - + XMultiComponentFactory xMCF = xContext.getServiceManager(); + MessageBox oMessageBox = new MessageBox(xContext, xMCF); - + //load default text document to get an active frame xComp = oMessageBox.createDefaultTextDocument(); - + XWindowPeer xWindowPeer = oMessageBox.getWindowPeerOfFrame(xComp); if (xWindowPeer != null) { XVclWindowPeer xVclWindowPeer = (XVclWindowPeer) UnoRuntime.queryInterface(XVclWindowPeer.class, xWindowPeer); @@ -84,7 +84,7 @@ public class MessageBox { } else{ System.out.println("Could not retrieve current frame"); } - + } catch( Exception e ) { System.err.println( e + e.getMessage()); e.printStackTrace(); @@ -99,33 +99,33 @@ public class MessageBox { } } catch (com.sun.star.util.CloseVetoException e) { System.err.println( e + e.getMessage()); - e.printStackTrace(); + e.printStackTrace(); } } } - + System.exit( 0 ); } - - // helper method to get the window peer of a document or if no + + // helper method to get the window peer of a document or if no // document is specified it tries to get the avtive frame // which is potentially dangerous public XWindowPeer getWindowPeerOfFrame(XComponent xComp) { try { XFrame xFrame = null; - + if (xComp != null) { XModel xModel = (XModel)UnoRuntime.queryInterface(XModel.class, xComp); xFrame = xModel.getCurrentController().getFrame(); - + } else { // Note: This method is potentially dangerous and should only be used for debugging // purposes as it relies on the platform dependent window handler.. Object oDesktop = m_xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", m_xContext); XFramesSupplier xFramesSupplier = (XFramesSupplier) UnoRuntime.queryInterface(XFramesSupplier.class, oDesktop); - xFrame = xFramesSupplier.getActiveFrame(); + xFrame = xFramesSupplier.getActiveFrame(); } - + if (xFrame != null){ XWindow xWindow = xFrame.getContainerWindow(); if (xWindow != null){ @@ -140,9 +140,9 @@ public class MessageBox { } XComponent createDefaultTextDocument() { - + XComponent xComp = null; - try { + try { Object oDesktop = m_xMCF.createInstanceWithContext( "com.sun.star.frame.Desktop", m_xContext); @@ -150,7 +150,7 @@ public class MessageBox { // text document com.sun.star.frame.XComponentLoader xCLoader =(com.sun.star.frame.XComponentLoader) UnoRuntime.queryInterface(com.sun.star.frame.XComponentLoader.class,oDesktop); - + com.sun.star.beans.PropertyValue[] args = new com.sun.star.beans.PropertyValue [1]; args[0] = new com.sun.star.beans.PropertyValue(); args[0].Name = "Hidden"; @@ -158,13 +158,13 @@ public class MessageBox { String strDoc = "private:factory/swriter"; xComp = xCLoader.loadComponentFromURL(strDoc, "_blank", 0, args); - + } catch(com.sun.star.uno.Exception ex) { ex.printStackTrace(); } return xComp; } - + /** shows an error messagebox * @param _xParentWindowPeer the windowpeer of the parent window * @param _sTitle the title of the messagebox @@ -191,14 +191,14 @@ public class MessageBox { } } } - - + + /** @param _xVclWindowPeer the windowpeer of a dialog control or the dialog itself * @return true if HighContrastMode is activated or false if HighContrastMode is deactivated */ public boolean isHighContrastModeActivated(XVclWindowPeer _xVclWindowPeer) { boolean bIsActivated = false; - + try { if (_xVclWindowPeer != null){ int nUIColor = AnyConverter.toInt(_xVclWindowPeer.getProperty("DisplayBackgroundColor")); @@ -216,7 +216,7 @@ public class MessageBox { } return bIsActivated; } - + public static int getRedColorShare(int _nColor) { int nRed = (int) _nColor/65536; int nRedModulo = _nColor % 65536; @@ -225,14 +225,14 @@ public class MessageBox { int nBlue = nGreenModulo; return nRed; } - + public static int getGreenColorShare(int _nColor) { int nRed = (int) _nColor/65536; int nRedModulo = _nColor % 65536; int nGreen = (int) (nRedModulo / 256); return nGreen; } - + public static int getBlueColorShare(int _nColor) { int nRed = (int) _nColor/65536; int nRedModulo = _nColor % 65536; @@ -241,5 +241,5 @@ public class MessageBox { int nBlue = nGreenModulo; return nBlue; } - + } diff --git a/odk/examples/DevelopersGuide/GUI/RoadmapItemStateChangeListener.java b/odk/examples/DevelopersGuide/GUI/RoadmapItemStateChangeListener.java index a52928cb4be0..834517e4b6cd 100644 --- a/odk/examples/DevelopersGuide/GUI/RoadmapItemStateChangeListener.java +++ b/odk/examples/DevelopersGuide/GUI/RoadmapItemStateChangeListener.java @@ -41,11 +41,11 @@ import com.sun.star.uno.UnoRuntime; public class RoadmapItemStateChangeListener implements XItemListener { protected com.sun.star.lang.XMultiServiceFactory m_xMSFDialogModel; - + public RoadmapItemStateChangeListener(com.sun.star.lang.XMultiServiceFactory xMSFDialogModel) { m_xMSFDialogModel = xMSFDialogModel; } - + public void itemStateChanged(com.sun.star.awt.ItemEvent itemEvent) { try { // get the new ID of the roadmap that is supposed to refer to the new step of the dialogmodel @@ -61,7 +61,7 @@ public class RoadmapItemStateChangeListener implements XItemListener { exception.printStackTrace(System.out); } } - + public void disposing(EventObject eventObject) { } } diff --git a/odk/examples/DevelopersGuide/GUI/SystemDialog.java b/odk/examples/DevelopersGuide/GUI/SystemDialog.java index 00aa44162442..c20718dfc300 100644 --- a/odk/examples/DevelopersGuide/GUI/SystemDialog.java +++ b/odk/examples/DevelopersGuide/GUI/SystemDialog.java @@ -46,16 +46,16 @@ import com.sun.star.uno.XComponentContext; public class SystemDialog { - + protected XComponentContext m_xContext = null; protected com.sun.star.lang.XMultiComponentFactory m_xMCF; - + /** Creates a new instance of MessageBox */ public SystemDialog(XComponentContext _xContext, XMultiComponentFactory _xMCF){ m_xContext = _xContext; m_xMCF = _xMCF; } - + public static void main(String args[]){ try { XComponentContext xContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); @@ -72,8 +72,8 @@ public class SystemDialog { System.exit( 0 ); } - - + + public String raiseSaveAsDialog() { String sStorePath = ""; XComponent xComponent = null; @@ -81,37 +81,37 @@ public class SystemDialog { // the filepicker is instantiated with the global Multicomponentfactory... Object oFilePicker = m_xMCF.createInstanceWithContext("com.sun.star.ui.dialogs.FilePicker", m_xContext); XFilePicker xFilePicker = (XFilePicker) UnoRuntime.queryInterface(XFilePicker.class, oFilePicker); - + // the defaultname is the initially proposed filename.. xFilePicker.setDefaultName("MyExampleDocument"); - + // set the initial displaydirectory. In this example the user template directory is used Object oPathSettings = m_xMCF.createInstanceWithContext("com.sun.star.util.PathSettings",m_xContext); XPropertySet xPropertySet = (XPropertySet) com.sun.star.uno.UnoRuntime.queryInterface(XPropertySet.class, oPathSettings); String sTemplateUrl = (String) xPropertySet.getPropertyValue("Template_writable"); xFilePicker.setDisplayDirectory(sTemplateUrl); - + // set the filters of the dialog. The filternames may be retrieved from // http://wiki.services.openoffice.org/wiki/Framework/Article/Filter XFilterManager xFilterManager = (XFilterManager) UnoRuntime.queryInterface(XFilterManager.class, xFilePicker); xFilterManager.appendFilter("OpenDocument Text Template", "writer8_template"); xFilterManager.appendFilter("OpenDocument Text", "writer8"); - + // choose the template that defines the capabilities of the filepicker dialog XInitialization xInitialize = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, xFilePicker); Short[] listAny = new Short[] { new Short(com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_AUTOEXTENSION)}; xInitialize.initialize(listAny); - + // add a control to the dialog to add the extension automatically to the filename... XFilePickerControlAccess xFilePickerControlAccess = (XFilePickerControlAccess) UnoRuntime.queryInterface(XFilePickerControlAccess.class, xFilePicker); xFilePickerControlAccess.setValue(com.sun.star.ui.dialogs.ExtendedFilePickerElementIds.CHECKBOX_AUTOEXTENSION, (short) 0, new Boolean(true)); - + xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xFilePicker); - + // execute the dialog... XExecutableDialog xExecutable = (XExecutableDialog) UnoRuntime.queryInterface(XExecutableDialog.class, xFilePicker); short nResult = xExecutable.execute(); - + // query the resulting path of the dialog... if (nResult == com.sun.star.ui.dialogs.ExecutableDialogResults.OK){ String[] sPathList = xFilePicker.getFiles(); @@ -129,7 +129,7 @@ public class SystemDialog { } return sStorePath; } - + public String getWorkPath(){ String sWorkUrl = ""; try{ @@ -142,7 +142,7 @@ public class SystemDialog { } return sWorkUrl; } - + /** raises a folderpicker in which the user can browse and select a path * @param _sDisplayDirectory the path to the directory that is initially displayed * @param _sTitle the title of the folderpicker @@ -165,12 +165,12 @@ public class SystemDialog { xFolderPicker.setTitle(_sTitle); // show the dialog... short nResult = xExecutable.execute(); - + // User has clicked "Select" button... if (nResult == com.sun.star.ui.dialogs.ExecutableDialogResults.OK){ sReturnFolder = xFolderPicker.getDirectory(); } - + }catch( Exception exception ) { exception.printStackTrace(System.out); } finally{ diff --git a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java index 4013dbb79e66..043fff2a3d4e 100644 --- a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java +++ b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java @@ -115,8 +115,8 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis protected XTopWindow m_xTopWindow = null; protected XFrame m_xFrame = null; protected XComponent m_xComponent = null; - - + + /** * Creates a new instance of UnoDialogSample */ @@ -125,11 +125,11 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis m_xMCF = _xMCF; createDialog(m_xMCF); } - - + + public static void main(String args[]) { UnoDialogSample oUnoDialogSample = null; - + try { XComponentContext xContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); if(xContext != null ) @@ -180,11 +180,11 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } } } - + System.exit( 0 ); } - - + + /** * @param _sKeyName * @return @@ -206,8 +206,8 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis return null; } } - - + + /** * @param _sRegistryPath the path a registryNode * @param _sImageName the name of the image @@ -239,26 +239,26 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } return sImageUrl; } - + protected void createDialog(XMultiComponentFactory _xMCF) { try { Object oDialogModel = _xMCF.createInstanceWithContext("com.sun.star.awt.UnoControlDialogModel", m_xContext); - + // The XMultiServiceFactory of the dialogmodel is needed to instantiate the controls... m_xMSFDialogModel = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oDialogModel); - + // The named container is used to insert the created controls into... m_xDlgModelNameContainer = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oDialogModel); - + // create the dialog... Object oUnoDialog = _xMCF.createInstanceWithContext("com.sun.star.awt.UnoControlDialog", m_xContext); m_xDialogControl = (XControl) UnoRuntime.queryInterface(XControl.class, oUnoDialog); - + // The scope of the control container is public... m_xDlgContainer = (XControlContainer) UnoRuntime.queryInterface(XControlContainer.class, oUnoDialog); - + m_xTopWindow = (XTopWindow) UnoRuntime.queryInterface(XTopWindow.class, m_xDlgContainer); - + // link the dialog and its model... XControlModel xControlModel = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, oDialogModel); m_xDialogControl.setModel(xControlModel); @@ -266,9 +266,9 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis exception.printStackTrace(System.out); } } - - - + + + public short executeDialogWithembeddedExampleSnippets() throws com.sun.star.script.BasicErrorException { if (m_xWindowPeer == null){ createWindowPeer(); @@ -279,8 +279,8 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis xDialog = (XDialog) UnoRuntime.queryInterface(XDialog.class, m_xDialogControl); return xDialog.execute(); } - - + + public short executeDialog() throws com.sun.star.script.BasicErrorException { if (m_xWindowPeer == null) { createWindowPeer(); @@ -289,15 +289,15 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis m_xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, m_xDialogControl); return xDialog.execute(); } - - - - + + + + public XItemListener getRoadmapItemStateChangeListener(){ return new RoadmapItemStateChangeListener(m_xMSFDialogModel); } - - + + public void initialize(String[] PropertyNames, Object[] PropertyValues) throws com.sun.star.script.BasicErrorException{ try{ XMultiPropertySet xMultiPropertySet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, m_xDlgModelNameContainer); @@ -305,9 +305,9 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } catch (com.sun.star.uno.Exception ex) { ex.printStackTrace(System.out); }} - - - + + + /** * create a peer for this * dialog, using the given @@ -333,8 +333,8 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } return null; } - - + + public void calculateDialogPosition(XWindow _xWindow) { Rectangle aFramePosSize = m_xModel.getCurrentController().getFrame().getComponentWindow().getPosSize(); Rectangle CurPosSize = _xWindow.getPosSize(); @@ -346,9 +346,9 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis int iYPos = ((WindowHeight / 2) - (DialogHeight / 2)); _xWindow.setPosSize(iXPos, iYPos, DialogWidth, DialogHeight, PosSize.POS); } - - - + + + /** * Creates a peer for this * dialog, using the active OO frame @@ -359,12 +359,12 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis public XWindowPeer createWindowPeer() throws com.sun.star.script.BasicErrorException{ return createWindowPeer(null); } - + public void endExecute() { xDialog.endExecute(); } - - + + public Object insertControlModel(String ServiceName, String sName, String[] sProperties, Object[] sValues) throws com.sun.star.script.BasicErrorException{ try { Object oControlModel = m_xMSFDialogModel.createInstance(ServiceName); @@ -377,30 +377,30 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis return null; } } - - + + public XFixedText insertFixedText(XMouseListener _xMouseListener, int _nPosX, int _nPosY, int _nWidth, int _nStep, String _sLabel){ XFixedText xFixedText = null; try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "Label"); - + // create a controlmodel at the multiservicefactory of the dialog model... Object oFTModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlFixedTextModel"); XMultiPropertySet xFTModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oFTModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! - + xFTModelMPSet.setPropertyValues( new String[] {"Height", "Name", "PositionX", "PositionY", "Step", "Width"}, new Object[] { new Integer(8), sName, new Integer(_nPosX), new Integer(_nPosY), new Integer(_nStep), new Integer(_nWidth)}); // add the model to the NameContainer of the dialog model m_xDlgModelNameContainer.insertByName(sName, oFTModel); - + // The following property may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration XPropertySet xFTPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oFTModel); xFTPSet.setPropertyValue("Label", _sLabel); - + // reference the control by the Name XControl xFTControl = m_xDlgContainer.getControl(sName); xFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, xFTControl); @@ -420,33 +420,33 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } return xFixedText; } - - + + public XTextComponent insertCurrencyField(XTextListener _xTextListener, int _nPositionX, int _nPositionY, int _nWidth){ XTextComponent xTextComponent = null; try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "CurrencyField"); - + // create a controlmodel at the multiservicefactory of the dialog model... Object oCFModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlCurrencyFieldModel"); XMultiPropertySet xCFModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oCFModel); - + // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xCFModelMPSet.setPropertyValues( new String[] {"Height", "Name", "PositionX", "PositionY", "Width"}, new Object[] { new Integer(12), sName, new Integer(_nPositionX), new Integer(_nPositionY), new Integer(_nWidth)}); - + // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oCFModel); XPropertySet xCFModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oCFModel); - + // The following properties may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration xCFModelPSet.setPropertyValue("PrependCurrencySymbol", Boolean.TRUE); xCFModelPSet.setPropertyValue("CurrencySymbol", "$"); xCFModelPSet.setPropertyValue("Value", new Double(2.93)); - + // add a textlistener that is notified on each change of the controlvalue... Object oCFControl = m_xDlgContainer.getControl(sName); xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, oCFControl); @@ -465,28 +465,28 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } return xTextComponent; } - - - + + + public XPropertySet insertProgressBar(int _nPosX, int _nPosY, int _nWidth, int _nProgressMax){ XPropertySet xPBModelPSet = null; try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "ProgressBar"); - + // create a controlmodel at the multiservicefactory of the dialog model... Object oPBModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlProgressBarModel"); - + XMultiPropertySet xPBModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oPBModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xPBModelMPSet.setPropertyValues( new String[] {"Height", "Name", "PositionX", "PositionY", "Width"}, new Object[] { new Integer(8), sName, new Integer(_nPosX), new Integer(_nPosY), new Integer(_nWidth)}); - + // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oPBModel); xPBModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oPBModel); - + // The following properties may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration xPBModelPSet.setPropertyValue("ProgressValueMin", new Integer(0)); @@ -505,26 +505,26 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } return xPBModelPSet; } - - - + + + public void insertHorizontalFixedLine(int _nPosX, int _nPosY, int _nWidth, String _sLabel){ try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "FixedLine"); - + // create a controlmodel at the multiservicefactory of the dialog model... Object oFLModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlFixedLineModel"); XMultiPropertySet xFLModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oFLModel); - + // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xFLModelMPSet.setPropertyValues( new String[] {"Height", "Name", "Orientation", "PositionX", "PositionY", "Width"}, new Object[] { new Integer(8), sName, new Integer(0), new Integer(_nPosX), new Integer(_nPosY), new Integer(_nWidth)}); - + // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oFLModel); - + // The following property may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration XPropertySet xFLPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oFLModel); @@ -542,26 +542,26 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis ex.printStackTrace(System.out); } } - - - + + + public void insertGroupBox(int _nPosX, int _nPosY, int _nHeight, int _nWidth){ try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "FrameControl"); - + // create a controlmodel at the multiservicefactory of the dialog model... Object oGBModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlGroupBoxModel"); XMultiPropertySet xGBModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oGBModel); - + // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xGBModelMPSet.setPropertyValues( new String[] {"Height", "Name", "PositionX", "PositionY", "Width"}, new Object[] { new Integer(_nHeight), sName, new Integer(_nPosX), new Integer(_nPosY), new Integer(_nWidth)}); - + // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oGBModel); - + // The following property may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration XPropertySet xGBPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oGBModel); @@ -579,33 +579,33 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis ex.printStackTrace(System.out); } } - - - + + + public XTextComponent insertEditField(XTextListener _xTextListener, XFocusListener _xFocusListener, int _nPosX, int _nPosY, int _nWidth){ XTextComponent xTextComponent = null; try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "TextField"); - + // create a controlmodel at the multiservicefactory of the dialog model... Object oTFModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlEditModel"); XMultiPropertySet xTFModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oTFModel); - + // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xTFModelMPSet.setPropertyValues( new String[] {"Height", "Name", "PositionX", "PositionY", "Text", "Width"}, new Object[] { new Integer(12), sName, new Integer(_nPosX), new Integer(_nPosY), "MyText", new Integer(_nWidth)}); - + // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oTFModel); XPropertySet xTFModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oTFModel); - + // The following property may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration xTFModelPSet.setPropertyValue("EchoChar", new Short((short) '*')); XControl xTFControl = m_xDlgContainer.getControl(sName); - + // add a textlistener that is notified on each change of the controlvalue... xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, xTFControl); XWindow xTFWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xTFControl); @@ -626,26 +626,26 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } return xTextComponent; } - + public XPropertySet insertTimeField(int _nPosX, int _nPosY, int _nWidth, int _nTime, int _nTimeMin, int _nTimeMax){ XPropertySet xTFModelPSet = null; try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "TimeField"); - + // create a controlmodel at the multiservicefactory of the dialog model... Object oTFModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlTimeFieldModel"); XMultiPropertySet xTFModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oTFModel); - + // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xTFModelMPSet.setPropertyValues( new String[] {"Height", "Name", "PositionX", "PositionY", "Spin", "Width"}, new Object[] { new Integer(12), sName, new Integer(_nPosX), new Integer(_nPosY), Boolean.TRUE, new Integer(_nWidth)}); - + // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oTFModel); xTFModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oTFModel); - + // The following properties may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration xTFModelPSet.setPropertyValue("TimeFormat", new Short((short) 5)); @@ -666,28 +666,28 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } return xTFModelPSet; } - - - + + + public XPropertySet insertDateField(XSpinListener _xSpinListener, int _nPosX, int _nPosY, int _nWidth){ XPropertySet xDFModelPSet = null; try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "DateField"); - + // create a controlmodel at the multiservicefactory of the dialog model... Object oDFModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlDateFieldModel"); XMultiPropertySet xDFModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oDFModel); - + // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xDFModelMPSet.setPropertyValues( new String[] {"Dropdown", "Height", "Name", "PositionX", "PositionY", "Width"}, new Object[] {Boolean.TRUE, new Integer(12), sName, new Integer(_nPosX), new Integer(_nPosY), new Integer(_nWidth)}); - + // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oDFModel); xDFModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oDFModel); - + // The following properties may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration xDFModelPSet.setPropertyValue("DateFormat", new Short((short) 7)); @@ -695,7 +695,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis xDFModelPSet.setPropertyValue("DateMax", new Integer(20070501)); xDFModelPSet.setPropertyValue("Date", new Integer(20000415)); Object oDFControl = m_xDlgContainer.getControl(sName); - + // add a SpinListener that is notified on each change of the controlvalue... XSpinField xSpinField = (XSpinField) UnoRuntime.queryInterface(XSpinField.class, oDFControl); xSpinField.addSpinListener(_xSpinListener); @@ -713,27 +713,27 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } return xDFModelPSet; } - - + + public XPropertySet insertPatternField(int _nPosX, int _nPosY, int _nWidth){ XPropertySet xPFModelPSet = null; try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "PatternField"); - + // create a controlmodel at the multiservicefactory of the dialog model... Object oPFModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlPatternFieldModel"); XMultiPropertySet xPFModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oPFModel); - + // Set the properties at the model - keep in mind to pass the property names in alphabetical order! xPFModelMPSet.setPropertyValues( new String[] {"Height", "Name", "PositionX", "PositionY", "Width"}, new Object[] { new Integer(12), sName, new Integer(_nPosX), new Integer(_nPosY), new Integer(_nWidth)}); - + // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oPFModel); xPFModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oPFModel); - + // The following properties may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration xPFModelPSet.setPropertyValue("LiteralMask", "__.05.2007"); @@ -755,8 +755,8 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } return xPFModelPSet; } - - + + public XPropertySet insertNumericField( int _nPosX, int _nPosY, int _nWidth, double _fValueMin, double _fValueMax, double _fValue, double _fValueStep, short _nDecimalAccuracy){ @@ -764,7 +764,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "NumericField"); - + // create a controlmodel at the multiservicefactory of the dialog model... Object oNFModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlNumericFieldModel"); XMultiPropertySet xNFModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oNFModel); @@ -772,7 +772,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis xNFModelMPSet.setPropertyValues( new String[] {"Height", "Name", "PositionX", "PositionY", "Spin", "StrictFormat", "Width"}, new Object[] { new Integer(12), sName, new Integer(_nPosX), new Integer(_nPosY), Boolean.TRUE, Boolean.TRUE, new Integer(_nWidth)}); - + // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oNFModel); xNFModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oNFModel); @@ -798,17 +798,17 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } return xNFModelPSet; } - - - + + + public XPropertySet insertVerticalScrollBar(XAdjustmentListener _xAdjustmentListener, int _nPosX, int _nPosY, int _nHeight){ XPropertySet xSBModelPSet = null; try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "ScrollBar"); - + Integer NOrientation = new Integer(com.sun.star.awt.ScrollBarOrientation.VERTICAL); - + // create a controlmodel at the multiservicefactory of the dialog model... Object oSBModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlScrollBarModel"); XMultiPropertySet xSBModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oSBModel); @@ -816,10 +816,10 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis xSBModelMPSet.setPropertyValues( new String[] {"Height", "Name", "Orientation", "PositionX", "PositionY", "Width"}, new Object[] { new Integer(_nHeight), sName, NOrientation, new Integer(_nPosX), new Integer(_nPosY), new Integer(8)}); - + // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oSBModel); - + xSBModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oSBModel); // The following properties may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration @@ -828,7 +828,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis xSBModelPSet.setPropertyValue("ScrollValue", new Integer(5)); xSBModelPSet.setPropertyValue("LineIncrement", new Integer(2)); xSBModelPSet.setPropertyValue("BlockIncrement", new Integer(10)); - + // Add an Adjustment that will listen to changes of the scrollbar... XControl xSBControl = m_xDlgContainer.getControl(sName); XScrollBar xScrollBar = (XScrollBar) UnoRuntime.queryInterface(XScrollBar.class, xSBControl); @@ -847,8 +847,8 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } return xSBModelPSet; } - - + + /** makes a String unique by appending a numerical suffix * @param _xElementContainer the com.sun.star.container.XNameAccess container * that the new Element is going to be inserted to @@ -868,29 +868,29 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } return _sElementName; } - - + + public XCheckBox insertCheckBox(XItemListener _xItemListener, int _nPosX, int _nPosY, int _nWidth){ XCheckBox xCheckBox = null; try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "CheckBox"); - + // create a controlmodel at the multiservicefactory of the dialog model... Object oCBModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlCheckBoxModel"); - + // Set the properties at the model - keep in mind to pass the property names in alphabetical order! XMultiPropertySet xCBMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oCBModel); xCBMPSet.setPropertyValues( new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Width" } , new Object[] {new Integer(8), "~Include page number", sName, new Integer(_nPosX), new Integer(_nPosY), new Integer(_nWidth)}); - + // The following property may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration XPropertySet xCBModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xCBMPSet); xCBModelPSet.setPropertyValue("TriState", Boolean.TRUE); xCBModelPSet.setPropertyValue("State", new Short((short) 1)); - + // add the model to the NameContainer of the dialog model m_xDlgModelNameContainer.insertByName(sName, oCBModel); XControl xCBControl = m_xDlgContainer.getControl(sName); @@ -911,15 +911,15 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } return xCheckBox; } - - - - + + + + public void insertRadioButtonGroup(short _nTabIndex, int _nPosX, int _nPosY, int _nWidth){ try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "OptionButton"); - + // create a controlmodel at the multiservicefactory of the dialog model... Object oRBModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlRadioButtonModel"); XMultiPropertySet xRBMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oRBModel); @@ -929,10 +929,10 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis new Object[] {new Integer(8), "~First Option", sName, new Integer(_nPosX), new Integer(_nPosY), new Short((short) 1), new Short(_nTabIndex++),new Integer(_nWidth)}); // add the model to the NameContainer of the dialog model m_xDlgModelNameContainer.insertByName(sName, oRBModel); - + // create a unique name by means of an own implementation... sName = createUniqueName(m_xDlgModelNameContainer, "OptionButton"); - + oRBModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlRadioButtonModel"); xRBMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oRBModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! @@ -954,14 +954,14 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis ex.printStackTrace(System.out); } } - - + + public XListBox insertListBox(int _nPosX, int _nPosY, int _nWidth, int _nStep, String[] _sStringItemList){ XListBox xListBox = null; try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "ListBox"); - + // create a controlmodel at the multiservicefactory of the dialog model... Object oListBoxModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlListBoxModel"); XMultiPropertySet xLBModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oListBoxModel); @@ -994,16 +994,16 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } return xListBox; } - - + + public XComboBox insertComboBox(int _nPosX, int _nPosY, int _nWidth){ XComboBox xComboBox = null; try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "ComboBox"); - + String[] sStringItemList = new String[]{"First Entry", "Second Entry", "Third Entry", "Fourth Entry"}; - + // create a controlmodel at the multiservicefactory of the dialog model... Object oComboBoxModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlComboBoxModel"); XMultiPropertySet xCbBModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oComboBoxModel); @@ -1011,17 +1011,17 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis xCbBModelMPSet.setPropertyValues( new String[] {"Dropdown", "Height", "Name", "PositionX", "PositionY", "StringItemList", "Width" } , new Object[] {Boolean.TRUE, new Integer(12), sName, new Integer(_nPosX), new Integer(_nPosY), sStringItemList, new Integer(_nWidth)}); - + // The following property may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration XPropertySet xCbBModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xCbBModelMPSet); xCbBModelPSet.setPropertyValue("MaxTextLen", new Short((short) 10)); xCbBModelPSet.setPropertyValue("ReadOnly", Boolean.FALSE); - + // add the model to the NameContainer of the dialog model m_xDlgModelNameContainer.insertByName(sName, xCbBModelMPSet); XControl xControl = m_xDlgContainer.getControl(sName); - + // retrieve a ListBox that is more convenient to work with than the Model of the ListBox... xComboBox = (XComboBox) UnoRuntime.queryInterface(XComboBox.class, xControl); } catch (com.sun.star.uno.Exception ex) { @@ -1038,15 +1038,15 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } return xComboBox; } - - - + + + public XPropertySet insertFormattedField(XSpinListener _xSpinListener, int _nPosX, int _nPosY, int _nWidth){ XPropertySet xFFModelPSet = null; try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "FormattedField"); - + // create a controlmodel at the multiservicefactory of the dialog model... Object oFFModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlFormattedFieldModel"); XMultiPropertySet xFFModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oFFModel); @@ -1054,7 +1054,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis xFFModelMPSet.setPropertyValues( new String[] {"EffectiveValue", "Height", "Name", "PositionX", "PositionY", "StrictFormat", "Spin", "Width"}, new Object[] { new Double(12348), new Integer(12), sName, new Integer(_nPosX), new Integer(_nPosY), Boolean.TRUE, Boolean.TRUE, new Integer(_nWidth)}); - + xFFModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oFFModel); // to define a numberformat you always need a locale... com.sun.star.lang.Locale aLocale = new com.sun.star.lang.Locale(); @@ -1062,7 +1062,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis aLocale.Language = "en"; // this Format is only compliant to the english locale! String sFormatString = "NNNNMMMM DD, YYYY"; - + // a NumberFormatsSupplier has to be created first "in the open countryside"... Object oNumberFormatsSupplier = m_xMCF.createInstanceWithContext("com.sun.star.util.NumberFormatsSupplier", m_xContext); XNumberFormatsSupplier xNumberFormatsSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, oNumberFormatsSupplier); @@ -1073,21 +1073,21 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // if not then add it to the NumberFormatsSupplier nFormatKey = xNumberFormats.addNew(sFormatString, aLocale); } - + // The following property may also be set with XMultiPropertySet but we // use the XPropertySet interface merely for reasons of demonstration xFFModelPSet.setPropertyValue("FormatsSupplier", xNumberFormatsSupplier); xFFModelPSet.setPropertyValue("FormatKey", new Integer(nFormatKey)); - + // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oFFModel); - + // finally we add a Spin-Listener to the control XControl xFFControl = m_xDlgContainer.getControl(sName); // add a SpinListener that is notified on each change of the controlvalue... XSpinField xSpinField = (XSpinField) UnoRuntime.queryInterface(XSpinField.class, xFFControl); xSpinField.addSpinListener(_xSpinListener); - + } catch (com.sun.star.uno.Exception ex) { /* perform individual exception handling here. * Possible exception types are: @@ -1102,41 +1102,41 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } return xFFModelPSet; } - + public void convertUnits(){ // iXPixelFactor = (int) (100000/xDevice.getInfo().PixelPerMeterX); } - - + + public XTextComponent insertFileControl(XTextListener _xTextListener, int _nPosX, int _nPosY, int _nWidth){ XTextComponent xTextComponent = null; try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "FileControl"); - + // retrieve the configured Work path... Object oPathSettings = m_xMCF.createInstanceWithContext("com.sun.star.util.PathSettings",m_xContext); XPropertySet xPropertySet = (XPropertySet) com.sun.star.uno.UnoRuntime.queryInterface(XPropertySet.class, oPathSettings); String sWorkUrl = (String) xPropertySet.getPropertyValue("Work"); - + // convert the Url to a system path that is "human readable"... Object oFCProvider = m_xMCF.createInstanceWithContext("com.sun.star.ucb.FileContentProvider", m_xContext); XFileIdentifierConverter xFileIdentifierConverter = (XFileIdentifierConverter) UnoRuntime.queryInterface(XFileIdentifierConverter.class, oFCProvider); String sSystemWorkPath = xFileIdentifierConverter.getSystemPathFromFileURL(sWorkUrl); - + // create a controlmodel at the multiservicefactory of the dialog model... Object oFCModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlFileControlModel"); - + // Set the properties at the model - keep in mind to pass the property names in alphabetical order! XMultiPropertySet xFCModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oFCModel); xFCModelMPSet.setPropertyValues( new String[] {"Height", "Name", "PositionX", "PositionY", "Text", "Width"}, new Object[] { new Integer(14), sName, new Integer(_nPosX), new Integer(_nPosY), sSystemWorkPath, new Integer(_nWidth)}); - + // The controlmodel is not really available until inserted to the Dialog container m_xDlgModelNameContainer.insertByName(sName, oFCModel); XPropertySet xFCModelPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oFCModel); - + // add a textlistener that is notified on each change of the controlvalue... XControl xFCControl = m_xDlgContainer.getControl(sName); xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, xFCControl); @@ -1156,14 +1156,14 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } return xTextComponent; } - - + + public XButton insertButton(XActionListener _xActionListener, int _nPosX, int _nPosY, int _nWidth, String _sLabel, short _nPushButtonType){ XButton xButton = null; try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "CommandButton"); - + // create a controlmodel at the multiservicefactory of the dialog model... Object oButtonModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlButtonModel"); XMultiPropertySet xButtonMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oButtonModel); @@ -1171,7 +1171,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis xButtonMPSet.setPropertyValues( new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "PushButtonType", "Width" } , new Object[] {new Integer(14), _sLabel, sName, new Integer(_nPosX), new Integer(_nPosY), new Short(_nPushButtonType), new Integer(_nWidth)}); - + // add the model to the NameContainer of the dialog model m_xDlgModelNameContainer.insertByName(sName, oButtonModel); XControl xButtonControl = m_xDlgContainer.getControl(sName); @@ -1192,7 +1192,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 @@ -1204,7 +1204,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xWindow); return xWindowPeer; } - + public XFrame getCurrentFrame(){ XFrame xRetFrame = null; try { @@ -1216,8 +1216,8 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } return xRetFrame; } - - + + public void textChanged(TextEvent textEvent) { try { // get the control that has fired the event, @@ -1242,9 +1242,9 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis ex.printStackTrace(System.out); } } - - - + + + public void up(SpinEvent spinEvent) { try { // get the control that has fired the event, @@ -1269,21 +1269,21 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis ex.printStackTrace(System.out); } } - - + + public void down(SpinEvent spinEvent) { } - + public void last(SpinEvent spinEvent) { } - + public void first(SpinEvent spinEvent) { - } - + } + public void disposing(EventObject rEventObject) { } - - + + public void actionPerformed(ActionEvent rEvent) { try{ // get the control that has fired the event, @@ -1306,8 +1306,8 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis ex.printStackTrace(System.out); } } - - + + public void focusLost(FocusEvent _focusEvent) { short nFocusFlags = _focusEvent.FocusFlags; int nFocusChangeReason = nFocusFlags & FocusChangeReason.TAB; @@ -1318,20 +1318,20 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, _focusEvent.NextFocus); } } - - + + public void focusGained(FocusEvent focusEvent) { - } - + } + public void mouseReleased(MouseEvent mouseEvent) { } - + public void mousePressed(MouseEvent mouseEvent) { - } - + } + public void mouseExited(MouseEvent mouseEvent) { } - + public void mouseEntered(MouseEvent _mouseEvent) { try { // retrieve the control that the event has been invoked at... @@ -1348,12 +1348,12 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis // finally set the created pointer at the windowpeer of the control xControl.getPeer().setPointer(xPointer); } catch (com.sun.star.uno.Exception ex) { - throw new java.lang.RuntimeException("cannot happen..."); + throw new java.lang.RuntimeException("cannot happen..."); } } - - - + + + public void itemStateChanged(ItemEvent itemEvent) { try{ // retrieve the control that the event has been invoked at... @@ -1386,9 +1386,9 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis */ ex.printStackTrace(System.out); } - } - - + } + + public void adjustmentValueChanged(AdjustmentEvent _adjustmentEvent) { switch (_adjustmentEvent.Type.getValue()){ case AdjustmentType.ADJUST_ABS_value: @@ -1403,41 +1403,41 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis } System.out.println( "The value of the scrollbar is: " + _adjustmentEvent.Value); } - - - + + + // Globally available object variables of the roadmapmodel XPropertySet m_xRMPSet; XSingleServiceFactory m_xSSFRoadmap; XIndexContainer m_xRMIndexCont; - + public void addRoadmap(XItemListener _xItemListener) { XPropertySet xDialogModelPropertySet = null; try { // create a unique name by means of an own implementation... String sRoadmapName = createUniqueName(m_xDlgModelNameContainer, "Roadmap"); - + xDialogModelPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, m_xMSFDialogModel); // Similar to the office assistants the roadmap is adjusted to the height of the dialog // where a certain space is left at the bottom for the buttons... int nDialogHeight = ((Integer) xDialogModelPropertySet.getPropertyValue("Height")).intValue(); - + // instantiate the roadmapmodel... Object oRoadmapModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlRoadmapModel"); - + // define the properties of the roadmapmodel XMultiPropertySet xRMMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oRoadmapModel); xRMMPSet.setPropertyValues( new String[] {"Complete", "Height", "Name", "PositionX", "PositionY", "Text", "Width" }, new Object[] {Boolean.FALSE, new Integer(nDialogHeight - 26), sRoadmapName, new Integer(0), new Integer(0), "Steps", new Integer(85)}); m_xRMPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmapModel); - + // add the roadmapmodel to the dialog container.. m_xDlgModelNameContainer.insertByName(sRoadmapName, oRoadmapModel); - + // the roadmapmodel is a SingleServiceFactory to instantiate the roadmapitems... m_xSSFRoadmap = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, oRoadmapModel); m_xRMIndexCont = (XIndexContainer) UnoRuntime.queryInterface(XIndexContainer.class, oRoadmapModel); - + // add the itemlistener to the control... XControl xRMControl = this.m_xDlgContainer.getControl(sRoadmapName); XItemEventBroadcaster xRMBroadcaster = (XItemEventBroadcaster) UnoRuntime.queryInterface(XItemEventBroadcaster.class, xRMControl); @@ -1446,7 +1446,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis jexception.printStackTrace(System.out); } } - + /** *To fully understand the example one has to be aware that the passed ???Index??? parameter * refers to the position of the roadmap item in the roadmapmodel container @@ -1468,15 +1468,15 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis exception.printStackTrace(System.out); } } - - + + public void keyReleased(KeyEvent keyEvent) { int i = keyEvent.KeyChar; int n = keyEvent.KeyCode; int m = keyEvent.KeyFunc; } - + public void keyPressed(KeyEvent keyEvent) { } - + } diff --git a/odk/examples/DevelopersGuide/GUI/UnoDialogSample2.java b/odk/examples/DevelopersGuide/GUI/UnoDialogSample2.java index 3b85eb57d306..5e5959b340fe 100644 --- a/odk/examples/DevelopersGuide/GUI/UnoDialogSample2.java +++ b/odk/examples/DevelopersGuide/GUI/UnoDialogSample2.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.awt.PushButtonType; import com.sun.star.awt.XControl; @@ -56,36 +56,36 @@ import com.sun.star.uno.XComponentContext; public class UnoDialogSample2 extends UnoDialogSample { XIntrospectionAccess m_xIntrospectionAccess = null; Object m_oUnoObject = null; - // define some constants used to set positions and sizes + // define some constants used to set positions and sizes // of controls. For further information see // http://ui.openoffice.org/knowledge/DialogSpecificationandGuidelines.odt - final static int nFixedTextHeight = 8; - final static int nControlMargin = 6; + final static int nFixedTextHeight = 8; + final static int nControlMargin = 6; final static int nDialogWidth = 250; final static int nDialogHeight = 140; // the default roadmap width == 80 MAPs final static int nRoadmapWidth = 80; final static int nButtonHeight = 14; final static int nButtonWidth = 50; - - + + public UnoDialogSample2(XComponentContext _xContext, XMultiComponentFactory _xMCF, Object _oUnoObject) { super(_xContext, _xMCF); try { m_oUnoObject = _oUnoObject; Object o = m_xMCF.createInstanceWithContext("com.sun.star.beans.Introspection", m_xContext); - XIntrospection m_xIntrospection = ( XIntrospection ) UnoRuntime.queryInterface(XIntrospection.class, o ); - // the variable m_xIntrospectionAccess offers functionality to access all methods and properties + XIntrospection m_xIntrospection = ( XIntrospection ) UnoRuntime.queryInterface(XIntrospection.class, o ); + // the variable m_xIntrospectionAccess offers functionality to access all methods and properties // of a variable m_xIntrospectionAccess = m_xIntrospection.inspect(_oUnoObject); } catch (com.sun.star.uno.Exception ex) { ex.printStackTrace(); } } - + public static void main(String args[]) { UnoDialogSample2 oUnoDialogSample2 = null; - try { + try { XComponentContext xContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); if(xContext != null ) System.out.println("Connected to a running office ..."); @@ -94,8 +94,8 @@ public class UnoDialogSample2 extends UnoDialogSample { // create an arbitrary Uno-Object - in this case an empty writer document.. Object oDesktop =xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", xContext); XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, oDesktop); - Object oUnoObject = xComponentLoader.loadComponentFromURL("private:factory/swriter", "_default", 0, aPropertyValues); - + Object oUnoObject = xComponentLoader.loadComponentFromURL("private:factory/swriter", "_default", 0, aPropertyValues); + // define some coordinates where to position the controls final int nButtonPosX = (int)((nDialogWidth/2) - (nButtonWidth/2)); final int nButtonPosY = nDialogHeight - nButtonHeight - nControlMargin; @@ -118,9 +118,9 @@ public class UnoDialogSample2 extends UnoDialogSample { oUnoDialogSample2.insertListBox(nControlPosX, nControlMargin, nListBoxHeight, nControlWidth, 4, sMethodNames); oUnoDialogSample2.insertListBox(nControlPosX, nControlMargin, nListBoxHeight, nControlWidth, 5, sPropertyNames); oUnoDialogSample2.insertButton(oUnoDialogSample2, nButtonPosX, nButtonPosY, nButtonWidth, "~Close", (short) PushButtonType.OK_value); - oUnoDialogSample2.insertHorizontalFixedLine(0, nButtonPosY - nControlMargin - 4, nDialogWidth, ""); - // create the windowpeer; - // it must be kept in mind that it must be created after the insertion of the controls + oUnoDialogSample2.insertHorizontalFixedLine(0, nButtonPosY - nControlMargin - 4, nDialogWidth, ""); + // create the windowpeer; + // it must be kept in mind that it must be created after the insertion of the controls // (see http://qa.openoffice.org/issues/show_bug.cgi?id=75129) oUnoDialogSample2.createWindowPeer(); // add the roadmap control. Note that the roadmap may not be created before the windowpeer of the dialog exists @@ -137,7 +137,7 @@ public class UnoDialogSample2 extends UnoDialogSample { oUnoDialogSample2.xDialog.execute(); }catch( Exception ex ) { ex.printStackTrace(System.out); - } + } finally{ //make sure always to dispose the component and free the memory! if (oUnoDialogSample2 != null){ @@ -146,10 +146,10 @@ public class UnoDialogSample2 extends UnoDialogSample { } } } - + System.exit( 0 ); } - + public String[] getMethodNames() { String[] sMethodNames = new String[]{}; @@ -165,15 +165,15 @@ public class UnoDialogSample2 extends UnoDialogSample { } return sMethodNames; } - + // returns the names of all supported servicenames of a UNO object public String[] getSupportedServiceNames() { String[] sSupportedServiceNames = new String[]{}; - // If the Uno-Object supports "com.sun.star.lang.XServiceInfo" + // If the Uno-Object supports "com.sun.star.lang.XServiceInfo" // this will give access to all supported servicenames XServiceInfo xServiceInfo = ( XServiceInfo ) UnoRuntime.queryInterface( XServiceInfo.class, m_oUnoObject); if ( xServiceInfo != null ) { - sSupportedServiceNames = xServiceInfo.getSupportedServiceNames(); + sSupportedServiceNames = xServiceInfo.getSupportedServiceNames(); } return sSupportedServiceNames; } @@ -210,35 +210,35 @@ public class UnoDialogSample2 extends UnoDialogSample { } return sTypeNames; } - - - + + + public XListBox insertListBox(int _nPosX, int _nPosY, int _nHeight, int _nWidth, int _nStep, String[] _sStringItemList) { XListBox xListBox = null; try{ // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "ListBox"); - // create a controlmodel at the multiservicefactory of the dialog model... + // create a controlmodel at the multiservicefactory of the dialog model... Object oListBoxModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlListBoxModel"); XMultiPropertySet xLBModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oListBoxModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! - xLBModelMPSet.setPropertyValues( + xLBModelMPSet.setPropertyValues( new String[] {"Dropdown", "Height", "Name", "PositionX", "PositionY", "ReadOnly", "Step", "StringItemList", "Width" } , - new Object[] {Boolean.FALSE, new Integer(_nHeight), sName, new Integer(_nPosX), new Integer(_nPosY), Boolean.TRUE, new Integer(_nStep), _sStringItemList, new Integer(_nWidth)}); + new Object[] {Boolean.FALSE, new Integer(_nHeight), sName, new Integer(_nPosX), new Integer(_nPosY), Boolean.TRUE, new Integer(_nStep), _sStringItemList, new Integer(_nWidth)}); m_xDlgModelNameContainer.insertByName(sName, xLBModelMPSet); }catch (com.sun.star.uno.Exception ex) { throw new java.lang.RuntimeException("cannot happen..."); } return xListBox; } - + public void insertMultiLineFixedText(int _nPosX, int _nPosY, int _nWidth, int _nLineCount, int _nStep, String _sLabel) { - try { + try { // create a unique name by means of an own implementation... String sName = createUniqueName(m_xDlgModelNameContainer, "Label"); int nHeight = _nLineCount * nFixedTextHeight; - // create a controlmodel at the multiservicefactory of the dialog model... + // create a controlmodel at the multiservicefactory of the dialog model... Object oFTModel = m_xMSFDialogModel.createInstance("com.sun.star.awt.UnoControlFixedTextModel"); XMultiPropertySet xFTModelMPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, oFTModel); // Set the properties at the model - keep in mind to pass the property names in alphabetical order! diff --git a/odk/examples/DevelopersGuide/GUI/UnoMenu.java b/odk/examples/DevelopersGuide/GUI/UnoMenu.java index 2fba20245d57..0bd29dfd702f 100644 --- a/odk/examples/DevelopersGuide/GUI/UnoMenu.java +++ b/odk/examples/DevelopersGuide/GUI/UnoMenu.java @@ -20,15 +20,15 @@ import com.sun.star.uno.XComponentContext; public class UnoMenu extends UnoDialogSample implements XMenuListener { private XTopWindow mxTopWindow = null; - + public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { super(_xContext, _xMCF); } - + public static void main(String args[]){ UnoMenu oUnoMenu = null; XComponent xComponent = null; - try { + try { XComponentContext xContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); if(xContext != null ) System.out.println("Connected to a running office ..."); @@ -38,7 +38,7 @@ public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { oUnoMenu.addMenuBar(oUnoMenu.mxTopWindow, oUnoMenu); }catch( Exception ex ) { ex.printStackTrace(System.out); - } + } } @@ -63,7 +63,7 @@ public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { xPopupMenu.checkItem((short) 2, true); xPopupMenu.addMenuListener(this); }catch( Exception e ) { - throw new java.lang.RuntimeException("cannot happen..."); + throw new java.lang.RuntimeException("cannot happen..."); } return xPopupMenu; } @@ -81,7 +81,7 @@ public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { xMenuBar.addMenuListener(_xMenuListener); _xTopWindow.setMenuBar(xMenuBar); }catch( Exception e ) { - throw new java.lang.RuntimeException("cannot happen..."); + throw new java.lang.RuntimeException("cannot happen..."); }} protected void closeDialog(){ @@ -91,7 +91,7 @@ public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { } // to ensure that the Java application terminates - System.exit( 0 ); + System.exit( 0 ); } public XTopWindow showTopWindow( Rectangle _aRectangle){ @@ -104,7 +104,7 @@ public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { // set up a window description and create the window. A parent window is always necessary for this... com.sun.star.awt.WindowDescriptor aWindowDescriptor = new com.sun.star.awt.WindowDescriptor(); // a TopWindow is contains a title bar and is able to inlude menus... - aWindowDescriptor.Type = WindowClass.TOP; + aWindowDescriptor.Type = WindowClass.TOP; // specify the position and height of the window on the parent window aWindowDescriptor.Bounds = _aRectangle; // set the window attributes... @@ -118,7 +118,7 @@ public UnoMenu(XComponentContext _xContext, XMultiComponentFactory _xMCF) { Object oFrame = m_xMCF.createInstanceWithContext("com.sun.star.frame.Frame", m_xContext); m_xFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, oFrame); - Object oDesktop = m_xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", m_xContext); + Object oDesktop = m_xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", m_xContext); XFramesSupplier xFramesSupplier = (XFramesSupplier) UnoRuntime.queryInterface(XFramesSupplier.class, oDesktop); m_xFrame.setCreator(xFramesSupplier); // get the XTopWindow interface.. diff --git a/odk/examples/DevelopersGuide/GUI/UnoMenu2.java b/odk/examples/DevelopersGuide/GUI/UnoMenu2.java index d9f9ed92c741..cc25d0d98d1e 100644 --- a/odk/examples/DevelopersGuide/GUI/UnoMenu2.java +++ b/odk/examples/DevelopersGuide/GUI/UnoMenu2.java @@ -12,14 +12,14 @@ import com.sun.star.uno.XComponentContext; public class UnoMenu2 extends UnoMenu implements XMouseListener{ - + public UnoMenu2(XComponentContext _xContext, XMultiComponentFactory _xMCF) { super(_xContext, _xMCF); } - + public static void main(String args[]){ UnoMenu2 oUnoMenu2 = null; - try { + try { XComponentContext xContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); if(xContext != null ) System.out.println("Connected to a running office ..."); @@ -34,12 +34,12 @@ public UnoMenu2(XComponentContext _xContext, XMultiComponentFactory _xMCF) { new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Width"}, new Object[] { new Integer(8), "This code-sample demonstrates the creation of a popup-menu", "HeaderLabel", new Integer(6), new Integer(6), new Integer(200)}); // add the model to the NameContainer of the dialog model - oUnoMenu2.m_xDlgModelNameContainer.insertByName("Headerlabel", oFTHeaderModel); + oUnoMenu2.m_xDlgModelNameContainer.insertByName("Headerlabel", oFTHeaderModel); oUnoMenu2.addLabelForPopupMenu(); oUnoMenu2.executeDialog(); }catch( Exception ex ) { ex.printStackTrace(System.out); - } + } finally{ //make sure always to dispose the component and free the memory! if (oUnoMenu2 != null) { @@ -47,7 +47,7 @@ public UnoMenu2(XComponentContext _xContext, XMultiComponentFactory _xMCF) { oUnoMenu2.m_xComponent.dispose(); } } - System.exit( 0 ); + System.exit( 0 ); }} @@ -80,7 +80,7 @@ public UnoMenu2(XComponentContext _xContext, XMultiComponentFactory _xMCF) { if (mouseEvent.PopupTrigger){ Rectangle aRectangle = new Rectangle(mouseEvent.X, mouseEvent.Y, 0, 0); XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, mouseEvent.Source); - getPopupMenu().execute( xControl.getPeer(), aRectangle, com.sun.star.awt.PopupMenuDirection.DEFAULT); + getPopupMenu().execute( xControl.getPeer(), aRectangle, com.sun.star.awt.PopupMenuDirection.DEFAULT); } } diff --git a/odk/examples/DevelopersGuide/OfficeBean/OOoBeanViewer.java b/odk/examples/DevelopersGuide/OfficeBean/OOoBeanViewer.java index 0bbe5475f23f..886016f7b308 100644 --- a/odk/examples/DevelopersGuide/OfficeBean/OOoBeanViewer.java +++ b/odk/examples/DevelopersGuide/OfficeBean/OOoBeanViewer.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ package com.sun.star.comp.beans; @@ -40,18 +40,18 @@ import java.io.*; /** A simple Applet that contains the SimpleBean. * - * This applet is a sample implementation of the - * OpenOffice.org bean. + * This applet is a sample implementation of the + * OpenOffice.org bean. * When initally loaded the applet has two buttons - * one for opening an existant file and one to open + * one for opening an existant file and one to open * a blank document of a given type supported by * OpenOffice.org eg. Writer, Calc, Impress, ..... * */ - + public class OOoBeanViewer extends java.applet.Applet { - + /** * Private variables declaration - GUI components */ @@ -84,8 +84,8 @@ public class OOoBeanViewer extends java.applet.Applet public void init() { //The aBean needs to be initialized to add it to the applet - aBean = new OOoBean(); - + aBean = new OOoBean(); + //Initialize GUI components rightPanel = new java.awt.Panel(); bottomPanel = new java.awt.Panel(); @@ -99,7 +99,7 @@ public class OOoBeanViewer extends java.applet.Applet menuBarButton = new javax.swing.JCheckBox("MenuBar"); menuBarButton.setSelected( aBean.isMenuBarVisible() ); - + mainBarButton = new javax.swing.JCheckBox("MainBar"); mainBarButton.setSelected( aBean.isStandardBarVisible() ); @@ -110,16 +110,16 @@ public class OOoBeanViewer extends java.applet.Applet statusBarButton.setSelected( aBean.isStatusBarVisible() ); documentURLTextField = new javax.swing.JTextField(); - + //Set up the Popup Menu to create a blank document documentTypePopUp.setToolTipText("Create an empty document"); - + item = documentTypePopUp.add("Text Document"); item.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - createBlankDoc("private:factory/swriter", + createBlankDoc("private:factory/swriter", "New text document"); } }); @@ -129,7 +129,7 @@ public class OOoBeanViewer extends java.applet.Applet { public void actionPerformed(java.awt.event.ActionEvent evt) { - createBlankDoc("private:factory/simpress", + createBlankDoc("private:factory/simpress", "New presentation document"); } }); @@ -139,7 +139,7 @@ public class OOoBeanViewer extends java.applet.Applet { public void actionPerformed(java.awt.event.ActionEvent evt) { - createBlankDoc("private:factory/sdraw", + createBlankDoc("private:factory/sdraw", "New drawing document"); } }); @@ -149,7 +149,7 @@ public class OOoBeanViewer extends java.applet.Applet { public void actionPerformed(java.awt.event.ActionEvent evt) { - createBlankDoc("private:factory/smath", + createBlankDoc("private:factory/smath", "New formula document"); } }); @@ -159,7 +159,7 @@ public class OOoBeanViewer extends java.applet.Applet { public void actionPerformed(java.awt.event.ActionEvent evt) { - createBlankDoc("private:factory/scalc", + createBlankDoc("private:factory/scalc", "New spreadsheet document"); } }); @@ -169,7 +169,7 @@ public class OOoBeanViewer extends java.applet.Applet { public void actionPerformed(java.awt.event.ActionEvent evt) { - try + try { aBean.releaseSystemWindow(); aBean.aquireSystemWindow(); @@ -186,13 +186,13 @@ public class OOoBeanViewer extends java.applet.Applet { public void actionPerformed(java.awt.event.ActionEvent evt) { - try + try { buffer = aBean.storeToByteArray( null, null ); } catch ( Throwable aExc ) - { - System.err.println( "storeToBuffer failed: " + aExc ); + { + System.err.println( "storeToBuffer failed: " + aExc ); aExc.printStackTrace( System.err ); } } @@ -203,13 +203,13 @@ public class OOoBeanViewer extends java.applet.Applet { public void actionPerformed(java.awt.event.ActionEvent evt) { - try + try { aBean.loadFromByteArray( buffer, null ); } catch ( Throwable aExc ) - { - System.err.println( "loadFromBuffer failed: " + aExc ); + { + System.err.println( "loadFromBuffer failed: " + aExc ); aExc.printStackTrace( System.err ); } } @@ -313,7 +313,7 @@ public class OOoBeanViewer extends java.applet.Applet //Get the office process to load the URL aBean.loadFromURL( url, null ); - aBean.aquireSystemWindow(); + aBean.aquireSystemWindow(); } catch ( com.sun.star.comp.beans.SystemWindowException aExc ) { @@ -338,7 +338,7 @@ public class OOoBeanViewer extends java.applet.Applet private void close() { setVisible(false); - aBean.stopOOoConnection(); + aBean.stopOOoConnection(); stop(); System.exit(0); } @@ -353,7 +353,7 @@ public class OOoBeanViewer extends java.applet.Applet xDesktop = aBean.getOOoDesktop(); } catch ( com.sun.star.comp.beans.NoConnectionException aExc ) {} // ignore - aBean.stopOOoConnection(); + aBean.stopOOoConnection(); stop(); if ( xDesktop != null ) xDesktop.terminate(); @@ -367,7 +367,7 @@ public class OOoBeanViewer extends java.applet.Applet { /** * windowClosed - * + * * @param e A WindowEvent for a closed Window event */ public void windowClosed( java.awt.event.WindowEvent e) diff --git a/odk/examples/DevelopersGuide/OfficeDev/Clipboard/Clipboard.java b/odk/examples/DevelopersGuide/OfficeDev/Clipboard/Clipboard.java index 0d79e1e6bc25..82127e706b57 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Clipboard/Clipboard.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Clipboard/Clipboard.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.lang.XComponent; @@ -53,9 +53,9 @@ import com.sun.star.uno.AnyConverter; public class Clipboard { - public static void main(String[] args) + public static void main(String[] args) { - try + try { // get the remote office context. If necessary a new office // process is started @@ -82,13 +82,13 @@ public class Clipboard xDoc.getText().setString("In the first step, paste the current content of the clipboard in the document!\nThe text \"Hello world!\" shall be insert at the current cursor position below.\n\nIn the second step, please select some words and put it into the clipboard! ...\n\nCurrent clipboard content = "); // ensure that the document content is optimal visible - com.sun.star.frame.XModel xModel = + com.sun.star.frame.XModel xModel = (com.sun.star.frame.XModel)UnoRuntime.queryInterface( com.sun.star.frame.XModel.class, xDoc); // get the frame for later usage com.sun.star.frame.XFrame xFrame = xModel.getCurrentController().getFrame(); - + com.sun.star.view.XViewSettingsSupplier xViewSettings = (com.sun.star.view.XViewSettingsSupplier)UnoRuntime.queryInterface( com.sun.star.view.XViewSettingsSupplier.class, @@ -97,7 +97,7 @@ public class Clipboard "ZoomType", new Short((short)0)); } // test document will be closed later - + Object oClipboard = xServiceManager.createInstanceWithContext( "com.sun.star.datatransfer.clipboard.SystemClipboard", xOfficeContext); @@ -113,27 +113,27 @@ public class Clipboard UnoRuntime.queryInterface(XClipboardNotifier.class, oClipboard); ClipboardListener aClipListener= new ClipboardListener(); - + xClipNotifier.addClipboardListener(aClipListener); // Read ClipBoard - readClipBoard(xClipboard); + readClipBoard(xClipboard); //--------------------------------------------------- // becoming a clipboard owner //--------------------------------------------------- - + System.out.println("Becoming a clipboard owner..."); System.out.println(""); ClipboardOwner aClipOwner = new ClipboardOwner(); xClipboard.setContents(new TextTransferable("Hello World!"), aClipOwner); - int iFirst = 0; - + int iFirst = 0; + while (aClipOwner.isClipboardOwner()) { if (iFirst != 2) { - if (iFirst == 1) { + if (iFirst == 1) { System.out.println("Change clipboard ownership by putting something into the clipboard!\n"); System.out.print("Still clipboard owner..."); } else { @@ -147,8 +147,8 @@ public class Clipboard } // Read ClipBoard again - readClipBoard(xClipboard); - + readClipBoard(xClipboard); + //--------------------------------------------------- // unregistering as clipboard listener //--------------------------------------------------- @@ -165,10 +165,10 @@ public class Clipboard { xComponent.dispose(); } - + System.exit(0); } - catch( Exception ex ) + catch( Exception ex ) { ex.printStackTrace(); } @@ -180,42 +180,42 @@ public class Clipboard //--------------------------------------------------- // get a list of formats currently on the clipboard //--------------------------------------------------- - + XTransferable xTransferable = xClipboard.getContents(); - + DataFlavor[] aDflvArr = xTransferable.getTransferDataFlavors(); - + // print all available formats - + System.out.println("Reading the clipboard..."); System.out.println("Available clipboard formats:"); - + DataFlavor aUniFlv = null; - + for (int i=0;i<aDflvArr.length;i++) { - System.out.println( "MimeType: " + - aDflvArr[i].MimeType + - " HumanPresentableName: " + - aDflvArr[i].HumanPresentableName ); + System.out.println( "MimeType: " + + aDflvArr[i].MimeType + + " HumanPresentableName: " + + aDflvArr[i].HumanPresentableName ); // if there is the format unicode text on the clipboard save the // corresponding DataFlavor so that we can later output the string - + if ( aDflvArr[i].MimeType.equals("text/plain;charset=utf-16") ) - { + { aUniFlv = aDflvArr[i]; } } - + System.out.println(""); - - try + + try { if (aUniFlv != null) { System.out.print("Unicode text on the clipboard ...\nYour selected text \""); - Object aData = xTransferable.getTransferData(aUniFlv); + Object aData = xTransferable.getTransferData(aUniFlv); System.out.println(AnyConverter.toString(aData) + "\" is now in the clipboard.\n"); } diff --git a/odk/examples/DevelopersGuide/OfficeDev/Clipboard/ClipboardListener.java b/odk/examples/DevelopersGuide/OfficeDev/Clipboard/ClipboardListener.java index 49efd28c0ea8..b858ddcfcda4 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Clipboard/ClipboardListener.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Clipboard/ClipboardListener.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,19 +29,19 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.lang.EventObject; import com.sun.star.datatransfer.clipboard.ClipboardEvent; import com.sun.star.datatransfer.clipboard.XClipboardListener; -//----------------------------- +//----------------------------- // A simple clipboard listener //----------------------------- public class ClipboardListener implements XClipboardListener -{ +{ public void disposing(EventObject event) { } diff --git a/odk/examples/DevelopersGuide/OfficeDev/Clipboard/ClipboardOwner.java b/odk/examples/DevelopersGuide/OfficeDev/Clipboard/ClipboardOwner.java index eb745bae4119..46137bbb5995 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Clipboard/ClipboardOwner.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Clipboard/ClipboardOwner.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.datatransfer.XTransferable; @@ -37,11 +37,11 @@ import com.sun.star.datatransfer.clipboard.XClipboard; import com.sun.star.datatransfer.clipboard.XClipboardOwner; //-------------------------- -// A simple clipboard owner +// A simple clipboard owner //-------------------------- public class ClipboardOwner implements XClipboardOwner -{ +{ public void lostOwnership( XClipboard xClipboard, XTransferable xTransferable ) { System.out.println(""); diff --git a/odk/examples/DevelopersGuide/OfficeDev/Clipboard/TextTransferable.java b/odk/examples/DevelopersGuide/OfficeDev/Clipboard/TextTransferable.java index 291cbbb97e22..768745f67504 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Clipboard/TextTransferable.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Clipboard/TextTransferable.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.datatransfer.DataFlavor; @@ -43,7 +43,7 @@ import com.sun.star.uno.Type; //--------------------------------------- public class TextTransferable implements XTransferable -{ +{ public TextTransferable(String aText) { text = aText; @@ -64,10 +64,10 @@ public class TextTransferable implements XTransferable DataFlavor[] adf = new DataFlavor[1]; DataFlavor uniflv = new DataFlavor( - UNICODE_CONTENT_TYPE, - "Unicode Text", + UNICODE_CONTENT_TYPE, + "Unicode Text", new Type(String.class) ); - + adf[0] = uniflv; return adf; diff --git a/odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java b/odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java index 1b10f7d50dcb..a5d81e306492 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java +++ b/odk/examples/DevelopersGuide/OfficeDev/ContextMenuInterceptor.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.beans.XPropertySet; @@ -51,7 +51,7 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor { try { OfficeConnect aConnect = OfficeConnect.createConnection(); - com.sun.star.frame.XDesktop xDesktop = + com.sun.star.frame.XDesktop xDesktop = (com.sun.star.frame.XDesktop)aConnect.createRemoteInstance( com.sun.star.frame.XDesktop.class,"com.sun.star.frame.Desktop"); @@ -71,16 +71,16 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor { UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class, xComponent); - String infoMsg = new String("All context menus of the created document frame contains now a 'Help' entry with the submenus 'Content', 'Help Agent' and 'Tips'.\n\nPress 'Return' in the shell to remove the context menu interceptor and finish the example!"); + String infoMsg = new String("All context menus of the created document frame contains now a 'Help' entry with the submenus 'Content', 'Help Agent' and 'Tips'.\n\nPress 'Return' in the shell to remove the context menu interceptor and finish the example!"); xDoc.getText().setString(infoMsg); // ensure that the document content is optimal visible - com.sun.star.frame.XModel xModel = + com.sun.star.frame.XModel xModel = (com.sun.star.frame.XModel)UnoRuntime.queryInterface( com.sun.star.frame.XModel.class, xDoc); // get the frame for later usage xFrame = xModel.getCurrentController().getFrame(); - + com.sun.star.view.XViewSettingsSupplier xViewSettings = (com.sun.star.view.XViewSettingsSupplier)UnoRuntime.queryInterface( com.sun.star.view.XViewSettingsSupplier.class, xModel.getCurrentController()); @@ -88,26 +88,26 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor { "ZoomType", new Short((short)0)); } // test document will be closed later - + // reuse the frame com.sun.star.frame.XController xController = xFrame.getController(); if ( xController != null ) { - com.sun.star.ui.XContextMenuInterception xContextMenuInterception = - (com.sun.star.ui.XContextMenuInterception)UnoRuntime.queryInterface( + com.sun.star.ui.XContextMenuInterception xContextMenuInterception = + (com.sun.star.ui.XContextMenuInterception)UnoRuntime.queryInterface( com.sun.star.ui.XContextMenuInterception.class, xController ); if( xContextMenuInterception != null ) { ContextMenuInterceptor aContextMenuInterceptor = new ContextMenuInterceptor(); - com.sun.star.ui.XContextMenuInterceptor xContextMenuInterceptor = - (com.sun.star.ui.XContextMenuInterceptor)UnoRuntime.queryInterface( + com.sun.star.ui.XContextMenuInterceptor xContextMenuInterceptor = + (com.sun.star.ui.XContextMenuInterceptor)UnoRuntime.queryInterface( com.sun.star.ui.XContextMenuInterceptor.class, aContextMenuInterceptor ); xContextMenuInterception.registerContextMenuInterceptor( xContextMenuInterceptor ); - + System.out.println( "\n ... all context menus of the created document frame contains now a 'Help' entry with the\n submenus 'Content', 'Help Agent' and 'Tips'.\n\nPress 'Return' to remove the context menu interceptor and finish the example!"); java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)); reader.read(); - + xContextMenuInterception.releaseContextMenuInterceptor( xContextMenuInterceptor ); System.out.println( " ... context menu interceptor removed!" ); @@ -138,7 +138,7 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor { } System.out.println(" ... exit!\n"); - System.exit( 0 ); + System.exit( 0 ); } /** @@ -147,7 +147,7 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor { *@param args Description of Parameter *@since */ - public ContextMenuInterceptorAction notifyContextMenuExecute( + public ContextMenuInterceptorAction notifyContextMenuExecute( com.sun.star.ui.ContextMenuExecuteEvent aEvent ) throws RuntimeException { try { @@ -155,30 +155,30 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor { // Retrieve context menu container and query for service factory to // create sub menus, menu entries and separators com.sun.star.container.XIndexContainer xContextMenu = aEvent.ActionTriggerContainer; - com.sun.star.lang.XMultiServiceFactory xMenuElementFactory = + com.sun.star.lang.XMultiServiceFactory xMenuElementFactory = (com.sun.star.lang.XMultiServiceFactory)UnoRuntime.queryInterface( com.sun.star.lang.XMultiServiceFactory.class, xContextMenu ); if ( xMenuElementFactory != null ) { // create root menu entry and sub menu com.sun.star.beans.XPropertySet xRootMenuEntry = (XPropertySet)UnoRuntime.queryInterface( - com.sun.star.beans.XPropertySet.class, + com.sun.star.beans.XPropertySet.class, xMenuElementFactory.createInstance( "com.sun.star.ui.ActionTrigger" )); // create a line separator for our new help sub menu - com.sun.star.beans.XPropertySet xSeparator = - (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface( - com.sun.star.beans.XPropertySet.class, + com.sun.star.beans.XPropertySet xSeparator = + (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface( + com.sun.star.beans.XPropertySet.class, xMenuElementFactory.createInstance( "com.sun.star.ui.ActionTriggerSeparator" )); - + Short aSeparatorType = new Short( ActionTriggerSeparatorType.LINE ); xSeparator.setPropertyValue( "SeparatorType", (Object)aSeparatorType ); - + // query sub menu for index container to get access com.sun.star.container.XIndexContainer xSubMenuContainer = - (com.sun.star.container.XIndexContainer)UnoRuntime.queryInterface( + (com.sun.star.container.XIndexContainer)UnoRuntime.queryInterface( com.sun.star.container.XIndexContainer.class, - xMenuElementFactory.createInstance( + xMenuElementFactory.createInstance( "com.sun.star.ui.ActionTriggerContainer" )); // intialize root menu entry @@ -188,21 +188,21 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor { xRootMenuEntry.setPropertyValue( "SubContainer", (Object)xSubMenuContainer ); // create menu entries for the new sub menu - + // intialize help/content menu entry - XPropertySet xMenuEntry = (XPropertySet)UnoRuntime.queryInterface( + XPropertySet xMenuEntry = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xMenuElementFactory.createInstance( "com.sun.star.ui.ActionTrigger" )); xMenuEntry.setPropertyValue( "Text", new String( "Content" )); xMenuEntry.setPropertyValue( "CommandURL", new String( "slot:5401" )); xMenuEntry.setPropertyValue( "HelpURL", new String( "5401" )); - + // insert menu entry to sub menu xSubMenuContainer.insertByIndex( 0, (Object)xMenuEntry ); // intialize help/help agent - xMenuEntry = (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface( + xMenuEntry = (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface( com.sun.star.beans.XPropertySet.class, xMenuElementFactory.createInstance( "com.sun.star.ui.ActionTrigger" )); @@ -212,11 +212,11 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor { // insert menu entry to sub menu xSubMenuContainer.insertByIndex( 1, (Object)xMenuEntry ); - + // intialize help/tips - xMenuEntry = (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface( + xMenuEntry = (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface( com.sun.star.beans.XPropertySet.class, - xMenuElementFactory.createInstance( + xMenuElementFactory.createInstance( "com.sun.star.ui.ActionTrigger" )); xMenuEntry.setPropertyValue( "Text", new String( "Tips" )); xMenuEntry.setPropertyValue( "CommandURL", new String( "slot:5404" )); @@ -230,7 +230,7 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor { // add new sub menu into the given context menu xContextMenu.insertByIndex( 0, (Object)xRootMenuEntry ); - + // The controller should execute the modified context menu and stop notifying other // interceptors. return com.sun.star.ui.ContextMenuInterceptorAction.EXECUTE_MODIFIED; @@ -238,7 +238,7 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor { } catch ( com.sun.star.beans.UnknownPropertyException ex ) { // do something useful - // we used a unknown property + // we used a unknown property } catch ( com.sun.star.lang.IndexOutOfBoundsException ex ) { // do something useful @@ -250,7 +250,7 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor { catch ( java.lang.Exception ex ) { // catch java exceptions and something useful } - + return com.sun.star.ui.ContextMenuInterceptorAction.IGNORED; } } diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/CustomizeView.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/CustomizeView.java index 0a53b9a1e0b9..3aa793148b8c 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/CustomizeView.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/CustomizeView.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java index 8f635dfdcf6e..b63c83e551e7 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Desk.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java index a45294c5affe..0e9aeeacb5a4 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/DocumentView.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java index 75af2ab7f35d..9e04ddccd3c0 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -189,7 +189,7 @@ public class FunctionHelper * future prove this old one should be tried too. * - it's possible to pass the native window handle directly to the toolkit. * A special interface method was enabled to accept that. - * + * * The right way to create an office window should be then: * - try to use second creation mode (directly using of the window handle) * - if it failed ... use the old way by packing the handle inside an object diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IOnewayLink.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IOnewayLink.java index 935f788b8c03..45b020225304 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IOnewayLink.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IOnewayLink.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import java.util.Vector; diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IShutdownListener.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IShutdownListener.java index ba9035383d24..f80358f097b9 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IShutdownListener.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IShutdownListener.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Implementation __________ diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java index da1b68bc059d..36f01ffd79f7 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/JavaWindowPeerFake.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/JavaWindowPeerFake.java index 24cd05e2f526..1e05e12dfaa8 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/JavaWindowPeerFake.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/JavaWindowPeerFake.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import java.awt.*; diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/NativeView.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/NativeView.java index ead6d7745287..e727270b9ead 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/NativeView.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/NativeView.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java index e1a8b3f9f35b..f4bc5554a87a 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java index 7d84d7c5fcca..c98045d96fe5 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import java.util.Vector; diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java index de369dcd8c16..25db43df1320 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusView.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusView.java index 64923f539516..18e4c1e31798 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusView.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusView.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java index e35e3c0d7b99..02f68a05e0fd 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/unix/nativeview.c b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/unix/nativeview.c index fa52c68b3ee4..83f246eef876 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/unix/nativeview.c +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/unix/nativeview.c @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include <X11/Xlib.h> diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/unix/nativeview.h b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/unix/nativeview.h index 81de2d9f1b31..51642e94495d 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/unix/nativeview.h +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/unix/nativeview.h @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ /* DO NOT EDIT THIS FILE - it is machine generated */ diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/windows/nativeview.c b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/windows/nativeview.c index 84173a0e546a..28da7c111ab5 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/windows/nativeview.c +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/windows/nativeview.c @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include <windows.h> diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/windows/nativeview.h b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/windows/nativeview.h index 81de2d9f1b31..51642e94495d 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/windows/nativeview.h +++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/nativelib/windows/nativeview.h @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ /* DO NOT EDIT THIS FILE - it is machine generated */ diff --git a/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java b/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java index a74c0d102544..5398c8173d1f 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.uno.UnoRuntime; @@ -51,7 +51,7 @@ import com.sun.star.text.XTextDocument; * commands. */ public class DisableCommandsTest extends java.lang.Object { - + /* * A list of command names */ @@ -62,37 +62,37 @@ public class DisableCommandsTest extends java.lang.Object { new String( "SelectAll" ), new String( "Quit" ), }; - + private static XComponentContext xRemoteContext = null; private static XMultiComponentFactory xRemoteServiceManager = null; private static XURLTransformer xTransformer = null; private static XMultiServiceFactory xConfigProvider = null; - + /* * @param args the command line arguments */ public static void main(String[] args) { - + try { // get the remote office context. If necessary a new office // process is started xRemoteContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); System.out.println("Connected to a running office ..."); xRemoteServiceManager = xRemoteContext.getServiceManager(); - + Object transformer = xRemoteServiceManager.createInstanceWithContext( "com.sun.star.util.URLTransformer", xRemoteContext ); xTransformer = (com.sun.star.util.XURLTransformer) UnoRuntime.queryInterface(com.sun.star.util.XURLTransformer.class, transformer ); - + Object configProvider = xRemoteServiceManager.createInstanceWithContext( "com.sun.star.configuration.ConfigurationProvider", xRemoteContext ); xConfigProvider = (com.sun.star.lang.XMultiServiceFactory) UnoRuntime.queryInterface( com.sun.star.lang.XMultiServiceFactory.class, configProvider ); - + // create a new test document Object oDesktop = xRemoteServiceManager.createInstanceWithContext( "com.sun.star.frame.Desktop", xRemoteContext); @@ -117,13 +117,13 @@ public class DisableCommandsTest extends java.lang.Object { + "example and close the document."); // ensure that the document content is optimal visible - com.sun.star.frame.XModel xModel = + com.sun.star.frame.XModel xModel = (com.sun.star.frame.XModel)UnoRuntime.queryInterface( com.sun.star.frame.XModel.class, xDoc); // get the frame for later usage com.sun.star.frame.XFrame xFrame = xModel.getCurrentController().getFrame(); - + com.sun.star.view.XViewSettingsSupplier xViewSettings = (com.sun.star.view.XViewSettingsSupplier)UnoRuntime.queryInterface( com.sun.star.view.XViewSettingsSupplier.class, @@ -136,13 +136,13 @@ public class DisableCommandsTest extends java.lang.Object { // First we need a defined starting point. So we have to remove // all commands from the disabled set! enableCommands(); - + // Check if the commands are usable testCommands( false ); - + // Disable the commands disableCommands(); - + // Now the commands shouldn't be usable anymore testCommands( true ); @@ -151,7 +151,7 @@ public class DisableCommandsTest extends java.lang.Object { System.out.println("\nYou can now check the disabled commands.\n" +"Please press 'return' to enable the commands!"); waitForUserInput(); - + // Remove disable commands to make Office usable again enableCommands(); @@ -161,7 +161,7 @@ public class DisableCommandsTest extends java.lang.Object { +"Please press 'return' to finish the example and " +"close the document!"); waitForUserInput(); - + // close test document com.sun.star.util.XCloseable xCloseable = (com.sun.star.util.XCloseable) UnoRuntime.queryInterface(com.sun.star.util.XCloseable.class, @@ -172,7 +172,7 @@ public class DisableCommandsTest extends java.lang.Object { } else { xComponent.dispose(); - } + } } catch (java.lang.Exception e){ e.printStackTrace(); @@ -192,7 +192,7 @@ public class DisableCommandsTest extends java.lang.Object { reader.read(); } - + /** * Test the commands that we enabled/disabled */ @@ -209,8 +209,8 @@ public class DisableCommandsTest extends java.lang.Object { if ( xFrame != null ) { // We have a frame. Now we need access to the dispatch provider. - xDispatchProvider = - (com.sun.star.frame.XDispatchProvider)UnoRuntime.queryInterface( + xDispatchProvider = + (com.sun.star.frame.XDispatchProvider)UnoRuntime.queryInterface( com.sun.star.frame.XDispatchProvider.class, xFrame ); if ( xDispatchProvider != null ) { @@ -222,13 +222,13 @@ public class DisableCommandsTest extends java.lang.Object { com.sun.star.util.URL[] aURL = new com.sun.star.util.URL[1]; aURL[0] = new com.sun.star.util.URL(); com.sun.star.frame.XDispatch xDispatch = null; - + aURL[0].Complete = ".uno:" + aCommandURLTestSet[n]; xTransformer.parseSmart( aURL, ".uno:" ); - + // Try to get a dispatch object for our URL xDispatch = xDispatchProvider.queryDispatch( aURL[0], "", 0 ); - + if ( xDispatch != null ) { if ( bDisabledCmds ) @@ -273,14 +273,14 @@ public class DisableCommandsTest extends java.lang.Object { try { // Create configuration update access to have write access to the // configuration - Object xAccess = xConfigProvider.createInstanceWithArguments( + Object xAccess = xConfigProvider.createInstanceWithArguments( "com.sun.star.configuration.ConfigurationUpdateAccess", lParams ); - + com.sun.star.container.XNameAccess xNameAccess = (com.sun.star.container.XNameAccess)UnoRuntime.queryInterface( com.sun.star.container.XNameAccess.class, xAccess ); - + if ( xNameAccess != null ) { // We need the XNameContainer interface to remove the nodes by name com.sun.star.container.XNameContainer xNameContainer = @@ -300,13 +300,13 @@ public class DisableCommandsTest extends java.lang.Object { catch ( com.sun.star.container.NoSuchElementException e ) { } } - } + } // Commit our changes com.sun.star.util.XChangesBatch xFlush = (com.sun.star.util.XChangesBatch)UnoRuntime.queryInterface( com.sun.star.util.XChangesBatch.class, xAccess); - + xFlush.commitChanges(); } catch ( com.sun.star.uno.Exception e ) { @@ -314,7 +314,7 @@ public class DisableCommandsTest extends java.lang.Object { System.out.println( e ); } } - + /** * Disable all commands defined in the aCommandURLTestSet array */ @@ -322,7 +322,7 @@ public class DisableCommandsTest extends java.lang.Object { // Set the root path for our configuration access com.sun.star.beans.PropertyValue[] lParams = new com.sun.star.beans.PropertyValue[1]; - + lParams[0] = new com.sun.star.beans.PropertyValue(); lParams[0].Name = new String("nodepath"); lParams[0].Value = "/org.openoffice.Office.Commands/Execute/Disabled"; @@ -330,41 +330,41 @@ public class DisableCommandsTest extends java.lang.Object { try { // Create configuration update access to have write access to the // configuration - Object xAccess = xConfigProvider.createInstanceWithArguments( + Object xAccess = xConfigProvider.createInstanceWithArguments( "com.sun.star.configuration.ConfigurationUpdateAccess", lParams ); - - com.sun.star.lang.XSingleServiceFactory xSetElementFactory = + + com.sun.star.lang.XSingleServiceFactory xSetElementFactory = (com.sun.star.lang.XSingleServiceFactory)UnoRuntime.queryInterface( com.sun.star.lang.XSingleServiceFactory.class, xAccess ); com.sun.star.container.XNameContainer xNameContainer = (com.sun.star.container.XNameContainer)UnoRuntime.queryInterface( com.sun.star.container.XNameContainer.class, xAccess ); - + if ( xSetElementFactory != null && xNameContainer != null ) { Object[] aArgs = new Object[0]; - + for ( int i = 0; i < aCommandURLTestSet.length; i++ ) { // Create the nodes with the XSingleServiceFactory of the // configuration Object xNewElement = xSetElementFactory.createInstanceWithArguments( aArgs ); - + if ( xNewElement != null ) { // We have a new node. To set the properties of the node // we need the XPropertySet interface. - com.sun.star.beans.XPropertySet xPropertySet = + com.sun.star.beans.XPropertySet xPropertySet = (com.sun.star.beans.XPropertySet) UnoRuntime.queryInterface( com.sun.star.beans.XPropertySet.class, xNewElement ); - + if ( xPropertySet != null ) { // Create a unique node name. String aCmdNodeName = new String( "Command-" ); aCmdNodeName += i; - + // Insert the node into the Disabled set xPropertySet.setPropertyValue( "Command", aCommandURLTestSet[i] ); @@ -373,20 +373,20 @@ public class DisableCommandsTest extends java.lang.Object { } } } - + // Commit our changes com.sun.star.util.XChangesBatch xFlush = (com.sun.star.util.XChangesBatch)UnoRuntime.queryInterface( com.sun.star.util.XChangesBatch.class, xAccess); xFlush.commitChanges(); - } + } } catch ( com.sun.star.uno.Exception e ) { System.err.println( "Exception detected!" + e); e.printStackTrace(); } - } + } /** * reset URL so it can be reused diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java index 24eb92a3109c..623a19102774 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java +++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/AsciiReplaceFilter.java @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ package OfficeDev.samples.Filter; @@ -88,7 +88,7 @@ public class AsciiReplaceFilter { //______________________________ // const - + // the supported service names, the first one being the service name of the component itself public static final String[] m_serviceNames = { "com.sun.star.comp.ansifilter.AsciiReplaceFilter" , "com.sun.star.document.ImportFilter", "com.sun.star.document.ExportFilter" }; @@ -354,12 +354,12 @@ public class AsciiReplaceFilter bImport = m_bImport; xText = m_xDocument; } - + measure("options analyzed"); - + if (aOptions.isValid()==false) return false; - + // start real filtering boolean bState = false; if (bImport) @@ -424,32 +424,32 @@ public class AsciiReplaceFilter FilterOptions aOptions ) { measure("implts_import {"); - + com.sun.star.text.XSimpleText xText = (com.sun.star.text.XSimpleText)UnoRuntime.queryInterface( com.sun.star.text.XSimpleText.class, xTarget.getText()); - + measure("cast XSimpleText"); - + boolean bBreaked = false; - + try { StringBuffer sBuffer = new StringBuffer(100000); byte[][] lData = new byte[1][]; int nRead = aOptions.m_xInput.readBytes( lData, 4096 ); - + measure("read first bytes"); - + while (nRead>0 && !bBreaked) { // copy data from stream to temp. buffer sBuffer.append( new String(lData[0]) ); measure("buffer append ["+nRead+"]"); - + nRead = aOptions.m_xInput.readBytes( lData, 2048 ); measure("read next bytes"); - + // check for cancelled filter proc on every loop! synchronized(this) { @@ -461,11 +461,11 @@ public class AsciiReplaceFilter } measure("break check"); } - + // Make some replacements inside the buffer. String sText = implts_replace( sBuffer, aOptions ); measure("replace"); - + // copy current buffer to the document model. // Create a new paragraph for every line inside original file. // May not all data could be readed - but that doesn't matter here. @@ -474,27 +474,27 @@ public class AsciiReplaceFilter int nStart = 0; int nEnd = -1; int nLength = sText.length(); - + com.sun.star.text.XTextRange xCursor = (com.sun.star.text.XTextRange)UnoRuntime.queryInterface( com.sun.star.text.XTextRange.class, xText.createTextCursor()); - + while (true) { nEnd = sText.indexOf('\n',nStart); - + if (nEnd==-1 && nStart<nLength) nEnd = nLength; - + if (nEnd==-1) break; - + String sLine = sText.substring(nStart,nEnd); nStart = nEnd+1; - + xText.insertString(xCursor,sLine,false); xText.insertControlCharacter(xCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK,false); - + // check for cancelled filter proc on every loop! synchronized(this) { @@ -506,9 +506,9 @@ public class AsciiReplaceFilter } measure("break check"); } - + measure("set on model"); - + // with refreshing the document we are on the safe-side, otherwise the first time the filter is used the document is not fully shown (flaw!). com.sun.star.util.XRefreshable xRefresh = (com.sun.star.util.XRefreshable)UnoRuntime.queryInterface( com.sun.star.util.XRefreshable.class, @@ -526,11 +526,11 @@ public class AsciiReplaceFilter catch(com.sun.star.io.BufferSizeExceededException exExceed ) { bBreaked = true; } catch(com.sun.star.io.NotConnectedException exConnect ) { bBreaked = true; } catch(com.sun.star.io.IOException exIO ) { bBreaked = true; } - + measure("} implts_import"); - + return !bBreaked; } @@ -556,22 +556,22 @@ public class AsciiReplaceFilter FilterOptions aOptions) { measure("implts_export {"); - + com.sun.star.text.XTextRange xText = (com.sun.star.text.XSimpleText)UnoRuntime.queryInterface( com.sun.star.text.XSimpleText.class, xSource.getText()); - + measure("cast XTextRange"); - + boolean bBreaked = false; - + try { StringBuffer sBuffer = new StringBuffer(xText.getString()); String sText = implts_replace(sBuffer,aOptions); - + measure("get text from model"); - + // Normaly this function isn't realy cancelable // But we following operation can be very expensive. So // this place is the last one to stop it. @@ -583,12 +583,12 @@ public class AsciiReplaceFilter return false; } } - + aOptions.m_xOutput.writeBytes(sText.getBytes()); aOptions.m_xOutput.flush(); - + measure("written to file"); - + // If we created used stream - we must close it too. if (aOptions.m_bStreamOwner==true) { @@ -599,12 +599,12 @@ public class AsciiReplaceFilter catch(com.sun.star.io.BufferSizeExceededException exExceed ) { bBreaked = true; } catch(com.sun.star.io.NotConnectedException exConnect ) { bBreaked = true; } catch(com.sun.star.io.IOException exIO ) { bBreaked = true; } - + measure("} implts_export"); - + return !bBreaked; } - + /** * helper function to convert the used StringBuffer into a Strig value. * And we use this chance to have a look on optional filter options @@ -626,7 +626,7 @@ public class AsciiReplaceFilter nEnd = nStart+nLength; } } - + // convert buffer into return format [string] // and convert to lower or upper case if required. String sResult = rBuffer.toString(); @@ -637,11 +637,11 @@ public class AsciiReplaceFilter else sResult = sResult.toUpperCase(); } - + return sResult; } - - + + //______________________________ // interface XServiceInfo /** @@ -672,7 +672,7 @@ public class AsciiReplaceFilter sService.equals( m_serviceNames[2] ) ); } - + /** * Return the real class name of the component * @@ -730,4 +730,4 @@ public class AsciiReplaceFilter _AsciiReplaceFilter.m_serviceNames, xRegistryKey ); } -} +} diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java index 013f93a304f5..3c72f8f6e46e 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java +++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/AsciiFilter/FilterOptions.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ package OfficeDev.samples.Filter; diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx index c6f5f9629453..bf62c3999bf4 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx +++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include <stdio.h> @@ -66,9 +66,9 @@ sal_Bool SAL_CALL component_writeInfo( try { Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( FilterDetect_getImplementationName() ) ); + reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( FilterDetect_getImplementationName() ) ); xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) ); - + const Sequence< OUString > & rSNL = FilterDetect_getSupportedServiceNames(); const OUString * pArray = rSNL.getConstArray(); for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) @@ -89,7 +89,7 @@ void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { void * pRet = 0; - + OUString implName = OUString::createFromAscii( pImplName ); if ( pServiceManager && implName.equals(FilterDetect_getImplementationName()) ) { @@ -97,7 +97,7 @@ void * SAL_CALL component_getFactory( reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), OUString::createFromAscii( pImplName ), FilterDetect_createInstance, FilterDetect_getSupportedServiceNames() ) ); - + if (xFactory.is()) { xFactory->acquire(); diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx index e6bbe85cb2c7..b9fbd7c6af70 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx +++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include "filterdetect.hxx" @@ -72,7 +72,7 @@ using namespace com::sun::star::container; using namespace com::sun::star::ucb; -OUString SAL_CALL FilterDetect::detect(Sequence< PropertyValue >& aArguments ) +OUString SAL_CALL FilterDetect::detect(Sequence< PropertyValue >& aArguments ) throw( RuntimeException ) { // type name to return @@ -82,7 +82,7 @@ OUString SAL_CALL FilterDetect::detect(Sequence< PropertyValue >& aArguments ) // stream of the document to be detected Reference< XInputStream > xInStream; for ( sal_Int32 i = 0 ; i < aArguments.getLength(); i++) - { + { OUString aName = aArguments[i].Name; if (aName.equalsAscii("TypeName" ) ) aArguments[i].Value >>= sOriginalTypeName; @@ -92,7 +92,7 @@ OUString SAL_CALL FilterDetect::detect(Sequence< PropertyValue >& aArguments ) aArguments[i].Value >>= xInStream; } - if (!xInStream.is()) + if (!xInStream.is()) { // open the stream if it was not suplied by the framework Reference< XSimpleFileAccess > xSFI(mxMSF->createInstance( @@ -100,7 +100,7 @@ OUString SAL_CALL FilterDetect::detect(Sequence< PropertyValue >& aArguments ) if (sURL.getLength() > 0 && xSFI.is()) { try - { + { xInStream = xSFI->openFileRead( sURL); } catch( Exception& ) @@ -116,17 +116,17 @@ OUString SAL_CALL FilterDetect::detect(Sequence< PropertyValue >& aArguments ) // flatxml starts with an office:document element. this element // conatains a clas="..." attribut by which we can deduct the // type of document that is to be loaded - // + // // WARNING: // parsing the plain text of the document is an easy way to do this - // but not the purest solution, since namespaces and other xml details + // but not the purest solution, since namespaces and other xml details // may lead to another syntactic expression of the same document. // this example works for the way the office serializes it's XML stream // but might need extension for other data sources... static OString aDocToken("office:document"); // static OString aClassToken("office:class=\""); static OString aMimeTypeToken("office:mimetype=\""); - + sal_Int32 nHeadSize = 4096; Sequence< sal_Int8 > aHeadData(nHeadSize); @@ -138,9 +138,9 @@ OUString SAL_CALL FilterDetect::detect(Sequence< PropertyValue >& aArguments ) long bytestRead = xInStream->readBytes(aHeadData, nHeadSize); OString aHead = OString((const sal_Char *)aHeadData.getConstArray(), bytestRead).toAsciiLowerCase(); - + // check for document element of flatxml format - if (aHead.indexOf(aDocToken) >= 0) + if (aHead.indexOf(aDocToken) >= 0) { // read document class sal_Int32 n = aHead.indexOf(aMimeTypeToken); @@ -150,26 +150,26 @@ OUString SAL_CALL FilterDetect::detect(Sequence< PropertyValue >& aArguments ) OString aMimeType = aHead.copy(n, aHead.indexOf('\"', n) - n); // return type for class found if (aMimeType.equals("application/x-vnd.oasis.opendocument.text") || - aMimeType.equals("application/vnd.oasis.opendocument.text")) + aMimeType.equals("application/vnd.oasis.opendocument.text")) sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_writer"); else if (aMimeType.equals("application/x-vnd.oasis.opendocument.text-master") || - aMimeType.equals("application/vnd.oasis.opendocument.text-master")) - sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_master"); + aMimeType.equals("application/vnd.oasis.opendocument.text-master")) + sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_master"); else if (aMimeType.equals("application/x-vnd.oasis.openoffice.text-global") || - aMimeType.equals("application/vnd.oasis.openoffice.text-global")) - sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_master"); + aMimeType.equals("application/vnd.oasis.openoffice.text-global")) + sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_master"); else if (aMimeType.equals("application/x-vnd.oasis.opendocument.spreadsheet") || - aMimeType.equals("application/vnd.oasis.opendocument.spreadsheet")) - sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_calc"); + aMimeType.equals("application/vnd.oasis.opendocument.spreadsheet")) + sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_calc"); else if (aMimeType.equals("application/x-vnd.oasis.opendocument.drawing") || - aMimeType.equals("application/vnd.oasis.opendocument.drawing")) - sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_draw"); + aMimeType.equals("application/vnd.oasis.opendocument.drawing")) + sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_draw"); else if (aMimeType.equals("application/x-vnd.oasis.opendocument.presentation") || - aMimeType.equals("application/vnd.oasis.opendocument.presentation")) + aMimeType.equals("application/vnd.oasis.opendocument.presentation")) sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_impress"); else if (aMimeType.equals("application/x-vnd.oasis.opendocument.presentation") || aMimeType.equals("application/vnd.oasis.opendocument.presentation")) - sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_impress"); + sTypeName = OUString::createFromAscii("devguide_FlatXMLType_Cpp_impress"); } } return sTypeName; @@ -177,7 +177,7 @@ OUString SAL_CALL FilterDetect::detect(Sequence< PropertyValue >& aArguments ) // XInitialization -void SAL_CALL FilterDetect::initialize( const Sequence< Any >& aArguments ) +void SAL_CALL FilterDetect::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException) { Sequence < PropertyValue > aAnySeq; @@ -187,10 +187,10 @@ void SAL_CALL FilterDetect::initialize( const Sequence< Any >& aArguments ) const PropertyValue * pValue = aAnySeq.getConstArray(); nLength = aAnySeq.getLength(); for ( sal_Int32 i = 0 ; i < nLength; i++) - { + { if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "Type" ) ) ) { - pValue[i].Value >>= msFilterName; + pValue[i].Value >>= msFilterName; } else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "UserData" ) ) ) { @@ -212,13 +212,13 @@ OUString FilterDetect_getImplementationName () #define SERVICE_NAME1 "com.sun.star.document.ExtendedTypeDetection" -sal_Bool SAL_CALL FilterDetect_supportsService( const OUString& ServiceName ) +sal_Bool SAL_CALL FilterDetect_supportsService( const OUString& ServiceName ) throw (RuntimeException) { return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME1 ) ); } -Sequence< OUString > SAL_CALL FilterDetect_getSupportedServiceNames( ) +Sequence< OUString > SAL_CALL FilterDetect_getSupportedServiceNames( ) throw (RuntimeException) { Sequence < OUString > aRet(2); @@ -236,19 +236,19 @@ Reference< XInterface > SAL_CALL FilterDetect_createInstance( const Reference< X } // XServiceInfo -OUString SAL_CALL FilterDetect::getImplementationName( ) +OUString SAL_CALL FilterDetect::getImplementationName( ) throw (RuntimeException) { return FilterDetect_getImplementationName(); } -sal_Bool SAL_CALL FilterDetect::supportsService( const OUString& rServiceName ) +sal_Bool SAL_CALL FilterDetect::supportsService( const OUString& rServiceName ) throw (RuntimeException) { return FilterDetect_supportsService( rServiceName ); } -Sequence< OUString > SAL_CALL FilterDetect::getSupportedServiceNames( ) +Sequence< OUString > SAL_CALL FilterDetect::getSupportedServiceNames( ) throw (RuntimeException) { return FilterDetect_getSupportedServiceNames(); diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.hxx b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.hxx index 210d59cf56e5..e3da3d5cec0c 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.hxx +++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.hxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef _FILTERDETECT_HXX @@ -47,7 +47,7 @@ #include <cppuhelper/implbase3.hxx> -enum FilterType +enum FilterType { FILTER_IMPORT, FILTER_EXPORT @@ -66,36 +66,36 @@ protected: ::rtl::OUString msFilterName; ::com::sun::star::uno::Sequence< ::rtl::OUString > msUserData; ::rtl::OUString msTemplateName; - - sal_Bool SAL_CALL exportImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) + + sal_Bool SAL_CALL exportImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) throw (::com::sun::star::uno::RuntimeException); - - sal_Bool SAL_CALL importImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) + + sal_Bool SAL_CALL importImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) throw (::com::sun::star::uno::RuntimeException); - + public: FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF) : mxMSF( rxMSF ) {} - + virtual ~FilterDetect() {} - + //XExtendedFilterDetection - virtual ::rtl::OUString SAL_CALL detect( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& lDescriptor ) + virtual ::rtl::OUString SAL_CALL detect( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& lDescriptor ) throw( com::sun::star::uno::RuntimeException ); - + // XInitialization - - virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) + + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - + // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); - - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); }; @@ -103,10 +103,10 @@ public: ::rtl::OUString FilterDetect_getImplementationName() throw ( ::com::sun::star::uno::RuntimeException ); -sal_Bool SAL_CALL FilterDetect_supportsService( const ::rtl::OUString& ServiceName ) +sal_Bool SAL_CALL FilterDetect_supportsService( const ::rtl::OUString& ServiceName ) throw ( ::com::sun::star::uno::RuntimeException ); -::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL FilterDetect_getSupportedServiceNames( ) +::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL FilterDetect_getSupportedServiceNames( ) throw ( ::com::sun::star::uno::RuntimeException ); ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/FlatXml.cxx b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/FlatXml.cxx index 6935eb351f55..34ae11cdbfe9 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/FlatXml.cxx +++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/FlatXml.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include <cppuhelper/factory.hxx> @@ -88,47 +88,47 @@ private: public: // ctor... - XFlatXml( const Reference< XMultiServiceFactory > &r ) + XFlatXml( const Reference< XMultiServiceFactory > &r ) : m_rServiceFactory(r) , m_bPrettyPrint(sal_True) {} // XImportFilter virtual sal_Bool SAL_CALL importer( - const Sequence<PropertyValue>& aSourceData, - const Reference<XDocumentHandler>& xHandler, - const Sequence<OUString>& msUserData) + const Sequence<PropertyValue>& aSourceData, + const Reference<XDocumentHandler>& xHandler, + const Sequence<OUString>& msUserData) throw(RuntimeException); // XExportFilter virtual sal_Bool SAL_CALL exporter( - const Sequence<PropertyValue>& aSourceData, - const Sequence<OUString>& msUserData) + const Sequence<PropertyValue>& aSourceData, + const Sequence<OUString>& msUserData) throw(RuntimeException); // XDocumentHandler - virtual void SAL_CALL startDocument() + virtual void SAL_CALL startDocument() throw (SAXException,RuntimeException); - virtual void SAL_CALL endDocument() + virtual void SAL_CALL endDocument() throw (SAXException, RuntimeException); - virtual void SAL_CALL startElement(const OUString& str, const Reference<XAttributeList>& attriblist) + virtual void SAL_CALL startElement(const OUString& str, const Reference<XAttributeList>& attriblist) throw (SAXException,RuntimeException); - virtual void SAL_CALL endElement(const OUString& str) + virtual void SAL_CALL endElement(const OUString& str) throw (SAXException, RuntimeException); - virtual void SAL_CALL characters(const OUString& str) + virtual void SAL_CALL characters(const OUString& str) throw (SAXException, RuntimeException); - virtual void SAL_CALL ignorableWhitespace(const OUString& str) + virtual void SAL_CALL ignorableWhitespace(const OUString& str) throw (SAXException, RuntimeException); - virtual void SAL_CALL processingInstruction(const OUString& str, const OUString& str2) + virtual void SAL_CALL processingInstruction(const OUString& str, const OUString& str2) throw (com::sun::star::xml::sax::SAXException,RuntimeException); - virtual void SAL_CALL setDocumentLocator(const Reference<XLocator>& doclocator) - throw (SAXException,RuntimeException); + virtual void SAL_CALL setDocumentLocator(const Reference<XLocator>& doclocator) + throw (SAXException,RuntimeException); }; sal_Bool XFlatXml::importer( - const Sequence<PropertyValue>& aSourceData, - const Reference<XDocumentHandler>& xHandler, - const Sequence<OUString>& msUserData) + const Sequence<PropertyValue>& aSourceData, + const Reference<XDocumentHandler>& xHandler, + const Sequence<OUString>& msUserData) throw (RuntimeException) { // get information from media descriptor @@ -137,12 +137,12 @@ sal_Bool XFlatXml::importer( // the sax parser that drives the supplied document handler sal_Int32 nLength = aSourceData.getLength(); OUString aName, aFileName, aURL; - Reference< XInputStream > xInputStream; + Reference< XInputStream > xInputStream; for ( sal_Int32 i = 0 ; i < nLength; i++) { aName = aSourceData[i].Name; if (aName.equalsAscii("InputStream")) - aSourceData[i].Value >>= xInputStream; + aSourceData[i].Value >>= xInputStream; else if ( aName.equalsAscii("FileName")) aSourceData[i].Value >>= aFileName; else if ( aName.equalsAscii("URL")) @@ -158,17 +158,17 @@ sal_Bool XFlatXml::importer( if (xSeek.is()) xSeek->seek(0); - + // create SAX parser that will read the document file // and provide events to xHandler passed to this call - Reference < XParser > xSaxParser( m_rServiceFactory->createInstance( + Reference < XParser > xSaxParser( m_rServiceFactory->createInstance( OUString::createFromAscii("com.sun.star.xml.sax.Parser")), UNO_QUERY ); OSL_ASSERT(xSaxParser.is()); if(!xSaxParser.is())return sal_False; // let the parser try to send the sax event to the document handler try - { + { InputSource aInput; aInput.sSystemId = aURL; aInput.sPublicId = aURL; @@ -188,8 +188,8 @@ sal_Bool XFlatXml::importer( } sal_Bool XFlatXml::exporter( - const Sequence<PropertyValue>& aSourceData, - const Sequence<OUString>& msUserData) + const Sequence<PropertyValue>& aSourceData, + const Sequence<OUString>& msUserData) throw (RuntimeException) { @@ -199,9 +199,9 @@ sal_Bool XFlatXml::exporter( // from it's data-source interface OUString aName, sURL; Reference<XOutputStream> rOutputStream; - sal_Int32 nLength = aSourceData.getLength(); + sal_Int32 nLength = aSourceData.getLength(); for ( sal_Int32 i = 0 ; i < nLength; i++) - { + { aName = aSourceData[i].Name; if ( aName.equalsAscii("OutputStream")) aSourceData[i].Value >>= rOutputStream; @@ -243,44 +243,44 @@ void XFlatXml::endDocument() throw (SAXException,RuntimeException){ m_rDocumentHandler->endDocument(); } -void XFlatXml::startElement(const OUString& str, const Reference<XAttributeList>& attriblist) +void XFlatXml::startElement(const OUString& str, const Reference<XAttributeList>& attriblist) throw (SAXException, RuntimeException) { OSL_ASSERT(m_rDocumentHandler.is()); m_rDocumentHandler->startElement(str, attriblist); } -void XFlatXml::endElement(const OUString& str) - throw (SAXException, RuntimeException) +void XFlatXml::endElement(const OUString& str) + throw (SAXException, RuntimeException) { OSL_ASSERT(m_rDocumentHandler.is()); m_rDocumentHandler->endElement(str); } -void XFlatXml::characters(const OUString& str) - throw (SAXException, RuntimeException) +void XFlatXml::characters(const OUString& str) + throw (SAXException, RuntimeException) { OSL_ASSERT(m_rDocumentHandler.is()); m_rDocumentHandler->characters(str); } -void XFlatXml::ignorableWhitespace(const OUString& str) +void XFlatXml::ignorableWhitespace(const OUString& str) throw (SAXException, RuntimeException) -{ +{ OSL_ASSERT(m_rDocumentHandler.is()); if (!m_bPrettyPrint) return; m_rDocumentHandler->ignorableWhitespace(str); } - -void XFlatXml::processingInstruction(const OUString& str, const OUString& str2) - throw (SAXException, RuntimeException) + +void XFlatXml::processingInstruction(const OUString& str, const OUString& str2) + throw (SAXException, RuntimeException) { OSL_ASSERT(m_rDocumentHandler.is()); m_rDocumentHandler->processingInstruction(str, str2); } -void XFlatXml::setDocumentLocator(const Reference<XLocator>& doclocator) - throw (SAXException, RuntimeException) +void XFlatXml::setDocumentLocator(const Reference<XLocator>& doclocator) + throw (SAXException, RuntimeException) { OSL_ASSERT(m_rDocumentHandler.is()); m_rDocumentHandler->setDocumentLocator(doclocator); diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/FlatXmlFilter_cpp.uno.xml b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/FlatXmlFilter_cpp.uno.xml index 9202844eef76..a7965afc4af0 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/FlatXmlFilter_cpp.uno.xml +++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_cpp/FlatXmlFilter_cpp.uno.xml @@ -5,12 +5,12 @@ <component-description> <author> Aidan Butler </author> <name>devguide.officedev.samples.filter.FlatXmlCpp</name> - + <description> This component is a sample implementation, which describes how a filter may be written that uses the XmlFilterAdaptor component. This filter opens and saves Flat Xml files. </description> - <loader-name> com.sun.star.loader.SharedLibrary </loader-name> - <language> c++ </language> + <loader-name> com.sun.star.loader.SharedLibrary </loader-name> + <language> c++ </language> <status value="final"/> <supported-service>devguide.officedev.samples.filter.FlatXmlCpp</supported-service> <type>com.sun.star.lang.XSingleServiceFactory</type> @@ -47,13 +47,13 @@ <type>com.sun.star.ucb.XSimpleFileAccess</type> <type>com.sun.star.beans.XPropertySet</type> </component-description> - <project-build-dependency> cppuhelper </project-build-dependency> - <project-build-dependency> cppu </project-build-dependency> - <project-build-dependency> sal </project-build-dependency> - <runtime-module-dependency> cppuhelper$(UDK_MAJOR)$(COM) </runtime-module-dependency> - <runtime-module-dependency> salhelper$(UDK_MAJOR)$(COM) </runtime-module-dependency> - <runtime-module-dependency> cppu$(UDK_MAJOR) </runtime-module-dependency> - <runtime-module-dependency> reg$(UDK_MAJOR) </runtime-module-dependency> - <runtime-module-dependency> store$(UDK_MAJOR) </runtime-module-dependency> - <runtime-module-dependency> sal$(UDK_MAJOR) </runtime-module-dependency> + <project-build-dependency> cppuhelper </project-build-dependency> + <project-build-dependency> cppu </project-build-dependency> + <project-build-dependency> sal </project-build-dependency> + <runtime-module-dependency> cppuhelper$(UDK_MAJOR)$(COM) </runtime-module-dependency> + <runtime-module-dependency> salhelper$(UDK_MAJOR)$(COM) </runtime-module-dependency> + <runtime-module-dependency> cppu$(UDK_MAJOR) </runtime-module-dependency> + <runtime-module-dependency> reg$(UDK_MAJOR) </runtime-module-dependency> + <runtime-module-dependency> store$(UDK_MAJOR) </runtime-module-dependency> + <runtime-module-dependency> sal$(UDK_MAJOR) </runtime-module-dependency> </module-description> diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_java/FlatXml.java b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_java/FlatXml.java index cf95e1637c08..e801227ed4be 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_java/FlatXml.java +++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilter_java/FlatXml.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import java.io.*; @@ -50,8 +50,8 @@ import com.sun.star.io.XActiveDataSource; -public class FlatXml implements XImportFilter, XExportFilter, XServiceName, - XServiceInfo, XDocumentHandler, XTypeProvider +public class FlatXml implements XImportFilter, XExportFilter, XServiceName, + XServiceInfo, XDocumentHandler, XTypeProvider { /* @@ -66,15 +66,15 @@ public class FlatXml implements XImportFilter, XExportFilter, XServiceName, static private final String[] __supportedServiceNames = { "devguide.officedev.samples.filter.FlatXmlJava" }; - + public FlatXml(XMultiServiceFactory f) { m_xServiceFactory = f; } - + // --- XTypeProvider --- public byte[] getImplementationId() { return Integer.toString(this.hashCode()).getBytes(); - } + } // --- XServiceName --- public String getServiceName() { @@ -91,10 +91,10 @@ public class FlatXml implements XImportFilter, XExportFilter, XServiceName, public String getImplementationName() { return( this.getClass().getName() ); } - public String[] getSupportedServiceNames() { + public String[] getSupportedServiceNames() { return( __supportedServiceNames ); } - + public com.sun.star.uno.Type[] getTypes() { Type[] typeReturn = {}; try { @@ -103,7 +103,7 @@ public class FlatXml implements XImportFilter, XExportFilter, XServiceName, new Type( XExportFilter.class ), new Type( XImportFilter.class ), new Type( XServiceName.class ), - new Type( XServiceInfo.class ) + new Type( XServiceInfo.class ) }; } catch( java.lang.Exception exception ) { return null; @@ -111,19 +111,19 @@ public class FlatXml implements XImportFilter, XExportFilter, XServiceName, return( typeReturn ); } - public boolean importer(PropertyValue[] aSourceData, XDocumentHandler xDocHandler, String[] msUserData) - throws com.sun.star.uno.RuntimeException, com.sun.star.lang.IllegalArgumentException - { + public boolean importer(PropertyValue[] aSourceData, XDocumentHandler xDocHandler, String[] msUserData) + throws com.sun.star.uno.RuntimeException, com.sun.star.lang.IllegalArgumentException + { String sName = null; String sFileName = null; - String sURL = null; - com.sun.star.io.XInputStream xin = null; + String sURL = null; + com.sun.star.io.XInputStream xin = null; try { - + for (int i = 0 ; i < aSourceData.length; i++) { - sName = aSourceData[i].Name; + sName = aSourceData[i].Name; if (sName.equals("InputStream")) xin = (XInputStream)AnyConverter.toObject(XInputStream.class, aSourceData[i].Value); if (sName.equals("URL")) @@ -131,48 +131,48 @@ public class FlatXml implements XImportFilter, XExportFilter, XServiceName, if (sName.equals("FileName")) sFileName=(String)AnyConverter.toObject(String.class, aSourceData[i].Value); } - + Object tmpObj=m_xServiceFactory.createInstance("com.sun.star.xml.sax.Parser"); if (tmpObj == null) return false; - + XParser xParser = (XParser)UnoRuntime.queryInterface(XParser.class , tmpObj); if (xParser == null) return false; - + InputSource aInput = new InputSource(); aInput.sSystemId = sURL; aInput.aInputStream =xin; xParser.setDocumentHandler ( xDocHandler ); - xParser.parseStream ( aInput ); + xParser.parseStream ( aInput ); } catch (com.sun.star.uno.Exception e){ - e.printStackTrace(); + e.printStackTrace(); return false; } - + // done... return true; } - public boolean exporter(PropertyValue[] aSourceData, String[] msUserData) + public boolean exporter(PropertyValue[] aSourceData, String[] msUserData) throws com.sun.star.uno.RuntimeException, com.sun.star.lang.IllegalArgumentException { try { String sURL = null; String sName = null; XOutputStream xos = null; - - // get interesting values from sourceData + + // get interesting values from sourceData for (int i = 0 ; i < aSourceData.length; i++) { - sName = aSourceData[i].Name; + sName = aSourceData[i].Name; if (sName.equals("OutputStream")) xos = (XOutputStream)AnyConverter.toObject(XOutputStream.class, aSourceData[i].Value); if (sName.equals("URL")) sURL=(String)AnyConverter.toObject(String.class, aSourceData[i].Value); } - + // prepare the XML writer Object tmpObj = null; - if (m_xHandler == null) + if (m_xHandler == null) { tmpObj = m_xServiceFactory.createInstance("com.sun.star.xml.sax.Writer"); if (tmpObj != null) @@ -181,10 +181,10 @@ public class FlatXml implements XImportFilter, XExportFilter, XServiceName, if (m_xHandler == null) return false; - // Connect the provided output stream to the writer + // Connect the provided output stream to the writer XActiveDataSource xADSource = (XActiveDataSource)UnoRuntime.queryInterface( XActiveDataSource.class, m_xHandler); - + if (xADSource != null && xos != null) xADSource.setOutputStream(xos); else @@ -192,23 +192,23 @@ public class FlatXml implements XImportFilter, XExportFilter, XServiceName, } catch (com.sun.star.uno.Exception e){ return false; } - + // done ... return true; } - - public void startDocument () + + public void startDocument () throws com.sun.star.xml.sax.SAXException { m_xHandler.startDocument(); } - + public void endDocument() throws com.sun.star.xml.sax.SAXException { m_xHandler.endDocument(); } - + public void startElement (String str, com.sun.star.xml.sax.XAttributeList xattribs) throws com.sun.star.xml.sax.SAXException { @@ -226,12 +226,12 @@ public class FlatXml implements XImportFilter, XExportFilter, XServiceName, { m_xHandler.characters(str); } - + public void ignorableWhitespace(String str) throws com.sun.star.xml.sax.SAXException { if (!m_bPrettyPrint) return; - else m_xHandler.ignorableWhitespace(str); + else m_xHandler.ignorableWhitespace(str); } public void processingInstruction(String aTarget, String aData) @@ -245,12 +245,12 @@ public class FlatXml implements XImportFilter, XExportFilter, XServiceName, { m_xHandler.setDocumentLocator(xLocator); } - - // ------------------------------------------------------------ + + // ------------------------------------------------------------ // component management - + public static XSingleServiceFactory __getServiceFactory(String implName, - XMultiServiceFactory multiFactory, XRegistryKey regKey) + XMultiServiceFactory multiFactory, XRegistryKey regKey) { XSingleServiceFactory xSingleServiceFactory = null; if (implName.equals(__implName) ) { @@ -260,14 +260,14 @@ public class FlatXml implements XImportFilter, XExportFilter, XServiceName, } catch (java.lang.ClassNotFoundException e) { return null; } - } + } return xSingleServiceFactory; } - - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) + + public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { return FactoryHelper.writeRegistryServiceInfo(__implName, __serviceName, regKey); } - + } diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/LinguisticExamples.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/LinguisticExamples.java index 60829600861f..b4c2cd1edf12 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/LinguisticExamples.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/LinguisticExamples.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // used interfaces @@ -84,14 +84,14 @@ public class LinguisticExamples protected XPropertySet mxLinguProps = null; - public static void main(String args[]) + public static void main(String args[]) { // Create an instance of the class and call it's begin method try { LinguisticExamples aExample = new LinguisticExamples(); aExample.Connect(); - aExample.Run(); - } catch (Exception e) { + aExample.Run(); + } catch (Exception e) { System.err.println("failed to run examples"); e.printStackTrace(); } @@ -119,12 +119,12 @@ public class LinguisticExamples if (mxRemoteContext != null && mxRemoteServiceManager != null) { Object aObj = mxRemoteServiceManager.createInstanceWithContext( "com.sun.star.linguistic2.LinguServiceManager", mxRemoteContext ); - mxLinguSvcMgr = (XLinguServiceManager) + mxLinguSvcMgr = (XLinguServiceManager) UnoRuntime.queryInterface(XLinguServiceManager.class, aObj); } return mxLinguSvcMgr != null; - } - + } + /** Get the SpellChecker to be used. */ @@ -175,9 +175,9 @@ public class LinguisticExamples // use american english as language Locale aLocale = new Locale("en","US",""); - - - + + + // another list of property values to used in function calls below. // Only properties with values different from the (default) values // in the LinguProperties property set need to be supllied. @@ -185,9 +185,9 @@ public class LinguisticExamples aProps[0] = new PropertyValue(); aProps[0].Name = "IsGermanPreReform"; aProps[0].Value = new Boolean( true ); - - - GetSpell(); + + + GetSpell(); if (mxSpell != null) { // test with correct word @@ -198,7 +198,7 @@ public class LinguisticExamples // test with incorrect word aWord = "course"; bIsCorrect = mxSpell.isValid( aWord, aLocale , aEmptyProps ); - System.out.println( aWord + ": " + bIsCorrect ); + System.out.println( aWord + ": " + bIsCorrect ); aWord = "house"; @@ -220,10 +220,10 @@ public class LinguisticExamples } - GetHyph(); + GetHyph(); if (mxHyph != null) { - // maximum number of characters to remain before the hyphen + // maximum number of characters to remain before the hyphen // character in the resulting word of the hyphenation short nMaxLeading = 6; @@ -235,16 +235,16 @@ public class LinguisticExamples else { System.out.println( "valid hyphenation pos found at " - + xHyphWord.getHyphenationPos() + + xHyphWord.getHyphenationPos() + " in " + xHyphWord.getWord() ); System.out.println( "hyphenation char will be after char " - + xHyphWord.getHyphenPos() + + xHyphWord.getHyphenPos() + " in " + xHyphWord.getHyphenatedWord() ); } //! Note: 'aProps' needs to have set 'IsGermanPreReform' to true! - xHyphWord = mxHyph.queryAlternativeSpelling( "Schiffahrt", + xHyphWord = mxHyph.queryAlternativeSpelling( "Schiffahrt", new Locale("de","DE",""), (short)4, aProps ); if (xHyphWord == null) System.out.println( "no alternative spelling found at specified position." ); @@ -253,10 +253,10 @@ public class LinguisticExamples if (xHyphWord.isAlternativeSpelling()) System.out.println( "alternative spelling detectetd!" ); System.out.println( "valid hyphenation pos found at " - + xHyphWord.getHyphenationPos() + + xHyphWord.getHyphenationPos() + " in " + xHyphWord.getWord() ); System.out.println( "hyphenation char will be after char " - + xHyphWord.getHyphenPos() + + xHyphWord.getHyphenPos() + " in " + xHyphWord.getHyphenatedWord() ); } @@ -267,12 +267,12 @@ public class LinguisticExamples if (xPossHyph == null) System.out.println( "no hyphenation positions found." ); else - System.out.println( xPossHyph.getPossibleHyphens() ); - } - - - GetThes(); - if (mxThes != null) + System.out.println( xPossHyph.getPossibleHyphens() ); + } + + + GetThes(); + if (mxThes != null) { XMeaning[] xMeanings = mxThes.queryMeanings("house", aLocale, aEmptyProps ); @@ -287,11 +287,11 @@ public class LinguisticExamples for (int k = 0; k < aSynonyms.length; ++k) System.out.println( " Synonym: " + aSynonyms[k] ); } - } - } - - - + } + } + + + XLinguServiceEventListener aClient = new Client(); // get access to LinguProperties property set @@ -299,18 +299,18 @@ public class LinguisticExamples "com.sun.star.linguistic2.LinguProperties", mxRemoteContext); XPropertySet aLinguProps = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class,aObj); - + // set a spellchecker and hyphenator property value to a defined state try { aLinguProps.setPropertyValue("IsGermanPreReform", new Boolean(true)); } catch (Exception e) { - } + } // now add the client as listener to the service manager to // get informed when spellchecking or hyphenation may produce // different results then before. mxLinguSvcMgr.addLinguServiceManagerListener(aClient); - + // change that property value in order to trigger a property change // event that eventually results in the listeners // 'processLinguServiceEvent' function being called @@ -318,9 +318,9 @@ public class LinguisticExamples aLinguProps.setPropertyValue("IsGermanPreReform", new Boolean(false)); } catch (Exception e) { } - + //! keep the listener and the program alive until the event will - //! be launched. + //! be launched. //! There is a voluntary delay before launching the event! // Of course this code would usually not be in a *real* client // its @@ -328,38 +328,38 @@ public class LinguisticExamples try { this.wait(4000); } catch(Exception e) { - + } } - + //! remove listener before programm termination. //! should not be omitted. mxLinguSvcMgr.removeLinguServiceManagerListener(aClient); - - + + System.exit(0); } /** simple sample implementation of a clients XLinguServiceEventListener * interface implementation */ - public class Client + public class Client implements XLinguServiceEventListener { public void disposing ( EventObject aEventObj ) { //! any references to the EventObjects source have to be //! released here now! - + System.out.println("object listened to will be disposed"); } public void processLinguServiceEvent( LinguServiceEvent aServiceEvent ) - { + { //! do here whatever you think needs to be done depending //! on the event recieved (e.g. trigger background spellchecking //! or hyphenation again.) - + System.out.println("Listener called"); } }; diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/OneInstanceFactory.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/OneInstanceFactory.java index 9b2a22403caa..03e2a665b610 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/OneInstanceFactory.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/OneInstanceFactory.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.lang.XSingleServiceFactory; @@ -45,9 +45,9 @@ import java.lang.reflect.Constructor; // // purpose of this class is to provide a service factory that instantiates -// the services only once (as long as this factory itself exists) +// the services only once (as long as this factory itself exists) // and returns only reference to that instance. -// +// public class OneInstanceFactory implements XSingleServiceFactory, @@ -75,8 +75,8 @@ public class OneInstanceFactory implements //********************** // XSingleServiceFactory //********************** - public Object createInstance() - throws com.sun.star.uno.Exception, + public Object createInstance() + throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException { if (xInstantiatedService == null) @@ -88,7 +88,7 @@ public class OneInstanceFactory implements } catch( Exception e ) { } - + //!! workaround for services not always being created //!! via 'createInstanceWithArguments' XInitialization xIni = (XInitialization) UnoRuntime.queryInterface( @@ -102,15 +102,15 @@ public class OneInstanceFactory implements XPropertySet.class , xMultiFactory.createInstance( "com.sun.star.linguistic2.LinguProperties" ) ); aArguments[0] = xPropSet; - } + } xIni.initialize( aArguments ); } } return xInstantiatedService; } - public Object createInstanceWithArguments( Object[] aArguments ) - throws com.sun.star.uno.Exception, + public Object createInstanceWithArguments( Object[] aArguments ) + throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException { if (xInstantiatedService == null) @@ -145,7 +145,7 @@ public class OneInstanceFactory implements { return aSvcImplName; } - + public String[] getSupportedServiceNames() throws com.sun.star.uno.RuntimeException { diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java index 87b1ea3b5b3b..ec6471480fcd 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.linguistic2.XLinguServiceEventBroadcaster; @@ -66,23 +66,23 @@ public class PropChgHelper implements { return xEvtSource; } - + public XPropertySet GetPropSet() { return xPropSet; } - + public String[] GetPropNames() { return aPropNames; } - + public void LaunchEvent( LinguServiceEvent aEvt ) { int nCnt = aLngSvcEvtListeners.size(); for (int i = 0; i < nCnt; ++i) { - XLinguServiceEventListener xLstnr = + XLinguServiceEventListener xLstnr = (XLinguServiceEventListener) aLngSvcEvtListeners.get(i); if (xLstnr != null) xLstnr.processLinguServiceEvent( aEvt ); @@ -104,7 +104,7 @@ public class PropChgHelper implements if (aPropNames[i].length() != 0) { try { - xPropSet.addPropertyChangeListener( + xPropSet.addPropertyChangeListener( aPropNames[i], (XPropertyChangeListener) this ); } catch( Exception e ) { @@ -124,7 +124,7 @@ public class PropChgHelper implements if (aPropNames[i].length() != 0) { try { - xPropSet.removePropertyChangeListener( + xPropSet.removePropertyChangeListener( aPropNames[i], (XPropertyChangeListener) this ); } catch( Exception e ) { @@ -135,7 +135,7 @@ public class PropChgHelper implements xPropSet = null; } } - + // __________ interface methods __________ //*************** diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper_Hyph.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper_Hyph.java index 00d67df8485a..0b6395036d98 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper_Hyph.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper_Hyph.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.linguistic2.XLinguServiceEventBroadcaster; diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper_Spell.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper_Spell.java index d399e13477e1..9a4f07a33779 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper_Spell.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper_Spell.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.linguistic2.XLinguServiceEventBroadcaster; diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java index adad109f9a87..9e4639c7f5f1 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleHyphenator.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,10 +29,10 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ -// uno +// uno import com.sun.star.lib.uno.helper.ComponentBase; import com.sun.star.uno.UnoRuntime; @@ -43,10 +43,10 @@ import com.sun.star.lang.XSingleServiceFactory; // supported Interfaces import com.sun.star.linguistic2.XHyphenator; import com.sun.star.linguistic2.XLinguServiceEventBroadcaster; -import com.sun.star.lang.XInitialization; +import com.sun.star.lang.XInitialization; import com.sun.star.lang.XComponent; -import com.sun.star.lang.XServiceInfo; -import com.sun.star.lang.XServiceDisplayName; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lang.XServiceDisplayName; // Exceptions import com.sun.star.uno.Exception; @@ -101,10 +101,10 @@ public class SampleHyphenator extends ComponentBase implements { return aLoc1.Language.equals( aLoc2.Language ) && aLoc1.Country .equals( aLoc2.Country ) && - aLoc1.Variant .equals( aLoc2.Variant ); + aLoc1.Variant .equals( aLoc2.Variant ); } - private boolean GetValueToUse( + private boolean GetValueToUse( String aPropName, boolean bDefaultVal, PropertyValue[] aProps ) @@ -139,11 +139,11 @@ public class SampleHyphenator extends ComponentBase implements catch (Exception e) { bRes = bDefaultVal; } - + return bRes; } - - private short GetValueToUse( + + private short GetValueToUse( String aPropName, short nDefaultVal, PropertyValue[] aProps ) @@ -178,20 +178,20 @@ public class SampleHyphenator extends ComponentBase implements catch (Exception e) { nRes = nDefaultVal; } - + return nRes; } - + // __________ interface methods __________ - - + + //***************** //XSupportedLocales //***************** public Locale[] getLocales() throws com.sun.star.uno.RuntimeException { - Locale aLocales[] = + Locale aLocales[] = { new Locale( "de", "DE", "" ), new Locale( "en", "US", "" ) @@ -199,23 +199,23 @@ public class SampleHyphenator extends ComponentBase implements return aLocales; } - - public boolean hasLocale( Locale aLocale ) + + public boolean hasLocale( Locale aLocale ) throws com.sun.star.uno.RuntimeException { boolean bRes = false; if ( IsEqual( aLocale, new Locale( "de", "DE", "" ) ) || IsEqual( aLocale, new Locale( "en", "US", "" ) )) bRes = true; - return bRes; + return bRes; } - + //*********** //XHyphenator //*********** public XHyphenatedWord hyphenate( String aWord, Locale aLocale, - short nMaxLeading, PropertyValue[] aProperties ) + short nMaxLeading, PropertyValue[] aProperties ) throws com.sun.star.uno.RuntimeException, IllegalArgumentException { @@ -239,14 +239,14 @@ public class SampleHyphenator extends ComponentBase implements short nHyphMinWordLen = GetValueToUse( "HyphMinWordLength", (short)5, aProperties ); XHyphenatedWord xRes = null; - + if (aWord.length() >= nHyphMinWordLen) { String aHyphenatedWord = aWord; short nHyphenationPos = -1; short nHyphenPos = -1; - //!! This code needs to be replaced by code calling the actual + //!! This code needs to be replaced by code calling the actual //!! implementation of your hyphenator if (IsEqual( aLocale, new Locale( "de", "DE", "" ) ) ) { @@ -254,7 +254,7 @@ public class SampleHyphenator extends ComponentBase implements { // Note: there is only one position where the word // can be hyphenated... - + aHyphenatedWord = "Schifffahrt"; nHyphenationPos = 4; nHyphenPos = 5; @@ -267,15 +267,15 @@ public class SampleHyphenator extends ComponentBase implements else if (IsEqual( aLocale, new Locale( "en", "US", "" ) ) ) { int nLast = aWord.length() - 1 - nHyphMinTrailing; - - if ( aWord.equals( "waterfall" ) ) + + if ( aWord.equals( "waterfall" ) ) { if (4 <= nLast) nHyphenationPos = nHyphenPos = 4; else nHyphenationPos = nHyphenPos = 1; } - else if ( aWord.equals( "driving" ) ) + else if ( aWord.equals( "driving" ) ) { nHyphenationPos = nHyphenPos = 3; } @@ -284,19 +284,19 @@ public class SampleHyphenator extends ComponentBase implements // check if hyphenation pos is valid, // a value of -1 indicates that hyphenation is not possible if ( nHyphenationPos != -1 && - !(nHyphenationPos < nHyphMinLeading) && + !(nHyphenationPos < nHyphMinLeading) && !(nHyphenationPos >= aWord.length() - nHyphMinTrailing)) { - xRes = new XHyphenatedWord_impl(aWord, aLocale, + xRes = new XHyphenatedWord_impl(aWord, aLocale, nHyphenationPos, aHyphenatedWord, nHyphenPos); } } return xRes; } - + public XHyphenatedWord queryAlternativeSpelling( String aWord, Locale aLocale, - short nIndex, PropertyValue[] aProperties ) + short nIndex, PropertyValue[] aProperties ) throws com.sun.star.uno.RuntimeException, IllegalArgumentException { @@ -318,10 +318,10 @@ public class SampleHyphenator extends ComponentBase implements short nHyphMinLeading = GetValueToUse( "HyphMinLeading", (short)2, aProperties ); short nHyphMinTrailing = GetValueToUse( "HyphMinTrailing", (short)2, aProperties ); short nHyphMinWordLen = GetValueToUse( "HyphMinWordLength", (short)5, aProperties ); - + XHyphenatedWord xRes = null; - //!! This code needs to be replaced by code calling the actual + //!! This code needs to be replaced by code calling the actual //!! implementation of your hyphenator if ( IsEqual( aLocale, new Locale( "de", "DE", "" ) ) ) { @@ -330,8 +330,8 @@ public class SampleHyphenator extends ComponentBase implements // is set. if (aWord.equals( "Schiffahrt" ) && bIsGermanPreReform && nIndex == 4) - { - xRes = new XHyphenatedWord_impl(aWord, aLocale, + { + xRes = new XHyphenatedWord_impl(aWord, aLocale, (short)4, "Schifffahrt", (short)5 ); } } @@ -342,16 +342,16 @@ public class SampleHyphenator extends ComponentBase implements return xRes; } - + public XPossibleHyphens createPossibleHyphens( String aWord, Locale aLocale, - PropertyValue[] aProperties ) + PropertyValue[] aProperties ) throws com.sun.star.uno.RuntimeException, IllegalArgumentException { if (IsEqual( aLocale, new Locale() ) || aWord.length() == 0) return null; - + // linguistic is currently not allowed to throw exceptions // thus we return null which means 'word cannot be hyphenated' if (!hasLocale( aLocale )) @@ -367,15 +367,15 @@ public class SampleHyphenator extends ComponentBase implements short nHyphMinLeading = GetValueToUse( "HyphMinLeading", (short)2, aProperties ); short nHyphMinTrailing = GetValueToUse( "HyphMinTrailing", (short)2, aProperties ); short nHyphMinWordLen = GetValueToUse( "HyphMinWordLength", (short)5, aProperties ); - + XPossibleHyphens xRes = null; - //!! This code needs to be replaced by code calling the actual + //!! This code needs to be replaced by code calling the actual //!! implementation of your hyphenator if ( IsEqual( aLocale, new Locale( "de", "DE", "" ) ) ) { if (bIsGermanPreReform && aWord.equals( "Schiffahrt" )) - { + { short aPos[] = new short[] { (short) 4 }; xRes = new XPossibleHyphens_impl(aWord, aLocale, "Schiff=fahrt", aPos); @@ -389,14 +389,14 @@ public class SampleHyphenator extends ComponentBase implements } else if ( IsEqual( aLocale, new Locale( "en", "US", "" ) ) ) { - if ( aWord.equals( "waterfall" ) ) + if ( aWord.equals( "waterfall" ) ) { short aPos[] = new short[] { (short) 1, (short) 4 }; xRes = new XPossibleHyphens_impl(aWord, aLocale, "wa=ter=fall", aPos); } - else if ( aWord.equals( "driving" ) ) + else if ( aWord.equals( "driving" ) ) { short aPos[] = new short[] { (short) 3 }; @@ -407,7 +407,7 @@ public class SampleHyphenator extends ComponentBase implements return xRes; } - + //***************************** //XLinguServiceEventBroadcaster //***************************** @@ -415,35 +415,35 @@ public class SampleHyphenator extends ComponentBase implements XLinguServiceEventListener xLstnr ) throws com.sun.star.uno.RuntimeException { - boolean bRes = false; + boolean bRes = false; if (!bDisposing && xLstnr != null) bRes = aPropChgHelper.addLinguServiceEventListener( xLstnr ); return bRes; } - + public boolean removeLinguServiceEventListener( - XLinguServiceEventListener xLstnr ) + XLinguServiceEventListener xLstnr ) throws com.sun.star.uno.RuntimeException { - boolean bRes = false; + boolean bRes = false; if (!bDisposing && xLstnr != null) bRes = aPropChgHelper.removeLinguServiceEventListener( xLstnr ); return bRes; - } + } //******************** // XServiceDisplayName //******************** - public String getServiceDisplayName( Locale aLocale ) + public String getServiceDisplayName( Locale aLocale ) throws com.sun.star.uno.RuntimeException { - return "Java Samples"; + return "Java Samples"; } //**************** // XInitialization //**************** - public void initialize( Object[] aArguments ) + public void initialize( Object[] aArguments ) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException { @@ -457,7 +457,7 @@ public class SampleHyphenator extends ComponentBase implements } } - + //************* // XServiceInfo //************* @@ -479,17 +479,17 @@ public class SampleHyphenator extends ComponentBase implements { return _aSvcImplName; } - + public String[] getSupportedServiceNames() throws com.sun.star.uno.RuntimeException { return getSupportedServiceNames_Static(); } - + // __________ static things __________ public static String _aSvcImplName = "com.sun.star.linguistic2.JavaSamples.SampleHyphenator"; - + public static String[] getSupportedServiceNames_Static() { String[] aResult = { "com.sun.star.linguistic2.Hyphenator" }; @@ -531,7 +531,7 @@ public class SampleHyphenator extends ComponentBase implements * @param xRegKey the registryKey * @see com.sun.star.comp.loader.JavaLoader */ - public static boolean __writeRegistryServiceInfo( + public static boolean __writeRegistryServiceInfo( com.sun.star.registry.XRegistryKey xRegKey ) { boolean bResult = true; diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.java index 9e2cd5a81853..f63bc81af147 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleSpellChecker.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // uno @@ -43,10 +43,10 @@ import com.sun.star.lang.XSingleServiceFactory; // supported Interfaces import com.sun.star.linguistic2.XSpellChecker; import com.sun.star.linguistic2.XLinguServiceEventBroadcaster; -import com.sun.star.lang.XInitialization; +import com.sun.star.lang.XInitialization; import com.sun.star.lang.XComponent; -import com.sun.star.lang.XServiceInfo; -import com.sun.star.lang.XServiceDisplayName; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lang.XServiceDisplayName; // Exceptions import com.sun.star.uno.Exception; @@ -101,10 +101,10 @@ public class SampleSpellChecker extends ComponentBase implements { return aLoc1.Language.equals( aLoc2.Language ) && aLoc1.Country .equals( aLoc2.Country ) && - aLoc1.Variant .equals( aLoc2.Variant ); + aLoc1.Variant .equals( aLoc2.Variant ); } - private boolean GetValueToUse( + private boolean GetValueToUse( String aPropName, boolean bDefaultVal, PropertyValue[] aProps ) @@ -139,13 +139,13 @@ public class SampleSpellChecker extends ComponentBase implements catch (Exception e) { bRes = bDefaultVal; } - + return bRes; } private boolean IsUpper( String aWord, Locale aLocale ) { - java.util.Locale aLang = new java.util.Locale( + java.util.Locale aLang = new java.util.Locale( aLocale.Language, aLocale.Country, aLocale.Variant ); return aWord.equals( aWord.toUpperCase( aLang ) ); } @@ -161,14 +161,14 @@ public class SampleSpellChecker extends ComponentBase implements return false; } - private short GetSpellFailure( - String aWord, + private short GetSpellFailure( + String aWord, Locale aLocale, - PropertyValue[] aProperties ) + PropertyValue[] aProperties ) { short nRes = -1; - //!! This code needs to be replaced by code calling the actual + //!! This code needs to be replaced by code calling the actual //!! implementation of your spellchecker boolean bIsGermanPreReform = GetValueToUse( "IsGermanPreReform", false, aProperties ); if (IsEqual( aLocale, new Locale( "de", "DE", "" ) )) @@ -188,23 +188,23 @@ public class SampleSpellChecker extends ComponentBase implements { // default value (no other SpellFailure type is applicable) nRes = SpellFailure.SPELLING_ERROR; - + if (aWord.equals( "arizona" )) nRes = SpellFailure.CAPTION_ERROR; else if (aWord.equals( "house" )) nRes = SpellFailure.SPELLING_ERROR; else if (aWord.equals( "course" )) nRes = SpellFailure.IS_NEGATIVE_WORD; - } + } } - + return nRes; } - private XSpellAlternatives GetProposals( - String aWord, - Locale aLocale, - PropertyValue[] aProperties ) + private XSpellAlternatives GetProposals( + String aWord, + Locale aLocale, + PropertyValue[] aProperties ) { short nType = SpellFailure.SPELLING_ERROR; String[] aProposals = null; @@ -218,7 +218,7 @@ public class SampleSpellChecker extends ComponentBase implements boolean bIsSpellUpperCase = GetValueToUse( "IsSpellUpperCase", false, aProperties ); boolean bIsSpellCapitalization = GetValueToUse( "IsSpellCapitalization", true, aProperties ); - //!! This code needs to be replaced by code calling the actual + //!! This code needs to be replaced by code calling the actual //!! implementation of your spellchecker if (IsEqual( aLocale, new Locale( "de", "DE", "" ) )) { @@ -257,17 +257,17 @@ public class SampleSpellChecker extends ComponentBase implements return new XSpellAlternatives_impl( aWord, aLocale, nType, aProposals ); } - + // __________ interface methods __________ - - + + //***************** //XSupportedLocales //***************** public Locale[] getLocales() throws com.sun.star.uno.RuntimeException { - Locale aLocales[] = + Locale aLocales[] = { new Locale( "de", "DE", "" ), new Locale( "en", "US", "" ) @@ -275,30 +275,30 @@ public class SampleSpellChecker extends ComponentBase implements return aLocales; } - - public boolean hasLocale( Locale aLocale ) + + public boolean hasLocale( Locale aLocale ) throws com.sun.star.uno.RuntimeException { boolean bRes = false; if ( IsEqual( aLocale, new Locale( "de", "DE", "" ) ) || IsEqual( aLocale, new Locale( "en", "US", "" ) )) bRes = true; - return bRes; + return bRes; } - + //************* //XSpellChecker //************* public boolean isValid( String aWord, Locale aLocale, - PropertyValue[] aProperties ) + PropertyValue[] aProperties ) throws com.sun.star.uno.RuntimeException, IllegalArgumentException { if (IsEqual( aLocale, new Locale() ) || aWord.length() == 0) return true; - + // linguistic is currently not allowed to throw exceptions // thus we return null which means 'word cannot be spelled' if (!hasLocale( aLocale )) @@ -312,7 +312,7 @@ public class SampleSpellChecker extends ComponentBase implements boolean bIsSpellWithDigits = GetValueToUse( "IsSpellWithDigits", false, aProperties ); boolean bIsSpellUpperCase = GetValueToUse( "IsSpellUpperCase", false, aProperties ); boolean bIsSpellCapitalization = GetValueToUse( "IsSpellCapitalization", true, aProperties ); - + short nFailure = GetSpellFailure( aWord, aLocale, aProperties ); if (nFailure != -1) { @@ -327,22 +327,22 @@ public class SampleSpellChecker extends ComponentBase implements return nFailure == -1; } - - + + public XSpellAlternatives spell( String aWord, Locale aLocale, - PropertyValue[] aProperties ) + PropertyValue[] aProperties ) throws com.sun.star.uno.RuntimeException, IllegalArgumentException { if (IsEqual( aLocale, new Locale() ) || aWord.length() == 0) return null; - + // linguistic is currently not allowed to throw exceptions // thus we return null fwhich means 'word cannot be spelled' if (!hasLocale( aLocale )) return null; - + XSpellAlternatives xRes = null; if (!isValid( aWord, aLocale, aProperties )) { @@ -350,8 +350,8 @@ public class SampleSpellChecker extends ComponentBase implements } return xRes; } - - + + //***************************** //XLinguServiceEventBroadcaster //***************************** @@ -359,35 +359,35 @@ public class SampleSpellChecker extends ComponentBase implements XLinguServiceEventListener xLstnr ) throws com.sun.star.uno.RuntimeException { - boolean bRes = false; + boolean bRes = false; if (!bDisposing && xLstnr != null) bRes = aPropChgHelper.addLinguServiceEventListener( xLstnr ); return bRes; } - + public boolean removeLinguServiceEventListener( - XLinguServiceEventListener xLstnr ) + XLinguServiceEventListener xLstnr ) throws com.sun.star.uno.RuntimeException { - boolean bRes = false; + boolean bRes = false; if (!bDisposing && xLstnr != null) bRes = aPropChgHelper.removeLinguServiceEventListener( xLstnr ); return bRes; - } + } //******************** // XServiceDisplayName //******************** - public String getServiceDisplayName( Locale aLocale ) + public String getServiceDisplayName( Locale aLocale ) throws com.sun.star.uno.RuntimeException { - return "Java Samples"; + return "Java Samples"; } //**************** // XInitialization //**************** - public void initialize( Object[] aArguments ) + public void initialize( Object[] aArguments ) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException { @@ -422,17 +422,17 @@ public class SampleSpellChecker extends ComponentBase implements { return _aSvcImplName; } - + public String[] getSupportedServiceNames() throws com.sun.star.uno.RuntimeException { return getSupportedServiceNames_Static(); } - + // __________ static things __________ public static String _aSvcImplName = "com.sun.star.linguistic2.JavaSamples.SampleSpellChecker"; - + public static String[] getSupportedServiceNames_Static() { String[] aResult = { "com.sun.star.linguistic2.SpellChecker" }; @@ -474,7 +474,7 @@ public class SampleSpellChecker extends ComponentBase implements * @param xRegKey the registryKey * @see com.sun.star.comp.loader.JavaLoader */ - public static boolean __writeRegistryServiceInfo( + public static boolean __writeRegistryServiceInfo( com.sun.star.registry.XRegistryKey xRegKey ) { boolean bResult = true; diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.java index 7e5bbb1bf442..e3b361f87a72 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/SampleThesaurus.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // uno @@ -42,10 +42,10 @@ import com.sun.star.lang.XSingleServiceFactory; // supported Interfaces import com.sun.star.linguistic2.XThesaurus; -import com.sun.star.lang.XInitialization; +import com.sun.star.lang.XInitialization; import com.sun.star.lang.XComponent; -import com.sun.star.lang.XServiceInfo; -import com.sun.star.lang.XServiceDisplayName; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.lang.XServiceDisplayName; // Exceptions import com.sun.star.uno.Exception; @@ -74,7 +74,7 @@ public class SampleThesaurus extends ComponentBase implements PropChgHelper aPropChgHelper; ArrayList aEvtListeners; boolean bDisposing; - + public SampleThesaurus() { // names of relevant properties to be used @@ -84,13 +84,13 @@ public class SampleThesaurus extends ComponentBase implements "IsUseDictionaryList", "IsGermanPreReform", }; - + // this service has no listeners thus we may use the base class, - // which is here basically used only to keep track of the + // which is here basically used only to keep track of the // property set (and it's lifetime) since it gets used in the // 'GetValueToUse' function aPropChgHelper = new PropChgHelper( (XThesaurus) this, aProps ); - + aEvtListeners = new ArrayList(); bDisposing = false; } @@ -99,10 +99,10 @@ public class SampleThesaurus extends ComponentBase implements { return aLoc1.Language.equals( aLoc2.Language ) && aLoc1.Country .equals( aLoc2.Country ) && - aLoc1.Variant .equals( aLoc2.Variant ); + aLoc1.Variant .equals( aLoc2.Variant ); } - private boolean GetValueToUse( + private boolean GetValueToUse( String aPropName, boolean bDefaultVal, PropertyValue[] aProps ) @@ -137,40 +137,40 @@ public class SampleThesaurus extends ComponentBase implements catch (Exception e) { bRes = bDefaultVal; } - + return bRes; } - + // __________ interface methods __________ - - + + //***************** //XSupportedLocales //***************** public Locale[] getLocales() throws com.sun.star.uno.RuntimeException { - Locale aLocales[] = + Locale aLocales[] = { new Locale( "en", "US", "" ) }; return aLocales; } - - public boolean hasLocale( Locale aLocale ) + + public boolean hasLocale( Locale aLocale ) throws com.sun.star.uno.RuntimeException { boolean bRes = false; if (IsEqual( aLocale, new Locale( "en", "US", "" ) )) bRes = true; - return bRes; + return bRes; } - + //********** //XThesaurus //********** - public XMeaning[] queryMeanings( + public XMeaning[] queryMeanings( String aTerm, Locale aLocale, PropertyValue[] aProperties ) throws com.sun.star.lang.IllegalArgumentException, @@ -178,7 +178,7 @@ public class SampleThesaurus extends ComponentBase implements { if (IsEqual( aLocale, new Locale() ) || aTerm.length() == 0) return null; - + // linguistic is currently not allowed to throw exceptions // thus we return null fwhich means 'word cannot be looked up' if (!hasLocale( aLocale )) @@ -192,39 +192,39 @@ public class SampleThesaurus extends ComponentBase implements XMeaning[] aRes = null; - //!! This code needs to be replaced by code calling the actual + //!! This code needs to be replaced by code calling the actual //!! implementation of your thesaurus if (aTerm.equals( "house" ) && IsEqual( aLocale, new Locale( "en", "US", "" ) ) ) { aRes = new XMeaning[] { - new XMeaning_impl( "a building where one lives", + new XMeaning_impl( "a building where one lives", new String[]{ "home", "place", "dwelling" } ), - new XMeaning_impl( "a group of people sharing common ancestry", + new XMeaning_impl( "a group of people sharing common ancestry", new String[]{ "family", "clan", "kindred" } ), - new XMeaning_impl( "to provide with lodging", + new XMeaning_impl( "to provide with lodging", new String[]{ "room", "board", "put up" } ) }; } return aRes; } - - + + //******************** // XServiceDisplayName //******************** - public String getServiceDisplayName( Locale aLocale ) + public String getServiceDisplayName( Locale aLocale ) throws com.sun.star.uno.RuntimeException { - return "Java Samples"; + return "Java Samples"; } //**************** // XInitialization //**************** - public void initialize( Object[] aArguments ) + public void initialize( Object[] aArguments ) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException { @@ -259,17 +259,17 @@ public class SampleThesaurus extends ComponentBase implements { return _aSvcImplName; } - + public String[] getSupportedServiceNames() throws com.sun.star.uno.RuntimeException { return getSupportedServiceNames_Static(); } - + // __________ static things __________ public static String _aSvcImplName = "com.sun.star.linguistic2.JavaSamples.SampleThesaurus"; - + public static String[] getSupportedServiceNames_Static() { String[] aResult = { "com.sun.star.linguistic2.Thesaurus" }; @@ -311,7 +311,7 @@ public class SampleThesaurus extends ComponentBase implements * @param xRegKey the registryKey * @see com.sun.star.comp.loader.JavaLoader */ - public static boolean __writeRegistryServiceInfo( + public static boolean __writeRegistryServiceInfo( com.sun.star.registry.XRegistryKey xRegKey ) { boolean bResult = true; diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XHyphenatedWord_impl.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XHyphenatedWord_impl.java index 47405dd38a89..08fd7ab6dde6 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XHyphenatedWord_impl.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XHyphenatedWord_impl.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.lang.Locale; @@ -45,10 +45,10 @@ public class XHyphenatedWord_impl implements boolean bIsAltSpelling; public XHyphenatedWord_impl( - String aWord, - Locale aLang, + String aWord, + Locale aLang, short nHyphenationPos, - String aHyphenatedWord, + String aHyphenatedWord, short nHyphenPos ) { this.aWord = aWord; @@ -58,7 +58,7 @@ public class XHyphenatedWord_impl implements this.nHyphenPos = nHyphenPos; this.bIsAltSpelling = (aWord != aHyphenatedWord); - //!! none of these cases should ever occur! + //!! none of these cases should ever occur! //!! values provided only for safety if (this.aWord == null) this.aWord = new String(); @@ -67,7 +67,7 @@ public class XHyphenatedWord_impl implements if (this.aHyphenatedWord == null) this.aHyphenatedWord = new String(); } - + // XHyphenatedWord public String getWord() throws com.sun.star.uno.RuntimeException @@ -86,7 +86,7 @@ public class XHyphenatedWord_impl implements { return aHyphenatedWord; } - public short getHyphenPos() throws com.sun.star.uno.RuntimeException + public short getHyphenPos() throws com.sun.star.uno.RuntimeException { return nHyphenPos; } diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XMeaning_impl.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XMeaning_impl.java index b1fc2e1ea710..29adf8f9f1a4 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XMeaning_impl.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XMeaning_impl.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.lang.Locale; @@ -44,8 +44,8 @@ public class XMeaning_impl implements { this.aMeaning = aMeaning; this.aSynonyms = aSynonyms; - - //!! none of these cases should ever occur! + + //!! none of these cases should ever occur! //!! values provided only for safety if (this.aMeaning == null) this.aMeaning = new String(); diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XPossibleHyphens_impl.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XPossibleHyphens_impl.java index dce63f8d8ec9..3756dddd4e51 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XPossibleHyphens_impl.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XPossibleHyphens_impl.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.lang.Locale; @@ -43,7 +43,7 @@ public class XPossibleHyphens_impl implements Locale aLang; public XPossibleHyphens_impl( - String aWord, + String aWord, Locale aLang, String aHyphWord, short[] aOrigHyphenPos) @@ -52,8 +52,8 @@ public class XPossibleHyphens_impl implements this.aLang = aLang; this.aHyphWord = aHyphWord; this.aOrigHyphenPos = aOrigHyphenPos; - - //!! none of these cases should ever occur! + + //!! none of these cases should ever occur! //!! values provided only for safety if (this.aWord == null) this.aWord = new String(); @@ -67,7 +67,7 @@ public class XPossibleHyphens_impl implements if (this.aOrigHyphenPos == null) this.aOrigHyphenPos = new short[]{}; } - + // XPossibleHyphens public String getWord() throws com.sun.star.uno.RuntimeException { @@ -78,9 +78,9 @@ public class XPossibleHyphens_impl implements { return aLang; } - public String getPossibleHyphens() throws com.sun.star.uno.RuntimeException + public String getPossibleHyphens() throws com.sun.star.uno.RuntimeException { - return aHyphWord; + return aHyphWord; } public short[] getHyphenationPositions() throws com.sun.star.uno.RuntimeException { diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XSpellAlternatives_impl.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XSpellAlternatives_impl.java index 0c3cdd0bf89e..15e6c17ccb80 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XSpellAlternatives_impl.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/XSpellAlternatives_impl.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.lang.Locale; @@ -43,24 +43,24 @@ public class XSpellAlternatives_impl implements String[] aAlt; // list of alternatives, may be empty. short nType; // type of failure - public XSpellAlternatives_impl( - String aWord, - Locale aLanguage, - short nFailureType, + public XSpellAlternatives_impl( + String aWord, + Locale aLanguage, + short nFailureType, String[] aAlt ) { this.aWord = aWord; this.aLanguage = aLanguage; this.aAlt = aAlt; this.nType = nFailureType; - - //!! none of these cases should ever occur! + + //!! none of these cases should ever occur! //!! values provided only for safety if (this.aWord == null) this.aWord = new String(); if (this.aLanguage == null) this.aLanguage = new Locale(); - + // having no alternatives is OK though. // still for safety an empty existing array has to be provided. if (this.aAlt == null) diff --git a/odk/examples/DevelopersGuide/OfficeDev/MenuElement.java b/odk/examples/DevelopersGuide/OfficeDev/MenuElement.java index 71ec62d69098..bf6c6ce419b2 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/MenuElement.java +++ b/odk/examples/DevelopersGuide/OfficeDev/MenuElement.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.lang.XServiceInfo; @@ -45,7 +45,7 @@ public class MenuElement return xServiceInfo.supportsService( "com.sun.star.ui.ActionTrigger" ); } - + static public boolean IsMenuSeparator( com.sun.star.beans.XPropertySet xMenuElement ) { com.sun.star.lang.XServiceInfo xServiceInfo = (com.sun.star.lang.XServiceInfo)UnoRuntime.queryInterface( diff --git a/odk/examples/DevelopersGuide/OfficeDev/Number_Formats.java b/odk/examples/DevelopersGuide/OfficeDev/Number_Formats.java index de05e4caa2f1..9ea9174e02a8 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/Number_Formats.java +++ b/odk/examples/DevelopersGuide/OfficeDev/Number_Formats.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ diff --git a/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java b/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java index 7f0bd79b99e4..6d4745b97412 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java +++ b/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // __________ Imports __________ @@ -175,7 +175,7 @@ public class OfficeConnect */ // singleton connection instance private static OfficeConnect maConnection; - + // reference to remote office context private com.sun.star.uno.XComponentContext mxOfficeContext; // reference to remote service manager diff --git a/odk/examples/DevelopersGuide/OfficeDev/PathSettings/PathSettingsTest.java b/odk/examples/DevelopersGuide/OfficeDev/PathSettings/PathSettingsTest.java index 9aaeadc74f79..44d0a2c9c094 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/PathSettings/PathSettingsTest.java +++ b/odk/examples/DevelopersGuide/OfficeDev/PathSettings/PathSettingsTest.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.uno.UnoRuntime; @@ -46,7 +46,7 @@ import com.sun.star.beans.UnknownPropertyException; * path pathsettings servce. */ public class PathSettingsTest extends java.lang.Object { - + /* * List of pre-defined path variables supported by * the path settings service. @@ -77,28 +77,28 @@ public class PathSettingsTest extends java.lang.Object { "UserDictionary", "Work" }; - + /* * @param args the command line arguments */ public static void main(String[] args) { - + XComponentContext xRemoteContext = null; XMultiComponentFactory xRemoteServiceManager = null; XPropertySet xPathSettingsService = null; - + try { // get the remote office context. If necessary a new office // process is started xRemoteContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); System.out.println("Connected to a running office ..."); xRemoteServiceManager = xRemoteContext.getServiceManager(); - + Object pathSubst = xRemoteServiceManager.createInstanceWithContext( "com.sun.star.comp.framework.PathSettings", xRemoteContext ); xPathSettingsService = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, pathSubst); - + /* Work with path settings */ workWithPathSettings( xPathSettingsService ); } @@ -120,12 +120,12 @@ public class PathSettingsTest extends java.lang.Object { for ( int i=0; i<predefinedPathProperties.length; i++ ) { try { /* Retrieve values for path properties from path settings - * service*/ - Object aValue = xPathSettingsService.getPropertyValue( + * service*/ + Object aValue = xPathSettingsService.getPropertyValue( predefinedPathProperties[i] ); - + // getPropertyValue returns an Object, you have to cast - // it to type that you need + // it to type that you need String aPath = (String)aValue; System.out.println( "Property="+ predefinedPathProperties[i] + " Path=" + aPath ); @@ -137,11 +137,11 @@ public class PathSettingsTest extends java.lang.Object { System.err.println( "WrappedTargetException has been thrown accessing "+predefinedPathProperties[i]); } } - + // Try to modfiy the work path property. After running this example - // you should see the new value of "My Documents" in the path options + // you should see the new value of "My Documents" in the path options // tab page, accessible via "Tools - Options - [Star|Open]Office - - // Paths". + // Paths". // If you want to revert the changes, you can also do it with the // path tab page. try { diff --git a/odk/examples/DevelopersGuide/OfficeDev/PathSubstitution/PathSubstitutionTest.java b/odk/examples/DevelopersGuide/OfficeDev/PathSubstitution/PathSubstitutionTest.java index 26faedd97da9..5aad6fa07b8a 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/PathSubstitution/PathSubstitutionTest.java +++ b/odk/examples/DevelopersGuide/OfficeDev/PathSubstitution/PathSubstitutionTest.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.uno.UnoRuntime; @@ -44,7 +44,7 @@ import com.sun.star.util.XStringSubstitution; * @author Carsten Driesner */ public class PathSubstitutionTest extends java.lang.Object { - + /* * List of pre-defined path variables supported by * the path substitution service. @@ -53,28 +53,28 @@ public class PathSubstitutionTest extends java.lang.Object { "$(home)","$(inst)","$(prog)","$(temp)","$(user)", "$(work)","$(path)","$(lang)","$(langid)","$(vlang)" }; - + /* * @param args the command line arguments */ public static void main(String[] args) { - + XComponentContext xRemoteContext = null; XMultiComponentFactory xRemoteServiceManager = null; XStringSubstitution xPathSubstService = null; - + try { // get the remote office context. If necessary a new office // process is started xRemoteContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); System.out.println("Connected to a running office ..."); xRemoteServiceManager = xRemoteContext.getServiceManager(); - + Object pathSubst = xRemoteServiceManager.createInstanceWithContext( "com.sun.star.comp.framework.PathSubstitution", xRemoteContext ); xPathSubstService = (XStringSubstitution)UnoRuntime.queryInterface( XStringSubstitution.class, pathSubst); - + /* Work with path variables */ workWithPathVariables( xPathSubstService ); } @@ -91,22 +91,22 @@ public class PathSubstitutionTest extends java.lang.Object { if ( xPathSubstService != null ) { for ( int i=0; i<predefinedPathVariables.length; i++ ) { try { - /* Retrieve values for pre-defined path variables */ - String aValue = xPathSubstService.getSubstituteVariableValue( + /* Retrieve values for pre-defined path variables */ + String aValue = xPathSubstService.getSubstituteVariableValue( predefinedPathVariables[i] ); - System.out.println( "Variable: "+ predefinedPathVariables[i] + + System.out.println( "Variable: "+ predefinedPathVariables[i] + " value=" + aValue ); } catch ( com.sun.star.container.NoSuchElementException e) { System.err.println( "NoSuchElementException has been thrown accessing "+predefinedPathVariables[i]); } } - + // Check the resubstitution function try { String aPath = xPathSubstService.getSubstituteVariableValue( predefinedPathVariables[0] ); // Use $(home) as starting point - aPath += "/test"; // extend the path + aPath += "/test"; // extend the path System.out.println( "Path="+aPath ); String aResubstPath = xPathSubstService.reSubstituteVariables( aPath ); System.out.println( "Resubstituted path="+aResubstPath ); diff --git a/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/TerminateListener.java b/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/TerminateListener.java index 65343e967c69..b04e95c582b1 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/TerminateListener.java +++ b/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/TerminateListener.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.frame.TerminationVetoException; @@ -45,9 +45,9 @@ public class TerminateListener implements XTerminateListener { System.out.println("about to terminate..."); } - public void queryTermination(com.sun.star.lang.EventObject eventObject) + public void queryTermination(com.sun.star.lang.EventObject eventObject) throws TerminationVetoException { - + // test if we can terminate now if (TerminationTest.isAtWork() == true) { System.out.println("Terminate while we are at work? You can't mean it serious ;-)!"); @@ -56,5 +56,5 @@ public class TerminateListener implements XTerminateListener { } public void disposing(com.sun.star.lang.EventObject eventObject) { - } + } } diff --git a/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/TerminationTest.java b/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/TerminationTest.java index 8c0a0c556cbe..0df7b6b2c515 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/TerminationTest.java +++ b/odk/examples/DevelopersGuide/OfficeDev/TerminationTest/TerminationTest.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.uno.UnoRuntime; @@ -42,7 +42,7 @@ import com.sun.star.frame.XDesktop; * @author dschulten */ public class TerminationTest extends java.lang.Object { - + private static boolean atWork = false; /** * @param args the command line arguments @@ -52,8 +52,8 @@ public class TerminationTest extends java.lang.Object { XComponentContext xRemoteContext = null; XMultiComponentFactory xRemoteServiceManager = null; XDesktop xDesktop = null; - - try { + + try { // get the remote office context. If necessary a new office // process is started xRemoteContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); @@ -63,26 +63,26 @@ public class TerminationTest extends java.lang.Object { Object desktop = xRemoteServiceManager.createInstanceWithContext( "com.sun.star.frame.Desktop", xRemoteContext); xDesktop = (XDesktop)UnoRuntime.queryInterface(XDesktop.class, desktop); - + TerminateListener terminateListener = new TerminateListener(); xDesktop.addTerminateListener(terminateListener); - + atWork = true; // try to terminate while we are at work boolean terminated = xDesktop.terminate(); System.out.println("The Office " + - (terminated == true ? - "has been terminated" : + (terminated == true ? + "has been terminated" : "is still running, we are at work")); - + // no longer at work atWork = false; - // once more: try to terminate + // once more: try to terminate terminated = xDesktop.terminate(); - System.out.println("The Office " + + System.out.println("The Office " + (terminated == true ? "has been terminated" : - "is still running. Someone else prevents termination, " + + "is still running. Someone else prevents termination, " + "e.g. the quickstarter")); } catch (java.lang.Exception e){ @@ -91,8 +91,8 @@ public class TerminationTest extends java.lang.Object { finally { System.exit(0); } - - + + } public static boolean isAtWork() { return atWork; diff --git a/odk/examples/DevelopersGuide/ProfUNO/CppBinding/office_connect.cxx b/odk/examples/DevelopersGuide/ProfUNO/CppBinding/office_connect.cxx index 9b476874ce26..5361027274ab 100644 --- a/odk/examples/DevelopersGuide/ProfUNO/CppBinding/office_connect.cxx +++ b/odk/examples/DevelopersGuide/ProfUNO/CppBinding/office_connect.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include <stdio.h> @@ -55,15 +55,15 @@ SAL_IMPLEMENT_MAIN() defaultBootstrap_InitialComponentContext(); // retrieve the servicemanager from the context - Reference< XMultiComponentFactory > rServiceManager = + Reference< XMultiComponentFactory > rServiceManager = rComponentContext->getServiceManager(); // instantiate a sample service with the servicemanager. Reference< XInterface > rInstance = - rServiceManager->createInstanceWithContext( + rServiceManager->createInstanceWithContext( OUString::createFromAscii("com.sun.star.bridge.UnoUrlResolver" ), rComponentContext ); - + // Query for the XUnoUrlResolver interface Reference< XUnoUrlResolver > rResolver( rInstance, UNO_QUERY ); @@ -75,9 +75,9 @@ SAL_IMPLEMENT_MAIN() try { // resolve the uno-url - rInstance = rResolver->resolve( OUString::createFromAscii( + rInstance = rResolver->resolve( OUString::createFromAscii( "uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager" ) ); - + if( ! rInstance.is() ) { printf( "StarOffice.ServiceManager is not exported from remote counterpart\n" ); @@ -94,7 +94,7 @@ SAL_IMPLEMENT_MAIN() } printf( "Connected sucessfully to the office\n" ); - } + } catch( Exception &e ) { OString o = OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ); diff --git a/odk/examples/DevelopersGuide/ProfUNO/CppBinding/string_samples.cxx b/odk/examples/DevelopersGuide/ProfUNO/CppBinding/string_samples.cxx index c3c37e4beee2..47689edb2971 100644 --- a/odk/examples/DevelopersGuide/ProfUNO/CppBinding/string_samples.cxx +++ b/odk/examples/DevelopersGuide/ProfUNO/CppBinding/string_samples.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include <stdio.h> @@ -58,7 +58,7 @@ SAL_IMPLEMENT_MAIN() // append an ascii string buf.appendAscii( "pi ( here " ); - // numbers can be simply appended + // numbers can be simply appended buf.append( pi ); // lets the compiler count the stringlength, so this is more efficient than @@ -77,11 +77,11 @@ SAL_IMPLEMENT_MAIN() // I could of course also used the OStringBuffer directly OString oString = rtl::OUStringToOString( string , RTL_TEXTENCODING_ASCII_US ); - // just to print something + // just to print something printf( "%s\n" ,oString.getStr() ); return 0; } - + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/ConnectionAwareClient.java b/odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/ConnectionAwareClient.java index 5e7d8715c45d..932428173202 100644 --- a/odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/ConnectionAwareClient.java +++ b/odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/ConnectionAwareClient.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import java.awt.*; @@ -63,12 +63,12 @@ public class ConnectionAwareClient extends java.awt.Frame private XComponentContext _ctx; private com.sun.star.frame.XComponentLoader _officeComponentLoader; - + public ConnectionAwareClient( XComponentContext ctx , String url ) { _url = url; _ctx = ctx; - + Panel p1 = new Panel(); _btnWriter = new Button("New writer"); _btnCalc = new Button("New calc"); @@ -79,7 +79,7 @@ public class ConnectionAwareClient extends java.awt.Frame p1.add( _btnWriter ); p1.add( _btnCalc ); p1.add( _txtLabel ); - + addWindowListener( new WindowAdapter() { @@ -100,7 +100,7 @@ public class ConnectionAwareClient extends java.awt.Frame _txtLabel.setText( "disconnected" ); } - public void actionPerformed( ActionEvent event ) + public void actionPerformed( ActionEvent event ) { try { @@ -143,7 +143,7 @@ public class ConnectionAwareClient extends java.awt.Frame int semicolon = url.indexOf( ';' ); if( semicolon == -1 ) return null; - + aRet[0] = url.substring( 4 , semicolon ); int nextSemicolon = url.indexOf( ';' , semicolon+1); @@ -167,7 +167,7 @@ public class ConnectionAwareClient extends java.awt.Frame // instantiate connector service Object x = _ctx.getServiceManager().createInstanceWithContext( "com.sun.star.connection.Connector", _ctx ); - + XConnector xConnector = (XConnector ) UnoRuntime.queryInterface(XConnector.class, x); @@ -179,7 +179,7 @@ public class ConnectionAwareClient extends java.awt.Frame // connect using the connection string part of the uno-url only. XConnection connection = xConnector.connect( a[0] ); - + x = _ctx.getServiceManager().createInstanceWithContext( "com.sun.star.bridge.BridgeFactory", _ctx ); @@ -195,7 +195,7 @@ public class ConnectionAwareClient extends java.awt.Frame XComponent.class, bridge ); xComponent.addEventListener( this ); - // get the remote instance + // get the remote instance x = bridge.getInstance( a[2] ); // Did the remote server export this object ? @@ -204,7 +204,7 @@ public class ConnectionAwareClient extends java.awt.Frame throw new com.sun.star.uno.Exception( "Server didn't provide an instance for" + a[2], null ); } - + // Query the initial object for its main factory interface XMultiComponentFactory xOfficeMultiComponentFactory = ( XMultiComponentFactory ) UnoRuntime.queryInterface( XMultiComponentFactory.class, x ); @@ -213,17 +213,17 @@ public class ConnectionAwareClient extends java.awt.Frame // Query for the XPropertySet interface. XPropertySet xProperySet = ( XPropertySet ) UnoRuntime.queryInterface( XPropertySet.class, xOfficeMultiComponentFactory ); - + // Get the default context from the office server. Object oDefaultContext = xProperySet.getPropertyValue( "DefaultContext" ); - + // Query for the interface XComponentContext. XComponentContext xOfficeComponentContext = ( XComponentContext ) UnoRuntime.queryInterface( XComponentContext.class, oDefaultContext ); - + // now create the desktop service // NOTE: use the office component context here ! Object oDesktop = xOfficeMultiComponentFactory.createInstanceWithContext( @@ -241,7 +241,7 @@ public class ConnectionAwareClient extends java.awt.Frame } return officeComponentLoader; } - + public static void main( String [] args ) throws java.lang.Exception { if( args.length != 1 ) diff --git a/odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/UrlResolver.java b/odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/UrlResolver.java index 854fbea0580b..33b4b9959e0c 100644 --- a/odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/UrlResolver.java +++ b/odk/examples/DevelopersGuide/ProfUNO/InterprocessConn/UrlResolver.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.bridge.XUnoUrlResolver; @@ -53,14 +53,14 @@ class UrlResolver " (use \" on unix shells to avoid ;-problems" ); System.exit( 1 ); } - + // create default local component context XComponentContext xLocalContext = com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(null); - + // initial serviceManager XMultiComponentFactory xLocalServiceManager = xLocalContext.getServiceManager(); - + // create a urlresolver Object urlResolver = xLocalServiceManager.createInstanceWithContext( "com.sun.star.bridge.UnoUrlResolver", xLocalContext ); diff --git a/odk/examples/DevelopersGuide/ProfUNO/Lifetime/MyUnoObject.java b/odk/examples/DevelopersGuide/ProfUNO/Lifetime/MyUnoObject.java index 1e2051a5a1b6..33da8cd6d5d1 100644 --- a/odk/examples/DevelopersGuide/ProfUNO/Lifetime/MyUnoObject.java +++ b/odk/examples/DevelopersGuide/ProfUNO/Lifetime/MyUnoObject.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,28 +29,28 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ class MyUnoObject implements com.sun.star.uno.XInterface { public MyUnoObject() {} - - protected void finalize() throws Throwable { + + protected void finalize() throws Throwable { super.finalize(); System.out.println( "finalizer called" ); } - + public static void main( String args[] ) throws java.lang.InterruptedException { com.sun.star.uno.XInterface a = new MyUnoObject(); a = null; - // ask the garbage collector politely + // ask the garbage collector politely System.gc(); synchronized( Thread.currentThread() ) { - // wait a second + // wait a second Thread.currentThread().wait( 1000 ); } System.out.println( "leaving" ); diff --git a/odk/examples/DevelopersGuide/ProfUNO/Lifetime/object_lifetime.cxx b/odk/examples/DevelopersGuide/ProfUNO/Lifetime/object_lifetime.cxx index c24e4e394dd7..63056a9219b7 100644 --- a/odk/examples/DevelopersGuide/ProfUNO/Lifetime/object_lifetime.cxx +++ b/odk/examples/DevelopersGuide/ProfUNO/Lifetime/object_lifetime.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include <stdio.h> diff --git a/odk/examples/DevelopersGuide/ProfUNO/SimpleBootstrap_cpp/SimpleBootstrap_cpp.cxx b/odk/examples/DevelopersGuide/ProfUNO/SimpleBootstrap_cpp/SimpleBootstrap_cpp.cxx index 32388bb3cded..3735b809e576 100644 --- a/odk/examples/DevelopersGuide/ProfUNO/SimpleBootstrap_cpp/SimpleBootstrap_cpp.cxx +++ b/odk/examples/DevelopersGuide/ProfUNO/SimpleBootstrap_cpp/SimpleBootstrap_cpp.cxx @@ -3,7 +3,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -30,7 +30,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #include <stdio.h> @@ -52,7 +52,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) try { // get the remote office component context - Reference< XComponentContext > xContext( ::cppu::bootstrap() ); + Reference< XComponentContext > xContext( ::cppu::bootstrap() ); if ( !xContext.is() ) { fprintf(stderr, "no component context!\n"); @@ -68,10 +68,10 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) return 1; } - // get an instance of the remote office desktop UNO service + // get an instance of the remote office desktop UNO service // and query the XComponentLoader interface Reference < XComponentLoader > xComponentLoader( - xServiceManager->createInstanceWithContext( + xServiceManager->createInstanceWithContext( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ), xContext ), UNO_QUERY_THROW ); diff --git a/odk/examples/DevelopersGuide/ProfUNO/SimpleBootstrap_java/SimpleBootstrap_java.java b/odk/examples/DevelopersGuide/ProfUNO/SimpleBootstrap_java/SimpleBootstrap_java.java index a4bce5125f4e..f348e073c5a1 100644 --- a/odk/examples/DevelopersGuide/ProfUNO/SimpleBootstrap_java/SimpleBootstrap_java.java +++ b/odk/examples/DevelopersGuide/ProfUNO/SimpleBootstrap_java/SimpleBootstrap_java.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.beans.PropertyValue; @@ -41,18 +41,18 @@ import com.sun.star.lang.XMultiComponentFactory; import com.sun.star.beans.XPropertySet; public class SimpleBootstrap_java { - + public static void main(String[] args) { - + try { // get the remote office component context XComponentContext xContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); - + // get the remote office service manager XMultiComponentFactory xServiceManager = xContext.getServiceManager(); - + // get an instance of the remote office desktop UNO service Object desktop = xServiceManager.createInstanceWithContext( "com.sun.star.frame.Desktop", xContext ); diff --git a/odk/examples/DevelopersGuide/ScriptingFramework/SayHello/SayHello/SayHello.java b/odk/examples/DevelopersGuide/ScriptingFramework/SayHello/SayHello/SayHello.java index b120c4cfa9f9..4913ad09335a 100644 --- a/odk/examples/DevelopersGuide/ScriptingFramework/SayHello/SayHello/SayHello.java +++ b/odk/examples/DevelopersGuide/ScriptingFramework/SayHello/SayHello/SayHello.java @@ -16,7 +16,7 @@ public class SayHello { SayHello.start(ctxt); } - + public static void start(XScriptContext ctxt) throws Exception { diff --git a/odk/examples/DevelopersGuide/ScriptingFramework/SayHello/build.xml b/odk/examples/DevelopersGuide/ScriptingFramework/SayHello/build.xml index dd0b0cfcfd10..ffd3e44504ea 100755 --- a/odk/examples/DevelopersGuide/ScriptingFramework/SayHello/build.xml +++ b/odk/examples/DevelopersGuide/ScriptingFramework/SayHello/build.xml @@ -23,12 +23,12 @@ <!-- ==================== classpath setting ============================ --> <target name="init" depends="checksdk,initsdk,initnosdk"> <path id="scriptclasspath"> - <pathelement location="${opp}/classes/unoil.jar"/> + <pathelement location="${opp}/classes/unoil.jar"/> <pathelement location="${opp}/classes/ridl.jar"/> <pathelement location="${opp}/classes/jurt.jar"/> <pathelement location="${opp}/classes/juh.jar"/> <pathelement location="${opp}/classes/ScriptFramework.jar"/> - </path> + </path> </target> <!-- ====================== Clean Generated Files ===================== --> @@ -77,5 +77,5 @@ <!-- ========================= All In One Build ======================= --> <target name="all" depends="clean,build,deploy"/> - + </project> diff --git a/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java b/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java index f461b9ddfb5d..cc448ff27715 100644 --- a/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java +++ b/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/ScriptSelector/ScriptSelector.java @@ -63,7 +63,7 @@ public class ScriptSelector { XScriptProviderFactory fac = (XScriptProviderFactory) UnoRuntime.queryInterface(XScriptProviderFactory.class, obj); - + final XScriptProvider msp = fac.createScriptProvider(new Any(new Type(), null)); @@ -117,7 +117,7 @@ public class ScriptSelector { Object[][] out = new Object[1][0]; out[0] = new Object[0]; - + short[][] num = new short[1][0]; num[0] = new short[0]; @@ -185,7 +185,7 @@ public class ScriptSelector { JButton button) { boolean enable = false; - + try { if (props != null) @@ -207,19 +207,19 @@ public class ScriptSelector { { // leave enable set to false } - + button.setEnabled(enable); } private XBrowseNode getRootNode(XScriptContext ctxt) { XBrowseNode result = null; - + XComponentContext xcc = ctxt.getComponentContext(); XBrowseNodeFactory xBrowseFac = (XBrowseNodeFactory) UnoRuntime.queryInterface( XBrowseNodeFactory.class, xcc.getValueByName(BROWSE_FACTORY)); - + result = (XBrowseNode)UnoRuntime.queryInterface( XBrowseNode.class, xBrowseFac.createView( BrowseNodeFactoryViewTypes.MACROSELECTOR ) ); @@ -244,7 +244,7 @@ class ScriptSelectorPanel extends JPanel { public XBrowseNode getSelection() { DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); - + if (node == null) { return null; } @@ -384,7 +384,7 @@ class ScriptTreeRenderer extends DefaultTreeCellRenderer { XBrowseNode xbn = (XBrowseNode)node.getUserObject(); if (xbn.getType() == BrowseNodeTypes.SCRIPT) { setIcon(scriptIcon); - } + } else if(xbn.getType() == BrowseNodeTypes.CONTAINER) { setIcon(containerIcon); } diff --git a/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/build.xml b/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/build.xml index 572e7c4c459a..6179e527b273 100755 --- a/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/build.xml +++ b/odk/examples/DevelopersGuide/ScriptingFramework/ScriptSelector/build.xml @@ -23,12 +23,12 @@ <!-- ==================== classpath setting ============================ --> <target name="init" depends="checksdk,initsdk,initnosdk"> <path id="scriptclasspath"> - <pathelement location="${opp}/classes/unoil.jar"/> + <pathelement location="${opp}/classes/unoil.jar"/> <pathelement location="${opp}/classes/ridl.jar"/> <pathelement location="${opp}/classes/jurt.jar"/> <pathelement location="${opp}/classes/juh.jar"/> <pathelement location="${opp}/classes/ScriptFramework.jar"/> - </path> + </path> </target> <!-- ====================== Clean Generated Files ===================== --> @@ -77,5 +77,5 @@ <!-- ========================= All In One Build ======================= --> <target name="all" depends="clean,build,deploy"/> - + </project> diff --git a/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java b/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java index 44f17a50c83d..94c0c48adc6e 100644 --- a/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java +++ b/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ class ExampleAddInResult implements com.sun.star.sheet.XVolatileResult @@ -250,11 +250,11 @@ public class ExampleAddIn // ignored in this example aFuncLocale = aLocale; } - + public com.sun.star.lang.Locale getLocale() { return aFuncLocale; - } + } // XServiceName @@ -300,7 +300,7 @@ public class ExampleAddIn multiFactory, regKey); return xSingleServiceFactory; } - + public static boolean __writeRegistryServiceInfo( com.sun.star.registry.XRegistryKey regKey) { diff --git a/odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.java b/odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.java index 80f5ff15a4d2..3bd4703aa71d 100644 --- a/odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.java +++ b/odk/examples/DevelopersGuide/Spreadsheet/ExampleDataPilotSource.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // Example DataPilot source component @@ -309,7 +309,7 @@ class ExampleLevel implements aResults[nResultPos].Name = ExampleSettings.getMemberName(nMember); aResults[nResultPos].Caption = aResults[nResultPos].Name; aResults[nResultPos].Flags = - com.sun.star.sheet.MemberResultFlags.HASMEMBER; + com.sun.star.sheet.MemberResultFlags.HASMEMBER; ++nResultPos; for (int nInner=1; nInner<nFill; nInner++) @@ -323,7 +323,7 @@ class ExampleLevel implements } return aResults; } - + // XPropertySet public com.sun.star.beans.XPropertySetInfo getPropertySetInfo() @@ -803,7 +803,7 @@ public class ExampleDataPilotSource } // XDataPilotResults - + public com.sun.star.sheet.DataResult[][] getResults() { int[] nDigits = new int[ExampleSettings.nDimensionCount]; @@ -969,7 +969,7 @@ public class ExampleDataPilotSource return xSingleServiceFactory; } - + public static boolean __writeRegistryServiceInfo( com.sun.star.registry.XRegistryKey regKey) { diff --git a/odk/examples/DevelopersGuide/Spreadsheet/GeneralTableSample.java b/odk/examples/DevelopersGuide/Spreadsheet/GeneralTableSample.java index 30bd5c143aa1..3307e18a9247 100644 --- a/odk/examples/DevelopersGuide/Spreadsheet/GeneralTableSample.java +++ b/odk/examples/DevelopersGuide/Spreadsheet/GeneralTableSample.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.uno.UnoRuntime; diff --git a/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetDocHelper.java b/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetDocHelper.java index 35beab5053e2..734a6af8ad77 100644 --- a/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetDocHelper.java +++ b/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetDocHelper.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.comp.servicemanager.ServiceManager; @@ -371,14 +371,14 @@ public class SpreadsheetDocHelper // First step: get the remote office component context mxRemoteContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); System.out.println("Connected to a running office ..."); - + mxRemoteServiceManager = mxRemoteContext.getServiceManager(); } catch( Exception e) { System.err.println("ERROR: can't get a component context from a running office ..."); e.printStackTrace(); System.exit(1); - } + } } } diff --git a/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java b/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java index fcae70c91ec4..7fc2ab28ff29 100644 --- a/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java +++ b/odk/examples/DevelopersGuide/Spreadsheet/SpreadsheetSample.java @@ -724,7 +724,7 @@ public class SpreadsheetSample extends SpreadsheetDocHelper // get the global collection of table auto formats, use global service // manager com.sun.star.lang.XMultiComponentFactory xServiceManager = getServiceManager(); - + Object aAutoFormatsObj = xServiceManager.createInstanceWithContext( "com.sun.star.sheet.TableAutoFormats", getContext()); com.sun.star.container.XNameContainer xAutoFormatsNA = diff --git a/odk/examples/DevelopersGuide/Spreadsheet/ViewSample.java b/odk/examples/DevelopersGuide/Spreadsheet/ViewSample.java index dd89ce017ead..36a3029b2310 100644 --- a/odk/examples/DevelopersGuide/Spreadsheet/ViewSample.java +++ b/odk/examples/DevelopersGuide/Spreadsheet/ViewSample.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.uno.UnoRuntime; @@ -75,7 +75,7 @@ public class ViewSample extends SpreadsheetDocHelper com.sun.star.frame.XModel xModel = (com.sun.star.frame.XModel) UnoRuntime.queryInterface( com.sun.star.frame.XModel.class, xDoc); com.sun.star.frame.XController xController = xModel.getCurrentController(); - + // --- Spreadsheet view --- // freeze the first column and first two rows com.sun.star.sheet.XViewFreezable xFreeze = (com.sun.star.sheet.XViewFreezable) @@ -96,7 +96,7 @@ public class ViewSample extends SpreadsheetDocHelper UnoRuntime.queryInterface( com.sun.star.beans.XPropertySet.class, xRange ); xRangeProp.setPropertyValue( "IsCellBackgroundTransparent", new Boolean( false ) ); xRangeProp.setPropertyValue( "CellBackColor", new Integer( 0xFFFFCC ) ); - + // --- View settings --- // change the view to display green grid lines com.sun.star.beans.XPropertySet xProp = (com.sun.star.beans.XPropertySet) diff --git a/odk/examples/DevelopersGuide/Spreadsheet/XExampleAddIn.idl b/odk/examples/DevelopersGuide/Spreadsheet/XExampleAddIn.idl index 7834fc8b3c6d..6f6a48f33ae4 100644 --- a/odk/examples/DevelopersGuide/Spreadsheet/XExampleAddIn.idl +++ b/odk/examples/DevelopersGuide/Spreadsheet/XExampleAddIn.idl @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,11 +29,11 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ #ifndef _ORG_OPENOFFICE_SHEET_ADDIN_XEXAMPLEADDIN_IDL_ -#define _ORG_OPENOFFICE_SHEET_ADDIN_XEXAMPLEADDIN_IDL_ +#define _ORG_OPENOFFICE_SHEET_ADDIN_XEXAMPLEADDIN_IDL_ #include <com/sun/star/uno/XInterface.idl> #include <com/sun/star/sheet/XVolatileResult.idl> @@ -47,10 +47,10 @@ module org { { /// Sample function that just increments a value. long getIncremented( [in] long nValue ); - + /// Sample function that returns a volatile result. com::sun::star::sheet::XVolatileResult getCounter( [in] string aName ); - }; + }; }; }; }; diff --git a/odk/examples/DevelopersGuide/Text/TextDocuments.java b/odk/examples/DevelopersGuide/Text/TextDocuments.java index 4696b41ffe59..fad1be9c0e4a 100644 --- a/odk/examples/DevelopersGuide/Text/TextDocuments.java +++ b/odk/examples/DevelopersGuide/Text/TextDocuments.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.awt.Point; @@ -144,9 +144,9 @@ public class TextDocuments { private static String sOutputDir; private String aPrinterName = "\\\\so-print\\xml3sof"; - + private XComponentContext mxRemoteContext = null; - private XMultiComponentFactory mxRemoteServiceManager = null; + private XMultiComponentFactory mxRemoteServiceManager = null; private XTextDocument mxDoc = null; private XMultiServiceFactory mxDocFactory = null; private XMultiServiceFactory mxFactory = null; @@ -155,11 +155,11 @@ public class TextDocuments { private XTextCursor mxDocCursor = null; private XTextContent mxFishSection = null; private Random maRandom = null; - + /** Creates a new instance of TextDocuments */ public TextDocuments() { } - + /** * @param args the command line arguments */ @@ -168,7 +168,7 @@ public class TextDocuments { try { // output directory for store test; sOutputDir = args[0]; - + textDocuments1.runDemo(); } catch (java.lang.Exception e){ @@ -179,15 +179,15 @@ public class TextDocuments { System.exit(0); } } - + protected void runDemo() throws java.lang.Exception { storePrintExample(); // depends on printer name - templateExample(); + templateExample(); viewCursorExample(); // makes changes to the current document, // use with care editingExample(); } - + /** Sample for use of templates * This sample uses the file TextTemplateWithUserFields.odt from the Samples * folder. The file contains a number of User text fields (Variables - User) @@ -201,40 +201,40 @@ public class TextDocuments { recipient.put("ZIP", "34567"); recipient.put("City", "Fort Lauderdale"); recipient.put("State", "Florida"); - + // load template with User fields and bookmark java.io.File sourceFile = new java.io.File("TextTemplateWithUserFields.odt"); StringBuffer sTemplateFileUrl = new StringBuffer("file:///"); sTemplateFileUrl.append(sourceFile.getCanonicalPath().replace('\\', '/')); - XComponent xTemplateComponent = + XComponent xTemplateComponent = newDocComponentFromTemplate( sTemplateFileUrl.toString() ); - + // get XTextFieldsSupplier, XBookmarksSupplier interfaces XTextFieldsSupplier xTextFieldsSupplier = (XTextFieldsSupplier) UnoRuntime.queryInterface(XTextFieldsSupplier.class, xTemplateComponent); XBookmarksSupplier xBookmarksSupplier = (XBookmarksSupplier) UnoRuntime.queryInterface(XBookmarksSupplier.class, xTemplateComponent); - + // access the TextFields and the TextFieldMasters collections XNameAccess xNamedFieldMasters = xTextFieldsSupplier.getTextFieldMasters(); XEnumerationAccess xEnumeratedFields = xTextFieldsSupplier.getTextFields(); - + // iterate over hashtable and insert values into field masters java.util.Enumeration keys = recipient.keys(); while(keys.hasMoreElements()) { // get column name String key = (String)keys.nextElement(); - + // access corresponding field master Object fieldMaster = xNamedFieldMasters.getByName( "com.sun.star.text.fieldmaster.User." + key); - + // query the XPropertySet interface, we need to set the Content property XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, fieldMaster); - + // insert the column value into field master xPropertySet.setPropertyValue("Content", recipient.get(key)); } @@ -245,10 +245,10 @@ public class TextDocuments { // accessing the Bookmarks collection of the document XNameAccess xNamedBookmarks = xBookmarksSupplier.getBookmarks(); - + // find the bookmark named "Subscription" Object bookmark = xNamedBookmarks.getByName("Subscription"); - // we need its XTextRange which is available from getAnchor(), + // we need its XTextRange which is available from getAnchor(), // so query for XTextContent XTextContent xBookmarkContent = (XTextContent)UnoRuntime.queryInterface( XTextContent.class, bookmark); @@ -256,14 +256,14 @@ public class TextDocuments { XTextRange xBookmarkRange = xBookmarkContent.getAnchor(); // set string at the bookmark position xBookmarkRange.setString("subscription for the Manatee Journal"); - + } - + /** Sample for document changes, starting at the current view cursor position * The sample changes the paragraph style and the character style at the * current view cursor selection Open the sample file ViewCursorExampleFile, * select some text and run the example. - * The current paragraph will be set to Quotations paragraph style. + * The current paragraph will be set to Quotations paragraph style. * The selected text will be set to Quotation character style. */ private void viewCursorExample() throws java.lang.Exception { @@ -281,11 +281,11 @@ public class TextDocuments { xCurrentComponent); XController xController = xModel.getCurrentController(); // the controller gives us the TextViewCursor - XTextViewCursorSupplier xViewCursorSupplier = + XTextViewCursorSupplier xViewCursorSupplier = (XTextViewCursorSupplier)UnoRuntime.queryInterface( XTextViewCursorSupplier.class, xController); XTextViewCursor xViewCursor = xViewCursorSupplier.getViewCursor(); - + // query its XPropertySet interface, we want to set character and paragraph // properties XPropertySet xCursorPropertySet = (XPropertySet)UnoRuntime.queryInterface( @@ -297,7 +297,7 @@ public class TextDocuments { XPageCursor xPageCursor = (XPageCursor)UnoRuntime.queryInterface( XPageCursor.class, xViewCursor); System.out.println("The current page number is " + xPageCursor.getPage()); - // the model cursor is much more powerful, so + // the model cursor is much more powerful, so // we create a model cursor at the current view cursor position with the // following steps: // get the Text service from the TextViewCursor, it is an XTextRange: @@ -315,8 +315,8 @@ public class TextDocuments { xParagraphCursor.gotoEndOfParagraph(false); xParagraphCursor.setString(" ***** Fin de semana! ******"); } - - + + /** Sample for the various editing facilities described in the * developer's manual */ @@ -326,49 +326,49 @@ public class TextDocuments { // query its XTextDocument interface to get the text mxDoc = (XTextDocument)UnoRuntime.queryInterface( XTextDocument.class, xEmptyWriterComponent); - + // get a reference to the body text of the document mxDocText = mxDoc.getText(); - + // Get a reference to the document's property set. This contains document // information like the current word count mxDocProps = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, mxDoc ); - + // Simple text insertion example BodyTextExample (); // Example using text ranges to insert strings at the beginning or end // of a text range - TextRangeExample (); + TextRangeExample (); // Create a document cursor and remember it, it will be used in most // of the following examples - mxDocCursor = mxDocText.createTextCursor(); + mxDocCursor = mxDocText.createTextCursor(); // Demonstrate some of the different cursor types (word, sentence) TextCursorExample (); - + // Access the text document's multi service factory, which we will need // for most of the following examples mxDocFactory = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, mxDoc ); - + // Examples of text fields, dependant text fields and field masters TextFieldExample (); - + // Example of using an XEnumerationAccess to iterate over paragraphs and // set properties of each paragraph as we do so - ParagraphExample (); - + ParagraphExample (); + // Example of creating and manipulating a text frame TextFrameExample (); - + // Example of creating and manipulating a text table, text table rows // and text table cells get a new random generator maRandom = new Random(); TextTableExample (); - + // Example of creating, inserting and manipulating text sections, as // well as an example of how to refresh the document - TextSectionExample (); + TextSectionExample (); // Example of creating a text section over a block of text and formatting // the text section into columns, as well as how to insert an empty @@ -383,7 +383,7 @@ public class TextDocuments { // document and how to create, insert and apply styles StylesExample (); IndexExample (); - + // Example of how to create and manipulate reference marks and GetReference // text fields ReferenceExample (); @@ -396,15 +396,15 @@ public class TextDocuments { // and how to access the draw page of the document using the // XDrawPageSupplier interface DrawPageExample (); - + mxFactory = (XMultiServiceFactory)UnoRuntime.queryInterface( XMultiServiceFactory.class, mxRemoteServiceManager); // This example demonstrates the use of the AutoTextContainer, // AutoTextGroup and AutoTextEntry services and shows how to create, // insert and modify auto text blocks - AutoTextExample (); + AutoTextExample (); } - + protected void storePrintExample() throws java.lang.Exception { // get the remote service manager mxRemoteServiceManager = this.getRemoteServiceManager(); @@ -418,7 +418,7 @@ public class TextDocuments { java.io.File sourceFile = new java.io.File("PrintDemo.odt"); StringBuffer sLoadFileUrl = new StringBuffer("file:///"); sLoadFileUrl.append(sourceFile.getCanonicalPath().replace('\\', '/')); - + XComponent xDoc = xComponentLoader.loadComponentFromURL( sLoadFileUrl.toString(), "_blank", 0, loadProps); @@ -432,10 +432,10 @@ public class TextDocuments { printDocComponent(xDoc); } } - + private XMultiComponentFactory getRemoteServiceManager() throws java.lang.Exception - { + { if (mxRemoteContext == null && mxRemoteServiceManager == null) { // get the remote office context. If necessary a new office // process is started @@ -444,8 +444,8 @@ public class TextDocuments { mxRemoteServiceManager = mxRemoteContext.getServiceManager(); } return mxRemoteServiceManager; - } - + } + protected XComponent newDocComponent(String docType) throws java.lang.Exception { @@ -457,9 +457,9 @@ public class TextDocuments { UnoRuntime.queryInterface(XComponentLoader.class, desktop); PropertyValue[] loadProps = new PropertyValue[0]; return xComponentLoader.loadComponentFromURL(loadUrl, "_blank", - 0, loadProps); + 0, loadProps); } - + /** Load a document as template */ protected XComponent newDocComponentFromTemplate(String loadUrl) @@ -472,17 +472,17 @@ public class TextDocuments { "com.sun.star.frame.Desktop", mxRemoteContext); XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktop); - + // define load properties according to com.sun.star.document.MediaDescriptor // the boolean property AsTemplate tells the office to create a new document // from the given file PropertyValue[] loadProps = new PropertyValue[1]; loadProps[0] = new PropertyValue(); loadProps[0].Name = "AsTemplate"; - loadProps[0].Value = new Boolean(true); + loadProps[0].Value = new Boolean(true); // load return xComponentLoader.loadComponentFromURL(loadUrl, "_blank", - 0, loadProps); + 0, loadProps); } /** Load a document with arguments (text purposes) @@ -490,18 +490,18 @@ public class TextDocuments { protected void storeDocComponent(XComponent xDoc, String storeUrl) throws java.lang.Exception { - + XStorable xStorable = (XStorable)UnoRuntime.queryInterface( XStorable.class, xDoc); PropertyValue[] storeProps = new PropertyValue[1]; storeProps[0] = new PropertyValue(); storeProps[0].Name = "FilterName"; - storeProps[0].Value = "MS Word 97"; + storeProps[0].Value = "MS Word 97"; System.out.println("... store \"PrintDemo.odt\" to \"" + storeUrl + "\"."); - xStorable.storeAsURL(storeUrl, storeProps); + xStorable.storeAsURL(storeUrl, storeProps); } - + protected void printDocComponent(XComponent xDoc) throws java.lang.Exception { XPrintable xPrintable = (XPrintable)UnoRuntime.queryInterface( XPrintable.class, xDoc); @@ -510,16 +510,16 @@ public class TextDocuments { printerDesc[0].Name = "Name"; printerDesc[0].Value = aPrinterName; - xPrintable.setPrinter(printerDesc); - + xPrintable.setPrinter(printerDesc); + PropertyValue[] printOpts = new PropertyValue[1]; printOpts[0] = new PropertyValue(); printOpts[0].Name = "Pages"; - printOpts[0].Value = "1"; - - xPrintable.print(printOpts); + printOpts[0].Value = "1"; + + xPrintable.print(printOpts); } - + // Setting the whole text of a document as one string protected void BodyTextExample () { @@ -527,7 +527,7 @@ public class TextDocuments { try { // demonstrate simple text insertion - mxDocText.setString ( "This is the new body text of the document." + mxDocText.setString ( "This is the new body text of the document." + "\n\nThis is on the second line.\n\n" ); } catch ( Exception e ) @@ -535,7 +535,7 @@ public class TextDocuments { e.printStackTrace(); } } - + // Adding a string at the end or the beginning of text protected void TextRangeExample () { @@ -555,7 +555,7 @@ public class TextDocuments { e.printStackTrace(); } } - + /** moving a text cursor, selecting text and overwriting it */ protected void TextCursorExample () @@ -591,14 +591,14 @@ public class TextDocuments { // replace the '.' at the end of the sentence with a new string xSentenceCursor.gotoEndOfSentence( false ); xWordCursor.gotoPreviousWord( true ); - mxDocText.insertString (xWordCursor, + mxDocText.insertString (xWordCursor, ", which has been changed with text cursors!", true); } catch ( Exception e ) { e.printStackTrace(); - } + } } /** This method inserts both a date field and a user field containing the @@ -608,7 +608,7 @@ public class TextDocuments { { try { - // Use the text document's factory to create a DateTime text field, + // Use the text document's factory to create a DateTime text field, // and access it's XTextField interface XTextField xDateField = (XTextField) UnoRuntime.queryInterface ( XTextField.class, mxDocFactory.createInstance ( @@ -617,9 +617,9 @@ public class TextDocuments { // Insert it at the end of the document mxDocText.insertTextContent ( mxDocText.getEnd(), xDateField, false ); - // Use the text document's factory to create a user text field, + // Use the text document's factory to create a user text field, // and access it's XDependentTextField interface - XDependentTextField xUserField = + XDependentTextField xUserField = (XDependentTextField) UnoRuntime.queryInterface ( XDependentTextField.class, mxDocFactory.createInstance ( "com.sun.star.text.TextField.User" ) ); @@ -633,16 +633,16 @@ public class TextDocuments { // Set the name and value of the FieldMaster xMasterPropSet.setPropertyValue ( "Name", "UserEmperor" ); xMasterPropSet.setPropertyValue ( "Value", new Integer ( 42 ) ); - + // Attach the field master to the user field xUserField.attachTextFieldMaster ( xMasterPropSet ); - + // Move the cursor to the end of the document mxDocCursor.gotoEnd( false ); // insert a paragraph break using the XSimpleText interface - mxDocText.insertControlCharacter ( + mxDocText.insertControlCharacter ( mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - + // Insert the user field at the end of the document mxDocText.insertTextContent ( mxDocText.getEnd(), xUserField, false ); } @@ -650,8 +650,8 @@ public class TextDocuments { { e.printStackTrace(); } - } - + } + /** This method demonstrates how to iterate over paragraphs */ protected void ParagraphExample () @@ -660,7 +660,7 @@ public class TextDocuments { { // The service 'com.sun.star.text.Text' supports the XEnumerationAccess // interface to provide an enumeration of the paragraphs contained by - // the text the service refers to. + // the text the service refers to. // Here, we access this interface XEnumerationAccess xParaAccess = (XEnumerationAccess) @@ -697,80 +697,80 @@ public class TextDocuments { e.printStackTrace(); } } - + /** This method returns a random double which isn't too high or too low */ protected double getRandomDouble () { return ( ( maRandom.nextInt() % 1000 ) * maRandom.nextDouble () ); } - + /** This method sets the text colour of the cell refered to by sCellName to white and inserts the string sText in it */ protected static void insertIntoCell(String sCellName, String sText, - XTextTable xTable) + XTextTable xTable) { - // Access the XText interface of the cell referred to by sCellName + // Access the XText interface of the cell referred to by sCellName XText xCellText = (XText) UnoRuntime.queryInterface( XText.class, xTable.getCellByName ( sCellName ) ); - + // create a text cursor from the cells XText interface XTextCursor xCellCursor = xCellText.createTextCursor(); // Get the property set of the cell's TextCursor XPropertySet xCellCursorProps = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xCellCursor ); - - try + + try { // Set the colour of the text to white xCellCursorProps.setPropertyValue( "CharColor", new Integer(16777215)); - } - catch ( Exception e) + } + catch ( Exception e) { e.printStackTrace(); } // Set the text in the cell to sText xCellText.setString( sText ); } - + /** This method shows how to create and insert a text table, as well as insert text and formulae into the cells of the table */ protected void TextTableExample () { - try + try { // Create a new table from the document's factory - XTextTable xTable = (XTextTable) UnoRuntime.queryInterface( + XTextTable xTable = (XTextTable) UnoRuntime.queryInterface( XTextTable.class, mxDocFactory .createInstance( "com.sun.star.text.TextTable" ) ); - + // Specify that we want the table to have 4 rows and 4 columns xTable.initialize( 4, 4 ); - + // Insert the table into the document mxDocText.insertTextContent( mxDocCursor, xTable, false); // Get an XIndexAccess of the table rows XIndexAccess xRows = xTable.getRows(); - + // Access the property set of the first row (properties listed in // service description: com.sun.star.text.TextTableRow) - XPropertySet xRow = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet xRow = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, xRows.getByIndex ( 0 ) ); // If BackTransparant is false, then the background color is visible xRow.setPropertyValue( "BackTransparent", new Boolean(false)); // Specify the color of the background to be dark blue xRow.setPropertyValue( "BackColor", new Integer(6710932)); - + // Access the property set of the whole table - XPropertySet xTableProps = (XPropertySet)UnoRuntime.queryInterface( + XPropertySet xTableProps = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xTable ); // We want visible background colors xTableProps.setPropertyValue( "BackTransparent", new Boolean(false)); // Set the background colour to light blue xTableProps.setPropertyValue( "BackColor", new Integer(13421823)); - + // set the text (and text colour) of all the cells in the first row // of the table insertIntoCell( "A1", "First Column", xTable ); @@ -783,22 +783,22 @@ public class TextDocuments { xTable.getCellByName( "A2" ).setValue( getRandomDouble() ); xTable.getCellByName( "B2" ).setValue( getRandomDouble() ); xTable.getCellByName( "C2" ).setValue( getRandomDouble() ); - + xTable.getCellByName( "A3" ).setValue( getRandomDouble() ); xTable.getCellByName( "B3" ).setValue( getRandomDouble() ); xTable.getCellByName( "C3" ).setValue( getRandomDouble() ); - + xTable.getCellByName( "A4" ).setValue( getRandomDouble() ); xTable.getCellByName( "B4" ).setValue( getRandomDouble() ); xTable.getCellByName( "C4" ).setValue( getRandomDouble() ); - + // Set the last cell in each row to be a formula that calculates // the sum of the first three cells xTable.getCellByName( "D2" ).setFormula( "sum <A2:C2>" ); xTable.getCellByName( "D3" ).setFormula( "sum <A3:C3>" ); xTable.getCellByName( "D4" ).setFormula( "sum <A4:C4>" ); - } - catch (Exception e) + } + catch (Exception e) { e.printStackTrace(); } @@ -807,20 +807,20 @@ public class TextDocuments { */ protected void TextFrameExample () { - try + try { // Use the document's factory to create a new text frame and // immediately access it's XTextFrame interface XTextFrame xFrame = (XTextFrame) UnoRuntime.queryInterface ( XTextFrame.class, mxDocFactory.createInstance ( "com.sun.star.text.TextFrame" ) ); - + // Access the XShape interface of the TextFrame XShape xShape = (XShape)UnoRuntime.queryInterface(XShape.class, xFrame); // Access the XPropertySet interface of the TextFrame XPropertySet xFrameProps = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xFrame ); - + // Set the size of the new Text Frame using the XShape's 'setSize' // method Size aSize = new Size(); @@ -834,31 +834,31 @@ public class TextDocuments { // Go to the end of the text document mxDocCursor.gotoEnd( false ); // Insert a new paragraph - mxDocText.insertControlCharacter ( + mxDocText.insertControlCharacter ( mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, false ); // Then insert the new frame mxDocText.insertTextContent(mxDocCursor, xFrame, false); - + // Access the XText interface of the text contained within the frame XText xFrameText = xFrame.getText(); // Create a TextCursor over the frame's contents XTextCursor xFrameCursor = xFrameText.createTextCursor(); // Insert some text into the frame - xFrameText.insertString( + xFrameText.insertString( xFrameCursor, "The first line in the newly created text frame.", false ); - xFrameText.insertString( + xFrameText.insertString( xFrameCursor, "\nThe second line in the new text frame.", false ); // Insert a paragraph break into the document (not the frame) - mxDocText.insertControlCharacter ( + mxDocText.insertControlCharacter ( mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - } - catch (Exception e) + } + catch (Exception e) { e.printStackTrace(); } } - + /** This example demonstrates the use of the AutoTextContainer, AutoTextGroup and AutoTextEntry services and shows how to create, insert and modify auto text blocks @@ -870,9 +870,9 @@ public class TextDocuments { // Go to the end of the document mxDocCursor.gotoEnd( false ); // Insert two paragraphs - mxDocText.insertControlCharacter ( mxDocCursor, + mxDocText.insertControlCharacter ( mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - mxDocText.insertControlCharacter ( mxDocCursor, + mxDocText.insertControlCharacter ( mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, false ); // Position the cursor in the second paragraph XParagraphCursor xParaCursor = (XParagraphCursor) @@ -881,29 +881,29 @@ public class TextDocuments { // Get an XNameAccess interface to all auto text groups from the // document factory - XNameAccess xContainer = (XNameAccess) UnoRuntime.queryInterface( + XNameAccess xContainer = (XNameAccess) UnoRuntime.queryInterface( XNameAccess.class, mxFactory.createInstance ( "com.sun.star.text.AutoTextContainer" ) ); - // Create a new table at the document factory - XTextTable xTable = (XTextTable) UnoRuntime.queryInterface( - XTextTable.class, mxDocFactory .createInstance( + // Create a new table at the document factory + XTextTable xTable = (XTextTable) UnoRuntime.queryInterface( + XTextTable.class, mxDocFactory .createInstance( "com.sun.star.text.TextTable" ) ); - + // Store the names of all auto text groups in an array of strings String[] aGroupNames = xContainer.getElementNames(); // Make sure we have at least one group name - if ( aGroupNames.length > 0 ) + if ( aGroupNames.length > 0 ) { - // initialise the table to have a row for every autotext group + // initialise the table to have a row for every autotext group // in a single column + one additional row for a header xTable.initialize( aGroupNames.length+1,1); // Access the XPropertySet of the table XPropertySet xTableProps = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xTable ); - + // We want a visible background xTableProps.setPropertyValue( "BackTransparent", new Boolean(false)); @@ -916,20 +916,20 @@ public class TextDocuments { // Get an XIndexAccess to all table rows XIndexAccess xRows = xTable.getRows(); - + // Get the first row in the table XPropertySet xRow = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, xRows.getByIndex ( 0 ) ); // We want the background of the first row to be visible too xRow.setPropertyValue( "BackTransparent", new Boolean(false)); - + // And let's make it dark blue xRow.setPropertyValue( "BackColor", new Integer(6710932)); - + // Put a description of the table contents into the first cell insertIntoCell( "A1", "AutoText Groups", xTable); - + // Create a table cursor pointing at the second cell in the first // column XTextTableCursor xTableCursor = xTable.createCursorByCellName("A2"); @@ -939,15 +939,15 @@ public class TextDocuments { { // Get the name of the current cell String sCellName = xTableCursor.getRangeName (); - + // Get the XText interface of the current cell - XText xCellText = (XText) UnoRuntime.queryInterface ( + XText xCellText = (XText) UnoRuntime.queryInterface ( XText.class, xTable.getCellByName ( sCellName ) ); - - // Set the cell contents of the current cell to be + + // Set the cell contents of the current cell to be //the name of the of an autotext group xCellText.setString ( aGroupNames[i] ); - + // Access the autotext group with this name XAutoTextGroup xGroup = (XAutoTextGroup) UnoRuntime.queryInterface (XAutoTextGroup.class, @@ -955,23 +955,23 @@ public class TextDocuments { // Get the titles of each autotext block in this group String [] aBlockNames = xGroup.getTitles(); - + // Make sure that the autotext group contains at least one block if ( aBlockNames.length > 0 ) { // Split the current cell vertically into two seperate cells xTableCursor.splitRange ( (short) 1, false ); - - // Put the cursor in the newly created right hand cell + + // Put the cursor in the newly created right hand cell // and select it xTableCursor.goRight ( (short) 1, false ); - - // Split this cell horizontally to make a seperate cell + + // Split this cell horizontally to make a seperate cell // for each Autotext block if ( ( aBlockNames.length -1 ) > 0 ) - xTableCursor.splitRange ( + xTableCursor.splitRange ( (short) (aBlockNames.length - 1), true ); - + // loop over the block names for ( int j = 0 ; j < aBlockNames.length ; j ++ ) { @@ -979,44 +979,44 @@ public class TextDocuments { xCellText = (XText) UnoRuntime.queryInterface ( XText.class, xTable.getCellByName ( xTableCursor.getRangeName() ) ); - + // Set the text contents of the current cell to the // title of an Autotext block xCellText.setString ( aBlockNames[j] ); - + // Move the cursor down one cell xTableCursor.goDown( (short)1, false); } } // Go back to the cell we originally split xTableCursor.gotoCellByName ( sCellName, false ); - + // Go down one cell xTableCursor.goDown( (short)1, false); } - + XAutoTextGroup xGroup; String [] aBlockNames; - + // Add a depth so that we only generate 200 numbers before giving up // on finding a random autotext group that contains autotext blocks int nDepth = 0; do { - // Generate a random, positive number which is lower than + // Generate a random, positive number which is lower than // the number of autotext groups int nRandom = Math.abs ( maRandom.nextInt() % aGroupNames.length ); - + // Get the autotext group at this name - xGroup = ( XAutoTextGroup ) UnoRuntime.queryInterface ( + xGroup = ( XAutoTextGroup ) UnoRuntime.queryInterface ( XAutoTextGroup.class, xContainer.getByName ( aGroupNames[ nRandom ] ) ); // Fill our string array with the names of all the blocks in // this group aBlockNames = xGroup.getElementNames(); - + // increment our depth counter ++nDepth; } @@ -1026,26 +1026,26 @@ public class TextDocuments { { // Pick a random block in this group and get it's // XAutoTextEntry interface - int nRandom = Math.abs ( maRandom.nextInt() + int nRandom = Math.abs ( maRandom.nextInt() % aBlockNames.length ); XAutoTextEntry xEntry = ( XAutoTextEntry ) - UnoRuntime.queryInterface ( + UnoRuntime.queryInterface ( XAutoTextEntry.class, xGroup.getByName ( aBlockNames[ nRandom ] ) ); // insert the modified autotext block at the end of the document xEntry.applyTo ( mxDocCursor ); - + // Get the titles of all text blocks in this AutoText group String [] aBlockTitles = xGroup.getTitles(); - + // Get the XNamed interface of the autotext group XNamed xGroupNamed = ( XNamed ) UnoRuntime.queryInterface ( XNamed.class, xGroup ); - - // Output the short cut and title of the random block + + // Output the short cut and title of the random block //and the name of the group it's from System.out.println ( "Inserted the Autotext '" + - aBlockTitles[nRandom] + aBlockTitles[nRandom] + "', shortcut '" + aBlockNames[nRandom] + "' from group '" + xGroupNamed.getName()); @@ -1055,9 +1055,9 @@ public class TextDocuments { // Go to the end of the document mxDocCursor.gotoEnd( false ); // Insert new paragraph - mxDocText.insertControlCharacter ( + mxDocText.insertControlCharacter ( mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - + // Position cursor in new paragraph xParaCursor.gotoPreviousParagraph ( false ); @@ -1068,12 +1068,12 @@ public class TextDocuments { // Go to the end of the document mxDocCursor.gotoEnd( false ); } - catch (Exception e) + catch (Exception e) { e.printStackTrace(); } } - + /** This method demonstrates how to insert indexes and index marks */ protected void IndexExample () @@ -1085,25 +1085,25 @@ public class TextDocuments { // Insert a new paragraph and position the cursor in it mxDocText.insertControlCharacter ( mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - XParagraphCursor xParaCursor = (XParagraphCursor) + XParagraphCursor xParaCursor = (XParagraphCursor) UnoRuntime.queryInterface( XParagraphCursor.class, mxDocCursor ); xParaCursor.gotoPreviousParagraph ( false ); - + // Create a new ContentIndexMark and get it's XPropertySet interface XPropertySet xEntry = (XPropertySet)UnoRuntime.queryInterface( - XPropertySet.class, + XPropertySet.class, mxDocFactory.createInstance("com.sun.star.text.ContentIndexMark")); // Set the text to be displayed in the index xEntry.setPropertyValue( "AlternativeText", "Big dogs! Falling on my head!"); - + // The Level property _must_ be set xEntry.setPropertyValue ( "Level", new Short ( (short) 1 ) ); - + // Create a ContentIndex and access it's XPropertySet interface XPropertySet xIndex = (XPropertySet) UnoRuntime.queryInterface( - XPropertySet.class, + XPropertySet.class, mxDocFactory.createInstance ( "com.sun.star.text.ContentIndex" ) ); // Again, the Level property _must_ be set @@ -1111,28 +1111,28 @@ public class TextDocuments { // Access the XTextContent interfaces of both the Index and the // IndexMark - XTextContent xIndexContent = (XTextContent) UnoRuntime.queryInterface( + XTextContent xIndexContent = (XTextContent) UnoRuntime.queryInterface( XTextContent.class, xIndex ); - XTextContent xEntryContent = (XTextContent) UnoRuntime.queryInterface( + XTextContent xEntryContent = (XTextContent) UnoRuntime.queryInterface( XTextContent.class, xEntry ); - + // Insert both in the document mxDocText.insertTextContent ( mxDocCursor, xEntryContent, false ); mxDocText.insertTextContent ( mxDocCursor, xIndexContent, false ); - + // Get the XDocumentIndex interface of the Index - XDocumentIndex xDocIndex = (XDocumentIndex) UnoRuntime.queryInterface( + XDocumentIndex xDocIndex = (XDocumentIndex) UnoRuntime.queryInterface( XDocumentIndex.class, xIndex ); - + // And call it's update method xDocIndex.update(); } - catch (Exception e) + catch (Exception e) { e.printStackTrace(); } } - + /** This method demonstrates how to create and insert reference marks, and * GetReference Text Fields */ @@ -1142,25 +1142,25 @@ public class TextDocuments { { // Go to the end of the document mxDocCursor.gotoEnd( false ); - + // Insert a paragraph break - mxDocText.insertControlCharacter ( + mxDocText.insertControlCharacter ( mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - + // Get the Paragraph cursor - XParagraphCursor xParaCursor = (XParagraphCursor) + XParagraphCursor xParaCursor = (XParagraphCursor) UnoRuntime.queryInterface( XParagraphCursor.class, mxDocCursor ); - + // Move the cursor into the new paragraph xParaCursor.gotoPreviousParagraph ( false ); - + // Create a new ReferenceMark and get it's XNamed interface XNamed xRefMark = (XNamed) UnoRuntime.queryInterface(XNamed.class, mxDocFactory.createInstance ("com.sun.star.text.ReferenceMark")); // Set the name to TableHeader xRefMark.setName ( "TableHeader" ); - + // Get the TextTablesSupplier interface of the document XTextTablesSupplier xTableSupplier = ( XTextTablesSupplier ) UnoRuntime.queryInterface(XTextTablesSupplier.class, mxDoc); @@ -1176,10 +1176,10 @@ public class TextDocuments { // Get the first cell from the table XText xTableText = (XText) UnoRuntime.queryInterface( XText.class, xTable.getCellByName ( "A1" ) ); - + // Get a text cursor for the first cell XTextCursor xTableCursor = xTableText.createTextCursor(); - + // Get the XTextContent interface of the reference mark so we can // insert it XTextContent xContent = ( XTextContent ) UnoRuntime.queryInterface ( @@ -1187,7 +1187,7 @@ public class TextDocuments { // Insert the reference mark into the first cell of the table xTableText.insertTextContent ( xTableCursor, xContent, false ); - + // Create a 'GetReference' text field to refer to the reference mark // we just inserted, and get it's XPropertySet interface XPropertySet xFieldProps = (XPropertySet) UnoRuntime.queryInterface( @@ -1204,16 +1204,16 @@ public class TextDocuments { // Put the names of each reference mark into an array of strings String[] aNames = xMarks.getElementNames(); - - // Make sure that at least 1 reference mark actually exists + + // Make sure that at least 1 reference mark actually exists // (well, we just inserted one!) if ( aNames.length > 0 ) { // Output the name of the first reference mark ('TableHeader') System.out.println ( - "GetReference text field inserted for ReferenceMark : " + "GetReference text field inserted for ReferenceMark : " + aNames[0] ); - + // Set the SourceName of the GetReference text field to // 'TableHeader' xFieldProps.setPropertyValue ( "SourceName", aNames[0] ); @@ -1224,17 +1224,17 @@ public class TextDocuments { new Short(ReferenceFieldSource.REFERENCE_MARK)); // We want the reference displayed as 'above' or 'below' - xFieldProps.setPropertyValue ( "ReferenceFieldPart", + xFieldProps.setPropertyValue ( "ReferenceFieldPart", new Short(ReferenceFieldPart.UP_DOWN)); - + // Get the XTextContent interface of the GetReference text field XTextContent xRefContent = (XTextContent) UnoRuntime.queryInterface( XTextContent.class, xFieldProps ); // Go to the end of the document mxDocCursor.gotoEnd( false ); - + // Make some text to precede the reference mxDocText.insertString(mxDocText.getEnd(), "The table ", false); @@ -1242,7 +1242,7 @@ public class TextDocuments { mxDocText.insertTextContent(mxDocText.getEnd(), xRefContent, false); // And some text after the reference.. - mxDocText.insertString(mxDocText.getEnd(), + mxDocText.insertString(mxDocText.getEnd(), " contains the sum of some random numbers.", false ); // Refresh the document @@ -1251,12 +1251,12 @@ public class TextDocuments { xRefresh.refresh(); } } - catch (Exception e) + catch (Exception e) { e.printStackTrace(); } } - + /** This method demonstrates how to create and insert footnotes, and how to access the XFootnotesSupplier interface of the document */ @@ -1272,14 +1272,14 @@ public class TextDocuments { // Set the label to 'Numbers' xFootnote.setLabel ( "Numbers" ); - + // Get the footnotes XTextContent interface so we can... - XTextContent xContent = ( XTextContent ) UnoRuntime.queryInterface ( + XTextContent xContent = ( XTextContent ) UnoRuntime.queryInterface ( XTextContent.class, xFootnote ); - + // ...insert it into the document mxDocText.insertTextContent ( mxDocCursor, xContent, false ); - + // Get the XFootnotesSupplier interface of the document XFootnotesSupplier xFootnoteSupplier = (XFootnotesSupplier) UnoRuntime.queryInterface(XFootnotesSupplier.class, mxDoc ); @@ -1289,27 +1289,27 @@ public class TextDocuments { XIndexAccess.class, xFootnoteSupplier.getFootnotes() ); // Get the XFootnote interface to the first footnote inserted ('Numbers') - XFootnote xNumbers = ( XFootnote ) UnoRuntime.queryInterface ( + XFootnote xNumbers = ( XFootnote ) UnoRuntime.queryInterface ( XFootnote.class, xFootnotes.getByIndex( 0 ) ); // Get the XSimpleText interface to the Footnote XSimpleText xSimple = (XSimpleText ) UnoRuntime.queryInterface ( XSimpleText.class, xNumbers ); - + // Create a text cursor for the foot note text XTextRange xRange = (XTextRange ) UnoRuntime.queryInterface ( XTextRange.class, xSimple.createTextCursor() ); - + // And insert the actual text of the footnote. - xSimple.insertString ( + xSimple.insertString ( xRange, " The numbers were generated by using java.util.Random", false ); } - catch (Exception e) + catch (Exception e) { e.printStackTrace(); } } - + /** This method demonstrates how to create and manipulate shapes, and how to access the draw page of the document to insert shapes */ @@ -1326,22 +1326,22 @@ public class TextDocuments { ControlCharacter.PARAGRAPH_BREAK, false); // Get the XParagraphCursor interface of our document cursor - XParagraphCursor xParaCursor = (XParagraphCursor) + XParagraphCursor xParaCursor = (XParagraphCursor) UnoRuntime.queryInterface( XParagraphCursor.class, mxDocCursor ); // Position the cursor in the 2nd paragraph xParaCursor.gotoPreviousParagraph ( false ); - + // Create a RectangleShape using the document factory - XShape xRect = (XShape) UnoRuntime.queryInterface( + XShape xRect = (XShape) UnoRuntime.queryInterface( XShape.class, mxDocFactory.createInstance ( "com.sun.star.drawing.RectangleShape" ) ); - + // Create an EllipseShape using the document factory - XShape xEllipse = (XShape) UnoRuntime.queryInterface( - XShape.class, mxDocFactory.createInstance ( + XShape xEllipse = (XShape) UnoRuntime.queryInterface( + XShape.class, mxDocFactory.createInstance ( "com.sun.star.drawing.EllipseShape" ) ); - + // Set the size of both the ellipse and the rectangle Size aSize = new Size(); aSize.Height = 4000; @@ -1350,19 +1350,19 @@ public class TextDocuments { aSize.Height = 3000; aSize.Width = 6000; xEllipse.setSize ( aSize ); - + // Set the position of the Rectangle to the right of the ellipse Point aPoint = new Point(); aPoint.X = 6100; aPoint.Y = 0; xRect.setPosition ( aPoint ); - + // Get the XPropertySet interfaces of both shapes - XPropertySet xRectProps = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet xRectProps = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, xRect ); XPropertySet xEllipseProps = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, xEllipse ); - + // And set the AnchorTypes of both shapes to 'AT_PARAGRAPH' xRectProps.setPropertyValue ( "AnchorType", TextContentAnchorType.AT_PARAGRAPH ); @@ -1374,20 +1374,20 @@ public class TextDocuments { UnoRuntime.queryInterface (XDrawPageSupplier.class, mxDoc ); // Get the XShapes interface of the draw page - XShapes xShapes = ( XShapes ) UnoRuntime.queryInterface ( + XShapes xShapes = ( XShapes ) UnoRuntime.queryInterface ( XShapes.class, xDrawPageSupplier.getDrawPage () ); - + // Add both shapes xShapes.add ( xEllipse ); xShapes.add ( xRect ); /* This doesn't work, I am assured that FME and AMA are fixing it. - - XShapes xGrouper = (XShapes) UnoRuntime.queryInterface( - XShapes.class, mxDocFactory.createInstance ( + + XShapes xGrouper = (XShapes) UnoRuntime.queryInterface( + XShapes.class, mxDocFactory.createInstance ( "com.sun.star.drawing.GroupShape" ) ); - + XShape xGrouperShape = (XShape) UnoRuntime.queryInterface( XShape.class, xGrouper ); xShapes.add ( xGrouperShape ); @@ -1399,14 +1399,14 @@ public class TextDocuments { UnoRuntime.queryInterface(XShapeGrouper.class, xShapes); xShapeGrouper.group ( xGrouper ); */ - + } - catch (Exception e) + catch (Exception e) { e.printStackTrace(); } - } - + } + /** This method demonstrates how to create, insert and apply styles */ protected void StylesExample () @@ -1415,36 +1415,36 @@ public class TextDocuments { { // Go to the end of the document mxDocCursor.gotoEnd( false ); - + // Insert two paragraph breaks - mxDocText.insertControlCharacter ( + mxDocText.insertControlCharacter ( mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - mxDocText.insertControlCharacter ( + mxDocText.insertControlCharacter ( mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - + // Create a new style from the document's factory - XStyle xStyle = (XStyle) UnoRuntime.queryInterface( - XStyle.class, mxDocFactory.createInstance( + XStyle xStyle = (XStyle) UnoRuntime.queryInterface( + XStyle.class, mxDocFactory.createInstance( "com.sun.star.style.ParagraphStyle" ) ); - + // Access the XPropertySet interface of the new style XPropertySet xStyleProps = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, xStyle ); - + // Give the new style a light blue background xStyleProps.setPropertyValue ( "ParaBackColor", new Integer (13421823)); - + // Get the StyleFamiliesSupplier interface of the document XStyleFamiliesSupplier xSupplier = (XStyleFamiliesSupplier) UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, mxDoc); // Use the StyleFamiliesSupplier interface to get the XNameAccess // interface of the actual style families - XNameAccess xFamilies = ( XNameAccess ) UnoRuntime.queryInterface ( + XNameAccess xFamilies = ( XNameAccess ) UnoRuntime.queryInterface ( XNameAccess.class, xSupplier.getStyleFamilies() ); // Access the 'ParagraphStyles' Family - XNameContainer xFamily = (XNameContainer ) UnoRuntime.queryInterface ( + XNameContainer xFamily = (XNameContainer ) UnoRuntime.queryInterface ( XNameContainer.class, xFamilies.getByName ( "ParagraphStyles" ) ); @@ -1452,7 +1452,7 @@ public class TextDocuments { xFamily.insertByName ( "All-Singing All-Dancing Style", xStyle ); // Get the XParagraphCursor interface of the document cursor - XParagraphCursor xParaCursor = (XParagraphCursor) + XParagraphCursor xParaCursor = (XParagraphCursor) UnoRuntime.queryInterface( XParagraphCursor.class, mxDocCursor ); // Select the first paragraph inserted @@ -1469,20 +1469,20 @@ public class TextDocuments { // Go back to the end mxDocCursor.gotoEnd ( false ); - + // Select the last paragraph in the document xParaCursor.gotoNextParagraph ( true ); - + // And reset it's style to 'Standard' (the programmatic name for // the default style) xCursorProps.setPropertyValue ( "ParaStyleName", "Standard" ); } - catch (Exception e) + catch (Exception e) { e.printStackTrace(); } } - + /** This method demonstrates how to set numbering types and numbering levels using the com.sun.star.text.NumberingRules service */ @@ -1493,7 +1493,7 @@ public class TextDocuments { // Go to the end of the document mxDocCursor.gotoEnd( false ); // Get the RelativeTextContentInsert interface of the document - XRelativeTextContentInsert xRelative = + XRelativeTextContentInsert xRelative = (XRelativeTextContentInsert ) UnoRuntime.queryInterface ( XRelativeTextContentInsert.class, mxDocText ); @@ -1516,10 +1516,10 @@ public class TextDocuments { XTextContent xNewPara = (XTextContent) UnoRuntime.queryInterface( XTextContent.class, mxDocFactory.createInstance( "com.sun.star.text.Paragraph" ) ); - + // Get the XPropertySet interface of the new paragraph and put // it in our array - xParas[i] = (XPropertySet) UnoRuntime.queryInterface( + xParas[i] = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, xNewPara ); // Insert the new paragraph into the document after the fish @@ -1538,44 +1538,44 @@ public class TextDocuments { { if ( aProps[j].Name.equals ( "NumberingType" ) ) { - // Once we find it, set it's value to a new type, + // Once we find it, set it's value to a new type, // dependent on which numbering level we're currently on switch ( i ) { - case 0 : aProps[j].Value = + case 0 : aProps[j].Value = new Short(NumberingType.ROMAN_UPPER); break; - case 1 : aProps[j].Value = + case 1 : aProps[j].Value = new Short(NumberingType.CHARS_UPPER_LETTER); break; - case 2 : aProps[j].Value = + case 2 : aProps[j].Value = new Short(NumberingType.ARABIC); break; } // Put the updated PropertyValue sequence back into the // NumberingRules service - xReplace.replaceByIndex ( i, aProps ); + xReplace.replaceByIndex ( i, aProps ); break; } } } // Get the XParagraphCursor interface of our text cursro - XParagraphCursor xParaCursor = (XParagraphCursor) + XParagraphCursor xParaCursor = (XParagraphCursor) UnoRuntime.queryInterface( XParagraphCursor.class, mxDocCursor ); // Go to the end of the document, then select the preceding paragraphs mxDocCursor.gotoEnd ( false ); xParaCursor.gotoPreviousParagraph ( false ); xParaCursor.gotoPreviousParagraph ( true ); xParaCursor.gotoPreviousParagraph ( true ); - + // Get the XPropertySet of the cursor's currently selected text XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, mxDocCursor ); - + // Set the updated Numbering rules to the cursor's property set xCursorProps.setPropertyValue ( "NumberingRules", xNum ); mxDocCursor.gotoEnd( false ); - + // Set the first paragraph that was inserted to a numbering level of // 2 (thus it will have Arabic style numbering) xParas[0].setPropertyValue ( "NumberingLevel", new Short((short) 2)); @@ -1588,13 +1588,13 @@ public class TextDocuments { // 0 (thus it will have 'Chars Upper Letter' style numbering) xParas[2].setPropertyValue ( "NumberingLevel", new Short((short) 0)); } - catch (Exception e) + catch (Exception e) { e.printStackTrace(); } } - - /** This method demonstrates how to create linked and unlinked sections + + /** This method demonstrates how to create linked and unlinked sections */ protected void TextSectionExample () { @@ -1603,11 +1603,11 @@ public class TextDocuments { // Go to the end of the document mxDocCursor.gotoEnd( false ); // Insert two paragraph breaks - mxDocText.insertControlCharacter ( + mxDocText.insertControlCharacter ( mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - mxDocText.insertControlCharacter ( + mxDocText.insertControlCharacter ( mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, true ); - + // Create a new TextSection from the document factory and access // it's XNamed interface XNamed xChildNamed = (XNamed) UnoRuntime.queryInterface( @@ -1615,7 +1615,7 @@ public class TextDocuments { "com.sun.star.text.TextSection" ) ); // Set the new sections name to 'Child_Section' xChildNamed.setName ( "Child_Section" ); - + // Access the Child_Section's XTextContent interface and insert it // into the document XTextContent xChildSection = (XTextContent) UnoRuntime.queryInterface( @@ -1628,10 +1628,10 @@ public class TextDocuments { // Go back one paragraph (into Child_Section) xParaCursor.gotoPreviousParagraph ( false ); - + // Insert a string into the Child_Section mxDocText.insertString ( mxDocCursor, "This is a test", false ); - + // Go to the end of the document mxDocCursor.gotoEnd( false ); @@ -1640,63 +1640,63 @@ public class TextDocuments { xParaCursor.gotoPreviousParagraph ( false ); // Go to the end of the document, selecting the two paragraphs mxDocCursor.gotoEnd ( true ); - + // Create another text section and access it's XNamed interface XNamed xParentNamed = (XNamed) UnoRuntime.queryInterface(XNamed.class, mxDocFactory.createInstance("com.sun.star.text.TextSection")); // Set this text section's name to Parent_Section xParentNamed.setName ( "Parent_Section" ); - + // Access the Parent_Section's XTextContent interface ... XTextContent xParentSection = (XTextContent) UnoRuntime.queryInterface( XTextContent.class, xParentNamed ); // ...and insert it into the document mxDocText.insertTextContent ( mxDocCursor, xParentSection, false ); - + // Go to the end of the document mxDocCursor.gotoEnd ( false ); // Insert a new paragraph - mxDocText.insertControlCharacter ( + mxDocText.insertControlCharacter ( mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, false ); // And select the new pargraph xParaCursor.gotoPreviousParagraph ( true ); - + // Create a new Text Section and access it's XNamed interface XNamed xLinkNamed = (XNamed) UnoRuntime.queryInterface(XNamed.class, mxDocFactory.createInstance("com.sun.star.text.TextSection")); // Set the new text section's name to Linked_Section xLinkNamed.setName ( "Linked_Section" ); - + // Access the Linked_Section's XTextContent interface XTextContent xLinkedSection = (XTextContent) UnoRuntime.queryInterface( XTextContent.class, xLinkNamed ); // And insert the Linked_Section into the document mxDocText.insertTextContent ( mxDocCursor, xLinkedSection, false ); - + // Access the Linked_Section's XPropertySet interface - XPropertySet xLinkProps = (XPropertySet)UnoRuntime.queryInterface( + XPropertySet xLinkProps = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xLinkNamed ); // Set the linked section to be linked to the Child_Section xLinkProps.setPropertyValue ( "LinkRegion", "Child_Section" ); - + // Access the XPropertySet interface of the Child_Section XPropertySet xChildProps = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, xChildNamed ); // Set the Child_Section's background colour to blue xChildProps.setPropertyValue( "BackColor", new Integer(13421823)); - + // Refresh the document, so the linked section matches the Child_Section - XRefreshable xRefresh = (XRefreshable) UnoRuntime.queryInterface( + XRefreshable xRefresh = (XRefreshable) UnoRuntime.queryInterface( XRefreshable.class, mxDoc ); xRefresh.refresh(); } - catch (Exception e) + catch (Exception e) { e.printStackTrace(); } } - + /** This method demonstrates the XTextColumns interface and how to insert a blank paragraph using the XRelativeTextContentInsert interface */ @@ -1707,36 +1707,36 @@ public class TextDocuments { // Go to the end of the doucment mxDocCursor.gotoEnd( false ); // insert a new paragraph - mxDocText.insertControlCharacter ( + mxDocText.insertControlCharacter ( mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - + // insert the string 'I am a fish.' 100 times for ( int i = 0 ; i < 100 ; ++i ) { mxDocText.insertString ( mxDocCursor, "I am a fish.", false ); } // insert a paragraph break after the text - mxDocText.insertControlCharacter ( + mxDocText.insertControlCharacter ( mxDocCursor, ControlCharacter.PARAGRAPH_BREAK, false ); - + // Get the XParagraphCursor interface of our text cursor - XParagraphCursor xParaCursor = (XParagraphCursor) + XParagraphCursor xParaCursor = (XParagraphCursor) UnoRuntime.queryInterface( XParagraphCursor.class, mxDocCursor ); // Jump back before all the text we just inserted xParaCursor.gotoPreviousParagraph ( false ); xParaCursor.gotoPreviousParagraph ( false ); - + // Insert a string at the beginning of the block of text mxDocText.insertString ( mxDocCursor, "Fish section begins:", false ); - + // Then select all of the text xParaCursor.gotoNextParagraph ( true ); xParaCursor.gotoNextParagraph ( true ); - + // Create a new text section and get it's XNamed interface XNamed xSectionNamed = (XNamed) UnoRuntime.queryInterface(XNamed.class, mxDocFactory.createInstance("com.sun.star.text.TextSection")); - + // Set the name of our new section (appropiately) to 'Fish' xSectionNamed.setName ( "Fish" ); @@ -1747,7 +1747,7 @@ public class TextDocuments { // We want three columns xColumns.setColumnCount ( (short) 3 ); - + // Get the TextColumns, and make the middle one narrow with a larger // margin on the left than the right TextColumn[] aSequence = xColumns.getColumns (); @@ -1756,26 +1756,26 @@ public class TextDocuments { aSequence[1].RightMargin = 200; // Set the updated TextColumns back to the XTextColumns xColumns.setColumns ( aSequence ); - + // Get the property set interface of our 'Fish' section XPropertySet xSectionProps = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, xSectionNamed ); - + // Set the columns to the Text Section xSectionProps.setPropertyValue ( "TextColumns", xColumns ); - + // Get the XTextContent interface of our 'Fish' section mxFishSection = (XTextContent) UnoRuntime.queryInterface( XTextContent.class, xSectionNamed ); - + // Insert the 'Fish' section over the currently selected text mxDocText.insertTextContent ( mxDocCursor, mxFishSection, true ); - + // Get the wonderful XRelativeTextContentInsert interface XRelativeTextContentInsert xRelative = (XRelativeTextContentInsert ) UnoRuntime.queryInterface ( XRelativeTextContentInsert.class, mxDocText ); - + // Create a new empty paragraph and get it's XTextContent interface XTextContent xNewPara = (XTextContent) UnoRuntime.queryInterface( XTextContent.class, @@ -1784,9 +1784,9 @@ public class TextDocuments { // Insert the empty paragraph after the fish Text Section xRelative.insertTextContentAfter ( xNewPara, mxFishSection ); } - catch (Exception e) + catch (Exception e) { e.printStackTrace(); } - } + } } diff --git a/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java b/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java index 24d627111f38..daa3d821eebf 100644 --- a/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java +++ b/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.ucb.OpenCommandArgument2; diff --git a/odk/examples/DevelopersGuide/UCB/DataStreamComposer.java b/odk/examples/DevelopersGuide/UCB/DataStreamComposer.java index 2d67cde0e4ae..899861a0451f 100644 --- a/odk/examples/DevelopersGuide/UCB/DataStreamComposer.java +++ b/odk/examples/DevelopersGuide/UCB/DataStreamComposer.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.ucb.InsertCommandArgument; @@ -180,7 +180,7 @@ public class DataStreamComposer { } else if ( args[i].startsWith( "-srcURL=" )) { m_srcURL = args[i].substring( 9 ); } else if ( args[i].startsWith( "-workdir=" )) { - workdir = args[i].substring( 9 ); + workdir = args[i].substring( 9 ); } else if ( args[i].startsWith( "-help" ) || args[i].startsWith( "-?" )) { printCmdLineUsage(); diff --git a/odk/examples/DevelopersGuide/UCB/DataStreamRetriever.java b/odk/examples/DevelopersGuide/UCB/DataStreamRetriever.java index 84529ab39533..5bf66124fdd3 100644 --- a/odk/examples/DevelopersGuide/UCB/DataStreamRetriever.java +++ b/odk/examples/DevelopersGuide/UCB/DataStreamRetriever.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.ucb.OpenCommandArgument2; diff --git a/odk/examples/DevelopersGuide/UCB/Helper.java b/odk/examples/DevelopersGuide/UCB/Helper.java index ea5f5536365b..dbba9156f4eb 100644 --- a/odk/examples/DevelopersGuide/UCB/Helper.java +++ b/odk/examples/DevelopersGuide/UCB/Helper.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import java.util.Vector; @@ -70,7 +70,7 @@ public class Helper { * * @exception java.lang.Exception */ - public Helper(String url) throws java.lang.Exception { + public Helper(String url) throws java.lang.Exception { m_contenturl = url; if (null == m_xContext ) { @@ -78,7 +78,7 @@ public class Helper { m_xContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); System.out.println("Connected to a running office ..."); } - + XMultiComponentFactory xMCF = m_xContext.getServiceManager(); m_ucb = (XInterface)UnoRuntime.queryInterface(XInterface.class, @@ -121,7 +121,7 @@ public class Helper { } return content; } - + /** * Get ucb instance. * @@ -191,9 +191,9 @@ public class Helper { { e.printStackTrace(); } - return new String(); + return new String(); } - + public static String prependCurrentDirAsAbsoluteFileURL( String relativeURL ) { // get url of current dir. diff --git a/odk/examples/DevelopersGuide/UCB/MyActiveDataSink.java b/odk/examples/DevelopersGuide/UCB/MyActiveDataSink.java index 4d111dc740a8..3eb0dc8fd7d0 100644 --- a/odk/examples/DevelopersGuide/UCB/MyActiveDataSink.java +++ b/odk/examples/DevelopersGuide/UCB/MyActiveDataSink.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,18 +29,18 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.io.XActiveDataSink; import com.sun.star.io.XInputStream; /** - * XActiveDataSink interface implementation. Makes it possible to read - * the corresponding object from an input stream. + * XActiveDataSink interface implementation. Makes it possible to read + * the corresponding object from an input stream. */ public class MyActiveDataSink implements XActiveDataSink { - + /** * Member properties */ @@ -48,26 +48,26 @@ public class MyActiveDataSink implements XActiveDataSink { /** * Constructor - */ + */ public MyActiveDataSink() { super(); } - + /** * Plugs the input stream. * *@param XInputStream */ public void setInputStream( XInputStream aStream ) { - m_aStream = aStream; + m_aStream = aStream; } - + /** * Get the plugged stream. * *@return XInputStream The plugged stream - */ + */ public XInputStream getInputStream() { - return m_aStream; + return m_aStream; } } diff --git a/odk/examples/DevelopersGuide/UCB/MyInputStream.java b/odk/examples/DevelopersGuide/UCB/MyInputStream.java index d3c701c71776..187ff97e861b 100644 --- a/odk/examples/DevelopersGuide/UCB/MyInputStream.java +++ b/odk/examples/DevelopersGuide/UCB/MyInputStream.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ // imports @@ -164,7 +164,7 @@ public class MyInputStream implements XSeekable, XInputStream { *@return int */ public synchronized int readSomeBytes(byte[][] p0, int p1) - throws NotConnectedException, + throws NotConnectedException, BufferSizeExceededException, com.sun.star.io.IOException, com.sun.star.uno.RuntimeException { @@ -178,7 +178,7 @@ public class MyInputStream implements XSeekable, XInputStream { *@param int */ public synchronized void skipBytes(int p0) - throws NotConnectedException, BufferSizeExceededException, + throws NotConnectedException, BufferSizeExceededException, com.sun.star.io.IOException, com.sun.star.uno.RuntimeException { read += p0; if( read > bigbuffer.length ) diff --git a/odk/examples/DevelopersGuide/UCB/PropertiesRetriever.java b/odk/examples/DevelopersGuide/UCB/PropertiesRetriever.java index 2d000c1a3b90..ea7bb3c588de 100644 --- a/odk/examples/DevelopersGuide/UCB/PropertiesRetriever.java +++ b/odk/examples/DevelopersGuide/UCB/PropertiesRetriever.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import java.util.Vector; diff --git a/odk/examples/DevelopersGuide/UCB/ResourceRemover.java b/odk/examples/DevelopersGuide/UCB/ResourceRemover.java index f08740889cdb..09a6bcb7c21c 100644 --- a/odk/examples/DevelopersGuide/UCB/ResourceRemover.java +++ b/odk/examples/DevelopersGuide/UCB/ResourceRemover.java @@ -2,7 +2,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * @@ -29,7 +29,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ /** |