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 
10 #pragma once
11 
12 #include <sal/config.h>
13 
14 #include <com/sun/star/awt/XWindow.hpp>
15 #include <vcl/idle.hxx>
16 #include <vcl/weld.hxx>
17 #include "datatableview.hxx"
18 #include <memory>
19 
20 class ScDocument;
21 class ScDataProviderBaseControl;
22 class ScDataTransformationBaseControl;
23 class ScDBData;
24 
25 class ScDataProviderDlg : public weld::GenericDialogController
26 {
27 private:
28     std::shared_ptr<ScDocument> mxDoc;
29     std::unique_ptr<weld::Menu> mxStartMenu;
30     std::unique_ptr<weld::Menu> mxColumnMenu;
31     std::unique_ptr<weld::Container> mxBox;
32     css::uno::Reference<css::awt::XWindow> m_xTableParent;
33     VclPtr<ScDataTableView> mxTable;
34     std::unique_ptr<weld::ScrolledWindow> mxScroll;
35     std::unique_ptr<weld::Container> mxList;
36     std::unique_ptr<ScDataProviderBaseControl> mxDataProviderCtrl;
37     std::unique_ptr<weld::ComboBox> mxDBRanges;
38 
39     std::vector<std::unique_ptr<ScDataTransformationBaseControl>> maControls;
40 
41     Idle maIdle;
42 
43     sal_uInt32 mnIndex;
44     ScDBData* pDBData;
45 
46     void InitMenu();
47 
48     DECL_LINK(StartMenuHdl, const OString&, void);
49     DECL_LINK(ColumnMenuHdl, const OString&, void);
50     DECL_LINK(ImportHdl, ScDataProviderBaseControl*, void);
51     DECL_LINK(ScrollToEnd, Timer*, void);
52 
53 public:
54     ScDataProviderDlg(weld::Window* pWindow, std::shared_ptr<ScDocument> pDoc,
55                       const ScDocument* pDocument);
56     virtual ~ScDataProviderDlg() override;
57 
58     void applyAndQuit();
59     void cancelAndQuit();
60 
61     void deleteColumn();
62     void splitColumn();
63     void mergeColumns();
64     void textTransformation();
65     void sortTransformation();
66     void aggregateFunction();
67     void numberTransformation();
68     void deletefromList(sal_uInt32 nIndex);
69     void replaceNullTransformation();
70     void dateTimeTransformation();
71 
72     void import(ScDocument& rDoc, bool bInternal = false);
73 };
74 
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
76