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 "dbtreeview.hxx"
21 : #include <svtools/treelistbox.hxx>
22 : #include "dbtreelistbox.hxx"
23 : #include "dbtreemodel.hxx"
24 : #include "dbaccess_helpid.hrc"
25 : #include <boost/scoped_ptr.hpp>
26 :
27 : namespace dbaui
28 : {
29 :
30 : using namespace ::com::sun::star::uno;
31 : using namespace ::com::sun::star::lang;
32 :
33 : // class DBTreeView
34 0 : DBTreeView::DBTreeView( Window* pParent, WinBits nBits)
35 : : Window( pParent, nBits )
36 0 : , m_pTreeListBox(NULL)
37 : {
38 :
39 0 : m_pTreeListBox = new DBTreeListBox(this, WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT);
40 0 : m_pTreeListBox->EnableCheckButton(NULL);
41 0 : m_pTreeListBox->SetDragDropMode( 0 );
42 0 : m_pTreeListBox->EnableInplaceEditing( true );
43 0 : m_pTreeListBox->SetHelpId(HID_TLB_TREELISTBOX);
44 0 : m_pTreeListBox->Show();
45 0 : }
46 :
47 0 : DBTreeView::~DBTreeView()
48 : {
49 0 : if (m_pTreeListBox)
50 : {
51 0 : if (m_pTreeListBox->GetModel())
52 : {
53 0 : m_pTreeListBox->GetModel()->RemoveView(m_pTreeListBox);
54 0 : m_pTreeListBox->DisconnectFromModel();
55 : }
56 0 : boost::scoped_ptr<Window> aTemp(m_pTreeListBox);
57 0 : m_pTreeListBox = NULL;
58 : }
59 0 : }
60 :
61 0 : void DBTreeView::SetPreExpandHandler(const Link& _rHdl)
62 : {
63 0 : m_pTreeListBox->SetPreExpandHandler(_rHdl);
64 0 : }
65 :
66 0 : void DBTreeView::setCopyHandler(const Link& _rHdl)
67 : {
68 0 : m_pTreeListBox->setCopyHandler(_rHdl);
69 0 : }
70 :
71 0 : void DBTreeView::Resize()
72 : {
73 0 : Window::Resize();
74 0 : m_pTreeListBox->SetPosSizePixel(Point(0,0),GetOutputSizePixel());
75 0 : }
76 :
77 0 : void DBTreeView::setModel(SvTreeList* _pTreeModel)
78 : {
79 0 : if (_pTreeModel)
80 0 : _pTreeModel->InsertView(m_pTreeListBox);
81 0 : m_pTreeListBox->SetModel(_pTreeModel);
82 0 : }
83 :
84 0 : void DBTreeView::setSelChangeHdl( const Link& _rHdl )
85 : {
86 0 : m_pTreeListBox->SetSelChangeHdl( _rHdl );
87 0 : }
88 :
89 0 : void DBTreeView::GetFocus()
90 : {
91 0 : Window::GetFocus();
92 0 : if ( m_pTreeListBox )//&& !m_pTreeListBox->HasChildPathFocus())
93 0 : m_pTreeListBox->GrabFocus();
94 0 : }
95 :
96 : } // namespace dbaui
97 :
98 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|