Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / cui / source / inc / cuigaldlg.hxx
blob6c7e489929fdaf0c852fc3f0e5db22d497495e5b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
43 #include <vector>
45 // ------------
46 // - Forwards -
47 // ------------
49 class GalleryTheme;
50 class SearchProgress;
51 class TakeProgress;
52 class TPGalleryThemeProperties;
54 typedef ::std::vector< UniString* > StringList;
55 typedef ::std::vector< sal_uLong > TokenList_impl;
57 // ---------------
58 // - FilterEntry -
59 // ---------------
61 struct FilterEntry
63 String aFilterName;
66 // ----------------
67 // - SearchThread -
68 // ----------------
70 class SearchThread: public salhelper::Thread
72 private:
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();
85 public:
87 SearchThread( SearchProgress* pProgess,
88 TPGalleryThemeProperties* pBrowser,
89 const INetURLObject& rStartURL );
92 // ------------------
93 // - SearchProgress -
94 // ------------------
96 class SearchProgress : public ModalDialog
98 private:
100 FixedText aFtSearchDir;
101 FixedLine aFLSearchDir;
102 FixedText aFtSearchType;
103 FixedLine aFLSearchType;
104 CancelButton aBtnCancel;
105 Window * parent_;
106 INetURLObject startUrl_;
107 rtl::Reference< SearchThread > maSearchThread;
109 DECL_LINK( ClickCancelBtn, void* );
110 void Terminate();
112 public:
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 ) ); }
124 // --------------
125 // - TakeThread -
126 // --------------
128 class TakeThread: public salhelper::Thread
130 private:
132 TakeProgress* mpProgress;
133 TPGalleryThemeProperties* mpBrowser;
134 TokenList_impl& mrTakenList;
136 virtual ~TakeThread();
137 virtual void execute();
139 public:
141 TakeThread(
142 TakeProgress* pProgess,
143 TPGalleryThemeProperties* pBrowser,
144 TokenList_impl& rTakenList
148 // ----------------
149 // - TakeProgress -
150 // ----------------
152 class TakeProgress : public ModalDialog
154 private:
156 FixedText aFtTakeFile;
157 FixedLine aFLTakeProgress;
158 CancelButton aBtnCancel;
159 Window * window_;
160 rtl::Reference< TakeThread > maTakeThread;
161 TokenList_impl maTakenList;
163 DECL_LINK( ClickCancelBtn, void* );
164 void Terminate();
166 public:
168 TakeProgress( Window* pWindow );
169 ~TakeProgress() {};
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
184 private:
186 FixedText aFtActualizeFile;
187 FixedLine aFLActualizeProgress;
188 CancelButton aBtnCancel;
189 Timer* pTimer;
190 GalleryTheme* pTheme;
191 GalleryProgress aStatusProgress;
193 DECL_LINK( ClickCancelBtn, void* );
194 DECL_LINK( TimeoutHdl, Timer* );
195 DECL_LINK( ActualizeHdl, INetURLObject* pURL );
197 public:
198 ActualizeProgress( Window* pWindow, GalleryTheme* pThm );
199 ~ActualizeProgress() {};
201 virtual short Execute();
204 // ---------------
205 // - TitleDialog -
206 // ---------------
208 class TitleDialog : public ModalDialog
210 private:
212 OKButton maOk;
213 CancelButton maCancel;
214 HelpButton maHelp;
215 FixedLine maFL;
216 Edit maEdit;
218 public:
220 TitleDialog( Window* pParent, const String& rOldText );
221 String GetTitle() const { return maEdit.GetText(); }
224 // -------------------
225 // - GalleryIdDialog -
226 // -------------------
228 class GalleryIdDialog : public ModalDialog
230 private:
232 OKButton aBtnOk;
233 CancelButton aBtnCancel;
234 FixedLine aFLId;
235 ListBox aLbResName;
236 GalleryTheme* pThm;
238 DECL_LINK( ClickOkHdl, void* );
239 DECL_LINK( ClickResNameHdl, void* );
241 public:
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
255 ExchangeData* pData;
257 virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage );
259 public:
261 GalleryThemeProperties( Window* pParent, ExchangeData* pData, SfxItemSet* pItemSet );
262 ~GalleryThemeProperties() {}
265 // -------------------------
266 // - TPGalleryThemeGeneral -
267 // -------------------------
269 class TPGalleryThemeGeneral : public SfxTabPage
271 private:
273 FixedImage aFiMSImage;
274 Edit aEdtMSName;
275 FixedLine aFlMSGeneralFirst;
276 FixedText aFtMSType;
277 FixedText aFtMSShowType;
278 FixedText aFtMSPath;
279 FixedText aFtMSShowPath;
280 FixedText aFtMSContent;
281 FixedText aFtMSShowContent;
282 FixedLine aFlMSGeneralSecond;
283 FixedText aFtMSChangeDate;
284 FixedText aFtMSShowChangeDate;
285 ExchangeData* pData;
287 virtual void Reset( const SfxItemSet& ) {}
288 virtual sal_Bool FillItemSet( SfxItemSet& rSet );
291 public:
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;
317 PushButton aBtnTake;
318 PushButton aBtnTakeAll;
319 CheckBox aCbxPreview;
320 GalleryPreview aWndPreview;
322 ExchangeData* pData;
323 StringList aFoundList;
324 FilterEntryList_impl aFilterEntryList;
325 Timer aPreviewTimer;
326 String aLastFilterName;
327 String aPreviewString;
328 INetURLObject aURL;
329 sal_uInt16 nCurFilterPos;
330 sal_uInt16 nFirstExtFilterPos;
331 sal_Bool bEntriesFound;
332 sal_Bool bInputAllowed;
333 sal_Bool bTakeAll;
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();
345 void SearchFiles();
346 void TakeFiles();
347 void DoPreview();
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* );
361 public:
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: */