1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_WTYPESELECT_HXX
20 #define INCLUDED_DBACCESS_SOURCE_UI_INC_WTYPESELECT_HXX
22 #include "FieldDescControl.hxx"
23 #include "TypeInfo.hxx"
24 #include "WTabPage.hxx"
26 #include <vcl/button.hxx>
27 #include <vcl/field.hxx>
28 #include <vcl/fixed.hxx>
29 #include <vcl/lstbox.hxx>
35 class OTableDesignHelpBar
;
36 // OWizTypeSelectControl
37 class OWizTypeSelectControl
: public OFieldDescControl
40 VclPtr
<vcl::Window
> m_pParentTabPage
;
41 virtual void ActivateAggregate( EControlType eType
) SAL_OVERRIDE
;
42 virtual void DeactivateAggregate( EControlType eType
) SAL_OVERRIDE
;
44 virtual void CellModified(long nRow
, sal_uInt16 nColId
) SAL_OVERRIDE
;
46 virtual ::com::sun::star::lang::Locale
GetLocale() const SAL_OVERRIDE
;
47 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatter
> GetFormatter() const SAL_OVERRIDE
;
48 virtual TOTypeInfoSP
getTypeInfo(sal_Int32 _nPos
) SAL_OVERRIDE
;
49 virtual const OTypeInfoMap
* getTypeInfo() const SAL_OVERRIDE
;
50 virtual bool isAutoIncrementValueEnabled() const SAL_OVERRIDE
;
51 virtual OUString
getAutoIncrementValue() const SAL_OVERRIDE
;
54 OWizTypeSelectControl(vcl::Window
* pParent
, vcl::Window
* pParentTabPage
, OTableDesignHelpBar
* pHelpBar
=NULL
);
55 virtual ~OWizTypeSelectControl();
56 virtual void dispose() SAL_OVERRIDE
;
58 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XDatabaseMetaData
> getMetaData() SAL_OVERRIDE
;
59 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
> getConnection() SAL_OVERRIDE
;
62 // Wizard Page: OWizTypeSelectList
63 // just defines the ::com::sun::star::ucb::Command for the Contextmenu
64 class OWizTypeSelectList
: public MultiListBox
67 bool IsPrimaryKeyAllowed() const;
68 void setPrimaryKey( OFieldDescription
* _pFieldDescr
,
72 virtual bool PreNotify( NotifyEvent
& rNEvt
) SAL_OVERRIDE
;
73 VclPtr
<vcl::Window
> m_pParentTabPage
;
75 OWizTypeSelectList( vcl::Window
* pParent
, WinBits nStyle
= WB_BORDER
)
76 : MultiListBox(pParent
,nStyle
)
78 , m_pParentTabPage(NULL
)
80 virtual ~OWizTypeSelectList();
81 virtual void dispose() SAL_OVERRIDE
;
82 void SetPKey(bool bPKey
) { m_bPKey
= bPKey
; }
83 void SetParentTabPage(vcl::Window
* pParentTabPage
) { m_pParentTabPage
= pParentTabPage
; }
86 // Wizard Page: OWizTypeSelect
87 // Serves as base class for different copy properties.
88 // Calls FillColumnList, when button AUTO is triggered
89 class OWizTypeSelect
: public OWizardPage
91 friend class OWizTypeSelectControl
;
92 friend class OWizTypeSelectList
;
94 DECL_LINK( ColumnSelectHdl
, MultiListBox
* );
95 DECL_LINK( ButtonClickHdl
, Button
* );
97 VclPtr
<OWizTypeSelectList
> m_pColumnNames
;
98 VclPtr
<FixedText
> m_pColumns
;
99 VclPtr
<OWizTypeSelectControl
> m_pTypeControl
;
100 VclPtr
<FixedText
> m_pAutoType
;
101 VclPtr
<FixedText
> m_pAutoFt
;
102 VclPtr
<NumericField
> m_pAutoEt
;
103 VclPtr
<PushButton
> m_pAutoPb
;
106 SvStream
* m_pParserStream
; // stream to read the tokens from or NULL
107 OUString m_sAutoIncrementValue
;
108 sal_Int32 m_nDisplayRow
;
109 bool m_bAutoIncrementEnabled
;
110 bool m_bDuplicateName
;
112 void fillColumnList(sal_uInt32 nRows
);
113 virtual SvParser
* createReader(sal_Int32 _nRows
) = 0;
115 void EnableAuto(bool bEnable
);
117 virtual void Reset ( ) SAL_OVERRIDE
;
118 virtual void ActivatePage( ) SAL_OVERRIDE
;
119 virtual bool LeavePage() SAL_OVERRIDE
;
120 virtual OUString
GetTitle() const SAL_OVERRIDE
;
122 OWizTypeSelect(vcl::Window
* pParent
, SvStream
* _pStream
= NULL
);
123 virtual ~OWizTypeSelect();
124 virtual void dispose() SAL_OVERRIDE
;
126 inline void setDisplayRow(sal_Int32 _nRow
) { m_nDisplayRow
= _nRow
- 1; }
127 inline void setDuplicateName(bool _bDuplicateName
) { m_bDuplicateName
= _bDuplicateName
; }
130 typedef VclPtr
<OWizTypeSelect
> (*TypeSelectionPageFactory
)( vcl::Window
*, SvStream
& );
132 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_WTYPESELECT_HXX
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */