196de5490SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
396de5490SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
496de5490SAndrew Rist * or more contributor license agreements. See the NOTICE file
596de5490SAndrew Rist * distributed with this work for additional information
696de5490SAndrew Rist * regarding copyright ownership. The ASF licenses this file
796de5490SAndrew Rist * to you under the Apache License, Version 2.0 (the
896de5490SAndrew Rist * "License"); you may not use this file except in compliance
996de5490SAndrew Rist * with the License. You may obtain a copy of the License at
1096de5490SAndrew Rist *
1196de5490SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
1296de5490SAndrew Rist *
1396de5490SAndrew Rist * Unless required by applicable law or agreed to in writing,
1496de5490SAndrew Rist * software distributed under the License is distributed on an
1596de5490SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1696de5490SAndrew Rist * KIND, either express or implied. See the License for the
1796de5490SAndrew Rist * specific language governing permissions and limitations
1896de5490SAndrew Rist * under the License.
1996de5490SAndrew Rist *
2096de5490SAndrew Rist *************************************************************/
2196de5490SAndrew Rist
2296de5490SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25*b63233d8Sdamjan #include "precompiled_dbui.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #ifndef DBACCESS_UI_DBTREEVIEW_HXX
28cdf0e10cSrcweir #include "dbtreeview.hxx"
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #ifndef _SVTREEBOX_HXX
31cdf0e10cSrcweir #include <svtools/svtreebx.hxx>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef DBAUI_DBTREELISTBOX_HXX
34cdf0e10cSrcweir #include "dbtreelistbox.hxx"
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #ifndef DBAUI_DBTREEMODEL_HXX
37cdf0e10cSrcweir #include "dbtreemodel.hxx"
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #include "dbaccess_helpid.hrc"
40cdf0e10cSrcweir
41cdf0e10cSrcweir // .........................................................................
42cdf0e10cSrcweir namespace dbaui
43cdf0e10cSrcweir {
44cdf0e10cSrcweir // .........................................................................
45cdf0e10cSrcweir
46cdf0e10cSrcweir using namespace ::com::sun::star::uno;
47cdf0e10cSrcweir using namespace ::com::sun::star::lang;
48cdf0e10cSrcweir
DBG_NAME(DBTreeView)49cdf0e10cSrcweir DBG_NAME(DBTreeView)
50cdf0e10cSrcweir //========================================================================
51cdf0e10cSrcweir // class DBTreeView
52cdf0e10cSrcweir //========================================================================
53cdf0e10cSrcweir DBTreeView::DBTreeView( Window* pParent, const Reference< XMultiServiceFactory >& _rxORB, WinBits nBits)
54cdf0e10cSrcweir : Window( pParent, nBits )
55cdf0e10cSrcweir , m_pTreeListBox(NULL)
56cdf0e10cSrcweir {
57cdf0e10cSrcweir DBG_CTOR(DBTreeView,NULL);
58cdf0e10cSrcweir
59cdf0e10cSrcweir m_pTreeListBox = new DBTreeListBox(this, _rxORB ,WB_HASLINES | WB_SORT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT,sal_True);
60cdf0e10cSrcweir m_pTreeListBox->EnableCheckButton(NULL);
61cdf0e10cSrcweir m_pTreeListBox->SetDragDropMode( 0 );
62cdf0e10cSrcweir m_pTreeListBox->EnableInplaceEditing( sal_True );
63cdf0e10cSrcweir m_pTreeListBox->SetHelpId(HID_TLB_TREELISTBOX);
64cdf0e10cSrcweir m_pTreeListBox->Show();
65cdf0e10cSrcweir }
66cdf0e10cSrcweir
67cdf0e10cSrcweir // -----------------------------------------------------------------------------
68cdf0e10cSrcweir
~DBTreeView()69cdf0e10cSrcweir DBTreeView::~DBTreeView()
70cdf0e10cSrcweir {
71cdf0e10cSrcweir DBG_DTOR(DBTreeView,NULL);
72cdf0e10cSrcweir if (m_pTreeListBox)
73cdf0e10cSrcweir {
74cdf0e10cSrcweir if (m_pTreeListBox->GetModel())
75cdf0e10cSrcweir {
76cdf0e10cSrcweir m_pTreeListBox->GetModel()->RemoveView(m_pTreeListBox);
77cdf0e10cSrcweir m_pTreeListBox->DisconnectFromModel();
78cdf0e10cSrcweir }
79cdf0e10cSrcweir ::std::auto_ptr<Window> aTemp(m_pTreeListBox);
80cdf0e10cSrcweir m_pTreeListBox = NULL;
81cdf0e10cSrcweir }
82cdf0e10cSrcweir }
83cdf0e10cSrcweir
84cdf0e10cSrcweir // -----------------------------------------------------------------------------
SetPreExpandHandler(const Link & _rHdl)85cdf0e10cSrcweir void DBTreeView::SetPreExpandHandler(const Link& _rHdl)
86cdf0e10cSrcweir {
87cdf0e10cSrcweir m_pTreeListBox->SetPreExpandHandler(_rHdl);
88cdf0e10cSrcweir }
89cdf0e10cSrcweir
90cdf0e10cSrcweir // -----------------------------------------------------------------------------
setCopyHandler(const Link & _rHdl)91cdf0e10cSrcweir void DBTreeView::setCopyHandler(const Link& _rHdl)
92cdf0e10cSrcweir {
93cdf0e10cSrcweir m_pTreeListBox->setCopyHandler(_rHdl);
94cdf0e10cSrcweir }
95cdf0e10cSrcweir // -----------------------------------------------------------------------------
Resize()96cdf0e10cSrcweir void DBTreeView::Resize()
97cdf0e10cSrcweir {
98cdf0e10cSrcweir Window::Resize();
99cdf0e10cSrcweir m_pTreeListBox->SetPosSizePixel(Point(0,0),GetOutputSizePixel());
100cdf0e10cSrcweir }
101cdf0e10cSrcweir // -------------------------------------------------------------------------
setModel(SvLBoxTreeList * _pTreeModel)102cdf0e10cSrcweir void DBTreeView::setModel(SvLBoxTreeList* _pTreeModel)
103cdf0e10cSrcweir {
104cdf0e10cSrcweir if (_pTreeModel)
105cdf0e10cSrcweir _pTreeModel->InsertView(m_pTreeListBox);
106cdf0e10cSrcweir m_pTreeListBox->SetModel(_pTreeModel);
107cdf0e10cSrcweir }
108cdf0e10cSrcweir
109cdf0e10cSrcweir // -------------------------------------------------------------------------
setSelChangeHdl(const Link & _rHdl)110cdf0e10cSrcweir void DBTreeView::setSelChangeHdl( const Link& _rHdl )
111cdf0e10cSrcweir {
112cdf0e10cSrcweir m_pTreeListBox->SetSelChangeHdl( _rHdl );
113cdf0e10cSrcweir }
114cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetFocus()115cdf0e10cSrcweir void DBTreeView::GetFocus()
116cdf0e10cSrcweir {
117cdf0e10cSrcweir Window::GetFocus();
118cdf0e10cSrcweir if ( m_pTreeListBox )//&& !m_pTreeListBox->HasChildPathFocus())
119cdf0e10cSrcweir m_pTreeListBox->GrabFocus();
120cdf0e10cSrcweir }
121cdf0e10cSrcweir
122cdf0e10cSrcweir
123cdf0e10cSrcweir // .........................................................................
124cdf0e10cSrcweir } // namespace dbaui
125cdf0e10cSrcweir // .........................................................................
126cdf0e10cSrcweir
127cdf0e10cSrcweir
128