1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_dbui.hxx"
26 #ifndef DBAUI_JOINDESIGNVIEW_HXX
27 #include "JoinDesignView.hxx"
28 #endif
29 #ifndef DBAUI_JOINTABLEVIEW_HXX
30 #include "JoinTableView.hxx"
31 #endif
32 #ifndef DBAUI_JOINCONTROLLER_HXX
33 #include "JoinController.hxx"
34 #endif
35 #ifndef _UNDO_HXX
36 #include <svl/undo.hxx>
37 #endif
38 #ifndef DBAUI_QYDLGTAB_HXX
39 #include "adtabdlg.hxx"
40 #endif
41 #ifndef _SV_SVAPP_HXX
42 #include <vcl/svapp.hxx>
43 #endif
44 #ifndef _SV_MSGBOX_HXX
45 #include <vcl/msgbox.hxx>
46 #endif
47 #ifndef DBACCESS_UI_BROWSER_ID_HXX
48 #include "browserids.hxx"
49 #endif
50 #ifndef _DBU_QRY_HRC_
51 #include "dbu_qry.hrc"
52 #endif
53 #ifndef _COMPHELPER_TYPES_HXX_
54 #include <comphelper/types.hxx>
55 #endif
56 #ifndef _CONNECTIVITY_DBTOOLS_HXX_
57 #include <connectivity/dbtools.hxx>
58 #endif
59 #ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
60 #include <com/sun/star/sdbc/DataType.hpp>
61 #endif
62 #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
63 #include <com/sun/star/container/XNameAccess.hpp>
64 #endif
65 #ifndef DBAUI_TABLECONNECTION_HXX
66 #include "TableConnection.hxx"
67 #endif
68 #ifndef DBAUI_CONNECTIONLINE_HXX
69 #include "ConnectionLine.hxx"
70 #endif
71 #ifndef DBAUI_CONNECTIONLINEDATA_HXX
72 #include "ConnectionLineData.hxx"
73 #endif
74 #ifndef DBAUI_TABLECONNECTIONDATA_HXX
75 #include "TableConnectionData.hxx"
76 #endif
77 #ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
78 #include "dbustrings.hrc"
79 #endif
80 #ifndef _COMPHELPER_EXTRACT_HXX_
81 #include <comphelper/extract.hxx>
82 #endif
83 #ifndef DBAUI_TOOLS_HXX
84 #include "UITools.hxx"
85 #endif
86 #ifndef DBAUI_JOINTABLEVIEW_HXX
87 #include "JoinTableView.hxx"
88 #endif
89 //	#include <com/sun/star/util/URL.hdl>
90 
91 using namespace ::com::sun::star::uno;
92 using namespace ::com::sun::star::lang;
93 using namespace ::com::sun::star::i18n;
94 using namespace ::com::sun::star::sdbc;
95 using namespace ::com::sun::star::beans;
96 using namespace ::com::sun::star::container;
97 using namespace ::com::sun::star::util;
98 
99 namespace dbaui
100 {
101 
102 // =============================================================================
103 // = OJoinDesignView
104 // =============================================================================
105 // -----------------------------------------------------------------------------
OJoinDesignView(Window * _pParent,OJoinController & _rController,const Reference<XMultiServiceFactory> & _rFactory)106 OJoinDesignView::OJoinDesignView(Window* _pParent, OJoinController& _rController,const Reference< XMultiServiceFactory >& _rFactory)
107 	:ODataView( _pParent, _rController, _rFactory )
108 	,m_pTableView(NULL)
109 	,m_rController( _rController )
110 {
111 	m_pScrollWindow = new OScrollWindowHelper(this);
112 }
113 // -----------------------------------------------------------------------------
~OJoinDesignView()114 OJoinDesignView::~OJoinDesignView()
115 {
116 	::std::auto_ptr<Window> aT3(m_pScrollWindow);
117 	m_pScrollWindow = NULL;
118 	::std::auto_ptr<Window> aT2(m_pTableView);
119 	m_pTableView = NULL;
120 }
121 // -------------------------------------------------------------------------
Construct()122 void OJoinDesignView::Construct()
123 {
124 	m_pScrollWindow->setTableView(m_pTableView);
125 	m_pScrollWindow->Show();
126 	m_pTableView->Show();
127 
128 	SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor()) );
129 
130 	ODataView::Construct();
131 }
132 // -----------------------------------------------------------------------------
initialize()133 void OJoinDesignView::initialize()
134 {
135 	//	getAddTableDialog()->Update();
136 }
137 // -------------------------------------------------------------------------
resizeDocumentView(Rectangle & _rPlayground)138 void OJoinDesignView::resizeDocumentView(Rectangle& _rPlayground)
139 {
140 	m_pScrollWindow->SetPosSizePixel( _rPlayground.TopLeft(), _rPlayground.GetSize() );
141 
142 	// just for completeness: there is no space left, we occupied it all ...
143 	_rPlayground.SetPos( _rPlayground.BottomRight() );
144 	_rPlayground.SetSize( Size( 0, 0 ) );
145 }
146 // -----------------------------------------------------------------------------
setReadOnly(sal_Bool)147 void OJoinDesignView::setReadOnly(sal_Bool /*_bReadOnly*/)
148 {
149 }
150 // -----------------------------------------------------------------------------
SaveTabWinUIConfig(OTableWindow * pWin)151 void OJoinDesignView::SaveTabWinUIConfig(OTableWindow* pWin)
152 {
153 	getController().SaveTabWinPosSize(pWin, m_pScrollWindow->GetHScrollBar()->GetThumbPos(), m_pScrollWindow->GetVScrollBar()->GetThumbPos());
154 }
155 // -----------------------------------------------------------------------------
KeyInput(const KeyEvent & rEvt)156 void OJoinDesignView::KeyInput( const KeyEvent& rEvt )
157 {
158 	if ( m_pTableView && m_pTableView->IsVisible() )
159 		m_pTableView->KeyInput( rEvt );
160 	else
161 		ODataView::KeyInput(rEvt);
162 }
163 // -----------------------------------------------------------------------------
164 
165 }   // namespace dbaui
166 
167