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