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 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_dbaccess.hxx" 26 #ifndef DBAUI_TABLEFIELDDESCGENPAGE_HXX 27 #include "FieldDescGenWin.hxx" 28 #endif 29 #ifndef _TOOLS_DEBUG_HXX 30 #include <tools/debug.hxx> 31 #endif 32 #ifndef _DBA_DBACCESS_HELPID_HRC_ 33 #include "dbaccess_helpid.hrc" 34 #endif 35 #ifndef DBAUI_TABLEDESIGNHELPBAR_HXX 36 #include "TableDesignHelpBar.hxx" 37 #endif 38 #ifndef DBAUI_TABLEFIELDCONTROL_HXX 39 #include "TableFieldControl.hxx" 40 #endif 41 #ifndef DBAUI_TABLEDESIGNVIEW_HXX 42 #include "TableDesignView.hxx" 43 #endif 44 #ifndef DBAUI_TABLEEDITORCONTROL_HXX 45 #include "TEditControl.hxx" 46 #endif 47 using namespace dbaui; 48 49 //================================================================== 50 // class OFieldDescGenWin 51 //================================================================== 52 53 DBG_NAME(OFieldDescGenWin) 54 //================================================================== 55 //------------------------------------------------------------------------------ 56 OFieldDescGenWin::OFieldDescGenWin( Window* pParent, OTableDesignHelpBar* pHelp ) : 57 TabPage( pParent, WB_3DLOOK | WB_DIALOGCONTROL ) 58 { 59 DBG_CTOR(OFieldDescGenWin,NULL); 60 m_pFieldControl = new OTableFieldControl(this,pHelp); 61 m_pFieldControl->SetHelpId(HID_TAB_DESIGN_FIELDCONTROL); 62 m_pFieldControl->Show(); 63 } 64 //------------------------------------------------------------------------------ 65 OFieldDescGenWin::~OFieldDescGenWin() 66 { 67 DBG_DTOR(OFieldDescGenWin,NULL); 68 ::std::auto_ptr<Window> aTemp(m_pFieldControl); 69 m_pFieldControl = NULL; 70 } 71 //------------------------------------------------------------------------------ 72 void OFieldDescGenWin::Init() 73 { 74 DBG_ASSERT(GetEditorCtrl() != NULL, "OFieldDescGenWin::Init : have no editor control !"); 75 76 m_pFieldControl->Init(); 77 } 78 //------------------------------------------------------------------------------ 79 void OFieldDescGenWin::Resize() 80 { 81 m_pFieldControl->SetPosSizePixel(Point(0,0),GetSizePixel()); 82 m_pFieldControl->Resize(); 83 } 84 //------------------------------------------------------------------------------ 85 void OFieldDescGenWin::SetReadOnly( sal_Bool bReadOnly ) 86 { 87 DBG_CHKTHIS(OFieldDescGenWin,NULL); 88 89 m_pFieldControl->SetReadOnly(bReadOnly); 90 } 91 //------------------------------------------------------------------------------ 92 String OFieldDescGenWin::GetControlText( sal_uInt16 nControlId ) 93 { 94 DBG_CHKTHIS(OFieldDescGenWin,NULL); 95 return m_pFieldControl->GetControlText(nControlId); 96 } 97 //------------------------------------------------------------------------------ 98 void OFieldDescGenWin::SetControlText( sal_uInt16 nControlId, const String& rText ) 99 { 100 DBG_CHKTHIS(OFieldDescGenWin,NULL); 101 ////////////////////////////////////////////////////////////////////// 102 // Texte der Controls setzen 103 m_pFieldControl->SetControlText(nControlId,rText); 104 } 105 //------------------------------------------------------------------------------ 106 void OFieldDescGenWin::DisplayData( OFieldDescription* pFieldDescr ) 107 { 108 DBG_CHKTHIS(OFieldDescGenWin,NULL); 109 110 m_pFieldControl->DisplayData(pFieldDescr); 111 } 112 //------------------------------------------------------------------------------ 113 #if OSL_DEBUG_LEVEL > 0 114 OTableEditorCtrl* OFieldDescGenWin::GetEditorCtrl() 115 { 116 DBG_CHKTHIS(OFieldDescGenWin,NULL); 117 OTableDesignView* pDesignWin = static_cast<OTableDesignView*>(GetParent()->GetParent()->GetParent()); 118 return pDesignWin->GetEditorCtrl(); 119 } 120 #endif 121 //------------------------------------------------------------------------------ 122 //short OFieldDescGenWin::GetFormatCategory(OFieldDescription* pFieldDescr) 123 //{ 124 // return m_pFieldControl->GetFormatCategory(pFieldDescr); 125 //} 126 //------------------------------------------------------------------------------ 127 void OFieldDescGenWin::SaveData( OFieldDescription* pFieldDescr ) 128 { 129 DBG_CHKTHIS(OFieldDescGenWin,NULL); 130 m_pFieldControl->SaveData(pFieldDescr); 131 } 132 //------------------------------------------------------------------------------ 133 void OFieldDescGenWin::GetFocus() 134 { 135 DBG_CHKTHIS(OFieldDescGenWin,NULL); 136 ////////////////////////////////////////////////////////////////////// 137 // Setzt den Focus auf das zuletzt aktive Control 138 TabPage::GetFocus(); 139 if(m_pFieldControl) 140 m_pFieldControl->GetFocus(); 141 142 } 143 //------------------------------------------------------------------------------ 144 void OFieldDescGenWin::LoseFocus() 145 { 146 DBG_CHKTHIS(OFieldDescGenWin,NULL); 147 m_pFieldControl->LoseFocus(); 148 TabPage::LoseFocus(); 149 } 150 //------------------------------------------------------------------ 151 String OFieldDescGenWin::BoolStringPersistent(const String& rUIString) const 152 { 153 return m_pFieldControl->BoolStringPersistent(rUIString); 154 } 155 156 //------------------------------------------------------------------ 157 String OFieldDescGenWin::BoolStringUI(const String& rPersistentString) const 158 { 159 return m_pFieldControl->BoolStringUI(rPersistentString); 160 } 161 // ----------------------------------------------------------------------------- 162 sal_Bool OFieldDescGenWin::isCopyAllowed() 163 { 164 return (m_pFieldControl && m_pFieldControl->isCutAllowed()); 165 } 166 // ----------------------------------------------------------------------------- 167 sal_Bool OFieldDescGenWin::isCutAllowed() 168 { 169 return (m_pFieldControl && m_pFieldControl->isCutAllowed()); 170 } 171 // ----------------------------------------------------------------------------- 172 sal_Bool OFieldDescGenWin::isPasteAllowed() 173 { 174 return (m_pFieldControl && m_pFieldControl->isPasteAllowed()); 175 } 176 // ----------------------------------------------------------------------------- 177 void OFieldDescGenWin::cut() 178 { 179 if(m_pFieldControl) 180 m_pFieldControl->cut(); 181 } 182 // ----------------------------------------------------------------------------- 183 void OFieldDescGenWin::copy() 184 { 185 if(m_pFieldControl) 186 m_pFieldControl->copy(); 187 } 188 // ----------------------------------------------------------------------------- 189 void OFieldDescGenWin::paste() 190 { 191 if(m_pFieldControl) 192 m_pFieldControl->paste(); 193 } 194 // ----------------------------------------------------------------------------- 195 196 197 198 199 200