1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "TableFieldDescWin.hxx"
#include <FieldDescriptions.hxx>
#include <strings.hrc>
#include <TableDesignHelpBar.hxx>
#include <helpids.h>
#include <core_resource.hxx>
using namespace dbaui;
OTableFieldDescWin::OTableFieldDescWin(weld::Container* pParent, OTableDesignView* pView)
: OChildWindow(pParent, "dbaccess/ui/fielddescpanel.ui", "FieldDescPanel")
, m_xHelpBar(new OTableDesignHelpBar(m_xBuilder->weld_text_view("textview")))
, m_xBox(m_xBuilder->weld_container("box"))
, m_xFieldControl(new OTableFieldControl(m_xBox.get(), m_xHelpBar.get(), pView))
, m_xHeader(m_xBuilder->weld_label("header"))
, m_eChildFocus(NONE)
{
// Header
m_xHeader->set_label(DBA_RES(STR_TAB_PROPERTIES));
m_xFieldControl->SetHelpId(HID_TAB_DESIGN_FIELDCONTROL);
m_xHelpBar->connect_focus_in(LINK(this, OTableFieldDescWin, HelpFocusIn));
m_xFieldControl->connect_focus_in(LINK(this, OTableFieldDescWin, FieldFocusIn));
}
bool OTableFieldDescWin::HasChildPathFocus() const
{
return m_xFieldControl->HasChildPathFocus() || m_xHelpBar->HasFocus();
}
OTableFieldDescWin::~OTableFieldDescWin()
{
}
void OTableFieldDescWin::Init()
{
m_xFieldControl->Init();
}
void OTableFieldDescWin::SetReadOnly( bool bRead )
{
m_xFieldControl->SetReadOnly( bRead );
}
void OTableFieldDescWin::DisplayData( OFieldDescription* pFieldDescr )
{
m_xFieldControl->DisplayData( pFieldDescr );
}
void OTableFieldDescWin::SaveData( OFieldDescription* pFieldDescr )
{
m_xFieldControl->SaveData( pFieldDescr );
}
IClipboardTest* OTableFieldDescWin::getActiveChild() const
{
IClipboardTest* pTest = nullptr;
switch(m_eChildFocus)
{
case DESCRIPTION:
pTest = m_xFieldControl.get();
break;
default:
pTest = m_xHelpBar.get();
break;
}
return pTest;
}
bool OTableFieldDescWin::isCopyAllowed()
{
return getActiveChild() && getActiveChild()->isCopyAllowed();
}
bool OTableFieldDescWin::isCutAllowed()
{
return getActiveChild() && getActiveChild()->isCutAllowed();
}
bool OTableFieldDescWin::isPasteAllowed()
{
return getActiveChild() && getActiveChild()->isPasteAllowed();
}
void OTableFieldDescWin::cut()
{
if (getActiveChild())
getActiveChild()->cut();
}
void OTableFieldDescWin::copy()
{
if ( getActiveChild() )
getActiveChild()->copy();
}
void OTableFieldDescWin::paste()
{
if (getActiveChild())
getActiveChild()->paste();
}
void OTableFieldDescWin::GrabFocus()
{
m_xFieldControl->GrabFocus();
}
IMPL_LINK(OTableFieldDescWin, HelpFocusIn, weld::Widget&, rWidget, void)
{
m_eChildFocus = HELP;
m_aFocusInHdl.Call(rWidget);
}
IMPL_LINK(OTableFieldDescWin, FieldFocusIn, weld::Widget&, rWidget, void)
{
m_eChildFocus = DESCRIPTION;
m_aFocusInHdl.Call(rWidget);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|