Update ooo320-m1
[ooovba.git] / basctl / source / basicide / moduldlg.hxx
blobe4a575e8e356f58bb404d1c827cd429fc62b2d1c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: moduldlg.hxx,v $
10 * $Revision: 1.25 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _MODULDLG_HXX
32 #define _MODULDLG_HXX
34 #include <svheader.hxx>
36 #include <bastype2.hxx>
37 #include <vcl/dialog.hxx>
39 #ifndef _SV_BUTTON_HXX //autogen
40 #include <vcl/button.hxx>
41 #endif
42 #include <vcl/fixed.hxx>
43 #include <svtools/svtabbx.hxx>
44 #include <vcl/tabdlg.hxx>
45 #include <vcl/tabpage.hxx>
46 #include "com/sun/star/task/XInteractionHandler.hpp"
48 #include <vcl/tabctrl.hxx>
49 #include <vcl/lstbox.hxx>
51 class StarBASIC;
54 #define NEWOBJECTMODE_LIB 1
55 #define NEWOBJECTMODE_MOD 2
56 #define NEWOBJECTMODE_DLG 3
57 #define NEWOBJECTMODE_METH 4
59 class NewObjectDialog : public ModalDialog
61 private:
62 FixedText aText;
63 Edit aEdit;
64 OKButton aOKButton;
65 CancelButton aCancelButton;
67 DECL_LINK(OkButtonHandler, Button *);
69 public:
70 NewObjectDialog(Window * pParent, USHORT nMode, bool bCheckName = false);
71 ~NewObjectDialog();
73 String GetObjectName() const { return aEdit.GetText(); }
74 void SetObjectName( const String& rName ) { aEdit.SetText( rName ); aEdit.SetSelection( Selection( 0, rName.Len() ) );}
77 class ExportDialog : public ModalDialog
79 private:
80 RadioButton maExportAsPackageButton;
81 RadioButton maExportAsBasicButton;
82 OKButton maOKButton;
83 CancelButton maCancelButton;
85 sal_Bool mbExportAsPackage;
87 DECL_LINK(OkButtonHandler, Button *);
89 public:
90 ExportDialog( Window * pParent );
91 ~ExportDialog();
93 sal_Bool isExportAsPackage( void ) { return mbExportAsPackage; }
97 class ExtBasicTreeListBox : public BasicTreeListBox
99 protected:
100 virtual BOOL EditingEntry( SvLBoxEntry* pEntry, Selection& rSel );
101 virtual BOOL EditedEntry( SvLBoxEntry* pEntry, const String& rNewText );
103 virtual DragDropMode NotifyStartDrag( TransferDataContainer& rData, SvLBoxEntry* pEntry );
104 virtual BOOL NotifyAcceptDrop( SvLBoxEntry* pEntry );
106 virtual BOOL NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
107 SvLBoxEntry*& rpNewParent, ULONG& rNewChildPos );
108 virtual BOOL NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
109 SvLBoxEntry*& rpNewParent, ULONG& rNewChildPos );
110 BOOL NotifyCopyingMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
111 SvLBoxEntry*& rpNewParent, ULONG& rNewChildPos, BOOL bMove );
113 public:
114 ExtBasicTreeListBox( Window* pParent, const ResId& rRes );
115 ~ExtBasicTreeListBox();
118 #define LIBMODE_CHOOSER 1
119 #define LIBMODE_MANAGER 2
121 class BasicCheckBox : public SvTabListBox
123 private:
124 USHORT nMode;
125 SvLBoxButtonData* pCheckButton;
126 ScriptDocument m_aDocument;
127 void Init();
129 public:
130 BasicCheckBox( Window* pParent, const ResId& rResId );
131 ~BasicCheckBox();
133 SvLBoxEntry* DoInsertEntry( const String& rStr, ULONG nPos = LISTBOX_APPEND );
134 SvLBoxEntry* FindEntry( const String& rName );
136 void CheckEntryPos( ULONG nPos, BOOL bCheck = TRUE );
137 BOOL IsChecked( ULONG nPos ) const;
139 virtual void InitEntry( SvLBoxEntry*, const XubString&, const Image&, const Image&, SvLBoxButtonKind eButtonKind );
140 virtual BOOL EditingEntry( SvLBoxEntry* pEntry, Selection& rSel );
141 virtual BOOL EditedEntry( SvLBoxEntry* pEntry, const String& rNewText );
143 void SetDocument( const ScriptDocument& rDocument ) { m_aDocument = rDocument; }
145 void SetMode( USHORT n );
146 USHORT GetMode() const { return nMode; }
149 class LibDialog: public ModalDialog
151 private:
152 OKButton aOKButton;
153 CancelButton aCancelButton;
154 FixedText aStorageName;
155 BasicCheckBox aLibBox;
156 FixedLine aFixedLine;
157 CheckBox aReferenceBox;
158 CheckBox aReplaceBox;
160 public:
161 LibDialog( Window* pParent );
162 ~LibDialog();
164 void SetStorageName( const String& rName );
166 BasicCheckBox& GetLibBox() { return aLibBox; }
167 BOOL IsReference() const { return aReferenceBox.IsChecked(); }
168 BOOL IsReplace() const { return aReplaceBox.IsChecked(); }
170 void EnableReference( BOOL b ) { aReferenceBox.Enable( b ); }
171 void EnableReplace( BOOL b ) { aReplaceBox.Enable( b ); }
175 class OrganizeDialog : public TabDialog
177 private:
178 TabControl aTabCtrl;
179 BasicEntryDescriptor m_aCurEntry;
181 public:
182 OrganizeDialog( Window* pParent, INT16 tabId, BasicEntryDescriptor& rDesc );
183 ~OrganizeDialog();
185 virtual short Execute();
187 DECL_LINK( ActivatePageHdl, TabControl * );
190 class ObjectPage: public TabPage
192 protected:
193 FixedText aLibText;
194 ExtBasicTreeListBox aBasicBox;
195 PushButton aEditButton;
196 CancelButton aCloseButton;
197 PushButton aNewModButton;
198 PushButton aNewDlgButton;
199 PushButton aDelButton;
201 DECL_LINK( BasicBoxHighlightHdl, BasicTreeListBox * );
202 DECL_LINK( ButtonHdl, Button * );
203 void CheckButtons();
204 bool GetSelection( ScriptDocument& rDocument, String& rLibName );
205 void DeleteCurrent();
206 void NewModule();
207 void NewDialog();
208 void EndTabDialog( USHORT nRet );
210 TabDialog* pTabDlg;
212 virtual void ActivatePage();
213 virtual void DeactivatePage();
215 public:
216 ObjectPage( Window* pParent, const ResId& rResId, USHORT nMode );
218 void SetCurrentEntry( BasicEntryDescriptor& rDesc );
219 void SetTabDlg( TabDialog* p ) { pTabDlg = p;}
223 class SvxPasswordDialog;
225 class LibPage: public TabPage
227 protected:
228 FixedText aBasicsText;
229 ListBox aBasicsBox;
230 FixedText aLibText;
231 BasicCheckBox aLibBox;
232 PushButton aEditButton;
233 CancelButton aCloseButton;
234 PushButton aPasswordButton;
235 PushButton aExportButton;
236 PushButton aNewLibButton;
237 PushButton aInsertLibButton;
238 PushButton aDelButton;
240 ScriptDocument m_aCurDocument;
241 LibraryLocation m_eCurLocation;
243 DECL_LINK( TreeListHighlightHdl, SvTreeListBox * );
244 DECL_LINK( BasicSelectHdl, ListBox * );
245 DECL_LINK( ButtonHdl, Button * );
246 DECL_LINK( CheckPasswordHdl, SvxPasswordDialog * );
247 void CheckButtons();
248 void DeleteCurrent();
249 void NewLib();
250 void InsertLib();
251 void implExportLib( const String& aLibName, const String& aTargetURL,
252 const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
253 void Export();
254 void ExportAsPackage( const String& aLibName );
255 void ExportAsBasic( const String& aLibName );
256 void EndTabDialog( USHORT nRet );
257 void FillListBox();
258 void InsertListBoxEntry( const ScriptDocument& rDocument, LibraryLocation eLocation );
259 void SetCurLib();
260 SvLBoxEntry* ImpInsertLibEntry( const String& rLibName, ULONG nPos );
261 virtual void ActivatePage();
262 virtual void DeactivatePage();
264 TabDialog* pTabDlg;
266 public:
267 LibPage( Window* pParent );
268 virtual ~LibPage();
270 void SetTabDlg( TabDialog* p ) { pTabDlg = p;}
273 // Helper functions
274 SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument,
275 BasicTreeListBox& rBasicBox, const String& rLibName, String aModName, bool bMain = false );
276 void createLibImpl( Window* pWin, const ScriptDocument& rDocument,
277 BasicCheckBox* pLibBox, BasicTreeListBox* pBasicBox );
279 #endif // _MODULDLG_HXX