Bump version to 6.4.7.2.M8
[LibreOffice.git] / cui / source / inc / cuigaldlg.hxx
blobf472d283b2fd56eb2bbf6ed2f88c27d6fa5288d5
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 <tools/urlobj.hxx>
27 #include <vcl/idle.hxx>
28 #include <sfx2/tabdlg.hxx>
29 #include <svx/galctrl.hxx>
30 #include <svx/galmisc.hxx>
31 #include <com/sun/star/media/XPlayer.hpp>
32 #include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
33 #include <svtools/dialogclosedlistener.hxx>
34 #include <vector>
36 class GalleryTheme;
37 class SearchProgress;
38 class TakeProgress;
39 class TPGalleryThemeProperties;
41 typedef std::vector< sal_uLong > TokenList_impl;
43 struct FilterEntry
45 OUString aFilterName;
48 class SearchThread: public salhelper::Thread
50 private:
52 SearchProgress* mpProgress;
53 TPGalleryThemeProperties* mpBrowser;
54 INetURLObject maStartURL;
56 void ImplSearch( const INetURLObject& rStartURL,
57 const std::vector< OUString >& rFormats,
58 bool bRecursive );
60 virtual ~SearchThread() override;
61 virtual void execute() override;
63 public:
65 SearchThread(SearchProgress* pProgress,
66 TPGalleryThemeProperties* pBrowser,
67 const INetURLObject& rStartURL);
70 class SearchProgress : public weld::GenericDialogController
72 private:
73 INetURLObject startUrl_;
74 TPGalleryThemeProperties* m_pTabPage;
75 rtl::Reference< SearchThread > m_aSearchThread;
76 std::unique_ptr<weld::Label> m_xFtSearchDir;
77 std::unique_ptr<weld::Label> m_xFtSearchType;
78 std::unique_ptr<weld::Button> m_xBtnCancel;
80 DECL_LINK(ClickCancelBtn, weld::Button&, void);
82 public:
83 SearchProgress(weld::Window* pParent, TPGalleryThemeProperties* pTabPage, const INetURLObject& rStartURL);
84 void LaunchThread();
85 virtual ~SearchProgress() override;
87 DECL_LINK( CleanUpHdl, void*, void );
89 void SetFileType( const OUString& rType ) { m_xFtSearchType->set_label(rType); }
90 void SetDirectory( const INetURLObject& rURL ) { m_xFtSearchDir->set_label(GetReducedString(rURL, 30)); }
93 class TakeThread: public salhelper::Thread
95 private:
97 TakeProgress* mpProgress;
98 TPGalleryThemeProperties* mpBrowser;
99 TokenList_impl& mrTakenList;
101 virtual ~TakeThread() override;
102 virtual void execute() override;
104 public:
106 TakeThread(
107 TakeProgress* pProgress,
108 TPGalleryThemeProperties* pBrowser,
109 TokenList_impl& rTakenList
113 class TakeProgress : public weld::GenericDialogController
115 private:
116 weld::Window* m_pParent;
117 TPGalleryThemeProperties* m_pTabPage;
118 rtl::Reference< TakeThread > maTakeThread;
119 TokenList_impl maTakenList;
120 std::unique_ptr<weld::Label> m_xFtTakeFile;
121 std::unique_ptr<weld::Button> m_xBtnCancel;
123 DECL_LINK(ClickCancelBtn, weld::Button&, void);
125 public:
127 TakeProgress(weld::Window* pParent, TPGalleryThemeProperties* pTabPage);
128 void LaunchThread();
129 virtual ~TakeProgress() override;
131 DECL_LINK( CleanUpHdl, void*, void );
133 void SetFile( const INetURLObject& rURL ) { m_xFtTakeFile->set_label(GetReducedString(rURL, 30)); }
136 class ActualizeProgress : public weld::GenericDialogController
138 private:
139 Idle* pIdle;
140 GalleryTheme* pTheme;
141 GalleryProgress aStatusProgress;
142 std::unique_ptr<weld::Label> m_xFtActualizeFile;
143 std::unique_ptr<weld::Button> m_xBtnCancel;
145 DECL_LINK(ClickCancelBtn, weld::Button&, void);
146 DECL_LINK(TimeoutHdl, Timer*, void);
147 DECL_LINK(ActualizeHdl, const INetURLObject&, void);
149 public:
150 ActualizeProgress(weld::Window* pWindow, GalleryTheme* pThm);
151 virtual ~ActualizeProgress() override;
153 virtual short run() override;
156 class TitleDialog : public weld::GenericDialogController
158 private:
159 std::unique_ptr<weld::Entry> m_xEdit;
160 public:
161 TitleDialog(weld::Window* pParent, const OUString& rOldText);
162 virtual ~TitleDialog() override;
163 OUString GetTitle() const { return m_xEdit->get_text(); }
166 class GalleryIdDialog : public weld::GenericDialogController
168 private:
169 GalleryTheme* m_pThm;
170 std::unique_ptr<weld::Button> m_xBtnOk;
171 std::unique_ptr<weld::ComboBox> m_xLbResName;
173 DECL_LINK(ClickOkHdl, weld::Button&, void);
174 public:
175 GalleryIdDialog(weld::Window* pParent, GalleryTheme* pThm);
176 virtual ~GalleryIdDialog() override;
177 sal_uInt32 GetId() const { return m_xLbResName->get_active(); }
180 class GalleryThemeProperties : public SfxTabDialogController
182 ExchangeData* pData;
184 virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
186 public:
187 GalleryThemeProperties(weld::Window* pParent, ExchangeData* pData, SfxItemSet const * pItemSet);
190 class TPGalleryThemeGeneral : public SfxTabPage
192 private:
193 ExchangeData* pData;
195 std::unique_ptr<weld::Image> m_xFiMSImage;
196 std::unique_ptr<weld::Entry> m_xEdtMSName;
197 std::unique_ptr<weld::Label> m_xFtMSShowType;
198 std::unique_ptr<weld::Label> m_xFtMSShowPath;
199 std::unique_ptr<weld::Label> m_xFtMSShowContent;
200 std::unique_ptr<weld::Label> m_xFtMSShowChangeDate;
202 virtual void Reset( const SfxItemSet* ) override {}
203 virtual bool FillItemSet( SfxItemSet* rSet ) override;
205 public:
206 TPGalleryThemeGeneral(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
207 void SetXChgData( ExchangeData* pData );
208 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
211 class TPGalleryThemeProperties : public SfxTabPage
213 friend class SearchThread;
214 friend class TakeProgress;
215 friend class TakeThread;
217 ExchangeData* pData;
218 std::vector<OUString> aFoundList;
219 std::vector< std::unique_ptr<FilterEntry> >
220 aFilterEntryList;
221 Timer aPreviewTimer;
222 OUString aLastFilterName;
223 OUString aPreviewString;
224 INetURLObject aURL;
225 bool bEntriesFound;
226 bool bInputAllowed;
227 bool bTakeAll;
228 bool bSearchRecursive;
230 rtl::Reference< ::svt::DialogClosedListener > xDialogListener;
231 css::uno::Reference< css::media::XPlayer > xMediaPlayer;
232 css::uno::Reference< css::ui::dialogs::XFolderPicker2 > xFolderPicker;
234 SvxGalleryPreview m_aWndPreview;
235 std::unique_ptr<weld::ComboBox> m_xCbbFileType;
236 std::unique_ptr<weld::TreeView> m_xLbxFound;
237 std::unique_ptr<weld::Button> m_xBtnSearch;
238 std::unique_ptr<weld::Button> m_xBtnTake;
239 std::unique_ptr<weld::Button> m_xBtnTakeAll;
240 std::unique_ptr<weld::CheckButton> m_xCbxPreview;
241 std::unique_ptr<weld::CustomWeld> m_xWndPreview;
243 virtual void Reset( const SfxItemSet* /*rSet*/ ) override {}
244 virtual bool FillItemSet( SfxItemSet* /*rSet*/ ) override { return true; }
245 static OUString addExtension( const OUString&, const OUString& );
246 void FillFilterList();
248 void SearchFiles();
249 void TakeFiles();
250 void DoPreview();
251 void EndSearchProgressHdl(sal_Int32 nResult);
253 DECL_LINK(ClickPreviewHdl, weld::ToggleButton&, void);
254 DECL_LINK(ClickSearchHdl, weld::Button&, void);
255 DECL_LINK(ClickTakeHdl, weld::Button&, void);
256 DECL_LINK(ClickTakeAllHdl, weld::Button&, void);
257 DECL_LINK(SelectFoundHdl, weld::TreeView&, void);
258 DECL_LINK(SelectFileTypeHdl, weld::ComboBox&, void);
259 DECL_LINK(DClickFoundHdl, weld::TreeView&, bool);
260 DECL_LINK(PreviewTimerHdl, Timer*, void);
261 DECL_LINK(DialogClosedHdl, css::ui::dialogs::DialogClosedEvent*, void);
263 public:
264 TPGalleryThemeProperties(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
265 virtual ~TPGalleryThemeProperties() override;
267 void SetXChgData( ExchangeData* pData );
268 const ExchangeData* GetXChgData() const { return pData; }
270 void StartSearchFiles( const OUString& _rFolderURL, short _nDlgResult );
272 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet);
275 #endif // INCLUDED_CUI_SOURCE_INC_CUIGALDLG_HXX
277 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */