Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_DBACCESS_SOURCE_UI_DLG_TEXTCONNECTIONHELPER_HXX
21 : #define INCLUDED_DBACCESS_SOURCE_UI_DLG_TEXTCONNECTIONHELPER_HXX
22 :
23 : #include "ConnectionPageSetup.hxx"
24 : #include "adminpages.hxx"
25 : #include "charsetlistbox.hxx"
26 : #include <ucbhelper/content.hxx>
27 : #include "curledit.hxx"
28 : #include <svtools/roadmapwizard.hxx>
29 : #include <vcl/field.hxx>
30 : #include <rtl/ustring.hxx>
31 : #include <vcl/lstbox.hxx>
32 :
33 : namespace dbaui
34 :
35 : {
36 :
37 : #define TC_EXTENSION ((short)0x01) // a section specifying the extension of the files to connect to
38 : #define TC_SEPARATORS ((short)0x02) // a section specifying the various separators
39 : #define TC_HEADER ((short)0x04) // a section containing the "Text contains header" check box only
40 : #define TC_CHARSET ((short)0x08) // not yet implemented
41 :
42 : // OTextConnectionPage
43 : class OTextConnectionHelper : public Control
44 : {
45 : OTextConnectionHelper();
46 :
47 : Link m_aModifiedHandler; /// to be called if something on the page has been modified
48 :
49 : public:
50 : OTextConnectionHelper( Window* pParent, const short _nAvailableSections );
51 : virtual ~OTextConnectionHelper();
52 :
53 : private:
54 : FixedText m_aFTExtensionHeader;
55 : RadioButton m_aRBAccessTextFiles;
56 : RadioButton m_aRBAccessCSVFiles;
57 : RadioButton m_aRBAccessOtherFiles;
58 : Edit m_aETOwnExtension;
59 : FixedText m_aFTExtensionExample;
60 : FixedLine m_aLineFormat;
61 : FixedText m_aFieldSeparatorLabel;
62 : ComboBox m_aFieldSeparator;
63 : FixedText m_aTextSeparatorLabel;
64 : ComboBox m_aTextSeparator;
65 : FixedText m_aDecimalSeparatorLabel;
66 : ComboBox m_aDecimalSeparator;
67 : FixedText m_aThousandsSeparatorLabel;
68 : ComboBox m_aThousandsSeparator;
69 : CheckBox m_aRowHeader;
70 : FixedLine m_aCharSetHeader;
71 : FixedText m_aCharSetLabel;
72 : CharSetListBox m_aCharSet;
73 : OUString m_aFieldSeparatorList;
74 : OUString m_aTextSeparatorList;
75 : OUString m_aTextNone;
76 : OUString m_aOldExtension;
77 : Link m_aGetExtensionHandler; /// to be called if a new type is selected
78 :
79 : short m_nAvailableSections;
80 :
81 : protected:
82 0 : void callModifiedHdl() const { if (m_aModifiedHandler.IsSet()) m_aModifiedHandler.Call((void*)this); }
83 0 : Link getControlModifiedLink() { return LINK(this, OTextConnectionHelper, OnControlModified); }
84 : DECL_LINK(OnSetExtensionHdl,RadioButton*);
85 : DECL_LINK(OnControlModified,Control*);
86 : DECL_LINK(OnEditModified,Edit*);
87 :
88 : private:
89 : OUString GetSeparator( const ComboBox& rBox, const OUString& rList );
90 : void SetSeparator( ComboBox& rBox, const OUString& rList, const OUString& rVal );
91 : void SetExtension(const OUString& _rVal);
92 :
93 : public:
94 : void implInitControls(const SfxItemSet& _rSet, sal_Bool _bValid);
95 : void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
96 : void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
97 0 : void SetClickHandler(const Link& _rHandler) { m_aGetExtensionHandler = _rHandler; }
98 : OUString GetExtension();
99 : sal_Bool FillItemSet( SfxItemSet& rSet, const sal_Bool bChangedSomething );
100 : sal_Bool prepareLeave();
101 : };
102 :
103 : } // namespace dbaui
104 :
105 : #endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_TEXTCONNECTIONHELPER_HXX
106 :
107 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|