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 2 : DBTreeView::DBTreeView( vcl::Window* pParent, WinBits nBits)
35 : : Window( pParent, nBits )
36 2 : , m_pTreeListBox(NULL)
37 : {
38 :
39 2 : m_pTreeListBox = new DBTreeListBox(this, WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT);
40 2 : m_pTreeListBox->EnableCheckButton(NULL);
41 2 : m_pTreeListBox->SetDragDropMode( 0 );
42 2 : m_pTreeListBox->EnableInplaceEditing( true );
43 2 : m_pTreeListBox->SetHelpId(HID_TLB_TREELISTBOX);
44 2 : m_pTreeListBox->Show();
45 2 : }
46 :
47 6 : DBTreeView::~DBTreeView()
48 : {
49 2 : if (m_pTreeListBox)
50 : {
51 2 : if (m_pTreeListBox->GetModel())
52 : {
53 2 : m_pTreeListBox->GetModel()->RemoveView(m_pTreeListBox);
54 2 : m_pTreeListBox->DisconnectFromModel();
55 : }
56 2 : boost::scoped_ptr<vcl::Window> aTemp(m_pTreeListBox);
57 2 : m_pTreeListBox = NULL;
58 : }
59 4 : }
60 :
61 2 : void DBTreeView::SetPreExpandHandler(const Link& _rHdl)
62 : {
63 2 : m_pTreeListBox->SetPreExpandHandler(_rHdl);
64 2 : }
65 :
66 2 : void DBTreeView::setCopyHandler(const Link& _rHdl)
67 : {
68 2 : m_pTreeListBox->setCopyHandler(_rHdl);
69 2 : }
70 :
71 14 : void DBTreeView::Resize()
72 : {
73 14 : Window::Resize();
74 14 : m_pTreeListBox->SetPosSizePixel(Point(0,0),GetOutputSizePixel());
75 14 : }
76 :
77 2 : void DBTreeView::setModel(SvTreeList* _pTreeModel)
78 : {
79 2 : if (_pTreeModel)
80 2 : _pTreeModel->InsertView(m_pTreeListBox);
81 2 : m_pTreeListBox->SetModel(_pTreeModel);
82 2 : }
83 :
84 2 : void DBTreeView::setSelChangeHdl( const Link& _rHdl )
85 : {
86 2 : m_pTreeListBox->SetSelChangeHdl( _rHdl );
87 2 : }
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 72 : } // namespace dbaui
97 :
98 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|