1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_dbaccess.hxx"
30 #ifndef DBAUI_RELATIONDESIGNVIEW_HXX
31 #include "RelationDesignView.hxx"
32 #endif
33 #ifndef DBAUI_RELATION_TABLEVIEW_HXX
34 #include "RelationTableView.hxx"
35 #endif
36 #ifndef DBAUI_RELATIONCONTROLLER_HXX
37 #include "RelationController.hxx"
38 #endif
39 #ifndef _UNDO_HXX
40 #include <svl/undo.hxx>
41 #endif
42 #ifndef _SV_SVAPP_HXX
43 #include <vcl/svapp.hxx>
44 #endif
45 #ifndef _SV_MSGBOX_HXX
46 #include <vcl/msgbox.hxx>
47 #endif
48 #ifndef DBACCESS_UI_BROWSER_ID_HXX
49 #include "browserids.hxx"
50 #endif
51 #ifndef _DBU_REL_HRC_
52 #include "dbu_rel.hrc"
53 #endif
54 #ifndef _COMPHELPER_TYPES_HXX_
55 #include <comphelper/types.hxx>
56 #endif
57 #ifndef _CONNECTIVITY_DBTOOLS_HXX_
58 #include <connectivity/dbtools.hxx>
59 #endif
60 #ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
61 #include <com/sun/star/sdbc/DataType.hpp>
62 #endif
63 #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
64 #include <com/sun/star/container/XNameAccess.hpp>
65 #endif
66 #ifndef DBAUI_RTABLECONNECTION_HXX
67 #include "RTableConnection.hxx"
68 #endif
69 #ifndef DBAUI_CONNECTIONLINE_HXX
70 #include "ConnectionLine.hxx"
71 #endif
72 #ifndef DBAUI_CONNECTIONLINEDATA_HXX
73 #include "ConnectionLineData.hxx"
74 #endif
75 #ifndef DBAUI_RTABLECONNECTIONDATA_HXX
76 #include "RTableConnectionData.hxx"
77 #endif
78 #ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
79 #include "dbustrings.hrc"
80 #endif
81 #ifndef _COMPHELPER_EXTRACT_HXX_
82 #include <comphelper/extract.hxx>
83 #endif
84 #ifndef DBAUI_TOOLS_HXX
85 #include "UITools.hxx"
86 #endif
87 #ifndef _TOOLS_DEBUG_HXX
88 #include <tools/debug.hxx>
89 #endif
90 
91 using namespace ::dbaui;
92 using namespace ::com::sun::star::uno;
93 using namespace ::com::sun::star::lang;
94 using namespace ::com::sun::star::sdbc;
95 using namespace ::com::sun::star::beans;
96 using namespace ::com::sun::star::container;
97 
98 DBG_NAME(ORelationDesignView)
99 ORelationDesignView::ORelationDesignView(Window* _pParent, ORelationController& _rController,const Reference< XMultiServiceFactory >& _rFactory)
100 	:OJoinDesignView( _pParent, _rController, _rFactory )
101 {
102 	DBG_CTOR(ORelationDesignView,NULL);
103 }
104 // -----------------------------------------------------------------------------
105 ORelationDesignView::~ORelationDesignView()
106 {
107 	DBG_DTOR(ORelationDesignView,NULL);
108 }
109 // -------------------------------------------------------------------------
110 void ORelationDesignView::Construct()
111 {
112 	m_pTableView	= new ORelationTableView(m_pScrollWindow,this);
113 	OJoinDesignView::Construct();
114 }
115 // -----------------------------------------------------------------------------
116 void ORelationDesignView::initialize()
117 {
118 	m_pTableView->clearLayoutInformation();
119 	m_pTableView->ReSync();
120 
121 	OJoinDesignView::initialize();
122 }
123 // -----------------------------------------------------------------------------
124 long ORelationDesignView::PreNotify( NotifyEvent& rNEvt )
125 {
126 	long nDone = 0L;
127 	if(rNEvt.GetType() == EVENT_GETFOCUS)
128 	{
129 		if(!m_pTableView->HasChildPathFocus())
130 		{
131 			m_pTableView->GrabTabWinFocus();
132 			nDone = 1L;
133 		}
134 	}
135 	if(!nDone)
136 		nDone = OJoinDesignView::PreNotify(rNEvt);
137 	return nDone;
138 }
139 // -----------------------------------------------------------------------------
140 void ORelationDesignView::GetFocus()
141 {
142 	OJoinDesignView::GetFocus();
143 	if ( m_pTableView && m_pTableView->IsVisible() && !m_pTableView->GetTabWinMap()->empty() )
144 		m_pTableView->GrabTabWinFocus();
145 }
146 // -----------------------------------------------------------------------------
147 
148 
149 
150 
151 
152 
153 
154