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 : #include <boost/scoped_ptr.hpp>
28 : using namespace dbaui;
29 :
30 : // class OFieldDescGenWin
31 0 : OFieldDescGenWin::OFieldDescGenWin( vcl::Window* pParent, OTableDesignHelpBar* pHelp ) :
32 0 : TabPage( pParent, WB_3DLOOK | WB_DIALOGCONTROL )
33 : {
34 0 : m_pFieldControl = VclPtr<OTableFieldControl>::Create(this,pHelp);
35 0 : m_pFieldControl->SetHelpId(HID_TAB_DESIGN_FIELDCONTROL);
36 0 : m_pFieldControl->Show();
37 0 : }
38 :
39 0 : OFieldDescGenWin::~OFieldDescGenWin()
40 : {
41 0 : disposeOnce();
42 0 : }
43 :
44 0 : void OFieldDescGenWin::dispose()
45 : {
46 0 : m_pFieldControl.disposeAndClear();
47 0 : TabPage::dispose();
48 0 : }
49 :
50 0 : void OFieldDescGenWin::Init()
51 : {
52 : OSL_ENSURE(GetEditorCtrl() != NULL, "OFieldDescGenWin::Init : have no editor control !");
53 :
54 0 : m_pFieldControl->Init();
55 0 : }
56 :
57 0 : void OFieldDescGenWin::Resize()
58 : {
59 0 : m_pFieldControl->SetPosSizePixel(Point(0,0),GetSizePixel());
60 0 : m_pFieldControl->Resize();
61 0 : }
62 :
63 0 : void OFieldDescGenWin::SetReadOnly( bool bReadOnly )
64 : {
65 :
66 0 : m_pFieldControl->SetReadOnly(bReadOnly);
67 0 : }
68 :
69 0 : OUString OFieldDescGenWin::GetControlText( sal_uInt16 nControlId )
70 : {
71 0 : return m_pFieldControl->GetControlText(nControlId);
72 : }
73 :
74 0 : void OFieldDescGenWin::SetControlText( sal_uInt16 nControlId, const OUString& rText )
75 : {
76 : // set texts of the controls
77 0 : m_pFieldControl->SetControlText(nControlId,rText);
78 0 : }
79 :
80 0 : void OFieldDescGenWin::DisplayData( OFieldDescription* pFieldDescr )
81 : {
82 0 : m_pFieldControl->DisplayData(pFieldDescr);
83 0 : }
84 :
85 : #if OSL_DEBUG_LEVEL > 0
86 : OTableEditorCtrl* OFieldDescGenWin::GetEditorCtrl()
87 : {
88 : OTableDesignView* pDesignWin = static_cast<OTableDesignView*>(GetParent()->GetParent()->GetParent());
89 : return pDesignWin->GetEditorCtrl();
90 : }
91 :
92 : #endif
93 0 : void OFieldDescGenWin::SaveData( OFieldDescription* pFieldDescr )
94 : {
95 0 : m_pFieldControl->SaveData(pFieldDescr);
96 0 : }
97 :
98 0 : void OFieldDescGenWin::GetFocus()
99 : {
100 : // sets the focus to the control that was active last
101 0 : TabPage::GetFocus();
102 0 : if(m_pFieldControl)
103 0 : m_pFieldControl->GetFocus();
104 :
105 0 : }
106 :
107 0 : void OFieldDescGenWin::LoseFocus()
108 : {
109 0 : if (m_pFieldControl)
110 0 : m_pFieldControl->LoseFocus();
111 0 : TabPage::LoseFocus();
112 0 : }
113 :
114 0 : OUString OFieldDescGenWin::BoolStringPersistent(const OUString& rUIString) const
115 : {
116 0 : return m_pFieldControl->BoolStringPersistent(rUIString);
117 : }
118 :
119 0 : OUString OFieldDescGenWin::BoolStringUI(const OUString& rPersistentString) const
120 : {
121 0 : return m_pFieldControl->BoolStringUI(rPersistentString);
122 : }
123 :
124 0 : bool OFieldDescGenWin::isCopyAllowed()
125 : {
126 0 : return (m_pFieldControl && m_pFieldControl->isCutAllowed());
127 : }
128 :
129 0 : bool OFieldDescGenWin::isCutAllowed()
130 : {
131 0 : return (m_pFieldControl && m_pFieldControl->isCutAllowed());
132 : }
133 :
134 0 : bool OFieldDescGenWin::isPasteAllowed()
135 : {
136 0 : return (m_pFieldControl && m_pFieldControl->isPasteAllowed());
137 : }
138 :
139 0 : void OFieldDescGenWin::cut()
140 : {
141 0 : if(m_pFieldControl)
142 0 : m_pFieldControl->cut();
143 0 : }
144 :
145 0 : void OFieldDescGenWin::copy()
146 : {
147 0 : if(m_pFieldControl)
148 0 : m_pFieldControl->copy();
149 0 : }
150 :
151 0 : void OFieldDescGenWin::paste()
152 : {
153 0 : if(m_pFieldControl)
154 0 : m_pFieldControl->paste();
155 36 : }
156 :
157 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|