1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 //
28 #ifndef _MACRODLG_HXX
29 #define _MACRODLG_HXX
30 
31 #include <svheader.hxx>
32 
33 #include <bastype2.hxx>
34 #include <bastype3.hxx>
35 #include <sfx2/basedlgs.hxx>
36 #include <vcl/fixed.hxx>
37 
38 #ifndef _SV_BUTTON_HXX //autogen
39 #include <vcl/button.hxx>
40 #endif
41 
42 #define MACRO_CLOSE			10
43 #define MACRO_OK_RUN		11
44 #define MACRO_NEW 			12
45 #define MACRO_EDIT			14
46 #define MACRO_ORGANIZE		15
47 #define MACRO_ASSIGN		16
48 
49 #define MACROCHOOSER_ALL			1
50 #define MACROCHOOSER_CHOOSEONLY		2
51 #define MACROCHOOSER_RECORDING		3
52 
53 class BasicManager;
54 
55 class MacroChooser : public SfxModalDialog
56 {
57 private:
58 	FixedText 				aMacroNameTxt;
59 	Edit 					aMacroNameEdit;
60 	FixedText 				aMacroFromTxT;
61 	FixedText 				aMacrosSaveInTxt;
62 	BasicTreeListBox		aBasicBox;
63 	FixedText 				aMacrosInTxt;
64 	String	 				aMacrosInTxtBaseStr;
65 	SvTreeListBox			aMacroBox;
66 
67 	PushButton				aRunButton;
68 	CancelButton 			aCloseButton;
69 	PushButton				aAssignButton;
70 	PushButton				aEditButton;
71 	PushButton				aNewDelButton;
72 	PushButton 				aOrganizeButton;
73 	HelpButton				aHelpButton;
74 	PushButton 				aNewLibButton;
75 	PushButton 				aNewModButton;
76 
77 	sal_Bool				bNewDelIsDel;
78 	sal_Bool				bForceStoreBasic;
79 
80 	sal_uInt16				nMode;
81 
82 	DECL_LINK( MacroSelectHdl, SvTreeListBox * );
83 	DECL_LINK( MacroDoubleClickHdl, SvTreeListBox * );
84 	DECL_LINK( BasicSelectHdl, SvTreeListBox * );
85 	DECL_LINK( EditModifyHdl, Edit * );
86 	DECL_LINK( ButtonHdl, Button * );
87 
88 	void				CheckButtons();
89 	void				SaveSetCurEntry( SvTreeListBox& rBox, SvLBoxEntry* pEntry );
90 	void				UpdateFields();
91 
92 	void				EnableButton( Button& rButton, sal_Bool bEnable );
93 
94 	String				GetInfo( SbxVariable* pVar );
95 
96 	void				StoreMacroDescription();
97 	void				RestoreMacroDescription();
98 
99 public:
100 						MacroChooser( Window* pParent, sal_Bool bCreateEntries = sal_True );
101 						~MacroChooser();
102 
103 	SbMethod*			GetMacro();
104     void                DeleteMacro();
105 	SbMethod*			CreateMacro();
106 
107 	virtual short		Execute();
108 
109 	void				SetMode( sal_uInt16 nMode );
110 	sal_uInt16				GetMode() const { return nMode; }
111 };
112 
113 #endif	// _MACRODLG_HXX
114