summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbaccess/source/ui/inc/ConnectionLine.hxx34
-rw-r--r--dbaccess/source/ui/inc/TableConnection.hxx7
-rw-r--r--dbaccess/source/ui/querydesign/ConnectionLine.cxx11
-rw-r--r--dbaccess/source/ui/querydesign/JoinTableView.cxx25
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx21
-rw-r--r--dbaccess/source/ui/querydesign/QueryTableView.cxx6
-rw-r--r--dbaccess/source/ui/querydesign/TableConnection.cxx53
7 files changed, 86 insertions, 71 deletions
diff --git a/dbaccess/source/ui/inc/ConnectionLine.hxx b/dbaccess/source/ui/inc/ConnectionLine.hxx
index 24268d2e8a56..f5169d9ca64e 100644
--- a/dbaccess/source/ui/inc/ConnectionLine.hxx
+++ b/dbaccess/source/ui/inc/ConnectionLine.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ConnectionLine.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: oj $ $Date: 2001-02-28 10:06:26 $
+ * last change: $Author: oj $ $Date: 2001-08-09 09:59:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -70,6 +70,10 @@
#ifndef DBAUI_CONNECTIONLINEDATA_HXX
#include "ConnectionLineData.hxx"
#endif
+#ifndef INCLUDED_FUNCTIONAL
+#define INCLUDED_FUNCTIONAL
+#include <functional>
+#endif
class SvLBoxEntry;
class OutputDevice;
@@ -113,7 +117,7 @@ namespace dbaui
Rectangle GetBoundingRect();
BOOL RecalcLine();
void Draw( OutputDevice* pOutDev );
- BOOL CheckHit( const Point& rMousePos );
+ bool CheckHit( const Point& rMousePos ) const;
String GetSourceFieldName() const { return m_pData->GetSourceFieldName(); }
String GetDestFieldName() const { return m_pData->GetDestFieldName(); }
@@ -127,5 +131,29 @@ namespace dbaui
OConnectionLineData* GetData() const { return m_pData; }
};
+ /// unary_function Functor object for class OConnectionLine returntype is void
+ /// draws a connectionline object on outputdevice
+ struct TConnectionLineDrawFunctor : ::std::unary_function<OConnectionLine*,void>
+ {
+ OutputDevice* pDevice;
+ TConnectionLineDrawFunctor(OutputDevice* _pDevice)
+ {
+ pDevice = _pDevice;
+ }
+ inline void operator()(OConnectionLine* _pLine)
+ {
+ _pLine->Draw(pDevice);
+ }
+ };
+ /// binary_function Functor object for class OConnectionLine returntype is bool
+ /// checks if the point is on connectionline
+ struct TConnectionLineCheckHitFunctor : ::std::binary_function<OConnectionLine*,Point,bool>
+ {
+ inline bool operator()(const OConnectionLine* lhs,const Point& rhs) const
+ {
+ return lhs->CheckHit(rhs);
+ }
+ };
+
}
#endif // DBAUI_CONNECTIONLINE_HXX
diff --git a/dbaccess/source/ui/inc/TableConnection.hxx b/dbaccess/source/ui/inc/TableConnection.hxx
index 0c25a1277947..10178186973a 100644
--- a/dbaccess/source/ui/inc/TableConnection.hxx
+++ b/dbaccess/source/ui/inc/TableConnection.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TableConnection.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: oj $ $Date: 2001-02-28 10:05:50 $
+ * last change: $Author: oj $ $Date: 2001-08-09 09:59:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -104,11 +104,12 @@ namespace dbaui
OTableConnection& operator=( const OTableConnection& rConn );
+
void Select();
void Deselect();
BOOL IsSelected() const { return m_bSelected; }
BOOL CheckHit( const Point& rMousePos );
- void Invalidate();
+ bool Invalidate();
void UpdateLineList();
OTableWindow* GetSourceWin() const;
diff --git a/dbaccess/source/ui/querydesign/ConnectionLine.cxx b/dbaccess/source/ui/querydesign/ConnectionLine.cxx
index 71d386f96271..c1e074b4647f 100644
--- a/dbaccess/source/ui/querydesign/ConnectionLine.cxx
+++ b/dbaccess/source/ui/querydesign/ConnectionLine.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ConnectionLine.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: oj $ $Date: 2001-04-30 13:02:01 $
+ * last change: $Author: oj $ $Date: 2001-08-09 09:59:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -464,7 +464,7 @@ double dist_Euklid(const Point &p1, const Point& p2,const Point& pM, Point& q)
return l;
}
//------------------------------------------------------------------------
-BOOL OConnectionLine::CheckHit( const Point& rMousePos )
+bool OConnectionLine::CheckHit( const Point& rMousePos ) const
{
//////////////////////////////////////////////////////////////////////
/*
@@ -477,10 +477,11 @@ BOOL OConnectionLine::CheckHit( const Point& rMousePos )
{
if(::std::min(m_aSourceConnPos.X(),m_aDestConnPos.X()) <= q.X() && ::std::min(m_aSourceConnPos.Y(),m_aDestConnPos.Y()) <= q.Y()
&& q.X() <= ::std::max(m_aDestConnPos.X(),m_aSourceConnPos.X()) && q.Y() <= ::std::max(m_aDestConnPos.Y(),m_aSourceConnPos.Y()))
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
+// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index 859697992c7a..e48a234f0c55 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: JoinTableView.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: oj $ $Date: 2001-07-26 07:11:02 $
+ * last change: $Author: oj $ $Date: 2001-08-09 09:59:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -112,6 +112,11 @@
#ifndef DBAUI_TABLEWINDOWDATA_HXX
#include "TableWindowData.hxx"
#endif
+#ifndef INCLUDED_FUNCTIONAL
+#define INCLUDED_FUNCTIONAL
+#include <functional>
+#endif
+
using namespace dbaui;
using namespace ::com::sun::star::uno;
@@ -987,10 +992,8 @@ void OJoinTableView::InvalidateConnections()
DBG_CHKTHIS(OJoinTableView,NULL);
//////////////////////////////////////////////////////////////////////
// Die Joins zeichnen
-
- ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin();
- for(;aIter != m_vTableConnection.end();++aIter)
- (*aIter)->Invalidate();
+ ::std::for_each(m_vTableConnection.begin(),m_vTableConnection.end(),
+ ::std::mem_fun(& OTableConnection::Invalidate));
}
//------------------------------------------------------------------------------
@@ -1316,7 +1319,7 @@ long OJoinTableView::PreNotify(NotifyEvent& rNEvt)
if (aIter != m_aTableMap.end())
{ // there is a currently active tab win
// check if there is an "overflow" and we should select a conn instead of a win
- if (m_vTableConnection.size())
+ if (!m_vTableConnection.empty())
{
if ((aIter->second == m_aTableMap.rbegin()->second) && bForward)
// the last win is active and we're travelling forward -> select the first conn
@@ -1343,7 +1346,7 @@ long OJoinTableView::PreNotify(NotifyEvent& rNEvt)
if (i == sal_Int32(m_vTableConnection.size() - 1) && bForward)
// the last conn is active and we're travelling forward -> select the first win
pNextWin = m_aTableMap.begin()->second;
- if ((i == 0) && !bForward && m_aTableMap.size())
+ if ((i == 0) && !bForward && !m_aTableMap.empty())
// the first conn is active and we're travelling backward -> select the last win
pNextWin = m_aTableMap.rbegin()->second;
@@ -1356,9 +1359,9 @@ long OJoinTableView::PreNotify(NotifyEvent& rNEvt)
pNextConn = m_vTableConnection[(i + (bForward ? 1 : m_vTableConnection.size() - 1)) % m_vTableConnection.size()];
else
{ // no tab win selected, no conn selected
- if (m_vTableConnection.size())
+ if (!m_vTableConnection.empty())
pNextConn = m_vTableConnection[bForward ? 0 : m_vTableConnection.size() - 1];
- else if (m_aTableMap.size())
+ else if (!m_aTableMap.empty())
{
if(bForward)
pNextWin = m_aTableMap.begin()->second;
@@ -1441,7 +1444,7 @@ void OJoinTableView::GrabTabWinFocus()
else
m_pLastFocusTabWin->GrabFocus();
}
- else if (m_aTableMap.size() && m_aTableMap.begin()->second && m_aTableMap.begin()->second->IsVisible())
+ else if (!m_aTableMap.empty() && m_aTableMap.begin()->second && m_aTableMap.begin()->second->IsVisible())
{
OTableWindow* pFirstWin = m_aTableMap.begin()->second;
if (pFirstWin->GetListBox())
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 153469c72fe3..c410483dd4a5 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: QueryDesignView.cxx,v $
*
- * $Revision: 1.21 $
+ * $Revision: 1.22 $
*
- * last change: $Author: oj $ $Date: 2001-07-25 06:20:59 $
+ * last change: $Author: oj $ $Date: 2001-08-09 09:59:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1967,6 +1967,9 @@ void OQueryDesignView::InitFromParseNode()
::rtl::OUString aComposedName;
::rtl::OUString aQualifierName;
::rtl::OUString sAlias;
+
+
+
OSQLTables::const_iterator aIter = aMap.begin();
for(;aIter != aMap.end();++aIter)
{
@@ -1991,17 +1994,11 @@ void OQueryDesignView::InitFromParseNode()
// now delete the data for which we haven't any tablewindow
OJoinTableView::OTableWindowMap* pTableMap = m_pTableView->GetTabWinMap();
- ::std::vector< OTableWindowData*>::iterator aDataIter = static_cast<OQueryController*>(getController())->getTableWindowData()->begin();
- for(;aDataIter != static_cast<OQueryController*>(getController())->getTableWindowData()->end();)
+ OJoinTableView::OTableWindowMap::iterator aIterTableMap = pTableMap->begin();
+ for(;aIterTableMap != pTableMap->end();++aIterTableMap)
{
- OQueryTableWindowData* pData = static_cast<OQueryTableWindowData*>(*aDataIter);
- if(pTableMap->find(pData->GetAliasName()) == pTableMap->end())
- {
- delete *aDataIter;
- aDataIter = static_cast<OQueryController*>(getController())->getTableWindowData()->erase(aDataIter);
- }
- else
- ++aDataIter;
+ if(aMap.find(aIterTableMap->first) == aMap.end())
+ m_pTableView->RemoveTabWin(aIterTableMap->second);
}
FillOuterJoins(pParseTree->getChild(3)->getChild(0)->getChild(1));
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index 1d1984cfdb69..021687558389 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: QueryTableView.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: oj $ $Date: 2001-07-26 07:11:02 $
+ * last change: $Author: oj $ $Date: 2001-08-09 09:59:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -563,7 +563,7 @@ void OQueryTableView::AddTabWin(const ::rtl::OUString& _rComposedName, const ::r
// Relationen zwischen den einzelnen Tabellen anzeigen
OTableWindowMap* pTabWins = GetTabWinMap();
- if(bNewTable && pTabWins->size() && strTableName.getLength())
+ if(bNewTable && !pTabWins->empty() && strTableName.getLength())
{
Reference<XConnection> xCon = m_pView->getController()->getConnection();
OSL_ENSURE(xCon.is(),"OQueryTableView::AddTabWin connection is null!");
diff --git a/dbaccess/source/ui/querydesign/TableConnection.cxx b/dbaccess/source/ui/querydesign/TableConnection.cxx
index 3a273032c253..7c75a68e1220 100644
--- a/dbaccess/source/ui/querydesign/TableConnection.cxx
+++ b/dbaccess/source/ui/querydesign/TableConnection.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TableConnection.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: oj $ $Date: 2001-02-28 10:18:26 $
+ * last change: $Author: oj $ $Date: 2001-08-09 09:59:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -142,16 +142,7 @@ void OTableConnection::UpdateLineList()
delete *aLineIter;
m_vConnLine.clear();
- //////////////////////////////////////////////////////////////////////
- // Linienliste aus der Datenliste neu erstellen
- ::std::vector<OConnectionLineData*>* pLineData = GetData()->GetConnLineDataList();
- ::std::vector<OConnectionLineData*>::const_iterator aIter = pLineData->begin();
- for(;aIter != pLineData->end();++aIter)
- {
- OConnectionLine* pConnLine = new OConnectionLine( this, *aIter );
- m_vConnLine.push_back(pConnLine);
- }
-
+ Init();
}
//------------------------------------------------------------------------
@@ -166,7 +157,7 @@ OTableConnection& OTableConnection::operator=( const OTableConnection& rConn )
m_vConnLine.clear();
// Linienliste kopieren
- if( rConn.GetConnLineList()->size() )
+ if(! rConn.GetConnLineList()->empty() )
{
const ::std::vector<OConnectionLine*>* pLine = rConn.GetConnLineList();
::std::vector<OConnectionLine*>::const_iterator aIter = pLine->begin();
@@ -191,8 +182,7 @@ OTableConnection& OTableConnection::operator=( const OTableConnection& rConn )
//------------------------------------------------------------------------
void OTableConnection::RecalcLines()
{
- for(::std::vector<OConnectionLine*>::iterator aIter = m_vConnLine.begin();aIter != m_vConnLine.end();++aIter)
- (*aIter)->RecalcLine();
+ ::std::for_each(m_vConnLine.begin(),m_vConnLine.end(),::std::mem_fun(&OConnectionLine::RecalcLine));
}
//------------------------------------------------------------------------
OTableWindow* OTableConnection::GetSourceWin() const
@@ -228,16 +218,16 @@ BOOL OTableConnection::CheckHit( const Point& rMousePos )
{
//////////////////////////////////////////////////////////////////////
// Pruefen, ob auf eine der Linien geclickt worden ist
- for(::std::vector<OConnectionLine*>::iterator aIter = m_vConnLine.begin();aIter != m_vConnLine.end();++aIter)
- {
- if( (*aIter)->IsValid() && (*aIter)->CheckHit(rMousePos) )
- return TRUE;
- }
- return FALSE;
+ ::std::vector<OConnectionLine*>::iterator aIter = ::std::find_if(m_vConnLine.begin(),
+ m_vConnLine.end(),
+ ::std::compose2(::std::logical_and<bool>(),
+ ::std::mem_fun(&OConnectionLine::IsValid),
+ ::std::bind2nd(TConnectionLineCheckHitFunctor(),rMousePos)));
+ return aIter != m_vConnLine.end();
}
//------------------------------------------------------------------------
-void OTableConnection::Invalidate()
+bool OTableConnection::Invalidate()
{
Rectangle rcBounding = GetBoundingRect();
rcBounding.Bottom() += 1;
@@ -247,6 +237,8 @@ void OTableConnection::Invalidate()
// Invalidate erfasst dabei offensichtlich eine Pixelzeile weniger als Draw.
// Oder alles haengt ganz anders zusammen ... jedenfalls klappt es so ...
m_pParent->Invalidate( rcBounding, INVALIDATE_NOCHILDREN );
+
+ return true;
}
//------------------------------------------------------------------------
@@ -265,9 +257,9 @@ Rectangle OTableConnection::GetBoundingRect()
if( (aTempRect.GetWidth()!=1) && (aTempRect.GetHeight()!=1) )
{
if( (aBoundingRect.GetWidth()==1) && (aBoundingRect.GetHeight()==1) )
- aBoundingRect = (*aIter)->GetBoundingRect();
+ aBoundingRect = aTempRect;
else
- aBoundingRect.Union( (*aIter)->GetBoundingRect() );
+ aBoundingRect.Union( aTempRect );
}
}
@@ -278,18 +270,11 @@ Rectangle OTableConnection::GetBoundingRect()
void OTableConnection::Draw( const Rectangle& rRect )
{
//////////////////////////////////////////////////////////////////////
- // Nur neu zeichnen, wenn Connection innerhalb des ungueltigen Bereichs liegt
-/* Rectangle aIntersectRect = GetBoundingRect().GetIntersection( rRect );
- Rectangle aBoundingRect = GetBoundingRect();
- if( !aIntersectRect.GetWidth() && !aIntersectRect.GetHeight() )
- return;
-*/
-
- //////////////////////////////////////////////////////////////////////
// Linien zeichnen
- for(::std::vector<OConnectionLine*>::iterator aIter = m_vConnLine.begin();aIter != m_vConnLine.end();++aIter)
- (*aIter)->Draw( m_pParent );
+ ::std::for_each(m_vConnLine.begin(),m_vConnLine.end(),TConnectionLineDrawFunctor(m_pParent));
}
+// -----------------------------------------------------------------------------
+