tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / dbaccess / source / ui / inc / TypeInfo.hxx
blobe9958e8e8dda787f648d8135bbd4e203387630ea
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #pragma once
21 #include <rtl/ustring.hxx>
22 #include <com/sun/star/sdbc/DataType.hpp>
23 #include <com/sun/star/sdbc/ColumnSearch.hpp>
24 #include <map>
25 #include <memory>
27 namespace dbaui
29 // Based on these ids the language dependent OUString are fetched from the resource
30 const sal_uInt16 TYPE_UNKNOWN = 0;
31 const sal_uInt16 TYPE_TEXT = 1;
32 const sal_uInt16 TYPE_NUMERIC = 2;
33 const sal_uInt16 TYPE_DATETIME = 3;
34 const sal_uInt16 TYPE_DATE = 4;
35 const sal_uInt16 TYPE_TIME = 5;
36 const sal_uInt16 TYPE_BOOL = 6;
37 const sal_uInt16 TYPE_CURRENCY = 7;
38 const sal_uInt16 TYPE_MEMO = 8;
39 const sal_uInt16 TYPE_COUNTER = 9;
40 const sal_uInt16 TYPE_IMAGE = 10;
41 const sal_uInt16 TYPE_CHAR = 11;
42 const sal_uInt16 TYPE_DECIMAL = 12;
43 const sal_uInt16 TYPE_BINARY = 13;
44 const sal_uInt16 TYPE_VARBINARY = 14;
45 const sal_uInt16 TYPE_BIGINT = 15;
46 const sal_uInt16 TYPE_DOUBLE = 16;
47 const sal_uInt16 TYPE_FLOAT = 17;
48 const sal_uInt16 TYPE_REAL = 18;
49 const sal_uInt16 TYPE_INTEGER = 19;
50 const sal_uInt16 TYPE_SMALLINT = 20;
51 const sal_uInt16 TYPE_TINYINT = 21;
52 const sal_uInt16 TYPE_SQLNULL = 22;
53 const sal_uInt16 TYPE_OBJECT = 23;
54 const sal_uInt16 TYPE_DISTINCT = 24;
55 const sal_uInt16 TYPE_STRUCT = 25;
56 const sal_uInt16 TYPE_ARRAY = 26;
57 const sal_uInt16 TYPE_BLOB = 27;
58 const sal_uInt16 TYPE_CLOB = 28;
59 const sal_uInt16 TYPE_REF = 29;
60 const sal_uInt16 TYPE_OTHER = 30;
61 const sal_uInt16 TYPE_BIT = 31;
63 class OTypeInfo
65 public:
66 OUString aUIName; // the name which is the user see (a combination of resource text and aTypeName)
67 OUString aTypeName; // name of type in database
68 OUString aCreateParams; // parameter for creation
69 OUString aLocalTypeName;
71 sal_Int32 nPrecision; // length of type
72 sal_Int32 nNumPrecRadix; // indicating the radix, which is usually 2 or 10
73 sal_Int32 nType; // database type
75 sal_Int16 nMaximumScale; // decimal places after decimal point
76 sal_Int16 nMinimumScale; // min decimal places after decimal point
78 sal_Int16 nSearchType; // if it is possible to search for type
80 bool bCurrency : 1, // currency
81 bAutoIncrement : 1, // if automatic incrementing field
82 bNullable : 1; // if field can be NULL
84 OTypeInfo()
85 :nPrecision(0)
86 ,nNumPrecRadix(10)
87 ,nType(css::sdbc::DataType::OTHER)
88 ,nMaximumScale(0)
89 ,nMinimumScale(0)
90 ,nSearchType(css::sdbc::ColumnSearch::FULL)
91 ,bCurrency(false)
92 ,bAutoIncrement(false)
93 ,bNullable(true)
95 const OUString& getDBName() const { return aTypeName; }
99 typedef std::shared_ptr<OTypeInfo> TOTypeInfoSP;
100 typedef std::multimap<sal_Int32,TOTypeInfoSP> OTypeInfoMap;
101 /** return the most suitable typeinfo for a requested type
102 @param _rTypeInfo contains a map of type to typeinfo
103 @param _nType the requested type
104 @param _sTypeName the typename
105 @param _sCreateParams the create params
106 @param _nPrecision the precision
107 @param _nScale the scale
108 @param _bAutoIncrement if it is an auto increment
109 @param _brForceToType true when type was found which has some differences
111 TOTypeInfoSP getTypeInfoFromType(const OTypeInfoMap& _rTypeInfo,
112 sal_Int32 _nType,
113 const OUString& _sTypeName,
114 const OUString& _sCreateParams,
115 sal_Int32 _nPrecision,
116 sal_Int32 _nScale,
117 bool _bAutoIncrement,
118 bool& _brForceToType);
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */