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 TabPage
44 : {
45 : OTextConnectionHelper();
46 :
47 : Link<> m_aModifiedHandler; /// to be called if something on the page has been modified
48 :
49 : public:
50 : OTextConnectionHelper( vcl::Window* pParent, const short _nAvailableSections );
51 : virtual ~OTextConnectionHelper();
52 : virtual void dispose() SAL_OVERRIDE;
53 :
54 : private:
55 : VclPtr<FixedText> m_pExtensionHeader;
56 : VclPtr<RadioButton> m_pAccessTextFiles;
57 : VclPtr<RadioButton> m_pAccessCSVFiles;
58 : VclPtr<RadioButton> m_pAccessOtherFiles;
59 : VclPtr<Edit> m_pOwnExtension;
60 : VclPtr<FixedText> m_pExtensionExample;
61 : VclPtr<FixedText> m_pFormatHeader;
62 : VclPtr<FixedText> m_pFieldSeparatorLabel;
63 : VclPtr<ComboBox> m_pFieldSeparator;
64 : VclPtr<FixedText> m_pTextSeparatorLabel;
65 : VclPtr<ComboBox> m_pTextSeparator;
66 : VclPtr<FixedText> m_pDecimalSeparatorLabel;
67 : VclPtr<ComboBox> m_pDecimalSeparator;
68 : VclPtr<FixedText> m_pThousandsSeparatorLabel;
69 : VclPtr<ComboBox> m_pThousandsSeparator;
70 : VclPtr<CheckBox> m_pRowHeader;
71 : VclPtr<FixedText> m_pCharSetHeader;
72 : VclPtr<FixedText> m_pCharSetLabel;
73 : VclPtr<CharSetListBox> m_pCharSet;
74 : OUString m_aFieldSeparatorList;
75 : OUString m_aTextSeparatorList;
76 : OUString m_aTextNone;
77 : OUString m_aOldExtension;
78 : Link<OTextConnectionHelper*, void> m_aGetExtensionHandler; /// to be called if a new type is selected
79 :
80 : short m_nAvailableSections;
81 :
82 : protected:
83 0 : void callModifiedHdl() const { if (m_aModifiedHandler.IsSet()) m_aModifiedHandler.Call(const_cast<OTextConnectionHelper *>(this)); }
84 0 : Link<> getControlModifiedLink() { return LINK(this, OTextConnectionHelper, OnControlModified); }
85 : DECL_LINK(OnSetExtensionHdl,RadioButton*);
86 : DECL_LINK(OnControlModified,Control*);
87 : DECL_LINK(OnEditModified,Edit*);
88 :
89 : private:
90 : OUString GetSeparator( const ComboBox& rBox, const OUString& rList );
91 : void SetSeparator( ComboBox& rBox, const OUString& rList, const OUString& rVal );
92 : void SetExtension(const OUString& _rVal);
93 :
94 : public:
95 : void implInitControls(const SfxItemSet& _rSet, bool _bValid);
96 : void fillControls(::std::vector< ISaveValueWrapper* >& _rControlList);
97 : void fillWindows(::std::vector< ISaveValueWrapper* >& _rControlList);
98 0 : void SetClickHandler(const Link<OTextConnectionHelper*, void>& _rHandler) { m_aGetExtensionHandler = _rHandler; }
99 : OUString GetExtension();
100 : bool FillItemSet( SfxItemSet& rSet, const bool bChangedSomething );
101 : bool prepareLeave();
102 : };
103 :
104 : } // namespace dbaui
105 :
106 : #endif // INCLUDED_DBACCESS_SOURCE_UI_DLG_TEXTCONNECTIONHELPER_HXX
107 :
108 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|