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