1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: moduldlg.hxx,v $
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 ************************************************************************/
34 #include <svheader.hxx>
36 #include <bastype2.hxx>
37 #include <vcl/dialog.hxx>
39 #ifndef _SV_BUTTON_HXX //autogen
40 #include <vcl/button.hxx>
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>
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
65 CancelButton aCancelButton
;
67 DECL_LINK(OkButtonHandler
, Button
*);
70 NewObjectDialog(Window
* pParent
, USHORT nMode
, bool bCheckName
= false);
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
80 RadioButton maExportAsPackageButton
;
81 RadioButton maExportAsBasicButton
;
83 CancelButton maCancelButton
;
85 sal_Bool mbExportAsPackage
;
87 DECL_LINK(OkButtonHandler
, Button
*);
90 ExportDialog( Window
* pParent
);
93 sal_Bool
isExportAsPackage( void ) { return mbExportAsPackage
; }
97 class ExtBasicTreeListBox
: public BasicTreeListBox
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
);
114 ExtBasicTreeListBox( Window
* pParent
, const ResId
& rRes
);
115 ~ExtBasicTreeListBox();
118 #define LIBMODE_CHOOSER 1
119 #define LIBMODE_MANAGER 2
121 class BasicCheckBox
: public SvTabListBox
125 SvLBoxButtonData
* pCheckButton
;
126 ScriptDocument m_aDocument
;
130 BasicCheckBox( Window
* pParent
, const ResId
& rResId
);
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
153 CancelButton aCancelButton
;
154 FixedText aStorageName
;
155 BasicCheckBox aLibBox
;
156 FixedLine aFixedLine
;
157 CheckBox aReferenceBox
;
158 CheckBox aReplaceBox
;
161 LibDialog( Window
* pParent
);
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
179 BasicEntryDescriptor m_aCurEntry
;
182 OrganizeDialog( Window
* pParent
, INT16 tabId
, BasicEntryDescriptor
& rDesc
);
185 virtual short Execute();
187 DECL_LINK( ActivatePageHdl
, TabControl
* );
190 class ObjectPage
: public TabPage
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
* );
204 bool GetSelection( ScriptDocument
& rDocument
, String
& rLibName
);
205 void DeleteCurrent();
208 void EndTabDialog( USHORT nRet
);
212 virtual void ActivatePage();
213 virtual void DeactivatePage();
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
228 FixedText aBasicsText
;
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
* );
248 void DeleteCurrent();
251 void implExportLib( const String
& aLibName
, const String
& aTargetURL
,
252 const ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionHandler
>& Handler
);
254 void ExportAsPackage( const String
& aLibName
);
255 void ExportAsBasic( const String
& aLibName
);
256 void EndTabDialog( USHORT nRet
);
258 void InsertListBoxEntry( const ScriptDocument
& rDocument
, LibraryLocation eLocation
);
260 SvLBoxEntry
* ImpInsertLibEntry( const String
& rLibName
, ULONG nPos
);
261 virtual void ActivatePage();
262 virtual void DeactivatePage();
267 LibPage( Window
* pParent
);
270 void SetTabDlg( TabDialog
* p
) { pTabDlg
= p
;}
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