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 package org.openoffice.xmerge.converter.xml.sxc.minicalc;
25 
26 import org.openoffice.xmerge.ConverterCapabilities;
27 import org.openoffice.xmerge.converter.xml.OfficeConstants;
28 
29 
30 /**
31  *  <p>MiniCalc implementation of <code>ConverterCapabilities</code> for
32  *  the {@link
33  *  org.openoffice.xmerge.converter.xml.sxc.minicalc.PluginFactoryImpl
34  *  PluginFactoryImpl}.</p>
35  *
36  *  <p>Used with StarCalc SXC to/from MiniCalc conversions.  The
37  *  <code>ConverterCapibilies</code> specify which &quot;Office&quot;
38  *  <code>Document</code> tags and attributes are supported on the
39  *  &quot;Device&quot; <code>Document</code> format.</p>
40  */
41 public final class ConverterCapabilitiesImpl
42     implements ConverterCapabilities {
43 
canConvertTag(String tag)44     public boolean canConvertTag(String tag) {
45 
46         if (OfficeConstants.TAG_OFFICE_BODY.equals(tag))
47             return true;
48         else if (OfficeConstants.TAG_PARAGRAPH.equals(tag))
49             return true;
50         else if (OfficeConstants.TAG_TABLE.equals(tag))
51             return true;
52         else if (OfficeConstants.TAG_TABLE_ROW.equals(tag))
53             return true;
54         else if (OfficeConstants.TAG_TABLE_COLUMN.equals(tag))
55             return false;
56         // TODO - we currently do not handle the table column tag
57         else if (OfficeConstants.TAG_TABLE_SCENARIO.equals(tag))
58             return false;
59         // TODO - we currently do not handle the table scenario tag
60         else if (OfficeConstants.TAG_TABLE_CELL.equals(tag))
61             return true;
62 
63         return false;
64     }
65 
canConvertAttribute(String tag, String attribute)66     public boolean canConvertAttribute(String tag,
67                                        String attribute) {
68 
69         if (OfficeConstants.TAG_TABLE.equals(tag)) {
70 
71             if (OfficeConstants.ATTRIBUTE_TABLE_NAME.equals(attribute))
72                 return true;
73 
74         } else if (OfficeConstants.TAG_TABLE_CELL.equals(tag)) {
75 
76             if (OfficeConstants.ATTRIBUTE_TABLE_VALUE_TYPE.equals(attribute))
77                 return true;
78             else if (OfficeConstants.ATTRIBUTE_TABLE_FORMULA.
79                      equals(attribute))
80                 return true;
81             else if (OfficeConstants.ATTRIBUTE_TABLE_VALUE.equals(attribute))
82                 return true;
83             else if (OfficeConstants.ATTRIBUTE_TABLE_BOOLEAN_VALUE.
84                      equals(attribute))
85                 return true;
86             else if (OfficeConstants.ATTRIBUTE_TABLE_CURRENCY.
87                      equals(attribute))
88                 return true;
89             else if (OfficeConstants.ATTRIBUTE_TABLE_TIME_VALUE.
90                      equals(attribute))
91                 return true;
92             else if (OfficeConstants.ATTRIBUTE_TABLE_DATE_VALUE.
93                      equals(attribute))
94                 return true;
95             else if (OfficeConstants.ATTRIBUTE_TABLE_NUM_COLUMNS_REPEATED.
96                      equals(attribute))
97                 return true;
98 
99         } else if (OfficeConstants.TAG_TABLE_ROW.equals(tag)) {
100 
101             if (OfficeConstants.ATTRIBUTE_TABLE_NUM_ROWS_REPEATED.
102                 equals(attribute))
103                 return true;
104         }
105 
106         return false;
107     }
108 }
109 
110