bump product version to 4.1.6.2
[LibreOffice.git] / basctl / source / basicide / moduldlg.hxx
blob34de345f8964bcaf0044ce02efd11fd478cdc5dc
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 #ifndef BASCTL_MODULDLG_HXX
21 #define BASCTL_MODULDLG_HXX
23 #include <svheader.hxx>
25 #include <bastype2.hxx>
26 #include <vcl/dialog.hxx>
28 #include <vcl/button.hxx>
29 #include <vcl/fixed.hxx>
30 #include <svtools/svtabbx.hxx>
31 #include <vcl/tabdlg.hxx>
32 #include <vcl/tabpage.hxx>
33 #include "com/sun/star/task/XInteractionHandler.hpp"
35 #include <vcl/tabctrl.hxx>
36 #include <vcl/lstbox.hxx>
38 class SvxPasswordDialog;
40 namespace basctl
43 namespace ObjectMode
45 enum Mode
47 Library = 1,
48 Module = 2,
49 Dialog = 3,
50 Method = 4,
54 class NewObjectDialog : public ModalDialog
56 private:
57 FixedText aText;
58 Edit aEdit;
59 OKButton aOKButton;
60 CancelButton aCancelButton;
62 DECL_LINK(OkButtonHandler, void *);
64 public:
65 NewObjectDialog (Window* pParent, ObjectMode::Mode, bool bCheckName = false);
66 virtual ~NewObjectDialog ();
68 String GetObjectName() const { return aEdit.GetText(); }
69 void SetObjectName( const String& rName ) { aEdit.SetText( rName ); aEdit.SetSelection( Selection( 0, rName.Len() ) );}
72 class GotoLineDialog : public ModalDialog
74 FixedText aText;
75 Edit aEdit;
76 OKButton aOKButton;
77 CancelButton aCancelButton;
78 DECL_LINK(OkButtonHandler, void *);
79 public:
80 GotoLineDialog( Window * pParent );
81 sal_Int32 GetLineNumber();
84 class ExportDialog : public ModalDialog
86 private:
87 RadioButton maExportAsPackageButton;
88 RadioButton maExportAsBasicButton;
89 OKButton maOKButton;
90 CancelButton maCancelButton;
92 bool mbExportAsPackage;
94 DECL_LINK(OkButtonHandler, void *);
96 public:
97 ExportDialog( Window * pParent );
98 ~ExportDialog();
100 bool isExportAsPackage () { return mbExportAsPackage; }
104 class ExtTreeListBox : public TreeListBox
106 protected:
107 virtual sal_Bool EditingEntry( SvTreeListEntry* pEntry, Selection& rSel );
108 virtual sal_Bool EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText );
110 virtual DragDropMode NotifyStartDrag( TransferDataContainer& rData, SvTreeListEntry* pEntry );
111 virtual sal_Bool NotifyAcceptDrop( SvTreeListEntry* pEntry );
113 virtual sal_Bool NotifyMoving( SvTreeListEntry* pTarget, SvTreeListEntry* pEntry,
114 SvTreeListEntry*& rpNewParent, sal_uLong& rNewChildPos );
115 virtual sal_Bool NotifyCopying( SvTreeListEntry* pTarget, SvTreeListEntry* pEntry,
116 SvTreeListEntry*& rpNewParent, sal_uLong& rNewChildPos );
117 sal_Bool NotifyCopyingMoving( SvTreeListEntry* pTarget, SvTreeListEntry* pEntry,
118 SvTreeListEntry*& rpNewParent, sal_uLong& rNewChildPos, sal_Bool bMove );
120 public:
121 ExtTreeListBox( Window* pParent, const ResId& rRes );
122 ~ExtTreeListBox();
125 class CheckBox : public SvTabListBox
127 private:
128 ObjectMode::Mode eMode;
129 SvLBoxButtonData* pCheckButton;
130 ScriptDocument m_aDocument;
131 void Init();
133 public:
134 CheckBox( Window* pParent, const ResId& rResId );
135 ~CheckBox();
137 SvTreeListEntry* DoInsertEntry( const String& rStr, sal_uLong nPos = LISTBOX_APPEND );
138 SvTreeListEntry* FindEntry( const String& rName );
140 void CheckEntryPos( sal_uLong nPos );
141 bool IsChecked( sal_uLong nPos ) const;
143 virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&, SvLBoxButtonKind eButtonKind);
144 virtual sal_Bool EditingEntry( SvTreeListEntry* pEntry, Selection& rSel );
145 virtual sal_Bool EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText );
147 void SetDocument( const ScriptDocument& rDocument ) { m_aDocument = rDocument; }
149 void SetMode (ObjectMode::Mode);
150 ObjectMode::Mode GetMode () const { return eMode; }
153 class LibDialog: public ModalDialog
155 private:
156 OKButton aOKButton;
157 CancelButton aCancelButton;
158 FixedText aStorageName;
159 CheckBox aLibBox;
160 FixedLine aFixedLine;
161 ::CheckBox aReferenceBox;
162 ::CheckBox aReplaceBox;
164 public:
165 LibDialog( Window* pParent );
166 ~LibDialog();
168 void SetStorageName( const OUString& rName );
170 CheckBox& GetLibBox() { return aLibBox; }
171 bool IsReference() const { return aReferenceBox.IsChecked(); }
172 bool IsReplace() const { return aReplaceBox.IsChecked(); }
174 void EnableReference (bool b) { aReferenceBox.Enable(b); }
175 void EnableReplace (bool b) { aReplaceBox.Enable(b); }
179 class OrganizeDialog : public TabDialog
181 private:
182 TabControl aTabCtrl;
183 EntryDescriptor m_aCurEntry;
185 public:
186 OrganizeDialog( Window* pParent, sal_Int16 tabId, EntryDescriptor& rDesc );
187 ~OrganizeDialog();
189 virtual short Execute();
191 DECL_LINK( ActivatePageHdl, TabControl * );
194 class ObjectPage: public TabPage
196 protected:
197 FixedText aLibText;
198 ExtTreeListBox aBasicBox;
199 PushButton aEditButton;
200 CancelButton aCloseButton;
201 PushButton aNewModButton;
202 PushButton aNewDlgButton;
203 PushButton aDelButton;
205 DECL_LINK( BasicBoxHighlightHdl, TreeListBox * );
206 DECL_LINK( ButtonHdl, Button * );
207 void CheckButtons();
208 bool GetSelection( ScriptDocument& rDocument, OUString& rLibName );
209 void DeleteCurrent();
210 void NewModule();
211 void NewDialog();
212 void EndTabDialog( sal_uInt16 nRet );
214 TabDialog* pTabDlg;
216 virtual void ActivatePage();
217 virtual void DeactivatePage();
219 public:
220 ObjectPage( Window* pParent, const ResId& rResId, sal_uInt16 nMode );
222 void SetCurrentEntry( EntryDescriptor& rDesc );
223 void SetTabDlg( TabDialog* p ) { pTabDlg = p;}
227 class LibPage: public TabPage
229 protected:
230 FixedText aBasicsText;
231 ListBox aBasicsBox;
232 FixedText aLibText;
233 CheckBox aLibBox;
234 PushButton aEditButton;
235 CancelButton aCloseButton;
236 PushButton aPasswordButton;
237 PushButton aNewLibButton;
238 PushButton aInsertLibButton;
239 PushButton aExportButton;
240 PushButton aDelButton;
242 ScriptDocument m_aCurDocument;
243 LibraryLocation m_eCurLocation;
245 DECL_LINK( TreeListHighlightHdl, SvTreeListBox * );
246 DECL_LINK( BasicSelectHdl, ListBox * );
247 DECL_LINK( ButtonHdl, Button * );
248 DECL_LINK( CheckPasswordHdl, SvxPasswordDialog * );
249 void CheckButtons();
250 void DeleteCurrent();
251 void NewLib();
252 void InsertLib();
253 void implExportLib( const String& aLibName, const String& aTargetURL,
254 const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
255 void Export();
256 void ExportAsPackage( const String& aLibName );
257 void ExportAsBasic( const String& aLibName );
258 void EndTabDialog( sal_uInt16 nRet );
259 void FillListBox();
260 void InsertListBoxEntry( const ScriptDocument& rDocument, LibraryLocation eLocation );
261 void SetCurLib();
262 SvTreeListEntry* ImpInsertLibEntry( const String& rLibName, sal_uLong nPos );
263 virtual void ActivatePage();
264 virtual void DeactivatePage();
266 TabDialog* pTabDlg;
268 public:
269 LibPage( Window* pParent );
270 virtual ~LibPage();
272 void SetTabDlg( TabDialog* p ) { pTabDlg = p;}
275 // Helper functions
276 SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument,
277 TreeListBox& rBasicBox, const OUString& rLibName, OUString aModName, bool bMain = false );
278 void createLibImpl( Window* pWin, const ScriptDocument& rDocument,
279 CheckBox* pLibBox, TreeListBox* pBasicBox );
281 } // namespace basctl
283 #endif // BASCTL_MODULDLG_HXX
285 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */