Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "dbtreeview.hxx"
31 : : #include <svtools/svtreebx.hxx>
32 : : #include "dbtreelistbox.hxx"
33 : : #include "dbtreemodel.hxx"
34 : : #include "dbaccess_helpid.hrc"
35 : :
36 : : // .........................................................................
37 : : namespace dbaui
38 : : {
39 : : // .........................................................................
40 : :
41 : : using namespace ::com::sun::star::uno;
42 : : using namespace ::com::sun::star::lang;
43 : :
44 : : DBG_NAME(DBTreeView)
45 : : //========================================================================
46 : : // class DBTreeView
47 : : //========================================================================
48 : 2 : DBTreeView::DBTreeView( Window* pParent, const Reference< XMultiServiceFactory >& _rxORB, WinBits nBits)
49 : : : Window( pParent, nBits )
50 : 2 : , m_pTreeListBox(NULL)
51 : : {
52 : : DBG_CTOR(DBTreeView,NULL);
53 : :
54 [ + - ][ + - ]: 2 : m_pTreeListBox = new DBTreeListBox(this, _rxORB ,WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT);
55 [ + - ]: 2 : m_pTreeListBox->EnableCheckButton(NULL);
56 [ + - ]: 2 : m_pTreeListBox->SetDragDropMode( 0 );
57 [ + - ]: 2 : m_pTreeListBox->EnableInplaceEditing( sal_True );
58 [ + - ]: 2 : m_pTreeListBox->SetHelpId(HID_TLB_TREELISTBOX);
59 [ + - ]: 2 : m_pTreeListBox->Show();
60 : 2 : }
61 : :
62 : : // -----------------------------------------------------------------------------
63 : :
64 : 2 : DBTreeView::~DBTreeView()
65 : : {
66 : : DBG_DTOR(DBTreeView,NULL);
67 [ + - ]: 2 : if (m_pTreeListBox)
68 : : {
69 [ + - ]: 2 : if (m_pTreeListBox->GetModel())
70 : : {
71 [ + - ][ + - ]: 2 : m_pTreeListBox->GetModel()->RemoveView(m_pTreeListBox);
72 [ + - ]: 2 : m_pTreeListBox->DisconnectFromModel();
73 : : }
74 : 2 : ::std::auto_ptr<Window> aTemp(m_pTreeListBox);
75 [ + - ]: 2 : m_pTreeListBox = NULL;
76 : : }
77 [ - + ]: 4 : }
78 : :
79 : : // -----------------------------------------------------------------------------
80 : 2 : void DBTreeView::SetPreExpandHandler(const Link& _rHdl)
81 : : {
82 : 2 : m_pTreeListBox->SetPreExpandHandler(_rHdl);
83 : 2 : }
84 : :
85 : : // -----------------------------------------------------------------------------
86 : 2 : void DBTreeView::setCopyHandler(const Link& _rHdl)
87 : : {
88 : 2 : m_pTreeListBox->setCopyHandler(_rHdl);
89 : 2 : }
90 : : // -----------------------------------------------------------------------------
91 : 14 : void DBTreeView::Resize()
92 : : {
93 : 14 : Window::Resize();
94 [ + - ]: 14 : m_pTreeListBox->SetPosSizePixel(Point(0,0),GetOutputSizePixel());
95 : 14 : }
96 : : // -------------------------------------------------------------------------
97 : 2 : void DBTreeView::setModel(SvLBoxTreeList* _pTreeModel)
98 : : {
99 [ + - ]: 2 : if (_pTreeModel)
100 [ + - ]: 2 : _pTreeModel->InsertView(m_pTreeListBox);
101 : 2 : m_pTreeListBox->SetModel(_pTreeModel);
102 : 2 : }
103 : :
104 : : // -------------------------------------------------------------------------
105 : 2 : void DBTreeView::setSelChangeHdl( const Link& _rHdl )
106 : : {
107 : 2 : m_pTreeListBox->SetSelChangeHdl( _rHdl );
108 : 2 : }
109 : : // -----------------------------------------------------------------------------
110 : 0 : void DBTreeView::GetFocus()
111 : : {
112 : 0 : Window::GetFocus();
113 [ # # ]: 0 : if ( m_pTreeListBox )//&& !m_pTreeListBox->HasChildPathFocus())
114 : 0 : m_pTreeListBox->GrabFocus();
115 : 0 : }
116 : :
117 : :
118 : : // .........................................................................
119 : : } // namespace dbaui
120 : : // .........................................................................
121 : :
122 : :
123 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|