1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 /* 24 * Created on 17.10.2003 25 * 26 * To change the template for this generated file go to 27 * Window>Preferences>Java>Code Generation>Code and Comments 28 */ 29 package com.sun.star.wizards.web.export; 30 31 import com.sun.star.lang.XMultiServiceFactory; 32 import com.sun.star.wizards.common.FileAccess; 33 import com.sun.star.wizards.ui.event.Task; 34 import com.sun.star.wizards.web.data.CGDocument; 35 36 /** 37 * @author rpiterman 38 * 39 * To change the template for this generated type comment go to 40 * Window>Preferences>Java>Code Generation>Code and Comments 41 */ 42 public class CopyExporter extends AbstractExporter 43 { 44 45 /* (non-Javadoc) 46 * @see com.sun.star.wizards.web.export.Exporter#export(java.lang.Object, java.io.File, com.sun.star.wizards.web.data.CGSettings, com.sun.star.lang.XMultiServiceFactory) 47 */ export(CGDocument source, String target, XMultiServiceFactory xmsf, Task task)48 public boolean export(CGDocument source, String target, XMultiServiceFactory xmsf, Task task) 49 { 50 try 51 { 52 task.advance(true); 53 54 55 /* 56 * this will open the document, and calculate the pages/slides number 57 * in it. 58 */ 59 if (exporter.cp_PageType > 0) 60 { 61 closeDocument(openDocument(source, xmsf), xmsf); 62 } 63 64 task.advance(true); 65 66 String newTarget = FileAccess.connectURLs( 67 FileAccess.getParentDir(target), source.urlFilename); 68 69 boolean b = getFileAccess(xmsf).copy(source.cp_URL, newTarget); 70 71 task.advance(true); 72 73 calcFileSize(source, newTarget, xmsf); 74 75 return b; 76 77 } 78 catch (Exception ex) 79 { 80 return false; 81 } 82 } 83 } 84