merge the formfield patch from ooo-build
[ooovba.git] / dbaccess / source / ui / browser / dbtreeview.cxx
blob1100b0df51aaa118e8cedc146e36f9c42c75ae12
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dbtreeview.cxx,v $
10 * $Revision: 1.23 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
34 #ifndef DBACCESS_UI_DBTREEVIEW_HXX
35 #include "dbtreeview.hxx"
36 #endif
37 #ifndef _SVTREEBOX_HXX
38 #include <svtools/svtreebx.hxx>
39 #endif
40 #ifndef DBAUI_DBTREELISTBOX_HXX
41 #include "dbtreelistbox.hxx"
42 #endif
43 #ifndef DBAUI_DBTREEMODEL_HXX
44 #include "dbtreemodel.hxx"
45 #endif
46 #include "dbaccess_helpid.hrc"
48 // .........................................................................
49 namespace dbaui
51 // .........................................................................
53 using namespace ::com::sun::star::uno;
54 using namespace ::com::sun::star::lang;
56 DBG_NAME(DBTreeView)
57 //========================================================================
58 // class DBTreeView
59 //========================================================================
60 DBTreeView::DBTreeView( Window* pParent, const Reference< XMultiServiceFactory >& _rxORB, WinBits nBits)
61 : Window( pParent, nBits )
62 , m_pTreeListBox(NULL)
64 DBG_CTOR(DBTreeView,NULL);
66 m_pTreeListBox = new DBTreeListBox(this, _rxORB ,WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT);
67 m_pTreeListBox->EnableCheckButton(NULL);
68 m_pTreeListBox->SetDragDropMode( 0 );
69 m_pTreeListBox->EnableInplaceEditing( sal_True );
70 m_pTreeListBox->SetHelpId(HID_TLB_TREELISTBOX);
71 m_pTreeListBox->Show();
74 // -----------------------------------------------------------------------------
76 DBTreeView::~DBTreeView()
78 DBG_DTOR(DBTreeView,NULL);
79 if (m_pTreeListBox)
81 if (m_pTreeListBox->GetModel())
83 m_pTreeListBox->GetModel()->RemoveView(m_pTreeListBox);
84 m_pTreeListBox->DisconnectFromModel();
86 ::std::auto_ptr<Window> aTemp(m_pTreeListBox);
87 m_pTreeListBox = NULL;
91 // -----------------------------------------------------------------------------
92 void DBTreeView::SetPreExpandHandler(const Link& _rHdl)
94 m_pTreeListBox->SetPreExpandHandler(_rHdl);
97 // -----------------------------------------------------------------------------
98 void DBTreeView::setCopyHandler(const Link& _rHdl)
100 m_pTreeListBox->setCopyHandler(_rHdl);
102 // -----------------------------------------------------------------------------
103 void DBTreeView::Resize()
105 Window::Resize();
106 m_pTreeListBox->SetPosSizePixel(Point(0,0),GetOutputSizePixel());
108 // -------------------------------------------------------------------------
109 void DBTreeView::setModel(SvLBoxTreeList* _pTreeModel)
111 if (_pTreeModel)
112 _pTreeModel->InsertView(m_pTreeListBox);
113 m_pTreeListBox->SetModel(_pTreeModel);
116 // -------------------------------------------------------------------------
117 void DBTreeView::setSelChangeHdl( const Link& _rHdl )
119 m_pTreeListBox->SetSelChangeHdl( _rHdl );
121 // -----------------------------------------------------------------------------
122 void DBTreeView::GetFocus()
124 Window::GetFocus();
125 if ( m_pTreeListBox )//&& !m_pTreeListBox->HasChildPathFocus())
126 m_pTreeListBox->GrabFocus();
130 // .........................................................................
131 } // namespace dbaui
132 // .........................................................................