1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_FIELDDESCRIPTIONS_HXX
20 #define INCLUDED_DBACCESS_SOURCE_UI_INC_FIELDDESCRIPTIONS_HXX
22 #include "QEnumTypes.hxx"
23 #include <editeng/svxenum.hxx>
24 #include "TypeInfo.hxx"
25 #include <osl/diagnose.h>
26 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <com/sun/star/beans/XPropertySetInfo.hpp>
31 class OFieldDescription
34 css::uno::Any m_aDefaultValue
; // the default value from the database
35 css::uno::Any m_aControlDefault
; // the value which the control inserts as default
36 css::uno::Any m_aWidth
; // sal_Int32 or void
37 css::uno::Any m_aRelativePosition
; // sal_Int32 or void
41 css::uno::Reference
< css::beans::XPropertySet
> m_xDest
;
42 css::uno::Reference
< css::beans::XPropertySetInfo
> m_xDestInfo
;
46 OUString m_sDescription
;
49 OUString m_sAutoIncrementValue
;
50 sal_Int32 m_nType
; // only used when m_pType is null
51 sal_Int32 m_nPrecision
;
53 sal_Int32 m_nIsNullable
;
54 sal_Int32 m_nFormatKey
;
55 SvxCellHorJustify m_eHorJustify
;
56 bool m_bIsAutoIncrement
;
63 OFieldDescription( const OFieldDescription
& rDescr
);
64 OFieldDescription(const css::uno::Reference
< css::beans::XPropertySet
>& _xAffectedCol
65 ,bool _bUseAsDest
= false);
68 void SetName(const OUString
& _rName
);
69 void SetDescription(const OUString
& _rDescription
);
70 void SetHelpText(const OUString
& _sHelptext
);
71 void SetDefaultValue(const css::uno::Any
& _rDefaultValue
);
72 void SetControlDefault(const css::uno::Any
& _rControlDefault
);
73 void SetAutoIncrementValue(const OUString
& _sAutoIncValue
);
74 void SetType(const TOTypeInfoSP
& _pType
);
75 void SetTypeValue(sal_Int32 _nType
);
76 void SetTypeName(const OUString
& _sTypeName
);
77 void SetPrecision(sal_Int32 _rPrecision
);
78 void SetScale(sal_Int32 _rScale
);
79 void SetIsNullable(sal_Int32 _rIsNullable
);
80 void SetFormatKey(sal_Int32 _rFormatKey
);
81 void SetHorJustify(const SvxCellHorJustify
& _rHorJustify
);
82 void SetAutoIncrement(bool _bAuto
);
83 void SetPrimaryKey(bool _bPKey
);
84 void SetCurrency(bool _bIsCurrency
);
86 /** copies the content of the field description into the column
87 @param _rxColumn the dest
89 void copyColumnSettingsTo(const css::uno::Reference
< css::beans::XPropertySet
>& _rxColumn
);
91 void FillFromTypeInfo(const TOTypeInfoSP
& _pType
,bool _bForce
,bool _bReset
);
93 OUString
GetName() const;
94 OUString
GetDescription() const;
95 OUString
GetHelpText() const;
96 css::uno::Any
GetControlDefault() const;
97 OUString
GetAutoIncrementValue() const;
98 sal_Int32
GetType() const;
99 OUString
GetTypeName() const;
100 sal_Int32
GetPrecision() const;
101 sal_Int32
GetScale() const;
102 sal_Int32
GetIsNullable() const;
103 sal_Int32
GetFormatKey() const;
104 SvxCellHorJustify
GetHorJustify() const;
105 const TOTypeInfoSP
& getTypeInfo() const { return m_pType
;}
106 TOTypeInfoSP
getSpecialTypeInfo() const;
107 bool IsAutoIncrement() const;
108 bool IsPrimaryKey() const { return m_bIsPrimaryKey
;}
109 bool IsCurrency() const { return m_bIsCurrency
;}
110 bool IsNullable() const;
113 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_FIELDDESCRIPTIONS_HXX
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */