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_WTYPESELECT_HXX
20 : #define INCLUDED_DBACCESS_SOURCE_UI_INC_WTYPESELECT_HXX
21 :
22 : #include "FieldDescControl.hxx"
23 : #include "TypeInfo.hxx"
24 : #include "WTabPage.hxx"
25 :
26 : #include <vcl/button.hxx>
27 : #include <vcl/field.hxx>
28 : #include <vcl/fixed.hxx>
29 : #include <vcl/lstbox.hxx>
30 :
31 : class SvStream;
32 : class SvParser;
33 : namespace dbaui
34 : {
35 : class OTableDesignHelpBar;
36 : // OWizTypeSelectControl
37 : class OWizTypeSelectControl : public OFieldDescControl
38 : {
39 : protected:
40 : virtual void ActivateAggregate( EControlType eType ) SAL_OVERRIDE;
41 : virtual void DeactivateAggregate( EControlType eType ) SAL_OVERRIDE;
42 :
43 : virtual void CellModified(long nRow, sal_uInt16 nColId ) SAL_OVERRIDE;
44 :
45 : virtual ::com::sun::star::lang::Locale GetLocale() const SAL_OVERRIDE;
46 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > GetFormatter() const SAL_OVERRIDE;
47 : virtual TOTypeInfoSP getTypeInfo(sal_Int32 _nPos) SAL_OVERRIDE;
48 : virtual const OTypeInfoMap* getTypeInfo() const SAL_OVERRIDE;
49 : virtual sal_Bool isAutoIncrementValueEnabled() const SAL_OVERRIDE;
50 : virtual OUString getAutoIncrementValue() const SAL_OVERRIDE;
51 :
52 : public:
53 : OWizTypeSelectControl(Window* pParent, const ResId& rResId,OTableDesignHelpBar* pHelpBar=NULL);
54 : virtual ~OWizTypeSelectControl();
55 :
56 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> getMetaData() SAL_OVERRIDE;
57 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection() SAL_OVERRIDE;
58 : };
59 :
60 : // Wizard Page: OWizTypeSelectList
61 : // just defines the ::com::sun::star::ucb::Command for the Contextmenu
62 0 : class OWizTypeSelectList : public MultiListBox
63 : {
64 : sal_Bool m_bPKey;
65 : sal_Bool IsPrimaryKeyAllowed() const;
66 : void setPrimaryKey( OFieldDescription* _pFieldDescr,
67 : sal_uInt16 _nPos,
68 : sal_Bool _bSet = sal_False);
69 : protected:
70 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
71 : public:
72 : OWizTypeSelectList( Window* pParent, WinBits nStyle = WB_BORDER )
73 : : MultiListBox(pParent,nStyle)
74 : , m_bPKey(sal_False)
75 : {}
76 0 : OWizTypeSelectList( Window* pParent, const ResId& rResId )
77 : : MultiListBox(pParent,rResId)
78 0 : , m_bPKey(sal_False)
79 0 : {}
80 0 : void SetPKey(sal_Bool bPKey) { m_bPKey = bPKey; }
81 : };
82 :
83 : // Wizard Page: OWizTypeSelect
84 : // Serves as base class for different copy properties.
85 : // Calls FillColumnList, when button AUTO is triggered
86 : class OWizTypeSelect : public OWizardPage
87 : {
88 : friend class OWizTypeSelectControl;
89 : friend class OWizTypeSelectList;
90 :
91 : DECL_LINK( ColumnSelectHdl, MultiListBox* );
92 : DECL_LINK( ButtonClickHdl, Button * );
93 : protected:
94 : OWizTypeSelectList m_lbColumnNames;
95 : FixedLine m_flColumns;
96 : OWizTypeSelectControl m_aTypeControl;
97 : FixedLine m_flAutoType;
98 : FixedText m_ftAuto;
99 : NumericField m_etAuto;
100 : PushButton m_pbAuto;
101 :
102 : Image m_imgPKey;
103 : SvStream* m_pParserStream; // stream to read the tokens from or NULL
104 : OUString m_sAutoIncrementValue;
105 : sal_Int32 m_nDisplayRow;
106 : sal_Bool m_bAutoIncrementEnabled;
107 : sal_Bool m_bDuplicateName;
108 :
109 : void fillColumnList(sal_uInt32 nRows);
110 : virtual SvParser* createReader(sal_Int32 _nRows) = 0;
111 :
112 : void EnableAuto(sal_Bool bEnable);
113 : public:
114 : virtual void Reset ( ) SAL_OVERRIDE;
115 : virtual void ActivatePage( ) SAL_OVERRIDE;
116 : virtual void Resize() SAL_OVERRIDE;
117 : virtual sal_Bool LeavePage() SAL_OVERRIDE;
118 : virtual OUString GetTitle() const SAL_OVERRIDE;
119 :
120 : OWizTypeSelect(Window* pParent, SvStream* _pStream = NULL );
121 : virtual ~OWizTypeSelect();
122 :
123 0 : inline void setDisplayRow(sal_Int32 _nRow) { m_nDisplayRow = _nRow - 1; }
124 0 : inline void setDuplicateName(sal_Bool _bDuplicateName) { m_bDuplicateName = _bDuplicateName; }
125 : };
126 :
127 : typedef OWizTypeSelect* (*TypeSelectionPageFactory)( Window*, SvStream& );
128 : }
129 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_WTYPESELECT_HXX
130 :
131 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|