summaryrefslogtreecommitdiff
path: root/odk/examples/DevelopersGuide/Drawing/StyleDemo.java
diff options
context:
space:
mode:
Diffstat (limited to 'odk/examples/DevelopersGuide/Drawing/StyleDemo.java')
-rw-r--r--odk/examples/DevelopersGuide/Drawing/StyleDemo.java35
1 files changed, 13 insertions, 22 deletions
diff --git a/odk/examples/DevelopersGuide/Drawing/StyleDemo.java b/odk/examples/DevelopersGuide/Drawing/StyleDemo.java
index 6196ad1d0727..2fe07f62efbf 100644
--- a/odk/examples/DevelopersGuide/Drawing/StyleDemo.java
+++ b/odk/examples/DevelopersGuide/Drawing/StyleDemo.java
@@ -89,12 +89,11 @@ public class StyleDemo
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 );
+ 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.style.XStyleFamiliesSupplier.class, xModel );
com.sun.star.container.XNameAccess xFamilies = xSFS.getStyleFamilies();
@@ -109,21 +108,18 @@ public class StyleDemo
// 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 );
+ 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 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 );
+ XPropertySet xStylePropSet = UnoRuntime.queryInterface( XPropertySet.class, xStyle );
XPropertySetInfo xStylePropSetInfo =
xStylePropSet.getPropertySetInfo();
if ( xStylePropSetInfo.hasPropertyByName( "CharColor" ) )
@@ -140,26 +136,21 @@ public class StyleDemo
the "graphics" family */
Object obj = xFamilies.getByName( "graphics" );
- com.sun.star.container.XNameAccess xStyles = (XNameAccess)
- UnoRuntime.queryInterface(com.sun.star.container.XNameAccess.class,
- obj );
+ com.sun.star.container.XNameAccess xStyles = 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 );
+ com.sun.star.style.XStyle xTitle1Style = UnoRuntime.queryInterface( com.sun.star.style.XStyle.class, obj );
- XDrawPagesSupplier xDrawPagesSupplier =
- (XDrawPagesSupplier)UnoRuntime.queryInterface(
- XDrawPagesSupplier.class, xComponent );
+ XDrawPagesSupplier xDrawPagesSupplier = UnoRuntime.queryInterface( XDrawPagesSupplier.class, xComponent );
XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages();
- XDrawPage xDrawPage = (XDrawPage)UnoRuntime.queryInterface(
+ XDrawPage xDrawPage = UnoRuntime.queryInterface(
XDrawPage.class, xDrawPages.getByIndex( 0 ));
- XShapes xShapes = (XShapes)UnoRuntime.queryInterface(XShapes.class,
+ 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 );
+ XPropertySet xPropSet = UnoRuntime.queryInterface( XPropertySet.class, xShape );
xPropSet.setPropertyValue( "Style", xTitle1Style );
}