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