1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef DBAUI_WIZ_TYPESELECT_HXX 24 #define DBAUI_WIZ_TYPESELECT_HXX 25 26 #include "FieldDescControl.hxx" 27 #include "TypeInfo.hxx" 28 #include "WTabPage.hxx" 29 30 #include <vcl/button.hxx> 31 #include <vcl/field.hxx> 32 #include <vcl/fixed.hxx> 33 #include <vcl/lstbox.hxx> 34 35 class SvStream; 36 class SvParser; 37 namespace dbaui 38 { 39 class OTableDesignHelpBar; 40 // ============================================================================================= 41 // OWizTypeSelectControl 42 // ============================================================================================= 43 class OWizTypeSelectControl : public OFieldDescControl 44 { 45 protected: 46 virtual void ActivateAggregate( EControlType eType ); 47 virtual void DeactivateAggregate( EControlType eType ); 48 49 virtual void CellModified(long nRow, sal_uInt16 nColId ); 50 51 virtual ::com::sun::star::lang::Locale GetLocale() const; 52 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > GetFormatter() const; 53 virtual TOTypeInfoSP getTypeInfo(sal_Int32 _nPos); 54 virtual const OTypeInfoMap* getTypeInfo() const; 55 virtual sal_Bool isAutoIncrementValueEnabled() const; 56 virtual ::rtl::OUString getAutoIncrementValue() const; 57 58 public: 59 OWizTypeSelectControl(Window* pParent, const ResId& rResId,OTableDesignHelpBar* pHelpBar=NULL); 60 virtual ~OWizTypeSelectControl(); 61 62 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> getMetaData(); 63 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection(); 64 }; 65 66 67 // ======================================================== 68 // Wizard Page: OWizTypeSelectList 69 // definiert nur das ::com::sun::star::ucb::Command f"ur das Contextmenu 70 // ======================================================== 71 class OWizTypeSelectList : public MultiListBox 72 { 73 sal_Bool m_bPKey; 74 sal_Bool IsPrimaryKeyAllowed() const; 75 void setPrimaryKey( OFieldDescription* _pFieldDescr, 76 sal_uInt16 _nPos, 77 sal_Bool _bSet=sal_False); 78 protected: 79 virtual long PreNotify( NotifyEvent& rNEvt ); 80 public: OWizTypeSelectList(Window * pParent,WinBits nStyle=WB_BORDER)81 OWizTypeSelectList( Window* pParent, WinBits nStyle = WB_BORDER ) : MultiListBox(pParent,nStyle) {}; OWizTypeSelectList(Window * pParent,const ResId & rResId)82 OWizTypeSelectList( Window* pParent, const ResId& rResId ) : MultiListBox(pParent,rResId) {}; SetPKey(sal_Bool bPKey)83 void SetPKey(sal_Bool bPKey) { m_bPKey = bPKey; } 84 }; 85 86 // ======================================================== 87 // Wizard Page: OWizTypeSelect 88 // Dient als Basis Klasse fuer unterschiedliche Kopiereigenschaften 89 // FillColumnList wird aufgerufen, wenn der Button AUTO ausgeloest wird. 90 // ======================================================== 91 class OWizTypeSelect : public OWizardPage 92 { 93 friend class OWizTypeSelectControl; 94 friend class OWizTypeSelectList; 95 96 DECL_LINK( ColumnSelectHdl, MultiListBox* ); 97 DECL_LINK( ButtonClickHdl, Button * ); 98 protected: 99 OWizTypeSelectList m_lbColumnNames; 100 FixedLine m_flColumns; 101 OWizTypeSelectControl m_aTypeControl; 102 FixedLine m_flAutoType; 103 FixedText m_ftAuto; 104 NumericField m_etAuto; 105 PushButton m_pbAuto; 106 107 Image m_imgPKey; 108 SvStream* m_pParserStream; // stream to read the tokens from or NULL 109 ::rtl::OUString m_sAutoIncrementValue; 110 sal_Int32 m_nDisplayRow; 111 sal_Bool m_bAutoIncrementEnabled; 112 sal_Bool m_bDuplicateName; 113 114 void fillColumnList(sal_uInt32 nRows); 115 virtual SvParser* createReader(sal_Int32 _nRows) = 0; 116 117 void EnableAuto(sal_Bool bEnable); 118 public: 119 virtual void Reset ( ); 120 virtual void ActivatePage( ); 121 virtual void Resize(); 122 virtual sal_Bool LeavePage(); 123 virtual String GetTitle() const; 124 125 OWizTypeSelect(Window* pParent, SvStream* _pStream = NULL ); 126 virtual ~OWizTypeSelect(); 127 setDisplayRow(sal_Int32 _nRow)128 inline void setDisplayRow(sal_Int32 _nRow) { m_nDisplayRow = _nRow - 1; } setDuplicateName(sal_Bool _bDuplicateName)129 inline void setDuplicateName(sal_Bool _bDuplicateName) { m_bDuplicateName = _bDuplicateName; } 130 }; 131 132 // ======================================================== 133 typedef OWizTypeSelect* (*TypeSelectionPageFactory)( Window*, SvStream& ); 134 } 135 #endif // DBAUI_WIZ_TYPESELECT_HXX 136 137 138 139