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