1*ed2f6d3bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ed2f6d3bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ed2f6d3bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ed2f6d3bSAndrew Rist  * distributed with this work for additional information
6*ed2f6d3bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ed2f6d3bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ed2f6d3bSAndrew Rist  * "License"); you may not use this file except in compliance
9*ed2f6d3bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ed2f6d3bSAndrew Rist  *
11*ed2f6d3bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ed2f6d3bSAndrew Rist  *
13*ed2f6d3bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ed2f6d3bSAndrew Rist  * software distributed under the License is distributed on an
15*ed2f6d3bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ed2f6d3bSAndrew Rist  * KIND, either express or implied.  See the License for the
17*ed2f6d3bSAndrew Rist  * specific language governing permissions and limitations
18*ed2f6d3bSAndrew Rist  * under the License.
19*ed2f6d3bSAndrew Rist  *
20*ed2f6d3bSAndrew Rist  *************************************************************/
21*ed2f6d3bSAndrew Rist 
22*ed2f6d3bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef FILEEXTENSIONS_HXX_INCLUDED
25cdf0e10cSrcweir #define FILEEXTENSIONS_HXX_INCLUDED
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "internal/global.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <string>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir // A simple table with information about the currently used OO file extensions
32cdf0e10cSrcweir // for instance ".sxw" and information about windows registry keys which are
33cdf0e10cSrcweir // necessary for properly registering of the shell extensions
34cdf0e10cSrcweir 
35cdf0e10cSrcweir /** A FileExtensionEntry consists of the extension as ansi and as
36cdf0e10cSrcweir 	unicode string and of the currently used registry forward key
37cdf0e10cSrcweir 	for this extension
38cdf0e10cSrcweir */
39cdf0e10cSrcweir struct FileExtensionEntry
40cdf0e10cSrcweir {
41cdf0e10cSrcweir 	char*    ExtensionAnsi;			// e.g. ".sxw"
42cdf0e10cSrcweir 	wchar_t* ExtensionUnicode;		// e.g. L".sxw"
43cdf0e10cSrcweir 	char*    RegistryForwardKey;	// e.g. "soffice.StarWriterDocument.6"
44cdf0e10cSrcweir };
45cdf0e10cSrcweir 
46cdf0e10cSrcweir extern FileExtensionEntry OOFileExtensionTable[];
47cdf0e10cSrcweir 
48cdf0e10cSrcweir extern size_t OOFileExtensionTableSize;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir //---------------------------------
51cdf0e10cSrcweir /** Return the extension of a file
52cdf0e10cSrcweir 	name without the '.'
53cdf0e10cSrcweir */
54cdf0e10cSrcweir std::string get_file_name_extension(const std::string& file_name);
55cdf0e10cSrcweir 
56cdf0e10cSrcweir //---------------------------------
57cdf0e10cSrcweir /** Return the type of a file
58cdf0e10cSrcweir */
59cdf0e10cSrcweir 
60cdf0e10cSrcweir enum File_Type_t { UNKNOWN, WRITER, CALC, DRAW, IMPRESS, MATH, WEB, DATABASE };
61cdf0e10cSrcweir 
62cdf0e10cSrcweir File_Type_t get_file_type(const std::string& file_name);
63cdf0e10cSrcweir 
64cdf0e10cSrcweir #endif
65