INTEGRATION: CWS sdksample (1.4.40); FILE MERGED

2004/06/16 08:49:16 jsc 1.4.40.2: #i29308# explicit imports
2004/06/10 10:05:54 jsc 1.4.40.1: #i29308# use of new UNO bootstrap feature
This commit is contained in:
Rüdiger Timm
2005-01-31 15:24:11 +00:00
parent 3f6949f3f0
commit 4d4e7e85d4
3 changed files with 105 additions and 128 deletions

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: LayerDemo.java,v $
*
* $Revision: 1.4 $
* $Revision: 1.5 $
*
* last change: $Author: hr $ $Date: 2004-02-02 19:55:22 $
* last change: $Author: rt $ $Date: 2005-01-31 16:23:20 $
*
* The Contents of this file are made available subject to the terms of
* the BSD license.
@@ -40,30 +40,25 @@
// __________ Imports __________
// base classes
import com.sun.star.uno.UnoRuntime;
import com.sun.star.lang.*;
import com.sun.star.lang.XComponent;
// property access
import com.sun.star.beans.*;
import com.sun.star.awt.Point;
import com.sun.star.awt.Size;
// name access
import com.sun.star.container.*;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
// text
import com.sun.star.text.*;
import com.sun.star.style.*;
import com.sun.star.container.XNameAccess;
import com.sun.star.style.ParagraphAdjust;
// application specific classes
import com.sun.star.drawing.*;
// presentation specific classes
import com.sun.star.presentation.*;
// Point, Size, ..
import com.sun.star.awt.*;
import java.io.File;
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 __________
@@ -79,22 +74,19 @@ public class LayerDemo
XComponent xDrawDoc = null;
try
{
String sConnection;
if ( args.length >= 1 )
sConnection = args[ 1 ];
else
sConnection = "uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager";
XMultiServiceFactory xServiceFactory =
Helper.connect( sConnection );
// 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
// 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( xServiceFactory,
xDrawDoc = Helper.createDocument( xOfficeContext,
"private:factory/sdraw", "_blank", 0, pPropValues );
@@ -113,10 +105,15 @@ public class LayerDemo
xShapes.add( xRect1 );
xShapes.add( xRect2 );
XPropertySet xTextProp = ShapeHelper.addPortion( xRect2, "this shape is locked", false );
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 );
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
@@ -130,7 +127,9 @@ public class LayerDemo
// create a layer and set its properties
XPropertySet xLayerPropSet;
XLayer xNotVisibleAndEditable = xLayerManager.insertNewByIndex( xLayerManager.getCount() );
XLayer xNotVisibleAndEditable = xLayerManager.insertNewByIndex(
xLayerManager.getCount() );
xLayerPropSet = (XPropertySet)
(XPropertySet)UnoRuntime.queryInterface(
XPropertySet.class, xNotVisibleAndEditable );
@@ -139,7 +138,9 @@ public class LayerDemo
xLayerPropSet.setPropertyValue( "IsLocked", new Boolean( true ) );
// create a second layer
XLayer xNotEditable = xLayerManager.insertNewByIndex( xLayerManager.getCount() );
XLayer xNotEditable = xLayerManager.insertNewByIndex(
xLayerManager.getCount() );
xLayerPropSet = (XPropertySet)
(XPropertySet)UnoRuntime.queryInterface(
XPropertySet.class, xNotEditable );