INTEGRATION: CWS sdksample (1.4.40); FILE MERGED
2004/06/16 08:49:17 jsc 1.4.40.2: #i29308# explicit imports 2004/06/10 10:05:55 jsc 1.4.40.1: #i29308# use of new UNO bootstrap feature
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: TextDemo.java,v $
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
* $Revision: 1.5 $
|
||||
*
|
||||
* last change: $Author: hr $ $Date: 2004-02-02 19:57:37 $
|
||||
* last change: $Author: rt $ $Date: 2005-01-31 16:25:38 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* the BSD license.
|
||||
@@ -40,29 +40,24 @@
|
||||
|
||||
// __________ 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.drawing.XShape;
|
||||
import com.sun.star.drawing.XShapes;
|
||||
import com.sun.star.drawing.XDrawPage;
|
||||
import com.sun.star.drawing.TextFitToSizeType;
|
||||
|
||||
// application specific classes
|
||||
import com.sun.star.drawing.*;
|
||||
import com.sun.star.style.LineSpacing;
|
||||
import com.sun.star.style.LineSpacingMode;
|
||||
import com.sun.star.style.ParagraphAdjust;
|
||||
|
||||
// presentation specific classes
|
||||
import com.sun.star.presentation.*;
|
||||
|
||||
// Point, Size, ..
|
||||
import com.sun.star.awt.*;
|
||||
import java.io.File;
|
||||
|
||||
|
||||
// __________ Implementation __________
|
||||
@@ -78,22 +73,19 @@ public class TextDemo
|
||||
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 );
|
||||
|
||||
XDrawPage xPage = PageHelper.getDrawPageByIndex( xDrawDoc, 0 );
|
||||
@@ -124,13 +116,15 @@ public class TextDemo
|
||||
xTextPropSet = ShapeHelper.addPortion( xRectangle, "Portion2", false );
|
||||
xTextPropSet.setPropertyValue( "CharColor", new Integer( 0x8080ff ) );
|
||||
aLineSpacing.Height = 100;
|
||||
ShapeHelper.setPropertyForLastParagraph( xRectangle, "ParaLineSpacing", aLineSpacing );
|
||||
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 );
|
||||
ShapeHelper.setPropertyForLastParagraph( xRectangle, "ParaLineSpacing",
|
||||
aLineSpacing );
|
||||
|
||||
|
||||
|
||||
@@ -142,15 +136,19 @@ public class TextDemo
|
||||
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 );
|
||||
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(0xff00));
|
||||
xTextPropSet = ShapeHelper.addPortion(xRectangle,
|
||||
"and a Border distance of 2,5 cm",
|
||||
true );
|
||||
xTextPropSet.setPropertyValue( "CharColor", new Integer( 0xff0000 ) );
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user