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