1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: WTypeSelect.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef DBAUI_WIZ_TYPESELECT_HXX
31 #define DBAUI_WIZ_TYPESELECT_HXX
33 #include "FieldDescControl.hxx"
34 #include "TypeInfo.hxx"
35 #include "WTabPage.hxx"
37 #include <vcl/button.hxx>
38 #include <vcl/field.hxx>
39 #include <vcl/fixed.hxx>
40 #include <vcl/lstbox.hxx>
46 class OTableDesignHelpBar
;
47 // =============================================================================================
48 // OWizTypeSelectControl
49 // =============================================================================================
50 class OWizTypeSelectControl
: public OFieldDescControl
53 virtual void ActivateAggregate( EControlType eType
);
54 virtual void DeactivateAggregate( EControlType eType
);
56 virtual void CellModified(long nRow
, sal_uInt16 nColId
);
58 virtual ::com::sun::star::lang::Locale
GetLocale() const;
59 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatter
> GetFormatter() const;
60 virtual TOTypeInfoSP
getTypeInfo(sal_Int32 _nPos
);
61 virtual const OTypeInfoMap
* getTypeInfo() const;
62 virtual sal_Bool
isAutoIncrementValueEnabled() const;
63 virtual ::rtl::OUString
getAutoIncrementValue() const;
66 OWizTypeSelectControl(Window
* pParent
, const ResId
& rResId
,OTableDesignHelpBar
* pHelpBar
=NULL
);
67 virtual ~OWizTypeSelectControl();
69 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XDatabaseMetaData
> getMetaData();
70 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
> getConnection();
74 // ========================================================
75 // Wizard Page: OWizTypeSelectList
76 // definiert nur das ::com::sun::star::ucb::Command f"ur das Contextmenu
77 // ========================================================
78 class OWizTypeSelectList
: public MultiListBox
81 sal_Bool
IsPrimaryKeyAllowed() const;
82 void setPrimaryKey( OFieldDescription
* _pFieldDescr
,
84 sal_Bool _bSet
=sal_False
);
86 virtual long PreNotify( NotifyEvent
& rNEvt
);
88 OWizTypeSelectList( Window
* pParent
, WinBits nStyle
= WB_BORDER
) : MultiListBox(pParent
,nStyle
) {};
89 OWizTypeSelectList( Window
* pParent
, const ResId
& rResId
) : MultiListBox(pParent
,rResId
) {};
90 void SetPKey(sal_Bool bPKey
) { m_bPKey
= bPKey
; }
93 // ========================================================
94 // Wizard Page: OWizTypeSelect
95 // Dient als Basis Klasse fuer unterschiedliche Kopiereigenschaften
96 // FillColumnList wird aufgerufen, wenn der Button AUTO ausgeloest wird.
97 // ========================================================
98 class OWizTypeSelect
: public OWizardPage
100 friend class OWizTypeSelectControl
;
101 friend class OWizTypeSelectList
;
103 DECL_LINK( ColumnSelectHdl
, MultiListBox
* );
104 DECL_LINK( ButtonClickHdl
, Button
* );
106 OWizTypeSelectList m_lbColumnNames
;
107 FixedLine m_flColumns
;
108 OWizTypeSelectControl m_aTypeControl
;
109 FixedLine m_flAutoType
;
111 NumericField m_etAuto
;
115 SvStream
* m_pParserStream
; // stream to read the tokens from or NULL
116 ::rtl::OUString m_sAutoIncrementValue
;
117 sal_Int32 m_nDisplayRow
;
118 sal_Bool m_bAutoIncrementEnabled
;
119 sal_Bool m_bDuplicateName
;
121 void fillColumnList(sal_uInt32 nRows
);
122 virtual SvParser
* createReader(sal_Int32 _nRows
) = 0;
124 void EnableAuto(sal_Bool bEnable
);
126 virtual void Reset ( );
127 virtual void ActivatePage( );
128 virtual void Resize();
129 virtual sal_Bool
LeavePage();
130 virtual String
GetTitle() const;
132 OWizTypeSelect(Window
* pParent
, SvStream
* _pStream
= NULL
);
133 virtual ~OWizTypeSelect();
135 inline void setDisplayRow(sal_Int32 _nRow
) { m_nDisplayRow
= _nRow
- 1; }
136 inline void setDuplicateName(sal_Bool _bDuplicateName
) { m_bDuplicateName
= _bDuplicateName
; }
139 // ========================================================
140 typedef OWizTypeSelect
* (*TypeSelectionPageFactory
)( Window
*, SvStream
& );
142 #endif // DBAUI_WIZ_TYPESELECT_HXX