1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
30 #include "dbtreeview.hxx"
31 #include <svtools/svtreebx.hxx>
32 #include "dbtreelistbox.hxx"
33 #include "dbtreemodel.hxx"
34 #include "dbaccess_helpid.hrc"
36 // .........................................................................
39 // .........................................................................
41 using namespace ::com::sun::star::uno
;
42 using namespace ::com::sun::star::lang
;
45 //========================================================================
47 //========================================================================
48 DBTreeView::DBTreeView( Window
* pParent
, const Reference
< XMultiServiceFactory
>& _rxORB
, WinBits nBits
)
49 : Window( pParent
, nBits
)
50 , m_pTreeListBox(NULL
)
52 DBG_CTOR(DBTreeView
,NULL
);
54 m_pTreeListBox
= new DBTreeListBox(this, _rxORB
,WB_BORDER
| WB_HASLINES
| WB_HASLINESATROOT
| WB_HASBUTTONS
| WB_HSCROLL
|WB_HASBUTTONSATROOT
);
55 m_pTreeListBox
->EnableCheckButton(NULL
);
56 m_pTreeListBox
->SetDragDropMode( 0 );
57 m_pTreeListBox
->EnableInplaceEditing( sal_True
);
58 m_pTreeListBox
->SetHelpId(HID_TLB_TREELISTBOX
);
59 m_pTreeListBox
->Show();
62 // -----------------------------------------------------------------------------
64 DBTreeView::~DBTreeView()
66 DBG_DTOR(DBTreeView
,NULL
);
69 if (m_pTreeListBox
->GetModel())
71 m_pTreeListBox
->GetModel()->RemoveView(m_pTreeListBox
);
72 m_pTreeListBox
->DisconnectFromModel();
74 ::std::auto_ptr
<Window
> aTemp(m_pTreeListBox
);
75 m_pTreeListBox
= NULL
;
79 // -----------------------------------------------------------------------------
80 void DBTreeView::SetPreExpandHandler(const Link
& _rHdl
)
82 m_pTreeListBox
->SetPreExpandHandler(_rHdl
);
85 // -----------------------------------------------------------------------------
86 void DBTreeView::setCopyHandler(const Link
& _rHdl
)
88 m_pTreeListBox
->setCopyHandler(_rHdl
);
90 // -----------------------------------------------------------------------------
91 void DBTreeView::Resize()
94 m_pTreeListBox
->SetPosSizePixel(Point(0,0),GetOutputSizePixel());
96 // -------------------------------------------------------------------------
97 void DBTreeView::setModel(SvLBoxTreeList
* _pTreeModel
)
100 _pTreeModel
->InsertView(m_pTreeListBox
);
101 m_pTreeListBox
->SetModel(_pTreeModel
);
104 // -------------------------------------------------------------------------
105 void DBTreeView::setSelChangeHdl( const Link
& _rHdl
)
107 m_pTreeListBox
->SetSelChangeHdl( _rHdl
);
109 // -----------------------------------------------------------------------------
110 void DBTreeView::GetFocus()
113 if ( m_pTreeListBox
)//&& !m_pTreeListBox->HasChildPathFocus())
114 m_pTreeListBox
->GrabFocus();
118 // .........................................................................
120 // .........................................................................
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */