1*a1b4a26bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*a1b4a26bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*a1b4a26bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*a1b4a26bSAndrew Rist  * distributed with this work for additional information
6*a1b4a26bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*a1b4a26bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*a1b4a26bSAndrew Rist  * "License"); you may not use this file except in compliance
9*a1b4a26bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*a1b4a26bSAndrew Rist  *
11*a1b4a26bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*a1b4a26bSAndrew Rist  *
13*a1b4a26bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*a1b4a26bSAndrew Rist  * software distributed under the License is distributed on an
15*a1b4a26bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*a1b4a26bSAndrew Rist  * KIND, either express or implied.  See the License for the
17*a1b4a26bSAndrew Rist  * specific language governing permissions and limitations
18*a1b4a26bSAndrew Rist  * under the License.
19*a1b4a26bSAndrew Rist  *
20*a1b4a26bSAndrew Rist  *************************************************************/
21*a1b4a26bSAndrew Rist 
22*a1b4a26bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir /*
25cdf0e10cSrcweir  * Created on 31.10.2003
26cdf0e10cSrcweir  *
27cdf0e10cSrcweir  * To change the template for this generated file go to
28cdf0e10cSrcweir  * Window>Preferences>Java>Code Generation>Code and Comments
29cdf0e10cSrcweir  */
30cdf0e10cSrcweir package com.sun.star.wizards.web.export;
31cdf0e10cSrcweir 
32cdf0e10cSrcweir import java.util.Iterator;
33cdf0e10cSrcweir 
34cdf0e10cSrcweir import com.sun.star.wizards.web.data.CGArgument;
35cdf0e10cSrcweir import com.sun.star.wizards.web.data.CGExporter;
36cdf0e10cSrcweir 
37cdf0e10cSrcweir /**
38cdf0e10cSrcweir  * @author rpiterman
39cdf0e10cSrcweir  *
40cdf0e10cSrcweir  * To change the template for this generated type comment go to
41cdf0e10cSrcweir  * Window>Preferences>Java>Code Generation>Code and Comments
42cdf0e10cSrcweir  */
43cdf0e10cSrcweir public class ConfiguredExporter extends FilterExporter
44cdf0e10cSrcweir {
45cdf0e10cSrcweir 
46cdf0e10cSrcweir     /* (non-Javadoc)
47cdf0e10cSrcweir      * @see com.sun.star.wizards.web.export.Exporter#init(com.sun.star.wizards.web.data.CGExporter)
48cdf0e10cSrcweir      */
init(CGExporter exporter)49cdf0e10cSrcweir     public void init(CGExporter exporter)
50cdf0e10cSrcweir     {
51cdf0e10cSrcweir         super.init(exporter);
52cdf0e10cSrcweir         for (Iterator i = exporter.cp_Arguments.keys().iterator(); i.hasNext();)
53cdf0e10cSrcweir         {
54cdf0e10cSrcweir             Object key = i.next();
55cdf0e10cSrcweir             if (!key.equals("Filter"))
56cdf0e10cSrcweir             {
57cdf0e10cSrcweir                 Object value = exporter.cp_Arguments.getElement(key);
58cdf0e10cSrcweir                 props.put(key, cast(((CGArgument) value).cp_Value));
59cdf0e10cSrcweir             }
60cdf0e10cSrcweir         }
61cdf0e10cSrcweir     }
62cdf0e10cSrcweir 
cast(String s)63cdf0e10cSrcweir     private Object cast(String s)
64cdf0e10cSrcweir     {
65cdf0e10cSrcweir         String s1 = s.substring(1);
66cdf0e10cSrcweir         char c = s.charAt(0);
67cdf0e10cSrcweir         switch (c)
68cdf0e10cSrcweir         {
69cdf0e10cSrcweir             case '$':
70cdf0e10cSrcweir                 return s1;
71cdf0e10cSrcweir             case '%':
72cdf0e10cSrcweir                 return Integer.valueOf(s1);
73cdf0e10cSrcweir             case '#':
74cdf0e10cSrcweir                 return Short.valueOf(s1);
75cdf0e10cSrcweir             case '&':
76cdf0e10cSrcweir                 return Double.valueOf(s1);
77cdf0e10cSrcweir             case 'f':
78cdf0e10cSrcweir                 if (s.equals("false"))
79cdf0e10cSrcweir                 {
80cdf0e10cSrcweir                     return Boolean.FALSE;
81cdf0e10cSrcweir                 }
82cdf0e10cSrcweir                 break;
83cdf0e10cSrcweir             case 't':
84cdf0e10cSrcweir                 if (s.equals("true"))
85cdf0e10cSrcweir                 {
86cdf0e10cSrcweir                     return Boolean.TRUE;
87cdf0e10cSrcweir                 }
88cdf0e10cSrcweir                 break;
89cdf0e10cSrcweir         }
90cdf0e10cSrcweir         return null;
91cdf0e10cSrcweir     }
92cdf0e10cSrcweir }
93cdf0e10cSrcweir 
94