Gtk-WARNING gtktreestore.c:1047: Invalid column number 1 added to iter
[LibreOffice.git] / dbaccess / source / ui / dlg / TextConnectionHelper.hxx
blob6755a422378eec0aeef0fca7a2c13558d401c4b7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include "adminpages.hxx"
23 #include <charsetlistbox.hxx>
24 #include <rtl/ustring.hxx>
26 namespace dbaui
30 #define TC_EXTENSION (short(0x01)) // a section specifying the extension of the files to connect to
31 #define TC_SEPARATORS (short(0x02)) // a section specifying the various separators
32 #define TC_HEADER (short(0x04)) // a section containing the "Text contains header" check box only
33 #define TC_CHARSET (short(0x08)) // not yet implemented
35 class OTextConnectionHelper final
37 public:
38 OTextConnectionHelper(weld::Widget* pParent , const short _nAvailableSections);
40 private:
41 OUString m_aFieldSeparatorList;
42 OUString m_aTextSeparatorList;
43 OUString m_aTextNone;
44 OUString m_aOldExtension;
45 Link<OTextConnectionHelper*, void> m_aGetExtensionHandler; /// to be called if a new type is selected
47 short m_nAvailableSections;
49 std::unique_ptr<weld::Builder> m_xBuilder;
50 std::unique_ptr<weld::Widget> m_xContainer;
51 std::unique_ptr<weld::Widget> m_xExtensionHeader;
52 std::unique_ptr<weld::RadioButton> m_xAccessTextFiles;
53 std::unique_ptr<weld::RadioButton> m_xAccessCSVFiles;
54 std::unique_ptr<weld::RadioButton> m_xAccessOtherFiles;
55 std::unique_ptr<weld::Entry> m_xOwnExtension;
56 std::unique_ptr<weld::Label> m_xExtensionExample;
57 std::unique_ptr<weld::Widget> m_xFormatHeader;
58 std::unique_ptr<weld::Label> m_xFieldSeparatorLabel;
59 std::unique_ptr<weld::ComboBox> m_xFieldSeparator;
60 std::unique_ptr<weld::Label> m_xTextSeparatorLabel;
61 std::unique_ptr<weld::ComboBox> m_xTextSeparator;
62 std::unique_ptr<weld::Label> m_xDecimalSeparatorLabel;
63 std::unique_ptr<weld::ComboBox> m_xDecimalSeparator;
64 std::unique_ptr<weld::Label> m_xThousandsSeparatorLabel;
65 std::unique_ptr<weld::ComboBox> m_xThousandsSeparator;
66 std::unique_ptr<weld::CheckButton> m_xRowHeader;
67 std::unique_ptr<weld::Widget> m_xCharSetHeader;
68 std::unique_ptr<weld::Label> m_xCharSetLabel;
69 std::unique_ptr<CharSetListBox> m_xCharSet;
71 DECL_LINK(OnSetExtensionHdl, weld::Toggleable&, void);
72 DECL_LINK(OnEditModified, weld::Entry&, void);
74 OUString GetSeparator(const weld::ComboBox& rBox, std::u16string_view rList);
75 void SetSeparator(weld::ComboBox& rBox, std::u16string_view rList, const OUString& rVal);
76 void SetExtension(const OUString& _rVal);
78 public:
79 void implInitControls(const SfxItemSet& _rSet, bool _bValid);
80 void fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList);
81 void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList);
82 void SetClickHandler(const Link<OTextConnectionHelper*, void>& _rHandler) { m_aGetExtensionHandler = _rHandler; }
83 OUString GetExtension() const;
84 bool FillItemSet( SfxItemSet& rSet, const bool bChangedSomething );
85 bool prepareLeave();
87 } // namespace dbaui
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */