1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cuigaldlg.hxx,v $
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>
54 #include <svtools/dialogclosedlistener.hxx>
64 class TPGalleryThemeProperties
;
79 class SearchThread
: public ::vos::OThread
83 SearchProgress
* mpProgress
;
84 TPGalleryThemeProperties
* mpBrowser
;
85 INetURLObject maStartURL
;
87 void ImplSearch( const INetURLObject
& rStartURL
,
88 const ::std::vector
< String
>& rFormats
,
91 virtual void SAL_CALL
run();
92 virtual void SAL_CALL
onTerminated();
96 SearchThread( SearchProgress
* pProgess
,
97 TPGalleryThemeProperties
* pBrowser
,
98 const INetURLObject
& rStartURL
);
99 virtual ~SearchThread();
102 // ------------------
103 // - SearchProgress -
104 // ------------------
106 class SearchProgress
: public ModalDialog
110 FixedText aFtSearchDir
;
111 FixedLine aFLSearchDir
;
112 FixedText aFtSearchType
;
113 FixedLine aFLSearchType
;
114 CancelButton aBtnCancel
;
115 SearchThread maSearchThread
;
117 DECL_LINK( ClickCancelBtn
, void* );
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 ) ); }
136 class TakeThread
: public ::vos::OThread
140 TakeProgress
* mpProgress
;
141 TPGalleryThemeProperties
* mpBrowser
;
144 virtual void SAL_CALL
run();
145 virtual void SAL_CALL
onTerminated();
149 TakeThread( TakeProgress
* pProgess
, TPGalleryThemeProperties
* pBrowser
, List
& rTakenList
);
150 virtual ~TakeThread();
157 class TakeProgress
: public ModalDialog
161 FixedText aFtTakeFile
;
162 FixedLine aFLTakeProgress
;
163 CancelButton aBtnCancel
;
164 TakeThread maTakeThread
;
167 DECL_LINK( ClickCancelBtn
, void* );
172 TakeProgress( Window
* pWindow
);
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
190 FixedText aFtActualizeFile
;
191 FixedLine aFLActualizeProgress
;
192 CancelButton aBtnCancel
;
194 GalleryTheme
* pTheme
;
195 GalleryProgress aStatusProgress
;
197 DECL_LINK( ClickCancelBtn
, void* );
198 DECL_LINK( TimeoutHdl
, Timer
* );
199 DECL_LINK( ActualizeHdl
, INetURLObject
* pURL
);
202 ActualizeProgress( Window
* pWindow
, GalleryTheme
* pThm
);
203 ~ActualizeProgress() {};
205 virtual short Execute();
212 class TitleDialog
: public ModalDialog
217 CancelButton maCancel
;
224 TitleDialog( Window
* pParent
, const String
& rOldText
);
225 String
GetTitle() const { return maEdit
.GetText(); }
228 // -------------------
229 // - GalleryIdDialog -
230 // -------------------
232 class GalleryIdDialog
: public ModalDialog
237 CancelButton aBtnCancel
;
242 DECL_LINK( ClickOkHdl
, void* );
243 DECL_LINK( ClickResNameHdl
, void* );
247 GalleryIdDialog( Window
* pParent
, GalleryTheme
* pThm
);
248 ~GalleryIdDialog() {}
250 ULONG
GetId() const { return aLbResName
.GetSelectEntryPos(); }
253 // --------------------------
254 // - GalleryThemeProperties -
255 // --------------------------
257 class GalleryThemeProperties
: public SfxTabDialog
261 virtual void PageCreated( USHORT nId
, SfxTabPage
&rPage
);
265 GalleryThemeProperties( Window
* pParent
, ExchangeData
* pData
, SfxItemSet
* pItemSet
);
266 ~GalleryThemeProperties() {}
269 // -------------------------
270 // - TPGalleryThemeGeneral -
271 // -------------------------
273 class TPGalleryThemeGeneral
: public SfxTabPage
277 FixedImage aFiMSImage
;
279 FixedLine aFlMSGeneralFirst
;
281 FixedText aFtMSShowType
;
283 FixedText aFtMSShowPath
;
284 FixedText aFtMSContent
;
285 FixedText aFtMSShowContent
;
286 FixedLine aFlMSGeneralSecond
;
287 FixedText aFtMSChangeDate
;
288 FixedText aFtMSShowChangeDate
;
291 virtual void Reset( const SfxItemSet
& ) {}
292 virtual BOOL
FillItemSet( SfxItemSet
& rSet
);
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
;
318 PushButton aBtnTakeAll
;
319 CheckBox aCbxPreview
;
320 ComboBox aCbbFileType
;
321 MultiListBox aLbxFound
;
322 FixedText aFtFileType
;
323 GalleryPreview aWndPreview
;
326 StringList aFoundList
;
327 List aFilterEntryList
;
329 String aLastFilterName
;
330 String aPreviewString
;
332 USHORT nCurFilterPos
;
333 USHORT nFirstExtFilterPos
;
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();
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
* );
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_