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
10*2e2212a7SAndrew Rist  *
11*2e2212a7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2e2212a7SAndrew Rist  *
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.
19*2e2212a7SAndrew Rist  *
20*2e2212a7SAndrew Rist  *************************************************************/
21*2e2212a7SAndrew Rist 
22*2e2212a7SAndrew Rist 
23cdf0e10cSrcweir #ifndef DBAUI_QUERY_TABLEWINDOW_HXX
24cdf0e10cSrcweir #define DBAUI_QUERY_TABLEWINDOW_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #ifndef DBAUI_TABLEWINDOW_HXX
27cdf0e10cSrcweir #include "TableWindow.hxx"
28cdf0e10cSrcweir #endif
29cdf0e10cSrcweir #ifndef DBAUI_QUERY_TABLEWINDOWDATA_HXX
30cdf0e10cSrcweir #include "QTableWindowData.hxx"
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #ifndef DBAUI_TABLEFIELDDESC_HXX
33cdf0e10cSrcweir #include "TableFieldDescription.hxx"
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir #ifndef _RTTI_HXX
36cdf0e10cSrcweir #include <tools/rtti.hxx>
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir 
39cdf0e10cSrcweir namespace dbaui
40cdf0e10cSrcweir {
41cdf0e10cSrcweir 	//==================================================================
42cdf0e10cSrcweir 	class OQueryTableWindow : public OTableWindow
43cdf0e10cSrcweir 	{
44cdf0e10cSrcweir 		sal_Int32			m_nAliasNum;
45cdf0e10cSrcweir 		::rtl::OUString		m_strInitialAlias;
46cdf0e10cSrcweir 	public:
47cdf0e10cSrcweir 		OQueryTableWindow( Window* pParent, const TTableWindowData::value_type& pTabWinData, sal_Unicode* pszInitialAlias = NULL );
48cdf0e10cSrcweir 		virtual ~OQueryTableWindow();
49cdf0e10cSrcweir 
GetAliasName() const50cdf0e10cSrcweir 		::rtl::OUString	GetAliasName() const
51cdf0e10cSrcweir 		{
52cdf0e10cSrcweir 			return static_cast<OQueryTableWindowData*>(GetData().get())->GetAliasName();
53cdf0e10cSrcweir 		}
SetAliasName(const::rtl::OUString & strNewAlias)54cdf0e10cSrcweir 		void			SetAliasName(const ::rtl::OUString& strNewAlias)
55cdf0e10cSrcweir 		{
56cdf0e10cSrcweir 			static_cast<OQueryTableWindowData*>(GetData().get())->SetAliasName(strNewAlias);
57cdf0e10cSrcweir 		}
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 		// spaeter Constructor, die Basisklasse ERZEUGT beim ersten Aufruf die Listbox
60cdf0e10cSrcweir 		virtual sal_Bool	Init();
61cdf0e10cSrcweir 
GetAliasNum() const62cdf0e10cSrcweir 		inline sal_Int32		GetAliasNum() const	{ return m_nAliasNum; }
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 		sal_Bool			ExistsField(const ::rtl::OUString& strFieldName, OTableFieldDescRef& rInfo);
65cdf0e10cSrcweir 		sal_Bool			ExistsAVisitedConn() const;
66cdf0e10cSrcweir 
GetName() const67cdf0e10cSrcweir 		virtual ::rtl::OUString		GetName() const { return GetWinName(); }
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 	protected:
70cdf0e10cSrcweir 		virtual void	KeyInput( const KeyEvent& rEvt );
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 		virtual void	OnEntryDoubleClicked(SvLBoxEntry* pEntry);
73cdf0e10cSrcweir 			// wird aus dem DoubleClickHdl der ListBox heraus aufgerufen
74cdf0e10cSrcweir 		/** delete the user data with the equal type as created within createUserData
75cdf0e10cSrcweir 			@param	_pUserData
76cdf0e10cSrcweir 				The user data store in the listbox entries. Created with a call to createUserData.
77cdf0e10cSrcweir 				_pUserData may be <NULL/>.
78cdf0e10cSrcweir 		*/
79cdf0e10cSrcweir 		virtual void deleteUserData(void*& _pUserData);
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 		/** creates user information that will be append at the ListBoxentry
82cdf0e10cSrcweir 			@param	_xColumn
83cdf0e10cSrcweir 				The corresponding column, can be <NULL/>.
84cdf0e10cSrcweir 			@param	_bPrimaryKey
85cdf0e10cSrcweir 				<TRUE/> when the column belongs to the primary key
86cdf0e10cSrcweir 			@return
87cdf0e10cSrcweir 				the user data which will be append at the listbox entry, may be <NULL/>
88cdf0e10cSrcweir 		*/
89cdf0e10cSrcweir 		virtual void* createUserData(const ::com::sun::star::uno::Reference<
90cdf0e10cSrcweir 									::com::sun::star::beans::XPropertySet>& _xColumn,
91cdf0e10cSrcweir 									bool _bPrimaryKey);
92cdf0e10cSrcweir 	};
93cdf0e10cSrcweir }
94cdf0e10cSrcweir #endif // DBAUI_QUERY_TABLEWINDOW_HXX
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 
97