xref: /trunk/main/cui/source/inc/dbregister.hxx (revision c4eee24d)
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 SVX_DBREGISTER_HXX
25 #define SVX_DBREGISTER_HXX
26 
27 #include "optpath.hxx"
28 #include <tools/string.hxx>
29 #include <comphelper/stl_types.hxx>
30 #include <svl/poolitem.hxx>
31 #include "ControlFocusHelper.hxx"
32 #include <sfx2/basedlgs.hxx>
33 
34 class SvLBoxEntry;
35 namespace svx
36 {
37 	class OptHeaderTabListBox;
38 }
39 //........................................................................
40 namespace svx
41 {
42 //........................................................................
43 
44     //====================================================================
45 	//= DbRegistrationOptionsPage
46 	//====================================================================
47 	class DbRegistrationOptionsPage : public SfxTabPage
48 	{
49 	private:
50 		FixedLine           aStdBox;
51 		FixedText			aTypeText;
52 		FixedText			aPathText;
53 		SvxControlFocusHelper	aPathCtrl;
54 		PushButton			m_aNew;
55 		PushButton			m_aEdit;
56 		PushButton      	m_aDelete;
57 
58 		HeaderBar*			pHeaderBar;
59 		::svx::OptHeaderTabListBox*	pPathBox;
60 		SvLBoxEntry*		m_pCurEntry;
61 		sal_uLong				m_nOldCount;
62 		sal_Bool				m_bModified;
63 
64 #ifdef SVX_DBREGISTER_HXX
65 		DECL_LINK( NewHdl, void * );
66 		DECL_LINK( EditHdl, void * );
67 		DECL_LINK( DeleteHdl, void * );
68 
69 		DECL_LINK( PathSelect_Impl, SvTabListBox* );
70 
71 		DECL_LINK( HeaderSelect_Impl, HeaderBar * );
72 		DECL_LINK( HeaderEndDrag_Impl, HeaderBar * );
73 		DECL_LINK( NameValidator, String*);
74 
75 
76 		/** inserts a new entry in the tablistbox
77 			@param	_sName
78 				The name of the entry.
79 			@param	_sLocation
80 				The location of the file.
81 		*/
82 		void insertNewEntry( const ::rtl::OUString& _sName,const ::rtl::OUString& _sLocation, const bool bReadOnly );
83 
84 		/** opens the LinkDialog to create a register pair
85 			@param	_sOldName
86 				The old name of the entry may be empty.
87 			@param	_sOldLocation
88 				The old location of the entry may be empty.
89 			@param	_pEntry
90 				The entry to remove if the entry will be changed
91 		*/
92 		void openLinkDialog(const String& _sOldName,const String& _sOldLocation,SvLBoxEntry* _pEntry = NULL);
93 
94 #endif
95 
96 	public:
97 		DbRegistrationOptionsPage( Window* pParent, const SfxItemSet& rSet );
98 		virtual ~DbRegistrationOptionsPage();
99 
100 		static SfxTabPage*	Create( Window* pParent, const SfxItemSet& rSet );
101 		static sal_uInt16*		GetRanges();
102 
103 		virtual	sal_Bool 		FillItemSet( SfxItemSet& rSet );
104 		virtual	void 		Reset( const SfxItemSet& rSet );
105 		virtual void        FillUserData();
106 	};
107 
108     //====================================================================
109 	//= RegistrationItemSetHolder
110 	//====================================================================
111     /** helper for DatabaseRegistrationDialog
112 
113         Necessary so that DatabaseRegistrationDialog is self-contained, i.e. always reflects
114         the current registration state.
115     */
116     class RegistrationItemSetHolder
117     {
118     private:
119         SfxItemSet  m_aRegistrationItems;
120 
121     protected:
122         RegistrationItemSetHolder( const SfxItemSet& _rMasterSet );
123         ~RegistrationItemSetHolder();
124 
125     protected:
getRegistrationItems() const126         const SfxItemSet& getRegistrationItems() const { return m_aRegistrationItems; }
127     };
128 
129     //====================================================================
130 	//= DatabaseRegistrationDialog
131 	//====================================================================
132     class DatabaseRegistrationDialog    :public RegistrationItemSetHolder
133                                         ,public SfxSingleTabDialog
134     {
135     public:
136 	    DatabaseRegistrationDialog( Window* pParent, const SfxItemSet& rAttr );
137 	    ~DatabaseRegistrationDialog();
138 
139         virtual short	Execute();
140     };
141 
142 //........................................................................
143 }	// namespace svx
144 //........................................................................
145 
146 #endif // SVX_DBREGISTER_HXX
147 
148 
149