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