Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_FIELDDESCRIPTIONS_HXX
20 : #define INCLUDED_DBACCESS_SOURCE_UI_INC_FIELDDESCRIPTIONS_HXX
21 :
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>
28 :
29 : namespace dbaui
30 : {
31 : class OFieldDescription
32 : {
33 : private:
34 : ::com::sun::star::uno::Any m_aDefaultValue; // the default value from the database
35 : ::com::sun::star::uno::Any m_aControlDefault; // the value which the control inserts as default
36 : ::com::sun::star::uno::Any m_aWidth; // sal_Int32 or void
37 : ::com::sun::star::uno::Any m_aRelativePosition; // sal_Int32 or void
38 :
39 : TOTypeInfoSP m_pType;
40 :
41 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xDest;
42 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > m_xDestInfo;
43 :
44 : OUString m_sName;
45 : OUString m_sTypeName;
46 : OUString m_sDescription;
47 : OUString m_sHelpText;
48 :
49 : OUString m_sAutoIncrementValue;
50 : sal_Int32 m_nType; // only used when m_pType is null
51 : sal_Int32 m_nPrecision;
52 : sal_Int32 m_nScale;
53 : sal_Int32 m_nIsNullable;
54 : sal_Int32 m_nFormatKey;
55 : SvxCellHorJustify m_eHorJustify;
56 : bool m_bIsAutoIncrement;
57 : bool m_bIsPrimaryKey;
58 : bool m_bIsCurrency;
59 : bool m_bHidden;
60 :
61 : public:
62 : OFieldDescription();
63 : OFieldDescription( const OFieldDescription& rDescr );
64 : OFieldDescription(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xAffectedCol
65 : ,bool _bUseAsDest = false);
66 : ~OFieldDescription();
67 :
68 : void SetName(const OUString& _rName);
69 : void SetDescription(const OUString& _rDescription);
70 : void SetHelpText(const OUString& _sHelptext);
71 : void SetDefaultValue(const ::com::sun::star::uno::Any& _rDefaultValue);
72 : void SetControlDefault(const ::com::sun::star::uno::Any& _rControlDefault);
73 : void SetAutoIncrementValue(const OUString& _sAutoIncValue);
74 : void SetType(TOTypeInfoSP _pType);
75 : void SetTypeValue(sal_Int32 _nType);
76 : void SetTypeName(const OUString& _sTypeName);
77 : void SetPrecision(const sal_Int32& _rPrecision);
78 : void SetScale(const sal_Int32& _rScale);
79 : void SetIsNullable(const sal_Int32& _rIsNullable);
80 : void SetFormatKey(const sal_Int32& _rFormatKey);
81 : void SetHorJustify(const SvxCellHorJustify& _rHorJustify);
82 : void SetAutoIncrement(bool _bAuto);
83 : void SetPrimaryKey(bool _bPKey);
84 : void SetCurrency(bool _bIsCurrency);
85 :
86 : /** copies the content of the field eescription into the column
87 : @param _rxColumn the dest
88 : */
89 : void copyColumnSettingsTo(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn);
90 :
91 : void FillFromTypeInfo(const TOTypeInfoSP& _pType,bool _bForce,bool _bReset);
92 :
93 : OUString GetName() const;
94 : OUString GetDescription() const;
95 : OUString GetHelpText() const;
96 : ::com::sun::star::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 0 : TOTypeInfoSP getTypeInfo() const { return m_pType;}
106 : TOTypeInfoSP getSpecialTypeInfo() const;
107 : bool IsAutoIncrement() const;
108 0 : bool IsPrimaryKey() const { return m_bIsPrimaryKey;}
109 0 : bool IsCurrency() const { return m_bIsCurrency;}
110 : bool IsNullable() const;
111 : };
112 : }
113 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_FIELDDESCRIPTIONS_HXX
114 :
115 :
116 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|