summaryrefslogtreecommitdiff
path: root/odk/examples/DevelopersGuide/Drawing
diff options
context:
space:
mode:
Diffstat (limited to 'odk/examples/DevelopersGuide/Drawing')
-rw-r--r--odk/examples/DevelopersGuide/Drawing/ChangeOrderDemo.java115
-rw-r--r--odk/examples/DevelopersGuide/Drawing/ControlAndSelectDemo.java143
-rw-r--r--odk/examples/DevelopersGuide/Drawing/CustomShowDemo.java173
-rw-r--r--odk/examples/DevelopersGuide/Drawing/DrawViewDemo.java141
-rw-r--r--odk/examples/DevelopersGuide/Drawing/DrawingDemo.java426
-rw-r--r--odk/examples/DevelopersGuide/Drawing/FillAndLineStyleDemo.java133
-rw-r--r--odk/examples/DevelopersGuide/Drawing/GluePointDemo.java188
-rw-r--r--odk/examples/DevelopersGuide/Drawing/GraphicExportDemo.java152
-rw-r--r--odk/examples/DevelopersGuide/Drawing/Helper.java83
-rw-r--r--odk/examples/DevelopersGuide/Drawing/LayerDemo.java156
-rw-r--r--odk/examples/DevelopersGuide/Drawing/Makefile175
-rw-r--r--odk/examples/DevelopersGuide/Drawing/ObjectTransformationDemo.java133
-rw-r--r--odk/examples/DevelopersGuide/Drawing/Organigram.java191
-rw-r--r--odk/examples/DevelopersGuide/Drawing/PageHelper.java223
-rw-r--r--odk/examples/DevelopersGuide/Drawing/PresentationDemo.java239
-rw-r--r--odk/examples/DevelopersGuide/Drawing/ShapeHelper.java145
-rw-r--r--odk/examples/DevelopersGuide/Drawing/SimplePresentation.odpbin74753 -> 0 bytes
-rw-r--r--odk/examples/DevelopersGuide/Drawing/StyleDemo.java174
-rw-r--r--odk/examples/DevelopersGuide/Drawing/TextDemo.java155
-rw-r--r--odk/examples/DevelopersGuide/Drawing/makefile.mk81
20 files changed, 0 insertions, 3226 deletions
diff --git a/odk/examples/DevelopersGuide/Drawing/ChangeOrderDemo.java b/odk/examples/DevelopersGuide/Drawing/ChangeOrderDemo.java
deleted file mode 100644
index 12ae3f20..00000000
--- a/odk/examples/DevelopersGuide/Drawing/ChangeOrderDemo.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * 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 __________
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.XComponent;
-
-import com.sun.star.awt.Point;
-import com.sun.star.awt.Size;
-
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.XPropertySet;
-
-import com.sun.star.drawing.XShape;
-import com.sun.star.drawing.XShapes;
-import com.sun.star.drawing.XDrawPage;
-
-
-
-// __________ Implementation __________
-
-/** ChangeOrderDemo
- @author Sven Jacobi
- */
-
-public class ChangeOrderDemo
-{
- public static void main( String args[] )
- {
- XComponent xDrawDoc = null;
- try
- {
- // 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
- PropertyValue[] pPropValues = new PropertyValue[ 1 ];
- pPropValues[ 0 ] = new PropertyValue();
- pPropValues[ 0 ].Name = "Silent";
- pPropValues[ 0 ].Value = new Boolean( true );
-
- xDrawDoc = Helper.createDocument( xOfficeContext,
- "private:factory/sdraw", "_blank", 0, pPropValues );
-
- // create two rectangles
- XDrawPage xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
- XShapes xShapes = (XShapes)
- UnoRuntime.queryInterface( XShapes.class, xPage );
-
- XShape xShape1 = ShapeHelper.createShape( xDrawDoc,
- new Point( 1000, 1000 ), new Size( 5000, 5000 ),
- "com.sun.star.drawing.RectangleShape" );
-
- 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)
- UnoRuntime.queryInterface( XPropertySet.class, xShape2 );
-
- 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 ) );
- }
- catch( Exception ex )
- {
- System.out.println( ex );
- }
- System.exit( 0 );
- }
-}
diff --git a/odk/examples/DevelopersGuide/Drawing/ControlAndSelectDemo.java b/odk/examples/DevelopersGuide/Drawing/ControlAndSelectDemo.java
deleted file mode 100644
index 3a6bfee2..00000000
--- a/odk/examples/DevelopersGuide/Drawing/ControlAndSelectDemo.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * 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 __________
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XMultiServiceFactory;
-
-import com.sun.star.awt.Point;
-import com.sun.star.awt.Size;
-import com.sun.star.awt.XControlModel;
-
-import com.sun.star.beans.PropertyValue;
-
-import com.sun.star.drawing.XShape;
-import com.sun.star.drawing.XShapes;
-import com.sun.star.drawing.XControlShape;
-import com.sun.star.drawing.XDrawPage;
-import com.sun.star.drawing.XDrawPages;
-import com.sun.star.drawing.XDrawPagesSupplier;
-
-import com.sun.star.frame.XModel;
-import com.sun.star.frame.XController;
-
-import com.sun.star.view.XSelectionSupplier;
-
-
-// __________ Implementation __________
-
-/** ControlAndSelectDemo
- @author Sven Jacobi
-
- A (GroupBox) ControlShape will be created.
- Finally the ControlShape will be inserted into a selection.
-*/
-
-public class ControlAndSelectDemo
-{
- public static void main( String args[] )
- {
- XComponent xComponent = null;
- try
- {
- // 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
- PropertyValue[] pPropValues = new PropertyValue[ 1 ];
- pPropValues[ 0 ] = new PropertyValue();
- pPropValues[ 0 ].Name = "Silent";
- pPropValues[ 0 ].Value = new Boolean( true );
-
- xComponent = Helper.createDocument( xOfficeContext,
- "private:factory/sdraw", "_blank", 0, pPropValues );
-
- XMultiServiceFactory xFactory =
- (XMultiServiceFactory )UnoRuntime.queryInterface(
- XMultiServiceFactory.class, xComponent );
-
- XDrawPagesSupplier xDrawPagesSupplier =
- (XDrawPagesSupplier)UnoRuntime.queryInterface(
- XDrawPagesSupplier.class, xComponent );
- XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages();
- XDrawPage xDrawPage = (XDrawPage)UnoRuntime.queryInterface(
- XDrawPage.class, xDrawPages.getByIndex( 0 ));
- XShapes xShapes = (XShapes)UnoRuntime.queryInterface(XShapes.class,
- xDrawPage );
-
-
- // create and insert the ControlShape
- Object xObj = xFactory.createInstance(
- "com.sun.star.drawing.ControlShape" );
- XShape xShape = (XShape)UnoRuntime.queryInterface( XShape.class, xObj );
- xShape.setPosition( new Point( 1000, 1000 ) );
- xShape.setSize( new Size( 2000, 2000 ) );
- xShapes.add( xShape );
-
- // create and set the control
- XControlModel xControlModel = (XControlModel)UnoRuntime.queryInterface(
- XControlModel.class,
- xFactory.createInstance( "com.sun.star.form.component.GroupBox" ) );
- XControlShape xControlShape = (XControlShape)UnoRuntime.queryInterface(
- XControlShape.class, xShape );
- xControlShape.setControl( xControlModel );
-
-
- // the following code will demonstrate how to
- // make a selection that contains our new created ControlShape
- XModel xModel = (XModel)UnoRuntime.queryInterface( XModel.class,
- xComponent );
- XController xController = xModel.getCurrentController();
- XSelectionSupplier xSelectionSupplier =(XSelectionSupplier)
- UnoRuntime.queryInterface( XSelectionSupplier.class, xController );
- // take care to use the global service factory only and not the one
- // that is provided by the component if you create the ShapeColletion
- XShapes xSelection = (XShapes)UnoRuntime.queryInterface( XShapes.class,
- xOfficeContext.getServiceManager().createInstanceWithContext(
- "com.sun.star.drawing.ShapeCollection", xOfficeContext ) );
- xSelection.add( xShape );
- xSelectionSupplier.select( xSelection );
- }
- catch( java.lang.Exception ex )
- {
- System.out.println( ex );
- }
- System.exit( 0 );
- }
-}
diff --git a/odk/examples/DevelopersGuide/Drawing/CustomShowDemo.java b/odk/examples/DevelopersGuide/Drawing/CustomShowDemo.java
deleted file mode 100644
index 46020dfa..00000000
--- a/odk/examples/DevelopersGuide/Drawing/CustomShowDemo.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * 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 __________
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XSingleServiceFactory;
-
-import com.sun.star.awt.Point;
-import com.sun.star.awt.Size;
-
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.XPropertySet;
-
-import com.sun.star.container.XNamed;
-import com.sun.star.container.XNameContainer;
-import com.sun.star.container.XIndexContainer;
-
-import com.sun.star.drawing.XShape;
-import com.sun.star.drawing.XShapes;
-import com.sun.star.drawing.XDrawPage;
-import com.sun.star.drawing.XDrawPages;
-import com.sun.star.drawing.XDrawPagesSupplier;
-
-import com.sun.star.presentation.XPresentation;
-import com.sun.star.presentation.XPresentationSupplier;
-import com.sun.star.presentation.XCustomPresentationSupplier;
-
-
-// __________ Implementation __________
-
-/** presentation demo
- @author Sven Jacobi
- */
-
-// This demo will demonstrate how to create a CustomShow
-
-// 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.
-
-
-public class CustomShowDemo
-{
- public static void main( String args[] )
- {
- XComponent xDrawDoc = null;
- try
- {
- // 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
- PropertyValue[] pPropValues = new PropertyValue[ 1 ];
- pPropValues[ 0 ] = new PropertyValue();
- pPropValues[ 0 ].Name = "Silent";
- pPropValues[ 0 ].Value = new Boolean( true );
-
- xDrawDoc = Helper.createDocument( xOfficeContext,
- "private:factory/simpress", "_blank", 0, pPropValues );
-
- XDrawPagesSupplier xDrawPagesSupplier =
- (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 );
-
- // assign a name to each page and also insert a text object including the name of the page
- String aNameArray[] = { "Introduction", "page one", "page two", "page three", "page four",
- "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 );
- 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 ),
- "com.sun.star.drawing.TextShape" );
- XShapes xShapes = (XShapes)
- UnoRuntime.queryInterface( XShapes.class, xDrawPage );
- xShapes.add( xTextObj );
- ShapeHelper.addPortion( xTextObj, aNameArray[ i ], true );
- }
-
- /* create two custom shows, one will play slide 6 to 10 and is named "ShortVersion"
- the other one will play slide 2 til 10 and is named "LongVersion" */
- XCustomPresentationSupplier xCustPresSupplier = (XCustomPresentationSupplier)
- UnoRuntime.queryInterface( XCustomPresentationSupplier.class, xDrawDoc );
-
- /* the following container is a container for further container
- which concludes the list of pages that are to play within a custom show */
- XNameContainer xNameContainer = xCustPresSupplier.getCustomPresentations();
- XSingleServiceFactory xFactory = (XSingleServiceFactory)
- UnoRuntime.queryInterface( XSingleServiceFactory.class, xNameContainer );
-
- Object xObj;
- XIndexContainer xContainer;
-
- /* instanciate an IndexContainer that will take
- a list of draw pages for the first custom show */
- xObj = xFactory.createInstance();
- xContainer = (XIndexContainer)UnoRuntime.queryInterface( XIndexContainer.class, xObj );
- for ( i = 5; i < 10; i++ )
- xContainer.insertByIndex( xContainer.getCount(), xDrawPages.getByIndex( i ) );
- xNameContainer.insertByName( "ShortVersion", xContainer );
-
- /* instanciate an IndexContainer that will take
- a list of draw page for the second custom show */
- xObj = xFactory.createInstance();
- xContainer = (XIndexContainer)UnoRuntime.queryInterface( XIndexContainer.class, xObj );
- for ( i = 1; i < 10; i++ )
- xContainer.insertByIndex( xContainer.getCount(), xDrawPages.getByIndex( i ) );
- xNameContainer.insertByName( "LongVersion", xContainer );
-
- /* which custom show is to use
- can been set in the presentation settings */
-
- XPresentationSupplier xPresSupplier = (XPresentationSupplier)
- UnoRuntime.queryInterface( XPresentationSupplier.class, xDrawDoc );
- XPresentation xPresentation = xPresSupplier.getPresentation();
- XPropertySet xPresPropSet = (XPropertySet)
- UnoRuntime.queryInterface( XPropertySet.class, xPresentation );
- xPresPropSet.setPropertyValue( "CustomShow", "ShortVersion" );
- }
- catch( Exception ex )
- {
- System.out.println( ex );
- }
- System.exit( 0 );
- }
-}
diff --git a/odk/examples/DevelopersGuide/Drawing/DrawViewDemo.java b/odk/examples/DevelopersGuide/Drawing/DrawViewDemo.java
deleted file mode 100644
index 1b806d78..00000000
--- a/odk/examples/DevelopersGuide/Drawing/DrawViewDemo.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * 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 __________
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.XComponent;
-
-import com.sun.star.beans.Property;
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.XPropertySet;
-import com.sun.star.beans.XPropertySetInfo;
-
-import com.sun.star.container.XIndexAccess;
-
-import com.sun.star.document.XViewDataSupplier;
-
-import com.sun.star.frame.XModel;
-import com.sun.star.frame.XController;
-
-
-
-// __________ Implementation __________
-
-/** text demo
- @author Sven Jacobi
- */
-
-public class DrawViewDemo
-{
- public static void main( String args[] )
- {
- if ( args.length < 1 )
- {
- System.out.println( "usage: DrawViewDemo SourceURL" );
- System.exit(1);
- }
-
- XComponent xComponent = null;
- try
- {
- // 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
- PropertyValue[] pPropValues = new PropertyValue[ 1 ];
- 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 =
- (XViewDataSupplier)UnoRuntime.queryInterface(
- XViewDataSupplier.class, xModel );
- XIndexAccess xIndexAccess = xViewDataSupplier.getViewData();
- if ( xIndexAccess.getCount() != 0 )
- {
- 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");
- XController xController = xModel.getCurrentController();
- XPropertySet xPropSet =
- (XPropertySet)UnoRuntime.queryInterface(
- XPropertySet.class, xController );
- XPropertySetInfo xPropSetInfo = xPropSet.getPropertySetInfo();
- Property[] aPropSeq = xPropSetInfo.getProperties();
- for( int i = 0; i < aPropSeq.length; i++ )
- {
- System.out.println( aPropSeq[ i ].Name );
- }
- System.out.println("*** change into masterpage mode");
- xPropSet.setPropertyValue( "IsMasterPageMode", new Boolean( true ) );
-
- }
- catch( Exception ex )
- {
- System.out.println( ex.getMessage() );
- ex.printStackTrace(System.out);
- }
-
- System.exit( 0 );
- }
-}
diff --git a/odk/examples/DevelopersGuide/Drawing/DrawingDemo.java b/odk/examples/DevelopersGuide/Drawing/DrawingDemo.java
deleted file mode 100644
index 6d34da14..00000000
--- a/odk/examples/DevelopersGuide/Drawing/DrawingDemo.java
+++ /dev/null
@@ -1,426 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * 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 __________
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.XComponent;
-
-import com.sun.star.awt.Point;
-import com.sun.star.awt.Size;
-
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.XPropertySet;
-
-import com.sun.star.container.XNamed;
-
-import com.sun.star.drawing.PolygonFlags;
-import com.sun.star.drawing.PolyPolygonBezierCoords;
-import com.sun.star.drawing.XShape;
-import com.sun.star.drawing.XShapes;
-import com.sun.star.drawing.XShapeGrouper;
-import com.sun.star.drawing.XDrawPage;
-
-import java.util.Random;
-
-
-// __________ Implementation __________
-
-/** drawing demo
- @author Sven Jacobi
- */
-
-// This drawing demo will create/load a document, and show how to
-// handle pages and shapes using the Office API,
-
-// Calling this demo two parameter can be used. The first parameter
-// describes if a document is to create or load: "draw" creates a
-// draw document, "impress" creates an impress document, any other
-// parameter is interpreted as URL and loads the corresponding
-// document. ( example for a URL is: "file:///c:/test.odp" )
-// The second parameter is the connection that is to use. If no parameter
-// is given a standard impress document is created by using following
-// connection: "uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager";
-
-public class DrawingDemo
-{
- public static void main( String args[] )
- {
- XComponent xDrawDoc = null;
- try
- {
- // 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();
-
- String sURL;
- if ( args.length == 0 )
- sURL = "impress";
- else
- sURL = args[ 0 ];
-
- if ( sURL.equals( "draw" ) )
- sURL = "private:factory/sdraw";
- else if ( sURL.equals( "impress" ) )
- sURL = "private:factory/simpress";
-
- // suppress Presentation Autopilot when opening the document
- // properties are the same as described for
- // com.sun.star.document.MediaDescriptor
- PropertyValue[] pPropValues = new PropertyValue[ 1 ];
- pPropValues[ 0 ] = new PropertyValue();
- pPropValues[ 0 ].Name = "Silent";
- pPropValues[ 0 ].Value = new Boolean( true );
-
- xDrawDoc = Helper.createDocument( xOfficeContext,
- sURL, "_blank", 0, pPropValues );
- }
- catch( Exception ex )
- {
- System.out.println( ex );
- System.exit( 0 );
- }
-
-
- Demo_PageCreation( xDrawDoc, 10 );
- Demo_PageNaming( xDrawDoc, "this page is called: LastPage" );
- Demo_ShapeCreation( xDrawDoc );
- Demo_PolyPolygonBezier( xDrawDoc );
- Demo_Group1( xDrawDoc );
- Demo_Group2( xDrawDoc );
- System.exit( 0 );
- }
-
- // This method appends draw pages to the document, so that a
- // minimum of n draw pages will be available.
- // For each second draw page also a new master page is created.
- public static void Demo_PageCreation( XComponent xDrawDoc, int n )
- {
- try
- {
- // If the document has less than n draw pages, append them,
- // a minimum of n draw pages will be available
- int i, nDrawPages;
- for ( nDrawPages = PageHelper.getDrawPageCount( xDrawDoc );
- nDrawPages < n; nDrawPages++ )
- PageHelper.insertNewDrawPageByIndex( xDrawDoc, nDrawPages );
- // Create a master page for each second drawpage
- int nMasterPages;
- for ( nMasterPages = PageHelper.getMasterPageCount( xDrawDoc );
- 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.
- for ( i = 0; i < nDrawPages; i++ )
- {
- XDrawPage xDrawPage = PageHelper.getDrawPageByIndex( xDrawDoc, i );
- XDrawPage xMasterPage = PageHelper.getMasterPageByIndex(
- xDrawDoc, i / 2 );
- PageHelper.setMasterPage( xDrawPage, xMasterPage );
- }
- }
- catch( Exception ex )
- {
- System.out.println("Demo_PageCreation: I have a page creation problem");
- }
- }
-
- // this method shows how to name a page, this is exemplary
- // be done for the last draw page
- public static void Demo_PageNaming(
- XComponent xDrawDoc, String sLastPageName )
- {
- try
- {
- XDrawPage xLastPage = PageHelper.getDrawPageByIndex( xDrawDoc,
- PageHelper.getDrawPageCount( xDrawDoc ) - 1 );
-
- // each drawpage is supporting an XNamed interface
- XNamed xNamed = (XNamed)UnoRuntime.queryInterface(
- XNamed.class, xLastPage );
-
- // beware, the page must have an unique name
- xNamed.setName( sLastPageName );
- }
- catch( Exception ex )
- {
- System.out.println( "Demo_PageNaming: can't set page name" );
- }
- }
-
- // This method will add one rectangle shape into the lower left quarter of
- // every page that is available,
- public static void Demo_ShapeCreation( XComponent xDrawDoc )
- {
- try
- {
- boolean bIsImpressDocument = PageHelper.isImpressDocument( xDrawDoc );
-
- int nDrawingPages = PageHelper.getDrawPageCount( xDrawDoc );
- int nMasterPages = PageHelper.getMasterPageCount( xDrawDoc );
- int nGlobalPageCount = nDrawingPages + nMasterPages;
-
- if ( bIsImpressDocument )
- {
- // in impress each draw page also has a notes page
- nGlobalPageCount += nDrawingPages;
- // for each drawing master is also a notes master available
- nGlobalPageCount += nMasterPages;
- // one handout is existing
- nGlobalPageCount += 1;
- }
-
- // create and fill a container with all draw pages
- XDrawPage[] pPages = new XDrawPage[ nGlobalPageCount ];
- int i, nCurrentPageIndex = 0;
-
- // insert handout page
- if ( bIsImpressDocument )
- pPages[ nCurrentPageIndex++ ] = PageHelper.getHandoutMasterPage(
- xDrawDoc );
-
- // inserting all master pages
- for( i = 0; i < nMasterPages; i++ )
- {
- XDrawPage xMasterPage = PageHelper.getMasterPageByIndex(
- xDrawDoc, i );
- pPages[ nCurrentPageIndex++ ] = xMasterPage;
-
- // if the document is an impress, get the corresponding notes
- // master page
- if ( bIsImpressDocument )
- pPages[ nCurrentPageIndex++ ] = PageHelper.getNotesPage(
- xMasterPage );
- }
- for ( i = 0; i < nDrawingPages; i++ )
- {
- XDrawPage xDrawPage = PageHelper.getDrawPageByIndex( xDrawDoc, i );
- pPages[ nCurrentPageIndex++ ] = xDrawPage;
-
- // if the document is an impress, get the corresponding notes page
- if ( bIsImpressDocument )
- pPages[ nCurrentPageIndex++ ] = PageHelper.getNotesPage(
- xDrawPage );
- }
-
- // Now a complete list of pages is available in pPages.
- // The following code will insert a rectangle into each page.
- for ( i = 0; i < nGlobalPageCount; i++ )
- {
- Size aPageSize = PageHelper.getPageSize( pPages[ i ] );
- int nHalfWidth = aPageSize.Width / 2;
- int nHalfHeight = aPageSize.Height / 2;
-
- Random aRndGen = new Random();
- int nRndObjWidth = aRndGen.nextInt( nHalfWidth );
- int nRndObjHeight = aRndGen.nextInt( nHalfHeight );
-
- 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,
- new Point( nRndObjPosX, nRndObjPosY ),
- new Size( nRndObjWidth, nRndObjHeight ),
- "com.sun.star.drawing.RectangleShape" );
- }
- }
- catch( Exception ex )
- {
- System.out.println( "Demo_ShapeCreation:" + ex );
- }
- }
-
- // This method will show how to create a PolyPolygonBezier that lies is in the
- // topleft quarter of the page and positioned at the back
- public static void Demo_PolyPolygonBezier( XComponent xDrawDoc )
- {
- try
- {
- XShape xPolyPolygonBezier = ShapeHelper.createShape( xDrawDoc,
- 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
- XDrawPage xDrawPage;
- // if possible insert our new shape in the master page
- if ( PageHelper.isImpressDocument( xDrawDoc ) )
- xDrawPage = PageHelper.getMasterPageByIndex( xDrawDoc, 0 );
- else
- xDrawPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
- XShapes xShapes = (XShapes)
- UnoRuntime.queryInterface( XShapes.class, xDrawPage );
- xShapes.add( xPolyPolygonBezier );
-
- XPropertySet xShapeProperties = (XPropertySet)
- UnoRuntime.queryInterface( XPropertySet.class, xPolyPolygonBezier );
-
- // get pagesize
- XPropertySet xPageProperties = (XPropertySet)
- UnoRuntime.queryInterface( XPropertySet.class, xDrawPage );
- int nPageWidth = ((Integer)xPageProperties.getPropertyValue( "Width" )).intValue() / 2;
- int nPageHeight = ((Integer)xPageProperties.getPropertyValue( "Height" )).intValue() / 2;
-
- PolyPolygonBezierCoords aCoords = new PolyPolygonBezierCoords();
- // allocating the outer sequence
- int nPolygonCount = 50;
- aCoords.Coordinates = new Point[ nPolygonCount ][ ];
- aCoords.Flags = new PolygonFlags[ nPolygonCount ][ ];
- int i, n, nY;
- // fill the inner point sequence now
- for ( nY = 0, i = 0; i < nPolygonCount; i++, nY += nPageHeight / nPolygonCount )
- {
- // 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 ];
-
- for ( n = 0; n < nPointCount; n++ )
- pPolyPoints[ n ] = new Point();
-
- pPolyPoints[ 0 ].X = 0;
- pPolyPoints[ 0 ].Y = nY;
- pPolyFlags[ 0 ] = PolygonFlags.NORMAL;
- pPolyPoints[ 1 ].X = nPageWidth / 2;
- pPolyPoints[ 1 ].Y = nPageHeight;
- pPolyFlags[ 1 ] = PolygonFlags.CONTROL;
- pPolyPoints[ 2 ].X = nPageWidth / 2;;
- pPolyPoints[ 2 ].Y = nPageHeight;
- pPolyFlags[ 2 ] = PolygonFlags.CONTROL;
- pPolyPoints[ 3 ].X = nPageWidth;
- pPolyPoints[ 3 ].Y = nY;
- pPolyFlags[ 3 ] = PolygonFlags.NORMAL;
-
- pPolyPoints[ 4 ].X = nPageWidth - 1000;
- pPolyPoints[ 4 ].Y = nY;
- pPolyFlags[ 4 ] = PolygonFlags.NORMAL;
- pPolyPoints[ 5 ].X = nPageWidth / 2;
- pPolyPoints[ 5 ].Y = nPageHeight / 2;
- pPolyFlags[ 5 ] = PolygonFlags.CONTROL;
- pPolyPoints[ 6 ].X = nPageWidth / 2;;
- pPolyPoints[ 6 ].Y = nPageHeight / 2;
- pPolyFlags[ 6 ] = PolygonFlags.CONTROL;
- pPolyPoints[ 7 ].X = 1000;
- pPolyPoints[ 7 ].Y = nY;
- pPolyFlags[ 7 ] = PolygonFlags.NORMAL;
-
- aCoords.Coordinates[ i ]= pPolyPoints;
- aCoords.Flags[ i ] = pPolyFlags;
- }
- xShapeProperties.setPropertyValue( "PolyPolygonBezier", aCoords );
-
- // move the shape to the back by changing the ZOrder
- xShapeProperties.setPropertyValue( "ZOrder", new Integer( 1 ) );
- }
- catch ( Exception ex )
- {
- System.out.println( "Demo_PolyPolygonBezier:" + ex );
- }
- }
-
- // 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 )
- {
- try
- {
- XShape xGroup = ShapeHelper.createShape( xDrawDoc,
- new Point( 0, 0 ),
- new Size( 0, 0 ),
- "com.sun.star.drawing.GroupShape" );
-
- // before it is possible to insert shapes,
- // the group must have been added to the page
- XDrawPage xDrawPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
- XShapes xShapes = (XShapes)
- UnoRuntime.queryInterface( XShapes.class, xDrawPage );
- xShapes.add( xGroup );
-
- XShapes xShapesGroup = (XShapes)
- UnoRuntime.queryInterface( XShapes.class, xGroup );
-
- Size aPageSize = PageHelper.getPageSize( xDrawPage );
-
- int nWidth = 4000;
- int nHeight = 2000;
- int nPosX = ( aPageSize.Width * 3 ) / 4 - nWidth / 2;
- int nPosY1 = 2000;
- int nPosY2 = aPageSize.Height / 2 - ( nPosY1 + nHeight );
- XShape xRect1 = ShapeHelper.createShape( xDrawDoc,
- new Point( nPosX, nPosY1 ),
- new Size( nWidth, nHeight ),
- "com.sun.star.drawing.EllipseShape" );
- XShape xRect2 = ShapeHelper.createShape( xDrawDoc,
- new Point( nPosX, nPosY2 ),
- new Size( nWidth, nHeight ),
- "com.sun.star.drawing.EllipseShape" );
-
- xShapesGroup.add( xRect1 );
- xShapesGroup.add( xRect2 );
- }
- catch ( Exception ex )
- {
- System.out.println( "Demo_Group1:" + ex );
- }
- }
-
- // This method will group all available objects on the
- // first page.
- public static void Demo_Group2( XComponent xDrawDoc )
- {
- try
- {
- XDrawPage xDrawPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
- XShapeGrouper xShapeGrouper = (XShapeGrouper)
- UnoRuntime.queryInterface( XShapeGrouper.class, xDrawPage );
-
- XShapes xShapesPage = (XShapes)
- UnoRuntime.queryInterface( XShapes.class, xDrawPage );
-
- xShapeGrouper.group( xShapesPage );
- }
- catch ( Exception ex )
- {
- System.out.println( "Demo_Group2:" + ex );
- }
- }
-}
diff --git a/odk/examples/DevelopersGuide/Drawing/FillAndLineStyleDemo.java b/odk/examples/DevelopersGuide/Drawing/FillAndLineStyleDemo.java
deleted file mode 100644
index 9380ffd2..00000000
--- a/odk/examples/DevelopersGuide/Drawing/FillAndLineStyleDemo.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * 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 __________
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.XComponent;
-
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.XPropertySet;
-
-import com.sun.star.drawing.LineDash;
-import com.sun.star.drawing.XShape;
-import com.sun.star.drawing.XShapes;
-import com.sun.star.drawing.XDrawPage;
-
-import com.sun.star.awt.Gradient;
-import com.sun.star.awt.GradientStyle;
-import com.sun.star.awt.Point;
-import com.sun.star.awt.Size;
-
-
-// __________ Implementation __________
-
-/** FillStyle and LineStyle demo
- @author Sven Jacobi
- */
-
-public class FillAndLineStyleDemo
-{
- public static void main( String args[] )
- {
- XComponent xDrawDoc = null;
- try
- {
- // 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
- PropertyValue[] pPropValues = new PropertyValue[ 1 ];
- pPropValues[ 0 ] = new PropertyValue();
- pPropValues[ 0 ].Name = "Silent";
- pPropValues[ 0 ].Value = new Boolean( true );
-
- xDrawDoc = Helper.createDocument( xOfficeContext,
- "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
- right and is changing its color from green to yellow */
- xPropSet.setPropertyValue( "FillStyle",
- com.sun.star.drawing.FillStyle.GRADIENT );
- Gradient aGradient = new Gradient();
- aGradient.Style = GradientStyle.LINEAR;
- aGradient.StartColor = 0x00ff00;
- aGradient.EndColor = 0xffff00;
- aGradient.Angle = 450;
- aGradient.Border = 0;
- aGradient.XOffset = 0;
- aGradient.YOffset = 0;
- aGradient.StartIntensity = 100;
- aGradient.EndIntensity = 100;
- aGradient.StepCount = 10;
- xPropSet.setPropertyValue( "FillGradient", aGradient );
-
- /* create a blue line with dashes and dots */
- xPropSet.setPropertyValue( "LineStyle",
- com.sun.star.drawing.LineStyle.DASH );
- LineDash aLineDash = new LineDash();
- aLineDash.Dots = 3;
- aLineDash.DotLen = 150;
- aLineDash.Dashes = 3;
- aLineDash.DashLen = 300;
- aLineDash.Distance = 150;
- xPropSet.setPropertyValue( "LineDash", aLineDash );
- xPropSet.setPropertyValue( "LineColor", new Integer( 0x0000ff ) );
- xPropSet.setPropertyValue( "LineWidth", new Integer( 200 ) );
-
- }
- catch( Exception ex )
- {
- System.out.println( ex );
- }
- System.exit( 0 );
- }
-}
diff --git a/odk/examples/DevelopersGuide/Drawing/GluePointDemo.java b/odk/examples/DevelopersGuide/Drawing/GluePointDemo.java
deleted file mode 100644
index 43765dec..00000000
--- a/odk/examples/DevelopersGuide/Drawing/GluePointDemo.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * 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 __________
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.XComponent;
-
-import com.sun.star.awt.Point;
-import com.sun.star.awt.Size;
-
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.XPropertySet;
-
-import com.sun.star.container.XIndexContainer;
-import com.sun.star.container.XIdentifierContainer;
-
-import com.sun.star.drawing.Alignment;
-import com.sun.star.drawing.EscapeDirection;
-import com.sun.star.drawing.GluePoint2;
-import com.sun.star.drawing.XShape;
-import com.sun.star.drawing.XShapes;
-import com.sun.star.drawing.XDrawPage;
-import com.sun.star.drawing.XGluePointsSupplier;
-
-
-
-// __________ Implementation __________
-
-/** GluePointDemo
- @author Sven Jacobi
- */
-
-public class GluePointDemo
-{
- public static void main( String args[] )
- {
- XComponent xDrawDoc = null;
- try
- {
- // 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
- PropertyValue[] pPropValues = new PropertyValue[ 1 ];
- pPropValues[ 0 ] = new PropertyValue();
- pPropValues[ 0 ].Name = "Silent";
- pPropValues[ 0 ].Value = new Boolean( true );
-
- xDrawDoc = Helper.createDocument( xOfficeContext,
- "private:factory/sdraw", "_blank", 0, pPropValues );
-
-
- XDrawPage xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
- XShapes xShapes = (XShapes)
- UnoRuntime.queryInterface( XShapes.class, xPage );
-
- // create two rectangles
- XShape xShape1 = ShapeHelper.createShape( xDrawDoc,
- new Point( 15000, 1000 ), new Size( 5000, 5000 ),
- "com.sun.star.drawing.RectangleShape" );
-
- XShape xShape2 = ShapeHelper.createShape( xDrawDoc,
- new Point( 2000, 15000 ), new Size( 5000, 5000 ),
- "com.sun.star.drawing.EllipseShape" );
-
- // and a connector
- XShape xConnector = ShapeHelper.createShape( xDrawDoc,
- new Point( 0, 0 ),
- new Size( 0, 0 ),
- "com.sun.star.drawing.ConnectorShape" );
-
- 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
-
- int nStartIndex = 3;
- int nEndIndex = 1;
-
- // the "StartPosition" or "EndPosition" property needs not to be set
- // if there is a shape to connect
- xConnectorPropSet.setPropertyValue( "StartShape", xShape1 );
- xConnectorPropSet.setPropertyValue( "StartGluePointIndex",
- new Integer( nStartIndex ) );
-
- xConnectorPropSet.setPropertyValue( "EndShape", xShape2 );
- xConnectorPropSet.setPropertyValue( "EndGluePointIndex",
- new Integer( nEndIndex ) );
-
- XGluePointsSupplier xGluePointsSupplier;
- XIndexContainer xIndexContainer;
- XIdentifierContainer xIdentifierContainer;
-
- GluePoint2 aGluePoint = new GluePoint2();
- aGluePoint.IsRelative = false;
- aGluePoint.PositionAlignment = Alignment.CENTER;
- aGluePoint.Escape = EscapeDirection.SMART;
- aGluePoint.IsUserDefined = true;
- aGluePoint.Position.X = 0;
- aGluePoint.Position.Y = 0;
-
- // create and insert a glue point at shape1
- xGluePointsSupplier = (XGluePointsSupplier)
- UnoRuntime.queryInterface( XGluePointsSupplier.class, xShape1 );
- xIndexContainer = xGluePointsSupplier.getGluePoints();
- xIdentifierContainer = (XIdentifierContainer)
- UnoRuntime.queryInterface( XIdentifierContainer.class,
- xIndexContainer );
- int nIndexOfGluePoint1 = xIdentifierContainer.insert( aGluePoint );
-
- // create and insert a glue point at shape2
- xGluePointsSupplier = (XGluePointsSupplier)
- UnoRuntime.queryInterface( XGluePointsSupplier.class, xShape2 );
- xIndexContainer = xGluePointsSupplier.getGluePoints();
- xIdentifierContainer = (XIdentifierContainer)
- UnoRuntime.queryInterface( XIdentifierContainer.class,
- xIndexContainer );
- int nIndexOfGluePoint2 = xIdentifierContainer.insert( aGluePoint );
-
- // create and add a connector
- XShape xConnector2 = ShapeHelper.createShape( xDrawDoc,
- new Point( 0, 0 ),
- new Size( 0, 0 ),
- "com.sun.star.drawing.ConnectorShape" );
- xShapes.add( xConnector2 );
-
- XPropertySet xConnector2PropSet = (XPropertySet)
- UnoRuntime.queryInterface( XPropertySet.class, xConnector2 );
-
- xConnector2PropSet.setPropertyValue( "StartShape", xShape1 );
- xConnector2PropSet.setPropertyValue( "StartGluePointIndex",
- new Integer( nIndexOfGluePoint1 ) );
-
- xConnector2PropSet.setPropertyValue( "EndShape", xShape2 );
- xConnector2PropSet.setPropertyValue( "EndGluePointIndex",
- new Integer( nIndexOfGluePoint2 ) );
-
-
- }
- catch( Exception ex )
- {
- System.out.println( ex );
- }
- System.exit( 0 );
- }
-}
diff --git a/odk/examples/DevelopersGuide/Drawing/GraphicExportDemo.java b/odk/examples/DevelopersGuide/Drawing/GraphicExportDemo.java
deleted file mode 100644
index a6ca8d38..00000000
--- a/odk/examples/DevelopersGuide/Drawing/GraphicExportDemo.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * 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 __________
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.XComponent;
-
-import com.sun.star.beans.PropertyValue;
-
-import com.sun.star.document.XExporter;
-import com.sun.star.document.XFilter;
-
-import com.sun.star.drawing.XDrawPage;
-
-// __________ Implementation __________
-
-/** text demo
- @author Sven Jacobi
- */
-
-public class GraphicExportDemo
-{
- public static void main( String args[] )
- {
- if ( args.length < 3 )
- {
- System.out.println( "usage: GraphicExportDemo SourceURL DestinationURL PageIndexToExport" );
- System.exit(1);
- }
-
- XComponent xComponent = null;
- try
- {
- // 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
- PropertyValue[] pPropValues = new PropertyValue[ 1 ];
- 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].Value = "WMF";
- */
- java.io.File destFile = new java.io.File(args[1]);
- java.net.URL destUrl = destFile.toURI().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 )
- {
- XDrawPage xPage = PageHelper.getDrawPageByIndex( xComponent,
- nPageIndex );
- XComponent xComp = (XComponent)
- UnoRuntime.queryInterface( XComponent.class, xPage );
- xExporter.setSourceDocument( xComp );
- 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 \""
- + 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,
- xComponent);
-
- if (xCloseable != null )
- xCloseable.close(false);
- else
- xComponent.dispose();
-
- 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
deleted file mode 100644
index e9d316ee..00000000
--- a/odk/examples/DevelopersGuide/Drawing/Helper.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * 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 __________
-
-import com.sun.star.uno.UnoRuntime;
-
-public class Helper
-{
- // __________ static helper methods __________
-
- /** Connect to an office, if no office is running a new instance is started.
- * A new connection is established and the service manger from the running
- * offic eis returned.
- */
- static public com.sun.star.uno.XComponentContext connect()
- throws Exception
- {
- // get the remote office component context
- com.sun.star.uno.XComponentContext xOfficeContext =
- com.sun.star.comp.helper.Bootstrap.bootstrap();
-
- // if connection fails an exception is thrown
- System.out.println("Connected to a running office ...");
-
- return xOfficeContext;
- }
-
- /** creates and instantiates new document
- */
- static public com.sun.star.lang.XComponent createDocument(
- com.sun.star.uno.XComponentContext xOfficeContext,
- String sURL, String sTargetFrame, int nSearchFlags,
- com.sun.star.beans.PropertyValue[] aArgs )
- throws Exception
- {
- com.sun.star.lang.XComponent xComponent = null;
- com.sun.star.frame.XComponentLoader aLoader =
- (com.sun.star.frame.XComponentLoader)UnoRuntime.queryInterface(
- com.sun.star.frame.XComponentLoader.class,
- xOfficeContext.getServiceManager().createInstanceWithContext(
- "com.sun.star.frame.Desktop", xOfficeContext));
-
- 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
deleted file mode 100644
index 47fc9644..00000000
--- a/odk/examples/DevelopersGuide/Drawing/LayerDemo.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * 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 __________
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.XComponent;
-
-import com.sun.star.awt.Point;
-import com.sun.star.awt.Size;
-
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.XPropertySet;
-
-import com.sun.star.container.XNameAccess;
-
-import com.sun.star.style.ParagraphAdjust;
-
-import com.sun.star.drawing.XShape;
-import com.sun.star.drawing.XShapes;
-import com.sun.star.drawing.XDrawPage;
-import com.sun.star.drawing.XLayer;
-import com.sun.star.drawing.XLayerManager;
-import com.sun.star.drawing.XLayerSupplier;
-
-
-// __________ Implementation __________
-
-/** LayerDemo
- @author Sven Jacobi
- */
-
-public class LayerDemo
-{
- public static void main( String args[] )
- {
- XComponent xDrawDoc = null;
- try
- {
- // 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
- PropertyValue[] pPropValues = new PropertyValue[ 1 ];
- pPropValues[ 0 ] = new PropertyValue();
- pPropValues[ 0 ].Name = "Silent";
- pPropValues[ 0 ].Value = new Boolean( true );
-
- xDrawDoc = Helper.createDocument( xOfficeContext,
- "private:factory/sdraw", "_blank", 0, pPropValues );
-
-
- // create two rectangles
- XDrawPage xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
- XShapes xShapes = (XShapes)
- UnoRuntime.queryInterface( XShapes.class, xPage );
-
- XShape xRect1 = ShapeHelper.createShape( xDrawDoc,
- new Point( 1000, 1000 ), new Size( 5000, 5000 ),
- "com.sun.star.drawing.RectangleShape" );
-
- XShape xRect2 = ShapeHelper.createShape( xDrawDoc,
- new Point( 1000, 7000 ), new Size( 5000, 5000 ),
- "com.sun.star.drawing.RectangleShape" );
-
- xShapes.add( xRect1 );
- xShapes.add( xRect2 );
- XPropertySet xTextProp = ShapeHelper.addPortion( xRect2,
- "this shape is locked",
- false );
- xTextProp.setPropertyValue( "ParaAdjust", ParagraphAdjust.CENTER );
- ShapeHelper.addPortion( xRect2, "and the shape above is not visible",
- true );
- ShapeHelper.addPortion( xRect2,
- "(switch to the layer view to gain access)",
- true );
-
-
- // query for the XLayerManager
- XLayerSupplier xLayerSupplier = (XLayerSupplier)
- (XLayerSupplier)UnoRuntime.queryInterface(
- XLayerSupplier.class, xDrawDoc );
- XNameAccess xNameAccess = xLayerSupplier.getLayerManager();
- XLayerManager xLayerManager = (XLayerManager)
- (XLayerManager)UnoRuntime.queryInterface(
- 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 );
- xLayerPropSet.setPropertyValue( "Name", "NotVisibleAndEditable" );
- xLayerPropSet.setPropertyValue( "IsVisible", new Boolean( false ) );
- xLayerPropSet.setPropertyValue( "IsLocked", new Boolean( true ) );
-
- // create a second layer
- XLayer xNotEditable = xLayerManager.insertNewByIndex(
- xLayerManager.getCount() );
-
- xLayerPropSet = (XPropertySet)
- (XPropertySet)UnoRuntime.queryInterface(
- XPropertySet.class, xNotEditable );
- xLayerPropSet.setPropertyValue( "Name", "NotEditable" );
- xLayerPropSet.setPropertyValue( "IsVisible", new Boolean( true ) );
- xLayerPropSet.setPropertyValue( "IsLocked", new Boolean( true ) );
-
- // attach the layer to the rectangles
- xLayerManager.attachShapeToLayer( xRect1, xNotVisibleAndEditable );
- xLayerManager.attachShapeToLayer( xRect2, xNotEditable );
-
- }
- catch( Exception ex )
- {
- System.out.println( ex );
- }
- System.exit( 0 );
- }
-}
diff --git a/odk/examples/DevelopersGuide/Drawing/Makefile b/odk/examples/DevelopersGuide/Drawing/Makefile
deleted file mode 100644
index 2bf39023..00000000
--- a/odk/examples/DevelopersGuide/Drawing/Makefile
+++ /dev/null
@@ -1,175 +0,0 @@
-#*************************************************************************
-#
-# 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.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of Sun Microsystems, Inc. nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# 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.
-#
-#**************************************************************************
-
-# Builds the Drawing examples of the Developers Guide.
-
-PRJ=../../..
-SETTINGS=$(PRJ)/settings
-
-include $(SETTINGS)/settings.mk
-include $(SETTINGS)/std.mk
-include $(SETTINGS)/dk.mk
-
-# Define non-platform/compiler specific settings
-SAMPLE_NAME=DrawingExamples
-SAMPLE_CLASS_OUT = $(OUT_CLASS)/$(SAMPLE_NAME)
-SAMPLE_GEN_OUT = $(OUT_MISC)/$(SAMPLE_NAME)
-
-APP1_NAME=ChangeOrderDemo
-APP1_JAR=$(SAMPLE_CLASS_OUT)/$(APP1_NAME).jar
-APP2_NAME=ControlAndSelectDemo
-APP2_JAR=$(SAMPLE_CLASS_OUT)/$(APP2_NAME).jar
-APP3_NAME=CustomShowDemo
-APP3_JAR=$(SAMPLE_CLASS_OUT)/$(APP3_NAME).jar
-APP4_NAME=DrawingDemo
-APP4_JAR=$(SAMPLE_CLASS_OUT)/$(APP4_NAME).jar
-APP5_NAME=DrawViewDemo
-APP5_JAR=$(SAMPLE_CLASS_OUT)/$(APP5_NAME).jar
-APP6_NAME=FillAndLineStyleDemo
-APP6_JAR=$(SAMPLE_CLASS_OUT)/$(APP6_NAME).jar
-APP7_NAME=GluePointDemo
-APP7_JAR=$(SAMPLE_CLASS_OUT)/$(APP7_NAME).jar
-APP8_NAME=GraphicExportDemo
-APP8_JAR=$(SAMPLE_CLASS_OUT)/$(APP8_NAME).jar
-APP9_NAME=LayerDemo
-APP9_JAR=$(SAMPLE_CLASS_OUT)/$(APP9_NAME).jar
-APP10_NAME=ObjectTransformationDemo
-APP10_JAR=$(SAMPLE_CLASS_OUT)/$(APP10_NAME).jar
-APP11_NAME=Organigram
-APP11_JAR=$(SAMPLE_CLASS_OUT)/$(APP11_NAME).jar
-APP12_NAME=PresentationDemo
-APP12_JAR=$(SAMPLE_CLASS_OUT)/$(APP12_NAME).jar
-APP13_NAME=StyleDemo
-APP13_JAR=$(SAMPLE_CLASS_OUT)/$(APP13_NAME).jar
-APP14_NAME=TextDemo
-APP14_JAR=$(SAMPLE_CLASS_OUT)/$(APP14_NAME).jar
-
-APP_JAVAFILES = \
- Helper.java \
- PageHelper.java \
- ShapeHelper.java
-
-APP_CLASSFILES = $(patsubst %.java,$(SAMPLE_CLASS_OUT)/%.class,$(APP_JAVAFILES))
-APP_CLASSNAMES = $(patsubst %.java,%.class,$(APP_JAVAFILES))
-
-SDK_CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(CLASSPATH)\
- $(PATH_SEPARATOR)$(SAMPLE_CLASS_OUT))
-
-
-# Targets
-.PHONY: ALL
-ALL : \
- DrawingExamples
-
-include $(SETTINGS)/stdtarget.mk
-
-$(APP_CLASSFILES) : $(APP_JAVAFILES)
- -$(MKDIR) $(subst /,$(PS),$(@D))
- $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(SAMPLE_CLASS_OUT) $(APP_JAVAFILES)
-
-$(SAMPLE_CLASS_OUT)/%.class : %.java $(APP_CLASSFILES)
- -$(MKDIR) $(subst /,$(PS),$(@D))
- $(SDK_JAVAC) $(JAVAC_FLAGS) -classpath "$(SDK_CLASSPATH)" -d $(SAMPLE_CLASS_OUT) $<
-
-$(SAMPLE_CLASS_OUT)/%.mf :
- -$(MKDIR) $(subst /,$(PS),$(@D))
- @echo Main-Class: com.sun.star.lib.loader.Loader> $@
- $(ECHOLINE)>> $@
- @echo Name: com/sun/star/lib/loader/Loader.class>> $@
- @echo Application-Class: $*>> $@
-
-$(SAMPLE_CLASS_OUT)/%.jar : $(SAMPLE_CLASS_OUT)/%.mf $(SAMPLE_CLASS_OUT)/%.class $(APP_CLASSFILES)
- -$(DEL) $(subst \\,\,$(subst /,$(PS),$@))
- -$(MKDIR) $(subst /,$(PS),$(@D))
- +cd $(subst /,$(PS),$(SAMPLE_CLASS_OUT)) && $(SDK_JAR) cvfm $(@F) $*.mf $*.class $(APP_CLASSNAMES)
- +$(SDK_JAR) uvf $@ $(SDK_JAVA_UNO_BOOTSTRAP_FILES)
-
-$(APP1_JAR) : $(SAMPLE_CLASS_OUT)/$(APP1_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP1_NAME).class
-$(APP2_JAR) : $(SAMPLE_CLASS_OUT)/$(APP2_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP2_NAME).class
-$(APP3_JAR) : $(SAMPLE_CLASS_OUT)/$(APP3_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP3_NAME).class
-$(APP4_JAR) : $(SAMPLE_CLASS_OUT)/$(APP4_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP4_NAME).class
-$(APP5_JAR) : $(SAMPLE_CLASS_OUT)/$(APP5_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP5_NAME).class
-$(APP6_JAR) : $(SAMPLE_CLASS_OUT)/$(APP6_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP6_NAME).class
-$(APP7_JAR) : $(SAMPLE_CLASS_OUT)/$(APP7_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP7_NAME).class
-$(APP8_JAR) : $(SAMPLE_CLASS_OUT)/$(APP8_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP8_NAME).class
-$(APP9_JAR) : $(SAMPLE_CLASS_OUT)/$(APP9_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP9_NAME).class
-$(APP10_JAR) : $(SAMPLE_CLASS_OUT)/$(APP10_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP10_NAME).class
-$(APP11_JAR) : $(SAMPLE_CLASS_OUT)/$(APP11_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP11_NAME).class
-$(APP12_JAR) : $(SAMPLE_CLASS_OUT)/$(APP12_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP12_NAME).class
-$(APP13_JAR) : $(SAMPLE_CLASS_OUT)/$(APP13_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP13_NAME).class
-$(APP14_JAR) : $(SAMPLE_CLASS_OUT)/$(APP14_NAME).mf $(SAMPLE_CLASS_OUT)/$(APP14_NAME).class
-
-DrawingExamples : $(APP1_JAR) $(APP2_JAR) $(APP3_JAR) $(APP4_JAR) $(APP5_JAR) $(APP6_JAR) $(APP7_JAR) $(APP8_JAR) $(APP9_JAR) $(APP10_JAR) $(APP11_JAR) $(APP12_JAR) $(APP13_JAR) $(APP14_JAR)
- @echo --------------------------------------------------------------------------------
- @echo Please use one of the following commands to execute the examples!
- @echo -
- @echo $(MAKE) $(APP1_NAME).run
- @echo $(MAKE) $(APP2_NAME).run
- @echo $(MAKE) $(APP3_NAME).run
- @echo $(MAKE) $(APP4_NAME).run
- @echo $(MAKE) $(APP5_NAME).run
- @echo $(MAKE) $(APP6_NAME).run
- @echo $(MAKE) $(APP7_NAME).run
- @echo $(MAKE) $(APP8_NAME).run
- @echo $(MAKE) $(APP9_NAME).run
- @echo $(MAKE) $(APP10_NAME).run
- @echo $(MAKE) $(APP11_NAME).run
- @echo $(MAKE) $(APP12_NAME).run
- @echo $(MAKE) $(APP13_NAME).run
- @echo $(MAKE) $(APP14_NAME).run
- @echo --------
- @echo The $(APP5_NAME) and the $(APP8_NAME) needs parameters. Please use the
- @echo following command to start the demo if you do not want the default parameters
- @echo specified in the this makefile:
- @echo --- $(APP5_NAME) ---
- @echo java -Dcom.sun.star.lib.loader.unopath="$(QM)$(OFFICE_PROGRAM_PATH)$(QM)" -jar $(APP5_NAME).jar "$(QM)SourceUrl$(QM)"
- @echo --- $(APP8_NAME) ---
- @echo java -Dcom.sun.star.lib.loader.unopath="$(QM)$(OFFICE_PROGRAM_PATH)$(QM)" -jar $(APP8_NAME).jar "$(QM)SourceUrl$(QM)" "$(QM)DestinationUrl$(QM)" "$(QM)index$(QM)"
- @echo --------------------------------------------------------------------------------
-
-%.run: $(SAMPLE_CLASS_OUT)/%.jar
- $(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $<
-
-$(APP5_NAME).run: $(APP5_JAR)
- $(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< SimplePresentation.odp
-
-$(APP8_NAME).run: $(APP8_JAR)
- -$(MKDIR) $(subst /,$(PS),$(SAMPLE_GEN_OUT)/export)
- $(SDK_JAVA) -Dcom.sun.star.lib.loader.unopath="$(OFFICE_PROGRAM_PATH)" -jar $< SimplePresentation.odp "$(SAMPLE_GEN_OUT)/export/MyTestExport.gif" 2
-
-
-.PHONY: clean
-clean :
- -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_CLASS_OUT))
- -$(DELRECURSIVE) $(subst /,$(PS),$(SAMPLE_GEN_OUT))
diff --git a/odk/examples/DevelopersGuide/Drawing/ObjectTransformationDemo.java b/odk/examples/DevelopersGuide/Drawing/ObjectTransformationDemo.java
deleted file mode 100644
index 56b5e806..00000000
--- a/odk/examples/DevelopersGuide/Drawing/ObjectTransformationDemo.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * 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 __________
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.XComponent;
-
-import com.sun.star.awt.Point;
-import com.sun.star.awt.Size;
-
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.XPropertySet;
-
-import com.sun.star.drawing.XShape;
-import com.sun.star.drawing.XShapes;
-import com.sun.star.drawing.XDrawPage;
-import com.sun.star.drawing.HomogenMatrix3;
-
-import java.awt.geom.AffineTransform;
-
-// __________ Implementation __________
-
-/** ObjectTransformationDemo
- @author Sven Jacobi
- */
-
-public class ObjectTransformationDemo
-{
- public static void main( String args[] )
- {
- XComponent xDrawDoc = null;
- try
- {
- // 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
- PropertyValue[] pPropValues = new PropertyValue[ 1 ];
- pPropValues[ 0 ] = new PropertyValue();
- pPropValues[ 0 ].Name = "Silent";
- pPropValues[ 0 ].Value = new Boolean( true );
-
- xDrawDoc = Helper.createDocument( xOfficeContext,
- "private:factory/simpress", "_blank", 0, pPropValues );
-
- XDrawPage xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
- XPropertySet xPagePropSet= (XPropertySet)
- UnoRuntime.queryInterface( XPropertySet.class, xPage );
-
- XShapes xShapes = (XShapes)
- UnoRuntime.queryInterface( XShapes.class, xPage );
-
-
- XShape xShape = ShapeHelper.createShape( xDrawDoc,
- 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,
- aHomogenMatrix3.Line1.Column2, aHomogenMatrix3.Line2.Column2,
- aHomogenMatrix3.Line1.Column3, aHomogenMatrix3.Line2.Column3 );
-
-
- AffineTransform aNewMatrix1 = new AffineTransform();
- aNewMatrix1.setToRotation( Math.PI /180 * 15 );
- aNewMatrix1.concatenate( aOriginalMatrix );
-
- AffineTransform aNewMatrix2 = new AffineTransform();
- aNewMatrix2.setToTranslation( 2000, 2000 );
- aNewMatrix2.concatenate( aNewMatrix1 );
-
- double aFlatMatrix[] = new double[ 6 ];
- aNewMatrix2.getMatrix( aFlatMatrix );
- aHomogenMatrix3.Line1.Column1 = aFlatMatrix[ 0 ];
- aHomogenMatrix3.Line2.Column1 = aFlatMatrix[ 1 ];
- aHomogenMatrix3.Line1.Column2 = aFlatMatrix[ 2 ];
- aHomogenMatrix3.Line2.Column2 = aFlatMatrix[ 3 ];
- aHomogenMatrix3.Line1.Column3 = aFlatMatrix[ 4 ];
- aHomogenMatrix3.Line2.Column3 = aFlatMatrix[ 5 ];
- xPropSet.setPropertyValue( "Transformation", aHomogenMatrix3 );
-
-
- }
- catch( Exception ex )
- {
- System.out.println( ex );
- }
- System.exit( 0 );
- }
-}
diff --git a/odk/examples/DevelopersGuide/Drawing/Organigram.java b/odk/examples/DevelopersGuide/Drawing/Organigram.java
deleted file mode 100644
index caa390dc..00000000
--- a/odk/examples/DevelopersGuide/Drawing/Organigram.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * 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;
-
-import com.sun.star.bridge.XUnoUrlResolver;
-
-import com.sun.star.frame.XComponentLoader;
-
-import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XMultiComponentFactory;
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.AnyConverter;
-import com.sun.star.uno.XComponentContext;
-
-
-/*
- * OpenQuery.java
- *
- * Created on 6. Juli 2002, 10:25
- */
-
-/**
- *
- * @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
- */
- public static void main(String[] args) {
- Organigram organigram1 = new Organigram();
- try {
- organigram1.drawOrganigram();
- }
- catch (java.lang.Exception e){
- e.printStackTrace();
- }
- finally {
- System.exit(0);
- }
- }
- 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 ...");
- // get the remote service manager
- 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 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(
- com.sun.star.drawing.XDrawPagesSupplier.class, xDrawComponent );
- com.sun.star.drawing.XDrawPages xDrawPages =
- xDrawPagesSupplier.getDrawPages();
- Object drawPage = xDrawPages.getByIndex(0);
- 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"));
- int pageBorderLeft = AnyConverter.toInt(xPageProps.getPropertyValue("BorderLeft"));
- int pageBorderRight = AnyConverter.toInt(xPageProps.getPropertyValue("BorderRight"));
- int drawWidth = pageWidth - pageBorderLeft - pageBorderRight;
- int horCenter = pageBorderLeft + drawWidth / 2;
-
- String[][] orgUnits = new String[2][4];
- orgUnits[0][0] = "Management";
- orgUnits[1][0] = "Production";
- orgUnits[1][1] = "Purchasing";
- orgUnits[1][2] = "IT Services";
- orgUnits[1][3] = "Sales";
- int[] levelCount = {1, 4};
-
- int horSpace = 300;
- int verSpace = 3000;
-
- int shapeWidth = (drawWidth - (levelCount[1] - 1) * horSpace) / levelCount[1];
- 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--) {
- shapeX = horCenter - (levelCount[level] * shapeWidth +
- (levelCount[level] - 1) * horSpace) / 2
- + i * shapeWidth + i * horSpace;
- Object shape = xDocumentFactory.createInstance("com.sun.star.drawing.RectangleShape");
- com.sun.star.drawing.XShape xShape = (com.sun.star.drawing.XShape)
- 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));
- 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]);
-
- // memorize the root shape
- if (level == 0 && i == 0)
- xStartShape = xShape;
-
- if (level == 1) {
- Object connector = xDocumentFactory.createInstance("com.sun.star.drawing.ConnectorShape");
- com.sun.star.beans.XPropertySet xConnectorProps =
- (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface(
- com.sun.star.beans.XPropertySet.class, connector);
- com.sun.star.drawing.XShape xConnector =
- (com.sun.star.drawing.XShape)UnoRuntime.queryInterface(
- com.sun.star.drawing.XShape.class, connector);
- xDrawPage.add(xConnector);
- xConnectorProps.setPropertyValue("StartShape", xStartShape);
- xConnectorProps.setPropertyValue("EndShape", xShape);
- xConnectorProps.setPropertyValue("StartGluePointIndex",
- 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
deleted file mode 100644
index 10391668..00000000
--- a/odk/examples/DevelopersGuide/Drawing/PageHelper.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * 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 __________
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XServiceInfo;
-
-import com.sun.star.awt.Size;
-
-import com.sun.star.beans.XPropertySet;
-
-import com.sun.star.drawing.XDrawPage;
-import com.sun.star.drawing.XDrawPages;
-import com.sun.star.drawing.XDrawPagesSupplier;
-import com.sun.star.drawing.XMasterPageTarget;
-import com.sun.star.drawing.XMasterPagesSupplier;
-
-import com.sun.star.presentation.XPresentationPage;
-import com.sun.star.presentation.XHandoutMasterSupplier;
-
-
-public class PageHelper
-{
- // __________ static helper methods __________
-
- // __________ draw pages __________
-
- /** get the page count for standard pages
- */
- static public int getDrawPageCount( XComponent xComponent )
- {
- XDrawPagesSupplier xDrawPagesSupplier =
- (XDrawPagesSupplier)UnoRuntime.queryInterface(
- XDrawPagesSupplier.class, xComponent );
- XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages();
- return xDrawPages.getCount();
- }
-
- /** get draw page by index
- */
- static public XDrawPage getDrawPageByIndex( XComponent xComponent, int nIndex )
- throws com.sun.star.lang.IndexOutOfBoundsException,
- com.sun.star.lang.WrappedTargetException
- {
- XDrawPagesSupplier xDrawPagesSupplier =
- (XDrawPagesSupplier)UnoRuntime.queryInterface(
- XDrawPagesSupplier.class, xComponent );
- XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages();
- return (XDrawPage)UnoRuntime.queryInterface(XDrawPage.class, xDrawPages.getByIndex( nIndex ));
- }
-
- /** creates and inserts a draw page into the giving position,
- the method returns the new created page
- */
- static public XDrawPage insertNewDrawPageByIndex( XComponent xComponent, int nIndex )
- throws Exception
- {
- XDrawPagesSupplier xDrawPagesSupplier =
- (XDrawPagesSupplier)UnoRuntime.queryInterface(
- XDrawPagesSupplier.class, xComponent );
- XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages();
- return xDrawPages.insertNewByIndex( nIndex );
- }
-
- /** removes the given page
- */
- static public void removeDrawPage( XComponent xComponent, XDrawPage xDrawPage )
- {
- XDrawPagesSupplier xDrawPagesSupplier =
- (XDrawPagesSupplier)UnoRuntime.queryInterface(
- XDrawPagesSupplier.class, xComponent );
- XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages();
- xDrawPages.remove( xDrawPage );
- }
-
- /** get size of the given page
- */
- static public Size getPageSize( XDrawPage xDrawPage )
- throws com.sun.star.beans.UnknownPropertyException,
- com.sun.star.lang.WrappedTargetException
- {
- XPropertySet xPageProperties = (XPropertySet)
- UnoRuntime.queryInterface( XPropertySet.class, xDrawPage );
- return new Size(
- ((Integer)xPageProperties.getPropertyValue( "Width" )).intValue(),
- ((Integer)xPageProperties.getPropertyValue( "Height" )).intValue() );
- }
-
- // __________ master pages __________
-
- /** get the page count for master pages
- */
- static public int getMasterPageCount( XComponent xComponent )
- {
- XMasterPagesSupplier xMasterPagesSupplier =
- (XMasterPagesSupplier)UnoRuntime.queryInterface(
- XMasterPagesSupplier.class, xComponent );
- XDrawPages xDrawPages = xMasterPagesSupplier.getMasterPages();
- return xDrawPages.getCount();
- }
-
- /** get master page by index
- */
- static public XDrawPage getMasterPageByIndex( XComponent xComponent, int nIndex )
- throws com.sun.star.lang.IndexOutOfBoundsException,
- com.sun.star.lang.WrappedTargetException
- {
- XMasterPagesSupplier xMasterPagesSupplier =
- (XMasterPagesSupplier)UnoRuntime.queryInterface(
- XMasterPagesSupplier.class, xComponent );
- XDrawPages xDrawPages = xMasterPagesSupplier.getMasterPages();
- return (XDrawPage)UnoRuntime.queryInterface(XDrawPage.class, xDrawPages.getByIndex( nIndex ));
- }
-
- /** creates and inserts a new master page into the giving position,
- the method returns the new created page
- */
- static public XDrawPage insertNewMasterPageByIndex( XComponent xComponent, int nIndex )
- {
- XMasterPagesSupplier xMasterPagesSupplier =
- (XMasterPagesSupplier)UnoRuntime.queryInterface(
- XMasterPagesSupplier.class, xComponent );
- XDrawPages xDrawPages = xMasterPagesSupplier.getMasterPages();
- return xDrawPages.insertNewByIndex( nIndex );
- }
-
- /** removes the given page
- */
- static public void removeMasterPage( XComponent xComponent, XDrawPage xDrawPage )
- {
- XMasterPagesSupplier xMasterPagesSupplier =
- (XMasterPagesSupplier)UnoRuntime.queryInterface(
- XMasterPagesSupplier.class, xComponent );
- XDrawPages xDrawPages = xMasterPagesSupplier.getMasterPages();
- xDrawPages.remove( xDrawPage );
- }
-
- /** return the corresponding masterpage for the giving drawpage
- */
- static public XDrawPage getMasterPage( XDrawPage xDrawPage )
- {
- XMasterPageTarget xMasterPageTarget =
- (XMasterPageTarget)UnoRuntime.queryInterface(
- XMasterPageTarget.class, xDrawPage );
- return xMasterPageTarget.getMasterPage();
- }
-
- /** sets given masterpage at the drawpage
- */
- static public void setMasterPage( XDrawPage xDrawPage, XDrawPage xMasterPage )
- {
- XMasterPageTarget xMasterPageTarget =
- (XMasterPageTarget)UnoRuntime.queryInterface(
- XMasterPageTarget.class, xDrawPage );
- xMasterPageTarget.setMasterPage( xMasterPage );
- }
-
- // __________ presentation pages __________
-
- /** 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 );
- return xInfo.supportsService( "com.sun.star.presentation.PresentationDocument" );
- }
-
- /** in impress documents each normal draw page has a corresponding notes page
- */
- static public XDrawPage getNotesPage( XDrawPage xDrawPage )
- {
- XPresentationPage aPresentationPage =
- (XPresentationPage)UnoRuntime.queryInterface(
- XPresentationPage.class, xDrawPage );
- return aPresentationPage.getNotesPage();
- }
-
- /** in impress each documents has one handout page
- */
- static public XDrawPage getHandoutMasterPage( XComponent xComponent )
- {
- 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
deleted file mode 100644
index 6a411336..00000000
--- a/odk/examples/DevelopersGuide/Drawing/PresentationDemo.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * 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 __________
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XServiceInfo;
-
-import com.sun.star.awt.Point;
-import com.sun.star.awt.Size;
-
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.XPropertySet;
-
-import com.sun.star.container.XNamed;
-
-import com.sun.star.drawing.XShape;
-import com.sun.star.drawing.XShapes;
-import com.sun.star.drawing.XDrawPage;
-
-import com.sun.star.presentation.XPresentation;
-import com.sun.star.presentation.XPresentationSupplier;
-
-
-
-// __________ Implementation __________
-
-/** presentation demo
- @author Sven Jacobi
- */
-
-// 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.
-
-
-public class PresentationDemo
-{
- public static void main( String args[] )
- {
- XComponent xDrawDoc = null;
- try
- {
- // 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
- PropertyValue[] pPropValues = new PropertyValue[ 1 ];
- pPropValues[ 0 ] = new PropertyValue();
- pPropValues[ 0 ].Name = "Silent";
- pPropValues[ 0 ].Value = new Boolean( true );
-
- xDrawDoc = Helper.createDocument( xOfficeContext,
- "private:factory/simpress", "_blank", 0, pPropValues );
-
-
- XDrawPage xPage;
- XShapes xShapes;
- XPropertySet xShapePropSet;
-
- // create pages, so that three are available
- while ( PageHelper.getDrawPageCount( xDrawDoc ) < 3 )
- PageHelper.insertNewDrawPageByIndex( xDrawDoc, 0 );
-
-
- // set the slide transition for the first page
- xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
- xShapes = (XShapes)
- UnoRuntime.queryInterface( XShapes.class, xPage );
- // set slide transition effect
- setSlideTransition( xPage,
- 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 ),
- "com.sun.star.drawing.RectangleShape" );
- xShapePropSet.setPropertyValue("Effect",
- com.sun.star.presentation.AnimationEffect.WAVYLINE_FROM_BOTTOM );
-
- /* the following three properties provokes that the shape is dimmed
- to red
- after the animation has been finished */
- xShapePropSet.setPropertyValue( "DimHide", new Boolean( false ) );
- xShapePropSet.setPropertyValue( "DimPrevious", new Boolean( true ) );
- xShapePropSet.setPropertyValue( "DimColor", new Integer( 0xff0000 ) );
-
-
- // set the slide transition for the second page
- xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 1 );
- xShapes = (XShapes)
- UnoRuntime.queryInterface( XShapes.class, xPage );
- setSlideTransition( xPage,
- com.sun.star.presentation.FadeEffect.FADE_FROM_RIGHT,
- com.sun.star.presentation.AnimationSpeed.SLOW,
- 1, 0 ); // automatic object and slide transition
-
- // create an ellipse that is placed on the bottom right of second page
- xShapePropSet = ShapeHelper.createAndInsertShape( xDrawDoc,
- xShapes, new Point( 21000, 15000 ), new Size( 5000, 5000 ),
- "com.sun.star.drawing.EllipseShape" );
- xShapePropSet.setPropertyValue(
- "Effect", com.sun.star.presentation.AnimationEffect.HIDE );
-
-
- // create two objects for the third page
- // clicking the first object lets the presentation jump
- // to page one by using ClickAction.FIRSTPAGE,
- // the second object lets the presentation jump to page two
- // by using a ClickAction.BOOKMARK;
- xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 2 );
- xShapes = (XShapes)
- UnoRuntime.queryInterface( XShapes.class, xPage );
- setSlideTransition( xPage,
- com.sun.star.presentation.FadeEffect.ROLL_FROM_LEFT,
- com.sun.star.presentation.AnimationSpeed.MEDIUM,
- 2, 0 );
- XShape xShape = ShapeHelper.createShape( xDrawDoc,
- new Point( 1000, 8000 ), new Size( 5000, 5000 ),
- "com.sun.star.drawing.EllipseShape" );
- xShapes.add( xShape );
- ShapeHelper.addPortion( xShape, "click to go", false );
- ShapeHelper.addPortion( xShape, "to first page", true );
- xShapePropSet = (XPropertySet)
- UnoRuntime.queryInterface( XPropertySet.class, xShape );
- xShapePropSet.setPropertyValue("Effect",
- com.sun.star.presentation.AnimationEffect.FADE_FROM_BOTTOM );
- xShapePropSet.setPropertyValue(
- "OnClick", com.sun.star.presentation.ClickAction.FIRSTPAGE );
-
-
- xShape = ShapeHelper.createShape( xDrawDoc,
- new Point( 22000, 8000 ), new Size( 5000, 5000 ),
- "com.sun.star.drawing.RectangleShape" );
- xShapes.add( xShape );
- ShapeHelper.addPortion( xShape, "click to go", false );
- ShapeHelper.addPortion( xShape, "to the second page", true );
- xShapePropSet = (XPropertySet)
- 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
- XNamed xPageName = (XNamed)UnoRuntime.queryInterface(
- XNamed.class, PageHelper.getDrawPageByIndex( xDrawDoc, 1 ) );
- xPageName.setName( "page two" );
- xShapePropSet.setPropertyValue(
- "Bookmark", xPageName.getName() );
-
-
- /* start an endless presentation which is displayed in
- full-screen mode and placed on top */
-
- XPresentationSupplier xPresSupplier = (XPresentationSupplier)
- UnoRuntime.queryInterface( XPresentationSupplier.class, xDrawDoc );
- XPresentation xPresentation = xPresSupplier.getPresentation();
- XPropertySet xPresPropSet = (XPropertySet)
- UnoRuntime.queryInterface( XPropertySet.class, xPresentation );
- xPresPropSet.setPropertyValue( "IsEndless", new Boolean( true ) );
- xPresPropSet.setPropertyValue( "IsAlwaysOnTop", new Boolean( true ) );
- xPresPropSet.setPropertyValue( "Pause", new Integer( 0 ) );
- xPresentation.start();
- }
- catch( Exception ex )
- {
- System.out.println( ex );
- }
- System.exit( 0 );
- }
-
- // this simple method applies the slide transition to a page
- public static void setSlideTransition( XDrawPage xPage,
- com.sun.star.presentation.FadeEffect eEffect,
- com.sun.star.presentation.AnimationSpeed eSpeed,
- int nChange,
- int nDuration )
- {
- // the following test is only sensible if you do not exactly know
- // 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 );
- if ( xInfo.supportsService( "com.sun.star.presentation.DrawPage" ) == true )
- {
- try
- {
- XPropertySet xPropSet = (XPropertySet)
- UnoRuntime.queryInterface( XPropertySet.class, xPage );
- xPropSet.setPropertyValue( "Effect", eEffect );
- xPropSet.setPropertyValue( "Speed", eSpeed );
- xPropSet.setPropertyValue( "Change", new Integer( nChange ) );
- xPropSet.setPropertyValue( "Duration", new Integer( nDuration ) );
- }
- catch( Exception ex )
- {
- }
- }
- }
-}
diff --git a/odk/examples/DevelopersGuide/Drawing/ShapeHelper.java b/odk/examples/DevelopersGuide/Drawing/ShapeHelper.java
deleted file mode 100644
index 72647f4f..00000000
--- a/odk/examples/DevelopersGuide/Drawing/ShapeHelper.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * 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 __________
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XMultiServiceFactory;
-
-import com.sun.star.awt.Point;
-import com.sun.star.awt.Size;
-
-import com.sun.star.beans.XPropertySet;
-
-import com.sun.star.container.XEnumeration;
-import com.sun.star.container.XEnumerationAccess;
-
-import com.sun.star.drawing.XShape;
-import com.sun.star.drawing.XShapes;
-
-import com.sun.star.text.ControlCharacter;
-import com.sun.star.text.XText;
-import com.sun.star.text.XTextCursor;
-import com.sun.star.text.XTextContent;
-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
- {
- XShape xShape = createShape( xDrawDoc, aPos, aSize, sShapeType );
- xShapes.add( xShape );
- XPropertySet xPropSet = (XPropertySet)
- UnoRuntime.queryInterface( XPropertySet.class, xShape );
- return xPropSet;
- }
-
- /** create a Shape
- */
- public static XShape createShape( XComponent xDrawDoc,
- Point aPos, Size aSize, String sShapeType )
- throws java.lang.Exception
- {
- XShape xShape = null;
- XMultiServiceFactory xFactory =
- (XMultiServiceFactory )UnoRuntime.queryInterface(
- XMultiServiceFactory.class, xDrawDoc );
- Object xObj = xFactory.createInstance( sShapeType );
- xShape = (XShape)UnoRuntime.queryInterface(
- XShape.class, xObj );
- xShape.setPosition( aPos );
- xShape.setSize( aSize );
- return xShape;
- }
-
- /**
- add text to a shape. the return value is the PropertySet
- of the text range that has been added
- */
- public static XPropertySet addPortion( XShape xShape, String sText, boolean bNewParagraph )
- throws com.sun.star.lang.IllegalArgumentException
- {
- XText xText = (XText)
- UnoRuntime.queryInterface( XText.class, xShape );
-
- XTextCursor xTextCursor = xText.createTextCursor();
- xTextCursor.gotoEnd( false );
- if ( bNewParagraph == true )
- {
- xText.insertControlCharacter( xTextCursor, ControlCharacter.PARAGRAPH_BREAK, false );
- xTextCursor.gotoEnd( false );
- }
- XTextRange xTextRange = (XTextRange)
- UnoRuntime.queryInterface( XTextRange.class, xTextCursor );
- xTextRange.setString( sText );
- xTextCursor.gotoEnd( true );
- XPropertySet xPropSet = (XPropertySet)
- UnoRuntime.queryInterface( XPropertySet.class, xTextRange );
- return xPropSet;
- }
-
- public static void setPropertyForLastParagraph( XShape xText, String sPropName,
- Object aValue )
- throws com.sun.star.beans.UnknownPropertyException,
- com.sun.star.beans.PropertyVetoException,
- com.sun.star.lang.IllegalArgumentException,
- com.sun.star.lang.WrappedTargetException,
- com.sun.star.container.NoSuchElementException
- {
- XEnumerationAccess xEnumerationAccess = (XEnumerationAccess)
- UnoRuntime.queryInterface( XEnumerationAccess.class, xText );
- if ( xEnumerationAccess.hasElements() )
- {
- XEnumeration xEnumeration = xEnumerationAccess.createEnumeration();
- while( xEnumeration.hasMoreElements () )
- {
- Object xObj = xEnumeration.nextElement();
- if ( xEnumeration.hasMoreElements() == false )
- {
- XTextContent xTextContent = (XTextContent)UnoRuntime.queryInterface(
- XTextContent.class, xObj );
- XPropertySet xParaPropSet = (XPropertySet)
- UnoRuntime.queryInterface( XPropertySet.class, xTextContent );
- xParaPropSet.setPropertyValue( sPropName, aValue );
- }
- }
- }
- }
-}
diff --git a/odk/examples/DevelopersGuide/Drawing/SimplePresentation.odp b/odk/examples/DevelopersGuide/Drawing/SimplePresentation.odp
deleted file mode 100644
index 3f40f766..00000000
--- a/odk/examples/DevelopersGuide/Drawing/SimplePresentation.odp
+++ /dev/null
Binary files differ
diff --git a/odk/examples/DevelopersGuide/Drawing/StyleDemo.java b/odk/examples/DevelopersGuide/Drawing/StyleDemo.java
deleted file mode 100644
index c5a3ad39..00000000
--- a/odk/examples/DevelopersGuide/Drawing/StyleDemo.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * 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 __________
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.XComponent;
-
-import com.sun.star.awt.Point;
-import com.sun.star.awt.Size;
-
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.XPropertySet;
-import com.sun.star.beans.XPropertySetInfo;
-
-import com.sun.star.container.XNameAccess;
-
-import com.sun.star.drawing.XShape;
-import com.sun.star.drawing.XShapes;
-import com.sun.star.drawing.XDrawPage;
-import com.sun.star.drawing.XDrawPages;
-import com.sun.star.drawing.XDrawPagesSupplier;
-
-import com.sun.star.frame.XModel;
-
-
-
-// __________ Implementation __________
-
-/** StyleDemo
- @author Sven Jacobi
- */
-
-public class StyleDemo
-{
- public static void main( String args[] )
- {
- XComponent xComponent = null;
- try
- {
- // 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
- PropertyValue[] pPropValues = new PropertyValue[ 1 ];
- pPropValues[ 0 ] = new PropertyValue();
- pPropValues[ 0 ].Name = "Silent";
- pPropValues[ 0 ].Value = new Boolean( true );
-
- xComponent = Helper.createDocument( xOfficeContext,
- "private:factory/simpress", "_blank", 0, pPropValues );
-
-
-
-
- /* The first part of this demo will set each "CharColor" Property
- that is available within the styles of the document to red. It
- will also print each family and style name to the standard output */
- XModel xModel =
- (XModel)UnoRuntime.queryInterface(
- XModel.class, xComponent );
- com.sun.star.style.XStyleFamiliesSupplier xSFS =
- (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
- // "graphics" and the other one is the name of the Master page
- String[] Families = xFamilies.getElementNames();
- for ( int i = 0; i < Families.length; i++ )
- {
- // 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 =
- (com.sun.star.container.XNameAccess)
- UnoRuntime.queryInterface(
- com.sun.star.container.XNameAccess.class, aFamilyObj );
- String[] Styles = xStyles.getElementNames();
- for( int j = 0; j < Styles.length; j++ )
- {
- System.out.println( " " + Styles[ j ] );
- Object aStyleObj = xStyles.getByName( Styles[ j ] );
- com.sun.star.style.XStyle xStyle = (com.sun.star.style.XStyle)
- UnoRuntime.queryInterface(
- com.sun.star.style.XStyle.class, aStyleObj );
- // now we have the XStyle Interface and the CharColor for
- // all styles is exemplary be set to red.
- XPropertySet xStylePropSet = (XPropertySet)
- UnoRuntime.queryInterface( XPropertySet.class, xStyle );
- XPropertySetInfo xStylePropSetInfo =
- xStylePropSet.getPropertySetInfo();
- if ( xStylePropSetInfo.hasPropertyByName( "CharColor" ) )
- {
- xStylePropSet.setPropertyValue( "CharColor",
- new Integer( 0xff0000 ) );
- }
- }
- }
-
-
-
- /* now create a rectangle and apply the "title1" style of
- the "graphics" family */
-
- Object obj = xFamilies.getByName( "graphics" );
- com.sun.star.container.XNameAccess xStyles = (XNameAccess)
- UnoRuntime.queryInterface(com.sun.star.container.XNameAccess.class,
- obj );
- obj = xStyles.getByName( "title1" );
- com.sun.star.style.XStyle xTitle1Style = (com.sun.star.style.XStyle)
- UnoRuntime.queryInterface( com.sun.star.style.XStyle.class, obj );
-
- XDrawPagesSupplier xDrawPagesSupplier =
- (XDrawPagesSupplier)UnoRuntime.queryInterface(
- XDrawPagesSupplier.class, xComponent );
- XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages();
- XDrawPage xDrawPage = (XDrawPage)UnoRuntime.queryInterface(
- XDrawPage.class, xDrawPages.getByIndex( 0 ));
- XShapes xShapes = (XShapes)UnoRuntime.queryInterface(XShapes.class,
- xDrawPage );
- XShape xShape = ShapeHelper.createShape( xComponent, new Point( 0, 0 ),
- new Size( 5000, 5000 ), "com.sun.star.drawing.RectangleShape" );
- xShapes.add( xShape );
- XPropertySet xPropSet = (XPropertySet)
- UnoRuntime.queryInterface( XPropertySet.class, xShape );
- xPropSet.setPropertyValue( "Style", xTitle1Style );
-
- }
- catch( Exception ex )
- {
- System.out.println( ex );
- }
- System.exit( 0 );
- }
-}
diff --git a/odk/examples/DevelopersGuide/Drawing/TextDemo.java b/odk/examples/DevelopersGuide/Drawing/TextDemo.java
deleted file mode 100644
index cbc87a34..00000000
--- a/odk/examples/DevelopersGuide/Drawing/TextDemo.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*************************************************************************
- *
- * 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.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * 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 __________
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.lang.XComponent;
-
-import com.sun.star.awt.Point;
-import com.sun.star.awt.Size;
-
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.beans.XPropertySet;
-
-import com.sun.star.drawing.XShape;
-import com.sun.star.drawing.XShapes;
-import com.sun.star.drawing.XDrawPage;
-import com.sun.star.drawing.TextFitToSizeType;
-
-import com.sun.star.style.LineSpacing;
-import com.sun.star.style.LineSpacingMode;
-import com.sun.star.style.ParagraphAdjust;
-
-
-
-// __________ Implementation __________
-
-/** text demo
- @author Sven Jacobi
- */
-
-public class TextDemo
-{
- public static void main( String args[] )
- {
- XComponent xDrawDoc = null;
- try
- {
- // 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
- PropertyValue[] pPropValues = new PropertyValue[ 1 ];
- pPropValues[ 0 ] = new PropertyValue();
- pPropValues[ 0 ].Name = "Silent";
- pPropValues[ 0 ].Value = new Boolean( true );
-
- xDrawDoc = Helper.createDocument( xOfficeContext,
- "private:factory/sdraw", "_blank", 0, pPropValues );
-
- XDrawPage xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
- XShapes xShapes = (XShapes)
- UnoRuntime.queryInterface( XShapes.class, xPage );
-
-
- XShape xRectangle;
- XPropertySet xTextPropSet, xShapePropSet;
- LineSpacing aLineSpacing = new LineSpacing();
- aLineSpacing.Mode = LineSpacingMode.PROP;
-
-
-
- // first shape
- xRectangle = ShapeHelper.createShape( xDrawDoc,
- new Point( 0, 0 ),
- new Size( 15000, 7500 ),
- "com.sun.star.drawing.RectangleShape" );
- xShapes.add( xRectangle );
- xShapePropSet = (XPropertySet)
- UnoRuntime.queryInterface( XPropertySet.class, xRectangle );
-
-
- // first paragraph
- xTextPropSet = ShapeHelper.addPortion( xRectangle, "Portion1", false );
- xTextPropSet.setPropertyValue( "CharColor", new Integer( 0xff0000 ) );
- xTextPropSet = ShapeHelper.addPortion( xRectangle, "Portion2", false );
- xTextPropSet.setPropertyValue( "CharColor", new Integer( 0x8080ff ) );
- aLineSpacing.Height = 100;
- ShapeHelper.setPropertyForLastParagraph( xRectangle, "ParaLineSpacing",
- aLineSpacing );
-
- // second paragraph
- xTextPropSet = ShapeHelper.addPortion( xRectangle, "Portion3", true );
- xTextPropSet.setPropertyValue( "CharColor", new Integer( 0xff ) );
- aLineSpacing.Height = 200;
- ShapeHelper.setPropertyForLastParagraph( xRectangle, "ParaLineSpacing",
- aLineSpacing );
-
-
-
- // second shape
- xRectangle = ShapeHelper.createShape( xDrawDoc,
- new Point( 0, 10000 ),
- new Size( 21000, 12500 ),
- "com.sun.star.drawing.RectangleShape" );
- xShapes.add( xRectangle );
- xShapePropSet = (XPropertySet)
- UnoRuntime.queryInterface( XPropertySet.class, xRectangle );
- xShapePropSet.setPropertyValue( "TextFitToSize",
- TextFitToSizeType.PROPORTIONAL );
- xShapePropSet.setPropertyValue( "TextLeftDistance", new Integer(2500));
- xShapePropSet.setPropertyValue( "TextRightDistance", new Integer(2500));
- xShapePropSet.setPropertyValue( "TextUpperDistance", new Integer(2500));
- xShapePropSet.setPropertyValue( "TextLowerDistance", new Integer(2500));
- xTextPropSet = ShapeHelper.addPortion( xRectangle,
- "using TextFitToSize", false );
- xTextPropSet.setPropertyValue( "ParaAdjust", ParagraphAdjust.CENTER );
- xTextPropSet.setPropertyValue( "CharColor", new Integer(0xff00));
- xTextPropSet = ShapeHelper.addPortion(xRectangle,
- "and a Border distance of 2,5 cm",
- true );
- xTextPropSet.setPropertyValue( "CharColor", new Integer( 0xff0000 ) );
-
- }
- catch( Exception ex )
- {
- System.out.println( ex );
- }
- System.exit( 0 );
- }
-}
diff --git a/odk/examples/DevelopersGuide/Drawing/makefile.mk b/odk/examples/DevelopersGuide/Drawing/makefile.mk
deleted file mode 100644
index 50c892f6..00000000
--- a/odk/examples/DevelopersGuide/Drawing/makefile.mk
+++ /dev/null
@@ -1,81 +0,0 @@
-#*************************************************************************
-#
-# 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>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..
-PRJNAME=odk
-TARGET=copying
-
-#----------------------------------------------------------------
-.INCLUDE: settings.mk
-.INCLUDE: $(PRJ)$/util$/makefile.pmk
-#----------------------------------------------------------------
-
-#----------------------------------------------------
-# this makefile is only used for copying the example
-# files into the SDK
-#----------------------------------------------------
-
-DRAWING_FILES=\
- $(DESTDIRDEVGUIDEEXAMPLES)$/Drawing$/ChangeOrderDemo.java \
- $(DESTDIRDEVGUIDEEXAMPLES)$/Drawing$/ControlAndSelectDemo.java \
- $(DESTDIRDEVGUIDEEXAMPLES)$/Drawing$/CustomShowDemo.java \
- $(DESTDIRDEVGUIDEEXAMPLES)$/Drawing$/DrawingDemo.java \
- $(DESTDIRDEVGUIDEEXAMPLES)$/Drawing$/DrawViewDemo.java \
- $(DESTDIRDEVGUIDEEXAMPLES)$/Drawing$/FillAndLineStyleDemo.java \
- $(DESTDIRDEVGUIDEEXAMPLES)$/Drawing$/GluePointDemo.java \
- $(DESTDIRDEVGUIDEEXAMPLES)$/Drawing$/GraphicExportDemo.java \
- $(DESTDIRDEVGUIDEEXAMPLES)$/Drawing$/Helper.java \
- $(DESTDIRDEVGUIDEEXAMPLES)$/Drawing$/LayerDemo.java \
- $(DESTDIRDEVGUIDEEXAMPLES)$/Drawing$/Makefile \
- $(DESTDIRDEVGUIDEEXAMPLES)$/Drawing$/ObjectTransformationDemo.java \
- $(DESTDIRDEVGUIDEEXAMPLES)$/Drawing$/Organigram.java \
- $(DESTDIRDEVGUIDEEXAMPLES)$/Drawing$/PageHelper.java \
- $(DESTDIRDEVGUIDEEXAMPLES)$/Drawing$/PresentationDemo.java \
- $(DESTDIRDEVGUIDEEXAMPLES)$/Drawing$/ShapeHelper.java \
- $(DESTDIRDEVGUIDEEXAMPLES)$/Drawing$/SimplePresentation.odp \
- $(DESTDIRDEVGUIDEEXAMPLES)$/Drawing$/StyleDemo.java \
- $(DESTDIRDEVGUIDEEXAMPLES)$/Drawing$/TextDemo.java
-
-DIR_FILE_LIST= \
- $(DRAWING_FILES) \
-
-DIR_DIRECTORY_LIST=$(uniq $(DIR_FILE_LIST:d))
-DIR_CREATE_FLAG=$(MISC)$/devguide_drawing_dirs_created.txt
-DIR_FILE_FLAG=$(MISC)$/devguide_drawing.txt
-
-#--------------------------------------------------
-# TARGETS
-#--------------------------------------------------
-all : \
- $(DIR_FILE_LIST) \
- $(DIR_FILE_FLAG)
-
-#--------------------------------------------------
-# use global rules
-#--------------------------------------------------
-.INCLUDE: $(PRJ)$/util$/odk_rules.pmk
-