1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef DBAUI_TEXTCONNECTIONHELPER_HXX
29*cdf0e10cSrcweir #define DBAUI_TEXTCONNECTIONHELPER_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #ifndef DBAUI_CONNECTIONPAGESETUP_HXX
32*cdf0e10cSrcweir #include "ConnectionPageSetup.hxx"
33*cdf0e10cSrcweir #endif
34*cdf0e10cSrcweir #ifndef _DBAUI_ADMINPAGES_HXX_
35*cdf0e10cSrcweir #include "adminpages.hxx"
36*cdf0e10cSrcweir #endif
37*cdf0e10cSrcweir #ifndef CHARSETLISTBOX_HXX
38*cdf0e10cSrcweir #include "charsetlistbox.hxx"
39*cdf0e10cSrcweir #endif
40*cdf0e10cSrcweir #ifndef _UCBHELPER_CONTENT_HXX
41*cdf0e10cSrcweir #include <ucbhelper/content.hxx>
42*cdf0e10cSrcweir #endif
43*cdf0e10cSrcweir #ifndef _DBAUI_CURLEDIT_HXX_
44*cdf0e10cSrcweir #include "curledit.hxx"
45*cdf0e10cSrcweir #endif
46*cdf0e10cSrcweir #ifndef SVTOOLS_INC_ROADMAPWIZARD_HXX
47*cdf0e10cSrcweir #include <svtools/roadmapwizard.hxx>
48*cdf0e10cSrcweir #endif
49*cdf0e10cSrcweir #ifndef _SV_FIELD_HXX
50*cdf0e10cSrcweir #include <vcl/field.hxx>
51*cdf0e10cSrcweir #endif
52*cdf0e10cSrcweir #ifndef _RTL_USTRING_HXX_
53*cdf0e10cSrcweir #include <rtl/ustring.hxx>
54*cdf0e10cSrcweir #endif
55*cdf0e10cSrcweir #ifndef _SV_LSTBOX_HXX
56*cdf0e10cSrcweir #include <vcl/lstbox.hxx>
57*cdf0e10cSrcweir #endif
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir //.........................................................................
61*cdf0e10cSrcweir namespace dbaui
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir {
64*cdf0e10cSrcweir //.........................................................................
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir     #define TC_EXTENSION    ((short)0x01)   // a section specifying the extension of the files to connect to
67*cdf0e10cSrcweir     #define TC_SEPARATORS   ((short)0x02)   // a section specifying the various separators
68*cdf0e10cSrcweir     #define TC_HEADER       ((short)0x04)   // a section containing the "Text contains header" check box only
69*cdf0e10cSrcweir     #define TC_CHARSET      ((short)0x08)   // not yet implemented
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir 	//========================================================================
72*cdf0e10cSrcweir 	//= OTextConnectionPage
73*cdf0e10cSrcweir 	//========================================================================
74*cdf0e10cSrcweir 	class OTextConnectionHelper : public Control
75*cdf0e10cSrcweir 	{
76*cdf0e10cSrcweir         OTextConnectionHelper();
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir 		Link		m_aModifiedHandler;		/// to be called if something on the page has been modified
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir     public:
81*cdf0e10cSrcweir 		OTextConnectionHelper( Window* pParent, const short _nAvailableSections );
82*cdf0e10cSrcweir         virtual ~OTextConnectionHelper();
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir     private:
85*cdf0e10cSrcweir         FixedText   m_aFTExtensionHeader;
86*cdf0e10cSrcweir         RadioButton m_aRBAccessTextFiles;
87*cdf0e10cSrcweir         RadioButton m_aRBAccessCSVFiles;
88*cdf0e10cSrcweir         RadioButton m_aRBAccessOtherFiles;
89*cdf0e10cSrcweir         Edit        m_aETOwnExtension;
90*cdf0e10cSrcweir         FixedText   m_aFTExtensionExample;
91*cdf0e10cSrcweir 		FixedLine	m_aLineFormat;
92*cdf0e10cSrcweir 		FixedText	m_aFieldSeparatorLabel;
93*cdf0e10cSrcweir 		ComboBox	m_aFieldSeparator;
94*cdf0e10cSrcweir 		FixedText	m_aTextSeparatorLabel;
95*cdf0e10cSrcweir 		ComboBox	m_aTextSeparator;
96*cdf0e10cSrcweir 		FixedText	m_aDecimalSeparatorLabel;
97*cdf0e10cSrcweir 		ComboBox	m_aDecimalSeparator;
98*cdf0e10cSrcweir 		FixedText	m_aThousandsSeparatorLabel;
99*cdf0e10cSrcweir 		ComboBox	m_aThousandsSeparator;
100*cdf0e10cSrcweir   		CheckBox	m_aRowHeader;
101*cdf0e10cSrcweir         FixedLine   m_aCharSetHeader;
102*cdf0e10cSrcweir         FixedText   m_aCharSetLabel;
103*cdf0e10cSrcweir         CharSetListBox  m_aCharSet;
104*cdf0e10cSrcweir 		String		m_aFieldSeparatorList;
105*cdf0e10cSrcweir 		String		m_aTextSeparatorList;
106*cdf0e10cSrcweir 		String		m_aTextNone;
107*cdf0e10cSrcweir         String      m_aOldExtension;
108*cdf0e10cSrcweir         Link		m_aGetExtensionHandler;	/// to be called if a new type is selected
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir         short       m_nAvailableSections;
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir     protected:
113*cdf0e10cSrcweir 		void callModifiedHdl() const { if (m_aModifiedHandler.IsSet()) m_aModifiedHandler.Call((void*)this); }
114*cdf0e10cSrcweir         Link getControlModifiedLink() { return LINK(this, OTextConnectionHelper, OnControlModified); }
115*cdf0e10cSrcweir         DECL_LINK(OnSetExtensionHdl,RadioButton*);
116*cdf0e10cSrcweir         DECL_LINK(OnControlModified,Control*);
117*cdf0e10cSrcweir 		DECL_LINK(OnEditModified,Edit*);
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir 	private:
120*cdf0e10cSrcweir 		String		GetSeparator( const ComboBox& rBox, const String& rList );
121*cdf0e10cSrcweir 		void		SetSeparator( ComboBox& rBox, const String& rList, const String& rVal );
122*cdf0e10cSrcweir         void        SetExtension(const String& _rVal);
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir     public:
126*cdf0e10cSrcweir 		void        implInitControls(const SfxItemSet& _rSet, sal_Bool _bValid);
127*cdf0e10cSrcweir 		void        fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
128*cdf0e10cSrcweir 		void        fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
129*cdf0e10cSrcweir         void        SetClickHandler(const Link& _rHandler) { m_aGetExtensionHandler = _rHandler; }
130*cdf0e10cSrcweir         String      GetExtension();
131*cdf0e10cSrcweir         sal_Bool FillItemSet( SfxItemSet& rSet, const sal_Bool bChangedSomething );
132*cdf0e10cSrcweir         sal_Bool prepareLeave();
133*cdf0e10cSrcweir 	};
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir //.........................................................................
136*cdf0e10cSrcweir }	// namespace dbaui
137*cdf0e10cSrcweir //.........................................................................
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir #endif // DBAUI_DBWIZ2_HXX
140*cdf0e10cSrcweir 
141