LibreOffice Module basctl (master) 1
moduldlg.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <sal/config.h>
23
24#include <string_view>
25
26#include <bastype2.hxx>
27#include <vcl/weld.hxx>
28#include <com/sun/star/task/XInteractionHandler.hpp>
29
30class SvxPasswordDialog;
31
32namespace basctl
33{
34
35enum class ObjectMode
36{
37 Library = 1,
38 Module = 2,
39 Dialog = 3,
40};
41
43{
44private:
45 std::unique_ptr<weld::Entry> m_xEdit;
46 std::unique_ptr<weld::Button> m_xOKButton;
48
49 DECL_LINK(OkButtonHandler, weld::Button&, void);
50public:
51 NewObjectDialog(weld::Window* pParent, ObjectMode, bool bCheckName = false);
52 OUString GetObjectName() const { return m_xEdit->get_text(); }
53 void SetObjectName(const OUString& rName)
54 {
55 m_xEdit->set_text(rName);
56 m_xEdit->select_region(0, -1);
57 }
58};
59
61{
62 std::unique_ptr<weld::Entry> m_xEdit;
63 std::unique_ptr<weld::Button> m_xOKButton;
64 DECL_LINK(OkButtonHandler, weld::Button&, void);
65public:
66 explicit GotoLineDialog(weld::Window* pParent);
67 virtual ~GotoLineDialog() override;
68 sal_Int32 GetLineNumber() const;
69};
70
72{
73private:
75
76 std::unique_ptr<weld::RadioButton> m_xExportAsPackageButton;
77 std::unique_ptr<weld::Button> m_xOKButton;
78
79 DECL_LINK(OkButtonHandler, weld::Button&, void);
80
81public:
82 explicit ExportDialog(weld::Window * pParent);
83 virtual ~ExportDialog() override;
84
85 bool isExportAsPackage () const { return m_bExportAsPackage; }
86};
87
89{
90private:
91 std::unique_ptr<weld::Frame> m_xStorageFrame;
92 std::unique_ptr<weld::TreeView> m_xLibBox;
93 std::unique_ptr<weld::CheckButton> m_xReferenceBox;
94 std::unique_ptr<weld::CheckButton> m_xReplaceBox;
95
96public:
97 explicit LibDialog(weld::Window* pParent);
98 virtual ~LibDialog() override;
99
100 void SetStorageName( std::u16string_view rName );
101
103 bool IsReference() const { return m_xReferenceBox->get_active(); }
104 bool IsReplace() const { return m_xReplaceBox->get_active(); }
105
106 void EnableReference (bool b) { m_xReferenceBox->set_sensitive(b); }
107};
108
109class OrganizeDialog;
110
112{
113protected:
115 std::unique_ptr<weld::Builder> m_xBuilder;
116 std::unique_ptr<weld::Container> m_xContainer;
117
118 OrganizePage(weld::Container* pParent, const OUString& rUIFile, const OUString &rName, OrganizeDialog* pDialog);
119 virtual ~OrganizePage();
120
121public:
122 virtual void ActivatePage() = 0;
123};
124
126
127class ObjectPage final : public OrganizePage
128{
129 std::unique_ptr<SbTreeListBox> m_xBasicBox;
130 std::unique_ptr<weld::Button> m_xEditButton;
131 std::unique_ptr<weld::Button> m_xNewModButton;
132 std::unique_ptr<weld::Button> m_xNewDlgButton;
133 std::unique_ptr<weld::Button> m_xDelButton;
134 std::unique_ptr<SbTreeListBoxDropTarget> m_xDropTarget;
135
136 DECL_LINK( BasicBoxHighlightHdl, weld::TreeView&, void );
137 DECL_LINK( ButtonHdl, weld::Button&, void );
138 DECL_LINK( EditingEntryHdl, const weld::TreeIter&, bool );
139 typedef std::pair<const weld::TreeIter&, OUString> IterString;
140 DECL_LINK( EditedEntryHdl, const IterString&, bool );
141
142 void CheckButtons();
143 bool GetSelection( ScriptDocument& rDocument, OUString& rLibName );
144 void DeleteCurrent();
145 void NewModule();
146 void NewDialog();
147 void EndTabDialog();
148
149public:
150 ObjectPage(weld::Container* pParent, const OUString& rName, BrowseMode nMode, OrganizeDialog* pDialog);
151 virtual ~ObjectPage() override;
152
153 void SetCurrentEntry(const EntryDescriptor& rDesc) { m_xBasicBox->SetCurrentEntry(rDesc); }
154
155 virtual void ActivatePage() override;
156};
157
158class LibPage final : public OrganizePage
159{
160 std::unique_ptr<weld::ComboBox> m_xBasicsBox;
161 std::unique_ptr<weld::TreeView> m_xLibBox;
162 std::unique_ptr<weld::Button> m_xEditButton;
163 std::unique_ptr<weld::Button> m_xPasswordButton;
164 std::unique_ptr<weld::Button> m_xNewLibButton;
165 std::unique_ptr<weld::Button> m_xInsertLibButton;
166 std::unique_ptr<weld::Button> m_xExportButton;
167 std::unique_ptr<weld::Button> m_xDelButton;
168
171
172 DECL_LINK( TreeListHighlightHdl, weld::TreeView&, void );
173 DECL_LINK( BasicSelectHdl, weld::ComboBox&, void );
174 DECL_LINK( ButtonHdl, weld::Button&, void );
175 DECL_LINK( CheckPasswordHdl, SvxPasswordDialog *, bool );
176 DECL_LINK( EditingEntryHdl, const weld::TreeIter&, bool );
177 typedef std::pair<const weld::TreeIter&, OUString> IterString;
178 DECL_LINK( EditedEntryHdl, const IterString&, bool );
179
180 void CheckButtons();
181 void DeleteCurrent();
182 void NewLib();
183 void InsertLib();
184 void implExportLib( const OUString& aLibName, const OUString& aTargetURL,
185 const css::uno::Reference< css::task::XInteractionHandler >& Handler );
186 void Export();
187 void ExportAsPackage( const OUString& aLibName );
188 void ExportAsBasic( const OUString& aLibName );
189 void EndTabDialog();
190 void FillListBox();
191 void InsertListBoxEntry( const ScriptDocument& rDocument, LibraryLocation eLocation );
192 void SetCurLib();
193 void ImpInsertLibEntry( const OUString& rLibName, int nPos );
194
195public:
196 explicit LibPage(weld::Container* pParent, OrganizeDialog* pDialog);
197 virtual ~LibPage() override;
198 virtual void ActivatePage() override;
199};
200
202{
203private:
204 std::unique_ptr<weld::Notebook> m_xTabCtrl;
205 std::unique_ptr<ObjectPage> m_xModulePage;
206 std::unique_ptr<ObjectPage> m_xDialogPage;
207 std::unique_ptr<LibPage> m_xLibPage;
208
209 DECL_LINK(ActivatePageHdl, const OUString&, void);
210
211 void SetCurrentEntry(const css::uno::Reference<css::frame::XFrame>& xDocFrame);
212
213public:
214 OrganizeDialog(weld::Window* pParent, const css::uno::Reference<css::frame::XFrame>& xDocFrame, sal_Int16 tabId);
215 virtual ~OrganizeDialog() override;
216};
217
218// Helper functions
219SbModule* createModImpl(weld::Window* pWin, const ScriptDocument& rDocument,
220 SbTreeListBox& rBasicBox, const OUString& rLibName, const OUString& aModName, bool bMain);
221void createLibImpl(weld::Window* pWin, const ScriptDocument& rDocument,
222 weld::TreeView* pLibBox, SbTreeListBox* pBasicBox);
223
224} // namespace basctl
225
226/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
BrowseMode
Definition: bastype2.hxx:36
virtual ~ExportDialog() override
Definition: moduldl2.cxx:199
bool isExportAsPackage() const
Definition: moduldlg.hxx:85
ExportDialog(weld::Window *pParent)
Definition: moduldl2.cxx:189
DECL_LINK(OkButtonHandler, weld::Button &, void)
std::unique_ptr< weld::RadioButton > m_xExportAsPackageButton
Definition: moduldlg.hxx:76
std::unique_ptr< weld::Button > m_xOKButton
Definition: moduldlg.hxx:77
virtual ~GotoLineDialog() override
Definition: moduldl2.cxx:165
sal_Int32 GetLineNumber() const
Definition: moduldl2.cxx:169
std::unique_ptr< weld::Button > m_xOKButton
Definition: moduldlg.hxx:63
std::unique_ptr< weld::Entry > m_xEdit
Definition: moduldlg.hxx:62
DECL_LINK(OkButtonHandler, weld::Button &, void)
GotoLineDialog(weld::Window *pParent)
Definition: moduldl2.cxx:156
std::unique_ptr< weld::TreeView > m_xLibBox
Definition: moduldlg.hxx:92
std::unique_ptr< weld::CheckButton > m_xReferenceBox
Definition: moduldlg.hxx:93
void SetStorageName(std::u16string_view rName)
Definition: moduldlg.cxx:947
bool IsReference() const
Definition: moduldlg.hxx:103
weld::TreeView & GetLibBox()
Definition: moduldlg.hxx:102
std::unique_ptr< weld::Frame > m_xStorageFrame
Definition: moduldlg.hxx:91
void EnableReference(bool b)
Definition: moduldlg.hxx:106
bool IsReplace() const
Definition: moduldlg.hxx:104
virtual ~LibDialog() override
Definition: moduldlg.cxx:943
LibDialog(weld::Window *pParent)
Definition: moduldlg.cxx:929
std::unique_ptr< weld::CheckButton > m_xReplaceBox
Definition: moduldlg.hxx:94
void ExportAsBasic(const OUString &aLibName)
Definition: moduldl2.cxx:1104
void InsertLib()
Definition: moduldl2.cxx:547
LibPage(weld::Container *pParent, OrganizeDialog *pDialog)
Definition: moduldl2.cxx:204
std::unique_ptr< weld::TreeView > m_xLibBox
Definition: moduldlg.hxx:161
void DeleteCurrent()
Definition: moduldl2.cxx:1131
DECL_LINK(EditedEntryHdl, const IterString &, bool)
std::unique_ptr< weld::Button > m_xInsertLibButton
Definition: moduldlg.hxx:165
virtual void ActivatePage() override
Definition: moduldl2.cxx:406
virtual ~LibPage() override
Definition: moduldl2.cxx:342
void CheckButtons()
Definition: moduldl2.cxx:355
DECL_LINK(ButtonHdl, weld::Button &, void)
DECL_LINK(EditingEntryHdl, const weld::TreeIter &, bool)
void EndTabDialog()
Definition: moduldl2.cxx:1168
DECL_LINK(BasicSelectHdl, weld::ComboBox &, void)
std::unique_ptr< weld::Button > m_xEditButton
Definition: moduldlg.hxx:162
std::unique_ptr< weld::ComboBox > m_xBasicsBox
Definition: moduldlg.hxx:160
void ImpInsertLibEntry(const OUString &rLibName, int nPos)
Definition: moduldl2.cxx:1229
void FillListBox()
Definition: moduldl2.cxx:1173
std::unique_ptr< weld::Button > m_xNewLibButton
Definition: moduldlg.hxx:164
void InsertListBoxEntry(const ScriptDocument &rDocument, LibraryLocation eLocation)
Definition: moduldl2.cxx:1185
std::pair< const weld::TreeIter &, OUString > IterString
Definition: moduldlg.hxx:177
std::unique_ptr< weld::Button > m_xPasswordButton
Definition: moduldlg.hxx:163
std::unique_ptr< weld::Button > m_xExportButton
Definition: moduldlg.hxx:166
DECL_LINK(TreeListHighlightHdl, weld::TreeView &, void)
void implExportLib(const OUString &aLibName, const OUString &aTargetURL, const css::uno::Reference< css::task::XInteractionHandler > &Handler)
Definition: moduldl2.cxx:951
ScriptDocument m_aCurDocument
Definition: moduldlg.hxx:169
DECL_LINK(CheckPasswordHdl, SvxPasswordDialog *, bool)
void ExportAsPackage(const OUString &aLibName)
Definition: moduldl2.cxx:1002
LibraryLocation m_eCurLocation
Definition: moduldlg.hxx:170
std::unique_ptr< weld::Button > m_xDelButton
Definition: moduldlg.hxx:167
DECL_LINK(OkButtonHandler, weld::Button &, void)
std::unique_ptr< weld::Button > m_xOKButton
Definition: moduldlg.hxx:46
OUString GetObjectName() const
Definition: moduldlg.hxx:52
NewObjectDialog(weld::Window *pParent, ObjectMode, bool bCheckName=false)
Definition: moduldl2.cxx:132
std::unique_ptr< weld::Entry > m_xEdit
Definition: moduldlg.hxx:45
void SetObjectName(const OUString &rName)
Definition: moduldlg.hxx:53
DECL_LINK(EditingEntryHdl, const weld::TreeIter &, bool)
bool GetSelection(ScriptDocument &rDocument, OUString &rLibName)
Definition: moduldlg.cxx:747
std::unique_ptr< SbTreeListBox > m_xBasicBox
Definition: moduldlg.hxx:129
std::pair< const weld::TreeIter &, OUString > IterString
Definition: moduldlg.hxx:139
std::unique_ptr< SbTreeListBoxDropTarget > m_xDropTarget
Definition: moduldlg.hxx:134
void SetCurrentEntry(const EntryDescriptor &rDesc)
Definition: moduldlg.hxx:153
std::unique_ptr< weld::Button > m_xNewModButton
Definition: moduldlg.hxx:131
ObjectPage(weld::Container *pParent, const OUString &rName, BrowseMode nMode, OrganizeDialog *pDialog)
Definition: moduldlg.cxx:566
DECL_LINK(EditedEntryHdl, const IterString &, bool)
virtual void ActivatePage() override
Definition: moduldlg.cxx:616
DECL_LINK(BasicBoxHighlightHdl, weld::TreeView &, void)
std::unique_ptr< weld::Button > m_xNewDlgButton
Definition: moduldlg.hxx:132
std::unique_ptr< weld::Button > m_xDelButton
Definition: moduldlg.hxx:133
virtual ~ObjectPage() override
Definition: moduldlg.cxx:612
std::unique_ptr< weld::Button > m_xEditButton
Definition: moduldlg.hxx:130
DECL_LINK(ButtonHdl, weld::Button &, void)
DECL_LINK(ActivatePageHdl, const OUString &, void)
std::unique_ptr< ObjectPage > m_xDialogPage
Definition: moduldlg.hxx:206
std::unique_ptr< weld::Notebook > m_xTabCtrl
Definition: moduldlg.hxx:204
std::unique_ptr< ObjectPage > m_xModulePage
Definition: moduldlg.hxx:205
std::unique_ptr< LibPage > m_xLibPage
Definition: moduldlg.hxx:207
OrganizeDialog(weld::Window *pParent, const css::uno::Reference< css::frame::XFrame > &xDocFrame, sal_Int16 tabId)
Definition: moduldlg.cxx:203
virtual ~OrganizeDialog() override
Definition: moduldlg.cxx:238
void SetCurrentEntry(const css::uno::Reference< css::frame::XFrame > &xDocFrame)
Definition: moduldlg.cxx:186
virtual void ActivatePage()=0
std::unique_ptr< weld::Container > m_xContainer
Definition: moduldlg.hxx:116
std::unique_ptr< weld::Builder > m_xBuilder
Definition: moduldlg.hxx:115
virtual ~OrganizePage()
Definition: moduldlg.cxx:249
OrganizeDialog * m_pDialog
Definition: moduldlg.hxx:114
OrganizePage(weld::Container *pParent, const OUString &rUIFile, const OUString &rName, OrganizeDialog *pDialog)
Definition: moduldlg.cxx:242
encapsulates a document which contains Basic scripts and dialogs
void createLibImpl(weld::Window *pWin, const ScriptDocument &rDocument, weld::TreeView *pLibBox, SbTreeListBox *pBasicBox)
Definition: moduldl2.cxx:1257
SbModule * createModImpl(weld::Window *pWin, const ScriptDocument &rDocument, SbTreeListBox &rBasicBox, const OUString &rLibName, const OUString &_aModName, bool bMain)
Definition: moduldlg.cxx:954
ObjectMode
Definition: moduldlg.hxx:36