bump product version to 5.0.4.1
[LibreOffice.git] / cui / source / inc / cuigaldlg.hxx
bloba2384403a36efa6abbd4903ab8143bbcfcc20034
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 INCLUDED_CUI_SOURCE_INC_CUIGALDLG_HXX
21 #define INCLUDED_CUI_SOURCE_INC_CUIGALDLG_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 <vcl/idle.hxx>
35 #include <svl/slstitm.hxx>
36 #include <svtools/transfer.hxx>
37 #include <svtools/grfmgr.hxx>
38 #include <sfx2/tabdlg.hxx>
39 #include <svx/galctrl.hxx>
40 #include <svx/galmisc.hxx>
41 #include <com/sun/star/media/XPlayer.hpp>
42 #include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
43 #include <svtools/dialogclosedlistener.hxx>
44 #include <vector>
46 class GalleryTheme;
47 class SearchProgress;
48 class TakeProgress;
49 class TPGalleryThemeProperties;
51 typedef ::std::vector< OUString > StringList;
52 typedef ::std::vector< sal_uLong > TokenList_impl;
54 struct FilterEntry
56 OUString aFilterName;
59 class SearchThread: public salhelper::Thread
61 private:
63 VclPtr<SearchProgress> mpProgress;
64 VclPtr<TPGalleryThemeProperties> mpBrowser;
65 INetURLObject maStartURL;
67 void ImplSearch( const INetURLObject& rStartURL,
68 const ::std::vector< OUString >& rFormats,
69 bool bRecursive );
71 virtual ~SearchThread();
72 virtual void execute() SAL_OVERRIDE;
74 public:
76 SearchThread( SearchProgress* pProgess,
77 TPGalleryThemeProperties* pBrowser,
78 const INetURLObject& rStartURL );
81 class SearchProgress : public ModalDialog
83 private:
84 VclPtr<FixedText> m_pFtSearchDir;
85 VclPtr<FixedText> m_pFtSearchType;
86 VclPtr<CancelButton> m_pBtnCancel;
87 VclPtr<vcl::Window> parent_;
88 INetURLObject startUrl_;
89 rtl::Reference< SearchThread > maSearchThread;
91 DECL_LINK( ClickCancelBtn, void* );
92 void Terminate();
94 public:
95 SearchProgress( vcl::Window* pParent, const INetURLObject& rStartURL );
96 virtual ~SearchProgress();
97 virtual void dispose() SAL_OVERRIDE;
99 DECL_LINK( CleanUpHdl, void* );
101 virtual short Execute() SAL_OVERRIDE;
102 virtual void StartExecuteModal( const Link<>& rEndDialogHdl ) SAL_OVERRIDE;
103 void SetFileType( const OUString& rType ) { m_pFtSearchType->SetText( rType ); }
104 void SetDirectory( const INetURLObject& rURL ) { m_pFtSearchDir->SetText( GetReducedString( rURL, 30 ) ); }
107 class TakeThread: public salhelper::Thread
109 private:
111 VclPtr<TakeProgress> mpProgress;
112 VclPtr<TPGalleryThemeProperties> mpBrowser;
113 TokenList_impl& mrTakenList;
115 virtual ~TakeThread();
116 virtual void execute() SAL_OVERRIDE;
118 public:
120 TakeThread(
121 TakeProgress* pProgess,
122 TPGalleryThemeProperties* pBrowser,
123 TokenList_impl& rTakenList
127 class TakeProgress : public ModalDialog
129 private:
130 VclPtr<FixedText> m_pFtTakeFile;
131 VclPtr<CancelButton> m_pBtnCancel;
132 VclPtr<vcl::Window> window_;
133 rtl::Reference< TakeThread > maTakeThread;
134 TokenList_impl maTakenList;
136 DECL_LINK( ClickCancelBtn, void* );
137 void Terminate();
139 public:
141 TakeProgress( vcl::Window* pWindow );
142 virtual ~TakeProgress();
143 virtual void dispose() SAL_OVERRIDE;
145 DECL_LINK( CleanUpHdl, void* );
147 void SetFile( const INetURLObject& rURL ) { m_pFtTakeFile->SetText( GetReducedString( rURL, 30 ) ); }
148 virtual short Execute() SAL_OVERRIDE;
149 virtual void StartExecuteModal( const Link<>& rEndDialogHdl ) SAL_OVERRIDE;
152 class ActualizeProgress : public ModalDialog
154 private:
155 VclPtr<FixedText> m_pFtActualizeFile;
156 VclPtr<CancelButton> m_pBtnCancel;
157 Idle* pIdle;
158 GalleryTheme* pTheme;
159 GalleryProgress aStatusProgress;
161 DECL_LINK( ClickCancelBtn, void* );
162 DECL_LINK_TYPED( TimeoutHdl, Idle*, void );
163 DECL_LINK( ActualizeHdl, INetURLObject* pURL );
165 public:
166 ActualizeProgress( vcl::Window* pWindow, GalleryTheme* pThm );
167 virtual ~ActualizeProgress();
168 virtual void dispose() SAL_OVERRIDE;
170 virtual short Execute() SAL_OVERRIDE;
173 class TitleDialog : public ModalDialog
175 private:
176 VclPtr<Edit> m_pEdit;
177 public:
178 TitleDialog(vcl::Window* pParent, const OUString& rOldText);
179 virtual ~TitleDialog();
180 virtual void dispose() SAL_OVERRIDE;
181 OUString GetTitle() const { return m_pEdit->GetText(); }
184 class GalleryIdDialog : public ModalDialog
186 private:
187 VclPtr<OKButton> m_pBtnOk;
188 VclPtr<ListBox> m_pLbResName;
189 GalleryTheme* pThm;
191 DECL_LINK( ClickOkHdl, void* );
192 DECL_LINK( ClickResNameHdl, void* );
193 public:
194 GalleryIdDialog( vcl::Window* pParent, GalleryTheme* pThm );
195 virtual ~GalleryIdDialog();
196 virtual void dispose() SAL_OVERRIDE;
197 sal_uLong GetId() const { return m_pLbResName->GetSelectEntryPos(); }
200 class GalleryThemeProperties : public SfxTabDialog
202 ExchangeData* pData;
204 sal_uInt16 m_nGeneralPageId;
205 sal_uInt16 m_nFilesPageId;
207 virtual void PageCreated(sal_uInt16 nId, SfxTabPage &rPage) SAL_OVERRIDE;
209 public:
210 GalleryThemeProperties(vcl::Window* pParent, ExchangeData* pData, SfxItemSet* pItemSet);
213 class TPGalleryThemeGeneral : public SfxTabPage
215 private:
217 VclPtr<FixedImage> m_pFiMSImage;
218 VclPtr<Edit> m_pEdtMSName;
219 VclPtr<FixedText> m_pFtMSShowType;
220 VclPtr<FixedText> m_pFtMSShowPath;
221 VclPtr<FixedText> m_pFtMSShowContent;
222 VclPtr<FixedText> m_pFtMSShowChangeDate;
223 ExchangeData* pData;
225 virtual void Reset( const SfxItemSet* ) SAL_OVERRIDE {}
226 virtual bool FillItemSet( SfxItemSet* rSet ) SAL_OVERRIDE;
229 public:
231 TPGalleryThemeGeneral( vcl::Window* pParent, const SfxItemSet& rSet );
232 virtual ~TPGalleryThemeGeneral();
233 virtual void dispose() SAL_OVERRIDE;
235 void SetXChgData( ExchangeData* pData );
236 const ExchangeData* GetXChgData() const { return pData; }
238 static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
241 typedef ::std::vector< FilterEntry* > FilterEntryList_impl;
243 class TPGalleryThemeProperties : public SfxTabPage
245 friend class SearchThread;
246 friend class TakeProgress;
247 friend class TakeThread;
249 VclPtr<ComboBox> m_pCbbFileType;
250 VclPtr<ListBox> m_pLbxFound;
251 VclPtr<PushButton> m_pBtnSearch;
252 VclPtr<PushButton> m_pBtnTake;
253 VclPtr<PushButton> m_pBtnTakeAll;
254 VclPtr<CheckBox> m_pCbxPreview;
255 VclPtr<GalleryPreview> m_pWndPreview;
257 ExchangeData* pData;
258 StringList aFoundList;
259 FilterEntryList_impl aFilterEntryList;
260 Timer aPreviewTimer;
261 OUString aLastFilterName;
262 OUString aPreviewString;
263 INetURLObject aURL;
264 sal_uInt16 nCurFilterPos;
265 sal_uInt16 nFirstExtFilterPos;
266 bool bEntriesFound;
267 bool bInputAllowed;
268 bool bTakeAll;
269 bool bSearchRecursive;
271 ::com::sun::star::uno::Reference< ::svt::DialogClosedListener > xDialogListener;
272 ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > xMediaPlayer;
273 ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker2 > xFolderPicker;
275 virtual void Reset( const SfxItemSet* /*rSet*/ ) SAL_OVERRIDE {}
276 virtual bool FillItemSet( SfxItemSet* /*rSet*/ ) SAL_OVERRIDE { return true; }
277 static OUString addExtension( const OUString&, const OUString& );
278 void FillFilterList();
280 void SearchFiles();
281 void TakeFiles();
282 void DoPreview();
284 DECL_LINK( ClickPreviewHdl, void* );
285 DECL_LINK( ClickSearchHdl, void* );
286 DECL_LINK( ClickTakeHdl, void* );
287 DECL_LINK( ClickTakeAllHdl, void* );
288 DECL_LINK( SelectFoundHdl, void* );
289 DECL_LINK( SelectThemeHdl, void* );
290 DECL_LINK( SelectFileTypeHdl, void* );
291 DECL_LINK( DClickFoundHdl, void* );
292 DECL_LINK_TYPED( PreviewTimerHdl, Timer*, void );
293 DECL_LINK(EndSearchProgressHdl, void *);
294 DECL_LINK( DialogClosedHdl, ::com::sun::star::ui::dialogs::DialogClosedEvent* );
296 public:
297 TPGalleryThemeProperties( vcl::Window* pWindow, const SfxItemSet& rSet );
298 virtual ~TPGalleryThemeProperties();
299 virtual void dispose() SAL_OVERRIDE;
301 void SetXChgData( ExchangeData* pData );
302 const ExchangeData* GetXChgData() const { return pData; }
304 void StartSearchFiles( const OUString& _rFolderURL, short _nDlgResult );
306 static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet );
309 #endif // INCLUDED_CUI_SOURCE_INC_CUIGALDLG_HXX
311 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */