Update ooo320-m1
[ooovba.git] / svx / source / cui / cuigaldlg.hxx
blob5290fd1cc204948f643e65aafeacba5b3492ae76
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cuigaldlg.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _CUI_GALDLG_HXX_
32 #define _CUI_GALDLG_HXX_
34 #include <vos/thread.hxx>
35 #include <vcl/dialog.hxx>
36 #include <vcl/graph.hxx>
37 #include <vcl/fixed.hxx>
38 #include <vcl/button.hxx>
39 #include <vcl/lstbox.hxx>
40 #include <vcl/menu.hxx>
41 #include <vcl/edit.hxx>
42 #include <vcl/combobox.hxx>
43 #include <svtools/slstitm.hxx>
44 #include <svtools/transfer.hxx>
45 #include <goodies/grfmgr.hxx>
46 #include <sfx2/tabdlg.hxx>
47 #include "galctrl.hxx"
48 #include "galmisc.hxx"
49 #include "galdlg.hxx" //CHINA001
50 #include <com/sun/star/media/XPlayer.hpp>
51 #ifndef _COM_SUN_STAR_UI_XFOLDERPICKER_HPP_
52 #include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
53 #endif
54 #include <svtools/dialogclosedlistener.hxx>
56 // ------------
57 // - Forwards -
58 // ------------
60 class Gallery;
61 class GalleryTheme;
62 class SearchProgress;
63 class TakeProgress;
64 class TPGalleryThemeProperties;
66 // ---------------
67 // - FilterEntry -
68 // ---------------
70 struct FilterEntry
72 String aFilterName;
75 // ----------------
76 // - SearchThread -
77 // ----------------
79 class SearchThread : public ::vos::OThread
81 private:
83 SearchProgress* mpProgress;
84 TPGalleryThemeProperties* mpBrowser;
85 INetURLObject maStartURL;
87 void ImplSearch( const INetURLObject& rStartURL,
88 const ::std::vector< String >& rFormats,
89 BOOL bRecursive );
91 virtual void SAL_CALL run();
92 virtual void SAL_CALL onTerminated();
94 public:
96 SearchThread( SearchProgress* pProgess,
97 TPGalleryThemeProperties* pBrowser,
98 const INetURLObject& rStartURL );
99 virtual ~SearchThread();
102 // ------------------
103 // - SearchProgress -
104 // ------------------
106 class SearchProgress : public ModalDialog
108 private:
110 FixedText aFtSearchDir;
111 FixedLine aFLSearchDir;
112 FixedText aFtSearchType;
113 FixedLine aFLSearchType;
114 CancelButton aBtnCancel;
115 SearchThread maSearchThread;
117 DECL_LINK( ClickCancelBtn, void* );
118 void Terminate();
120 public:
121 SearchProgress( Window* pParent, const INetURLObject& rStartURL );
122 ~SearchProgress() {};
124 DECL_LINK( CleanUpHdl, void* );
126 virtual short Execute();
127 virtual void StartExecuteModal( const Link& rEndDialogHdl );
128 void SetFileType( const String& rType ) { aFtSearchType.SetText( rType ); }
129 void SetDirectory( const INetURLObject& rURL ) { aFtSearchDir.SetText( GetReducedString( rURL, 30 ) ); }
132 // --------------
133 // - TakeThread -
134 // --------------
136 class TakeThread : public ::vos::OThread
138 private:
140 TakeProgress* mpProgress;
141 TPGalleryThemeProperties* mpBrowser;
142 List& mrTakenList;
144 virtual void SAL_CALL run();
145 virtual void SAL_CALL onTerminated();
147 public:
149 TakeThread( TakeProgress* pProgess, TPGalleryThemeProperties* pBrowser, List& rTakenList );
150 virtual ~TakeThread();
153 // ----------------
154 // - TakeProgress -
155 // ----------------
157 class TakeProgress : public ModalDialog
159 private:
161 FixedText aFtTakeFile;
162 FixedLine aFLTakeProgress;
163 CancelButton aBtnCancel;
164 TakeThread maTakeThread;
165 List maTakenList;
167 DECL_LINK( ClickCancelBtn, void* );
168 void Terminate();
170 public:
172 TakeProgress( Window* pWindow );
173 ~TakeProgress() {};
175 DECL_LINK( CleanUpHdl, void* );
177 void SetFile( const INetURLObject& rURL ) { aFtTakeFile.SetText( GetReducedString( rURL, 30 ) ); }
178 virtual short Execute();
179 virtual void StartExecuteModal( const Link& rEndDialogHdl );
182 // ---------------------
183 // - ActualizeProgress -
184 // ---------------------
186 class ActualizeProgress : public ModalDialog
188 private:
190 FixedText aFtActualizeFile;
191 FixedLine aFLActualizeProgress;
192 CancelButton aBtnCancel;
193 Timer* pTimer;
194 GalleryTheme* pTheme;
195 GalleryProgress aStatusProgress;
197 DECL_LINK( ClickCancelBtn, void* );
198 DECL_LINK( TimeoutHdl, Timer* );
199 DECL_LINK( ActualizeHdl, INetURLObject* pURL );
201 public:
202 ActualizeProgress( Window* pWindow, GalleryTheme* pThm );
203 ~ActualizeProgress() {};
205 virtual short Execute();
208 // ---------------
209 // - TitleDialog -
210 // ---------------
212 class TitleDialog : public ModalDialog
214 private:
216 OKButton maOk;
217 CancelButton maCancel;
218 HelpButton maHelp;
219 FixedLine maFL;
220 Edit maEdit;
222 public:
224 TitleDialog( Window* pParent, const String& rOldText );
225 String GetTitle() const { return maEdit.GetText(); }
228 // -------------------
229 // - GalleryIdDialog -
230 // -------------------
232 class GalleryIdDialog : public ModalDialog
234 private:
236 OKButton aBtnOk;
237 CancelButton aBtnCancel;
238 FixedLine aFLId;
239 ListBox aLbResName;
240 GalleryTheme* pThm;
242 DECL_LINK( ClickOkHdl, void* );
243 DECL_LINK( ClickResNameHdl, void* );
245 public:
247 GalleryIdDialog( Window* pParent, GalleryTheme* pThm );
248 ~GalleryIdDialog() {}
250 ULONG GetId() const { return aLbResName.GetSelectEntryPos(); }
253 // --------------------------
254 // - GalleryThemeProperties -
255 // --------------------------
257 class GalleryThemeProperties : public SfxTabDialog
259 ExchangeData* pData;
261 virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
263 public:
265 GalleryThemeProperties( Window* pParent, ExchangeData* pData, SfxItemSet* pItemSet );
266 ~GalleryThemeProperties() {}
269 // -------------------------
270 // - TPGalleryThemeGeneral -
271 // -------------------------
273 class TPGalleryThemeGeneral : public SfxTabPage
275 private:
277 FixedImage aFiMSImage;
278 Edit aEdtMSName;
279 FixedLine aFlMSGeneralFirst;
280 FixedText aFtMSType;
281 FixedText aFtMSShowType;
282 FixedText aFtMSPath;
283 FixedText aFtMSShowPath;
284 FixedText aFtMSContent;
285 FixedText aFtMSShowContent;
286 FixedLine aFlMSGeneralSecond;
287 FixedText aFtMSChangeDate;
288 FixedText aFtMSShowChangeDate;
289 ExchangeData* pData;
291 virtual void Reset( const SfxItemSet& ) {}
292 virtual BOOL FillItemSet( SfxItemSet& rSet );
295 public:
297 TPGalleryThemeGeneral( Window* pParent, const SfxItemSet& rSet );
298 ~TPGalleryThemeGeneral() {}
300 void SetXChgData( ExchangeData* pData );
301 const ExchangeData* GetXChgData() const { return pData; }
303 static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
306 // ----------------------------
307 // - TPGalleryThemeProperties -
308 // ----------------------------
310 class TPGalleryThemeProperties : public SfxTabPage
312 friend class SearchThread;
313 friend class TakeProgress;
314 friend class TakeThread;
316 PushButton aBtnSearch;
317 PushButton aBtnTake;
318 PushButton aBtnTakeAll;
319 CheckBox aCbxPreview;
320 ComboBox aCbbFileType;
321 MultiListBox aLbxFound;
322 FixedText aFtFileType;
323 GalleryPreview aWndPreview;
325 ExchangeData* pData;
326 StringList aFoundList;
327 List aFilterEntryList;
328 Timer aPreviewTimer;
329 String aLastFilterName;
330 String aPreviewString;
331 INetURLObject aURL;
332 USHORT nCurFilterPos;
333 USHORT nFirstExtFilterPos;
334 BOOL bEntriesFound;
335 BOOL bInputAllowed;
336 BOOL bTakeAll;
337 BOOL bSearchRecursive;
339 ::com::sun::star::uno::Reference< ::svt::DialogClosedListener > xDialogListener;
340 ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > xMediaPlayer;
341 ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker > xFolderPicker;
343 virtual void Reset( const SfxItemSet& /*rSet*/ ) {}
344 virtual BOOL FillItemSet( SfxItemSet& /*rSet*/ ) { return TRUE; }
345 ::rtl::OUString addExtension( const ::rtl::OUString&, const ::rtl::OUString& );
346 void FillFilterList();
348 void SearchFiles();
349 void TakeFiles();
350 void DoPreview();
352 DECL_LINK( ClickPreviewHdl, void* );
353 DECL_LINK( ClickCloseBrowserHdl, void* );
354 DECL_LINK( ClickSearchHdl, void* );
355 DECL_LINK( ClickTakeHdl, void* );
356 DECL_LINK( ClickTakeAllHdl, void* );
357 DECL_LINK( SelectFoundHdl, void* );
358 DECL_LINK( SelectThemeHdl, void* );
359 DECL_LINK( SelectFileTypeHdl, void* );
360 DECL_LINK( DClickFoundHdl, void* );
361 DECL_LINK( PreviewTimerHdl, void* );
362 DECL_LINK( EndSearchProgressHdl, SearchProgress* );
363 DECL_LINK( DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent* );
365 public:
366 TPGalleryThemeProperties( Window* pWindow, const SfxItemSet& rSet );
367 ~TPGalleryThemeProperties();
369 void SetXChgData( ExchangeData* pData );
370 const ExchangeData* GetXChgData() const { return pData; }
372 void StartSearchFiles( const String& _rFolderURL, short _nDlgResult );
374 static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
377 #endif // _CUI_GALDLG_HXX_