1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <sfx2/objsh.hxx>
23 #include <vcl/timer.hxx>
24 #include <vcl/weld.hxx>
31 namespace sfx2
{ class DocumentInserter
; }
32 namespace sfx2
{ class FileDialogHelper
; }
34 class ScInsertTableDlg
: public weld::GenericDialogController
37 ScInsertTableDlg(weld::Window
* pParent
, ScViewData
& rViewData
, SCTAB nTabCount
, bool bFromFile
);
38 virtual ~ScInsertTableDlg() override
;
40 virtual short run() override
; // override to set parent dialog
42 bool GetTablesFromFile() const { return m_xBtnFromFile
->get_active(); }
43 bool GetTablesAsLink() const { return m_xBtnLink
->get_active(); }
45 const OUString
* GetFirstTable( sal_uInt16
* pN
);
46 const OUString
* GetNextTable( sal_uInt16
* pN
);
47 ScDocShell
* GetDocShellTables() { return pDocShTables
.get(); }
48 bool IsTableBefore() const { return m_xBtnBefore
->get_active(); }
49 SCTAB
GetTableCount() const { return nTableCount
;}
53 ScViewData
& rViewData
;
55 rtl::Reference
<ScDocShell
> pDocShTables
;
56 std::unique_ptr
<sfx2::DocumentInserter
> pDocInserter
;
59 sal_uInt16 nSelTabIndex
; // for GetFirstTable() / GetNextTable()
60 OUString aStrCurSelTable
;
62 OUString m_sSheetDotDotDot
;
64 std::unique_ptr
<weld::RadioButton
> m_xBtnBefore
;
65 std::unique_ptr
<weld::RadioButton
> m_xBtnNew
;
66 std::unique_ptr
<weld::RadioButton
> m_xBtnFromFile
;
67 std::unique_ptr
<weld::Label
> m_xFtCount
;
68 std::unique_ptr
<weld::SpinButton
> m_xNfCount
;
69 std::unique_ptr
<weld::Label
> m_xFtName
;
70 std::unique_ptr
<weld::Entry
> m_xEdName
;
71 std::unique_ptr
<weld::TreeView
> m_xLbTables
;
72 std::unique_ptr
<weld::Label
> m_xFtPath
;
73 std::unique_ptr
<weld::Button
> m_xBtnBrowse
;
74 std::unique_ptr
<weld::CheckButton
> m_xBtnLink
;
75 std::unique_ptr
<weld::Button
> m_xBtnOk
;
77 void Init_Impl( bool bFromFile
);
78 void SetNewTable_Impl();
79 void SetFromTo_Impl();
80 void FillTables_Impl( const ScDocument
* pSrcDoc
);
83 DECL_LINK( BrowseHdl_Impl
, weld::Button
&, void );
84 DECL_LINK( ChoiceHdl_Impl
, weld::Toggleable
&, void );
85 DECL_LINK( SelectHdl_Impl
, weld::TreeView
&, void );
86 DECL_LINK( CountHdl_Impl
, weld::SpinButton
&, void );
87 DECL_LINK( DoEnterHdl
, weld::Button
&, void );
88 DECL_LINK( BrowseTimeoutHdl
, Timer
*, void );
89 DECL_LINK( DialogClosedHdl
, sfx2::FileDialogHelper
*, void );
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */