Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _CUI_GALDLG_HXX_
21 : #define _CUI_GALDLG_HXX_
22 :
23 : #include "sal/config.h"
24 :
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>
43 : #include <vector>
44 :
45 : class GalleryTheme;
46 : class SearchProgress;
47 : class TakeProgress;
48 : class TPGalleryThemeProperties;
49 :
50 : typedef ::std::vector< OUString > StringList;
51 : typedef ::std::vector< sal_uLong > TokenList_impl;
52 :
53 0 : struct FilterEntry
54 : {
55 : String aFilterName;
56 : };
57 :
58 : class SearchThread: public salhelper::Thread
59 : {
60 : private:
61 :
62 : SearchProgress* mpProgress;
63 : TPGalleryThemeProperties* mpBrowser;
64 : INetURLObject maStartURL;
65 :
66 : void ImplSearch( const INetURLObject& rStartURL,
67 : const ::std::vector< String >& rFormats,
68 : sal_Bool bRecursive );
69 :
70 : virtual ~SearchThread();
71 : virtual void execute();
72 :
73 : public:
74 :
75 : SearchThread( SearchProgress* pProgess,
76 : TPGalleryThemeProperties* pBrowser,
77 : const INetURLObject& rStartURL );
78 : };
79 :
80 : class SearchProgress : public ModalDialog
81 : {
82 : private:
83 :
84 : FixedText aFtSearchDir;
85 : FixedLine aFLSearchDir;
86 : FixedText aFtSearchType;
87 : FixedLine aFLSearchType;
88 : CancelButton aBtnCancel;
89 : Window * parent_;
90 : INetURLObject startUrl_;
91 : rtl::Reference< SearchThread > maSearchThread;
92 :
93 : DECL_LINK( ClickCancelBtn, void* );
94 : void Terminate();
95 :
96 : public:
97 : SearchProgress( Window* pParent, const INetURLObject& rStartURL );
98 0 : ~SearchProgress() {};
99 :
100 : DECL_LINK( CleanUpHdl, void* );
101 :
102 : virtual short Execute();
103 : virtual void StartExecuteModal( const Link& rEndDialogHdl );
104 0 : void SetFileType( const String& rType ) { aFtSearchType.SetText( rType ); }
105 0 : void SetDirectory( const INetURLObject& rURL ) { aFtSearchDir.SetText( GetReducedString( rURL, 30 ) ); }
106 : };
107 :
108 : class TakeThread: public salhelper::Thread
109 : {
110 : private:
111 :
112 : TakeProgress* mpProgress;
113 : TPGalleryThemeProperties* mpBrowser;
114 : TokenList_impl& mrTakenList;
115 :
116 : virtual ~TakeThread();
117 : virtual void execute();
118 :
119 : public:
120 :
121 : TakeThread(
122 : TakeProgress* pProgess,
123 : TPGalleryThemeProperties* pBrowser,
124 : TokenList_impl& rTakenList
125 : );
126 : };
127 :
128 : class TakeProgress : public ModalDialog
129 : {
130 : private:
131 :
132 : FixedText aFtTakeFile;
133 : FixedLine aFLTakeProgress;
134 : CancelButton aBtnCancel;
135 : Window * window_;
136 : rtl::Reference< TakeThread > maTakeThread;
137 : TokenList_impl maTakenList;
138 :
139 : DECL_LINK( ClickCancelBtn, void* );
140 : void Terminate();
141 :
142 : public:
143 :
144 : TakeProgress( Window* pWindow );
145 0 : ~TakeProgress() {};
146 :
147 : DECL_LINK( CleanUpHdl, void* );
148 :
149 0 : void SetFile( const INetURLObject& rURL ) { aFtTakeFile.SetText( GetReducedString( rURL, 30 ) ); }
150 : virtual short Execute();
151 : virtual void StartExecuteModal( const Link& rEndDialogHdl );
152 : };
153 :
154 : class ActualizeProgress : public ModalDialog
155 : {
156 : private:
157 :
158 : FixedText aFtActualizeFile;
159 : FixedLine aFLActualizeProgress;
160 : CancelButton aBtnCancel;
161 : Timer* pTimer;
162 : GalleryTheme* pTheme;
163 : GalleryProgress aStatusProgress;
164 :
165 : DECL_LINK( ClickCancelBtn, void* );
166 : DECL_LINK( TimeoutHdl, Timer* );
167 : DECL_LINK( ActualizeHdl, INetURLObject* pURL );
168 :
169 : public:
170 : ActualizeProgress( Window* pWindow, GalleryTheme* pThm );
171 0 : ~ActualizeProgress() {};
172 :
173 : virtual short Execute();
174 : };
175 :
176 0 : class TitleDialog : public ModalDialog
177 : {
178 : private:
179 :
180 : OKButton maOk;
181 : CancelButton maCancel;
182 : HelpButton maHelp;
183 : FixedLine maFL;
184 : Edit maEdit;
185 :
186 : public:
187 :
188 : TitleDialog( Window* pParent, const String& rOldText );
189 0 : String GetTitle() const { return maEdit.GetText(); }
190 : };
191 :
192 : class GalleryIdDialog : public ModalDialog
193 : {
194 : private:
195 :
196 : OKButton aBtnOk;
197 : CancelButton aBtnCancel;
198 : FixedLine aFLId;
199 : ListBox aLbResName;
200 : GalleryTheme* pThm;
201 :
202 : DECL_LINK( ClickOkHdl, void* );
203 : DECL_LINK( ClickResNameHdl, void* );
204 :
205 : public:
206 :
207 : GalleryIdDialog( Window* pParent, GalleryTheme* pThm );
208 0 : ~GalleryIdDialog() {}
209 :
210 0 : sal_uLong GetId() const { return aLbResName.GetSelectEntryPos(); }
211 : };
212 :
213 : class GalleryThemeProperties : public SfxTabDialog
214 : {
215 : ExchangeData* pData;
216 :
217 : virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
218 :
219 : public:
220 :
221 : GalleryThemeProperties( Window* pParent, ExchangeData* pData, SfxItemSet* pItemSet );
222 0 : ~GalleryThemeProperties() {}
223 : };
224 :
225 : class TPGalleryThemeGeneral : public SfxTabPage
226 : {
227 : private:
228 :
229 : FixedImage aFiMSImage;
230 : Edit aEdtMSName;
231 : FixedLine aFlMSGeneralFirst;
232 : FixedText aFtMSType;
233 : FixedText aFtMSShowType;
234 : FixedText aFtMSPath;
235 : FixedText aFtMSShowPath;
236 : FixedText aFtMSContent;
237 : FixedText aFtMSShowContent;
238 : FixedLine aFlMSGeneralSecond;
239 : FixedText aFtMSChangeDate;
240 : FixedText aFtMSShowChangeDate;
241 : ExchangeData* pData;
242 :
243 0 : virtual void Reset( const SfxItemSet& ) {}
244 : virtual sal_Bool FillItemSet( SfxItemSet& rSet );
245 :
246 :
247 : public:
248 :
249 : TPGalleryThemeGeneral( Window* pParent, const SfxItemSet& rSet );
250 0 : ~TPGalleryThemeGeneral() {}
251 :
252 : void SetXChgData( ExchangeData* pData );
253 : const ExchangeData* GetXChgData() const { return pData; }
254 :
255 : static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
256 : };
257 :
258 : typedef ::std::vector< FilterEntry* > FilterEntryList_impl;
259 :
260 : class TPGalleryThemeProperties : public SfxTabPage
261 : {
262 : friend class SearchThread;
263 : friend class TakeProgress;
264 : friend class TakeThread;
265 :
266 : FixedText aFtFileType;
267 : ComboBox aCbbFileType;
268 : MultiListBox aLbxFound;
269 : PushButton aBtnSearch;
270 : PushButton aBtnTake;
271 : PushButton aBtnTakeAll;
272 : CheckBox aCbxPreview;
273 : GalleryPreview aWndPreview;
274 :
275 : ExchangeData* pData;
276 : StringList aFoundList;
277 : FilterEntryList_impl aFilterEntryList;
278 : Timer aPreviewTimer;
279 : String aLastFilterName;
280 : String aPreviewString;
281 : INetURLObject aURL;
282 : sal_uInt16 nCurFilterPos;
283 : sal_uInt16 nFirstExtFilterPos;
284 : sal_Bool bEntriesFound;
285 : sal_Bool bInputAllowed;
286 : sal_Bool bTakeAll;
287 : sal_Bool bSearchRecursive;
288 :
289 : ::com::sun::star::uno::Reference< ::svt::DialogClosedListener > xDialogListener;
290 : ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > xMediaPlayer;
291 : ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker2 > xFolderPicker;
292 :
293 0 : virtual void Reset( const SfxItemSet& /*rSet*/ ) {}
294 0 : virtual sal_Bool FillItemSet( SfxItemSet& /*rSet*/ ) { return sal_True; }
295 : OUString addExtension( const OUString&, const OUString& );
296 : void FillFilterList();
297 :
298 : void SearchFiles();
299 : void TakeFiles();
300 : void DoPreview();
301 :
302 : DECL_LINK( ClickPreviewHdl, void* );
303 : DECL_LINK( ClickSearchHdl, void* );
304 : DECL_LINK( ClickTakeHdl, void* );
305 : DECL_LINK( ClickTakeAllHdl, void* );
306 : DECL_LINK( SelectFoundHdl, void* );
307 : DECL_LINK( SelectThemeHdl, void* );
308 : DECL_LINK( SelectFileTypeHdl, void* );
309 : DECL_LINK( DClickFoundHdl, void* );
310 : DECL_LINK( PreviewTimerHdl, void* );
311 : DECL_LINK(EndSearchProgressHdl, void *);
312 : DECL_LINK( DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent* );
313 :
314 : public:
315 : TPGalleryThemeProperties( Window* pWindow, const SfxItemSet& rSet );
316 : ~TPGalleryThemeProperties();
317 :
318 : void SetXChgData( ExchangeData* pData );
319 0 : const ExchangeData* GetXChgData() const { return pData; }
320 :
321 : void StartSearchFiles( const String& _rFolderURL, short _nDlgResult );
322 :
323 : static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
324 : };
325 :
326 : #endif // _CUI_GALDLG_HXX_
327 :
328 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|