1*2e2212a7SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2e2212a7SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2e2212a7SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2e2212a7SAndrew Rist * distributed with this work for additional information 6*2e2212a7SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2e2212a7SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2e2212a7SAndrew Rist * "License"); you may not use this file except in compliance 9*2e2212a7SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*2e2212a7SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*2e2212a7SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2e2212a7SAndrew Rist * software distributed under the License is distributed on an 15*2e2212a7SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2e2212a7SAndrew Rist * KIND, either express or implied. See the License for the 17*2e2212a7SAndrew Rist * specific language governing permissions and limitations 18*2e2212a7SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*2e2212a7SAndrew Rist *************************************************************/ 21*2e2212a7SAndrew Rist 22*2e2212a7SAndrew Rist 23cdf0e10cSrcweir #ifndef DBAUI_TABLECONNECTION_HXX 24cdf0e10cSrcweir #define DBAUI_TABLECONNECTION_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir //#ifndef _SV_GEN_HXX 27cdf0e10cSrcweir //#include <tools/gen.hxx> 28cdf0e10cSrcweir //#endif 29cdf0e10cSrcweir //#ifndef DBAUI_CONNECTIONLINE_HXX 30cdf0e10cSrcweir //#include "ConnectionLine.hxx" 31cdf0e10cSrcweir //#endif 32cdf0e10cSrcweir #include <vector> 33cdf0e10cSrcweir #ifndef _TOOLS_DEBUG_HXX 34cdf0e10cSrcweir #include <tools/debug.hxx> 35cdf0e10cSrcweir #endif 36cdf0e10cSrcweir #ifndef _SV_WINDOW_HXX 37cdf0e10cSrcweir #include <vcl/window.hxx> 38cdf0e10cSrcweir #endif 39cdf0e10cSrcweir #ifndef _RTTI_HXX 40cdf0e10cSrcweir #include <tools/rtti.hxx> 41cdf0e10cSrcweir #endif 42cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ 43cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h> 44cdf0e10cSrcweir #endif 45cdf0e10cSrcweir #include "TableConnectionData.hxx" 46cdf0e10cSrcweir 47cdf0e10cSrcweir class Point; 48cdf0e10cSrcweir class Rectangle; 49cdf0e10cSrcweir 50cdf0e10cSrcweir namespace dbaui 51cdf0e10cSrcweir { 52cdf0e10cSrcweir class OTableConnectionData; 53cdf0e10cSrcweir class OTableWindow; 54cdf0e10cSrcweir class OJoinTableView; 55cdf0e10cSrcweir class OConnectionLine; 56cdf0e10cSrcweir 57cdf0e10cSrcweir DBG_NAMEEX(OTableConnection) 58cdf0e10cSrcweir class OTableConnection : public Window 59cdf0e10cSrcweir { 60cdf0e10cSrcweir ::std::vector<OConnectionLine*> m_vConnLine; 61cdf0e10cSrcweir TTableConnectionData::value_type 62cdf0e10cSrcweir m_pData; 63cdf0e10cSrcweir OJoinTableView* m_pParent; 64cdf0e10cSrcweir 65cdf0e10cSrcweir sal_Bool m_bSelected; 66cdf0e10cSrcweir 67cdf0e10cSrcweir void Init(); 68cdf0e10cSrcweir /** clearLineData loops through the vector and deletes all lines 69cdf0e10cSrcweir */ 70cdf0e10cSrcweir void clearLineData(); 71cdf0e10cSrcweir 72cdf0e10cSrcweir protected: 73cdf0e10cSrcweir OConnectionLine* CreateConnLine( const OConnectionLine& rConnLine ); 74cdf0e10cSrcweir 75cdf0e10cSrcweir public: 76cdf0e10cSrcweir OTableConnection( OJoinTableView* pContainer, const TTableConnectionData::value_type& pTabConnData ); 77cdf0e10cSrcweir OTableConnection( const OTableConnection& rConn ); 78cdf0e10cSrcweir // WICHTIG : normalerweise bekomme ich von aussen einen Zeiger auf OTableConnectionData mitgegeben, hier aber muss ich 79cdf0e10cSrcweir // mir (ueber OTableConnectionData::NewInstance) selber eine INstanz anlegen, die ich aber - wie in allen anderen Faellen auch - 80cdf0e10cSrcweir // NIE loesche. Der Aufrufer ist also bei Benutzung dieses Constructors dafuer verantwortlich, meine Daten abzufragen und 81cdf0e10cSrcweir // sich irgendwo zu merken, um sie dann irgendwann zu loeschen. 82cdf0e10cSrcweir virtual ~OTableConnection(); 83cdf0e10cSrcweir 84cdf0e10cSrcweir OTableConnection& operator=( const OTableConnection& rConn ); 85cdf0e10cSrcweir 86cdf0e10cSrcweir 87cdf0e10cSrcweir void Select(); 88cdf0e10cSrcweir void Deselect(); IsSelected() const89cdf0e10cSrcweir sal_Bool IsSelected() const { return m_bSelected; } 90cdf0e10cSrcweir sal_Bool CheckHit( const Point& rMousePos ) const; 91cdf0e10cSrcweir bool InvalidateConnection(); 92cdf0e10cSrcweir void UpdateLineList(); 93cdf0e10cSrcweir 94cdf0e10cSrcweir OTableWindow* GetSourceWin() const; 95cdf0e10cSrcweir OTableWindow* GetDestWin() const; 96cdf0e10cSrcweir 97cdf0e10cSrcweir bool RecalcLines(); 98cdf0e10cSrcweir /** isTableConnection 99cdf0e10cSrcweir @param _pTable the table where we should check if we belongs to it 100cdf0e10cSrcweir 101cdf0e10cSrcweir @return true when the source or the destination window are equal 102cdf0e10cSrcweir */ isTableConnection(const OTableWindow * _pTable)103cdf0e10cSrcweir bool isTableConnection(const OTableWindow* _pTable) 104cdf0e10cSrcweir { 105cdf0e10cSrcweir return (_pTable == GetSourceWin() || _pTable == GetDestWin()); 106cdf0e10cSrcweir } 107cdf0e10cSrcweir 108cdf0e10cSrcweir Rectangle GetBoundingRect() const; 109cdf0e10cSrcweir GetData() const110cdf0e10cSrcweir inline TTableConnectionData::value_type GetData() const { return m_pData; } GetConnLineList() const111cdf0e10cSrcweir const ::std::vector<OConnectionLine*>* GetConnLineList() const { return &m_vConnLine; } GetParent() const112cdf0e10cSrcweir inline OJoinTableView* GetParent() const { return m_pParent; } 113cdf0e10cSrcweir virtual void Draw( const Rectangle& rRect ); 114cdf0e10cSrcweir using Window::Draw; 115cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); 116cdf0e10cSrcweir }; 117cdf0e10cSrcweir } 118cdf0e10cSrcweir #endif // DBAUI_TABLECONNECTION_HXX 119cdf0e10cSrcweir 120