Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / cui / source / inc / cuigaldlg.hxx
blobcac63d8a6b1e7ee03a3aab282f07c626e4dad03a
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 #pragma once
22 #include <sal/config.h>
24 #include <salhelper/thread.hxx>
25 #include <tools/urlobj.hxx>
26 #include <vcl/idle.hxx>
27 #include <sfx2/tabdlg.hxx>
28 #include <svx/galctrl.hxx>
29 #include <svx/galmisc.hxx>
30 #include <com/sun/star/media/XPlayer.hpp>
31 #include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
32 #include <svtools/dialogclosedlistener.hxx>
34 #include <string_view>
35 #include <vector>
37 class GalleryTheme;
38 class SearchProgress;
39 class TakeProgress;
40 class TPGalleryThemeProperties;
42 typedef std::vector< sal_Int32 > TokenList_impl;
44 struct FilterEntry
46 OUString aFilterName;
49 class SearchThread: public salhelper::Thread
51 private:
53 SearchProgress* mpProgress;
54 TPGalleryThemeProperties* mpBrowser;
55 INetURLObject maStartURL;
57 void ImplSearch( const INetURLObject& rStartURL,
58 const std::vector< OUString >& rFormats,
59 bool bRecursive );
61 virtual ~SearchThread() override;
62 virtual void execute() override;
64 public:
66 SearchThread(SearchProgress* pProgress,
67 TPGalleryThemeProperties* pBrowser,
68 INetURLObject aStartURL);
71 class SearchProgress : public weld::GenericDialogController
73 private:
74 INetURLObject startUrl_;
75 TPGalleryThemeProperties* m_pTabPage;
76 rtl::Reference< SearchThread > m_aSearchThread;
77 std::unique_ptr<weld::Label> m_xFtSearchDir;
78 std::unique_ptr<weld::Label> m_xFtSearchType;
79 std::unique_ptr<weld::Button> m_xBtnCancel;
81 DECL_LINK(ClickCancelBtn, weld::Button&, void);
83 public:
84 SearchProgress(weld::Window* pParent, TPGalleryThemeProperties* pTabPage, INetURLObject aStartURL);
85 void LaunchThread();
86 virtual ~SearchProgress() override;
88 DECL_LINK( CleanUpHdl, void*, void );
90 void SetFileType( const OUString& rType ) { m_xFtSearchType->set_label(rType); }
91 void SetDirectory( const INetURLObject& rURL ) { m_xFtSearchDir->set_label(GetReducedString(rURL, 30)); }
94 class TakeThread: public salhelper::Thread
96 private:
98 TakeProgress* mpProgress;
99 TPGalleryThemeProperties* mpBrowser;
100 TokenList_impl& mrTakenList;
102 virtual ~TakeThread() override;
103 virtual void execute() override;
105 public:
107 TakeThread(
108 TakeProgress* pProgress,
109 TPGalleryThemeProperties* pBrowser,
110 TokenList_impl& rTakenList
114 class TakeProgress : public weld::GenericDialogController
116 private:
117 weld::Window* m_pParent;
118 TPGalleryThemeProperties* m_pTabPage;
119 rtl::Reference< TakeThread > maTakeThread;
120 TokenList_impl maTakenList;
121 std::unique_ptr<weld::Label> m_xFtTakeFile;
122 std::unique_ptr<weld::Button> m_xBtnCancel;
124 DECL_LINK(ClickCancelBtn, weld::Button&, void);
126 public:
128 TakeProgress(weld::Window* pParent, TPGalleryThemeProperties* pTabPage);
129 void LaunchThread();
130 virtual ~TakeProgress() override;
132 DECL_LINK( CleanUpHdl, void*, void );
134 void SetFile( const INetURLObject& rURL ) { m_xFtTakeFile->set_label(GetReducedString(rURL, 30)); }
137 class ActualizeProgress : public weld::GenericDialogController
139 private:
140 Idle* pIdle;
141 GalleryTheme* pTheme;
142 GalleryProgress aStatusProgress;
143 std::unique_ptr<weld::Label> m_xFtActualizeFile;
144 std::unique_ptr<weld::Button> m_xBtnCancel;
146 DECL_LINK(ClickCancelBtn, weld::Button&, void);
147 DECL_LINK(TimeoutHdl, Timer*, void);
148 DECL_LINK(ActualizeHdl, const INetURLObject&, void);
150 public:
151 ActualizeProgress(weld::Widget* pWindow, GalleryTheme* pThm);
152 virtual ~ActualizeProgress() override;
154 virtual short run() override;
157 class TitleDialog : public weld::GenericDialogController
159 private:
160 std::unique_ptr<weld::Entry> m_xEdit;
161 public:
162 TitleDialog(weld::Widget* pParent, const OUString& rOldText);
163 virtual ~TitleDialog() override;
164 OUString GetTitle() const { return m_xEdit->get_text(); }
167 class GalleryIdDialog : public weld::GenericDialogController
169 private:
170 GalleryTheme* m_pThm;
171 std::unique_ptr<weld::Button> m_xBtnOk;
172 std::unique_ptr<weld::ComboBox> m_xLbResName;
174 DECL_LINK(ClickOkHdl, weld::Button&, void);
175 public:
176 GalleryIdDialog(weld::Widget* pParent, GalleryTheme* pThm);
177 virtual ~GalleryIdDialog() override;
178 sal_uInt32 GetId() const { return m_xLbResName->get_active(); }
181 class GalleryThemeProperties : public SfxTabDialogController
183 ExchangeData* pData;
185 virtual void PageCreated(const OUString& rId, SfxTabPage &rPage) override;
187 public:
188 GalleryThemeProperties(weld::Widget* pParent, ExchangeData* pData, SfxItemSet const * pItemSet);
191 class TPGalleryThemeGeneral : public SfxTabPage
193 private:
194 ExchangeData* pData;
196 std::unique_ptr<weld::Image> m_xFiMSImage;
197 std::unique_ptr<weld::Entry> m_xEdtMSName;
198 std::unique_ptr<weld::Label> m_xFtMSShowType;
199 std::unique_ptr<weld::Label> m_xFtMSShowPath;
200 std::unique_ptr<weld::Label> m_xFtMSShowContent;
201 std::unique_ptr<weld::Label> m_xFtMSShowChangeDate;
203 virtual void Reset( const SfxItemSet* ) override {}
204 virtual bool FillItemSet( SfxItemSet* rSet ) override;
206 public:
207 TPGalleryThemeGeneral(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
208 void SetXChgData( ExchangeData* pData );
209 static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
212 class TPGalleryThemeProperties : public SfxTabPage
214 friend class SearchThread;
215 friend class TakeProgress;
216 friend class TakeThread;
218 ExchangeData* pData;
219 std::vector<OUString> aFoundList;
220 std::vector< std::unique_ptr<FilterEntry> >
221 aFilterEntryList;
222 Timer aPreviewTimer;
223 OUString aLastFilterName;
224 OUString aPreviewString;
225 INetURLObject aURL;
226 bool bEntriesFound;
227 bool bInputAllowed;
228 bool bTakeAll;
229 bool bSearchRecursive;
231 rtl::Reference< ::svt::DialogClosedListener > xDialogListener;
232 css::uno::Reference< css::media::XPlayer > xMediaPlayer;
233 css::uno::Reference< css::ui::dialogs::XFolderPicker2 > xFolderPicker;
235 DialogGalleryPreview m_aWndPreview;
236 std::unique_ptr<weld::ComboBox> m_xCbbFileType;
237 std::unique_ptr<weld::TreeView> m_xLbxFound;
238 std::unique_ptr<weld::Button> m_xBtnSearch;
239 std::unique_ptr<weld::Button> m_xBtnTake;
240 std::unique_ptr<weld::Button> m_xBtnTakeAll;
241 std::unique_ptr<weld::CheckButton> m_xCbxPreview;
242 std::unique_ptr<weld::CustomWeld> m_xWndPreview;
244 virtual void Reset( const SfxItemSet* /*rSet*/ ) override {}
245 virtual bool FillItemSet( SfxItemSet* /*rSet*/ ) override { return true; }
246 static OUString addExtension( const OUString&, std::u16string_view );
247 void FillFilterList();
249 void SearchFiles();
250 void TakeFiles();
251 void DoPreview();
252 void EndSearchProgressHdl(sal_Int32 nResult);
254 DECL_LINK(ClickPreviewHdl, weld::Toggleable&, void);
255 DECL_LINK(ClickSearchHdl, weld::Button&, void);
256 DECL_LINK(ClickTakeHdl, weld::Button&, void);
257 DECL_LINK(ClickTakeAllHdl, weld::Button&, void);
258 DECL_LINK(SelectFoundHdl, weld::TreeView&, void);
259 DECL_LINK(SelectFileTypeHdl, weld::ComboBox&, void);
260 DECL_LINK(DClickFoundHdl, weld::TreeView&, bool);
261 DECL_LINK(PreviewTimerHdl, Timer*, void);
262 DECL_LINK(DialogClosedHdl, css::ui::dialogs::DialogClosedEvent*, void);
264 public:
265 TPGalleryThemeProperties(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
266 virtual ~TPGalleryThemeProperties() override;
268 void SetXChgData( ExchangeData* pData );
269 const ExchangeData* GetXChgData() const { return pData; }
271 void StartSearchFiles( std::u16string_view _rFolderURL, short _nDlgResult );
273 static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet);
276 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */