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