diff options
Diffstat (limited to 'odk/examples/DevelopersGuide/Drawing')
17 files changed, 137 insertions, 137 deletions
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 ); |