1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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
;
30 // class OFieldDescGenWin
31 OFieldDescGenWin::OFieldDescGenWin( vcl::Window
* pParent
, OTableDesignHelpBar
* pHelp
) :
32 TabPage( pParent
, WB_3DLOOK
| WB_DIALOGCONTROL
)
34 m_pFieldControl
= VclPtr
<OTableFieldControl
>::Create(this,pHelp
);
35 m_pFieldControl
->SetHelpId(HID_TAB_DESIGN_FIELDCONTROL
);
36 m_pFieldControl
->Show();
39 OFieldDescGenWin::~OFieldDescGenWin()
44 void OFieldDescGenWin::dispose()
46 m_pFieldControl
.disposeAndClear();
50 void OFieldDescGenWin::Init()
52 OSL_ENSURE(GetEditorCtrl() != NULL
, "OFieldDescGenWin::Init : have no editor control !");
54 m_pFieldControl
->Init();
57 void OFieldDescGenWin::Resize()
59 m_pFieldControl
->SetPosSizePixel(Point(0,0),GetSizePixel());
60 m_pFieldControl
->Resize();
63 void OFieldDescGenWin::SetReadOnly( bool bReadOnly
)
66 m_pFieldControl
->SetReadOnly(bReadOnly
);
69 OUString
OFieldDescGenWin::GetControlText( sal_uInt16 nControlId
)
71 return m_pFieldControl
->GetControlText(nControlId
);
74 void OFieldDescGenWin::SetControlText( sal_uInt16 nControlId
, const OUString
& rText
)
76 // set texts of the controls
77 m_pFieldControl
->SetControlText(nControlId
,rText
);
80 void OFieldDescGenWin::DisplayData( OFieldDescription
* pFieldDescr
)
82 m_pFieldControl
->DisplayData(pFieldDescr
);
85 #if OSL_DEBUG_LEVEL > 0
86 OTableEditorCtrl
* OFieldDescGenWin::GetEditorCtrl()
88 OTableDesignView
* pDesignWin
= static_cast<OTableDesignView
*>(GetParent()->GetParent()->GetParent());
89 return pDesignWin
->GetEditorCtrl();
93 void OFieldDescGenWin::SaveData( OFieldDescription
* pFieldDescr
)
95 m_pFieldControl
->SaveData(pFieldDescr
);
98 void OFieldDescGenWin::GetFocus()
100 // sets the focus to the control that was active last
103 m_pFieldControl
->GetFocus();
107 void OFieldDescGenWin::LoseFocus()
110 m_pFieldControl
->LoseFocus();
111 TabPage::LoseFocus();
114 OUString
OFieldDescGenWin::BoolStringPersistent(const OUString
& rUIString
) const
116 return m_pFieldControl
->BoolStringPersistent(rUIString
);
119 OUString
OFieldDescGenWin::BoolStringUI(const OUString
& rPersistentString
) const
121 return m_pFieldControl
->BoolStringUI(rPersistentString
);
124 bool OFieldDescGenWin::isCopyAllowed()
126 return (m_pFieldControl
&& m_pFieldControl
->isCutAllowed());
129 bool OFieldDescGenWin::isCutAllowed()
131 return (m_pFieldControl
&& m_pFieldControl
->isCutAllowed());
134 bool OFieldDescGenWin::isPasteAllowed()
136 return (m_pFieldControl
&& m_pFieldControl
->isPasteAllowed());
139 void OFieldDescGenWin::cut()
142 m_pFieldControl
->cut();
145 void OFieldDescGenWin::copy()
148 m_pFieldControl
->copy();
151 void OFieldDescGenWin::paste()
154 m_pFieldControl
->paste();
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */