Kaydet (Commit) 0300cbb8 authored tarafından Frank Schönheit's avatar Frank Schönheit

renamed/outsourced the DSBrowserString

üst c67534af
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: dbtreemodel.cxx,v $ * $RCSfile: dbtreemodel.cxx,v $
* *
* $Revision: 1.4 $ * $Revision: 1.5 $
* *
* last change: $Author: fs $ $Date: 2000-11-10 13:53:55 $ * last change: $Author: fs $ $Date: 2001-01-30 08:32:01 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -59,132 +59,5 @@ ...@@ -59,132 +59,5 @@
* *
************************************************************************/ ************************************************************************/
#ifndef _COM_SUN_STAR_UTIL_XFLUSHABLE_HPP_
#include <com/sun/star/util/XFlushable.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XDATASOURCE_HPP_
#include <com/sun/star/sdbc/XDataSource.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
#include <com/sun/star/sdbc/XConnection.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBCX_XVIEWSSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
#endif
#ifndef _COM_SUN_STAR_SDB_XCOMPLETEDCONNECTION_HPP_
#include <com/sun/star/sdb/XCompletedConnection.hpp>
#endif
#ifndef _COM_SUN_STAR_SDB_XQUERYDEFINITIONSSUPPLIER_HPP_
#include <com/sun/star/sdb/XQueryDefinitionsSupplier.hpp>
#endif
#ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HPP_
#include <com/sun/star/task/XInteractionHandler.hpp>
#endif
#ifndef _COM_SUN_STAR_UI_XEXECUTABLEDIALOG_HPP_
#include <com/sun/star/ui/XExecutableDialog.hpp>
#endif
#include <com/sun/star/beans/PropertyValue.hpp>
#ifndef _CPPUHELPER_EXTRACT_HXX_
#include <cppuhelper/extract.hxx>
#endif
#ifndef _DBU_RESOURCE_HRC_
#include "dbu_resource.hrc"
#endif
#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
#include "dbustrings.hrc"
#endif
#ifndef DBAUI_DBTREEMODEL_HXX
#include "dbtreemodel.hxx"
#endif
#ifndef _SVLBOXITM_HXX
#include <svtools/svlbitm.hxx>
#endif
#ifndef _COMPHELPER_TYPES_HXX_
#include <comphelper/types.hxx>
#endif
#ifndef _DBHELPER_DBEXCEPTION_HXX_
#include <connectivity/dbexception.hxx>
#endif
#ifndef _VCL_STDTEXT_HXX
#include <vcl/stdtext.hxx>
#endif
using namespace ::com::sun::star::ui; // this file is obsolete
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::task;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::beans;
using namespace ::dbtools;
// .........................................................................
namespace dbaui
{
// .........................................................................
//========================================================================
// class DSBrowserString
//========================================================================
//------------------------------------------------------------------------
void DSBrowserString::InitViewData( SvLBox* pView,SvLBoxEntry* pEntry, SvViewDataItem* _pViewData)
{
SvLBoxString::InitViewData(pView,pEntry, _pViewData);
if (!_pViewData)
_pViewData = pView->GetViewDataItem( pEntry, this );
Font aOldFont( pView->GetFont());
Font aFont( aOldFont );
aFont.SetWeight(WEIGHT_BOLD);
pView->SetFont( aFont );
_pViewData->aSize = Size(pView->GetTextWidth(GetText()), pView->GetTextHeight());
pView->SetFont( aOldFont );
}
//------------------------------------------------------------------------
USHORT DSBrowserString::IsA()
{
return SV_ITEM_ID_DBTEXTITEM;
}
//------------------------------------------------------------------------
void DSBrowserString::Paint(const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry )
{
if (m_bSelected)
{
Font aOldFont( rDev.GetFont());
Font aFont( aOldFont );
aFont.SetWeight(WEIGHT_BOLD);
rDev.SetFont( aFont );
Point aPos(rPos);
rDev.DrawText( aPos, GetText() );
rDev.SetFont( aOldFont );
}
else
SvLBoxString::Paint(rPos, rDev, nFlags, pEntry);
}
//========================================================================
// class DBTreeListModel
//========================================================================
// -------------------------------------------------------------------------
DBTreeListModel::DBTreeListModel()
{
}
// .........................................................................
} // namespace dbaui
// .........................................................................
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: unodatbr.cxx,v $ * $RCSfile: unodatbr.cxx,v $
* *
* $Revision: 1.25 $ * $Revision: 1.26 $
* *
* last change: $Author: fs $ $Date: 2001-01-26 16:11:56 $ * last change: $Author: fs $ $Date: 2001-01-30 08:32:01 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -234,6 +234,9 @@ ...@@ -234,6 +234,9 @@
#ifndef _DBAUI_QUERYDESIGNACCESS_HXX_ #ifndef _DBAUI_QUERYDESIGNACCESS_HXX_
#include "querydesignaccess.hxx" #include "querydesignaccess.hxx"
#endif #endif
#ifndef _DBAUI_LISTVIEWITEMS_HXX_
#include "listviewitems.hxx"
#endif
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdb;
...@@ -1471,7 +1474,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnListContextMenu, const CommandEvent*, _pEvent) ...@@ -1471,7 +1474,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnListContextMenu, const CommandEvent*, _pEvent)
// get all needed properties for querydesign // get all needed properties for querydesign
::rtl::OUString aDSName; ::rtl::OUString aDSName;
SvLBoxItem* pTextItem = pDSEntry->GetFirstItem(SV_ITEM_ID_DBTEXTITEM); SvLBoxItem* pTextItem = pDSEntry->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING);
if (pTextItem) if (pTextItem)
aDSName = static_cast<SvLBoxString*>(pTextItem)->GetText(); aDSName = static_cast<SvLBoxString*>(pTextItem)->GetText();
Reference<XConnection> xConnection; // supports the service sdb::connection Reference<XConnection> xConnection; // supports the service sdb::connection
...@@ -1487,7 +1490,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnListContextMenu, const CommandEvent*, _pEvent) ...@@ -1487,7 +1490,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnListContextMenu, const CommandEvent*, _pEvent)
if ((ID_TREE_QUERY_EDIT == nPos) && pEntry) if ((ID_TREE_QUERY_EDIT == nPos) && pEntry)
{ {
// get the name of the query // get the name of the query
SvLBoxItem* pQueryTextItem = pEntry->GetFirstItem(SV_ITEM_ID_DBTEXTITEM); SvLBoxItem* pQueryTextItem = pEntry->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING);
if (pQueryTextItem) if (pQueryTextItem)
sCurrentQuery = static_cast<SvLBoxString*>(pQueryTextItem)->GetText(); sCurrentQuery = static_cast<SvLBoxString*>(pQueryTextItem)->GetText();
...@@ -1503,7 +1506,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnListContextMenu, const CommandEvent*, _pEvent) ...@@ -1503,7 +1506,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnListContextMenu, const CommandEvent*, _pEvent)
if(xSup.is()) if(xSup.is())
xNameAccess = xSup->getQueries(); xNameAccess = xSup->getQueries();
SvLBoxItem* pTextItem = pEntry->GetFirstItem(SV_ITEM_ID_DBTEXTITEM); SvLBoxItem* pTextItem = pEntry->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING);
if (pTextItem) if (pTextItem)
sCurrentQuery = static_cast<SvLBoxString*>(pTextItem)->GetText(); sCurrentQuery = static_cast<SvLBoxString*>(pTextItem)->GetText();
...@@ -1533,7 +1536,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnListContextMenu, const CommandEvent*, _pEvent) ...@@ -1533,7 +1536,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnListContextMenu, const CommandEvent*, _pEvent)
try try
{ {
::rtl::OUString aName; ::rtl::OUString aName;
SvLBoxItem* pTextItem = pDSEntry->GetFirstItem(SV_ITEM_ID_DBTEXTITEM); SvLBoxItem* pTextItem = pDSEntry->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING);
if (pTextItem) if (pTextItem)
aName = static_cast<SvLBoxString*>(pTextItem)->GetText(); aName = static_cast<SvLBoxString*>(pTextItem)->GetText();
m_xDatabaseContext->getByName(aName) >>= xSet; m_xDatabaseContext->getByName(aName) >>= xSet;
...@@ -1547,7 +1550,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnListContextMenu, const CommandEvent*, _pEvent) ...@@ -1547,7 +1550,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnListContextMenu, const CommandEvent*, _pEvent)
{ {
try try
{ {
SvLBoxItem* pTextItem = pEntry->GetFirstItem(SV_ITEM_ID_DBTEXTITEM); SvLBoxItem* pTextItem = pEntry->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING);
if (pTextItem) if (pTextItem)
xNames->removeByName(static_cast<SvLBoxString*>(pTextItem)->GetText().GetBuffer()); xNames->removeByName(static_cast<SvLBoxString*>(pTextItem)->GetText().GetBuffer());
} }
...@@ -1577,7 +1580,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvLBoxEntry*, _pParent) ...@@ -1577,7 +1580,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvLBoxEntry*, _pParent)
DBTreeListModel::DBTreeListUserData* pData = static_cast< DBTreeListModel::DBTreeListUserData* >(_pParent->GetUserData()); DBTreeListModel::DBTreeListUserData* pData = static_cast< DBTreeListModel::DBTreeListUserData* >(_pParent->GetUserData());
OSL_ENSHURE(pData,"SbaTableQueryBrowser::OnExpandEntry: No user data!"); OSL_ENSHURE(pData,"SbaTableQueryBrowser::OnExpandEntry: No user data!");
SvLBoxString* pString = static_cast<SvLBoxString*>(pFirstParent->GetFirstItem(SV_ITEM_ID_DBTEXTITEM)); SvLBoxString* pString = static_cast<SvLBoxString*>(pFirstParent->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING));
OSL_ENSHURE(pString,"SbaTableQueryBrowser::OnExpandEntry: No string item!"); OSL_ENSHURE(pString,"SbaTableQueryBrowser::OnExpandEntry: No string item!");
if(pData->bTable) if(pData->bTable)
...@@ -1642,9 +1645,9 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvLBoxEntry*, _pParent) ...@@ -1642,9 +1645,9 @@ IMPL_LINK(SbaTableQueryBrowser, OnExpandEntry, SvLBoxEntry*, _pParent)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
sal_Bool SbaTableQueryBrowser::isSelected(SvLBoxEntry* _pEntry) const sal_Bool SbaTableQueryBrowser::isSelected(SvLBoxEntry* _pEntry) const
{ {
SvLBoxItem* pTextItem = _pEntry ? _pEntry->GetFirstItem(SV_ITEM_ID_DBTEXTITEM) : NULL; SvLBoxItem* pTextItem = _pEntry ? _pEntry->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING) : NULL;
if (pTextItem) if (pTextItem)
return static_cast<DSBrowserString*>(pTextItem)->isSelected(); return static_cast<OBoldListboxString*>(pTextItem)->isEmphasized();
else else
DBG_ERROR("SbaTableQueryBrowser::isSelected: invalid entry!"); DBG_ERROR("SbaTableQueryBrowser::isSelected: invalid entry!");
return sal_False; return sal_False;
...@@ -1653,10 +1656,10 @@ sal_Bool SbaTableQueryBrowser::isSelected(SvLBoxEntry* _pEntry) const ...@@ -1653,10 +1656,10 @@ sal_Bool SbaTableQueryBrowser::isSelected(SvLBoxEntry* _pEntry) const
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void SbaTableQueryBrowser::select(SvLBoxEntry* _pEntry, sal_Bool _bSelect) void SbaTableQueryBrowser::select(SvLBoxEntry* _pEntry, sal_Bool _bSelect)
{ {
SvLBoxItem* pTextItem = _pEntry ? _pEntry->GetFirstItem(SV_ITEM_ID_DBTEXTITEM) : NULL; SvLBoxItem* pTextItem = _pEntry ? _pEntry->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING) : NULL;
if (pTextItem) if (pTextItem)
{ {
static_cast<DSBrowserString*>(pTextItem)->Select(_bSelect); static_cast<OBoldListboxString*>(pTextItem)->emphasize(_bSelect);
m_pTreeModel->InvalidateEntry(_pEntry); m_pTreeModel->InvalidateEntry(_pEntry);
} }
else else
...@@ -1688,7 +1691,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnSelectEntry, SvLBoxEntry*, _pEntry) ...@@ -1688,7 +1691,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnSelectEntry, SvLBoxEntry*, _pEntry)
Reference<XConnection> xOldConnection; Reference<XConnection> xOldConnection;
xProp->getPropertyValue(PROPERTY_ACTIVECONNECTION) >>= xOldConnection; xProp->getPropertyValue(PROPERTY_ACTIVECONNECTION) >>= xOldConnection;
// the name of the table or query // the name of the table or query
SvLBoxString* pString = (SvLBoxString*)_pEntry->GetFirstItem(SV_ITEM_ID_DBTEXTITEM); SvLBoxString* pString = (SvLBoxString*)_pEntry->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING);
OSL_ENSURE(pString,"There must be a string item!"); OSL_ENSURE(pString,"There must be a string item!");
::rtl::OUString aName(pString->GetText().GetBuffer()); ::rtl::OUString aName(pString->GetText().GetBuffer());
...@@ -1735,7 +1738,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnSelectEntry, SvLBoxEntry*, _pEntry) ...@@ -1735,7 +1738,7 @@ IMPL_LINK(SbaTableQueryBrowser, OnSelectEntry, SvLBoxEntry*, _pEntry)
if (pEntry) if (pEntry)
{ {
SvLBoxItem* pTextItem = pEntry->GetFirstItem(SV_ITEM_ID_DBTEXTITEM); SvLBoxItem* pTextItem = pEntry->GetFirstItem(SV_ITEM_ID_BOLDLBSTRING);
if (pTextItem) if (pTextItem)
sDataSourceName = static_cast<SvLBoxString*>(pTextItem)->GetText(); sDataSourceName = static_cast<SvLBoxString*>(pTextItem)->GetText();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment