( XMultiServiceFactory xMSF )
| 695 | } |
| 696 | |
| 697 | public String CreateTempFile( XMultiServiceFactory xMSF ) |
| 698 | { |
| 699 | String sResult = null; |
| 700 | |
| 701 | // try to get temporary file representation |
| 702 | XPropertySet xTempFileProps = null; |
| 703 | try |
| 704 | { |
| 705 | Object oTempFile = xMSF.createInstance( "com.sun.star.io.TempFile" ); |
| 706 | xTempFileProps = UnoRuntime.queryInterface( XPropertySet.class, oTempFile ); |
| 707 | } |
| 708 | catch( Exception e ) |
| 709 | {} |
| 710 | |
| 711 | if ( xTempFileProps != null ) |
| 712 | { |
| 713 | try |
| 714 | { |
| 715 | xTempFileProps.setPropertyValue( "RemoveFile", Boolean.FALSE ); |
| 716 | sResult = AnyConverter.toString( xTempFileProps.getPropertyValue( "Uri" ) ); |
| 717 | } |
| 718 | catch( Exception e ) |
| 719 | { |
| 720 | Error( "Can't control TempFile properties, exception: " + e ); |
| 721 | } |
| 722 | } |
| 723 | else |
| 724 | { |
| 725 | Error( "Can't create temporary file representation!" ); |
| 726 | } |
| 727 | |
| 728 | // close temporary file explicitly |
| 729 | try |
| 730 | { |
| 731 | XStream xStream = UnoRuntime.queryInterface( XStream.class, xTempFileProps ); |
| 732 | if ( xStream != null ) |
| 733 | { |
| 734 | XOutputStream xOut = xStream.getOutputStream(); |
| 735 | if ( xOut != null ) |
| 736 | xOut.closeOutput(); |
| 737 | |
| 738 | XInputStream xIn = xStream.getInputStream(); |
| 739 | if ( xIn != null ) |
| 740 | xIn.closeInput(); |
| 741 | } |
| 742 | else |
| 743 | Error( "Can't close TempFile!" ); |
| 744 | } |
| 745 | catch( Exception e ) |
| 746 | { |
| 747 | Error( "Can't close TempFile, exception: " + e ); |
| 748 | } |
| 749 | |
| 750 | return sResult; |
| 751 | } |
| 752 | |
| 753 | public boolean copyElementTo( XStorage xSource, String sName, XStorage xDest ) |
| 754 | { |
no test coverage detected