summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/control/tabletree.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/ui/control/tabletree.cxx')
-rw-r--r--dbaccess/source/ui/control/tabletree.cxx105
1 files changed, 26 insertions, 79 deletions
diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx
index 5d3513cc8cd5..c86cac49e5ad 100644
--- a/dbaccess/source/ui/control/tabletree.cxx
+++ b/dbaccess/source/ui/control/tabletree.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,75 +29,33 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbui.hxx"
-#ifndef _DBAUI_TABLETREE_HXX_
#include "tabletree.hxx"
-#endif
-#ifndef _DBAUI_TABLETREE_HRC_
#include "tabletree.hrc"
-#endif
-#ifndef DBACCESS_IMAGEPROVIDER_HXX
#include "imageprovider.hxx"
-#endif
-#ifndef _DBAUI_MODULE_DBU_HXX_
#include "moduledbu.hxx"
-#endif
-#ifndef _DBU_CONTROL_HRC_
#include "dbu_control.hrc"
-#endif
-#ifndef _SV_MENU_HXX
#include <vcl/menu.hxx>
-#endif
-#ifndef _CONNECTIVITY_DBTOOLS_HXX_
#include <connectivity/dbtools.hxx>
-#endif
-#ifndef _COMPHELPER_TYPES_HXX_
#include <comphelper/types.hxx>
-#endif
-#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
#include "dbustrings.hrc"
-#endif
-#ifndef _COM_SUN_STAR_SDB_APPLICATION_DATABASEOBJECT_HPP_
#include <com/sun/star/sdb/application/DatabaseObject.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_APPLICATION_DATABASEOBJECTFOLDER_HPP_
#include <com/sun/star/sdb/application/DatabaseObjectContainer.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XDRIVERACCESS_HPP_
#include <com/sun/star/sdbc/XDriverAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XDATADEFINITIONSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XVIEWSSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_
#include <com/sun/star/sdb/SQLContext.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
#include <com/sun/star/sdbc/XRow.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
-#endif
-#ifndef _DBAUI_COMMON_TYPES_HXX_
#include "commontypes.hxx"
-#endif
-#ifndef _DBAUI_LISTVIEWITEMS_HXX_
#include "listviewitems.hxx"
-#endif
-#ifndef TOOLS_DIAGNOSE_EX_H
#include <tools/diagnose_ex.h>
-#endif
-#ifndef _RTL_USTRBUF_HXX_
+#include <osl/diagnose.h>
#include <rtl/ustrbuf.hxx>
-#endif
#include <connectivity/dbmetadata.hxx>
#include <algorithm>
+#include <o3tl/compat_functional.hxx>
//.........................................................................
namespace dbaui
@@ -148,10 +107,8 @@ OTableTreeListBox::~OTableTreeListBox()
void OTableTreeListBox::implSetDefaultImages()
{
ImageProvider aImageProvider;
- SetDefaultExpandedEntryBmp( aImageProvider.getFolderImage( DatabaseObject::TABLE, false ), BMP_COLOR_NORMAL );
- SetDefaultExpandedEntryBmp( aImageProvider.getFolderImage( DatabaseObject::TABLE, true ), BMP_COLOR_HIGHCONTRAST );
- SetDefaultCollapsedEntryBmp( aImageProvider.getFolderImage( DatabaseObject::TABLE, false ), BMP_COLOR_NORMAL );
- SetDefaultCollapsedEntryBmp( aImageProvider.getFolderImage( DatabaseObject::TABLE, true ), BMP_COLOR_HIGHCONTRAST );
+ SetDefaultExpandedEntryBmp( aImageProvider.getFolderImage( DatabaseObject::TABLE ) );
+ SetDefaultCollapsedEntryBmp( aImageProvider.getFolderImage( DatabaseObject::TABLE ) );
}
// -----------------------------------------------------------------------------
@@ -182,25 +139,19 @@ void OTableTreeListBox::notifyHiContrastChanged()
{
SvLBoxContextBmp* pContextBitmapItem = static_cast< SvLBoxContextBmp* >( pItem );
- Image aImage, aImageHC;
+ Image aImage;
if ( isFolderEntry( pEntryLoop ) )
{
- aImage = m_pImageProvider->getFolderImage( DatabaseObject::TABLE, false );
- aImageHC = m_pImageProvider->getFolderImage( DatabaseObject::TABLE, true );
+ aImage = m_pImageProvider->getFolderImage( DatabaseObject::TABLE );
}
else
{
String sCompleteName( getQualifiedTableName( pEntryLoop ) );
- m_pImageProvider->getImages( sCompleteName, DatabaseObject::TABLE, aImage, aImageHC );
+ m_pImageProvider->getImages( sCompleteName, DatabaseObject::TABLE, aImage );
}
- pContextBitmapItem->SetBitmap1( aImage, BMP_COLOR_NORMAL );
- pContextBitmapItem->SetBitmap2( aImage, BMP_COLOR_NORMAL );
- pContextBitmapItem->SetBitmap1( aImageHC, BMP_COLOR_HIGHCONTRAST );
- pContextBitmapItem->SetBitmap2( aImageHC, BMP_COLOR_HIGHCONTRAST );
- // TODO: Now that we give both images to the entry item, it is not necessary anymore
- // to do this anytime HC changes - the tree control will do this itself now.
- // We would only need to properly initialize newly inserted entries.
+ pContextBitmapItem->SetBitmap1( aImage );
+ pContextBitmapItem->SetBitmap2( aImage );
break;
}
}
@@ -242,7 +193,7 @@ void OTableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConn
}
catch(RuntimeException&)
{
- DBG_ERROR("OTableTreeListBox::UpdateTableList : caught an RuntimeException!");
+ OSL_FAIL("OTableTreeListBox::UpdateTableList : caught an RuntimeException!");
}
catch ( const SQLException& )
{
@@ -250,7 +201,7 @@ void OTableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConn
}
catch(Exception&)
{
- // a non-SQLException exception occured ... simply throw an SQLException
+ // a non-SQLException exception occurred ... simply throw an SQLException
SQLException aInfo;
aInfo.Message = sCurrentActionError;
throw aInfo;
@@ -333,15 +284,13 @@ void OTableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConn
try
{
- // the root entry saying "all objects"
- SvLBoxEntry* pAllObjects = NULL;
if (haveVirtualRoot())
{
String sRootEntryText;
TNames::const_iterator aViews = ::std::find_if(_rTables.begin(),_rTables.end(),
- ::std::compose1(::std::bind2nd(::std::equal_to<sal_Bool>(),sal_False),::std::select2nd<TNames::value_type>()));
+ ::o3tl::compose1(::std::bind2nd(::std::equal_to<sal_Bool>(),sal_False),::o3tl::select2nd<TNames::value_type>()));
TNames::const_iterator aTables = ::std::find_if(_rTables.begin(),_rTables.end(),
- ::std::compose1(::std::bind2nd(::std::equal_to<sal_Bool>(),sal_True),::std::select2nd<TNames::value_type>()));
+ ::o3tl::compose1(::std::bind2nd(::std::equal_to<sal_Bool>(),sal_True),::o3tl::select2nd<TNames::value_type>()));
if ( aViews == _rTables.end() )
sRootEntryText = String(ModuleRes(STR_ALL_TABLES));
@@ -349,7 +298,7 @@ void OTableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConn
sRootEntryText = String(ModuleRes(STR_ALL_VIEWS));
else
sRootEntryText = String(ModuleRes(STR_ALL_TABLES_AND_VIEWS));
- pAllObjects = InsertEntry( sRootEntryText, NULL, sal_False, LIST_APPEND, reinterpret_cast< void* >( DatabaseObjectContainer::TABLES ) );
+ InsertEntry( sRootEntryText, NULL, sal_False, LIST_APPEND, reinterpret_cast< void* >( DatabaseObjectContainer::TABLES ) );
}
if ( _rTables.empty() )
@@ -435,22 +384,21 @@ void OTableTreeListBox::checkedButton_noBroadcast(SvLBoxEntry* _pEntry)
{
OMarkableTreeListBox::checkedButton_noBroadcast(_pEntry);
- // if an entry has children, it makes a difference if the entry is checked because alls children are checked
- // or if the user checked it explicitly.
+ // if an entry has children, it makes a difference if the entry is checked
+ // because all children are checked or if the user checked it explicitly.
// So we track explicit (un)checking
SvButtonState eState = GetCheckButtonState(_pEntry);
- DBG_ASSERT(SV_BUTTON_TRISTATE != eState, "OTableTreeListBox::CheckButtonHdl: user action which lead to TRISTATE?");
+ OSL_ENSURE(SV_BUTTON_TRISTATE != eState, "OTableTreeListBox::CheckButtonHdl: user action which lead to TRISTATE?");
implEmphasize(_pEntry, SV_BUTTON_CHECKED == eState);
}
//------------------------------------------------------------------------
void OTableTreeListBox::implEmphasize(SvLBoxEntry* _pEntry, sal_Bool _bChecked, sal_Bool _bUpdateDescendants, sal_Bool _bUpdateAncestors)
{
- DBG_ASSERT(_pEntry, "OTableTreeListBox::implEmphasize: invalid entry (NULL)!");
+ OSL_ENSURE(_pEntry, "OTableTreeListBox::implEmphasize: invalid entry (NULL)!");
// special emphasizing handling for the "all objects" entry
- // 89709 - 16.07.2001 - frank.schoenheit@sun.com
sal_Bool bAllObjectsEntryAffected = haveVirtualRoot() && (getAllObjectsEntry() == _pEntry);
if ( GetModel()->HasChilds(_pEntry) // the entry has children
|| bAllObjectsEntryAffected // or it is the "all objects" entry
@@ -491,9 +439,9 @@ void OTableTreeListBox::InitEntry(SvLBoxEntry* _pEntry, const XubString& _rStrin
// replace the text item with our own one
SvLBoxItem* pTextItem = _pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING);
- DBG_ASSERT(pTextItem, "OTableTreeListBox::InitEntry: no text item!?");
+ OSL_ENSURE(pTextItem, "OTableTreeListBox::InitEntry: no text item!?");
sal_uInt16 nTextPos = _pEntry->GetPos(pTextItem);
- DBG_ASSERT(((sal_uInt16)-1) != nTextPos, "OTableTreeListBox::InitEntry: no text item pos!");
+ OSL_ENSURE(((sal_uInt16)-1) != nTextPos, "OTableTreeListBox::InitEntry: no text item pos!");
_pEntry->ReplaceItem(new OBoldListboxString(_pEntry, 0, _rString), nTextPos);
}
@@ -550,13 +498,11 @@ SvLBoxEntry* OTableTreeListBox::implAddEntry(
{
pRet = InsertEntry( sName, pParentEntry, sal_False, LIST_APPEND );
- Image aImage, aImageHC;
- m_pImageProvider->getImages( _rTableName, DatabaseObject::TABLE, aImage, aImageHC );
+ Image aImage;
+ m_pImageProvider->getImages( _rTableName, DatabaseObject::TABLE, aImage );
- SetExpandedEntryBmp( pRet, aImage, BMP_COLOR_NORMAL );
- SetCollapsedEntryBmp( pRet, aImage, BMP_COLOR_NORMAL );
- SetExpandedEntryBmp( pRet, aImageHC, BMP_COLOR_HIGHCONTRAST );
- SetCollapsedEntryBmp( pRet, aImageHC, BMP_COLOR_HIGHCONTRAST );
+ SetExpandedEntryBmp( pRet, aImage );
+ SetCollapsedEntryBmp( pRet, aImage );
}
return pRet;
}
@@ -736,3 +682,4 @@ void OTableTreeListBox::removedTable( const ::rtl::OUString& _rName )
} // namespace dbaui
//.........................................................................
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */