2010-10-12 15:59:03 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-09-27 13:52:10 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2000-10-26 13:46:14 +00:00
|
|
|
|
2000-10-31 11:50:30 +00:00
|
|
|
#include "dbtreeview.hxx"
|
2012-10-11 16:13:12 -04:00
|
|
|
#include <svtools/treelistbox.hxx>
|
2000-10-26 13:46:14 +00:00
|
|
|
#include "dbtreelistbox.hxx"
|
|
|
|
#include "dbtreemodel.hxx"
|
2000-12-01 10:51:05 +00:00
|
|
|
#include "dbaccess_helpid.hrc"
|
2000-10-26 13:46:14 +00:00
|
|
|
|
2000-11-10 12:53:55 +00:00
|
|
|
namespace dbaui
|
|
|
|
{
|
|
|
|
|
2000-12-08 20:23:41 +00:00
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::lang;
|
2000-10-26 13:46:14 +00:00
|
|
|
|
2001-07-12 07:42:16 +00:00
|
|
|
DBG_NAME(DBTreeView)
|
2000-11-10 12:53:55 +00:00
|
|
|
// class DBTreeView
|
2013-01-04 13:38:11 +02:00
|
|
|
DBTreeView::DBTreeView( Window* pParent, WinBits nBits)
|
2000-10-26 13:46:14 +00:00
|
|
|
: Window( pParent, nBits )
|
|
|
|
, m_pTreeListBox(NULL)
|
|
|
|
{
|
2001-07-03 11:54:05 +00:00
|
|
|
DBG_CTOR(DBTreeView,NULL);
|
|
|
|
|
2013-01-04 13:38:11 +02:00
|
|
|
m_pTreeListBox = new DBTreeListBox(this, WB_BORDER | WB_HASLINES | WB_HASLINESATROOT | WB_HASBUTTONS | WB_HSCROLL |WB_HASBUTTONSATROOT);
|
2000-10-26 13:46:14 +00:00
|
|
|
m_pTreeListBox->EnableCheckButton(NULL);
|
|
|
|
m_pTreeListBox->SetDragDropMode( 0 );
|
2001-09-25 12:28:23 +00:00
|
|
|
m_pTreeListBox->EnableInplaceEditing( sal_True );
|
2010-07-10 18:21:24 +02:00
|
|
|
m_pTreeListBox->SetHelpId(HID_TLB_TREELISTBOX);
|
2000-10-26 13:46:14 +00:00
|
|
|
m_pTreeListBox->Show();
|
|
|
|
}
|
|
|
|
|
|
|
|
DBTreeView::~DBTreeView()
|
|
|
|
{
|
2004-08-02 14:33:37 +00:00
|
|
|
DBG_DTOR(DBTreeView,NULL);
|
2000-11-06 16:44:28 +00:00
|
|
|
if (m_pTreeListBox)
|
2000-10-26 13:46:14 +00:00
|
|
|
{
|
2000-11-06 16:44:28 +00:00
|
|
|
if (m_pTreeListBox->GetModel())
|
|
|
|
{
|
|
|
|
m_pTreeListBox->GetModel()->RemoveView(m_pTreeListBox);
|
|
|
|
m_pTreeListBox->DisconnectFromModel();
|
|
|
|
}
|
2004-08-02 14:33:37 +00:00
|
|
|
::std::auto_ptr<Window> aTemp(m_pTreeListBox);
|
2001-09-06 11:40:39 +00:00
|
|
|
m_pTreeListBox = NULL;
|
2000-10-26 13:46:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-11-09 06:36:15 +00:00
|
|
|
void DBTreeView::SetPreExpandHandler(const Link& _rHdl)
|
|
|
|
{
|
|
|
|
m_pTreeListBox->SetPreExpandHandler(_rHdl);
|
|
|
|
}
|
|
|
|
|
2001-07-18 10:34:19 +00:00
|
|
|
void DBTreeView::setCopyHandler(const Link& _rHdl)
|
|
|
|
{
|
|
|
|
m_pTreeListBox->setCopyHandler(_rHdl);
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2000-10-26 13:46:14 +00:00
|
|
|
void DBTreeView::Resize()
|
|
|
|
{
|
|
|
|
Window::Resize();
|
|
|
|
m_pTreeListBox->SetPosSizePixel(Point(0,0),GetOutputSizePixel());
|
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2012-10-19 15:20:10 +02:00
|
|
|
void DBTreeView::setModel(SvTreeList* _pTreeModel)
|
2000-10-26 13:46:14 +00:00
|
|
|
{
|
2000-11-06 16:44:28 +00:00
|
|
|
if (_pTreeModel)
|
|
|
|
_pTreeModel->InsertView(m_pTreeListBox);
|
2000-10-26 13:46:14 +00:00
|
|
|
m_pTreeListBox->SetModel(_pTreeModel);
|
|
|
|
}
|
2000-11-09 06:36:15 +00:00
|
|
|
|
2008-12-01 12:31:27 +00:00
|
|
|
void DBTreeView::setSelChangeHdl( const Link& _rHdl )
|
2000-10-26 13:46:14 +00:00
|
|
|
{
|
2008-12-01 12:31:27 +00:00
|
|
|
m_pTreeListBox->SetSelChangeHdl( _rHdl );
|
2000-10-26 13:46:14 +00:00
|
|
|
}
|
2013-08-17 23:43:14 +02:00
|
|
|
|
2002-05-02 06:14:29 +00:00
|
|
|
void DBTreeView::GetFocus()
|
2001-03-19 11:43:13 +00:00
|
|
|
{
|
2002-05-02 06:14:29 +00:00
|
|
|
Window::GetFocus();
|
|
|
|
if ( m_pTreeListBox )//&& !m_pTreeListBox->HasChildPathFocus())
|
2001-03-19 11:43:13 +00:00
|
|
|
m_pTreeListBox->GrabFocus();
|
|
|
|
}
|
2000-11-09 06:36:15 +00:00
|
|
|
|
2000-11-10 12:53:55 +00:00
|
|
|
} // namespace dbaui
|
|
|
|
|
2010-10-12 15:59:03 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|