1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: FieldDescGenWin.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
33 #ifndef DBAUI_TABLEFIELDDESCGENPAGE_HXX
34 #include "FieldDescGenWin.hxx"
36 #ifndef _TOOLS_DEBUG_HXX
37 #include <tools/debug.hxx>
39 #ifndef _DBA_DBACCESS_HELPID_HRC_
40 #include "dbaccess_helpid.hrc"
42 #ifndef DBAUI_TABLEDESIGNHELPBAR_HXX
43 #include "TableDesignHelpBar.hxx"
45 #ifndef DBAUI_TABLEFIELDCONTROL_HXX
46 #include "TableFieldControl.hxx"
48 #ifndef DBAUI_TABLEDESIGNVIEW_HXX
49 #include "TableDesignView.hxx"
51 #ifndef DBAUI_TABLEEDITORCONTROL_HXX
52 #include "TEditControl.hxx"
54 using namespace dbaui
;
56 //==================================================================
57 // class OFieldDescGenWin
58 //==================================================================
60 DBG_NAME(OFieldDescGenWin
)
61 //==================================================================
62 //------------------------------------------------------------------------------
63 OFieldDescGenWin::OFieldDescGenWin( Window
* pParent
, OTableDesignHelpBar
* pHelp
) :
64 TabPage( pParent
, WB_3DLOOK
| WB_DIALOGCONTROL
)
66 DBG_CTOR(OFieldDescGenWin
,NULL
);
67 m_pFieldControl
= new OTableFieldControl(this,pHelp
);
68 m_pFieldControl
->SetHelpId(HID_TAB_DESIGN_FIELDCONTROL
);
69 m_pFieldControl
->Show();
71 //------------------------------------------------------------------------------
72 OFieldDescGenWin::~OFieldDescGenWin()
74 DBG_DTOR(OFieldDescGenWin
,NULL
);
75 ::std::auto_ptr
<Window
> aTemp(m_pFieldControl
);
76 m_pFieldControl
= NULL
;
78 //------------------------------------------------------------------------------
79 void OFieldDescGenWin::Init()
81 DBG_ASSERT(GetEditorCtrl() != NULL
, "OFieldDescGenWin::Init : have no editor control !");
83 m_pFieldControl
->Init();
85 //------------------------------------------------------------------------------
86 void OFieldDescGenWin::Resize()
88 m_pFieldControl
->SetPosSizePixel(Point(0,0),GetSizePixel());
89 m_pFieldControl
->Resize();
91 //------------------------------------------------------------------------------
92 void OFieldDescGenWin::SetReadOnly( sal_Bool bReadOnly
)
94 DBG_CHKTHIS(OFieldDescGenWin
,NULL
);
96 m_pFieldControl
->SetReadOnly(bReadOnly
);
98 //------------------------------------------------------------------------------
99 String
OFieldDescGenWin::GetControlText( sal_uInt16 nControlId
)
101 DBG_CHKTHIS(OFieldDescGenWin
,NULL
);
102 return m_pFieldControl
->GetControlText(nControlId
);
104 //------------------------------------------------------------------------------
105 void OFieldDescGenWin::SetControlText( sal_uInt16 nControlId
, const String
& rText
)
107 DBG_CHKTHIS(OFieldDescGenWin
,NULL
);
108 //////////////////////////////////////////////////////////////////////
109 // Texte der Controls setzen
110 m_pFieldControl
->SetControlText(nControlId
,rText
);
112 //------------------------------------------------------------------------------
113 void OFieldDescGenWin::DisplayData( OFieldDescription
* pFieldDescr
)
115 DBG_CHKTHIS(OFieldDescGenWin
,NULL
);
117 m_pFieldControl
->DisplayData(pFieldDescr
);
119 //------------------------------------------------------------------------------
120 #if OSL_DEBUG_LEVEL > 0
121 OTableEditorCtrl
* OFieldDescGenWin::GetEditorCtrl()
123 DBG_CHKTHIS(OFieldDescGenWin
,NULL
);
124 OTableDesignView
* pDesignWin
= static_cast<OTableDesignView
*>(GetParent()->GetParent()->GetParent());
125 return pDesignWin
->GetEditorCtrl();
128 //------------------------------------------------------------------------------
129 //short OFieldDescGenWin::GetFormatCategory(OFieldDescription* pFieldDescr)
131 // return m_pFieldControl->GetFormatCategory(pFieldDescr);
133 //------------------------------------------------------------------------------
134 void OFieldDescGenWin::SaveData( OFieldDescription
* pFieldDescr
)
136 DBG_CHKTHIS(OFieldDescGenWin
,NULL
);
137 m_pFieldControl
->SaveData(pFieldDescr
);
139 //------------------------------------------------------------------------------
140 void OFieldDescGenWin::GetFocus()
142 DBG_CHKTHIS(OFieldDescGenWin
,NULL
);
143 //////////////////////////////////////////////////////////////////////
144 // Setzt den Focus auf das zuletzt aktive Control
147 m_pFieldControl
->GetFocus();
150 //------------------------------------------------------------------------------
151 void OFieldDescGenWin::LoseFocus()
153 DBG_CHKTHIS(OFieldDescGenWin
,NULL
);
154 m_pFieldControl
->LoseFocus();
155 TabPage::LoseFocus();
157 //------------------------------------------------------------------
158 String
OFieldDescGenWin::BoolStringPersistent(const String
& rUIString
) const
160 return m_pFieldControl
->BoolStringPersistent(rUIString
);
163 //------------------------------------------------------------------
164 String
OFieldDescGenWin::BoolStringUI(const String
& rPersistentString
) const
166 return m_pFieldControl
->BoolStringUI(rPersistentString
);
168 // -----------------------------------------------------------------------------
169 sal_Bool
OFieldDescGenWin::isCopyAllowed()
171 return (m_pFieldControl
&& m_pFieldControl
->isCutAllowed());
173 // -----------------------------------------------------------------------------
174 sal_Bool
OFieldDescGenWin::isCutAllowed()
176 return (m_pFieldControl
&& m_pFieldControl
->isCutAllowed());
178 // -----------------------------------------------------------------------------
179 sal_Bool
OFieldDescGenWin::isPasteAllowed()
181 return (m_pFieldControl
&& m_pFieldControl
->isPasteAllowed());
183 // -----------------------------------------------------------------------------
184 void OFieldDescGenWin::cut()
187 m_pFieldControl
->cut();
189 // -----------------------------------------------------------------------------
190 void OFieldDescGenWin::copy()
193 m_pFieldControl
->copy();
195 // -----------------------------------------------------------------------------
196 void OFieldDescGenWin::paste()
199 m_pFieldControl
->paste();
201 // -----------------------------------------------------------------------------