lok: Don't attempt to select the exact text after a failed search.
[LibreOffice.git] / basctl / source / basicide / moduldlg.hxx
blobac7c56468da56730e98f4062f51f5450d5e3aa36
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_BASCTL_SOURCE_BASICIDE_MODULDLG_HXX
21 #define INCLUDED_BASCTL_SOURCE_BASICIDE_MODULDLG_HXX
23 #include <bastype2.hxx>
24 #include <svtools/svtabbx.hxx>
25 #include <vcl/layout.hxx>
26 #include <vcl/lstbox.hxx>
27 #include <vcl/tabctrl.hxx>
28 #include <vcl/tabdlg.hxx>
29 #include <vcl/tabpage.hxx>
30 #include <com/sun/star/task/XInteractionHandler.hpp>
32 class SvxPasswordDialog;
34 namespace basctl
37 namespace ObjectMode
39 enum Mode
41 Library = 1,
42 Module = 2,
43 Dialog = 3,
44 Method = 4,
48 class NewObjectDialog : public ModalDialog
50 private:
51 VclPtr<Edit> m_pEdit;
52 VclPtr<OKButton> m_pOKButton;
54 DECL_LINK(OkButtonHandler, void *);
55 public:
56 NewObjectDialog (vcl::Window* pParent, ObjectMode::Mode, bool bCheckName = false);
57 virtual ~NewObjectDialog();
58 virtual void dispose() SAL_OVERRIDE;
59 OUString GetObjectName() const { return m_pEdit->GetText(); }
60 void SetObjectName( const OUString& rName )
62 m_pEdit->SetText( rName );
63 m_pEdit->SetSelection(Selection( 0, rName.getLength()));
67 class GotoLineDialog : public ModalDialog
69 VclPtr<Edit> m_pEdit;
70 VclPtr<OKButton> m_pOKButton;
71 DECL_LINK(OkButtonHandler, void *);
72 public:
73 explicit GotoLineDialog(vcl::Window * pParent);
74 virtual ~GotoLineDialog();
75 virtual void dispose() SAL_OVERRIDE;
76 sal_Int32 GetLineNumber() const;
79 class ExportDialog : public ModalDialog
81 private:
82 VclPtr<RadioButton> m_pExportAsPackageButton;
83 VclPtr<OKButton> m_pOKButton;
85 bool mbExportAsPackage;
87 DECL_LINK(OkButtonHandler, void *);
89 public:
90 explicit ExportDialog( vcl::Window * pParent );
91 virtual ~ExportDialog();
92 virtual void dispose() SAL_OVERRIDE;
94 bool isExportAsPackage () const { return mbExportAsPackage; }
98 class ExtTreeListBox : public TreeListBox
100 protected:
101 virtual bool EditingEntry( SvTreeListEntry* pEntry, Selection& rSel ) SAL_OVERRIDE;
102 virtual bool EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText ) SAL_OVERRIDE;
104 virtual DragDropMode NotifyStartDrag( TransferDataContainer& rData, SvTreeListEntry* pEntry ) SAL_OVERRIDE;
105 virtual bool NotifyAcceptDrop( SvTreeListEntry* pEntry ) SAL_OVERRIDE;
107 virtual TriState NotifyMoving( SvTreeListEntry* pTarget, SvTreeListEntry* pEntry,
108 SvTreeListEntry*& rpNewParent, sal_uLong& rNewChildPos ) SAL_OVERRIDE;
109 virtual TriState NotifyCopying( SvTreeListEntry* pTarget, SvTreeListEntry* pEntry,
110 SvTreeListEntry*& rpNewParent, sal_uLong& rNewChildPos ) SAL_OVERRIDE;
111 TriState NotifyCopyingMoving( SvTreeListEntry* pTarget, SvTreeListEntry* pEntry,
112 SvTreeListEntry*& rpNewParent, sal_uLong& rNewChildPos, bool bMove );
114 public:
115 ExtTreeListBox(vcl::Window* pParent, WinBits nStyle);
118 class CheckBox : public SvTabListBox
120 private:
121 ObjectMode::Mode eMode;
122 SvLBoxButtonData* pCheckButton;
123 ScriptDocument m_aDocument;
124 void Init();
126 public:
127 CheckBox(vcl::Window* pParent, WinBits nStyle);
128 virtual ~CheckBox();
129 virtual void dispose() SAL_OVERRIDE;
131 SvTreeListEntry* DoInsertEntry( const OUString& rStr, sal_uLong nPos = LISTBOX_APPEND );
132 SvTreeListEntry* FindEntry( const OUString& rName );
134 void CheckEntryPos( sal_uLong nPos );
135 bool IsChecked( sal_uLong nPos ) const;
137 virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&, SvLBoxButtonKind eButtonKind) SAL_OVERRIDE;
138 virtual bool EditingEntry( SvTreeListEntry* pEntry, Selection& rSel ) SAL_OVERRIDE;
139 virtual bool EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText ) SAL_OVERRIDE;
141 void SetDocument( const ScriptDocument& rDocument ) { m_aDocument = rDocument; }
143 void SetMode (ObjectMode::Mode);
144 ObjectMode::Mode GetMode () const { return eMode; }
147 class LibDialog: public ModalDialog
149 private:
150 VclPtr<VclFrame> m_pStorageFrame;
151 VclPtr<CheckBox> m_pLibBox;
152 VclPtr< ::CheckBox> m_pReferenceBox;
153 VclPtr< ::CheckBox> m_pReplaceBox;
155 public:
156 explicit LibDialog(vcl::Window* pParent);
157 virtual ~LibDialog();
158 virtual void dispose() SAL_OVERRIDE;
160 void SetStorageName( const OUString& rName );
162 CheckBox& GetLibBox() { return *m_pLibBox; }
163 bool IsReference() const { return m_pReferenceBox->IsChecked(); }
164 bool IsReplace() const { return m_pReplaceBox->IsChecked(); }
166 void EnableReference (bool b) { m_pReferenceBox->Enable(b); }
167 void EnableReplace (bool b) { m_pReplaceBox->Enable(b); }
170 class OrganizeDialog : public TabDialog
172 private:
173 VclPtr<TabControl> m_pTabCtrl;
174 EntryDescriptor m_aCurEntry;
176 public:
177 OrganizeDialog( vcl::Window* pParent, sal_Int16 tabId, EntryDescriptor& rDesc );
178 virtual ~OrganizeDialog();
179 virtual void dispose() SAL_OVERRIDE;
181 virtual short Execute() SAL_OVERRIDE;
183 DECL_LINK( ActivatePageHdl, TabControl * );
186 class ObjectPage: public TabPage
188 protected:
189 VclPtr<ExtTreeListBox> m_pBasicBox;
190 VclPtr<PushButton> m_pEditButton;
191 VclPtr<PushButton> m_pNewModButton;
192 VclPtr<PushButton> m_pNewDlgButton;
193 VclPtr<PushButton> m_pDelButton;
195 DECL_LINK( BasicBoxHighlightHdl, TreeListBox * );
196 DECL_LINK( ButtonHdl, Button * );
197 void CheckButtons();
198 bool GetSelection( ScriptDocument& rDocument, OUString& rLibName );
199 void DeleteCurrent();
200 void NewModule();
201 void NewDialog();
202 void EndTabDialog( sal_uInt16 nRet );
204 VclPtr<TabDialog> pTabDlg;
206 virtual void ActivatePage() SAL_OVERRIDE;
207 virtual void DeactivatePage() SAL_OVERRIDE;
209 public:
210 ObjectPage(vcl::Window* pParent, const OString& rName, sal_uInt16 nMode);
211 virtual ~ObjectPage();
212 virtual void dispose() SAL_OVERRIDE;
214 void SetCurrentEntry( EntryDescriptor& rDesc );
215 void SetTabDlg( TabDialog* p ) { pTabDlg = p;}
219 class LibPage: public TabPage
221 protected:
222 VclPtr<ListBox> m_pBasicsBox;
223 VclPtr<CheckBox> m_pLibBox;
224 VclPtr<PushButton> m_pEditButton;
225 VclPtr<PushButton> m_pPasswordButton;
226 VclPtr<PushButton> m_pNewLibButton;
227 VclPtr<PushButton> m_pInsertLibButton;
228 VclPtr<PushButton> m_pExportButton;
229 VclPtr<PushButton> m_pDelButton;
231 ScriptDocument m_aCurDocument;
232 LibraryLocation m_eCurLocation;
234 DECL_LINK( TreeListHighlightHdl, SvTreeListBox * );
235 DECL_LINK( BasicSelectHdl, ListBox * );
236 DECL_LINK( ButtonHdl, Button * );
237 DECL_LINK( CheckPasswordHdl, SvxPasswordDialog * );
238 void CheckButtons();
239 void DeleteCurrent();
240 void NewLib();
241 void InsertLib();
242 void implExportLib( const OUString& aLibName, const OUString& aTargetURL,
243 const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
244 void Export();
245 void ExportAsPackage( const OUString& aLibName );
246 void ExportAsBasic( const OUString& aLibName );
247 void EndTabDialog( sal_uInt16 nRet );
248 void FillListBox();
249 void InsertListBoxEntry( const ScriptDocument& rDocument, LibraryLocation eLocation );
250 void SetCurLib();
251 SvTreeListEntry* ImpInsertLibEntry( const OUString& rLibName, sal_uLong nPos );
252 virtual void ActivatePage() SAL_OVERRIDE;
253 virtual void DeactivatePage() SAL_OVERRIDE;
255 VclPtr<TabDialog> pTabDlg;
257 public:
258 explicit LibPage(vcl::Window* pParent);
259 virtual ~LibPage();
260 virtual void dispose() SAL_OVERRIDE;
262 void SetTabDlg( TabDialog* p ) { pTabDlg = p;}
265 // Helper functions
266 SbModule* createModImpl( vcl::Window* pWin, const ScriptDocument& rDocument,
267 TreeListBox& rBasicBox, const OUString& rLibName, const OUString& aModName, bool bMain = false );
268 void createLibImpl( vcl::Window* pWin, const ScriptDocument& rDocument,
269 CheckBox* pLibBox, TreeListBox* pBasicBox );
271 } // namespace basctl
273 #endif // INCLUDED_BASCTL_SOURCE_BASICIDE_MODULDLG_HXX
275 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */