1a1b4a26bSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3a1b4a26bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4a1b4a26bSAndrew Rist * or more contributor license agreements. See the NOTICE file 5a1b4a26bSAndrew Rist * distributed with this work for additional information 6a1b4a26bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7a1b4a26bSAndrew Rist * to you under the Apache License, Version 2.0 (the 8a1b4a26bSAndrew Rist * "License"); you may not use this file except in compliance 9a1b4a26bSAndrew Rist * with the License. You may obtain a copy of the License at 10a1b4a26bSAndrew Rist * 11a1b4a26bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12a1b4a26bSAndrew Rist * 13a1b4a26bSAndrew Rist * Unless required by applicable law or agreed to in writing, 14a1b4a26bSAndrew Rist * software distributed under the License is distributed on an 15a1b4a26bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16a1b4a26bSAndrew Rist * KIND, either express or implied. See the License for the 17a1b4a26bSAndrew Rist * specific language governing permissions and limitations 18a1b4a26bSAndrew Rist * under the License. 19a1b4a26bSAndrew Rist * 20a1b4a26bSAndrew Rist *************************************************************/ 21a1b4a26bSAndrew Rist 22a1b4a26bSAndrew Rist 23cdf0e10cSrcweir package com.sun.star.wizards.web.export; 24cdf0e10cSrcweir 25cdf0e10cSrcweir import com.sun.star.io.IOException; 26cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory; 27cdf0e10cSrcweir import com.sun.star.wizards.common.PropertyNames; 28cdf0e10cSrcweir import com.sun.star.wizards.ui.event.Task; 29cdf0e10cSrcweir import com.sun.star.wizards.web.data.CGDocument; 30cdf0e10cSrcweir import com.sun.star.wizards.web.data.CGSession; 31cdf0e10cSrcweir 32cdf0e10cSrcweir /** 33cdf0e10cSrcweir * @author rpiterman 34cdf0e10cSrcweir * 35cdf0e10cSrcweir * To change the template for this generated type comment go to 36cdf0e10cSrcweir * Window>Preferences>Java>Code Generation>Code and Comments 37cdf0e10cSrcweir */ 38cdf0e10cSrcweir public class ImpressHTMLExporter extends ConfiguredExporter 39cdf0e10cSrcweir { 40cdf0e10cSrcweir 41cdf0e10cSrcweir private static final Integer SMALL_IMAGE = 512; 42cdf0e10cSrcweir private static final Integer MEDIUM_IMAGE = 640; 43cdf0e10cSrcweir private static final Integer LARGE_IMAGE = 800; 44cdf0e10cSrcweir export(CGDocument source, String targetDirectory, XMultiServiceFactory xmsf, Task task)45cdf0e10cSrcweir public boolean export(CGDocument source, String targetDirectory, XMultiServiceFactory xmsf, Task task) throws IOException 46cdf0e10cSrcweir { 47cdf0e10cSrcweir 48cdf0e10cSrcweir /* here set some filter specific properties. 49*86e1cf34SPedro Giffuni * other properties, which are not dependent on 50cdf0e10cSrcweir * user input are set through the exporter 51cdf0e10cSrcweir * configuration. 52cdf0e10cSrcweir */ 53cdf0e10cSrcweir 54cdf0e10cSrcweir CGSession session = getSession(source); 55cdf0e10cSrcweir 56cdf0e10cSrcweir props.put("Author", source.cp_Author); 57cdf0e10cSrcweir props.put("Email", session.cp_GeneralInfo.cp_Email); 58cdf0e10cSrcweir props.put("HomepageURL", getHomepageURL(session)); 59cdf0e10cSrcweir props.put("UserText", source.cp_Title); 60cdf0e10cSrcweir 61cdf0e10cSrcweir props.put(PropertyNames.PROPERTY_WIDTH, getImageWidth(session)); 62cdf0e10cSrcweir 63cdf0e10cSrcweir /* 64cdf0e10cSrcweir * props.put("BackColor",...); 65cdf0e10cSrcweir * props.put("TextColor",...); 66cdf0e10cSrcweir * props.put("LinkColor",...); 67cdf0e10cSrcweir * props.put("VLinkColor",...); 68cdf0e10cSrcweir * props.put("ALinkColor",...); 69cdf0e10cSrcweir */ 70cdf0e10cSrcweir props.put("UseButtonSet", new Integer(session.cp_Design.cp_IconSet)); 71cdf0e10cSrcweir 72cdf0e10cSrcweir 73cdf0e10cSrcweir //now export 74cdf0e10cSrcweir return super.export(source, targetDirectory, xmsf, task); 75cdf0e10cSrcweir 76cdf0e10cSrcweir } 77cdf0e10cSrcweir getHomepageURL(CGSession session)78cdf0e10cSrcweir private String getHomepageURL(CGSession session) 79cdf0e10cSrcweir { 80cdf0e10cSrcweir return "../" + 81cdf0e10cSrcweir (exporter.cp_OwnDirectory ? "../index.html" : "index.html"); 82cdf0e10cSrcweir } 83cdf0e10cSrcweir getImageWidth(CGSession session)84cdf0e10cSrcweir private Integer getImageWidth(CGSession session) 85cdf0e10cSrcweir { 86cdf0e10cSrcweir switch (session.cp_Design.cp_OptimizeDisplaySize) 87cdf0e10cSrcweir { 88cdf0e10cSrcweir case 0: 89cdf0e10cSrcweir return SMALL_IMAGE; 90cdf0e10cSrcweir case 1: 91cdf0e10cSrcweir return MEDIUM_IMAGE; 92cdf0e10cSrcweir case 2: 93cdf0e10cSrcweir return LARGE_IMAGE; 94cdf0e10cSrcweir } 95cdf0e10cSrcweir return MEDIUM_IMAGE; 96cdf0e10cSrcweir } 97cdf0e10cSrcweir getSession(CGDocument doc)98cdf0e10cSrcweir private CGSession getSession(CGDocument doc) 99cdf0e10cSrcweir { 100cdf0e10cSrcweir return doc.getSettings().cp_DefaultSession; 101cdf0e10cSrcweir } 102cdf0e10cSrcweir } 103