fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dbaccess / source / ui / inc / FieldDescControl.hxx
blob6b58cabddd1932b33b9e6a845e2d00b692260345
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 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_FIELDDESCCONTROL_HXX
20 #define INCLUDED_DBACCESS_SOURCE_UI_INC_FIELDDESCCONTROL_HXX
22 #include <vcl/tabpage.hxx>
23 #include "QEnumTypes.hxx"
24 #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
25 #include <com/sun/star/util/XNumberFormatter.hpp>
26 #include "TypeInfo.hxx"
28 // field description columns of a table
29 #define FIELD_NAME 1
30 #define FIELD_TYPE 2
31 #define HELP_TEXT 3
32 #define COLUMN_DESCRIPTION 4
34 #define FIELD_FIRST_VIRTUAL_COLUMN 5
36 #define FIELD_PROPERTY_REQUIRED 5
37 #define FIELD_PROPERTY_NUMTYPE 6
38 #define FIELD_PROPERTY_AUTOINC 7
39 #define FIELD_PROPERTY_DEFAULT 8
40 #define FIELD_PROPERTY_TEXTLEN 9
41 #define FIELD_PROPERTY_LENGTH 10
42 #define FIELD_PROPERTY_SCALE 11
43 #define FIELD_PROPERTY_BOOL_DEFAULT 12
44 #define FIELD_PROPERTY_FORMAT 13
45 #define FIELD_PROPERTY_COLUMNNAME 14
46 #define FIELD_PROPERTY_TYPE 15
47 #define FIELD_PROPERTY_AUTOINCREMENT 16
49 class FixedText;
50 class PushButton;
51 class ScrollBar;
52 class Button;
53 class ListBox;
54 class Control;
56 namespace dbaui
58 class OTableDesignHelpBar;
59 class OPropListBoxCtrl;
60 class OPropEditCtrl;
61 class OPropNumericEditCtrl;
62 class OFieldDescription;
63 class OPropColumnEditCtrl;
65 class OFieldDescControl : public TabPage
67 private:
68 VclPtr<OTableDesignHelpBar> pHelp;
69 VclPtr<vcl::Window> pLastFocusWindow;
70 VclPtr<vcl::Window> m_pActFocusWindow;
72 VclPtr<FixedText> pDefaultText;
73 VclPtr<FixedText> pRequiredText;
74 VclPtr<FixedText> pAutoIncrementText;
75 VclPtr<FixedText> pTextLenText;
76 VclPtr<FixedText> pNumTypeText;
77 VclPtr<FixedText> pLengthText;
78 VclPtr<FixedText> pScaleText;
79 VclPtr<FixedText> pFormatText;
80 VclPtr<FixedText> pBoolDefaultText;
81 VclPtr<FixedText> m_pColumnNameText;
82 VclPtr<FixedText> m_pTypeText;
83 VclPtr<FixedText> m_pAutoIncrementValueText;
85 VclPtr<OPropListBoxCtrl> pRequired;
86 VclPtr<OPropListBoxCtrl> pNumType;
87 VclPtr<OPropListBoxCtrl> pAutoIncrement;
88 VclPtr<OPropEditCtrl> pDefault;
89 VclPtr<OPropNumericEditCtrl> pTextLen;
90 VclPtr<OPropNumericEditCtrl> pLength;
91 VclPtr<OPropNumericEditCtrl> pScale;
92 VclPtr<OPropEditCtrl> pFormatSample;
93 VclPtr<OPropListBoxCtrl> pBoolDefault;
94 VclPtr<OPropColumnEditCtrl> m_pColumnName;
95 VclPtr<OPropListBoxCtrl> m_pType;
96 VclPtr<OPropEditCtrl> m_pAutoIncrementValue;
98 VclPtr<PushButton> pFormat;
100 VclPtr<ScrollBar> m_pVertScroll;
101 VclPtr<ScrollBar> m_pHorzScroll;
103 TOTypeInfoSP m_pPreviousType;
104 short m_nPos;
105 OUString aYes;
106 OUString aNo;
108 long m_nOldVThumb;
109 long m_nOldHThumb;
110 sal_Int32 m_nWidth;
112 bool m_bAdded;
113 bool m_bRightAligned;
115 OFieldDescription* pActFieldDescr;
117 DECL_LINK( OnScroll, ScrollBar*);
119 DECL_LINK( FormatClickHdl, Button * );
120 DECL_LINK( ChangeHdl, ListBox * );
122 // used by ActivatePropertyField
123 DECL_LINK( OnControlFocusLost, Control* );
124 DECL_LINK( OnControlFocusGot, Control* );
126 void UpdateFormatSample(OFieldDescription* pFieldDescr);
127 void ArrangeAggregates();
129 void SetPosSize( VclPtr<Control>& rControl, long nRow, sal_uInt16 nCol );
131 static void ScrollAggregate(Control* pText, Control* pInput, Control* pButton, long nDeltaX, long nDeltaY);
132 void ScrollAllAggregates();
134 bool isTextFormat(const OFieldDescription* _pFieldDescr,sal_uInt32& _nFormatKey) const;
135 void Contruct();
136 VclPtr<OPropNumericEditCtrl> CreateNumericControl(sal_uInt16 _nHelpStr,short _nProperty,const OString& _sHelpId);
137 VclPtr<FixedText> CreateText(sal_uInt16 _nTextRes);
138 void InitializeControl(Control* _pControl,const OString& _sHelpId,bool _bAddChangeHandler);
140 protected:
141 inline void setRightAligned() { m_bRightAligned = true; }
142 inline bool isRightAligned() const { return m_bRightAligned; }
144 inline void saveCurrentFieldDescData() { SaveData( pActFieldDescr ); }
145 inline OFieldDescription* getCurrentFieldDescData() { return pActFieldDescr; }
146 inline void setCurrentFieldDescData( OFieldDescription* _pDesc ) { pActFieldDescr = _pDesc; }
148 sal_uInt16 CountActiveAggregates() const;
149 sal_Int32 GetMaxControlHeight() const;
151 virtual void ActivateAggregate( EControlType eType );
152 virtual void DeactivateAggregate( EControlType eType );
153 virtual bool IsReadOnly() { return false; };
155 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > GetFormatter() const = 0;
157 virtual ::com::sun::star::lang::Locale GetLocale() const = 0;
159 virtual void CellModified(long nRow, sal_uInt16 nColId ) = 0;
160 virtual void SetModified(bool bModified); // base implementation is empty
162 virtual TOTypeInfoSP getTypeInfo(sal_Int32 _nPos) = 0;
163 virtual const OTypeInfoMap* getTypeInfo() const = 0;
165 virtual bool isAutoIncrementValueEnabled() const = 0;
166 virtual OUString getAutoIncrementValue() const = 0;
168 OUString BoolStringPersistent(const OUString& rUIString) const;
169 OUString BoolStringUI(const OUString& rPersistentString) const;
171 const OPropColumnEditCtrl* getColumnCtrl() const { return m_pColumnName; }
173 void implFocusLost(vcl::Window* _pWhich);
175 public:
176 OFieldDescControl( vcl::Window* pParent, OTableDesignHelpBar* pHelpBar);
177 virtual ~OFieldDescControl();
178 virtual void dispose() SAL_OVERRIDE;
180 void DisplayData(OFieldDescription* pFieldDescr );
182 void SaveData( OFieldDescription* pFieldDescr );
184 void SetControlText( sal_uInt16 nControlId, const OUString& rText );
185 OUString GetControlText( sal_uInt16 nControlId );
186 void SetReadOnly( bool bReadOnly );
188 // when resize is called
189 void CheckScrollBars();
190 bool isCutAllowed();
191 bool isCopyAllowed();
192 bool isPasteAllowed();
194 void cut();
195 void copy();
196 void paste();
198 void Init();
199 virtual void GetFocus() SAL_OVERRIDE;
200 virtual void LoseFocus() SAL_OVERRIDE;
201 virtual void Resize() SAL_OVERRIDE;
203 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> getMetaData() = 0;
204 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection() = 0;
206 OUString getControlDefault( const OFieldDescription* _pFieldDescr, bool _bCheck = true) const;
208 inline void setEditWidth(sal_Int32 _nWidth) { m_nWidth = _nWidth; }
211 #endif
213 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */