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 
24cdf0e10cSrcweir #ifndef DBAUI_TEXTCONNECTIONHELPER_HXX
25cdf0e10cSrcweir #define DBAUI_TEXTCONNECTIONHELPER_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef DBAUI_CONNECTIONPAGESETUP_HXX
28cdf0e10cSrcweir #include "ConnectionPageSetup.hxx"
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #ifndef _DBAUI_ADMINPAGES_HXX_
31cdf0e10cSrcweir #include "adminpages.hxx"
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef CHARSETLISTBOX_HXX
34cdf0e10cSrcweir #include "charsetlistbox.hxx"
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #ifndef _UCBHELPER_CONTENT_HXX
37cdf0e10cSrcweir #include <ucbhelper/content.hxx>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #ifndef _DBAUI_CURLEDIT_HXX_
40cdf0e10cSrcweir #include "curledit.hxx"
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #ifndef SVTOOLS_INC_ROADMAPWIZARD_HXX
43cdf0e10cSrcweir #include <svtools/roadmapwizard.hxx>
44cdf0e10cSrcweir #endif
45cdf0e10cSrcweir #ifndef _SV_FIELD_HXX
46cdf0e10cSrcweir #include <vcl/field.hxx>
47cdf0e10cSrcweir #endif
48cdf0e10cSrcweir #ifndef _RTL_USTRING_HXX_
49cdf0e10cSrcweir #include <rtl/ustring.hxx>
50cdf0e10cSrcweir #endif
51cdf0e10cSrcweir #ifndef _SV_LSTBOX_HXX
52cdf0e10cSrcweir #include <vcl/lstbox.hxx>
53cdf0e10cSrcweir #endif
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 
56cdf0e10cSrcweir //.........................................................................
57cdf0e10cSrcweir namespace dbaui
58cdf0e10cSrcweir 
59cdf0e10cSrcweir {
60cdf0e10cSrcweir //.........................................................................
61cdf0e10cSrcweir 
62cdf0e10cSrcweir     #define TC_EXTENSION    ((short)0x01)   // a section specifying the extension of the files to connect to
63cdf0e10cSrcweir     #define TC_SEPARATORS   ((short)0x02)   // a section specifying the various separators
64cdf0e10cSrcweir     #define TC_HEADER       ((short)0x04)   // a section containing the "Text contains header" check box only
65cdf0e10cSrcweir     #define TC_CHARSET      ((short)0x08)   // not yet implemented
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 	//========================================================================
68cdf0e10cSrcweir 	//= OTextConnectionPage
69cdf0e10cSrcweir 	//========================================================================
70cdf0e10cSrcweir 	class OTextConnectionHelper : public Control
71cdf0e10cSrcweir 	{
72cdf0e10cSrcweir         OTextConnectionHelper();
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 		Link		m_aModifiedHandler;		/// to be called if something on the page has been modified
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     public:
77cdf0e10cSrcweir 		OTextConnectionHelper( Window* pParent, const short _nAvailableSections );
78cdf0e10cSrcweir         virtual ~OTextConnectionHelper();
79cdf0e10cSrcweir 
80cdf0e10cSrcweir     private:
81cdf0e10cSrcweir         FixedText   m_aFTExtensionHeader;
82cdf0e10cSrcweir         RadioButton m_aRBAccessTextFiles;
83cdf0e10cSrcweir         RadioButton m_aRBAccessCSVFiles;
84cdf0e10cSrcweir         RadioButton m_aRBAccessOtherFiles;
85cdf0e10cSrcweir         Edit        m_aETOwnExtension;
86cdf0e10cSrcweir         FixedText   m_aFTExtensionExample;
87cdf0e10cSrcweir 		FixedLine	m_aLineFormat;
88cdf0e10cSrcweir 		FixedText	m_aFieldSeparatorLabel;
89cdf0e10cSrcweir 		ComboBox	m_aFieldSeparator;
90cdf0e10cSrcweir 		FixedText	m_aTextSeparatorLabel;
91cdf0e10cSrcweir 		ComboBox	m_aTextSeparator;
92cdf0e10cSrcweir 		FixedText	m_aDecimalSeparatorLabel;
93cdf0e10cSrcweir 		ComboBox	m_aDecimalSeparator;
94cdf0e10cSrcweir 		FixedText	m_aThousandsSeparatorLabel;
95cdf0e10cSrcweir 		ComboBox	m_aThousandsSeparator;
96cdf0e10cSrcweir   		CheckBox	m_aRowHeader;
97cdf0e10cSrcweir         FixedLine   m_aCharSetHeader;
98cdf0e10cSrcweir         FixedText   m_aCharSetLabel;
99cdf0e10cSrcweir         CharSetListBox  m_aCharSet;
100cdf0e10cSrcweir 		String		m_aFieldSeparatorList;
101cdf0e10cSrcweir 		String		m_aTextSeparatorList;
102cdf0e10cSrcweir 		String		m_aTextNone;
103cdf0e10cSrcweir         String      m_aOldExtension;
104cdf0e10cSrcweir         Link		m_aGetExtensionHandler;	/// to be called if a new type is selected
105cdf0e10cSrcweir 
106cdf0e10cSrcweir         short       m_nAvailableSections;
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     protected:
callModifiedHdl() const109cdf0e10cSrcweir 		void callModifiedHdl() const { if (m_aModifiedHandler.IsSet()) m_aModifiedHandler.Call((void*)this); }
getControlModifiedLink()110cdf0e10cSrcweir         Link getControlModifiedLink() { return LINK(this, OTextConnectionHelper, OnControlModified); }
111cdf0e10cSrcweir         DECL_LINK(OnSetExtensionHdl,RadioButton*);
112cdf0e10cSrcweir         DECL_LINK(OnControlModified,Control*);
113cdf0e10cSrcweir 		DECL_LINK(OnEditModified,Edit*);
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 	private:
116cdf0e10cSrcweir 		String		GetSeparator( const ComboBox& rBox, const String& rList );
117cdf0e10cSrcweir 		void		SetSeparator( ComboBox& rBox, const String& rList, const String& rVal );
118cdf0e10cSrcweir         void        SetExtension(const String& _rVal);
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     public:
122cdf0e10cSrcweir 		void        implInitControls(const SfxItemSet& _rSet, sal_Bool _bValid);
123cdf0e10cSrcweir 		void        fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
124cdf0e10cSrcweir 		void        fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
SetClickHandler(const Link & _rHandler)125cdf0e10cSrcweir         void        SetClickHandler(const Link& _rHandler) { m_aGetExtensionHandler = _rHandler; }
126cdf0e10cSrcweir         String      GetExtension();
127cdf0e10cSrcweir         sal_Bool FillItemSet( SfxItemSet& rSet, const sal_Bool bChangedSomething );
128cdf0e10cSrcweir         sal_Bool prepareLeave();
129cdf0e10cSrcweir 	};
130cdf0e10cSrcweir 
131cdf0e10cSrcweir //.........................................................................
132cdf0e10cSrcweir }	// namespace dbaui
133cdf0e10cSrcweir //.........................................................................
134cdf0e10cSrcweir 
135cdf0e10cSrcweir #endif // DBAUI_DBWIZ2_HXX
136cdf0e10cSrcweir 
137