xref: /trunk/main/dbaccess/source/ui/dlg/tablespage.hxx (revision cdf0e10c)
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 #ifndef _DBAUI_TABLESPAGE_HXX_
29 #define _DBAUI_TABLESPAGE_HXX_
30 
31 #ifndef _DBAUI_ADMINPAGES_HXX_
32 #include "adminpages.hxx"
33 #endif
34 #ifndef _COM_SUN_STAR_I18N_XCOLLATOR_HPP_
35 #include <com/sun/star/i18n/XCollator.hpp>
36 #endif
37 #ifndef _OSL_MUTEX_HXX_
38 #include <osl/mutex.hxx>
39 #endif
40 #ifndef _COMPHELPER_STLTYPES_HXX_
41 #include <comphelper/stl_types.hxx>
42 #endif
43 #ifndef _SV_FIXED_HXX
44 #include <vcl/fixed.hxx>
45 #endif
46 #ifndef _DBAUI_TABLETREE_HXX_
47 #include "tabletree.hxx"
48 #endif
49 #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
50 #include <com/sun/star/sdbc/XConnection.hpp>
51 #endif
52 
53 
54 //.........................................................................
55 namespace dbaui
56 {
57 //.........................................................................
58 
59 	//========================================================================
60 	//= OTableSubscriptionPage
61 	//========================================================================
62 	class OTableSubscriptionDialog;
63 	class OTableSubscriptionPage
64 			:public OGenericAdministrationPage
65 	{
66 	private:
67 		FixedLine				m_aTables;
68 		OTableTreeListBox		m_aTablesList;
69 		FixedText				m_aExplanation;
70 
71 		::rtl::OUString			m_sCatalogSeparator;
72 		sal_Bool				m_bCheckedAll : 1;
73 		sal_Bool				m_bCatalogAtStart : 1;
74 
75 		::osl::Mutex			m_aNotifierMutex;
76 
77 		::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
78 								m_xCurrentConnection;	/// valid as long as the page is active
79 		::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator >
80 								m_xCollator;
81 		OTableSubscriptionDialog* m_pTablesDlg;
82 
83 	public:
84 		virtual	sal_Bool			FillItemSet(SfxItemSet& _rCoreAttrs);
85 		virtual int				DeactivatePage(SfxItemSet* _pSet);
86         using OGenericAdministrationPage::DeactivatePage;
87 
88 		virtual void 			StateChanged( StateChangedType nStateChange );
89 		virtual void 			DataChanged( const DataChangedEvent& rDCEvt );
90 
91 
92 		/** will be called when the controls need to be resized.
93 		*/
94 		virtual void			resizeControls(const Size& _rDiff);
95 
96 		OTableSubscriptionPage( Window* pParent, const SfxItemSet& _rCoreAttrs ,OTableSubscriptionDialog* _pTablesDlg);
97 		virtual ~OTableSubscriptionPage();
98 
99 	protected:
100 		virtual void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
101 		virtual void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
102 
103 		DECL_LINK( OnTreeEntryCompare, const SvSortData* );
104 		DECL_LINK( OnTreeEntryChecked, Control* );
105 
106 	private:
107 
108 
109 		/**	check the tables in <member>m_aTablesList</member> according to <arg>_rTables</arg>
110 		*/
111 		void implCheckTables(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rTables);
112 
113 		/// returns the next sibling, if not available, the next sibling of the parent, a.s.o.
114 		SvLBoxEntry* implNextSibling(SvLBoxEntry* _pEntry) const;
115 
116 		/** return the current selection in <member>m_aTablesList</member>
117 		*/
118 		::com::sun::star::uno::Sequence< ::rtl::OUString > collectDetailedSelection() const;
119 
120 		/// (un)check all entries
121 		void CheckAll( sal_Bool bCheck = sal_True );
122 
123 		virtual void implInitControls(const SfxItemSet& _rSet, sal_Bool _bSaveValue);
124 
125 		// checks the tables according to the filter given
126 		// in oppsofite to implCheckTables, this method handles the case of an empty sequence, too ...
127 		void implCompleteTablesCheck( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rTableFilter );
128 	};
129 
130 //.........................................................................
131 }	// namespace dbaui
132 //.........................................................................
133 
134 #endif // _DBAUI_TABLESPAGE_HXX_
135 
136