1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
;
54 class NewObjectDialog
: public ModalDialog
60 CancelButton aCancelButton
;
62 DECL_LINK(OkButtonHandler
, void *);
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
77 CancelButton aCancelButton
;
78 DECL_LINK(OkButtonHandler
, void *);
80 GotoLineDialog( Window
* pParent
);
81 sal_Int32
GetLineNumber();
84 class ExportDialog
: public ModalDialog
87 RadioButton maExportAsPackageButton
;
88 RadioButton maExportAsBasicButton
;
90 CancelButton maCancelButton
;
92 bool mbExportAsPackage
;
94 DECL_LINK(OkButtonHandler
, void *);
97 ExportDialog( Window
* pParent
);
100 bool isExportAsPackage () { return mbExportAsPackage
; }
104 class ExtTreeListBox
: public TreeListBox
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
);
121 ExtTreeListBox( Window
* pParent
, const ResId
& rRes
);
125 class CheckBox
: public SvTabListBox
128 ObjectMode::Mode eMode
;
129 SvLBoxButtonData
* pCheckButton
;
130 ScriptDocument m_aDocument
;
134 CheckBox( Window
* pParent
, const ResId
& rResId
);
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
157 CancelButton aCancelButton
;
158 FixedText aStorageName
;
160 FixedLine aFixedLine
;
161 ::CheckBox aReferenceBox
;
162 ::CheckBox aReplaceBox
;
165 LibDialog( Window
* pParent
);
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
183 EntryDescriptor m_aCurEntry
;
186 OrganizeDialog( Window
* pParent
, sal_Int16 tabId
, EntryDescriptor
& rDesc
);
189 virtual short Execute();
191 DECL_LINK( ActivatePageHdl
, TabControl
* );
194 class ObjectPage
: public TabPage
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
* );
208 bool GetSelection( ScriptDocument
& rDocument
, OUString
& rLibName
);
209 void DeleteCurrent();
212 void EndTabDialog( sal_uInt16 nRet
);
216 virtual void ActivatePage();
217 virtual void DeactivatePage();
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
230 FixedText aBasicsText
;
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
* );
250 void DeleteCurrent();
253 void implExportLib( const String
& aLibName
, const String
& aTargetURL
,
254 const ::com::sun::star::uno::Reference
< ::com::sun::star::task::XInteractionHandler
>& Handler
);
256 void ExportAsPackage( const String
& aLibName
);
257 void ExportAsBasic( const String
& aLibName
);
258 void EndTabDialog( sal_uInt16 nRet
);
260 void InsertListBoxEntry( const ScriptDocument
& rDocument
, LibraryLocation eLocation
);
262 SvTreeListEntry
* ImpInsertLibEntry( const String
& rLibName
, sal_uLong nPos
);
263 virtual void ActivatePage();
264 virtual void DeactivatePage();
269 LibPage( Window
* pParent
);
272 void SetTabDlg( TabDialog
* p
) { pTabDlg
= p
;}
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: */