Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _CUI_GALDLG_HXX_
30 : : #define _CUI_GALDLG_HXX_
31 : :
32 : : #include "sal/config.h"
33 : :
34 : : #include <salhelper/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 <svl/slstitm.hxx>
44 : : #include <svtools/transfer.hxx>
45 : : #include <svtools/grfmgr.hxx>
46 : : #include <sfx2/tabdlg.hxx>
47 : : #include <svx/galctrl.hxx>
48 : : #include <svx/galmisc.hxx>
49 : : #include <com/sun/star/media/XPlayer.hpp>
50 : : #include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
51 : : #include <svtools/dialogclosedlistener.hxx>
52 : : #include <vector>
53 : :
54 : : // ------------
55 : : // - Forwards -
56 : : // ------------
57 : :
58 : : class GalleryTheme;
59 : : class SearchProgress;
60 : : class TakeProgress;
61 : : class TPGalleryThemeProperties;
62 : :
63 : : typedef ::std::vector< UniString* > StringList;
64 : : typedef ::std::vector< sal_uLong > TokenList_impl;
65 : :
66 : : // ---------------
67 : : // - FilterEntry -
68 : : // ---------------
69 : :
70 : 0 : struct FilterEntry
71 : : {
72 : : String aFilterName;
73 : : };
74 : :
75 : : // ----------------
76 : : // - SearchThread -
77 : : // ----------------
78 : :
79 : : class SearchThread: public salhelper::Thread
80 : : {
81 : : private:
82 : :
83 : : SearchProgress* mpProgress;
84 : : TPGalleryThemeProperties* mpBrowser;
85 : : INetURLObject maStartURL;
86 : :
87 : : void ImplSearch( const INetURLObject& rStartURL,
88 : : const ::std::vector< String >& rFormats,
89 : : sal_Bool bRecursive );
90 : :
91 : : virtual ~SearchThread();
92 : : virtual void execute();
93 : :
94 : : public:
95 : :
96 : : SearchThread( SearchProgress* pProgess,
97 : : TPGalleryThemeProperties* pBrowser,
98 : : const INetURLObject& rStartURL );
99 : : };
100 : :
101 : : // ------------------
102 : : // - SearchProgress -
103 : : // ------------------
104 : :
105 : : class SearchProgress : public ModalDialog
106 : : {
107 : : private:
108 : :
109 : : FixedText aFtSearchDir;
110 : : FixedLine aFLSearchDir;
111 : : FixedText aFtSearchType;
112 : : FixedLine aFLSearchType;
113 : : CancelButton aBtnCancel;
114 : : Window * parent_;
115 : : INetURLObject startUrl_;
116 : : rtl::Reference< SearchThread > maSearchThread;
117 : :
118 : : DECL_LINK( ClickCancelBtn, void* );
119 : : void Terminate();
120 : :
121 : : public:
122 : : SearchProgress( Window* pParent, const INetURLObject& rStartURL );
123 [ # # ][ # # ]: 0 : ~SearchProgress() {};
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
124 : :
125 : : DECL_LINK( CleanUpHdl, void* );
126 : :
127 : : virtual short Execute();
128 : : virtual void StartExecuteModal( const Link& rEndDialogHdl );
129 : 0 : void SetFileType( const String& rType ) { aFtSearchType.SetText( rType ); }
130 [ # # ]: 0 : void SetDirectory( const INetURLObject& rURL ) { aFtSearchDir.SetText( GetReducedString( rURL, 30 ) ); }
131 : : };
132 : :
133 : : // --------------
134 : : // - TakeThread -
135 : : // --------------
136 : :
137 : : class TakeThread: public salhelper::Thread
138 : : {
139 : : private:
140 : :
141 : : TakeProgress* mpProgress;
142 : : TPGalleryThemeProperties* mpBrowser;
143 : : TokenList_impl& mrTakenList;
144 : :
145 : : virtual ~TakeThread();
146 : : virtual void execute();
147 : :
148 : : public:
149 : :
150 : : TakeThread(
151 : : TakeProgress* pProgess,
152 : : TPGalleryThemeProperties* pBrowser,
153 : : TokenList_impl& rTakenList
154 : : );
155 : : };
156 : :
157 : : // ----------------
158 : : // - TakeProgress -
159 : : // ----------------
160 : :
161 : : class TakeProgress : public ModalDialog
162 : : {
163 : : private:
164 : :
165 : : FixedText aFtTakeFile;
166 : : FixedLine aFLTakeProgress;
167 : : CancelButton aBtnCancel;
168 : : Window * window_;
169 : : rtl::Reference< TakeThread > maTakeThread;
170 : : TokenList_impl maTakenList;
171 : :
172 : : DECL_LINK( ClickCancelBtn, void* );
173 : : void Terminate();
174 : :
175 : : public:
176 : :
177 : : TakeProgress( Window* pWindow );
178 [ # # ][ # # ]: 0 : ~TakeProgress() {};
[ # # ][ # # ]
[ # # ]
179 : :
180 : : DECL_LINK( CleanUpHdl, void* );
181 : :
182 [ # # ]: 0 : void SetFile( const INetURLObject& rURL ) { aFtTakeFile.SetText( GetReducedString( rURL, 30 ) ); }
183 : : virtual short Execute();
184 : : virtual void StartExecuteModal( const Link& rEndDialogHdl );
185 : : };
186 : :
187 : : // ---------------------
188 : : // - ActualizeProgress -
189 : : // ---------------------
190 : :
191 : : class ActualizeProgress : public ModalDialog
192 : : {
193 : : private:
194 : :
195 : : FixedText aFtActualizeFile;
196 : : FixedLine aFLActualizeProgress;
197 : : CancelButton aBtnCancel;
198 : : Timer* pTimer;
199 : : GalleryTheme* pTheme;
200 : : GalleryProgress aStatusProgress;
201 : :
202 : : DECL_LINK( ClickCancelBtn, void* );
203 : : DECL_LINK( TimeoutHdl, Timer* );
204 : : DECL_LINK( ActualizeHdl, INetURLObject* pURL );
205 : :
206 : : public:
207 : : ActualizeProgress( Window* pWindow, GalleryTheme* pThm );
208 [ # # ][ # # ]: 0 : ~ActualizeProgress() {};
[ # # ][ # # ]
[ # # ]
209 : :
210 : : virtual short Execute();
211 : : };
212 : :
213 : : // ---------------
214 : : // - TitleDialog -
215 : : // ---------------
216 : :
217 [ # # ][ # # ]: 0 : class TitleDialog : public ModalDialog
[ # # ][ # # ]
[ # # ][ # # ]
218 : : {
219 : : private:
220 : :
221 : : OKButton maOk;
222 : : CancelButton maCancel;
223 : : HelpButton maHelp;
224 : : FixedLine maFL;
225 : : Edit maEdit;
226 : :
227 : : public:
228 : :
229 : : TitleDialog( Window* pParent, const String& rOldText );
230 : 0 : String GetTitle() const { return maEdit.GetText(); }
231 : : };
232 : :
233 : : // -------------------
234 : : // - GalleryIdDialog -
235 : : // -------------------
236 : :
237 : : class GalleryIdDialog : public ModalDialog
238 : : {
239 : : private:
240 : :
241 : : OKButton aBtnOk;
242 : : CancelButton aBtnCancel;
243 : : FixedLine aFLId;
244 : : ListBox aLbResName;
245 : : GalleryTheme* pThm;
246 : :
247 : : DECL_LINK( ClickOkHdl, void* );
248 : : DECL_LINK( ClickResNameHdl, void* );
249 : :
250 : : public:
251 : :
252 : : GalleryIdDialog( Window* pParent, GalleryTheme* pThm );
253 [ # # ][ # # ]: 0 : ~GalleryIdDialog() {}
[ # # ][ # # ]
[ # # ]
254 : :
255 : 0 : sal_uLong GetId() const { return aLbResName.GetSelectEntryPos(); }
256 : : };
257 : :
258 : : // --------------------------
259 : : // - GalleryThemeProperties -
260 : : // --------------------------
261 : :
262 : : class GalleryThemeProperties : public SfxTabDialog
263 : : {
264 : : ExchangeData* pData;
265 : :
266 : : virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
267 : :
268 : : public:
269 : :
270 : : GalleryThemeProperties( Window* pParent, ExchangeData* pData, SfxItemSet* pItemSet );
271 [ # # ]: 0 : ~GalleryThemeProperties() {}
272 : : };
273 : :
274 : : // -------------------------
275 : : // - TPGalleryThemeGeneral -
276 : : // -------------------------
277 : :
278 : : class TPGalleryThemeGeneral : public SfxTabPage
279 : : {
280 : : private:
281 : :
282 : : FixedImage aFiMSImage;
283 : : Edit aEdtMSName;
284 : : FixedLine aFlMSGeneralFirst;
285 : : FixedText aFtMSType;
286 : : FixedText aFtMSShowType;
287 : : FixedText aFtMSPath;
288 : : FixedText aFtMSShowPath;
289 : : FixedText aFtMSContent;
290 : : FixedText aFtMSShowContent;
291 : : FixedLine aFlMSGeneralSecond;
292 : : FixedText aFtMSChangeDate;
293 : : FixedText aFtMSShowChangeDate;
294 : : ExchangeData* pData;
295 : :
296 : 0 : virtual void Reset( const SfxItemSet& ) {}
297 : : virtual sal_Bool FillItemSet( SfxItemSet& rSet );
298 : :
299 : :
300 : : public:
301 : :
302 : : TPGalleryThemeGeneral( Window* pParent, const SfxItemSet& rSet );
303 [ # # ][ # # ]: 0 : ~TPGalleryThemeGeneral() {}
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
304 : :
305 : : void SetXChgData( ExchangeData* pData );
306 : : const ExchangeData* GetXChgData() const { return pData; }
307 : :
308 : : static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
309 : : };
310 : :
311 : : // ----------------------------
312 : : // - TPGalleryThemeProperties -
313 : : // ----------------------------
314 : : typedef ::std::vector< FilterEntry* > FilterEntryList_impl;
315 : :
316 : : class TPGalleryThemeProperties : public SfxTabPage
317 : : {
318 : : friend class SearchThread;
319 : : friend class TakeProgress;
320 : : friend class TakeThread;
321 : :
322 : : FixedText aFtFileType;
323 : : ComboBox aCbbFileType;
324 : : MultiListBox aLbxFound;
325 : : PushButton aBtnSearch;
326 : : PushButton aBtnTake;
327 : : PushButton aBtnTakeAll;
328 : : CheckBox aCbxPreview;
329 : : GalleryPreview aWndPreview;
330 : :
331 : : ExchangeData* pData;
332 : : StringList aFoundList;
333 : : FilterEntryList_impl aFilterEntryList;
334 : : Timer aPreviewTimer;
335 : : String aLastFilterName;
336 : : String aPreviewString;
337 : : INetURLObject aURL;
338 : : sal_uInt16 nCurFilterPos;
339 : : sal_uInt16 nFirstExtFilterPos;
340 : : sal_Bool bEntriesFound;
341 : : sal_Bool bInputAllowed;
342 : : sal_Bool bTakeAll;
343 : : sal_Bool bSearchRecursive;
344 : :
345 : : ::com::sun::star::uno::Reference< ::svt::DialogClosedListener > xDialogListener;
346 : : ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > xMediaPlayer;
347 : : ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker > xFolderPicker;
348 : :
349 : 0 : virtual void Reset( const SfxItemSet& /*rSet*/ ) {}
350 : 0 : virtual sal_Bool FillItemSet( SfxItemSet& /*rSet*/ ) { return sal_True; }
351 : : ::rtl::OUString addExtension( const ::rtl::OUString&, const ::rtl::OUString& );
352 : : void FillFilterList();
353 : :
354 : : void SearchFiles();
355 : : void TakeFiles();
356 : : void DoPreview();
357 : :
358 : : DECL_LINK( ClickPreviewHdl, void* );
359 : : DECL_LINK( ClickSearchHdl, void* );
360 : : DECL_LINK( ClickTakeHdl, void* );
361 : : DECL_LINK( ClickTakeAllHdl, void* );
362 : : DECL_LINK( SelectFoundHdl, void* );
363 : : DECL_LINK( SelectThemeHdl, void* );
364 : : DECL_LINK( SelectFileTypeHdl, void* );
365 : : DECL_LINK( DClickFoundHdl, void* );
366 : : DECL_LINK( PreviewTimerHdl, void* );
367 : : DECL_LINK(EndSearchProgressHdl, void *);
368 : : DECL_LINK( DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent* );
369 : :
370 : : public:
371 : : TPGalleryThemeProperties( Window* pWindow, const SfxItemSet& rSet );
372 : : ~TPGalleryThemeProperties();
373 : :
374 : : void SetXChgData( ExchangeData* pData );
375 : 0 : const ExchangeData* GetXChgData() const { return pData; }
376 : :
377 : : void StartSearchFiles( const String& _rFolderURL, short _nDlgResult );
378 : :
379 : : static SfxTabPage* Create( Window* pParent, const SfxItemSet& rSet );
380 : : };
381 : :
382 : : #endif // _CUI_GALDLG_HXX_
383 : :
384 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|