xref: /aoo42x/main/cui/source/inc/cuigaldlg.hxx (revision c4eee24d)
1*c4eee24dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*c4eee24dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*c4eee24dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*c4eee24dSAndrew Rist  * distributed with this work for additional information
6*c4eee24dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*c4eee24dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*c4eee24dSAndrew Rist  * "License"); you may not use this file except in compliance
9*c4eee24dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*c4eee24dSAndrew Rist  *
11*c4eee24dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*c4eee24dSAndrew Rist  *
13*c4eee24dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*c4eee24dSAndrew Rist  * software distributed under the License is distributed on an
15*c4eee24dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c4eee24dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*c4eee24dSAndrew Rist  * specific language governing permissions and limitations
18*c4eee24dSAndrew Rist  * under the License.
19*c4eee24dSAndrew Rist  *
20*c4eee24dSAndrew Rist  *************************************************************/
21*c4eee24dSAndrew Rist 
22*c4eee24dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _CUI_GALDLG_HXX_
25cdf0e10cSrcweir #define _CUI_GALDLG_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vos/thread.hxx>
28cdf0e10cSrcweir #include <vcl/dialog.hxx>
29cdf0e10cSrcweir #include <vcl/graph.hxx>
30cdf0e10cSrcweir #include <vcl/fixed.hxx>
31cdf0e10cSrcweir #include <vcl/button.hxx>
32cdf0e10cSrcweir #include <vcl/lstbox.hxx>
33cdf0e10cSrcweir #include <vcl/menu.hxx>
34cdf0e10cSrcweir #include <vcl/edit.hxx>
35cdf0e10cSrcweir #include <vcl/combobox.hxx>
36cdf0e10cSrcweir #include <svl/slstitm.hxx>
37cdf0e10cSrcweir #include <svtools/transfer.hxx>
38cdf0e10cSrcweir #include <svtools/grfmgr.hxx>
39cdf0e10cSrcweir #include <sfx2/tabdlg.hxx>
40cdf0e10cSrcweir #include <svx/galctrl.hxx>
41cdf0e10cSrcweir #include <svx/galmisc.hxx>
42cdf0e10cSrcweir #include <com/sun/star/media/XPlayer.hpp>
43cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
44cdf0e10cSrcweir #include <svtools/dialogclosedlistener.hxx>
45cdf0e10cSrcweir 
46cdf0e10cSrcweir DECLARE_LIST( StringList, String* )
47cdf0e10cSrcweir 
48cdf0e10cSrcweir // ------------
49cdf0e10cSrcweir // - Forwards -
50cdf0e10cSrcweir // ------------
51cdf0e10cSrcweir 
52cdf0e10cSrcweir class Gallery;
53cdf0e10cSrcweir class GalleryTheme;
54cdf0e10cSrcweir class SearchProgress;
55cdf0e10cSrcweir class TakeProgress;
56cdf0e10cSrcweir class TPGalleryThemeProperties;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir // ---------------
59cdf0e10cSrcweir // - FilterEntry -
60cdf0e10cSrcweir // ---------------
61cdf0e10cSrcweir 
62cdf0e10cSrcweir struct FilterEntry
63cdf0e10cSrcweir {
64cdf0e10cSrcweir 	String	aFilterName;
65cdf0e10cSrcweir };
66cdf0e10cSrcweir 
67cdf0e10cSrcweir // ----------------
68cdf0e10cSrcweir // - SearchThread -
69cdf0e10cSrcweir // ----------------
70cdf0e10cSrcweir 
71cdf0e10cSrcweir class SearchThread : public ::vos::OThread
72cdf0e10cSrcweir {
73cdf0e10cSrcweir private:
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 	SearchProgress*				mpProgress;
76cdf0e10cSrcweir 	TPGalleryThemeProperties*	mpBrowser;
77cdf0e10cSrcweir 	INetURLObject				maStartURL;
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 	void						ImplSearch( const INetURLObject& rStartURL,
80cdf0e10cSrcweir                                             const ::std::vector< String >& rFormats,
81cdf0e10cSrcweir                                             sal_Bool bRecursive );
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 	virtual void SAL_CALL		run();
84cdf0e10cSrcweir     virtual void SAL_CALL       onTerminated();
85cdf0e10cSrcweir 
86cdf0e10cSrcweir public:
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 								SearchThread( SearchProgress* pProgess,
89cdf0e10cSrcweir 											  TPGalleryThemeProperties* pBrowser,
90cdf0e10cSrcweir 											  const INetURLObject& rStartURL );
91cdf0e10cSrcweir     virtual						~SearchThread();
92cdf0e10cSrcweir };
93cdf0e10cSrcweir 
94cdf0e10cSrcweir // ------------------
95cdf0e10cSrcweir // - SearchProgress -
96cdf0e10cSrcweir // ------------------
97cdf0e10cSrcweir 
98cdf0e10cSrcweir class SearchProgress : public ModalDialog
99cdf0e10cSrcweir {
100cdf0e10cSrcweir private:
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 	FixedText			aFtSearchDir;
103cdf0e10cSrcweir     FixedLine           aFLSearchDir;
104cdf0e10cSrcweir 	FixedText			aFtSearchType;
105cdf0e10cSrcweir     FixedLine           aFLSearchType;
106cdf0e10cSrcweir 	CancelButton		aBtnCancel;
107cdf0e10cSrcweir 	SearchThread		maSearchThread;
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 						DECL_LINK( ClickCancelBtn, void* );
110cdf0e10cSrcweir 	void				Terminate();
111cdf0e10cSrcweir 
112cdf0e10cSrcweir public:
113cdf0e10cSrcweir 						SearchProgress( Window* pParent, const INetURLObject& rStartURL );
~SearchProgress()114cdf0e10cSrcweir 						~SearchProgress() {};
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 						DECL_LINK( CleanUpHdl, void* );
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 	virtual short		Execute();
119cdf0e10cSrcweir     virtual void        StartExecuteModal( const Link& rEndDialogHdl );
SetFileType(const String & rType)120cdf0e10cSrcweir 	void 				SetFileType( const String& rType ) { aFtSearchType.SetText( rType ); }
SetDirectory(const INetURLObject & rURL)121cdf0e10cSrcweir 	void 				SetDirectory( const INetURLObject& rURL ) { aFtSearchDir.SetText( GetReducedString( rURL, 30 ) ); }
122cdf0e10cSrcweir };
123cdf0e10cSrcweir 
124cdf0e10cSrcweir // --------------
125cdf0e10cSrcweir // - TakeThread -
126cdf0e10cSrcweir // --------------
127cdf0e10cSrcweir 
128cdf0e10cSrcweir class TakeThread : public ::vos::OThread
129cdf0e10cSrcweir {
130cdf0e10cSrcweir private:
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	TakeProgress*				mpProgress;
133cdf0e10cSrcweir 	TPGalleryThemeProperties*	mpBrowser;
134cdf0e10cSrcweir 	List&						mrTakenList;
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 	virtual void SAL_CALL		run();
137cdf0e10cSrcweir     virtual void SAL_CALL       onTerminated();
138cdf0e10cSrcweir 
139cdf0e10cSrcweir public:
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 								TakeThread( TakeProgress* pProgess, TPGalleryThemeProperties* pBrowser, List& rTakenList );
142cdf0e10cSrcweir 	virtual                     ~TakeThread();
143cdf0e10cSrcweir };
144cdf0e10cSrcweir 
145cdf0e10cSrcweir // ----------------
146cdf0e10cSrcweir // - TakeProgress -
147cdf0e10cSrcweir // ----------------
148cdf0e10cSrcweir 
149cdf0e10cSrcweir class TakeProgress : public ModalDialog
150cdf0e10cSrcweir {
151cdf0e10cSrcweir private:
152cdf0e10cSrcweir 
153cdf0e10cSrcweir 	FixedText			aFtTakeFile;
154cdf0e10cSrcweir     FixedLine           aFLTakeProgress;
155cdf0e10cSrcweir 	CancelButton		aBtnCancel;
156cdf0e10cSrcweir 	TakeThread			maTakeThread;
157cdf0e10cSrcweir 	List				maTakenList;
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 						DECL_LINK( ClickCancelBtn, void* );
160cdf0e10cSrcweir 	void				Terminate();
161cdf0e10cSrcweir 
162cdf0e10cSrcweir public:
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 						TakeProgress( Window* pWindow );
~TakeProgress()165cdf0e10cSrcweir 						~TakeProgress() {};
166cdf0e10cSrcweir 
167cdf0e10cSrcweir 						DECL_LINK( CleanUpHdl, void* );
168cdf0e10cSrcweir 
SetFile(const INetURLObject & rURL)169cdf0e10cSrcweir 	void 				SetFile( const INetURLObject& rURL ) { aFtTakeFile.SetText( GetReducedString( rURL, 30 ) ); }
170cdf0e10cSrcweir 	virtual short		Execute();
171cdf0e10cSrcweir     virtual void        StartExecuteModal( const Link& rEndDialogHdl );
172cdf0e10cSrcweir };
173cdf0e10cSrcweir 
174cdf0e10cSrcweir // ---------------------
175cdf0e10cSrcweir // - ActualizeProgress -
176cdf0e10cSrcweir // ---------------------
177cdf0e10cSrcweir 
178cdf0e10cSrcweir class ActualizeProgress : public ModalDialog
179cdf0e10cSrcweir {
180cdf0e10cSrcweir private:
181cdf0e10cSrcweir 
182cdf0e10cSrcweir 	FixedText			aFtActualizeFile;
183cdf0e10cSrcweir     FixedLine           aFLActualizeProgress;
184cdf0e10cSrcweir 	CancelButton		aBtnCancel;
185cdf0e10cSrcweir 	Timer*				pTimer;
186cdf0e10cSrcweir 	GalleryTheme*		pTheme;
187cdf0e10cSrcweir 	GalleryProgress		aStatusProgress;
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 						DECL_LINK( ClickCancelBtn, void* );
190cdf0e10cSrcweir 						DECL_LINK( TimeoutHdl, Timer* );
191cdf0e10cSrcweir 						DECL_LINK( ActualizeHdl, INetURLObject* pURL );
192cdf0e10cSrcweir 
193cdf0e10cSrcweir public:
194cdf0e10cSrcweir 						ActualizeProgress( Window* pWindow, GalleryTheme* pThm );
~ActualizeProgress()195cdf0e10cSrcweir 						~ActualizeProgress() {};
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 	virtual short		Execute();
198cdf0e10cSrcweir };
199cdf0e10cSrcweir 
200cdf0e10cSrcweir // ---------------
201cdf0e10cSrcweir // - TitleDialog -
202cdf0e10cSrcweir // ---------------
203cdf0e10cSrcweir 
204cdf0e10cSrcweir class TitleDialog : public ModalDialog
205cdf0e10cSrcweir {
206cdf0e10cSrcweir private:
207cdf0e10cSrcweir 
208cdf0e10cSrcweir 	OKButton			maOk;
209cdf0e10cSrcweir 	CancelButton		maCancel;
210cdf0e10cSrcweir 	HelpButton			maHelp;
211cdf0e10cSrcweir     FixedLine           maFL;
212cdf0e10cSrcweir 	Edit				maEdit;
213cdf0e10cSrcweir 
214cdf0e10cSrcweir public:
215cdf0e10cSrcweir 
216cdf0e10cSrcweir 						TitleDialog( Window* pParent, const String& rOldText );
GetTitle() const217cdf0e10cSrcweir 	String				GetTitle() const { return maEdit.GetText(); }
218cdf0e10cSrcweir };
219cdf0e10cSrcweir 
220cdf0e10cSrcweir // -------------------
221cdf0e10cSrcweir // - GalleryIdDialog -
222cdf0e10cSrcweir // -------------------
223cdf0e10cSrcweir 
224cdf0e10cSrcweir class GalleryIdDialog : public ModalDialog
225cdf0e10cSrcweir {
226cdf0e10cSrcweir private:
227cdf0e10cSrcweir 
228cdf0e10cSrcweir 	OKButton		aBtnOk;
229cdf0e10cSrcweir 	CancelButton	aBtnCancel;
230cdf0e10cSrcweir     FixedLine       aFLId;
231cdf0e10cSrcweir 	ListBox			aLbResName;
232cdf0e10cSrcweir 	GalleryTheme*	pThm;
233cdf0e10cSrcweir 
234cdf0e10cSrcweir 					DECL_LINK( ClickOkHdl, void* );
235cdf0e10cSrcweir 					DECL_LINK( ClickResNameHdl, void* );
236cdf0e10cSrcweir 
237cdf0e10cSrcweir public:
238cdf0e10cSrcweir 
239cdf0e10cSrcweir 					GalleryIdDialog( Window* pParent, GalleryTheme* pThm );
~GalleryIdDialog()240cdf0e10cSrcweir 					~GalleryIdDialog() {}
241cdf0e10cSrcweir 
GetId() const242cdf0e10cSrcweir 	sal_uLong			GetId() const { return aLbResName.GetSelectEntryPos(); }
243cdf0e10cSrcweir };
244cdf0e10cSrcweir 
245cdf0e10cSrcweir // --------------------------
246cdf0e10cSrcweir // - GalleryThemeProperties -
247cdf0e10cSrcweir // --------------------------
248cdf0e10cSrcweir 
249cdf0e10cSrcweir class GalleryThemeProperties : public SfxTabDialog
250cdf0e10cSrcweir {
251cdf0e10cSrcweir 	ExchangeData*	pData;
252cdf0e10cSrcweir 
253cdf0e10cSrcweir 	virtual void	PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
254cdf0e10cSrcweir 
255cdf0e10cSrcweir public:
256cdf0e10cSrcweir 
257cdf0e10cSrcweir 					GalleryThemeProperties( Window* pParent, ExchangeData* pData, SfxItemSet* pItemSet  );
~GalleryThemeProperties()258cdf0e10cSrcweir 					~GalleryThemeProperties() {}
259cdf0e10cSrcweir };
260cdf0e10cSrcweir 
261cdf0e10cSrcweir // -------------------------
262cdf0e10cSrcweir // - TPGalleryThemeGeneral -
263cdf0e10cSrcweir // -------------------------
264cdf0e10cSrcweir 
265cdf0e10cSrcweir class TPGalleryThemeGeneral : public SfxTabPage
266cdf0e10cSrcweir {
267cdf0e10cSrcweir private:
268cdf0e10cSrcweir 
269cdf0e10cSrcweir 	FixedImage			aFiMSImage;
270cdf0e10cSrcweir 	Edit				aEdtMSName;
271cdf0e10cSrcweir 	FixedLine			aFlMSGeneralFirst;
272cdf0e10cSrcweir 	FixedText			aFtMSType;
273cdf0e10cSrcweir 	FixedText			aFtMSShowType;
274cdf0e10cSrcweir 	FixedText			aFtMSPath;
275cdf0e10cSrcweir 	FixedText			aFtMSShowPath;
276cdf0e10cSrcweir 	FixedText			aFtMSContent;
277cdf0e10cSrcweir 	FixedText			aFtMSShowContent;
278cdf0e10cSrcweir 	FixedLine			aFlMSGeneralSecond;
279cdf0e10cSrcweir 	FixedText			aFtMSChangeDate;
280cdf0e10cSrcweir 	FixedText			aFtMSShowChangeDate;
281cdf0e10cSrcweir 	ExchangeData*		pData;
282cdf0e10cSrcweir 
Reset(const SfxItemSet &)283cdf0e10cSrcweir 	virtual void		Reset( const SfxItemSet& ) {}
284cdf0e10cSrcweir 	virtual sal_Bool        FillItemSet( SfxItemSet& rSet );
285cdf0e10cSrcweir 
286cdf0e10cSrcweir 
287cdf0e10cSrcweir public:
288cdf0e10cSrcweir 
289cdf0e10cSrcweir 						TPGalleryThemeGeneral( Window* pParent, const SfxItemSet& rSet );
~TPGalleryThemeGeneral()290cdf0e10cSrcweir 						~TPGalleryThemeGeneral() {}
291cdf0e10cSrcweir 
292cdf0e10cSrcweir 	void				SetXChgData( ExchangeData* pData );
GetXChgData() const293cdf0e10cSrcweir 	const ExchangeData*	GetXChgData() const { return pData; }
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 	static SfxTabPage*	Create( Window* pParent, const SfxItemSet& rSet );
296cdf0e10cSrcweir };
297cdf0e10cSrcweir 
298cdf0e10cSrcweir // ----------------------------
299cdf0e10cSrcweir // - TPGalleryThemeProperties -
300cdf0e10cSrcweir // ----------------------------
301cdf0e10cSrcweir 
302cdf0e10cSrcweir class TPGalleryThemeProperties : public SfxTabPage
303cdf0e10cSrcweir {
304cdf0e10cSrcweir 	friend class SearchThread;
305cdf0e10cSrcweir 	friend class TakeProgress;
306cdf0e10cSrcweir 	friend class TakeThread;
307cdf0e10cSrcweir 
308cdf0e10cSrcweir 	FixedText			aFtFileType;
309cdf0e10cSrcweir 	ComboBox			aCbbFileType;
310cdf0e10cSrcweir     MultiListBox		aLbxFound;
311cdf0e10cSrcweir 	PushButton			aBtnSearch;
312cdf0e10cSrcweir 	PushButton			aBtnTake;
313cdf0e10cSrcweir 	PushButton			aBtnTakeAll;
314cdf0e10cSrcweir 	CheckBox			aCbxPreview;
315cdf0e10cSrcweir 	GalleryPreview		aWndPreview;
316cdf0e10cSrcweir 
317cdf0e10cSrcweir 	ExchangeData*		pData;
318cdf0e10cSrcweir 	StringList			aFoundList;
319cdf0e10cSrcweir 	List				aFilterEntryList;
320cdf0e10cSrcweir 	Timer				aPreviewTimer;
321cdf0e10cSrcweir 	String				aLastFilterName;
322cdf0e10cSrcweir 	String				aPreviewString;
323cdf0e10cSrcweir 	INetURLObject		aURL;
324cdf0e10cSrcweir 	sal_uInt16				nCurFilterPos;
325cdf0e10cSrcweir 	sal_uInt16				nFirstExtFilterPos;
326cdf0e10cSrcweir 	sal_Bool				bEntriesFound;
327cdf0e10cSrcweir 	sal_Bool				bInputAllowed;
328cdf0e10cSrcweir 	sal_Bool				bTakeAll;
329cdf0e10cSrcweir 	sal_Bool				bSearchRecursive;
330cdf0e10cSrcweir 
331cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::svt::DialogClosedListener >                  xDialogListener;
332cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer >             xMediaPlayer;
333cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker > xFolderPicker;
334cdf0e10cSrcweir 
Reset(const SfxItemSet &)335cdf0e10cSrcweir     virtual void        Reset( const SfxItemSet& /*rSet*/ ) {}
FillItemSet(SfxItemSet &)336cdf0e10cSrcweir     virtual sal_Bool        FillItemSet( SfxItemSet& /*rSet*/ ) { return sal_True; }
337cdf0e10cSrcweir 	::rtl::OUString 	addExtension( const ::rtl::OUString&, const ::rtl::OUString& );
338cdf0e10cSrcweir 	void				FillFilterList();
339cdf0e10cSrcweir 
340cdf0e10cSrcweir 	void				SearchFiles();
341cdf0e10cSrcweir 	void 				TakeFiles();
342cdf0e10cSrcweir 	void				DoPreview();
343cdf0e10cSrcweir 
344cdf0e10cSrcweir 						DECL_LINK( ClickPreviewHdl, void* );
345cdf0e10cSrcweir 						DECL_LINK( ClickCloseBrowserHdl, void* );
346cdf0e10cSrcweir 						DECL_LINK( ClickSearchHdl, void* );
347cdf0e10cSrcweir 						DECL_LINK( ClickTakeHdl, void* );
348cdf0e10cSrcweir 						DECL_LINK( ClickTakeAllHdl, void* );
349cdf0e10cSrcweir 						DECL_LINK( SelectFoundHdl, void* );
350cdf0e10cSrcweir 						DECL_LINK( SelectThemeHdl, void* );
351cdf0e10cSrcweir 						DECL_LINK( SelectFileTypeHdl, void* );
352cdf0e10cSrcweir 						DECL_LINK( DClickFoundHdl, void* );
353cdf0e10cSrcweir 						DECL_LINK( PreviewTimerHdl, void* );
354cdf0e10cSrcweir                         DECL_LINK( EndSearchProgressHdl, SearchProgress* );
355cdf0e10cSrcweir                         DECL_LINK( DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent* );
356cdf0e10cSrcweir 
357cdf0e10cSrcweir public:
358cdf0e10cSrcweir 						TPGalleryThemeProperties( Window* pWindow, const SfxItemSet& rSet );
359cdf0e10cSrcweir 						~TPGalleryThemeProperties();
360cdf0e10cSrcweir 
361cdf0e10cSrcweir 	void				SetXChgData( ExchangeData* pData );
GetXChgData() const362cdf0e10cSrcweir 	const ExchangeData*	GetXChgData() const { return pData; }
363cdf0e10cSrcweir 
364cdf0e10cSrcweir     void                StartSearchFiles( const String& _rFolderURL, short _nDlgResult );
365cdf0e10cSrcweir 
366cdf0e10cSrcweir 	static SfxTabPage*	Create( Window* pParent, const SfxItemSet& rSet );
367cdf0e10cSrcweir };
368cdf0e10cSrcweir 
369cdf0e10cSrcweir #endif // _CUI_GALDLG_HXX_
370