1*96de5490SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*96de5490SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*96de5490SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*96de5490SAndrew Rist  * distributed with this work for additional information
6*96de5490SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*96de5490SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*96de5490SAndrew Rist  * "License"); you may not use this file except in compliance
9*96de5490SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*96de5490SAndrew Rist  *
11*96de5490SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*96de5490SAndrew Rist  *
13*96de5490SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*96de5490SAndrew Rist  * software distributed under the License is distributed on an
15*96de5490SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*96de5490SAndrew Rist  * KIND, either express or implied.  See the License for the
17*96de5490SAndrew Rist  * specific language governing permissions and limitations
18*96de5490SAndrew Rist  * under the License.
19*96de5490SAndrew Rist  *
20*96de5490SAndrew Rist  *************************************************************/
21*96de5490SAndrew Rist 
22*96de5490SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_dbaccess.hxx"
26cdf0e10cSrcweir #ifndef DBAUI_TABLEFIELDDESCGENPAGE_HXX
27cdf0e10cSrcweir #include "FieldDescGenWin.hxx"
28cdf0e10cSrcweir #endif
29cdf0e10cSrcweir #ifndef _TOOLS_DEBUG_HXX
30cdf0e10cSrcweir #include <tools/debug.hxx>
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #ifndef _DBA_DBACCESS_HELPID_HRC_
33cdf0e10cSrcweir #include "dbaccess_helpid.hrc"
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir #ifndef DBAUI_TABLEDESIGNHELPBAR_HXX
36cdf0e10cSrcweir #include "TableDesignHelpBar.hxx"
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir #ifndef DBAUI_TABLEFIELDCONTROL_HXX
39cdf0e10cSrcweir #include "TableFieldControl.hxx"
40cdf0e10cSrcweir #endif
41cdf0e10cSrcweir #ifndef DBAUI_TABLEDESIGNVIEW_HXX
42cdf0e10cSrcweir #include "TableDesignView.hxx"
43cdf0e10cSrcweir #endif
44cdf0e10cSrcweir #ifndef DBAUI_TABLEEDITORCONTROL_HXX
45cdf0e10cSrcweir #include "TEditControl.hxx"
46cdf0e10cSrcweir #endif
47cdf0e10cSrcweir using namespace dbaui;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir //==================================================================
50cdf0e10cSrcweir // class OFieldDescGenWin
51cdf0e10cSrcweir //==================================================================
52cdf0e10cSrcweir 
DBG_NAME(OFieldDescGenWin)53cdf0e10cSrcweir DBG_NAME(OFieldDescGenWin)
54cdf0e10cSrcweir //==================================================================
55cdf0e10cSrcweir //------------------------------------------------------------------------------
56cdf0e10cSrcweir OFieldDescGenWin::OFieldDescGenWin( Window* pParent, OTableDesignHelpBar* pHelp ) :
57cdf0e10cSrcweir 	 TabPage( pParent, WB_3DLOOK | WB_DIALOGCONTROL )
58cdf0e10cSrcweir {
59cdf0e10cSrcweir 	DBG_CTOR(OFieldDescGenWin,NULL);
60cdf0e10cSrcweir 	m_pFieldControl = new OTableFieldControl(this,pHelp);
61cdf0e10cSrcweir 	m_pFieldControl->SetHelpId(HID_TAB_DESIGN_FIELDCONTROL);
62cdf0e10cSrcweir 	m_pFieldControl->Show();
63cdf0e10cSrcweir }
64cdf0e10cSrcweir //------------------------------------------------------------------------------
~OFieldDescGenWin()65cdf0e10cSrcweir OFieldDescGenWin::~OFieldDescGenWin()
66cdf0e10cSrcweir {
67cdf0e10cSrcweir 	DBG_DTOR(OFieldDescGenWin,NULL);
68cdf0e10cSrcweir 	::std::auto_ptr<Window> aTemp(m_pFieldControl);
69cdf0e10cSrcweir 	m_pFieldControl = NULL;
70cdf0e10cSrcweir }
71cdf0e10cSrcweir //------------------------------------------------------------------------------
Init()72cdf0e10cSrcweir void OFieldDescGenWin::Init()
73cdf0e10cSrcweir {
74cdf0e10cSrcweir 	DBG_ASSERT(GetEditorCtrl() != NULL, "OFieldDescGenWin::Init : have no editor control !");
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	m_pFieldControl->Init();
77cdf0e10cSrcweir }
78cdf0e10cSrcweir //------------------------------------------------------------------------------
Resize()79cdf0e10cSrcweir void OFieldDescGenWin::Resize()
80cdf0e10cSrcweir {
81cdf0e10cSrcweir 	m_pFieldControl->SetPosSizePixel(Point(0,0),GetSizePixel());
82cdf0e10cSrcweir 	m_pFieldControl->Resize();
83cdf0e10cSrcweir }
84cdf0e10cSrcweir //------------------------------------------------------------------------------
SetReadOnly(sal_Bool bReadOnly)85cdf0e10cSrcweir void OFieldDescGenWin::SetReadOnly( sal_Bool bReadOnly )
86cdf0e10cSrcweir {
87cdf0e10cSrcweir 	DBG_CHKTHIS(OFieldDescGenWin,NULL);
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	m_pFieldControl->SetReadOnly(bReadOnly);
90cdf0e10cSrcweir }
91cdf0e10cSrcweir //------------------------------------------------------------------------------
GetControlText(sal_uInt16 nControlId)92cdf0e10cSrcweir String OFieldDescGenWin::GetControlText( sal_uInt16 nControlId )
93cdf0e10cSrcweir {
94cdf0e10cSrcweir 	DBG_CHKTHIS(OFieldDescGenWin,NULL);
95cdf0e10cSrcweir 	return m_pFieldControl->GetControlText(nControlId);
96cdf0e10cSrcweir }
97cdf0e10cSrcweir //------------------------------------------------------------------------------
SetControlText(sal_uInt16 nControlId,const String & rText)98cdf0e10cSrcweir void OFieldDescGenWin::SetControlText( sal_uInt16 nControlId, const String& rText )
99cdf0e10cSrcweir {
100cdf0e10cSrcweir 	DBG_CHKTHIS(OFieldDescGenWin,NULL);
101cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
102cdf0e10cSrcweir 	// Texte der Controls setzen
103cdf0e10cSrcweir 	m_pFieldControl->SetControlText(nControlId,rText);
104cdf0e10cSrcweir }
105cdf0e10cSrcweir //------------------------------------------------------------------------------
DisplayData(OFieldDescription * pFieldDescr)106cdf0e10cSrcweir void OFieldDescGenWin::DisplayData( OFieldDescription* pFieldDescr )
107cdf0e10cSrcweir {
108cdf0e10cSrcweir 	DBG_CHKTHIS(OFieldDescGenWin,NULL);
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 	m_pFieldControl->DisplayData(pFieldDescr);
111cdf0e10cSrcweir }
112cdf0e10cSrcweir //------------------------------------------------------------------------------
113cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
GetEditorCtrl()114cdf0e10cSrcweir OTableEditorCtrl* OFieldDescGenWin::GetEditorCtrl()
115cdf0e10cSrcweir {
116cdf0e10cSrcweir 	DBG_CHKTHIS(OFieldDescGenWin,NULL);
117cdf0e10cSrcweir 	OTableDesignView* pDesignWin = static_cast<OTableDesignView*>(GetParent()->GetParent()->GetParent());
118cdf0e10cSrcweir 	return pDesignWin->GetEditorCtrl();
119cdf0e10cSrcweir }
120cdf0e10cSrcweir #endif
121cdf0e10cSrcweir //------------------------------------------------------------------------------
122cdf0e10cSrcweir //short OFieldDescGenWin::GetFormatCategory(OFieldDescription* pFieldDescr)
123cdf0e10cSrcweir //{
124cdf0e10cSrcweir //	return m_pFieldControl->GetFormatCategory(pFieldDescr);
125cdf0e10cSrcweir //}
126cdf0e10cSrcweir //------------------------------------------------------------------------------
SaveData(OFieldDescription * pFieldDescr)127cdf0e10cSrcweir void OFieldDescGenWin::SaveData( OFieldDescription* pFieldDescr )
128cdf0e10cSrcweir {
129cdf0e10cSrcweir 	DBG_CHKTHIS(OFieldDescGenWin,NULL);
130cdf0e10cSrcweir 	m_pFieldControl->SaveData(pFieldDescr);
131cdf0e10cSrcweir }
132cdf0e10cSrcweir //------------------------------------------------------------------------------
GetFocus()133cdf0e10cSrcweir void OFieldDescGenWin::GetFocus()
134cdf0e10cSrcweir {
135cdf0e10cSrcweir 	DBG_CHKTHIS(OFieldDescGenWin,NULL);
136cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
137cdf0e10cSrcweir 	// Setzt den Focus auf das zuletzt aktive Control
138cdf0e10cSrcweir 	TabPage::GetFocus();
139cdf0e10cSrcweir 	if(m_pFieldControl)
140cdf0e10cSrcweir 		m_pFieldControl->GetFocus();
141cdf0e10cSrcweir 
142cdf0e10cSrcweir }
143cdf0e10cSrcweir //------------------------------------------------------------------------------
LoseFocus()144cdf0e10cSrcweir void OFieldDescGenWin::LoseFocus()
145cdf0e10cSrcweir {
146cdf0e10cSrcweir 	DBG_CHKTHIS(OFieldDescGenWin,NULL);
147cdf0e10cSrcweir 	m_pFieldControl->LoseFocus();
148cdf0e10cSrcweir 	TabPage::LoseFocus();
149cdf0e10cSrcweir }
150cdf0e10cSrcweir //------------------------------------------------------------------
BoolStringPersistent(const String & rUIString) const151cdf0e10cSrcweir String OFieldDescGenWin::BoolStringPersistent(const String& rUIString) const
152cdf0e10cSrcweir {
153cdf0e10cSrcweir 	return m_pFieldControl->BoolStringPersistent(rUIString);
154cdf0e10cSrcweir }
155cdf0e10cSrcweir 
156cdf0e10cSrcweir //------------------------------------------------------------------
BoolStringUI(const String & rPersistentString) const157cdf0e10cSrcweir String OFieldDescGenWin::BoolStringUI(const String& rPersistentString) const
158cdf0e10cSrcweir {
159cdf0e10cSrcweir 	return m_pFieldControl->BoolStringUI(rPersistentString);
160cdf0e10cSrcweir }
161cdf0e10cSrcweir // -----------------------------------------------------------------------------
isCopyAllowed()162cdf0e10cSrcweir sal_Bool OFieldDescGenWin::isCopyAllowed()
163cdf0e10cSrcweir {
164cdf0e10cSrcweir 	return (m_pFieldControl && m_pFieldControl->isCutAllowed());
165cdf0e10cSrcweir }
166cdf0e10cSrcweir // -----------------------------------------------------------------------------
isCutAllowed()167cdf0e10cSrcweir sal_Bool OFieldDescGenWin::isCutAllowed()
168cdf0e10cSrcweir {
169cdf0e10cSrcweir 	return (m_pFieldControl && m_pFieldControl->isCutAllowed());
170cdf0e10cSrcweir }
171cdf0e10cSrcweir // -----------------------------------------------------------------------------
isPasteAllowed()172cdf0e10cSrcweir sal_Bool OFieldDescGenWin::isPasteAllowed()
173cdf0e10cSrcweir {
174cdf0e10cSrcweir 	return (m_pFieldControl && m_pFieldControl->isPasteAllowed());
175cdf0e10cSrcweir }
176cdf0e10cSrcweir // -----------------------------------------------------------------------------
cut()177cdf0e10cSrcweir void OFieldDescGenWin::cut()
178cdf0e10cSrcweir {
179cdf0e10cSrcweir 	if(m_pFieldControl)
180cdf0e10cSrcweir 		m_pFieldControl->cut();
181cdf0e10cSrcweir }
182cdf0e10cSrcweir // -----------------------------------------------------------------------------
copy()183cdf0e10cSrcweir void OFieldDescGenWin::copy()
184cdf0e10cSrcweir {
185cdf0e10cSrcweir 	if(m_pFieldControl)
186cdf0e10cSrcweir 		m_pFieldControl->copy();
187cdf0e10cSrcweir }
188cdf0e10cSrcweir // -----------------------------------------------------------------------------
paste()189cdf0e10cSrcweir void OFieldDescGenWin::paste()
190cdf0e10cSrcweir {
191cdf0e10cSrcweir 	if(m_pFieldControl)
192cdf0e10cSrcweir 		m_pFieldControl->paste();
193cdf0e10cSrcweir }
194cdf0e10cSrcweir // -----------------------------------------------------------------------------
195cdf0e10cSrcweir 
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 
200