1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 _CUI_GALDLG_HXX_
21 #define _CUI_GALDLG_HXX_
23 #include "sal/config.h"
25 #include <salhelper/thread.hxx>
26 #include <vcl/dialog.hxx>
27 #include <vcl/graph.hxx>
28 #include <vcl/fixed.hxx>
29 #include <vcl/button.hxx>
30 #include <vcl/lstbox.hxx>
31 #include <vcl/menu.hxx>
32 #include <vcl/edit.hxx>
33 #include <vcl/combobox.hxx>
34 #include <svl/slstitm.hxx>
35 #include <svtools/transfer.hxx>
36 #include <svtools/grfmgr.hxx>
37 #include <sfx2/tabdlg.hxx>
38 #include <svx/galctrl.hxx>
39 #include <svx/galmisc.hxx>
40 #include <com/sun/star/media/XPlayer.hpp>
41 #include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
42 #include <svtools/dialogclosedlistener.hxx>
52 class TPGalleryThemeProperties
;
54 typedef ::std::vector
< UniString
* > StringList
;
55 typedef ::std::vector
< sal_uLong
> TokenList_impl
;
70 class SearchThread
: public salhelper::Thread
74 SearchProgress
* mpProgress
;
75 TPGalleryThemeProperties
* mpBrowser
;
76 INetURLObject maStartURL
;
78 void ImplSearch( const INetURLObject
& rStartURL
,
79 const ::std::vector
< String
>& rFormats
,
80 sal_Bool bRecursive
);
82 virtual ~SearchThread();
83 virtual void execute();
87 SearchThread( SearchProgress
* pProgess
,
88 TPGalleryThemeProperties
* pBrowser
,
89 const INetURLObject
& rStartURL
);
96 class SearchProgress
: public ModalDialog
100 FixedText aFtSearchDir
;
101 FixedLine aFLSearchDir
;
102 FixedText aFtSearchType
;
103 FixedLine aFLSearchType
;
104 CancelButton aBtnCancel
;
106 INetURLObject startUrl_
;
107 rtl::Reference
< SearchThread
> maSearchThread
;
109 DECL_LINK( ClickCancelBtn
, void* );
113 SearchProgress( Window
* pParent
, const INetURLObject
& rStartURL
);
114 ~SearchProgress() {};
116 DECL_LINK( CleanUpHdl
, void* );
118 virtual short Execute();
119 virtual void StartExecuteModal( const Link
& rEndDialogHdl
);
120 void SetFileType( const String
& rType
) { aFtSearchType
.SetText( rType
); }
121 void SetDirectory( const INetURLObject
& rURL
) { aFtSearchDir
.SetText( GetReducedString( rURL
, 30 ) ); }
128 class TakeThread
: public salhelper::Thread
132 TakeProgress
* mpProgress
;
133 TPGalleryThemeProperties
* mpBrowser
;
134 TokenList_impl
& mrTakenList
;
136 virtual ~TakeThread();
137 virtual void execute();
142 TakeProgress
* pProgess
,
143 TPGalleryThemeProperties
* pBrowser
,
144 TokenList_impl
& rTakenList
152 class TakeProgress
: public ModalDialog
156 FixedText aFtTakeFile
;
157 FixedLine aFLTakeProgress
;
158 CancelButton aBtnCancel
;
160 rtl::Reference
< TakeThread
> maTakeThread
;
161 TokenList_impl maTakenList
;
163 DECL_LINK( ClickCancelBtn
, void* );
168 TakeProgress( Window
* pWindow
);
171 DECL_LINK( CleanUpHdl
, void* );
173 void SetFile( const INetURLObject
& rURL
) { aFtTakeFile
.SetText( GetReducedString( rURL
, 30 ) ); }
174 virtual short Execute();
175 virtual void StartExecuteModal( const Link
& rEndDialogHdl
);
178 // ---------------------
179 // - ActualizeProgress -
180 // ---------------------
182 class ActualizeProgress
: public ModalDialog
186 FixedText aFtActualizeFile
;
187 FixedLine aFLActualizeProgress
;
188 CancelButton aBtnCancel
;
190 GalleryTheme
* pTheme
;
191 GalleryProgress aStatusProgress
;
193 DECL_LINK( ClickCancelBtn
, void* );
194 DECL_LINK( TimeoutHdl
, Timer
* );
195 DECL_LINK( ActualizeHdl
, INetURLObject
* pURL
);
198 ActualizeProgress( Window
* pWindow
, GalleryTheme
* pThm
);
199 ~ActualizeProgress() {};
201 virtual short Execute();
208 class TitleDialog
: public ModalDialog
213 CancelButton maCancel
;
220 TitleDialog( Window
* pParent
, const String
& rOldText
);
221 String
GetTitle() const { return maEdit
.GetText(); }
224 // -------------------
225 // - GalleryIdDialog -
226 // -------------------
228 class GalleryIdDialog
: public ModalDialog
233 CancelButton aBtnCancel
;
238 DECL_LINK( ClickOkHdl
, void* );
239 DECL_LINK( ClickResNameHdl
, void* );
243 GalleryIdDialog( Window
* pParent
, GalleryTheme
* pThm
);
244 ~GalleryIdDialog() {}
246 sal_uLong
GetId() const { return aLbResName
.GetSelectEntryPos(); }
249 // --------------------------
250 // - GalleryThemeProperties -
251 // --------------------------
253 class GalleryThemeProperties
: public SfxTabDialog
257 virtual void PageCreated( sal_uInt16 nId
, SfxTabPage
&rPage
);
261 GalleryThemeProperties( Window
* pParent
, ExchangeData
* pData
, SfxItemSet
* pItemSet
);
262 ~GalleryThemeProperties() {}
265 // -------------------------
266 // - TPGalleryThemeGeneral -
267 // -------------------------
269 class TPGalleryThemeGeneral
: public SfxTabPage
273 FixedImage aFiMSImage
;
275 FixedLine aFlMSGeneralFirst
;
277 FixedText aFtMSShowType
;
279 FixedText aFtMSShowPath
;
280 FixedText aFtMSContent
;
281 FixedText aFtMSShowContent
;
282 FixedLine aFlMSGeneralSecond
;
283 FixedText aFtMSChangeDate
;
284 FixedText aFtMSShowChangeDate
;
287 virtual void Reset( const SfxItemSet
& ) {}
288 virtual sal_Bool
FillItemSet( SfxItemSet
& rSet
);
293 TPGalleryThemeGeneral( Window
* pParent
, const SfxItemSet
& rSet
);
294 ~TPGalleryThemeGeneral() {}
296 void SetXChgData( ExchangeData
* pData
);
297 const ExchangeData
* GetXChgData() const { return pData
; }
299 static SfxTabPage
* Create( Window
* pParent
, const SfxItemSet
& rSet
);
302 // ----------------------------
303 // - TPGalleryThemeProperties -
304 // ----------------------------
305 typedef ::std::vector
< FilterEntry
* > FilterEntryList_impl
;
307 class TPGalleryThemeProperties
: public SfxTabPage
309 friend class SearchThread
;
310 friend class TakeProgress
;
311 friend class TakeThread
;
313 FixedText aFtFileType
;
314 ComboBox aCbbFileType
;
315 MultiListBox aLbxFound
;
316 PushButton aBtnSearch
;
318 PushButton aBtnTakeAll
;
319 CheckBox aCbxPreview
;
320 GalleryPreview aWndPreview
;
323 StringList aFoundList
;
324 FilterEntryList_impl aFilterEntryList
;
326 String aLastFilterName
;
327 String aPreviewString
;
329 sal_uInt16 nCurFilterPos
;
330 sal_uInt16 nFirstExtFilterPos
;
331 sal_Bool bEntriesFound
;
332 sal_Bool bInputAllowed
;
334 sal_Bool bSearchRecursive
;
336 ::com::sun::star::uno::Reference
< ::svt::DialogClosedListener
> xDialogListener
;
337 ::com::sun::star::uno::Reference
< ::com::sun::star::media::XPlayer
> xMediaPlayer
;
338 ::com::sun::star::uno::Reference
< ::com::sun::star::ui::dialogs::XFolderPicker2
> xFolderPicker
;
340 virtual void Reset( const SfxItemSet
& /*rSet*/ ) {}
341 virtual sal_Bool
FillItemSet( SfxItemSet
& /*rSet*/ ) { return sal_True
; }
342 ::rtl::OUString
addExtension( const ::rtl::OUString
&, const ::rtl::OUString
& );
343 void FillFilterList();
349 DECL_LINK( ClickPreviewHdl
, void* );
350 DECL_LINK( ClickSearchHdl
, void* );
351 DECL_LINK( ClickTakeHdl
, void* );
352 DECL_LINK( ClickTakeAllHdl
, void* );
353 DECL_LINK( SelectFoundHdl
, void* );
354 DECL_LINK( SelectThemeHdl
, void* );
355 DECL_LINK( SelectFileTypeHdl
, void* );
356 DECL_LINK( DClickFoundHdl
, void* );
357 DECL_LINK( PreviewTimerHdl
, void* );
358 DECL_LINK(EndSearchProgressHdl
, void *);
359 DECL_LINK( DialogClosedHdl
, ::com::sun::star::ui::dialogs::DialogClosedEvent
* );
362 TPGalleryThemeProperties( Window
* pWindow
, const SfxItemSet
& rSet
);
363 ~TPGalleryThemeProperties();
365 void SetXChgData( ExchangeData
* pData
);
366 const ExchangeData
* GetXChgData() const { return pData
; }
368 void StartSearchFiles( const String
& _rFolderURL
, short _nDlgResult
);
370 static SfxTabPage
* Create( Window
* pParent
, const SfxItemSet
& rSet
);
373 #endif // _CUI_GALDLG_HXX_
375 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */