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 import com.sun.star.uno.*; 24 25 /** a helper "enumeration class" for classifying a document type 26 */ 27 public class DocumentType extends com.sun.star.uno.Enum 28 { DocumentType( int value )29 private DocumentType( int value ) 30 { 31 super( value ); 32 } 33 getDefault()34 public static DocumentType getDefault() 35 { 36 return WRITER; 37 } 38 39 public static final DocumentType WRITER = new DocumentType(0); 40 public static final DocumentType CALC = new DocumentType(1); 41 public static final DocumentType DRAWING = new DocumentType(2); 42 public static final DocumentType UNKNOWN = new DocumentType(-1); 43 fromInt(int value)44 public static DocumentType fromInt(int value) 45 { 46 switch(value) 47 { 48 case 0: return WRITER; 49 case 1: return CALC; 50 case 2: return DRAWING; 51 default: return UNKNOWN; 52 } 53 } 54 }; 55 56