nss: upgrade to release 3.73
[LibreOffice.git] / basctl / source / basicide / moduldlg.hxx
blob37e3d9556185258f87c407eda67b9a2efc08f9c1
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 <bastype2.hxx>
23 #include <tools/solar.h>
24 #include <vcl/weld.hxx>
25 #include <com/sun/star/task/XInteractionHandler.hpp>
27 class SvxPasswordDialog;
29 namespace basctl
32 enum class ObjectMode
34 Library = 1,
35 Module = 2,
36 Dialog = 3,
39 class NewObjectDialog : public weld::GenericDialogController
41 private:
42 std::unique_ptr<weld::Entry> m_xEdit;
43 std::unique_ptr<weld::Button> m_xOKButton;
44 bool m_bCheckName;
46 DECL_LINK(OkButtonHandler, weld::Button&, void);
47 public:
48 NewObjectDialog(weld::Window* pParent, ObjectMode, bool bCheckName = false);
49 OUString GetObjectName() const { return m_xEdit->get_text(); }
50 void SetObjectName(const OUString& rName)
52 m_xEdit->set_text(rName);
53 m_xEdit->select_region(0, -1);
57 class GotoLineDialog : public weld::GenericDialogController
59 std::unique_ptr<weld::Entry> m_xEdit;
60 std::unique_ptr<weld::Button> m_xOKButton;
61 DECL_LINK(OkButtonHandler, weld::Button&, void);
62 public:
63 explicit GotoLineDialog(weld::Window* pParent);
64 virtual ~GotoLineDialog() override;
65 sal_Int32 GetLineNumber() const;
68 class ExportDialog : public weld::GenericDialogController
70 private:
71 bool m_bExportAsPackage;
73 std::unique_ptr<weld::RadioButton> m_xExportAsPackageButton;
74 std::unique_ptr<weld::Button> m_xOKButton;
76 DECL_LINK(OkButtonHandler, weld::Button&, void);
78 public:
79 explicit ExportDialog(weld::Window * pParent);
80 virtual ~ExportDialog() override;
82 bool isExportAsPackage () const { return m_bExportAsPackage; }
85 class LibDialog : public weld::GenericDialogController
87 private:
88 std::unique_ptr<weld::Frame> m_xStorageFrame;
89 std::unique_ptr<weld::TreeView> m_xLibBox;
90 std::unique_ptr<weld::CheckButton> m_xReferenceBox;
91 std::unique_ptr<weld::CheckButton> m_xReplaceBox;
93 public:
94 explicit LibDialog(weld::Window* pParent);
95 virtual ~LibDialog() override;
97 void SetStorageName( const OUString& rName );
99 weld::TreeView& GetLibBox() { return *m_xLibBox; }
100 bool IsReference() const { return m_xReferenceBox->get_active(); }
101 bool IsReplace() const { return m_xReplaceBox->get_active(); }
103 void EnableReference (bool b) { m_xReferenceBox->set_sensitive(b); }
106 class OrganizeDialog;
108 class OrganizePage
110 protected:
111 OrganizeDialog* m_pDialog;
112 std::unique_ptr<weld::Builder> m_xBuilder;
113 std::unique_ptr<weld::Container> m_xContainer;
115 OrganizePage(weld::Container* pParent, const OUString& rUIFile, const OString &rName, OrganizeDialog* pDialog);
116 virtual ~OrganizePage();
118 public:
119 virtual void ActivatePage() = 0;
122 class SbTreeListBoxDropTarget;
124 class ObjectPage final : public OrganizePage
126 std::unique_ptr<SbTreeListBox> m_xBasicBox;
127 std::unique_ptr<weld::Button> m_xEditButton;
128 std::unique_ptr<weld::Button> m_xNewModButton;
129 std::unique_ptr<weld::Button> m_xNewDlgButton;
130 std::unique_ptr<weld::Button> m_xDelButton;
131 std::unique_ptr<SbTreeListBoxDropTarget> m_xDropTarget;
133 DECL_LINK( BasicBoxHighlightHdl, weld::TreeView&, void );
134 DECL_LINK( ButtonHdl, weld::Button&, void );
135 DECL_LINK( EditingEntryHdl, const weld::TreeIter&, bool );
136 typedef std::pair<const weld::TreeIter&, OUString> IterString;
137 DECL_LINK( EditedEntryHdl, const IterString&, bool );
139 void CheckButtons();
140 bool GetSelection( ScriptDocument& rDocument, OUString& rLibName );
141 void DeleteCurrent();
142 void NewModule();
143 void NewDialog();
144 void EndTabDialog();
146 public:
147 ObjectPage(weld::Container* pParent, const OString& rName, BrowseMode nMode, OrganizeDialog* pDialog);
148 virtual ~ObjectPage() override;
150 virtual void ActivatePage() override;
153 class LibPage final : public OrganizePage
155 std::unique_ptr<weld::ComboBox> m_xBasicsBox;
156 std::unique_ptr<weld::TreeView> m_xLibBox;
157 std::unique_ptr<weld::Button> m_xEditButton;
158 std::unique_ptr<weld::Button> m_xPasswordButton;
159 std::unique_ptr<weld::Button> m_xNewLibButton;
160 std::unique_ptr<weld::Button> m_xInsertLibButton;
161 std::unique_ptr<weld::Button> m_xExportButton;
162 std::unique_ptr<weld::Button> m_xDelButton;
164 ScriptDocument m_aCurDocument;
165 LibraryLocation m_eCurLocation;
167 DECL_LINK( TreeListHighlightHdl, weld::TreeView&, void );
168 DECL_LINK( BasicSelectHdl, weld::ComboBox&, void );
169 DECL_LINK( ButtonHdl, weld::Button&, void );
170 DECL_LINK( CheckPasswordHdl, SvxPasswordDialog *, bool );
171 DECL_LINK( EditingEntryHdl, const weld::TreeIter&, bool );
172 typedef std::pair<const weld::TreeIter&, OUString> IterString;
173 DECL_LINK( EditedEntryHdl, const IterString&, bool );
175 void CheckButtons();
176 void DeleteCurrent();
177 void NewLib();
178 void InsertLib();
179 void implExportLib( const OUString& aLibName, const OUString& aTargetURL,
180 const css::uno::Reference< css::task::XInteractionHandler >& Handler );
181 void Export();
182 void ExportAsPackage( const OUString& aLibName );
183 void ExportAsBasic( const OUString& aLibName );
184 void EndTabDialog();
185 void FillListBox();
186 void InsertListBoxEntry( const ScriptDocument& rDocument, LibraryLocation eLocation );
187 void SetCurLib();
188 void ImpInsertLibEntry( const OUString& rLibName, sal_uLong nPos );
190 public:
191 explicit LibPage(weld::Container* pParent, OrganizeDialog* pDialog);
192 virtual ~LibPage() override;
193 virtual void ActivatePage() override;
196 class OrganizeDialog : public weld::GenericDialogController
198 private:
199 std::unique_ptr<weld::Notebook> m_xTabCtrl;
200 std::unique_ptr<ObjectPage> m_xModulePage;
201 std::unique_ptr<ObjectPage> m_xDialogPage;
202 std::unique_ptr<LibPage> m_xLibPage;
204 DECL_LINK(ActivatePageHdl, const OString&, void);
206 public:
207 OrganizeDialog(weld::Window* pParent, sal_Int16 tabId);
208 virtual ~OrganizeDialog() override;
211 // Helper functions
212 SbModule* createModImpl(weld::Window* pWin, const ScriptDocument& rDocument,
213 SbTreeListBox& rBasicBox, const OUString& rLibName, const OUString& aModName, bool bMain);
214 void createLibImpl(weld::Window* pWin, const ScriptDocument& rDocument,
215 weld::TreeView* pLibBox, SbTreeListBox* pBasicBox);
217 } // namespace basctl
219 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */