1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_dbaccess.hxx" 30 #ifndef DBAUI_TABLEFIELDDESCGENPAGE_HXX 31 #include "FieldDescGenWin.hxx" 32 #endif 33 #ifndef _TOOLS_DEBUG_HXX 34 #include <tools/debug.hxx> 35 #endif 36 #ifndef _DBA_DBACCESS_HELPID_HRC_ 37 #include "dbaccess_helpid.hrc" 38 #endif 39 #ifndef DBAUI_TABLEDESIGNHELPBAR_HXX 40 #include "TableDesignHelpBar.hxx" 41 #endif 42 #ifndef DBAUI_TABLEFIELDCONTROL_HXX 43 #include "TableFieldControl.hxx" 44 #endif 45 #ifndef DBAUI_TABLEDESIGNVIEW_HXX 46 #include "TableDesignView.hxx" 47 #endif 48 #ifndef DBAUI_TABLEEDITORCONTROL_HXX 49 #include "TEditControl.hxx" 50 #endif 51 using namespace dbaui; 52 53 //================================================================== 54 // class OFieldDescGenWin 55 //================================================================== 56 57 DBG_NAME(OFieldDescGenWin) 58 //================================================================== 59 //------------------------------------------------------------------------------ 60 OFieldDescGenWin::OFieldDescGenWin( Window* pParent, OTableDesignHelpBar* pHelp ) : 61 TabPage( pParent, WB_3DLOOK | WB_DIALOGCONTROL ) 62 { 63 DBG_CTOR(OFieldDescGenWin,NULL); 64 m_pFieldControl = new OTableFieldControl(this,pHelp); 65 m_pFieldControl->SetHelpId(HID_TAB_DESIGN_FIELDCONTROL); 66 m_pFieldControl->Show(); 67 } 68 //------------------------------------------------------------------------------ 69 OFieldDescGenWin::~OFieldDescGenWin() 70 { 71 DBG_DTOR(OFieldDescGenWin,NULL); 72 ::std::auto_ptr<Window> aTemp(m_pFieldControl); 73 m_pFieldControl = NULL; 74 } 75 //------------------------------------------------------------------------------ 76 void OFieldDescGenWin::Init() 77 { 78 DBG_ASSERT(GetEditorCtrl() != NULL, "OFieldDescGenWin::Init : have no editor control !"); 79 80 m_pFieldControl->Init(); 81 } 82 //------------------------------------------------------------------------------ 83 void OFieldDescGenWin::Resize() 84 { 85 m_pFieldControl->SetPosSizePixel(Point(0,0),GetSizePixel()); 86 m_pFieldControl->Resize(); 87 } 88 //------------------------------------------------------------------------------ 89 void OFieldDescGenWin::SetReadOnly( sal_Bool bReadOnly ) 90 { 91 DBG_CHKTHIS(OFieldDescGenWin,NULL); 92 93 m_pFieldControl->SetReadOnly(bReadOnly); 94 } 95 //------------------------------------------------------------------------------ 96 String OFieldDescGenWin::GetControlText( sal_uInt16 nControlId ) 97 { 98 DBG_CHKTHIS(OFieldDescGenWin,NULL); 99 return m_pFieldControl->GetControlText(nControlId); 100 } 101 //------------------------------------------------------------------------------ 102 void OFieldDescGenWin::SetControlText( sal_uInt16 nControlId, const String& rText ) 103 { 104 DBG_CHKTHIS(OFieldDescGenWin,NULL); 105 ////////////////////////////////////////////////////////////////////// 106 // Texte der Controls setzen 107 m_pFieldControl->SetControlText(nControlId,rText); 108 } 109 //------------------------------------------------------------------------------ 110 void OFieldDescGenWin::DisplayData( OFieldDescription* pFieldDescr ) 111 { 112 DBG_CHKTHIS(OFieldDescGenWin,NULL); 113 114 m_pFieldControl->DisplayData(pFieldDescr); 115 } 116 //------------------------------------------------------------------------------ 117 #if OSL_DEBUG_LEVEL > 0 118 OTableEditorCtrl* OFieldDescGenWin::GetEditorCtrl() 119 { 120 DBG_CHKTHIS(OFieldDescGenWin,NULL); 121 OTableDesignView* pDesignWin = static_cast<OTableDesignView*>(GetParent()->GetParent()->GetParent()); 122 return pDesignWin->GetEditorCtrl(); 123 } 124 #endif 125 //------------------------------------------------------------------------------ 126 //short OFieldDescGenWin::GetFormatCategory(OFieldDescription* pFieldDescr) 127 //{ 128 // return m_pFieldControl->GetFormatCategory(pFieldDescr); 129 //} 130 //------------------------------------------------------------------------------ 131 void OFieldDescGenWin::SaveData( OFieldDescription* pFieldDescr ) 132 { 133 DBG_CHKTHIS(OFieldDescGenWin,NULL); 134 m_pFieldControl->SaveData(pFieldDescr); 135 } 136 //------------------------------------------------------------------------------ 137 void OFieldDescGenWin::GetFocus() 138 { 139 DBG_CHKTHIS(OFieldDescGenWin,NULL); 140 ////////////////////////////////////////////////////////////////////// 141 // Setzt den Focus auf das zuletzt aktive Control 142 TabPage::GetFocus(); 143 if(m_pFieldControl) 144 m_pFieldControl->GetFocus(); 145 146 } 147 //------------------------------------------------------------------------------ 148 void OFieldDescGenWin::LoseFocus() 149 { 150 DBG_CHKTHIS(OFieldDescGenWin,NULL); 151 m_pFieldControl->LoseFocus(); 152 TabPage::LoseFocus(); 153 } 154 //------------------------------------------------------------------ 155 String OFieldDescGenWin::BoolStringPersistent(const String& rUIString) const 156 { 157 return m_pFieldControl->BoolStringPersistent(rUIString); 158 } 159 160 //------------------------------------------------------------------ 161 String OFieldDescGenWin::BoolStringUI(const String& rPersistentString) const 162 { 163 return m_pFieldControl->BoolStringUI(rPersistentString); 164 } 165 // ----------------------------------------------------------------------------- 166 sal_Bool OFieldDescGenWin::isCopyAllowed() 167 { 168 return (m_pFieldControl && m_pFieldControl->isCutAllowed()); 169 } 170 // ----------------------------------------------------------------------------- 171 sal_Bool OFieldDescGenWin::isCutAllowed() 172 { 173 return (m_pFieldControl && m_pFieldControl->isCutAllowed()); 174 } 175 // ----------------------------------------------------------------------------- 176 sal_Bool OFieldDescGenWin::isPasteAllowed() 177 { 178 return (m_pFieldControl && m_pFieldControl->isPasteAllowed()); 179 } 180 // ----------------------------------------------------------------------------- 181 void OFieldDescGenWin::cut() 182 { 183 if(m_pFieldControl) 184 m_pFieldControl->cut(); 185 } 186 // ----------------------------------------------------------------------------- 187 void OFieldDescGenWin::copy() 188 { 189 if(m_pFieldControl) 190 m_pFieldControl->copy(); 191 } 192 // ----------------------------------------------------------------------------- 193 void OFieldDescGenWin::paste() 194 { 195 if(m_pFieldControl) 196 m_pFieldControl->paste(); 197 } 198 // ----------------------------------------------------------------------------- 199 200 201 202 203 204