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 "TableFieldDescWin.hxx"
21 #include <FieldDescriptions.hxx>
22 #include <strings.hrc>
23 #include <TableDesignHelpBar.hxx>
25 #include <core_resource.hxx>
27 using namespace dbaui
;
29 OTableFieldDescWin::OTableFieldDescWin(weld::Container
* pParent
, OTableDesignView
* pView
)
30 : OChildWindow(pParent
, u
"dbaccess/ui/fielddescpanel.ui"_ustr
, u
"FieldDescPanel"_ustr
)
31 , m_aHelpBar(m_xBuilder
->weld_text_view(u
"textview"_ustr
))
32 , m_xBox(m_xBuilder
->weld_container(u
"box"_ustr
))
33 , m_xFieldControl(new OTableFieldControl(m_xBox
.get(), &m_aHelpBar
, pView
))
34 , m_xHeader(m_xBuilder
->weld_label(u
"header"_ustr
))
38 m_xHeader
->set_label(DBA_RES(STR_TAB_PROPERTIES
));
40 m_xFieldControl
->SetHelpId(HID_TAB_DESIGN_FIELDCONTROL
);
42 m_aHelpBar
.connect_focus_in(LINK(this, OTableFieldDescWin
, HelpFocusIn
));
43 m_xFieldControl
->connect_focus_in(LINK(this, OTableFieldDescWin
, FieldFocusIn
));
46 bool OTableFieldDescWin::HasChildPathFocus() const
48 return m_xFieldControl
->HasChildPathFocus() || m_aHelpBar
.HasFocus();
51 OTableFieldDescWin::~OTableFieldDescWin()
55 void OTableFieldDescWin::Init()
57 m_xFieldControl
->Init();
60 void OTableFieldDescWin::SetReadOnly( bool bRead
)
62 m_xFieldControl
->SetReadOnly( bRead
);
65 void OTableFieldDescWin::DisplayData( OFieldDescription
* pFieldDescr
)
67 m_xFieldControl
->DisplayData( pFieldDescr
);
70 void OTableFieldDescWin::SaveData( OFieldDescription
* pFieldDescr
)
72 m_xFieldControl
->SaveData( pFieldDescr
);
75 IClipboardTest
* OTableFieldDescWin::getActiveChild() const
77 IClipboardTest
* pTest
= nullptr;
81 pTest
= m_xFieldControl
.get();
84 pTest
= const_cast<OTableDesignHelpBar
*>(&m_aHelpBar
);
90 bool OTableFieldDescWin::isCopyAllowed()
92 return getActiveChild() && getActiveChild()->isCopyAllowed();
95 bool OTableFieldDescWin::isCutAllowed()
97 return getActiveChild() && getActiveChild()->isCutAllowed();
100 bool OTableFieldDescWin::isPasteAllowed()
102 return getActiveChild() && getActiveChild()->isPasteAllowed();
105 void OTableFieldDescWin::cut()
107 if (getActiveChild())
108 getActiveChild()->cut();
111 void OTableFieldDescWin::copy()
113 if ( getActiveChild() )
114 getActiveChild()->copy();
117 void OTableFieldDescWin::paste()
119 if (getActiveChild())
120 getActiveChild()->paste();
123 void OTableFieldDescWin::GrabFocus()
125 m_xFieldControl
->GrabFocus();
128 IMPL_LINK(OTableFieldDescWin
, HelpFocusIn
, weld::Widget
&, rWidget
, void)
130 m_eChildFocus
= HELP
;
131 m_aFocusInHdl
.Call(rWidget
);
134 IMPL_LINK(OTableFieldDescWin
, FieldFocusIn
, weld::Widget
&, rWidget
, void)
136 m_eChildFocus
= DESCRIPTION
;
137 m_aFocusInHdl
.Call(rWidget
);
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */