Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "FieldDescGenWin.hxx"
21 : #include <osl/diagnose.h>
22 : #include "dbaccess_helpid.hrc"
23 : #include "TableDesignHelpBar.hxx"
24 : #include "TableFieldControl.hxx"
25 : #include "TableDesignView.hxx"
26 : #include "TEditControl.hxx"
27 : using namespace dbaui;
28 :
29 : //==================================================================
30 : // class OFieldDescGenWin
31 : //==================================================================
32 :
33 : DBG_NAME(OFieldDescGenWin)
34 : //==================================================================
35 : //------------------------------------------------------------------------------
36 0 : OFieldDescGenWin::OFieldDescGenWin( Window* pParent, OTableDesignHelpBar* pHelp ) :
37 0 : TabPage( pParent, WB_3DLOOK | WB_DIALOGCONTROL )
38 : {
39 : DBG_CTOR(OFieldDescGenWin,NULL);
40 0 : m_pFieldControl = new OTableFieldControl(this,pHelp);
41 0 : m_pFieldControl->SetHelpId(HID_TAB_DESIGN_FIELDCONTROL);
42 0 : m_pFieldControl->Show();
43 0 : }
44 : //------------------------------------------------------------------------------
45 0 : OFieldDescGenWin::~OFieldDescGenWin()
46 : {
47 : DBG_DTOR(OFieldDescGenWin,NULL);
48 0 : ::std::auto_ptr<Window> aTemp(m_pFieldControl);
49 0 : m_pFieldControl = NULL;
50 0 : }
51 : //------------------------------------------------------------------------------
52 0 : void OFieldDescGenWin::Init()
53 : {
54 : OSL_ENSURE(GetEditorCtrl() != NULL, "OFieldDescGenWin::Init : have no editor control !");
55 :
56 0 : m_pFieldControl->Init();
57 0 : }
58 : //------------------------------------------------------------------------------
59 0 : void OFieldDescGenWin::Resize()
60 : {
61 0 : m_pFieldControl->SetPosSizePixel(Point(0,0),GetSizePixel());
62 0 : m_pFieldControl->Resize();
63 0 : }
64 : //------------------------------------------------------------------------------
65 0 : void OFieldDescGenWin::SetReadOnly( sal_Bool bReadOnly )
66 : {
67 : DBG_CHKTHIS(OFieldDescGenWin,NULL);
68 :
69 0 : m_pFieldControl->SetReadOnly(bReadOnly);
70 0 : }
71 : //------------------------------------------------------------------------------
72 0 : String OFieldDescGenWin::GetControlText( sal_uInt16 nControlId )
73 : {
74 : DBG_CHKTHIS(OFieldDescGenWin,NULL);
75 0 : return m_pFieldControl->GetControlText(nControlId);
76 : }
77 : //------------------------------------------------------------------------------
78 0 : void OFieldDescGenWin::SetControlText( sal_uInt16 nControlId, const String& rText )
79 : {
80 : DBG_CHKTHIS(OFieldDescGenWin,NULL);
81 : //////////////////////////////////////////////////////////////////////
82 : // Texte der Controls setzen
83 0 : m_pFieldControl->SetControlText(nControlId,rText);
84 0 : }
85 : //------------------------------------------------------------------------------
86 0 : void OFieldDescGenWin::DisplayData( OFieldDescription* pFieldDescr )
87 : {
88 : DBG_CHKTHIS(OFieldDescGenWin,NULL);
89 :
90 0 : m_pFieldControl->DisplayData(pFieldDescr);
91 0 : }
92 : //------------------------------------------------------------------------------
93 : #if OSL_DEBUG_LEVEL > 0
94 : OTableEditorCtrl* OFieldDescGenWin::GetEditorCtrl()
95 : {
96 : DBG_CHKTHIS(OFieldDescGenWin,NULL);
97 : OTableDesignView* pDesignWin = static_cast<OTableDesignView*>(GetParent()->GetParent()->GetParent());
98 : return pDesignWin->GetEditorCtrl();
99 : }
100 : #endif
101 : //------------------------------------------------------------------------------
102 0 : void OFieldDescGenWin::SaveData( OFieldDescription* pFieldDescr )
103 : {
104 : DBG_CHKTHIS(OFieldDescGenWin,NULL);
105 0 : m_pFieldControl->SaveData(pFieldDescr);
106 0 : }
107 : //------------------------------------------------------------------------------
108 0 : void OFieldDescGenWin::GetFocus()
109 : {
110 : DBG_CHKTHIS(OFieldDescGenWin,NULL);
111 : //////////////////////////////////////////////////////////////////////
112 : // Setzt den Focus auf das zuletzt aktive Control
113 0 : TabPage::GetFocus();
114 0 : if(m_pFieldControl)
115 0 : m_pFieldControl->GetFocus();
116 :
117 0 : }
118 : //------------------------------------------------------------------------------
119 0 : void OFieldDescGenWin::LoseFocus()
120 : {
121 : DBG_CHKTHIS(OFieldDescGenWin,NULL);
122 0 : m_pFieldControl->LoseFocus();
123 0 : TabPage::LoseFocus();
124 0 : }
125 : //------------------------------------------------------------------
126 0 : String OFieldDescGenWin::BoolStringPersistent(const String& rUIString) const
127 : {
128 0 : return m_pFieldControl->BoolStringPersistent(rUIString);
129 : }
130 :
131 : //------------------------------------------------------------------
132 0 : String OFieldDescGenWin::BoolStringUI(const String& rPersistentString) const
133 : {
134 0 : return m_pFieldControl->BoolStringUI(rPersistentString);
135 : }
136 : // -----------------------------------------------------------------------------
137 0 : sal_Bool OFieldDescGenWin::isCopyAllowed()
138 : {
139 0 : return (m_pFieldControl && m_pFieldControl->isCutAllowed());
140 : }
141 : // -----------------------------------------------------------------------------
142 0 : sal_Bool OFieldDescGenWin::isCutAllowed()
143 : {
144 0 : return (m_pFieldControl && m_pFieldControl->isCutAllowed());
145 : }
146 : // -----------------------------------------------------------------------------
147 0 : sal_Bool OFieldDescGenWin::isPasteAllowed()
148 : {
149 0 : return (m_pFieldControl && m_pFieldControl->isPasteAllowed());
150 : }
151 : // -----------------------------------------------------------------------------
152 0 : void OFieldDescGenWin::cut()
153 : {
154 0 : if(m_pFieldControl)
155 0 : m_pFieldControl->cut();
156 0 : }
157 : // -----------------------------------------------------------------------------
158 0 : void OFieldDescGenWin::copy()
159 : {
160 0 : if(m_pFieldControl)
161 0 : m_pFieldControl->copy();
162 0 : }
163 : // -----------------------------------------------------------------------------
164 0 : void OFieldDescGenWin::paste()
165 : {
166 0 : if(m_pFieldControl)
167 0 : m_pFieldControl->paste();
168 0 : }
169 : // -----------------------------------------------------------------------------
170 :
171 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|