2001-09-20 11:59:25 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-08 13:28:14 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2001-09-20 11:59:25 +00:00
|
|
|
*
|
2005-09-08 13:28:14 +00:00
|
|
|
* $RCSfile: dsEntriesNoExp.cxx,v $
|
2001-09-20 11:59:25 +00:00
|
|
|
*
|
2006-06-20 01:57:13 +00:00
|
|
|
* $Revision: 1.15 $
|
2001-09-20 11:59:25 +00:00
|
|
|
*
|
2006-06-20 01:57:13 +00:00
|
|
|
* last change: $Author: hr $ $Date: 2006-06-20 02:57:13 $
|
2001-09-20 11:59:25 +00:00
|
|
|
*
|
2005-09-08 13:28:14 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2001-09-20 11:59:25 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-08 13:28:14 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2001-09-20 11:59:25 +00:00
|
|
|
*
|
2005-09-08 13:28:14 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2001-09-20 11:59:25 +00:00
|
|
|
*
|
2005-09-08 13:28:14 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2001-09-20 11:59:25 +00:00
|
|
|
*
|
2005-09-08 13:28:14 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2001-09-20 11:59:25 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _SBA_UNODATBR_HXX_
|
|
|
|
#include "unodatbr.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef DBACCESS_UI_BROWSER_ID_HXX
|
|
|
|
#include "browserids.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _DBAUI_LISTVIEWITEMS_HXX_
|
|
|
|
#include "listviewitems.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _TOOLS_DEBUG_HXX
|
|
|
|
#include <tools/debug.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef DBACCESS_UI_DBTREEVIEW_HXX
|
|
|
|
#include "dbtreeview.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef DBAUI_DBTREELISTBOX_HXX
|
|
|
|
#include "dbtreelistbox.hxx"
|
|
|
|
#endif
|
2002-08-19 06:32:53 +00:00
|
|
|
#ifndef _DBU_BRW_HRC_
|
|
|
|
#include "dbu_brw.hrc"
|
2001-09-20 11:59:25 +00:00
|
|
|
#endif
|
|
|
|
#ifndef DBAUI_DBTREEMODEL_HXX
|
|
|
|
#include "dbtreemodel.hxx"
|
|
|
|
#endif
|
|
|
|
|
2004-11-16 13:49:57 +00:00
|
|
|
using namespace ::com::sun::star::frame;
|
2001-09-20 11:59:25 +00:00
|
|
|
using namespace ::dbtools;
|
|
|
|
using namespace ::svx;
|
|
|
|
|
|
|
|
// .........................................................................
|
|
|
|
namespace dbaui
|
|
|
|
{
|
|
|
|
// .........................................................................
|
|
|
|
// -----------------------------------------------------------------------------
|
2002-02-08 07:49:11 +00:00
|
|
|
SbaTableQueryBrowser::EntryType SbaTableQueryBrowser::getChildType( SvLBoxEntry* _pEntry ) const
|
2001-09-20 11:59:25 +00:00
|
|
|
{
|
|
|
|
DBG_ASSERT(isContainer(_pEntry), "SbaTableQueryBrowser::getChildType: invalid entry!");
|
|
|
|
switch (getEntryType(_pEntry))
|
|
|
|
{
|
|
|
|
case etTableContainer:
|
|
|
|
return etTable;
|
|
|
|
case etQueryContainer:
|
|
|
|
return etQuery;
|
2006-06-20 01:57:13 +00:00
|
|
|
default:
|
|
|
|
break;
|
2001-09-20 11:59:25 +00:00
|
|
|
}
|
|
|
|
return etUnknown;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
2004-10-22 11:03:17 +00:00
|
|
|
String SbaTableQueryBrowser::GetEntryText( SvLBoxEntry* _pEntry ) const
|
2001-09-20 11:59:25 +00:00
|
|
|
{
|
|
|
|
return m_pTreeView->getListBox()->GetEntryText(_pEntry);
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
2002-01-24 16:43:35 +00:00
|
|
|
SbaTableQueryBrowser::EntryType SbaTableQueryBrowser::getEntryType( SvLBoxEntry* _pEntry ) const
|
2001-09-20 11:59:25 +00:00
|
|
|
{
|
|
|
|
if (!_pEntry)
|
|
|
|
return etUnknown;
|
|
|
|
|
|
|
|
SvLBoxEntry* pRootEntry = m_pTreeView->getListBox()->GetRootLevelParent(_pEntry);
|
|
|
|
SvLBoxEntry* pEntryParent = m_pTreeView->getListBox()->GetParent(_pEntry);
|
|
|
|
SvLBoxEntry* pTables = m_pTreeView->getListBox()->GetEntry(pRootEntry, CONTAINER_TABLES);
|
|
|
|
SvLBoxEntry* pQueries = m_pTreeView->getListBox()->GetEntry(pRootEntry, CONTAINER_QUERIES);
|
|
|
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
String sTest;
|
|
|
|
if (pTables) sTest = m_pTreeView->getListBox()->GetEntryText(pTables);
|
|
|
|
if (pQueries) sTest = m_pTreeView->getListBox()->GetEntryText(pQueries);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (pRootEntry == _pEntry)
|
|
|
|
return etDatasource;
|
|
|
|
|
|
|
|
if (pTables == _pEntry)
|
|
|
|
return etTableContainer;
|
|
|
|
|
|
|
|
if (pQueries == _pEntry)
|
|
|
|
return etQueryContainer;
|
|
|
|
|
|
|
|
if (pTables == pEntryParent)
|
|
|
|
return etTable;
|
|
|
|
|
|
|
|
if (pQueries == pEntryParent)
|
|
|
|
return etQuery;
|
|
|
|
|
|
|
|
return etUnknown;
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void SbaTableQueryBrowser::select(SvLBoxEntry* _pEntry, sal_Bool _bSelect)
|
|
|
|
{
|
|
|
|
SvLBoxItem* pTextItem = _pEntry ? _pEntry->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING) : NULL;
|
|
|
|
if (pTextItem)
|
|
|
|
{
|
|
|
|
static_cast<OBoldListboxString*>(pTextItem)->emphasize(_bSelect);
|
|
|
|
m_pTreeModel->InvalidateEntry(_pEntry);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
DBG_ERROR("SbaTableQueryBrowser::select: invalid entry!");
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void SbaTableQueryBrowser::selectPath(SvLBoxEntry* _pEntry, sal_Bool _bSelect)
|
|
|
|
{
|
|
|
|
while (_pEntry)
|
|
|
|
{
|
|
|
|
select(_pEntry, _bSelect);
|
|
|
|
_pEntry = m_pTreeModel->GetParent(_pEntry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
sal_Bool SbaTableQueryBrowser::isSelected(SvLBoxEntry* _pEntry) const
|
|
|
|
{
|
|
|
|
SvLBoxItem* pTextItem = _pEntry ? _pEntry->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING) : NULL;
|
|
|
|
if (pTextItem)
|
|
|
|
return static_cast<OBoldListboxString*>(pTextItem)->isEmphasized();
|
|
|
|
else
|
|
|
|
DBG_ERROR("SbaTableQueryBrowser::isSelected: invalid entry!");
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
2005-07-08 09:38:20 +00:00
|
|
|
void SbaTableQueryBrowser::SelectionChanged()
|
|
|
|
{
|
|
|
|
if ( !m_bShowMenu )
|
|
|
|
{
|
|
|
|
InvalidateFeature(ID_BROWSER_INSERTCOLUMNS);
|
|
|
|
InvalidateFeature(ID_BROWSER_INSERTCONTENT);
|
|
|
|
InvalidateFeature(ID_BROWSER_FORMLETTER);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
2004-11-16 13:49:57 +00:00
|
|
|
void SbaTableQueryBrowser::describeSupportedFeatures()
|
2001-09-20 11:59:25 +00:00
|
|
|
{
|
2004-11-16 13:49:57 +00:00
|
|
|
SbaXDataBrowserController::describeSupportedFeatures();
|
2001-09-20 11:59:25 +00:00
|
|
|
|
2004-11-16 13:49:57 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:Title", ID_BROWSER_TITLE );
|
2004-11-16 08:29:32 +00:00
|
|
|
if ( !m_bShowMenu )
|
|
|
|
{
|
2004-11-16 13:49:57 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DSBrowserExplorer", ID_BROWSER_EXPLORER, CommandGroup::VIEW );
|
2004-11-16 08:29:32 +00:00
|
|
|
|
2004-11-16 13:49:57 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DSBFormLetter", ID_BROWSER_FORMLETTER, CommandGroup::DOCUMENT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DSBInsertColumns", ID_BROWSER_INSERTCOLUMNS, CommandGroup::INSERT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DSBInsertContent", ID_BROWSER_INSERTCONTENT, CommandGroup::INSERT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DSBDocumentDataSource", ID_BROWSER_DOCUMENT_DATASOURCE, CommandGroup::VIEW );
|
2001-09-20 11:59:25 +00:00
|
|
|
|
2004-11-16 13:49:57 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:DataSourceBrowser/FormLetter", ID_BROWSER_FORMLETTER );
|
|
|
|
implDescribeSupportedFeature( ".uno:DataSourceBrowser/InsertColumns", ID_BROWSER_INSERTCOLUMNS );
|
|
|
|
implDescribeSupportedFeature( ".uno:DataSourceBrowser/InsertContent", ID_BROWSER_INSERTCONTENT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DataSourceBrowser/DocumentDataSource", ID_BROWSER_DOCUMENT_DATASOURCE );
|
2004-11-16 08:29:32 +00:00
|
|
|
}
|
2004-09-09 08:41:36 +00:00
|
|
|
|
2004-11-16 13:49:57 +00:00
|
|
|
implDescribeSupportedFeature( ".uno:CloseWin", ID_BROWSER_CLOSE, CommandGroup::DOCUMENT );
|
|
|
|
implDescribeSupportedFeature( ".uno:DBRebuildData", ID_BROWSER_REFRESH_REBUILD, CommandGroup::DATA );
|
2001-09-20 11:59:25 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
String SbaTableQueryBrowser::getURL() const
|
|
|
|
{
|
|
|
|
return String();
|
|
|
|
}
|
2002-04-29 07:47:03 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
void SbaTableQueryBrowser::notifyHiContrastChanged()
|
|
|
|
{
|
|
|
|
if ( m_pTreeView )
|
|
|
|
{
|
|
|
|
sal_Bool bHiContrast = isHiContrast();
|
2001-09-20 11:59:25 +00:00
|
|
|
|
2002-04-29 07:47:03 +00:00
|
|
|
if ( m_bHiContrast != bHiContrast )
|
|
|
|
{
|
|
|
|
m_bHiContrast = bHiContrast;
|
|
|
|
// change all bitmap entries
|
|
|
|
SvLBoxEntry* pEntryLoop = m_pTreeModel->First();
|
2002-04-30 06:33:31 +00:00
|
|
|
while ( pEntryLoop )
|
2002-04-29 07:47:03 +00:00
|
|
|
{
|
|
|
|
DBTreeListModel::DBTreeListUserData* pData = static_cast<DBTreeListModel::DBTreeListUserData*>(pEntryLoop->GetUserData());
|
|
|
|
if ( pData )
|
|
|
|
{
|
|
|
|
ModuleRes aResId(DBTreeListModel::getImageResId(pData->eType,isHiContrast()));
|
|
|
|
Image aImage(aResId);
|
|
|
|
USHORT nCount = pEntryLoop->ItemCount();
|
|
|
|
for (USHORT i=0;i<nCount;++i)
|
|
|
|
{
|
|
|
|
SvLBoxItem* pItem = pEntryLoop->GetItem(i);
|
|
|
|
if ( pItem && pItem->IsA() == SV_ITEM_ID_LBOXCONTEXTBMP)
|
|
|
|
{
|
2006-06-20 01:57:13 +00:00
|
|
|
static_cast<SvLBoxContextBmp*>(pItem)->SetBitmap1( aImage );
|
|
|
|
static_cast<SvLBoxContextBmp*>(pItem)->SetBitmap2( aImage );
|
2002-04-29 07:47:03 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pEntryLoop = m_pTreeModel->Next(pEntryLoop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
2001-09-20 11:59:25 +00:00
|
|
|
// .........................................................................
|
|
|
|
} // namespace dbaui
|
|
|
|
// .........................................................................
|
|
|
|
|