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_JOINDESIGNVIEW_HXX
31 #include "JoinDesignView.hxx"
32 #endif
33 #ifndef DBAUI_JOINTABLEVIEW_HXX
34 #include "JoinTableView.hxx"
35 #endif
36 #ifndef DBAUI_JOINCONTROLLER_HXX
37 #include "JoinController.hxx"
38 #endif
39 #ifndef _UNDO_HXX
40 #include <svl/undo.hxx>
41 #endif
42 #ifndef DBAUI_QYDLGTAB_HXX
43 #include "adtabdlg.hxx"
44 #endif
45 #ifndef _SV_SVAPP_HXX
46 #include <vcl/svapp.hxx>
47 #endif
48 #ifndef _SV_MSGBOX_HXX
49 #include <vcl/msgbox.hxx>
50 #endif
51 #ifndef DBACCESS_UI_BROWSER_ID_HXX
52 #include "browserids.hxx"
53 #endif
54 #ifndef _DBU_QRY_HRC_
55 #include "dbu_qry.hrc"
56 #endif
57 #ifndef _COMPHELPER_TYPES_HXX_
58 #include <comphelper/types.hxx>
59 #endif
60 #ifndef _CONNECTIVITY_DBTOOLS_HXX_
61 #include <connectivity/dbtools.hxx>
62 #endif
63 #ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
64 #include <com/sun/star/sdbc/DataType.hpp>
65 #endif
66 #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
67 #include <com/sun/star/container/XNameAccess.hpp>
68 #endif
69 #ifndef DBAUI_TABLECONNECTION_HXX
70 #include "TableConnection.hxx"
71 #endif
72 #ifndef DBAUI_CONNECTIONLINE_HXX
73 #include "ConnectionLine.hxx"
74 #endif
75 #ifndef DBAUI_CONNECTIONLINEDATA_HXX
76 #include "ConnectionLineData.hxx"
77 #endif
78 #ifndef DBAUI_TABLECONNECTIONDATA_HXX
79 #include "TableConnectionData.hxx"
80 #endif
81 #ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
82 #include "dbustrings.hrc"
83 #endif
84 #ifndef _COMPHELPER_EXTRACT_HXX_
85 #include <comphelper/extract.hxx>
86 #endif
87 #ifndef DBAUI_TOOLS_HXX
88 #include "UITools.hxx"
89 #endif
90 #ifndef DBAUI_JOINTABLEVIEW_HXX
91 #include "JoinTableView.hxx"
92 #endif
93 //	#include <com/sun/star/util/URL.hdl>
94 
95 using namespace ::com::sun::star::uno;
96 using namespace ::com::sun::star::lang;
97 using namespace ::com::sun::star::i18n;
98 using namespace ::com::sun::star::sdbc;
99 using namespace ::com::sun::star::beans;
100 using namespace ::com::sun::star::container;
101 using namespace ::com::sun::star::util;
102 
103 namespace dbaui
104 {
105 
106 // =============================================================================
107 // = OJoinDesignView
108 // =============================================================================
109 // -----------------------------------------------------------------------------
110 OJoinDesignView::OJoinDesignView(Window* _pParent, OJoinController& _rController,const Reference< XMultiServiceFactory >& _rFactory)
111 	:ODataView( _pParent, _rController, _rFactory )
112 	,m_pTableView(NULL)
113 	,m_rController( _rController )
114 {
115 	m_pScrollWindow = new OScrollWindowHelper(this);
116 }
117 // -----------------------------------------------------------------------------
118 OJoinDesignView::~OJoinDesignView()
119 {
120 	::std::auto_ptr<Window> aT3(m_pScrollWindow);
121 	m_pScrollWindow = NULL;
122 	::std::auto_ptr<Window> aT2(m_pTableView);
123 	m_pTableView = NULL;
124 }
125 // -------------------------------------------------------------------------
126 void OJoinDesignView::Construct()
127 {
128 	m_pScrollWindow->setTableView(m_pTableView);
129 	m_pScrollWindow->Show();
130 	m_pTableView->Show();
131 
132 	SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor()) );
133 
134 	ODataView::Construct();
135 }
136 // -----------------------------------------------------------------------------
137 void OJoinDesignView::initialize()
138 {
139 	//	getAddTableDialog()->Update();
140 }
141 // -------------------------------------------------------------------------
142 void OJoinDesignView::resizeDocumentView(Rectangle& _rPlayground)
143 {
144 	m_pScrollWindow->SetPosSizePixel( _rPlayground.TopLeft(), _rPlayground.GetSize() );
145 
146 	// just for completeness: there is no space left, we occupied it all ...
147 	_rPlayground.SetPos( _rPlayground.BottomRight() );
148 	_rPlayground.SetSize( Size( 0, 0 ) );
149 }
150 // -----------------------------------------------------------------------------
151 void OJoinDesignView::setReadOnly(sal_Bool /*_bReadOnly*/)
152 {
153 }
154 // -----------------------------------------------------------------------------
155 void OJoinDesignView::SaveTabWinUIConfig(OTableWindow* pWin)
156 {
157 	getController().SaveTabWinPosSize(pWin, m_pScrollWindow->GetHScrollBar()->GetThumbPos(), m_pScrollWindow->GetVScrollBar()->GetThumbPos());
158 }
159 // -----------------------------------------------------------------------------
160 void OJoinDesignView::KeyInput( const KeyEvent& rEvt )
161 {
162 	if ( m_pTableView && m_pTableView->IsVisible() )
163 		m_pTableView->KeyInput( rEvt );
164 	else
165 		ODataView::KeyInput(rEvt);
166 }
167 // -----------------------------------------------------------------------------
168 
169 }   // namespace dbaui
170 
171