diff options
Diffstat (limited to 'odk/examples/DevelopersGuide/Drawing/PageHelper.java')
-rw-r--r-- | odk/examples/DevelopersGuide/Drawing/PageHelper.java | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/odk/examples/DevelopersGuide/Drawing/PageHelper.java b/odk/examples/DevelopersGuide/Drawing/PageHelper.java index c612afa4e61b..b6bb684453ed 100644 --- a/odk/examples/DevelopersGuide/Drawing/PageHelper.java +++ b/odk/examples/DevelopersGuide/Drawing/PageHelper.java @@ -63,8 +63,8 @@ public class PageHelper static public int getDrawPageCount( XComponent xComponent ) { XDrawPagesSupplier xDrawPagesSupplier = - (XDrawPagesSupplier)UnoRuntime.queryInterface( - XDrawPagesSupplier.class, xComponent ); + UnoRuntime.queryInterface( + XDrawPagesSupplier.class, xComponent ); XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages(); return xDrawPages.getCount(); } @@ -76,10 +76,10 @@ public class PageHelper com.sun.star.lang.WrappedTargetException { XDrawPagesSupplier xDrawPagesSupplier = - (XDrawPagesSupplier)UnoRuntime.queryInterface( - XDrawPagesSupplier.class, xComponent ); + UnoRuntime.queryInterface( + XDrawPagesSupplier.class, xComponent ); XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages(); - return (XDrawPage)UnoRuntime.queryInterface(XDrawPage.class, xDrawPages.getByIndex( nIndex )); + return UnoRuntime.queryInterface(XDrawPage.class, xDrawPages.getByIndex( nIndex )); } /** creates and inserts a draw page into the giving position, @@ -89,8 +89,8 @@ public class PageHelper throws Exception { XDrawPagesSupplier xDrawPagesSupplier = - (XDrawPagesSupplier)UnoRuntime.queryInterface( - XDrawPagesSupplier.class, xComponent ); + UnoRuntime.queryInterface( + XDrawPagesSupplier.class, xComponent ); XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages(); return xDrawPages.insertNewByIndex( nIndex ); } @@ -100,8 +100,8 @@ public class PageHelper static public void removeDrawPage( XComponent xComponent, XDrawPage xDrawPage ) { XDrawPagesSupplier xDrawPagesSupplier = - (XDrawPagesSupplier)UnoRuntime.queryInterface( - XDrawPagesSupplier.class, xComponent ); + UnoRuntime.queryInterface( + XDrawPagesSupplier.class, xComponent ); XDrawPages xDrawPages = xDrawPagesSupplier.getDrawPages(); xDrawPages.remove( xDrawPage ); } @@ -112,8 +112,7 @@ public class PageHelper throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException { - XPropertySet xPageProperties = (XPropertySet) - UnoRuntime.queryInterface( XPropertySet.class, xDrawPage ); + XPropertySet xPageProperties = UnoRuntime.queryInterface( XPropertySet.class, xDrawPage ); return new Size( ((Integer)xPageProperties.getPropertyValue( "Width" )).intValue(), ((Integer)xPageProperties.getPropertyValue( "Height" )).intValue() ); @@ -126,8 +125,8 @@ public class PageHelper static public int getMasterPageCount( XComponent xComponent ) { XMasterPagesSupplier xMasterPagesSupplier = - (XMasterPagesSupplier)UnoRuntime.queryInterface( - XMasterPagesSupplier.class, xComponent ); + UnoRuntime.queryInterface( + XMasterPagesSupplier.class, xComponent ); XDrawPages xDrawPages = xMasterPagesSupplier.getMasterPages(); return xDrawPages.getCount(); } @@ -139,10 +138,10 @@ public class PageHelper com.sun.star.lang.WrappedTargetException { XMasterPagesSupplier xMasterPagesSupplier = - (XMasterPagesSupplier)UnoRuntime.queryInterface( - XMasterPagesSupplier.class, xComponent ); + UnoRuntime.queryInterface( + XMasterPagesSupplier.class, xComponent ); XDrawPages xDrawPages = xMasterPagesSupplier.getMasterPages(); - return (XDrawPage)UnoRuntime.queryInterface(XDrawPage.class, xDrawPages.getByIndex( nIndex )); + return UnoRuntime.queryInterface(XDrawPage.class, xDrawPages.getByIndex( nIndex )); } /** creates and inserts a new master page into the giving position, @@ -151,8 +150,8 @@ public class PageHelper static public XDrawPage insertNewMasterPageByIndex( XComponent xComponent, int nIndex ) { XMasterPagesSupplier xMasterPagesSupplier = - (XMasterPagesSupplier)UnoRuntime.queryInterface( - XMasterPagesSupplier.class, xComponent ); + UnoRuntime.queryInterface( + XMasterPagesSupplier.class, xComponent ); XDrawPages xDrawPages = xMasterPagesSupplier.getMasterPages(); return xDrawPages.insertNewByIndex( nIndex ); } @@ -162,8 +161,8 @@ public class PageHelper static public void removeMasterPage( XComponent xComponent, XDrawPage xDrawPage ) { XMasterPagesSupplier xMasterPagesSupplier = - (XMasterPagesSupplier)UnoRuntime.queryInterface( - XMasterPagesSupplier.class, xComponent ); + UnoRuntime.queryInterface( + XMasterPagesSupplier.class, xComponent ); XDrawPages xDrawPages = xMasterPagesSupplier.getMasterPages(); xDrawPages.remove( xDrawPage ); } @@ -173,8 +172,8 @@ public class PageHelper static public XDrawPage getMasterPage( XDrawPage xDrawPage ) { XMasterPageTarget xMasterPageTarget = - (XMasterPageTarget)UnoRuntime.queryInterface( - XMasterPageTarget.class, xDrawPage ); + UnoRuntime.queryInterface( + XMasterPageTarget.class, xDrawPage ); return xMasterPageTarget.getMasterPage(); } @@ -183,8 +182,8 @@ public class PageHelper static public void setMasterPage( XDrawPage xDrawPage, XDrawPage xMasterPage ) { XMasterPageTarget xMasterPageTarget = - (XMasterPageTarget)UnoRuntime.queryInterface( - XMasterPageTarget.class, xDrawPage ); + UnoRuntime.queryInterface( + XMasterPageTarget.class, xDrawPage ); xMasterPageTarget.setMasterPage( xMasterPage ); } @@ -196,7 +195,7 @@ public class PageHelper */ static public boolean isImpressDocument( XComponent xComponent ) { - XServiceInfo xInfo = (XServiceInfo)UnoRuntime.queryInterface( + XServiceInfo xInfo = UnoRuntime.queryInterface( XServiceInfo.class, xComponent ); return xInfo.supportsService( "com.sun.star.presentation.PresentationDocument" ); } @@ -206,8 +205,8 @@ public class PageHelper static public XDrawPage getNotesPage( XDrawPage xDrawPage ) { XPresentationPage aPresentationPage = - (XPresentationPage)UnoRuntime.queryInterface( - XPresentationPage.class, xDrawPage ); + UnoRuntime.queryInterface( + XPresentationPage.class, xDrawPage ); return aPresentationPage.getNotesPage(); } @@ -216,8 +215,8 @@ public class PageHelper static public XDrawPage getHandoutMasterPage( XComponent xComponent ) { XHandoutMasterSupplier aHandoutMasterSupplier = - (XHandoutMasterSupplier)UnoRuntime.queryInterface( - XHandoutMasterSupplier.class, xComponent ); + UnoRuntime.queryInterface( + XHandoutMasterSupplier.class, xComponent ); return aHandoutMasterSupplier.getHandoutMasterPage(); } } |